@bpmn-io/form-js-viewer 1.8.7 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,6 +49,7 @@
49
49
  --color-background-active: var(--cds-background-active, var(--color-grey-225-10-75));
50
50
  --color-layer: var(--cds-layer, var(--cds-layer-01, var(--color-white)));
51
51
  --color-layer-accent: var(--cds-layer-accent, var(--color-grey-0-0-88));
52
+ --color-background-pre: var(--cds-layer, var(--cds-layer-01, var(--color-white)));
52
53
 
53
54
  --color-icon-base: var(--cds-icon-primary, var(--color-black));
54
55
  --color-icon-inverted: var(--cds-icon-inverse, var(--color-black));
@@ -66,6 +67,7 @@
66
67
  --color-borders-adornment: var(--cds-border-subtle, var(--cds-border-subtle-01, var(--color-grey-225-10-85)));
67
68
  --color-borders-readonly: var(--cds-border-subtle, var(--color-grey-225-10-75));
68
69
  --color-borders-inverted: var(--cds-border-inverse, var(--color-grey-225-10-90));
70
+ --color-borders-pre: var(--cds-border-subtle, var(--color-grey-225-10-85));
69
71
 
70
72
  --color-warning: var(--cds-text-error, var(--color-red-360-100-45));
71
73
  --color-warning-light: var(--cds-text-error, var(--color-red-360-100-92));
@@ -833,6 +835,13 @@
833
835
  white-space: nowrap;
834
836
  }
835
837
 
838
+ .fjs-container .fjs-form-field-html pre,
839
+ .fjs-container .fjs-form-field-text pre {
840
+ border: 1px solid var(--color-borders-pre);
841
+ background: var(--color-background-pre);
842
+ padding: 4px;
843
+ }
844
+
836
845
  .fjs-container .fjs-taglist-anchor,
837
846
  .fjs-container .fjs-select-anchor,
838
847
  .fjs-container .fjs-timepicker-anchor {
@@ -44,6 +44,7 @@
44
44
  --color-background-active: var(--cds-background-active, var(--color-grey-225-10-75));
45
45
  --color-layer: var(--cds-layer, var(--cds-layer-01, var(--color-white)));
46
46
  --color-layer-accent: var(--cds-layer-accent, var(--color-grey-0-0-88));
47
+ --color-background-pre: var(--cds-layer, var(--cds-layer-01, var(--color-white)));
47
48
  --color-icon-base: var(--cds-icon-primary, var(--color-black));
48
49
  --color-icon-inverted: var(--cds-icon-inverse, var(--color-black));
49
50
  --color-text: var(--cds-text-primary, var(--color-grey-225-10-15));
@@ -59,6 +60,7 @@
59
60
  --color-borders-adornment: var(--cds-border-subtle, var(--cds-border-subtle-01, var(--color-grey-225-10-85)));
60
61
  --color-borders-readonly: var(--cds-border-subtle, var(--color-grey-225-10-75));
61
62
  --color-borders-inverted: var(--cds-border-inverse, var(--color-grey-225-10-90));
63
+ --color-borders-pre: var(--cds-border-subtle, var(--color-grey-225-10-85));
62
64
  --color-warning: var(--cds-text-error, var(--color-red-360-100-45));
63
65
  --color-warning-light: var(--cds-text-error, var(--color-red-360-100-92));
64
66
  --color-accent: var(--cds-link-primary, var(--color-blue-205-100-40));
@@ -793,6 +795,13 @@
793
795
  white-space: nowrap;
794
796
  }
795
797
 
798
+ .fjs-container .fjs-form-field-html pre,
799
+ .fjs-container .fjs-form-field-text pre {
800
+ border: 1px solid var(--color-borders-pre);
801
+ background: var(--color-background-pre);
802
+ padding: 4px;
803
+ }
804
+
796
805
  .fjs-container .fjs-taglist-anchor,
797
806
  .fjs-container .fjs-select-anchor,
798
807
  .fjs-container .fjs-timepicker-anchor {
package/dist/index.cjs CHANGED
@@ -8,6 +8,7 @@ var jsxRuntime = require('preact/jsx-runtime');
8
8
  var hooks = require('preact/hooks');
9
9
  var preact = require('preact');
10
10
  var isEqual = require('lodash/isEqual');
11
+ var luxon = require('luxon');
11
12
  var flatpickr = require('flatpickr');
12
13
  var React = require('preact/compat');
13
14
  var DOMPurify = require('dompurify');
@@ -602,40 +603,6 @@ function prefixId(id, formId, indexes) {
602
603
  return result;
603
604
  }
604
605
 
605
- const type$h = 'button';
606
- function Button(props) {
607
- const {
608
- disabled,
609
- onFocus,
610
- onBlur,
611
- field
612
- } = props;
613
- const {
614
- action = 'submit'
615
- } = field;
616
- return jsxRuntime.jsx("div", {
617
- class: formFieldClasses(type$h),
618
- children: jsxRuntime.jsx("button", {
619
- class: "fjs-button",
620
- type: action,
621
- disabled: disabled,
622
- onFocus: () => onFocus && onFocus(),
623
- onBlur: () => onBlur && onBlur(),
624
- children: field.label
625
- })
626
- });
627
- }
628
- Button.config = {
629
- type: type$h,
630
- keyed: false,
631
- label: 'Button',
632
- group: 'action',
633
- create: (options = {}) => ({
634
- action: 'submit',
635
- ...options
636
- })
637
- };
638
-
639
606
  const FormRenderContext = preact.createContext({
640
607
  Empty: props => {
641
608
  return null;
@@ -1472,16 +1439,16 @@ function parseIsoTime(isoTimeString) {
1472
1439
  return parseBasicMinutes(isoTimeString);
1473
1440
  }
1474
1441
  }
1442
+
1443
+ /**
1444
+ * Returns the date object as a simple 'YYYY-MM-DD' formatted date in the local timezone.
1445
+ *
1446
+ * @param {*} date The date object to serialize.
1447
+ * @returns {string} The serialized date.
1448
+ */
1475
1449
  function serializeDate(date) {
1476
- var d = new Date(date),
1477
- month = '' + (d.getMonth() + 1),
1478
- day = '' + d.getDate(),
1479
- year = d.getFullYear();
1480
- if (month.length < 2) month = '0' + month;
1481
- if (day.length < 2) day = '0' + day;
1482
- return [year, month, day].join('-');
1450
+ return luxon.DateTime.fromJSDate(date).toISODate();
1483
1451
  }
1484
-
1485
1452
  // this method is used to make the `new Date(value)` parsing behavior stricter
1486
1453
  function isDateTimeInputInformationSufficient(value) {
1487
1454
  if (!value || typeof value !== 'string') return false;
@@ -1709,6 +1676,43 @@ function useCleanupMultiSelectValue(props) {
1709
1676
  }, [field, options, onChange, memoizedValues, loadState]);
1710
1677
  }
1711
1678
 
1679
+ const type$h = 'button';
1680
+ function Button(props) {
1681
+ const {
1682
+ disabled,
1683
+ onFocus,
1684
+ onBlur,
1685
+ field
1686
+ } = props;
1687
+ const {
1688
+ action = 'submit'
1689
+ } = field;
1690
+ const evaluatedLabel = useSingleLineTemplateEvaluation(field.label || '', {
1691
+ debug: true
1692
+ });
1693
+ return jsxRuntime.jsx("div", {
1694
+ class: formFieldClasses(type$h),
1695
+ children: jsxRuntime.jsx("button", {
1696
+ class: "fjs-button",
1697
+ type: action,
1698
+ disabled: disabled,
1699
+ onFocus: () => onFocus && onFocus(),
1700
+ onBlur: () => onBlur && onBlur(),
1701
+ children: evaluatedLabel
1702
+ })
1703
+ });
1704
+ }
1705
+ Button.config = {
1706
+ type: type$h,
1707
+ keyed: false,
1708
+ label: 'Button',
1709
+ group: 'action',
1710
+ create: (options = {}) => ({
1711
+ action: 'submit',
1712
+ ...options
1713
+ })
1714
+ };
1715
+
1712
1716
  function Description(props) {
1713
1717
  const {
1714
1718
  description,
@@ -2864,7 +2868,7 @@ function Datetime(props) {
2864
2868
  switch (subtype) {
2865
2869
  case DATETIME_SUBTYPES.DATE:
2866
2870
  {
2867
- date = new Date(Date.parse(value));
2871
+ date = typeof value === 'string' ? luxon.DateTime.fromISO(value).toJSDate() : new Date(NaN);
2868
2872
  break;
2869
2873
  }
2870
2874
  case DATETIME_SUBTYPES.TIME:
@@ -5744,7 +5748,7 @@ class FormFields {
5744
5748
  }
5745
5749
  }
5746
5750
 
5747
- 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'];
5751
+ 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', 'expression'];
5748
5752
  const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'content', 'url'];
5749
5753
 
5750
5754
  /**
@@ -6953,7 +6957,10 @@ const RepetitionScaffold = props => {
6953
6957
  const localExpressionContextInfo = hooks.useMemo(() => ({
6954
6958
  data: parentExpressionContextInfo.data,
6955
6959
  this: itemValue,
6956
- parent: buildExpressionContext(parentExpressionContextInfo),
6960
+ parent: buildExpressionContext({
6961
+ ...parentExpressionContextInfo,
6962
+ data: parentExpressionContextInfo.this
6963
+ }),
6957
6964
  i: [...parentExpressionContextInfo.i, itemIndex + 1]
6958
6965
  }), [itemIndex, parentExpressionContextInfo, itemValue]);
6959
6966
  return !showRemove ? jsxRuntime.jsx(LocalExpressionContext.Provider, {
@@ -7865,13 +7872,11 @@ class FieldFactory {
7865
7872
  if (config.repeatable) {
7866
7873
  this._enforceDefaultPath(field);
7867
7874
  }
7868
- if (field.path) {
7869
- this._pathRegistry.claimPath(this._pathRegistry.getValuePath(field), {
7870
- isRepeatable: config.repeatable,
7871
- claimerId: field.id,
7872
- knownAncestorIds: getAncestryList(_parent, this._formFieldRegistry)
7873
- });
7874
- }
7875
+ this._pathRegistry.claimPath(this._pathRegistry.getValuePath(field), {
7876
+ isRepeatable: config.repeatable,
7877
+ claimerId: field.id,
7878
+ knownAncestorIds: getAncestryList(_parent, this._formFieldRegistry)
7879
+ });
7875
7880
  }
7876
7881
  return field;
7877
7882
  }