@bpmn-io/form-js-playground 0.10.0-alpha.2 → 0.10.0-alpha.3
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.
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* file-drop.css
|
|
3
|
+
*/
|
|
4
|
+
.drop-overlay {
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
right: 0;
|
|
10
|
+
|
|
11
|
+
padding: 50px;
|
|
12
|
+
|
|
13
|
+
background: rgba(255, 255, 255, .9);
|
|
14
|
+
|
|
15
|
+
z-index: 1000;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.drop-overlay .box {
|
|
19
|
+
text-align: center;
|
|
20
|
+
border: dashed 4px #CCC;
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: 100%;
|
|
23
|
+
display: table;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.drop-overlay .label {
|
|
27
|
+
font-size: 26px;
|
|
28
|
+
color: #888;
|
|
29
|
+
margin: auto;
|
|
30
|
+
|
|
31
|
+
display: table-cell;
|
|
32
|
+
vertical-align: middle;
|
|
33
|
+
}.fjs-pgl-root {
|
|
2
34
|
--color-button-hover: var(--color-grey-225-10-95);
|
|
3
35
|
|
|
4
36
|
--color-section-border: var(--color-grey-225-10-55);
|
|
@@ -232,36 +264,3 @@
|
|
|
232
264
|
width: 100%;
|
|
233
265
|
height: 100%;
|
|
234
266
|
}
|
|
235
|
-
/**
|
|
236
|
-
* file-drop.css
|
|
237
|
-
*/
|
|
238
|
-
.drop-overlay {
|
|
239
|
-
position: fixed;
|
|
240
|
-
top: 0;
|
|
241
|
-
left: 0;
|
|
242
|
-
bottom: 0;
|
|
243
|
-
right: 0;
|
|
244
|
-
|
|
245
|
-
padding: 50px;
|
|
246
|
-
|
|
247
|
-
background: rgba(255, 255, 255, .9);
|
|
248
|
-
|
|
249
|
-
z-index: 1000;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.drop-overlay .box {
|
|
253
|
-
text-align: center;
|
|
254
|
-
border: dashed 4px #CCC;
|
|
255
|
-
height: 100%;
|
|
256
|
-
width: 100%;
|
|
257
|
-
display: table;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.drop-overlay .label {
|
|
261
|
-
font-size: 26px;
|
|
262
|
-
color: #888;
|
|
263
|
-
margin: auto;
|
|
264
|
-
|
|
265
|
-
display: table-cell;
|
|
266
|
-
vertical-align: middle;
|
|
267
|
-
}
|
|
@@ -16669,16 +16669,16 @@
|
|
|
16669
16669
|
function isValidNumber$1(value) {
|
|
16670
16670
|
return (typeof value === 'number' || typeof value === 'string') && value !== '' && !isNaN(Number(value));
|
|
16671
16671
|
}
|
|
16672
|
-
function willKeyProduceValidNumber(key, previousValue,
|
|
16672
|
+
function willKeyProduceValidNumber(key, previousValue, caretIndex, selectionWidth, decimalDigits) {
|
|
16673
16673
|
// Dot and comma are both treated as dot
|
|
16674
16674
|
previousValue = previousValue.replace(',', '.');
|
|
16675
16675
|
const isFirstDot = !previousValue.includes('.') && (key === '.' || key === ',');
|
|
16676
|
-
const isFirstMinus = !previousValue.includes('-') && key === '-' &&
|
|
16676
|
+
const isFirstMinus = !previousValue.includes('-') && key === '-' && caretIndex === 0;
|
|
16677
16677
|
const keypressIsNumeric = /^[0-9]$/i.test(key);
|
|
16678
|
-
const dotIndex = previousValue
|
|
16678
|
+
const dotIndex = previousValue === undefined ? -1 : previousValue.indexOf('.');
|
|
16679
16679
|
|
|
16680
|
-
// If the
|
|
16681
|
-
const overflowsDecimalSpace = typeof decimalDigits === 'number' && selectionWidth === 0 && dotIndex !== -1 && previousValue.includes('.') && previousValue.split('.')[1].length >= decimalDigits &&
|
|
16680
|
+
// If the caret is positioned after a dot, and the current decimal digits count is equal or greater to the maximum, disallow the key press
|
|
16681
|
+
const overflowsDecimalSpace = typeof decimalDigits === 'number' && selectionWidth === 0 && dotIndex !== -1 && previousValue.includes('.') && previousValue.split('.')[1].length >= decimalDigits && caretIndex > dotIndex;
|
|
16682
16682
|
const keypressIsAllowedChar = keypressIsNumeric || decimalDigits !== 0 && isFirstDot || isFirstMinus;
|
|
16683
16683
|
return keypressIsAllowedChar && !overflowsDecimalSpace;
|
|
16684
16684
|
}
|
|
@@ -18001,10 +18001,10 @@
|
|
|
18001
18001
|
|
|
18002
18002
|
// intercept key presses which would lead to an invalid number
|
|
18003
18003
|
const onKeyPress = e => {
|
|
18004
|
-
const
|
|
18004
|
+
const caretIndex = inputRef.current.selectionStart;
|
|
18005
18005
|
const selectionWidth = inputRef.current.selectionStart - inputRef.current.selectionEnd;
|
|
18006
18006
|
const previousValue = inputRef.current.value;
|
|
18007
|
-
if (!willKeyProduceValidNumber(e.key, previousValue,
|
|
18007
|
+
if (!willKeyProduceValidNumber(e.key, previousValue, caretIndex, selectionWidth, decimalDigits)) {
|
|
18008
18008
|
e.preventDefault();
|
|
18009
18009
|
}
|
|
18010
18010
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-io/form-js-playground",
|
|
3
|
-
"version": "0.10.0-alpha.
|
|
3
|
+
"version": "0.10.0-alpha.3",
|
|
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": "^0.10.0-alpha.
|
|
48
|
-
"@bpmn-io/form-js-viewer": "^0.10.0-alpha.
|
|
47
|
+
"@bpmn-io/form-js-editor": "^0.10.0-alpha.3",
|
|
48
|
+
"@bpmn-io/form-js-viewer": "^0.10.0-alpha.3",
|
|
49
49
|
"@codemirror/lang-json": "^6.0.0",
|
|
50
50
|
"@codemirror/lint": "^6.0.0",
|
|
51
51
|
"@codemirror/state": "^6.1.1",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"rollup-plugin-css-only": "^3.1.0",
|
|
68
68
|
"style-loader": "^3.3.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "9ad2c7ba06cc208ba956e6db4bdfb71b510d38c7"
|
|
71
71
|
}
|