@bpmn-io/form-js-viewer 0.10.0 → 0.11.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.
- package/dist/assets/form-js.css +46 -48
- package/dist/index.cjs +44 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +44 -45
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
package/dist/assets/form-js.css
CHANGED
|
@@ -178,6 +178,8 @@
|
|
|
178
178
|
width: auto !important;
|
|
179
179
|
min-width: 34px;
|
|
180
180
|
text-align: center;
|
|
181
|
+
overflow: hidden;
|
|
182
|
+
text-overflow: ellipsis;
|
|
181
183
|
}
|
|
182
184
|
|
|
183
185
|
.fjs-container .fjs-input-adornment svg {
|
|
@@ -221,6 +223,10 @@
|
|
|
221
223
|
width: 100%;
|
|
222
224
|
}
|
|
223
225
|
|
|
226
|
+
.fjs-container .fjs-form-field-datetime .fjs-input-adornment svg {
|
|
227
|
+
color: var(--color-black);
|
|
228
|
+
}
|
|
229
|
+
|
|
224
230
|
.fjs-container .fjs-datetime-separator {
|
|
225
231
|
width: 10px;
|
|
226
232
|
}
|
|
@@ -228,21 +234,11 @@
|
|
|
228
234
|
.fjs-container .fjs-input-group {
|
|
229
235
|
display: flex;
|
|
230
236
|
width: 100%;
|
|
231
|
-
margin: 4px
|
|
237
|
+
margin: 4px 0;
|
|
232
238
|
border: var(--border-definition);
|
|
233
239
|
border-radius: 3px;
|
|
234
240
|
}
|
|
235
241
|
|
|
236
|
-
.fjs-container .fjs-input-group.disabled {
|
|
237
|
-
background-color: var(--color-background-disabled);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.fjs-container .fjs-input-group.disabled,
|
|
241
|
-
.fjs-container .fjs-input-group.disabled .fjs-input,
|
|
242
|
-
.fjs-container .fjs-input-group.disabled .fjs-input-adornment {
|
|
243
|
-
border-color: var(--color-borders-disabled);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
242
|
.fjs-container .fjs-taglist .fjs-taglist-input,
|
|
247
243
|
.fjs-container .fjs-input-group .fjs-input {
|
|
248
244
|
border: none;
|
|
@@ -322,9 +318,7 @@
|
|
|
322
318
|
color: var(--color-text);
|
|
323
319
|
}
|
|
324
320
|
|
|
325
|
-
|
|
326
|
-
background-color: var(--color-grey-225-10-95);
|
|
327
|
-
}
|
|
321
|
+
|
|
328
322
|
|
|
329
323
|
.fjs-container .fjs-radio {
|
|
330
324
|
display: flex;
|
|
@@ -388,6 +382,8 @@
|
|
|
388
382
|
.fjs-container .fjs-input:disabled,
|
|
389
383
|
.fjs-container .fjs-textarea:disabled,
|
|
390
384
|
.fjs-container .fjs-select:disabled,
|
|
385
|
+
.fjs-container .fjs-number-arrow-container.disabled button,
|
|
386
|
+
.fjs-container .fjs-input-group.disabled,
|
|
391
387
|
.fjs-container .fjs-taglist.disabled {
|
|
392
388
|
background-color: var(--color-background-disabled);
|
|
393
389
|
border-color: var(--color-borders-disabled);
|
|
@@ -400,6 +396,11 @@
|
|
|
400
396
|
border-color: var(--color-borders-disabled);
|
|
401
397
|
}
|
|
402
398
|
|
|
399
|
+
.fjs-container .fjs-input-group.disabled .fjs-input,
|
|
400
|
+
.fjs-container .fjs-input-group.disabled .fjs-input-adornment {
|
|
401
|
+
border-color: var(--color-borders-disabled);
|
|
402
|
+
}
|
|
403
|
+
|
|
403
404
|
.fjs-container .fjs-form-field.fjs-has-errors .fjs-input,
|
|
404
405
|
.fjs-container .fjs-form-field.fjs-has-errors .fjs-select,
|
|
405
406
|
.fjs-container .fjs-form-field.fjs-has-errors .fjs-textarea,
|
|
@@ -459,15 +460,11 @@
|
|
|
459
460
|
gap: 5px;
|
|
460
461
|
border: var(--color-borders) solid 1px;
|
|
461
462
|
border-radius: 3px;
|
|
463
|
+
margin: 4px 0;
|
|
462
464
|
padding: 5px;
|
|
463
465
|
background-color: var(--color-background);
|
|
464
466
|
}
|
|
465
467
|
|
|
466
|
-
.fjs-container .fjs-taglist.disabled {
|
|
467
|
-
border: var(--color-borders-disabled) solid 1px;
|
|
468
|
-
background-color: var(--color-background-disabled);
|
|
469
|
-
}
|
|
470
|
-
|
|
471
468
|
.fjs-container .fjs-taglist .fjs-taglist-tag {
|
|
472
469
|
display: flex;
|
|
473
470
|
overflow: hidden;
|
|
@@ -567,54 +564,55 @@
|
|
|
567
564
|
|
|
568
565
|
.fjs-container .fjs-image-placeholder {
|
|
569
566
|
height: 64px;
|
|
570
|
-
margin:
|
|
567
|
+
margin: 4px 0;
|
|
571
568
|
}
|
|
572
569
|
|
|
573
570
|
/**
|
|
574
571
|
* Flatpickr style adjustments
|
|
575
572
|
*/
|
|
576
573
|
|
|
577
|
-
.flatpickr-day.today {
|
|
578
|
-
border-color: transparent
|
|
579
|
-
background-color: transparent
|
|
580
|
-
font-weight: bold
|
|
574
|
+
.fjs-container .flatpickr-day.today {
|
|
575
|
+
border-color: transparent;
|
|
576
|
+
background-color: transparent;
|
|
577
|
+
font-weight: bold;
|
|
581
578
|
}
|
|
582
579
|
|
|
583
|
-
.flatpickr-day.today:hover,
|
|
584
|
-
.flatpickr-day.today:focus {
|
|
585
|
-
border-color: var(--color-borders)
|
|
586
|
-
background-color: var(--color-datepicker-focused-day)
|
|
587
|
-
color: var(--color-text-inverted)
|
|
580
|
+
.fjs-container .flatpickr-day.today:hover,
|
|
581
|
+
.fjs-container .flatpickr-day.today:focus {
|
|
582
|
+
border-color: var(--color-borders);
|
|
583
|
+
background-color: var(--color-datepicker-focused-day);
|
|
584
|
+
color: var(--color-text-inverted);
|
|
588
585
|
}
|
|
589
586
|
|
|
590
|
-
.flatpickr-day.selected {
|
|
591
|
-
border-color: var(--color-accent)
|
|
592
|
-
background-color: inherit
|
|
593
|
-
color: inherit
|
|
594
|
-
font-weight: normal
|
|
587
|
+
.fjs-container .flatpickr-day.selected {
|
|
588
|
+
border-color: var(--color-accent);
|
|
589
|
+
background-color: inherit;
|
|
590
|
+
color: inherit;
|
|
591
|
+
font-weight: normal;
|
|
595
592
|
}
|
|
596
593
|
|
|
597
|
-
.flatpickr-day.selected.today {
|
|
598
|
-
font-weight: bold
|
|
594
|
+
.fjs-container .flatpickr-day.selected.today {
|
|
595
|
+
font-weight: bold;
|
|
599
596
|
}
|
|
600
597
|
|
|
601
|
-
.flatpickr-day.selected:hover,
|
|
602
|
-
.flatpickr-day.selected:focus {
|
|
603
|
-
background-color: var(--color-accent)
|
|
604
|
-
font-weight: bold
|
|
605
|
-
color: var(--color-text-inverted)
|
|
598
|
+
.fjs-container .flatpickr-day.selected:hover,
|
|
599
|
+
.fjs-container .flatpickr-day.selected:focus {
|
|
600
|
+
background-color: var(--color-accent);
|
|
601
|
+
font-weight: bold;
|
|
602
|
+
color: var(--color-text-inverted);
|
|
603
|
+
border-color: var(--color-accent);
|
|
606
604
|
}
|
|
607
605
|
|
|
608
|
-
.flatpickr-days, .flatpickr-weekdays {
|
|
609
|
-
padding: 10px
|
|
610
|
-
width: 100
|
|
606
|
+
.fjs-container .flatpickr-days, .flatpickr-weekdays {
|
|
607
|
+
padding: 10px;
|
|
608
|
+
width: 100%;
|
|
611
609
|
}
|
|
612
610
|
|
|
613
611
|
.fjs-container .flatpickr-calendar.hasTime.noCalendar {
|
|
614
|
-
width: auto
|
|
615
|
-
max-width: 250px
|
|
612
|
+
width: auto;
|
|
613
|
+
max-width: 250px;
|
|
616
614
|
}
|
|
617
615
|
|
|
618
|
-
.flatpickr-calendar {
|
|
619
|
-
width: 326px
|
|
616
|
+
.fjs-container .flatpickr-calendar {
|
|
617
|
+
width: 326px;
|
|
620
618
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -616,7 +616,7 @@ class Validator {
|
|
|
616
616
|
if (type === 'number') {
|
|
617
617
|
const {
|
|
618
618
|
decimalDigits,
|
|
619
|
-
|
|
619
|
+
increment
|
|
620
620
|
} = field;
|
|
621
621
|
if (value === 'NaN') {
|
|
622
622
|
errors = [...errors, 'Value is not a number.'];
|
|
@@ -624,13 +624,13 @@ class Validator {
|
|
|
624
624
|
if (decimalDigits >= 0 && countDecimals(value) > decimalDigits) {
|
|
625
625
|
errors = [...errors, 'Value is expected to ' + (decimalDigits === 0 ? 'be an integer' : `have at most ${decimalDigits} decimal digit${decimalDigits > 1 ? 's' : ''}`) + '.'];
|
|
626
626
|
}
|
|
627
|
-
if (
|
|
627
|
+
if (increment) {
|
|
628
628
|
const bigValue = Big__default['default'](value);
|
|
629
|
-
const
|
|
630
|
-
const offset = bigValue.mod(
|
|
629
|
+
const bigIncrement = Big__default['default'](increment);
|
|
630
|
+
const offset = bigValue.mod(bigIncrement);
|
|
631
631
|
if (offset.cmp(0) !== 0) {
|
|
632
632
|
const previousValue = bigValue.minus(offset);
|
|
633
|
-
const nextValue = previousValue.plus(
|
|
633
|
+
const nextValue = previousValue.plus(bigIncrement);
|
|
634
634
|
errors = [...errors, `Please select a valid value, the two nearest valid values are ${previousValue} and ${nextValue}.`];
|
|
635
635
|
}
|
|
636
636
|
}
|
|
@@ -645,10 +645,10 @@ class Validator {
|
|
|
645
645
|
if (validate.required && (minDash.isNil(value) || value === '')) {
|
|
646
646
|
errors = [...errors, 'Field is required.'];
|
|
647
647
|
}
|
|
648
|
-
if ('min' in validate && value && value < validate.min) {
|
|
648
|
+
if ('min' in validate && (value || value === 0) && value < validate.min) {
|
|
649
649
|
errors = [...errors, `Field must have minimum value of ${validate.min}.`];
|
|
650
650
|
}
|
|
651
|
-
if ('max' in validate && value && value > validate.max) {
|
|
651
|
+
if ('max' in validate && (value || value === 0) && value > validate.max) {
|
|
652
652
|
errors = [...errors, `Field must have maximum value of ${validate.max}.`];
|
|
653
653
|
}
|
|
654
654
|
if ('minLength' in validate && value && value.trim().length < validate.minLength) {
|
|
@@ -1874,7 +1874,7 @@ var CalendarIcon = (({
|
|
|
1874
1874
|
fillRule: "evenodd",
|
|
1875
1875
|
clipRule: "evenodd",
|
|
1876
1876
|
d: "M19 2H9V0H7v2H2a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V4a2 2 0 00-2-2h-5V0h-2v2zM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7zm-5 4v17h24V11H2z",
|
|
1877
|
-
fill: "
|
|
1877
|
+
fill: "currentColor"
|
|
1878
1878
|
})));
|
|
1879
1879
|
|
|
1880
1880
|
function InputAdorner(props) {
|
|
@@ -1939,10 +1939,6 @@ function Datepicker(props) {
|
|
|
1939
1939
|
|
|
1940
1940
|
// setup flatpickr instance
|
|
1941
1941
|
hooks.useEffect(() => {
|
|
1942
|
-
if (disabled) {
|
|
1943
|
-
setFlatpickrInstance(null);
|
|
1944
|
-
return;
|
|
1945
|
-
}
|
|
1946
1942
|
let config = {
|
|
1947
1943
|
allowInput: true,
|
|
1948
1944
|
dateFormat: 'm/d/Y',
|
|
@@ -1975,7 +1971,7 @@ function Datepicker(props) {
|
|
|
1975
1971
|
// flatpicker logic that was lost when setting allowInput to true
|
|
1976
1972
|
instance.config.onOpen = [() => instance.calendarContainer.addEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.addEventListener('mousedown', onCalendarMouseDown)];
|
|
1977
1973
|
instance.config.onClose = [() => instance.calendarContainer.removeEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.removeEventListener('mousedown', onCalendarMouseDown)];
|
|
1978
|
-
}, [
|
|
1974
|
+
}, [disallowPassedDates]);
|
|
1979
1975
|
|
|
1980
1976
|
// onChange is updated dynamically, so not to re-render the flatpicker every time it changes
|
|
1981
1977
|
hooks.useEffect(() => {
|
|
@@ -2064,12 +2060,12 @@ var ClockIcon = (({
|
|
|
2064
2060
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2065
2061
|
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
2066
2062
|
d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z",
|
|
2067
|
-
fill: "
|
|
2063
|
+
fill: "currentColor"
|
|
2068
2064
|
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
2069
2065
|
fillRule: "evenodd",
|
|
2070
2066
|
clipRule: "evenodd",
|
|
2071
2067
|
d: "M6.222 25.64A14 14 0 1021.778 2.36 14 14 0 006.222 25.64zM7.333 4.023a12 12 0 1113.334 19.955A12 12 0 017.333 4.022z",
|
|
2072
|
-
fill: "
|
|
2068
|
+
fill: "currentColor"
|
|
2073
2069
|
})));
|
|
2074
2070
|
|
|
2075
2071
|
function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
@@ -2161,6 +2157,7 @@ function DropdownList(props) {
|
|
|
2161
2157
|
ref: dropdownContainer,
|
|
2162
2158
|
tabIndex: -1,
|
|
2163
2159
|
class: "fjs-dropdownlist",
|
|
2160
|
+
onMouseDown: e => e.preventDefault(),
|
|
2164
2161
|
style: {
|
|
2165
2162
|
maxHeight: height,
|
|
2166
2163
|
scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
|
|
@@ -2172,10 +2169,7 @@ function DropdownList(props) {
|
|
|
2172
2169
|
}),
|
|
2173
2170
|
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
|
|
2174
2171
|
onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
|
|
2175
|
-
onMouseDown: e =>
|
|
2176
|
-
e.preventDefault();
|
|
2177
|
-
onValueSelected(v);
|
|
2178
|
-
},
|
|
2172
|
+
onMouseDown: e => onValueSelected(v),
|
|
2179
2173
|
children: getLabel(v)
|
|
2180
2174
|
});
|
|
2181
2175
|
}), !values.length && jsxRuntime.jsx("div", {
|
|
@@ -2375,31 +2369,29 @@ function Datetime(props) {
|
|
|
2375
2369
|
date,
|
|
2376
2370
|
time
|
|
2377
2371
|
} = getNullDateTime();
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2372
|
+
switch (subtype) {
|
|
2373
|
+
case DATETIME_SUBTYPES.DATE:
|
|
2374
|
+
{
|
|
2375
|
+
date = new Date(Date.parse(value));
|
|
2376
|
+
break;
|
|
2377
|
+
}
|
|
2378
|
+
case DATETIME_SUBTYPES.TIME:
|
|
2379
|
+
{
|
|
2380
|
+
time = parseIsoTime(value);
|
|
2381
|
+
break;
|
|
2382
|
+
}
|
|
2383
|
+
case DATETIME_SUBTYPES.DATETIME:
|
|
2384
|
+
{
|
|
2385
|
+
date = new Date(Date.parse(value));
|
|
2386
|
+
time = isValidDate(date) ? 60 * date.getHours() + date.getMinutes() : null;
|
|
2387
|
+
break;
|
|
2388
|
+
}
|
|
2397
2389
|
}
|
|
2398
2390
|
setDateTime({
|
|
2399
2391
|
date,
|
|
2400
2392
|
time
|
|
2401
2393
|
});
|
|
2402
|
-
}, [subtype, value
|
|
2394
|
+
}, [subtype, value]);
|
|
2403
2395
|
const computeAndSetState = hooks.useCallback(({
|
|
2404
2396
|
date,
|
|
2405
2397
|
time
|
|
@@ -2789,6 +2781,7 @@ function Numberfield(props) {
|
|
|
2789
2781
|
}), [stringValueCache, value, field]);
|
|
2790
2782
|
const displayValue = hooks.useMemo(() => {
|
|
2791
2783
|
if (value === 'NaN') return 'NaN';
|
|
2784
|
+
if (stringValueCache === '-') return '-';
|
|
2792
2785
|
return cacheValueMatchesState ? stringValueCache : value || value === 0 ? Big__default['default'](value).toFixed() : '';
|
|
2793
2786
|
}, [stringValueCache, value, cacheValueMatchesState]);
|
|
2794
2787
|
const arrowIncrementValue = hooks.useMemo(() => {
|
|
@@ -2808,6 +2801,10 @@ function Numberfield(props) {
|
|
|
2808
2801
|
|
|
2809
2802
|
// treat commas as dots
|
|
2810
2803
|
stringValue = stringValue.replaceAll(',', '.');
|
|
2804
|
+
if (stringValue === '-') {
|
|
2805
|
+
setStringValueCache('-');
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2811
2808
|
if (isNaN(Number(stringValue))) {
|
|
2812
2809
|
setStringValueCache('NaN');
|
|
2813
2810
|
onChange({
|
|
@@ -2912,6 +2909,7 @@ function Numberfield(props) {
|
|
|
2912
2909
|
}),
|
|
2913
2910
|
children: [jsxRuntime.jsx("button", {
|
|
2914
2911
|
class: "fjs-number-arrow-up",
|
|
2912
|
+
type: "button",
|
|
2915
2913
|
onClick: () => increment(),
|
|
2916
2914
|
tabIndex: -1,
|
|
2917
2915
|
children: "\u02C4"
|
|
@@ -2919,6 +2917,7 @@ function Numberfield(props) {
|
|
|
2919
2917
|
class: "fjs-number-arrow-separator"
|
|
2920
2918
|
}), jsxRuntime.jsx("button", {
|
|
2921
2919
|
class: "fjs-number-arrow-down",
|
|
2920
|
+
type: "button",
|
|
2922
2921
|
onClick: () => decrement(),
|
|
2923
2922
|
tabIndex: -1,
|
|
2924
2923
|
children: "\u02C5"
|
|
@@ -3336,18 +3335,18 @@ var ChecklistIcon = (({
|
|
|
3336
3335
|
styles = {},
|
|
3337
3336
|
...props
|
|
3338
3337
|
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
|
|
3338
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3339
3339
|
width: "54",
|
|
3340
3340
|
height: "54",
|
|
3341
|
-
fill: "none"
|
|
3342
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
3341
|
+
fill: "none"
|
|
3343
3342
|
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3344
3343
|
fillRule: "evenodd",
|
|
3345
3344
|
clipRule: "evenodd",
|
|
3346
|
-
d: "
|
|
3347
|
-
fill: "#
|
|
3345
|
+
d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 36h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z",
|
|
3346
|
+
fill: "#161616"
|
|
3348
3347
|
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3349
|
-
d: "
|
|
3350
|
-
fill: "#
|
|
3348
|
+
d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 26.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 38.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z",
|
|
3349
|
+
fill: "#161616"
|
|
3351
3350
|
})));
|
|
3352
3351
|
|
|
3353
3352
|
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); }
|