@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.
- package/dist/assets/form-js-base.css +9 -0
- package/dist/assets/form-js.css +9 -0
- package/dist/index.cjs +57 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +57 -52
- package/dist/index.es.js.map +1 -1
- package/dist/types/render/components/util/dateTimeUtil.d.ts +6 -0
- package/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -6,6 +6,7 @@ import { jsx, jsxs, Fragment } from 'preact/jsx-runtime';
|
|
|
6
6
|
import { useContext, useMemo, useRef, useCallback, useEffect, useState, useLayoutEffect } from 'preact/hooks';
|
|
7
7
|
import { createContext, createElement, Fragment as Fragment$1, render } from 'preact';
|
|
8
8
|
import isEqual from 'lodash/isEqual';
|
|
9
|
+
import { DateTime } from 'luxon';
|
|
9
10
|
import flatpickr from 'flatpickr';
|
|
10
11
|
import * as React from 'preact/compat';
|
|
11
12
|
import { createPortal } from 'preact/compat';
|
|
@@ -582,40 +583,6 @@ function prefixId(id, formId, indexes) {
|
|
|
582
583
|
return result;
|
|
583
584
|
}
|
|
584
585
|
|
|
585
|
-
const type$h = 'button';
|
|
586
|
-
function Button(props) {
|
|
587
|
-
const {
|
|
588
|
-
disabled,
|
|
589
|
-
onFocus,
|
|
590
|
-
onBlur,
|
|
591
|
-
field
|
|
592
|
-
} = props;
|
|
593
|
-
const {
|
|
594
|
-
action = 'submit'
|
|
595
|
-
} = field;
|
|
596
|
-
return jsx("div", {
|
|
597
|
-
class: formFieldClasses(type$h),
|
|
598
|
-
children: jsx("button", {
|
|
599
|
-
class: "fjs-button",
|
|
600
|
-
type: action,
|
|
601
|
-
disabled: disabled,
|
|
602
|
-
onFocus: () => onFocus && onFocus(),
|
|
603
|
-
onBlur: () => onBlur && onBlur(),
|
|
604
|
-
children: field.label
|
|
605
|
-
})
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
Button.config = {
|
|
609
|
-
type: type$h,
|
|
610
|
-
keyed: false,
|
|
611
|
-
label: 'Button',
|
|
612
|
-
group: 'action',
|
|
613
|
-
create: (options = {}) => ({
|
|
614
|
-
action: 'submit',
|
|
615
|
-
...options
|
|
616
|
-
})
|
|
617
|
-
};
|
|
618
|
-
|
|
619
586
|
const FormRenderContext = createContext({
|
|
620
587
|
Empty: props => {
|
|
621
588
|
return null;
|
|
@@ -1452,16 +1419,16 @@ function parseIsoTime(isoTimeString) {
|
|
|
1452
1419
|
return parseBasicMinutes(isoTimeString);
|
|
1453
1420
|
}
|
|
1454
1421
|
}
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* Returns the date object as a simple 'YYYY-MM-DD' formatted date in the local timezone.
|
|
1425
|
+
*
|
|
1426
|
+
* @param {*} date The date object to serialize.
|
|
1427
|
+
* @returns {string} The serialized date.
|
|
1428
|
+
*/
|
|
1455
1429
|
function serializeDate(date) {
|
|
1456
|
-
|
|
1457
|
-
month = '' + (d.getMonth() + 1),
|
|
1458
|
-
day = '' + d.getDate(),
|
|
1459
|
-
year = d.getFullYear();
|
|
1460
|
-
if (month.length < 2) month = '0' + month;
|
|
1461
|
-
if (day.length < 2) day = '0' + day;
|
|
1462
|
-
return [year, month, day].join('-');
|
|
1430
|
+
return DateTime.fromJSDate(date).toISODate();
|
|
1463
1431
|
}
|
|
1464
|
-
|
|
1465
1432
|
// this method is used to make the `new Date(value)` parsing behavior stricter
|
|
1466
1433
|
function isDateTimeInputInformationSufficient(value) {
|
|
1467
1434
|
if (!value || typeof value !== 'string') return false;
|
|
@@ -1689,6 +1656,43 @@ function useCleanupMultiSelectValue(props) {
|
|
|
1689
1656
|
}, [field, options, onChange, memoizedValues, loadState]);
|
|
1690
1657
|
}
|
|
1691
1658
|
|
|
1659
|
+
const type$h = 'button';
|
|
1660
|
+
function Button(props) {
|
|
1661
|
+
const {
|
|
1662
|
+
disabled,
|
|
1663
|
+
onFocus,
|
|
1664
|
+
onBlur,
|
|
1665
|
+
field
|
|
1666
|
+
} = props;
|
|
1667
|
+
const {
|
|
1668
|
+
action = 'submit'
|
|
1669
|
+
} = field;
|
|
1670
|
+
const evaluatedLabel = useSingleLineTemplateEvaluation(field.label || '', {
|
|
1671
|
+
debug: true
|
|
1672
|
+
});
|
|
1673
|
+
return jsx("div", {
|
|
1674
|
+
class: formFieldClasses(type$h),
|
|
1675
|
+
children: jsx("button", {
|
|
1676
|
+
class: "fjs-button",
|
|
1677
|
+
type: action,
|
|
1678
|
+
disabled: disabled,
|
|
1679
|
+
onFocus: () => onFocus && onFocus(),
|
|
1680
|
+
onBlur: () => onBlur && onBlur(),
|
|
1681
|
+
children: evaluatedLabel
|
|
1682
|
+
})
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
Button.config = {
|
|
1686
|
+
type: type$h,
|
|
1687
|
+
keyed: false,
|
|
1688
|
+
label: 'Button',
|
|
1689
|
+
group: 'action',
|
|
1690
|
+
create: (options = {}) => ({
|
|
1691
|
+
action: 'submit',
|
|
1692
|
+
...options
|
|
1693
|
+
})
|
|
1694
|
+
};
|
|
1695
|
+
|
|
1692
1696
|
function Description(props) {
|
|
1693
1697
|
const {
|
|
1694
1698
|
description,
|
|
@@ -2844,7 +2848,7 @@ function Datetime(props) {
|
|
|
2844
2848
|
switch (subtype) {
|
|
2845
2849
|
case DATETIME_SUBTYPES.DATE:
|
|
2846
2850
|
{
|
|
2847
|
-
date =
|
|
2851
|
+
date = typeof value === 'string' ? DateTime.fromISO(value).toJSDate() : new Date(NaN);
|
|
2848
2852
|
break;
|
|
2849
2853
|
}
|
|
2850
2854
|
case DATETIME_SUBTYPES.TIME:
|
|
@@ -5724,7 +5728,7 @@ class FormFields {
|
|
|
5724
5728
|
}
|
|
5725
5729
|
}
|
|
5726
5730
|
|
|
5727
|
-
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'];
|
|
5731
|
+
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'];
|
|
5728
5732
|
const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'content', 'url'];
|
|
5729
5733
|
|
|
5730
5734
|
/**
|
|
@@ -6933,7 +6937,10 @@ const RepetitionScaffold = props => {
|
|
|
6933
6937
|
const localExpressionContextInfo = useMemo(() => ({
|
|
6934
6938
|
data: parentExpressionContextInfo.data,
|
|
6935
6939
|
this: itemValue,
|
|
6936
|
-
parent: buildExpressionContext(
|
|
6940
|
+
parent: buildExpressionContext({
|
|
6941
|
+
...parentExpressionContextInfo,
|
|
6942
|
+
data: parentExpressionContextInfo.this
|
|
6943
|
+
}),
|
|
6937
6944
|
i: [...parentExpressionContextInfo.i, itemIndex + 1]
|
|
6938
6945
|
}), [itemIndex, parentExpressionContextInfo, itemValue]);
|
|
6939
6946
|
return !showRemove ? jsx(LocalExpressionContext.Provider, {
|
|
@@ -7845,13 +7852,11 @@ class FieldFactory {
|
|
|
7845
7852
|
if (config.repeatable) {
|
|
7846
7853
|
this._enforceDefaultPath(field);
|
|
7847
7854
|
}
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
});
|
|
7854
|
-
}
|
|
7855
|
+
this._pathRegistry.claimPath(this._pathRegistry.getValuePath(field), {
|
|
7856
|
+
isRepeatable: config.repeatable,
|
|
7857
|
+
claimerId: field.id,
|
|
7858
|
+
knownAncestorIds: getAncestryList(_parent, this._formFieldRegistry)
|
|
7859
|
+
});
|
|
7855
7860
|
}
|
|
7856
7861
|
return field;
|
|
7857
7862
|
}
|