From cf291b998927ced6fac88509956639346578652a 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 | 6 ++++-- src/create-menu/CreateMenu.js | 8 ++++---- src/create-menu/CreateOptions.js | 11 +++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/append-menu/AppendMenu.js b/src/append-menu/AppendMenu.js index f4dafcc..c879b8b 100644 --- a/src/append-menu/AppendMenu.js +++ b/src/append-menu/AppendMenu.js @@ -65,7 +65,8 @@ AppendMenu.prototype._getDefaultEntries = function() { target, description, category, - search + search, + rating } = option; return { @@ -75,6 +76,7 @@ AppendMenu.prototype._getDefaultEntries = function() { description, category, search, + rating, action: () => { return this._elementFactory.create('shape', { ...target }); } @@ -211,7 +213,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 12a92f9..35aecb8 100644 --- a/src/create-menu/CreateMenu.js +++ b/src/create-menu/CreateMenu.js @@ -49,10 +49,10 @@ CreateMenu.prototype._getDefaultEntries = function() { actionName, className, label, - rating, - target, category, - search + search, + rating, + target } = option; return { @@ -188,7 +188,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 83341f9..598d711 100644 --- a/src/create-menu/CreateOptions.js +++ b/src/create-menu/CreateOptions.js @@ -33,6 +33,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' } @@ -41,6 +42,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' } @@ -49,6 +51,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' } @@ -57,6 +60,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' } @@ -414,6 +418,7 @@ export var GATEWAY = [ search: 'or', actionName: 'replace-with-inclusive-gateway', className: 'bpmn-icon-gateway-or', + rating: -1, target: { type: 'bpmn:InclusiveGateway' } @@ -422,6 +427,7 @@ export var GATEWAY = [ label: 'Complex Gateway', actionName: 'replace-with-complex-gateway', className: 'bpmn-icon-gateway-complex', + rating: -1, target: { type: 'bpmn:ComplexGateway' } @@ -486,6 +492,7 @@ export var TASK = [ label: 'Task', actionName: 'replace-with-task', className: 'bpmn-icon-task', + rating: -1, target: { type: 'bpmn:Task' } @@ -494,6 +501,7 @@ export var TASK = [ label: 'Send Task', actionName: 'replace-with-send-task', className: 'bpmn-icon-send', + rating: -1, target: { type: 'bpmn:SendTask' } @@ -502,6 +510,7 @@ export var TASK = [ label: 'Receive Task', actionName: 'replace-with-receive-task', className: 'bpmn-icon-receive', + rating: -1, target: { type: 'bpmn:ReceiveTask' } @@ -518,6 +527,7 @@ export var TASK = [ label: 'Manual Task', actionName: 'replace-with-manual-task', className: 'bpmn-icon-manual', + rating: -1, target: { type: 'bpmn:ManualTask' } @@ -542,6 +552,7 @@ export var TASK = [ label: 'Script Task', actionName: 'replace-with-script-task', className: 'bpmn-icon-script', + rating: -1, target: { type: 'bpmn:ScriptTask' }