@bpmn-io/form-js-editor 0.11.0 → 0.12.0

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
@@ -1,30 +1,19 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var formJsViewer = require('@bpmn-io/form-js-viewer');
6
4
  var Ids = require('ids');
7
5
  var minDash = require('min-dash');
6
+ var classnames = require('classnames');
7
+ var jsxRuntime = require('preact/jsx-runtime');
8
8
  var preact = require('preact');
9
9
  var hooks$1 = require('preact/hooks');
10
10
  var dragula = require('dragula');
11
- var jsxRuntime = require('preact/jsx-runtime');
12
11
  var React = require('preact/compat');
13
12
  var minDom = require('min-dom');
14
13
  var arrayMove = require('array-move');
15
- var classnames = require('classnames');
16
14
  var FeelEditor = require('@bpmn-io/feel-editor');
17
15
  var Big = require('big.js');
18
16
 
19
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
-
21
- var Ids__default = /*#__PURE__*/_interopDefaultLegacy(Ids);
22
- var dragula__default = /*#__PURE__*/_interopDefaultLegacy(dragula);
23
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
- var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
25
- var FeelEditor__default = /*#__PURE__*/_interopDefaultLegacy(FeelEditor);
26
- var Big__default = /*#__PURE__*/_interopDefaultLegacy(Big);
27
-
28
17
  var FN_REF = '__fn';
29
18
  var DEFAULT_PRIORITY$2 = 1000;
30
19
  var slice = Array.prototype.slice;
@@ -683,9 +672,98 @@ var importModule = {
683
672
  importer: ['type', Importer]
684
673
  };
685
674
 
675
+ function editorFormFieldClasses(type, {
676
+ disabled = false
677
+ } = {}) {
678
+ if (!type) {
679
+ throw new Error('type required');
680
+ }
681
+ return classnames('fjs-form-field', `fjs-form-field-${type}`, {
682
+ 'fjs-disabled': disabled
683
+ });
684
+ }
685
+
686
+ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : 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); }
687
+ var CloseIcon = (({
688
+ styles = {},
689
+ ...props
690
+ }) => /*#__PURE__*/React.createElement("svg", _extends$2({
691
+ width: "16",
692
+ height: "16",
693
+ fill: "currentColor",
694
+ xmlns: "http://www.w3.org/2000/svg"
695
+ }, props), /*#__PURE__*/React.createElement("path", {
696
+ fillRule: "evenodd",
697
+ clipRule: "evenodd",
698
+ d: "M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7z"
699
+ })));
700
+
701
+ function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : 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); }
702
+ var SearchIcon = (({
703
+ styles = {},
704
+ ...props
705
+ }) => /*#__PURE__*/React.createElement("svg", _extends$1({
706
+ width: "15",
707
+ height: "15",
708
+ fill: "none",
709
+ xmlns: "http://www.w3.org/2000/svg"
710
+ }, props), /*#__PURE__*/React.createElement("path", {
711
+ d: "M14.5 13.793l-3.776-3.776a5.508 5.508 0 10-.707.707l3.776 3.776.707-.707zM2 6.5a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0z",
712
+ fill: "currentColor"
713
+ })));
714
+
715
+ function EditorText(props) {
716
+ const {
717
+ type,
718
+ text = ''
719
+ } = props.field;
720
+ const Icon = formJsViewer.iconsByType['text'];
721
+ if (!text) {
722
+ return jsxRuntime.jsx("div", {
723
+ class: editorFormFieldClasses(type),
724
+ children: jsxRuntime.jsxs("div", {
725
+ class: "fjs-form-field-placeholder",
726
+ children: [jsxRuntime.jsx(Icon, {
727
+ viewBox: "0 0 54 54"
728
+ }), "Text view is empty"]
729
+ })
730
+ });
731
+ }
732
+ if (formJsViewer.isExpression(text)) {
733
+ return jsxRuntime.jsx("div", {
734
+ class: editorFormFieldClasses(type),
735
+ children: jsxRuntime.jsxs("div", {
736
+ class: "fjs-form-field-placeholder",
737
+ children: [jsxRuntime.jsx(Icon, {
738
+ viewBox: "0 0 54 54"
739
+ }), "Text view is populated by an expression"]
740
+ })
741
+ });
742
+ }
743
+ return jsxRuntime.jsx(formJsViewer.Text, {
744
+ ...props,
745
+ disableLinks: true
746
+ });
747
+ }
748
+ EditorText.create = formJsViewer.Text.create;
749
+ EditorText.type = formJsViewer.Text.type;
750
+ EditorText.keyed = formJsViewer.Text.keyed;
751
+
752
+ const editorFormFields = [EditorText];
753
+
754
+ class EditorFormFields extends formJsViewer.FormFields {
755
+ constructor() {
756
+ super();
757
+ editorFormFields.forEach(formField => {
758
+ this.register(formField.type, formField);
759
+ });
760
+ }
761
+ }
762
+
686
763
  const DragAndDropContext = preact.createContext({
687
764
  drake: null
688
765
  });
766
+ var DragAndDropContext$1 = DragAndDropContext;
689
767
 
690
768
  /**
691
769
  * @param {string} type
@@ -697,11 +775,12 @@ function getService$1(type, strict) {}
697
775
  const FormEditorContext = preact.createContext({
698
776
  getService: getService$1
699
777
  });
778
+ var FormEditorContext$1 = FormEditorContext;
700
779
 
701
780
  function useService$1 (type, strict) {
702
781
  const {
703
782
  getService
704
- } = hooks$1.useContext(FormEditorContext);
783
+ } = hooks$1.useContext(FormEditorContext$1);
705
784
  return getService(type, strict);
706
785
  }
707
786
 
@@ -709,14 +788,157 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
709
788
  var ListDeleteIcon = (({
710
789
  styles = {},
711
790
  ...props
712
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends({
791
+ }) => /*#__PURE__*/React.createElement("svg", _extends({
713
792
  xmlns: "http://www.w3.org/2000/svg",
714
793
  width: "11",
715
794
  height: "14"
716
- }, props), /*#__PURE__*/React__default['default'].createElement("path", {
795
+ }, props), /*#__PURE__*/React.createElement("path", {
717
796
  d: "M10 4v8c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V4h9zM8 6H3v4.8c0 .66.5 1.2 1.111 1.2H6.89C7.5 12 8 11.46 8 10.8V6zm3-5H8.5l-1-1h-4l-1 1H0v1.5h11V1z"
718
797
  })));
719
798
 
799
+ const PALETTE_ENTRIES = formJsViewer.formFields.filter(f => f.type !== 'default').map(f => {
800
+ return {
801
+ label: f.label,
802
+ type: f.type,
803
+ group: f.group
804
+ };
805
+ });
806
+ const PALETTE_GROUPS = [{
807
+ label: 'Basic input',
808
+ id: 'basic-input'
809
+ }, {
810
+ label: 'Selection',
811
+ id: 'selection'
812
+ }, {
813
+ label: 'Presentation',
814
+ id: 'presentation'
815
+ }, {
816
+ label: 'Action',
817
+ id: 'action'
818
+ }];
819
+ function Palette(props) {
820
+ const [entries, setEntries] = hooks$1.useState(PALETTE_ENTRIES);
821
+ const [searchTerm, setSearchTerm] = hooks$1.useState('');
822
+ const inputRef = hooks$1.useRef();
823
+ const groups = groupEntries(entries);
824
+
825
+ // filter entries on search change
826
+ hooks$1.useEffect(() => {
827
+ const filter = entry => {
828
+ if (!searchTerm) {
829
+ return true;
830
+ }
831
+ const search = entry.label.toLowerCase();
832
+ return searchTerm.toLowerCase().split(/\s/g).every(term => search.includes(term));
833
+ };
834
+ const entries = PALETTE_ENTRIES.filter(filter);
835
+ setEntries(entries);
836
+ }, [searchTerm]);
837
+ const handleInput = hooks$1.useCallback(event => {
838
+ setSearchTerm(() => event.target.value);
839
+ }, [setSearchTerm]);
840
+ const handleClear = hooks$1.useCallback(event => {
841
+ setSearchTerm('');
842
+ inputRef.current.focus();
843
+ }, [inputRef, setSearchTerm]);
844
+ return jsxRuntime.jsxs("div", {
845
+ class: "fjs-palette",
846
+ children: [jsxRuntime.jsx("div", {
847
+ class: "fjs-palette-header",
848
+ title: "Components",
849
+ children: "Components"
850
+ }), jsxRuntime.jsxs("div", {
851
+ class: "fjs-palette-search-container",
852
+ children: [jsxRuntime.jsx("span", {
853
+ class: "fjs-palette-search-icon",
854
+ children: jsxRuntime.jsx(SearchIcon, {})
855
+ }), jsxRuntime.jsx("input", {
856
+ class: "fjs-palette-search",
857
+ ref: inputRef,
858
+ type: "text",
859
+ placeholder: "Search components",
860
+ value: searchTerm,
861
+ onInput: handleInput
862
+ }), searchTerm && jsxRuntime.jsx("button", {
863
+ title: "Clear content",
864
+ class: "fjs-palette-search-clear",
865
+ onClick: handleClear,
866
+ children: jsxRuntime.jsx(CloseIcon, {})
867
+ })]
868
+ }), jsxRuntime.jsxs("div", {
869
+ class: "fjs-palette-entries",
870
+ children: [groups.map(({
871
+ label,
872
+ entries,
873
+ id
874
+ }) => jsxRuntime.jsxs("div", {
875
+ class: "fjs-palette-group",
876
+ "data-group-id": id,
877
+ children: [jsxRuntime.jsx("span", {
878
+ class: "fjs-palette-group-title",
879
+ children: label
880
+ }), jsxRuntime.jsx("div", {
881
+ class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
882
+ children: entries.map(({
883
+ label,
884
+ type
885
+ }) => {
886
+ const Icon = formJsViewer.iconsByType[type];
887
+ return jsxRuntime.jsxs("div", {
888
+ class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
889
+ "data-field-type": type,
890
+ title: `Create a ${label} element`,
891
+ children: [Icon ? jsxRuntime.jsx(Icon, {
892
+ class: "fjs-palette-field-icon",
893
+ width: "36",
894
+ height: "36",
895
+ viewBox: "0 0 54 54"
896
+ }) : null, jsxRuntime.jsx("span", {
897
+ class: "fjs-palette-field-text",
898
+ children: label
899
+ })]
900
+ });
901
+ })
902
+ })]
903
+ })), groups.length == 0 && jsxRuntime.jsx("div", {
904
+ class: "fjs-palette-no-entries",
905
+ children: "No components found."
906
+ })]
907
+ })]
908
+ });
909
+ }
910
+
911
+ // helpers ///////
912
+
913
+ function groupEntries(entries) {
914
+ const groups = PALETTE_GROUPS.map(group => {
915
+ return {
916
+ ...group,
917
+ entries: []
918
+ };
919
+ });
920
+ const getGroup = id => groups.find(group => id === group.id);
921
+ entries.forEach(entry => {
922
+ const {
923
+ group
924
+ } = entry;
925
+ getGroup(group).entries.push(entry);
926
+ });
927
+ return groups.filter(g => g.entries.length);
928
+ }
929
+
930
+ const CURSOR_CLS_PATTERN = /^fjs-cursor-.*$/;
931
+ function set(mode) {
932
+ const classes = minDom.classes(document.body);
933
+ classes.removeMatching(CURSOR_CLS_PATTERN);
934
+ if (mode) {
935
+ classes.add('fjs-cursor-' + mode);
936
+ }
937
+ }
938
+ function unset() {
939
+ set(null);
940
+ }
941
+
720
942
  function ContextPad(props) {
721
943
  if (!props.children) {
722
944
  return null;
@@ -840,8 +1062,11 @@ function FormEditor$1(props) {
840
1062
  drake
841
1063
  };
842
1064
  hooks$1.useEffect(() => {
1065
+ const handleDragEvent = (type, context) => {
1066
+ return eventBus.fire(type, context);
1067
+ };
843
1068
  const createDragulaInstance = () => {
844
- const dragulaInstance = dragula__default['default']({
1069
+ const dragulaInstance = dragula({
845
1070
  isContainer(el) {
846
1071
  return el.classList.contains('fjs-drag-container');
847
1072
  },
@@ -854,6 +1079,56 @@ function FormEditor$1(props) {
854
1079
  slideFactorX: 10,
855
1080
  slideFactorY: 5
856
1081
  });
1082
+
1083
+ // bind life cycle events
1084
+ dragulaInstance.on('drag', (element, source) => {
1085
+ handleDragEvent('drag.start', {
1086
+ element,
1087
+ source
1088
+ });
1089
+ });
1090
+ dragulaInstance.on('dragend', element => {
1091
+ handleDragEvent('drag.end', {
1092
+ element
1093
+ });
1094
+ });
1095
+ dragulaInstance.on('drop', (element, target, source, sibling) => {
1096
+ handleDragEvent('drag.drop', {
1097
+ element,
1098
+ target,
1099
+ source,
1100
+ sibling
1101
+ });
1102
+ });
1103
+ dragulaInstance.on('over', (element, container, source) => {
1104
+ handleDragEvent('drag.hover', {
1105
+ element,
1106
+ container,
1107
+ source
1108
+ });
1109
+ });
1110
+ dragulaInstance.on('out', (element, container, source) => {
1111
+ handleDragEvent('drag.out', {
1112
+ element,
1113
+ container,
1114
+ source
1115
+ });
1116
+ });
1117
+ dragulaInstance.on('cancel', (element, container, source) => {
1118
+ handleDragEvent('drag.cancel', {
1119
+ element,
1120
+ container,
1121
+ source
1122
+ });
1123
+ });
1124
+
1125
+ // set custom styling
1126
+ dragulaInstance.on('drag', () => {
1127
+ set('grabbing');
1128
+ });
1129
+ dragulaInstance.on('dragend', () => {
1130
+ unset();
1131
+ });
857
1132
  dragulaInstance.on('drop', (el, target, source, sibling) => {
858
1133
  dragulaInstance.remove();
859
1134
  if (!target) {
@@ -910,9 +1185,7 @@ function FormEditor$1(props) {
910
1185
  const formContext = {
911
1186
  getService(type, strict = true) {
912
1187
  // TODO(philippfromme): clean up
913
- if (type === 'formFieldRegistry') {
914
- return new Map();
915
- } else if (type === 'form') {
1188
+ if (type === 'form') {
916
1189
  return {
917
1190
  _getState() {
918
1191
  return {
@@ -950,7 +1223,7 @@ function FormEditor$1(props) {
950
1223
  }, [propertiesPanelRef, propertiesPanel, hasDefaultPropertiesPanel]);
951
1224
  return jsxRuntime.jsxs("div", {
952
1225
  class: "fjs-form-editor",
953
- children: [jsxRuntime.jsxs(DragAndDropContext.Provider, {
1226
+ children: [jsxRuntime.jsxs(DragAndDropContext$1.Provider, {
954
1227
  value: dragAndDropContext,
955
1228
  children: [hasDefaultPalette && jsxRuntime.jsx("div", {
956
1229
  class: "fjs-editor-palette-container",
@@ -988,14 +1261,32 @@ function getFormFieldIndex(parent, formField) {
988
1261
  function CreatePreview(props) {
989
1262
  const {
990
1263
  drake
991
- } = hooks$1.useContext(DragAndDropContext);
1264
+ } = hooks$1.useContext(DragAndDropContext$1);
992
1265
  function handleCloned(clone, original, type) {
993
1266
  const fieldType = clone.dataset.fieldType;
994
1267
  const Icon = formJsViewer.iconsByType[fieldType];
1268
+ const {
1269
+ label
1270
+ } = findPaletteEntry(fieldType);
995
1271
  if (fieldType) {
996
1272
  clone.innerHTML = '';
997
1273
  clone.class = 'gu-mirror';
998
- preact.render(jsxRuntime.jsx(Icon, {}), clone);
1274
+ if (original.classList.contains('fjs-palette-field')) {
1275
+ preact.render(jsxRuntime.jsxs("div", {
1276
+ class: "fjs-palette-field",
1277
+ children: [jsxRuntime.jsx(Icon, {
1278
+ class: "fjs-palette-field-icon",
1279
+ width: "36",
1280
+ height: "36",
1281
+ viewBox: "0 0 54 54"
1282
+ }), jsxRuntime.jsx("span", {
1283
+ class: "fjs-palette-field-text",
1284
+ children: label
1285
+ })]
1286
+ }), clone);
1287
+ } else {
1288
+ preact.render(jsxRuntime.jsx(Icon, {}), clone);
1289
+ }
999
1290
  }
1000
1291
  }
1001
1292
  hooks$1.useEffect(() => {
@@ -1016,6 +1307,9 @@ function defaultPalette(paletteConfig) {
1016
1307
  function defaultPropertiesPanel(propertiesPanelConfig) {
1017
1308
  return !(propertiesPanelConfig && propertiesPanelConfig.parent);
1018
1309
  }
1310
+ function findPaletteEntry(type) {
1311
+ return PALETTE_ENTRIES.find(entry => entry.type === type);
1312
+ }
1019
1313
 
1020
1314
  class Renderer {
1021
1315
  constructor(renderConfig, eventBus, formEditor, injector) {
@@ -1041,7 +1335,7 @@ class Renderer {
1041
1335
  }
1042
1336
  return jsxRuntime.jsx("div", {
1043
1337
  class: `fjs-container fjs-editor-container ${compact ? 'fjs-editor-compact' : ''}`,
1044
- children: jsxRuntime.jsx(FormEditorContext.Provider, {
1338
+ children: jsxRuntime.jsx(FormEditorContext$1.Provider, {
1045
1339
  value: formEditorContext,
1046
1340
  children: jsxRuntime.jsx(FormEditor$1, {})
1047
1341
  })
@@ -1059,7 +1353,7 @@ Renderer.$inject = ['config.renderer', 'eventBus', 'formEditor', 'injector'];
1059
1353
 
1060
1354
  var renderModule = {
1061
1355
  __init__: ['formFields', 'renderer'],
1062
- formFields: ['type', formJsViewer.FormFields],
1356
+ formFields: ['type', EditorFormFields],
1063
1357
  renderer: ['type', Renderer]
1064
1358
  };
1065
1359
 
@@ -2376,10 +2670,40 @@ class KeyBehavior extends CommandInterceptor {
2376
2670
  }
2377
2671
  KeyBehavior.$inject = ['eventBus', 'modeling'];
2378
2672
 
2673
+ class ValidateBehavior extends CommandInterceptor {
2674
+ constructor(eventBus) {
2675
+ super(eventBus);
2676
+
2677
+ /**
2678
+ * Remove custom validation if <validationType> is about to be added.
2679
+ */
2680
+ // @ts-ignore-next-line
2681
+ this.preExecute('formField.edit', function (context) {
2682
+ const {
2683
+ properties
2684
+ } = context;
2685
+ const {
2686
+ validate = {}
2687
+ } = properties;
2688
+ if (validate.validationType) {
2689
+ const newValidate = {
2690
+ ...validate
2691
+ };
2692
+ delete newValidate.minLength;
2693
+ delete newValidate.maxLength;
2694
+ delete newValidate.pattern;
2695
+ properties['validate'] = newValidate;
2696
+ }
2697
+ }, true);
2698
+ }
2699
+ }
2700
+ ValidateBehavior.$inject = ['eventBus'];
2701
+
2379
2702
  var behaviorModule = {
2380
- __init__: ['idBehavior', 'keyBehavior'],
2703
+ __init__: ['idBehavior', 'keyBehavior', 'validateBehavior'],
2381
2704
  idBehavior: ['type', IdBehavior],
2382
- keyBehavior: ['type', KeyBehavior]
2705
+ keyBehavior: ['type', KeyBehavior],
2706
+ validateBehavior: ['type', ValidateBehavior]
2383
2707
  };
2384
2708
 
2385
2709
  /**
@@ -2880,79 +3204,6 @@ var SelectionModule = {
2880
3204
  selectionBehavior: ['type', SelectionBehavior]
2881
3205
  };
2882
3206
 
2883
- const types = [{
2884
- label: 'Text field',
2885
- type: 'textfield'
2886
- }, {
2887
- label: 'Text area',
2888
- type: 'textarea'
2889
- }, {
2890
- label: 'Number',
2891
- type: 'number'
2892
- }, {
2893
- label: 'Datetime',
2894
- type: 'datetime'
2895
- }, {
2896
- label: 'Checkbox',
2897
- type: 'checkbox'
2898
- }, {
2899
- label: 'Checklist',
2900
- type: 'checklist'
2901
- }, {
2902
- label: 'Taglist',
2903
- type: 'taglist'
2904
- }, {
2905
- label: 'Radio',
2906
- type: 'radio'
2907
- }, {
2908
- label: 'Select',
2909
- type: 'select'
2910
- }, {
2911
- label: 'Text view',
2912
- type: 'text'
2913
- }, {
2914
- label: 'Image view',
2915
- type: 'image'
2916
- }, {
2917
- label: 'Button',
2918
- type: 'button'
2919
- }];
2920
- function Palette(props) {
2921
- return jsxRuntime.jsxs("div", {
2922
- class: "fjs-palette",
2923
- children: [jsxRuntime.jsxs("div", {
2924
- class: "fjs-palette-header",
2925
- title: "Form elements library",
2926
- children: [jsxRuntime.jsx("span", {
2927
- class: "fjs-hide-compact",
2928
- children: "FORM ELEMENTS "
2929
- }), "LIBRARY"]
2930
- }), jsxRuntime.jsx("div", {
2931
- class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
2932
- children: types.map(({
2933
- label,
2934
- type
2935
- }) => {
2936
- const Icon = formJsViewer.iconsByType[type];
2937
- return jsxRuntime.jsxs("div", {
2938
- class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
2939
- "data-field-type": type,
2940
- title: `Create a ${label} element`,
2941
- children: [Icon ? jsxRuntime.jsx(Icon, {
2942
- class: "fjs-palette-field-icon",
2943
- width: "36",
2944
- height: "36",
2945
- viewBox: "0 0 54 54"
2946
- }) : null, jsxRuntime.jsx("span", {
2947
- class: "fjs-palette-field-text",
2948
- children: label
2949
- })]
2950
- });
2951
- })
2952
- })]
2953
- });
2954
- }
2955
-
2956
3207
  class PaletteRenderer {
2957
3208
  constructor(paletteConfig, eventBus) {
2958
3209
  const {
@@ -3174,19 +3425,19 @@ const ErrorsContext = preact.createContext({
3174
3425
  errors: {}
3175
3426
  });
3176
3427
 
3177
- /**
3178
- * @typedef {Function} <propertiesPanel.showEntry> callback
3179
- *
3180
- * @example
3181
- *
3182
- * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
3183
- * // ...
3184
- * });
3185
- *
3186
- * @param {Object} context
3187
- * @param {boolean} [context.focus]
3188
- *
3189
- * @returns void
3428
+ /**
3429
+ * @typedef {Function} <propertiesPanel.showEntry> callback
3430
+ *
3431
+ * @example
3432
+ *
3433
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
3434
+ * // ...
3435
+ * });
3436
+ *
3437
+ * @param {Object} context
3438
+ * @param {boolean} [context.focus]
3439
+ *
3440
+ * @returns void
3190
3441
  */
3191
3442
  const EventContext = preact.createContext({
3192
3443
  eventBus: null
@@ -3198,20 +3449,20 @@ const LayoutContext = preact.createContext({
3198
3449
  setLayoutForKey: () => {}
3199
3450
  });
3200
3451
 
3201
- /**
3202
- * Accesses the global DescriptionContext and returns a description for a given id and element.
3203
- *
3204
- * @example
3205
- * ```jsx
3206
- * function TextField(props) {
3207
- * const description = useDescriptionContext('input1', element);
3208
- * }
3209
- * ```
3210
- *
3211
- * @param {string} id
3212
- * @param {object} element
3213
- *
3214
- * @returns {string}
3452
+ /**
3453
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
3454
+ *
3455
+ * @example
3456
+ * ```jsx
3457
+ * function TextField(props) {
3458
+ * const description = useDescriptionContext('input1', element);
3459
+ * }
3460
+ * ```
3461
+ *
3462
+ * @param {string} id
3463
+ * @param {object} element
3464
+ *
3465
+ * @returns {string}
3215
3466
  */
3216
3467
  function useDescriptionContext(id, element) {
3217
3468
  const {
@@ -3226,11 +3477,11 @@ function useError(id) {
3226
3477
  return errors[id];
3227
3478
  }
3228
3479
 
3229
- /**
3230
- * Subscribe to an event immediately. Update subscription after inputs changed.
3231
- *
3232
- * @param {string} event
3233
- * @param {Function} callback
3480
+ /**
3481
+ * Subscribe to an event immediately. Update subscription after inputs changed.
3482
+ *
3483
+ * @param {string} event
3484
+ * @param {Function} callback
3234
3485
  */
3235
3486
  function useEvent(event, callback, eventBus) {
3236
3487
  const eventContext = hooks$1.useContext(EventContext);
@@ -3260,20 +3511,20 @@ function useEvent(event, callback, eventBus) {
3260
3511
  }, [callback, event, eventBus]);
3261
3512
  }
3262
3513
 
3263
- /**
3264
- * Creates a state that persists in the global LayoutContext.
3265
- *
3266
- * @example
3267
- * ```jsx
3268
- * function Group(props) {
3269
- * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
3270
- * }
3271
- * ```
3272
- *
3273
- * @param {(string|number)[]} path
3274
- * @param {any} [defaultValue]
3275
- *
3276
- * @returns {[ any, Function ]}
3514
+ /**
3515
+ * Creates a state that persists in the global LayoutContext.
3516
+ *
3517
+ * @example
3518
+ * ```jsx
3519
+ * function Group(props) {
3520
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
3521
+ * }
3522
+ * ```
3523
+ *
3524
+ * @param {(string|number)[]} path
3525
+ * @param {any} [defaultValue]
3526
+ *
3527
+ * @returns {[ any, Function ]}
3277
3528
  */
3278
3529
  function useLayoutState(path, defaultValue) {
3279
3530
  const {
@@ -3292,11 +3543,11 @@ function useLayoutState(path, defaultValue) {
3292
3543
  return [value, setState];
3293
3544
  }
3294
3545
 
3295
- /**
3296
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
3297
- * state on updates.
3298
- *
3299
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
3546
+ /**
3547
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
3548
+ * state on updates.
3549
+ *
3550
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
3300
3551
  */
3301
3552
 
3302
3553
  function usePrevious(value) {
@@ -3307,12 +3558,12 @@ function usePrevious(value) {
3307
3558
  return ref.current;
3308
3559
  }
3309
3560
 
3310
- /**
3311
- * Subscribe to `propertiesPanel.showEntry`.
3312
- *
3313
- * @param {string} id
3314
- *
3315
- * @returns {import('preact').Ref}
3561
+ /**
3562
+ * Subscribe to `propertiesPanel.showEntry`.
3563
+ *
3564
+ * @param {string} id
3565
+ *
3566
+ * @returns {import('preact').Ref}
3316
3567
  */
3317
3568
  function useShowEntryEvent(id) {
3318
3569
  const {
@@ -3343,20 +3594,20 @@ function useShowEntryEvent(id) {
3343
3594
  return ref;
3344
3595
  }
3345
3596
 
3346
- /**
3347
- * @callback setSticky
3348
- * @param {boolean} value
3597
+ /**
3598
+ * @callback setSticky
3599
+ * @param {boolean} value
3349
3600
  */
3350
3601
 
3351
- /**
3352
- * Use IntersectionObserver to identify when DOM element is in sticky mode.
3353
- * If sticky is observered setSticky(true) will be called.
3354
- * If sticky mode is left, setSticky(false) will be called.
3355
- *
3356
- *
3357
- * @param {Object} ref
3358
- * @param {string} scrollContainerSelector
3359
- * @param {setSticky} setSticky
3602
+ /**
3603
+ * Use IntersectionObserver to identify when DOM element is in sticky mode.
3604
+ * If sticky is observered setSticky(true) will be called.
3605
+ * If sticky mode is left, setSticky(false) will be called.
3606
+ *
3607
+ *
3608
+ * @param {Object} ref
3609
+ * @param {string} scrollContainerSelector
3610
+ * @param {setSticky} setSticky
3360
3611
  */
3361
3612
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
3362
3613
  hooks$1.useEffect(() => {
@@ -3395,19 +3646,19 @@ function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky)
3395
3646
  }, [ref, scrollContainerSelector, setSticky]);
3396
3647
  }
3397
3648
 
3398
- /**
3399
- * Creates a static function reference with changing body.
3400
- * This is necessary when external libraries require a callback function
3401
- * that has references to state variables.
3402
- *
3403
- * Usage:
3404
- * const callback = useStaticCallback((val) => {val === currentState});
3405
- *
3406
- * The `callback` reference is static and can be safely used in external
3407
- * libraries or as a prop that does not cause rerendering of children.
3408
- *
3409
- * @param {Function} callback function with changing reference
3410
- * @returns {Function} static function reference
3649
+ /**
3650
+ * Creates a static function reference with changing body.
3651
+ * This is necessary when external libraries require a callback function
3652
+ * that has references to state variables.
3653
+ *
3654
+ * Usage:
3655
+ * const callback = useStaticCallback((val) => {val === currentState});
3656
+ *
3657
+ * The `callback` reference is static and can be safely used in external
3658
+ * libraries or as a prop that does not cause rerendering of children.
3659
+ *
3660
+ * @param {Function} callback function with changing reference
3661
+ * @returns {Function} static function reference
3411
3662
  */
3412
3663
  function useStaticCallback(callback) {
3413
3664
  const callbackRef = hooks$1.useRef(callback);
@@ -3457,7 +3708,7 @@ function Group(props) {
3457
3708
  "data-group-id": 'group-' + id,
3458
3709
  ref: groupRef,
3459
3710
  children: [jsxRuntime.jsxs("div", {
3460
- class: classnames__default['default']('bio-properties-panel-group-header', edited ? '' : 'empty', open ? 'open' : '', sticky && open ? 'sticky' : ''),
3711
+ class: classnames('bio-properties-panel-group-header', edited ? '' : 'empty', open ? 'open' : '', sticky && open ? 'sticky' : ''),
3461
3712
  onClick: toggleOpen,
3462
3713
  children: [jsxRuntime.jsx("div", {
3463
3714
  title: label,
@@ -3474,7 +3725,7 @@ function Group(props) {
3474
3725
  })]
3475
3726
  })]
3476
3727
  }), jsxRuntime.jsx("div", {
3477
- class: classnames__default['default']('bio-properties-panel-group-entries', open ? 'open' : ''),
3728
+ class: classnames('bio-properties-panel-group-entries', open ? 'open' : ''),
3478
3729
  children: jsxRuntime.jsx(LayoutContext.Provider, {
3479
3730
  value: propertiesPanelContext,
3480
3731
  children: entries.map(entry => {
@@ -3499,13 +3750,13 @@ function DataMarker() {
3499
3750
  });
3500
3751
  }
3501
3752
 
3502
- /**
3503
- * @typedef { {
3504
- * text: (element: object) => string,
3505
- * icon?: (element: Object) => import('preact').Component
3506
- * } } PlaceholderDefinition
3507
- *
3508
- * @param { PlaceholderDefinition } props
3753
+ /**
3754
+ * @typedef { {
3755
+ * text: (element: object) => string,
3756
+ * icon?: (element: Object) => import('preact').Component
3757
+ * } } PlaceholderDefinition
3758
+ *
3759
+ * @param { PlaceholderDefinition } props
3509
3760
  */
3510
3761
  function Placeholder(props) {
3511
3762
  const {
@@ -3530,72 +3781,72 @@ const DEFAULT_LAYOUT = {
3530
3781
  };
3531
3782
  const DEFAULT_DESCRIPTION = {};
3532
3783
 
3533
- /**
3534
- * @typedef { {
3535
- * component: import('preact').Component,
3536
- * id: String,
3537
- * isEdited?: Function
3538
- * } } EntryDefinition
3539
- *
3540
- * @typedef { {
3541
- * autoFocusEntry: String,
3542
- * autoOpen?: Boolean,
3543
- * entries: Array<EntryDefinition>,
3544
- * id: String,
3545
- * label: String,
3546
- * remove: (event: MouseEvent) => void
3547
- * } } ListItemDefinition
3548
- *
3549
- * @typedef { {
3550
- * add: (event: MouseEvent) => void,
3551
- * component: import('preact').Component,
3552
- * element: Object,
3553
- * id: String,
3554
- * items: Array<ListItemDefinition>,
3555
- * label: String,
3556
- * shouldSort?: Boolean,
3557
- * shouldOpen?: Boolean
3558
- * } } ListGroupDefinition
3559
- *
3560
- * @typedef { {
3561
- * component?: import('preact').Component,
3562
- * entries: Array<EntryDefinition>,
3563
- * id: String,
3564
- * label: String,
3565
- * shouldOpen?: Boolean
3566
- * } } GroupDefinition
3567
- *
3568
- * @typedef { {
3569
- * [id: String]: GetDescriptionFunction
3570
- * } } DescriptionConfig
3571
- *
3572
- * @callback { {
3573
- * @param {string} id
3574
- * @param {Object} element
3575
- * @returns {string}
3576
- * } } GetDescriptionFunction
3577
- *
3578
- * @typedef { {
3579
- * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
3580
- * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
3581
- * } } PlaceholderProvider
3582
- *
3784
+ /**
3785
+ * @typedef { {
3786
+ * component: import('preact').Component,
3787
+ * id: String,
3788
+ * isEdited?: Function
3789
+ * } } EntryDefinition
3790
+ *
3791
+ * @typedef { {
3792
+ * autoFocusEntry: String,
3793
+ * autoOpen?: Boolean,
3794
+ * entries: Array<EntryDefinition>,
3795
+ * id: String,
3796
+ * label: String,
3797
+ * remove: (event: MouseEvent) => void
3798
+ * } } ListItemDefinition
3799
+ *
3800
+ * @typedef { {
3801
+ * add: (event: MouseEvent) => void,
3802
+ * component: import('preact').Component,
3803
+ * element: Object,
3804
+ * id: String,
3805
+ * items: Array<ListItemDefinition>,
3806
+ * label: String,
3807
+ * shouldSort?: Boolean,
3808
+ * shouldOpen?: Boolean
3809
+ * } } ListGroupDefinition
3810
+ *
3811
+ * @typedef { {
3812
+ * component?: import('preact').Component,
3813
+ * entries: Array<EntryDefinition>,
3814
+ * id: String,
3815
+ * label: String,
3816
+ * shouldOpen?: Boolean
3817
+ * } } GroupDefinition
3818
+ *
3819
+ * @typedef { {
3820
+ * [id: String]: GetDescriptionFunction
3821
+ * } } DescriptionConfig
3822
+ *
3823
+ * @callback { {
3824
+ * @param {string} id
3825
+ * @param {Object} element
3826
+ * @returns {string}
3827
+ * } } GetDescriptionFunction
3828
+ *
3829
+ * @typedef { {
3830
+ * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
3831
+ * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
3832
+ * } } PlaceholderProvider
3833
+ *
3583
3834
  */
3584
3835
 
3585
- /**
3586
- * A basic properties panel component. Describes *how* content will be rendered, accepts
3587
- * data from implementor to describe *what* will be rendered.
3588
- *
3589
- * @param {Object} props
3590
- * @param {Object|Array} props.element
3591
- * @param {import('./components/Header').HeaderProvider} props.headerProvider
3592
- * @param {PlaceholderProvider} [props.placeholderProvider]
3593
- * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
3594
- * @param {Object} [props.layoutConfig]
3595
- * @param {Function} [props.layoutChanged]
3596
- * @param {DescriptionConfig} [props.descriptionConfig]
3597
- * @param {Function} [props.descriptionLoaded]
3598
- * @param {Object} [props.eventBus]
3836
+ /**
3837
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
3838
+ * data from implementor to describe *what* will be rendered.
3839
+ *
3840
+ * @param {Object} props
3841
+ * @param {Object|Array} props.element
3842
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
3843
+ * @param {PlaceholderProvider} [props.placeholderProvider]
3844
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
3845
+ * @param {Object} [props.layoutConfig]
3846
+ * @param {Function} [props.layoutChanged]
3847
+ * @param {DescriptionConfig} [props.descriptionConfig]
3848
+ * @param {Function} [props.descriptionLoaded]
3849
+ * @param {Object} [props.eventBus]
3599
3850
  */
3600
3851
  function PropertiesPanel(props) {
3601
3852
  const {
@@ -3683,7 +3934,7 @@ function PropertiesPanel(props) {
3683
3934
  children: jsxRuntime.jsx(EventContext.Provider, {
3684
3935
  value: eventContext,
3685
3936
  children: jsxRuntime.jsxs("div", {
3686
- class: classnames__default['default']('bio-properties-panel', layout.open ? 'open' : ''),
3937
+ class: classnames('bio-properties-panel', layout.open ? 'open' : ''),
3687
3938
  children: [jsxRuntime.jsx(Header, {
3688
3939
  element: element,
3689
3940
  headerProvider: headerProvider
@@ -3751,13 +4002,13 @@ function CollapsibleEntry(props) {
3751
4002
  const placeholderLabel = '<empty>';
3752
4003
  return jsxRuntime.jsxs("div", {
3753
4004
  "data-entry-id": id,
3754
- class: classnames__default['default']('bio-properties-panel-collapsible-entry', open ? 'open' : ''),
4005
+ class: classnames('bio-properties-panel-collapsible-entry', open ? 'open' : ''),
3755
4006
  children: [jsxRuntime.jsxs("div", {
3756
4007
  class: "bio-properties-panel-collapsible-entry-header",
3757
4008
  onClick: toggleOpen,
3758
4009
  children: [jsxRuntime.jsx("div", {
3759
4010
  title: label || placeholderLabel,
3760
- class: classnames__default['default']('bio-properties-panel-collapsible-entry-header-title', !label && 'empty'),
4011
+ class: classnames('bio-properties-panel-collapsible-entry-header-title', !label && 'empty'),
3761
4012
  children: label || placeholderLabel
3762
4013
  }), jsxRuntime.jsx("button", {
3763
4014
  title: "Toggle list item",
@@ -3772,7 +4023,7 @@ function CollapsibleEntry(props) {
3772
4023
  children: jsxRuntime.jsx(DeleteIcon, {})
3773
4024
  }) : null]
3774
4025
  }), jsxRuntime.jsx("div", {
3775
- class: classnames__default['default']('bio-properties-panel-collapsible-entry-entries', open ? 'open' : ''),
4026
+ class: classnames('bio-properties-panel-collapsible-entry-entries', open ? 'open' : ''),
3776
4027
  children: jsxRuntime.jsx(LayoutContext.Provider, {
3777
4028
  value: propertiesPanelContext,
3778
4029
  children: entries.map(entry => {
@@ -3820,8 +4071,8 @@ function ListItem(props) {
3820
4071
  }
3821
4072
  const noop$2 = () => {};
3822
4073
 
3823
- /**
3824
- * @param {import('../PropertiesPanel').ListGroupDefinition} props
4074
+ /**
4075
+ * @param {import('../PropertiesPanel').ListGroupDefinition} props
3825
4076
  */
3826
4077
  function ListGroup(props) {
3827
4078
  const {
@@ -3926,7 +4177,7 @@ function ListGroup(props) {
3926
4177
  "data-group-id": 'group-' + id,
3927
4178
  ref: groupRef,
3928
4179
  children: [jsxRuntime.jsxs("div", {
3929
- class: classnames__default['default']('bio-properties-panel-group-header', hasItems ? '' : 'empty', hasItems && open ? 'open' : '', sticky && open ? 'sticky' : ''),
4180
+ class: classnames('bio-properties-panel-group-header', hasItems ? '' : 'empty', hasItems && open ? 'open' : '', sticky && open ? 'sticky' : ''),
3930
4181
  onClick: hasItems ? toggleOpen : noop$2,
3931
4182
  children: [jsxRuntime.jsx("div", {
3932
4183
  title: label,
@@ -3955,7 +4206,7 @@ function ListGroup(props) {
3955
4206
  }) : null]
3956
4207
  })]
3957
4208
  }), jsxRuntime.jsx("div", {
3958
- class: classnames__default['default']('bio-properties-panel-list', open && hasItems ? 'open' : ''),
4209
+ class: classnames('bio-properties-panel-list', open && hasItems ? 'open' : ''),
3959
4210
  children: jsxRuntime.jsx(LayoutContext.Provider, {
3960
4211
  value: propertiesPanelContext,
3961
4212
  children: ordering.map((o, index) => {
@@ -3984,8 +4235,8 @@ function ListGroup(props) {
3984
4235
 
3985
4236
  // helpers ////////////////////
3986
4237
 
3987
- /**
3988
- * Sorts given items alphanumeric by label
4238
+ /**
4239
+ * Sorts given items alphanumeric by label
3989
4240
  */
3990
4241
  function sortItems(items) {
3991
4242
  return minDash.sortBy(items, i => i.label.toLowerCase());
@@ -4059,17 +4310,17 @@ function Checkbox(props) {
4059
4310
  });
4060
4311
  }
4061
4312
 
4062
- /**
4063
- * @param {Object} props
4064
- * @param {Object} props.element
4065
- * @param {String} props.id
4066
- * @param {String} props.description
4067
- * @param {String} props.label
4068
- * @param {Function} props.getValue
4069
- * @param {Function} props.setValue
4070
- * @param {Function} props.onFocus
4071
- * @param {Function} props.onBlur
4072
- * @param {boolean} [props.disabled]
4313
+ /**
4314
+ * @param {Object} props
4315
+ * @param {Object} props.element
4316
+ * @param {String} props.id
4317
+ * @param {String} props.description
4318
+ * @param {String} props.label
4319
+ * @param {Function} props.getValue
4320
+ * @param {Function} props.setValue
4321
+ * @param {Function} props.onFocus
4322
+ * @param {Function} props.onBlur
4323
+ * @param {boolean} [props.disabled]
4073
4324
  */
4074
4325
  function CheckboxEntry(props) {
4075
4326
  const {
@@ -4157,10 +4408,10 @@ const CodeEditor = React.forwardRef((props, ref) => {
4157
4408
  hooks$1.useEffect(() => {
4158
4409
  let editor;
4159
4410
 
4160
- /* Trigger FEEL toggle when
4161
- *
4162
- * - `backspace` is pressed
4163
- * - AND the cursor is at the beginning of the input
4411
+ /* Trigger FEEL toggle when
4412
+ *
4413
+ * - `backspace` is pressed
4414
+ * - AND the cursor is at the beginning of the input
4164
4415
  */
4165
4416
  const onKeyDown = e => {
4166
4417
  if (e.key !== 'Backspace' || !editor) {
@@ -4172,7 +4423,7 @@ const CodeEditor = React.forwardRef((props, ref) => {
4172
4423
  onFeelToggle();
4173
4424
  }
4174
4425
  };
4175
- editor = new FeelEditor__default['default']({
4426
+ editor = new FeelEditor({
4176
4427
  container: inputRef.current,
4177
4428
  onChange: handleInput,
4178
4429
  onKeyDown: onKeyDown,
@@ -4208,10 +4459,10 @@ const CodeEditor = React.forwardRef((props, ref) => {
4208
4459
  ref.current.focus();
4209
4460
  };
4210
4461
  return jsxRuntime.jsx("div", {
4211
- class: classnames__default['default']('bio-properties-panel-feel-editor-container', disabled ? 'disabled' : null),
4462
+ class: classnames('bio-properties-panel-feel-editor-container', disabled ? 'disabled' : null),
4212
4463
  children: jsxRuntime.jsx("div", {
4213
4464
  name: props.name,
4214
- class: classnames__default['default']('bio-properties-panel-input', localValue ? 'edited' : null),
4465
+ class: classnames('bio-properties-panel-input', localValue ? 'edited' : null),
4215
4466
  ref: inputRef,
4216
4467
  onClick: handleClick
4217
4468
  })
@@ -4231,10 +4482,10 @@ function FeelIndicator(props) {
4231
4482
  }
4232
4483
  const noop$1 = () => {};
4233
4484
 
4234
- /**
4235
- * @param {Object} props
4236
- * @param {Object} props.label
4237
- * @param {String} props.feel
4485
+ /**
4486
+ * @param {Object} props
4487
+ * @param {Object} props.label
4488
+ * @param {String} props.feel
4238
4489
  */
4239
4490
  function FeelIcon(props) {
4240
4491
  const {
@@ -4255,7 +4506,7 @@ function FeelIcon(props) {
4255
4506
  }
4256
4507
  };
4257
4508
  return jsxRuntime.jsx("button", {
4258
- class: classnames__default['default']('bio-properties-panel-feel-icon', active ? 'active' : null, feel === 'required' ? 'required' : 'optional'),
4509
+ class: classnames('bio-properties-panel-feel-icon', active ? 'active' : null, feel === 'required' ? 'required' : 'optional'),
4259
4510
  onClick: handleClick,
4260
4511
  disabled: feel === 'required' || disabled,
4261
4512
  title: label + (feel === 'required' ? feelRequiredLabel : feelOptionalLabel),
@@ -4508,17 +4759,17 @@ const OptionalFeelTextArea = React.forwardRef((props, ref) => {
4508
4759
  });
4509
4760
  });
4510
4761
 
4511
- /**
4512
- * @param {Object} props
4513
- * @param {Object} props.element
4514
- * @param {String} props.id
4515
- * @param {String} props.description
4516
- * @param {Boolean} props.debounce
4517
- * @param {Boolean} props.disabled
4518
- * @param {String} props.label
4519
- * @param {Function} props.getValue
4520
- * @param {Function} props.setValue
4521
- * @param {Function} props.validate
4762
+ /**
4763
+ * @param {Object} props
4764
+ * @param {Object} props.element
4765
+ * @param {String} props.id
4766
+ * @param {String} props.description
4767
+ * @param {Boolean} props.debounce
4768
+ * @param {Boolean} props.disabled
4769
+ * @param {String} props.label
4770
+ * @param {Function} props.getValue
4771
+ * @param {Function} props.setValue
4772
+ * @param {Function} props.validate
4522
4773
  */
4523
4774
  function FeelEntry(props) {
4524
4775
  const {
@@ -4574,7 +4825,7 @@ function FeelEntry(props) {
4574
4825
  const temporaryError = useError(id);
4575
4826
  const error = localError || temporaryError || validationError;
4576
4827
  return jsxRuntime.jsxs("div", {
4577
- class: classnames__default['default'](props.class, 'bio-properties-panel-entry', error ? 'has-error' : ''),
4828
+ class: classnames(props.class, 'bio-properties-panel-entry', error ? 'has-error' : ''),
4578
4829
  "data-entry-id": id,
4579
4830
  children: [jsxRuntime.jsx(FeelTextfield, {
4580
4831
  debounce: debounce,
@@ -4603,19 +4854,19 @@ function FeelEntry(props) {
4603
4854
  });
4604
4855
  }
4605
4856
 
4606
- /**
4607
- * @param {Object} props
4608
- * @param {Object} props.element
4609
- * @param {String} props.id
4610
- * @param {String} props.description
4611
- * @param {Boolean} props.debounce
4612
- * @param {Boolean} props.disabled
4613
- * @param {String} props.label
4614
- * @param {Function} props.getValue
4615
- * @param {Function} props.setValue
4616
- * @param {Function} props.onFocus
4617
- * @param {Function} props.onBlur
4618
- * @param {Function} props.validate
4857
+ /**
4858
+ * @param {Object} props
4859
+ * @param {Object} props.element
4860
+ * @param {String} props.id
4861
+ * @param {String} props.description
4862
+ * @param {Boolean} props.debounce
4863
+ * @param {Boolean} props.disabled
4864
+ * @param {String} props.label
4865
+ * @param {Function} props.getValue
4866
+ * @param {Function} props.setValue
4867
+ * @param {Function} props.onFocus
4868
+ * @param {Function} props.onBlur
4869
+ * @param {Function} props.validate
4619
4870
  */
4620
4871
  function FeelTextArea(props) {
4621
4872
  return jsxRuntime.jsx(FeelEntry, {
@@ -4694,21 +4945,22 @@ function NumberField(props) {
4694
4945
  });
4695
4946
  }
4696
4947
 
4697
- /**
4698
- * @param {Object} props
4699
- * @param {Boolean} props.debounce
4700
- * @param {String} props.description
4701
- * @param {Boolean} props.disabled
4702
- * @param {Object} props.element
4703
- * @param {Function} props.getValue
4704
- * @param {String} props.id
4705
- * @param {String} props.label
4706
- * @param {String} props.max
4707
- * @param {String} props.min
4708
- * @param {Function} props.setValue
4709
- * @param {Function} props.onFocus
4710
- * @param {Function} props.onBlur
4711
- * @param {String} props.step
4948
+ /**
4949
+ * @param {Object} props
4950
+ * @param {Boolean} props.debounce
4951
+ * @param {String} props.description
4952
+ * @param {Boolean} props.disabled
4953
+ * @param {Object} props.element
4954
+ * @param {Function} props.getValue
4955
+ * @param {String} props.id
4956
+ * @param {String} props.label
4957
+ * @param {String} props.max
4958
+ * @param {String} props.min
4959
+ * @param {Function} props.setValue
4960
+ * @param {Function} props.onFocus
4961
+ * @param {Function} props.onBlur
4962
+ * @param {String} props.step
4963
+ * @param {Function} props.validate
4712
4964
  */
4713
4965
  function NumberFieldEntry(props) {
4714
4966
  const {
@@ -4724,25 +4976,55 @@ function NumberFieldEntry(props) {
4724
4976
  setValue,
4725
4977
  step,
4726
4978
  onFocus,
4727
- onBlur
4979
+ onBlur,
4980
+ validate
4728
4981
  } = props;
4729
- const value = getValue(element);
4982
+ const [cachedInvalidValue, setCachedInvalidValue] = hooks$1.useState(null);
4983
+ const globalError = useError(id);
4984
+ const [localError, setLocalError] = hooks$1.useState(null);
4985
+ let value = getValue(element);
4986
+ const previousValue = usePrevious(value);
4987
+ hooks$1.useEffect(() => {
4988
+ if (minDash.isFunction(validate)) {
4989
+ const newValidationError = validate(value) || null;
4990
+ setLocalError(newValidationError);
4991
+ }
4992
+ }, [value]);
4993
+ const onInput = newValue => {
4994
+ let newValidationError = null;
4995
+ if (minDash.isFunction(validate)) {
4996
+ newValidationError = validate(newValue) || null;
4997
+ }
4998
+ if (newValidationError) {
4999
+ setCachedInvalidValue(newValue);
5000
+ } else {
5001
+ setValue(newValue);
5002
+ }
5003
+ setLocalError(newValidationError);
5004
+ };
5005
+ if (previousValue === value && localError) {
5006
+ value = cachedInvalidValue;
5007
+ }
5008
+ const error = globalError || localError;
4730
5009
  return jsxRuntime.jsxs("div", {
4731
- class: "bio-properties-panel-entry",
5010
+ class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
4732
5011
  "data-entry-id": id,
4733
5012
  children: [jsxRuntime.jsx(NumberField, {
4734
5013
  debounce: debounce,
4735
5014
  disabled: disabled,
4736
5015
  id: id,
4737
5016
  label: label,
4738
- onInput: setValue,
4739
5017
  onFocus: onFocus,
4740
5018
  onBlur: onBlur,
5019
+ onInput: onInput,
4741
5020
  max: max,
4742
5021
  min: min,
4743
5022
  step: step,
4744
5023
  value: value
4745
- }, element), jsxRuntime.jsx(Description$1, {
5024
+ }, element), error && jsxRuntime.jsx("div", {
5025
+ class: "bio-properties-panel-error",
5026
+ children: error
5027
+ }), jsxRuntime.jsx(Description$1, {
4746
5028
  forId: id,
4747
5029
  element: element,
4748
5030
  value: description
@@ -4764,7 +5046,7 @@ function Select(props) {
4764
5046
  label,
4765
5047
  onChange,
4766
5048
  options = [],
4767
- value,
5049
+ value = '',
4768
5050
  disabled,
4769
5051
  onFocus,
4770
5052
  onBlur
@@ -4813,18 +5095,18 @@ function Select(props) {
4813
5095
  });
4814
5096
  }
4815
5097
 
4816
- /**
4817
- * @param {object} props
4818
- * @param {object} props.element
4819
- * @param {string} props.id
4820
- * @param {string} [props.description]
4821
- * @param {string} props.label
4822
- * @param {Function} props.getValue
4823
- * @param {Function} props.setValue
4824
- * @param {Function} props.onFocus
4825
- * @param {Function} props.onBlur
4826
- * @param {Function} props.getOptions
4827
- * @param {boolean} [props.disabled]
5098
+ /**
5099
+ * @param {object} props
5100
+ * @param {object} props.element
5101
+ * @param {string} props.id
5102
+ * @param {string} [props.description]
5103
+ * @param {string} props.label
5104
+ * @param {Function} props.getValue
5105
+ * @param {Function} props.setValue
5106
+ * @param {Function} props.onFocus
5107
+ * @param {Function} props.onBlur
5108
+ * @param {Function} props.getOptions
5109
+ * @param {boolean} [props.disabled]
4828
5110
  */
4829
5111
  function SelectEntry(props) {
4830
5112
  const {
@@ -4843,7 +5125,7 @@ function SelectEntry(props) {
4843
5125
  const options = getOptions(element);
4844
5126
  const error = useError(id);
4845
5127
  return jsxRuntime.jsxs("div", {
4846
- class: classnames__default['default']('bio-properties-panel-entry', error ? 'has-error' : ''),
5128
+ class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
4847
5129
  "data-entry-id": id,
4848
5130
  children: [jsxRuntime.jsx(Select, {
4849
5131
  id: id,
@@ -4914,7 +5196,7 @@ function TextArea(props) {
4914
5196
  id: prefixId$2(id),
4915
5197
  name: id,
4916
5198
  spellCheck: "false",
4917
- class: classnames__default['default']('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : ''),
5199
+ class: classnames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : ''),
4918
5200
  onInput: handleInput,
4919
5201
  onFocus: onFocus,
4920
5202
  onBlur: onBlur,
@@ -4926,20 +5208,20 @@ function TextArea(props) {
4926
5208
  });
4927
5209
  }
4928
5210
 
4929
- /**
4930
- * @param {object} props
4931
- * @param {object} props.element
4932
- * @param {string} props.id
4933
- * @param {string} props.description
4934
- * @param {boolean} props.debounce
4935
- * @param {string} props.label
4936
- * @param {Function} props.getValue
4937
- * @param {Function} props.setValue
4938
- * @param {Function} props.onFocus
4939
- * @param {Function} props.onBlur
4940
- * @param {number} props.rows
4941
- * @param {boolean} props.monospace
4942
- * @param {boolean} [props.disabled]
5211
+ /**
5212
+ * @param {object} props
5213
+ * @param {object} props.element
5214
+ * @param {string} props.id
5215
+ * @param {string} props.description
5216
+ * @param {boolean} props.debounce
5217
+ * @param {string} props.label
5218
+ * @param {Function} props.getValue
5219
+ * @param {Function} props.setValue
5220
+ * @param {Function} props.onFocus
5221
+ * @param {Function} props.onBlur
5222
+ * @param {number} props.rows
5223
+ * @param {boolean} props.monospace
5224
+ * @param {boolean} [props.disabled]
4943
5225
  */
4944
5226
  function TextAreaEntry(props) {
4945
5227
  const {
@@ -4959,7 +5241,7 @@ function TextAreaEntry(props) {
4959
5241
  const value = getValue(element);
4960
5242
  const error = useError(id);
4961
5243
  return jsxRuntime.jsxs("div", {
4962
- class: classnames__default['default']('bio-properties-panel-entry', error ? 'has-error' : ''),
5244
+ class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
4963
5245
  "data-entry-id": id,
4964
5246
  children: [jsxRuntime.jsx(TextArea, {
4965
5247
  id: id,
@@ -5042,19 +5324,19 @@ function Textfield(props) {
5042
5324
  });
5043
5325
  }
5044
5326
 
5045
- /**
5046
- * @param {Object} props
5047
- * @param {Object} props.element
5048
- * @param {String} props.id
5049
- * @param {String} props.description
5050
- * @param {Boolean} props.debounce
5051
- * @param {Boolean} props.disabled
5052
- * @param {String} props.label
5053
- * @param {Function} props.getValue
5054
- * @param {Function} props.setValue
5055
- * @param {Function} props.onFocus
5056
- * @param {Function} props.onBlur
5057
- * @param {Function} props.validate
5327
+ /**
5328
+ * @param {Object} props
5329
+ * @param {Object} props.element
5330
+ * @param {String} props.id
5331
+ * @param {String} props.description
5332
+ * @param {Boolean} props.debounce
5333
+ * @param {Boolean} props.disabled
5334
+ * @param {String} props.label
5335
+ * @param {Function} props.getValue
5336
+ * @param {Function} props.setValue
5337
+ * @param {Function} props.onFocus
5338
+ * @param {Function} props.onBlur
5339
+ * @param {Function} props.validate
5058
5340
  */
5059
5341
  function TextfieldEntry(props) {
5060
5342
  const {
@@ -5098,7 +5380,7 @@ function TextfieldEntry(props) {
5098
5380
  }
5099
5381
  const error = globalError || localError;
5100
5382
  return jsxRuntime.jsxs("div", {
5101
- class: classnames__default['default']('bio-properties-panel-entry', error ? 'has-error' : ''),
5383
+ class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
5102
5384
  "data-entry-id": id,
5103
5385
  children: [jsxRuntime.jsx(Textfield, {
5104
5386
  debounce: debounce,
@@ -5139,6 +5421,7 @@ function getService(type, strict) {}
5139
5421
  const PropertiesPanelContext = preact.createContext({
5140
5422
  getService
5141
5423
  });
5424
+ var FormPropertiesPanelContext = PropertiesPanelContext;
5142
5425
 
5143
5426
  function arrayAdd(array, index, item) {
5144
5427
  const copy = [...array];
@@ -5146,7 +5429,7 @@ function arrayAdd(array, index, item) {
5146
5429
  return copy;
5147
5430
  }
5148
5431
  function countDecimals(number) {
5149
- const num = Big__default['default'](number);
5432
+ const num = Big(number);
5150
5433
  if (num.toString() === num.toFixed(0)) return 0;
5151
5434
  return num.toFixed().split('.')[1].length || 0;
5152
5435
  }
@@ -5290,7 +5573,7 @@ function Action(props) {
5290
5573
  function useService (type, strict) {
5291
5574
  const {
5292
5575
  getService
5293
- } = hooks$1.useContext(PropertiesPanelContext);
5576
+ } = hooks$1.useContext(FormPropertiesPanelContext);
5294
5577
  return getService(type, strict);
5295
5578
  }
5296
5579
 
@@ -5564,7 +5847,7 @@ function DefaultValueNumber(props) {
5564
5847
  if (!isValidNumber(value)) return;
5565
5848
 
5566
5849
  // Enforces decimal notation so that we do not submit defaults in exponent form
5567
- return serializeToString ? Big__default['default'](value).toFixed() : value;
5850
+ return serializeToString ? Big(value).toFixed() : value;
5568
5851
  };
5569
5852
  const setValue = value => {
5570
5853
  let newValue;
@@ -5905,6 +6188,46 @@ const SimpleStringComponent = props => {
5905
6188
  });
5906
6189
  };
5907
6190
 
6191
+ function simpleBoolEntryFactory(options) {
6192
+ const {
6193
+ id,
6194
+ label,
6195
+ path,
6196
+ props
6197
+ } = options;
6198
+ const {
6199
+ editField,
6200
+ field
6201
+ } = props;
6202
+ return {
6203
+ id,
6204
+ label,
6205
+ path,
6206
+ field,
6207
+ editField,
6208
+ component: SimpleBoolComponent,
6209
+ isEdited: isEdited$7
6210
+ };
6211
+ }
6212
+ const SimpleBoolComponent = props => {
6213
+ const {
6214
+ id,
6215
+ label,
6216
+ path,
6217
+ field,
6218
+ editField
6219
+ } = props;
6220
+ const getValue = () => minDash.get(field, path, '');
6221
+ const setValue = value => editField(field, path, value);
6222
+ return CheckboxEntry({
6223
+ element: field,
6224
+ getValue,
6225
+ id,
6226
+ label,
6227
+ setValue
6228
+ });
6229
+ };
6230
+
5908
6231
  function LabelEntry(props) {
5909
6232
  const {
5910
6233
  field
@@ -6084,11 +6407,15 @@ function NumberDecimalDigits(props) {
6084
6407
  debounce,
6085
6408
  label: 'Decimal digits',
6086
6409
  element: field,
6087
- min: 0,
6088
- step: 1,
6410
+ step: 'any',
6089
6411
  getValue,
6090
6412
  id,
6091
- setValue
6413
+ setValue,
6414
+ validate: value => {
6415
+ if (value === undefined || value === null) return;
6416
+ if (value < 0) return 'Should be greater than or equal to zero.';
6417
+ if (!Number.isInteger(value)) return 'Should be an integer.';
6418
+ }
6092
6419
  });
6093
6420
  }
6094
6421
  function NumberArrowStep(props) {
@@ -6123,10 +6450,10 @@ function NumberArrowStep(props) {
6123
6450
  validate: value => {
6124
6451
  if (value === undefined || value === null) return;
6125
6452
  if (!isValidNumber(value)) return 'Should be a valid number.';
6126
- if (Big__default['default'](value).cmp(0) <= 0) return 'Should be greater than zero.';
6453
+ if (Big(value).cmp(0) <= 0) return 'Should be greater than zero.';
6127
6454
  if (decimalDigitsSet) {
6128
- const minimumValue = Big__default['default'](`1e-${decimalDigits}`);
6129
- if (Big__default['default'](value).cmp(minimumValue) < 0) return `Should be at least ${minimumValue.toString()}.`;
6455
+ const minimumValue = Big(`1e-${decimalDigits}`);
6456
+ if (Big(value).cmp(minimumValue) < 0) return `Should be at least ${minimumValue.toString()}.`;
6130
6457
  if (countDecimals(value) > decimalDigits) return `Should not contain more than ${decimalDigits} decimal digits.`;
6131
6458
  }
6132
6459
  }
@@ -6170,7 +6497,7 @@ function SerializeToString(props) {
6170
6497
  const setValue = value => {
6171
6498
  // Whenever changing the formatting, make sure to change the default value type along with it
6172
6499
  if (defaultValue || defaultValue === 0) {
6173
- editField(field, ['defaultValue'], value ? Big__default['default'](defaultValue).toFixed() : Number(defaultValue));
6500
+ editField(field, ['defaultValue'], value ? Big(defaultValue).toFixed() : Number(defaultValue));
6174
6501
  }
6175
6502
  return editField(field, path, value);
6176
6503
  };
@@ -6178,7 +6505,7 @@ function SerializeToString(props) {
6178
6505
  element: field,
6179
6506
  getValue,
6180
6507
  id,
6181
- label: 'Serialize to string',
6508
+ label: 'Output as string',
6182
6509
  description: 'Allows arbitrary precision values',
6183
6510
  setValue
6184
6511
  });
@@ -6421,6 +6748,25 @@ function TimeFormatSelect(props) {
6421
6748
  });
6422
6749
  }
6423
6750
 
6751
+ function SelectEntries(props) {
6752
+ const {
6753
+ field
6754
+ } = props;
6755
+ const {
6756
+ type
6757
+ } = field;
6758
+ if (type !== 'select') {
6759
+ return [];
6760
+ }
6761
+ const entries = [simpleBoolEntryFactory({
6762
+ id: 'searchable',
6763
+ path: ['searchable'],
6764
+ label: 'Searchable',
6765
+ props
6766
+ })];
6767
+ return entries;
6768
+ }
6769
+
6424
6770
  function ValueEntry(props) {
6425
6771
  const {
6426
6772
  editField,
@@ -6950,6 +7296,9 @@ function GeneralGroup(field, editField) {
6950
7296
  }), ...AltTextEntry({
6951
7297
  field,
6952
7298
  editField
7299
+ }), ...SelectEntries({
7300
+ field,
7301
+ editField
6953
7302
  }), ...DisabledEntry({
6954
7303
  field,
6955
7304
  editField
@@ -7013,7 +7362,7 @@ function ValidationGroup(field, editField) {
7013
7362
  type
7014
7363
  } = field;
7015
7364
  const validate = minDash.get(field, ['validate'], {});
7016
- const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate?.validationType);
7365
+ const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate && validate.validationType);
7017
7366
  if (!(INPUTS.includes(type) && type !== 'checkbox' && type !== 'checklist' && type !== 'taglist')) {
7018
7367
  return null;
7019
7368
  }
@@ -7042,6 +7391,7 @@ function ValidationGroup(field, editField) {
7042
7391
  component: ValidationType,
7043
7392
  getValue,
7044
7393
  field,
7394
+ editField,
7045
7395
  isEdited: isEdited$1,
7046
7396
  onChange
7047
7397
  });
@@ -7160,7 +7510,7 @@ function Pattern(props) {
7160
7510
  element: field,
7161
7511
  getValue: getValue('pattern'),
7162
7512
  id,
7163
- label: 'Regular expression pattern',
7513
+ label: 'Custom regular expression',
7164
7514
  setValue: onChange('pattern')
7165
7515
  });
7166
7516
  }
@@ -7208,15 +7558,7 @@ function ValidationType(props) {
7208
7558
  onChange
7209
7559
  } = props;
7210
7560
  const debounce = useService('debounce');
7211
- const clearCustomValidation = () => {
7212
- onChange('minLength')(undefined);
7213
- onChange('maxLength')(undefined);
7214
- onChange('pattern')(undefined);
7215
- };
7216
7561
  const setValue = validationType => {
7217
- if (validationType) {
7218
- clearCustomValidation();
7219
- }
7220
7562
  onChange('validationType')(validationType || undefined);
7221
7563
  };
7222
7564
  return SelectEntry({
@@ -7224,7 +7566,7 @@ function ValidationType(props) {
7224
7566
  element: field,
7225
7567
  getValue: getValue('validationType'),
7226
7568
  id,
7227
- label: 'Regular expression validation',
7569
+ label: 'Validation pattern',
7228
7570
  setValue,
7229
7571
  getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS)
7230
7572
  });
@@ -7470,7 +7812,7 @@ function FormPropertiesPanel(props) {
7470
7812
  "data-field": selectedFormField && selectedFormField.id,
7471
7813
  onFocusCapture: onFocus,
7472
7814
  onBlurCapture: onBlur,
7473
- children: jsxRuntime.jsx(PropertiesPanelContext.Provider, {
7815
+ children: jsxRuntime.jsx(FormPropertiesPanelContext.Provider, {
7474
7816
  value: propertiesPanelContext,
7475
7817
  children: jsxRuntime.jsx(PropertiesPanel, {
7476
7818
  element: selectedFormField,
@@ -7553,7 +7895,7 @@ var PropertiesPanelModule = {
7553
7895
  propertiesPanel: ['type', PropertiesPanelRenderer]
7554
7896
  };
7555
7897
 
7556
- const ids = new Ids__default['default']([32, 36, 1]);
7898
+ const ids = new Ids([32, 36, 1]);
7557
7899
 
7558
7900
  /**
7559
7901
  * @typedef { import('./types').Injector } Injector
@@ -7859,9 +8201,7 @@ function createFormEditor(options) {
7859
8201
 
7860
8202
  Object.defineProperty(exports, 'schemaVersion', {
7861
8203
  enumerable: true,
7862
- get: function () {
7863
- return formJsViewer.schemaVersion;
7864
- }
8204
+ get: function () { return formJsViewer.schemaVersion; }
7865
8205
  });
7866
8206
  exports.FormEditor = FormEditor;
7867
8207
  exports.createFormEditor = createFormEditor;