@bpmn-io/form-js-editor 0.8.0-alpha.0 → 0.8.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -4,10 +4,10 @@ import Ids from 'ids';
4
4
  import { isArray, isFunction, isNumber, bind, assign, debounce, sortBy, find, get, set, isUndefined, without, has, forEach, isObject, uniqueBy, isString } from 'min-dash';
5
5
  import { createContext, createElement, render } from 'preact';
6
6
  import { useContext, useState, useEffect, useRef, useCallback, useMemo } from 'preact/hooks';
7
- import React from 'preact/compat';
8
- import { jsxs, jsx } from 'preact/jsx-runtime';
9
7
  import classnames from 'classnames';
10
- import { query, matches, closest, event } from 'min-dom';
8
+ import React from 'preact/compat';
9
+ import { jsx, jsxs } from 'preact/jsx-runtime';
10
+ import { query, matches, closest, event, domify } from 'min-dom';
11
11
  import dragula from 'dragula';
12
12
  import { mutate } from 'array-move';
13
13
 
@@ -766,251 +766,6 @@ function useService (type, strict) {
766
766
  return getService(type, strict);
767
767
  }
768
768
 
769
- function _extends$b() { _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
770
- var ButtonIcon = (({
771
- styles = {},
772
- ...props
773
- }) => /*#__PURE__*/React.createElement("svg", _extends$b({
774
- xmlns: "http://www.w3.org/2000/svg",
775
- width: "54",
776
- height: "54"
777
- }, props), /*#__PURE__*/React.createElement("path", {
778
- fillRule: "evenodd",
779
- d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
780
- })));
781
-
782
- function _extends$a() { _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
783
- var CheckboxIcon = (({
784
- styles = {},
785
- ...props
786
- }) => /*#__PURE__*/React.createElement("svg", _extends$a({
787
- xmlns: "http://www.w3.org/2000/svg",
788
- width: "54",
789
- height: "54"
790
- }, props), /*#__PURE__*/React.createElement("path", {
791
- d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
792
- })));
793
-
794
- function _extends$9() { _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
795
- var ChecklistIcon = (({
796
- styles = {},
797
- ...props
798
- }) => /*#__PURE__*/React.createElement("svg", _extends$9({
799
- width: "54",
800
- height: "54",
801
- fill: "none",
802
- xmlns: "http://www.w3.org/2000/svg"
803
- }, props), /*#__PURE__*/React.createElement("path", {
804
- fillRule: "evenodd",
805
- clipRule: "evenodd",
806
- d: "M19 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6 18h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6-30h-6v6h6V8zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2V8a2 2 0 00-2-2h-6z",
807
- fill: "#22242A"
808
- }), /*#__PURE__*/React.createElement("path", {
809
- d: "M26 26a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0 16a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0-32a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2z",
810
- fill: "#22242A"
811
- })));
812
-
813
- function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
814
- var TaglistIcon = (({
815
- styles = {},
816
- ...props
817
- }) => /*#__PURE__*/React.createElement("svg", _extends$8({
818
- width: "54",
819
- height: "54",
820
- fill: "none",
821
- xmlns: "http://www.w3.org/2000/svg"
822
- }, props), /*#__PURE__*/React.createElement("path", {
823
- fillRule: "evenodd",
824
- clipRule: "evenodd",
825
- d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z",
826
- fill: "#000"
827
- }), /*#__PURE__*/React.createElement("path", {
828
- d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
829
- fill: "#505562"
830
- })));
831
-
832
- function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
833
- var FormIcon = (({
834
- styles = {},
835
- ...props
836
- }) => /*#__PURE__*/React.createElement("svg", _extends$7({
837
- xmlns: "http://www.w3.org/2000/svg",
838
- width: "54",
839
- height: "54"
840
- }, props), /*#__PURE__*/React.createElement("rect", {
841
- x: "15",
842
- y: "17",
843
- width: "24",
844
- height: "4",
845
- rx: "1"
846
- }), /*#__PURE__*/React.createElement("rect", {
847
- x: "15",
848
- y: "25",
849
- width: "24",
850
- height: "4",
851
- rx: "1"
852
- }), /*#__PURE__*/React.createElement("rect", {
853
- x: "15",
854
- y: "33",
855
- width: "13",
856
- height: "4",
857
- rx: "1"
858
- })));
859
-
860
- function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
861
- var ColumnsIcon = (({
862
- styles = {},
863
- ...props
864
- }) => /*#__PURE__*/React.createElement("svg", _extends$6({
865
- xmlns: "http://www.w3.org/2000/svg",
866
- width: "54",
867
- height: "54"
868
- }, props), /*#__PURE__*/React.createElement("path", {
869
- fillRule: "evenodd",
870
- d: "M8 33v5a1 1 0 001 1h4v2H9a3 3 0 01-3-3v-5h2zm18 6v2H15v-2h11zm13 0v2H28v-2h11zm9-6v5a3 3 0 01-3 3h-4v-2h4a1 1 0 00.993-.883L46 38v-5h2zM8 22v9H6v-9h2zm40 0v9h-2v-9h2zm-35-9v2H9a1 1 0 00-.993.883L8 16v4H6v-4a3 3 0 013-3h4zm32 0a3 3 0 013 3v4h-2v-4a1 1 0 00-.883-.993L45 15h-4v-2h4zm-6 0v2H28v-2h11zm-13 0v2H15v-2h11z"
871
- })));
872
-
873
- function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
874
- var NumberIcon = (({
875
- styles = {},
876
- ...props
877
- }) => /*#__PURE__*/React.createElement("svg", _extends$5({
878
- xmlns: "http://www.w3.org/2000/svg",
879
- width: "54",
880
- height: "54"
881
- }, props), /*#__PURE__*/React.createElement("path", {
882
- fillRule: "evenodd",
883
- d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
884
- })));
885
-
886
- function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
887
- var RadioIcon = (({
888
- styles = {},
889
- ...props
890
- }) => /*#__PURE__*/React.createElement("svg", _extends$4({
891
- xmlns: "http://www.w3.org/2000/svg",
892
- width: "54",
893
- height: "54"
894
- }, props), /*#__PURE__*/React.createElement("path", {
895
- d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
896
- })));
897
-
898
- function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
899
- var SelectIcon = (({
900
- styles = {},
901
- ...props
902
- }) => /*#__PURE__*/React.createElement("svg", _extends$3({
903
- xmlns: "http://www.w3.org/2000/svg",
904
- width: "54",
905
- height: "54"
906
- }, props), /*#__PURE__*/React.createElement("path", {
907
- fillRule: "evenodd",
908
- d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
909
- })));
910
-
911
- function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
912
- var TextIcon = (({
913
- styles = {},
914
- ...props
915
- }) => /*#__PURE__*/React.createElement("svg", _extends$2({
916
- xmlns: "http://www.w3.org/2000/svg",
917
- width: "54",
918
- height: "54"
919
- }, props), /*#__PURE__*/React.createElement("path", {
920
- d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36l-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 012.4.14 3.42 3.42 0 011.41.55 3.47 3.47 0 011 1.14 3 3 0 01.42 1.58 3.26 3.26 0 01-1.91 2.94 3.63 3.63 0 011.91 1.22 3.28 3.28 0 01.66 2 4 4 0 01-.43 1.8 3.63 3.63 0 01-1.09 1.4 3.89 3.89 0 01-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 001.1-.49 1.41 1.41 0 00.41-1 1.49 1.49 0 00-.35-1 1.54 1.54 0 00-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 001.88-.09 1.65 1.65 0 001-.54 1.6 1.6 0 00.38-1.14 1.75 1.75 0 00-.29-1 1.69 1.69 0 00-.86-.62 9.28 9.28 0 00-2.41-.23zM44.35 28.79l2.65.84a5.94 5.94 0 01-2 3.29A5.74 5.74 0 0141.38 34a5.87 5.87 0 01-4.44-1.84 7.09 7.09 0 01-1.73-5A7.43 7.43 0 0137 21.87 6 6 0 0141.54 20a5.64 5.64 0 014 1.47A5.33 5.33 0 0147 24l-2.7.65a2.8 2.8 0 00-2.86-2.27A3.09 3.09 0 0039 23.42a5.31 5.31 0 00-.93 3.5 5.62 5.62 0 00.93 3.65 3 3 0 002.4 1.09 2.72 2.72 0 001.82-.66 4 4 0 001.13-2.21z"
921
- })));
922
-
923
- function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
924
- var TextfieldIcon = (({
925
- styles = {},
926
- ...props
927
- }) => /*#__PURE__*/React.createElement("svg", _extends$1({
928
- xmlns: "http://www.w3.org/2000/svg",
929
- width: "54",
930
- height: "54"
931
- }, props), /*#__PURE__*/React.createElement("path", {
932
- fillRule: "evenodd",
933
- d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-32 4v10h-2V22h2z"
934
- })));
935
-
936
- const iconsByType = {
937
- button: ButtonIcon,
938
- checkbox: CheckboxIcon,
939
- checklist: ChecklistIcon,
940
- columns: ColumnsIcon,
941
- number: NumberIcon,
942
- radio: RadioIcon,
943
- select: SelectIcon,
944
- taglist: TaglistIcon,
945
- text: TextIcon,
946
- textfield: TextfieldIcon,
947
- default: FormIcon
948
- };
949
-
950
- const types = [{
951
- label: 'Text Field',
952
- type: 'textfield'
953
- }, {
954
- label: 'Number',
955
- type: 'number'
956
- }, {
957
- label: 'Checkbox',
958
- type: 'checkbox'
959
- }, {
960
- label: 'Checklist',
961
- type: 'checklist'
962
- }, {
963
- label: 'Taglist',
964
- type: 'taglist'
965
- }, {
966
- label: 'Radio',
967
- type: 'radio'
968
- }, {
969
- label: 'Select',
970
- type: 'select'
971
- }, {
972
- label: 'Text',
973
- type: 'text'
974
- }, {
975
- label: 'Button',
976
- type: 'button'
977
- }];
978
- function Palette(props) {
979
- return jsxs("div", {
980
- class: "fjs-palette",
981
- children: [jsxs("div", {
982
- class: "fjs-palette-header",
983
- title: "Form elements library",
984
- children: [jsx("span", {
985
- class: "fjs-hide-compact",
986
- children: "FORM ELEMENTS "
987
- }), "LIBRARY"]
988
- }), jsx("div", {
989
- class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
990
- children: types.map(({
991
- label,
992
- type
993
- }) => {
994
- const Icon = iconsByType[type];
995
- return jsxs("div", {
996
- class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
997
- "data-field-type": type,
998
- title: `Create a ${label} element`,
999
- children: [Icon ? jsx(Icon, {
1000
- class: "fjs-palette-field-icon",
1001
- width: "36",
1002
- height: "36",
1003
- viewBox: "0 0 54 54"
1004
- }) : null, jsx("span", {
1005
- class: "fjs-palette-field-text fjs-hide-compact",
1006
- children: label
1007
- })]
1008
- });
1009
- })
1010
- })]
1011
- });
1012
- }
1013
-
1014
769
  var ArrowIcon = function ArrowIcon(props) {
1015
770
  return jsx("svg", { ...props,
1016
771
  children: jsx("path", {
@@ -2594,58 +2349,239 @@ function TextfieldEntry(props) {
2594
2349
  setValidationError(newValidationError);
2595
2350
  };
2596
2351
 
2597
- if (previousValue === value && validationError) {
2598
- value = cachedInvalidValue;
2599
- }
2352
+ if (previousValue === value && validationError) {
2353
+ value = cachedInvalidValue;
2354
+ }
2355
+
2356
+ const temporaryError = useShowErrorEvent(show);
2357
+ const error = temporaryError || validationError;
2358
+ return jsxs("div", {
2359
+ class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
2360
+ "data-entry-id": id,
2361
+ children: [jsx(Textfield, {
2362
+ debounce: debounce,
2363
+ disabled: disabled,
2364
+ feel: feel,
2365
+ id: id,
2366
+ label: label,
2367
+ onInput: onInput,
2368
+ show: show,
2369
+ value: value
2370
+ }), error && jsx("div", {
2371
+ class: "bio-properties-panel-error",
2372
+ children: error
2373
+ }), jsx(Description$1, {
2374
+ forId: id,
2375
+ element: element,
2376
+ value: description
2377
+ })]
2378
+ });
2379
+ }
2380
+
2381
+ function isEdited$1(node) {
2382
+ return node && !!node.value;
2383
+ } // helpers /////////////////
2384
+
2385
+
2386
+ function prefixId$1(id) {
2387
+ return `bio-properties-panel-${id}`;
2388
+ }
2389
+
2390
+ function arrayAdd$1(array, index, item) {
2391
+ const copy = [...array];
2392
+ copy.splice(index, 0, item);
2393
+ return copy;
2394
+ }
2395
+ function textToLabel(text = '...') {
2396
+ if (text.length > 10) {
2397
+ return `${text.substring(0, 30)}...`;
2398
+ }
2399
+
2400
+ return text;
2401
+ }
2402
+ const INPUTS = ['checkbox', 'checklist', 'number', 'radio', 'select', 'taglist', 'textfield'];
2403
+ const VALUES_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
2404
+
2405
+ function _extends$b() { _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
2406
+ var ButtonIcon = (({
2407
+ styles = {},
2408
+ ...props
2409
+ }) => /*#__PURE__*/React.createElement("svg", _extends$b({
2410
+ xmlns: "http://www.w3.org/2000/svg",
2411
+ width: "54",
2412
+ height: "54"
2413
+ }, props), /*#__PURE__*/React.createElement("path", {
2414
+ fillRule: "evenodd",
2415
+ d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
2416
+ })));
2417
+
2418
+ function _extends$a() { _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
2419
+ var CheckboxIcon = (({
2420
+ styles = {},
2421
+ ...props
2422
+ }) => /*#__PURE__*/React.createElement("svg", _extends$a({
2423
+ xmlns: "http://www.w3.org/2000/svg",
2424
+ width: "54",
2425
+ height: "54"
2426
+ }, props), /*#__PURE__*/React.createElement("path", {
2427
+ d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
2428
+ })));
2429
+
2430
+ function _extends$9() { _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
2431
+ var ChecklistIcon = (({
2432
+ styles = {},
2433
+ ...props
2434
+ }) => /*#__PURE__*/React.createElement("svg", _extends$9({
2435
+ width: "54",
2436
+ height: "54",
2437
+ fill: "none",
2438
+ xmlns: "http://www.w3.org/2000/svg"
2439
+ }, props), /*#__PURE__*/React.createElement("path", {
2440
+ fillRule: "evenodd",
2441
+ clipRule: "evenodd",
2442
+ d: "M19 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6 18h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6-30h-6v6h6V8zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2V8a2 2 0 00-2-2h-6z",
2443
+ fill: "#22242A"
2444
+ }), /*#__PURE__*/React.createElement("path", {
2445
+ d: "M26 26a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0 16a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0-32a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2z",
2446
+ fill: "#22242A"
2447
+ })));
2448
+
2449
+ function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
2450
+ var TaglistIcon = (({
2451
+ styles = {},
2452
+ ...props
2453
+ }) => /*#__PURE__*/React.createElement("svg", _extends$8({
2454
+ width: "54",
2455
+ height: "54",
2456
+ fill: "none",
2457
+ xmlns: "http://www.w3.org/2000/svg"
2458
+ }, props), /*#__PURE__*/React.createElement("path", {
2459
+ fillRule: "evenodd",
2460
+ clipRule: "evenodd",
2461
+ d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z",
2462
+ fill: "#000"
2463
+ }), /*#__PURE__*/React.createElement("path", {
2464
+ d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
2465
+ fill: "#505562"
2466
+ })));
2467
+
2468
+ function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
2469
+ var FormIcon = (({
2470
+ styles = {},
2471
+ ...props
2472
+ }) => /*#__PURE__*/React.createElement("svg", _extends$7({
2473
+ xmlns: "http://www.w3.org/2000/svg",
2474
+ width: "54",
2475
+ height: "54"
2476
+ }, props), /*#__PURE__*/React.createElement("rect", {
2477
+ x: "15",
2478
+ y: "17",
2479
+ width: "24",
2480
+ height: "4",
2481
+ rx: "1"
2482
+ }), /*#__PURE__*/React.createElement("rect", {
2483
+ x: "15",
2484
+ y: "25",
2485
+ width: "24",
2486
+ height: "4",
2487
+ rx: "1"
2488
+ }), /*#__PURE__*/React.createElement("rect", {
2489
+ x: "15",
2490
+ y: "33",
2491
+ width: "13",
2492
+ height: "4",
2493
+ rx: "1"
2494
+ })));
2495
+
2496
+ function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
2497
+ var ColumnsIcon = (({
2498
+ styles = {},
2499
+ ...props
2500
+ }) => /*#__PURE__*/React.createElement("svg", _extends$6({
2501
+ xmlns: "http://www.w3.org/2000/svg",
2502
+ width: "54",
2503
+ height: "54"
2504
+ }, props), /*#__PURE__*/React.createElement("path", {
2505
+ fillRule: "evenodd",
2506
+ d: "M8 33v5a1 1 0 001 1h4v2H9a3 3 0 01-3-3v-5h2zm18 6v2H15v-2h11zm13 0v2H28v-2h11zm9-6v5a3 3 0 01-3 3h-4v-2h4a1 1 0 00.993-.883L46 38v-5h2zM8 22v9H6v-9h2zm40 0v9h-2v-9h2zm-35-9v2H9a1 1 0 00-.993.883L8 16v4H6v-4a3 3 0 013-3h4zm32 0a3 3 0 013 3v4h-2v-4a1 1 0 00-.883-.993L45 15h-4v-2h4zm-6 0v2H28v-2h11zm-13 0v2H15v-2h11z"
2507
+ })));
2600
2508
 
2601
- const temporaryError = useShowErrorEvent(show);
2602
- const error = temporaryError || validationError;
2603
- return jsxs("div", {
2604
- class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
2605
- "data-entry-id": id,
2606
- children: [jsx(Textfield, {
2607
- debounce: debounce,
2608
- disabled: disabled,
2609
- feel: feel,
2610
- id: id,
2611
- label: label,
2612
- onInput: onInput,
2613
- show: show,
2614
- value: value
2615
- }), error && jsx("div", {
2616
- class: "bio-properties-panel-error",
2617
- children: error
2618
- }), jsx(Description$1, {
2619
- forId: id,
2620
- element: element,
2621
- value: description
2622
- })]
2623
- });
2624
- }
2509
+ function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
2510
+ var NumberIcon = (({
2511
+ styles = {},
2512
+ ...props
2513
+ }) => /*#__PURE__*/React.createElement("svg", _extends$5({
2514
+ xmlns: "http://www.w3.org/2000/svg",
2515
+ width: "54",
2516
+ height: "54"
2517
+ }, props), /*#__PURE__*/React.createElement("path", {
2518
+ fillRule: "evenodd",
2519
+ d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
2520
+ })));
2625
2521
 
2626
- function isEdited$1(node) {
2627
- return node && !!node.value;
2628
- } // helpers /////////////////
2522
+ function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
2523
+ var RadioIcon = (({
2524
+ styles = {},
2525
+ ...props
2526
+ }) => /*#__PURE__*/React.createElement("svg", _extends$4({
2527
+ xmlns: "http://www.w3.org/2000/svg",
2528
+ width: "54",
2529
+ height: "54"
2530
+ }, props), /*#__PURE__*/React.createElement("path", {
2531
+ d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
2532
+ })));
2629
2533
 
2534
+ function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
2535
+ var SelectIcon = (({
2536
+ styles = {},
2537
+ ...props
2538
+ }) => /*#__PURE__*/React.createElement("svg", _extends$3({
2539
+ xmlns: "http://www.w3.org/2000/svg",
2540
+ width: "54",
2541
+ height: "54"
2542
+ }, props), /*#__PURE__*/React.createElement("path", {
2543
+ fillRule: "evenodd",
2544
+ d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
2545
+ })));
2630
2546
 
2631
- function prefixId$1(id) {
2632
- return `bio-properties-panel-${id}`;
2633
- }
2547
+ function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
2548
+ var TextIcon = (({
2549
+ styles = {},
2550
+ ...props
2551
+ }) => /*#__PURE__*/React.createElement("svg", _extends$2({
2552
+ xmlns: "http://www.w3.org/2000/svg",
2553
+ width: "54",
2554
+ height: "54"
2555
+ }, props), /*#__PURE__*/React.createElement("path", {
2556
+ d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36l-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 012.4.14 3.42 3.42 0 011.41.55 3.47 3.47 0 011 1.14 3 3 0 01.42 1.58 3.26 3.26 0 01-1.91 2.94 3.63 3.63 0 011.91 1.22 3.28 3.28 0 01.66 2 4 4 0 01-.43 1.8 3.63 3.63 0 01-1.09 1.4 3.89 3.89 0 01-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 001.1-.49 1.41 1.41 0 00.41-1 1.49 1.49 0 00-.35-1 1.54 1.54 0 00-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 001.88-.09 1.65 1.65 0 001-.54 1.6 1.6 0 00.38-1.14 1.75 1.75 0 00-.29-1 1.69 1.69 0 00-.86-.62 9.28 9.28 0 00-2.41-.23zM44.35 28.79l2.65.84a5.94 5.94 0 01-2 3.29A5.74 5.74 0 0141.38 34a5.87 5.87 0 01-4.44-1.84 7.09 7.09 0 01-1.73-5A7.43 7.43 0 0137 21.87 6 6 0 0141.54 20a5.64 5.64 0 014 1.47A5.33 5.33 0 0147 24l-2.7.65a2.8 2.8 0 00-2.86-2.27A3.09 3.09 0 0039 23.42a5.31 5.31 0 00-.93 3.5 5.62 5.62 0 00.93 3.65 3 3 0 002.4 1.09 2.72 2.72 0 001.82-.66 4 4 0 001.13-2.21z"
2557
+ })));
2634
2558
 
2635
- function arrayAdd$1(array, index, item) {
2636
- const copy = [...array];
2637
- copy.splice(index, 0, item);
2638
- return copy;
2639
- }
2640
- function textToLabel(text = '...') {
2641
- if (text.length > 10) {
2642
- return `${text.substring(0, 30)}...`;
2643
- }
2559
+ function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
2560
+ var TextfieldIcon = (({
2561
+ styles = {},
2562
+ ...props
2563
+ }) => /*#__PURE__*/React.createElement("svg", _extends$1({
2564
+ xmlns: "http://www.w3.org/2000/svg",
2565
+ width: "54",
2566
+ height: "54"
2567
+ }, props), /*#__PURE__*/React.createElement("path", {
2568
+ fillRule: "evenodd",
2569
+ d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-32 4v10h-2V22h2z"
2570
+ })));
2644
2571
 
2645
- return text;
2646
- }
2647
- const INPUTS = ['checkbox', 'checklist', 'number', 'radio', 'select', 'taglist', 'textfield'];
2648
- const VALUES_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
2572
+ const iconsByType = {
2573
+ button: ButtonIcon,
2574
+ checkbox: CheckboxIcon,
2575
+ checklist: ChecklistIcon,
2576
+ columns: ColumnsIcon,
2577
+ number: NumberIcon,
2578
+ radio: RadioIcon,
2579
+ select: SelectIcon,
2580
+ taglist: TaglistIcon,
2581
+ text: TextIcon,
2582
+ textfield: TextfieldIcon,
2583
+ default: FormIcon
2584
+ };
2649
2585
 
2650
2586
  const labelsByType = {
2651
2587
  button: 'BUTTON',
@@ -3282,7 +3218,7 @@ function Key$1(props) {
3282
3218
 
3283
3219
  return TextfieldEntry({
3284
3220
  debounce,
3285
- description: 'Maps to a process variable',
3221
+ description: 'Binds to a form variable',
3286
3222
  element: field,
3287
3223
  getValue,
3288
3224
  id,
@@ -4043,7 +3979,7 @@ function ValuesGroups(field, editField) {
4043
3979
 
4044
3980
  const groups = [{
4045
3981
  id: valuesSourceId,
4046
- label: 'Values source',
3982
+ label: 'Options source',
4047
3983
  component: Group,
4048
3984
  entries: ValuesSourceSelectEntry({ ...context,
4049
3985
  id: valuesSourceId
@@ -4055,7 +3991,7 @@ function ValuesGroups(field, editField) {
4055
3991
  const dynamicValuesId = `${fieldId}-dynamicValues`;
4056
3992
  groups.push({
4057
3993
  id: dynamicValuesId,
4058
- label: 'Dynamic values',
3994
+ label: 'Dynamic options',
4059
3995
  component: Group,
4060
3996
  entries: InputKeyValuesSourceEntry({ ...context,
4061
3997
  id: dynamicValuesId
@@ -4065,7 +4001,7 @@ function ValuesGroups(field, editField) {
4065
4001
  const staticValuesId = `${fieldId}-staticValues`;
4066
4002
  groups.push({
4067
4003
  id: staticValuesId,
4068
- label: 'Static values',
4004
+ label: 'Static options',
4069
4005
  component: ListGroup,
4070
4006
  ...StaticValuesSourceEntry({ ...context,
4071
4007
  id: staticValuesId
@@ -4328,12 +4264,15 @@ function FormEditor$1(props) {
4328
4264
  formFieldRegistry = useService('formFieldRegistry'),
4329
4265
  injector = useService('injector'),
4330
4266
  modeling = useService('modeling'),
4331
- selection = useService('selection');
4267
+ selection = useService('selection'),
4268
+ palette = useService('palette'),
4269
+ paletteConfig = useService('config.palette');
4332
4270
 
4333
4271
  const {
4334
4272
  schema
4335
4273
  } = formEditor._getState();
4336
4274
 
4275
+ const paletteRef = useRef(null);
4337
4276
  const [selectedFormField, setSelection] = useState(schema);
4338
4277
  useEffect(() => {
4339
4278
  function handleSelectionChanged(event) {
@@ -4417,6 +4356,10 @@ function FormEditor$1(props) {
4417
4356
  eventBus.off('attach', onAttach);
4418
4357
  eventBus.off('detach', onDetach);
4419
4358
  };
4359
+ }, []); // fire event after first render to notify interested parties
4360
+
4361
+ useEffect(() => {
4362
+ eventBus.fire('formEditor.rendered');
4420
4363
  }, []);
4421
4364
  const formRenderContext = {
4422
4365
  Children,
@@ -4451,14 +4394,21 @@ function FormEditor$1(props) {
4451
4394
  };
4452
4395
  const onSubmit = useCallback(() => {}, []);
4453
4396
  const onReset = useCallback(() => {}, []);
4454
- const editField = useCallback((formField, key, value) => modeling.editFormField(formField, key, value), [modeling]);
4397
+ const editField = useCallback((formField, key, value) => modeling.editFormField(formField, key, value), [modeling]); // attach default palette
4398
+
4399
+ const hasDefaultPalette = defaultPalette(paletteConfig);
4400
+ useEffect(() => {
4401
+ if (hasDefaultPalette) {
4402
+ palette.attachTo(paletteRef.current);
4403
+ }
4404
+ }, [palette, paletteRef, hasDefaultPalette]);
4455
4405
  return jsxs("div", {
4456
4406
  class: "fjs-form-editor",
4457
4407
  children: [jsxs(DragAndDropContext.Provider, {
4458
4408
  value: dragAndDropContext,
4459
- children: [jsx("div", {
4460
- class: "fjs-palette-container",
4461
- children: jsx(Palette, {})
4409
+ children: [hasDefaultPalette && jsx("div", {
4410
+ class: "fjs-editor-palette-container",
4411
+ ref: paletteRef
4462
4412
  }), jsx("div", {
4463
4413
  class: "fjs-form-container",
4464
4414
  children: jsx(FormContext.Provider, {
@@ -4519,6 +4469,11 @@ function CreatePreview(props) {
4519
4469
  return () => drake.off('cloned', handleCloned);
4520
4470
  }, [drake]);
4521
4471
  return null;
4472
+ } // helper //////
4473
+
4474
+
4475
+ function defaultPalette(paletteConfig) {
4476
+ return !(paletteConfig && paletteConfig.parent);
4522
4477
  }
4523
4478
 
4524
4479
  class Renderer {
@@ -6575,6 +6530,145 @@ var SelectionModule = {
6575
6530
  selectionBehavior: ['type', SelectionBehavior]
6576
6531
  };
6577
6532
 
6533
+ const types = [{
6534
+ label: 'Text Field',
6535
+ type: 'textfield'
6536
+ }, {
6537
+ label: 'Number',
6538
+ type: 'number'
6539
+ }, {
6540
+ label: 'Checkbox',
6541
+ type: 'checkbox'
6542
+ }, {
6543
+ label: 'Checklist',
6544
+ type: 'checklist'
6545
+ }, {
6546
+ label: 'Taglist',
6547
+ type: 'taglist'
6548
+ }, {
6549
+ label: 'Radio',
6550
+ type: 'radio'
6551
+ }, {
6552
+ label: 'Select',
6553
+ type: 'select'
6554
+ }, {
6555
+ label: 'Text',
6556
+ type: 'text'
6557
+ }, {
6558
+ label: 'Button',
6559
+ type: 'button'
6560
+ }];
6561
+ function Palette(props) {
6562
+ return jsxs("div", {
6563
+ class: "fjs-palette",
6564
+ children: [jsxs("div", {
6565
+ class: "fjs-palette-header",
6566
+ title: "Form elements library",
6567
+ children: [jsx("span", {
6568
+ class: "fjs-hide-compact",
6569
+ children: "FORM ELEMENTS "
6570
+ }), "LIBRARY"]
6571
+ }), jsx("div", {
6572
+ class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
6573
+ children: types.map(({
6574
+ label,
6575
+ type
6576
+ }) => {
6577
+ const Icon = iconsByType[type];
6578
+ return jsxs("div", {
6579
+ class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
6580
+ "data-field-type": type,
6581
+ title: `Create a ${label} element`,
6582
+ children: [Icon ? jsx(Icon, {
6583
+ class: "fjs-palette-field-icon",
6584
+ width: "36",
6585
+ height: "36",
6586
+ viewBox: "0 0 54 54"
6587
+ }) : null, jsx("span", {
6588
+ class: "fjs-palette-field-text fjs-hide-compact",
6589
+ children: label
6590
+ })]
6591
+ });
6592
+ })
6593
+ })]
6594
+ });
6595
+ }
6596
+
6597
+ class PaletteRenderer {
6598
+ constructor(paletteConfig, eventBus) {
6599
+ const {
6600
+ parent
6601
+ } = paletteConfig || {};
6602
+ this._eventBus = eventBus;
6603
+ this._container = domify('<div class="fjs-palette-container"></div>');
6604
+
6605
+ if (parent) {
6606
+ this.attachTo(parent);
6607
+ }
6608
+
6609
+ this._eventBus.once('formEditor.rendered', 500, () => {
6610
+ this._render();
6611
+ });
6612
+ }
6613
+ /**
6614
+ * Attach the palette to a parent node.
6615
+ *
6616
+ * @param {HTMLElement} container
6617
+ */
6618
+
6619
+
6620
+ attachTo(container) {
6621
+ if (!container) {
6622
+ throw new Error('container required');
6623
+ }
6624
+
6625
+ if (typeof container === 'string') {
6626
+ container = query(container);
6627
+ } // (1) detach from old parent
6628
+
6629
+
6630
+ this.detach(); // (2) append to parent container
6631
+
6632
+ container.appendChild(this._container); // (3) notify interested parties
6633
+
6634
+ this._eventBus.fire('palette.attach');
6635
+ }
6636
+ /**
6637
+ * Detach the palette from its parent node.
6638
+ */
6639
+
6640
+
6641
+ detach() {
6642
+ const parentNode = this._container.parentNode;
6643
+
6644
+ if (parentNode) {
6645
+ parentNode.removeChild(this._container);
6646
+
6647
+ this._eventBus.fire('palette.detach');
6648
+ }
6649
+ }
6650
+
6651
+ _render() {
6652
+ render(jsx(Palette, {}), this._container);
6653
+
6654
+ this._eventBus.fire('palette.rendered');
6655
+ }
6656
+
6657
+ _destroy() {
6658
+ if (this._container) {
6659
+ render(null, this._container);
6660
+
6661
+ this._eventBus.fire('palette.destroyed');
6662
+ }
6663
+ }
6664
+
6665
+ }
6666
+ PaletteRenderer.$inject = ['config.palette', 'eventBus'];
6667
+
6668
+ var PaletteModule = {
6669
+ palette: ['type', PaletteRenderer]
6670
+ };
6671
+
6578
6672
  const ids = new Ids([32, 36, 1]);
6579
6673
  /**
6580
6674
  * @typedef { import('./types').Injector } Injector
@@ -6856,7 +6950,7 @@ class FormEditor {
6856
6950
 
6857
6951
 
6858
6952
  _getModules() {
6859
- return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule];
6953
+ return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule, PaletteModule];
6860
6954
  }
6861
6955
  /**
6862
6956
  * @internal