@bpmn-io/form-js-playground 0.11.1 → 0.12.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.
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FormPlayground = {}));
5
- }(this, (function (exports) { 'use strict';
5
+ })(this, (function (exports) { 'use strict';
6
6
 
7
7
  var n$3,
8
8
  l$3,
@@ -737,184 +737,192 @@
737
737
 
738
738
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
739
739
 
740
- var download$1 = {exports: {}};
740
+ var downloadExports = {};
741
+ var download$1 = {
742
+ get exports(){ return downloadExports; },
743
+ set exports(v){ downloadExports = v; },
744
+ };
741
745
 
742
746
  (function (module, exports) {
743
- //download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage
744
- // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime
745
- // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs
746
- // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.
747
- // v4 adds AMD/UMD, commonJS, and plain browser support
748
- // v4.1 adds url download capability via solo URL argument (same domain/CORS only)
749
- // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors
750
- // https://github.com/rndme/download
751
-
752
- (function (root, factory) {
753
- {
754
- // Node. Does not work with strict CommonJS, but
755
- // only CommonJS-like environments that support module.exports,
756
- // like Node.
757
- module.exports = factory();
758
- }
759
- })(commonjsGlobal, function () {
760
- return function download(data, strFileName, strMimeType) {
761
- var self = window,
762
- // this script is only for browsers anyway...
763
- defaultMime = "application/octet-stream",
764
- // this default mime also triggers iframe downloads
765
- mimeType = strMimeType || defaultMime,
766
- payload = data,
767
- url = !strFileName && !strMimeType && payload,
768
- anchor = document.createElement("a"),
769
- toString = function (a) {
770
- return String(a);
771
- },
772
- myBlob = self.Blob || self.MozBlob || self.WebKitBlob || toString,
773
- fileName = strFileName || "download",
774
- blob,
775
- reader;
776
- myBlob = myBlob.call ? myBlob.bind(self) : Blob;
777
- if (String(this) === "true") {
778
- //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
779
- payload = [payload, mimeType];
780
- mimeType = payload[0];
781
- payload = payload[1];
782
- }
783
- if (url && url.length < 2048) {
784
- // if no filename and no mime, assume a url was passed as the only argument
785
- fileName = url.split("/").pop().split("?")[0];
786
- anchor.href = url; // assign href prop to temp anchor
787
- if (anchor.href.indexOf(url) !== -1) {
788
- // if the browser determines that it's a potentially valid url path:
789
- var ajax = new XMLHttpRequest();
790
- ajax.open("GET", url, true);
791
- ajax.responseType = 'blob';
792
- ajax.onload = function (e) {
793
- download(e.target.response, fileName, defaultMime);
794
- };
795
- setTimeout(function () {
796
- ajax.send();
797
- }, 0); // allows setting custom ajax headers using the return:
798
- return ajax;
799
- } // end if valid url?
800
- } // end if url?
801
-
802
- //go ahead and download dataURLs right away
803
- if (/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)) {
804
- if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
805
- payload = dataUrlToBlob(payload);
806
- mimeType = payload.type || defaultMime;
807
- } else {
808
- return navigator.msSaveBlob ?
809
- // IE10 can't do a[download], only Blobs:
810
- navigator.msSaveBlob(dataUrlToBlob(payload), fileName) : saver(payload); // everyone else can save dataURLs un-processed
811
- }
812
- } else {
813
- //not data url, is it a string with special needs?
814
- if (/([\x80-\xff])/.test(payload)) {
815
- var i = 0,
816
- tempUiArr = new Uint8Array(payload.length),
817
- mx = tempUiArr.length;
818
- for (i; i < mx; ++i) tempUiArr[i] = payload.charCodeAt(i);
819
- payload = new myBlob([tempUiArr], {
820
- type: mimeType
821
- });
822
- }
823
- }
824
- blob = payload instanceof myBlob ? payload : new myBlob([payload], {
825
- type: mimeType
826
- });
827
- function dataUrlToBlob(strUrl) {
828
- var parts = strUrl.split(/[:;,]/),
829
- type = parts[1],
830
- decoder = parts[2] == "base64" ? atob : decodeURIComponent,
831
- binData = decoder(parts.pop()),
832
- mx = binData.length,
833
- i = 0,
834
- uiArr = new Uint8Array(mx);
835
- for (i; i < mx; ++i) uiArr[i] = binData.charCodeAt(i);
836
- return new myBlob([uiArr], {
837
- type: type
838
- });
839
- }
840
- function saver(url, winMode) {
841
- if ('download' in anchor) {
842
- //html5 A[download]
843
- anchor.href = url;
844
- anchor.setAttribute("download", fileName);
845
- anchor.className = "download-js-link";
846
- anchor.innerHTML = "downloading...";
847
- anchor.style.display = "none";
848
- document.body.appendChild(anchor);
849
- setTimeout(function () {
850
- anchor.click();
851
- document.body.removeChild(anchor);
852
- if (winMode === true) {
853
- setTimeout(function () {
854
- self.URL.revokeObjectURL(anchor.href);
855
- }, 250);
856
- }
857
- }, 66);
858
- return true;
859
- }
860
-
861
- // handle non-a[download] safari as best we can:
862
- if (/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
863
- if (/^data:/.test(url)) url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
864
- if (!window.open(url)) {
865
- // popup blocked, offer direct download:
866
- if (confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")) {
867
- location.href = url;
868
- }
869
- }
870
- return true;
871
- }
872
-
873
- //do iframe dataURL download (old ch+FF):
874
- var f = document.createElement("iframe");
875
- document.body.appendChild(f);
876
- if (!winMode && /^data:/.test(url)) {
877
- // force a mime that will download:
878
- url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
879
- }
880
- f.src = url;
881
- setTimeout(function () {
882
- document.body.removeChild(f);
883
- }, 333);
884
- } //end saver
885
-
886
- if (navigator.msSaveBlob) {
887
- // IE10+ : (has Blob, but not a[download] or URL)
888
- return navigator.msSaveBlob(blob, fileName);
889
- }
890
- if (self.URL) {
891
- // simple fast and modern way using Blob and URL:
892
- saver(self.URL.createObjectURL(blob), true);
893
- } else {
894
- // handle non-Blob()+non-URL browsers:
895
- if (typeof blob === "string" || blob.constructor === toString) {
896
- try {
897
- return saver("data:" + mimeType + ";base64," + self.btoa(blob));
898
- } catch (y) {
899
- return saver("data:" + mimeType + "," + encodeURIComponent(blob));
900
- }
901
- }
902
-
903
- // Blob but not URL support:
904
- reader = new FileReader();
905
- reader.onload = function (e) {
906
- saver(this.result);
907
- };
908
- reader.readAsDataURL(blob);
909
- }
910
- return true;
911
- }; /* end download() */
912
- });
913
- }(download$1));
914
-
915
- var download = download$1.exports;
916
-
917
- var classnames = {exports: {}};
747
+ //download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage
748
+ // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime
749
+ // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs
750
+ // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.
751
+ // v4 adds AMD/UMD, commonJS, and plain browser support
752
+ // v4.1 adds url download capability via solo URL argument (same domain/CORS only)
753
+ // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors
754
+ // https://github.com/rndme/download
755
+
756
+ (function (root, factory) {
757
+ {
758
+ // Node. Does not work with strict CommonJS, but
759
+ // only CommonJS-like environments that support module.exports,
760
+ // like Node.
761
+ module.exports = factory();
762
+ }
763
+ })(commonjsGlobal, function () {
764
+ return function download(data, strFileName, strMimeType) {
765
+ var self = window,
766
+ // this script is only for browsers anyway...
767
+ defaultMime = "application/octet-stream",
768
+ // this default mime also triggers iframe downloads
769
+ mimeType = strMimeType || defaultMime,
770
+ payload = data,
771
+ url = !strFileName && !strMimeType && payload,
772
+ anchor = document.createElement("a"),
773
+ toString = function (a) {
774
+ return String(a);
775
+ },
776
+ myBlob = self.Blob || self.MozBlob || self.WebKitBlob || toString,
777
+ fileName = strFileName || "download",
778
+ blob,
779
+ reader;
780
+ myBlob = myBlob.call ? myBlob.bind(self) : Blob;
781
+ if (String(this) === "true") {
782
+ //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
783
+ payload = [payload, mimeType];
784
+ mimeType = payload[0];
785
+ payload = payload[1];
786
+ }
787
+ if (url && url.length < 2048) {
788
+ // if no filename and no mime, assume a url was passed as the only argument
789
+ fileName = url.split("/").pop().split("?")[0];
790
+ anchor.href = url; // assign href prop to temp anchor
791
+ if (anchor.href.indexOf(url) !== -1) {
792
+ // if the browser determines that it's a potentially valid url path:
793
+ var ajax = new XMLHttpRequest();
794
+ ajax.open("GET", url, true);
795
+ ajax.responseType = 'blob';
796
+ ajax.onload = function (e) {
797
+ download(e.target.response, fileName, defaultMime);
798
+ };
799
+ setTimeout(function () {
800
+ ajax.send();
801
+ }, 0); // allows setting custom ajax headers using the return:
802
+ return ajax;
803
+ } // end if valid url?
804
+ } // end if url?
805
+
806
+ //go ahead and download dataURLs right away
807
+ if (/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)) {
808
+ if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
809
+ payload = dataUrlToBlob(payload);
810
+ mimeType = payload.type || defaultMime;
811
+ } else {
812
+ return navigator.msSaveBlob ?
813
+ // IE10 can't do a[download], only Blobs:
814
+ navigator.msSaveBlob(dataUrlToBlob(payload), fileName) : saver(payload); // everyone else can save dataURLs un-processed
815
+ }
816
+ } else {
817
+ //not data url, is it a string with special needs?
818
+ if (/([\x80-\xff])/.test(payload)) {
819
+ var i = 0,
820
+ tempUiArr = new Uint8Array(payload.length),
821
+ mx = tempUiArr.length;
822
+ for (i; i < mx; ++i) tempUiArr[i] = payload.charCodeAt(i);
823
+ payload = new myBlob([tempUiArr], {
824
+ type: mimeType
825
+ });
826
+ }
827
+ }
828
+ blob = payload instanceof myBlob ? payload : new myBlob([payload], {
829
+ type: mimeType
830
+ });
831
+ function dataUrlToBlob(strUrl) {
832
+ var parts = strUrl.split(/[:;,]/),
833
+ type = parts[1],
834
+ decoder = parts[2] == "base64" ? atob : decodeURIComponent,
835
+ binData = decoder(parts.pop()),
836
+ mx = binData.length,
837
+ i = 0,
838
+ uiArr = new Uint8Array(mx);
839
+ for (i; i < mx; ++i) uiArr[i] = binData.charCodeAt(i);
840
+ return new myBlob([uiArr], {
841
+ type: type
842
+ });
843
+ }
844
+ function saver(url, winMode) {
845
+ if ('download' in anchor) {
846
+ //html5 A[download]
847
+ anchor.href = url;
848
+ anchor.setAttribute("download", fileName);
849
+ anchor.className = "download-js-link";
850
+ anchor.innerHTML = "downloading...";
851
+ anchor.style.display = "none";
852
+ document.body.appendChild(anchor);
853
+ setTimeout(function () {
854
+ anchor.click();
855
+ document.body.removeChild(anchor);
856
+ if (winMode === true) {
857
+ setTimeout(function () {
858
+ self.URL.revokeObjectURL(anchor.href);
859
+ }, 250);
860
+ }
861
+ }, 66);
862
+ return true;
863
+ }
864
+
865
+ // handle non-a[download] safari as best we can:
866
+ if (/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
867
+ if (/^data:/.test(url)) url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
868
+ if (!window.open(url)) {
869
+ // popup blocked, offer direct download:
870
+ if (confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")) {
871
+ location.href = url;
872
+ }
873
+ }
874
+ return true;
875
+ }
876
+
877
+ //do iframe dataURL download (old ch+FF):
878
+ var f = document.createElement("iframe");
879
+ document.body.appendChild(f);
880
+ if (!winMode && /^data:/.test(url)) {
881
+ // force a mime that will download:
882
+ url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
883
+ }
884
+ f.src = url;
885
+ setTimeout(function () {
886
+ document.body.removeChild(f);
887
+ }, 333);
888
+ } //end saver
889
+
890
+ if (navigator.msSaveBlob) {
891
+ // IE10+ : (has Blob, but not a[download] or URL)
892
+ return navigator.msSaveBlob(blob, fileName);
893
+ }
894
+ if (self.URL) {
895
+ // simple fast and modern way using Blob and URL:
896
+ saver(self.URL.createObjectURL(blob), true);
897
+ } else {
898
+ // handle non-Blob()+non-URL browsers:
899
+ if (typeof blob === "string" || blob.constructor === toString) {
900
+ try {
901
+ return saver("data:" + mimeType + ";base64," + self.btoa(blob));
902
+ } catch (y) {
903
+ return saver("data:" + mimeType + "," + encodeURIComponent(blob));
904
+ }
905
+ }
906
+
907
+ // Blob but not URL support:
908
+ reader = new FileReader();
909
+ reader.onload = function (e) {
910
+ saver(this.result);
911
+ };
912
+ reader.readAsDataURL(blob);
913
+ }
914
+ return true;
915
+ }; /* end download() */
916
+ });
917
+ } (download$1));
918
+
919
+ var download = downloadExports;
920
+
921
+ var classnamesExports = {};
922
+ var classnames = {
923
+ get exports(){ return classnamesExports; },
924
+ set exports(v){ classnamesExports = v; },
925
+ };
918
926
 
919
927
  /*!
920
928
  Copyright (c) 2018 Jed Watson.
@@ -923,50 +931,50 @@
923
931
  */
924
932
 
925
933
  (function (module) {
926
- /* global define */
927
-
928
- (function () {
929
-
930
- var hasOwn = {}.hasOwnProperty;
931
- function classNames() {
932
- var classes = [];
933
- for (var i = 0; i < arguments.length; i++) {
934
- var arg = arguments[i];
935
- if (!arg) continue;
936
- var argType = typeof arg;
937
- if (argType === 'string' || argType === 'number') {
938
- classes.push(arg);
939
- } else if (Array.isArray(arg)) {
940
- if (arg.length) {
941
- var inner = classNames.apply(null, arg);
942
- if (inner) {
943
- classes.push(inner);
944
- }
945
- }
946
- } else if (argType === 'object') {
947
- if (arg.toString === Object.prototype.toString) {
948
- for (var key in arg) {
949
- if (hasOwn.call(arg, key) && arg[key]) {
950
- classes.push(key);
951
- }
952
- }
953
- } else {
954
- classes.push(arg.toString());
955
- }
956
- }
957
- }
958
- return classes.join(' ');
959
- }
960
- if (module.exports) {
961
- classNames.default = classNames;
962
- module.exports = classNames;
963
- } else {
964
- window.classNames = classNames;
965
- }
966
- })();
967
- }(classnames));
968
-
969
- var classNames = classnames.exports;
934
+ /* global define */
935
+
936
+ (function () {
937
+
938
+ var hasOwn = {}.hasOwnProperty;
939
+ function classNames() {
940
+ var classes = [];
941
+ for (var i = 0; i < arguments.length; i++) {
942
+ var arg = arguments[i];
943
+ if (!arg) continue;
944
+ var argType = typeof arg;
945
+ if (argType === 'string' || argType === 'number') {
946
+ classes.push(arg);
947
+ } else if (Array.isArray(arg)) {
948
+ if (arg.length) {
949
+ var inner = classNames.apply(null, arg);
950
+ if (inner) {
951
+ classes.push(inner);
952
+ }
953
+ }
954
+ } else if (argType === 'object') {
955
+ if (arg.toString === Object.prototype.toString) {
956
+ for (var key in arg) {
957
+ if (hasOwn.call(arg, key) && arg[key]) {
958
+ classes.push(key);
959
+ }
960
+ }
961
+ } else {
962
+ classes.push(arg.toString());
963
+ }
964
+ }
965
+ }
966
+ return classes.join(' ');
967
+ }
968
+ if (module.exports) {
969
+ classNames.default = classNames;
970
+ module.exports = classNames;
971
+ } else {
972
+ window.classNames = classNames;
973
+ }
974
+ })();
975
+ } (classnames));
976
+
977
+ var classNames = classnamesExports;
970
978
 
971
979
  function createCommonjsModule(fn, module) {
972
980
  return module = {
@@ -1156,6 +1164,26 @@
1156
1164
  return nativeHasOwnProperty$1.call(target, key);
1157
1165
  }
1158
1166
 
1167
+ /**
1168
+ * Find element index in collection.
1169
+ *
1170
+ * @param {Array|Object} collection
1171
+ * @param {Function} matcher
1172
+ *
1173
+ * @return {Object}
1174
+ */
1175
+ function findIndex(collection, matcher) {
1176
+ matcher = toMatcher$1(matcher);
1177
+ let idx = isArray$3(collection) ? -1 : undefined;
1178
+ forEach$1(collection, function (val, key) {
1179
+ if (matcher(val, key)) {
1180
+ idx = key;
1181
+ return false;
1182
+ }
1183
+ });
1184
+ return idx;
1185
+ }
1186
+
1159
1187
  /**
1160
1188
  * Iterate over collection; returning something
1161
1189
  * (non-undefined) will stop iteration.
@@ -1181,6 +1209,11 @@
1181
1209
  }
1182
1210
  }
1183
1211
  }
1212
+ function toMatcher$1(matcher) {
1213
+ return isFunction$1(matcher) ? matcher : e => {
1214
+ return e === matcher;
1215
+ };
1216
+ }
1184
1217
  function identity$1(arg) {
1185
1218
  return arg;
1186
1219
  }
@@ -1221,7 +1254,7 @@
1221
1254
  * @param {(string|number)[]} path The path to the nested value.
1222
1255
  * @param {any} value The value to set.
1223
1256
  */
1224
- function set$1(target, path, value) {
1257
+ function set$2(target, path, value) {
1225
1258
  let currentTarget = target;
1226
1259
  forEach$1(path, function (key, idx) {
1227
1260
  if (typeof key !== 'number' && typeof key !== 'string') {
@@ -8056,12 +8089,12 @@
8056
8089
  /// The default maximum length of a `TreeBuffer` node.
8057
8090
  const DefaultBufferLength = 1024;
8058
8091
  let nextPropID = 0;
8059
- class Range$2 {
8092
+ let Range$2 = class Range {
8060
8093
  constructor(from, to) {
8061
8094
  this.from = from;
8062
8095
  this.to = to;
8063
8096
  }
8064
- }
8097
+ };
8065
8098
  /// Each [node type](#common.NodeType) or [individual tree](#common.Tree)
8066
8099
  /// can have metadata associated with it in props. Instances of this
8067
8100
  /// class represent prop names.
@@ -12039,7 +12072,7 @@
12039
12072
  [FilterExpression$1]: 'FilterExpression',
12040
12073
  [ArithmeticExpression$1]: 'ArithmeticExpression'
12041
12074
  };
12042
- class ValueProducer$1 {
12075
+ let ValueProducer$1 = class ValueProducer {
12043
12076
  /**
12044
12077
  * @param { Function } fn
12045
12078
  */
@@ -12058,7 +12091,7 @@
12058
12091
  static of(fn) {
12059
12092
  return new ValueProducer$1(fn);
12060
12093
  }
12061
- }
12094
+ };
12062
12095
  const dateTimeLiterals$1 = {
12063
12096
  'date and time': 1,
12064
12097
  'date': 1,
@@ -12066,7 +12099,7 @@
12066
12099
  'duration': 1
12067
12100
  };
12068
12101
  const dateTimeIdentifiers$1 = Object.keys(dateTimeLiterals$1);
12069
- class Variables$1 {
12102
+ let Variables$1 = class Variables {
12070
12103
  constructor({
12071
12104
  name = 'Expressions',
12072
12105
  tokens = [],
@@ -12264,7 +12297,7 @@
12264
12297
  raw
12265
12298
  });
12266
12299
  }
12267
- }
12300
+ };
12268
12301
 
12269
12302
  /**
12270
12303
  * @param { string } name
@@ -12749,11 +12782,11 @@
12749
12782
  }
12750
12783
  return null;
12751
12784
  }
12752
- class Range$1 {
12785
+ let Range$1 = class Range {
12753
12786
  constructor(props) {
12754
12787
  Object.assign(this, props);
12755
12788
  }
12756
- }
12789
+ };
12757
12790
  function isNumber$1(obj) {
12758
12791
  return typeof obj === 'number';
12759
12792
  }
@@ -12839,7 +12872,7 @@
12839
12872
  if (arguments.length !== 1) {
12840
12873
  return null;
12841
12874
  }
12842
- return toString$1(from);
12875
+ return toString$2(from);
12843
12876
  }, ['any']),
12844
12877
  // date(from) => date string
12845
12878
  // date(from) => date and time
@@ -13365,17 +13398,17 @@
13365
13398
  }
13366
13399
  function toKeyString(key) {
13367
13400
  if (typeof key === 'string' && /\W/.test(key)) {
13368
- return toString$1(key, true);
13401
+ return toString$2(key, true);
13369
13402
  }
13370
13403
  return key;
13371
13404
  }
13372
13405
  function toDeepString(obj) {
13373
- return toString$1(obj, true);
13406
+ return toString$2(obj, true);
13374
13407
  }
13375
13408
  function escapeStr(str) {
13376
13409
  return str.replace(/("|\\)/g, '\\$1');
13377
13410
  }
13378
- function toString$1(obj, wrap = false) {
13411
+ function toString$2(obj, wrap = false) {
13379
13412
  var _a, _b, _c, _d;
13380
13413
  const type = getType(obj);
13381
13414
  if (type === 'nil') {
@@ -18879,7 +18912,7 @@
18879
18912
  }
18880
18913
  }
18881
18914
  Validator.$inject = [];
18882
- class FormFieldRegistry$1 {
18915
+ let FormFieldRegistry$1 = class FormFieldRegistry {
18883
18916
  constructor(eventBus) {
18884
18917
  this._eventBus = eventBus;
18885
18918
  this._formFields = {};
@@ -18925,7 +18958,7 @@
18925
18958
  this._ids.clear();
18926
18959
  this._keys.clear();
18927
18960
  }
18928
- }
18961
+ };
18929
18962
  FormFieldRegistry$1.$inject = ['eventBus'];
18930
18963
 
18931
18964
  /**
@@ -18965,7 +18998,7 @@
18965
18998
  } while (cursor.next());
18966
18999
  return Array.from(variables);
18967
19000
  }
18968
- function isExpression$2(value) {
19001
+ function isExpression$1(value) {
18969
19002
  return isString$3(value) && value.startsWith('=');
18970
19003
  }
18971
19004
 
@@ -19016,7 +19049,10 @@
19016
19049
  [VALUES_SOURCES.INPUT]: ['valuesKey']
19017
19050
  };
19018
19051
  const VALUES_SOURCES_DEFAULTS = {
19019
- [VALUES_SOURCES.STATIC]: [],
19052
+ [VALUES_SOURCES.STATIC]: [{
19053
+ label: 'Value',
19054
+ value: 'value'
19055
+ }],
19020
19056
  [VALUES_SOURCES.INPUT]: ''
19021
19057
  };
19022
19058
 
@@ -19125,13 +19161,7 @@
19125
19161
  // remove duplicates
19126
19162
  return Array.from(new Set(variables));
19127
19163
  }
19128
-
19129
- // helper ///////////////
19130
-
19131
- function isExpression$1(value) {
19132
- return isString$3(value) && value.startsWith('=');
19133
- }
19134
- class Importer$1 {
19164
+ let Importer$1 = class Importer {
19135
19165
  /**
19136
19166
  * @constructor
19137
19167
  * @param { import('../core').FormFieldRegistry } formFieldRegistry
@@ -19260,7 +19290,7 @@
19260
19290
  return initializedData;
19261
19291
  }, data);
19262
19292
  }
19263
- }
19293
+ };
19264
19294
  Importer$1.$inject = ['formFieldRegistry', 'formFields'];
19265
19295
  var importModule$1 = {
19266
19296
  importer: ['type', Importer$1]
@@ -19439,15 +19469,14 @@
19439
19469
  })
19440
19470
  });
19441
19471
  }
19442
- Button.create = function (options = {}) {
19443
- return {
19444
- action: 'submit',
19445
- ...options
19446
- };
19447
- };
19472
+ Button.create = (options = {}) => ({
19473
+ action: 'submit',
19474
+ ...options
19475
+ });
19448
19476
  Button.type = type$b;
19449
19477
  Button.label = 'Button';
19450
19478
  Button.keyed = true;
19479
+ Button.group = 'action';
19451
19480
  const FormRenderContext = D$1({
19452
19481
  Empty: props => {
19453
19482
  return null;
@@ -19459,6 +19488,7 @@
19459
19488
  return props.children;
19460
19489
  }
19461
19490
  });
19491
+ var FormRenderContext$1 = FormRenderContext;
19462
19492
 
19463
19493
  /**
19464
19494
  * @param {string} type
@@ -19471,6 +19501,7 @@
19471
19501
  getService: getService$2,
19472
19502
  formId: null
19473
19503
  });
19504
+ var FormContext$1 = FormContext;
19474
19505
  function Description$2(props) {
19475
19506
  const {
19476
19507
  description
@@ -19542,7 +19573,7 @@
19542
19573
  };
19543
19574
  const {
19544
19575
  formId
19545
- } = F$1(FormContext);
19576
+ } = F$1(FormContext$1);
19546
19577
  return e$1("div", {
19547
19578
  class: classNames(formFieldClasses(type$a, {
19548
19579
  errors,
@@ -19569,11 +19600,9 @@
19569
19600
  })]
19570
19601
  });
19571
19602
  }
19572
- Checkbox$1.create = function (options = {}) {
19573
- return {
19574
- ...options
19575
- };
19576
- };
19603
+ Checkbox$1.create = (options = {}) => ({
19604
+ ...options
19605
+ });
19577
19606
  Checkbox$1.type = type$a;
19578
19607
  Checkbox$1.label = 'Checkbox';
19579
19608
  Checkbox$1.keyed = true;
@@ -19581,10 +19610,11 @@
19581
19610
  Checkbox$1.sanitizeValue = ({
19582
19611
  value
19583
19612
  }) => value === true;
19613
+ Checkbox$1.group = 'selection';
19584
19614
  function useService$2(type, strict) {
19585
19615
  const {
19586
19616
  getService
19587
- } = F$1(FormContext);
19617
+ } = F$1(FormContext$1);
19588
19618
  return getService(type, strict);
19589
19619
  }
19590
19620
 
@@ -19680,8 +19710,8 @@
19680
19710
  if (is12h) {
19681
19711
  const isPM = workingString.includes('pm');
19682
19712
  const digits = workingString.match(/\d+/g);
19683
- const displayHour = parseInt(digits?.[0]);
19684
- const minute = parseInt(digits?.[1]) || 0;
19713
+ const displayHour = parseInt(digits && digits[0]);
19714
+ const minute = parseInt(digits && digits[1]) || 0;
19685
19715
  const isValidDisplayHour = isNumber$3(displayHour) && displayHour >= 1 && displayHour <= 12;
19686
19716
  const isValidMinute = minute >= 0 && minute <= 59;
19687
19717
  if (!isValidDisplayHour || !isValidMinute) return null;
@@ -19689,8 +19719,8 @@
19689
19719
  return hour * 60 + minute;
19690
19720
  } else {
19691
19721
  const digits = workingString.match(/\d+/g);
19692
- const hour = parseInt(digits?.[0]);
19693
- const minute = parseInt(digits?.[1]);
19722
+ const hour = parseInt(digits && digits[0]);
19723
+ const minute = parseInt(digits && digits[1]);
19694
19724
  const isValidHour = isNumber$3(hour) && hour >= 0 && hour <= 23;
19695
19725
  const isValidMinute = isNumber$3(minute) && minute >= 0 && minute <= 59;
19696
19726
  if (!isValidHour || !isValidMinute) return null;
@@ -19891,7 +19921,7 @@
19891
19921
  } = useValuesAsync(field);
19892
19922
  const {
19893
19923
  formId
19894
- } = F$1(FormContext);
19924
+ } = F$1(FormContext$1);
19895
19925
  return e$1("div", {
19896
19926
  class: classNames(formFieldClasses(type$9, {
19897
19927
  errors,
@@ -19923,13 +19953,18 @@
19923
19953
  })]
19924
19954
  });
19925
19955
  }
19926
- Checklist.create = function (options = {}) {
19927
- if (options.valuesKey) return options;
19928
- return {
19929
- values: [{
19956
+ Checklist.create = (options = {}) => {
19957
+ const defaults = {};
19958
+
19959
+ // provide default values if valuesKey isn't set
19960
+ if (!options.valuesKey) {
19961
+ defaults.values = [{
19930
19962
  label: 'Value',
19931
19963
  value: 'value'
19932
- }],
19964
+ }];
19965
+ }
19966
+ return {
19967
+ ...defaults,
19933
19968
  ...options
19934
19969
  };
19935
19970
  };
@@ -19938,6 +19973,7 @@
19938
19973
  Checklist.keyed = true;
19939
19974
  Checklist.emptyValue = [];
19940
19975
  Checklist.sanitizeValue = sanitizeMultiSelectValue;
19976
+ Checklist.group = 'selection';
19941
19977
 
19942
19978
  /**
19943
19979
  * Check if condition is met with given variables.
@@ -19980,7 +20016,7 @@
19980
20016
  const {
19981
20017
  Element,
19982
20018
  Empty
19983
- } = F$1(FormRenderContext);
20019
+ } = F$1(FormRenderContext$1);
19984
20020
  const FormFieldComponent = formFields.get(field.type);
19985
20021
  if (!FormFieldComponent) {
19986
20022
  throw new Error(`cannot render field <${field.type}>`);
@@ -20011,7 +20047,7 @@
20011
20047
  const {
20012
20048
  Children,
20013
20049
  Empty
20014
- } = F$1(FormRenderContext);
20050
+ } = F$1(FormRenderContext$1);
20015
20051
  const {
20016
20052
  field
20017
20053
  } = props;
@@ -20030,16 +20066,16 @@
20030
20066
  }), components.length ? null : e$1(Empty, {})]
20031
20067
  });
20032
20068
  }
20033
- Default.create = function (options = {}) {
20034
- return {
20035
- components: [],
20036
- ...options
20037
- };
20038
- };
20069
+ Default.create = (options = {}) => ({
20070
+ components: [],
20071
+ ...options
20072
+ });
20039
20073
  Default.type = 'default';
20040
20074
  Default.keyed = false;
20041
- function _extends$h() {
20042
- _extends$h = Object.assign ? Object.assign.bind() : function (target) {
20075
+ Default.label = null;
20076
+ Default.group = null;
20077
+ function _extends$j() {
20078
+ _extends$j = Object.assign ? Object.assign.bind() : function (target) {
20043
20079
  for (var i = 1; i < arguments.length; i++) {
20044
20080
  var source = arguments[i];
20045
20081
  for (var key in source) {
@@ -20050,12 +20086,12 @@
20050
20086
  }
20051
20087
  return target;
20052
20088
  };
20053
- return _extends$h.apply(this, arguments);
20089
+ return _extends$j.apply(this, arguments);
20054
20090
  }
20055
20091
  var CalendarIcon = ({
20056
20092
  styles = {},
20057
20093
  ...props
20058
- }) => /*#__PURE__*/React.createElement("svg", _extends$h({
20094
+ }) => /*#__PURE__*/React.createElement("svg", _extends$j({
20059
20095
  width: "14",
20060
20096
  height: "15",
20061
20097
  viewBox: "0 0 28 30",
@@ -20064,8 +20100,8 @@
20064
20100
  }, props), /*#__PURE__*/React.createElement("path", {
20065
20101
  fillRule: "evenodd",
20066
20102
  clipRule: "evenodd",
20067
- d: "M19 2H9V0H7v2H2a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V4a2 2 0 00-2-2h-5V0h-2v2zM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7zm-5 4v17h24V11H2z",
20068
- fill: "currentColor"
20103
+ fill: "currentColor",
20104
+ d: "M19 2H9V0H7v2H2a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V4a2 2 0 00-2-2h-5V0h-2v2zM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7zm-5 4v17h24V11H2z"
20069
20105
  }));
20070
20106
  function InputAdorner(props) {
20071
20107
  const {
@@ -20077,10 +20113,10 @@
20077
20113
  disabled,
20078
20114
  hasErrors
20079
20115
  } = props;
20080
- const onAdornmentClick = () => inputRef?.current?.focus();
20116
+ const onAdornmentClick = () => inputRef && inputRef.current && inputRef.current.focus();
20081
20117
  return e$1("div", {
20082
20118
  class: classNames('fjs-input-group', {
20083
- 'disabled': disabled
20119
+ 'fjs-disabled': disabled
20084
20120
  }, {
20085
20121
  'hasErrors': hasErrors
20086
20122
  }),
@@ -20088,11 +20124,17 @@
20088
20124
  children: [pre !== null && e$1("span", {
20089
20125
  class: "fjs-input-adornment border-right border-radius-left",
20090
20126
  onClick: onAdornmentClick,
20091
- children: [" ", pre, " "]
20127
+ children: [" ", isString$3(pre) ? e$1("span", {
20128
+ class: "fjs-input-adornment-text",
20129
+ children: pre
20130
+ }) : pre, " "]
20092
20131
  }), children, post !== null && e$1("span", {
20093
20132
  class: "fjs-input-adornment border-left border-radius-right",
20094
20133
  onClick: onAdornmentClick,
20095
- children: [" ", post, " "]
20134
+ children: [" ", isString$3(post) ? e$1("span", {
20135
+ class: "fjs-input-adornment-text",
20136
+ children: post
20137
+ }) : post, " "]
20096
20138
  })]
20097
20139
  });
20098
20140
  }
@@ -20133,14 +20175,10 @@
20133
20175
  dateFormat: 'm/d/Y',
20134
20176
  static: true,
20135
20177
  clickOpens: false,
20178
+ // TODO: support dates prior to 1900 (https://github.com/bpmn-io/form-js/issues/533)
20179
+ minDate: disallowPassedDates ? 'today' : '01/01/1900',
20136
20180
  errorHandler: () => {/* do nothing, we expect the values to sometimes be erronous and we don't want warnings polluting the console */}
20137
20181
  };
20138
- if (disallowPassedDates) {
20139
- config = {
20140
- ...config,
20141
- minDate: 'today'
20142
- };
20143
- }
20144
20182
  const instance = flatpickr(dateInputRef.current, config);
20145
20183
  setFlatpickrInstance(instance);
20146
20184
  const onCalendarFocusOut = e => {
@@ -20224,7 +20262,7 @@
20224
20262
  class: 'fjs-input',
20225
20263
  disabled: disabled,
20226
20264
  placeholder: "mm/dd/yyyy",
20227
- autoComplete: "false",
20265
+ autoComplete: "off",
20228
20266
  onFocus: onInputFocus,
20229
20267
  onKeyDown: onInputKeyDown,
20230
20268
  onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
@@ -20236,8 +20274,8 @@
20236
20274
  })]
20237
20275
  });
20238
20276
  }
20239
- function _extends$g() {
20240
- _extends$g = Object.assign ? Object.assign.bind() : function (target) {
20277
+ function _extends$i() {
20278
+ _extends$i = Object.assign ? Object.assign.bind() : function (target) {
20241
20279
  for (var i = 1; i < arguments.length; i++) {
20242
20280
  var source = arguments[i];
20243
20281
  for (var key in source) {
@@ -20248,25 +20286,25 @@
20248
20286
  }
20249
20287
  return target;
20250
20288
  };
20251
- return _extends$g.apply(this, arguments);
20289
+ return _extends$i.apply(this, arguments);
20252
20290
  }
20253
20291
  var ClockIcon = ({
20254
20292
  styles = {},
20255
20293
  ...props
20256
- }) => /*#__PURE__*/React.createElement("svg", _extends$g({
20294
+ }) => /*#__PURE__*/React.createElement("svg", _extends$i({
20257
20295
  width: "16",
20258
20296
  height: "16",
20259
20297
  viewBox: "0 0 28 29",
20260
20298
  fill: "none",
20261
20299
  xmlns: "http://www.w3.org/2000/svg"
20262
20300
  }, props), /*#__PURE__*/React.createElement("path", {
20263
- d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z",
20264
- fill: "currentColor"
20301
+ fill: "currentColor",
20302
+ d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z"
20265
20303
  }), /*#__PURE__*/React.createElement("path", {
20266
20304
  fillRule: "evenodd",
20267
20305
  clipRule: "evenodd",
20268
- d: "M6.222 25.64A14 14 0 1021.778 2.36 14 14 0 006.222 25.64zM7.333 4.023a12 12 0 1113.334 19.955A12 12 0 017.333 4.022z",
20269
- fill: "currentColor"
20306
+ fill: "currentColor",
20307
+ d: "M6.222 25.64A14 14 0 1021.778 2.36 14 14 0 006.222 25.64zM7.333 4.023a12 12 0 1113.334 19.955A12 12 0 017.333 4.022z"
20270
20308
  }));
20271
20309
  function useKeyDownAction(targetKey, action, listenerElement = window) {
20272
20310
  function downHandler({
@@ -20287,7 +20325,7 @@
20287
20325
  const NOOP = () => {};
20288
20326
  function DropdownList(props) {
20289
20327
  const {
20290
- keyEventsListener = window,
20328
+ listenerElement = window,
20291
20329
  values = [],
20292
20330
  getLabel = DEFAULT_LABEL_GETTER,
20293
20331
  onValueSelected = NOOP,
@@ -20317,18 +20355,18 @@
20317
20355
  changeFocusedValueIndex(-1);
20318
20356
  setMouseControl(false);
20319
20357
  }
20320
- }, keyEventsListener);
20358
+ }, listenerElement);
20321
20359
  useKeyDownAction('ArrowDown', () => {
20322
20360
  if (values.length) {
20323
20361
  changeFocusedValueIndex(1);
20324
20362
  setMouseControl(false);
20325
20363
  }
20326
- }, keyEventsListener);
20364
+ }, listenerElement);
20327
20365
  useKeyDownAction('Enter', () => {
20328
20366
  if (focusedItem) {
20329
20367
  onValueSelected(focusedItem);
20330
20368
  }
20331
- }, keyEventsListener);
20369
+ }, listenerElement);
20332
20370
  y(() => {
20333
20371
  const individualEntries = dropdownContainer.current.children;
20334
20372
  if (individualEntries.length && !mouseControl) {
@@ -20500,7 +20538,7 @@
20500
20538
  value: rawValue,
20501
20539
  disabled: disabled,
20502
20540
  placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
20503
- autoComplete: "false",
20541
+ autoComplete: "off",
20504
20542
  onFocus: () => useDropdown && setDropdownIsOpen(true),
20505
20543
  onClick: () => useDropdown && setDropdownIsOpen(true)
20506
20544
 
@@ -20551,7 +20589,7 @@
20551
20589
  } = validate;
20552
20590
  const {
20553
20591
  formId
20554
- } = F$1(FormContext);
20592
+ } = F$1(FormContext$1);
20555
20593
  const getNullDateTime = () => ({
20556
20594
  date: new Date(Date.parse(null)),
20557
20595
  time: null
@@ -20692,12 +20730,12 @@
20692
20730
  })]
20693
20731
  });
20694
20732
  }
20695
- Datetime.create = function (options = {}) {
20696
- const newOptions = {};
20697
- set$1(newOptions, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
20698
- set$1(newOptions, DATE_LABEL_PATH, 'Date');
20733
+ Datetime.create = (options = {}) => {
20734
+ const defaults = {};
20735
+ set$2(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
20736
+ set$2(defaults, DATE_LABEL_PATH, 'Date');
20699
20737
  return {
20700
- ...newOptions,
20738
+ ...defaults,
20701
20739
  ...options
20702
20740
  };
20703
20741
  };
@@ -20705,6 +20743,8 @@
20705
20743
  Datetime.keyed = true;
20706
20744
  Datetime.emptyValue = null;
20707
20745
  Datetime.sanitizeValue = sanitizeDateTimePickerValue;
20746
+ Datetime.label = 'Date time';
20747
+ Datetime.group = 'basic-input';
20708
20748
 
20709
20749
  /**
20710
20750
  * This file must not be changed or exchanged.
@@ -20866,8 +20906,8 @@
20866
20906
  function isExpression(value) {
20867
20907
  return isString$3(value) && value.startsWith('=');
20868
20908
  }
20869
- function _extends$f() {
20870
- _extends$f = Object.assign ? Object.assign.bind() : function (target) {
20909
+ function _extends$h() {
20910
+ _extends$h = Object.assign ? Object.assign.bind() : function (target) {
20871
20911
  for (var i = 1; i < arguments.length; i++) {
20872
20912
  var source = arguments[i];
20873
20913
  for (var key in source) {
@@ -20878,12 +20918,12 @@
20878
20918
  }
20879
20919
  return target;
20880
20920
  };
20881
- return _extends$f.apply(this, arguments);
20921
+ return _extends$h.apply(this, arguments);
20882
20922
  }
20883
20923
  var ImagePlaceholder = ({
20884
20924
  styles = {},
20885
20925
  ...props
20886
- }) => /*#__PURE__*/React.createElement("svg", _extends$f({
20926
+ }) => /*#__PURE__*/React.createElement("svg", _extends$h({
20887
20927
  width: "64",
20888
20928
  height: "64",
20889
20929
  viewBox: "0 0 1280 1280",
@@ -20922,7 +20962,7 @@
20922
20962
  const altText = useExpressionValue(alt);
20923
20963
  const {
20924
20964
  formId
20925
- } = F$1(FormContext);
20965
+ } = F$1(FormContext$1);
20926
20966
  return e$1("div", {
20927
20967
  class: formFieldClasses(type$7),
20928
20968
  children: e$1("div", {
@@ -20941,13 +20981,71 @@
20941
20981
  })
20942
20982
  });
20943
20983
  }
20944
- Image.create = function (options = {}) {
20945
- return {
20946
- ...options
20947
- };
20948
- };
20984
+ Image.create = (options = {}) => ({
20985
+ ...options
20986
+ });
20949
20987
  Image.type = type$7;
20950
20988
  Image.keyed = false;
20989
+ Image.label = 'Image view';
20990
+ Image.group = 'presentation';
20991
+ function _extends$g() {
20992
+ _extends$g = Object.assign ? Object.assign.bind() : function (target) {
20993
+ for (var i = 1; i < arguments.length; i++) {
20994
+ var source = arguments[i];
20995
+ for (var key in source) {
20996
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20997
+ target[key] = source[key];
20998
+ }
20999
+ }
21000
+ }
21001
+ return target;
21002
+ };
21003
+ return _extends$g.apply(this, arguments);
21004
+ }
21005
+ var AngelDownIcon = ({
21006
+ styles = {},
21007
+ ...props
21008
+ }) => /*#__PURE__*/React.createElement("svg", _extends$g({
21009
+ xmlns: "http://www.w3.org/2000/svg",
21010
+ width: "8",
21011
+ height: "8"
21012
+ }, props), /*#__PURE__*/React.createElement("path", {
21013
+ fillRule: "evenodd",
21014
+ clipRule: "evenodd",
21015
+ fill: "currentColor",
21016
+ stroke: "currentColor",
21017
+ strokeWidth: ".5",
21018
+ d: "M7.75 1.336L4 6.125.258 1.335 0 1.54l4 5.125L8 1.54zm0 0"
21019
+ }));
21020
+ function _extends$f() {
21021
+ _extends$f = Object.assign ? Object.assign.bind() : function (target) {
21022
+ for (var i = 1; i < arguments.length; i++) {
21023
+ var source = arguments[i];
21024
+ for (var key in source) {
21025
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21026
+ target[key] = source[key];
21027
+ }
21028
+ }
21029
+ }
21030
+ return target;
21031
+ };
21032
+ return _extends$f.apply(this, arguments);
21033
+ }
21034
+ var AngelUpIcon = ({
21035
+ styles = {},
21036
+ ...props
21037
+ }) => /*#__PURE__*/React.createElement("svg", _extends$f({
21038
+ xmlns: "http://www.w3.org/2000/svg",
21039
+ width: "8",
21040
+ height: "8"
21041
+ }, props), /*#__PURE__*/React.createElement("path", {
21042
+ fillRule: "evenodd",
21043
+ clipRule: "evenodd",
21044
+ fill: "currentColor",
21045
+ stroke: "currentColor",
21046
+ strokeWidth: ".5",
21047
+ d: "M7.75 6.664L4 1.875.258 6.665 0 6.46l4-5.125L8 6.46zm0 0"
21048
+ }));
20951
21049
  const type$6 = 'number';
20952
21050
  function Numberfield(props) {
20953
21051
  const {
@@ -21075,7 +21173,7 @@
21075
21173
  };
21076
21174
  const {
21077
21175
  formId
21078
- } = F$1(FormContext);
21176
+ } = F$1(FormContext$1);
21079
21177
  return e$1("div", {
21080
21178
  class: formFieldClasses(type$6, {
21081
21179
  errors,
@@ -21091,7 +21189,7 @@
21091
21189
  post: suffixAdorner,
21092
21190
  children: e$1("div", {
21093
21191
  class: classNames('fjs-vertical-group', {
21094
- 'disabled': disabled
21192
+ 'fjs-disabled': disabled
21095
21193
  }, {
21096
21194
  'hasErrors': errors.length
21097
21195
  }),
@@ -21113,22 +21211,24 @@
21113
21211
  value: displayValue
21114
21212
  }), e$1("div", {
21115
21213
  class: classNames('fjs-number-arrow-container', {
21116
- 'disabled': disabled
21214
+ 'fjs-disabled': disabled
21117
21215
  }),
21118
21216
  children: [e$1("button", {
21119
21217
  class: "fjs-number-arrow-up",
21120
21218
  type: "button",
21219
+ "aria-label": "Increment",
21121
21220
  onClick: () => increment(),
21122
21221
  tabIndex: -1,
21123
- children: "\u02C4"
21222
+ children: e$1(AngelUpIcon, {})
21124
21223
  }), e$1("div", {
21125
21224
  class: "fjs-number-arrow-separator"
21126
21225
  }), e$1("button", {
21127
21226
  class: "fjs-number-arrow-down",
21128
21227
  type: "button",
21228
+ "aria-label": "Decrement",
21129
21229
  onClick: () => decrement(),
21130
21230
  tabIndex: -1,
21131
- children: "\u02C5"
21231
+ children: e$1(AngelDownIcon, {})
21132
21232
  })]
21133
21233
  })]
21134
21234
  })
@@ -21139,7 +21239,9 @@
21139
21239
  })]
21140
21240
  });
21141
21241
  }
21142
- Numberfield.create = (options = {}) => options;
21242
+ Numberfield.create = (options = {}) => ({
21243
+ ...options
21244
+ });
21143
21245
  Numberfield.sanitizeValue = ({
21144
21246
  value,
21145
21247
  formField
@@ -21157,6 +21259,7 @@
21157
21259
  Numberfield.keyed = true;
21158
21260
  Numberfield.label = 'Number';
21159
21261
  Numberfield.emptyValue = null;
21262
+ Numberfield.group = 'basic-input';
21160
21263
  const type$5 = 'radio';
21161
21264
  function Radio(props) {
21162
21265
  const {
@@ -21186,7 +21289,7 @@
21186
21289
  } = useValuesAsync(field);
21187
21290
  const {
21188
21291
  formId
21189
- } = F$1(FormContext);
21292
+ } = F$1(FormContext$1);
21190
21293
  return e$1("div", {
21191
21294
  class: formFieldClasses(type$5, {
21192
21295
  errors,
@@ -21220,12 +21323,17 @@
21220
21323
  });
21221
21324
  }
21222
21325
  Radio.create = function (options = {}) {
21223
- if (options.valuesKey) return options;
21224
- return {
21225
- values: [{
21326
+ const defaults = {};
21327
+
21328
+ // provide default values if valuesKey isn't set
21329
+ if (!options.valuesKey) {
21330
+ defaults.values = [{
21226
21331
  label: 'Value',
21227
21332
  value: 'value'
21228
- }],
21333
+ }];
21334
+ }
21335
+ return {
21336
+ ...defaults,
21229
21337
  ...options
21230
21338
  };
21231
21339
  };
@@ -21234,38 +21342,306 @@
21234
21342
  Radio.keyed = true;
21235
21343
  Radio.emptyValue = null;
21236
21344
  Radio.sanitizeValue = sanitizeSingleSelectValue;
21345
+ Radio.group = 'selection';
21346
+ function _extends$e() {
21347
+ _extends$e = Object.assign ? Object.assign.bind() : function (target) {
21348
+ for (var i = 1; i < arguments.length; i++) {
21349
+ var source = arguments[i];
21350
+ for (var key in source) {
21351
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21352
+ target[key] = source[key];
21353
+ }
21354
+ }
21355
+ }
21356
+ return target;
21357
+ };
21358
+ return _extends$e.apply(this, arguments);
21359
+ }
21360
+ var XMarkIcon = ({
21361
+ styles = {},
21362
+ ...props
21363
+ }) => /*#__PURE__*/React.createElement("svg", _extends$e({
21364
+ xmlns: "http://www.w3.org/2000/svg",
21365
+ width: "8",
21366
+ height: "8"
21367
+ }, props), /*#__PURE__*/React.createElement("path", {
21368
+ fillRule: "evenodd",
21369
+ clipRule: "evenodd",
21370
+ fill: "currentColor",
21371
+ stroke: "currentColor",
21372
+ strokeWidth: ".5",
21373
+ d: "M4 3.766L7.43.336l.234.234L4.234 4l3.43 3.43-.234.234L4 4.234.57 7.664.336 7.43 3.766 4 .336.57.57.336zm0 0"
21374
+ }));
21375
+ function SearchableSelect(props) {
21376
+ const {
21377
+ id,
21378
+ disabled,
21379
+ errors,
21380
+ field,
21381
+ value
21382
+ } = props;
21383
+ const {
21384
+ formId
21385
+ } = F$1(FormContext$1);
21386
+ const [filter, setFilter] = l$2('');
21387
+ const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
21388
+ const [shouldApplyFilter, setShouldApplyFilter] = l$2(true);
21389
+ const [isEscapeClosed, setIsEscapeClose] = l$2(false);
21390
+ const searchbarRef = s$1();
21391
+ const {
21392
+ state: loadState,
21393
+ values: options
21394
+ } = useValuesAsync(field);
21395
+
21396
+ // We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
21397
+ const valueToOptionMap = d(() => Object.assign({}, ...options.map((o, x) => ({
21398
+ [o.value]: options[x]
21399
+ }))), [options]);
21400
+ const valueLabel = d(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
21401
+
21402
+ // whenever we change the underlying value, set the label to it
21403
+ y(() => {
21404
+ setFilter(valueLabel);
21405
+ }, [valueLabel]);
21406
+ const filteredOptions = d(() => {
21407
+ if (loadState === LOAD_STATES.LOADED) {
21408
+ return shouldApplyFilter ? options.filter(o => o.label && o.value && o.label.toLowerCase().includes(filter.toLowerCase())) : options;
21409
+ }
21410
+ return [];
21411
+ }, [filter, loadState, options, shouldApplyFilter]);
21412
+ const onChange = ({
21413
+ target
21414
+ }) => {
21415
+ setIsEscapeClose(false);
21416
+ setIsDropdownExpanded(true);
21417
+ setShouldApplyFilter(true);
21418
+ setFilter(target.value || '');
21419
+ };
21420
+ const setValue = A$1(option => {
21421
+ setFilter(option && option.label || '');
21422
+ props.onChange({
21423
+ value: option && option.value || null,
21424
+ field
21425
+ });
21426
+ }, [field, props]);
21427
+ const onInputKeyDown = A$1(keyDownEvent => {
21428
+ switch (keyDownEvent.key) {
21429
+ case 'ArrowUp':
21430
+ keyDownEvent.preventDefault();
21431
+ break;
21432
+ case 'ArrowDown':
21433
+ {
21434
+ if (!isDropdownExpanded) {
21435
+ setIsDropdownExpanded(true);
21436
+ setShouldApplyFilter(false);
21437
+ }
21438
+ keyDownEvent.preventDefault();
21439
+ break;
21440
+ }
21441
+ case 'Escape':
21442
+ setIsEscapeClose(true);
21443
+ break;
21444
+ case 'Enter':
21445
+ if (isEscapeClosed) {
21446
+ setIsEscapeClose(false);
21447
+ }
21448
+ break;
21449
+ }
21450
+ }, [isDropdownExpanded, isEscapeClosed]);
21451
+ const displayState = d(() => {
21452
+ const ds = {};
21453
+ ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
21454
+ ds.displayCross = ds.componentReady && value !== null && value !== undefined;
21455
+ ds.displayDropdown = !disabled && isDropdownExpanded && !isEscapeClosed;
21456
+ return ds;
21457
+ }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, value]);
21458
+ const onAngelMouseDown = A$1(e => {
21459
+ setIsEscapeClose(false);
21460
+ setIsDropdownExpanded(!isDropdownExpanded);
21461
+ const searchbar = searchbarRef.current;
21462
+ isDropdownExpanded ? searchbar.blur() : searchbar.focus();
21463
+ e.preventDefault();
21464
+ }, [isDropdownExpanded]);
21465
+ return e$1(d$1, {
21466
+ children: [e$1("div", {
21467
+ id: prefixId(`${id}`, formId),
21468
+ class: classNames('fjs-input-group', {
21469
+ 'disabled': disabled
21470
+ }, {
21471
+ 'hasErrors': errors.length
21472
+ }),
21473
+ children: [e$1("input", {
21474
+ disabled: disabled,
21475
+ class: "fjs-input",
21476
+ ref: searchbarRef,
21477
+ id: prefixId(`${id}-search`, formId),
21478
+ onChange: onChange,
21479
+ type: "text",
21480
+ value: filter,
21481
+ placeholder: 'Search',
21482
+ autoComplete: "off",
21483
+ onKeyDown: e => onInputKeyDown(e),
21484
+ onMouseDown: () => {
21485
+ setIsEscapeClose(false);
21486
+ setIsDropdownExpanded(true);
21487
+ setShouldApplyFilter(false);
21488
+ },
21489
+ onFocus: () => {
21490
+ setIsDropdownExpanded(true);
21491
+ setShouldApplyFilter(false);
21492
+ },
21493
+ onBlur: () => {
21494
+ setIsDropdownExpanded(false);
21495
+ setFilter(valueLabel);
21496
+ }
21497
+ }), displayState.displayCross && e$1("span", {
21498
+ class: "fjs-select-cross",
21499
+ onMouseDown: e => {
21500
+ setValue(null);
21501
+ e.preventDefault();
21502
+ },
21503
+ children: [e$1(XMarkIcon, {}), " "]
21504
+ }), e$1("span", {
21505
+ class: "fjs-select-arrow",
21506
+ onMouseDown: e => onAngelMouseDown(e),
21507
+ children: displayState.displayDropdown ? e$1(AngelUpIcon, {}) : e$1(AngelDownIcon, {})
21508
+ })]
21509
+ }), e$1("div", {
21510
+ class: "fjs-select-anchor",
21511
+ children: displayState.displayDropdown && e$1(DropdownList, {
21512
+ values: filteredOptions,
21513
+ getLabel: o => o.label,
21514
+ onValueSelected: o => {
21515
+ setValue(o);
21516
+ setIsDropdownExpanded(false);
21517
+ },
21518
+ listenerElement: searchbarRef.current
21519
+ })
21520
+ })]
21521
+ });
21522
+ }
21523
+ function SimpleSelect(props) {
21524
+ const {
21525
+ id,
21526
+ disabled,
21527
+ errors,
21528
+ field,
21529
+ value
21530
+ } = props;
21531
+ const {
21532
+ formId
21533
+ } = F$1(FormContext$1);
21534
+ const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
21535
+ const selectRef = s$1();
21536
+ const {
21537
+ state: loadState,
21538
+ values: options
21539
+ } = useValuesAsync(field);
21540
+
21541
+ // We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
21542
+ const valueToOptionMap = d(() => Object.assign({}, ...options.map((o, x) => ({
21543
+ [o.value]: options[x]
21544
+ }))), [options]);
21545
+ const valueLabel = d(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
21546
+ const setValue = A$1(option => {
21547
+ props.onChange({
21548
+ value: option && option.value || null,
21549
+ field
21550
+ });
21551
+ }, [field, props]);
21552
+ const displayState = d(() => {
21553
+ const ds = {};
21554
+ ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
21555
+ ds.displayCross = ds.componentReady && value !== null && value !== undefined;
21556
+ ds.displayDropdown = !disabled && isDropdownExpanded;
21557
+ return ds;
21558
+ }, [disabled, isDropdownExpanded, loadState, value]);
21559
+ const onMouseDown = A$1(e => {
21560
+ const select = selectRef.current;
21561
+ setIsDropdownExpanded(!isDropdownExpanded);
21562
+ if (isDropdownExpanded) {
21563
+ select.blur();
21564
+ } else {
21565
+ select.focus();
21566
+ }
21567
+ e.preventDefault();
21568
+ }, [isDropdownExpanded]);
21569
+ const initialFocusIndex = d(() => value && findIndex(options, o => o.value === value) || 0, [options, value]);
21570
+ return e$1(d$1, {
21571
+ children: [e$1("div", {
21572
+ ref: selectRef,
21573
+ id: prefixId(`${id}`, formId),
21574
+ class: classNames('fjs-input-group', {
21575
+ 'disabled': disabled
21576
+ }, {
21577
+ 'hasErrors': errors.length
21578
+ }),
21579
+ onFocus: () => setIsDropdownExpanded(true),
21580
+ onBlur: () => setIsDropdownExpanded(false),
21581
+ onMouseDown: e => onMouseDown(e),
21582
+ tabIndex: disabled ? undefined : 0,
21583
+ children: [e$1("div", {
21584
+ class: classNames('fjs-select-display', {
21585
+ 'fjs-select-placeholder': !value
21586
+ }),
21587
+ id: prefixId(`${id}-display`, formId),
21588
+ children: valueLabel || 'Select'
21589
+ }), displayState.displayCross && e$1("span", {
21590
+ class: "fjs-select-cross",
21591
+ onMouseDown: e => {
21592
+ setValue(null);
21593
+ e.stopPropagation();
21594
+ },
21595
+ children: e$1(XMarkIcon, {})
21596
+ }), e$1("span", {
21597
+ class: "fjs-select-arrow",
21598
+ children: displayState.displayDropdown ? e$1(AngelUpIcon, {}) : e$1(AngelDownIcon, {})
21599
+ })]
21600
+ }), e$1("div", {
21601
+ class: "fjs-select-anchor",
21602
+ children: displayState.displayDropdown && e$1(DropdownList, {
21603
+ values: options,
21604
+ getLabel: o => o.label,
21605
+ initialFocusIndex: initialFocusIndex,
21606
+ onValueSelected: o => {
21607
+ setValue(o);
21608
+ setIsDropdownExpanded(false);
21609
+ },
21610
+ listenerElement: selectRef.current
21611
+ })
21612
+ })]
21613
+ });
21614
+ }
21237
21615
  const type$4 = 'select';
21238
21616
  function Select$1(props) {
21239
21617
  const {
21240
21618
  disabled,
21241
21619
  errors = [],
21242
21620
  field,
21621
+ onChange,
21243
21622
  value
21244
21623
  } = props;
21245
21624
  const {
21246
21625
  description,
21247
21626
  id,
21248
21627
  label,
21628
+ searchable = false,
21249
21629
  validate = {}
21250
21630
  } = field;
21251
21631
  const {
21252
21632
  required
21253
21633
  } = validate;
21254
- const onChange = ({
21255
- target
21256
- }) => {
21257
- props.onChange({
21258
- field,
21259
- value: target.value === '' ? null : target.value
21260
- });
21261
- };
21262
- const {
21263
- state: loadState,
21264
- values: options
21265
- } = useValuesAsync(field);
21266
21634
  const {
21267
21635
  formId
21268
- } = F$1(FormContext);
21636
+ } = F$1(FormContext$1);
21637
+ const selectProps = d(() => ({
21638
+ id,
21639
+ disabled,
21640
+ errors,
21641
+ field,
21642
+ value,
21643
+ onChange
21644
+ }), [disabled, errors, field, id, value, onChange]);
21269
21645
  return e$1("div", {
21270
21646
  class: formFieldClasses(type$4, {
21271
21647
  errors,
@@ -21275,20 +21651,10 @@
21275
21651
  id: prefixId(id, formId),
21276
21652
  label: label,
21277
21653
  required: required
21278
- }), e$1("select", {
21279
- class: "fjs-select",
21280
- disabled: disabled,
21281
- id: prefixId(id, formId),
21282
- onChange: onChange,
21283
- value: value || '',
21284
- children: [e$1("option", {
21285
- value: ""
21286
- }), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
21287
- return e$1("option", {
21288
- value: option.value,
21289
- children: option.label
21290
- }, `${id}-${index}`);
21291
- })]
21654
+ }), searchable ? e$1(SearchableSelect, {
21655
+ ...selectProps
21656
+ }) : e$1(SimpleSelect, {
21657
+ ...selectProps
21292
21658
  }), e$1(Description$2, {
21293
21659
  description: description
21294
21660
  }), e$1(Errors, {
@@ -21296,13 +21662,18 @@
21296
21662
  })]
21297
21663
  });
21298
21664
  }
21299
- Select$1.create = function (options = {}) {
21300
- if (options.valuesKey) return options;
21301
- return {
21302
- values: [{
21665
+ Select$1.create = (options = {}) => {
21666
+ const defaults = {};
21667
+
21668
+ // provide default values if valuesKey isn't set
21669
+ if (!options.valuesKey) {
21670
+ defaults.values = [{
21303
21671
  label: 'Value',
21304
21672
  value: 'value'
21305
- }],
21673
+ }];
21674
+ }
21675
+ return {
21676
+ ...defaults,
21306
21677
  ...options
21307
21678
  };
21308
21679
  };
@@ -21311,34 +21682,7 @@
21311
21682
  Select$1.keyed = true;
21312
21683
  Select$1.emptyValue = null;
21313
21684
  Select$1.sanitizeValue = sanitizeSingleSelectValue;
21314
- function _extends$e() {
21315
- _extends$e = Object.assign ? Object.assign.bind() : function (target) {
21316
- for (var i = 1; i < arguments.length; i++) {
21317
- var source = arguments[i];
21318
- for (var key in source) {
21319
- if (Object.prototype.hasOwnProperty.call(source, key)) {
21320
- target[key] = source[key];
21321
- }
21322
- }
21323
- }
21324
- return target;
21325
- };
21326
- return _extends$e.apply(this, arguments);
21327
- }
21328
- var CloseIcon = ({
21329
- styles = {},
21330
- ...props
21331
- }) => /*#__PURE__*/React.createElement("svg", _extends$e({
21332
- width: "16",
21333
- height: "16",
21334
- fill: "none",
21335
- xmlns: "http://www.w3.org/2000/svg"
21336
- }, props), /*#__PURE__*/React.createElement("path", {
21337
- fillRule: "evenodd",
21338
- clipRule: "evenodd",
21339
- 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",
21340
- fill: "currentColor"
21341
- }));
21685
+ Select$1.group = 'selection';
21342
21686
  const type$3 = 'taglist';
21343
21687
  function Taglist(props) {
21344
21688
  const {
@@ -21354,7 +21698,7 @@
21354
21698
  } = field;
21355
21699
  const {
21356
21700
  formId
21357
- } = F$1(FormContext);
21701
+ } = F$1(FormContext$1);
21358
21702
  const [filter, setFilter] = l$2('');
21359
21703
  const [filteredOptions, setFilteredOptions] = l$2([]);
21360
21704
  const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
@@ -21442,6 +21786,7 @@
21442
21786
  searchbarRef.current.focus();
21443
21787
  }
21444
21788
  };
21789
+ const shouldDisplayDropdown = d(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
21445
21790
  return e$1("div", {
21446
21791
  class: formFieldClasses(type$3, {
21447
21792
  errors,
@@ -21452,23 +21797,25 @@
21452
21797
  id: prefixId(`${id}-search`, formId)
21453
21798
  }), e$1("div", {
21454
21799
  class: classNames('fjs-taglist', {
21455
- 'disabled': disabled
21800
+ 'fjs-disabled': disabled
21456
21801
  }),
21457
- children: [!disabled && loadState === LOAD_STATES.LOADED && e$1("div", {
21802
+ children: [loadState === LOAD_STATES.LOADED && e$1("div", {
21458
21803
  class: "fjs-taglist-tags",
21459
21804
  children: values.map(v => {
21460
21805
  return e$1("div", {
21461
- class: "fjs-taglist-tag",
21806
+ class: classNames('fjs-taglist-tag', {
21807
+ 'fjs-disabled': disabled
21808
+ }),
21462
21809
  onMouseDown: e => e.preventDefault(),
21463
21810
  children: [e$1("span", {
21464
21811
  class: "fjs-taglist-tag-label",
21465
21812
  children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
21466
- }), e$1("button", {
21813
+ }), !disabled && e$1("button", {
21467
21814
  type: "button",
21468
21815
  title: "Remove tag",
21469
21816
  class: "fjs-taglist-tag-remove",
21470
21817
  onClick: event => onTagRemoveClick(event, v),
21471
- children: e$1(CloseIcon, {})
21818
+ children: e$1(XMarkIcon, {})
21472
21819
  })]
21473
21820
  });
21474
21821
  })
@@ -21480,7 +21827,7 @@
21480
21827
  onChange: onFilterChange,
21481
21828
  type: "text",
21482
21829
  value: filter,
21483
- placeholder: 'Search',
21830
+ placeholder: disabled ? '' : 'Search',
21484
21831
  autoComplete: "off",
21485
21832
  onKeyDown: e => onInputKeyDown(e),
21486
21833
  onMouseDown: () => setIsEscapeClose(false),
@@ -21492,7 +21839,7 @@
21492
21839
  })]
21493
21840
  }), e$1("div", {
21494
21841
  class: "fjs-taglist-anchor",
21495
- children: !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed && e$1(DropdownList, {
21842
+ children: shouldDisplayDropdown && e$1(DropdownList, {
21496
21843
  values: filteredOptions,
21497
21844
  getLabel: o => o.label,
21498
21845
  onValueSelected: o => selectValue(o.value),
@@ -21506,21 +21853,219 @@
21506
21853
  })]
21507
21854
  });
21508
21855
  }
21509
- Taglist.create = function (options = {}) {
21510
- if (options.valuesKey) return options;
21511
- return {
21512
- values: [{
21856
+ Taglist.create = (options = {}) => {
21857
+ const defaults = {};
21858
+
21859
+ // provide default values if valuesKey isn't set
21860
+ if (!options.valuesKey) {
21861
+ defaults.values = [{
21513
21862
  label: 'Value',
21514
21863
  value: 'value'
21515
- }],
21864
+ }];
21865
+ }
21866
+ return {
21867
+ ...defaults,
21516
21868
  ...options
21517
21869
  };
21518
21870
  };
21519
21871
  Taglist.type = type$3;
21520
- Taglist.label = 'Taglist';
21872
+ Taglist.label = 'Tag list';
21521
21873
  Taglist.keyed = true;
21522
21874
  Taglist.emptyValue = [];
21523
21875
  Taglist.sanitizeValue = sanitizeMultiSelectValue;
21876
+ Taglist.group = 'selection';
21877
+ const type$2 = 'text';
21878
+ function Text$2(props) {
21879
+ const {
21880
+ field,
21881
+ disableLinks
21882
+ } = props;
21883
+ const {
21884
+ text = ''
21885
+ } = field;
21886
+ const textValue = useExpressionValue(text) || '';
21887
+ const componentOverrides = disableLinks ? {
21888
+ 'a': DisabledLink
21889
+ } : {};
21890
+ return e$1("div", {
21891
+ class: formFieldClasses(type$2),
21892
+ children: e$1(Markup, {
21893
+ markup: safeMarkdown(textValue),
21894
+ components: componentOverrides,
21895
+ trim: false
21896
+ })
21897
+ });
21898
+ }
21899
+ Text$2.create = (options = {}) => ({
21900
+ text: '# Text',
21901
+ ...options
21902
+ });
21903
+ Text$2.type = type$2;
21904
+ Text$2.keyed = false;
21905
+ Text$2.group = 'presentation';
21906
+ Text$2.label = 'Text view';
21907
+ function DisabledLink({
21908
+ href,
21909
+ children
21910
+ }) {
21911
+ return e$1("a", {
21912
+ class: "fjs-disabled-link",
21913
+ href: href,
21914
+ tabIndex: -1,
21915
+ children: children
21916
+ });
21917
+ }
21918
+ const type$1 = 'textfield';
21919
+ function Textfield$1(props) {
21920
+ const {
21921
+ disabled,
21922
+ errors = [],
21923
+ field,
21924
+ value = ''
21925
+ } = props;
21926
+ const {
21927
+ description,
21928
+ id,
21929
+ label,
21930
+ appearance = {},
21931
+ validate = {}
21932
+ } = field;
21933
+ const {
21934
+ prefixAdorner,
21935
+ suffixAdorner
21936
+ } = appearance;
21937
+ const {
21938
+ required
21939
+ } = validate;
21940
+ const onChange = ({
21941
+ target
21942
+ }) => {
21943
+ props.onChange({
21944
+ field,
21945
+ value: target.value
21946
+ });
21947
+ };
21948
+ const {
21949
+ formId
21950
+ } = F$1(FormContext$1);
21951
+ return e$1("div", {
21952
+ class: formFieldClasses(type$1, {
21953
+ errors,
21954
+ disabled
21955
+ }),
21956
+ children: [e$1(Label$1, {
21957
+ id: prefixId(id, formId),
21958
+ label: label,
21959
+ required: required
21960
+ }), e$1(InputAdorner, {
21961
+ disabled: disabled,
21962
+ pre: prefixAdorner,
21963
+ post: suffixAdorner,
21964
+ children: e$1("input", {
21965
+ class: "fjs-input",
21966
+ disabled: disabled,
21967
+ id: prefixId(id, formId),
21968
+ onInput: onChange,
21969
+ type: "text",
21970
+ value: value
21971
+ })
21972
+ }), e$1(Description$2, {
21973
+ description: description
21974
+ }), e$1(Errors, {
21975
+ errors: errors
21976
+ })]
21977
+ });
21978
+ }
21979
+ Textfield$1.create = (options = {}) => ({
21980
+ ...options
21981
+ });
21982
+ Textfield$1.type = type$1;
21983
+ Textfield$1.label = 'Text field';
21984
+ Textfield$1.keyed = true;
21985
+ Textfield$1.emptyValue = '';
21986
+ Textfield$1.sanitizeValue = ({
21987
+ value
21988
+ }) => isArray$3(value) || isObject$1(value) ? '' : String(value);
21989
+ Textfield$1.group = 'basic-input';
21990
+ const type = 'textarea';
21991
+ function Textarea(props) {
21992
+ const {
21993
+ disabled,
21994
+ errors = [],
21995
+ field,
21996
+ value = ''
21997
+ } = props;
21998
+ const {
21999
+ description,
22000
+ id,
22001
+ label,
22002
+ validate = {}
22003
+ } = field;
22004
+ const {
22005
+ required
22006
+ } = validate;
22007
+ const textareaRef = s$1();
22008
+ const onInput = ({
22009
+ target
22010
+ }) => {
22011
+ props.onChange({
22012
+ field,
22013
+ value: target.value
22014
+ });
22015
+ };
22016
+ const autoSizeTextarea = A$1(textarea => {
22017
+ // Ensures the textarea shrinks back, and improves resizing behavior consistency
22018
+ textarea.style.height = '0px';
22019
+ const computed = window.getComputedStyle(textarea);
22020
+ const calculatedHeight = parseInt(computed.getPropertyValue('border-top-width')) + parseInt(computed.getPropertyValue('padding-top')) + textarea.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom')) + parseInt(computed.getPropertyValue('border-bottom-width'));
22021
+ const minHeight = 75;
22022
+ const maxHeight = 350;
22023
+ const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
22024
+ textarea.style.height = `${displayHeight}px`;
22025
+
22026
+ // Overflow is hidden by default to hide scrollbar flickering
22027
+ textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
22028
+ }, []);
22029
+ y(() => {
22030
+ autoSizeTextarea(textareaRef.current);
22031
+ }, [autoSizeTextarea, value]);
22032
+ const {
22033
+ formId
22034
+ } = F$1(FormContext$1);
22035
+ return e$1("div", {
22036
+ class: formFieldClasses(type, {
22037
+ errors,
22038
+ disabled
22039
+ }),
22040
+ children: [e$1(Label$1, {
22041
+ id: prefixId(id, formId),
22042
+ label: label,
22043
+ required: required
22044
+ }), e$1("textarea", {
22045
+ class: "fjs-textarea",
22046
+ disabled: disabled,
22047
+ id: prefixId(id, formId),
22048
+ onInput: onInput,
22049
+ value: value,
22050
+ ref: textareaRef
22051
+ }), e$1(Description$2, {
22052
+ description: description
22053
+ }), e$1(Errors, {
22054
+ errors: errors
22055
+ })]
22056
+ });
22057
+ }
22058
+ Textarea.create = (options = {}) => ({
22059
+ ...options
22060
+ });
22061
+ Textarea.type = type;
22062
+ Textarea.label = 'Text area';
22063
+ Textarea.keyed = true;
22064
+ Textarea.emptyValue = '';
22065
+ Textarea.sanitizeValue = ({
22066
+ value
22067
+ }) => isArray$3(value) || isObject$1(value) ? '' : String(value);
22068
+ Textarea.group = 'basic-input';
21524
22069
  function _extends$d() {
21525
22070
  _extends$d = Object.assign ? Object.assign.bind() : function (target) {
21526
22071
  for (var i = 1; i < arguments.length; i++) {
@@ -21831,8 +22376,8 @@
21831
22376
  }, props), /*#__PURE__*/React.createElement("path", {
21832
22377
  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"
21833
22378
  }));
21834
- function _extends$2() {
21835
- _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
22379
+ function _extends$2$1() {
22380
+ _extends$2$1 = Object.assign ? Object.assign.bind() : function (target) {
21836
22381
  for (var i = 1; i < arguments.length; i++) {
21837
22382
  var source = arguments[i];
21838
22383
  for (var key in source) {
@@ -21843,12 +22388,12 @@
21843
22388
  }
21844
22389
  return target;
21845
22390
  };
21846
- return _extends$2.apply(this, arguments);
22391
+ return _extends$2$1.apply(this, arguments);
21847
22392
  }
21848
22393
  var TextfieldIcon = ({
21849
22394
  styles = {},
21850
22395
  ...props
21851
- }) => /*#__PURE__*/React.createElement("svg", _extends$2({
22396
+ }) => /*#__PURE__*/React.createElement("svg", _extends$2$1({
21852
22397
  xmlns: "http://www.w3.org/2000/svg",
21853
22398
  width: "54",
21854
22399
  height: "54"
@@ -21856,8 +22401,8 @@
21856
22401
  fillRule: "evenodd",
21857
22402
  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"
21858
22403
  }));
21859
- function _extends$1() {
21860
- _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
22404
+ function _extends$1$1() {
22405
+ _extends$1$1 = Object.assign ? Object.assign.bind() : function (target) {
21861
22406
  for (var i = 1; i < arguments.length; i++) {
21862
22407
  var source = arguments[i];
21863
22408
  for (var key in source) {
@@ -21868,12 +22413,12 @@
21868
22413
  }
21869
22414
  return target;
21870
22415
  };
21871
- return _extends$1.apply(this, arguments);
22416
+ return _extends$1$1.apply(this, arguments);
21872
22417
  }
21873
22418
  var TextareaIcon = ({
21874
22419
  styles = {},
21875
22420
  ...props
21876
- }) => /*#__PURE__*/React.createElement("svg", _extends$1({
22421
+ }) => /*#__PURE__*/React.createElement("svg", _extends$1$1({
21877
22422
  xmlns: "http://www.w3.org/2000/svg",
21878
22423
  width: "54",
21879
22424
  height: "54"
@@ -21881,8 +22426,8 @@
21881
22426
  fillRule: "evenodd",
21882
22427
  d: "M45 13a3 3 0 013 3v22a3 3 0 01-3 3H9a3 3 0 01-3-3V16a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v22a1 1 0 001 1h36a1 1 0 001-1V16a1 1 0 00-1-1zm-1.136 15.5l.848.849-6.363 6.363-.849-.848 6.364-6.364zm.264 3.5l.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
21883
22428
  }));
21884
- function _extends$i() {
21885
- _extends$i = Object.assign ? Object.assign.bind() : function (target) {
22429
+ function _extends$k() {
22430
+ _extends$k = Object.assign ? Object.assign.bind() : function (target) {
21886
22431
  for (var i = 1; i < arguments.length; i++) {
21887
22432
  var source = arguments[i];
21888
22433
  for (var key in source) {
@@ -21893,12 +22438,12 @@
21893
22438
  }
21894
22439
  return target;
21895
22440
  };
21896
- return _extends$i.apply(this, arguments);
22441
+ return _extends$k.apply(this, arguments);
21897
22442
  }
21898
22443
  var ImageIcon = ({
21899
22444
  styles = {},
21900
22445
  ...props
21901
- }) => /*#__PURE__*/React.createElement("svg", _extends$i({
22446
+ }) => /*#__PURE__*/React.createElement("svg", _extends$k({
21902
22447
  width: "54",
21903
22448
  height: "54",
21904
22449
  fill: "none",
@@ -21914,238 +22459,30 @@
21914
22459
  d: "M15 13a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V15a2 2 0 00-2-2H15zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 012.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 012.411.239L39 32.73V15zM15 39v-8.754c.06-.038.116-.083.168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 002.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15z",
21915
22460
  fill: "#000"
21916
22461
  }));
21917
- const iconsByType = {
21918
- button: ButtonIcon,
21919
- checkbox: CheckboxIcon,
21920
- checklist: ChecklistIcon,
21921
- columns: ColumnsIcon,
21922
- datetime: DatetimeIcon,
21923
- image: ImageIcon,
21924
- number: NumberIcon,
21925
- radio: RadioIcon,
21926
- select: SelectIcon,
21927
- taglist: TaglistIcon,
21928
- text: TextIcon,
21929
- textfield: TextfieldIcon,
21930
- textarea: TextareaIcon,
21931
- default: FormIcon
21932
- };
21933
- const type$2 = 'text';
21934
- function Text$2(props) {
21935
- const {
21936
- field,
21937
- disabled
21938
- } = props;
21939
- const {
21940
- text = ''
21941
- } = field;
21942
- const textValue = useExpressionValue(text) || '';
21943
- return e$1("div", {
21944
- class: formFieldClasses(type$2),
21945
- children: renderText(field, textValue, disabled)
21946
- });
21947
- }
21948
- Text$2.create = function (options = {}) {
21949
- return {
21950
- text: '# Text',
21951
- ...options
21952
- };
21953
- };
21954
- Text$2.type = type$2;
21955
- Text$2.keyed = false;
21956
-
21957
- // helper //////////////
21958
-
21959
- function renderText(field, content, disabled) {
21960
- const {
21961
- text
21962
- } = field;
21963
- const Icon = iconsByType['text'];
21964
- if (disabled) {
21965
- if (!text) {
21966
- return e$1("div", {
21967
- class: "fjs-form-field-placeholder",
21968
- children: [e$1(Icon, {
21969
- viewBox: "0 0 54 54"
21970
- }), "Text view is empty"]
21971
- });
21972
- }
21973
- if (isExpression$2(text)) {
21974
- return e$1("div", {
21975
- class: "fjs-form-field-placeholder",
21976
- children: [e$1(Icon, {
21977
- viewBox: "0 0 54 54"
21978
- }), "Text view is populated by an expression"]
21979
- });
21980
- }
21981
- }
21982
- return e$1(Markup, {
21983
- markup: safeMarkdown(content),
21984
- trim: false
21985
- });
21986
- }
21987
- const type$1 = 'textfield';
21988
- function Textfield$1(props) {
21989
- const {
21990
- disabled,
21991
- errors = [],
21992
- field,
21993
- value = ''
21994
- } = props;
21995
- const {
21996
- description,
21997
- id,
21998
- label,
21999
- appearance = {},
22000
- validate = {}
22001
- } = field;
22002
- const {
22003
- prefixAdorner,
22004
- suffixAdorner
22005
- } = appearance;
22006
- const {
22007
- required
22008
- } = validate;
22009
- const onChange = ({
22010
- target
22011
- }) => {
22012
- props.onChange({
22013
- field,
22014
- value: target.value
22015
- });
22016
- };
22017
- const {
22018
- formId
22019
- } = F$1(FormContext);
22020
- return e$1("div", {
22021
- class: formFieldClasses(type$1, {
22022
- errors,
22023
- disabled
22024
- }),
22025
- children: [e$1(Label$1, {
22026
- id: prefixId(id, formId),
22027
- label: label,
22028
- required: required
22029
- }), e$1(InputAdorner, {
22030
- disabled: disabled,
22031
- pre: prefixAdorner,
22032
- post: suffixAdorner,
22033
- children: e$1("input", {
22034
- class: "fjs-input",
22035
- disabled: disabled,
22036
- id: prefixId(id, formId),
22037
- onInput: onChange,
22038
- type: "text",
22039
- value: value
22040
- })
22041
- }), e$1(Description$2, {
22042
- description: description
22043
- }), e$1(Errors, {
22044
- errors: errors
22045
- })]
22046
- });
22047
- }
22048
- Textfield$1.create = function (options = {}) {
22049
- return {
22050
- ...options
22051
- };
22052
- };
22053
- Textfield$1.type = type$1;
22054
- Textfield$1.label = 'Text field';
22055
- Textfield$1.keyed = true;
22056
- Textfield$1.emptyValue = '';
22057
- Textfield$1.sanitizeValue = ({
22058
- value
22059
- }) => isArray$3(value) || isObject$1(value) ? '' : String(value);
22060
- const type = 'textarea';
22061
- function Textarea(props) {
22062
- const {
22063
- disabled,
22064
- errors = [],
22065
- field,
22066
- value = ''
22067
- } = props;
22068
- const {
22069
- description,
22070
- id,
22071
- label,
22072
- validate = {}
22073
- } = field;
22074
- const {
22075
- required
22076
- } = validate;
22077
- const textareaRef = s$1();
22078
- const onInput = ({
22079
- target
22080
- }) => {
22081
- props.onChange({
22082
- field,
22083
- value: target.value
22084
- });
22085
- };
22086
- const autoSizeTextarea = A$1(textarea => {
22087
- // Ensures the textarea shrinks back, and improves resizing behavior consistency
22088
- textarea.style.height = '0px';
22089
- const computed = window.getComputedStyle(textarea);
22090
- const calculatedHeight = parseInt(computed.getPropertyValue('border-top-width')) + parseInt(computed.getPropertyValue('padding-top')) + textarea.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom')) + parseInt(computed.getPropertyValue('border-bottom-width'));
22091
- const minHeight = 75;
22092
- const maxHeight = 350;
22093
- const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
22094
- textarea.style.height = `${displayHeight}px`;
22095
-
22096
- // Overflow is hidden by default to hide scrollbar flickering
22097
- textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
22098
- }, []);
22099
- y(() => {
22100
- autoSizeTextarea(textareaRef.current);
22101
- }, [autoSizeTextarea, value]);
22102
- const {
22103
- formId
22104
- } = F$1(FormContext);
22105
- return e$1("div", {
22106
- class: formFieldClasses(type, {
22107
- errors,
22108
- disabled
22109
- }),
22110
- children: [e$1(Label$1, {
22111
- id: prefixId(id, formId),
22112
- label: label,
22113
- required: required
22114
- }), e$1("textarea", {
22115
- class: "fjs-textarea",
22116
- disabled: disabled,
22117
- id: prefixId(id, formId),
22118
- onInput: onInput,
22119
- value: value,
22120
- ref: textareaRef
22121
- }), e$1(Description$2, {
22122
- description: description
22123
- }), e$1(Errors, {
22124
- errors: errors
22125
- })]
22126
- });
22127
- }
22128
- Textarea.create = function (options = {}) {
22462
+ const iconsByType = type => {
22129
22463
  return {
22130
- ...options
22131
- };
22464
+ button: ButtonIcon,
22465
+ checkbox: CheckboxIcon,
22466
+ checklist: ChecklistIcon,
22467
+ columns: ColumnsIcon,
22468
+ datetime: DatetimeIcon,
22469
+ image: ImageIcon,
22470
+ number: NumberIcon,
22471
+ radio: RadioIcon,
22472
+ select: SelectIcon,
22473
+ taglist: TaglistIcon,
22474
+ text: TextIcon,
22475
+ textfield: TextfieldIcon,
22476
+ textarea: TextareaIcon,
22477
+ default: FormIcon
22478
+ }[type];
22132
22479
  };
22133
- Textarea.type = type;
22134
- Textarea.label = 'Text area';
22135
- Textarea.keyed = true;
22136
- Textarea.emptyValue = '';
22137
- Textarea.sanitizeValue = ({
22138
- value
22139
- }) => isArray$3(value) || isObject$1(value) ? '' : String(value);
22140
22480
  const formFields = [Button, Checkbox$1, Checklist, Default, Image, Numberfield, Datetime, Radio, Select$1, Taglist, Text$2, Textfield$1, Textarea];
22141
22481
  class FormFields {
22142
22482
  constructor() {
22143
22483
  this._formFields = {};
22144
22484
  formFields.forEach(formField => {
22145
- const {
22146
- type
22147
- } = formField;
22148
- this.register(type, formField);
22485
+ this.register(formField.type, formField);
22149
22486
  });
22150
22487
  }
22151
22488
  register(type, formField) {
@@ -22186,7 +22523,7 @@
22186
22523
  if (!schema) {
22187
22524
  return null;
22188
22525
  }
22189
- return e$1(FormContext.Provider, {
22526
+ return e$1(FormContext$1.Provider, {
22190
22527
  value: formContext,
22191
22528
  children: e$1(FormComponent, {
22192
22529
  onChange: onChange,
@@ -22403,7 +22740,7 @@
22403
22740
  }
22404
22741
  const value = get$1(data, _path);
22405
22742
  const fieldErrors = validator.validateField(field, value);
22406
- return set$1(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
22743
+ return set$2(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
22407
22744
  }, /** @type {Errors} */{});
22408
22745
  this._setState({
22409
22746
  errors
@@ -22452,7 +22789,7 @@
22452
22789
  * @param {any} value
22453
22790
  */
22454
22791
  setProperty(property, value) {
22455
- const properties = set$1(this._getState().properties, [property], value);
22792
+ const properties = set$2(this._getState().properties, [property], value);
22456
22793
  this._setState({
22457
22794
  properties
22458
22795
  });
@@ -22517,8 +22854,8 @@
22517
22854
  } = this._getState();
22518
22855
  const validator = this.get('validator');
22519
22856
  const fieldErrors = validator.validateField(field, value);
22520
- set$1(data, _path, value);
22521
- set$1(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
22857
+ set$2(data, _path, value);
22858
+ set$2(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
22522
22859
  this._setState({
22523
22860
  data: clone(data),
22524
22861
  errors: clone(errors)
@@ -22584,7 +22921,7 @@
22584
22921
  return conditionChecker.applyConditions(toFilter, data);
22585
22922
  }
22586
22923
  }
22587
- const schemaVersion = 6;
22924
+ const schemaVersion = 7;
22588
22925
 
22589
22926
  /**
22590
22927
  * Flatten array, one level deep.
@@ -22895,7 +23232,7 @@
22895
23232
  * @param {(string|number)[]} path The path to the nested value.
22896
23233
  * @param {any} value The value to set.
22897
23234
  */
22898
- function set(target, path, value) {
23235
+ function set$1(target, path, value) {
22899
23236
  let currentTarget = target;
22900
23237
  forEach(path, function (key, idx) {
22901
23238
  if (typeof key !== 'number' && typeof key !== 'string') {
@@ -23214,14 +23551,14 @@
23214
23551
  function rmClass(el, className) {
23215
23552
  el.className = el.className.replace(lookupClass(className), ' ').trim();
23216
23553
  }
23217
- var classes$1 = {
23554
+ var classes$2 = {
23218
23555
  add: addClass,
23219
23556
  rm: rmClass
23220
23557
  };
23221
23558
 
23222
23559
  var emitter = emitter$1;
23223
23560
  var crossvent = crossvent$1;
23224
- var classes = classes$1;
23561
+ var classes$1 = classes$2;
23225
23562
  var doc$1 = document;
23226
23563
  var documentElement = doc$1.documentElement;
23227
23564
  function dragula(initialContainers, options) {
@@ -23376,7 +23713,7 @@
23376
23713
  var offset = getOffset(_item);
23377
23714
  _offsetX = getCoord('pageX', e) - offset.left;
23378
23715
  _offsetY = getCoord('pageY', e) - offset.top;
23379
- classes.add(_copy || _item, 'gu-transit');
23716
+ classes$1.add(_copy || _item, 'gu-transit');
23380
23717
  renderMirrorImage();
23381
23718
  drag(e);
23382
23719
  }
@@ -23520,7 +23857,7 @@
23520
23857
  ungrab();
23521
23858
  removeMirrorImage();
23522
23859
  if (item) {
23523
- classes.rm(item, 'gu-transit');
23860
+ classes$1.rm(item, 'gu-transit');
23524
23861
  }
23525
23862
  if (_renderTimer) {
23526
23863
  clearTimeout(_renderTimer);
@@ -23624,11 +23961,11 @@
23624
23961
  }
23625
23962
  }
23626
23963
  function spillOver(el) {
23627
- classes.rm(el, 'gu-hide');
23964
+ classes$1.rm(el, 'gu-hide');
23628
23965
  }
23629
23966
  function spillOut(el) {
23630
23967
  if (drake.dragging) {
23631
- classes.add(el, 'gu-hide');
23968
+ classes$1.add(el, 'gu-hide');
23632
23969
  }
23633
23970
  }
23634
23971
  function renderMirrorImage() {
@@ -23639,16 +23976,16 @@
23639
23976
  _mirror = _item.cloneNode(true);
23640
23977
  _mirror.style.width = getRectWidth(rect) + 'px';
23641
23978
  _mirror.style.height = getRectHeight(rect) + 'px';
23642
- classes.rm(_mirror, 'gu-transit');
23643
- classes.add(_mirror, 'gu-mirror');
23979
+ classes$1.rm(_mirror, 'gu-transit');
23980
+ classes$1.add(_mirror, 'gu-mirror');
23644
23981
  o.mirrorContainer.appendChild(_mirror);
23645
23982
  touchy(documentElement, 'add', 'mousemove', drag);
23646
- classes.add(o.mirrorContainer, 'gu-unselectable');
23983
+ classes$1.add(o.mirrorContainer, 'gu-unselectable');
23647
23984
  drake.emit('cloned', _mirror, _item, 'mirror');
23648
23985
  }
23649
23986
  function removeMirrorImage() {
23650
23987
  if (_mirror) {
23651
- classes.rm(o.mirrorContainer, 'gu-unselectable');
23988
+ classes$1.rm(o.mirrorContainer, 'gu-unselectable');
23652
23989
  touchy(documentElement, 'remove', 'mousemove', drag);
23653
23990
  getParent(_mirror).removeChild(_mirror);
23654
23991
  _mirror = null;
@@ -23836,7 +24173,7 @@
23836
24173
  }
23837
24174
  var dragula_1 = dragula;
23838
24175
 
23839
- function _mergeNamespaces(n, m) {
24176
+ function _mergeNamespaces$1(n, m) {
23840
24177
  m.forEach(function (e) {
23841
24178
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
23842
24179
  if (k !== 'default' && !(k in n)) {
@@ -23853,6 +24190,140 @@
23853
24190
  return Object.freeze(n);
23854
24191
  }
23855
24192
 
24193
+ /**
24194
+ * Taken from https://github.com/component/classes
24195
+ *
24196
+ * Without the component bits.
24197
+ */
24198
+
24199
+ /**
24200
+ * toString reference.
24201
+ */
24202
+
24203
+ const toString$1 = Object.prototype.toString;
24204
+
24205
+ /**
24206
+ * Wrap `el` in a `ClassList`.
24207
+ *
24208
+ * @param {Element} el
24209
+ * @return {ClassList}
24210
+ * @api public
24211
+ */
24212
+
24213
+ function classes(el) {
24214
+ return new ClassList(el);
24215
+ }
24216
+
24217
+ /**
24218
+ * Initialize a new ClassList for `el`.
24219
+ *
24220
+ * @param {Element} el
24221
+ * @api private
24222
+ */
24223
+
24224
+ function ClassList(el) {
24225
+ if (!el || !el.nodeType) {
24226
+ throw new Error('A DOM element reference is required');
24227
+ }
24228
+ this.el = el;
24229
+ this.list = el.classList;
24230
+ }
24231
+
24232
+ /**
24233
+ * Add class `name` if not already present.
24234
+ *
24235
+ * @param {String} name
24236
+ * @return {ClassList}
24237
+ * @api public
24238
+ */
24239
+
24240
+ ClassList.prototype.add = function (name) {
24241
+ this.list.add(name);
24242
+ return this;
24243
+ };
24244
+
24245
+ /**
24246
+ * Remove class `name` when present, or
24247
+ * pass a regular expression to remove
24248
+ * any which match.
24249
+ *
24250
+ * @param {String|RegExp} name
24251
+ * @return {ClassList}
24252
+ * @api public
24253
+ */
24254
+
24255
+ ClassList.prototype.remove = function (name) {
24256
+ if ('[object RegExp]' == toString$1.call(name)) {
24257
+ return this.removeMatching(name);
24258
+ }
24259
+ this.list.remove(name);
24260
+ return this;
24261
+ };
24262
+
24263
+ /**
24264
+ * Remove all classes matching `re`.
24265
+ *
24266
+ * @param {RegExp} re
24267
+ * @return {ClassList}
24268
+ * @api private
24269
+ */
24270
+
24271
+ ClassList.prototype.removeMatching = function (re) {
24272
+ const arr = this.array();
24273
+ for (let i = 0; i < arr.length; i++) {
24274
+ if (re.test(arr[i])) {
24275
+ this.remove(arr[i]);
24276
+ }
24277
+ }
24278
+ return this;
24279
+ };
24280
+
24281
+ /**
24282
+ * Toggle class `name`, can force state via `force`.
24283
+ *
24284
+ * For browsers that support classList, but do not support `force` yet,
24285
+ * the mistake will be detected and corrected.
24286
+ *
24287
+ * @param {String} name
24288
+ * @param {Boolean} force
24289
+ * @return {ClassList}
24290
+ * @api public
24291
+ */
24292
+
24293
+ ClassList.prototype.toggle = function (name, force) {
24294
+ if ('undefined' !== typeof force) {
24295
+ if (force !== this.list.toggle(name, force)) {
24296
+ this.list.toggle(name); // toggle again to correct
24297
+ }
24298
+ } else {
24299
+ this.list.toggle(name);
24300
+ }
24301
+ return this;
24302
+ };
24303
+
24304
+ /**
24305
+ * Return an array of classes.
24306
+ *
24307
+ * @return {Array}
24308
+ * @api public
24309
+ */
24310
+
24311
+ ClassList.prototype.array = function () {
24312
+ return Array.from(this.list);
24313
+ };
24314
+
24315
+ /**
24316
+ * Check if class `name` is present.
24317
+ *
24318
+ * @param {String} name
24319
+ * @return {ClassList}
24320
+ * @api public
24321
+ */
24322
+
24323
+ ClassList.prototype.has = ClassList.prototype.contains = function (name) {
24324
+ return this.list.contains(name);
24325
+ };
24326
+
23856
24327
  /**
23857
24328
  * @param { HTMLElement } element
23858
24329
  * @param { String } selector
@@ -23916,7 +24387,7 @@
23916
24387
  el[unbind$1$1](prefix$1 + type, fn, capture || false);
23917
24388
  return fn;
23918
24389
  };
23919
- var event = /*#__PURE__*/_mergeNamespaces({
24390
+ var event = /*#__PURE__*/_mergeNamespaces$1({
23920
24391
  __proto__: null,
23921
24392
  bind: bind_1,
23922
24393
  unbind: unbind_1,
@@ -24020,7 +24491,11 @@
24020
24491
  return el.querySelector(selector);
24021
24492
  }
24022
24493
 
24023
- var arrayMove$1 = {exports: {}};
24494
+ var arrayMoveExports = {};
24495
+ var arrayMove$1 = {
24496
+ get exports(){ return arrayMoveExports; },
24497
+ set exports(v){ arrayMoveExports = v; },
24498
+ };
24024
24499
 
24025
24500
  const arrayMoveMutate = (array, from, to) => {
24026
24501
  const startIndex = from < 0 ? array.length + from : from;
@@ -24036,12 +24511,12 @@
24036
24511
  return array;
24037
24512
  };
24038
24513
  arrayMove$1.exports = arrayMove;
24039
- var mutate = arrayMove$1.exports.mutate = arrayMoveMutate;
24514
+ var mutate = arrayMoveExports.mutate = arrayMoveMutate;
24040
24515
 
24041
24516
  /**
24042
24517
  The data structure for documents. @nonabstract
24043
24518
  */
24044
- class Text$1 {
24519
+ let Text$1 = class Text {
24045
24520
  /**
24046
24521
  @internal
24047
24522
  */
@@ -24159,7 +24634,7 @@
24159
24634
  if (text.length == 1 && !text[0]) return Text$1.empty;
24160
24635
  return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
24161
24636
  }
24162
- }
24637
+ };
24163
24638
  // Leaves store an array of line strings. There are always line breaks
24164
24639
  // between these strings. Leaves are limited in size and have to be
24165
24640
  // contained in TextNode instances for bigger documents.
@@ -28030,7 +28505,6 @@
28030
28505
  222: "\""
28031
28506
  };
28032
28507
  var chrome$1 = typeof navigator != "undefined" && /Chrome\/(\d+)/.exec(navigator.userAgent);
28033
- typeof navigator != "undefined" && /Gecko\/\d+/.test(navigator.userAgent);
28034
28508
  var mac = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
28035
28509
  var ie$1 = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
28036
28510
  var brokenModifierNames = mac || chrome$1 && +chrome$1[1] < 57;
@@ -30214,7 +30688,7 @@
30214
30688
  }
30215
30689
  }
30216
30690
  // Reused array of character types
30217
- const types$1 = [];
30691
+ const types = [];
30218
30692
  function computeOrder(line, direction) {
30219
30693
  let len = line.length,
30220
30694
  outerType = direction == LTR ? 1 /* T.L */ : 2 /* T.R */,
@@ -30233,7 +30707,7 @@
30233
30707
  for (let i = 0, prev = outerType, prevStrong = outerType; i < len; i++) {
30234
30708
  let type = charType(line.charCodeAt(i));
30235
30709
  if (type == 512 /* T.NSM */) type = prev;else if (type == 8 /* T.EN */ && prevStrong == 4 /* T.AL */) type = 16 /* T.AN */;
30236
- types$1[i] = type == 4 /* T.AL */ ? 2 /* T.R */ : type;
30710
+ types[i] = type == 4 /* T.AL */ ? 2 /* T.R */ : type;
30237
30711
  if (type & 7 /* T.Strong */) prevStrong = type;
30238
30712
  prev = type;
30239
30713
  }
@@ -30246,17 +30720,17 @@
30246
30720
  // found, then change the type of the European number to L.
30247
30721
  // (Left after this: L, R, EN+AN, NI)
30248
30722
  for (let i = 0, prev = outerType, prevStrong = outerType; i < len; i++) {
30249
- let type = types$1[i];
30723
+ let type = types[i];
30250
30724
  if (type == 128 /* T.CS */) {
30251
- if (i < len - 1 && prev == types$1[i + 1] && prev & 24 /* T.Num */) type = types$1[i] = prev;else types$1[i] = 256 /* T.NI */;
30725
+ if (i < len - 1 && prev == types[i + 1] && prev & 24 /* T.Num */) type = types[i] = prev;else types[i] = 256 /* T.NI */;
30252
30726
  } else if (type == 64 /* T.ET */) {
30253
30727
  let end = i + 1;
30254
- while (end < len && types$1[end] == 64 /* T.ET */) end++;
30255
- let replace = i && prev == 8 /* T.EN */ || end < len && types$1[end] == 8 /* T.EN */ ? prevStrong == 1 /* T.L */ ? 1 /* T.L */ : 8 /* T.EN */ : 256 /* T.NI */;
30256
- for (let j = i; j < end; j++) types$1[j] = replace;
30728
+ while (end < len && types[end] == 64 /* T.ET */) end++;
30729
+ let replace = i && prev == 8 /* T.EN */ || end < len && types[end] == 8 /* T.EN */ ? prevStrong == 1 /* T.L */ ? 1 /* T.L */ : 8 /* T.EN */ : 256 /* T.NI */;
30730
+ for (let j = i; j < end; j++) types[j] = replace;
30257
30731
  i = end - 1;
30258
30732
  } else if (type == 8 /* T.EN */ && prevStrong == 1 /* T.L */) {
30259
- types$1[i] = 1 /* T.L */;
30733
+ types[i] = 1 /* T.L */;
30260
30734
  }
30261
30735
 
30262
30736
  prev = type;
@@ -30276,7 +30750,7 @@
30276
30750
  if (BracketStack[sJ + 1] == -br) {
30277
30751
  let flags = BracketStack[sJ + 2];
30278
30752
  let type = flags & 2 /* Bracketed.EmbedInside */ ? outerType : !(flags & 4 /* Bracketed.OppositeInside */) ? 0 : flags & 1 /* Bracketed.OppositeBefore */ ? oppositeType : outerType;
30279
- if (type) types$1[i] = types$1[BracketStack[sJ]] = type;
30753
+ if (type) types[i] = types[BracketStack[sJ]] = type;
30280
30754
  sI = sJ;
30281
30755
  break;
30282
30756
  }
@@ -30288,7 +30762,7 @@
30288
30762
  BracketStack[sI++] = ch;
30289
30763
  BracketStack[sI++] = context;
30290
30764
  }
30291
- } else if ((type = types$1[i]) == 2 /* T.R */ || type == 1 /* T.L */) {
30765
+ } else if ((type = types[i]) == 2 /* T.R */ || type == 1 /* T.L */) {
30292
30766
  let embed = type == outerType;
30293
30767
  context = embed ? 0 : 1 /* Bracketed.OppositeBefore */;
30294
30768
  for (let sJ = sI - 3; sJ >= 0; sJ -= 3) {
@@ -30311,13 +30785,13 @@
30311
30785
  // N2. Any remaining neutrals take the embedding direction.
30312
30786
  // (Left after this: L, R, EN+AN)
30313
30787
  for (let i = 0; i < len; i++) {
30314
- if (types$1[i] == 256 /* T.NI */) {
30788
+ if (types[i] == 256 /* T.NI */) {
30315
30789
  let end = i + 1;
30316
- while (end < len && types$1[end] == 256 /* T.NI */) end++;
30317
- let beforeL = (i ? types$1[i - 1] : outerType) == 1 /* T.L */;
30318
- let afterL = (end < len ? types$1[end] : outerType) == 1 /* T.L */;
30790
+ while (end < len && types[end] == 256 /* T.NI */) end++;
30791
+ let beforeL = (i ? types[i - 1] : outerType) == 1 /* T.L */;
30792
+ let afterL = (end < len ? types[end] : outerType) == 1 /* T.L */;
30319
30793
  let replace = beforeL == afterL ? beforeL ? 1 /* T.L */ : 2 /* T.R */ : outerType;
30320
- for (let j = i; j < end; j++) types$1[j] = replace;
30794
+ for (let j = i; j < end; j++) types[j] = replace;
30321
30795
  i = end - 1;
30322
30796
  }
30323
30797
  }
@@ -30330,13 +30804,13 @@
30330
30804
  if (outerType == 1 /* T.L */) {
30331
30805
  for (let i = 0; i < len;) {
30332
30806
  let start = i,
30333
- rtl = types$1[i++] != 1 /* T.L */;
30334
- while (i < len && rtl == (types$1[i] != 1 /* T.L */)) i++;
30807
+ rtl = types[i++] != 1 /* T.L */;
30808
+ while (i < len && rtl == (types[i] != 1 /* T.L */)) i++;
30335
30809
  if (rtl) {
30336
30810
  for (let j = i; j > start;) {
30337
30811
  let end = j,
30338
- l = types$1[--j] != 2 /* T.R */;
30339
- while (j > start && l == (types$1[j - 1] != 2 /* T.R */)) j--;
30812
+ l = types[--j] != 2 /* T.R */;
30813
+ while (j > start && l == (types[j - 1] != 2 /* T.R */)) j--;
30340
30814
  order.push(new BidiSpan(j, end, l ? 2 : 1));
30341
30815
  }
30342
30816
  } else {
@@ -30346,8 +30820,8 @@
30346
30820
  } else {
30347
30821
  for (let i = 0; i < len;) {
30348
30822
  let start = i,
30349
- rtl = types$1[i++] == 2 /* T.R */;
30350
- while (i < len && rtl == (types$1[i] == 2 /* T.R */)) i++;
30823
+ rtl = types[i++] == 2 /* T.R */;
30824
+ while (i < len && rtl == (types[i] == 2 /* T.R */)) i++;
30351
30825
  order.push(new BidiSpan(start, i, rtl ? 1 : 2));
30352
30826
  }
30353
30827
  }
@@ -44343,9 +44817,12 @@
44343
44817
  });
44344
44818
 
44345
44819
  var componentEvent = {};
44346
- var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
44347
- unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
44820
+ var bind$1, unbind$1, prefix;
44821
+ function detect() {
44822
+ bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent';
44823
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent';
44348
44824
  prefix = bind$1 !== 'addEventListener' ? 'on' : '';
44825
+ }
44349
44826
 
44350
44827
  /**
44351
44828
  * Bind `el` event `type` to `fn`.
@@ -44359,6 +44836,7 @@
44359
44836
  */
44360
44837
 
44361
44838
  componentEvent.bind = function (el, type, fn, capture) {
44839
+ if (!bind$1) detect();
44362
44840
  el[bind$1](prefix + type, fn, capture || false);
44363
44841
  return fn;
44364
44842
  };
@@ -44375,6 +44853,7 @@
44375
44853
  */
44376
44854
 
44377
44855
  componentEvent.unbind = function (el, type, fn, capture) {
44856
+ if (!unbind$1) detect();
44378
44857
  el[unbind$1](prefix + type, fn, capture || false);
44379
44858
  return fn;
44380
44859
  };
@@ -44472,6 +44951,71 @@
44472
44951
  }
44473
44952
  var domify$1 = domify;
44474
44953
 
44954
+ /**
44955
+ * Create an array of syntax errors in the given tree.
44956
+ *
44957
+ * @param {Tree} syntaxTree
44958
+ * @returns {LintMessage[]} array of syntax errors
44959
+ */
44960
+ function lintSyntax(syntaxTree) {
44961
+ const lintMessages = [];
44962
+ syntaxTree.iterate({
44963
+ enter: node => {
44964
+ if (node.type.isError) {
44965
+ const error = node.toString();
44966
+
44967
+ /* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
44968
+ const match = /\((.*?)\)/.exec(error);
44969
+ const nodeType = match && match[1];
44970
+ let message;
44971
+ if (nodeType) {
44972
+ message = 'unexpected ' + nodeType;
44973
+ } else {
44974
+ message = 'expression expected';
44975
+ }
44976
+ lintMessages.push({
44977
+ from: node.from,
44978
+ to: node.to,
44979
+ severity: 'error',
44980
+ message: message,
44981
+ type: 'syntaxError'
44982
+ });
44983
+ }
44984
+ }
44985
+ });
44986
+ return lintMessages;
44987
+ }
44988
+
44989
+ /**
44990
+ * Generates lint messages for the given syntax tree.
44991
+ *
44992
+ * @param {Tree} syntaxTree
44993
+ * @returns {LintMessage[]} array of all lint messages
44994
+ */
44995
+ function lintAll(syntaxTree) {
44996
+ const lintMessages = [...lintSyntax(syntaxTree)];
44997
+ return lintMessages;
44998
+ }
44999
+
45000
+ /**
45001
+ * CodeMirror extension that provides linting for FEEL expressions.
45002
+ *
45003
+ * @param {EditorView} editorView
45004
+ * @returns {Source} CodeMirror linting source
45005
+ */
45006
+ const cmFeelLinter = () => editorView => {
45007
+ // don't lint if the Editor is empty
45008
+ if (editorView.state.doc.length === 0) {
45009
+ return [];
45010
+ }
45011
+ const tree = syntaxTree(editorView.state);
45012
+ const messages = lintAll(tree);
45013
+ return messages.map(message => ({
45014
+ ...message,
45015
+ source: 'syntaxError'
45016
+ }));
45017
+ };
45018
+
44475
45019
  // helpers ///////////////////////////////
44476
45020
 
44477
45021
  function isNodeEmpty(node) {
@@ -44743,9 +45287,10 @@
44743
45287
  label: tag.name,
44744
45288
  type: 'function',
44745
45289
  info: () => {
44746
- const html = domify$1(tag.description);
45290
+ const html = domify$1(`<div class="description">${tag.description}<div>`);
44747
45291
  return html;
44748
- }
45292
+ },
45293
+ boost: -1
44749
45294
  }));
44750
45295
  var builtins = context => {
44751
45296
  let nodeBefore = syntaxTree(context.state).resolve(context.pos, -1);
@@ -44776,6 +45321,86 @@
44776
45321
  * @type {Facet<import('..').Variable[]>} Variable
44777
45322
  */
44778
45323
  const variablesFacet$1 = Facet.define();
45324
+ var pathExpression = context => {
45325
+ const variables = context.state.facet(variablesFacet$1)[0];
45326
+ const nodeBefore = syntaxTree(context.state).resolve(context.pos, -1);
45327
+ if (!isPathExpression(nodeBefore)) {
45328
+ return;
45329
+ }
45330
+ const expression = findPathExpression(nodeBefore);
45331
+
45332
+ // if the cursor is directly after the `.`, variable starts at the cursor position
45333
+ const from = nodeBefore === expression ? context.pos : nodeBefore.from;
45334
+ const path = getPath(expression, context);
45335
+ let options = variables;
45336
+ for (var i = 0; i < path.length - 1; i++) {
45337
+ var childVar = options.find(val => val.name === path[i].name);
45338
+ if (!childVar) {
45339
+ return null;
45340
+ }
45341
+
45342
+ // only suggest if variable type matches
45343
+ if (childVar.isList !== 'optional' && !!childVar.isList !== path[i].isList) {
45344
+ return;
45345
+ }
45346
+ options = childVar.entries;
45347
+ }
45348
+ if (!options) return;
45349
+ options = options.map(v => ({
45350
+ label: v.name,
45351
+ type: 'variable',
45352
+ info: v.info,
45353
+ detail: v.detail
45354
+ }));
45355
+ const result = {
45356
+ from: from,
45357
+ options: options
45358
+ };
45359
+ return result;
45360
+ };
45361
+ function findPathExpression(node) {
45362
+ while (node) {
45363
+ if (node.name === 'PathExpression') {
45364
+ return node;
45365
+ }
45366
+ node = node.parent;
45367
+ }
45368
+ }
45369
+
45370
+ // parses the path expression into a list of variable names with type information
45371
+ // e.g. foo[0].bar => [ { name: 'foo', isList: true }, { name: 'bar', isList: false } ]
45372
+ function getPath(node, context) {
45373
+ let path = [];
45374
+ for (let child = node.firstChild; child; child = child.nextSibling) {
45375
+ if (child.name === 'PathExpression') {
45376
+ path.push(...getPath(child, context));
45377
+ } else if (child.name === 'FilterExpression') {
45378
+ path.push(...getFilter(child, context));
45379
+ } else {
45380
+ path.push({
45381
+ name: getNodeContent(child, context),
45382
+ isList: false
45383
+ });
45384
+ }
45385
+ }
45386
+ return path;
45387
+ }
45388
+ function getFilter(node, context) {
45389
+ const list = node.firstChild;
45390
+ if (list.name === 'PathExpression') {
45391
+ const path = getPath(list, context);
45392
+ const last = path[path.length - 1];
45393
+ last.isList = true;
45394
+ return path;
45395
+ }
45396
+ return [{
45397
+ name: getNodeContent(list, context),
45398
+ isList: true
45399
+ }];
45400
+ }
45401
+ function getNodeContent(node, context) {
45402
+ return context.state.sliceDoc(node.from, node.to);
45403
+ }
44779
45404
 
44780
45405
  /**
44781
45406
  * @type {import('@codemirror/autocomplete').CompletionSource}
@@ -44816,48 +45441,16 @@
44816
45441
  };
44817
45442
  function autocompletion$1() {
44818
45443
  return [autocompletion$2({
44819
- override: [variables, builtins, completeFromList(snippets)]
45444
+ override: [variables, builtins, completeFromList(snippets.map(s => ({
45445
+ ...s,
45446
+ boost: -1
45447
+ }))), pathExpression]
44820
45448
  })];
44821
45449
  }
44822
45450
  function language() {
44823
45451
  return new LanguageSupport(feelLanguage, []);
44824
45452
  }
44825
- const FeelLinter = function (editorView) {
44826
- const messages = [];
44827
-
44828
- // don't lint if the Editor is empty
44829
- if (editorView.state.doc.length === 0) {
44830
- return messages;
44831
- }
44832
- const tree = syntaxTree(editorView.state);
44833
- tree.iterate({
44834
- enter: node => {
44835
- if (node.type.isError) {
44836
- const error = node.toString();
44837
-
44838
- /* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
44839
- const match = /\((.*?)\)/.exec(error);
44840
- const nodeType = match && match[1];
44841
- let message;
44842
- if (nodeType) {
44843
- message = 'unexpected ' + nodeType;
44844
- } else {
44845
- message = 'expression expected';
44846
- }
44847
- messages.push({
44848
- from: node.from,
44849
- to: node.to,
44850
- severity: 'error',
44851
- message: message,
44852
- source: 'syntaxError'
44853
- });
44854
- }
44855
- }
44856
- });
44857
- return messages;
44858
- };
44859
- var syntaxLinter = linter$1(FeelLinter);
44860
- var linter = [syntaxLinter];
45453
+ var linter = [linter$1(cmFeelLinter())];
44861
45454
  const baseTheme$2 = EditorView.theme({
44862
45455
  '& .cm-content': {
44863
45456
  padding: '0px'
@@ -44936,9 +45529,11 @@
44936
45529
 
44937
45530
  /**
44938
45531
  * @typedef {object} Variable
44939
- * @property {string} name
44940
- * @property {string} [info]
44941
- * @property {string} [detail]
45532
+ * @property {string} name name or key of the variable
45533
+ * @property {string} [info] short information about the variable, e.g. type
45534
+ * @property {string} [detail] longer description of the variable content
45535
+ * @property {boolean} [isList] whether the variable is a list
45536
+ * @property {array<Variable>} [schema] array of child variables if the variable is a context or list
44942
45537
  */
44943
45538
 
44944
45539
  const autocompletionConf = new Compartment();
@@ -46646,9 +47241,118 @@
46646
47241
  var importModule = {
46647
47242
  importer: ['type', Importer]
46648
47243
  };
47244
+ function editorFormFieldClasses(type, {
47245
+ disabled = false
47246
+ } = {}) {
47247
+ if (!type) {
47248
+ throw new Error('type required');
47249
+ }
47250
+ return classNames('fjs-form-field', `fjs-form-field-${type}`, {
47251
+ 'fjs-disabled': disabled
47252
+ });
47253
+ }
47254
+ function _extends$2() {
47255
+ _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
47256
+ for (var i = 1; i < arguments.length; i++) {
47257
+ var source = arguments[i];
47258
+ for (var key in source) {
47259
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
47260
+ target[key] = source[key];
47261
+ }
47262
+ }
47263
+ }
47264
+ return target;
47265
+ };
47266
+ return _extends$2.apply(this, arguments);
47267
+ }
47268
+ var CloseIcon = ({
47269
+ styles = {},
47270
+ ...props
47271
+ }) => /*#__PURE__*/React.createElement("svg", _extends$2({
47272
+ width: "16",
47273
+ height: "16",
47274
+ fill: "currentColor",
47275
+ xmlns: "http://www.w3.org/2000/svg"
47276
+ }, props), /*#__PURE__*/React.createElement("path", {
47277
+ fillRule: "evenodd",
47278
+ clipRule: "evenodd",
47279
+ 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"
47280
+ }));
47281
+ function _extends$1() {
47282
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
47283
+ for (var i = 1; i < arguments.length; i++) {
47284
+ var source = arguments[i];
47285
+ for (var key in source) {
47286
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
47287
+ target[key] = source[key];
47288
+ }
47289
+ }
47290
+ }
47291
+ return target;
47292
+ };
47293
+ return _extends$1.apply(this, arguments);
47294
+ }
47295
+ var SearchIcon = ({
47296
+ styles = {},
47297
+ ...props
47298
+ }) => /*#__PURE__*/React.createElement("svg", _extends$1({
47299
+ width: "15",
47300
+ height: "15",
47301
+ fill: "none",
47302
+ xmlns: "http://www.w3.org/2000/svg"
47303
+ }, props), /*#__PURE__*/React.createElement("path", {
47304
+ 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",
47305
+ fill: "currentColor"
47306
+ }));
47307
+ function EditorText(props) {
47308
+ const {
47309
+ type,
47310
+ text = ''
47311
+ } = props.field;
47312
+ const Icon = iconsByType('text');
47313
+ if (!text) {
47314
+ return e$1("div", {
47315
+ class: editorFormFieldClasses(type),
47316
+ children: e$1("div", {
47317
+ class: "fjs-form-field-placeholder",
47318
+ children: [e$1(Icon, {
47319
+ viewBox: "0 0 54 54"
47320
+ }), "Text view is empty"]
47321
+ })
47322
+ });
47323
+ }
47324
+ if (isExpression$1(text)) {
47325
+ return e$1("div", {
47326
+ class: editorFormFieldClasses(type),
47327
+ children: e$1("div", {
47328
+ class: "fjs-form-field-placeholder",
47329
+ children: [e$1(Icon, {
47330
+ viewBox: "0 0 54 54"
47331
+ }), "Text view is populated by an expression"]
47332
+ })
47333
+ });
47334
+ }
47335
+ return e$1(Text$2, {
47336
+ ...props,
47337
+ disableLinks: true
47338
+ });
47339
+ }
47340
+ EditorText.create = Text$2.create;
47341
+ EditorText.type = Text$2.type;
47342
+ EditorText.keyed = Text$2.keyed;
47343
+ const editorFormFields = [EditorText];
47344
+ class EditorFormFields extends FormFields {
47345
+ constructor() {
47346
+ super();
47347
+ editorFormFields.forEach(formField => {
47348
+ this.register(formField.type, formField);
47349
+ });
47350
+ }
47351
+ }
46649
47352
  const DragAndDropContext = D$1({
46650
47353
  drake: null
46651
47354
  });
47355
+ var DragAndDropContext$1 = DragAndDropContext;
46652
47356
 
46653
47357
  /**
46654
47358
  * @param {string} type
@@ -46660,10 +47364,11 @@
46660
47364
  const FormEditorContext = D$1({
46661
47365
  getService: getService$1
46662
47366
  });
47367
+ var FormEditorContext$1 = FormEditorContext;
46663
47368
  function useService$1(type, strict) {
46664
47369
  const {
46665
47370
  getService
46666
- } = F$1(FormEditorContext);
47371
+ } = F$1(FormEditorContext$1);
46667
47372
  return getService(type, strict);
46668
47373
  }
46669
47374
  function _extends() {
@@ -46690,6 +47395,147 @@
46690
47395
  }, props), /*#__PURE__*/React.createElement("path", {
46691
47396
  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"
46692
47397
  }));
47398
+ const PALETTE_ENTRIES = formFields.filter(f => f.type !== 'default').map(f => {
47399
+ return {
47400
+ label: f.label,
47401
+ type: f.type,
47402
+ group: f.group
47403
+ };
47404
+ });
47405
+ const PALETTE_GROUPS = [{
47406
+ label: 'Basic input',
47407
+ id: 'basic-input'
47408
+ }, {
47409
+ label: 'Selection',
47410
+ id: 'selection'
47411
+ }, {
47412
+ label: 'Presentation',
47413
+ id: 'presentation'
47414
+ }, {
47415
+ label: 'Action',
47416
+ id: 'action'
47417
+ }];
47418
+ function Palette(props) {
47419
+ const [entries, setEntries] = l$2(PALETTE_ENTRIES);
47420
+ const [searchTerm, setSearchTerm] = l$2('');
47421
+ const inputRef = s$1();
47422
+ const groups = groupEntries(entries);
47423
+
47424
+ // filter entries on search change
47425
+ y(() => {
47426
+ const filter = entry => {
47427
+ if (!searchTerm) {
47428
+ return true;
47429
+ }
47430
+ const search = entry.label.toLowerCase();
47431
+ return searchTerm.toLowerCase().split(/\s/g).every(term => search.includes(term));
47432
+ };
47433
+ const entries = PALETTE_ENTRIES.filter(filter);
47434
+ setEntries(entries);
47435
+ }, [searchTerm]);
47436
+ const handleInput = A$1(event => {
47437
+ setSearchTerm(() => event.target.value);
47438
+ }, [setSearchTerm]);
47439
+ const handleClear = A$1(event => {
47440
+ setSearchTerm('');
47441
+ inputRef.current.focus();
47442
+ }, [inputRef, setSearchTerm]);
47443
+ return e$1("div", {
47444
+ class: "fjs-palette",
47445
+ children: [e$1("div", {
47446
+ class: "fjs-palette-header",
47447
+ title: "Components",
47448
+ children: "Components"
47449
+ }), e$1("div", {
47450
+ class: "fjs-palette-search-container",
47451
+ children: [e$1("span", {
47452
+ class: "fjs-palette-search-icon",
47453
+ children: e$1(SearchIcon, {})
47454
+ }), e$1("input", {
47455
+ class: "fjs-palette-search",
47456
+ ref: inputRef,
47457
+ type: "text",
47458
+ placeholder: "Search components",
47459
+ value: searchTerm,
47460
+ onInput: handleInput
47461
+ }), searchTerm && e$1("button", {
47462
+ title: "Clear content",
47463
+ class: "fjs-palette-search-clear",
47464
+ onClick: handleClear,
47465
+ children: e$1(CloseIcon, {})
47466
+ })]
47467
+ }), e$1("div", {
47468
+ class: "fjs-palette-entries",
47469
+ children: [groups.map(({
47470
+ label,
47471
+ entries,
47472
+ id
47473
+ }) => e$1("div", {
47474
+ class: "fjs-palette-group",
47475
+ "data-group-id": id,
47476
+ children: [e$1("span", {
47477
+ class: "fjs-palette-group-title",
47478
+ children: label
47479
+ }), e$1("div", {
47480
+ class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
47481
+ children: entries.map(({
47482
+ label,
47483
+ type
47484
+ }) => {
47485
+ const Icon = iconsByType(type);
47486
+ return e$1("div", {
47487
+ class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
47488
+ "data-field-type": type,
47489
+ title: `Create a ${label} element`,
47490
+ children: [Icon ? e$1(Icon, {
47491
+ class: "fjs-palette-field-icon",
47492
+ width: "36",
47493
+ height: "36",
47494
+ viewBox: "0 0 54 54"
47495
+ }) : null, e$1("span", {
47496
+ class: "fjs-palette-field-text",
47497
+ children: label
47498
+ })]
47499
+ });
47500
+ })
47501
+ })]
47502
+ })), groups.length == 0 && e$1("div", {
47503
+ class: "fjs-palette-no-entries",
47504
+ children: "No components found."
47505
+ })]
47506
+ })]
47507
+ });
47508
+ }
47509
+
47510
+ // helpers ///////
47511
+
47512
+ function groupEntries(entries) {
47513
+ const groups = PALETTE_GROUPS.map(group => {
47514
+ return {
47515
+ ...group,
47516
+ entries: []
47517
+ };
47518
+ });
47519
+ const getGroup = id => groups.find(group => id === group.id);
47520
+ entries.forEach(entry => {
47521
+ const {
47522
+ group
47523
+ } = entry;
47524
+ getGroup(group).entries.push(entry);
47525
+ });
47526
+ return groups.filter(g => g.entries.length);
47527
+ }
47528
+ const CURSOR_CLS_PATTERN = /^fjs-cursor-.*$/;
47529
+ function set(mode) {
47530
+ const classes$1 = classes(document.body);
47531
+ classes$1.removeMatching(CURSOR_CLS_PATTERN);
47532
+ if (mode) {
47533
+ classes$1.add('fjs-cursor-' + mode);
47534
+ }
47535
+ }
47536
+ function unset() {
47537
+ set(null);
47538
+ }
46693
47539
  function ContextPad(props) {
46694
47540
  if (!props.children) {
46695
47541
  return null;
@@ -46813,6 +47659,9 @@
46813
47659
  drake
46814
47660
  };
46815
47661
  y(() => {
47662
+ const handleDragEvent = (type, context) => {
47663
+ return eventBus.fire(type, context);
47664
+ };
46816
47665
  const createDragulaInstance = () => {
46817
47666
  const dragulaInstance = dragula_1({
46818
47667
  isContainer(el) {
@@ -46827,6 +47676,56 @@
46827
47676
  slideFactorX: 10,
46828
47677
  slideFactorY: 5
46829
47678
  });
47679
+
47680
+ // bind life cycle events
47681
+ dragulaInstance.on('drag', (element, source) => {
47682
+ handleDragEvent('drag.start', {
47683
+ element,
47684
+ source
47685
+ });
47686
+ });
47687
+ dragulaInstance.on('dragend', element => {
47688
+ handleDragEvent('drag.end', {
47689
+ element
47690
+ });
47691
+ });
47692
+ dragulaInstance.on('drop', (element, target, source, sibling) => {
47693
+ handleDragEvent('drag.drop', {
47694
+ element,
47695
+ target,
47696
+ source,
47697
+ sibling
47698
+ });
47699
+ });
47700
+ dragulaInstance.on('over', (element, container, source) => {
47701
+ handleDragEvent('drag.hover', {
47702
+ element,
47703
+ container,
47704
+ source
47705
+ });
47706
+ });
47707
+ dragulaInstance.on('out', (element, container, source) => {
47708
+ handleDragEvent('drag.out', {
47709
+ element,
47710
+ container,
47711
+ source
47712
+ });
47713
+ });
47714
+ dragulaInstance.on('cancel', (element, container, source) => {
47715
+ handleDragEvent('drag.cancel', {
47716
+ element,
47717
+ container,
47718
+ source
47719
+ });
47720
+ });
47721
+
47722
+ // set custom styling
47723
+ dragulaInstance.on('drag', () => {
47724
+ set('grabbing');
47725
+ });
47726
+ dragulaInstance.on('dragend', () => {
47727
+ unset();
47728
+ });
46830
47729
  dragulaInstance.on('drop', (el, target, source, sibling) => {
46831
47730
  dragulaInstance.remove();
46832
47731
  if (!target) {
@@ -46883,9 +47782,7 @@
46883
47782
  const formContext = {
46884
47783
  getService(type, strict = true) {
46885
47784
  // TODO(philippfromme): clean up
46886
- if (type === 'formFieldRegistry') {
46887
- return new Map();
46888
- } else if (type === 'form') {
47785
+ if (type === 'form') {
46889
47786
  return {
46890
47787
  _getState() {
46891
47788
  return {
@@ -46923,16 +47820,16 @@
46923
47820
  }, [propertiesPanelRef, propertiesPanel, hasDefaultPropertiesPanel]);
46924
47821
  return e$1("div", {
46925
47822
  class: "fjs-form-editor",
46926
- children: [e$1(DragAndDropContext.Provider, {
47823
+ children: [e$1(DragAndDropContext$1.Provider, {
46927
47824
  value: dragAndDropContext,
46928
47825
  children: [hasDefaultPalette && e$1("div", {
46929
47826
  class: "fjs-editor-palette-container",
46930
47827
  ref: paletteRef
46931
47828
  }), e$1("div", {
46932
47829
  class: "fjs-form-container",
46933
- children: e$1(FormContext.Provider, {
47830
+ children: e$1(FormContext$1.Provider, {
46934
47831
  value: formContext,
46935
- children: e$1(FormRenderContext.Provider, {
47832
+ children: e$1(FormRenderContext$1.Provider, {
46936
47833
  value: formRenderContext,
46937
47834
  children: e$1(FormComponent, {
46938
47835
  onSubmit: onSubmit,
@@ -46961,14 +47858,32 @@
46961
47858
  function CreatePreview(props) {
46962
47859
  const {
46963
47860
  drake
46964
- } = F$1(DragAndDropContext);
47861
+ } = F$1(DragAndDropContext$1);
46965
47862
  function handleCloned(clone, original, type) {
46966
47863
  const fieldType = clone.dataset.fieldType;
46967
- const Icon = iconsByType[fieldType];
47864
+ const Icon = iconsByType(fieldType);
47865
+ const {
47866
+ label
47867
+ } = findPaletteEntry(fieldType);
46968
47868
  if (fieldType) {
46969
47869
  clone.innerHTML = '';
46970
47870
  clone.class = 'gu-mirror';
46971
- S$1(e$1(Icon, {}), clone);
47871
+ if (original.classList.contains('fjs-palette-field')) {
47872
+ S$1(e$1("div", {
47873
+ class: "fjs-palette-field",
47874
+ children: [e$1(Icon, {
47875
+ class: "fjs-palette-field-icon",
47876
+ width: "36",
47877
+ height: "36",
47878
+ viewBox: "0 0 54 54"
47879
+ }), e$1("span", {
47880
+ class: "fjs-palette-field-text",
47881
+ children: label
47882
+ })]
47883
+ }), clone);
47884
+ } else {
47885
+ S$1(e$1(Icon, {}), clone);
47886
+ }
46972
47887
  }
46973
47888
  }
46974
47889
  y(() => {
@@ -46989,6 +47904,9 @@
46989
47904
  function defaultPropertiesPanel(propertiesPanelConfig) {
46990
47905
  return !(propertiesPanelConfig && propertiesPanelConfig.parent);
46991
47906
  }
47907
+ function findPaletteEntry(type) {
47908
+ return PALETTE_ENTRIES.find(entry => entry.type === type);
47909
+ }
46992
47910
  class Renderer {
46993
47911
  constructor(renderConfig, eventBus, formEditor, injector) {
46994
47912
  const {
@@ -47013,7 +47931,7 @@
47013
47931
  }
47014
47932
  return e$1("div", {
47015
47933
  class: `fjs-container fjs-editor-container ${compact ? 'fjs-editor-compact' : ''}`,
47016
- children: e$1(FormEditorContext.Provider, {
47934
+ children: e$1(FormEditorContext$1.Provider, {
47017
47935
  value: formEditorContext,
47018
47936
  children: e$1(FormEditor$1, {})
47019
47937
  })
@@ -47030,7 +47948,7 @@
47030
47948
  Renderer.$inject = ['config.renderer', 'eventBus', 'formEditor', 'injector'];
47031
47949
  var renderModule = {
47032
47950
  __init__: ['formFields', 'renderer'],
47033
- formFields: ['type', FormFields],
47951
+ formFields: ['type', EditorFormFields],
47034
47952
  renderer: ['type', Renderer]
47035
47953
  };
47036
47954
  var core = {
@@ -48851,78 +49769,6 @@
48851
49769
  selection: ['type', Selection],
48852
49770
  selectionBehavior: ['type', SelectionBehavior]
48853
49771
  };
48854
- const types = [{
48855
- label: 'Text field',
48856
- type: 'textfield'
48857
- }, {
48858
- label: 'Text area',
48859
- type: 'textarea'
48860
- }, {
48861
- label: 'Number',
48862
- type: 'number'
48863
- }, {
48864
- label: 'Datetime',
48865
- type: 'datetime'
48866
- }, {
48867
- label: 'Checkbox',
48868
- type: 'checkbox'
48869
- }, {
48870
- label: 'Checklist',
48871
- type: 'checklist'
48872
- }, {
48873
- label: 'Taglist',
48874
- type: 'taglist'
48875
- }, {
48876
- label: 'Radio',
48877
- type: 'radio'
48878
- }, {
48879
- label: 'Select',
48880
- type: 'select'
48881
- }, {
48882
- label: 'Text view',
48883
- type: 'text'
48884
- }, {
48885
- label: 'Image view',
48886
- type: 'image'
48887
- }, {
48888
- label: 'Button',
48889
- type: 'button'
48890
- }];
48891
- function Palette(props) {
48892
- return e$1("div", {
48893
- class: "fjs-palette",
48894
- children: [e$1("div", {
48895
- class: "fjs-palette-header",
48896
- title: "Form elements library",
48897
- children: [e$1("span", {
48898
- class: "fjs-hide-compact",
48899
- children: "FORM ELEMENTS "
48900
- }), "LIBRARY"]
48901
- }), e$1("div", {
48902
- class: "fjs-palette-fields fjs-drag-container fjs-no-drop",
48903
- children: types.map(({
48904
- label,
48905
- type
48906
- }) => {
48907
- const Icon = iconsByType[type];
48908
- return e$1("div", {
48909
- class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
48910
- "data-field-type": type,
48911
- title: `Create a ${label} element`,
48912
- children: [Icon ? e$1(Icon, {
48913
- class: "fjs-palette-field-icon",
48914
- width: "36",
48915
- height: "36",
48916
- viewBox: "0 0 54 54"
48917
- }) : null, e$1("span", {
48918
- class: "fjs-palette-field-text",
48919
- children: label
48920
- })]
48921
- });
48922
- })
48923
- })]
48924
- });
48925
- }
48926
49772
  class PaletteRenderer {
48927
49773
  constructor(paletteConfig, eventBus) {
48928
49774
  const {
@@ -49142,19 +49988,19 @@
49142
49988
  errors: {}
49143
49989
  });
49144
49990
 
49145
- /**
49146
- * @typedef {Function} <propertiesPanel.showEntry> callback
49147
- *
49148
- * @example
49149
- *
49150
- * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
49151
- * // ...
49152
- * });
49153
- *
49154
- * @param {Object} context
49155
- * @param {boolean} [context.focus]
49156
- *
49157
- * @returns void
49991
+ /**
49992
+ * @typedef {Function} <propertiesPanel.showEntry> callback
49993
+ *
49994
+ * @example
49995
+ *
49996
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
49997
+ * // ...
49998
+ * });
49999
+ *
50000
+ * @param {Object} context
50001
+ * @param {boolean} [context.focus]
50002
+ *
50003
+ * @returns void
49158
50004
  */
49159
50005
  const EventContext = D$1({
49160
50006
  eventBus: null
@@ -49166,20 +50012,20 @@
49166
50012
  setLayoutForKey: () => {}
49167
50013
  });
49168
50014
 
49169
- /**
49170
- * Accesses the global DescriptionContext and returns a description for a given id and element.
49171
- *
49172
- * @example
49173
- * ```jsx
49174
- * function TextField(props) {
49175
- * const description = useDescriptionContext('input1', element);
49176
- * }
49177
- * ```
49178
- *
49179
- * @param {string} id
49180
- * @param {object} element
49181
- *
49182
- * @returns {string}
50015
+ /**
50016
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
50017
+ *
50018
+ * @example
50019
+ * ```jsx
50020
+ * function TextField(props) {
50021
+ * const description = useDescriptionContext('input1', element);
50022
+ * }
50023
+ * ```
50024
+ *
50025
+ * @param {string} id
50026
+ * @param {object} element
50027
+ *
50028
+ * @returns {string}
49183
50029
  */
49184
50030
  function useDescriptionContext(id, element) {
49185
50031
  const {
@@ -49194,11 +50040,11 @@
49194
50040
  return errors[id];
49195
50041
  }
49196
50042
 
49197
- /**
49198
- * Subscribe to an event immediately. Update subscription after inputs changed.
49199
- *
49200
- * @param {string} event
49201
- * @param {Function} callback
50043
+ /**
50044
+ * Subscribe to an event immediately. Update subscription after inputs changed.
50045
+ *
50046
+ * @param {string} event
50047
+ * @param {Function} callback
49202
50048
  */
49203
50049
  function useEvent(event, callback, eventBus) {
49204
50050
  const eventContext = F$1(EventContext);
@@ -49228,20 +50074,20 @@
49228
50074
  }, [callback, event, eventBus]);
49229
50075
  }
49230
50076
 
49231
- /**
49232
- * Creates a state that persists in the global LayoutContext.
49233
- *
49234
- * @example
49235
- * ```jsx
49236
- * function Group(props) {
49237
- * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
49238
- * }
49239
- * ```
49240
- *
49241
- * @param {(string|number)[]} path
49242
- * @param {any} [defaultValue]
49243
- *
49244
- * @returns {[ any, Function ]}
50077
+ /**
50078
+ * Creates a state that persists in the global LayoutContext.
50079
+ *
50080
+ * @example
50081
+ * ```jsx
50082
+ * function Group(props) {
50083
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
50084
+ * }
50085
+ * ```
50086
+ *
50087
+ * @param {(string|number)[]} path
50088
+ * @param {any} [defaultValue]
50089
+ *
50090
+ * @returns {[ any, Function ]}
49245
50091
  */
49246
50092
  function useLayoutState(path, defaultValue) {
49247
50093
  const {
@@ -49260,11 +50106,11 @@
49260
50106
  return [value, setState];
49261
50107
  }
49262
50108
 
49263
- /**
49264
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
49265
- * state on updates.
49266
- *
49267
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
50109
+ /**
50110
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
50111
+ * state on updates.
50112
+ *
50113
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
49268
50114
  */
49269
50115
 
49270
50116
  function usePrevious(value) {
@@ -49275,12 +50121,12 @@
49275
50121
  return ref.current;
49276
50122
  }
49277
50123
 
49278
- /**
49279
- * Subscribe to `propertiesPanel.showEntry`.
49280
- *
49281
- * @param {string} id
49282
- *
49283
- * @returns {import('preact').Ref}
50124
+ /**
50125
+ * Subscribe to `propertiesPanel.showEntry`.
50126
+ *
50127
+ * @param {string} id
50128
+ *
50129
+ * @returns {import('preact').Ref}
49284
50130
  */
49285
50131
  function useShowEntryEvent(id) {
49286
50132
  const {
@@ -49311,20 +50157,20 @@
49311
50157
  return ref;
49312
50158
  }
49313
50159
 
49314
- /**
49315
- * @callback setSticky
49316
- * @param {boolean} value
50160
+ /**
50161
+ * @callback setSticky
50162
+ * @param {boolean} value
49317
50163
  */
49318
50164
 
49319
- /**
49320
- * Use IntersectionObserver to identify when DOM element is in sticky mode.
49321
- * If sticky is observered setSticky(true) will be called.
49322
- * If sticky mode is left, setSticky(false) will be called.
49323
- *
49324
- *
49325
- * @param {Object} ref
49326
- * @param {string} scrollContainerSelector
49327
- * @param {setSticky} setSticky
50165
+ /**
50166
+ * Use IntersectionObserver to identify when DOM element is in sticky mode.
50167
+ * If sticky is observered setSticky(true) will be called.
50168
+ * If sticky mode is left, setSticky(false) will be called.
50169
+ *
50170
+ *
50171
+ * @param {Object} ref
50172
+ * @param {string} scrollContainerSelector
50173
+ * @param {setSticky} setSticky
49328
50174
  */
49329
50175
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
49330
50176
  y(() => {
@@ -49363,19 +50209,19 @@
49363
50209
  }, [ref, scrollContainerSelector, setSticky]);
49364
50210
  }
49365
50211
 
49366
- /**
49367
- * Creates a static function reference with changing body.
49368
- * This is necessary when external libraries require a callback function
49369
- * that has references to state variables.
49370
- *
49371
- * Usage:
49372
- * const callback = useStaticCallback((val) => {val === currentState});
49373
- *
49374
- * The `callback` reference is static and can be safely used in external
49375
- * libraries or as a prop that does not cause rerendering of children.
49376
- *
49377
- * @param {Function} callback function with changing reference
49378
- * @returns {Function} static function reference
50212
+ /**
50213
+ * Creates a static function reference with changing body.
50214
+ * This is necessary when external libraries require a callback function
50215
+ * that has references to state variables.
50216
+ *
50217
+ * Usage:
50218
+ * const callback = useStaticCallback((val) => {val === currentState});
50219
+ *
50220
+ * The `callback` reference is static and can be safely used in external
50221
+ * libraries or as a prop that does not cause rerendering of children.
50222
+ *
50223
+ * @param {Function} callback function with changing reference
50224
+ * @returns {Function} static function reference
49379
50225
  */
49380
50226
  function useStaticCallback(callback) {
49381
50227
  const callbackRef = s$1(callback);
@@ -49467,13 +50313,13 @@
49467
50313
  });
49468
50314
  }
49469
50315
 
49470
- /**
49471
- * @typedef { {
49472
- * text: (element: object) => string,
49473
- * icon?: (element: Object) => import('preact').Component
49474
- * } } PlaceholderDefinition
49475
- *
49476
- * @param { PlaceholderDefinition } props
50316
+ /**
50317
+ * @typedef { {
50318
+ * text: (element: object) => string,
50319
+ * icon?: (element: Object) => import('preact').Component
50320
+ * } } PlaceholderDefinition
50321
+ *
50322
+ * @param { PlaceholderDefinition } props
49477
50323
  */
49478
50324
  function Placeholder(props) {
49479
50325
  const {
@@ -49498,72 +50344,72 @@
49498
50344
  };
49499
50345
  const DEFAULT_DESCRIPTION = {};
49500
50346
 
49501
- /**
49502
- * @typedef { {
49503
- * component: import('preact').Component,
49504
- * id: String,
49505
- * isEdited?: Function
49506
- * } } EntryDefinition
49507
- *
49508
- * @typedef { {
49509
- * autoFocusEntry: String,
49510
- * autoOpen?: Boolean,
49511
- * entries: Array<EntryDefinition>,
49512
- * id: String,
49513
- * label: String,
49514
- * remove: (event: MouseEvent) => void
49515
- * } } ListItemDefinition
49516
- *
49517
- * @typedef { {
49518
- * add: (event: MouseEvent) => void,
49519
- * component: import('preact').Component,
49520
- * element: Object,
49521
- * id: String,
49522
- * items: Array<ListItemDefinition>,
49523
- * label: String,
49524
- * shouldSort?: Boolean,
49525
- * shouldOpen?: Boolean
49526
- * } } ListGroupDefinition
49527
- *
49528
- * @typedef { {
49529
- * component?: import('preact').Component,
49530
- * entries: Array<EntryDefinition>,
49531
- * id: String,
49532
- * label: String,
49533
- * shouldOpen?: Boolean
49534
- * } } GroupDefinition
49535
- *
49536
- * @typedef { {
49537
- * [id: String]: GetDescriptionFunction
49538
- * } } DescriptionConfig
49539
- *
49540
- * @callback { {
49541
- * @param {string} id
49542
- * @param {Object} element
49543
- * @returns {string}
49544
- * } } GetDescriptionFunction
49545
- *
49546
- * @typedef { {
49547
- * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
49548
- * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
49549
- * } } PlaceholderProvider
49550
- *
50347
+ /**
50348
+ * @typedef { {
50349
+ * component: import('preact').Component,
50350
+ * id: String,
50351
+ * isEdited?: Function
50352
+ * } } EntryDefinition
50353
+ *
50354
+ * @typedef { {
50355
+ * autoFocusEntry: String,
50356
+ * autoOpen?: Boolean,
50357
+ * entries: Array<EntryDefinition>,
50358
+ * id: String,
50359
+ * label: String,
50360
+ * remove: (event: MouseEvent) => void
50361
+ * } } ListItemDefinition
50362
+ *
50363
+ * @typedef { {
50364
+ * add: (event: MouseEvent) => void,
50365
+ * component: import('preact').Component,
50366
+ * element: Object,
50367
+ * id: String,
50368
+ * items: Array<ListItemDefinition>,
50369
+ * label: String,
50370
+ * shouldSort?: Boolean,
50371
+ * shouldOpen?: Boolean
50372
+ * } } ListGroupDefinition
50373
+ *
50374
+ * @typedef { {
50375
+ * component?: import('preact').Component,
50376
+ * entries: Array<EntryDefinition>,
50377
+ * id: String,
50378
+ * label: String,
50379
+ * shouldOpen?: Boolean
50380
+ * } } GroupDefinition
50381
+ *
50382
+ * @typedef { {
50383
+ * [id: String]: GetDescriptionFunction
50384
+ * } } DescriptionConfig
50385
+ *
50386
+ * @callback { {
50387
+ * @param {string} id
50388
+ * @param {Object} element
50389
+ * @returns {string}
50390
+ * } } GetDescriptionFunction
50391
+ *
50392
+ * @typedef { {
50393
+ * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
50394
+ * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
50395
+ * } } PlaceholderProvider
50396
+ *
49551
50397
  */
49552
50398
 
49553
- /**
49554
- * A basic properties panel component. Describes *how* content will be rendered, accepts
49555
- * data from implementor to describe *what* will be rendered.
49556
- *
49557
- * @param {Object} props
49558
- * @param {Object|Array} props.element
49559
- * @param {import('./components/Header').HeaderProvider} props.headerProvider
49560
- * @param {PlaceholderProvider} [props.placeholderProvider]
49561
- * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
49562
- * @param {Object} [props.layoutConfig]
49563
- * @param {Function} [props.layoutChanged]
49564
- * @param {DescriptionConfig} [props.descriptionConfig]
49565
- * @param {Function} [props.descriptionLoaded]
49566
- * @param {Object} [props.eventBus]
50399
+ /**
50400
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
50401
+ * data from implementor to describe *what* will be rendered.
50402
+ *
50403
+ * @param {Object} props
50404
+ * @param {Object|Array} props.element
50405
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
50406
+ * @param {PlaceholderProvider} [props.placeholderProvider]
50407
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
50408
+ * @param {Object} [props.layoutConfig]
50409
+ * @param {Function} [props.layoutChanged]
50410
+ * @param {DescriptionConfig} [props.descriptionConfig]
50411
+ * @param {Function} [props.descriptionLoaded]
50412
+ * @param {Object} [props.eventBus]
49567
50413
  */
49568
50414
  function PropertiesPanel(props) {
49569
50415
  const {
@@ -49590,7 +50436,7 @@
49590
50436
  };
49591
50437
  const setLayoutForKey = (key, config) => {
49592
50438
  const newLayout = assign({}, layout);
49593
- set(newLayout, key, config);
50439
+ set$1(newLayout, key, config);
49594
50440
  setLayout(newLayout);
49595
50441
  };
49596
50442
  const layoutContext = {
@@ -49788,8 +50634,8 @@
49788
50634
  }
49789
50635
  const noop$2 = () => {};
49790
50636
 
49791
- /**
49792
- * @param {import('../PropertiesPanel').ListGroupDefinition} props
50637
+ /**
50638
+ * @param {import('../PropertiesPanel').ListGroupDefinition} props
49793
50639
  */
49794
50640
  function ListGroup(props) {
49795
50641
  const {
@@ -49952,8 +50798,8 @@
49952
50798
 
49953
50799
  // helpers ////////////////////
49954
50800
 
49955
- /**
49956
- * Sorts given items alphanumeric by label
50801
+ /**
50802
+ * Sorts given items alphanumeric by label
49957
50803
  */
49958
50804
  function sortItems(items) {
49959
50805
  return sortBy(items, i => i.label.toLowerCase());
@@ -50027,17 +50873,17 @@
50027
50873
  });
50028
50874
  }
50029
50875
 
50030
- /**
50031
- * @param {Object} props
50032
- * @param {Object} props.element
50033
- * @param {String} props.id
50034
- * @param {String} props.description
50035
- * @param {String} props.label
50036
- * @param {Function} props.getValue
50037
- * @param {Function} props.setValue
50038
- * @param {Function} props.onFocus
50039
- * @param {Function} props.onBlur
50040
- * @param {boolean} [props.disabled]
50876
+ /**
50877
+ * @param {Object} props
50878
+ * @param {Object} props.element
50879
+ * @param {String} props.id
50880
+ * @param {String} props.description
50881
+ * @param {String} props.label
50882
+ * @param {Function} props.getValue
50883
+ * @param {Function} props.setValue
50884
+ * @param {Function} props.onFocus
50885
+ * @param {Function} props.onBlur
50886
+ * @param {boolean} [props.disabled]
50041
50887
  */
50042
50888
  function CheckboxEntry(props) {
50043
50889
  const {
@@ -50125,10 +50971,10 @@
50125
50971
  y(() => {
50126
50972
  let editor;
50127
50973
 
50128
- /* Trigger FEEL toggle when
50129
- *
50130
- * - `backspace` is pressed
50131
- * - AND the cursor is at the beginning of the input
50974
+ /* Trigger FEEL toggle when
50975
+ *
50976
+ * - `backspace` is pressed
50977
+ * - AND the cursor is at the beginning of the input
50132
50978
  */
50133
50979
  const onKeyDown = e => {
50134
50980
  if (e.key !== 'Backspace' || !editor) {
@@ -50199,10 +51045,10 @@
50199
51045
  }
50200
51046
  const noop$1 = () => {};
50201
51047
 
50202
- /**
50203
- * @param {Object} props
50204
- * @param {Object} props.label
50205
- * @param {String} props.feel
51048
+ /**
51049
+ * @param {Object} props
51050
+ * @param {Object} props.label
51051
+ * @param {String} props.feel
50206
51052
  */
50207
51053
  function FeelIcon(props) {
50208
51054
  const {
@@ -50476,17 +51322,17 @@
50476
51322
  });
50477
51323
  });
50478
51324
 
50479
- /**
50480
- * @param {Object} props
50481
- * @param {Object} props.element
50482
- * @param {String} props.id
50483
- * @param {String} props.description
50484
- * @param {Boolean} props.debounce
50485
- * @param {Boolean} props.disabled
50486
- * @param {String} props.label
50487
- * @param {Function} props.getValue
50488
- * @param {Function} props.setValue
50489
- * @param {Function} props.validate
51325
+ /**
51326
+ * @param {Object} props
51327
+ * @param {Object} props.element
51328
+ * @param {String} props.id
51329
+ * @param {String} props.description
51330
+ * @param {Boolean} props.debounce
51331
+ * @param {Boolean} props.disabled
51332
+ * @param {String} props.label
51333
+ * @param {Function} props.getValue
51334
+ * @param {Function} props.setValue
51335
+ * @param {Function} props.validate
50490
51336
  */
50491
51337
  function FeelEntry(props) {
50492
51338
  const {
@@ -50571,19 +51417,19 @@
50571
51417
  });
50572
51418
  }
50573
51419
 
50574
- /**
50575
- * @param {Object} props
50576
- * @param {Object} props.element
50577
- * @param {String} props.id
50578
- * @param {String} props.description
50579
- * @param {Boolean} props.debounce
50580
- * @param {Boolean} props.disabled
50581
- * @param {String} props.label
50582
- * @param {Function} props.getValue
50583
- * @param {Function} props.setValue
50584
- * @param {Function} props.onFocus
50585
- * @param {Function} props.onBlur
50586
- * @param {Function} props.validate
51420
+ /**
51421
+ * @param {Object} props
51422
+ * @param {Object} props.element
51423
+ * @param {String} props.id
51424
+ * @param {String} props.description
51425
+ * @param {Boolean} props.debounce
51426
+ * @param {Boolean} props.disabled
51427
+ * @param {String} props.label
51428
+ * @param {Function} props.getValue
51429
+ * @param {Function} props.setValue
51430
+ * @param {Function} props.onFocus
51431
+ * @param {Function} props.onBlur
51432
+ * @param {Function} props.validate
50587
51433
  */
50588
51434
  function FeelTextArea(props) {
50589
51435
  return e$1(FeelEntry, {
@@ -50662,21 +51508,22 @@
50662
51508
  });
50663
51509
  }
50664
51510
 
50665
- /**
50666
- * @param {Object} props
50667
- * @param {Boolean} props.debounce
50668
- * @param {String} props.description
50669
- * @param {Boolean} props.disabled
50670
- * @param {Object} props.element
50671
- * @param {Function} props.getValue
50672
- * @param {String} props.id
50673
- * @param {String} props.label
50674
- * @param {String} props.max
50675
- * @param {String} props.min
50676
- * @param {Function} props.setValue
50677
- * @param {Function} props.onFocus
50678
- * @param {Function} props.onBlur
50679
- * @param {String} props.step
51511
+ /**
51512
+ * @param {Object} props
51513
+ * @param {Boolean} props.debounce
51514
+ * @param {String} props.description
51515
+ * @param {Boolean} props.disabled
51516
+ * @param {Object} props.element
51517
+ * @param {Function} props.getValue
51518
+ * @param {String} props.id
51519
+ * @param {String} props.label
51520
+ * @param {String} props.max
51521
+ * @param {String} props.min
51522
+ * @param {Function} props.setValue
51523
+ * @param {Function} props.onFocus
51524
+ * @param {Function} props.onBlur
51525
+ * @param {String} props.step
51526
+ * @param {Function} props.validate
50680
51527
  */
50681
51528
  function NumberFieldEntry(props) {
50682
51529
  const {
@@ -50692,25 +51539,55 @@
50692
51539
  setValue,
50693
51540
  step,
50694
51541
  onFocus,
50695
- onBlur
51542
+ onBlur,
51543
+ validate
50696
51544
  } = props;
50697
- const value = getValue(element);
51545
+ const [cachedInvalidValue, setCachedInvalidValue] = l$2(null);
51546
+ const globalError = useError(id);
51547
+ const [localError, setLocalError] = l$2(null);
51548
+ let value = getValue(element);
51549
+ const previousValue = usePrevious(value);
51550
+ y(() => {
51551
+ if (isFunction(validate)) {
51552
+ const newValidationError = validate(value) || null;
51553
+ setLocalError(newValidationError);
51554
+ }
51555
+ }, [value]);
51556
+ const onInput = newValue => {
51557
+ let newValidationError = null;
51558
+ if (isFunction(validate)) {
51559
+ newValidationError = validate(newValue) || null;
51560
+ }
51561
+ if (newValidationError) {
51562
+ setCachedInvalidValue(newValue);
51563
+ } else {
51564
+ setValue(newValue);
51565
+ }
51566
+ setLocalError(newValidationError);
51567
+ };
51568
+ if (previousValue === value && localError) {
51569
+ value = cachedInvalidValue;
51570
+ }
51571
+ const error = globalError || localError;
50698
51572
  return e$1("div", {
50699
- class: "bio-properties-panel-entry",
51573
+ class: classNames('bio-properties-panel-entry', error ? 'has-error' : ''),
50700
51574
  "data-entry-id": id,
50701
51575
  children: [e$1(NumberField, {
50702
51576
  debounce: debounce,
50703
51577
  disabled: disabled,
50704
51578
  id: id,
50705
51579
  label: label,
50706
- onInput: setValue,
50707
51580
  onFocus: onFocus,
50708
51581
  onBlur: onBlur,
51582
+ onInput: onInput,
50709
51583
  max: max,
50710
51584
  min: min,
50711
51585
  step: step,
50712
51586
  value: value
50713
- }, element), e$1(Description$1, {
51587
+ }, element), error && e$1("div", {
51588
+ class: "bio-properties-panel-error",
51589
+ children: error
51590
+ }), e$1(Description$1, {
50714
51591
  forId: id,
50715
51592
  element: element,
50716
51593
  value: description
@@ -50732,7 +51609,7 @@
50732
51609
  label,
50733
51610
  onChange,
50734
51611
  options = [],
50735
- value,
51612
+ value = '',
50736
51613
  disabled,
50737
51614
  onFocus,
50738
51615
  onBlur
@@ -50781,18 +51658,18 @@
50781
51658
  });
50782
51659
  }
50783
51660
 
50784
- /**
50785
- * @param {object} props
50786
- * @param {object} props.element
50787
- * @param {string} props.id
50788
- * @param {string} [props.description]
50789
- * @param {string} props.label
50790
- * @param {Function} props.getValue
50791
- * @param {Function} props.setValue
50792
- * @param {Function} props.onFocus
50793
- * @param {Function} props.onBlur
50794
- * @param {Function} props.getOptions
50795
- * @param {boolean} [props.disabled]
51661
+ /**
51662
+ * @param {object} props
51663
+ * @param {object} props.element
51664
+ * @param {string} props.id
51665
+ * @param {string} [props.description]
51666
+ * @param {string} props.label
51667
+ * @param {Function} props.getValue
51668
+ * @param {Function} props.setValue
51669
+ * @param {Function} props.onFocus
51670
+ * @param {Function} props.onBlur
51671
+ * @param {Function} props.getOptions
51672
+ * @param {boolean} [props.disabled]
50796
51673
  */
50797
51674
  function SelectEntry(props) {
50798
51675
  const {
@@ -50894,20 +51771,20 @@
50894
51771
  });
50895
51772
  }
50896
51773
 
50897
- /**
50898
- * @param {object} props
50899
- * @param {object} props.element
50900
- * @param {string} props.id
50901
- * @param {string} props.description
50902
- * @param {boolean} props.debounce
50903
- * @param {string} props.label
50904
- * @param {Function} props.getValue
50905
- * @param {Function} props.setValue
50906
- * @param {Function} props.onFocus
50907
- * @param {Function} props.onBlur
50908
- * @param {number} props.rows
50909
- * @param {boolean} props.monospace
50910
- * @param {boolean} [props.disabled]
51774
+ /**
51775
+ * @param {object} props
51776
+ * @param {object} props.element
51777
+ * @param {string} props.id
51778
+ * @param {string} props.description
51779
+ * @param {boolean} props.debounce
51780
+ * @param {string} props.label
51781
+ * @param {Function} props.getValue
51782
+ * @param {Function} props.setValue
51783
+ * @param {Function} props.onFocus
51784
+ * @param {Function} props.onBlur
51785
+ * @param {number} props.rows
51786
+ * @param {boolean} props.monospace
51787
+ * @param {boolean} [props.disabled]
50911
51788
  */
50912
51789
  function TextAreaEntry(props) {
50913
51790
  const {
@@ -51010,19 +51887,19 @@
51010
51887
  });
51011
51888
  }
51012
51889
 
51013
- /**
51014
- * @param {Object} props
51015
- * @param {Object} props.element
51016
- * @param {String} props.id
51017
- * @param {String} props.description
51018
- * @param {Boolean} props.debounce
51019
- * @param {Boolean} props.disabled
51020
- * @param {String} props.label
51021
- * @param {Function} props.getValue
51022
- * @param {Function} props.setValue
51023
- * @param {Function} props.onFocus
51024
- * @param {Function} props.onBlur
51025
- * @param {Function} props.validate
51890
+ /**
51891
+ * @param {Object} props
51892
+ * @param {Object} props.element
51893
+ * @param {String} props.id
51894
+ * @param {String} props.description
51895
+ * @param {Boolean} props.debounce
51896
+ * @param {Boolean} props.disabled
51897
+ * @param {String} props.label
51898
+ * @param {Function} props.getValue
51899
+ * @param {Function} props.setValue
51900
+ * @param {Function} props.onFocus
51901
+ * @param {Function} props.onBlur
51902
+ * @param {Function} props.validate
51026
51903
  */
51027
51904
  function TextfieldEntry(props) {
51028
51905
  const {
@@ -51107,6 +51984,7 @@
51107
51984
  const PropertiesPanelContext = D$1({
51108
51985
  getService
51109
51986
  });
51987
+ var FormPropertiesPanelContext = PropertiesPanelContext;
51110
51988
  function arrayAdd(array, index, item) {
51111
51989
  const copy = [...array];
51112
51990
  copy.splice(index, 0, item);
@@ -51170,7 +52048,7 @@
51170
52048
  const {
51171
52049
  type
51172
52050
  } = field;
51173
- const Icon = iconsByType[type];
52051
+ const Icon = iconsByType(type);
51174
52052
  if (Icon) {
51175
52053
  return () => e$1(Icon, {
51176
52054
  width: "36",
@@ -51254,7 +52132,7 @@
51254
52132
  function useService(type, strict) {
51255
52133
  const {
51256
52134
  getService
51257
- } = F$1(PropertiesPanelContext);
52135
+ } = F$1(FormPropertiesPanelContext);
51258
52136
  return getService(type, strict);
51259
52137
  }
51260
52138
 
@@ -51860,6 +52738,45 @@
51860
52738
  setValue
51861
52739
  });
51862
52740
  };
52741
+ function simpleBoolEntryFactory(options) {
52742
+ const {
52743
+ id,
52744
+ label,
52745
+ path,
52746
+ props
52747
+ } = options;
52748
+ const {
52749
+ editField,
52750
+ field
52751
+ } = props;
52752
+ return {
52753
+ id,
52754
+ label,
52755
+ path,
52756
+ field,
52757
+ editField,
52758
+ component: SimpleBoolComponent,
52759
+ isEdited: isEdited$7
52760
+ };
52761
+ }
52762
+ const SimpleBoolComponent = props => {
52763
+ const {
52764
+ id,
52765
+ label,
52766
+ path,
52767
+ field,
52768
+ editField
52769
+ } = props;
52770
+ const getValue = () => get(field, path, '');
52771
+ const setValue = value => editField(field, path, value);
52772
+ return CheckboxEntry({
52773
+ element: field,
52774
+ getValue,
52775
+ id,
52776
+ label,
52777
+ setValue
52778
+ });
52779
+ };
51863
52780
  function LabelEntry(props) {
51864
52781
  const {
51865
52782
  field
@@ -52036,11 +52953,15 @@
52036
52953
  debounce,
52037
52954
  label: 'Decimal digits',
52038
52955
  element: field,
52039
- min: 0,
52040
- step: 1,
52956
+ step: 'any',
52041
52957
  getValue,
52042
52958
  id,
52043
- setValue
52959
+ setValue,
52960
+ validate: value => {
52961
+ if (value === undefined || value === null) return;
52962
+ if (value < 0) return 'Should be greater than or equal to zero.';
52963
+ if (!Number.isInteger(value)) return 'Should be an integer.';
52964
+ }
52044
52965
  });
52045
52966
  }
52046
52967
  function NumberArrowStep(props) {
@@ -52129,7 +53050,7 @@
52129
53050
  element: field,
52130
53051
  getValue,
52131
53052
  id,
52132
- label: 'Serialize to string',
53053
+ label: 'Output as string',
52133
53054
  description: 'Allows arbitrary precision values',
52134
53055
  setValue
52135
53056
  });
@@ -52368,6 +53289,24 @@
52368
53289
  setValue
52369
53290
  });
52370
53291
  }
53292
+ function SelectEntries(props) {
53293
+ const {
53294
+ field
53295
+ } = props;
53296
+ const {
53297
+ type
53298
+ } = field;
53299
+ if (type !== 'select') {
53300
+ return [];
53301
+ }
53302
+ const entries = [simpleBoolEntryFactory({
53303
+ id: 'searchable',
53304
+ path: ['searchable'],
53305
+ label: 'Searchable',
53306
+ props
53307
+ })];
53308
+ return entries;
53309
+ }
52371
53310
  function ValueEntry(props) {
52372
53311
  const {
52373
53312
  editField,
@@ -52406,7 +53345,7 @@
52406
53345
  const debounce = useService('debounce');
52407
53346
  const setValue = value => {
52408
53347
  const values = get(field, ['values']);
52409
- return editField(field, 'values', set(values, [index, 'label'], value));
53348
+ return editField(field, 'values', set$1(values, [index, 'label'], value));
52410
53349
  };
52411
53350
  const getValue = () => {
52412
53351
  return get(field, ['values', index, 'label']);
@@ -52432,7 +53371,7 @@
52432
53371
  const debounce = useService('debounce');
52433
53372
  const setValue = value => {
52434
53373
  const values = get(field, ['values']);
52435
- return editField(field, 'values', set(values, [index, 'value'], value));
53374
+ return editField(field, 'values', set$1(values, [index, 'value'], value));
52436
53375
  };
52437
53376
  const getValue = () => {
52438
53377
  return get(field, ['values', index, 'value']);
@@ -52742,7 +53681,7 @@
52742
53681
  const onChange = key => {
52743
53682
  return value => {
52744
53683
  const appearance = get(field, ['appearance'], {});
52745
- editField(field, ['appearance'], set(appearance, [key], value));
53684
+ editField(field, ['appearance'], set$1(appearance, [key], value));
52746
53685
  };
52747
53686
  };
52748
53687
  const getValue = key => {
@@ -52890,6 +53829,9 @@
52890
53829
  }), ...AltTextEntry({
52891
53830
  field,
52892
53831
  editField
53832
+ }), ...SelectEntries({
53833
+ field,
53834
+ editField
52893
53835
  }), ...DisabledEntry({
52894
53836
  field,
52895
53837
  editField
@@ -52933,7 +53875,7 @@
52933
53875
  }
52934
53876
  const VALIDATION_TYPE_OPTIONS = {
52935
53877
  custom: {
52936
- value: undefined,
53878
+ value: '',
52937
53879
  label: 'Custom'
52938
53880
  },
52939
53881
  email: {
@@ -52950,14 +53892,14 @@
52950
53892
  type
52951
53893
  } = field;
52952
53894
  const validate = get(field, ['validate'], {});
52953
- const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate?.validationType);
53895
+ const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate.validationType);
52954
53896
  if (!(INPUTS.includes(type) && type !== 'checkbox' && type !== 'checklist' && type !== 'taglist')) {
52955
53897
  return null;
52956
53898
  }
52957
53899
  const onChange = key => {
52958
53900
  return value => {
52959
53901
  const validate = get(field, ['validate'], {});
52960
- editField(field, ['validate'], set(validate, [key], value));
53902
+ editField(field, ['validate'], set$1(validate, [key], value));
52961
53903
  };
52962
53904
  };
52963
53905
  const getValue = key => {
@@ -53098,7 +54040,7 @@
53098
54040
  element: field,
53099
54041
  getValue: getValue('pattern'),
53100
54042
  id,
53101
- label: 'Regular expression pattern',
54043
+ label: 'Custom regular expression',
53102
54044
  setValue: onChange('pattern')
53103
54045
  });
53104
54046
  }
@@ -53154,7 +54096,7 @@
53154
54096
  element: field,
53155
54097
  getValue: getValue('validationType'),
53156
54098
  id,
53157
- label: 'Regular expression validation',
54099
+ label: 'Validation pattern',
53158
54100
  setValue,
53159
54101
  getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS)
53160
54102
  });
@@ -53395,7 +54337,7 @@
53395
54337
  "data-field": selectedFormField && selectedFormField.id,
53396
54338
  onFocusCapture: onFocus,
53397
54339
  onBlurCapture: onBlur,
53398
- children: e$1(PropertiesPanelContext.Provider, {
54340
+ children: e$1(FormPropertiesPanelContext.Provider, {
53399
54341
  value: propertiesPanelContext,
53400
54342
  children: e$1(PropertiesPanel, {
53401
54343
  element: selectedFormField,
@@ -53656,7 +54598,7 @@
53656
54598
  * @param {any} value
53657
54599
  */
53658
54600
  setProperty(property, value) {
53659
- const properties = set(this._getState().properties, [property], value);
54601
+ const properties = set$1(this._getState().properties, [property], value);
53660
54602
  this._setState({
53661
54603
  properties
53662
54604
  });
@@ -55655,6 +56597,4 @@
55655
56597
 
55656
56598
  exports.Playground = Playground;
55657
56599
 
55658
- Object.defineProperty(exports, '__esModule', { value: true });
55659
-
55660
- })));
56600
+ }));