@bpmn-io/form-js-viewer 1.0.0-alpha.5 → 1.0.0-alpha.7
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/flatpickr/light.css +809 -0
- package/dist/index.cjs +24 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +24 -17
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -2517,8 +2517,8 @@ var CalendarIcon = (({
|
|
|
2517
2517
|
|
|
2518
2518
|
function InputAdorner(props) {
|
|
2519
2519
|
const {
|
|
2520
|
-
pre
|
|
2521
|
-
post
|
|
2520
|
+
pre,
|
|
2521
|
+
post,
|
|
2522
2522
|
rootRef,
|
|
2523
2523
|
inputRef,
|
|
2524
2524
|
children,
|
|
@@ -2535,14 +2535,14 @@ function InputAdorner(props) {
|
|
|
2535
2535
|
'hasErrors': hasErrors
|
|
2536
2536
|
}),
|
|
2537
2537
|
ref: rootRef,
|
|
2538
|
-
children: [pre
|
|
2538
|
+
children: [pre && jsxRuntime.jsxs("span", {
|
|
2539
2539
|
class: "fjs-input-adornment border-right border-radius-left",
|
|
2540
2540
|
onClick: onAdornmentClick,
|
|
2541
2541
|
children: [" ", minDash.isString(pre) ? jsxRuntime.jsx("span", {
|
|
2542
2542
|
class: "fjs-input-adornment-text",
|
|
2543
2543
|
children: pre
|
|
2544
2544
|
}) : pre, " "]
|
|
2545
|
-
}), children, post
|
|
2545
|
+
}), children, post && jsxRuntime.jsxs("span", {
|
|
2546
2546
|
class: "fjs-input-adornment border-left border-radius-right",
|
|
2547
2547
|
onClick: onAdornmentClick,
|
|
2548
2548
|
children: [" ", minDash.isString(post) ? jsxRuntime.jsx("span", {
|
|
@@ -2823,9 +2823,16 @@ function Timepicker(props) {
|
|
|
2823
2823
|
time,
|
|
2824
2824
|
setTime
|
|
2825
2825
|
} = props;
|
|
2826
|
+
const safeTimeInterval = hooks.useMemo(() => {
|
|
2827
|
+
const allowedIntervals = [1, 5, 10, 15, 30, 60];
|
|
2828
|
+
if (allowedIntervals.includes(timeInterval)) {
|
|
2829
|
+
return timeInterval;
|
|
2830
|
+
}
|
|
2831
|
+
return 15;
|
|
2832
|
+
}, [timeInterval]);
|
|
2826
2833
|
const timeInputRef = hooks.useRef();
|
|
2827
2834
|
const [dropdownIsOpen, setDropdownIsOpen] = hooks.useState(false);
|
|
2828
|
-
const useDropdown = hooks.useMemo(() =>
|
|
2835
|
+
const useDropdown = hooks.useMemo(() => safeTimeInterval !== 1, [safeTimeInterval]);
|
|
2829
2836
|
const [rawValue, setRawValue] = hooks.useState('');
|
|
2830
2837
|
|
|
2831
2838
|
// populates values from source
|
|
@@ -2834,12 +2841,12 @@ function Timepicker(props) {
|
|
|
2834
2841
|
setRawValue('');
|
|
2835
2842
|
return;
|
|
2836
2843
|
}
|
|
2837
|
-
const intervalAdjustedTime = time - time %
|
|
2844
|
+
const intervalAdjustedTime = time - time % safeTimeInterval;
|
|
2838
2845
|
setRawValue(formatTime(use24h, intervalAdjustedTime));
|
|
2839
2846
|
if (intervalAdjustedTime != time) {
|
|
2840
2847
|
setTime(intervalAdjustedTime);
|
|
2841
2848
|
}
|
|
2842
|
-
}, [time, setTime, use24h,
|
|
2849
|
+
}, [time, setTime, use24h, safeTimeInterval]);
|
|
2843
2850
|
const propagateRawToMinute = hooks.useCallback(newRawValue => {
|
|
2844
2851
|
const localRawValue = newRawValue || rawValue;
|
|
2845
2852
|
|
|
@@ -2858,34 +2865,34 @@ function Timepicker(props) {
|
|
|
2858
2865
|
}
|
|
2859
2866
|
|
|
2860
2867
|
// Enforce the minutes to match the timeInterval
|
|
2861
|
-
const correctedMinutes = minutes - minutes %
|
|
2868
|
+
const correctedMinutes = minutes - minutes % safeTimeInterval;
|
|
2862
2869
|
|
|
2863
2870
|
// Enforce the raw text to be formatted properly
|
|
2864
2871
|
setRawValue(formatTime(use24h, correctedMinutes));
|
|
2865
2872
|
setTime(correctedMinutes);
|
|
2866
|
-
}, [rawValue,
|
|
2873
|
+
}, [rawValue, safeTimeInterval, use24h, setTime]);
|
|
2867
2874
|
const timeOptions = hooks.useMemo(() => {
|
|
2868
2875
|
const minutesInDay = 24 * 60;
|
|
2869
|
-
const intervalCount = Math.floor(minutesInDay /
|
|
2870
|
-
return [...Array(intervalCount).keys()].map(intervalIndex => formatTime(use24h, intervalIndex *
|
|
2871
|
-
}, [
|
|
2876
|
+
const intervalCount = Math.floor(minutesInDay / safeTimeInterval);
|
|
2877
|
+
return [...Array(intervalCount).keys()].map(intervalIndex => formatTime(use24h, intervalIndex * safeTimeInterval));
|
|
2878
|
+
}, [safeTimeInterval, use24h]);
|
|
2872
2879
|
const initialFocusIndex = hooks.useMemo(() => {
|
|
2873
2880
|
// if there are no options, there will not be any focusing
|
|
2874
|
-
if (!timeOptions || !
|
|
2881
|
+
if (!timeOptions || !safeTimeInterval) return null;
|
|
2875
2882
|
|
|
2876
2883
|
// if there is a set minute value, we focus it in the dropdown
|
|
2877
|
-
if (time) return time /
|
|
2884
|
+
if (time) return time / safeTimeInterval;
|
|
2878
2885
|
const cacheTime = parseInputTime(rawValue);
|
|
2879
2886
|
|
|
2880
2887
|
// if there is a valid value in the input cache, we try and focus close to it
|
|
2881
2888
|
if (cacheTime) {
|
|
2882
|
-
const flooredCacheTime = cacheTime - cacheTime %
|
|
2883
|
-
return flooredCacheTime /
|
|
2889
|
+
const flooredCacheTime = cacheTime - cacheTime % safeTimeInterval;
|
|
2890
|
+
return flooredCacheTime / safeTimeInterval;
|
|
2884
2891
|
}
|
|
2885
2892
|
|
|
2886
2893
|
// If there is no set value, simply focus the middle of the dropdown (12:00)
|
|
2887
2894
|
return Math.floor(timeOptions.length / 2);
|
|
2888
|
-
}, [rawValue, time,
|
|
2895
|
+
}, [rawValue, time, safeTimeInterval, timeOptions]);
|
|
2889
2896
|
const onInputKeyDown = e => {
|
|
2890
2897
|
switch (e.key) {
|
|
2891
2898
|
case 'ArrowUp':
|