@bpmn-io/form-js-viewer 1.8.8 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,23 +1,23 @@
1
- Copyright (c) 2021-present Camunda Services GmbH
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in the
5
- Software without restriction, including without limitation the rights to use, copy,
6
- modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7
- and to permit persons to whom the Software is furnished to do so, subject to the
8
- following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- The source code responsible for displaying the bpmn.io project watermark that
14
- links back to https://bpmn.io as part of rendered diagrams MUST NOT be
15
- removed or changed. When this software is being used in a website or application,
16
- the watermark must stay fully visible and not visually overlapped by other elements.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20
- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
1
+ Copyright (c) 2021-present Camunda Services GmbH
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in the
5
+ Software without restriction, including without limitation the rights to use, copy,
6
+ modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7
+ and to permit persons to whom the Software is furnished to do so, subject to the
8
+ following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ The source code responsible for displaying the bpmn.io project watermark that
14
+ links back to https://bpmn.io as part of rendered diagrams MUST NOT be
15
+ removed or changed. When this software is being used in a website or application,
16
+ the watermark must stay fully visible and not visually overlapped by other elements.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
23
  OR OTHER DEALINGS IN THE SOFTWARE.
@@ -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 {
@@ -1180,6 +1189,10 @@
1180
1189
  color: var(--color-warning);
1181
1190
  }
1182
1191
 
1192
+ .fjs-container .fjs-repeat-row-collapsed {
1193
+ display: none;
1194
+ }
1195
+
1183
1196
  .fjs-container .fjs-repeat-render-footer {
1184
1197
  display: flex;
1185
1198
  flex-direction: row;
@@ -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 {
@@ -1140,6 +1149,10 @@
1140
1149
  color: var(--color-warning);
1141
1150
  }
1142
1151
 
1152
+ .fjs-container .fjs-repeat-row-collapsed {
1153
+ display: none;
1154
+ }
1155
+
1143
1156
  .fjs-container .fjs-repeat-render-footer {
1144
1157
  display: flex;
1145
1158
  flex-direction: row;
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');
@@ -1438,16 +1439,16 @@ function parseIsoTime(isoTimeString) {
1438
1439
  return parseBasicMinutes(isoTimeString);
1439
1440
  }
1440
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
+ */
1441
1449
  function serializeDate(date) {
1442
- var d = new Date(date),
1443
- month = '' + (d.getMonth() + 1),
1444
- day = '' + d.getDate(),
1445
- year = d.getFullYear();
1446
- if (month.length < 2) month = '0' + month;
1447
- if (day.length < 2) day = '0' + day;
1448
- return [year, month, day].join('-');
1450
+ return luxon.DateTime.fromJSDate(date).toISODate();
1449
1451
  }
1450
-
1451
1452
  // this method is used to make the `new Date(value)` parsing behavior stricter
1452
1453
  function isDateTimeInputInformationSufficient(value) {
1453
1454
  if (!value || typeof value !== 'string') return false;
@@ -2867,7 +2868,7 @@ function Datetime(props) {
2867
2868
  switch (subtype) {
2868
2869
  case DATETIME_SUBTYPES.DATE:
2869
2870
  {
2870
- date = new Date(Date.parse(value));
2871
+ date = typeof value === 'string' ? luxon.DateTime.fromISO(value).toJSDate() : new Date(NaN);
2871
2872
  break;
2872
2873
  }
2873
2874
  case DATETIME_SUBTYPES.TIME:
@@ -6808,6 +6809,7 @@ class RepeatRenderManager {
6808
6809
  const hasChildren = repeaterField.components && repeaterField.components.length > 0;
6809
6810
  const showRemove = repeaterField.allowAddRemove && hasChildren;
6810
6811
  const displayValues = isCollapsed ? values.slice(0, nonCollapsedItems) : values;
6812
+ const hiddenValues = isCollapsed ? values.slice(nonCollapsedItems) : [];
6811
6813
  const onDeleteItem = index => {
6812
6814
  const updatedValues = values.slice();
6813
6815
  updatedValues.splice(index, 1);
@@ -6818,8 +6820,8 @@ class RepeatRenderManager {
6818
6820
  });
6819
6821
  };
6820
6822
  const parentExpressionContextInfo = hooks.useContext(LocalExpressionContext);
6821
- return jsxRuntime.jsx(jsxRuntime.Fragment, {
6822
- children: displayValues.map((itemValue, itemIndex) => jsxRuntime.jsx(RepetitionScaffold, {
6823
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
6824
+ children: [displayValues.map((itemValue, itemIndex) => jsxRuntime.jsx(RepetitionScaffold, {
6823
6825
  itemIndex: itemIndex,
6824
6826
  itemValue: itemValue,
6825
6827
  parentExpressionContextInfo: parentExpressionContextInfo,
@@ -6829,7 +6831,20 @@ class RepeatRenderManager {
6829
6831
  onDeleteItem: onDeleteItem,
6830
6832
  showRemove: showRemove,
6831
6833
  ...restProps
6832
- }, itemIndex))
6834
+ }, itemIndex)), hiddenValues.length > 0 ? jsxRuntime.jsx("div", {
6835
+ className: "fjs-repeat-row-collapsed",
6836
+ children: hiddenValues.map((itemValue, itemIndex) => jsxRuntime.jsx(RepetitionScaffold, {
6837
+ itemIndex: itemIndex + nonCollapsedItems,
6838
+ itemValue: itemValue,
6839
+ parentExpressionContextInfo: parentExpressionContextInfo,
6840
+ repeaterField: repeaterField,
6841
+ RowsRenderer: RowsRenderer,
6842
+ indexes: indexes,
6843
+ onDeleteItem: onDeleteItem,
6844
+ showRemove: showRemove,
6845
+ ...restProps
6846
+ }, itemIndex))
6847
+ }) : null]
6833
6848
  });
6834
6849
  }
6835
6850
  RepeatFooter(props) {