@bpmn-io/form-js-playground 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/form-playground.umd.js +24 -17
- package/package.json +4 -4
|
@@ -51722,8 +51722,8 @@
|
|
|
51722
51722
|
}));
|
|
51723
51723
|
function InputAdorner(props) {
|
|
51724
51724
|
const {
|
|
51725
|
-
pre
|
|
51726
|
-
post
|
|
51725
|
+
pre,
|
|
51726
|
+
post,
|
|
51727
51727
|
rootRef,
|
|
51728
51728
|
inputRef,
|
|
51729
51729
|
children,
|
|
@@ -51740,14 +51740,14 @@
|
|
|
51740
51740
|
'hasErrors': hasErrors
|
|
51741
51741
|
}),
|
|
51742
51742
|
ref: rootRef,
|
|
51743
|
-
children: [pre
|
|
51743
|
+
children: [pre && e$1("span", {
|
|
51744
51744
|
class: "fjs-input-adornment border-right border-radius-left",
|
|
51745
51745
|
onClick: onAdornmentClick,
|
|
51746
51746
|
children: [" ", isString$4(pre) ? e$1("span", {
|
|
51747
51747
|
class: "fjs-input-adornment-text",
|
|
51748
51748
|
children: pre
|
|
51749
51749
|
}) : pre, " "]
|
|
51750
|
-
}), children, post
|
|
51750
|
+
}), children, post && e$1("span", {
|
|
51751
51751
|
class: "fjs-input-adornment border-left border-radius-right",
|
|
51752
51752
|
onClick: onAdornmentClick,
|
|
51753
51753
|
children: [" ", isString$4(post) ? e$1("span", {
|
|
@@ -52037,9 +52037,16 @@
|
|
|
52037
52037
|
time,
|
|
52038
52038
|
setTime
|
|
52039
52039
|
} = props;
|
|
52040
|
+
const safeTimeInterval = d(() => {
|
|
52041
|
+
const allowedIntervals = [1, 5, 10, 15, 30, 60];
|
|
52042
|
+
if (allowedIntervals.includes(timeInterval)) {
|
|
52043
|
+
return timeInterval;
|
|
52044
|
+
}
|
|
52045
|
+
return 15;
|
|
52046
|
+
}, [timeInterval]);
|
|
52040
52047
|
const timeInputRef = s$1();
|
|
52041
52048
|
const [dropdownIsOpen, setDropdownIsOpen] = l$2(false);
|
|
52042
|
-
const useDropdown = d(() =>
|
|
52049
|
+
const useDropdown = d(() => safeTimeInterval !== 1, [safeTimeInterval]);
|
|
52043
52050
|
const [rawValue, setRawValue] = l$2('');
|
|
52044
52051
|
|
|
52045
52052
|
// populates values from source
|
|
@@ -52048,12 +52055,12 @@
|
|
|
52048
52055
|
setRawValue('');
|
|
52049
52056
|
return;
|
|
52050
52057
|
}
|
|
52051
|
-
const intervalAdjustedTime = time - time %
|
|
52058
|
+
const intervalAdjustedTime = time - time % safeTimeInterval;
|
|
52052
52059
|
setRawValue(formatTime(use24h, intervalAdjustedTime));
|
|
52053
52060
|
if (intervalAdjustedTime != time) {
|
|
52054
52061
|
setTime(intervalAdjustedTime);
|
|
52055
52062
|
}
|
|
52056
|
-
}, [time, setTime, use24h,
|
|
52063
|
+
}, [time, setTime, use24h, safeTimeInterval]);
|
|
52057
52064
|
const propagateRawToMinute = A$1(newRawValue => {
|
|
52058
52065
|
const localRawValue = newRawValue || rawValue;
|
|
52059
52066
|
|
|
@@ -52072,34 +52079,34 @@
|
|
|
52072
52079
|
}
|
|
52073
52080
|
|
|
52074
52081
|
// Enforce the minutes to match the timeInterval
|
|
52075
|
-
const correctedMinutes = minutes - minutes %
|
|
52082
|
+
const correctedMinutes = minutes - minutes % safeTimeInterval;
|
|
52076
52083
|
|
|
52077
52084
|
// Enforce the raw text to be formatted properly
|
|
52078
52085
|
setRawValue(formatTime(use24h, correctedMinutes));
|
|
52079
52086
|
setTime(correctedMinutes);
|
|
52080
|
-
}, [rawValue,
|
|
52087
|
+
}, [rawValue, safeTimeInterval, use24h, setTime]);
|
|
52081
52088
|
const timeOptions = d(() => {
|
|
52082
52089
|
const minutesInDay = 24 * 60;
|
|
52083
|
-
const intervalCount = Math.floor(minutesInDay /
|
|
52084
|
-
return [...Array(intervalCount).keys()].map(intervalIndex => formatTime(use24h, intervalIndex *
|
|
52085
|
-
}, [
|
|
52090
|
+
const intervalCount = Math.floor(minutesInDay / safeTimeInterval);
|
|
52091
|
+
return [...Array(intervalCount).keys()].map(intervalIndex => formatTime(use24h, intervalIndex * safeTimeInterval));
|
|
52092
|
+
}, [safeTimeInterval, use24h]);
|
|
52086
52093
|
const initialFocusIndex = d(() => {
|
|
52087
52094
|
// if there are no options, there will not be any focusing
|
|
52088
|
-
if (!timeOptions || !
|
|
52095
|
+
if (!timeOptions || !safeTimeInterval) return null;
|
|
52089
52096
|
|
|
52090
52097
|
// if there is a set minute value, we focus it in the dropdown
|
|
52091
|
-
if (time) return time /
|
|
52098
|
+
if (time) return time / safeTimeInterval;
|
|
52092
52099
|
const cacheTime = parseInputTime(rawValue);
|
|
52093
52100
|
|
|
52094
52101
|
// if there is a valid value in the input cache, we try and focus close to it
|
|
52095
52102
|
if (cacheTime) {
|
|
52096
|
-
const flooredCacheTime = cacheTime - cacheTime %
|
|
52097
|
-
return flooredCacheTime /
|
|
52103
|
+
const flooredCacheTime = cacheTime - cacheTime % safeTimeInterval;
|
|
52104
|
+
return flooredCacheTime / safeTimeInterval;
|
|
52098
52105
|
}
|
|
52099
52106
|
|
|
52100
52107
|
// If there is no set value, simply focus the middle of the dropdown (12:00)
|
|
52101
52108
|
return Math.floor(timeOptions.length / 2);
|
|
52102
|
-
}, [rawValue, time,
|
|
52109
|
+
}, [rawValue, time, safeTimeInterval, timeOptions]);
|
|
52103
52110
|
const onInputKeyDown = e => {
|
|
52104
52111
|
switch (e.key) {
|
|
52105
52112
|
case 'ArrowUp':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-io/form-js-playground",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "A form-js playground",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"url": "https://github.com/bpmn-io"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@bpmn-io/form-js-editor": "^1.0.0-alpha.
|
|
48
|
-
"@bpmn-io/form-js-viewer": "^1.0.0-alpha.
|
|
47
|
+
"@bpmn-io/form-js-editor": "^1.0.0-alpha.7",
|
|
48
|
+
"@bpmn-io/form-js-viewer": "^1.0.0-alpha.7",
|
|
49
49
|
"@codemirror/autocomplete": "^6.3.4",
|
|
50
50
|
"@codemirror/commands": "^6.1.2",
|
|
51
51
|
"@codemirror/lang-json": "^6.0.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"rollup-plugin-css-only": "^4.0.0",
|
|
71
71
|
"style-loader": "^3.3.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "ced83b4bbba91cf0c2ca9e2f9950bb278f36ed3c"
|
|
74
74
|
}
|