From c16533e97aa6e0e9c36af846bbbb0a457df26a79 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 25 Mar 2022 23:49:02 +0100 Subject: [PATCH] feat: don't show non / blank elements initially Can be easily modeled via existing UI controls. --- src/append-menu/AppendMenu.js | 4 +++- src/create-menu/CreateMenu.js | 4 +++- src/create-menu/CreateOptions.js | 11 +++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/append-menu/AppendMenu.js b/src/append-menu/AppendMenu.js index 9e4d326..d0e493d 100644 --- a/src/append-menu/AppendMenu.js +++ b/src/append-menu/AppendMenu.js @@ -58,6 +58,7 @@ AppendMenu.prototype._getDefaultEntries = function() { actionName, className, label, + rating, target } = option; @@ -65,6 +66,7 @@ AppendMenu.prototype._getDefaultEntries = function() { label, id: `create-${actionName}`, className, + rating, action: () => { return this._elementFactory.create('shape', { ...target }); } @@ -194,7 +196,7 @@ function AppendMenuComponent(props) { const filter = (template) => { if (!value) { - return true; + return template.rating !== -1; } const search = [ diff --git a/src/create-menu/CreateMenu.js b/src/create-menu/CreateMenu.js index 05f88a7..19d3865 100644 --- a/src/create-menu/CreateMenu.js +++ b/src/create-menu/CreateMenu.js @@ -49,6 +49,7 @@ CreateMenu.prototype._getDefaultEntries = function() { actionName, className, label, + rating, target } = option; @@ -56,6 +57,7 @@ CreateMenu.prototype._getDefaultEntries = function() { label, id: `create-${actionName}`, className, + rating, action: () => { return this._elementFactory.create('shape', { ...target }); } @@ -177,7 +179,7 @@ function CreateMenuComponent(props) { const filter = (template) => { if (!value) { - return true; + return template.rating !== -1; } const search = [ diff --git a/src/create-menu/CreateOptions.js b/src/create-menu/CreateOptions.js index bba3033..8a7ace0 100644 --- a/src/create-menu/CreateOptions.js +++ b/src/create-menu/CreateOptions.js @@ -3,6 +3,7 @@ export var NONE_EVENTS = [ label: 'Start Event', actionName: 'replace-non-start-event', className: 'bpmn-icon-start-event-none', + rating: -1, target: { type: 'bpmn:StartEvent' } @@ -11,6 +12,7 @@ export var NONE_EVENTS = [ label: 'Intermediate Throw Event', actionName: 'replace-with-none-intermediate-throwing', className: 'bpmn-icon-intermediate-event-none', + rating: -1, target: { type: 'bpmn:IntermediateThrowEvent' } @@ -19,6 +21,7 @@ export var NONE_EVENTS = [ label: 'Boundary Event', actionName: 'replace-with-boundary-event', className: 'bpmn-icon-intermediate-event-none', + rating: -1, target: { type: 'bpmn:IntermediateThrowEvent' } @@ -27,6 +30,7 @@ export var NONE_EVENTS = [ label: 'End Event', actionName: 'replace-with-none-end', className: 'bpmn-icon-end-event-none', + rating: -1, target: { type: 'bpmn:EndEvent' } @@ -383,6 +387,7 @@ export var GATEWAY = [ label: 'Inclusive Gateway', actionName: 'replace-with-inclusive-gateway', className: 'bpmn-icon-gateway-or', + rating: -1, target: { type: 'bpmn:InclusiveGateway' } @@ -391,6 +396,7 @@ export var GATEWAY = [ label: 'Complex Gateway', actionName: 'replace-with-complex-gateway', className: 'bpmn-icon-gateway-complex', + rating: -1, target: { type: 'bpmn:ComplexGateway' } @@ -452,6 +458,7 @@ export var TASK = [ label: 'Task', actionName: 'replace-with-task', className: 'bpmn-icon-task', + rating: -1, target: { type: 'bpmn:Task' } @@ -460,6 +467,7 @@ export var TASK = [ label: 'Send Task', actionName: 'replace-with-send-task', className: 'bpmn-icon-send', + rating: -1, target: { type: 'bpmn:SendTask' } @@ -468,6 +476,7 @@ export var TASK = [ label: 'Receive Task', actionName: 'replace-with-receive-task', className: 'bpmn-icon-receive', + rating: -1, target: { type: 'bpmn:ReceiveTask' } @@ -484,6 +493,7 @@ export var TASK = [ label: 'Manual Task', actionName: 'replace-with-manual-task', className: 'bpmn-icon-manual', + rating: -1, target: { type: 'bpmn:ManualTask' } @@ -508,6 +518,7 @@ export var TASK = [ label: 'Script Task', actionName: 'replace-with-script-task', className: 'bpmn-icon-script', + rating: -1, target: { type: 'bpmn:ScriptTask' }