@bpmn-io/form-js-viewer 1.5.0 → 1.6.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.
Files changed (43) hide show
  1. package/dist/assets/form-js-base.css +220 -16
  2. package/dist/assets/form-js.css +219 -16
  3. package/dist/index.cjs +1822 -606
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.es.js +1812 -603
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/types/Form.d.ts +15 -4
  8. package/dist/types/core/FieldFactory.d.ts +2 -0
  9. package/dist/types/core/FormFieldRegistry.d.ts +1 -0
  10. package/dist/types/core/PathRegistry.d.ts +7 -3
  11. package/dist/types/features/{expression-language → expressionLanguage}/ConditionChecker.d.ts +8 -4
  12. package/dist/types/features/index.d.ts +4 -2
  13. package/dist/types/features/repeatRender/RepeatRenderManager.d.ts +21 -0
  14. package/dist/types/features/repeatRender/index.d.ts +7 -0
  15. package/dist/types/features/viewerCommands/ViewerCommands.d.ts +1 -1
  16. package/dist/types/index.d.ts +1 -1
  17. package/dist/types/render/components/Label.d.ts +21 -1
  18. package/dist/types/render/components/Util.d.ts +1 -1
  19. package/dist/types/render/components/form-fields/DynamicList.d.ts +18 -0
  20. package/dist/types/render/components/form-fields/Table.d.ts +71 -0
  21. package/dist/types/render/components/form-fields/parts/ChildrenRenderer.d.ts +1 -0
  22. package/dist/types/render/components/index.d.ts +3 -1
  23. package/dist/types/render/context/FormRenderContext.d.ts +4 -3
  24. package/dist/types/render/context/LocalExpressionContext.d.ts +7 -0
  25. package/dist/types/render/context/index.d.ts +1 -0
  26. package/dist/types/render/hooks/index.d.ts +1 -0
  27. package/dist/types/render/hooks/useExpressionEvaluation.d.ts +3 -3
  28. package/dist/types/render/hooks/useFilteredFormData.d.ts +1 -0
  29. package/dist/types/render/hooks/useScrollIntoView.d.ts +18 -0
  30. package/dist/types/render/hooks/useTemplateEvaluation.d.ts +1 -1
  31. package/dist/types/util/constants/OptionsSourceConstants.d.ts +19 -0
  32. package/dist/types/util/constants/index.d.ts +1 -1
  33. package/dist/types/util/getSchemaVariables.d.ts +39 -0
  34. package/dist/types/util/index.d.ts +3 -52
  35. package/dist/types/util/simple.d.ts +20 -0
  36. package/dist/types/util/structure.d.ts +1 -0
  37. package/package.json +4 -4
  38. package/dist/types/render/components/form-fields/parts/Grid.d.ts +0 -1
  39. package/dist/types/util/constants/ValuesSourceConstants.d.ts +0 -19
  40. /package/dist/types/features/{expression-language → expressionLanguage}/FeelExpressionLanguage.d.ts +0 -0
  41. /package/dist/types/features/{expression-language → expressionLanguage}/FeelersTemplating.d.ts +0 -0
  42. /package/dist/types/features/{expression-language → expressionLanguage}/index.d.ts +0 -0
  43. /package/dist/types/features/{expression-language → expressionLanguage}/variableExtractionHelpers.d.ts +0 -0
package/dist/index.cjs CHANGED
@@ -3,16 +3,16 @@
3
3
  var Ids = require('ids');
4
4
  var minDash = require('min-dash');
5
5
  var Big = require('big.js');
6
- var feelin = require('feelin');
7
- var feelers = require('feelers');
8
6
  var classNames = require('classnames');
9
7
  var jsxRuntime = require('preact/jsx-runtime');
10
8
  var hooks = require('preact/hooks');
11
9
  var preact = require('preact');
12
- var React = require('preact/compat');
13
10
  var flatpickr = require('flatpickr');
11
+ var React = require('preact/compat');
14
12
  var Markup = require('preact-markup');
15
13
  var didi = require('didi');
14
+ var feelin = require('feelin');
15
+ var feelers = require('feelers');
16
16
  var showdown = require('showdown');
17
17
 
18
18
  function _interopNamespaceDefault(e) {
@@ -413,6 +413,92 @@ class FeelersTemplating {
413
413
  }
414
414
  FeelersTemplating.$inject = [];
415
415
 
416
+ // config ///////////////////
417
+
418
+ const MINUTES_IN_DAY = 60 * 24;
419
+ const DATETIME_SUBTYPES = {
420
+ DATE: 'date',
421
+ TIME: 'time',
422
+ DATETIME: 'datetime'
423
+ };
424
+ const TIME_SERIALISING_FORMATS = {
425
+ UTC_OFFSET: 'utc_offset',
426
+ UTC_NORMALIZED: 'utc_normalized',
427
+ NO_TIMEZONE: 'no_timezone'
428
+ };
429
+ const DATETIME_SUBTYPES_LABELS = {
430
+ [DATETIME_SUBTYPES.DATE]: 'Date',
431
+ [DATETIME_SUBTYPES.TIME]: 'Time',
432
+ [DATETIME_SUBTYPES.DATETIME]: 'Date & Time'
433
+ };
434
+ const TIME_SERIALISINGFORMAT_LABELS = {
435
+ [TIME_SERIALISING_FORMATS.UTC_OFFSET]: 'UTC offset',
436
+ [TIME_SERIALISING_FORMATS.UTC_NORMALIZED]: 'UTC normalized',
437
+ [TIME_SERIALISING_FORMATS.NO_TIMEZONE]: 'No timezone'
438
+ };
439
+ const DATETIME_SUBTYPE_PATH = ['subtype'];
440
+ const DATE_LABEL_PATH = ['dateLabel'];
441
+ const DATE_DISALLOW_PAST_PATH = ['disallowPassedDates'];
442
+ const TIME_LABEL_PATH = ['timeLabel'];
443
+ const TIME_USE24H_PATH = ['use24h'];
444
+ const TIME_INTERVAL_PATH = ['timeInterval'];
445
+ const TIME_SERIALISING_FORMAT_PATH = ['timeSerializingFormat'];
446
+
447
+ // config ///////////////////
448
+
449
+ const OPTIONS_SOURCES = {
450
+ STATIC: 'static',
451
+ INPUT: 'input',
452
+ EXPRESSION: 'expression'
453
+ };
454
+ const OPTIONS_SOURCE_DEFAULT = OPTIONS_SOURCES.STATIC;
455
+ const OPTIONS_SOURCES_LABELS = {
456
+ [OPTIONS_SOURCES.STATIC]: 'Static',
457
+ [OPTIONS_SOURCES.INPUT]: 'Input data',
458
+ [OPTIONS_SOURCES.EXPRESSION]: 'Expression'
459
+ };
460
+ const OPTIONS_SOURCES_PATHS = {
461
+ [OPTIONS_SOURCES.STATIC]: ['values'],
462
+ [OPTIONS_SOURCES.INPUT]: ['valuesKey'],
463
+ [OPTIONS_SOURCES.EXPRESSION]: ['valuesExpression']
464
+ };
465
+ const OPTIONS_SOURCES_DEFAULTS = {
466
+ [OPTIONS_SOURCES.STATIC]: [{
467
+ label: 'Value',
468
+ value: 'value'
469
+ }],
470
+ [OPTIONS_SOURCES.INPUT]: '',
471
+ [OPTIONS_SOURCES.EXPRESSION]: '='
472
+ };
473
+
474
+ // helpers ///////////////////
475
+
476
+ function getOptionsSource(field) {
477
+ for (const source of Object.values(OPTIONS_SOURCES)) {
478
+ if (minDash.get(field, OPTIONS_SOURCES_PATHS[source]) !== undefined) {
479
+ return source;
480
+ }
481
+ }
482
+ return OPTIONS_SOURCE_DEFAULT;
483
+ }
484
+
485
+ function createInjector(bootstrapModules) {
486
+ const injector = new didi.Injector(bootstrapModules);
487
+ injector.init();
488
+ return injector;
489
+ }
490
+
491
+ /**
492
+ * @param {string?} prefix
493
+ *
494
+ * @returns Element
495
+ */
496
+ function createFormContainer(prefix = 'fjs') {
497
+ const container = document.createElement('div');
498
+ container.classList.add(`${prefix}-container`);
499
+ return container;
500
+ }
501
+
416
502
  function formFieldClasses(type, {
417
503
  errors = [],
418
504
  disabled = false,
@@ -438,14 +524,19 @@ function gridColumnClasses(formField) {
438
524
  // always fall back to top-down on smallest screens
439
525
  'cds--col-sm-16', 'cds--col-md-16');
440
526
  }
441
- function prefixId(id, formId) {
527
+ function prefixId(id, formId, indexes) {
528
+ let result = 'fjs-form';
442
529
  if (formId) {
443
- return `fjs-form-${formId}-${id}`;
530
+ result += `-${formId}`;
444
531
  }
445
- return `fjs-form-${id}`;
532
+ result += `-${id}`;
533
+ Object.values(indexes || {}).forEach(index => {
534
+ result += `_${index}`;
535
+ });
536
+ return result;
446
537
  }
447
538
 
448
- const type$e = 'button';
539
+ const type$f = 'button';
449
540
  function Button(props) {
450
541
  const {
451
542
  disabled,
@@ -457,7 +548,7 @@ function Button(props) {
457
548
  action = 'submit'
458
549
  } = field;
459
550
  return jsxRuntime.jsx("div", {
460
- class: formFieldClasses(type$e),
551
+ class: formFieldClasses(type$f),
461
552
  children: jsxRuntime.jsx("button", {
462
553
  class: "fjs-button",
463
554
  type: action,
@@ -469,7 +560,7 @@ function Button(props) {
469
560
  });
470
561
  }
471
562
  Button.config = {
472
- type: type$e,
563
+ type: type$f,
473
564
  keyed: false,
474
565
  label: 'Button',
475
566
  group: 'action',
@@ -480,27 +571,30 @@ Button.config = {
480
571
  };
481
572
 
482
573
  const FormRenderContext = preact.createContext({
483
- EmptyRoot: props => {
574
+ Empty: props => {
484
575
  return null;
485
576
  },
486
- Empty: props => {
577
+ Hidden: props => {
487
578
  return null;
488
579
  },
489
580
  Children: props => {
490
581
  return jsxRuntime.jsx("div", {
491
582
  class: props.class,
583
+ style: props.style,
492
584
  children: props.children
493
585
  });
494
586
  },
495
587
  Element: props => {
496
588
  return jsxRuntime.jsx("div", {
497
589
  class: props.class,
590
+ style: props.style,
498
591
  children: props.children
499
592
  });
500
593
  },
501
594
  Row: props => {
502
595
  return jsxRuntime.jsx("div", {
503
596
  class: props.class,
597
+ style: props.style,
504
598
  children: props.children
505
599
  });
506
600
  },
@@ -510,16 +604,24 @@ const FormRenderContext = preact.createContext({
510
604
  }
511
605
  return jsxRuntime.jsx("div", {
512
606
  class: props.class,
607
+ style: props.style,
513
608
  children: props.children
514
609
  });
515
610
  },
516
- hoveredId: [],
517
- setHoveredId: newValue => {
518
- console.log(`setHoveredId not defined, called with '${newValue}'`);
611
+ hoverInfo: {
612
+ cleanup: () => {}
519
613
  }
520
614
  });
521
615
  var FormRenderContext$1 = FormRenderContext;
522
616
 
617
+ const LocalExpressionContext = preact.createContext({
618
+ data: null,
619
+ this: null,
620
+ parent: null,
621
+ i: null
622
+ });
623
+ var LocalExpressionContext$1 = LocalExpressionContext;
624
+
523
625
  /**
524
626
  * @param {string} type
525
627
  * @param {boolean} [strict]
@@ -540,24 +642,77 @@ function useService(type, strict) {
540
642
  return getService(type, strict);
541
643
  }
542
644
 
645
+ function isRequired(field) {
646
+ return field.required;
647
+ }
648
+ function pathParse(path) {
649
+ if (!path) {
650
+ return [];
651
+ }
652
+ return path.split('.').map(key => {
653
+ return isNaN(parseInt(key)) ? key : parseInt(key);
654
+ });
655
+ }
656
+ function pathsEqual(a, b) {
657
+ return a && b && a.length === b.length && a.every((value, index) => value === b[index]);
658
+ }
659
+ const indices = {};
660
+ function generateIndexForType(type) {
661
+ if (type in indices) {
662
+ indices[type]++;
663
+ } else {
664
+ indices[type] = 1;
665
+ }
666
+ return indices[type];
667
+ }
668
+ function generateIdForType(type) {
669
+ return `${type}${generateIndexForType(type)}`;
670
+ }
671
+
543
672
  /**
544
- * Returns the conditionally filtered data of a form reactively.
545
- * Memoised to minimize re-renders
673
+ * @template T
674
+ * @param {T} data
675
+ * @param {(this: any, key: string, value: any) => any} [replacer]
676
+ * @return {T}
677
+ */
678
+ function clone(data, replacer) {
679
+ return JSON.parse(JSON.stringify(data, replacer));
680
+ }
681
+
682
+ /**
683
+ * Transform a LocalExpressionContext object into a usable FEEL context.
546
684
  *
685
+ * @param {Object} context - The LocalExpressionContext object.
686
+ * @returns {Object} The usable FEEL context.
547
687
  */
548
- function useFilteredFormData() {
688
+
689
+ function buildExpressionContext(context) {
549
690
  const {
550
- initialData,
551
- data
552
- } = useService('form')._getState();
553
- const conditionChecker = useService('conditionChecker', false);
554
- return hooks.useMemo(() => {
555
- const newData = conditionChecker ? conditionChecker.applyConditions(data, data) : data;
556
- return {
557
- ...initialData,
558
- ...newData
559
- };
560
- }, [conditionChecker, data, initialData]);
691
+ data,
692
+ ...specialContextKeys
693
+ } = context;
694
+ return {
695
+ ...specialContextKeys,
696
+ ...data,
697
+ ..._wrapObjectKeysWithUnderscores(specialContextKeys)
698
+ };
699
+ }
700
+ function runRecursively(formField, fn) {
701
+ const components = formField.components || [];
702
+ components.forEach((component, index) => {
703
+ runRecursively(component, fn);
704
+ });
705
+ fn(formField);
706
+ }
707
+
708
+ // helpers //////////////////////
709
+
710
+ function _wrapObjectKeysWithUnderscores(obj) {
711
+ const newObj = {};
712
+ for (const [key, value] of Object.entries(obj)) {
713
+ newObj[`_${key}_`] = value;
714
+ }
715
+ return newObj;
561
716
  }
562
717
 
563
718
  /**
@@ -569,29 +724,125 @@ function useFilteredFormData() {
569
724
  */
570
725
  function useCondition(condition) {
571
726
  const conditionChecker = useService('conditionChecker', false);
572
- const filteredData = useFilteredFormData();
727
+ const expressionContextInfo = hooks.useContext(LocalExpressionContext$1);
573
728
  return hooks.useMemo(() => {
574
- return conditionChecker ? conditionChecker.check(condition, filteredData) : null;
575
- }, [conditionChecker, condition, filteredData]);
729
+ return conditionChecker ? conditionChecker.check(condition, buildExpressionContext(expressionContextInfo)) : null;
730
+ }, [conditionChecker, condition, expressionContextInfo]);
731
+ }
732
+
733
+ /**
734
+ * Custom hook to scroll an element into view only when it is not visible within the viewport.
735
+ *
736
+ * @param {Object} targetRef - A ref pointing to the DOM element to scroll into view.
737
+ * @param {Array} deps - An array of dependencies that trigger the effect.
738
+ * @param {Array} flagRefs - An array of refs that are used as flags to control when to scroll.
739
+ * @param {Object} [scrollOptions={}] - Options defining the behavior of the scrolling.
740
+ * @param {String} [scrollOptions.align='center'] - The alignment of the element within the viewport.
741
+ * @param {String} [scrollOptions.behavior='auto'] - The scrolling behavior.
742
+ * @param {Number} [scrollOptions.offset=0] - An offset that is added to the scroll position.
743
+ * @param {Boolean} [scrollOptions.scrollIfVisible=false] - Whether to scroll even if the element is visible.
744
+ */
745
+ function useScrollIntoView(targetRef, deps, scrollOptions = null, flagRefs = []) {
746
+ hooks.useEffect(() => {
747
+ // return early if flags are not raised, or component is not mounted
748
+ if (minDash.some(flagRefs, ref => !ref.current) || !targetRef.current) {
749
+ return;
750
+ }
751
+ for (let i = 0; i < flagRefs.length; i++) {
752
+ flagRefs[i].current = false;
753
+ }
754
+ const itemToBeScrolled = targetRef.current;
755
+ const scrollContainer = _getNearestScrollableAncestor(itemToBeScrolled);
756
+ if (!scrollContainer) {
757
+ return;
758
+ }
759
+ const itemRect = itemToBeScrolled.getBoundingClientRect();
760
+ const containerRect = scrollContainer.getBoundingClientRect();
761
+
762
+ // should scroll if visible or scrollIfVisible option is set
763
+ const shouldScroll = scrollOptions.scrollIfVisible || !(itemRect.top >= containerRect.top && itemRect.bottom <= containerRect.bottom);
764
+ if (!shouldScroll) {
765
+ return;
766
+ }
767
+ const {
768
+ align = 'center',
769
+ offset = 0,
770
+ behavior = 'auto'
771
+ } = scrollOptions;
772
+ const topOffset = _getTopOffset(itemToBeScrolled, scrollContainer, {
773
+ align,
774
+ offset
775
+ });
776
+ scrollContainer.scroll({
777
+ top: topOffset,
778
+ behavior
779
+ });
780
+
781
+ // eslint-disable-next-line react-hooks/exhaustive-deps
782
+ }, deps);
783
+ }
784
+
785
+ // helper //////////////////////
786
+
787
+ function _getNearestScrollableAncestor(el) {
788
+ while (el) {
789
+ if (el.scrollHeight > el.clientHeight) {
790
+ return el;
791
+ }
792
+ el = el.parentElement;
793
+ }
794
+ }
795
+ function _getTopOffset(item, scrollContainer, options) {
796
+ const itemRect = item.getBoundingClientRect();
797
+ const containerRect = scrollContainer.getBoundingClientRect();
798
+ if (options.align === 'top') {
799
+ return itemRect.top - containerRect.top + scrollContainer.scrollTop - options.offset;
800
+ } else if (options.align === 'bottom') {
801
+ return itemRect.bottom - containerRect.top - scrollContainer.clientHeight + scrollContainer.scrollTop + options.offset;
802
+ } else if (options.align === 'center') {
803
+ return itemRect.top - containerRect.top - scrollContainer.clientHeight / 2 + scrollContainer.scrollTop + itemRect.height / 2 + options.offset;
804
+ }
805
+ return 0;
576
806
  }
577
807
 
578
808
  /**
579
809
  * Evaluate a string reactively based on the expressionLanguage and form data.
580
810
  * If the string is not an expression, it is returned as is.
581
- * Memoised to minimize re-renders.
582
- *
583
- * @param {string} value
811
+ * The function is memoized to minimize re-renders.
584
812
  *
813
+ * @param {string} value - The string to evaluate.
814
+ * @returns {any} - Evaluated value or the original value if not an expression.
585
815
  */
586
816
  function useExpressionEvaluation(value) {
587
- const formData = useFilteredFormData();
588
817
  const expressionLanguage = useService('expressionLanguage');
818
+ const expressionContextInfo = hooks.useContext(LocalExpressionContext$1);
589
819
  return hooks.useMemo(() => {
590
820
  if (expressionLanguage && expressionLanguage.isExpression(value)) {
591
- return expressionLanguage.evaluate(value, formData);
821
+ return expressionLanguage.evaluate(value, buildExpressionContext(expressionContextInfo));
592
822
  }
593
823
  return value;
594
- }, [expressionLanguage, formData, value]);
824
+ }, [expressionLanguage, expressionContextInfo, value]);
825
+ }
826
+
827
+ /**
828
+ * Returns the conditionally filtered data of a form reactively.
829
+ * Memoised to minimize re-renders
830
+ *
831
+ * Warning: costly operation, use with care
832
+ */
833
+ function useFilteredFormData() {
834
+ const {
835
+ initialData,
836
+ data
837
+ } = useService('form')._getState();
838
+ const conditionChecker = useService('conditionChecker', false);
839
+ return hooks.useMemo(() => {
840
+ const newData = conditionChecker ? conditionChecker.applyConditions(data, data) : data;
841
+ return {
842
+ ...initialData,
843
+ ...newData
844
+ };
845
+ }, [conditionChecker, data, initialData]);
595
846
  }
596
847
 
597
848
  function useKeyDownAction(targetKey, action, listenerElement = window) {
@@ -624,7 +875,7 @@ function useKeyDownAction(targetKey, action, listenerElement = window) {
624
875
  function useReadonly(formField, properties = {}) {
625
876
  const expressionLanguage = useService('expressionLanguage');
626
877
  const conditionChecker = useService('conditionChecker', false);
627
- const filteredData = useFilteredFormData();
878
+ const expressionContextInfo = hooks.useContext(LocalExpressionContext$1);
628
879
  const {
629
880
  readonly
630
881
  } = formField;
@@ -632,7 +883,7 @@ function useReadonly(formField, properties = {}) {
632
883
  return true;
633
884
  }
634
885
  if (expressionLanguage && expressionLanguage.isExpression(readonly)) {
635
- return conditionChecker ? conditionChecker.check(readonly, filteredData) : false;
886
+ return conditionChecker ? conditionChecker.check(readonly, buildExpressionContext(expressionContextInfo)) : false;
636
887
  }
637
888
  return readonly || false;
638
889
  }
@@ -679,15 +930,15 @@ function compare(a, b) {
679
930
  * @param {Function} [options.buildDebugString]
680
931
  *
681
932
  */
682
- function useTemplateEvaluation(value, options) {
683
- const filteredData = useFilteredFormData();
933
+ function useTemplateEvaluation(value, options = {}) {
684
934
  const templating = useService('templating');
935
+ const expressionContextInfo = hooks.useContext(LocalExpressionContext$1);
685
936
  return hooks.useMemo(() => {
686
937
  if (templating && templating.isTemplate(value)) {
687
- return templating.evaluate(value, filteredData, options);
938
+ return templating.evaluate(value, buildExpressionContext(expressionContextInfo), options);
688
939
  }
689
940
  return value;
690
- }, [filteredData, templating, value, options]);
941
+ }, [templating, value, expressionContextInfo, options]);
691
942
  }
692
943
 
693
944
  /**
@@ -767,11 +1018,13 @@ function Label(props) {
767
1018
  });
768
1019
  }
769
1020
 
770
- const type$d = 'checkbox';
1021
+ const type$e = 'checkbox';
771
1022
  function Checkbox(props) {
772
1023
  const {
773
1024
  disabled,
774
1025
  errors = [],
1026
+ errorMessageId,
1027
+ domId,
775
1028
  onBlur,
776
1029
  onFocus,
777
1030
  field,
@@ -780,7 +1033,6 @@ function Checkbox(props) {
780
1033
  } = props;
781
1034
  const {
782
1035
  description,
783
- id,
784
1036
  label,
785
1037
  validate = {}
786
1038
  } = field;
@@ -795,12 +1047,8 @@ function Checkbox(props) {
795
1047
  value: target.checked
796
1048
  });
797
1049
  };
798
- const {
799
- formId
800
- } = hooks.useContext(FormContext$1);
801
- const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
802
1050
  return jsxRuntime.jsxs("div", {
803
- class: classNames(formFieldClasses(type$d, {
1051
+ class: classNames(formFieldClasses(type$e, {
804
1052
  errors,
805
1053
  disabled,
806
1054
  readonly
@@ -808,7 +1056,7 @@ function Checkbox(props) {
808
1056
  'fjs-checked': value
809
1057
  }),
810
1058
  children: [jsxRuntime.jsx(Label, {
811
- id: prefixId(id, formId),
1059
+ id: domId,
812
1060
  label: label,
813
1061
  required: required,
814
1062
  children: jsxRuntime.jsx("input", {
@@ -816,7 +1064,7 @@ function Checkbox(props) {
816
1064
  class: "fjs-input",
817
1065
  disabled: disabled,
818
1066
  readOnly: readonly,
819
- id: prefixId(id, formId),
1067
+ id: domId,
820
1068
  type: "checkbox",
821
1069
  onChange: onChange,
822
1070
  onBlur: () => onBlur && onBlur(),
@@ -832,7 +1080,7 @@ function Checkbox(props) {
832
1080
  });
833
1081
  }
834
1082
  Checkbox.config = {
835
- type: type$d,
1083
+ type: type$e,
836
1084
  keyed: true,
837
1085
  label: 'Checkbox',
838
1086
  group: 'selection',
@@ -1006,37 +1254,6 @@ function useCleanupMultiSelectValues (props) {
1006
1254
  }, [field, options, onChange, JSON.stringify(values), loadState]);
1007
1255
  }
1008
1256
 
1009
- // config ///////////////////
1010
-
1011
- const MINUTES_IN_DAY = 60 * 24;
1012
- const DATETIME_SUBTYPES = {
1013
- DATE: 'date',
1014
- TIME: 'time',
1015
- DATETIME: 'datetime'
1016
- };
1017
- const TIME_SERIALISING_FORMATS = {
1018
- UTC_OFFSET: 'utc_offset',
1019
- UTC_NORMALIZED: 'utc_normalized',
1020
- NO_TIMEZONE: 'no_timezone'
1021
- };
1022
- const DATETIME_SUBTYPES_LABELS = {
1023
- [DATETIME_SUBTYPES.DATE]: 'Date',
1024
- [DATETIME_SUBTYPES.TIME]: 'Time',
1025
- [DATETIME_SUBTYPES.DATETIME]: 'Date & Time'
1026
- };
1027
- const TIME_SERIALISINGFORMAT_LABELS = {
1028
- [TIME_SERIALISING_FORMATS.UTC_OFFSET]: 'UTC offset',
1029
- [TIME_SERIALISING_FORMATS.UTC_NORMALIZED]: 'UTC normalized',
1030
- [TIME_SERIALISING_FORMATS.NO_TIMEZONE]: 'No timezone'
1031
- };
1032
- const DATETIME_SUBTYPE_PATH = ['subtype'];
1033
- const DATE_LABEL_PATH = ['dateLabel'];
1034
- const DATE_DISALLOW_PAST_PATH = ['disallowPassedDates'];
1035
- const TIME_LABEL_PATH = ['timeLabel'];
1036
- const TIME_USE24H_PATH = ['use24h'];
1037
- const TIME_INTERVAL_PATH = ['timeInterval'];
1038
- const TIME_SERIALISING_FORMAT_PATH = ['timeSerializingFormat'];
1039
-
1040
1257
  const ENTER_KEYDOWN_EVENT = new KeyboardEvent('keydown', {
1041
1258
  code: 'Enter',
1042
1259
  key: 'Enter',
@@ -1243,11 +1460,13 @@ function sanitizeMultiSelectValue(options) {
1243
1460
  }
1244
1461
  }
1245
1462
 
1246
- const type$c = 'checklist';
1463
+ const type$d = 'checklist';
1247
1464
  function Checklist(props) {
1248
1465
  const {
1249
1466
  disabled,
1250
1467
  errors = [],
1468
+ errorMessageId,
1469
+ domId,
1251
1470
  onBlur,
1252
1471
  onFocus,
1253
1472
  field,
@@ -1256,7 +1475,6 @@ function Checklist(props) {
1256
1475
  } = props;
1257
1476
  const {
1258
1477
  description,
1259
- id,
1260
1478
  label,
1261
1479
  validate = {}
1262
1480
  } = field;
@@ -1299,12 +1517,8 @@ function Checklist(props) {
1299
1517
  values,
1300
1518
  onChange: props.onChange
1301
1519
  });
1302
- const {
1303
- formId
1304
- } = hooks.useContext(FormContext$1);
1305
- const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
1306
1520
  return jsxRuntime.jsxs("div", {
1307
- class: classNames(formFieldClasses(type$c, {
1521
+ class: classNames(formFieldClasses(type$d, {
1308
1522
  errors,
1309
1523
  disabled,
1310
1524
  readonly
@@ -1313,27 +1527,28 @@ function Checklist(props) {
1313
1527
  children: [jsxRuntime.jsx(Label, {
1314
1528
  label: label,
1315
1529
  required: required
1316
- }), loadState == LOAD_STATES.LOADED && options.map((v, index) => {
1530
+ }), loadState == LOAD_STATES.LOADED && options.map((o, index) => {
1531
+ const itemDomId = `${domId}-${index}`;
1317
1532
  return jsxRuntime.jsx(Label, {
1318
- id: prefixId(`${id}-${index}`, formId),
1319
- label: v.label,
1533
+ id: itemDomId,
1534
+ label: o.label,
1320
1535
  class: classNames({
1321
- 'fjs-checked': values.includes(v.value)
1536
+ 'fjs-checked': values.includes(o.value)
1322
1537
  }),
1323
1538
  required: false,
1324
1539
  children: jsxRuntime.jsx("input", {
1325
- checked: values.includes(v.value),
1540
+ checked: values.includes(o.value),
1326
1541
  class: "fjs-input",
1327
1542
  disabled: disabled,
1328
1543
  readOnly: readonly,
1329
- id: prefixId(`${id}-${index}`, formId),
1544
+ id: itemDomId,
1330
1545
  type: "checkbox",
1331
- onClick: () => toggleCheckbox(v.value),
1546
+ onClick: () => toggleCheckbox(o.value),
1332
1547
  onBlur: onCheckboxBlur,
1333
1548
  onFocus: onCheckboxFocus,
1334
1549
  "aria-describedby": errorMessageId
1335
1550
  })
1336
- }, `${id}-${index}`);
1551
+ });
1337
1552
  }), jsxRuntime.jsx(Description, {
1338
1553
  description: description
1339
1554
  }), jsxRuntime.jsx(Errors, {
@@ -1343,7 +1558,7 @@ function Checklist(props) {
1343
1558
  });
1344
1559
  }
1345
1560
  Checklist.config = {
1346
- type: type$c,
1561
+ type: type$d,
1347
1562
  keyed: true,
1348
1563
  label: 'Checkbox group',
1349
1564
  group: 'selection',
@@ -1356,6 +1571,7 @@ const noop$1 = () => false;
1356
1571
  function FormField(props) {
1357
1572
  const {
1358
1573
  field,
1574
+ indexes,
1359
1575
  onChange
1360
1576
  } = props;
1361
1577
  const formFields = useService('formFields'),
@@ -1371,14 +1587,19 @@ function FormField(props) {
1371
1587
  } = form._getState();
1372
1588
  const {
1373
1589
  Element,
1374
- Empty,
1590
+ Hidden,
1375
1591
  Column
1376
1592
  } = hooks.useContext(FormRenderContext$1);
1593
+ const {
1594
+ formId
1595
+ } = hooks.useContext(FormContext$1);
1377
1596
  const FormFieldComponent = formFields.get(field.type);
1378
1597
  if (!FormFieldComponent) {
1379
1598
  throw new Error(`cannot render field <${field.type}>`);
1380
1599
  }
1381
- const valuePath = hooks.useMemo(() => pathRegistry.getValuePath(field), [field, pathRegistry]);
1600
+ const valuePath = hooks.useMemo(() => pathRegistry.getValuePath(field, {
1601
+ indexes
1602
+ }), [field, indexes, pathRegistry]);
1382
1603
  const initialValue = hooks.useMemo(() => minDash.get(initialData, valuePath), [initialData, valuePath]);
1383
1604
  const readonly = useReadonly(field, properties);
1384
1605
  const value = minDash.get(data, valuePath);
@@ -1387,12 +1608,12 @@ function FormField(props) {
1387
1608
  const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
1388
1609
  const onBlur = hooks.useCallback(() => {
1389
1610
  if (viewerCommands) {
1390
- viewerCommands.updateFieldValidation(field, value);
1611
+ viewerCommands.updateFieldValidation(field, value, indexes);
1391
1612
  }
1392
1613
  eventBus.fire('formField.blur', {
1393
1614
  formField: field
1394
1615
  });
1395
- }, [eventBus, viewerCommands, field, value]);
1616
+ }, [eventBus, viewerCommands, field, value, indexes]);
1396
1617
  const onFocus = hooks.useCallback(() => {
1397
1618
  eventBus.fire('formField.focus', {
1398
1619
  formField: field
@@ -1400,13 +1621,25 @@ function FormField(props) {
1400
1621
  }, [eventBus, field]);
1401
1622
  hooks.useEffect(() => {
1402
1623
  if (viewerCommands && initialValue) {
1403
- viewerCommands.updateFieldValidation(field, initialValue);
1624
+ viewerCommands.updateFieldValidation(field, initialValue, indexes);
1404
1625
  }
1405
- }, [viewerCommands, field, initialValue]);
1626
+ }, [viewerCommands, field, initialValue, JSON.stringify(indexes)]);
1406
1627
  const hidden = useCondition(field.conditional && field.conditional.hide || null);
1628
+ const onChangeIndexed = hooks.useCallback(update => {
1629
+ // add indexes of the keyed field to the update, if any
1630
+ onChange(FormFieldComponent.config.keyed ? {
1631
+ ...update,
1632
+ indexes
1633
+ } : update);
1634
+ }, [onChange, FormFieldComponent.config.keyed, indexes]);
1407
1635
  if (hidden) {
1408
- return jsxRuntime.jsx(Empty, {});
1636
+ return jsxRuntime.jsx(Hidden, {
1637
+ field: field
1638
+ });
1409
1639
  }
1640
+ const domId = `${prefixId(field.id, formId, indexes)}`;
1641
+ const fieldErrors = minDash.get(errors, [field.id, ...Object.values(indexes || {})]) || [];
1642
+ const errorMessageId = errors.length === 0 ? undefined : `${domId}-error-message`;
1410
1643
  return jsxRuntime.jsx(Column, {
1411
1644
  field: field,
1412
1645
  class: gridColumnClasses(field),
@@ -1416,8 +1649,10 @@ function FormField(props) {
1416
1649
  children: jsxRuntime.jsx(FormFieldComponent, {
1417
1650
  ...props,
1418
1651
  disabled: disabled,
1419
- errors: errors[field.id],
1420
- onChange: disabled || readonly ? noop$1 : onChange,
1652
+ errors: fieldErrors,
1653
+ errorMessageId: errorMessageId,
1654
+ domId: domId,
1655
+ onChange: disabled || readonly ? noop$1 : onChangeIndexed,
1421
1656
  onBlur: disabled || readonly ? noop$1 : onBlur,
1422
1657
  onFocus: disabled || readonly ? noop$1 : onFocus,
1423
1658
  readonly: readonly,
@@ -1427,60 +1662,147 @@ function FormField(props) {
1427
1662
  });
1428
1663
  }
1429
1664
 
1430
- function Grid(props) {
1665
+ function ChildrenRenderer(props) {
1431
1666
  const {
1432
- Children,
1433
- Row
1667
+ Children
1434
1668
  } = hooks.useContext(FormRenderContext$1);
1435
1669
  const {
1436
1670
  field,
1437
1671
  Empty
1438
1672
  } = props;
1439
1673
  const {
1440
- id,
1441
- components = []
1674
+ id
1442
1675
  } = field;
1443
- const formLayouter = useService('formLayouter');
1444
- const formFieldRegistry = useService('formFieldRegistry');
1445
- const rows = formLayouter.getRows(id);
1446
- return jsxRuntime.jsxs(Children, {
1447
- class: "fjs-vertical-layout fjs-children cds--grid cds--grid--condensed",
1448
- field: field,
1449
- children: [rows.map(row => {
1450
- const {
1451
- components = []
1452
- } = row;
1453
- if (!components.length) {
1676
+ const repeatRenderManager = useService('repeatRenderManager', false);
1677
+ const isRepeating = repeatRenderManager && repeatRenderManager.isFieldRepeating(id);
1678
+ const Repeater = repeatRenderManager.Repeater;
1679
+ const RepeatFooter = repeatRenderManager.RepeatFooter;
1680
+ return isRepeating ? jsxRuntime.jsx(RepeatChildrenRenderer, {
1681
+ ...props,
1682
+ ChildrenRoot: Children,
1683
+ Empty,
1684
+ Repeater,
1685
+ RepeatFooter,
1686
+ repeatRenderManager
1687
+ }) : jsxRuntime.jsx(SimpleChildrenRenderer, {
1688
+ ...props,
1689
+ ChildrenRoot: Children,
1690
+ Empty
1691
+ });
1692
+ }
1693
+ function SimpleChildrenRenderer(props) {
1694
+ const {
1695
+ ChildrenRoot,
1696
+ Empty,
1697
+ field
1698
+ } = props;
1699
+ const {
1700
+ components = []
1701
+ } = field;
1702
+ const isEmpty = !components.length;
1703
+ return jsxRuntime.jsxs(ChildrenRoot, {
1704
+ class: "fjs-vertical-layout fjs-children cds--grid cds--grid--condensed",
1705
+ field: field,
1706
+ children: [jsxRuntime.jsx(RowsRenderer, {
1707
+ ...props
1708
+ }), isEmpty ? jsxRuntime.jsx(Empty, {
1709
+ field: field
1710
+ }) : null]
1711
+ });
1712
+ }
1713
+ function RepeatChildrenRenderer(props) {
1714
+ const {
1715
+ ChildrenRoot,
1716
+ repeatRenderManager,
1717
+ Empty,
1718
+ field,
1719
+ ...restProps
1720
+ } = props;
1721
+ const {
1722
+ components = []
1723
+ } = field;
1724
+ const useSharedState = hooks.useState({
1725
+ isCollapsed: true
1726
+ });
1727
+ const Repeater = repeatRenderManager.Repeater;
1728
+ const RepeatFooter = repeatRenderManager.RepeatFooter;
1729
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1730
+ children: [jsxRuntime.jsxs(ChildrenRoot, {
1731
+ class: "fjs-vertical-layout fjs-children cds--grid cds--grid--condensed",
1732
+ field: field,
1733
+ children: [Repeater ? jsxRuntime.jsx(Repeater, {
1734
+ ...restProps,
1735
+ useSharedState,
1736
+ field,
1737
+ RowsRenderer
1738
+ }) : jsxRuntime.jsx(RowsRenderer, {
1739
+ ...restProps,
1740
+ field
1741
+ }), !components.length ? jsxRuntime.jsx(Empty, {
1742
+ field: field
1743
+ }) : null]
1744
+ }), RepeatFooter ? jsxRuntime.jsx(RepeatFooter, {
1745
+ ...restProps,
1746
+ useSharedState,
1747
+ field
1748
+ }) : null]
1749
+ });
1750
+ }
1751
+ function RowsRenderer(props) {
1752
+ const {
1753
+ field,
1754
+ indexes
1755
+ } = props;
1756
+ const {
1757
+ id: parentId,
1758
+ verticalAlignment = 'start'
1759
+ } = field;
1760
+ const formLayouter = useService('formLayouter');
1761
+ const formFieldRegistry = useService('formFieldRegistry');
1762
+ const rows = formLayouter.getRows(parentId);
1763
+ const {
1764
+ Row
1765
+ } = hooks.useContext(FormRenderContext$1);
1766
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1767
+ children: [" ", rows.map(row => {
1768
+ const {
1769
+ components = []
1770
+ } = row;
1771
+ if (!components.length) {
1454
1772
  return null;
1455
1773
  }
1456
1774
  return jsxRuntime.jsx(Row, {
1457
1775
  row: row,
1458
1776
  class: "fjs-layout-row cds--row",
1459
- children: components.map(id => {
1460
- const childField = formFieldRegistry.get(id);
1777
+ style: {
1778
+ alignItems: verticalAlignment
1779
+ },
1780
+ children: components.map(childId => {
1781
+ const childField = formFieldRegistry.get(childId);
1461
1782
  if (!childField) {
1462
1783
  return null;
1463
1784
  }
1464
1785
  return preact.createElement(FormField, {
1465
1786
  ...props,
1466
- key: childField.id,
1467
- field: childField
1787
+ key: childId,
1788
+ field: childField,
1789
+ indexes: indexes
1468
1790
  });
1469
1791
  })
1470
1792
  });
1471
- }), components.length ? null : jsxRuntime.jsx(Empty, {})]
1793
+ }), " "]
1472
1794
  });
1473
1795
  }
1474
1796
 
1475
1797
  function FormComponent$1(props) {
1476
1798
  const {
1477
- EmptyRoot
1799
+ Empty
1478
1800
  } = hooks.useContext(FormRenderContext$1);
1479
1801
  const fullProps = {
1480
1802
  ...props,
1481
- Empty: EmptyRoot
1803
+ Empty
1482
1804
  };
1483
- return jsxRuntime.jsx(Grid, {
1805
+ return jsxRuntime.jsx(ChildrenRenderer, {
1484
1806
  ...fullProps
1485
1807
  });
1486
1808
  }
@@ -1495,24 +1817,6 @@ FormComponent$1.config = {
1495
1817
  })
1496
1818
  };
1497
1819
 
1498
- var _path$k;
1499
- function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
1500
- var SvgCalendar = function SvgCalendar(props) {
1501
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
1502
- xmlns: "http://www.w3.org/2000/svg",
1503
- width: 14,
1504
- height: 15,
1505
- fill: "none",
1506
- viewBox: "0 0 28 30"
1507
- }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
1508
- fill: "currentColor",
1509
- fillRule: "evenodd",
1510
- d: "M19 2H9V0H7v2H2a2 2 0 0 0-2 2v24a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-5V0h-2v2ZM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7Zm-5 4v17h24V11H2Z",
1511
- clipRule: "evenodd"
1512
- })));
1513
- };
1514
- var CalendarIcon = SvgCalendar;
1515
-
1516
1820
  /**
1517
1821
  * Returns date format for the provided locale.
1518
1822
  * If the locale is not provided, uses the browser's locale.
@@ -1581,6 +1885,24 @@ function flatpickerizeDateFormat(dateFormat) {
1581
1885
  return dateFormat;
1582
1886
  }
1583
1887
 
1888
+ var _path$u;
1889
+ function _extends$w() { _extends$w = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$w.apply(this, arguments); }
1890
+ var SvgCalendar = function SvgCalendar(props) {
1891
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$w({
1892
+ xmlns: "http://www.w3.org/2000/svg",
1893
+ width: 14,
1894
+ height: 15,
1895
+ fill: "none",
1896
+ viewBox: "0 0 28 30"
1897
+ }, props), _path$u || (_path$u = /*#__PURE__*/React__namespace.createElement("path", {
1898
+ fill: "currentColor",
1899
+ fillRule: "evenodd",
1900
+ d: "M19 2H9V0H7v2H2a2 2 0 0 0-2 2v24a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-5V0h-2v2ZM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7Zm-5 4v17h24V11H2Z",
1901
+ clipRule: "evenodd"
1902
+ })));
1903
+ };
1904
+ var CalendarIcon = SvgCalendar;
1905
+
1584
1906
  function InputAdorner(props) {
1585
1907
  const {
1586
1908
  pre,
@@ -1621,12 +1943,11 @@ function InputAdorner(props) {
1621
1943
 
1622
1944
  function Datepicker(props) {
1623
1945
  const {
1624
- id,
1625
1946
  label,
1947
+ domId,
1626
1948
  collapseLabelOnEmpty,
1627
1949
  onDateTimeBlur,
1628
1950
  onDateTimeFocus,
1629
- formId,
1630
1951
  required,
1631
1952
  disabled,
1632
1953
  disallowPassedDates,
@@ -1726,11 +2047,10 @@ function Datepicker(props) {
1726
2047
  }
1727
2048
  onDateTimeBlur(e);
1728
2049
  }, [isInputDirty, onDateTimeBlur]);
1729
- const fullId = `${prefixId(id, formId)}--date`;
1730
2050
  return jsxRuntime.jsxs("div", {
1731
2051
  class: "fjs-datetime-subsection",
1732
2052
  children: [jsxRuntime.jsx(Label, {
1733
- id: fullId,
2053
+ id: domId,
1734
2054
  label: label,
1735
2055
  collapseOnEmpty: collapseLabelOnEmpty,
1736
2056
  required: required
@@ -1748,7 +2068,7 @@ function Datepicker(props) {
1748
2068
  children: jsxRuntime.jsx("input", {
1749
2069
  ref: dateInputRef,
1750
2070
  type: "text",
1751
- id: fullId,
2071
+ id: domId,
1752
2072
  class: "fjs-input",
1753
2073
  disabled: disabled,
1754
2074
  readOnly: readonly,
@@ -1767,19 +2087,19 @@ function Datepicker(props) {
1767
2087
  });
1768
2088
  }
1769
2089
 
1770
- var _path$j, _path2$4;
1771
- function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
2090
+ var _path$t, _path2$5;
2091
+ function _extends$v() { _extends$v = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
1772
2092
  var SvgClock = function SvgClock(props) {
1773
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
2093
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$v({
1774
2094
  xmlns: "http://www.w3.org/2000/svg",
1775
2095
  width: 16,
1776
2096
  height: 16,
1777
2097
  fill: "none",
1778
2098
  viewBox: "0 0 28 29"
1779
- }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
2099
+ }, props), _path$t || (_path$t = /*#__PURE__*/React__namespace.createElement("path", {
1780
2100
  fill: "currentColor",
1781
2101
  d: "M13 14.41 18.59 20 20 18.59l-5-5.01V5h-2v9.41Z"
1782
- })), _path2$4 || (_path2$4 = /*#__PURE__*/React__namespace.createElement("path", {
2102
+ })), _path2$5 || (_path2$5 = /*#__PURE__*/React__namespace.createElement("path", {
1783
2103
  fill: "currentColor",
1784
2104
  fillRule: "evenodd",
1785
2105
  d: "M6.222 25.64A14 14 0 1 0 21.778 2.36 14 14 0 0 0 6.222 25.64ZM7.333 4.023a12 12 0 1 1 13.334 19.955A12 12 0 0 1 7.333 4.022Z",
@@ -1886,12 +2206,11 @@ function DropdownList(props) {
1886
2206
 
1887
2207
  function Timepicker(props) {
1888
2208
  const {
1889
- id,
1890
2209
  label,
1891
2210
  collapseLabelOnEmpty,
1892
2211
  onDateTimeBlur,
1893
2212
  onDateTimeFocus,
1894
- formId,
2213
+ domId,
1895
2214
  required,
1896
2215
  disabled,
1897
2216
  readonly,
@@ -2000,11 +2319,10 @@ function Timepicker(props) {
2000
2319
  setDropdownIsOpen(false);
2001
2320
  propagateRawToMinute(value);
2002
2321
  };
2003
- const fullId = `${prefixId(id, formId)}--time`;
2004
2322
  return jsxRuntime.jsxs("div", {
2005
2323
  class: "fjs-datetime-subsection",
2006
2324
  children: [jsxRuntime.jsx(Label, {
2007
- id: fullId,
2325
+ id: domId,
2008
2326
  label: label,
2009
2327
  collapseOnEmpty: collapseLabelOnEmpty,
2010
2328
  required: required
@@ -2018,7 +2336,7 @@ function Timepicker(props) {
2018
2336
  children: [jsxRuntime.jsx("input", {
2019
2337
  ref: timeInputRef,
2020
2338
  type: "text",
2021
- id: fullId,
2339
+ id: domId,
2022
2340
  class: "fjs-input",
2023
2341
  value: rawValue,
2024
2342
  disabled: disabled,
@@ -2050,11 +2368,12 @@ function Timepicker(props) {
2050
2368
  });
2051
2369
  }
2052
2370
 
2053
- const type$b = 'datetime';
2371
+ const type$c = 'datetime';
2054
2372
  function Datetime(props) {
2055
2373
  const {
2056
2374
  disabled,
2057
2375
  errors = [],
2376
+ domId,
2058
2377
  onBlur,
2059
2378
  onFocus,
2060
2379
  field,
@@ -2191,12 +2510,11 @@ function Datetime(props) {
2191
2510
  }, []);
2192
2511
  const errorMessageId = allErrors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
2193
2512
  const datePickerProps = {
2194
- id,
2195
2513
  label: dateLabel,
2196
2514
  collapseLabelOnEmpty: !timeLabel,
2197
2515
  onDateTimeBlur,
2198
2516
  onDateTimeFocus,
2199
- formId,
2517
+ domId: `${domId}-date`,
2200
2518
  required,
2201
2519
  disabled,
2202
2520
  disallowPassedDates,
@@ -2206,12 +2524,11 @@ function Datetime(props) {
2206
2524
  'aria-describedby': errorMessageId
2207
2525
  };
2208
2526
  const timePickerProps = {
2209
- id,
2210
2527
  label: timeLabel,
2211
2528
  collapseLabelOnEmpty: !dateLabel,
2212
2529
  onDateTimeBlur,
2213
2530
  onDateTimeFocus,
2214
- formId,
2531
+ domId: `${domId}-time`,
2215
2532
  required,
2216
2533
  disabled,
2217
2534
  readonly,
@@ -2222,7 +2539,7 @@ function Datetime(props) {
2222
2539
  'aria-describedby': errorMessageId
2223
2540
  };
2224
2541
  return jsxRuntime.jsxs("div", {
2225
- class: formFieldClasses(type$b, {
2542
+ class: formFieldClasses(type$c, {
2226
2543
  errors: allErrors,
2227
2544
  disabled,
2228
2545
  readonly
@@ -2246,7 +2563,7 @@ function Datetime(props) {
2246
2563
  });
2247
2564
  }
2248
2565
  Datetime.config = {
2249
- type: type$b,
2566
+ type: type$c,
2250
2567
  keyed: true,
2251
2568
  label: 'Date time',
2252
2569
  group: 'basic-input',
@@ -2375,32 +2692,39 @@ function FormComponent(props) {
2375
2692
  event.preventDefault();
2376
2693
  onReset();
2377
2694
  };
2695
+ const filteredFormData = useFilteredFormData();
2696
+ const localExpressionContext = hooks.useMemo(() => ({
2697
+ data: filteredFormData,
2698
+ parent: null,
2699
+ this: filteredFormData,
2700
+ i: []
2701
+ }), [filteredFormData]);
2378
2702
  return jsxRuntime.jsxs("form", {
2379
2703
  class: "fjs-form",
2380
2704
  onSubmit: handleSubmit,
2381
2705
  onReset: handleReset,
2382
2706
  "aria-label": ariaLabel,
2383
2707
  noValidate: true,
2384
- children: [jsxRuntime.jsx(FormField, {
2385
- field: schema,
2386
- onChange: onChange
2708
+ children: [jsxRuntime.jsx(LocalExpressionContext$1.Provider, {
2709
+ value: localExpressionContext,
2710
+ children: jsxRuntime.jsx(FormField, {
2711
+ field: schema,
2712
+ onChange: onChange
2713
+ })
2387
2714
  }), jsxRuntime.jsx(PoweredBy, {})]
2388
2715
  });
2389
2716
  }
2390
2717
 
2391
2718
  function Group(props) {
2392
2719
  const {
2393
- field
2720
+ field,
2721
+ domId
2394
2722
  } = props;
2395
2723
  const {
2396
2724
  label,
2397
- id,
2398
2725
  type,
2399
2726
  showOutline
2400
2727
  } = field;
2401
- const {
2402
- formId
2403
- } = hooks.useContext(FormContext$1);
2404
2728
  const {
2405
2729
  Empty
2406
2730
  } = hooks.useContext(FormRenderContext$1);
@@ -2409,15 +2733,15 @@ function Group(props) {
2409
2733
  Empty
2410
2734
  };
2411
2735
  return jsxRuntime.jsxs("div", {
2412
- className: classNames(formFieldClasses(type), {
2736
+ className: classNames(formFieldClasses(type), 'fjs-form-field-grouplike', {
2413
2737
  'fjs-outlined': showOutline
2414
2738
  }),
2415
2739
  role: "group",
2416
- "aria-labelledby": prefixId(id, formId),
2740
+ "aria-labelledby": domId,
2417
2741
  children: [jsxRuntime.jsx(Label, {
2418
- id: prefixId(id, formId),
2742
+ id: domId,
2419
2743
  label: label
2420
- }), jsxRuntime.jsx(Grid, {
2744
+ }), jsxRuntime.jsx(ChildrenRenderer, {
2421
2745
  ...fullProps
2422
2746
  })]
2423
2747
  });
@@ -2574,7 +2898,7 @@ function isValidAttribute(lcTag, lcName, value) {
2574
2898
  return true;
2575
2899
  }
2576
2900
 
2577
- const type$a = 'iframe';
2901
+ const type$b = 'iframe';
2578
2902
  const DEFAULT_HEIGHT = 300;
2579
2903
  function IFrame(props) {
2580
2904
  const {
@@ -2599,7 +2923,7 @@ function IFrame(props) {
2599
2923
  formId
2600
2924
  } = hooks.useContext(FormContext$1);
2601
2925
  return jsxRuntime.jsxs("div", {
2602
- class: formFieldClasses(type$a, {
2926
+ class: formFieldClasses(type$b, {
2603
2927
  disabled,
2604
2928
  readonly
2605
2929
  }),
@@ -2633,7 +2957,7 @@ function IFramePlaceholder(props) {
2633
2957
  });
2634
2958
  }
2635
2959
  IFrame.config = {
2636
- type: type$a,
2960
+ type: type$b,
2637
2961
  keyed: false,
2638
2962
  label: 'iFrame',
2639
2963
  group: 'container',
@@ -2642,9 +2966,9 @@ IFrame.config = {
2642
2966
  })
2643
2967
  };
2644
2968
 
2645
- function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
2969
+ function _extends$u() { _extends$u = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
2646
2970
  var SvgImagePlaceholder = function SvgImagePlaceholder(props) {
2647
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
2971
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
2648
2972
  xmlns: "http://www.w3.org/2000/svg",
2649
2973
  xmlSpace: "preserve",
2650
2974
  width: 64,
@@ -2683,7 +3007,7 @@ var SvgImagePlaceholder = function SvgImagePlaceholder(props) {
2683
3007
  };
2684
3008
  var ImagePlaceholder = SvgImagePlaceholder;
2685
3009
 
2686
- const type$9 = 'image';
3010
+ const type$a = 'image';
2687
3011
  function Image(props) {
2688
3012
  const {
2689
3013
  field
@@ -2704,7 +3028,7 @@ function Image(props) {
2704
3028
  formId
2705
3029
  } = hooks.useContext(FormContext$1);
2706
3030
  return jsxRuntime.jsx("div", {
2707
- class: formFieldClasses(type$9),
3031
+ class: formFieldClasses(type$a),
2708
3032
  children: jsxRuntime.jsxs("div", {
2709
3033
  class: "fjs-image-container",
2710
3034
  children: [safeSource && jsxRuntime.jsx("img", {
@@ -2722,7 +3046,7 @@ function Image(props) {
2722
3046
  });
2723
3047
  }
2724
3048
  Image.config = {
2725
- type: type$9,
3049
+ type: type$a,
2726
3050
  keyed: false,
2727
3051
  label: 'Image view',
2728
3052
  group: 'presentation',
@@ -2749,14 +3073,14 @@ function TemplatedInputAdorner(props) {
2749
3073
  });
2750
3074
  }
2751
3075
 
2752
- var _path$i;
2753
- function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
3076
+ var _path$s;
3077
+ function _extends$t() { _extends$t = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
2754
3078
  var SvgAngelDown = function SvgAngelDown(props) {
2755
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
3079
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
2756
3080
  xmlns: "http://www.w3.org/2000/svg",
2757
3081
  width: 8,
2758
3082
  height: 8
2759
- }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
3083
+ }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
2760
3084
  fill: "currentColor",
2761
3085
  fillRule: "evenodd",
2762
3086
  stroke: "currentColor",
@@ -2767,14 +3091,14 @@ var SvgAngelDown = function SvgAngelDown(props) {
2767
3091
  };
2768
3092
  var AngelDownIcon = SvgAngelDown;
2769
3093
 
2770
- var _path$h;
2771
- function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
3094
+ var _path$r;
3095
+ function _extends$s() { _extends$s = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
2772
3096
  var SvgAngelUp = function SvgAngelUp(props) {
2773
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
3097
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
2774
3098
  xmlns: "http://www.w3.org/2000/svg",
2775
3099
  width: 8,
2776
3100
  height: 8
2777
- }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
3101
+ }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
2778
3102
  fill: "currentColor",
2779
3103
  fillRule: "evenodd",
2780
3104
  stroke: "currentColor",
@@ -2810,11 +3134,13 @@ function isNullEquivalentValue(value) {
2810
3134
  return value === undefined || value === null || value === '';
2811
3135
  }
2812
3136
 
2813
- const type$8 = 'number';
3137
+ const type$9 = 'number';
2814
3138
  function Numberfield(props) {
2815
3139
  const {
2816
3140
  disabled,
2817
3141
  errors = [],
3142
+ errorMessageId,
3143
+ domId,
2818
3144
  onBlur,
2819
3145
  onFocus,
2820
3146
  field,
@@ -2824,7 +3150,6 @@ function Numberfield(props) {
2824
3150
  } = props;
2825
3151
  const {
2826
3152
  description,
2827
- id,
2828
3153
  label,
2829
3154
  appearance = {},
2830
3155
  validate = {},
@@ -2944,18 +3269,14 @@ function Numberfield(props) {
2944
3269
  e.preventDefault();
2945
3270
  }
2946
3271
  };
2947
- const {
2948
- formId
2949
- } = hooks.useContext(FormContext$1);
2950
- const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
2951
3272
  return jsxRuntime.jsxs("div", {
2952
- class: formFieldClasses(type$8, {
3273
+ class: formFieldClasses(type$9, {
2953
3274
  errors,
2954
3275
  disabled,
2955
3276
  readonly
2956
3277
  }),
2957
3278
  children: [jsxRuntime.jsx(Label, {
2958
- id: prefixId(id, formId),
3279
+ id: domId,
2959
3280
  label: label,
2960
3281
  required: required
2961
3282
  }), jsxRuntime.jsx(TemplatedInputAdorner, {
@@ -2975,7 +3296,7 @@ function Numberfield(props) {
2975
3296
  class: "fjs-input",
2976
3297
  disabled: disabled,
2977
3298
  readOnly: readonly,
2978
- id: prefixId(id, formId),
3299
+ id: domId,
2979
3300
  onKeyDown: onKeyDown,
2980
3301
  onKeyPress: onKeyPress,
2981
3302
  onBlur: () => onBlur && onBlur(),
@@ -3022,7 +3343,7 @@ function Numberfield(props) {
3022
3343
  });
3023
3344
  }
3024
3345
  Numberfield.config = {
3025
- type: type$8,
3346
+ type: type$9,
3026
3347
  keyed: true,
3027
3348
  label: 'Number',
3028
3349
  group: 'basic-input',
@@ -3066,11 +3387,13 @@ function useCleanupSingleSelectValue (props) {
3066
3387
  }, [field, options, onChange, value, loadState]);
3067
3388
  }
3068
3389
 
3069
- const type$7 = 'radio';
3390
+ const type$8 = 'radio';
3070
3391
  function Radio(props) {
3071
3392
  const {
3072
3393
  disabled,
3073
3394
  errors = [],
3395
+ errorMessageId,
3396
+ domId,
3074
3397
  onBlur,
3075
3398
  onFocus,
3076
3399
  field,
@@ -3079,7 +3402,6 @@ function Radio(props) {
3079
3402
  } = props;
3080
3403
  const {
3081
3404
  description,
3082
- id,
3083
3405
  label,
3084
3406
  validate = {}
3085
3407
  } = field;
@@ -3116,12 +3438,8 @@ function Radio(props) {
3116
3438
  value,
3117
3439
  onChange: props.onChange
3118
3440
  });
3119
- const {
3120
- formId
3121
- } = hooks.useContext(FormContext$1);
3122
- const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3123
3441
  return jsxRuntime.jsxs("div", {
3124
- class: formFieldClasses(type$7, {
3442
+ class: formFieldClasses(type$8, {
3125
3443
  errors,
3126
3444
  disabled,
3127
3445
  readonly
@@ -3131,8 +3449,9 @@ function Radio(props) {
3131
3449
  label: label,
3132
3450
  required: required
3133
3451
  }), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
3452
+ const itemDomId = `${domId}-${index}`;
3134
3453
  return jsxRuntime.jsx(Label, {
3135
- id: prefixId(`${id}-${index}`, formId),
3454
+ id: itemDomId,
3136
3455
  label: option.label,
3137
3456
  class: classNames({
3138
3457
  'fjs-checked': option.value === value
@@ -3143,14 +3462,14 @@ function Radio(props) {
3143
3462
  class: "fjs-input",
3144
3463
  disabled: disabled,
3145
3464
  readOnly: readonly,
3146
- id: prefixId(`${id}-${index}`, formId),
3465
+ id: itemDomId,
3147
3466
  type: "radio",
3148
3467
  onClick: () => onChange(option.value),
3149
3468
  onBlur: onRadioBlur,
3150
3469
  onFocus: onRadioFocus,
3151
3470
  "aria-describedby": errorMessageId
3152
3471
  })
3153
- }, `${id}-${index}`);
3472
+ }, index);
3154
3473
  }), jsxRuntime.jsx(Description, {
3155
3474
  description: description
3156
3475
  }), jsxRuntime.jsx(Errors, {
@@ -3160,7 +3479,7 @@ function Radio(props) {
3160
3479
  });
3161
3480
  }
3162
3481
  Radio.config = {
3163
- type: type$7,
3482
+ type: type$8,
3164
3483
  keyed: true,
3165
3484
  label: 'Radio group',
3166
3485
  group: 'selection',
@@ -3169,14 +3488,14 @@ Radio.config = {
3169
3488
  create: createEmptyOptions
3170
3489
  };
3171
3490
 
3172
- var _path$g;
3173
- function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
3491
+ var _path$q;
3492
+ function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
3174
3493
  var SvgXMark = function SvgXMark(props) {
3175
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
3494
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
3176
3495
  xmlns: "http://www.w3.org/2000/svg",
3177
3496
  width: 8,
3178
3497
  height: 8
3179
- }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
3498
+ }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
3180
3499
  fill: "currentColor",
3181
3500
  fillRule: "evenodd",
3182
3501
  stroke: "currentColor",
@@ -3189,7 +3508,7 @@ var XMarkIcon = SvgXMark;
3189
3508
 
3190
3509
  function SearchableSelect(props) {
3191
3510
  const {
3192
- id,
3511
+ domId,
3193
3512
  disabled,
3194
3513
  errors,
3195
3514
  onBlur,
@@ -3198,9 +3517,6 @@ function SearchableSelect(props) {
3198
3517
  readonly,
3199
3518
  value
3200
3519
  } = props;
3201
- const {
3202
- formId
3203
- } = hooks.useContext(FormContext$1);
3204
3520
  const [filter, setFilter] = hooks.useState('');
3205
3521
  const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
3206
3522
  const [shouldApplyFilter, setShouldApplyFilter] = hooks.useState(true);
@@ -3309,7 +3625,6 @@ function SearchableSelect(props) {
3309
3625
  }, [onBlur, valueLabel]);
3310
3626
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
3311
3627
  children: [jsxRuntime.jsxs("div", {
3312
- id: prefixId(`${id}`, formId),
3313
3628
  class: classNames('fjs-input-group', {
3314
3629
  'disabled': disabled,
3315
3630
  'readonly': readonly
@@ -3321,7 +3636,7 @@ function SearchableSelect(props) {
3321
3636
  readOnly: readonly,
3322
3637
  class: "fjs-input",
3323
3638
  ref: searchbarRef,
3324
- id: prefixId(`${id}-search`, formId),
3639
+ id: domId,
3325
3640
  onChange: onInputChange,
3326
3641
  type: "text",
3327
3642
  value: filter,
@@ -3361,7 +3676,7 @@ function SearchableSelect(props) {
3361
3676
 
3362
3677
  function SimpleSelect(props) {
3363
3678
  const {
3364
- id,
3679
+ domId,
3365
3680
  disabled,
3366
3681
  errors,
3367
3682
  onBlur,
@@ -3370,9 +3685,6 @@ function SimpleSelect(props) {
3370
3685
  readonly,
3371
3686
  value
3372
3687
  } = props;
3373
- const {
3374
- formId
3375
- } = hooks.useContext(FormContext$1);
3376
3688
  const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
3377
3689
  const selectRef = hooks.useRef();
3378
3690
  const inputRef = hooks.useRef();
@@ -3432,7 +3744,6 @@ function SimpleSelect(props) {
3432
3744
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
3433
3745
  children: [jsxRuntime.jsxs("div", {
3434
3746
  ref: selectRef,
3435
- id: prefixId(`${id}`, formId),
3436
3747
  class: classNames('fjs-input-group', {
3437
3748
  disabled,
3438
3749
  readonly
@@ -3446,11 +3757,11 @@ function SimpleSelect(props) {
3446
3757
  class: classNames('fjs-select-display', {
3447
3758
  'fjs-select-placeholder': !value
3448
3759
  }),
3449
- id: prefixId(`${id}-display`, formId),
3760
+ id: `${domId}-display`,
3450
3761
  children: valueLabel || 'Select'
3451
3762
  }), !disabled && jsxRuntime.jsx("input", {
3452
3763
  ref: inputRef,
3453
- id: prefixId(`${id}-search`, formId),
3764
+ id: domId,
3454
3765
  class: "fjs-select-hidden-input",
3455
3766
  value: valueLabel,
3456
3767
  onFocus: onInputFocus,
@@ -3483,11 +3794,13 @@ function SimpleSelect(props) {
3483
3794
  });
3484
3795
  }
3485
3796
 
3486
- const type$6 = 'select';
3797
+ const type$7 = 'select';
3487
3798
  function Select(props) {
3488
3799
  const {
3489
3800
  disabled,
3490
3801
  errors = [],
3802
+ errorMessageId,
3803
+ domId,
3491
3804
  onBlur,
3492
3805
  onFocus,
3493
3806
  field,
@@ -3497,7 +3810,6 @@ function Select(props) {
3497
3810
  } = props;
3498
3811
  const {
3499
3812
  description,
3500
- id,
3501
3813
  label,
3502
3814
  searchable = false,
3503
3815
  validate = {}
@@ -3505,12 +3817,8 @@ function Select(props) {
3505
3817
  const {
3506
3818
  required
3507
3819
  } = validate;
3508
- const {
3509
- formId
3510
- } = hooks.useContext(FormContext$1);
3511
- const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3512
- const selectProps = hooks.useMemo(() => ({
3513
- id,
3820
+ const selectProps = {
3821
+ domId,
3514
3822
  disabled,
3515
3823
  errors,
3516
3824
  onBlur,
@@ -3520,9 +3828,9 @@ function Select(props) {
3520
3828
  onChange,
3521
3829
  readonly,
3522
3830
  'aria-describedby': errorMessageId
3523
- }), [disabled, errors, field, id, value, onChange, onBlur, onFocus, readonly, errorMessageId]);
3831
+ };
3524
3832
  return jsxRuntime.jsxs("div", {
3525
- class: formFieldClasses(type$6, {
3833
+ class: formFieldClasses(type$7, {
3526
3834
  errors,
3527
3835
  disabled,
3528
3836
  readonly
@@ -3534,7 +3842,7 @@ function Select(props) {
3534
3842
  }
3535
3843
  },
3536
3844
  children: [jsxRuntime.jsx(Label, {
3537
- id: prefixId(`${id}-search`, formId),
3845
+ id: domId,
3538
3846
  label: label,
3539
3847
  required: required
3540
3848
  }), searchable ? jsxRuntime.jsx(SearchableSelect, {
@@ -3550,7 +3858,7 @@ function Select(props) {
3550
3858
  });
3551
3859
  }
3552
3860
  Select.config = {
3553
- type: type$6,
3861
+ type: type$7,
3554
3862
  keyed: true,
3555
3863
  label: 'Select',
3556
3864
  group: 'selection',
@@ -3559,15 +3867,15 @@ Select.config = {
3559
3867
  create: createEmptyOptions
3560
3868
  };
3561
3869
 
3562
- const type$5 = 'separator';
3870
+ const type$6 = 'separator';
3563
3871
  function Separator() {
3564
3872
  return jsxRuntime.jsx("div", {
3565
- class: formFieldClasses(type$5),
3873
+ class: formFieldClasses(type$6),
3566
3874
  children: jsxRuntime.jsx("hr", {})
3567
3875
  });
3568
3876
  }
3569
3877
  Separator.config = {
3570
- type: type$5,
3878
+ type: type$6,
3571
3879
  keyed: false,
3572
3880
  label: 'Separator',
3573
3881
  group: 'presentation',
@@ -3576,7 +3884,7 @@ Separator.config = {
3576
3884
  })
3577
3885
  };
3578
3886
 
3579
- const type$4 = 'spacer';
3887
+ const type$5 = 'spacer';
3580
3888
  function Spacer(props) {
3581
3889
  const {
3582
3890
  field
@@ -3585,14 +3893,14 @@ function Spacer(props) {
3585
3893
  height = 60
3586
3894
  } = field;
3587
3895
  return jsxRuntime.jsx("div", {
3588
- class: formFieldClasses(type$4),
3896
+ class: formFieldClasses(type$5),
3589
3897
  style: {
3590
3898
  height: height
3591
3899
  }
3592
3900
  });
3593
3901
  }
3594
3902
  Spacer.config = {
3595
- type: type$4,
3903
+ type: type$5,
3596
3904
  keyed: false,
3597
3905
  label: 'Spacer',
3598
3906
  group: 'presentation',
@@ -3602,6 +3910,56 @@ Spacer.config = {
3602
3910
  })
3603
3911
  };
3604
3912
 
3913
+ function DynamicList(props) {
3914
+ const {
3915
+ field,
3916
+ domId,
3917
+ readonly
3918
+ } = props;
3919
+ const {
3920
+ label,
3921
+ type,
3922
+ showOutline
3923
+ } = field;
3924
+ const {
3925
+ Empty
3926
+ } = hooks.useContext(FormRenderContext$1);
3927
+ const fullProps = {
3928
+ ...props,
3929
+ Empty
3930
+ };
3931
+ return jsxRuntime.jsxs("div", {
3932
+ className: classNames(formFieldClasses(type, {
3933
+ readonly
3934
+ }), 'fjs-form-field-grouplike', {
3935
+ 'fjs-outlined': showOutline
3936
+ }),
3937
+ role: "group",
3938
+ "aria-labelledby": domId,
3939
+ children: [jsxRuntime.jsx(Label, {
3940
+ id: domId,
3941
+ label: label
3942
+ }), jsxRuntime.jsx(ChildrenRenderer, {
3943
+ ...fullProps
3944
+ })]
3945
+ });
3946
+ }
3947
+ DynamicList.config = {
3948
+ type: 'dynamiclist',
3949
+ pathed: true,
3950
+ repeatable: true,
3951
+ label: 'Dynamic list',
3952
+ group: 'container',
3953
+ create: (options = {}) => ({
3954
+ components: [],
3955
+ showOutline: true,
3956
+ isRepeating: true,
3957
+ allowAddRemove: true,
3958
+ defaultRepetitions: 1,
3959
+ ...options
3960
+ })
3961
+ };
3962
+
3605
3963
  function SkipLink(props) {
3606
3964
  const {
3607
3965
  className,
@@ -3623,12 +3981,14 @@ function SkipLink(props) {
3623
3981
  });
3624
3982
  }
3625
3983
 
3626
- const type$3 = 'taglist';
3984
+ const type$4 = 'taglist';
3627
3985
  function Taglist(props) {
3628
3986
  const {
3629
3987
  disabled,
3630
3988
  errors = [],
3989
+ errorMessageId,
3631
3990
  onFocus,
3991
+ domId,
3632
3992
  onBlur,
3633
3993
  field,
3634
3994
  readonly,
@@ -3636,17 +3996,12 @@ function Taglist(props) {
3636
3996
  } = props;
3637
3997
  const {
3638
3998
  description,
3639
- id,
3640
3999
  label,
3641
4000
  validate = {}
3642
4001
  } = field;
3643
4002
  const {
3644
4003
  required
3645
4004
  } = validate;
3646
- const {
3647
- formId
3648
- } = hooks.useContext(FormContext$1);
3649
- const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3650
4005
  const [filter, setFilter] = hooks.useState('');
3651
4006
  const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
3652
4007
  const [isEscapeClosed, setIsEscapeClose] = hooks.useState(false);
@@ -3769,7 +4124,7 @@ function Taglist(props) {
3769
4124
  const shouldDisplayDropdown = hooks.useMemo(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
3770
4125
  return jsxRuntime.jsxs("div", {
3771
4126
  ref: focusScopeRef,
3772
- class: formFieldClasses(type$3, {
4127
+ class: formFieldClasses(type$4, {
3773
4128
  errors,
3774
4129
  disabled,
3775
4130
  readonly
@@ -3783,7 +4138,7 @@ function Taglist(props) {
3783
4138
  children: [jsxRuntime.jsx(Label, {
3784
4139
  label: label,
3785
4140
  required: required,
3786
- id: prefixId(`${id}-search`, formId)
4141
+ id: domId
3787
4142
  }), !disabled && !readonly && !!values.length && jsxRuntime.jsx(SkipLink, {
3788
4143
  className: "fjs-taglist-skip-link",
3789
4144
  label: "Skip to search",
@@ -3821,7 +4176,7 @@ function Taglist(props) {
3821
4176
  readOnly: readonly,
3822
4177
  class: "fjs-taglist-input",
3823
4178
  ref: inputRef,
3824
- id: prefixId(`${id}-search`, formId),
4179
+ id: domId,
3825
4180
  onChange: onInputChange,
3826
4181
  type: "text",
3827
4182
  value: filter,
@@ -3851,7 +4206,7 @@ function Taglist(props) {
3851
4206
  });
3852
4207
  }
3853
4208
  Taglist.config = {
3854
- type: type$3,
4209
+ type: type$4,
3855
4210
  keyed: true,
3856
4211
  label: 'Tag list',
3857
4212
  group: 'selection',
@@ -3860,7 +4215,7 @@ Taglist.config = {
3860
4215
  create: createEmptyOptions
3861
4216
  };
3862
4217
 
3863
- const type$2 = 'text';
4218
+ const type$3 = 'text';
3864
4219
  function Text(props) {
3865
4220
  const form = useService('form');
3866
4221
  const {
@@ -3887,7 +4242,7 @@ function Text(props) {
3887
4242
  const html = markdownRenderer.render(markdown);
3888
4243
  return sanitizeHTML(html);
3889
4244
  }, [markdownRenderer, markdown]);
3890
- const OverridenTargetLink = hooks.useMemo(() => BuildOverridenTargetLink(textLinkTarget), [textLinkTarget]);
4245
+ const OverriddenTargetLink = hooks.useMemo(() => BuildOverriddenTargetLink(textLinkTarget), [textLinkTarget]);
3891
4246
  const componentOverrides = hooks.useMemo(() => {
3892
4247
  if (disableLinks) {
3893
4248
  return {
@@ -3896,13 +4251,13 @@ function Text(props) {
3896
4251
  }
3897
4252
  if (textLinkTarget) {
3898
4253
  return {
3899
- 'a': OverridenTargetLink
4254
+ 'a': OverriddenTargetLink
3900
4255
  };
3901
4256
  }
3902
4257
  return {};
3903
- }, [disableLinks, OverridenTargetLink, textLinkTarget]);
4258
+ }, [disableLinks, OverriddenTargetLink, textLinkTarget]);
3904
4259
  return jsxRuntime.jsx("div", {
3905
- class: formFieldClasses(type$2),
4260
+ class: formFieldClasses(type$3),
3906
4261
  children: jsxRuntime.jsx(Markup, {
3907
4262
  markup: safeHtml,
3908
4263
  components: componentOverrides,
@@ -3911,7 +4266,7 @@ function Text(props) {
3911
4266
  });
3912
4267
  }
3913
4268
  Text.config = {
3914
- type: type$2,
4269
+ type: type$3,
3915
4270
  keyed: false,
3916
4271
  label: 'Text view',
3917
4272
  group: 'presentation',
@@ -3920,7 +4275,7 @@ Text.config = {
3920
4275
  ...options
3921
4276
  })
3922
4277
  };
3923
- function BuildOverridenTargetLink(target) {
4278
+ function BuildOverriddenTargetLink(target) {
3924
4279
  return function ({
3925
4280
  children,
3926
4281
  ...rest
@@ -3944,11 +4299,13 @@ function DisabledLink({
3944
4299
  });
3945
4300
  }
3946
4301
 
3947
- const type$1 = 'textfield';
4302
+ const type$2 = 'textfield';
3948
4303
  function Textfield(props) {
3949
4304
  const {
3950
4305
  disabled,
3951
4306
  errors = [],
4307
+ errorMessageId,
4308
+ domId,
3952
4309
  onBlur,
3953
4310
  onFocus,
3954
4311
  field,
@@ -3957,7 +4314,6 @@ function Textfield(props) {
3957
4314
  } = props;
3958
4315
  const {
3959
4316
  description,
3960
- id,
3961
4317
  label,
3962
4318
  appearance = {},
3963
4319
  validate = {}
@@ -3977,18 +4333,14 @@ function Textfield(props) {
3977
4333
  value: target.value
3978
4334
  });
3979
4335
  };
3980
- const {
3981
- formId
3982
- } = hooks.useContext(FormContext$1);
3983
- const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
3984
4336
  return jsxRuntime.jsxs("div", {
3985
- class: formFieldClasses(type$1, {
4337
+ class: formFieldClasses(type$2, {
3986
4338
  errors,
3987
4339
  disabled,
3988
4340
  readonly
3989
4341
  }),
3990
4342
  children: [jsxRuntime.jsx(Label, {
3991
- id: prefixId(id, formId),
4343
+ id: domId,
3992
4344
  label: label,
3993
4345
  required: required
3994
4346
  }), jsxRuntime.jsx(TemplatedInputAdorner, {
@@ -4000,7 +4352,7 @@ function Textfield(props) {
4000
4352
  class: "fjs-input",
4001
4353
  disabled: disabled,
4002
4354
  readOnly: readonly,
4003
- id: prefixId(id, formId),
4355
+ id: domId,
4004
4356
  onInput: onChange,
4005
4357
  onBlur: () => onBlur && onBlur(),
4006
4358
  onFocus: () => onFocus && onFocus(),
@@ -4017,7 +4369,7 @@ function Textfield(props) {
4017
4369
  });
4018
4370
  }
4019
4371
  Textfield.config = {
4020
- type: type$1,
4372
+ type: type$2,
4021
4373
  keyed: true,
4022
4374
  label: 'Text field',
4023
4375
  group: 'basic-input',
@@ -4040,11 +4392,13 @@ Textfield.config = {
4040
4392
  })
4041
4393
  };
4042
4394
 
4043
- const type = 'textarea';
4395
+ const type$1 = 'textarea';
4044
4396
  function Textarea(props) {
4045
4397
  const {
4046
4398
  disabled,
4047
4399
  errors = [],
4400
+ errorMessageId,
4401
+ domId,
4048
4402
  onBlur,
4049
4403
  onFocus,
4050
4404
  field,
@@ -4053,7 +4407,6 @@ function Textarea(props) {
4053
4407
  } = props;
4054
4408
  const {
4055
4409
  description,
4056
- id,
4057
4410
  label,
4058
4411
  validate = {}
4059
4412
  } = field;
@@ -4075,25 +4428,21 @@ function Textarea(props) {
4075
4428
  hooks.useEffect(() => {
4076
4429
  autoSizeTextarea(textareaRef.current);
4077
4430
  }, []);
4078
- const {
4079
- formId
4080
- } = hooks.useContext(FormContext$1);
4081
- const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
4082
4431
  return jsxRuntime.jsxs("div", {
4083
- class: formFieldClasses(type, {
4432
+ class: formFieldClasses(type$1, {
4084
4433
  errors,
4085
4434
  disabled,
4086
4435
  readonly
4087
4436
  }),
4088
4437
  children: [jsxRuntime.jsx(Label, {
4089
- id: prefixId(id, formId),
4438
+ id: domId,
4090
4439
  label: label,
4091
4440
  required: required
4092
4441
  }), jsxRuntime.jsx("textarea", {
4093
4442
  class: "fjs-textarea",
4094
4443
  disabled: disabled,
4095
4444
  readonly: readonly,
4096
- id: prefixId(id, formId),
4445
+ id: domId,
4097
4446
  onInput: onInput,
4098
4447
  onBlur: () => onBlur && onBlur(),
4099
4448
  onFocus: () => onFocus && onFocus(),
@@ -4109,7 +4458,7 @@ function Textarea(props) {
4109
4458
  });
4110
4459
  }
4111
4460
  Textarea.config = {
4112
- type,
4461
+ type: type$1,
4113
4462
  keyed: true,
4114
4463
  label: 'Text area',
4115
4464
  group: 'basic-input',
@@ -4140,64 +4489,419 @@ const autoSizeTextarea = textarea => {
4140
4489
  textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
4141
4490
  };
4142
4491
 
4143
- var _path$f;
4144
- function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
4145
- var SvgButton = function SvgButton(props) {
4146
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
4492
+ var _path$p;
4493
+ function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
4494
+ var SvgArrowDown = function SvgArrowDown(props) {
4495
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
4147
4496
  xmlns: "http://www.w3.org/2000/svg",
4148
- width: 54,
4149
- height: 54,
4150
- fill: "currentcolor"
4151
- }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
4152
- fillRule: "evenodd",
4153
- d: "M45 17a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V20a3 3 0 0 1 3-3h36zm-9 8.889H18v2.222h18v-2.222z"
4497
+ viewBox: "0 0 32 32"
4498
+ }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
4499
+ fill: "currentcolor",
4500
+ d: "M24.59 16.59 17 24.17V4h-2v20.17l-7.59-7.58L6 18l10 10 10-10-1.41-1.41z"
4154
4501
  })));
4155
4502
  };
4156
- var ButtonIcon = SvgButton;
4503
+ var ArrowDownIcon = SvgArrowDown;
4157
4504
 
4158
- var _path$e;
4159
- function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
4160
- var SvgCheckbox = function SvgCheckbox(props) {
4161
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
4505
+ var _path$o;
4506
+ function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
4507
+ var SvgArrowUp = function SvgArrowUp(props) {
4508
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
4162
4509
  xmlns: "http://www.w3.org/2000/svg",
4163
- width: 54,
4164
- height: 54,
4165
- fill: "currentcolor"
4166
- }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
4167
- d: "M34 18H20a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V20a2 2 0 0 0-2-2zm-9 14-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
4510
+ viewBox: "0 0 32 32"
4511
+ }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
4512
+ fill: "currentcolor",
4513
+ d: "M16 4 6 14l1.41 1.41L15 7.83V28h2V7.83l7.59 7.58L26 14 16 4z"
4168
4514
  })));
4169
4515
  };
4170
- var CheckboxIcon = SvgCheckbox;
4516
+ var ArrowUpIcon = SvgArrowUp;
4171
4517
 
4172
- var _path$d;
4173
- function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
4174
- var SvgChecklist = function SvgChecklist(props) {
4175
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
4518
+ var _path$n;
4519
+ function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
4520
+ var SvgCaretLeft = function SvgCaretLeft(props) {
4521
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
4176
4522
  xmlns: "http://www.w3.org/2000/svg",
4177
- width: 54,
4178
- height: 54,
4179
- fill: "none"
4180
- }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
4181
- fill: "currentColor",
4182
- fillRule: "evenodd",
4183
- d: "M14.35 24.75H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414ZM14.35 37.05H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414ZM14.35 12.45H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414Zm12.007 14.977a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Zm0 12.3a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Zm0-24.6a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Z",
4184
- clipRule: "evenodd"
4523
+ xmlSpace: "preserve",
4524
+ viewBox: "0 0 32 32"
4525
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
4526
+ fill: "currentcolor",
4527
+ d: "m20 24-10-8 10-8z"
4185
4528
  })));
4186
4529
  };
4187
- var ChecklistIcon = SvgChecklist;
4530
+ var CaretLeftIcon = SvgCaretLeft;
4188
4531
 
4189
- var _path$c, _path2$3, _path3;
4190
- function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
4532
+ var _path$m;
4533
+ function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
4534
+ var SvgCaretRight = function SvgCaretRight(props) {
4535
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
4536
+ xmlns: "http://www.w3.org/2000/svg",
4537
+ xmlSpace: "preserve",
4538
+ viewBox: "0 0 32 32"
4539
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
4540
+ fill: "currentcolor",
4541
+ d: "m12 8 10 8-10 8z"
4542
+ })));
4543
+ };
4544
+ var CaretRightIcon = SvgCaretRight;
4545
+
4546
+ const type = 'table';
4547
+
4548
+ /**
4549
+ * @typedef {('asc'|'desc')} Direction
4550
+ *
4551
+ * @typedef Sorting
4552
+ * @property {string} key
4553
+ * @property {Direction} direction
4554
+ *
4555
+ * @typedef Column
4556
+ * @property {string} label
4557
+ * @property {string} key
4558
+ *
4559
+ * @typedef Props
4560
+ * @property {Object} field
4561
+ * @property {string} field.id
4562
+ * @property {Array<Column>} [field.columns]
4563
+ * @property {string} [field.columnsExpression]
4564
+ * @property {string} [field.label]
4565
+ * @property {number} [field.rowCount]
4566
+ * @property {string} [field.dataSource]
4567
+ *
4568
+ * @param {Props} props
4569
+ * @returns {import("preact").JSX.Element}
4570
+ */
4571
+ function Table(props) {
4572
+ const {
4573
+ field
4574
+ } = props;
4575
+ const {
4576
+ columns = [],
4577
+ columnsExpression,
4578
+ dataSource = '',
4579
+ rowCount,
4580
+ id,
4581
+ label
4582
+ } = field;
4583
+
4584
+ /** @type {[(null|Sorting), import("preact/hooks").StateUpdater<null|Sorting>]} */
4585
+ const [sortBy, setSortBy] = hooks.useState(null);
4586
+ const evaluatedColumns = useEvaluatedColumns(columnsExpression || '', columns);
4587
+ const columnKeys = evaluatedColumns.map(({
4588
+ key
4589
+ }) => key);
4590
+ const evaluatedDataSource = useExpressionEvaluation(dataSource);
4591
+ const data = Array.isArray(evaluatedDataSource) ? evaluatedDataSource : [];
4592
+ const sortedData = sortBy === null ? data : sortByColumn(data, sortBy.key, sortBy.direction);
4593
+
4594
+ /** @type {unknown[][]} */
4595
+ const chunkedData = minDash.isNumber(rowCount) ? chunk(sortedData, rowCount) : [sortedData];
4596
+ const [currentPage, setCurrentPage] = hooks.useState(0);
4597
+ const currentChunk = chunkedData[currentPage] || [];
4598
+ hooks.useEffect(() => {
4599
+ setCurrentPage(0);
4600
+ }, [rowCount, sortBy]);
4601
+
4602
+ /** @param {string} key */
4603
+ function toggleSortBy(key) {
4604
+ setSortBy(current => {
4605
+ if (current === null || current.key !== key) {
4606
+ return {
4607
+ key,
4608
+ direction: 'asc'
4609
+ };
4610
+ }
4611
+ if (current.direction === 'desc') {
4612
+ return null;
4613
+ }
4614
+ return {
4615
+ key,
4616
+ direction: 'desc'
4617
+ };
4618
+ });
4619
+ }
4620
+ return jsxRuntime.jsxs("div", {
4621
+ class: formFieldClasses(type),
4622
+ children: [jsxRuntime.jsx(Label, {
4623
+ id: prefixId(id),
4624
+ label: label
4625
+ }), jsxRuntime.jsxs("div", {
4626
+ class: classNames('fjs-table-middle-container', {
4627
+ 'fjs-table-empty': evaluatedColumns.length === 0
4628
+ }),
4629
+ children: [evaluatedColumns.length === 0 ? 'Nothing to show.' : jsxRuntime.jsx("div", {
4630
+ class: "fjs-table-inner-container",
4631
+ children: jsxRuntime.jsxs("table", {
4632
+ class: "fjs-table",
4633
+ id: prefixId(id),
4634
+ children: [jsxRuntime.jsx("thead", {
4635
+ class: "fjs-table-head",
4636
+ children: jsxRuntime.jsx("tr", {
4637
+ class: "fjs-table-tr",
4638
+ children: evaluatedColumns.map(({
4639
+ key,
4640
+ label
4641
+ }) => {
4642
+ const displayLabel = label || key;
4643
+ return jsxRuntime.jsx("th", {
4644
+ tabIndex: 0,
4645
+ class: "fjs-table-th",
4646
+ onClick: () => {
4647
+ toggleSortBy(key);
4648
+ },
4649
+ onKeyDown: event => {
4650
+ if (['Enter', 'Space'].includes(event.code)) {
4651
+ toggleSortBy(key);
4652
+ }
4653
+ },
4654
+ "aria-label": getHeaderAriaLabel(sortBy, key, displayLabel),
4655
+ children: jsxRuntime.jsxs("span", {
4656
+ class: "fjs-table-th-label",
4657
+ children: [displayLabel, sortBy !== null && sortBy.key === key ? jsxRuntime.jsx(jsxRuntime.Fragment, {
4658
+ children: sortBy.direction === 'asc' ? jsxRuntime.jsx(ArrowUpIcon, {
4659
+ class: "fjs-table-sort-icon-asc"
4660
+ }) : jsxRuntime.jsx(ArrowDownIcon, {
4661
+ class: "fjs-table-sort-icon-desc"
4662
+ })
4663
+ }) : null]
4664
+ })
4665
+ }, key);
4666
+ })
4667
+ })
4668
+ }), currentChunk.length === 0 ? jsxRuntime.jsx("tbody", {
4669
+ class: "fjs-table-body",
4670
+ children: jsxRuntime.jsx("tr", {
4671
+ class: "fjs-table-tr",
4672
+ children: jsxRuntime.jsx("td", {
4673
+ class: "fjs-table-td",
4674
+ colSpan: evaluatedColumns.length,
4675
+ children: "Nothing to show."
4676
+ })
4677
+ })
4678
+ }) : jsxRuntime.jsx("tbody", {
4679
+ class: "fjs-table-body",
4680
+ children: currentChunk.map((row, index) => jsxRuntime.jsx("tr", {
4681
+ class: "fjs-table-tr",
4682
+ children: columnKeys.map(key => jsxRuntime.jsx("td", {
4683
+ class: "fjs-table-td",
4684
+ children: row[key]
4685
+ }, key))
4686
+ }, index))
4687
+ })]
4688
+ })
4689
+ }), minDash.isNumber(rowCount) && chunkedData.length > 1 && evaluatedColumns.length > 0 ? jsxRuntime.jsxs("nav", {
4690
+ class: "fjs-table-nav",
4691
+ children: [jsxRuntime.jsxs("span", {
4692
+ class: "fjs-table-nav-label",
4693
+ children: [currentPage + 1, " of ", chunkedData.length]
4694
+ }), jsxRuntime.jsx("button", {
4695
+ type: "button",
4696
+ class: "fjs-table-nav-button",
4697
+ onClick: () => {
4698
+ setCurrentPage(page => Math.max(page - 1, 0));
4699
+ },
4700
+ disabled: currentPage === 0,
4701
+ "aria-label": "Previous page",
4702
+ children: jsxRuntime.jsx(CaretLeftIcon, {})
4703
+ }), jsxRuntime.jsx("button", {
4704
+ type: "button",
4705
+ class: "fjs-table-nav-button",
4706
+ onClick: () => {
4707
+ setCurrentPage(page => Math.min(page + 1, chunkedData.length - 1));
4708
+ },
4709
+ disabled: currentPage >= chunkedData.length - 1,
4710
+ "aria-label": "Next page",
4711
+ children: jsxRuntime.jsx(CaretRightIcon, {})
4712
+ })]
4713
+ }) : null]
4714
+ })]
4715
+ });
4716
+ }
4717
+ Table.config = {
4718
+ type,
4719
+ keyed: false,
4720
+ label: 'Table',
4721
+ group: 'presentation',
4722
+ create: (options = {}) => {
4723
+ const {
4724
+ id,
4725
+ columnsExpression,
4726
+ columns,
4727
+ rowCount,
4728
+ ...remainingOptions
4729
+ } = options;
4730
+ if (minDash.isDefined(id) && minDash.isNumber(rowCount)) {
4731
+ remainingOptions['rowCount'] = rowCount;
4732
+ }
4733
+ if (minDash.isString(columnsExpression)) {
4734
+ return {
4735
+ ...remainingOptions,
4736
+ id,
4737
+ columnsExpression
4738
+ };
4739
+ }
4740
+ if (Array.isArray(columns) && columns.every(isColumn)) {
4741
+ return {
4742
+ ...remainingOptions,
4743
+ id,
4744
+ columns
4745
+ };
4746
+ }
4747
+ return {
4748
+ ...remainingOptions,
4749
+ rowCount: 10,
4750
+ columns: [{
4751
+ label: 'ID',
4752
+ key: 'id'
4753
+ }, {
4754
+ label: 'Name',
4755
+ key: 'name'
4756
+ }, {
4757
+ label: 'Date',
4758
+ key: 'date'
4759
+ }]
4760
+ };
4761
+ },
4762
+ initialDemoData: [{
4763
+ id: 1,
4764
+ name: 'John Doe',
4765
+ date: '31.01.2023'
4766
+ }, {
4767
+ id: 2,
4768
+ name: 'Erika Muller',
4769
+ date: '20.02.2023'
4770
+ }, {
4771
+ id: 3,
4772
+ name: 'Dominic Leaf',
4773
+ date: '11.03.2023'
4774
+ }]
4775
+ };
4776
+
4777
+ // helpers /////////////////////////////
4778
+
4779
+ /**
4780
+ * @param {string|void} columnsExpression
4781
+ * @param {Column[]} fallbackColumns
4782
+ * @returns {Column[]}
4783
+ */
4784
+ function useEvaluatedColumns(columnsExpression, fallbackColumns) {
4785
+ /** @type {Column[]|null} */
4786
+ const evaluation = useExpressionEvaluation(columnsExpression || '');
4787
+ return Array.isArray(evaluation) && evaluation.every(isColumn) ? evaluation : fallbackColumns;
4788
+ }
4789
+
4790
+ /**
4791
+ * @param {any} column
4792
+ * @returns {column is Column}
4793
+ */
4794
+ function isColumn(column) {
4795
+ return minDash.isObject(column) && minDash.isString(column['label']) && minDash.isString(column['key']);
4796
+ }
4797
+
4798
+ /**
4799
+ * @param {Array} array
4800
+ * @param {number} size
4801
+ * @returns {Array}
4802
+ */
4803
+ function chunk(array, size) {
4804
+ return array.reduce((chunks, item, index) => {
4805
+ if (index % size === 0) {
4806
+ chunks.push([item]);
4807
+ } else {
4808
+ chunks[chunks.length - 1].push(item);
4809
+ }
4810
+ return chunks;
4811
+ }, []);
4812
+ }
4813
+
4814
+ /**
4815
+ * @param {unknown[]} array
4816
+ * @param {string} key
4817
+ * @param {Direction} direction
4818
+ * @returns {unknown[]}
4819
+ */
4820
+ function sortByColumn(array, key, direction) {
4821
+ return [...array].sort((a, b) => {
4822
+ if (!minDash.isObject(a) || !minDash.isObject(b)) {
4823
+ return 0;
4824
+ }
4825
+ if (direction === 'asc') {
4826
+ return a[key] > b[key] ? 1 : -1;
4827
+ }
4828
+ return a[key] < b[key] ? 1 : -1;
4829
+ });
4830
+ }
4831
+
4832
+ /**
4833
+ * @param {null|Sorting} sortBy
4834
+ * @param {string} key
4835
+ * @param {string} label
4836
+ */
4837
+ function getHeaderAriaLabel(sortBy, key, label) {
4838
+ if (sortBy === null || sortBy.key !== key) {
4839
+ return `Click to sort by ${label} descending`;
4840
+ }
4841
+ if (sortBy.direction === 'asc') {
4842
+ return 'Click to remove sorting';
4843
+ }
4844
+ return `Click to sort by ${label} ascending`;
4845
+ }
4846
+
4847
+ var _path$l;
4848
+ function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
4849
+ var SvgButton = function SvgButton(props) {
4850
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
4851
+ xmlns: "http://www.w3.org/2000/svg",
4852
+ width: 54,
4853
+ height: 54,
4854
+ fill: "currentcolor"
4855
+ }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
4856
+ fillRule: "evenodd",
4857
+ d: "M45 17a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V20a3 3 0 0 1 3-3h36zm-9 8.889H18v2.222h18v-2.222z"
4858
+ })));
4859
+ };
4860
+ var ButtonIcon = SvgButton;
4861
+
4862
+ var _path$k;
4863
+ function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
4864
+ var SvgCheckbox = function SvgCheckbox(props) {
4865
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
4866
+ xmlns: "http://www.w3.org/2000/svg",
4867
+ width: 54,
4868
+ height: 54,
4869
+ fill: "currentcolor"
4870
+ }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
4871
+ d: "M34 18H20a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V20a2 2 0 0 0-2-2zm-9 14-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
4872
+ })));
4873
+ };
4874
+ var CheckboxIcon = SvgCheckbox;
4875
+
4876
+ var _path$j;
4877
+ function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
4878
+ var SvgChecklist = function SvgChecklist(props) {
4879
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
4880
+ xmlns: "http://www.w3.org/2000/svg",
4881
+ width: 54,
4882
+ height: 54,
4883
+ fill: "none"
4884
+ }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
4885
+ fill: "currentColor",
4886
+ fillRule: "evenodd",
4887
+ d: "M14.35 24.75H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414ZM14.35 37.05H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414ZM14.35 12.45H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414Zm12.007 14.977a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Zm0 12.3a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Zm0-24.6a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Z",
4888
+ clipRule: "evenodd"
4889
+ })));
4890
+ };
4891
+ var ChecklistIcon = SvgChecklist;
4892
+
4893
+ var _path$i, _path2$4, _path3;
4894
+ function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
4191
4895
  var SvgDatetime = function SvgDatetime(props) {
4192
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
4896
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
4193
4897
  xmlns: "http://www.w3.org/2000/svg",
4194
4898
  width: 54,
4195
4899
  height: 54,
4196
4900
  fill: "currentcolor"
4197
- }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
4901
+ }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
4198
4902
  fillRule: "evenodd",
4199
4903
  d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36a2.07 2.07 0 0 0-2.06 2.06v23.549a2.07 2.07 0 0 0 2.06 2.06h6.77v-1.766h-6.358a.707.707 0 0 1-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592a.71.71 0 0 1 .707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z"
4200
- })), _path2$3 || (_path2$3 = /*#__PURE__*/React__namespace.createElement("path", {
4904
+ })), _path2$4 || (_path2$4 = /*#__PURE__*/React__namespace.createElement("path", {
4201
4905
  d: "m35.13 37.603 1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984Z"
4202
4906
  })), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
4203
4907
  fillRule: "evenodd",
@@ -4206,27 +4910,27 @@ var SvgDatetime = function SvgDatetime(props) {
4206
4910
  };
4207
4911
  var DatetimeIcon = SvgDatetime;
4208
4912
 
4209
- var _path$b, _path2$2;
4210
- function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
4913
+ var _path$h, _path2$3;
4914
+ function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
4211
4915
  var SvgTaglist = function SvgTaglist(props) {
4212
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
4916
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
4213
4917
  xmlns: "http://www.w3.org/2000/svg",
4214
4918
  width: 54,
4215
4919
  height: 54,
4216
4920
  fill: "currentcolor"
4217
- }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
4921
+ }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
4218
4922
  fillRule: "evenodd",
4219
4923
  d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36Zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1Z"
4220
- })), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
4924
+ })), _path2$3 || (_path2$3 = /*#__PURE__*/React__namespace.createElement("path", {
4221
4925
  d: "M11 22a1 1 0 0 1 1-1h19a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H12a1 1 0 0 1-1-1V22Z"
4222
4926
  })));
4223
4927
  };
4224
4928
  var TaglistIcon = SvgTaglist;
4225
4929
 
4226
4930
  var _rect, _rect2, _rect3;
4227
- function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
4931
+ function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
4228
4932
  var SvgForm = function SvgForm(props) {
4229
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
4933
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
4230
4934
  xmlns: "http://www.w3.org/2000/svg",
4231
4935
  width: 54,
4232
4936
  height: 54
@@ -4252,151 +4956,168 @@ var SvgForm = function SvgForm(props) {
4252
4956
  };
4253
4957
  var FormIcon = SvgForm;
4254
4958
 
4255
- var _path$a;
4256
- function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
4959
+ var _path$g;
4960
+ function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
4257
4961
  var SvgGroup = function SvgGroup(props) {
4258
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
4962
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
4259
4963
  xmlns: "http://www.w3.org/2000/svg",
4260
4964
  width: 54,
4261
4965
  height: 54,
4262
4966
  fill: "currentcolor"
4263
- }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
4967
+ }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
4264
4968
  fillRule: "evenodd",
4265
4969
  d: "M8 33v5a1 1 0 0 0 1 1h4v2H9a3 3 0 0 1-3-3v-5h2Zm18 6v2H15v-2h11Zm13 0v2H28v-2h11Zm9-6v5a3 3 0 0 1-3 3h-4v-2h4a1 1 0 0 0 .993-.883L46 38v-5h2ZM8 22v9H6v-9h2Zm40 0v9h-2v-9h2Zm-35-9v2H9a1 1 0 0 0-.993.883L8 16v4H6v-4a3 3 0 0 1 3-3h4Zm32 0a3 3 0 0 1 3 3v4h-2v-4a1 1 0 0 0-.883-.993L45 15h-4v-2h4Zm-6 0v2H28v-2h11Zm-13 0v2H15v-2h11Z"
4266
4970
  })));
4267
4971
  };
4268
4972
  var GroupIcon = SvgGroup;
4269
4973
 
4270
- var _path$9;
4271
- function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
4974
+ var _path$f;
4975
+ function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
4272
4976
  var SvgNumber = function SvgNumber(props) {
4273
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
4977
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
4274
4978
  xmlns: "http://www.w3.org/2000/svg",
4275
4979
  width: 54,
4276
4980
  height: 54,
4277
4981
  fill: "currentcolor"
4278
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
4982
+ }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
4279
4983
  fillRule: "evenodd",
4280
4984
  d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
4281
4985
  })));
4282
4986
  };
4283
4987
  var NumberIcon = SvgNumber;
4284
4988
 
4285
- var _path$8;
4286
- function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
4989
+ var _path$e;
4990
+ function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
4287
4991
  var SvgRadio = function SvgRadio(props) {
4288
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
4992
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
4289
4993
  xmlns: "http://www.w3.org/2000/svg",
4290
4994
  width: 54,
4291
4995
  height: 54,
4292
4996
  fill: "currentcolor"
4293
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
4997
+ }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
4294
4998
  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 1 1 0-16 8 8 0 1 1 0 16z"
4295
4999
  })));
4296
5000
  };
4297
5001
  var RadioIcon = SvgRadio;
4298
5002
 
4299
- var _path$7;
4300
- function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
5003
+ var _path$d;
5004
+ function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
4301
5005
  var SvgSelect = function SvgSelect(props) {
4302
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
5006
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
4303
5007
  xmlns: "http://www.w3.org/2000/svg",
4304
5008
  width: 54,
4305
5009
  height: 54,
4306
5010
  fill: "currentcolor"
4307
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
5011
+ }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
4308
5012
  fillRule: "evenodd",
4309
5013
  d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zm-12 7h9l-4.5 6-4.5-6z"
4310
5014
  })));
4311
5015
  };
4312
5016
  var SelectIcon = SvgSelect;
4313
5017
 
4314
- var _path$6;
4315
- function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
5018
+ var _path$c;
5019
+ function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
4316
5020
  var SvgSeparator = function SvgSeparator(props) {
4317
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
5021
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
4318
5022
  xmlns: "http://www.w3.org/2000/svg",
4319
5023
  width: 54,
4320
5024
  height: 54,
4321
5025
  fill: "none"
4322
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
5026
+ }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
4323
5027
  fill: "currentColor",
4324
5028
  d: "M26.293 16.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L27 18.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4ZM9 26h36v2H9v-2Zm13.293 7.707 4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L27 35.586l-3.293-3.293a1 1 0 0 0-1.414 1.414Z"
4325
5029
  })));
4326
5030
  };
4327
5031
  var SeparatorIcon = SvgSeparator;
4328
5032
 
4329
- var _path$5;
4330
- function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
5033
+ var _path$b;
5034
+ function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
4331
5035
  var SvgSpacer = function SvgSpacer(props) {
4332
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
5036
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
4333
5037
  xmlns: "http://www.w3.org/2000/svg",
4334
5038
  width: 54,
4335
5039
  height: 54,
4336
5040
  fill: "none"
4337
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
5041
+ }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
4338
5042
  fill: "currentColor",
4339
5043
  d: "M9 15v2h36v-2H9Zm0 22v2h36v-2H9Zm17.293-17.707a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L27 21.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4Zm-4 11.414 4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L27 32.586l-3.293-3.293a1 1 0 0 0-1.414 1.414Z"
4340
5044
  })));
4341
5045
  };
4342
5046
  var SpacerIcon = SvgSpacer;
4343
5047
 
4344
- var _path$4;
4345
- function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
5048
+ var _path$a;
5049
+ function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
5050
+ var SvgDynamicList = function SvgDynamicList(props) {
5051
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
5052
+ xmlns: "http://www.w3.org/2000/svg",
5053
+ width: 54,
5054
+ height: 54,
5055
+ fill: "none"
5056
+ }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
5057
+ fill: "currentColor",
5058
+ fillRule: "evenodd",
5059
+ d: "M2.7 43.296v1.254c0 .746.604 1.35 1.35 1.35h1.275v-1.795c.049.14.075.29.075.445v-1.254h-.075V43.2H4.05c.177 0 .347.034.502.096H2.7Zm2.7-2.507v-2.507H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.015V23.24H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.014V13.21H2.7v2.507h2.7Zm-2.7-5.014h1.852a1.346 1.346 0 0 1-.502.096h1.275v-.096H5.4V9.45c0 .156-.026.306-.075.445V8.1H4.05A1.35 1.35 0 0 0 2.7 9.45v1.254Zm5.175.096h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1-2.7v1.795a1.348 1.348 0 0 1-.075-.445v1.254h.075v.096h1.275c-.177 0-.347-.034-.502-.096H51.3V9.45a1.35 1.35 0 0 0-1.35-1.35h-1.275Zm-.075 5.11v2.508h2.7V13.21h-2.7Zm0 5.015v2.507h2.7v-2.507h-2.7Zm0 5.014v2.507h2.7V23.24h-2.7Zm0 5.015v2.507h2.7v-2.507h-2.7Zm0 5.014v2.507h2.7v-2.507h-2.7Zm0 5.014v2.507h2.7v-2.507h-2.7Zm2.7 5.014h-1.852c.155-.062.325-.096.502-.096h-1.275v.096H48.6v1.254c0-.156.026-.305.075-.445V45.9h1.275a1.35 1.35 0 0 0 1.35-1.35v-1.254Zm-5.175-.096h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7ZM16.2 17.55a4.05 4.05 0 0 1 4.05 4.05v1.35A4.05 4.05 0 0 1 16.2 27h-1.35a4.05 4.05 0 0 1-4.05-4.05V21.6a4.05 4.05 0 0 1 4.05-4.05h1.35Zm0 2.7h-1.35a1.35 1.35 0 0 0-1.35 1.35v1.35c0 .746.604 1.35 1.35 1.35h1.35a1.35 1.35 0 0 0 1.35-1.35V21.6a1.35 1.35 0 0 0-1.35-1.35Zm27 1.35a4.05 4.05 0 0 0-4.05-4.05H29.7a4.05 4.05 0 0 0-4.05 4.05v1.35A4.05 4.05 0 0 0 29.7 27h9.45a4.05 4.05 0 0 0 4.05-4.05V21.6Zm-13.5-1.35h9.45c.746 0 1.35.604 1.35 1.35v1.35a1.35 1.35 0 0 1-1.35 1.35H29.7a1.35 1.35 0 0 1-1.35-1.35V21.6c0-.746.604-1.35 1.35-1.35ZM43.2 37.8a4.05 4.05 0 0 0-4.05-4.05H29.7a4.05 4.05 0 0 0-4.05 4.05v1.35h2.7V37.8c0-.746.604-1.35 1.35-1.35h9.45c.746 0 1.35.604 1.35 1.35v1.35h2.7V37.8Zm-27-4.05a4.05 4.05 0 0 1 4.05 4.05v1.35h-2.7V37.8a1.35 1.35 0 0 0-1.35-1.35h-1.35a1.35 1.35 0 0 0-1.35 1.35v1.35h-2.7V37.8a4.05 4.05 0 0 1 4.05-4.05h1.35Z",
5060
+ clipRule: "evenodd"
5061
+ })));
5062
+ };
5063
+ var DynamicListIcon = SvgDynamicList;
5064
+
5065
+ var _path$9;
5066
+ function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
4346
5067
  var SvgText = function SvgText(props) {
4347
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
5068
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
4348
5069
  xmlns: "http://www.w3.org/2000/svg",
4349
5070
  width: 54,
4350
5071
  height: 54,
4351
5072
  fill: "currentcolor"
4352
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
5073
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
4353
5074
  d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 0 1 2.4.14 3.42 3.42 0 0 1 1.41.55 3.47 3.47 0 0 1 1 1.14 3 3 0 0 1 .42 1.58 3.26 3.26 0 0 1-1.91 2.94 3.63 3.63 0 0 1 1.91 1.22 3.28 3.28 0 0 1 .66 2 4 4 0 0 1-.43 1.8 3.63 3.63 0 0 1-1.09 1.4 3.89 3.89 0 0 1-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 0 0 1.1-.49 1.41 1.41 0 0 0 .41-1 1.49 1.49 0 0 0-.35-1 1.54 1.54 0 0 0-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 0 0 1.88-.09 1.65 1.65 0 0 0 1-.54 1.6 1.6 0 0 0 .38-1.14 1.75 1.75 0 0 0-.29-1 1.69 1.69 0 0 0-.86-.62 9.28 9.28 0 0 0-2.41-.23zm19.62.92 2.65.84a5.94 5.94 0 0 1-2 3.29A5.74 5.74 0 0 1 41.38 34a5.87 5.87 0 0 1-4.44-1.84 7.09 7.09 0 0 1-1.73-5A7.43 7.43 0 0 1 37 21.87 6 6 0 0 1 41.54 20a5.64 5.64 0 0 1 4 1.47A5.33 5.33 0 0 1 47 24l-2.7.65a2.8 2.8 0 0 0-2.86-2.27A3.09 3.09 0 0 0 39 23.42a5.31 5.31 0 0 0-.93 3.5 5.62 5.62 0 0 0 .93 3.65 3 3 0 0 0 2.4 1.09 2.72 2.72 0 0 0 1.82-.66 4 4 0 0 0 1.13-2.21z"
4354
5075
  })));
4355
5076
  };
4356
5077
  var TextIcon = SvgText;
4357
5078
 
4358
- var _path$3;
4359
- function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
5079
+ var _path$8;
5080
+ function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
4360
5081
  var SvgTextfield = function SvgTextfield(props) {
4361
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
5082
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
4362
5083
  xmlns: "http://www.w3.org/2000/svg",
4363
5084
  width: 54,
4364
5085
  height: 54,
4365
5086
  fill: "currentcolor"
4366
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
5087
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
4367
5088
  fillRule: "evenodd",
4368
5089
  d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zm-32 4v10h-2V22h2z"
4369
5090
  })));
4370
5091
  };
4371
5092
  var TextfieldIcon = SvgTextfield;
4372
5093
 
4373
- var _path$2;
4374
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
5094
+ var _path$7;
5095
+ function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
4375
5096
  var SvgTextarea = function SvgTextarea(props) {
4376
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
5097
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
4377
5098
  xmlns: "http://www.w3.org/2000/svg",
4378
5099
  width: 54,
4379
5100
  height: 54,
4380
5101
  fill: "currentcolor"
4381
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
5102
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
4382
5103
  fillRule: "evenodd",
4383
5104
  d: "M45 13a3 3 0 0 1 3 3v22a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V16a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v22a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V16a1 1 0 0 0-1-1zm-1.136 15.5.849.849-6.364 6.364-.849-.849 6.364-6.364zm.264 3.5.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
4384
5105
  })));
4385
5106
  };
4386
5107
  var TextareaIcon = SvgTextarea;
4387
5108
 
4388
- var _path$1, _path2$1;
4389
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
5109
+ var _path$6, _path2$2;
5110
+ function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
4390
5111
  var SvgIFrame = function SvgIFrame(props) {
4391
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
5112
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
4392
5113
  xmlns: "http://www.w3.org/2000/svg",
4393
5114
  width: 54,
4394
5115
  height: 54,
4395
5116
  fill: "none"
4396
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
5117
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
4397
5118
  fill: "currentcolor",
4398
5119
  d: "M34.467 37.3 41 31l-6.533-6.3-1.32 1.273L38.36 31l-5.213 5.027 1.32 1.273ZM19.533 24.7 13 31l6.533 6.3 1.32-1.273L15.64 31l5.214-5.027-1.32-1.273Zm4.127 14.832 1.805.468 4.875-17.532L28.535 22 23.66 39.532Z"
4399
- })), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
5120
+ })), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
4400
5121
  fill: "currentcolor",
4401
5122
  fillRule: "evenodd",
4402
5123
  d: "M46 9a3 3 0 0 1 3 3v30a3 3 0 0 1-3 3H8a3 3 0 0 1-3-3V12a3 3 0 0 1 3-3h38Zm0 2H8a1 1 0 0 0-1 1v4h40v-4a1 1 0 0 0-1-1ZM7 42V18h40v24a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1Z",
@@ -4405,19 +5126,19 @@ var SvgIFrame = function SvgIFrame(props) {
4405
5126
  };
4406
5127
  var IFrameIcon = SvgIFrame;
4407
5128
 
4408
- var _path, _path2;
4409
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5129
+ var _path$5, _path2$1;
5130
+ function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
4410
5131
  var SvgImage = function SvgImage(props) {
4411
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
5132
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
4412
5133
  xmlns: "http://www.w3.org/2000/svg",
4413
5134
  width: 54,
4414
5135
  height: 54,
4415
5136
  fill: "currentcolor"
4416
- }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
5137
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
4417
5138
  fillRule: "evenodd",
4418
5139
  d: "M34.636 21.91A3.818 3.818 0 1 1 27 21.908a3.818 3.818 0 0 1 7.636 0Zm-2 0A1.818 1.818 0 1 1 29 21.908a1.818 1.818 0 0 1 3.636 0Z",
4419
5140
  clipRule: "evenodd"
4420
- })), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
5141
+ })), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
4421
5142
  fillRule: "evenodd",
4422
5143
  d: "M15 13a2 2 0 0 0-2 2v24a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V15a2 2 0 0 0-2-2H15Zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 0 1 2.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 0 1 2.411.239L39 32.73V15ZM15 39v-8.754a.975.975 0 0 0 .168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 0 0 2.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15Z",
4423
5144
  clipRule: "evenodd"
@@ -4425,6 +5146,22 @@ var SvgImage = function SvgImage(props) {
4425
5146
  };
4426
5147
  var ImageIcon = SvgImage;
4427
5148
 
5149
+ var _path$4;
5150
+ function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
5151
+ var SvgTable = function SvgTable(props) {
5152
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
5153
+ xmlns: "http://www.w3.org/2000/svg",
5154
+ fill: "none",
5155
+ viewBox: "0 0 54 54"
5156
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
5157
+ fill: "currentcolor",
5158
+ fillRule: "evenodd",
5159
+ d: "M42.545 12.273A2.455 2.455 0 0 1 45 14.727v24.546a2.455 2.455 0 0 1-2.455 2.454h-31.09A2.455 2.455 0 0 1 9 39.273V14.727a2.455 2.455 0 0 1 2.455-2.454zM27.818 40.09h14.727a.818.818 0 0 0 .819-.818v-4.91H27.818Zm-1.636-5.727v5.727H11.455a.818.818 0 0 1-.819-.818v-4.91zm1.636-1.637h15.546V27H27.818ZM26.182 27v5.727H10.636V27zm1.636-1.636h15.546v-5.728H27.818Zm-1.636-5.728v5.728H10.636v-5.728z",
5160
+ clipRule: "evenodd"
5161
+ })));
5162
+ };
5163
+ var TableIcon = SvgTable;
5164
+
4428
5165
  const iconsByType = type => {
4429
5166
  return {
4430
5167
  button: ButtonIcon,
@@ -4440,124 +5177,35 @@ const iconsByType = type => {
4440
5177
  select: SelectIcon,
4441
5178
  separator: SeparatorIcon,
4442
5179
  spacer: SpacerIcon,
5180
+ dynamiclist: DynamicListIcon,
4443
5181
  taglist: TaglistIcon,
4444
5182
  text: TextIcon,
4445
5183
  textfield: TextfieldIcon,
4446
5184
  textarea: TextareaIcon,
5185
+ table: TableIcon,
4447
5186
  default: FormIcon
4448
5187
  }[type];
4449
5188
  };
4450
5189
 
4451
- const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, IFrame, Image, Numberfield, Datetime, Radio, Select, Spacer, Separator, Taglist, Text, Textfield, Textarea];
5190
+ const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, IFrame, DynamicList, Image, Numberfield, Datetime, Radio, Select, Spacer, Separator, DynamicList, Taglist, Text, Textfield, Textarea, Table];
4452
5191
 
4453
5192
  class FormFields {
4454
5193
  constructor() {
4455
5194
  this._formFields = {};
4456
5195
  formFields.forEach(formField => {
4457
- this.register(formField.config.type, formField);
4458
- });
4459
- }
4460
- register(type, formField) {
4461
- this._formFields[type] = formField;
4462
- }
4463
- get(type) {
4464
- return this._formFields[type];
4465
- }
4466
- }
4467
-
4468
- // config ///////////////////
4469
-
4470
- const VALUES_SOURCES = {
4471
- STATIC: 'static',
4472
- INPUT: 'input',
4473
- EXPRESSION: 'expression'
4474
- };
4475
- const VALUES_SOURCE_DEFAULT = VALUES_SOURCES.STATIC;
4476
- const VALUES_SOURCES_LABELS = {
4477
- [VALUES_SOURCES.STATIC]: 'Static',
4478
- [VALUES_SOURCES.INPUT]: 'Input data',
4479
- [VALUES_SOURCES.EXPRESSION]: 'Expression'
4480
- };
4481
- const VALUES_SOURCES_PATHS = {
4482
- [VALUES_SOURCES.STATIC]: ['values'],
4483
- [VALUES_SOURCES.INPUT]: ['valuesKey'],
4484
- [VALUES_SOURCES.EXPRESSION]: ['valuesExpression']
4485
- };
4486
- const VALUES_SOURCES_DEFAULTS = {
4487
- [VALUES_SOURCES.STATIC]: [{
4488
- label: 'Value',
4489
- value: 'value'
4490
- }],
4491
- [VALUES_SOURCES.INPUT]: '',
4492
- [VALUES_SOURCES.EXPRESSION]: '='
4493
- };
4494
-
4495
- // helpers ///////////////////
4496
-
4497
- function getValuesSource(field) {
4498
- for (const source of Object.values(VALUES_SOURCES)) {
4499
- if (minDash.get(field, VALUES_SOURCES_PATHS[source]) !== undefined) {
4500
- return source;
4501
- }
4502
- }
4503
- return VALUES_SOURCE_DEFAULT;
4504
- }
4505
-
4506
- function createInjector(bootstrapModules) {
4507
- const injector = new didi.Injector(bootstrapModules);
4508
- injector.init();
4509
- return injector;
4510
- }
4511
-
4512
- /**
4513
- * @param {string?} prefix
4514
- *
4515
- * @returns Element
4516
- */
4517
- function createFormContainer(prefix = 'fjs') {
4518
- const container = document.createElement('div');
4519
- container.classList.add(`${prefix}-container`);
4520
- return container;
4521
- }
4522
-
4523
- const EXPRESSION_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'conditional.hide', 'description', 'label', 'source', 'readonly', 'text', 'validate.min', 'validate.max', 'validate.minLength', 'validate.maxLength', 'valuesExpression', 'url'];
4524
- const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'url'];
4525
- function isRequired(field) {
4526
- return field.required;
4527
- }
4528
- function pathParse(path) {
4529
- if (!path) {
4530
- return [];
4531
- }
4532
- return path.split('.').map(key => {
4533
- return isNaN(parseInt(key)) ? key : parseInt(key);
4534
- });
4535
- }
4536
- function pathsEqual(a, b) {
4537
- return a && b && a.length === b.length && a.every((value, index) => value === b[index]);
4538
- }
4539
- const indices = {};
4540
- function generateIndexForType(type) {
4541
- if (type in indices) {
4542
- indices[type]++;
4543
- } else {
4544
- indices[type] = 1;
5196
+ this.register(formField.config.type, formField);
5197
+ });
5198
+ }
5199
+ register(type, formField) {
5200
+ this._formFields[type] = formField;
5201
+ }
5202
+ get(type) {
5203
+ return this._formFields[type];
4545
5204
  }
4546
- return indices[type];
4547
- }
4548
- function generateIdForType(type) {
4549
- return `${type}${generateIndexForType(type)}`;
4550
5205
  }
4551
5206
 
4552
- /**
4553
- * @template T
4554
- * @param {T} data
4555
- * @param {(this: any, key: string, value: any) => any} [replacer]
4556
- * @return {T}
4557
- */
4558
- function clone(data, replacer) {
4559
- return JSON.parse(JSON.stringify(data, replacer));
4560
- }
5207
+ const EXPRESSION_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'conditional.hide', 'description', 'label', 'source', 'readonly', 'text', 'validate.min', 'validate.max', 'validate.minLength', 'validate.maxLength', 'valuesExpression', 'url', 'dataSource', 'columnsExpression'];
5208
+ const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'url'];
4561
5209
 
4562
5210
  /**
4563
5211
  * @typedef { import('../types').Schema } Schema
@@ -4664,13 +5312,24 @@ function getSchemaVariables(schema, options = {}) {
4664
5312
  // remove duplicates
4665
5313
  return Array.from(new Set(variables));
4666
5314
  }
4667
- function runRecursively(formField, fn) {
4668
- const components = formField.components || [];
4669
- components.forEach((component, index) => {
4670
- runRecursively(component, fn);
4671
- });
4672
- fn(formField);
4673
- }
5315
+
5316
+ /**
5317
+ * Get the ancestry list of a form field.
5318
+ *
5319
+ * @param {string} formFieldId
5320
+ * @param {import('../core/FormFieldRegistry').default} formFieldRegistry
5321
+ *
5322
+ * @return {Array<string>} ancestry list
5323
+ */
5324
+ const getAncestryList = (formFieldId, formFieldRegistry) => {
5325
+ const ids = [];
5326
+ let currentFormField = formFieldRegistry.get(formFieldId);
5327
+ while (currentFormField) {
5328
+ ids.push(currentFormField.id);
5329
+ currentFormField = formFieldRegistry.get(currentFormField._parent);
5330
+ }
5331
+ return ids;
5332
+ };
4674
5333
 
4675
5334
  /**
4676
5335
  * @typedef {object} Condition
@@ -4687,36 +5346,102 @@ class ConditionChecker {
4687
5346
  /**
4688
5347
  * For given data, remove properties based on condition.
4689
5348
  *
4690
- * @param {Object<string, any>} properties
4691
5349
  * @param {Object<string, any>} data
5350
+ * @param {Object<string, any>} contextData
4692
5351
  * @param {Object} [options]
4693
5352
  * @param {Function} [options.getFilterPath]
5353
+ * @param {boolean} [options.leafNodeDeletionOnly]
4694
5354
  */
4695
- applyConditions(properties, data = {}, options = {}) {
4696
- const newProperties = clone(properties);
5355
+ applyConditions(data, contextData = {}, options = {}) {
5356
+ const workingData = clone(data);
4697
5357
  const {
4698
- getFilterPath = field => this._pathRegistry.getValuePath(field)
5358
+ getFilterPath = (field, indexes) => this._pathRegistry.getValuePath(field, {
5359
+ indexes
5360
+ }),
5361
+ leafNodeDeletionOnly = false
4699
5362
  } = options;
4700
- const form = this._formFieldRegistry.getAll().find(field => field.type === 'default');
5363
+ const _applyConditionsWithinScope = (rootField, scopeContext, startHidden = false) => {
5364
+ const {
5365
+ indexes = {},
5366
+ expressionIndexes = [],
5367
+ scopeData = contextData,
5368
+ parentScopeData = null
5369
+ } = scopeContext;
5370
+ this._pathRegistry.executeRecursivelyOnFields(rootField, ({
5371
+ field,
5372
+ isClosed,
5373
+ isRepeatable,
5374
+ context
5375
+ }) => {
5376
+ const {
5377
+ conditional,
5378
+ components,
5379
+ id
5380
+ } = field;
5381
+
5382
+ // build the expression context in the right format
5383
+ const localExpressionContext = buildExpressionContext({
5384
+ this: scopeData,
5385
+ data: contextData,
5386
+ i: expressionIndexes,
5387
+ parent: parentScopeData
5388
+ });
5389
+ context.isHidden = startHidden || context.isHidden || conditional && this._checkHideCondition(conditional, localExpressionContext);
5390
+
5391
+ // if a field is repeatable and visible, we need to implement custom recursion on its children
5392
+ if (isRepeatable && (!context.isHidden || leafNodeDeletionOnly)) {
5393
+ // prevent the regular recursion behavior of executeRecursivelyOnFields
5394
+ context.preventRecursion = true;
5395
+ const repeaterValuePath = this._pathRegistry.getValuePath(field, {
5396
+ indexes
5397
+ });
5398
+ const repeaterValue = minDash.get(contextData, repeaterValuePath);
5399
+
5400
+ // quit early if there are no children or data associated with the repeater
5401
+ if (!Array.isArray(repeaterValue) || !repeaterValue.length || !Array.isArray(components) || !components.length) {
5402
+ return;
5403
+ }
5404
+ for (let i = 0; i < repeaterValue.length; i++) {
5405
+ // create a new scope context for each index
5406
+ const newScopeContext = {
5407
+ indexes: {
5408
+ ...indexes,
5409
+ [id]: i
5410
+ },
5411
+ expressionIndexes: [...expressionIndexes, i + 1],
5412
+ scopeData: repeaterValue[i],
5413
+ parentScopeData: scopeData
5414
+ };
5415
+
5416
+ // for each child component, apply conditions within the new repetition scope
5417
+ components.forEach(component => {
5418
+ _applyConditionsWithinScope(component, newScopeContext, context.isHidden);
5419
+ });
5420
+ }
5421
+ }
5422
+
5423
+ // if we have a hidden repeatable field, and the data structure allows, we clear it directly at the root and stop recursion
5424
+ if (context.isHidden && !leafNodeDeletionOnly && isRepeatable) {
5425
+ context.preventRecursion = true;
5426
+ this._cleanlyClearDataAtPath(getFilterPath(field, indexes), workingData);
5427
+ }
5428
+
5429
+ // for simple leaf fields, we always clear
5430
+ if (context.isHidden && isClosed) {
5431
+ this._cleanlyClearDataAtPath(getFilterPath(field, indexes), workingData);
5432
+ }
5433
+ });
5434
+ };
5435
+
5436
+ // apply conditions starting with the root of the form
5437
+ const form = this._formFieldRegistry.getForm();
4701
5438
  if (!form) {
4702
5439
  throw new Error('form field registry has no form');
4703
5440
  }
4704
- this._pathRegistry.executeRecursivelyOnFields(form, ({
4705
- field,
4706
- isClosed,
4707
- context
4708
- }) => {
4709
- const {
4710
- conditional: condition
4711
- } = field;
4712
- context.isHidden = context.isHidden || condition && this._checkHideCondition(condition, data);
4713
-
4714
- // only clear the leaf nodes, as groups may both point to the same path
4715
- if (context.isHidden && isClosed) {
4716
- this._clearObjectValueRecursively(getFilterPath(field), newProperties);
4717
- }
5441
+ _applyConditionsWithinScope(form, {
5442
+ scopeData: contextData
4718
5443
  });
4719
- return newProperties;
5444
+ return workingData;
4720
5445
  }
4721
5446
 
4722
5447
  /**
@@ -4760,16 +5485,22 @@ class ConditionChecker {
4760
5485
  const result = this.check(condition.hide, data);
4761
5486
  return result === true;
4762
5487
  }
4763
- _clearObjectValueRecursively(valuePath, obj) {
5488
+ _cleanlyClearDataAtPath(valuePath, obj) {
4764
5489
  const workingValuePath = [...valuePath];
4765
5490
  let recurse = false;
4766
5491
  do {
4767
5492
  minDash.set(obj, workingValuePath, undefined);
4768
5493
  workingValuePath.pop();
4769
5494
  const parentObject = minDash.get(obj, workingValuePath);
4770
- recurse = minDash.isObject(parentObject) && !minDash.values(parentObject).length && !!workingValuePath.length;
5495
+ recurse = !!workingValuePath.length && (this._isEmptyObject(parentObject) || this._isEmptyArray(parentObject));
4771
5496
  } while (recurse);
4772
5497
  }
5498
+ _isEmptyObject(parentObject) {
5499
+ return minDash.isObject(parentObject) && !minDash.values(parentObject).length;
5500
+ }
5501
+ _isEmptyArray(parentObject) {
5502
+ return Array.isArray(parentObject) && (!parentObject.length || parentObject.every(item => item === undefined));
5503
+ }
4773
5504
  }
4774
5505
  ConditionChecker.$inject = ['formFieldRegistry', 'pathRegistry', 'eventBus'];
4775
5506
 
@@ -5284,14 +6015,15 @@ class UpdateFieldValidationHandler {
5284
6015
  execute(context) {
5285
6016
  const {
5286
6017
  field,
5287
- value
6018
+ value,
6019
+ indexes
5288
6020
  } = context;
5289
6021
  const {
5290
6022
  errors
5291
6023
  } = this._form._getState();
5292
6024
  context.oldErrors = clone(errors);
5293
6025
  const fieldErrors = this._validator.validateField(field, value);
5294
- const updatedErrors = minDash.set(errors, [field.id], fieldErrors.length ? fieldErrors : undefined);
6026
+ const updatedErrors = minDash.set(errors, [field.id, ...Object.values(indexes || {})], fieldErrors.length ? fieldErrors : undefined);
5295
6027
  this._form._setState({
5296
6028
  errors: updatedErrors
5297
6029
  });
@@ -5321,10 +6053,11 @@ class ViewerCommands {
5321
6053
  'formField.validation.update': UpdateFieldValidationHandler
5322
6054
  };
5323
6055
  }
5324
- updateFieldValidation(field, value) {
6056
+ updateFieldValidation(field, value, indexes) {
5325
6057
  const context = {
5326
6058
  field,
5327
- value
6059
+ value,
6060
+ indexes
5328
6061
  };
5329
6062
  this._commandStack.execute('formField.validation.update', context);
5330
6063
  }
@@ -5337,6 +6070,266 @@ var ViewerCommandsModule = {
5337
6070
  viewerCommands: ['type', ViewerCommands]
5338
6071
  };
5339
6072
 
6073
+ var _path$3;
6074
+ function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
6075
+ var SvgExpand = function SvgExpand(props) {
6076
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
6077
+ xmlns: "http://www.w3.org/2000/svg",
6078
+ width: 16,
6079
+ height: 16,
6080
+ fill: "none"
6081
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
6082
+ fill: "currentColor",
6083
+ d: "M2 9h5.5v3.086l-1.293-1.293-.707.707L8 14l2.5-2.5-.707-.707L8.5 12.086V9H14V8H2v1Zm11-7H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1Zm0 3H3V3h10v2Z"
6084
+ })));
6085
+ };
6086
+ var ExpandSvg = SvgExpand;
6087
+
6088
+ var _path$2;
6089
+ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
6090
+ var SvgCollapse = function SvgCollapse(props) {
6091
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
6092
+ xmlns: "http://www.w3.org/2000/svg",
6093
+ width: 16,
6094
+ height: 16,
6095
+ fill: "none"
6096
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
6097
+ fill: "currentColor",
6098
+ d: "M13 10H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Zm0 3H3v-2h10v2ZM8.5 3.914l1.293 1.293.707-.707L8 2 5.5 4.5l.707.707L7.5 3.914V7H2v1h12V7H8.5V3.914Z"
6099
+ })));
6100
+ };
6101
+ var CollapseSvg = SvgCollapse;
6102
+
6103
+ var _path$1, _path2;
6104
+ function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
6105
+ var SvgAdd = function SvgAdd(props) {
6106
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
6107
+ xmlns: "http://www.w3.org/2000/svg",
6108
+ width: 16,
6109
+ height: 16,
6110
+ fill: "none"
6111
+ }, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
6112
+ fill: "currentColor",
6113
+ d: "M8 2c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6 2.7-6 6-6Zm0-1C4.15 1 1 4.15 1 8s3.15 7 7 7 7-3.15 7-7-3.15-7-7-7Z"
6114
+ })), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
6115
+ fill: "currentColor",
6116
+ d: "M12 7.5H8.5V4h-1v3.5H4v1h3.5V12h1V8.5H12v-1Z"
6117
+ })));
6118
+ };
6119
+ var AddSvg = SvgAdd;
6120
+
6121
+ var _path;
6122
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6123
+ var SvgDelete = function SvgDelete(props) {
6124
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
6125
+ xmlns: "http://www.w3.org/2000/svg",
6126
+ width: 16,
6127
+ height: 16,
6128
+ fill: "none"
6129
+ }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
6130
+ fill: "currentColor",
6131
+ d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z"
6132
+ })));
6133
+ };
6134
+ var DeleteSvg = SvgDelete;
6135
+
6136
+ // disable react hook rules as the linter is confusing the functional components within a class as class components
6137
+ class RepeatRenderManager {
6138
+ constructor(form, formFields, formFieldRegistry, pathRegistry) {
6139
+ this._form = form;
6140
+ this._formFields = formFields;
6141
+ this._formFieldRegistry = formFieldRegistry;
6142
+ this._pathRegistry = pathRegistry;
6143
+ this.Repeater = this.Repeater.bind(this);
6144
+ this.RepeatFooter = this.RepeatFooter.bind(this);
6145
+ }
6146
+
6147
+ /**
6148
+ * Checks whether a field is currently repeating its children.
6149
+ *
6150
+ * @param {string} id - The id of the field to check
6151
+ * @returns {boolean} - True if repeatable, false otherwise
6152
+ */
6153
+ isFieldRepeating(id) {
6154
+ if (!id) {
6155
+ return false;
6156
+ }
6157
+ const formField = this._formFieldRegistry.get(id);
6158
+ const formFieldDefinition = this._formFields.get(formField.type);
6159
+ return formFieldDefinition.config.repeatable && formField.isRepeating;
6160
+ }
6161
+ Repeater(props) {
6162
+ const {
6163
+ RowsRenderer,
6164
+ indexes,
6165
+ useSharedState,
6166
+ ...restProps
6167
+ } = props;
6168
+ const [sharedRepeatState] = useSharedState;
6169
+ const {
6170
+ data
6171
+ } = this._form._getState();
6172
+ const repeaterField = props.field;
6173
+ const dataPath = this._pathRegistry.getValuePath(repeaterField, {
6174
+ indexes
6175
+ });
6176
+ const values = minDash.get(data, dataPath) || [];
6177
+ const nonCollapsedItems = this._getNonCollapsedItems(repeaterField);
6178
+ const collapseEnabled = !repeaterField.disableCollapse && values.length > nonCollapsedItems;
6179
+ const isCollapsed = collapseEnabled && sharedRepeatState.isCollapsed;
6180
+ const hasChildren = repeaterField.components && repeaterField.components.length > 0;
6181
+ const showRemove = repeaterField.allowAddRemove && hasChildren;
6182
+ const displayValues = isCollapsed ? values.slice(0, nonCollapsedItems) : values;
6183
+ const onDeleteItem = index => {
6184
+ const updatedValues = values.slice();
6185
+ updatedValues.splice(index, 1);
6186
+ props.onChange({
6187
+ field: repeaterField,
6188
+ value: updatedValues,
6189
+ indexes
6190
+ });
6191
+ };
6192
+ const parentExpressionContextInfo = hooks.useContext(LocalExpressionContext$1);
6193
+ return jsxRuntime.jsx(jsxRuntime.Fragment, {
6194
+ children: displayValues.map((value, index) => {
6195
+ const elementProps = {
6196
+ ...restProps,
6197
+ indexes: {
6198
+ ...(indexes || {}),
6199
+ [repeaterField.id]: index
6200
+ }
6201
+ };
6202
+ const localExpressionContextInfo = hooks.useMemo(() => ({
6203
+ data: parentExpressionContextInfo.data,
6204
+ this: value,
6205
+ parent: buildExpressionContext(parentExpressionContextInfo),
6206
+ i: [...parentExpressionContextInfo.i, index + 1]
6207
+ }), [index, value]);
6208
+ return !showRemove ? jsxRuntime.jsx(LocalExpressionContext$1.Provider, {
6209
+ value: localExpressionContextInfo,
6210
+ children: jsxRuntime.jsx(RowsRenderer, {
6211
+ ...elementProps
6212
+ })
6213
+ }) : jsxRuntime.jsxs("div", {
6214
+ class: "fjs-repeat-row-container",
6215
+ children: [jsxRuntime.jsx("div", {
6216
+ class: "fjs-repeat-row-rows",
6217
+ children: jsxRuntime.jsx(LocalExpressionContext$1.Provider, {
6218
+ value: localExpressionContextInfo,
6219
+ children: jsxRuntime.jsx(RowsRenderer, {
6220
+ ...elementProps
6221
+ })
6222
+ })
6223
+ }), jsxRuntime.jsx("button", {
6224
+ class: "fjs-repeat-row-remove",
6225
+ type: "button",
6226
+ "aria-label": `Remove list item ${index + 1}`,
6227
+ onClick: () => onDeleteItem(index),
6228
+ children: jsxRuntime.jsx("div", {
6229
+ class: "fjs-repeat-row-remove-icon-container",
6230
+ children: jsxRuntime.jsx(DeleteSvg, {})
6231
+ })
6232
+ })]
6233
+ });
6234
+ })
6235
+ });
6236
+ }
6237
+ RepeatFooter(props) {
6238
+ const addButtonRef = hooks.useRef(null);
6239
+ const {
6240
+ useSharedState,
6241
+ indexes,
6242
+ field: repeaterField,
6243
+ readonly,
6244
+ disabled
6245
+ } = props;
6246
+ const [sharedRepeatState, setSharedRepeatState] = useSharedState;
6247
+ const {
6248
+ data
6249
+ } = this._form._getState();
6250
+ const dataPath = this._pathRegistry.getValuePath(repeaterField, {
6251
+ indexes
6252
+ });
6253
+ const values = minDash.get(data, dataPath) || [];
6254
+ const nonCollapsedItems = this._getNonCollapsedItems(repeaterField);
6255
+ const collapseEnabled = !repeaterField.disableCollapse && values.length > nonCollapsedItems;
6256
+ const isCollapsed = collapseEnabled && sharedRepeatState.isCollapsed;
6257
+ const hasChildren = repeaterField.components && repeaterField.components.length > 0;
6258
+ const showAdd = repeaterField.allowAddRemove && hasChildren;
6259
+ const toggle = () => {
6260
+ setSharedRepeatState(state => ({
6261
+ ...state,
6262
+ isCollapsed: !isCollapsed
6263
+ }));
6264
+ };
6265
+ const shouldScroll = hooks.useRef(false);
6266
+ const onAddItem = () => {
6267
+ const updatedValues = values.slice();
6268
+ const newItem = this._form._getInitializedFieldData(this._form._getState().data, {
6269
+ container: repeaterField,
6270
+ indexes: {
6271
+ ...indexes,
6272
+ [repeaterField.id]: updatedValues.length
6273
+ }
6274
+ });
6275
+ updatedValues.push(newItem);
6276
+ shouldScroll.current = true;
6277
+ props.onChange({
6278
+ field: repeaterField,
6279
+ value: updatedValues,
6280
+ indexes
6281
+ });
6282
+ setSharedRepeatState(state => ({
6283
+ ...state,
6284
+ isCollapsed: false
6285
+ }));
6286
+ };
6287
+ useScrollIntoView(addButtonRef, [values.length], {
6288
+ align: 'bottom',
6289
+ behavior: 'auto',
6290
+ offset: 20
6291
+ }, [shouldScroll]);
6292
+ return jsxRuntime.jsxs("div", {
6293
+ className: classNames('fjs-repeat-render-footer', {
6294
+ 'fjs-remove-allowed': repeaterField.allowAddRemove
6295
+ }),
6296
+ children: [showAdd ? jsxRuntime.jsx("button", {
6297
+ readOnly: readonly,
6298
+ disabled: disabled || readonly,
6299
+ class: "fjs-repeat-render-add",
6300
+ type: "button",
6301
+ ref: addButtonRef,
6302
+ onClick: onAddItem,
6303
+ children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
6304
+ children: [jsxRuntime.jsx(AddSvg, {}), " ", 'Add new']
6305
+ })
6306
+ }) : null, collapseEnabled ? jsxRuntime.jsx("button", {
6307
+ class: "fjs-repeat-render-collapse",
6308
+ type: "button",
6309
+ onClick: toggle,
6310
+ children: isCollapsed ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
6311
+ children: [jsxRuntime.jsx(ExpandSvg, {}), " ", `Expand all (${values.length})`]
6312
+ }) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
6313
+ children: [jsxRuntime.jsx(CollapseSvg, {}), " ", 'Collapse']
6314
+ })
6315
+ }) : null]
6316
+ });
6317
+ }
6318
+ _getNonCollapsedItems(field) {
6319
+ const DEFAULT_NON_COLLAPSED_ITEMS = 5;
6320
+ const {
6321
+ nonCollapsedItems
6322
+ } = field;
6323
+ return nonCollapsedItems ? nonCollapsedItems : DEFAULT_NON_COLLAPSED_ITEMS;
6324
+ }
6325
+ }
6326
+ RepeatRenderManager.$inject = ['form', 'formFields', 'formFieldRegistry', 'pathRegistry'];
6327
+
6328
+ var RepeatRenderModule = {
6329
+ __init__: ['repeatRenderManager'],
6330
+ repeatRenderManager: ['type', RepeatRenderManager]
6331
+ };
6332
+
5340
6333
  var FN_REF = '__fn';
5341
6334
  var DEFAULT_PRIORITY = 1000;
5342
6335
  var slice = Array.prototype.slice;
@@ -5737,7 +6730,7 @@ EventBus.prototype._invokeListener = function (event, args, listener) {
5737
6730
  * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
5738
6731
  *
5739
6732
  * @param {string} event
5740
- * @param {EventBusListener} listener
6733
+ * @param {EventBusListener} newListener
5741
6734
  */
5742
6735
  EventBus.prototype._addListener = function (event, newListener) {
5743
6736
  var listener = this._getListeners(event),
@@ -6085,10 +7078,17 @@ class FieldFactory {
6085
7078
 
6086
7079
  const parent = _parent && this._formFieldRegistry.get(_parent);
6087
7080
  const parentPath = parent && this._pathRegistry.getValuePath(parent) || [];
6088
- if (config.keyed && key && !this._pathRegistry.canClaimPath([...parentPath, ...key.split('.')], true)) {
7081
+ const knownAncestorIds = getAncestryList(_parent, this._formFieldRegistry);
7082
+ if (config.keyed && key && !this._pathRegistry.canClaimPath([...parentPath, ...key.split('.')], {
7083
+ isClosed: true,
7084
+ knownAncestorIds
7085
+ })) {
6089
7086
  throw new Error(`binding path '${[...parentPath, key].join('.')}' is already claimed`);
6090
7087
  }
6091
- if (config.pathed && path && !this._pathRegistry.canClaimPath([...parentPath, ...path.split('.')], false)) {
7088
+ if (config.pathed && path && !this._pathRegistry.canClaimPath([...parentPath, ...path.split('.')], {
7089
+ isRepeatable: config.repeatable,
7090
+ knownAncestorIds
7091
+ })) {
6092
7092
  throw new Error(`binding path '${[...parentPath, ...path.split('.')].join('.')}' is already claimed`);
6093
7093
  }
6094
7094
  const labelAttrs = applyDefaults && config.label ? {
@@ -6101,9 +7101,23 @@ class FieldFactory {
6101
7101
  this._ensureId(field);
6102
7102
  if (config.keyed) {
6103
7103
  this._ensureKey(field);
7104
+ this._pathRegistry.claimPath(this._pathRegistry.getValuePath(field), {
7105
+ isClosed: true,
7106
+ claimerId: field.id,
7107
+ knownAncestorIds: getAncestryList(_parent, this._formFieldRegistry)
7108
+ });
6104
7109
  }
6105
- if (config.pathed && path) {
6106
- this._pathRegistry.claimPath(this._pathRegistry.getValuePath(field), false);
7110
+ if (config.pathed) {
7111
+ if (config.repeatable) {
7112
+ this._enforceDefaultPath(field);
7113
+ }
7114
+ if (field.path) {
7115
+ this._pathRegistry.claimPath(this._pathRegistry.getValuePath(field), {
7116
+ isRepeatable: config.repeatable,
7117
+ claimerId: field.id,
7118
+ knownAncestorIds: getAncestryList(_parent, this._formFieldRegistry)
7119
+ });
7120
+ }
6107
7121
  }
6108
7122
  return field;
6109
7123
  }
@@ -6120,16 +7134,23 @@ class FieldFactory {
6120
7134
  }
6121
7135
  _ensureKey(field) {
6122
7136
  if (!field.key) {
6123
- let random;
6124
- const parent = this._formFieldRegistry.get(field._parent);
6125
-
6126
- // ensure key uniqueness at level
6127
- do {
6128
- random = Math.random().toString(36).substring(7);
6129
- } while (parent && parent.components.some(child => child.key === random));
6130
- field.key = `${field.type}_${random}`;
7137
+ field.key = this._getUniqueKeyPath(field);
7138
+ }
7139
+ }
7140
+ _enforceDefaultPath(field) {
7141
+ if (!field.path) {
7142
+ field.path = this._getUniqueKeyPath(field);
6131
7143
  }
6132
- this._pathRegistry.claimPath(this._pathRegistry.getValuePath(field), true);
7144
+ }
7145
+ _getUniqueKeyPath(field) {
7146
+ let random;
7147
+ const parent = this._formFieldRegistry.get(field._parent);
7148
+
7149
+ // ensure key uniqueness at level
7150
+ do {
7151
+ random = Math.random().toString(36).substring(7);
7152
+ } while (parent && parent.components.some(child => child.key === random));
7153
+ return `${field.type}_${random}`;
6133
7154
  }
6134
7155
  }
6135
7156
  FieldFactory.$inject = ['formFieldRegistry', 'pathRegistry', 'formFields'];
@@ -6166,34 +7187,61 @@ FieldFactory.$inject = ['formFieldRegistry', 'pathRegistry', 'formFields'];
6166
7187
  * ]
6167
7188
  */
6168
7189
  class PathRegistry {
6169
- constructor(formFieldRegistry, formFields) {
7190
+ constructor(formFieldRegistry, formFields, injector) {
6170
7191
  this._formFieldRegistry = formFieldRegistry;
6171
7192
  this._formFields = formFields;
7193
+ this._injector = injector;
6172
7194
  this._dataPaths = [];
6173
7195
  }
6174
- canClaimPath(path, closed = false) {
7196
+ canClaimPath(path, options = {}) {
7197
+ const {
7198
+ isClosed = false,
7199
+ isRepeatable = false,
7200
+ skipAncestryCheck = false,
7201
+ claimerId = null,
7202
+ knownAncestorIds = []
7203
+ } = options;
6175
7204
  let node = {
6176
7205
  children: this._dataPaths
6177
7206
  };
7207
+
7208
+ // (1) if we reach a leaf node, we cannot claim it, if we reach an open node, we can
7209
+ // if we reach a repeatable node, we need to ensure that the claimer is (or will be) an ancestor of the repeater
6178
7210
  for (const segment of path) {
6179
7211
  node = _getNextSegment(node, segment);
6180
-
6181
- // if no node at that path, we can claim it no matter what
6182
7212
  if (!node) {
6183
7213
  return true;
6184
7214
  }
6185
-
6186
- // if we reach a leaf node, definitely not claimable
7215
+ if (node.isRepeatable && !skipAncestryCheck) {
7216
+ if (!(claimerId || knownAncestorIds.length)) {
7217
+ throw new Error('cannot claim a path that contains a repeater without specifying a claimerId or knownAncestorIds');
7218
+ }
7219
+ const isValidRepeatClaim = knownAncestorIds.includes(node.repeaterId) || claimerId && getAncestryList(claimerId, this._formFieldRegistry).includes(node.repeaterId);
7220
+ if (!isValidRepeatClaim) {
7221
+ return false;
7222
+ }
7223
+ }
6187
7224
  if (node.children === null) {
6188
7225
  return false;
6189
7226
  }
6190
7227
  }
6191
7228
 
6192
- // if after all segments we reach a node with children, we can claim it only openly
6193
- return !closed;
7229
+ // (2) if the path lands in the middle of the tree, we can only claim an open, non-repeatable path
7230
+ return !(isClosed || isRepeatable);
6194
7231
  }
6195
- claimPath(path, closed = false) {
6196
- if (!this.canClaimPath(path, closed)) {
7232
+ claimPath(path, options = {}) {
7233
+ const {
7234
+ isClosed = false,
7235
+ isRepeatable = false,
7236
+ claimerId = null,
7237
+ knownAncestorIds = []
7238
+ } = options;
7239
+ if (!this.canClaimPath(path, {
7240
+ isClosed,
7241
+ isRepeatable,
7242
+ claimerId,
7243
+ knownAncestorIds
7244
+ })) {
6197
7245
  throw new Error(`cannot claim path '${path.join('.')}'`);
6198
7246
  }
6199
7247
  let node = {
@@ -6213,9 +7261,15 @@ class PathRegistry {
6213
7261
  }
6214
7262
  node = child;
6215
7263
  }
6216
- if (closed) {
7264
+ if (isClosed) {
6217
7265
  node.children = null;
6218
7266
  }
7267
+
7268
+ // add some additional info when we make a repeatable path claim
7269
+ if (isRepeatable) {
7270
+ node.isRepeatable = true;
7271
+ node.repeaterId = claimerId;
7272
+ }
6219
7273
  }
6220
7274
  unclaimPath(path) {
6221
7275
  // verification Pass
@@ -6264,6 +7318,7 @@ class PathRegistry {
6264
7318
  const callResult = fn({
6265
7319
  field,
6266
7320
  isClosed: true,
7321
+ isRepeatable: false,
6267
7322
  context
6268
7323
  });
6269
7324
  return result && callResult;
@@ -6271,16 +7326,22 @@ class PathRegistry {
6271
7326
  const callResult = fn({
6272
7327
  field,
6273
7328
  isClosed: false,
7329
+ isRepeatable: formFieldConfig.repeatable,
6274
7330
  context
6275
7331
  });
6276
7332
  result = result && callResult;
6277
7333
  }
6278
- if (field.components) {
7334
+
7335
+ // stop executing if false is specifically returned or if preventing recursion
7336
+ if (result === false || context.preventRecursion) {
7337
+ return result;
7338
+ }
7339
+ if (Array.isArray(field.components)) {
6279
7340
  for (const child of field.components) {
6280
7341
  const callResult = this.executeRecursivelyOnFields(child, fn, clone(context));
6281
7342
  result = result && callResult;
6282
7343
 
6283
- // only stop executing if false is specifically returned, not if undefined
7344
+ // stop executing if false is specifically returned
6284
7345
  if (result === false) {
6285
7346
  return result;
6286
7347
  }
@@ -6295,6 +7356,7 @@ class PathRegistry {
6295
7356
  * @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
6296
7357
  * @param {Object} [options={}] - Configuration options.
6297
7358
  * @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
7359
+ * @param {Object} [options.indexes=null] - A map of parent IDs to the index of the field within said parent, leave null to get an unindexed path.
6298
7360
  * @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
6299
7361
  *
6300
7362
  * @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
@@ -6302,11 +7364,14 @@ class PathRegistry {
6302
7364
  getValuePath(field, options = {}) {
6303
7365
  const {
6304
7366
  replacements = {},
7367
+ indexes = null,
6305
7368
  cutoffNode = null
6306
7369
  } = options;
6307
7370
  let localValuePath = [];
6308
7371
  const hasReplacement = Object.prototype.hasOwnProperty.call(replacements, field.id);
6309
7372
  const formFieldConfig = this._formFields.get(field.type).config;
7373
+
7374
+ // uses path overrides instead of true path to calculate a potential value path
6310
7375
  if (hasReplacement) {
6311
7376
  const replacement = replacements[field.id];
6312
7377
  if (replacement === null || replacement === undefined || replacement === '') {
@@ -6323,6 +7388,13 @@ class PathRegistry {
6323
7388
  } else if (formFieldConfig.pathed && field.path) {
6324
7389
  localValuePath = field.path.split('.');
6325
7390
  }
7391
+
7392
+ // add potential indexes of repeated fields
7393
+ if (indexes) {
7394
+ localValuePath = this._addIndexes(localValuePath, field, indexes);
7395
+ }
7396
+
7397
+ // if parent exists and isn't cutoff node, add parent's value path
6326
7398
  if (field._parent && field._parent !== cutoffNode) {
6327
7399
  const parent = this._formFieldRegistry.get(field._parent);
6328
7400
  return [...(this.getValuePath(parent, options) || []), ...localValuePath];
@@ -6332,6 +7404,13 @@ class PathRegistry {
6332
7404
  clear() {
6333
7405
  this._dataPaths = [];
6334
7406
  }
7407
+ _addIndexes(localValuePath, field, indexes) {
7408
+ const repeatRenderManager = this._injector.get('repeatRenderManager', false);
7409
+ if (repeatRenderManager && repeatRenderManager.isFieldRepeating(field._parent)) {
7410
+ return [indexes[field._parent], ...localValuePath];
7411
+ }
7412
+ return localValuePath;
7413
+ }
6335
7414
  }
6336
7415
  const _getNextSegment = (node, segment) => {
6337
7416
  if (minDash.isArray(node.children)) {
@@ -6339,7 +7418,7 @@ const _getNextSegment = (node, segment) => {
6339
7418
  }
6340
7419
  return null;
6341
7420
  };
6342
- PathRegistry.$inject = ['formFieldRegistry', 'formFields'];
7421
+ PathRegistry.$inject = ['formFieldRegistry', 'formFields', 'injector'];
6343
7422
 
6344
7423
  /**
6345
7424
  * @typedef { { id: String, components: Array<String> } } FormRow
@@ -6431,7 +7510,7 @@ class FormLayouter {
6431
7510
  type,
6432
7511
  components
6433
7512
  } = formField;
6434
- if (type !== 'default' && type !== 'group' || !components) {
7513
+ if (!['default', 'group', 'dynamiclist'].includes(type) || !components) {
6435
7514
  return;
6436
7515
  }
6437
7516
 
@@ -6523,6 +7602,9 @@ class FormFieldRegistry {
6523
7602
  getAll() {
6524
7603
  return Object.values(this._formFields);
6525
7604
  }
7605
+ getForm() {
7606
+ return this.getAll().find(formField => formField.type === 'default');
7607
+ }
6526
7608
  forEach(callback) {
6527
7609
  this.getAll().forEach(formField => callback(formField));
6528
7610
  }
@@ -6714,7 +7796,7 @@ class Form {
6714
7796
  schema: importedSchema,
6715
7797
  warnings
6716
7798
  } = this.get('importer').importSchema(schema);
6717
- const initializedData = this._initializeFieldData(clone(data));
7799
+ const initializedData = this._getInitializedFieldData(clone(data));
6718
7800
  this._setState({
6719
7801
  data: initializedData,
6720
7802
  errors: {},
@@ -6770,26 +7852,68 @@ class Form {
6770
7852
  * @returns {Errors}
6771
7853
  */
6772
7854
  validate() {
6773
- const formFieldRegistry = this.get('formFieldRegistry'),
7855
+ const formFields = this.get('formFields'),
7856
+ formFieldRegistry = this.get('formFieldRegistry'),
6774
7857
  pathRegistry = this.get('pathRegistry'),
6775
7858
  validator = this.get('validator');
6776
7859
  const {
6777
7860
  data
6778
7861
  } = this._getState();
6779
- const getErrorPath = field => [field.id];
6780
- const errors = formFieldRegistry.getAll().reduce((errors, field) => {
7862
+ const getErrorPath = (field, indexes) => [field.id, ...Object.values(indexes || {})];
7863
+ function validateFieldRecursively(errors, field, indexes) {
6781
7864
  const {
6782
- disabled
7865
+ disabled,
7866
+ type,
7867
+ isRepeating
6783
7868
  } = field;
7869
+ const {
7870
+ config: fieldConfig
7871
+ } = formFields.get(type);
7872
+
7873
+ // (1) Skip disabled fields
6784
7874
  if (disabled) {
6785
- return errors;
7875
+ return;
7876
+ }
7877
+
7878
+ // (2) Validate the field
7879
+ const valuePath = pathRegistry.getValuePath(field, {
7880
+ indexes
7881
+ });
7882
+ const valueData = minDash.get(data, valuePath);
7883
+ const fieldErrors = validator.validateField(field, valueData);
7884
+ if (fieldErrors.length) {
7885
+ minDash.set(errors, getErrorPath(field, indexes), fieldErrors);
7886
+ }
7887
+
7888
+ // (3) Process parents
7889
+ if (!Array.isArray(field.components)) {
7890
+ return;
7891
+ }
7892
+
7893
+ // (4a) Recurse repeatable parents both across the indexes of repetition and the children
7894
+ if (fieldConfig.repeatable && isRepeating) {
7895
+ if (!Array.isArray(valueData)) {
7896
+ return;
7897
+ }
7898
+ valueData.forEach((_, index) => {
7899
+ field.components.forEach(component => {
7900
+ validateFieldRecursively(errors, component, {
7901
+ ...indexes,
7902
+ [field.id]: index
7903
+ });
7904
+ });
7905
+ });
7906
+ return;
6786
7907
  }
6787
- const value = minDash.get(data, pathRegistry.getValuePath(field));
6788
- const fieldErrors = validator.validateField(field, value);
6789
- return minDash.set(errors, getErrorPath(field), fieldErrors.length ? fieldErrors : undefined);
6790
- }, /** @type {Errors} */{});
6791
- const filteredErrors = this._applyConditions(errors, data, {
6792
- getFilterPath: getErrorPath
7908
+
7909
+ // (4b) Recurse non-repeatable parents only across the children
7910
+ field.components.forEach(component => validateFieldRecursively(errors, component, indexes));
7911
+ }
7912
+ const workingErrors = {};
7913
+ validateFieldRecursively(workingErrors, formFieldRegistry.getForm());
7914
+ const filteredErrors = this._applyConditions(workingErrors, data, {
7915
+ getFilterPath: getErrorPath,
7916
+ leafNodeDeletionOnly: true
6793
7917
  });
6794
7918
  this._setState({
6795
7919
  errors: filteredErrors
@@ -6887,11 +8011,12 @@ class Form {
6887
8011
  /**
6888
8012
  * @internal
6889
8013
  *
6890
- * @param { { add?: boolean, field: any, remove?: number, value?: any } } update
8014
+ * @param { { add?: boolean, field: any, indexes: object, remove?: number, value?: any } } update
6891
8015
  */
6892
8016
  _update(update) {
6893
8017
  const {
6894
8018
  field,
8019
+ indexes,
6895
8020
  value
6896
8021
  } = update;
6897
8022
  const {
@@ -6901,8 +8026,11 @@ class Form {
6901
8026
  const validator = this.get('validator'),
6902
8027
  pathRegistry = this.get('pathRegistry');
6903
8028
  const fieldErrors = validator.validateField(field, value);
6904
- minDash.set(data, pathRegistry.getValuePath(field), value);
6905
- minDash.set(errors, [field.id], fieldErrors.length ? fieldErrors : undefined);
8029
+ const valuePath = pathRegistry.getValuePath(field, {
8030
+ indexes
8031
+ });
8032
+ minDash.set(data, valuePath, value);
8033
+ minDash.set(errors, [field.id, ...Object.values(indexes || {})], fieldErrors.length ? fieldErrors : undefined);
6906
8034
  this._setState({
6907
8035
  data: clone(data),
6908
8036
  errors: clone(errors)
@@ -6931,7 +8059,7 @@ class Form {
6931
8059
  * @internal
6932
8060
  */
6933
8061
  _getModules() {
6934
- return [ExpressionLanguageModule, MarkdownModule, ViewerCommandsModule];
8062
+ return [ExpressionLanguageModule, MarkdownModule, ViewerCommandsModule, RepeatRenderModule];
6935
8063
  }
6936
8064
 
6937
8065
  /**
@@ -6945,29 +8073,58 @@ class Form {
6945
8073
  * @internal
6946
8074
  */
6947
8075
  _getSubmitData() {
6948
- const formFieldRegistry = this.get('formFieldRegistry'),
6949
- pathRegistry = this.get('pathRegistry'),
6950
- formFields = this.get('formFields');
8076
+ const formFieldRegistry = this.get('formFieldRegistry');
8077
+ const formFields = this.get('formFields');
8078
+ const pathRegistry = this.get('pathRegistry');
6951
8079
  const formData = this._getState().data;
6952
- const submitData = formFieldRegistry.getAll().reduce((previous, field) => {
8080
+ function collectSubmitDataRecursively(submitData, formField, indexes) {
6953
8081
  const {
6954
8082
  disabled,
6955
8083
  type
6956
- } = field;
8084
+ } = formField;
6957
8085
  const {
6958
8086
  config: fieldConfig
6959
8087
  } = formFields.get(type);
6960
8088
 
6961
- // do not submit disabled form fields or routing fields
6962
- if (disabled || !fieldConfig.keyed) {
6963
- return previous;
8089
+ // (1) Process keyed fields
8090
+ if (!disabled && fieldConfig.keyed) {
8091
+ const valuePath = pathRegistry.getValuePath(formField, {
8092
+ indexes
8093
+ });
8094
+ const value = minDash.get(formData, valuePath);
8095
+ minDash.set(submitData, valuePath, value);
8096
+ }
8097
+
8098
+ // (2) Process parents
8099
+ if (!Array.isArray(formField.components)) {
8100
+ return;
8101
+ }
8102
+
8103
+ // (3a) Recurse repeatable parents both across the indexes of repetition and the children
8104
+ if (fieldConfig.repeatable && formField.isRepeating) {
8105
+ const valueData = minDash.get(formData, pathRegistry.getValuePath(formField, {
8106
+ indexes
8107
+ }));
8108
+ if (!Array.isArray(valueData)) {
8109
+ return;
8110
+ }
8111
+ valueData.forEach((_, index) => {
8112
+ formField.components.forEach(component => {
8113
+ collectSubmitDataRecursively(submitData, component, {
8114
+ ...indexes,
8115
+ [formField.id]: index
8116
+ });
8117
+ });
8118
+ });
8119
+ return;
6964
8120
  }
6965
- const valuePath = pathRegistry.getValuePath(field);
6966
- const value = minDash.get(formData, valuePath);
6967
- return minDash.set(previous, valuePath, value);
6968
- }, {});
6969
- const filteredSubmitData = this._applyConditions(submitData, formData);
6970
- return filteredSubmitData;
8121
+
8122
+ // (3b) Recurse non-repeatable parents only across the children
8123
+ formField.components.forEach(component => collectSubmitDataRecursively(submitData, component, indexes));
8124
+ }
8125
+ const workingSubmitData = {};
8126
+ collectSubmitDataRecursively(workingSubmitData, formFieldRegistry.getForm(), {});
8127
+ return this._applyConditions(workingSubmitData, formData);
6971
8128
  }
6972
8129
 
6973
8130
  /**
@@ -6981,26 +8138,27 @@ class Form {
6981
8138
  /**
6982
8139
  * @internal
6983
8140
  */
6984
- _initializeFieldData(data) {
6985
- const formFieldRegistry = this.get('formFieldRegistry'),
6986
- formFields = this.get('formFields'),
6987
- pathRegistry = this.get('pathRegistry');
6988
- return formFieldRegistry.getAll().reduce((initializedData, formField) => {
8141
+ _getInitializedFieldData(data, options = {}) {
8142
+ const formFieldRegistry = this.get('formFieldRegistry');
8143
+ const formFields = this.get('formFields');
8144
+ const pathRegistry = this.get('pathRegistry');
8145
+ function initializeFieldDataRecursively(initializedData, formField, indexes) {
6989
8146
  const {
6990
8147
  defaultValue,
6991
- type
8148
+ type,
8149
+ isRepeating
6992
8150
  } = formField;
8151
+ const {
8152
+ config: fieldConfig
8153
+ } = formFields.get(type);
8154
+ const valuePath = pathRegistry.getValuePath(formField, {
8155
+ indexes
8156
+ });
8157
+ let valueData = minDash.get(data, valuePath);
6993
8158
 
6994
- // try to get value from data
6995
- // if unavailable - try to get default value from form field
6996
- // if unavailable - get empty value from form field
6997
-
6998
- const valuePath = pathRegistry.getValuePath(formField);
6999
- if (valuePath) {
7000
- const {
7001
- config: fieldConfig
7002
- } = formFields.get(type);
7003
- let valueData = minDash.get(data, valuePath);
8159
+ // (1) Process keyed fields
8160
+ if (fieldConfig.keyed) {
8161
+ // (a) Retrieve and sanitize data from input
7004
8162
  if (!minDash.isUndefined(valueData) && fieldConfig.sanitizeValue) {
7005
8163
  valueData = fieldConfig.sanitizeValue({
7006
8164
  formField,
@@ -7008,15 +8166,66 @@ class Form {
7008
8166
  value: valueData
7009
8167
  });
7010
8168
  }
8169
+
8170
+ // (b) Initialize field value in output data
7011
8171
  const initializedFieldValue = !minDash.isUndefined(valueData) ? valueData : !minDash.isUndefined(defaultValue) ? defaultValue : fieldConfig.emptyValue;
7012
- return minDash.set(initializedData, valuePath, initializedFieldValue);
8172
+ minDash.set(initializedData, valuePath, initializedFieldValue);
8173
+ }
8174
+
8175
+ // (2) Process parents
8176
+ if (!Array.isArray(formField.components)) {
8177
+ return;
8178
+ }
8179
+ if (fieldConfig.repeatable && isRepeating) {
8180
+ // (a) Sanitize repeatable parents data if it is not an array
8181
+ if (!valueData || !Array.isArray(valueData)) {
8182
+ valueData = new Array(minDash.isUndefined(formField.defaultRepetitions) ? 1 : formField.defaultRepetitions).fill().map(_ => ({})) || [];
8183
+ }
8184
+
8185
+ // (b) Ensure all elements of the array are objects
8186
+ valueData = valueData.map(val => minDash.isObject(val) ? val : {});
8187
+
8188
+ // (c) Initialize field value in output data
8189
+ minDash.set(initializedData, valuePath, valueData);
8190
+
8191
+ // (d) If indexed ahead of time, recurse repeatable simply across the children
8192
+ if (!minDash.isUndefined(indexes[formField.id])) {
8193
+ formField.components.forEach(component => initializeFieldDataRecursively(initializedData, component, {
8194
+ ...indexes
8195
+ }));
8196
+ return;
8197
+ }
8198
+
8199
+ // (e1) Recurse repeatable parents both across the indexes of repetition and the children
8200
+ valueData.forEach((_, index) => {
8201
+ formField.components.forEach(component => initializeFieldDataRecursively(initializedData, component, {
8202
+ ...indexes,
8203
+ [formField.id]: index
8204
+ }));
8205
+ });
8206
+ return;
7013
8207
  }
7014
- return initializedData;
7015
- }, data);
8208
+
8209
+ // (e2) Recurse non-repeatable parents only across the children
8210
+ formField.components.forEach(component => initializeFieldDataRecursively(initializedData, component, indexes));
8211
+ }
8212
+
8213
+ // allows definition of a specific subfield to generate the data for
8214
+ const container = options.container || formFieldRegistry.getForm();
8215
+ const indexes = options.indexes || {};
8216
+ const basePath = pathRegistry.getValuePath(container, {
8217
+ indexes
8218
+ }) || [];
8219
+
8220
+ // if indexing ahead of time, we must add this index to the data path at the end
8221
+ const path = !minDash.isUndefined(indexes[container.id]) ? [...basePath, indexes[container.id]] : basePath;
8222
+ const workingData = clone(data);
8223
+ initializeFieldDataRecursively(workingData, container, indexes);
8224
+ return minDash.get(workingData, path, {});
7016
8225
  }
7017
8226
  }
7018
8227
 
7019
- const schemaVersion = 13;
8228
+ const schemaVersion = 14;
7020
8229
 
7021
8230
  /**
7022
8231
  * @typedef { import('./types').CreateFormOptions } CreateFormOptions
@@ -7053,6 +8262,7 @@ exports.DATE_LABEL_PATH = DATE_LABEL_PATH;
7053
8262
  exports.Datetime = Datetime;
7054
8263
  exports.Default = FormComponent$1;
7055
8264
  exports.Description = Description;
8265
+ exports.DynamicList = DynamicList;
7056
8266
  exports.Errors = Errors;
7057
8267
  exports.ExpressionLanguageModule = ExpressionLanguageModule;
7058
8268
  exports.FeelExpressionLanguage = FeelExpressionLanguage;
@@ -7071,12 +8281,20 @@ exports.IFrame = IFrame;
7071
8281
  exports.Image = Image;
7072
8282
  exports.Importer = Importer;
7073
8283
  exports.Label = Label;
8284
+ exports.LocalExpressionContext = LocalExpressionContext$1;
7074
8285
  exports.MINUTES_IN_DAY = MINUTES_IN_DAY;
7075
8286
  exports.MarkdownModule = MarkdownModule;
7076
8287
  exports.MarkdownRenderer = MarkdownRenderer;
7077
8288
  exports.Numberfield = Numberfield;
8289
+ exports.OPTIONS_SOURCES = OPTIONS_SOURCES;
8290
+ exports.OPTIONS_SOURCES_DEFAULTS = OPTIONS_SOURCES_DEFAULTS;
8291
+ exports.OPTIONS_SOURCES_LABELS = OPTIONS_SOURCES_LABELS;
8292
+ exports.OPTIONS_SOURCES_PATHS = OPTIONS_SOURCES_PATHS;
8293
+ exports.OPTIONS_SOURCE_DEFAULT = OPTIONS_SOURCE_DEFAULT;
7078
8294
  exports.PathRegistry = PathRegistry;
7079
8295
  exports.Radio = Radio;
8296
+ exports.RepeatRenderManager = RepeatRenderManager;
8297
+ exports.RepeatRenderModule = RepeatRenderModule;
7080
8298
  exports.Select = Select;
7081
8299
  exports.Separator = Separator;
7082
8300
  exports.Spacer = Spacer;
@@ -7086,17 +8304,14 @@ exports.TIME_SERIALISINGFORMAT_LABELS = TIME_SERIALISINGFORMAT_LABELS;
7086
8304
  exports.TIME_SERIALISING_FORMATS = TIME_SERIALISING_FORMATS;
7087
8305
  exports.TIME_SERIALISING_FORMAT_PATH = TIME_SERIALISING_FORMAT_PATH;
7088
8306
  exports.TIME_USE24H_PATH = TIME_USE24H_PATH;
8307
+ exports.Table = Table;
7089
8308
  exports.Taglist = Taglist;
7090
8309
  exports.Text = Text;
7091
8310
  exports.Textarea = Textarea;
7092
8311
  exports.Textfield = Textfield;
7093
- exports.VALUES_SOURCES = VALUES_SOURCES;
7094
- exports.VALUES_SOURCES_DEFAULTS = VALUES_SOURCES_DEFAULTS;
7095
- exports.VALUES_SOURCES_LABELS = VALUES_SOURCES_LABELS;
7096
- exports.VALUES_SOURCES_PATHS = VALUES_SOURCES_PATHS;
7097
- exports.VALUES_SOURCE_DEFAULT = VALUES_SOURCE_DEFAULT;
7098
8312
  exports.ViewerCommands = ViewerCommands;
7099
8313
  exports.ViewerCommandsModule = ViewerCommandsModule;
8314
+ exports.buildExpressionContext = buildExpressionContext;
7100
8315
  exports.clone = clone;
7101
8316
  exports.createForm = createForm;
7102
8317
  exports.createFormContainer = createFormContainer;
@@ -7104,8 +8319,9 @@ exports.createInjector = createInjector;
7104
8319
  exports.formFields = formFields;
7105
8320
  exports.generateIdForType = generateIdForType;
7106
8321
  exports.generateIndexForType = generateIndexForType;
8322
+ exports.getAncestryList = getAncestryList;
8323
+ exports.getOptionsSource = getOptionsSource;
7107
8324
  exports.getSchemaVariables = getSchemaVariables;
7108
- exports.getValuesSource = getValuesSource;
7109
8325
  exports.iconsByType = iconsByType;
7110
8326
  exports.isRequired = isRequired;
7111
8327
  exports.pathParse = pathParse;