@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.cjs CHANGED
@@ -7,9 +7,9 @@ var Ids = require('ids');
7
7
  var minDash = require('min-dash');
8
8
  var preact = require('preact');
9
9
  var hooks$1 = require('preact/hooks');
10
+ var classnames = require('classnames');
10
11
  var React = require('preact/compat');
11
12
  var jsxRuntime = require('preact/jsx-runtime');
12
- var classnames = require('classnames');
13
13
  var minDom = require('min-dom');
14
14
  var dragula = require('dragula');
15
15
  var arrayMove = require('array-move');
@@ -17,8 +17,8 @@ var arrayMove = require('array-move');
17
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
18
 
19
19
  var Ids__default = /*#__PURE__*/_interopDefaultLegacy(Ids);
20
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
20
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
21
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
22
  var dragula__default = /*#__PURE__*/_interopDefaultLegacy(dragula);
23
23
 
24
24
  var FN_REF = '__fn';
@@ -776,251 +776,6 @@ function useService (type, strict) {
776
776
  return getService(type, strict);
777
777
  }
778
778
 
779
- 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); }
780
- var ButtonIcon = (({
781
- styles = {},
782
- ...props
783
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
784
- xmlns: "http://www.w3.org/2000/svg",
785
- width: "54",
786
- height: "54"
787
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
788
- fillRule: "evenodd",
789
- 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"
790
- })));
791
-
792
- 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); }
793
- var CheckboxIcon = (({
794
- styles = {},
795
- ...props
796
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$a({
797
- xmlns: "http://www.w3.org/2000/svg",
798
- width: "54",
799
- height: "54"
800
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
801
- 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"
802
- })));
803
-
804
- 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); }
805
- var ChecklistIcon = (({
806
- styles = {},
807
- ...props
808
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$9({
809
- width: "54",
810
- height: "54",
811
- fill: "none",
812
- xmlns: "http://www.w3.org/2000/svg"
813
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
814
- fillRule: "evenodd",
815
- clipRule: "evenodd",
816
- 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",
817
- fill: "#22242A"
818
- }), /*#__PURE__*/React__default['default'].createElement("path", {
819
- 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",
820
- fill: "#22242A"
821
- })));
822
-
823
- 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); }
824
- var TaglistIcon = (({
825
- styles = {},
826
- ...props
827
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$8({
828
- width: "54",
829
- height: "54",
830
- fill: "none",
831
- xmlns: "http://www.w3.org/2000/svg"
832
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
833
- fillRule: "evenodd",
834
- clipRule: "evenodd",
835
- 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",
836
- fill: "#000"
837
- }), /*#__PURE__*/React__default['default'].createElement("path", {
838
- d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
839
- fill: "#505562"
840
- })));
841
-
842
- 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); }
843
- var FormIcon = (({
844
- styles = {},
845
- ...props
846
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$7({
847
- xmlns: "http://www.w3.org/2000/svg",
848
- width: "54",
849
- height: "54"
850
- }, props), /*#__PURE__*/React__default['default'].createElement("rect", {
851
- x: "15",
852
- y: "17",
853
- width: "24",
854
- height: "4",
855
- rx: "1"
856
- }), /*#__PURE__*/React__default['default'].createElement("rect", {
857
- x: "15",
858
- y: "25",
859
- width: "24",
860
- height: "4",
861
- rx: "1"
862
- }), /*#__PURE__*/React__default['default'].createElement("rect", {
863
- x: "15",
864
- y: "33",
865
- width: "13",
866
- height: "4",
867
- rx: "1"
868
- })));
869
-
870
- 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); }
871
- var ColumnsIcon = (({
872
- styles = {},
873
- ...props
874
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$6({
875
- xmlns: "http://www.w3.org/2000/svg",
876
- width: "54",
877
- height: "54"
878
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
879
- fillRule: "evenodd",
880
- 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"
881
- })));
882
-
883
- 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); }
884
- var NumberIcon = (({
885
- styles = {},
886
- ...props
887
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$5({
888
- xmlns: "http://www.w3.org/2000/svg",
889
- width: "54",
890
- height: "54"
891
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
892
- fillRule: "evenodd",
893
- 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"
894
- })));
895
-
896
- 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); }
897
- var RadioIcon = (({
898
- styles = {},
899
- ...props
900
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$4({
901
- xmlns: "http://www.w3.org/2000/svg",
902
- width: "54",
903
- height: "54"
904
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
905
- 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"
906
- })));
907
-
908
- 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); }
909
- var SelectIcon = (({
910
- styles = {},
911
- ...props
912
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$3({
913
- xmlns: "http://www.w3.org/2000/svg",
914
- width: "54",
915
- height: "54"
916
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
917
- fillRule: "evenodd",
918
- 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"
919
- })));
920
-
921
- 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); }
922
- var TextIcon = (({
923
- styles = {},
924
- ...props
925
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$2({
926
- xmlns: "http://www.w3.org/2000/svg",
927
- width: "54",
928
- height: "54"
929
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
930
- 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"
931
- })));
932
-
933
- 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); }
934
- var TextfieldIcon = (({
935
- styles = {},
936
- ...props
937
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$1({
938
- xmlns: "http://www.w3.org/2000/svg",
939
- width: "54",
940
- height: "54"
941
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
942
- fillRule: "evenodd",
943
- 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"
944
- })));
945
-
946
- const iconsByType = {
947
- button: ButtonIcon,
948
- checkbox: CheckboxIcon,
949
- checklist: ChecklistIcon,
950
- columns: ColumnsIcon,
951
- number: NumberIcon,
952
- radio: RadioIcon,
953
- select: SelectIcon,
954
- taglist: TaglistIcon,
955
- text: TextIcon,
956
- textfield: TextfieldIcon,
957
- default: FormIcon
958
- };
959
-
960
- const types = [{
961
- label: 'Text Field',
962
- type: 'textfield'
963
- }, {
964
- label: 'Number',
965
- type: 'number'
966
- }, {
967
- label: 'Checkbox',
968
- type: 'checkbox'
969
- }, {
970
- label: 'Checklist',
971
- type: 'checklist'
972
- }, {
973
- label: 'Taglist',
974
- type: 'taglist'
975
- }, {
976
- label: 'Radio',
977
- type: 'radio'
978
- }, {
979
- label: 'Select',
980
- type: 'select'
981
- }, {
982
- label: 'Text',
983
- type: 'text'
984
- }, {
985
- label: 'Button',
986
- type: 'button'
987
- }];
988
- function Palette(props) {
989
- return jsxRuntime.jsxs("div", {
990
- class: "fjs-palette",
991
- children: [jsxRuntime.jsxs("div", {
992
- class: "fjs-palette-header",
993
- title: "Form elements library",
994
- children: [jsxRuntime.jsx("span", {
995
- class: "fjs-hide-compact",
996
- children: "FORM ELEMENTS "
997
- }), "LIBRARY"]
998
- }), jsxRuntime.jsx("div", {
999
- class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
1000
- children: types.map(({
1001
- label,
1002
- type
1003
- }) => {
1004
- const Icon = iconsByType[type];
1005
- return jsxRuntime.jsxs("div", {
1006
- class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
1007
- "data-field-type": type,
1008
- title: `Create a ${label} element`,
1009
- children: [Icon ? jsxRuntime.jsx(Icon, {
1010
- class: "fjs-palette-field-icon",
1011
- width: "36",
1012
- height: "36",
1013
- viewBox: "0 0 54 54"
1014
- }) : null, jsxRuntime.jsx("span", {
1015
- class: "fjs-palette-field-text fjs-hide-compact",
1016
- children: label
1017
- })]
1018
- });
1019
- })
1020
- })]
1021
- });
1022
- }
1023
-
1024
779
  var ArrowIcon = function ArrowIcon(props) {
1025
780
  return jsxRuntime.jsx("svg", { ...props,
1026
781
  children: jsxRuntime.jsx("path", {
@@ -2604,58 +2359,239 @@ function TextfieldEntry(props) {
2604
2359
  setValidationError(newValidationError);
2605
2360
  };
2606
2361
 
2607
- if (previousValue === value && validationError) {
2608
- value = cachedInvalidValue;
2609
- }
2362
+ if (previousValue === value && validationError) {
2363
+ value = cachedInvalidValue;
2364
+ }
2365
+
2366
+ const temporaryError = useShowErrorEvent(show);
2367
+ const error = temporaryError || validationError;
2368
+ return jsxRuntime.jsxs("div", {
2369
+ class: classnames__default['default']('bio-properties-panel-entry', error ? 'has-error' : ''),
2370
+ "data-entry-id": id,
2371
+ children: [jsxRuntime.jsx(Textfield, {
2372
+ debounce: debounce,
2373
+ disabled: disabled,
2374
+ feel: feel,
2375
+ id: id,
2376
+ label: label,
2377
+ onInput: onInput,
2378
+ show: show,
2379
+ value: value
2380
+ }), error && jsxRuntime.jsx("div", {
2381
+ class: "bio-properties-panel-error",
2382
+ children: error
2383
+ }), jsxRuntime.jsx(Description$1, {
2384
+ forId: id,
2385
+ element: element,
2386
+ value: description
2387
+ })]
2388
+ });
2389
+ }
2390
+
2391
+ function isEdited$1(node) {
2392
+ return node && !!node.value;
2393
+ } // helpers /////////////////
2394
+
2395
+
2396
+ function prefixId$1(id) {
2397
+ return `bio-properties-panel-${id}`;
2398
+ }
2399
+
2400
+ function arrayAdd$1(array, index, item) {
2401
+ const copy = [...array];
2402
+ copy.splice(index, 0, item);
2403
+ return copy;
2404
+ }
2405
+ function textToLabel(text = '...') {
2406
+ if (text.length > 10) {
2407
+ return `${text.substring(0, 30)}...`;
2408
+ }
2409
+
2410
+ return text;
2411
+ }
2412
+ const INPUTS = ['checkbox', 'checklist', 'number', 'radio', 'select', 'taglist', 'textfield'];
2413
+ const VALUES_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
2414
+
2415
+ 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); }
2416
+ var ButtonIcon = (({
2417
+ styles = {},
2418
+ ...props
2419
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
2420
+ xmlns: "http://www.w3.org/2000/svg",
2421
+ width: "54",
2422
+ height: "54"
2423
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2424
+ fillRule: "evenodd",
2425
+ 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"
2426
+ })));
2427
+
2428
+ 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); }
2429
+ var CheckboxIcon = (({
2430
+ styles = {},
2431
+ ...props
2432
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$a({
2433
+ xmlns: "http://www.w3.org/2000/svg",
2434
+ width: "54",
2435
+ height: "54"
2436
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2437
+ 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"
2438
+ })));
2439
+
2440
+ 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); }
2441
+ var ChecklistIcon = (({
2442
+ styles = {},
2443
+ ...props
2444
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$9({
2445
+ width: "54",
2446
+ height: "54",
2447
+ fill: "none",
2448
+ xmlns: "http://www.w3.org/2000/svg"
2449
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2450
+ fillRule: "evenodd",
2451
+ clipRule: "evenodd",
2452
+ 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",
2453
+ fill: "#22242A"
2454
+ }), /*#__PURE__*/React__default['default'].createElement("path", {
2455
+ 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",
2456
+ fill: "#22242A"
2457
+ })));
2458
+
2459
+ 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); }
2460
+ var TaglistIcon = (({
2461
+ styles = {},
2462
+ ...props
2463
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$8({
2464
+ width: "54",
2465
+ height: "54",
2466
+ fill: "none",
2467
+ xmlns: "http://www.w3.org/2000/svg"
2468
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2469
+ fillRule: "evenodd",
2470
+ clipRule: "evenodd",
2471
+ 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",
2472
+ fill: "#000"
2473
+ }), /*#__PURE__*/React__default['default'].createElement("path", {
2474
+ d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
2475
+ fill: "#505562"
2476
+ })));
2477
+
2478
+ 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); }
2479
+ var FormIcon = (({
2480
+ styles = {},
2481
+ ...props
2482
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$7({
2483
+ xmlns: "http://www.w3.org/2000/svg",
2484
+ width: "54",
2485
+ height: "54"
2486
+ }, props), /*#__PURE__*/React__default['default'].createElement("rect", {
2487
+ x: "15",
2488
+ y: "17",
2489
+ width: "24",
2490
+ height: "4",
2491
+ rx: "1"
2492
+ }), /*#__PURE__*/React__default['default'].createElement("rect", {
2493
+ x: "15",
2494
+ y: "25",
2495
+ width: "24",
2496
+ height: "4",
2497
+ rx: "1"
2498
+ }), /*#__PURE__*/React__default['default'].createElement("rect", {
2499
+ x: "15",
2500
+ y: "33",
2501
+ width: "13",
2502
+ height: "4",
2503
+ rx: "1"
2504
+ })));
2505
+
2506
+ 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); }
2507
+ var ColumnsIcon = (({
2508
+ styles = {},
2509
+ ...props
2510
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$6({
2511
+ xmlns: "http://www.w3.org/2000/svg",
2512
+ width: "54",
2513
+ height: "54"
2514
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2515
+ fillRule: "evenodd",
2516
+ 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"
2517
+ })));
2610
2518
 
2611
- const temporaryError = useShowErrorEvent(show);
2612
- const error = temporaryError || validationError;
2613
- return jsxRuntime.jsxs("div", {
2614
- class: classnames__default['default']('bio-properties-panel-entry', error ? 'has-error' : ''),
2615
- "data-entry-id": id,
2616
- children: [jsxRuntime.jsx(Textfield, {
2617
- debounce: debounce,
2618
- disabled: disabled,
2619
- feel: feel,
2620
- id: id,
2621
- label: label,
2622
- onInput: onInput,
2623
- show: show,
2624
- value: value
2625
- }), error && jsxRuntime.jsx("div", {
2626
- class: "bio-properties-panel-error",
2627
- children: error
2628
- }), jsxRuntime.jsx(Description$1, {
2629
- forId: id,
2630
- element: element,
2631
- value: description
2632
- })]
2633
- });
2634
- }
2519
+ 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); }
2520
+ var NumberIcon = (({
2521
+ styles = {},
2522
+ ...props
2523
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$5({
2524
+ xmlns: "http://www.w3.org/2000/svg",
2525
+ width: "54",
2526
+ height: "54"
2527
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2528
+ fillRule: "evenodd",
2529
+ 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"
2530
+ })));
2635
2531
 
2636
- function isEdited$1(node) {
2637
- return node && !!node.value;
2638
- } // helpers /////////////////
2532
+ 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); }
2533
+ var RadioIcon = (({
2534
+ styles = {},
2535
+ ...props
2536
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$4({
2537
+ xmlns: "http://www.w3.org/2000/svg",
2538
+ width: "54",
2539
+ height: "54"
2540
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2541
+ 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"
2542
+ })));
2639
2543
 
2544
+ 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); }
2545
+ var SelectIcon = (({
2546
+ styles = {},
2547
+ ...props
2548
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$3({
2549
+ xmlns: "http://www.w3.org/2000/svg",
2550
+ width: "54",
2551
+ height: "54"
2552
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2553
+ fillRule: "evenodd",
2554
+ 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"
2555
+ })));
2640
2556
 
2641
- function prefixId$1(id) {
2642
- return `bio-properties-panel-${id}`;
2643
- }
2557
+ 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); }
2558
+ var TextIcon = (({
2559
+ styles = {},
2560
+ ...props
2561
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$2({
2562
+ xmlns: "http://www.w3.org/2000/svg",
2563
+ width: "54",
2564
+ height: "54"
2565
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2566
+ 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"
2567
+ })));
2644
2568
 
2645
- function arrayAdd$1(array, index, item) {
2646
- const copy = [...array];
2647
- copy.splice(index, 0, item);
2648
- return copy;
2649
- }
2650
- function textToLabel(text = '...') {
2651
- if (text.length > 10) {
2652
- return `${text.substring(0, 30)}...`;
2653
- }
2569
+ 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); }
2570
+ var TextfieldIcon = (({
2571
+ styles = {},
2572
+ ...props
2573
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$1({
2574
+ xmlns: "http://www.w3.org/2000/svg",
2575
+ width: "54",
2576
+ height: "54"
2577
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
2578
+ fillRule: "evenodd",
2579
+ 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"
2580
+ })));
2654
2581
 
2655
- return text;
2656
- }
2657
- const INPUTS = ['checkbox', 'checklist', 'number', 'radio', 'select', 'taglist', 'textfield'];
2658
- const VALUES_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
2582
+ const iconsByType = {
2583
+ button: ButtonIcon,
2584
+ checkbox: CheckboxIcon,
2585
+ checklist: ChecklistIcon,
2586
+ columns: ColumnsIcon,
2587
+ number: NumberIcon,
2588
+ radio: RadioIcon,
2589
+ select: SelectIcon,
2590
+ taglist: TaglistIcon,
2591
+ text: TextIcon,
2592
+ textfield: TextfieldIcon,
2593
+ default: FormIcon
2594
+ };
2659
2595
 
2660
2596
  const labelsByType = {
2661
2597
  button: 'BUTTON',
@@ -3292,7 +3228,7 @@ function Key$1(props) {
3292
3228
 
3293
3229
  return TextfieldEntry({
3294
3230
  debounce,
3295
- description: 'Maps to a process variable',
3231
+ description: 'Binds to a form variable',
3296
3232
  element: field,
3297
3233
  getValue,
3298
3234
  id,
@@ -4053,7 +3989,7 @@ function ValuesGroups(field, editField) {
4053
3989
 
4054
3990
  const groups = [{
4055
3991
  id: valuesSourceId,
4056
- label: 'Values source',
3992
+ label: 'Options source',
4057
3993
  component: Group,
4058
3994
  entries: ValuesSourceSelectEntry({ ...context,
4059
3995
  id: valuesSourceId
@@ -4065,7 +4001,7 @@ function ValuesGroups(field, editField) {
4065
4001
  const dynamicValuesId = `${fieldId}-dynamicValues`;
4066
4002
  groups.push({
4067
4003
  id: dynamicValuesId,
4068
- label: 'Dynamic values',
4004
+ label: 'Dynamic options',
4069
4005
  component: Group,
4070
4006
  entries: InputKeyValuesSourceEntry({ ...context,
4071
4007
  id: dynamicValuesId
@@ -4075,7 +4011,7 @@ function ValuesGroups(field, editField) {
4075
4011
  const staticValuesId = `${fieldId}-staticValues`;
4076
4012
  groups.push({
4077
4013
  id: staticValuesId,
4078
- label: 'Static values',
4014
+ label: 'Static options',
4079
4015
  component: ListGroup,
4080
4016
  ...StaticValuesSourceEntry({ ...context,
4081
4017
  id: staticValuesId
@@ -4338,12 +4274,15 @@ function FormEditor$1(props) {
4338
4274
  formFieldRegistry = useService('formFieldRegistry'),
4339
4275
  injector = useService('injector'),
4340
4276
  modeling = useService('modeling'),
4341
- selection = useService('selection');
4277
+ selection = useService('selection'),
4278
+ palette = useService('palette'),
4279
+ paletteConfig = useService('config.palette');
4342
4280
 
4343
4281
  const {
4344
4282
  schema
4345
4283
  } = formEditor._getState();
4346
4284
 
4285
+ const paletteRef = hooks$1.useRef(null);
4347
4286
  const [selectedFormField, setSelection] = hooks$1.useState(schema);
4348
4287
  hooks$1.useEffect(() => {
4349
4288
  function handleSelectionChanged(event) {
@@ -4427,6 +4366,10 @@ function FormEditor$1(props) {
4427
4366
  eventBus.off('attach', onAttach);
4428
4367
  eventBus.off('detach', onDetach);
4429
4368
  };
4369
+ }, []); // fire event after first render to notify interested parties
4370
+
4371
+ hooks$1.useEffect(() => {
4372
+ eventBus.fire('formEditor.rendered');
4430
4373
  }, []);
4431
4374
  const formRenderContext = {
4432
4375
  Children,
@@ -4461,14 +4404,21 @@ function FormEditor$1(props) {
4461
4404
  };
4462
4405
  const onSubmit = hooks$1.useCallback(() => {}, []);
4463
4406
  const onReset = hooks$1.useCallback(() => {}, []);
4464
- const editField = hooks$1.useCallback((formField, key, value) => modeling.editFormField(formField, key, value), [modeling]);
4407
+ const editField = hooks$1.useCallback((formField, key, value) => modeling.editFormField(formField, key, value), [modeling]); // attach default palette
4408
+
4409
+ const hasDefaultPalette = defaultPalette(paletteConfig);
4410
+ hooks$1.useEffect(() => {
4411
+ if (hasDefaultPalette) {
4412
+ palette.attachTo(paletteRef.current);
4413
+ }
4414
+ }, [palette, paletteRef, hasDefaultPalette]);
4465
4415
  return jsxRuntime.jsxs("div", {
4466
4416
  class: "fjs-form-editor",
4467
4417
  children: [jsxRuntime.jsxs(DragAndDropContext.Provider, {
4468
4418
  value: dragAndDropContext,
4469
- children: [jsxRuntime.jsx("div", {
4470
- class: "fjs-palette-container",
4471
- children: jsxRuntime.jsx(Palette, {})
4419
+ children: [hasDefaultPalette && jsxRuntime.jsx("div", {
4420
+ class: "fjs-editor-palette-container",
4421
+ ref: paletteRef
4472
4422
  }), jsxRuntime.jsx("div", {
4473
4423
  class: "fjs-form-container",
4474
4424
  children: jsxRuntime.jsx(formJsViewer.FormContext.Provider, {
@@ -4529,6 +4479,11 @@ function CreatePreview(props) {
4529
4479
  return () => drake.off('cloned', handleCloned);
4530
4480
  }, [drake]);
4531
4481
  return null;
4482
+ } // helper //////
4483
+
4484
+
4485
+ function defaultPalette(paletteConfig) {
4486
+ return !(paletteConfig && paletteConfig.parent);
4532
4487
  }
4533
4488
 
4534
4489
  class Renderer {
@@ -6585,6 +6540,145 @@ var SelectionModule = {
6585
6540
  selectionBehavior: ['type', SelectionBehavior]
6586
6541
  };
6587
6542
 
6543
+ const types = [{
6544
+ label: 'Text Field',
6545
+ type: 'textfield'
6546
+ }, {
6547
+ label: 'Number',
6548
+ type: 'number'
6549
+ }, {
6550
+ label: 'Checkbox',
6551
+ type: 'checkbox'
6552
+ }, {
6553
+ label: 'Checklist',
6554
+ type: 'checklist'
6555
+ }, {
6556
+ label: 'Taglist',
6557
+ type: 'taglist'
6558
+ }, {
6559
+ label: 'Radio',
6560
+ type: 'radio'
6561
+ }, {
6562
+ label: 'Select',
6563
+ type: 'select'
6564
+ }, {
6565
+ label: 'Text',
6566
+ type: 'text'
6567
+ }, {
6568
+ label: 'Button',
6569
+ type: 'button'
6570
+ }];
6571
+ function Palette(props) {
6572
+ return jsxRuntime.jsxs("div", {
6573
+ class: "fjs-palette",
6574
+ children: [jsxRuntime.jsxs("div", {
6575
+ class: "fjs-palette-header",
6576
+ title: "Form elements library",
6577
+ children: [jsxRuntime.jsx("span", {
6578
+ class: "fjs-hide-compact",
6579
+ children: "FORM ELEMENTS "
6580
+ }), "LIBRARY"]
6581
+ }), jsxRuntime.jsx("div", {
6582
+ class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
6583
+ children: types.map(({
6584
+ label,
6585
+ type
6586
+ }) => {
6587
+ const Icon = iconsByType[type];
6588
+ return jsxRuntime.jsxs("div", {
6589
+ class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
6590
+ "data-field-type": type,
6591
+ title: `Create a ${label} element`,
6592
+ children: [Icon ? jsxRuntime.jsx(Icon, {
6593
+ class: "fjs-palette-field-icon",
6594
+ width: "36",
6595
+ height: "36",
6596
+ viewBox: "0 0 54 54"
6597
+ }) : null, jsxRuntime.jsx("span", {
6598
+ class: "fjs-palette-field-text fjs-hide-compact",
6599
+ children: label
6600
+ })]
6601
+ });
6602
+ })
6603
+ })]
6604
+ });
6605
+ }
6606
+
6607
+ class PaletteRenderer {
6608
+ constructor(paletteConfig, eventBus) {
6609
+ const {
6610
+ parent
6611
+ } = paletteConfig || {};
6612
+ this._eventBus = eventBus;
6613
+ this._container = minDom.domify('<div class="fjs-palette-container"></div>');
6614
+
6615
+ if (parent) {
6616
+ this.attachTo(parent);
6617
+ }
6618
+
6619
+ this._eventBus.once('formEditor.rendered', 500, () => {
6620
+ this._render();
6621
+ });
6622
+ }
6623
+ /**
6624
+ * Attach the palette to a parent node.
6625
+ *
6626
+ * @param {HTMLElement} container
6627
+ */
6628
+
6629
+
6630
+ attachTo(container) {
6631
+ if (!container) {
6632
+ throw new Error('container required');
6633
+ }
6634
+
6635
+ if (typeof container === 'string') {
6636
+ container = minDom.query(container);
6637
+ } // (1) detach from old parent
6638
+
6639
+
6640
+ this.detach(); // (2) append to parent container
6641
+
6642
+ container.appendChild(this._container); // (3) notify interested parties
6643
+
6644
+ this._eventBus.fire('palette.attach');
6645
+ }
6646
+ /**
6647
+ * Detach the palette from its parent node.
6648
+ */
6649
+
6650
+
6651
+ detach() {
6652
+ const parentNode = this._container.parentNode;
6653
+
6654
+ if (parentNode) {
6655
+ parentNode.removeChild(this._container);
6656
+
6657
+ this._eventBus.fire('palette.detach');
6658
+ }
6659
+ }
6660
+
6661
+ _render() {
6662
+ preact.render(jsxRuntime.jsx(Palette, {}), this._container);
6663
+
6664
+ this._eventBus.fire('palette.rendered');
6665
+ }
6666
+
6667
+ _destroy() {
6668
+ if (this._container) {
6669
+ preact.render(null, this._container);
6670
+
6671
+ this._eventBus.fire('palette.destroyed');
6672
+ }
6673
+ }
6674
+
6675
+ }
6676
+ PaletteRenderer.$inject = ['config.palette', 'eventBus'];
6677
+
6678
+ var PaletteModule = {
6679
+ palette: ['type', PaletteRenderer]
6680
+ };
6681
+
6588
6682
  const ids = new Ids__default['default']([32, 36, 1]);
6589
6683
  /**
6590
6684
  * @typedef { import('./types').Injector } Injector
@@ -6866,7 +6960,7 @@ class FormEditor {
6866
6960
 
6867
6961
 
6868
6962
  _getModules() {
6869
- return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule];
6963
+ return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule, PaletteModule];
6870
6964
  }
6871
6965
  /**
6872
6966
  * @internal