@bpmn-io/form-js-playground 0.14.1 → 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -315,8 +315,6 @@
315
315
  *
316
316
  * @return {Array<?>}
317
317
  */
318
- var proto = typeof Element !== 'undefined' ? Element.prototype : {};
319
- proto.matches || proto.matchesSelector || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector;
320
318
 
321
319
  /**
322
320
  * Expose `parse`.
@@ -925,9 +923,9 @@
925
923
  };
926
924
 
927
925
  /*!
928
- Copyright (c) 2018 Jed Watson.
929
- Licensed under the MIT License (MIT), see
930
- http://jedwatson.github.io/classnames
926
+ Copyright (c) 2018 Jed Watson.
927
+ Licensed under the MIT License (MIT), see
928
+ http://jedwatson.github.io/classnames
931
929
  */
932
930
 
933
931
  (function (module) {
@@ -952,14 +950,14 @@
952
950
  }
953
951
  }
954
952
  } 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 {
953
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
962
954
  classes.push(arg.toString());
955
+ continue;
956
+ }
957
+ for (var key in arg) {
958
+ if (hasOwn.call(arg, key) && arg[key]) {
959
+ classes.push(key);
960
+ }
963
961
  }
964
962
  }
965
963
  }
@@ -12804,7 +12802,7 @@
12804
12802
  * @return { ValueProducer }
12805
12803
  */
12806
12804
  static of(fn) {
12807
- return new ValueProducer$2(fn);
12805
+ return new ValueProducer(fn);
12808
12806
  }
12809
12807
  };
12810
12808
  const dateTimeLiterals$2 = {
@@ -12969,7 +12967,7 @@
12969
12967
  * @return { Variables }
12970
12968
  */
12971
12969
  assign(options = {}) {
12972
- return Variables$2.of({
12970
+ return Variables.of({
12973
12971
  ...this,
12974
12972
  ...options
12975
12973
  });
@@ -12985,7 +12983,7 @@
12985
12983
  context: this.context,
12986
12984
  parent: this.parent
12987
12985
  };
12988
- return Variables$2.of({
12986
+ return Variables.of({
12989
12987
  ...defaultOptions,
12990
12988
  ...options
12991
12989
  });
@@ -13000,7 +12998,7 @@
13000
12998
  value,
13001
12999
  raw
13002
13000
  } = options;
13003
- return new Variables$2({
13001
+ return new Variables({
13004
13002
  name,
13005
13003
  tokens: [...tokens],
13006
13004
  children: [...children],
@@ -15334,7 +15332,7 @@
15334
15332
  * @return { ValueProducer }
15335
15333
  */
15336
15334
  static of(fn) {
15337
- return new ValueProducer$1(fn);
15335
+ return new ValueProducer(fn);
15338
15336
  }
15339
15337
  };
15340
15338
  const dateTimeLiterals$1 = {
@@ -15499,7 +15497,7 @@
15499
15497
  * @return { Variables }
15500
15498
  */
15501
15499
  assign(options = {}) {
15502
- return Variables$1.of({
15500
+ return Variables.of({
15503
15501
  ...this,
15504
15502
  ...options
15505
15503
  });
@@ -15515,7 +15513,7 @@
15515
15513
  context: this.context,
15516
15514
  parent: this.parent
15517
15515
  };
15518
- return Variables$1.of({
15516
+ return Variables.of({
15519
15517
  ...defaultOptions,
15520
15518
  ...options
15521
15519
  });
@@ -15530,7 +15528,7 @@
15530
15528
  value,
15531
15529
  raw
15532
15530
  } = options;
15533
- return new Variables$1({
15531
+ return new Variables({
15534
15532
  name,
15535
15533
  tokens: [...tokens],
15536
15534
  children: [...children],
@@ -17665,7 +17663,7 @@
17665
17663
  */
17666
17664
  static of(text) {
17667
17665
  if (text.length == 0) throw new RangeError("A document must have at least one line");
17668
- if (text.length == 1 && !text[0]) return Text$2.empty;
17666
+ if (text.length == 1 && !text[0]) return Text.empty;
17669
17667
  return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
17670
17668
  }
17671
17669
  };
@@ -19892,12 +19890,12 @@
19892
19890
  }
19893
19891
  function resolveTransactionInner(state, spec, docSize) {
19894
19892
  let sel = spec.selection,
19895
- annotations = asArray$1(spec.annotations);
19893
+ annotations = asArray$2(spec.annotations);
19896
19894
  if (spec.userEvent) annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent));
19897
19895
  return {
19898
19896
  changes: spec.changes instanceof ChangeSet ? spec.changes : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)),
19899
19897
  selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)),
19900
- effects: asArray$1(spec.effects),
19898
+ effects: asArray$2(spec.effects),
19901
19899
  annotations,
19902
19900
  scrollIntoView: !!spec.scrollIntoView
19903
19901
  };
@@ -19942,7 +19940,7 @@
19942
19940
  let filters = state.facet(transactionFilter);
19943
19941
  for (let i = filters.length - 1; i >= 0; i--) {
19944
19942
  let filtered = filters[i](tr);
19945
- if (filtered instanceof Transaction) tr = filtered;else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction) tr = filtered[0];else tr = resolveTransaction(state, asArray$1(filtered), false);
19943
+ if (filtered instanceof Transaction) tr = filtered;else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction) tr = filtered[0];else tr = resolveTransaction(state, asArray$2(filtered), false);
19946
19944
  }
19947
19945
  return tr;
19948
19946
  }
@@ -19957,7 +19955,7 @@
19957
19955
  return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView);
19958
19956
  }
19959
19957
  const none$3 = [];
19960
- function asArray$1(value) {
19958
+ function asArray$2(value) {
19961
19959
  return value == null ? none$3 : Array.isArray(value) ? value : [value];
19962
19960
  }
19963
19961
 
@@ -20091,7 +20089,7 @@
20091
20089
  base = effect.value;
20092
20090
  } else if (effect.is(StateEffect.appendConfig)) {
20093
20091
  conf = null;
20094
- base = asArray$1(base).concat(effect.value);
20092
+ base = asArray$2(base).concat(effect.value);
20095
20093
  }
20096
20094
  }
20097
20095
  let startValues;
@@ -20135,7 +20133,7 @@
20135
20133
  let result1 = f(sel.ranges[0]);
20136
20134
  let changes = this.changes(result1.changes),
20137
20135
  ranges = [result1.range];
20138
- let effects = asArray$1(result1.effects);
20136
+ let effects = asArray$2(result1.effects);
20139
20137
  for (let i = 1; i < sel.ranges.length; i++) {
20140
20138
  let result = f(sel.ranges[i]);
20141
20139
  let newChanges = this.changes(result.changes),
@@ -20144,7 +20142,7 @@
20144
20142
  let mapBy = changes.mapDesc(newChanges, true);
20145
20143
  ranges.push(result.range.map(mapBy));
20146
20144
  changes = changes.compose(newMapped);
20147
- effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray$1(result.effects), mapBy));
20145
+ effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray$2(result.effects), mapBy));
20148
20146
  }
20149
20147
  return {
20150
20148
  changes,
@@ -30554,7 +30552,7 @@
30554
30552
  };
30555
30553
  })
30556
30554
  });
30557
- function asArray(val) {
30555
+ function asArray$1(val) {
30558
30556
  return Array.isArray(val) ? val : [val];
30559
30557
  }
30560
30558
  function advanceCursor(cursor, collect, pos) {
@@ -30613,7 +30611,7 @@
30613
30611
  if (config.domEventHandlers[prop](view, line, event)) event.preventDefault();
30614
30612
  });
30615
30613
  }
30616
- this.markers = asArray(config.markers(view));
30614
+ this.markers = asArray$1(config.markers(view));
30617
30615
  if (config.initialSpacer) {
30618
30616
  this.spacer = new GutterElement(view, 0, 0, [config.initialSpacer(view)]);
30619
30617
  this.dom.appendChild(this.spacer.dom);
@@ -30622,7 +30620,7 @@
30622
30620
  }
30623
30621
  update(update) {
30624
30622
  let prevMarkers = this.markers;
30625
- this.markers = asArray(this.config.markers(update.view));
30623
+ this.markers = asArray$1(this.config.markers(update.view));
30626
30624
  if (this.spacer && this.config.updateSpacer) {
30627
30625
  let updated = this.config.updateSpacer(this.spacer.markers[0], update);
30628
30626
  if (updated != this.spacer.markers[0]) this.spacer.update(update.view, 0, 0, [updated]);
@@ -37979,7 +37977,7 @@
37979
37977
  }
37980
37978
  }
37981
37979
  /// Elements are used to compose syntax nodes during parsing.
37982
- let Element$2 = class Element {
37980
+ let Element$1 = class Element {
37983
37981
  /// @internal
37984
37982
  constructor(
37985
37983
  /// The node's
@@ -38030,7 +38028,7 @@
38030
38028
  }
38031
38029
  }
38032
38030
  function elt(type, from, to, children) {
38033
- return new Element$2(type, from, to, children);
38031
+ return new Element$1(type, from, to, children);
38034
38032
  }
38035
38033
  const EmphasisUnderscore = {
38036
38034
  resolve: "Emphasis",
@@ -38324,7 +38322,7 @@
38324
38322
  // Move the covered region into content, optionally adding marker nodes
38325
38323
  if (open.type.mark) content.push(this.elt(open.type.mark, start, open.to));
38326
38324
  for (let k = j + 1; k < i; k++) {
38327
- if (this.parts[k] instanceof Element$2) content.push(this.parts[k]);
38325
+ if (this.parts[k] instanceof Element$1) content.push(this.parts[k]);
38328
38326
  this.parts[k] = null;
38329
38327
  }
38330
38328
  if (close.type.mark) content.push(this.elt(close.type.mark, close.from, end));
@@ -38339,7 +38337,7 @@
38339
38337
  let result = [];
38340
38338
  for (let i = from; i < this.parts.length; i++) {
38341
38339
  let part = this.parts[i];
38342
- if (part instanceof Element$2) result.push(part);
38340
+ if (part instanceof Element$1) result.push(part);
38343
38341
  }
38344
38342
  return result;
38345
38343
  }
@@ -38383,7 +38381,7 @@
38383
38381
  while (eI < elts.length && elts[eI].to < mark.to) eI++;
38384
38382
  if (eI < elts.length && elts[eI].from < mark.from) {
38385
38383
  let e = elts[eI];
38386
- if (e instanceof Element$2) elts[eI] = new Element$2(e.type, e.from, e.to, injectMarks(e.children, [mark]));
38384
+ if (e instanceof Element$1) elts[eI] = new Element$1(e.type, e.from, e.to, injectMarks(e.children, [mark]));
38387
38385
  } else {
38388
38386
  elts.splice(eI++, 0, mark);
38389
38387
  }
@@ -49707,6 +49705,30 @@
49707
49705
  var DEFAULT_PRIORITY$3 = 1000;
49708
49706
  var slice$1 = Array.prototype.slice;
49709
49707
 
49708
+ /**
49709
+ * @typedef { {
49710
+ * stopPropagation(): void;
49711
+ * preventDefault(): void;
49712
+ * cancelBubble: boolean;
49713
+ * defaultPrevented: boolean;
49714
+ * returnValue: any;
49715
+ * } } Event
49716
+ */
49717
+
49718
+ /**
49719
+ * @template E
49720
+ *
49721
+ * @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
49722
+ */
49723
+
49724
+ /**
49725
+ * @typedef { {
49726
+ * priority: number;
49727
+ * next: EventBusListener | null;
49728
+ * callback: EventBusEventCallback<any>;
49729
+ * } } EventBusListener
49730
+ */
49731
+
49710
49732
  /**
49711
49733
  * A general purpose event bus.
49712
49734
  *
@@ -49791,6 +49813,9 @@
49791
49813
  * ```
49792
49814
  */
49793
49815
  function EventBus$1() {
49816
+ /**
49817
+ * @type { Record<string, EventBusListener> }
49818
+ */
49794
49819
  this._listeners = {};
49795
49820
 
49796
49821
  // cleanup on destroy on lowest priority to allow
@@ -49810,10 +49835,12 @@
49810
49835
  *
49811
49836
  * Returning anything but `undefined` from a listener will stop the listener propagation.
49812
49837
  *
49813
- * @param {string|Array<string>} events
49814
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
49815
- * @param {Function} callback
49816
- * @param {Object} [that] Pass context (`this`) to the callback
49838
+ * @template T
49839
+ *
49840
+ * @param {string|string[]} events to subscribe to
49841
+ * @param {number} [priority=1000] listen priority
49842
+ * @param {EventBusEventCallback<T>} callback
49843
+ * @param {any} [that] callback context
49817
49844
  */
49818
49845
  EventBus$1.prototype.on = function (events, priority, callback, that) {
49819
49846
  events = isArray$4(events) ? events : [events];
@@ -49845,14 +49872,16 @@
49845
49872
  };
49846
49873
 
49847
49874
  /**
49848
- * Register an event listener that is executed only once.
49875
+ * Register an event listener that is called only once.
49876
+ *
49877
+ * @template T
49849
49878
  *
49850
- * @param {string} event the event name to register for
49851
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
49852
- * @param {Function} callback the callback to execute
49853
- * @param {Object} [that] Pass context (`this`) to the callback
49879
+ * @param {string|string[]} events to subscribe to
49880
+ * @param {number} [priority=1000] the listen priority
49881
+ * @param {EventBusEventCallback<T>} callback
49882
+ * @param {any} [that] callback context
49854
49883
  */
49855
- EventBus$1.prototype.once = function (event, priority, callback, that) {
49884
+ EventBus$1.prototype.once = function (events, priority, callback, that) {
49856
49885
  var self = this;
49857
49886
  if (isFunction$1(priority)) {
49858
49887
  that = callback;
@@ -49865,7 +49894,7 @@
49865
49894
  function wrappedCallback() {
49866
49895
  wrappedCallback.__isTomb = true;
49867
49896
  var result = callback.apply(that, arguments);
49868
- self.off(event, wrappedCallback);
49897
+ self.off(events, wrappedCallback);
49869
49898
  return result;
49870
49899
  }
49871
49900
 
@@ -49873,7 +49902,7 @@
49873
49902
  // bound callbacks via {@link #off} using the original
49874
49903
  // callback
49875
49904
  wrappedCallback[FN_REF$1] = callback;
49876
- this.on(event, priority, wrappedCallback);
49905
+ this.on(events, priority, wrappedCallback);
49877
49906
  };
49878
49907
 
49879
49908
  /**
@@ -49881,8 +49910,8 @@
49881
49910
  *
49882
49911
  * If no callback is given, all listeners for a given event name are being removed.
49883
49912
  *
49884
- * @param {string|Array<string>} events
49885
- * @param {Function} [callback]
49913
+ * @param {string|string[]} events
49914
+ * @param {EventBusEventCallback} [callback]
49886
49915
  */
49887
49916
  EventBus$1.prototype.off = function (events, callback) {
49888
49917
  events = isArray$4(events) ? events : [events];
@@ -49893,11 +49922,11 @@
49893
49922
  };
49894
49923
 
49895
49924
  /**
49896
- * Create an EventBus event.
49925
+ * Create an event recognized be the event bus.
49897
49926
  *
49898
- * @param {Object} data
49927
+ * @param {Object} data Event data.
49899
49928
  *
49900
- * @return {Object} event, recognized by the eventBus
49929
+ * @return {Event} An event that will be recognized by the event bus.
49901
49930
  */
49902
49931
  EventBus$1.prototype.createEvent = function (data) {
49903
49932
  var event = new InternalEvent$1();
@@ -49906,10 +49935,11 @@
49906
49935
  };
49907
49936
 
49908
49937
  /**
49909
- * Fires a named event.
49938
+ * Fires an event.
49910
49939
  *
49911
49940
  * @example
49912
49941
  *
49942
+ * ```javascript
49913
49943
  * // fire event by name
49914
49944
  * events.fire('foo');
49915
49945
  *
@@ -49927,13 +49957,13 @@
49927
49957
  * });
49928
49958
  *
49929
49959
  * events.fire({ type: 'foo' }, 'I am bar!');
49960
+ * ```
49930
49961
  *
49931
- * @param {string} [name] the optional event name
49932
- * @param {Object} [event] the event object
49933
- * @param {...Object} additional arguments to be passed to the callback functions
49962
+ * @param {string} [type] event type
49963
+ * @param {Object} [data] event or event data
49964
+ * @param {...any} [args] additional arguments the callback will be called with.
49934
49965
  *
49935
- * @return {boolean} the events return value, if specified or false if the
49936
- * default action was prevented by listeners
49966
+ * @return {any} The return value. Will be set to `false` if the default was prevented.
49937
49967
  */
49938
49968
  EventBus$1.prototype.fire = function (type, data) {
49939
49969
  var event, firstListener, returnValue, args;
@@ -49985,6 +50015,14 @@
49985
50015
  }
49986
50016
  return returnValue;
49987
50017
  };
50018
+
50019
+ /**
50020
+ * Handle an error by firing an event.
50021
+ *
50022
+ * @param {Error} error The error to be handled.
50023
+ *
50024
+ * @return {boolean} Whether the error was handled.
50025
+ */
49988
50026
  EventBus$1.prototype.handleError = function (error) {
49989
50027
  return this.fire('error', {
49990
50028
  error: error
@@ -49993,6 +50031,14 @@
49993
50031
  EventBus$1.prototype._destroy = function () {
49994
50032
  this._listeners = {};
49995
50033
  };
50034
+
50035
+ /**
50036
+ * @param {Event} event
50037
+ * @param {any[]} args
50038
+ * @param {EventBusListener} listener
50039
+ *
50040
+ * @return {any}
50041
+ */
49996
50042
  EventBus$1.prototype._invokeListeners = function (event, args, listener) {
49997
50043
  var returnValue;
49998
50044
  while (listener) {
@@ -50005,6 +50051,14 @@
50005
50051
  }
50006
50052
  return returnValue;
50007
50053
  };
50054
+
50055
+ /**
50056
+ * @param {Event} event
50057
+ * @param {any[]} args
50058
+ * @param {EventBusListener} listener
50059
+ *
50060
+ * @return {any}
50061
+ */
50008
50062
  EventBus$1.prototype._invokeListener = function (event, args, listener) {
50009
50063
  var returnValue;
50010
50064
  if (listener.callback.__isTomb) {
@@ -50033,7 +50087,7 @@
50033
50087
  return returnValue;
50034
50088
  };
50035
50089
 
50036
- /*
50090
+ /**
50037
50091
  * Add new listener with a certain priority to the list
50038
50092
  * of listeners (for the given event).
50039
50093
  *
@@ -50047,7 +50101,7 @@
50047
50101
  * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
50048
50102
  *
50049
50103
  * @param {string} event
50050
- * @param {Object} listener { priority, callback }
50104
+ * @param {EventBusListener} listener
50051
50105
  */
50052
50106
  EventBus$1.prototype._addListener = function (event, newListener) {
50053
50107
  var listener = this._getListeners(event),
@@ -50078,9 +50132,20 @@
50078
50132
  // add new listener to back
50079
50133
  previousListener.next = newListener;
50080
50134
  };
50135
+
50136
+ /**
50137
+ * @param {string} name
50138
+ *
50139
+ * @return {EventBusListener}
50140
+ */
50081
50141
  EventBus$1.prototype._getListeners = function (name) {
50082
50142
  return this._listeners[name];
50083
50143
  };
50144
+
50145
+ /**
50146
+ * @param {string} name
50147
+ * @param {EventBusListener} listener
50148
+ */
50084
50149
  EventBus$1.prototype._setListeners = function (name, listener) {
50085
50150
  this._listeners[name] = listener;
50086
50151
  };
@@ -50128,9 +50193,9 @@
50128
50193
  * Invoke function. Be fast...
50129
50194
  *
50130
50195
  * @param {Function} fn
50131
- * @param {Array<Object>} args
50196
+ * @param {any[]} args
50132
50197
  *
50133
- * @return {Any}
50198
+ * @return {any}
50134
50199
  */
50135
50200
  function invokeFunction$1(fn, args) {
50136
50201
  return fn.apply(null, args);
@@ -50501,7 +50566,7 @@
50501
50566
  container.classList.add(`${prefix}-container`);
50502
50567
  return container;
50503
50568
  }
50504
- const EXPRESSION_PROPERTIES = ['alt', 'source', 'text'];
50569
+ const EXPRESSION_PROPERTIES = ['alt', 'source', 'readonly', 'text'];
50505
50570
  const TEMPLATE_PROPERTIES = ['text'];
50506
50571
  function findErrors(errors, path) {
50507
50572
  return errors[pathStringify(path)];
@@ -50705,16 +50770,18 @@
50705
50770
  // if unavailable - get empty value from form field
50706
50771
 
50707
50772
  if (_path) {
50708
- const fieldImplementation = this._formFields.get(type);
50773
+ const {
50774
+ config: fieldConfig
50775
+ } = this._formFields.get(type);
50709
50776
  let valueData = get$1(data, _path);
50710
- if (!isUndefined$2(valueData) && fieldImplementation.sanitizeValue) {
50711
- valueData = fieldImplementation.sanitizeValue({
50777
+ if (!isUndefined$2(valueData) && fieldConfig.sanitizeValue) {
50778
+ valueData = fieldConfig.sanitizeValue({
50712
50779
  formField,
50713
50780
  data,
50714
50781
  value: valueData
50715
50782
  });
50716
50783
  }
50717
- const initializedFieldValue = !isUndefined$2(valueData) ? valueData : !isUndefined$2(defaultValue) ? defaultValue : fieldImplementation.emptyValue;
50784
+ const initializedFieldValue = !isUndefined$2(valueData) ? valueData : !isUndefined$2(defaultValue) ? defaultValue : fieldConfig.emptyValue;
50718
50785
  initializedData = {
50719
50786
  ...initializedData,
50720
50787
  [_path[0]]: initializedFieldValue
@@ -50730,14 +50797,16 @@
50730
50797
  };
50731
50798
  function formFieldClasses(type, {
50732
50799
  errors = [],
50733
- disabled = false
50800
+ disabled = false,
50801
+ readonly = false
50734
50802
  } = {}) {
50735
50803
  if (!type) {
50736
50804
  throw new Error('type required');
50737
50805
  }
50738
50806
  return classNames('fjs-form-field', `fjs-form-field-${type}`, {
50739
50807
  'fjs-has-errors': errors.length > 0,
50740
- 'fjs-disabled': disabled
50808
+ 'fjs-disabled': disabled,
50809
+ 'fjs-readonly': readonly
50741
50810
  });
50742
50811
  }
50743
50812
  function gridColumnClasses(formField) {
@@ -50751,7 +50820,7 @@
50751
50820
  // always fall back to top-down on smallest screens
50752
50821
  'cds--col-sm-16', 'cds--col-md-16');
50753
50822
  }
50754
- function prefixId(id, formId) {
50823
+ function prefixId$2(id, formId) {
50755
50824
  if (formId) {
50756
50825
  return `fjs-form-${formId}-${id}`;
50757
50826
  }
@@ -50776,14 +50845,16 @@
50776
50845
  })
50777
50846
  });
50778
50847
  }
50779
- Button.create = (options = {}) => ({
50780
- action: 'submit',
50781
- ...options
50782
- });
50783
- Button.type = type$b;
50784
- Button.label = 'Button';
50785
- Button.keyed = true;
50786
- Button.group = 'action';
50848
+ Button.config = {
50849
+ type: type$b,
50850
+ keyed: true,
50851
+ label: 'Button',
50852
+ group: 'action',
50853
+ create: (options = {}) => ({
50854
+ action: 'submit',
50855
+ ...options
50856
+ })
50857
+ };
50787
50858
  const FormRenderContext = D$1({
50788
50859
  Empty: props => {
50789
50860
  return null;
@@ -50844,13 +50915,16 @@
50844
50915
  }
50845
50916
  function Errors(props) {
50846
50917
  const {
50847
- errors
50918
+ errors,
50919
+ id
50848
50920
  } = props;
50849
50921
  if (!errors.length) {
50850
50922
  return null;
50851
50923
  }
50852
50924
  return e$1("div", {
50853
50925
  class: "fjs-form-field-error",
50926
+ "aria-live": "polite",
50927
+ id: id,
50854
50928
  children: e$1("ul", {
50855
50929
  children: errors.map(error => {
50856
50930
  return e$1("li", {
@@ -50884,6 +50958,7 @@
50884
50958
  disabled,
50885
50959
  errors = [],
50886
50960
  field,
50961
+ readonly,
50887
50962
  value = false
50888
50963
  } = props;
50889
50964
  const {
@@ -50906,43 +50981,50 @@
50906
50981
  const {
50907
50982
  formId
50908
50983
  } = F$1(FormContext$1);
50984
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
50909
50985
  return e$1("div", {
50910
50986
  class: classNames(formFieldClasses(type$a, {
50911
50987
  errors,
50912
- disabled
50988
+ disabled,
50989
+ readonly
50913
50990
  }), {
50914
50991
  'fjs-checked': value
50915
50992
  }),
50916
50993
  children: [e$1(Label$1, {
50917
- id: prefixId(id, formId),
50994
+ id: prefixId$2(id, formId),
50918
50995
  label: label,
50919
50996
  required: required,
50920
50997
  children: e$1("input", {
50921
50998
  checked: value,
50922
50999
  class: "fjs-input",
50923
51000
  disabled: disabled,
50924
- id: prefixId(id, formId),
51001
+ readOnly: readonly,
51002
+ id: prefixId$2(id, formId),
50925
51003
  type: "checkbox",
50926
- onChange: onChange
51004
+ onChange: onChange,
51005
+ "aria-describedby": errorMessageId
50927
51006
  })
50928
51007
  }), e$1(Description$2, {
50929
51008
  description: description
50930
51009
  }), e$1(Errors, {
50931
- errors: errors
51010
+ errors: errors,
51011
+ id: errorMessageId
50932
51012
  })]
50933
51013
  });
50934
51014
  }
50935
- Checkbox$1.create = (options = {}) => ({
50936
- ...options
50937
- });
50938
- Checkbox$1.type = type$a;
50939
- Checkbox$1.label = 'Checkbox';
50940
- Checkbox$1.keyed = true;
50941
- Checkbox$1.emptyValue = false;
50942
- Checkbox$1.sanitizeValue = ({
50943
- value
50944
- }) => value === true;
50945
- Checkbox$1.group = 'selection';
51015
+ Checkbox$1.config = {
51016
+ type: type$a,
51017
+ keyed: true,
51018
+ label: 'Checkbox',
51019
+ group: 'selection',
51020
+ emptyValue: false,
51021
+ sanitizeValue: ({
51022
+ value
51023
+ }) => value === true,
51024
+ create: (options = {}) => ({
51025
+ ...options
51026
+ })
51027
+ };
50946
51028
 
50947
51029
  // parses the options data from the provided form field and form data
50948
51030
  function getValuesData(formField, formData) {
@@ -51274,6 +51356,7 @@
51274
51356
  disabled,
51275
51357
  errors = [],
51276
51358
  field,
51359
+ readonly,
51277
51360
  value = []
51278
51361
  } = props;
51279
51362
  const {
@@ -51304,17 +51387,19 @@
51304
51387
  const {
51305
51388
  formId
51306
51389
  } = F$1(FormContext$1);
51390
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
51307
51391
  return e$1("div", {
51308
51392
  class: classNames(formFieldClasses(type$9, {
51309
51393
  errors,
51310
- disabled
51394
+ disabled,
51395
+ readonly
51311
51396
  })),
51312
51397
  children: [e$1(Label$1, {
51313
51398
  label: label,
51314
51399
  required: required
51315
51400
  }), loadState == LOAD_STATES.LOADED && options.map((v, index) => {
51316
51401
  return e$1(Label$1, {
51317
- id: prefixId(`${id}-${index}`, formId),
51402
+ id: prefixId$2(`${id}-${index}`, formId),
51318
51403
  label: v.label,
51319
51404
  class: classNames({
51320
51405
  'fjs-checked': value.includes(v.value)
@@ -51324,39 +51409,44 @@
51324
51409
  checked: value.includes(v.value),
51325
51410
  class: "fjs-input",
51326
51411
  disabled: disabled,
51327
- id: prefixId(`${id}-${index}`, formId),
51412
+ readOnly: readonly,
51413
+ id: prefixId$2(`${id}-${index}`, formId),
51328
51414
  type: "checkbox",
51329
- onClick: () => toggleCheckbox(v.value)
51415
+ onClick: () => toggleCheckbox(v.value),
51416
+ "aria-describedby": errorMessageId
51330
51417
  })
51331
51418
  }, `${id}-${index}`);
51332
51419
  }), e$1(Description$2, {
51333
51420
  description: description
51334
51421
  }), e$1(Errors, {
51335
- errors: errors
51422
+ errors: errors,
51423
+ id: errorMessageId
51336
51424
  })]
51337
51425
  });
51338
51426
  }
51339
- Checklist.create = (options = {}) => {
51340
- const defaults = {};
51341
-
51342
- // provide default values if valuesKey isn't set
51343
- if (!options.valuesKey) {
51344
- defaults.values = [{
51345
- label: 'Value',
51346
- value: 'value'
51347
- }];
51427
+ Checklist.config = {
51428
+ type: type$9,
51429
+ keyed: true,
51430
+ label: 'Checklist',
51431
+ group: 'selection',
51432
+ emptyValue: [],
51433
+ sanitizeValue: sanitizeMultiSelectValue,
51434
+ create: (options = {}) => {
51435
+ const defaults = {};
51436
+
51437
+ // provide default values if valuesKey isn't set
51438
+ if (!options.valuesKey) {
51439
+ defaults.values = [{
51440
+ label: 'Value',
51441
+ value: 'value'
51442
+ }];
51443
+ }
51444
+ return {
51445
+ ...defaults,
51446
+ ...options
51447
+ };
51348
51448
  }
51349
- return {
51350
- ...defaults,
51351
- ...options
51352
- };
51353
51449
  };
51354
- Checklist.type = type$9;
51355
- Checklist.label = 'Checklist';
51356
- Checklist.keyed = true;
51357
- Checklist.emptyValue = [];
51358
- Checklist.sanitizeValue = sanitizeMultiSelectValue;
51359
- Checklist.group = 'selection';
51360
51450
 
51361
51451
  /**
51362
51452
  * Returns the conditionally filtered data of a form reactively.
@@ -51427,6 +51517,33 @@
51427
51517
  });
51428
51518
  }
51429
51519
 
51520
+ /**
51521
+ * Retrieve readonly value of a form field, given it can be an
51522
+ * expression optionally or configured globally.
51523
+ *
51524
+ * @typedef { import('../../types').FormProperties } FormProperties
51525
+ *
51526
+ * @param {any} formField
51527
+ * @param {FormProperties} properties
51528
+ *
51529
+ * @returns {boolean}
51530
+ */
51531
+ function useReadonly(formField, properties = {}) {
51532
+ const expressionLanguage = useService$2('expressionLanguage');
51533
+ const conditionChecker = useService$2('conditionChecker', false);
51534
+ const filteredData = useFilteredFormData();
51535
+ const {
51536
+ readonly
51537
+ } = formField;
51538
+ if (properties.readOnly) {
51539
+ return true;
51540
+ }
51541
+ if (expressionLanguage && expressionLanguage.isExpression(readonly)) {
51542
+ return conditionChecker ? conditionChecker.check(readonly, filteredData) : false;
51543
+ }
51544
+ return readonly || false;
51545
+ }
51546
+
51430
51547
  /**
51431
51548
  * Template a string reactively based on form data. If the string is not a template, it is returned as is.
51432
51549
  * Memoised to minimize re-renders
@@ -51454,9 +51571,6 @@
51454
51571
  field,
51455
51572
  onChange
51456
51573
  } = props;
51457
- const {
51458
- _path
51459
- } = field;
51460
51574
  const formFields = useService$2('formFields'),
51461
51575
  form = useService$2('form');
51462
51576
  const {
@@ -51473,9 +51587,12 @@
51473
51587
  if (!FormFieldComponent) {
51474
51588
  throw new Error(`cannot render field <${field.type}>`);
51475
51589
  }
51476
- const value = get$1(data, _path);
51477
- const fieldErrors = findErrors(errors, _path);
51478
- const disabled = properties.readOnly || field.disabled || false;
51590
+ const value = get$1(data, field._path);
51591
+ const fieldErrors = findErrors(errors, field._path);
51592
+ const readonly = useReadonly(field, properties);
51593
+
51594
+ // add precedence: global readonly > form field disabled
51595
+ const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
51479
51596
  const hidden = useCondition(field.conditional && field.conditional.hide || null);
51480
51597
  if (hidden) {
51481
51598
  return e$1(Empty, {});
@@ -51490,7 +51607,8 @@
51490
51607
  ...props,
51491
51608
  disabled: disabled,
51492
51609
  errors: fieldErrors,
51493
- onChange: disabled ? noop$1$1 : onChange,
51610
+ onChange: disabled || readonly ? noop$1$1 : onChange,
51611
+ readonly: readonly,
51494
51612
  value: value
51495
51613
  })
51496
51614
  })
@@ -51540,14 +51658,16 @@
51540
51658
  }), components.length ? null : e$1(Empty, {})]
51541
51659
  });
51542
51660
  }
51543
- Default.create = (options = {}) => ({
51544
- components: [],
51545
- ...options
51546
- });
51547
- Default.type = 'default';
51548
- Default.keyed = false;
51549
- Default.label = null;
51550
- Default.group = null;
51661
+ Default.config = {
51662
+ type: 'default',
51663
+ keyed: false,
51664
+ label: null,
51665
+ group: null,
51666
+ create: (options = {}) => ({
51667
+ components: [],
51668
+ ...options
51669
+ })
51670
+ };
51551
51671
  function _extends$j() {
51552
51672
  _extends$j = Object.assign ? Object.assign.bind() : function (target) {
51553
51673
  for (var i = 1; i < arguments.length; i++) {
@@ -51585,12 +51705,14 @@
51585
51705
  inputRef,
51586
51706
  children,
51587
51707
  disabled,
51708
+ readonly,
51588
51709
  hasErrors
51589
51710
  } = props;
51590
51711
  const onAdornmentClick = () => inputRef && inputRef.current && inputRef.current.focus();
51591
51712
  return e$1("div", {
51592
51713
  class: classNames('fjs-input-group', {
51593
- 'fjs-disabled': disabled
51714
+ 'fjs-disabled': disabled,
51715
+ 'fjs-readonly': readonly
51594
51716
  }, {
51595
51717
  'hasErrors': hasErrors
51596
51718
  }),
@@ -51622,6 +51744,7 @@
51622
51744
  disabled,
51623
51745
  disallowPassedDates,
51624
51746
  date,
51747
+ readonly,
51625
51748
  setDate
51626
51749
  } = props;
51627
51750
  const dateInputRef = s$1();
@@ -51701,9 +51824,9 @@
51701
51824
  }
51702
51825
  }, [flatpickrInstance, isInputDirty]);
51703
51826
  const onInputFocus = A$1(e => {
51704
- if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget)) return;
51827
+ if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget) || readonly) return;
51705
51828
  flatpickrInstance.open();
51706
- }, [flatpickrInstance]);
51829
+ }, [flatpickrInstance, readonly]);
51707
51830
 
51708
51831
  // simulate an enter press on blur to make sure the date value is submitted in all scenarios
51709
51832
  const onInputBlur = A$1(e => {
@@ -51711,7 +51834,7 @@
51711
51834
  dateInputRef.current.dispatchEvent(ENTER_KEYDOWN_EVENT);
51712
51835
  setIsInputDirty(false);
51713
51836
  }, [isInputDirty]);
51714
- const fullId = `${prefixId(id, formId)}--date`;
51837
+ const fullId = `${prefixId$2(id, formId)}--date`;
51715
51838
  return e$1("div", {
51716
51839
  class: "fjs-datetime-subsection",
51717
51840
  children: [e$1(Label$1, {
@@ -51722,6 +51845,7 @@
51722
51845
  }), e$1(InputAdorner, {
51723
51846
  pre: e$1(CalendarIcon, {}),
51724
51847
  disabled: disabled,
51848
+ readonly: readonly,
51725
51849
  rootRef: focusScopeRef,
51726
51850
  inputRef: dateInputRef,
51727
51851
  children: e$1("div", {
@@ -51733,16 +51857,18 @@
51733
51857
  ref: dateInputRef,
51734
51858
  type: "text",
51735
51859
  id: fullId,
51736
- class: 'fjs-input',
51860
+ class: "fjs-input",
51737
51861
  disabled: disabled,
51862
+ readOnly: readonly,
51738
51863
  placeholder: "mm/dd/yyyy",
51739
51864
  autoComplete: "off",
51740
51865
  onFocus: onInputFocus,
51741
51866
  onKeyDown: onInputKeyDown,
51742
- onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
51867
+ onMouseDown: () => !flatpickrInstance.isOpen && !readonly && flatpickrInstance.open(),
51743
51868
  onBlur: onInputBlur,
51744
- onInput: e => setIsInputDirty(true),
51745
- "data-input": true
51869
+ onInput: () => setIsInputDirty(true),
51870
+ "data-input": true,
51871
+ "aria-describedby": props['aria-describedby']
51746
51872
  })
51747
51873
  })
51748
51874
  })]
@@ -51882,6 +52008,7 @@
51882
52008
  formId,
51883
52009
  required,
51884
52010
  disabled,
52011
+ readonly,
51885
52012
  use24h = false,
51886
52013
  timeInterval,
51887
52014
  time,
@@ -51975,7 +52102,7 @@
51975
52102
  setDropdownIsOpen(false);
51976
52103
  propagateRawToMinute(value);
51977
52104
  };
51978
- const fullId = `${prefixId(id, formId)}--time`;
52105
+ const fullId = `${prefixId$2(id, formId)}--time`;
51979
52106
  return e$1("div", {
51980
52107
  class: "fjs-datetime-subsection",
51981
52108
  children: [e$1(Label$1, {
@@ -51987,6 +52114,7 @@
51987
52114
  pre: e$1(ClockIcon, {}),
51988
52115
  inputRef: timeInputRef,
51989
52116
  disabled: disabled,
52117
+ readonly: readonly,
51990
52118
  children: e$1("div", {
51991
52119
  class: "fjs-timepicker fjs-timepicker-anchor",
51992
52120
  children: [e$1("input", {
@@ -51996,10 +52124,11 @@
51996
52124
  class: "fjs-input",
51997
52125
  value: rawValue,
51998
52126
  disabled: disabled,
52127
+ readOnly: readonly,
51999
52128
  placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
52000
52129
  autoComplete: "off",
52001
- onFocus: () => useDropdown && setDropdownIsOpen(true),
52002
- onClick: () => useDropdown && setDropdownIsOpen(true)
52130
+ onFocus: () => !readonly && useDropdown && setDropdownIsOpen(true),
52131
+ onClick: () => !readonly && useDropdown && setDropdownIsOpen(true)
52003
52132
 
52004
52133
  // @ts-ignore
52005
52134
  ,
@@ -52010,7 +52139,8 @@
52010
52139
  },
52011
52140
  onBlur: onInputBlur,
52012
52141
  onKeyDown: onInputKeyDown,
52013
- "data-input": true
52142
+ "data-input": true,
52143
+ "aria-describedby": props['aria-describedby']
52014
52144
  }), dropdownIsOpen && e$1(DropdownList, {
52015
52145
  values: timeOptions,
52016
52146
  height: 150,
@@ -52029,6 +52159,7 @@
52029
52159
  errors = [],
52030
52160
  field,
52031
52161
  onChange,
52162
+ readonly,
52032
52163
  value = ''
52033
52164
  } = props;
52034
52165
  const {
@@ -52145,6 +52276,7 @@
52145
52276
  time
52146
52277
  });
52147
52278
  }, []);
52279
+ const errorMessageId = allErrors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
52148
52280
  const datePickerProps = {
52149
52281
  id,
52150
52282
  label: dateLabel,
@@ -52154,7 +52286,9 @@
52154
52286
  disabled,
52155
52287
  disallowPassedDates,
52156
52288
  date: dateTime.date,
52157
- setDate
52289
+ readonly,
52290
+ setDate,
52291
+ 'aria-describedby': errorMessageId
52158
52292
  };
52159
52293
  const timePickerProps = {
52160
52294
  id,
@@ -52163,15 +52297,18 @@
52163
52297
  formId,
52164
52298
  required,
52165
52299
  disabled,
52300
+ readonly,
52166
52301
  use24h,
52167
52302
  timeInterval,
52168
52303
  time: dateTime.time,
52169
- setTime
52304
+ setTime,
52305
+ 'aria-describedby': errorMessageId
52170
52306
  };
52171
52307
  return e$1("div", {
52172
52308
  class: formFieldClasses(type$8, {
52173
52309
  errors: allErrors,
52174
- disabled
52310
+ disabled,
52311
+ readonly
52175
52312
  }),
52176
52313
  children: [e$1("div", {
52177
52314
  class: classNames('fjs-vertical-group'),
@@ -52185,25 +52322,28 @@
52185
52322
  }), e$1(Description$2, {
52186
52323
  description: description
52187
52324
  }), e$1(Errors, {
52188
- errors: allErrors
52325
+ errors: allErrors,
52326
+ id: errorMessageId
52189
52327
  })]
52190
52328
  });
52191
52329
  }
52192
- Datetime.create = (options = {}) => {
52193
- const defaults = {};
52194
- set$2(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
52195
- set$2(defaults, DATE_LABEL_PATH, 'Date');
52196
- return {
52197
- ...defaults,
52198
- ...options
52199
- };
52330
+ Datetime.config = {
52331
+ type: type$8,
52332
+ keyed: true,
52333
+ label: 'Date time',
52334
+ group: 'basic-input',
52335
+ emptyValue: null,
52336
+ sanitizeValue: sanitizeDateTimePickerValue,
52337
+ create: (options = {}) => {
52338
+ const defaults = {};
52339
+ set$2(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
52340
+ set$2(defaults, DATE_LABEL_PATH, 'Date');
52341
+ return {
52342
+ ...defaults,
52343
+ ...options
52344
+ };
52345
+ }
52200
52346
  };
52201
- Datetime.type = type$8;
52202
- Datetime.keyed = true;
52203
- Datetime.emptyValue = null;
52204
- Datetime.sanitizeValue = sanitizeDateTimePickerValue;
52205
- Datetime.label = 'Date time';
52206
- Datetime.group = 'basic-input';
52207
52347
 
52208
52348
  /**
52209
52349
  * This file must not be changed or exchanged.
@@ -52247,7 +52387,7 @@
52247
52387
  href: "https://bpmn.io",
52248
52388
  target: "_blank",
52249
52389
  rel: "noopener",
52250
- style: "margin: 15px 20px 15px 10px; align-self: center; color: #404040",
52390
+ style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
52251
52391
  children: e$1(Logo, {})
52252
52392
  }), e$1("span", {
52253
52393
  children: ["Web-based tooling for BPMN, DMN, and forms powered by ", e$1("a", {
@@ -52270,7 +52410,7 @@
52270
52410
  rel: "noopener",
52271
52411
  class: "fjs-powered-by-link",
52272
52412
  title: "Powered by bpmn.io",
52273
- style: "color: #404040",
52413
+ style: "color: var(--cds-text-primary, #404040)",
52274
52414
  onClick: props.onClick,
52275
52415
  children: e$1(Logo, {})
52276
52416
  })
@@ -52297,8 +52437,12 @@
52297
52437
  function FormComponent(props) {
52298
52438
  const form = useService$2('form');
52299
52439
  const {
52300
- schema
52440
+ schema,
52441
+ properties
52301
52442
  } = form._getState();
52443
+ const {
52444
+ ariaLabel
52445
+ } = properties;
52302
52446
  const {
52303
52447
  onSubmit = noop,
52304
52448
  onReset = noop,
@@ -52316,6 +52460,7 @@
52316
52460
  class: "fjs-form",
52317
52461
  onSubmit: handleSubmit,
52318
52462
  onReset: handleReset,
52463
+ "aria-label": ariaLabel,
52319
52464
  noValidate: true,
52320
52465
  children: [e$1(FormField, {
52321
52466
  field: schema,
@@ -52325,7 +52470,7 @@
52325
52470
  }
52326
52471
  const NODE_TYPE_TEXT = 3,
52327
52472
  NODE_TYPE_ELEMENT = 1;
52328
- const ALLOWED_NODES = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'em', 'a', 'p', 'div', 'ul', 'ol', 'li', 'hr', 'blockquote', 'img', 'pre', 'code', 'br', 'strong'];
52473
+ const ALLOWED_NODES = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'em', 'a', 'p', 'div', 'ul', 'ol', 'li', 'hr', 'blockquote', 'img', 'pre', 'code', 'br', 'strong', 'table', 'thead', 'tbody', 'tr', 'th', 'td'];
52329
52474
  const ALLOWED_ATTRIBUTES = ['align', 'alt', 'class', 'href', 'id', 'name', 'rel', 'target', 'src'];
52330
52475
  const ALLOWED_URI_PATTERN = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
52331
52476
  const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i; // eslint-disable-line no-useless-escape
@@ -52515,7 +52660,7 @@
52515
52660
  alt: altText,
52516
52661
  src: safeSource,
52517
52662
  class: "fjs-image",
52518
- id: prefixId(id, formId)
52663
+ id: prefixId$2(id, formId)
52519
52664
  }), !safeSource && e$1("div", {
52520
52665
  class: "fjs-image-placeholder",
52521
52666
  children: e$1(ImagePlaceholder, {
@@ -52525,13 +52670,15 @@
52525
52670
  })
52526
52671
  });
52527
52672
  }
52528
- Image.create = (options = {}) => ({
52529
- ...options
52530
- });
52531
- Image.type = type$7;
52532
- Image.keyed = false;
52533
- Image.label = 'Image view';
52534
- Image.group = 'presentation';
52673
+ Image.config = {
52674
+ type: type$7,
52675
+ keyed: false,
52676
+ label: 'Image view',
52677
+ group: 'presentation',
52678
+ create: (options = {}) => ({
52679
+ ...options
52680
+ })
52681
+ };
52535
52682
  function _extends$g() {
52536
52683
  _extends$g = Object.assign ? Object.assign.bind() : function (target) {
52537
52684
  for (var i = 1; i < arguments.length; i++) {
@@ -52597,6 +52744,7 @@
52597
52744
  errors = [],
52598
52745
  field,
52599
52746
  value,
52747
+ readonly,
52600
52748
  onChange
52601
52749
  } = props;
52602
52750
  const {
@@ -52621,10 +52769,10 @@
52621
52769
 
52622
52770
  // checks whether the value currently in the form data is practically different from the one in the input field cache
52623
52771
  // this allows us to guarantee the field always displays valid form data, but without auto-simplifying values like 1.000 to 1
52624
- const cacheValueMatchesState = d(() => Numberfield.sanitizeValue({
52772
+ const cacheValueMatchesState = d(() => Numberfield.config.sanitizeValue({
52625
52773
  value,
52626
52774
  formField: field
52627
- }) === Numberfield.sanitizeValue({
52775
+ }) === Numberfield.config.sanitizeValue({
52628
52776
  value: stringValueCache,
52629
52777
  formField: field
52630
52778
  }), [stringValueCache, value, field]);
@@ -52669,6 +52817,9 @@
52669
52817
  });
52670
52818
  }, [field, onChange, serializeToString]);
52671
52819
  const increment = () => {
52820
+ if (readonly) {
52821
+ return;
52822
+ }
52672
52823
  const base = isValidNumber$1(value) ? Big$1(value) : Big$1(0);
52673
52824
  const stepFlooredValue = base.minus(base.mod(arrowIncrementValue));
52674
52825
 
@@ -52676,6 +52827,9 @@
52676
52827
  setValue(stepFlooredValue.plus(arrowIncrementValue).toFixed());
52677
52828
  };
52678
52829
  const decrement = () => {
52830
+ if (readonly) {
52831
+ return;
52832
+ }
52679
52833
  const base = isValidNumber$1(value) ? Big$1(value) : Big$1(0);
52680
52834
  const offset = base.mod(arrowIncrementValue);
52681
52835
  if (offset.cmp(0) === 0) {
@@ -52718,22 +52872,26 @@
52718
52872
  const {
52719
52873
  formId
52720
52874
  } = F$1(FormContext$1);
52875
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
52721
52876
  return e$1("div", {
52722
52877
  class: formFieldClasses(type$6, {
52723
52878
  errors,
52724
- disabled
52879
+ disabled,
52880
+ readonly
52725
52881
  }),
52726
52882
  children: [e$1(Label$1, {
52727
- id: prefixId(id, formId),
52883
+ id: prefixId$2(id, formId),
52728
52884
  label: label,
52729
52885
  required: required
52730
52886
  }), e$1(InputAdorner, {
52731
52887
  disabled: disabled,
52888
+ readonly: readonly,
52732
52889
  pre: prefixAdorner,
52733
52890
  post: suffixAdorner,
52734
52891
  children: e$1("div", {
52735
52892
  class: classNames('fjs-vertical-group', {
52736
- 'fjs-disabled': disabled
52893
+ 'fjs-disabled': disabled,
52894
+ 'fjs-readonly': readonly
52737
52895
  }, {
52738
52896
  'hasErrors': errors.length
52739
52897
  }),
@@ -52741,7 +52899,8 @@
52741
52899
  ref: inputRef,
52742
52900
  class: "fjs-input",
52743
52901
  disabled: disabled,
52744
- id: prefixId(id, formId),
52902
+ readOnly: readonly,
52903
+ id: prefixId$2(id, formId),
52745
52904
  onKeyDown: onKeyDown,
52746
52905
  onKeyPress: onKeyPress
52747
52906
 
@@ -52752,10 +52911,12 @@
52752
52911
  type: "text",
52753
52912
  autoComplete: "off",
52754
52913
  step: arrowIncrementValue,
52755
- value: displayValue
52914
+ value: displayValue,
52915
+ "aria-describedby": errorMessageId
52756
52916
  }), e$1("div", {
52757
52917
  class: classNames('fjs-number-arrow-container', {
52758
- 'fjs-disabled': disabled
52918
+ 'fjs-disabled': disabled,
52919
+ 'fjs-readonly': readonly
52759
52920
  }),
52760
52921
  children: [e$1("button", {
52761
52922
  class: "fjs-number-arrow-up",
@@ -52779,37 +52940,41 @@
52779
52940
  }), e$1(Description$2, {
52780
52941
  description: description
52781
52942
  }), e$1(Errors, {
52782
- errors: errors
52943
+ errors: errors,
52944
+ id: errorMessageId
52783
52945
  })]
52784
52946
  });
52785
52947
  }
52786
- Numberfield.create = (options = {}) => ({
52787
- ...options
52788
- });
52789
- Numberfield.sanitizeValue = ({
52790
- value,
52791
- formField
52792
- }) => {
52793
- // null state is allowed
52794
- if (isNullEquivalentValue(value)) return null;
52948
+ Numberfield.config = {
52949
+ type: type$6,
52950
+ keyed: true,
52951
+ label: 'Number',
52952
+ group: 'basic-input',
52953
+ emptyValue: null,
52954
+ sanitizeValue: ({
52955
+ value,
52956
+ formField
52957
+ }) => {
52958
+ // null state is allowed
52959
+ if (isNullEquivalentValue(value)) return null;
52795
52960
 
52796
- // if data cannot be parsed as a valid number, go into invalid NaN state
52797
- if (!isValidNumber$1(value)) return 'NaN';
52961
+ // if data cannot be parsed as a valid number, go into invalid NaN state
52962
+ if (!isValidNumber$1(value)) return 'NaN';
52798
52963
 
52799
- // otherwise parse to formatting type
52800
- return formField.serializeToString ? value.toString() : Number(value);
52964
+ // otherwise parse to formatting type
52965
+ return formField.serializeToString ? value.toString() : Number(value);
52966
+ },
52967
+ create: (options = {}) => ({
52968
+ ...options
52969
+ })
52801
52970
  };
52802
- Numberfield.type = type$6;
52803
- Numberfield.keyed = true;
52804
- Numberfield.label = 'Number';
52805
- Numberfield.emptyValue = null;
52806
- Numberfield.group = 'basic-input';
52807
52971
  const type$5 = 'radio';
52808
52972
  function Radio(props) {
52809
52973
  const {
52810
52974
  disabled,
52811
52975
  errors = [],
52812
52976
  field,
52977
+ readonly,
52813
52978
  value
52814
52979
  } = props;
52815
52980
  const {
@@ -52834,17 +52999,19 @@
52834
52999
  const {
52835
53000
  formId
52836
53001
  } = F$1(FormContext$1);
53002
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
52837
53003
  return e$1("div", {
52838
53004
  class: formFieldClasses(type$5, {
52839
53005
  errors,
52840
- disabled
53006
+ disabled,
53007
+ readonly
52841
53008
  }),
52842
53009
  children: [e$1(Label$1, {
52843
53010
  label: label,
52844
53011
  required: required
52845
53012
  }), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
52846
53013
  return e$1(Label$1, {
52847
- id: prefixId(`${id}-${index}`, formId),
53014
+ id: prefixId$2(`${id}-${index}`, formId),
52848
53015
  label: option.label,
52849
53016
  class: classNames({
52850
53017
  'fjs-checked': option.value === value
@@ -52854,39 +53021,44 @@
52854
53021
  checked: option.value === value,
52855
53022
  class: "fjs-input",
52856
53023
  disabled: disabled,
52857
- id: prefixId(`${id}-${index}`, formId),
53024
+ readOnly: readonly,
53025
+ id: prefixId$2(`${id}-${index}`, formId),
52858
53026
  type: "radio",
52859
- onClick: () => onChange(option.value)
53027
+ onClick: () => onChange(option.value),
53028
+ "aria-describedby": errorMessageId
52860
53029
  })
52861
53030
  }, `${id}-${index}`);
52862
53031
  }), e$1(Description$2, {
52863
53032
  description: description
52864
53033
  }), e$1(Errors, {
52865
- errors: errors
53034
+ errors: errors,
53035
+ id: errorMessageId
52866
53036
  })]
52867
53037
  });
52868
53038
  }
52869
- Radio.create = function (options = {}) {
52870
- const defaults = {};
52871
-
52872
- // provide default values if valuesKey isn't set
52873
- if (!options.valuesKey) {
52874
- defaults.values = [{
52875
- label: 'Value',
52876
- value: 'value'
52877
- }];
53039
+ Radio.config = {
53040
+ type: type$5,
53041
+ keyed: true,
53042
+ label: 'Radio',
53043
+ group: 'selection',
53044
+ emptyValue: null,
53045
+ sanitizeValue: sanitizeSingleSelectValue,
53046
+ create: (options = {}) => {
53047
+ const defaults = {};
53048
+
53049
+ // provide default values if valuesKey isn't set
53050
+ if (!options.valuesKey) {
53051
+ defaults.values = [{
53052
+ label: 'Value',
53053
+ value: 'value'
53054
+ }];
53055
+ }
53056
+ return {
53057
+ ...defaults,
53058
+ ...options
53059
+ };
52878
53060
  }
52879
- return {
52880
- ...defaults,
52881
- ...options
52882
- };
52883
53061
  };
52884
- Radio.type = type$5;
52885
- Radio.label = 'Radio';
52886
- Radio.keyed = true;
52887
- Radio.emptyValue = null;
52888
- Radio.sanitizeValue = sanitizeSingleSelectValue;
52889
- Radio.group = 'selection';
52890
53062
  function _extends$e() {
52891
53063
  _extends$e = Object.assign ? Object.assign.bind() : function (target) {
52892
53064
  for (var i = 1; i < arguments.length; i++) {
@@ -52922,6 +53094,7 @@
52922
53094
  disabled,
52923
53095
  errors,
52924
53096
  field,
53097
+ readonly,
52925
53098
  value
52926
53099
  } = props;
52927
53100
  const {
@@ -52994,11 +53167,11 @@
52994
53167
  }, [isDropdownExpanded, isEscapeClosed]);
52995
53168
  const displayState = d(() => {
52996
53169
  const ds = {};
52997
- ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
53170
+ ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
52998
53171
  ds.displayCross = ds.componentReady && value !== null && value !== undefined;
52999
- ds.displayDropdown = !disabled && isDropdownExpanded && !isEscapeClosed;
53172
+ ds.displayDropdown = !disabled && !readonly && isDropdownExpanded && !isEscapeClosed;
53000
53173
  return ds;
53001
- }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, value]);
53174
+ }, [disabled, isDropdownExpanded, isEscapeClosed, loadState, readonly, value]);
53002
53175
  const onAngelMouseDown = A$1(e => {
53003
53176
  setIsEscapeClose(false);
53004
53177
  setIsDropdownExpanded(!isDropdownExpanded);
@@ -53008,17 +53181,19 @@
53008
53181
  }, [isDropdownExpanded]);
53009
53182
  return e$1(d$1, {
53010
53183
  children: [e$1("div", {
53011
- id: prefixId(`${id}`, formId),
53184
+ id: prefixId$2(`${id}`, formId),
53012
53185
  class: classNames('fjs-input-group', {
53013
- 'disabled': disabled
53186
+ 'disabled': disabled,
53187
+ 'readonly': readonly
53014
53188
  }, {
53015
53189
  'hasErrors': errors.length
53016
53190
  }),
53017
53191
  children: [e$1("input", {
53018
53192
  disabled: disabled,
53193
+ readOnly: readonly,
53019
53194
  class: "fjs-input",
53020
53195
  ref: searchbarRef,
53021
- id: prefixId(`${id}-search`, formId),
53196
+ id: prefixId$2(`${id}-search`, formId),
53022
53197
  onChange: onChange,
53023
53198
  type: "text",
53024
53199
  value: filter,
@@ -53037,7 +53212,8 @@
53037
53212
  onBlur: () => {
53038
53213
  setIsDropdownExpanded(false);
53039
53214
  setFilter(valueLabel);
53040
- }
53215
+ },
53216
+ "aria-describedby": props['aria-describedby']
53041
53217
  }), displayState.displayCross && e$1("span", {
53042
53218
  class: "fjs-select-cross",
53043
53219
  onMouseDown: e => {
@@ -53070,6 +53246,7 @@
53070
53246
  disabled,
53071
53247
  errors,
53072
53248
  field,
53249
+ readonly,
53073
53250
  value
53074
53251
  } = props;
53075
53252
  const {
@@ -53095,9 +53272,9 @@
53095
53272
  }, [field, props]);
53096
53273
  const displayState = d(() => {
53097
53274
  const ds = {};
53098
- ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
53275
+ ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
53099
53276
  ds.displayCross = ds.componentReady && value !== null && value !== undefined;
53100
- ds.displayDropdown = !disabled && isDropdownExpanded;
53277
+ ds.displayDropdown = !disabled && !readonly && isDropdownExpanded;
53101
53278
  return ds;
53102
53279
  }, [disabled, isDropdownExpanded, loadState, value]);
53103
53280
  const onMouseDown = A$1(e => {
@@ -53114,22 +53291,29 @@
53114
53291
  return e$1(d$1, {
53115
53292
  children: [e$1("div", {
53116
53293
  ref: selectRef,
53117
- id: prefixId(`${id}`, formId),
53294
+ id: prefixId$2(`${id}`, formId),
53118
53295
  class: classNames('fjs-input-group', {
53119
- 'disabled': disabled
53296
+ disabled,
53297
+ readonly
53120
53298
  }, {
53121
53299
  'hasErrors': errors.length
53122
53300
  }),
53123
53301
  onFocus: () => setIsDropdownExpanded(true),
53124
53302
  onBlur: () => setIsDropdownExpanded(false),
53125
- onMouseDown: e => onMouseDown(e),
53126
- tabIndex: disabled ? undefined : 0,
53303
+ onMouseDown: onMouseDown,
53127
53304
  children: [e$1("div", {
53128
53305
  class: classNames('fjs-select-display', {
53129
53306
  'fjs-select-placeholder': !value
53130
53307
  }),
53131
- id: prefixId(`${id}-display`, formId),
53308
+ id: prefixId$2(`${id}-display`, formId),
53132
53309
  children: valueLabel || 'Select'
53310
+ }), !disabled && e$1("input", {
53311
+ id: prefixId$2(`${id}-search`, formId),
53312
+ class: "fjs-select-hidden-input",
53313
+ value: valueLabel,
53314
+ onFocus: () => !readonly && setIsDropdownExpanded(true),
53315
+ onBlur: () => !readonly && setIsDropdownExpanded(false),
53316
+ "aria-describedby": props['aria-describedby']
53133
53317
  }), displayState.displayCross && e$1("span", {
53134
53318
  class: "fjs-select-cross",
53135
53319
  onMouseDown: e => {
@@ -53163,6 +53347,7 @@
53163
53347
  errors = [],
53164
53348
  field,
53165
53349
  onChange,
53350
+ readonly,
53166
53351
  value
53167
53352
  } = props;
53168
53353
  const {
@@ -53178,18 +53363,22 @@
53178
53363
  const {
53179
53364
  formId
53180
53365
  } = F$1(FormContext$1);
53366
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
53181
53367
  const selectProps = d(() => ({
53182
53368
  id,
53183
53369
  disabled,
53184
53370
  errors,
53185
53371
  field,
53186
53372
  value,
53187
- onChange
53188
- }), [disabled, errors, field, id, value, onChange]);
53373
+ onChange,
53374
+ readonly,
53375
+ 'aria-describedby': errorMessageId
53376
+ }), [disabled, errors, field, id, value, onChange, readonly, errorMessageId]);
53189
53377
  return e$1("div", {
53190
53378
  class: formFieldClasses(type$4, {
53191
53379
  errors,
53192
- disabled
53380
+ disabled,
53381
+ readonly
53193
53382
  }),
53194
53383
  onKeyDown: event => {
53195
53384
  if (event.key === 'Enter') {
@@ -53198,7 +53387,7 @@
53198
53387
  }
53199
53388
  },
53200
53389
  children: [e$1(Label$1, {
53201
- id: prefixId(id, formId),
53390
+ id: prefixId$2(`${id}-search`, formId),
53202
53391
  label: label,
53203
53392
  required: required
53204
53393
  }), searchable ? e$1(SearchableSelect, {
@@ -53208,37 +53397,41 @@
53208
53397
  }), e$1(Description$2, {
53209
53398
  description: description
53210
53399
  }), e$1(Errors, {
53211
- errors: errors
53400
+ errors: errors,
53401
+ id: errorMessageId
53212
53402
  })]
53213
53403
  });
53214
53404
  }
53215
- Select$1.create = (options = {}) => {
53216
- const defaults = {};
53217
-
53218
- // provide default values if valuesKey isn't set
53219
- if (!options.valuesKey) {
53220
- defaults.values = [{
53221
- label: 'Value',
53222
- value: 'value'
53223
- }];
53405
+ Select$1.config = {
53406
+ type: type$4,
53407
+ keyed: true,
53408
+ label: 'Select',
53409
+ group: 'selection',
53410
+ emptyValue: null,
53411
+ sanitizeValue: sanitizeSingleSelectValue,
53412
+ create: (options = {}) => {
53413
+ const defaults = {};
53414
+
53415
+ // provide default values if valuesKey isn't set
53416
+ if (!options.valuesKey) {
53417
+ defaults.values = [{
53418
+ label: 'Value',
53419
+ value: 'value'
53420
+ }];
53421
+ }
53422
+ return {
53423
+ ...defaults,
53424
+ ...options
53425
+ };
53224
53426
  }
53225
- return {
53226
- ...defaults,
53227
- ...options
53228
- };
53229
53427
  };
53230
- Select$1.type = type$4;
53231
- Select$1.label = 'Select';
53232
- Select$1.keyed = true;
53233
- Select$1.emptyValue = null;
53234
- Select$1.sanitizeValue = sanitizeSingleSelectValue;
53235
- Select$1.group = 'selection';
53236
53428
  const type$3 = 'taglist';
53237
53429
  function Taglist(props) {
53238
53430
  const {
53239
53431
  disabled,
53240
53432
  errors = [],
53241
53433
  field,
53434
+ readonly,
53242
53435
  value: values = []
53243
53436
  } = props;
53244
53437
  const {
@@ -53253,6 +53446,7 @@
53253
53446
  const {
53254
53447
  formId
53255
53448
  } = F$1(FormContext$1);
53449
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
53256
53450
  const [filter, setFilter] = l$2('');
53257
53451
  const [filteredOptions, setFilteredOptions] = l$2([]);
53258
53452
  const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
@@ -53328,6 +53522,10 @@
53328
53522
  break;
53329
53523
  }
53330
53524
  };
53525
+ const onBlur = () => {
53526
+ setIsDropdownExpanded(false);
53527
+ setFilter('');
53528
+ };
53331
53529
  const onTagRemoveClick = (event, value) => {
53332
53530
  const {
53333
53531
  target
@@ -53344,7 +53542,8 @@
53344
53542
  return e$1("div", {
53345
53543
  class: formFieldClasses(type$3, {
53346
53544
  errors,
53347
- disabled
53545
+ disabled,
53546
+ readonly
53348
53547
  }),
53349
53548
  onKeyDown: event => {
53350
53549
  if (event.key === 'Enter') {
@@ -53355,23 +53554,25 @@
53355
53554
  children: [e$1(Label$1, {
53356
53555
  label: label,
53357
53556
  required: required,
53358
- id: prefixId(`${id}-search`, formId)
53557
+ id: prefixId$2(`${id}-search`, formId)
53359
53558
  }), e$1("div", {
53360
53559
  class: classNames('fjs-taglist', {
53361
- 'fjs-disabled': disabled
53560
+ 'fjs-disabled': disabled,
53561
+ 'fjs-readonly': readonly
53362
53562
  }),
53363
53563
  children: [loadState === LOAD_STATES.LOADED && e$1("div", {
53364
53564
  class: "fjs-taglist-tags",
53365
53565
  children: values.map(v => {
53366
53566
  return e$1("div", {
53367
53567
  class: classNames('fjs-taglist-tag', {
53368
- 'fjs-disabled': disabled
53568
+ 'fjs-disabled': disabled,
53569
+ 'fjs-readonly': readonly
53369
53570
  }),
53370
53571
  onMouseDown: e => e.preventDefault(),
53371
53572
  children: [e$1("span", {
53372
53573
  class: "fjs-taglist-tag-label",
53373
53574
  children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
53374
- }), !disabled && e$1("button", {
53575
+ }), !disabled && !readonly && e$1("button", {
53375
53576
  type: "button",
53376
53577
  title: "Remove tag",
53377
53578
  class: "fjs-taglist-tag-remove",
@@ -53382,21 +53583,22 @@
53382
53583
  })
53383
53584
  }), e$1("input", {
53384
53585
  disabled: disabled,
53586
+ readOnly: readonly,
53385
53587
  class: "fjs-taglist-input",
53386
53588
  ref: searchbarRef,
53387
- id: prefixId(`${id}-search`, formId),
53589
+ id: prefixId$2(`${id}-search`, formId),
53388
53590
  onChange: onFilterChange,
53389
53591
  type: "text",
53390
53592
  value: filter,
53391
- placeholder: disabled ? '' : 'Search',
53593
+ placeholder: disabled || readonly ? undefined : 'Search',
53392
53594
  autoComplete: "off",
53393
- onKeyDown: e => onInputKeyDown(e),
53595
+ onKeyDown: onInputKeyDown,
53394
53596
  onMouseDown: () => setIsEscapeClose(false),
53395
- onFocus: () => setIsDropdownExpanded(true),
53597
+ onFocus: () => !readonly && setIsDropdownExpanded(true),
53396
53598
  onBlur: () => {
53397
- setIsDropdownExpanded(false);
53398
- setFilter('');
53399
- }
53599
+ !readonly && onBlur();
53600
+ },
53601
+ "aria-describedby": errorMessageId
53400
53602
  })]
53401
53603
  }), e$1("div", {
53402
53604
  class: "fjs-taglist-anchor",
@@ -53410,33 +53612,40 @@
53410
53612
  }), e$1(Description$2, {
53411
53613
  description: description
53412
53614
  }), e$1(Errors, {
53413
- errors: errors
53615
+ errors: errors,
53616
+ id: errorMessageId
53414
53617
  })]
53415
53618
  });
53416
53619
  }
53417
- Taglist.create = (options = {}) => {
53418
- const defaults = {};
53419
-
53420
- // provide default values if valuesKey isn't set
53421
- if (!options.valuesKey) {
53422
- defaults.values = [{
53423
- label: 'Value',
53424
- value: 'value'
53425
- }];
53620
+ Taglist.config = {
53621
+ type: type$3,
53622
+ keyed: true,
53623
+ label: 'Tag list',
53624
+ group: 'selection',
53625
+ emptyValue: [],
53626
+ sanitizeValue: sanitizeMultiSelectValue,
53627
+ create: (options = {}) => {
53628
+ const defaults = {};
53629
+
53630
+ // provide default values if valuesKey isn't set
53631
+ if (!options.valuesKey) {
53632
+ defaults.values = [{
53633
+ label: 'Value',
53634
+ value: 'value'
53635
+ }];
53636
+ }
53637
+ return {
53638
+ ...defaults,
53639
+ ...options
53640
+ };
53426
53641
  }
53427
- return {
53428
- ...defaults,
53429
- ...options
53430
- };
53431
53642
  };
53432
- Taglist.type = type$3;
53433
- Taglist.label = 'Tag list';
53434
- Taglist.keyed = true;
53435
- Taglist.emptyValue = [];
53436
- Taglist.sanitizeValue = sanitizeMultiSelectValue;
53437
- Taglist.group = 'selection';
53438
53643
  const type$2 = 'text';
53439
53644
  function Text$1(props) {
53645
+ const form = useService$2('form');
53646
+ const {
53647
+ textLinkTarget
53648
+ } = form._getState().properties;
53440
53649
  const {
53441
53650
  field,
53442
53651
  disableLinks
@@ -53458,9 +53667,20 @@
53458
53667
  const html = markdownRenderer.render(markdown);
53459
53668
  return sanitizeHTML(html);
53460
53669
  }, [markdownRenderer, markdown]);
53461
- const componentOverrides = d(() => disableLinks ? {
53462
- 'a': DisabledLink
53463
- } : {}, [disableLinks]);
53670
+ const OverridenTargetLink = d(() => BuildOverridenTargetLink(textLinkTarget), [textLinkTarget]);
53671
+ const componentOverrides = d(() => {
53672
+ if (disableLinks) {
53673
+ return {
53674
+ 'a': DisabledLink
53675
+ };
53676
+ }
53677
+ if (textLinkTarget) {
53678
+ return {
53679
+ 'a': OverridenTargetLink
53680
+ };
53681
+ }
53682
+ return {};
53683
+ }, [disableLinks, OverridenTargetLink, textLinkTarget]);
53464
53684
  return e$1("div", {
53465
53685
  class: formFieldClasses(type$2),
53466
53686
  children: e$1(Markup, {
@@ -53470,21 +53690,35 @@
53470
53690
  })
53471
53691
  });
53472
53692
  }
53473
- Text$1.create = (options = {}) => ({
53474
- text: '# Text',
53475
- ...options
53476
- });
53477
- Text$1.type = type$2;
53478
- Text$1.keyed = false;
53479
- Text$1.group = 'presentation';
53480
- Text$1.label = 'Text view';
53693
+ Text$1.config = {
53694
+ type: type$2,
53695
+ keyed: false,
53696
+ label: 'Text view',
53697
+ group: 'presentation',
53698
+ create: (options = {}) => ({
53699
+ text: '# Text',
53700
+ ...options
53701
+ })
53702
+ };
53703
+ function BuildOverridenTargetLink(target) {
53704
+ return function ({
53705
+ children,
53706
+ ...rest
53707
+ }) {
53708
+ return e$1("a", {
53709
+ ...rest,
53710
+ target: target,
53711
+ children: children
53712
+ });
53713
+ };
53714
+ }
53481
53715
  function DisabledLink({
53482
- href,
53483
- children
53716
+ children,
53717
+ ...rest
53484
53718
  }) {
53485
53719
  return e$1("a", {
53720
+ ...rest,
53486
53721
  class: "fjs-disabled-link",
53487
- href: href,
53488
53722
  tabIndex: -1,
53489
53723
  children: children
53490
53724
  });
@@ -53495,6 +53729,7 @@
53495
53729
  disabled,
53496
53730
  errors = [],
53497
53731
  field,
53732
+ readonly,
53498
53733
  value = ''
53499
53734
  } = props;
53500
53735
  const {
@@ -53522,51 +53757,70 @@
53522
53757
  const {
53523
53758
  formId
53524
53759
  } = F$1(FormContext$1);
53760
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
53525
53761
  return e$1("div", {
53526
53762
  class: formFieldClasses(type$1, {
53527
53763
  errors,
53528
- disabled
53764
+ disabled,
53765
+ readonly
53529
53766
  }),
53530
53767
  children: [e$1(Label$1, {
53531
- id: prefixId(id, formId),
53768
+ id: prefixId$2(id, formId),
53532
53769
  label: label,
53533
53770
  required: required
53534
53771
  }), e$1(InputAdorner, {
53535
53772
  disabled: disabled,
53773
+ readonly: readonly,
53536
53774
  pre: prefixAdorner,
53537
53775
  post: suffixAdorner,
53538
53776
  children: e$1("input", {
53539
53777
  class: "fjs-input",
53540
53778
  disabled: disabled,
53541
- id: prefixId(id, formId),
53779
+ readOnly: readonly,
53780
+ id: prefixId$2(id, formId),
53542
53781
  onInput: onChange,
53543
53782
  type: "text",
53544
- value: value
53783
+ value: value,
53784
+ "aria-describedby": errorMessageId
53545
53785
  })
53546
53786
  }), e$1(Description$2, {
53547
53787
  description: description
53548
53788
  }), e$1(Errors, {
53549
- errors: errors
53789
+ errors: errors,
53790
+ id: errorMessageId
53550
53791
  })]
53551
53792
  });
53552
53793
  }
53553
- Textfield$1.create = (options = {}) => ({
53554
- ...options
53555
- });
53556
- Textfield$1.type = type$1;
53557
- Textfield$1.label = 'Text field';
53558
- Textfield$1.keyed = true;
53559
- Textfield$1.emptyValue = '';
53560
- Textfield$1.sanitizeValue = ({
53561
- value
53562
- }) => isArray$4(value) || isObject$1(value) ? '' : String(value);
53563
- Textfield$1.group = 'basic-input';
53794
+ Textfield$1.config = {
53795
+ type: type$1,
53796
+ keyed: true,
53797
+ label: 'Text field',
53798
+ group: 'basic-input',
53799
+ emptyValue: '',
53800
+ sanitizeValue: ({
53801
+ value
53802
+ }) => {
53803
+ if (isArray$4(value) || isObject$1(value)) {
53804
+ return '';
53805
+ }
53806
+
53807
+ // sanitize newlines to spaces
53808
+ if (typeof value === 'string') {
53809
+ return value.replace(/[\r\n\t]/g, ' ');
53810
+ }
53811
+ return String(value);
53812
+ },
53813
+ create: (options = {}) => ({
53814
+ ...options
53815
+ })
53816
+ };
53564
53817
  const type = 'textarea';
53565
53818
  function Textarea(props) {
53566
53819
  const {
53567
53820
  disabled,
53568
53821
  errors = [],
53569
53822
  field,
53823
+ readonly,
53570
53824
  value = ''
53571
53825
  } = props;
53572
53826
  const {
@@ -53606,40 +53860,47 @@
53606
53860
  const {
53607
53861
  formId
53608
53862
  } = F$1(FormContext$1);
53863
+ const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
53609
53864
  return e$1("div", {
53610
53865
  class: formFieldClasses(type, {
53611
53866
  errors,
53612
- disabled
53867
+ disabled,
53868
+ readonly
53613
53869
  }),
53614
53870
  children: [e$1(Label$1, {
53615
- id: prefixId(id, formId),
53871
+ id: prefixId$2(id, formId),
53616
53872
  label: label,
53617
53873
  required: required
53618
53874
  }), e$1("textarea", {
53619
53875
  class: "fjs-textarea",
53620
53876
  disabled: disabled,
53621
- id: prefixId(id, formId),
53877
+ readonly: readonly,
53878
+ id: prefixId$2(id, formId),
53622
53879
  onInput: onInput,
53623
53880
  value: value,
53624
- ref: textareaRef
53881
+ ref: textareaRef,
53882
+ "aria-describedby": errorMessageId
53625
53883
  }), e$1(Description$2, {
53626
53884
  description: description
53627
53885
  }), e$1(Errors, {
53628
- errors: errors
53886
+ errors: errors,
53887
+ id: errorMessageId
53629
53888
  })]
53630
53889
  });
53631
53890
  }
53632
- Textarea.create = (options = {}) => ({
53633
- ...options
53634
- });
53635
- Textarea.type = type;
53636
- Textarea.label = 'Text area';
53637
- Textarea.keyed = true;
53638
- Textarea.emptyValue = '';
53639
- Textarea.sanitizeValue = ({
53640
- value
53641
- }) => isArray$4(value) || isObject$1(value) ? '' : String(value);
53642
- Textarea.group = 'basic-input';
53891
+ Textarea.config = {
53892
+ type,
53893
+ keyed: true,
53894
+ label: 'Text area',
53895
+ group: 'basic-input',
53896
+ emptyValue: '',
53897
+ sanitizeValue: ({
53898
+ value
53899
+ }) => isArray$4(value) || isObject$1(value) ? '' : String(value),
53900
+ create: (options = {}) => ({
53901
+ ...options
53902
+ })
53903
+ };
53643
53904
  function _extends$d() {
53644
53905
  _extends$d = Object.assign ? Object.assign.bind() : function (target) {
53645
53906
  for (var i = 1; i < arguments.length; i++) {
@@ -53660,10 +53921,11 @@
53660
53921
  }) => /*#__PURE__*/React.createElement("svg", _extends$d({
53661
53922
  xmlns: "http://www.w3.org/2000/svg",
53662
53923
  width: "54",
53663
- height: "54"
53924
+ height: "54",
53925
+ fill: "currentcolor"
53664
53926
  }, props), /*#__PURE__*/React.createElement("path", {
53665
53927
  fillRule: "evenodd",
53666
- d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
53928
+ d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18v-2.222z"
53667
53929
  }));
53668
53930
  function _extends$c() {
53669
53931
  _extends$c = Object.assign ? Object.assign.bind() : function (target) {
@@ -53685,7 +53947,8 @@
53685
53947
  }) => /*#__PURE__*/React.createElement("svg", _extends$c({
53686
53948
  xmlns: "http://www.w3.org/2000/svg",
53687
53949
  width: "54",
53688
- height: "54"
53950
+ height: "54",
53951
+ fill: "currentcolor"
53689
53952
  }, props), /*#__PURE__*/React.createElement("path", {
53690
53953
  d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
53691
53954
  }));
@@ -53708,18 +53971,35 @@
53708
53971
  ...props
53709
53972
  }) => /*#__PURE__*/React.createElement("svg", _extends$b({
53710
53973
  xmlns: "http://www.w3.org/2000/svg",
53974
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
53711
53975
  width: "54",
53712
53976
  height: "54",
53713
- fill: "none"
53714
- }, props), /*#__PURE__*/React.createElement("path", {
53715
- fillRule: "evenodd",
53716
- clipRule: "evenodd",
53717
- d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 36h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z",
53718
- fill: "#161616"
53977
+ fill: "currentcolor"
53978
+ }, props), /*#__PURE__*/React.createElement("g", {
53979
+ fillRule: "evenodd"
53980
+ }, /*#__PURE__*/React.createElement("use", {
53981
+ xlinkHref: "#a"
53982
+ }), /*#__PURE__*/React.createElement("use", {
53983
+ xlinkHref: "#a",
53984
+ y: "24"
53985
+ }), /*#__PURE__*/React.createElement("use", {
53986
+ xlinkHref: "#a",
53987
+ y: "12"
53988
+ })), /*#__PURE__*/React.createElement("use", {
53989
+ xlinkHref: "#b"
53990
+ }), /*#__PURE__*/React.createElement("use", {
53991
+ xlinkHref: "#b",
53992
+ y: "12"
53993
+ }), /*#__PURE__*/React.createElement("use", {
53994
+ xlinkHref: "#b",
53995
+ y: "24"
53996
+ }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("path", {
53997
+ id: "a",
53998
+ d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z"
53719
53999
  }), /*#__PURE__*/React.createElement("path", {
53720
- d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 26.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 38.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z",
53721
- fill: "#161616"
53722
- }));
54000
+ id: "b",
54001
+ d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z"
54002
+ })));
53723
54003
  function _extends$a() {
53724
54004
  _extends$a = Object.assign ? Object.assign.bind() : function (target) {
53725
54005
  for (var i = 1; i < arguments.length; i++) {
@@ -53741,20 +54021,15 @@
53741
54021
  xmlns: "http://www.w3.org/2000/svg",
53742
54022
  width: "54",
53743
54023
  height: "54",
53744
- fill: "none"
54024
+ fill: "currentcolor"
53745
54025
  }, props), /*#__PURE__*/React.createElement("path", {
53746
- fill: "#000",
53747
54026
  fillRule: "evenodd",
53748
- d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36c-1.132 0-2.06.928-2.06 2.06v23.549c0 1.132.928 2.06 2.06 2.06h6.77v-1.766h-6.358a.707.707 0 01-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592c.39 0 .707.317.707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z",
53749
- clipRule: "evenodd"
54027
+ d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36a2.07 2.07 0 00-2.06 2.06v23.549a2.07 2.07 0 002.06 2.06h6.77v-1.766h-6.358a.707.707 0 01-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592a.71.71 0 01.707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z"
53750
54028
  }), /*#__PURE__*/React.createElement("path", {
53751
- fill: "#000",
53752
54029
  d: "M35.13 37.603l1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984z"
53753
54030
  }), /*#__PURE__*/React.createElement("path", {
53754
- fill: "#000",
53755
54031
  fillRule: "evenodd",
53756
- d: "M23.08 36.962a9.678 9.678 0 1017.883-7.408 9.678 9.678 0 00-17.882 7.408zm4.54-10.292a7.924 7.924 0 118.805 13.177A7.924 7.924 0 0127.62 26.67z",
53757
- clipRule: "evenodd"
54032
+ d: "M23.08 36.962a9.678 9.678 0 1017.883-7.408 9.678 9.678 0 00-17.882 7.408zm4.54-10.292a7.924 7.924 0 118.805 13.177A7.924 7.924 0 0127.62 26.67z"
53758
54033
  }));
53759
54034
  function _extends$9() {
53760
54035
  _extends$9 = Object.assign ? Object.assign.bind() : function (target) {
@@ -53774,18 +54049,15 @@
53774
54049
  styles = {},
53775
54050
  ...props
53776
54051
  }) => /*#__PURE__*/React.createElement("svg", _extends$9({
54052
+ xmlns: "http://www.w3.org/2000/svg",
53777
54053
  width: "54",
53778
54054
  height: "54",
53779
- fill: "none",
53780
- xmlns: "http://www.w3.org/2000/svg"
54055
+ fill: "currentcolor"
53781
54056
  }, props), /*#__PURE__*/React.createElement("path", {
53782
54057
  fillRule: "evenodd",
53783
- clipRule: "evenodd",
53784
- d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z",
53785
- fill: "#000"
54058
+ d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z"
53786
54059
  }), /*#__PURE__*/React.createElement("path", {
53787
- d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
53788
- fill: "#505562"
54060
+ d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z"
53789
54061
  }));
53790
54062
  function _extends$8() {
53791
54063
  _extends$8 = Object.assign ? Object.assign.bind() : function (target) {
@@ -53809,22 +54081,22 @@
53809
54081
  width: "54",
53810
54082
  height: "54"
53811
54083
  }, props), /*#__PURE__*/React.createElement("rect", {
53812
- x: "15",
53813
- y: "17",
53814
54084
  width: "24",
53815
54085
  height: "4",
54086
+ x: "15",
54087
+ y: "17",
53816
54088
  rx: "1"
53817
54089
  }), /*#__PURE__*/React.createElement("rect", {
53818
- x: "15",
53819
- y: "25",
53820
54090
  width: "24",
53821
54091
  height: "4",
54092
+ x: "15",
54093
+ y: "25",
53822
54094
  rx: "1"
53823
54095
  }), /*#__PURE__*/React.createElement("rect", {
53824
- x: "15",
53825
- y: "33",
53826
54096
  width: "13",
53827
54097
  height: "4",
54098
+ x: "15",
54099
+ y: "33",
53828
54100
  rx: "1"
53829
54101
  }));
53830
54102
  function _extends$7() {
@@ -53872,7 +54144,8 @@
53872
54144
  }) => /*#__PURE__*/React.createElement("svg", _extends$6({
53873
54145
  xmlns: "http://www.w3.org/2000/svg",
53874
54146
  width: "54",
53875
- height: "54"
54147
+ height: "54",
54148
+ fill: "currentcolor"
53876
54149
  }, props), /*#__PURE__*/React.createElement("path", {
53877
54150
  fillRule: "evenodd",
53878
54151
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
@@ -53897,9 +54170,10 @@
53897
54170
  }) => /*#__PURE__*/React.createElement("svg", _extends$5({
53898
54171
  xmlns: "http://www.w3.org/2000/svg",
53899
54172
  width: "54",
53900
- height: "54"
54173
+ height: "54",
54174
+ fill: "currentcolor"
53901
54175
  }, props), /*#__PURE__*/React.createElement("path", {
53902
- d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
54176
+ d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18a8 8 0 110-16 8 8 0 110 16z"
53903
54177
  }));
53904
54178
  function _extends$4() {
53905
54179
  _extends$4 = Object.assign ? Object.assign.bind() : function (target) {
@@ -53921,7 +54195,8 @@
53921
54195
  }) => /*#__PURE__*/React.createElement("svg", _extends$4({
53922
54196
  xmlns: "http://www.w3.org/2000/svg",
53923
54197
  width: "54",
53924
- height: "54"
54198
+ height: "54",
54199
+ fill: "currentcolor"
53925
54200
  }, props), /*#__PURE__*/React.createElement("path", {
53926
54201
  fillRule: "evenodd",
53927
54202
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
@@ -53946,9 +54221,10 @@
53946
54221
  }) => /*#__PURE__*/React.createElement("svg", _extends$3$1({
53947
54222
  xmlns: "http://www.w3.org/2000/svg",
53948
54223
  width: "54",
53949
- height: "54"
54224
+ height: "54",
54225
+ fill: "currentcolor"
53950
54226
  }, props), /*#__PURE__*/React.createElement("path", {
53951
- 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"
54227
+ 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-.23zm19.62.92l2.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"
53952
54228
  }));
53953
54229
  function _extends$2$1() {
53954
54230
  _extends$2$1 = Object.assign ? Object.assign.bind() : function (target) {
@@ -53970,7 +54246,8 @@
53970
54246
  }) => /*#__PURE__*/React.createElement("svg", _extends$2$1({
53971
54247
  xmlns: "http://www.w3.org/2000/svg",
53972
54248
  width: "54",
53973
- height: "54"
54249
+ height: "54",
54250
+ fill: "currentcolor"
53974
54251
  }, props), /*#__PURE__*/React.createElement("path", {
53975
54252
  fillRule: "evenodd",
53976
54253
  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"
@@ -53995,10 +54272,11 @@
53995
54272
  }) => /*#__PURE__*/React.createElement("svg", _extends$1$1({
53996
54273
  xmlns: "http://www.w3.org/2000/svg",
53997
54274
  width: "54",
53998
- height: "54"
54275
+ height: "54",
54276
+ fill: "currentcolor"
53999
54277
  }, props), /*#__PURE__*/React.createElement("path", {
54000
54278
  fillRule: "evenodd",
54001
- 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"
54279
+ 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.849.849-6.364 6.364-.849-.849 6.364-6.364zm.264 3.5l.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
54002
54280
  }));
54003
54281
  function _extends$k() {
54004
54282
  _extends$k = Object.assign ? Object.assign.bind() : function (target) {
@@ -54018,20 +54296,18 @@
54018
54296
  styles = {},
54019
54297
  ...props
54020
54298
  }) => /*#__PURE__*/React.createElement("svg", _extends$k({
54299
+ xmlns: "http://www.w3.org/2000/svg",
54021
54300
  width: "54",
54022
54301
  height: "54",
54023
- fill: "none",
54024
- xmlns: "http://www.w3.org/2000/svg"
54302
+ fill: "currentcolor"
54025
54303
  }, props), /*#__PURE__*/React.createElement("path", {
54026
54304
  fillRule: "evenodd",
54027
- clipRule: "evenodd",
54028
54305
  d: "M34.636 21.91A3.818 3.818 0 1127 21.908a3.818 3.818 0 017.636 0zm-2 0A1.818 1.818 0 1129 21.908a1.818 1.818 0 013.636 0z",
54029
- fill: "#000"
54306
+ clipRule: "evenodd"
54030
54307
  }), /*#__PURE__*/React.createElement("path", {
54031
54308
  fillRule: "evenodd",
54032
- clipRule: "evenodd",
54033
- 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",
54034
- fill: "#000"
54309
+ 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.754a.975.975 0 00.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",
54310
+ clipRule: "evenodd"
54035
54311
  }));
54036
54312
  const iconsByType = type => {
54037
54313
  return {
@@ -54056,7 +54332,7 @@
54056
54332
  constructor() {
54057
54333
  this._formFields = {};
54058
54334
  formFields.forEach(formField => {
54059
- this.register(formField.type, formField);
54335
+ this.register(formField.config.type, formField);
54060
54336
  });
54061
54337
  }
54062
54338
  register(type, formField) {
@@ -54274,7 +54550,7 @@
54274
54550
  const {
54275
54551
  properties
54276
54552
  } = this._getState();
54277
- if (properties.readOnly) {
54553
+ if (properties.readOnly || properties.disabled) {
54278
54554
  throw new Error('form is read-only');
54279
54555
  }
54280
54556
  const data = this._getSubmitData();
@@ -54502,7 +54778,7 @@
54502
54778
  return conditionChecker.applyConditions(toFilter, data);
54503
54779
  }
54504
54780
  }
54505
- const schemaVersion = 8;
54781
+ const schemaVersion = 9;
54506
54782
 
54507
54783
  /**
54508
54784
  * Flatten array, one level deep.
@@ -55307,16 +55583,16 @@
55307
55583
  }
55308
55584
 
55309
55585
  var handle = item;
55310
- while (getParent(item) && isContainer(getParent(item)) === false) {
55586
+ while (getParent$1(item) && isContainer(getParent$1(item)) === false) {
55311
55587
  if (o.invalid(item, handle)) {
55312
55588
  return;
55313
55589
  }
55314
- item = getParent(item); // drag target should be a top element
55590
+ item = getParent$1(item); // drag target should be a top element
55315
55591
  if (!item) {
55316
55592
  return;
55317
55593
  }
55318
55594
  }
55319
- var source = getParent(item);
55595
+ var source = getParent$1(item);
55320
55596
  if (!source) {
55321
55597
  return;
55322
55598
  }
@@ -55360,7 +55636,7 @@
55360
55636
  return;
55361
55637
  }
55362
55638
  var item = _copy || _item;
55363
- drop(item, getParent(item));
55639
+ drop(item, getParent$1(item));
55364
55640
  }
55365
55641
  function ungrab() {
55366
55642
  _grabbed = false;
@@ -55386,7 +55662,7 @@
55386
55662
  }
55387
55663
  }
55388
55664
  function drop(item, target) {
55389
- var parent = getParent(item);
55665
+ var parent = getParent$1(item);
55390
55666
  if (_copy && o.copySortSource && target === _source) {
55391
55667
  parent.removeChild(_item);
55392
55668
  }
@@ -55402,7 +55678,7 @@
55402
55678
  return;
55403
55679
  }
55404
55680
  var item = _copy || _item;
55405
- var parent = getParent(item);
55681
+ var parent = getParent$1(item);
55406
55682
  if (parent) {
55407
55683
  parent.removeChild(item);
55408
55684
  }
@@ -55415,7 +55691,7 @@
55415
55691
  }
55416
55692
  var reverts = arguments.length > 0 ? revert : o.revertOnSpill;
55417
55693
  var item = _copy || _item;
55418
- var parent = getParent(item);
55694
+ var parent = getParent$1(item);
55419
55695
  var initial = isInitialPlacement(parent);
55420
55696
  if (initial === false && reverts) {
55421
55697
  if (_copy) {
@@ -55464,7 +55740,7 @@
55464
55740
  function findDropTarget(elementBehindCursor, clientX, clientY) {
55465
55741
  var target = elementBehindCursor;
55466
55742
  while (target && !accepted()) {
55467
- target = getParent(target);
55743
+ target = getParent$1(target);
55468
55744
  }
55469
55745
  return target;
55470
55746
  function accepted() {
@@ -55502,7 +55778,7 @@
55502
55778
  _lastDropTarget = dropTarget;
55503
55779
  over();
55504
55780
  }
55505
- var parent = getParent(item);
55781
+ var parent = getParent$1(item);
55506
55782
  if (dropTarget === _source && _copy && !o.copySortSource) {
55507
55783
  if (parent) {
55508
55784
  parent.removeChild(item);
@@ -55568,14 +55844,14 @@
55568
55844
  if (_mirror) {
55569
55845
  classes$1.rm(o.mirrorContainer, 'gu-unselectable');
55570
55846
  touchy(documentElement, 'remove', 'mousemove', drag);
55571
- getParent(_mirror).removeChild(_mirror);
55847
+ getParent$1(_mirror).removeChild(_mirror);
55572
55848
  _mirror = null;
55573
55849
  }
55574
55850
  }
55575
55851
  function getImmediateChild(dropTarget, target) {
55576
55852
  var immediate = target;
55577
- while (immediate !== dropTarget && getParent(immediate) !== dropTarget) {
55578
- immediate = getParent(immediate);
55853
+ while (immediate !== dropTarget && getParent$1(immediate) !== dropTarget) {
55854
+ immediate = getParent$1(immediate);
55579
55855
  }
55580
55856
  if (immediate === documentElement) {
55581
55857
  return null;
@@ -55698,7 +55974,7 @@
55698
55974
  function getRectHeight(rect) {
55699
55975
  return rect.height || rect.bottom - rect.top;
55700
55976
  }
55701
- function getParent(el) {
55977
+ function getParent$1(el) {
55702
55978
  return el.parentNode === doc ? null : el.parentNode;
55703
55979
  }
55704
55980
  function isInput$1(el) {
@@ -55714,7 +55990,7 @@
55714
55990
  if (el.contentEditable === 'true') {
55715
55991
  return true;
55716
55992
  } // found a contentEditable element in the chain
55717
- return isEditable(getParent(el)); // contentEditable is set to 'inherit'
55993
+ return isEditable(getParent$1(el)); // contentEditable is set to 'inherit'
55718
55994
  }
55719
55995
 
55720
55996
  function nextEl(el) {
@@ -55932,10 +56208,10 @@
55932
56208
  }
55933
56209
  return matches(currentElem, selector) ? currentElem : null;
55934
56210
  }
55935
- var componentEvent$1 = {};
55936
- var bind$1$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
55937
- unbind$1$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
55938
- prefix$1 = bind$1$1 !== 'addEventListener' ? 'on' : '';
56211
+ var componentEvent = {};
56212
+ var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
56213
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
56214
+ prefix = bind$1 !== 'addEventListener' ? 'on' : '';
55939
56215
 
55940
56216
  /**
55941
56217
  * Bind `el` event `type` to `fn`.
@@ -55948,8 +56224,8 @@
55948
56224
  * @api public
55949
56225
  */
55950
56226
 
55951
- var bind_1 = componentEvent$1.bind = function (el, type, fn, capture) {
55952
- el[bind$1$1](prefix$1 + type, fn, capture || false);
56227
+ var bind_1 = componentEvent.bind = function (el, type, fn, capture) {
56228
+ el[bind$1](prefix + type, fn, capture || false);
55953
56229
  return fn;
55954
56230
  };
55955
56231
 
@@ -55964,16 +56240,16 @@
55964
56240
  * @api public
55965
56241
  */
55966
56242
 
55967
- var unbind_1 = componentEvent$1.unbind = function (el, type, fn, capture) {
55968
- el[unbind$1$1](prefix$1 + type, fn, capture || false);
56243
+ var unbind_1 = componentEvent.unbind = function (el, type, fn, capture) {
56244
+ el[unbind$1](prefix + type, fn, capture || false);
55969
56245
  return fn;
55970
56246
  };
55971
56247
  var event = /*#__PURE__*/_mergeNamespaces$1({
55972
56248
  __proto__: null,
55973
56249
  bind: bind_1,
55974
56250
  unbind: unbind_1,
55975
- 'default': componentEvent$1
55976
- }, [componentEvent$1]);
56251
+ 'default': componentEvent
56252
+ }, [componentEvent]);
55977
56253
 
55978
56254
  /**
55979
56255
  * Expose `parse`.
@@ -56168,48 +56444,6 @@
56168
56444
  }
56169
56445
  });
56170
56446
 
56171
- var componentEvent = {};
56172
- var bind$1, unbind$1, prefix;
56173
- function detect() {
56174
- bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent';
56175
- unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent';
56176
- prefix = bind$1 !== 'addEventListener' ? 'on' : '';
56177
- }
56178
-
56179
- /**
56180
- * Bind `el` event `type` to `fn`.
56181
- *
56182
- * @param {Element} el
56183
- * @param {String} type
56184
- * @param {Function} fn
56185
- * @param {Boolean} capture
56186
- * @return {Function}
56187
- * @api public
56188
- */
56189
-
56190
- componentEvent.bind = function (el, type, fn, capture) {
56191
- if (!bind$1) detect();
56192
- el[bind$1](prefix + type, fn, capture || false);
56193
- return fn;
56194
- };
56195
-
56196
- /**
56197
- * Unbind `el` event `type`'s callback `fn`.
56198
- *
56199
- * @param {Element} el
56200
- * @param {String} type
56201
- * @param {Function} fn
56202
- * @param {Boolean} capture
56203
- * @return {Function}
56204
- * @api public
56205
- */
56206
-
56207
- componentEvent.unbind = function (el, type, fn, capture) {
56208
- if (!unbind$1) detect();
56209
- el[unbind$1](prefix + type, fn, capture || false);
56210
- return fn;
56211
- };
56212
-
56213
56447
  /**
56214
56448
  * Expose `parse`.
56215
56449
  */
@@ -56748,6 +56982,15 @@
56748
56982
  '&.cm-editor.cm-focused': {
56749
56983
  outline: 'none'
56750
56984
  },
56985
+ '& .cm-completionInfo': {
56986
+ whiteSpace: 'pre-wrap',
56987
+ overflow: 'hidden',
56988
+ textOverflow: 'ellipsis'
56989
+ },
56990
+ // Don't wrap whitespace for custom HTML
56991
+ '& .cm-completionInfo > *': {
56992
+ whiteSpace: 'normal'
56993
+ },
56751
56994
  '& .cm-completionInfo ul': {
56752
56995
  margin: 0,
56753
56996
  paddingLeft: '15px'
@@ -57879,6 +58122,30 @@
57879
58122
  var DEFAULT_PRIORITY$2 = 1000;
57880
58123
  var slice = Array.prototype.slice;
57881
58124
 
58125
+ /**
58126
+ * @typedef { {
58127
+ * stopPropagation(): void;
58128
+ * preventDefault(): void;
58129
+ * cancelBubble: boolean;
58130
+ * defaultPrevented: boolean;
58131
+ * returnValue: any;
58132
+ * } } Event
58133
+ */
58134
+
58135
+ /**
58136
+ * @template E
58137
+ *
58138
+ * @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
58139
+ */
58140
+
58141
+ /**
58142
+ * @typedef { {
58143
+ * priority: number;
58144
+ * next: EventBusListener | null;
58145
+ * callback: EventBusEventCallback<any>;
58146
+ * } } EventBusListener
58147
+ */
58148
+
57882
58149
  /**
57883
58150
  * A general purpose event bus.
57884
58151
  *
@@ -57963,6 +58230,9 @@
57963
58230
  * ```
57964
58231
  */
57965
58232
  function EventBus() {
58233
+ /**
58234
+ * @type { Record<string, EventBusListener> }
58235
+ */
57966
58236
  this._listeners = {};
57967
58237
 
57968
58238
  // cleanup on destroy on lowest priority to allow
@@ -57982,10 +58252,12 @@
57982
58252
  *
57983
58253
  * Returning anything but `undefined` from a listener will stop the listener propagation.
57984
58254
  *
57985
- * @param {string|Array<string>} events
57986
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
57987
- * @param {Function} callback
57988
- * @param {Object} [that] Pass context (`this`) to the callback
58255
+ * @template T
58256
+ *
58257
+ * @param {string|string[]} events to subscribe to
58258
+ * @param {number} [priority=1000] listen priority
58259
+ * @param {EventBusEventCallback<T>} callback
58260
+ * @param {any} [that] callback context
57989
58261
  */
57990
58262
  EventBus.prototype.on = function (events, priority, callback, that) {
57991
58263
  events = isArray(events) ? events : [events];
@@ -58017,14 +58289,16 @@
58017
58289
  };
58018
58290
 
58019
58291
  /**
58020
- * Register an event listener that is executed only once.
58292
+ * Register an event listener that is called only once.
58021
58293
  *
58022
- * @param {string} event the event name to register for
58023
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
58024
- * @param {Function} callback the callback to execute
58025
- * @param {Object} [that] Pass context (`this`) to the callback
58294
+ * @template T
58295
+ *
58296
+ * @param {string|string[]} events to subscribe to
58297
+ * @param {number} [priority=1000] the listen priority
58298
+ * @param {EventBusEventCallback<T>} callback
58299
+ * @param {any} [that] callback context
58026
58300
  */
58027
- EventBus.prototype.once = function (event, priority, callback, that) {
58301
+ EventBus.prototype.once = function (events, priority, callback, that) {
58028
58302
  var self = this;
58029
58303
  if (isFunction(priority)) {
58030
58304
  that = callback;
@@ -58037,7 +58311,7 @@
58037
58311
  function wrappedCallback() {
58038
58312
  wrappedCallback.__isTomb = true;
58039
58313
  var result = callback.apply(that, arguments);
58040
- self.off(event, wrappedCallback);
58314
+ self.off(events, wrappedCallback);
58041
58315
  return result;
58042
58316
  }
58043
58317
 
@@ -58045,7 +58319,7 @@
58045
58319
  // bound callbacks via {@link #off} using the original
58046
58320
  // callback
58047
58321
  wrappedCallback[FN_REF] = callback;
58048
- this.on(event, priority, wrappedCallback);
58322
+ this.on(events, priority, wrappedCallback);
58049
58323
  };
58050
58324
 
58051
58325
  /**
@@ -58053,8 +58327,8 @@
58053
58327
  *
58054
58328
  * If no callback is given, all listeners for a given event name are being removed.
58055
58329
  *
58056
- * @param {string|Array<string>} events
58057
- * @param {Function} [callback]
58330
+ * @param {string|string[]} events
58331
+ * @param {EventBusEventCallback} [callback]
58058
58332
  */
58059
58333
  EventBus.prototype.off = function (events, callback) {
58060
58334
  events = isArray(events) ? events : [events];
@@ -58065,11 +58339,11 @@
58065
58339
  };
58066
58340
 
58067
58341
  /**
58068
- * Create an EventBus event.
58342
+ * Create an event recognized be the event bus.
58069
58343
  *
58070
- * @param {Object} data
58344
+ * @param {Object} data Event data.
58071
58345
  *
58072
- * @return {Object} event, recognized by the eventBus
58346
+ * @return {Event} An event that will be recognized by the event bus.
58073
58347
  */
58074
58348
  EventBus.prototype.createEvent = function (data) {
58075
58349
  var event = new InternalEvent();
@@ -58078,10 +58352,11 @@
58078
58352
  };
58079
58353
 
58080
58354
  /**
58081
- * Fires a named event.
58355
+ * Fires an event.
58082
58356
  *
58083
58357
  * @example
58084
58358
  *
58359
+ * ```javascript
58085
58360
  * // fire event by name
58086
58361
  * events.fire('foo');
58087
58362
  *
@@ -58099,13 +58374,13 @@
58099
58374
  * });
58100
58375
  *
58101
58376
  * events.fire({ type: 'foo' }, 'I am bar!');
58377
+ * ```
58102
58378
  *
58103
- * @param {string} [name] the optional event name
58104
- * @param {Object} [event] the event object
58105
- * @param {...Object} additional arguments to be passed to the callback functions
58379
+ * @param {string} [type] event type
58380
+ * @param {Object} [data] event or event data
58381
+ * @param {...any} [args] additional arguments the callback will be called with.
58106
58382
  *
58107
- * @return {boolean} the events return value, if specified or false if the
58108
- * default action was prevented by listeners
58383
+ * @return {any} The return value. Will be set to `false` if the default was prevented.
58109
58384
  */
58110
58385
  EventBus.prototype.fire = function (type, data) {
58111
58386
  var event, firstListener, returnValue, args;
@@ -58157,6 +58432,14 @@
58157
58432
  }
58158
58433
  return returnValue;
58159
58434
  };
58435
+
58436
+ /**
58437
+ * Handle an error by firing an event.
58438
+ *
58439
+ * @param {Error} error The error to be handled.
58440
+ *
58441
+ * @return {boolean} Whether the error was handled.
58442
+ */
58160
58443
  EventBus.prototype.handleError = function (error) {
58161
58444
  return this.fire('error', {
58162
58445
  error: error
@@ -58165,6 +58448,14 @@
58165
58448
  EventBus.prototype._destroy = function () {
58166
58449
  this._listeners = {};
58167
58450
  };
58451
+
58452
+ /**
58453
+ * @param {Event} event
58454
+ * @param {any[]} args
58455
+ * @param {EventBusListener} listener
58456
+ *
58457
+ * @return {any}
58458
+ */
58168
58459
  EventBus.prototype._invokeListeners = function (event, args, listener) {
58169
58460
  var returnValue;
58170
58461
  while (listener) {
@@ -58177,6 +58468,14 @@
58177
58468
  }
58178
58469
  return returnValue;
58179
58470
  };
58471
+
58472
+ /**
58473
+ * @param {Event} event
58474
+ * @param {any[]} args
58475
+ * @param {EventBusListener} listener
58476
+ *
58477
+ * @return {any}
58478
+ */
58180
58479
  EventBus.prototype._invokeListener = function (event, args, listener) {
58181
58480
  var returnValue;
58182
58481
  if (listener.callback.__isTomb) {
@@ -58205,7 +58504,7 @@
58205
58504
  return returnValue;
58206
58505
  };
58207
58506
 
58208
- /*
58507
+ /**
58209
58508
  * Add new listener with a certain priority to the list
58210
58509
  * of listeners (for the given event).
58211
58510
  *
@@ -58219,7 +58518,7 @@
58219
58518
  * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
58220
58519
  *
58221
58520
  * @param {string} event
58222
- * @param {Object} listener { priority, callback }
58521
+ * @param {EventBusListener} listener
58223
58522
  */
58224
58523
  EventBus.prototype._addListener = function (event, newListener) {
58225
58524
  var listener = this._getListeners(event),
@@ -58250,9 +58549,20 @@
58250
58549
  // add new listener to back
58251
58550
  previousListener.next = newListener;
58252
58551
  };
58552
+
58553
+ /**
58554
+ * @param {string} name
58555
+ *
58556
+ * @return {EventBusListener}
58557
+ */
58253
58558
  EventBus.prototype._getListeners = function (name) {
58254
58559
  return this._listeners[name];
58255
58560
  };
58561
+
58562
+ /**
58563
+ * @param {string} name
58564
+ * @param {EventBusListener} listener
58565
+ */
58256
58566
  EventBus.prototype._setListeners = function (name, listener) {
58257
58567
  this._listeners[name] = listener;
58258
58568
  };
@@ -58300,9 +58610,9 @@
58300
58610
  * Invoke function. Be fast...
58301
58611
  *
58302
58612
  * @param {Function} fn
58303
- * @param {Array<Object>} args
58613
+ * @param {any[]} args
58304
58614
  *
58305
- * @return {Any}
58615
+ * @return {any}
58306
58616
  */
58307
58617
  function invokeFunction(fn, args) {
58308
58618
  return fn.apply(null, args);
@@ -58343,21 +58653,24 @@
58343
58653
  if (!fieldDefinition) {
58344
58654
  throw new Error(`form field of type <${type}> not supported`);
58345
58655
  }
58656
+ const {
58657
+ config
58658
+ } = fieldDefinition;
58346
58659
  if (id && this._formFieldRegistry._ids.assigned(id)) {
58347
58660
  throw new Error(`ID <${id}> already assigned`);
58348
58661
  }
58349
58662
  if (key && this._formFieldRegistry._keys.assigned(key)) {
58350
58663
  throw new Error(`key <${key}> already assigned`);
58351
58664
  }
58352
- const labelAttrs = applyDefaults && fieldDefinition.label ? {
58353
- label: fieldDefinition.label
58665
+ const labelAttrs = applyDefaults && config.label ? {
58666
+ label: config.label
58354
58667
  } : {};
58355
- const field = fieldDefinition.create({
58668
+ const field = config.create({
58356
58669
  ...labelAttrs,
58357
58670
  ...attrs
58358
58671
  });
58359
58672
  this._ensureId(field);
58360
- if (fieldDefinition.keyed) {
58673
+ if (config.keyed) {
58361
58674
  this._ensureKey(field, applyDefaults);
58362
58675
  }
58363
58676
  return field;
@@ -58428,6 +58741,10 @@
58428
58741
  }
58429
58742
  }
58430
58743
  }
58744
+ const MAX_COLUMNS_PER_ROW = 16;
58745
+ const MAX_COLUMNS = 16;
58746
+ const MIN_COLUMNS = 2;
58747
+ const MAX_FIELDS_PER_ROW = 4;
58431
58748
  class FormLayoutValidator {
58432
58749
  /**
58433
58750
  * @constructor
@@ -58441,15 +58758,15 @@
58441
58758
  }
58442
58759
  validateField(field = {}, columns, row) {
58443
58760
  // allow empty (auto columns)
58444
- if (columns) {
58445
- // allow minimum 2 cols
58446
- if (columns < 2) {
58447
- return 'Minimum 2 columns are allowed';
58761
+ if (Number.isInteger(columns)) {
58762
+ // allow minimum cols
58763
+ if (columns < MIN_COLUMNS) {
58764
+ return `Minimum ${MIN_COLUMNS} columns are allowed`;
58448
58765
  }
58449
58766
 
58450
- // allow maximum 16 cols
58451
- if (columns > 16) {
58452
- return 'Maximum 16 columns are allowed';
58767
+ // allow maximum cols
58768
+ if (columns > MAX_COLUMNS) {
58769
+ return `Maximum ${MAX_COLUMNS} columns are allowed`;
58453
58770
  }
58454
58771
  }
58455
58772
  if (!row) {
@@ -58474,16 +58791,23 @@
58474
58791
  });
58475
58792
 
58476
58793
  // do not allow overflows
58477
- if (sumColumns > 16 || sumColumns === 16 && sumAutoCols > 0 || columns === 16 && sumFields > 1) {
58478
- return 'New value exceeds the maximum of 16 columns per row';
58794
+ if (sumColumns > MAX_COLUMNS_PER_ROW || sumAutoCols > 0 && sumColumns > calculateMaxColumnsWithAuto(sumAutoCols) || columns === MAX_COLUMNS_PER_ROW && sumFields > 1) {
58795
+ return `New value exceeds the maximum of ${MAX_COLUMNS_PER_ROW} columns per row`;
58479
58796
  }
58480
- if (sumFields > 4) {
58481
- return 'Maximum 4 fields per row are allowed';
58797
+ if (sumFields > MAX_FIELDS_PER_ROW) {
58798
+ return `Maximum ${MAX_FIELDS_PER_ROW} fields per row are allowed`;
58482
58799
  }
58483
58800
  return null;
58484
58801
  }
58485
58802
  }
58486
58803
  FormLayoutValidator.$inject = ['formLayouter', 'formFieldRegistry'];
58804
+
58805
+ // helper //////////////////////
58806
+
58807
+ // on normal screen sizes, auto columns take minimum 2 columns
58808
+ function calculateMaxColumnsWithAuto(autoCols) {
58809
+ return MAX_COLUMNS_PER_ROW - autoCols * 2;
58810
+ }
58487
58811
  class Importer {
58488
58812
  /**
58489
58813
  * @constructor
@@ -58597,6 +58921,91 @@
58597
58921
  'fjs-disabled': disabled
58598
58922
  });
58599
58923
  }
58924
+
58925
+ /**
58926
+ * Add a dragger that calls back the passed function with
58927
+ * { event, delta } on drag.
58928
+ *
58929
+ * @example
58930
+ *
58931
+ * function dragMove(event, delta) {
58932
+ * // we are dragging (!!)
58933
+ * }
58934
+ *
58935
+ * domElement.addEventListener('dragstart', dragger(dragMove));
58936
+ *
58937
+ * @param {Function} fn
58938
+ * @param {Element} dragPreview
58939
+ *
58940
+ * @return {Function} drag start callback function
58941
+ */
58942
+ function createDragger(fn, dragPreview) {
58943
+ let self;
58944
+ let startX, startY;
58945
+
58946
+ /** drag start */
58947
+ function onDragStart(event) {
58948
+ self = this;
58949
+ startX = event.clientX;
58950
+ startY = event.clientY;
58951
+
58952
+ // (1) prevent preview image
58953
+ if (event.dataTransfer) {
58954
+ event.dataTransfer.setDragImage(dragPreview, 0, 0);
58955
+ }
58956
+
58957
+ // (2) setup drag listeners
58958
+
58959
+ // attach drag + cleanup event
58960
+ document.addEventListener('dragover', onDrag);
58961
+ document.addEventListener('dragend', onEnd);
58962
+ document.addEventListener('drop', preventDefault);
58963
+ }
58964
+ function onDrag(event) {
58965
+ const delta = {
58966
+ x: event.clientX - startX,
58967
+ y: event.clientY - startY
58968
+ };
58969
+
58970
+ // call provided fn with event, delta
58971
+ return fn.call(self, event, delta);
58972
+ }
58973
+ function onEnd() {
58974
+ document.removeEventListener('dragover', onDrag);
58975
+ document.removeEventListener('dragend', onEnd);
58976
+ document.removeEventListener('drop', preventDefault);
58977
+ }
58978
+ return onDragStart;
58979
+ }
58980
+
58981
+ /**
58982
+ * Throttle function call according UI update cycle.
58983
+ *
58984
+ * @param {Function} fn
58985
+ *
58986
+ * @return {Function} throttled fn
58987
+ */
58988
+ function throttle(fn) {
58989
+ let active = false;
58990
+ let lastArgs = [];
58991
+ let lastThis = undefined;
58992
+ return function (...args) {
58993
+ lastArgs = args;
58994
+ lastThis = this;
58995
+ if (active) {
58996
+ return;
58997
+ }
58998
+ active = true;
58999
+ fn.apply(lastThis, lastArgs);
59000
+ window.requestAnimationFrame(function () {
59001
+ lastArgs = lastThis = active = undefined;
59002
+ });
59003
+ };
59004
+ }
59005
+ function preventDefault(event) {
59006
+ event.preventDefault();
59007
+ event.stopPropagation();
59008
+ }
58600
59009
  const DragAndDropContext = D$1({
58601
59010
  drake: null
58602
59011
  });
@@ -58660,10 +59069,54 @@
58660
59069
  };
58661
59070
  return _extends$2.apply(this, arguments);
58662
59071
  }
58663
- var DraggableIcon = ({
59072
+ var DeleteIcon$1 = ({
58664
59073
  styles = {},
58665
59074
  ...props
58666
59075
  }) => /*#__PURE__*/React.createElement("svg", _extends$2({
59076
+ xmlns: "http://www.w3.org/2000/svg",
59077
+ width: "16",
59078
+ height: "16",
59079
+ fill: "none"
59080
+ }, props), /*#__PURE__*/React.createElement("rect", {
59081
+ width: "16",
59082
+ height: "16",
59083
+ x: ".536",
59084
+ fill: "#fff",
59085
+ rx: "3",
59086
+ style: {
59087
+ mixBlendMode: "multiply"
59088
+ }
59089
+ }), /*#__PURE__*/React.createElement("path", {
59090
+ fill: "#fff",
59091
+ d: "M.536 0h16v16h-16z",
59092
+ style: {
59093
+ mixBlendMode: "multiply"
59094
+ }
59095
+ }), /*#__PURE__*/React.createElement("path", {
59096
+ fill: "currentcolor",
59097
+ d: "M7.536 6h-1v6h1V6zm3 0h-1v6h1V6z"
59098
+ }), /*#__PURE__*/React.createElement("path", {
59099
+ fill: "currentcolor",
59100
+ d: "M2.536 3v1h1v10a1 1 0 001 1h8a1 1 0 001-1V4h1V3h-12zm2 11V4h8v10h-8zm6-13h-4v1h4V1z"
59101
+ }));
59102
+ function _extends$1() {
59103
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
59104
+ for (var i = 1; i < arguments.length; i++) {
59105
+ var source = arguments[i];
59106
+ for (var key in source) {
59107
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
59108
+ target[key] = source[key];
59109
+ }
59110
+ }
59111
+ }
59112
+ return target;
59113
+ };
59114
+ return _extends$1.apply(this, arguments);
59115
+ }
59116
+ var DraggableIcon = ({
59117
+ styles = {},
59118
+ ...props
59119
+ }) => /*#__PURE__*/React.createElement("svg", _extends$1({
58667
59120
  xmlns: "http://www.w3.org/2000/svg",
58668
59121
  width: "16",
58669
59122
  height: "16",
@@ -58675,8 +59128,8 @@
58675
59128
  d: "M0 0h32v32H0z",
58676
59129
  fill: "none"
58677
59130
  }));
58678
- function _extends$1() {
58679
- _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
59131
+ function _extends() {
59132
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
58680
59133
  for (var i = 1; i < arguments.length; i++) {
58681
59134
  var source = arguments[i];
58682
59135
  for (var key in source) {
@@ -58687,12 +59140,12 @@
58687
59140
  }
58688
59141
  return target;
58689
59142
  };
58690
- return _extends$1.apply(this, arguments);
59143
+ return _extends.apply(this, arguments);
58691
59144
  }
58692
59145
  var SearchIcon = ({
58693
59146
  styles = {},
58694
59147
  ...props
58695
- }) => /*#__PURE__*/React.createElement("svg", _extends$1({
59148
+ }) => /*#__PURE__*/React.createElement("svg", _extends({
58696
59149
  width: "15",
58697
59150
  height: "15",
58698
59151
  fill: "none",
@@ -58747,47 +59200,25 @@
58747
59200
  disableLinks: true
58748
59201
  });
58749
59202
  }
58750
- EditorText.create = Text$1.create;
58751
- EditorText.type = Text$1.type;
58752
- EditorText.keyed = Text$1.keyed;
59203
+ EditorText.config = Text$1.config;
58753
59204
  const editorFormFields = [EditorText];
58754
59205
  class EditorFormFields extends FormFields {
58755
59206
  constructor() {
58756
59207
  super();
58757
59208
  editorFormFields.forEach(formField => {
58758
- this.register(formField.type, formField);
59209
+ this.register(formField.config.type, formField);
58759
59210
  });
58760
59211
  }
58761
59212
  }
58762
- function _extends() {
58763
- _extends = Object.assign ? Object.assign.bind() : function (target) {
58764
- for (var i = 1; i < arguments.length; i++) {
58765
- var source = arguments[i];
58766
- for (var key in source) {
58767
- if (Object.prototype.hasOwnProperty.call(source, key)) {
58768
- target[key] = source[key];
58769
- }
58770
- }
58771
- }
58772
- return target;
58773
- };
58774
- return _extends.apply(this, arguments);
58775
- }
58776
- var ListDeleteIcon = ({
58777
- styles = {},
58778
- ...props
58779
- }) => /*#__PURE__*/React.createElement("svg", _extends({
58780
- xmlns: "http://www.w3.org/2000/svg",
58781
- width: "11",
58782
- height: "14"
58783
- }, props), /*#__PURE__*/React.createElement("path", {
58784
- 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"
58785
- }));
58786
- const PALETTE_ENTRIES = formFields.filter(f => f.type !== 'default').map(f => {
59213
+ const PALETTE_ENTRIES = formFields.filter(({
59214
+ config: fieldConfig
59215
+ }) => fieldConfig.type !== 'default').map(({
59216
+ config: fieldConfig
59217
+ }) => {
58787
59218
  return {
58788
- label: f.label,
58789
- type: f.type,
58790
- group: f.group
59219
+ label: fieldConfig.label,
59220
+ type: fieldConfig.type,
59221
+ group: fieldConfig.group
58791
59222
  };
58792
59223
  });
58793
59224
  const PALETTE_GROUPS = [{
@@ -58808,19 +59239,24 @@
58808
59239
  const [searchTerm, setSearchTerm] = l$2('');
58809
59240
  const inputRef = s$1();
58810
59241
  const groups = groupEntries(entries);
59242
+ const simplifyString = A$1(str => {
59243
+ return str.toLowerCase().replace(/\s+/g, '');
59244
+ }, []);
59245
+ const filter = A$1(entry => {
59246
+ const simplifiedSearchTerm = simplifyString(searchTerm);
59247
+ if (!simplifiedSearchTerm) {
59248
+ return true;
59249
+ }
59250
+ const simplifiedEntryLabel = simplifyString(entry.label);
59251
+ const simplifiedEntryType = simplifyString(entry.type);
59252
+ return simplifiedEntryLabel.includes(simplifiedSearchTerm) || simplifiedEntryType.includes(simplifiedSearchTerm);
59253
+ }, [searchTerm, simplifyString]);
58811
59254
 
58812
59255
  // filter entries on search change
58813
59256
  y(() => {
58814
- const filter = entry => {
58815
- if (!searchTerm) {
58816
- return true;
58817
- }
58818
- const search = entry.label.toLowerCase();
58819
- return searchTerm.toLowerCase().split(/\s/g).every(term => search.includes(term));
58820
- };
58821
59257
  const entries = PALETTE_ENTRIES.filter(filter);
58822
59258
  setEntries(entries);
58823
- }, [searchTerm]);
59259
+ }, [filter, searchTerm]);
58824
59260
  const handleInput = A$1(event => {
58825
59261
  setSearchTerm(() => event.target.value);
58826
59262
  }, [setSearchTerm]);
@@ -59229,6 +59665,135 @@
59229
59665
  })]
59230
59666
  });
59231
59667
  }
59668
+ const COLUMNS_REGEX = /^cds--col(-lg)?/;
59669
+ const ELEMENT_RESIZING_CLS = 'fjs-element-resizing';
59670
+ const RESIZE_DRAG_PREVIEW_CLS = 'fjs-resize-drag-preview';
59671
+ const GRID_OFFSET_PX = 16;
59672
+ function FieldResizer(props) {
59673
+ const {
59674
+ field,
59675
+ position
59676
+ } = props;
59677
+ const ref = s$1(null);
59678
+ const formLayoutValidator = useService$1('formLayoutValidator');
59679
+ const modeling = useService$1('modeling');
59680
+
59681
+ // we can't use state as we need to
59682
+ // manipulate this inside dragging events
59683
+ const context = s$1({
59684
+ startColumns: 0,
59685
+ newColumns: 0
59686
+ });
59687
+ const onResize = throttle((_, delta) => {
59688
+ const {
59689
+ x: dx
59690
+ } = delta;
59691
+ const {
59692
+ layout = {}
59693
+ } = field;
59694
+ const newColumns = calculateNewColumns(ref.current, layout.columns || context.current.startColumns, dx, position);
59695
+ const errorMessage = formLayoutValidator.validateField(field, newColumns);
59696
+ if (!errorMessage) {
59697
+ context.current.newColumns = newColumns;
59698
+
59699
+ // make visual updates to preview change
59700
+ const columnNode = ref.current.closest('.fjs-layout-column');
59701
+ removeMatching(columnNode, COLUMNS_REGEX);
59702
+ columnNode.classList.add(`cds--col-lg-${newColumns}`);
59703
+ }
59704
+ });
59705
+ const onResizeStart = event => {
59706
+ const target = getElementNode(field);
59707
+ const parent = getParent(target);
59708
+
59709
+ // create a blank element to use as drag preview
59710
+ // ensure it was only created once
59711
+ let blankPreview = getDragPreviewImage(parent);
59712
+ if (!blankPreview) {
59713
+ blankPreview = document.createElement('div');
59714
+ blankPreview.classList.add(RESIZE_DRAG_PREVIEW_CLS);
59715
+ parent.appendChild(blankPreview);
59716
+ }
59717
+
59718
+ // initialize drag handler
59719
+ const onDragStart = createDragger(onResize, blankPreview);
59720
+ onDragStart(event);
59721
+
59722
+ // mitigate auto columns on the grid that
59723
+ // has a offset of 16px (1rem) to both side
59724
+ const columnNode = getColumnNode(target);
59725
+ const startWidth = columnNode.getBoundingClientRect().width + GRID_OFFSET_PX;
59726
+ context.current.startColumns = asColumns(startWidth, parent);
59727
+ setResizing(target, position);
59728
+ };
59729
+ const onResizeEnd = () => {
59730
+ const {
59731
+ layout = {}
59732
+ } = field;
59733
+ if (context.current.newColumns) {
59734
+ modeling.editFormField(field, 'layout', {
59735
+ ...layout,
59736
+ columns: context.current.newColumns
59737
+ });
59738
+ }
59739
+ const target = getElementNode(field);
59740
+ unsetResizing(target, position);
59741
+ context.current.newColumns = null;
59742
+
59743
+ // remove blank preview
59744
+ const blankPreview = getDragPreviewImage(getParent(target));
59745
+ blankPreview.remove();
59746
+ };
59747
+ if (field.type === 'default') {
59748
+ return null;
59749
+ }
59750
+ return e$1("div", {
59751
+ ref: ref,
59752
+ class: classNames('fjs-field-resize-handle', 'fjs-field-resize-handle-' + position, DRAG_NO_MOVE_CLS),
59753
+ draggable: true,
59754
+ onDragStart: onResizeStart,
59755
+ onDragEnd: onResizeEnd
59756
+ });
59757
+ }
59758
+
59759
+ // helper //////
59760
+
59761
+ function asColumns(width, parent) {
59762
+ const totalWidth = parent.getBoundingClientRect().width;
59763
+ const oneColumn = 1 / 16 * totalWidth;
59764
+ return Math.round(width / oneColumn);
59765
+ }
59766
+ function calculateNewColumns(node, currentColumns, deltaX, position) {
59767
+ const parent = getParent(node);
59768
+
59769
+ // invert delta if we are resizing from the left
59770
+ if (position === 'left') {
59771
+ deltaX = deltaX * -1;
59772
+ }
59773
+ const deltaColumns = asColumns(deltaX, parent);
59774
+ return currentColumns + deltaColumns;
59775
+ }
59776
+ function getParent(node) {
59777
+ return node.closest('.fjs-layout-row');
59778
+ }
59779
+ function removeMatching(node, regex) {
59780
+ return classes(node).removeMatching(regex);
59781
+ }
59782
+ function getColumnNode(node) {
59783
+ return node.closest('.fjs-layout-column');
59784
+ }
59785
+ function getElementNode(field) {
59786
+ return query('.fjs-element[data-id="' + field.id + '"]');
59787
+ }
59788
+ function getDragPreviewImage(node) {
59789
+ return query('.fjs-resize-drag-preview', node);
59790
+ }
59791
+ function setResizing(node, position) {
59792
+ classes(node).add(ELEMENT_RESIZING_CLS + '-' + position);
59793
+ }
59794
+ function unsetResizing(node, position) {
59795
+ classes(node).remove(ELEMENT_RESIZING_CLS + '-' + position);
59796
+ }
59232
59797
  function ContextPad(props) {
59233
59798
  if (!props.children) {
59234
59799
  return null;
@@ -59241,7 +59806,7 @@
59241
59806
  function Empty(props) {
59242
59807
  return null;
59243
59808
  }
59244
- function Element$1(props) {
59809
+ function Element(props) {
59245
59810
  const eventBus = useService$1('eventBus'),
59246
59811
  formEditor = useService$1('formEditor'),
59247
59812
  formFieldRegistry = useService$1('formFieldRegistry'),
@@ -59271,9 +59836,17 @@
59271
59836
  eventBus.on('selection.changed', scrollIntoView);
59272
59837
  return () => eventBus.off('selection.changed', scrollIntoView);
59273
59838
  }, [id]);
59839
+ h(() => {
59840
+ if (selection.isSelected(field)) {
59841
+ ref.current.focus();
59842
+ }
59843
+ }, [selection, field]);
59274
59844
  function onClick(event) {
59275
59845
  event.stopPropagation();
59276
59846
  selection.toggle(field);
59847
+
59848
+ // properly focus on field
59849
+ ref.current.focus();
59277
59850
  }
59278
59851
  const classes = [];
59279
59852
  if (props.class) {
@@ -59288,11 +59861,19 @@
59288
59861
  const index = getFormFieldIndex(parentField, field);
59289
59862
  modeling.removeFormField(field, parentField, index);
59290
59863
  };
59864
+ const onKeyPress = event => {
59865
+ if (event.key === 'Enter') {
59866
+ event.stopPropagation();
59867
+ selection.toggle(field);
59868
+ }
59869
+ };
59291
59870
  return e$1("div", {
59292
59871
  class: classes.join(' '),
59293
59872
  "data-id": id,
59294
59873
  "data-field-type": type,
59874
+ tabIndex: type === 'default' ? -1 : 0,
59295
59875
  onClick: onClick,
59876
+ onKeyPress: onKeyPress,
59296
59877
  ref: ref,
59297
59878
  children: [e$1(DebugColumns, {
59298
59879
  field: field
@@ -59300,9 +59881,15 @@
59300
59881
  children: selection.isSelected(field) && field.type !== 'default' ? e$1("button", {
59301
59882
  class: "fjs-context-pad-item",
59302
59883
  onClick: onRemove,
59303
- children: e$1(ListDeleteIcon, {})
59884
+ children: e$1(DeleteIcon$1, {})
59304
59885
  }) : null
59305
- }), props.children]
59886
+ }), props.children, e$1(FieldResizer, {
59887
+ position: "left",
59888
+ field: field
59889
+ }), e$1(FieldResizer, {
59890
+ position: "right",
59891
+ field: field
59892
+ })]
59306
59893
  });
59307
59894
  }
59308
59895
  function DebugColumns(props) {
@@ -59387,8 +59974,12 @@
59387
59974
  propertiesPanel = useService$1('propertiesPanel'),
59388
59975
  propertiesPanelConfig = useService$1('config.propertiesPanel');
59389
59976
  const {
59390
- schema
59977
+ schema,
59978
+ properties
59391
59979
  } = formEditor._getState();
59980
+ const {
59981
+ ariaLabel
59982
+ } = properties;
59392
59983
  const formContainerRef = s$1(null);
59393
59984
  const paletteRef = s$1(null);
59394
59985
  const propertiesPanelRef = s$1(null);
@@ -59460,7 +60051,7 @@
59460
60051
  const formRenderContext = {
59461
60052
  Children,
59462
60053
  Column,
59463
- Element: Element$1,
60054
+ Element,
59464
60055
  Empty,
59465
60056
  Row
59466
60057
  };
@@ -59474,7 +60065,8 @@
59474
60065
  data: {},
59475
60066
  errors: {},
59476
60067
  properties: {
59477
- readOnly: true
60068
+ ariaLabel,
60069
+ disabled: true
59478
60070
  },
59479
60071
  schema
59480
60072
  };
@@ -59656,6 +60248,13 @@
59656
60248
  formLayoutValidator: ['type', FormLayoutValidator],
59657
60249
  fieldFactory: ['type', FieldFactory]
59658
60250
  };
60251
+
60252
+ /**
60253
+ * @typedef {import('didi').Injector} Injector
60254
+ *
60255
+ * @typedef {import('../../core/EventBus').default} EventBus
60256
+ */
60257
+
59659
60258
  var NOT_REGISTERED_ERROR = 'is not a registered action',
59660
60259
  IS_REGISTERED_ERROR = 'is already registered';
59661
60260
 
@@ -59785,10 +60384,10 @@
59785
60384
  /**
59786
60385
  * Triggers a registered action
59787
60386
  *
59788
- * @param {string} action
59789
- * @param {Object} opts
60387
+ * @param {string} action
60388
+ * @param {Object} opts
59790
60389
  *
59791
- * @return {Unknown} Returns what the registered listener returns
60390
+ * @return {unknown} Returns what the registered listener returns
59792
60391
  */
59793
60392
  EditorActions.prototype.trigger = function (action, opts) {
59794
60393
  if (!this._actions[action]) {
@@ -59817,7 +60416,7 @@
59817
60416
  * editorActions.isRegistered('spaceTool'); // true
59818
60417
  * ´´´
59819
60418
  *
59820
- * @param {Object} actions
60419
+ * @param {Object} actions
59821
60420
  */
59822
60421
  EditorActions.prototype.register = function (actions, listener) {
59823
60422
  var self = this;
@@ -59832,8 +60431,8 @@
59832
60431
  /**
59833
60432
  * Registers a listener to an action key
59834
60433
  *
59835
- * @param {string} action
59836
- * @param {Function} listener
60434
+ * @param {string} action
60435
+ * @param {Function} listener
59837
60436
  */
59838
60437
  EditorActions.prototype._registerAction = function (action, listener) {
59839
60438
  if (this.isRegistered(action)) {
@@ -59876,6 +60475,10 @@
59876
60475
  function error(action, message) {
59877
60476
  return new Error(action + ' ' + message);
59878
60477
  }
60478
+
60479
+ /**
60480
+ * @type { import('didi').ModuleDeclaration }
60481
+ */
59879
60482
  var EditorActionsModule$1 = {
59880
60483
  __init__: ['editorActions'],
59881
60484
  editorActions: ['type', EditorActions]
@@ -59931,10 +60534,10 @@
59931
60534
  __init__: ['dragging'],
59932
60535
  dragging: ['type', Dragging]
59933
60536
  };
59934
- var KEYS_COPY = ['c', 'C', 'KeyC'];
59935
- var KEYS_PASTE = ['v', 'V', 'KeyV'];
59936
- var KEYS_REDO$1 = ['y', 'Y', 'KeyY'];
59937
- var KEYS_UNDO$1 = ['z', 'Z', 'KeyZ'];
60537
+ var KEYS_COPY = ['c', 'C'];
60538
+ var KEYS_PASTE = ['v', 'V'];
60539
+ var KEYS_REDO = ['y', 'Y'];
60540
+ var KEYS_UNDO = ['z', 'Z'];
59938
60541
 
59939
60542
  /**
59940
60543
  * Returns true if event was triggered with any modifier
@@ -59959,7 +60562,7 @@
59959
60562
  /**
59960
60563
  * Checks if key pressed is one of provided keys.
59961
60564
  *
59962
- * @param {string|Array<string>} keys
60565
+ * @param {string|string[]} keys
59963
60566
  * @param {KeyboardEvent} event
59964
60567
  */
59965
60568
  function isKey(keys, event) {
@@ -59980,11 +60583,16 @@
59980
60583
  return isCmd(event) && isKey(KEYS_PASTE, event);
59981
60584
  }
59982
60585
  function isUndo(event) {
59983
- return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO$1, event);
60586
+ return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
59984
60587
  }
59985
60588
  function isRedo(event) {
59986
- return isCmd(event) && (isKey(KEYS_REDO$1, event) || isKey(KEYS_UNDO$1, event) && isShift(event));
60589
+ return isCmd(event) && (isKey(KEYS_REDO, event) || isKey(KEYS_UNDO, event) && isShift(event));
59987
60590
  }
60591
+
60592
+ /**
60593
+ * @typedef {import('../../core/EventBus').default} EventBus
60594
+ */
60595
+
59988
60596
  var KEYDOWN_EVENT = 'keyboard.keydown',
59989
60597
  KEYUP_EVENT = 'keyboard.keyup';
59990
60598
  var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
@@ -60011,7 +60619,7 @@
60011
60619
  * A default binding for the keyboard may be specified via the
60012
60620
  * `keyboard.bindTo` configuration option.
60013
60621
  *
60014
- * @param {Config} config
60622
+ * @param {Object} config
60015
60623
  * @param {EventBus} eventBus
60016
60624
  */
60017
60625
  function Keyboard(config, eventBus) {
@@ -60139,8 +60747,6 @@
60139
60747
  return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
60140
60748
  }
60141
60749
  var LOW_PRIORITY$1 = 500;
60142
- var KEYS_REDO = ['y', 'Y', 'KeyY'];
60143
- var KEYS_UNDO = ['z', 'Z', 'KeyZ'];
60144
60750
 
60145
60751
  /**
60146
60752
  * Adds default keyboard bindings.
@@ -60270,6 +60876,10 @@
60270
60876
  }
60271
60877
  });
60272
60878
  };
60879
+
60880
+ /**
60881
+ * @type { import('didi').ModuleDeclaration }
60882
+ */
60273
60883
  var KeyboardModule$1 = {
60274
60884
  __init__: ['keyboard', 'keyboardBindings'],
60275
60885
  keyboard: ['type', Keyboard],
@@ -60794,32 +61404,47 @@
60794
61404
  }
60795
61405
  }
60796
61406
  Modeling.$inject = ['commandStack', 'eventBus', 'formEditor', 'formFieldRegistry', 'fieldFactory'];
61407
+
61408
+ /**
61409
+ * @typedef {import('../core/Types').ElementLike} ElementLike
61410
+ * @typedef {import('../core/EventBus').default} EventBus
61411
+ * @typedef {import('./CommandStack').CommandContext} CommandContext
61412
+ *
61413
+ * @typedef {string|string[]} Events
61414
+ * @typedef { (context: CommandContext) => ElementLike[] | void } HandlerFunction
61415
+ * @typedef { (context: CommandContext) => void } ComposeHandlerFunction
61416
+ */
61417
+
60797
61418
  var DEFAULT_PRIORITY = 1000;
60798
61419
 
60799
61420
  /**
60800
- * A utility that can be used to plug-in into the command execution for
61421
+ * A utility that can be used to plug into the command execution for
60801
61422
  * extension and/or validation.
60802
61423
  *
60803
- * @param {EventBus} eventBus
61424
+ * @class
61425
+ * @constructor
60804
61426
  *
60805
61427
  * @example
60806
61428
  *
60807
- * import inherits from 'inherits-browser';
60808
- *
61429
+ * ```javascript
60809
61430
  * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
60810
61431
  *
60811
- * function CommandLogger(eventBus) {
60812
- * CommandInterceptor.call(this, eventBus);
61432
+ * class CommandLogger extends CommandInterceptor {
61433
+ * constructor(eventBus) {
61434
+ * super(eventBus);
60813
61435
  *
60814
- * this.preExecute(function(event) {
60815
- * console.log('command pre-execute', event);
61436
+ * this.preExecute('shape.create', (event) => {
61437
+ * console.log('commandStack.shape-create.preExecute', event);
60816
61438
  * });
60817
61439
  * }
61440
+ * ```
60818
61441
  *
60819
- * inherits(CommandLogger, CommandInterceptor);
60820
- *
61442
+ * @param {EventBus} eventBus
60821
61443
  */
60822
61444
  function CommandInterceptor(eventBus) {
61445
+ /**
61446
+ * @type {EventBus}
61447
+ */
60823
61448
  this._eventBus = eventBus;
60824
61449
  }
60825
61450
  CommandInterceptor.$inject = ['eventBus'];
@@ -60830,15 +61455,14 @@
60830
61455
  }
60831
61456
 
60832
61457
  /**
60833
- * Register an interceptor for a command execution
61458
+ * Intercept a command during one of the phases.
60834
61459
  *
60835
- * @param {string|Array<string>} [events] list of commands to register on
60836
- * @param {string} [hook] command hook, i.e. preExecute, executed to listen on
60837
- * @param {number} [priority] the priority on which to hook into the execution
60838
- * @param {Function} handlerFn interceptor to be invoked with (event)
60839
- * @param {boolean} unwrap if true, unwrap the event and pass (context, command, event) to the
60840
- * listener instead
60841
- * @param {Object} [that] Pass context (`this`) to the handler function
61460
+ * @param {Events} [events] command(s) to intercept
61461
+ * @param {string} [hook] phase to intercept
61462
+ * @param {number} [priority]
61463
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61464
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61465
+ * @param {any} [that]
60842
61466
  */
60843
61467
  CommandInterceptor.prototype.on = function (events, hook, priority, handlerFn, unwrap, that) {
60844
61468
  if (isFunction(hook) || isNumber(hook)) {
@@ -60873,28 +61497,130 @@
60873
61497
  eventBus.on(fullEvent, priority, unwrap ? unwrapEvent(handlerFn, that) : handlerFn, that);
60874
61498
  });
60875
61499
  };
60876
- var hooks = ['canExecute', 'preExecute', 'preExecuted', 'execute', 'executed', 'postExecute', 'postExecuted', 'revert', 'reverted'];
61500
+
61501
+ /**
61502
+ * Add a <canExecute> phase of command interceptor.
61503
+ *
61504
+ * @param {Events} [events] command(s) to intercept
61505
+ * @param {number} [priority]
61506
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61507
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61508
+ * @param {any} [that]
61509
+ */
61510
+ CommandInterceptor.prototype.canExecute = createHook('canExecute');
61511
+
61512
+ /**
61513
+ * Add a <preExecute> phase of command interceptor.
61514
+ *
61515
+ * @param {Events} [events] command(s) to intercept
61516
+ * @param {number} [priority]
61517
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61518
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61519
+ * @param {any} [that]
61520
+ */
61521
+ CommandInterceptor.prototype.preExecute = createHook('preExecute');
61522
+
61523
+ /**
61524
+ * Add a <preExecuted> phase of command interceptor.
61525
+ *
61526
+ * @param {Events} [events] command(s) to intercept
61527
+ * @param {number} [priority]
61528
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61529
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61530
+ * @param {any} [that]
61531
+ */
61532
+ CommandInterceptor.prototype.preExecuted = createHook('preExecuted');
61533
+
61534
+ /**
61535
+ * Add a <execute> phase of command interceptor.
61536
+ *
61537
+ * @param {Events} [events] command(s) to intercept
61538
+ * @param {number} [priority]
61539
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61540
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61541
+ * @param {any} [that]
61542
+ */
61543
+ CommandInterceptor.prototype.execute = createHook('execute');
61544
+
61545
+ /**
61546
+ * Add a <executed> phase of command interceptor.
61547
+ *
61548
+ * @param {Events} [events] command(s) to intercept
61549
+ * @param {number} [priority]
61550
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61551
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61552
+ * @param {any} [that]
61553
+ */
61554
+ CommandInterceptor.prototype.executed = createHook('executed');
61555
+
61556
+ /**
61557
+ * Add a <postExecute> phase of command interceptor.
61558
+ *
61559
+ * @param {Events} [events] command(s) to intercept
61560
+ * @param {number} [priority]
61561
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61562
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61563
+ * @param {any} [that]
61564
+ */
61565
+ CommandInterceptor.prototype.postExecute = createHook('postExecute');
61566
+
61567
+ /**
61568
+ * Add a <postExecuted> phase of command interceptor.
61569
+ *
61570
+ * @param {Events} [events] command(s) to intercept
61571
+ * @param {number} [priority]
61572
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61573
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61574
+ * @param {any} [that]
61575
+ */
61576
+ CommandInterceptor.prototype.postExecuted = createHook('postExecuted');
61577
+
61578
+ /**
61579
+ * Add a <revert> phase of command interceptor.
61580
+ *
61581
+ * @param {Events} [events] command(s) to intercept
61582
+ * @param {number} [priority]
61583
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61584
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61585
+ * @param {any} [that]
61586
+ */
61587
+ CommandInterceptor.prototype.revert = createHook('revert');
61588
+
61589
+ /**
61590
+ * Add a <reverted> phase of command interceptor.
61591
+ *
61592
+ * @param {Events} [events] command(s) to intercept
61593
+ * @param {number} [priority]
61594
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61595
+ * @param {boolean} [unwrap] whether the event should be unwrapped
61596
+ * @param {any} [that]
61597
+ */
61598
+ CommandInterceptor.prototype.reverted = createHook('reverted');
60877
61599
 
60878
61600
  /*
60879
- * Install hook shortcuts
61601
+ * Add prototype methods for each phase of command execution (e.g. execute,
61602
+ * revert).
61603
+ *
61604
+ * @param {string} hook
60880
61605
  *
60881
- * This will generate the CommandInterceptor#(preExecute|...|reverted) methods
60882
- * which will in term forward to CommandInterceptor#on.
61606
+ * @return { (
61607
+ * events?: Events,
61608
+ * priority?: number,
61609
+ * handlerFn: ComposeHandlerFunction|HandlerFunction,
61610
+ * unwrap?: boolean
61611
+ * ) => any }
60883
61612
  */
60884
- forEach(hooks, function (hook) {
61613
+ function createHook(hook) {
60885
61614
  /**
60886
- * {canExecute|preExecute|preExecuted|execute|executed|postExecute|postExecuted|revert|reverted}
60887
- *
60888
- * A named hook for plugging into the command execution
61615
+ * @this {CommandInterceptor}
60889
61616
  *
60890
- * @param {string|Array<string>} [events] list of commands to register on
60891
- * @param {number} [priority] the priority on which to hook into the execution
60892
- * @param {Function} handlerFn interceptor to be invoked with (event)
60893
- * @param {boolean} [unwrap=false] if true, unwrap the event and pass (context, command, event) to the
60894
- * listener instead
60895
- * @param {Object} [that] Pass context (`this`) to the handler function
61617
+ * @param {Events} [events]
61618
+ * @param {number} [priority]
61619
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
61620
+ * @param {boolean} [unwrap]
61621
+ * @param {any} [that]
60896
61622
  */
60897
- CommandInterceptor.prototype[hook] = function (events, priority, handlerFn, unwrap, that) {
61623
+ const hookFn = function (events, priority, handlerFn, unwrap, that) {
60898
61624
  if (isFunction(events) || isNumber(events)) {
60899
61625
  that = unwrap;
60900
61626
  unwrap = handlerFn;
@@ -60904,7 +61630,8 @@
60904
61630
  }
60905
61631
  this.on(events, hook, priority, handlerFn, unwrap, that);
60906
61632
  };
60907
- });
61633
+ return hookFn;
61634
+ }
60908
61635
  class FormLayoutUpdater extends CommandInterceptor {
60909
61636
  constructor(eventBus, formLayouter, modeling, formEditor) {
60910
61637
  super(eventBus);
@@ -61037,6 +61764,34 @@
61037
61764
  validateBehavior: ['type', ValidateBehavior]
61038
61765
  };
61039
61766
 
61767
+ /**
61768
+ * @typedef {import('didi').Injector} Injector
61769
+ *
61770
+ * @typedef {import('../core/Types').ElementLike} ElementLike
61771
+ *
61772
+ * @typedef {import('../core/EventBus').default} EventBus
61773
+ * @typedef {import('./CommandHandler').default} CommandHandler
61774
+ *
61775
+ * @typedef { any } CommandContext
61776
+ * @typedef { {
61777
+ * new (...args: any[]) : CommandHandler
61778
+ * } } CommandHandlerConstructor
61779
+ * @typedef { {
61780
+ * [key: string]: CommandHandler;
61781
+ * } } CommandHandlerMap
61782
+ * @typedef { {
61783
+ * command: string;
61784
+ * context: any;
61785
+ * id?: any;
61786
+ * } } CommandStackAction
61787
+ * @typedef { {
61788
+ * actions: CommandStackAction[];
61789
+ * dirty: ElementLike[];
61790
+ * trigger: 'execute' | 'undo' | 'redo' | 'clear' | null;
61791
+ * atomic?: boolean;
61792
+ * } } CurrentExecution
61793
+ */
61794
+
61040
61795
  /**
61041
61796
  * A service that offers un- and redoable execution of commands.
61042
61797
  *
@@ -61087,7 +61842,7 @@
61087
61842
  * got changed during the `execute` and `revert` operations.
61088
61843
  *
61089
61844
  * Command handlers may execute other modeling operations (and thus
61090
- * commands) in their `preExecute` and `postExecute` phases. The command
61845
+ * commands) in their `preExecute(d)` and `postExecute(d)` phases. The command
61091
61846
  * stack will properly group all commands together into a logical unit
61092
61847
  * that may be re- and undone atomically.
61093
61848
  *
@@ -61117,14 +61872,14 @@
61117
61872
  /**
61118
61873
  * A map of all registered command handlers.
61119
61874
  *
61120
- * @type {Object}
61875
+ * @type {CommandHandlerMap}
61121
61876
  */
61122
61877
  this._handlerMap = {};
61123
61878
 
61124
61879
  /**
61125
61880
  * A stack containing all re/undoable actions on the diagram
61126
61881
  *
61127
- * @type {Array<Object>}
61882
+ * @type {CommandStackAction[]}
61128
61883
  */
61129
61884
  this._stack = [];
61130
61885
 
@@ -61138,18 +61893,27 @@
61138
61893
  /**
61139
61894
  * Current active commandStack execution
61140
61895
  *
61141
- * @type {Object}
61142
- * @property {Object[]} actions
61143
- * @property {Object[]} dirty
61144
- * @property { 'undo' | 'redo' | 'clear' | 'execute' | null } trigger the cause of the current excecution
61896
+ * @type {CurrentExecution}
61145
61897
  */
61146
61898
  this._currentExecution = {
61147
61899
  actions: [],
61148
61900
  dirty: [],
61149
61901
  trigger: null
61150
61902
  };
61903
+
61904
+ /**
61905
+ * @type {Injector}
61906
+ */
61151
61907
  this._injector = injector;
61908
+
61909
+ /**
61910
+ * @type EventBus
61911
+ */
61152
61912
  this._eventBus = eventBus;
61913
+
61914
+ /**
61915
+ * @type { number }
61916
+ */
61153
61917
  this._uid = 1;
61154
61918
  eventBus.on(['diagram.destroy', 'diagram.clear'], function () {
61155
61919
  this.clear(false);
@@ -61158,10 +61922,10 @@
61158
61922
  CommandStack.$inject = ['eventBus', 'injector'];
61159
61923
 
61160
61924
  /**
61161
- * Execute a command
61925
+ * Execute a command.
61162
61926
  *
61163
- * @param {string} command the command to execute
61164
- * @param {Object} context the environment to execute the command in
61927
+ * @param {string} command The command to execute.
61928
+ * @param {CommandContext} context The context with which to execute the command.
61165
61929
  */
61166
61930
  CommandStack.prototype.execute = function (command, context) {
61167
61931
  if (!command) {
@@ -61174,11 +61938,11 @@
61174
61938
  };
61175
61939
  this._pushAction(action);
61176
61940
  this._internalExecute(action);
61177
- this._popAction(action);
61941
+ this._popAction();
61178
61942
  };
61179
61943
 
61180
61944
  /**
61181
- * Ask whether a given command can be executed.
61945
+ * Check whether a command can be executed.
61182
61946
  *
61183
61947
  * Implementors may hook into the mechanism on two ways:
61184
61948
  *
@@ -61192,10 +61956,10 @@
61192
61956
  * If the method {@link CommandHandler#canExecute} is implemented in a handler
61193
61957
  * it will be called to figure out whether the execution is allowed.
61194
61958
  *
61195
- * @param {string} command the command to execute
61196
- * @param {Object} context the environment to execute the command in
61959
+ * @param {string} command The command to execute.
61960
+ * @param {CommandContext} context The context with which to execute the command.
61197
61961
  *
61198
- * @return {boolean} true if the command can be executed
61962
+ * @return {boolean} Whether the command can be executed with the given context.
61199
61963
  */
61200
61964
  CommandStack.prototype.canExecute = function (command, context) {
61201
61965
  const action = {
@@ -61219,7 +61983,9 @@
61219
61983
  };
61220
61984
 
61221
61985
  /**
61222
- * Clear the command stack, erasing all undo / redo history
61986
+ * Clear the command stack, erasing all undo / redo history.
61987
+ *
61988
+ * @param {boolean} [emit=true] Whether to fire an event. Defaults to `true`.
61223
61989
  */
61224
61990
  CommandStack.prototype.clear = function (emit) {
61225
61991
  this._stack.length = 0;
@@ -61274,21 +62040,21 @@
61274
62040
  };
61275
62041
 
61276
62042
  /**
61277
- * Register a handler instance with the command stack
62043
+ * Register a handler instance with the command stack.
61278
62044
  *
61279
- * @param {string} command
61280
- * @param {CommandHandler} handler
62045
+ * @param {string} command Command to be executed.
62046
+ * @param {CommandHandler} handler Handler to execute the command.
61281
62047
  */
61282
62048
  CommandStack.prototype.register = function (command, handler) {
61283
62049
  this._setHandler(command, handler);
61284
62050
  };
61285
62051
 
61286
62052
  /**
61287
- * Register a handler type with the command stack
61288
- * by instantiating it and injecting its dependencies.
62053
+ * Register a handler type with the command stack by instantiating it and
62054
+ * injecting its dependencies.
61289
62055
  *
61290
- * @param {string} command
61291
- * @param {Function} a constructor for a {@link CommandHandler}
62056
+ * @param {string} command Command to be executed.
62057
+ * @param {CommandHandlerConstructor} handlerCls Constructor to instantiate a {@link CommandHandler}.
61292
62058
  */
61293
62059
  CommandStack.prototype.registerHandler = function (command, handlerCls) {
61294
62060
  if (!command || !handlerCls) {
@@ -61297,9 +62063,17 @@
61297
62063
  const handler = this._injector.instantiate(handlerCls);
61298
62064
  this.register(command, handler);
61299
62065
  };
62066
+
62067
+ /**
62068
+ * @return {boolean}
62069
+ */
61300
62070
  CommandStack.prototype.canUndo = function () {
61301
62071
  return !!this._getUndoAction();
61302
62072
  };
62073
+
62074
+ /**
62075
+ * @return {boolean}
62076
+ */
61303
62077
  CommandStack.prototype.canRedo = function () {
61304
62078
  return !!this._getRedoAction();
61305
62079
  };
@@ -61393,7 +62167,7 @@
61393
62167
  }
61394
62168
  this._fire(command, 'postExecuted', action);
61395
62169
  }
61396
- this._popAction(action);
62170
+ this._popAction();
61397
62171
  };
61398
62172
  CommandStack.prototype._pushAction = function (action) {
61399
62173
  const execution = this._currentExecution,
@@ -61453,6 +62227,10 @@
61453
62227
  }
61454
62228
  this._handlerMap[command] = handler;
61455
62229
  };
62230
+
62231
+ /**
62232
+ * @type { import('didi').ModuleDeclaration }
62233
+ */
61456
62234
  var commandModule = {
61457
62235
  commandStack: ['type', CommandStack]
61458
62236
  };
@@ -61652,44 +62430,18 @@
61652
62430
  fill: "none",
61653
62431
  xmlns: "http://www.w3.org/2000/svg"
61654
62432
  };
61655
- var FeelRequiredIcon = function FeelRequiredIcon(props) {
61656
- return e$1("svg", {
61657
- ...props,
61658
- children: [e$1("path", {
61659
- d: "M5.8 7.06V5.95h4.307v1.11H5.8Zm0 3.071v-1.11h4.307v1.11H5.8Z",
61660
- fill: "currentColor"
61661
- }), e$1("path", {
61662
- fillRule: "evenodd",
61663
- clipRule: "evenodd",
61664
- d: "M8 3.268A4.732 4.732 0 1 0 12.732 8H14a6 6 0 1 1-6-6v1.268Z",
61665
- fill: "currentColor"
61666
- }), e$1("path", {
61667
- d: "m11.28 6.072-.832-.56 1.016-1.224L10 3.848l.312-.912 1.392.584L11.632 2h1.032l-.072 1.52 1.392-.584.312.912-1.464.44 1.008 1.224-.832.552-.864-1.296-.864 1.304Z",
61668
- fill: "currentColor"
61669
- })]
61670
- });
61671
- };
61672
- FeelRequiredIcon.defaultProps = {
61673
- viewBox: "0 0 16 16",
61674
- fill: "none",
61675
- xmlns: "http://www.w3.org/2000/svg"
61676
- };
61677
- var FeelOptionalIcon = function FeelOptionalIcon(props) {
62433
+ var FeelIcon$1 = function FeelIcon(props) {
61678
62434
  return e$1("svg", {
61679
62435
  ...props,
61680
- children: [e$1("path", {
61681
- d: "M5.845 7.04V5.93h4.307v1.11H5.845Zm0 3.07V9h4.307v1.11H5.845Z",
61682
- fill: "currentColor"
61683
- }), e$1("path", {
61684
- fillRule: "evenodd",
61685
- clipRule: "evenodd",
61686
- d: "M3.286 8a4.714 4.714 0 1 0 9.428 0 4.714 4.714 0 0 0-9.428 0ZM8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Z",
61687
- fill: "currentColor"
61688
- })]
62436
+ children: e$1("path", {
62437
+ d: "M3.617 11.99c-.137.684-.392 1.19-.765 1.518-.362.328-.882.492-1.558.492H0l.309-1.579h1.264l1.515-7.64h-.912l.309-1.579h.911l.236-1.191c.137-.685.387-1.192.75-1.52C4.753.164 5.277 0 5.953 0h1.294L6.94 1.579H5.675l-.323 1.623h1.264l-.309 1.579H5.043l-1.426 7.208ZM5.605 11.021l3.029-4.155L7.28 3.202h2.073l.706 2.547h.176l1.691-2.547H14l-3.014 4.051 1.338 3.768H10.25l-.706-2.606H9.37L7.678 11.02H5.605Z",
62438
+ fill: "currentcolor"
62439
+ })
61689
62440
  });
61690
62441
  };
61691
- FeelOptionalIcon.defaultProps = {
61692
- viewBox: "0 0 16 16",
62442
+ FeelIcon$1.defaultProps = {
62443
+ width: "14",
62444
+ height: "14",
61693
62445
  fill: "none",
61694
62446
  xmlns: "http://www.w3.org/2000/svg"
61695
62447
  };
@@ -61929,6 +62681,18 @@
61929
62681
  * @param {setSticky} setSticky
61930
62682
  */
61931
62683
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
62684
+ const [scrollContainer, setScrollContainer] = l$2(query(scrollContainerSelector));
62685
+ const updateScrollContainer = A$1(() => {
62686
+ const newScrollContainer = query(scrollContainerSelector);
62687
+ if (newScrollContainer !== scrollContainer) {
62688
+ setScrollContainer(newScrollContainer);
62689
+ }
62690
+ }, [scrollContainerSelector, scrollContainer]);
62691
+ y(() => {
62692
+ updateScrollContainer();
62693
+ }, [updateScrollContainer]);
62694
+ useEvent('propertiesPanel.attach', updateScrollContainer);
62695
+ useEvent('propertiesPanel.detach', updateScrollContainer);
61932
62696
  y(() => {
61933
62697
  const Observer = IntersectionObserver;
61934
62698
 
@@ -61936,33 +62700,36 @@
61936
62700
  if (!Observer) {
61937
62701
  return;
61938
62702
  }
61939
- let observer;
61940
- if (ref.current) {
61941
- const scrollContainer = query(scrollContainerSelector);
61942
- observer = new Observer(entries => {
61943
- entries.forEach(entry => {
61944
- if (entry.intersectionRatio < 1) {
61945
- setSticky(true);
61946
- } else if (entry.intersectionRatio === 1) {
61947
- setSticky(false);
61948
- }
61949
- });
61950
- }, {
61951
- root: scrollContainer,
61952
- rootMargin: '0px 0px 999999% 0px',
61953
- // Use bottom margin to avoid stickyness when scrolling out to bottom
61954
- threshold: [1]
61955
- });
61956
- observer.observe(ref.current);
62703
+
62704
+ // TODO(@barmac): test this
62705
+ if (!ref.current || !scrollContainer) {
62706
+ return;
61957
62707
  }
62708
+ const observer = new Observer(entries => {
62709
+ // scroll container is unmounted, do not update sticky state
62710
+ if (scrollContainer.scrollHeight === 0) {
62711
+ return;
62712
+ }
62713
+ entries.forEach(entry => {
62714
+ if (entry.intersectionRatio < 1) {
62715
+ setSticky(true);
62716
+ } else if (entry.intersectionRatio === 1) {
62717
+ setSticky(false);
62718
+ }
62719
+ });
62720
+ }, {
62721
+ root: scrollContainer,
62722
+ rootMargin: '0px 0px 999999% 0px',
62723
+ // Use bottom margin to avoid stickyness when scrolling out to bottom
62724
+ threshold: [1]
62725
+ });
62726
+ observer.observe(ref.current);
61958
62727
 
61959
62728
  // Unobserve if unmounted
61960
62729
  return () => {
61961
- if (ref.current && observer) {
61962
- observer.unobserve(ref.current);
61963
- }
62730
+ observer.unobserve(ref.current);
61964
62731
  };
61965
- }, [ref, scrollContainerSelector, setSticky]);
62732
+ }, [ref.current, scrollContainer, setSticky]);
61966
62733
  }
61967
62734
 
61968
62735
  /**
@@ -62095,9 +62862,7 @@
62095
62862
  })
62096
62863
  });
62097
62864
  }
62098
- const DEFAULT_LAYOUT = {
62099
- open: true
62100
- };
62865
+ const DEFAULT_LAYOUT = {};
62101
62866
  const DEFAULT_DESCRIPTION = {};
62102
62867
 
62103
62868
  /**
@@ -62184,7 +62949,7 @@
62184
62949
  const [layout, setLayout] = l$2(createLayout(layoutConfig));
62185
62950
 
62186
62951
  // react to external changes in the layout config
62187
- useUpdateEffect(() => {
62952
+ useUpdateLayoutEffect(() => {
62188
62953
  const newLayout = createLayout(layoutConfig);
62189
62954
  setLayout(newLayout);
62190
62955
  }, [layoutConfig]);
@@ -62261,7 +63026,7 @@
62261
63026
  children: e$1(EventContext.Provider, {
62262
63027
  value: eventContext,
62263
63028
  children: e$1("div", {
62264
- class: classNames('bio-properties-panel', layout.open ? 'open' : ''),
63029
+ class: "bio-properties-panel",
62265
63030
  children: [e$1(Header, {
62266
63031
  element: element,
62267
63032
  headerProvider: headerProvider
@@ -62305,14 +63070,14 @@
62305
63070
  // hooks //////////////////
62306
63071
 
62307
63072
  /**
62308
- * This hook behaves like useEffect, but does not trigger on the first render.
63073
+ * This hook behaves like useLayoutEffect, but does not trigger on the first render.
62309
63074
  *
62310
63075
  * @param {Function} effect
62311
63076
  * @param {Array} deps
62312
63077
  */
62313
- function useUpdateEffect(effect, deps) {
63078
+ function useUpdateLayoutEffect(effect, deps) {
62314
63079
  const isMounted = s$1(false);
62315
- y(() => {
63080
+ h(() => {
62316
63081
  if (isMounted.current) {
62317
63082
  return effect();
62318
63083
  } else {
@@ -62930,14 +63695,13 @@
62930
63695
  */
62931
63696
  function FeelIcon(props) {
62932
63697
  const {
62933
- label,
62934
63698
  feel = false,
62935
63699
  active,
62936
63700
  disabled = false,
62937
63701
  onClick = noop$2
62938
63702
  } = props;
62939
- const feelRequiredLabel = ' must be a FEEL expression';
62940
- const feelOptionalLabel = ' can optionally be a FEEL expression';
63703
+ const feelRequiredLabel = 'FEEL expression is mandatory';
63704
+ const feelOptionalLabel = `Click to ${active ? 'remove' : 'set a'} dynamic value with FEEL expression`;
62941
63705
  const handleClick = e => {
62942
63706
  onClick(e);
62943
63707
 
@@ -62950,10 +63714,124 @@
62950
63714
  class: classNames('bio-properties-panel-feel-icon', active ? 'active' : null, feel === 'required' ? 'required' : 'optional'),
62951
63715
  onClick: handleClick,
62952
63716
  disabled: feel === 'required' || disabled,
62953
- title: label + (feel === 'required' ? feelRequiredLabel : feelOptionalLabel),
62954
- children: feel === 'required' ? e$1(FeelRequiredIcon, {}) : e$1(FeelOptionalIcon, {})
63717
+ title: feel === 'required' ? feelRequiredLabel : feelOptionalLabel,
63718
+ children: e$1(FeelIcon$1, {})
63719
+ });
63720
+ }
63721
+ function ToggleSwitch(props) {
63722
+ const {
63723
+ id,
63724
+ label,
63725
+ onInput,
63726
+ value,
63727
+ switcherLabel,
63728
+ inline,
63729
+ onFocus,
63730
+ onBlur,
63731
+ inputRef
63732
+ } = props;
63733
+ const [localValue, setLocalValue] = l$2(value);
63734
+ const handleInputCallback = async () => {
63735
+ onInput(!value);
63736
+ };
63737
+ const handleInput = e => {
63738
+ handleInputCallback();
63739
+ setLocalValue(e.target.value);
63740
+ };
63741
+ y(() => {
63742
+ if (value === localValue) {
63743
+ return;
63744
+ }
63745
+ setLocalValue(value);
63746
+ }, [value]);
63747
+ return e$1("div", {
63748
+ class: classNames('bio-properties-panel-toggle-switch', {
63749
+ inline
63750
+ }),
63751
+ children: [e$1("label", {
63752
+ class: "bio-properties-panel-label",
63753
+ for: prefixId$6(id),
63754
+ children: label
63755
+ }), e$1("div", {
63756
+ class: "bio-properties-panel-field-wrapper",
63757
+ children: [e$1("label", {
63758
+ class: "bio-properties-panel-toggle-switch__switcher",
63759
+ children: [e$1("input", {
63760
+ ref: inputRef,
63761
+ id: prefixId$6(id),
63762
+ class: "bio-properties-panel-input",
63763
+ type: "checkbox",
63764
+ onFocus: onFocus,
63765
+ onBlur: onBlur,
63766
+ name: id,
63767
+ onInput: handleInput,
63768
+ checked: !!localValue
63769
+ }), e$1("span", {
63770
+ class: "bio-properties-panel-toggle-switch__slider"
63771
+ })]
63772
+ }), switcherLabel && e$1("p", {
63773
+ class: "bio-properties-panel-toggle-switch__label",
63774
+ children: switcherLabel
63775
+ })]
63776
+ })]
63777
+ });
63778
+ }
63779
+
63780
+ /**
63781
+ * @param {Object} props
63782
+ * @param {Object} props.element
63783
+ * @param {String} props.id
63784
+ * @param {String} props.description
63785
+ * @param {String} props.label
63786
+ * @param {String} props.switcherLabel
63787
+ * @param {Boolean} props.inline
63788
+ * @param {Function} props.getValue
63789
+ * @param {Function} props.setValue
63790
+ * @param {Function} props.onFocus
63791
+ * @param {Function} props.onBlur
63792
+ */
63793
+ function ToggleSwitchEntry(props) {
63794
+ const {
63795
+ element,
63796
+ id,
63797
+ description,
63798
+ label,
63799
+ switcherLabel,
63800
+ inline,
63801
+ getValue,
63802
+ setValue,
63803
+ onFocus,
63804
+ onBlur
63805
+ } = props;
63806
+ const value = getValue(element);
63807
+ return e$1("div", {
63808
+ class: "bio-properties-panel-entry bio-properties-panel-toggle-switch-entry",
63809
+ "data-entry-id": id,
63810
+ children: [e$1(ToggleSwitch, {
63811
+ id: id,
63812
+ label: label,
63813
+ value: value,
63814
+ onInput: setValue,
63815
+ onFocus: onFocus,
63816
+ onBlur: onBlur,
63817
+ switcherLabel: switcherLabel,
63818
+ inline: inline
63819
+ }), e$1(Description$1, {
63820
+ forId: id,
63821
+ element: element,
63822
+ value: description
63823
+ })]
62955
63824
  });
62956
63825
  }
63826
+ function isEdited$7(node) {
63827
+ return node && !!node.checked;
63828
+ }
63829
+
63830
+ // helpers /////////////////
63831
+
63832
+ function prefixId$6(id) {
63833
+ return `bio-properties-panel-${id}`;
63834
+ }
62957
63835
  const noop$1 = () => {};
62958
63836
  function FeelTextfield(props) {
62959
63837
  const {
@@ -62972,8 +63850,8 @@
62972
63850
  const [localValue, _setLocalValue] = l$2(value);
62973
63851
  const editorRef = useShowEntryEvent(id);
62974
63852
  const containerRef = s$1();
62975
- const feelActive = localValue.startsWith('=') || feel === 'required';
62976
- const feelOnlyValue = localValue.startsWith('=') ? localValue.substring(1) : localValue;
63853
+ const feelActive = isString(localValue) && localValue.startsWith('=') || feel === 'required';
63854
+ const feelOnlyValue = isString(localValue) && localValue.startsWith('=') ? localValue.substring(1) : localValue;
62977
63855
  const [focus, _setFocus] = l$2(undefined);
62978
63856
  const setFocus = (offset = 0) => {
62979
63857
  const hasFocus = containerRef.current.contains(document.activeElement);
@@ -63013,7 +63891,7 @@
63013
63891
  return;
63014
63892
  }
63015
63893
  setLocalValue(newValue);
63016
- if (!feelActive && newValue.startsWith('=')) {
63894
+ if (!feelActive && isString(newValue) && newValue.startsWith('=')) {
63017
63895
  // focus is behind `=` sign that will be removed
63018
63896
  setFocus(-1);
63019
63897
  }
@@ -63076,9 +63954,11 @@
63076
63954
  };
63077
63955
  }, [containerRef, feelActive, handleFeelToggle, setFocus]);
63078
63956
  return e$1("div", {
63079
- class: "bio-properties-panel-feel-entry",
63957
+ class: classNames('bio-properties-panel-feel-entry', {
63958
+ 'feel-active': feelActive
63959
+ }),
63080
63960
  children: [e$1("label", {
63081
- for: prefixId$6(id),
63961
+ for: prefixId$5(id),
63082
63962
  class: "bio-properties-panel-label",
63083
63963
  onClick: () => setFocus(),
63084
63964
  children: [label, e$1(FeelIcon, {
@@ -63095,7 +63975,7 @@
63095
63975
  disabled: feel !== 'optional' || disabled,
63096
63976
  onClick: handleFeelToggle
63097
63977
  }), feelActive ? e$1(CodeEditor, {
63098
- id: prefixId$6(id),
63978
+ id: prefixId$5(id),
63099
63979
  name: id,
63100
63980
  onInput: handleLocalInput,
63101
63981
  disabled: disabled,
@@ -63112,7 +63992,8 @@
63112
63992
  ...props,
63113
63993
  onInput: handleLocalInput,
63114
63994
  contentAttributes: {
63115
- 'id': prefixId$6(id)
63995
+ 'id': prefixId$5(id),
63996
+ 'aria-label': label
63116
63997
  },
63117
63998
  value: localValue,
63118
63999
  ref: editorRef
@@ -63149,7 +64030,7 @@
63149
64030
  }
63150
64031
  };
63151
64032
  return e$1("input", {
63152
- id: prefixId$6(id),
64033
+ id: prefixId$5(id),
63153
64034
  type: "text",
63154
64035
  ref: inputRef,
63155
64036
  name: id,
@@ -63187,7 +64068,7 @@
63187
64068
  }
63188
64069
  };
63189
64070
  return e$1("textarea", {
63190
- id: prefixId$6(id),
64071
+ id: prefixId$5(id),
63191
64072
  type: "text",
63192
64073
  ref: inputRef,
63193
64074
  name: id,
@@ -63202,6 +64083,78 @@
63202
64083
  "data-gramm": "false"
63203
64084
  });
63204
64085
  });
64086
+ const OptionalFeelToggleSwitch = x((props, ref) => {
64087
+ const {
64088
+ id,
64089
+ onInput,
64090
+ value,
64091
+ onFocus,
64092
+ onBlur,
64093
+ switcherLabel
64094
+ } = props;
64095
+ const inputRef = s$1();
64096
+
64097
+ // To be consistent with the FEEL editor, set focus at start of input
64098
+ // this ensures clean editing experience when switching with the keyboard
64099
+ ref.current = {
64100
+ focus: () => {
64101
+ const input = inputRef.current;
64102
+ if (!input) {
64103
+ return;
64104
+ }
64105
+ input.focus();
64106
+ }
64107
+ };
64108
+ return e$1(ToggleSwitch, {
64109
+ id: id,
64110
+ value: value,
64111
+ inputRef: inputRef,
64112
+ onInput: onInput,
64113
+ onFocus: onFocus,
64114
+ onBlur: onBlur,
64115
+ switcherLabel: switcherLabel
64116
+ });
64117
+ });
64118
+ x((props, ref) => {
64119
+ const {
64120
+ id,
64121
+ disabled,
64122
+ onInput,
64123
+ value,
64124
+ onFocus,
64125
+ onBlur
64126
+ } = props;
64127
+ const inputRef = s$1();
64128
+ const handleChange = ({
64129
+ target
64130
+ }) => {
64131
+ onInput(target.checked);
64132
+ };
64133
+
64134
+ // To be consistent with the FEEL editor, set focus at start of input
64135
+ // this ensures clean editing experience when switching with the keyboard
64136
+ ref.current = {
64137
+ focus: () => {
64138
+ const input = inputRef.current;
64139
+ if (!input) {
64140
+ return;
64141
+ }
64142
+ input.focus();
64143
+ }
64144
+ };
64145
+ return e$1("input", {
64146
+ ref: inputRef,
64147
+ id: prefixId$5(id),
64148
+ name: id,
64149
+ onFocus: onFocus,
64150
+ onBlur: onBlur,
64151
+ type: "checkbox",
64152
+ class: "bio-properties-panel-input",
64153
+ onChange: handleChange,
64154
+ checked: value,
64155
+ disabled: disabled
64156
+ });
64157
+ });
63205
64158
 
63206
64159
  /**
63207
64160
  * @param {Object} props
@@ -63309,6 +64262,33 @@
63309
64262
  });
63310
64263
  }
63311
64264
 
64265
+ /**
64266
+ * @param {Object} props
64267
+ * @param {Object} props.element
64268
+ * @param {String} props.id
64269
+ * @param {String} props.description
64270
+ * @param {Boolean} props.debounce
64271
+ * @param {Boolean} props.disabled
64272
+ * @param {Boolean} props.feel
64273
+ * @param {String} props.label
64274
+ * @param {Function} props.getValue
64275
+ * @param {Function} props.setValue
64276
+ * @param {Function} props.tooltipContainer
64277
+ * @param {Function} props.validate
64278
+ * @param {Function} props.show
64279
+ * @param {Function} props.example
64280
+ * @param {Function} props.variables
64281
+ * @param {Function} props.onFocus
64282
+ * @param {Function} props.onBlur
64283
+ */
64284
+ function FeelToggleSwitchEntry(props) {
64285
+ return e$1(FeelEntry, {
64286
+ class: "bio-properties-panel-feel-toggle-switch",
64287
+ OptionalComponent: OptionalFeelToggleSwitch,
64288
+ ...props
64289
+ });
64290
+ }
64291
+
63312
64292
  /**
63313
64293
  * @param {Object} props
63314
64294
  * @param {Object} props.element
@@ -63337,13 +64317,19 @@
63337
64317
  ...props
63338
64318
  });
63339
64319
  }
63340
- function isEdited$7(node) {
63341
- return node && (!!node.value || node.classList.contains('edited'));
64320
+ function isEdited$6(node) {
64321
+ if (!node) {
64322
+ return false;
64323
+ }
64324
+ if (node.type === 'checkbox') {
64325
+ return !!node.checked || node.classList.contains('edited');
64326
+ }
64327
+ return !!node.value || node.classList.contains('edited');
63342
64328
  }
63343
64329
 
63344
64330
  // helpers /////////////////
63345
64331
 
63346
- function prefixId$6(id) {
64332
+ function prefixId$5(id) {
63347
64333
  return `bio-properties-panel-${id}`;
63348
64334
  }
63349
64335
  function NumberField(props) {
@@ -63385,11 +64371,11 @@
63385
64371
  return e$1("div", {
63386
64372
  class: "bio-properties-panel-numberfield",
63387
64373
  children: [e$1("label", {
63388
- for: prefixId$5(id),
64374
+ for: prefixId$4(id),
63389
64375
  class: "bio-properties-panel-label",
63390
64376
  children: label
63391
64377
  }), e$1("input", {
63392
- id: prefixId$5(id),
64378
+ id: prefixId$4(id),
63393
64379
  type: "number",
63394
64380
  name: id,
63395
64381
  spellCheck: "false",
@@ -63493,13 +64479,13 @@
63493
64479
  })]
63494
64480
  });
63495
64481
  }
63496
- function isEdited$5(node) {
64482
+ function isEdited$4(node) {
63497
64483
  return node && !!node.value;
63498
64484
  }
63499
64485
 
63500
64486
  // helpers /////////////////
63501
64487
 
63502
- function prefixId$5(id) {
64488
+ function prefixId$4(id) {
63503
64489
  return `bio-properties-panel-${id}`;
63504
64490
  }
63505
64491
  function Select(props) {
@@ -63533,12 +64519,12 @@
63533
64519
  return e$1("div", {
63534
64520
  class: "bio-properties-panel-select",
63535
64521
  children: [e$1("label", {
63536
- for: prefixId$4(id),
64522
+ for: prefixId$3(id),
63537
64523
  class: "bio-properties-panel-label",
63538
64524
  children: label
63539
64525
  }), e$1("select", {
63540
64526
  ref: ref,
63541
- id: prefixId$4(id),
64527
+ id: prefixId$3(id),
63542
64528
  name: id,
63543
64529
  class: "bio-properties-panel-input",
63544
64530
  onInput: handleChange,
@@ -63645,13 +64631,13 @@
63645
64631
  })]
63646
64632
  });
63647
64633
  }
63648
- function isEdited$4(node) {
64634
+ function isEdited$3(node) {
63649
64635
  return node && !!node.value;
63650
64636
  }
63651
64637
 
63652
64638
  // helpers /////////////////
63653
64639
 
63654
- function prefixId$4(id) {
64640
+ function prefixId$3(id) {
63655
64641
  return `bio-properties-panel-${id}`;
63656
64642
  }
63657
64643
  function resizeToContents(element) {
@@ -63699,12 +64685,12 @@
63699
64685
  return e$1("div", {
63700
64686
  class: "bio-properties-panel-textarea",
63701
64687
  children: [e$1("label", {
63702
- for: prefixId$2(id),
64688
+ for: prefixId$1(id),
63703
64689
  class: "bio-properties-panel-label",
63704
64690
  children: label
63705
64691
  }), e$1("textarea", {
63706
64692
  ref: ref,
63707
- id: prefixId$2(id),
64693
+ id: prefixId$1(id),
63708
64694
  name: id,
63709
64695
  spellCheck: "false",
63710
64696
  class: classNames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : '', autoResize ? 'auto-resize' : ''),
@@ -63732,6 +64718,7 @@
63732
64718
  * @param {Function} props.onBlur
63733
64719
  * @param {number} props.rows
63734
64720
  * @param {boolean} props.monospace
64721
+ * @param {Function} [props.validate]
63735
64722
  * @param {boolean} [props.disabled]
63736
64723
  */
63737
64724
  function TextAreaEntry(props) {
@@ -63746,12 +64733,38 @@
63746
64733
  rows,
63747
64734
  monospace,
63748
64735
  disabled,
64736
+ validate,
63749
64737
  onFocus,
63750
64738
  onBlur,
63751
64739
  autoResize
63752
64740
  } = props;
63753
- const value = getValue(element);
63754
- const error = useError(id);
64741
+ const [cachedInvalidValue, setCachedInvalidValue] = l$2(null);
64742
+ const globalError = useError(id);
64743
+ const [localError, setLocalError] = l$2(null);
64744
+ let value = getValue(element);
64745
+ const previousValue = usePrevious(value);
64746
+ y(() => {
64747
+ if (isFunction(validate)) {
64748
+ const newValidationError = validate(value) || null;
64749
+ setLocalError(newValidationError);
64750
+ }
64751
+ }, [value]);
64752
+ const onInput = newValue => {
64753
+ let newValidationError = null;
64754
+ if (isFunction(validate)) {
64755
+ newValidationError = validate(newValue) || null;
64756
+ }
64757
+ if (newValidationError) {
64758
+ setCachedInvalidValue(newValue);
64759
+ } else {
64760
+ setValue(newValue);
64761
+ }
64762
+ setLocalError(newValidationError);
64763
+ };
64764
+ if (previousValue === value && localError) {
64765
+ value = cachedInvalidValue;
64766
+ }
64767
+ const error = globalError || localError;
63755
64768
  return e$1("div", {
63756
64769
  class: classNames('bio-properties-panel-entry', error ? 'has-error' : ''),
63757
64770
  "data-entry-id": id,
@@ -63759,7 +64772,7 @@
63759
64772
  id: id,
63760
64773
  label: label,
63761
64774
  value: value,
63762
- onInput: setValue,
64775
+ onInput: onInput,
63763
64776
  onFocus: onFocus,
63764
64777
  onBlur: onBlur,
63765
64778
  rows: rows,
@@ -63777,13 +64790,13 @@
63777
64790
  })]
63778
64791
  });
63779
64792
  }
63780
- function isEdited$2(node) {
64793
+ function isEdited$1(node) {
63781
64794
  return node && !!node.value;
63782
64795
  }
63783
64796
 
63784
64797
  // helpers /////////////////
63785
64798
 
63786
- function prefixId$2(id) {
64799
+ function prefixId$1(id) {
63787
64800
  return `bio-properties-panel-${id}`;
63788
64801
  }
63789
64802
  function Textfield(props) {
@@ -63817,12 +64830,12 @@
63817
64830
  return e$1("div", {
63818
64831
  class: "bio-properties-panel-textfield",
63819
64832
  children: [e$1("label", {
63820
- for: prefixId$1(id),
64833
+ for: prefixId(id),
63821
64834
  class: "bio-properties-panel-label",
63822
64835
  children: label
63823
64836
  }), e$1("input", {
63824
64837
  ref: ref,
63825
- id: prefixId$1(id),
64838
+ id: prefixId(id),
63826
64839
  type: "text",
63827
64840
  name: id,
63828
64841
  spellCheck: "false",
@@ -63914,13 +64927,13 @@
63914
64927
  })]
63915
64928
  });
63916
64929
  }
63917
- function isEdited$1(node) {
64930
+ function isEdited(node) {
63918
64931
  return node && !!node.value;
63919
64932
  }
63920
64933
 
63921
64934
  // helpers /////////////////
63922
64935
 
63923
- function prefixId$1(id) {
64936
+ function prefixId(id) {
63924
64937
  return `bio-properties-panel-${id}`;
63925
64938
  }
63926
64939
 
@@ -64045,7 +65058,7 @@
64045
65058
  component: Action,
64046
65059
  editField: editField,
64047
65060
  field: field,
64048
- isEdited: isEdited$4
65061
+ isEdited: isEdited$3
64049
65062
  });
64050
65063
  }
64051
65064
  return entries;
@@ -64111,7 +65124,7 @@
64111
65124
  component: AltText,
64112
65125
  editField: editField,
64113
65126
  field: field,
64114
- isEdited: isEdited$7
65127
+ isEdited: isEdited$6
64115
65128
  });
64116
65129
  }
64117
65130
  return entries;
@@ -64155,7 +65168,7 @@
64155
65168
  component: Columns,
64156
65169
  field,
64157
65170
  editField,
64158
- isEdited: isEdited$4
65171
+ isEdited: isEdited$3
64159
65172
  }];
64160
65173
  return entries;
64161
65174
  }
@@ -64185,7 +65198,7 @@
64185
65198
  },
64186
65199
  // todo(pinussilvestrus): make options dependant on field type
64187
65200
  // cf. https://github.com/bpmn-io/form-js/issues/575
64188
- ...[2, 4, 6, 8, 10, 12, 14, 16].map(asOption)];
65201
+ ...asArray(16).filter(i => i >= MIN_COLUMNS).map(asOption)];
64189
65202
  };
64190
65203
  return SelectEntry({
64191
65204
  debounce,
@@ -64207,6 +65220,11 @@
64207
65220
  label: number.toString()
64208
65221
  };
64209
65222
  }
65223
+ function asArray(length) {
65224
+ return Array.from({
65225
+ length
65226
+ }).map((_, i) => i + 1);
65227
+ }
64210
65228
  function DescriptionEntry(props) {
64211
65229
  const {
64212
65230
  editField,
@@ -64222,7 +65240,7 @@
64222
65240
  component: Description,
64223
65241
  editField: editField,
64224
65242
  field: field,
64225
- isEdited: isEdited$1
65243
+ isEdited: isEdited
64226
65244
  });
64227
65245
  }
64228
65246
  return entries;
@@ -64275,21 +65293,21 @@
64275
65293
  entries.push({
64276
65294
  ...defaultOptions,
64277
65295
  component: DefaultValueCheckbox,
64278
- isEdited: isEdited$4
65296
+ isEdited: isEdited$3
64279
65297
  });
64280
65298
  }
64281
65299
  if (type === 'number') {
64282
65300
  entries.push({
64283
65301
  ...defaultOptions,
64284
65302
  component: DefaultValueNumber,
64285
- isEdited: isEdited$1
65303
+ isEdited: isEdited
64286
65304
  });
64287
65305
  }
64288
65306
  if (type === 'radio' || type === 'select') {
64289
65307
  entries.push({
64290
65308
  ...defaultOptions,
64291
65309
  component: DefaultValueSingleSelect,
64292
- isEdited: isEdited$4
65310
+ isEdited: isEdited$3
64293
65311
  });
64294
65312
  }
64295
65313
 
@@ -64299,14 +65317,14 @@
64299
65317
  entries.push({
64300
65318
  ...defaultOptions,
64301
65319
  component: DefaultValueTextfield,
64302
- isEdited: isEdited$1
65320
+ isEdited: isEdited
64303
65321
  });
64304
65322
  }
64305
65323
  if (type === 'textarea') {
64306
65324
  entries.push({
64307
65325
  ...defaultOptions,
64308
65326
  component: DefaultValueTextarea,
64309
- isEdited: isEdited$2
65327
+ isEdited: isEdited$1
64310
65328
  });
64311
65329
  }
64312
65330
  return entries;
@@ -64499,7 +65517,7 @@
64499
65517
  component: Disabled,
64500
65518
  editField: editField,
64501
65519
  field: field,
64502
- isEdited: isEdited$8
65520
+ isEdited: isEdited$7
64503
65521
  });
64504
65522
  }
64505
65523
  return entries;
@@ -64517,11 +65535,12 @@
64517
65535
  const setValue = value => {
64518
65536
  return editField(field, path, value);
64519
65537
  };
64520
- return CheckboxEntry({
65538
+ return ToggleSwitchEntry({
64521
65539
  element: field,
64522
65540
  getValue,
64523
65541
  id,
64524
65542
  label: 'Disabled',
65543
+ inline: true,
64525
65544
  setValue
64526
65545
  });
64527
65546
  }
@@ -64537,7 +65556,7 @@
64537
65556
  component: Id,
64538
65557
  editField: editField,
64539
65558
  field: field,
64540
- isEdited: isEdited$1
65559
+ isEdited: isEdited
64541
65560
  });
64542
65561
  }
64543
65562
  return entries;
@@ -64616,7 +65635,7 @@
64616
65635
  component: Key$1,
64617
65636
  editField: editField,
64618
65637
  field: field,
64619
- isEdited: isEdited$1
65638
+ isEdited: isEdited
64620
65639
  });
64621
65640
  }
64622
65641
  return entries;
@@ -64678,7 +65697,7 @@
64678
65697
  field,
64679
65698
  editField,
64680
65699
  component: SimpleStringComponent,
64681
- isEdited: isEdited$1
65700
+ isEdited: isEdited
64682
65701
  };
64683
65702
  }
64684
65703
  const SimpleStringComponent = props => {
@@ -64795,7 +65814,7 @@
64795
65814
  component: Source,
64796
65815
  editField: editField,
64797
65816
  field: field,
64798
- isEdited: isEdited$7
65817
+ isEdited: isEdited$6
64799
65818
  });
64800
65819
  }
64801
65820
  return entries;
@@ -64849,7 +65868,7 @@
64849
65868
  component: Text,
64850
65869
  editField: editField,
64851
65870
  field: field,
64852
- isEdited: isEdited$7
65871
+ isEdited: isEdited$6
64853
65872
  }];
64854
65873
 
64855
65874
  // todo: skipped to make the release without too much risk
@@ -64917,14 +65936,14 @@
64917
65936
  entries.push({
64918
65937
  id: id + '-decimalDigits',
64919
65938
  component: NumberDecimalDigits,
64920
- isEdited: isEdited$5,
65939
+ isEdited: isEdited$4,
64921
65940
  editField,
64922
65941
  field
64923
65942
  });
64924
65943
  entries.push({
64925
65944
  id: id + '-step',
64926
65945
  component: NumberArrowStep,
64927
- isEdited: isEdited$1,
65946
+ isEdited: isEdited,
64928
65947
  editField,
64929
65948
  field
64930
65949
  });
@@ -65060,7 +66079,7 @@
65060
66079
  const entries = [{
65061
66080
  id: 'subtype',
65062
66081
  component: DateTimeSubtypeSelect,
65063
- isEdited: isEdited$4,
66082
+ isEdited: isEdited$3,
65064
66083
  editField,
65065
66084
  field
65066
66085
  }];
@@ -65171,7 +66190,7 @@
65171
66190
  entries.push({
65172
66191
  id: id + '-timeInterval',
65173
66192
  component: TimeIntervalSelect,
65174
- isEdited: isEdited$4,
66193
+ isEdited: isEdited$3,
65175
66194
  editField,
65176
66195
  field
65177
66196
  });
@@ -65249,7 +66268,7 @@
65249
66268
  entries.push({
65250
66269
  id: 'time-format',
65251
66270
  component: TimeFormatSelect,
65252
- isEdited: isEdited$4,
66271
+ isEdited: isEdited$3,
65253
66272
  editField,
65254
66273
  field
65255
66274
  });
@@ -65505,7 +66524,7 @@
65505
66524
  return [{
65506
66525
  id: id + '-select',
65507
66526
  component: ValuesSourceSelect,
65508
- isEdited: isEdited$4,
66527
+ isEdited: isEdited$3,
65509
66528
  editField,
65510
66529
  field
65511
66530
  }];
@@ -65562,7 +66581,7 @@
65562
66581
  component: InputValuesKey,
65563
66582
  label: 'Input values key',
65564
66583
  description,
65565
- isEdited: isEdited$1,
66584
+ isEdited: isEdited,
65566
66585
  editField,
65567
66586
  field
65568
66587
  }];
@@ -65697,7 +66716,7 @@
65697
66716
  entries.push({
65698
66717
  id: 'prefix-adorner',
65699
66718
  component: PrefixAdorner,
65700
- isEdited: isEdited$1,
66719
+ isEdited: isEdited,
65701
66720
  editField,
65702
66721
  field,
65703
66722
  onChange,
@@ -65706,7 +66725,7 @@
65706
66725
  entries.push({
65707
66726
  id: 'suffix-adorner',
65708
66727
  component: SuffixAdorner,
65709
- isEdited: isEdited$1,
66728
+ isEdited: isEdited,
65710
66729
  editField,
65711
66730
  field,
65712
66731
  onChange,
@@ -65749,6 +66768,54 @@
65749
66768
  setValue: onChange('suffixAdorner')
65750
66769
  });
65751
66770
  }
66771
+ function ReadonlyEntry(props) {
66772
+ const {
66773
+ editField,
66774
+ field
66775
+ } = props;
66776
+ const {
66777
+ type
66778
+ } = field;
66779
+ const entries = [];
66780
+ if (INPUTS.includes(type)) {
66781
+ entries.push({
66782
+ id: 'readonly',
66783
+ component: Readonly,
66784
+ editField: editField,
66785
+ field: field,
66786
+ isEdited: isEdited$6
66787
+ });
66788
+ }
66789
+ return entries;
66790
+ }
66791
+ function Readonly(props) {
66792
+ const {
66793
+ editField,
66794
+ field,
66795
+ id
66796
+ } = props;
66797
+ const debounce = useService('debounce');
66798
+ const variables = useVariables().map(name => ({
66799
+ name
66800
+ }));
66801
+ const path = ['readonly'];
66802
+ const getValue = () => {
66803
+ return get(field, path, '');
66804
+ };
66805
+ const setValue = value => {
66806
+ return editField(field, path, value || false);
66807
+ };
66808
+ return FeelToggleSwitchEntry({
66809
+ debounce,
66810
+ element: field,
66811
+ feel: 'optional',
66812
+ getValue,
66813
+ id,
66814
+ label: 'Read only',
66815
+ setValue,
66816
+ variables
66817
+ });
66818
+ }
65752
66819
  function ConditionEntry(props) {
65753
66820
  const {
65754
66821
  editField,
@@ -65759,7 +66826,7 @@
65759
66826
  component: Condition,
65760
66827
  editField: editField,
65761
66828
  field: field,
65762
- isEdited: isEdited$7
66829
+ isEdited: isEdited$6
65763
66830
  }];
65764
66831
  }
65765
66832
  function Condition(props) {
@@ -65837,6 +66904,9 @@
65837
66904
  }), ...DisabledEntry({
65838
66905
  field,
65839
66906
  editField
66907
+ }), ...ReadonlyEntry({
66908
+ field,
66909
+ editField
65840
66910
  })];
65841
66911
  return {
65842
66912
  id: 'general',
@@ -65924,7 +66994,7 @@
65924
66994
  getValue,
65925
66995
  field,
65926
66996
  editField,
65927
- isEdited: isEdited$1,
66997
+ isEdited: isEdited,
65928
66998
  onChange
65929
66999
  });
65930
67000
  }
@@ -65934,14 +67004,14 @@
65934
67004
  component: MinLength,
65935
67005
  getValue,
65936
67006
  field,
65937
- isEdited: isEdited$5,
67007
+ isEdited: isEdited$4,
65938
67008
  onChange
65939
67009
  }, {
65940
67010
  id: 'maxLength',
65941
67011
  component: MaxLength,
65942
67012
  getValue,
65943
67013
  field,
65944
- isEdited: isEdited$5,
67014
+ isEdited: isEdited$4,
65945
67015
  onChange
65946
67016
  });
65947
67017
  }
@@ -65951,7 +67021,7 @@
65951
67021
  component: Pattern,
65952
67022
  getValue,
65953
67023
  field,
65954
- isEdited: isEdited$1,
67024
+ isEdited: isEdited,
65955
67025
  onChange
65956
67026
  });
65957
67027
  }
@@ -65961,14 +67031,14 @@
65961
67031
  component: Min,
65962
67032
  getValue,
65963
67033
  field,
65964
- isEdited: isEdited$5,
67034
+ isEdited: isEdited$4,
65965
67035
  onChange
65966
67036
  }, {
65967
67037
  id: 'max',
65968
67038
  component: Max,
65969
67039
  getValue,
65970
67040
  field,
65971
- isEdited: isEdited$5,
67041
+ isEdited: isEdited$4,
65972
67042
  onChange
65973
67043
  });
65974
67044
  }
@@ -68237,7 +69307,8 @@
68237
69307
 
68238
69308
  function JSONEditor(options = {}) {
68239
69309
  const {
68240
- readonly = false
69310
+ readonly = false,
69311
+ contentAttributes = {}
68241
69312
  } = options;
68242
69313
  const emitter = mitt();
68243
69314
  let language = new Compartment().of(json());
@@ -68264,14 +69335,15 @@
68264
69335
  }
68265
69336
  });
68266
69337
  const editable = EditorView.editable.of(!readonly);
69338
+ const contentAttributesExtension = EditorView.contentAttributes.of(contentAttributes);
68267
69339
  const view = new EditorView({
68268
- state: createState('', [updateListener, editable])
69340
+ state: createState('', [updateListener, editable, contentAttributesExtension])
68269
69341
  });
68270
69342
  view.setValue = function (value) {
68271
- this.setState(createState(value, [updateListener, editable]));
69343
+ this.setState(createState(value, [updateListener, editable, contentAttributesExtension]));
68272
69344
  };
68273
69345
  view.setVariables = function (variables) {
68274
- this.setState(createState(view.state.doc.toString(), [updateListener, editable], variables));
69346
+ this.setState(createState(view.state.doc.toString(), [updateListener, editable, contentAttributesExtension], variables));
68275
69347
  };
68276
69348
  return view;
68277
69349
  }
@@ -68338,7 +69410,11 @@
68338
69410
  const {
68339
69411
  actions: actionsConfig = {},
68340
69412
  emit,
68341
- exporter: exporterConfig = {}
69413
+ exporter: exporterConfig = {},
69414
+ viewerProperties = {},
69415
+ editorProperties = {},
69416
+ viewerAdditionalModules = [],
69417
+ editorAdditionalModules = []
68342
69418
  } = props;
68343
69419
  const {
68344
69420
  display: displayActions = true
@@ -68386,13 +69462,25 @@
68386
69462
  }, [props.schema]);
68387
69463
  y(() => {
68388
69464
  const dataEditor = dataEditorRef.current = new JSONEditor({
68389
- value: toString(data)
69465
+ value: toString(data),
69466
+ contentAttributes: {
69467
+ 'aria-label': 'Form Input'
69468
+ }
68390
69469
  });
68391
69470
  const resultView = resultViewRef.current = new JSONEditor({
68392
69471
  readonly: true,
68393
- value: toString(resultData)
69472
+ value: toString(resultData),
69473
+ contentAttributes: {
69474
+ 'aria-label': 'Form Output'
69475
+ }
69476
+ });
69477
+ const form = formRef.current = new Form({
69478
+ additionalModules: viewerAdditionalModules,
69479
+ properties: {
69480
+ ...viewerProperties,
69481
+ 'ariaLabel': 'Form Preview'
69482
+ }
68394
69483
  });
68395
- const form = formRef.current = new Form();
68396
69484
  const formEditor = formEditorRef.current = new FormEditor({
68397
69485
  renderer: {
68398
69486
  compact: true
@@ -68403,7 +69491,12 @@
68403
69491
  propertiesPanel: {
68404
69492
  parent: propertiesPanelContainerRef.current
68405
69493
  },
68406
- exporter: exporterConfig
69494
+ exporter: exporterConfig,
69495
+ properties: {
69496
+ ...editorProperties,
69497
+ 'ariaLabel': 'Form Definition'
69498
+ },
69499
+ additionalModules: editorAdditionalModules
68407
69500
  });
68408
69501
  paletteRef.current = formEditor.get('palette');
68409
69502
  propertiesPanelRef.current = formEditor.get('propertiesPanel');