@bpmn-io/properties-panel 3.41.1 → 3.41.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.
- package/dist/assets/properties-panel.css +21 -36
- package/dist/index.esm.js +45 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -569,42 +569,6 @@ textarea.bio-properties-panel-input {
|
|
|
569
569
|
resize: vertical;
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
-
/**
|
|
573
|
-
* JSON Editor (CodeMirror)
|
|
574
|
-
*/
|
|
575
|
-
|
|
576
|
-
.bio-properties-panel-json-editor .cm-editor {
|
|
577
|
-
border: 1px solid var(--input-border-color);
|
|
578
|
-
border-radius: 2px;
|
|
579
|
-
background-color: var(--input-background-color);
|
|
580
|
-
font-size: var(--text-size-base);
|
|
581
|
-
font-family: var(--font-family-monospace);
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
.bio-properties-panel-json-editor .cm-editor.cm-focused {
|
|
585
|
-
outline: none;
|
|
586
|
-
background-color: var(--input-focus-background-color);
|
|
587
|
-
border-color: var(--input-focus-border-color);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
.bio-properties-panel-json-editor .cm-scroller {
|
|
591
|
-
overflow: auto;
|
|
592
|
-
max-height: 215px;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
.bio-properties-panel-json-editor .cm-content {
|
|
596
|
-
padding-right: 18px;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
.bio-properties-panel-entry.has-error .bio-properties-panel-json-editor .cm-editor {
|
|
600
|
-
border-color: var(--input-error-border-color);
|
|
601
|
-
background-color: var(--input-error-background-color);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
.bio-properties-panel-entry.has-error .bio-properties-panel-json-editor .cm-editor.cm-focused {
|
|
605
|
-
border-color: var(--input-error-focus-border-color);
|
|
606
|
-
}
|
|
607
|
-
|
|
608
572
|
.bio-properties-panel-entry.has-error .bio-properties-panel-input,
|
|
609
573
|
.bio-properties-panel-entry.has-error .bio-properties-panel-feel-editor__open-popup-placeholder {
|
|
610
574
|
border-color: var(--input-error-border-color);
|
|
@@ -635,6 +599,27 @@ textarea.bio-properties-panel-input {
|
|
|
635
599
|
margin: auto;
|
|
636
600
|
}
|
|
637
601
|
|
|
602
|
+
/**
|
|
603
|
+
* JSON Editor (CodeMirror)
|
|
604
|
+
*/
|
|
605
|
+
|
|
606
|
+
.bio-properties-panel-json-editor .bio-properties-panel-input {
|
|
607
|
+
padding: 0;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.bio-properties-panel-json-editor .cm-editor {
|
|
611
|
+
font-family: var(--font-family-monospace);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.bio-properties-panel-json-editor .cm-editor.cm-focused {
|
|
615
|
+
outline: none;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.bio-properties-panel-json-editor .cm-scroller {
|
|
619
|
+
overflow: auto;
|
|
620
|
+
max-height: 215px;
|
|
621
|
+
}
|
|
622
|
+
|
|
638
623
|
/**
|
|
639
624
|
* Toggle Switch
|
|
640
625
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -1923,6 +1923,7 @@ function JsonEditor(props) {
|
|
|
1923
1923
|
children: label
|
|
1924
1924
|
})
|
|
1925
1925
|
}), jsx("div", {
|
|
1926
|
+
class: classnames('bio-properties-panel-input', value && 'edited'),
|
|
1926
1927
|
ref: containerRef
|
|
1927
1928
|
})]
|
|
1928
1929
|
});
|
|
@@ -1942,6 +1943,7 @@ function JsonEditor(props) {
|
|
|
1942
1943
|
* @param {boolean} [props.disabled]
|
|
1943
1944
|
* @param {string} [props.placeholder]
|
|
1944
1945
|
* @param {string} [props.tooltip]
|
|
1946
|
+
* @param {Function} [props.validate]
|
|
1945
1947
|
*/
|
|
1946
1948
|
function JsonEditorEntry(props) {
|
|
1947
1949
|
const {
|
|
@@ -1954,25 +1956,30 @@ function JsonEditorEntry(props) {
|
|
|
1954
1956
|
setValue,
|
|
1955
1957
|
disabled,
|
|
1956
1958
|
placeholder,
|
|
1957
|
-
tooltip
|
|
1959
|
+
tooltip,
|
|
1960
|
+
validate
|
|
1958
1961
|
} = props;
|
|
1959
1962
|
const globalError = useError(id);
|
|
1960
1963
|
let value = getValue(element);
|
|
1964
|
+
const [localError, setLocalError] = useState(() => computeError(validate, value));
|
|
1961
1965
|
const [editorValue, setEditorValue] = useState(value);
|
|
1962
1966
|
useEffect(() => {
|
|
1963
1967
|
if (value === editorValue) {
|
|
1964
1968
|
return;
|
|
1965
1969
|
}
|
|
1966
1970
|
setEditorValue(value);
|
|
1967
|
-
|
|
1971
|
+
setLocalError(computeError(validate, value));
|
|
1972
|
+
}, [value, validate]);
|
|
1968
1973
|
const onInput = useStaticCallback(newValue => {
|
|
1969
1974
|
setEditorValue(newValue);
|
|
1970
1975
|
const currentValue = getValue(element);
|
|
1971
1976
|
if (newValue !== currentValue) {
|
|
1972
|
-
|
|
1977
|
+
const newValidationError = computeError(validate, newValue);
|
|
1978
|
+
setValue(newValue, newValidationError);
|
|
1979
|
+
setLocalError(newValidationError);
|
|
1973
1980
|
}
|
|
1974
1981
|
});
|
|
1975
|
-
const error = globalError ||
|
|
1982
|
+
const error = globalError || localError;
|
|
1976
1983
|
return jsxs("div", {
|
|
1977
1984
|
class: classnames('bio-properties-panel-entry', error && 'has-error'),
|
|
1978
1985
|
"data-entry-id": id,
|
|
@@ -2001,12 +2008,14 @@ function JsonEditorEntry(props) {
|
|
|
2001
2008
|
* Check if the JSON editor entry has been edited.
|
|
2002
2009
|
*/
|
|
2003
2010
|
function isEdited$8(node) {
|
|
2004
|
-
|
|
2005
|
-
return cmContent ? cmContent.textContent.trim().length > 0 : false;
|
|
2011
|
+
return node && node.classList.contains('edited');
|
|
2006
2012
|
}
|
|
2007
2013
|
|
|
2008
2014
|
// helpers /////////////////
|
|
2009
2015
|
|
|
2016
|
+
function computeError(validate, value) {
|
|
2017
|
+
return (isFunction(validate) ? validate(value) : null) || validateJson(value);
|
|
2018
|
+
}
|
|
2010
2019
|
function validateJson(value) {
|
|
2011
2020
|
if (!value || !value.trim()) return null;
|
|
2012
2021
|
try {
|
|
@@ -2583,12 +2592,14 @@ function NumberFieldEntry(props) {
|
|
|
2583
2592
|
}
|
|
2584
2593
|
}, [value, validate]);
|
|
2585
2594
|
const onInput = newValue => {
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2595
|
+
if (newValue !== value) {
|
|
2596
|
+
let newValidationError = null;
|
|
2597
|
+
if (isFunction(validate)) {
|
|
2598
|
+
newValidationError = validate(newValue) || null;
|
|
2599
|
+
}
|
|
2600
|
+
setValue(newValue, newValidationError);
|
|
2601
|
+
setLocalError(newValidationError);
|
|
2589
2602
|
}
|
|
2590
|
-
setValue(newValue, newValidationError);
|
|
2591
|
-
setLocalError(newValidationError);
|
|
2592
2603
|
};
|
|
2593
2604
|
const error = globalError || localError;
|
|
2594
2605
|
return jsxs("div", {
|
|
@@ -3183,16 +3194,16 @@ function FeelEntry(props) {
|
|
|
3183
3194
|
}, [value, validate]);
|
|
3184
3195
|
const onInput = useStaticCallback(newValue => {
|
|
3185
3196
|
const value = getValue(element);
|
|
3186
|
-
let newValidationError = null;
|
|
3187
|
-
if (isFunction(validate)) {
|
|
3188
|
-
newValidationError = validate(newValue) || null;
|
|
3189
|
-
}
|
|
3190
3197
|
|
|
3191
|
-
// don't create multiple commandStack entries for the same value
|
|
3198
|
+
// don't create multiple commandStack entries and do validation for the same value
|
|
3192
3199
|
if (newValue !== value) {
|
|
3200
|
+
let newValidationError = null;
|
|
3201
|
+
if (isFunction(validate)) {
|
|
3202
|
+
newValidationError = validate(newValue) || null;
|
|
3203
|
+
}
|
|
3193
3204
|
setValue(newValue, newValidationError);
|
|
3205
|
+
setValidationError(newValidationError);
|
|
3194
3206
|
}
|
|
3195
|
-
setValidationError(newValidationError);
|
|
3196
3207
|
});
|
|
3197
3208
|
const onError = useCallback(err => {
|
|
3198
3209
|
setLocalError(err);
|
|
@@ -3915,12 +3926,14 @@ function SelectEntry(props) {
|
|
|
3915
3926
|
}
|
|
3916
3927
|
}, [value, validate]);
|
|
3917
3928
|
const onChange = newValue => {
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3929
|
+
if (newValue !== value) {
|
|
3930
|
+
let newValidationError = null;
|
|
3931
|
+
if (isFunction(validate)) {
|
|
3932
|
+
newValidationError = validate(newValue) || null;
|
|
3933
|
+
}
|
|
3934
|
+
setValue(newValue, newValidationError);
|
|
3935
|
+
setLocalError(newValidationError);
|
|
3921
3936
|
}
|
|
3922
|
-
setValue(newValue, newValidationError);
|
|
3923
|
-
setLocalError(newValidationError);
|
|
3924
3937
|
};
|
|
3925
3938
|
const error = globalError || localError;
|
|
3926
3939
|
return jsxs("div", {
|
|
@@ -4195,14 +4208,14 @@ function TextAreaEntry(props) {
|
|
|
4195
4208
|
}, [value, validate]);
|
|
4196
4209
|
const onInput = useStaticCallback(newValue => {
|
|
4197
4210
|
const value = getValue(element);
|
|
4198
|
-
let newValidationError = null;
|
|
4199
|
-
if (isFunction(validate)) {
|
|
4200
|
-
newValidationError = validate(newValue) || null;
|
|
4201
|
-
}
|
|
4202
4211
|
if (newValue !== value) {
|
|
4212
|
+
let newValidationError = null;
|
|
4213
|
+
if (isFunction(validate)) {
|
|
4214
|
+
newValidationError = validate(newValue) || null;
|
|
4215
|
+
}
|
|
4203
4216
|
setValue(newValue, newValidationError);
|
|
4217
|
+
setLocalError(newValidationError);
|
|
4204
4218
|
}
|
|
4205
|
-
setLocalError(newValidationError);
|
|
4206
4219
|
});
|
|
4207
4220
|
const error = globalError || localError;
|
|
4208
4221
|
return jsxs("div", {
|
|
@@ -4394,14 +4407,14 @@ function TextfieldEntry(props) {
|
|
|
4394
4407
|
}, [value, validate]);
|
|
4395
4408
|
const onInput = useStaticCallback(newValue => {
|
|
4396
4409
|
const value = getValue(element);
|
|
4397
|
-
let newValidationError = null;
|
|
4398
|
-
if (isFunction(validate)) {
|
|
4399
|
-
newValidationError = validate(newValue) || null;
|
|
4400
|
-
}
|
|
4401
4410
|
if (newValue !== value) {
|
|
4411
|
+
let newValidationError = null;
|
|
4412
|
+
if (isFunction(validate)) {
|
|
4413
|
+
newValidationError = validate(newValue) || null;
|
|
4414
|
+
}
|
|
4402
4415
|
setValue(newValue, newValidationError);
|
|
4416
|
+
setLocalError(newValidationError);
|
|
4403
4417
|
}
|
|
4404
|
-
setLocalError(newValidationError);
|
|
4405
4418
|
});
|
|
4406
4419
|
const error = globalError || localError;
|
|
4407
4420
|
return jsxs("div", {
|