@bpmn-io/form-js-playground 1.21.0 → 1.21.1
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 +125 -132
- package/package.json +4 -4
|
@@ -53580,6 +53580,110 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53580
53580
|
});
|
|
53581
53581
|
return result;
|
|
53582
53582
|
}
|
|
53583
|
+
|
|
53584
|
+
/**
|
|
53585
|
+
* Returns the options data for the provided if they can be simply determined, ignoring expression defined options.
|
|
53586
|
+
*
|
|
53587
|
+
* @param {object} formField
|
|
53588
|
+
* @param {object} formData
|
|
53589
|
+
*/
|
|
53590
|
+
function getSimpleOptionsData(formField, formData) {
|
|
53591
|
+
const {
|
|
53592
|
+
valuesExpression: optionsExpression,
|
|
53593
|
+
valuesKey: optionsKey,
|
|
53594
|
+
values: staticOptions
|
|
53595
|
+
} = formField;
|
|
53596
|
+
if (optionsExpression) {
|
|
53597
|
+
return null;
|
|
53598
|
+
}
|
|
53599
|
+
return optionsKey ? get$1(formData, [optionsKey]) : staticOptions;
|
|
53600
|
+
}
|
|
53601
|
+
|
|
53602
|
+
/**
|
|
53603
|
+
* Normalizes the provided options data to a format that can be used by the select components.
|
|
53604
|
+
* If the options data is not valid, it is filtered out.
|
|
53605
|
+
*
|
|
53606
|
+
* @param {any[]} optionsData
|
|
53607
|
+
*
|
|
53608
|
+
* @returns {object[]}
|
|
53609
|
+
*/
|
|
53610
|
+
function normalizeOptionsData(optionsData) {
|
|
53611
|
+
return optionsData.filter(_isAllowedValue).map(_normalizeOption).filter(o => !isNil$1(o));
|
|
53612
|
+
}
|
|
53613
|
+
|
|
53614
|
+
/**
|
|
53615
|
+
* Creates an options object with default values if no options are provided.
|
|
53616
|
+
*
|
|
53617
|
+
* @param {object} options
|
|
53618
|
+
*
|
|
53619
|
+
* @returns {object}
|
|
53620
|
+
*/
|
|
53621
|
+
function createEmptyOptions(options = {}) {
|
|
53622
|
+
const defaults = {};
|
|
53623
|
+
|
|
53624
|
+
// provide default options if valuesKey and valuesExpression are not set
|
|
53625
|
+
if (!options.valuesKey && !options.valuesExpression) {
|
|
53626
|
+
defaults.values = [{
|
|
53627
|
+
label: 'Value',
|
|
53628
|
+
value: 'value'
|
|
53629
|
+
}];
|
|
53630
|
+
}
|
|
53631
|
+
return {
|
|
53632
|
+
...defaults,
|
|
53633
|
+
...options
|
|
53634
|
+
};
|
|
53635
|
+
}
|
|
53636
|
+
|
|
53637
|
+
/**
|
|
53638
|
+
* Converts the provided option to a normalized format.
|
|
53639
|
+
* If the option is not valid, null is returned.
|
|
53640
|
+
*
|
|
53641
|
+
* @param {object} option
|
|
53642
|
+
* @param {string} option.label
|
|
53643
|
+
* @param {*} option.value
|
|
53644
|
+
*
|
|
53645
|
+
* @returns
|
|
53646
|
+
*/
|
|
53647
|
+
function _normalizeOption(option) {
|
|
53648
|
+
// (1) simple primitive case, use it as both label and value
|
|
53649
|
+
if (_isAllowedPrimitive(option)) {
|
|
53650
|
+
return {
|
|
53651
|
+
value: option,
|
|
53652
|
+
label: `${option}`
|
|
53653
|
+
};
|
|
53654
|
+
}
|
|
53655
|
+
if (isObject(option)) {
|
|
53656
|
+
const isValidLabel = _isValidLabel(option.label);
|
|
53657
|
+
|
|
53658
|
+
// (2) no label provided, but value is a simple primitive, use it as label and value
|
|
53659
|
+
if (!isValidLabel && _isAllowedPrimitive(option.value)) {
|
|
53660
|
+
return {
|
|
53661
|
+
value: option.value,
|
|
53662
|
+
label: `${option.value}`
|
|
53663
|
+
};
|
|
53664
|
+
}
|
|
53665
|
+
|
|
53666
|
+
// (3) both label and value are provided, use them as is
|
|
53667
|
+
if (isValidLabel && _isAllowedValue(option.value)) {
|
|
53668
|
+
return option;
|
|
53669
|
+
}
|
|
53670
|
+
}
|
|
53671
|
+
return null;
|
|
53672
|
+
}
|
|
53673
|
+
function _isAllowedPrimitive(value) {
|
|
53674
|
+
const isAllowedPrimitiveType = ['number', 'string', 'boolean'].includes(typeof value);
|
|
53675
|
+
const isValid = value || value === 0 || value === false;
|
|
53676
|
+
return isAllowedPrimitiveType && isValid;
|
|
53677
|
+
}
|
|
53678
|
+
function _isValidLabel(label) {
|
|
53679
|
+
return label && isString$2(label);
|
|
53680
|
+
}
|
|
53681
|
+
function _isAllowedValue(value) {
|
|
53682
|
+
if (isObject(value)) {
|
|
53683
|
+
return Object.keys(value).length > 0;
|
|
53684
|
+
}
|
|
53685
|
+
return _isAllowedPrimitive(value);
|
|
53686
|
+
}
|
|
53583
53687
|
const FormRenderContext = G$1({
|
|
53584
53688
|
Empty: props => {
|
|
53585
53689
|
return null;
|
|
@@ -53620,7 +53724,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53620
53724
|
},
|
|
53621
53725
|
hoverInfo: {
|
|
53622
53726
|
cleanup: () => {}
|
|
53623
|
-
}
|
|
53727
|
+
},
|
|
53728
|
+
applyVisibilityConditions: true
|
|
53624
53729
|
});
|
|
53625
53730
|
const LocalExpressionContext = G$1({
|
|
53626
53731
|
data: null,
|
|
@@ -53725,134 +53830,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53725
53830
|
return expressionLanguage.evaluateUnaryTest(value, buildExpressionContext(expressionContextInfo));
|
|
53726
53831
|
}
|
|
53727
53832
|
|
|
53728
|
-
/**
|
|
53729
|
-
* Evaluate a unary test expression reactively. Returns null for invalid/missing expressions.
|
|
53730
|
-
* The function is memoized to minimize re-renders.
|
|
53731
|
-
*
|
|
53732
|
-
* @param {string | undefined} value - A unary test expression to evaluate.
|
|
53733
|
-
* @returns {boolean | null} - Evaluated result, or null if expression is invalid/missing.
|
|
53734
|
-
*/
|
|
53735
|
-
function useUnaryTestEvaluation(value) {
|
|
53736
|
-
const expressionLanguage = useService$2('expressionLanguage');
|
|
53737
|
-
const expressionContextInfo = q$2(LocalExpressionContext);
|
|
53738
|
-
return F$2(() => runUnaryTestEvaluation(expressionLanguage, value, expressionContextInfo), [expressionLanguage, expressionContextInfo, value]);
|
|
53739
|
-
}
|
|
53740
|
-
|
|
53741
|
-
/**
|
|
53742
|
-
* Evaluate if condition is met reactively based on the expression language and form data.
|
|
53743
|
-
*
|
|
53744
|
-
* @param {string | undefined} condition
|
|
53745
|
-
*
|
|
53746
|
-
* @returns {boolean | null} true if condition is met, false if not, null if no condition or expression language
|
|
53747
|
-
*/
|
|
53748
|
-
function useCondition(condition) {
|
|
53749
|
-
return useUnaryTestEvaluation(condition);
|
|
53750
|
-
}
|
|
53751
|
-
|
|
53752
|
-
/**
|
|
53753
|
-
* Returns the options data for the provided if they can be simply determined, ignoring expression defined options.
|
|
53754
|
-
*
|
|
53755
|
-
* @param {object} formField
|
|
53756
|
-
* @param {object} formData
|
|
53757
|
-
*/
|
|
53758
|
-
function getSimpleOptionsData(formField, formData) {
|
|
53759
|
-
const {
|
|
53760
|
-
valuesExpression: optionsExpression,
|
|
53761
|
-
valuesKey: optionsKey,
|
|
53762
|
-
values: staticOptions
|
|
53763
|
-
} = formField;
|
|
53764
|
-
if (optionsExpression) {
|
|
53765
|
-
return null;
|
|
53766
|
-
}
|
|
53767
|
-
return optionsKey ? get$1(formData, [optionsKey]) : staticOptions;
|
|
53768
|
-
}
|
|
53769
|
-
|
|
53770
|
-
/**
|
|
53771
|
-
* Normalizes the provided options data to a format that can be used by the select components.
|
|
53772
|
-
* If the options data is not valid, it is filtered out.
|
|
53773
|
-
*
|
|
53774
|
-
* @param {any[]} optionsData
|
|
53775
|
-
*
|
|
53776
|
-
* @returns {object[]}
|
|
53777
|
-
*/
|
|
53778
|
-
function normalizeOptionsData(optionsData) {
|
|
53779
|
-
return optionsData.filter(_isAllowedValue).map(_normalizeOption).filter(o => !isNil$1(o));
|
|
53780
|
-
}
|
|
53781
|
-
|
|
53782
|
-
/**
|
|
53783
|
-
* Creates an options object with default values if no options are provided.
|
|
53784
|
-
*
|
|
53785
|
-
* @param {object} options
|
|
53786
|
-
*
|
|
53787
|
-
* @returns {object}
|
|
53788
|
-
*/
|
|
53789
|
-
function createEmptyOptions(options = {}) {
|
|
53790
|
-
const defaults = {};
|
|
53791
|
-
|
|
53792
|
-
// provide default options if valuesKey and valuesExpression are not set
|
|
53793
|
-
if (!options.valuesKey && !options.valuesExpression) {
|
|
53794
|
-
defaults.values = [{
|
|
53795
|
-
label: 'Value',
|
|
53796
|
-
value: 'value'
|
|
53797
|
-
}];
|
|
53798
|
-
}
|
|
53799
|
-
return {
|
|
53800
|
-
...defaults,
|
|
53801
|
-
...options
|
|
53802
|
-
};
|
|
53803
|
-
}
|
|
53804
|
-
|
|
53805
|
-
/**
|
|
53806
|
-
* Converts the provided option to a normalized format.
|
|
53807
|
-
* If the option is not valid, null is returned.
|
|
53808
|
-
*
|
|
53809
|
-
* @param {object} option
|
|
53810
|
-
* @param {string} option.label
|
|
53811
|
-
* @param {*} option.value
|
|
53812
|
-
*
|
|
53813
|
-
* @returns
|
|
53814
|
-
*/
|
|
53815
|
-
function _normalizeOption(option) {
|
|
53816
|
-
// (1) simple primitive case, use it as both label and value
|
|
53817
|
-
if (_isAllowedPrimitive(option)) {
|
|
53818
|
-
return {
|
|
53819
|
-
value: option,
|
|
53820
|
-
label: `${option}`
|
|
53821
|
-
};
|
|
53822
|
-
}
|
|
53823
|
-
if (isObject(option)) {
|
|
53824
|
-
const isValidLabel = _isValidLabel(option.label);
|
|
53825
|
-
|
|
53826
|
-
// (2) no label provided, but value is a simple primitive, use it as label and value
|
|
53827
|
-
if (!isValidLabel && _isAllowedPrimitive(option.value)) {
|
|
53828
|
-
return {
|
|
53829
|
-
value: option.value,
|
|
53830
|
-
label: `${option.value}`
|
|
53831
|
-
};
|
|
53832
|
-
}
|
|
53833
|
-
|
|
53834
|
-
// (3) both label and value are provided, use them as is
|
|
53835
|
-
if (isValidLabel && _isAllowedValue(option.value)) {
|
|
53836
|
-
return option;
|
|
53837
|
-
}
|
|
53838
|
-
}
|
|
53839
|
-
return null;
|
|
53840
|
-
}
|
|
53841
|
-
function _isAllowedPrimitive(value) {
|
|
53842
|
-
const isAllowedPrimitiveType = ['number', 'string', 'boolean'].includes(typeof value);
|
|
53843
|
-
const isValid = value || value === 0 || value === false;
|
|
53844
|
-
return isAllowedPrimitiveType && isValid;
|
|
53845
|
-
}
|
|
53846
|
-
function _isValidLabel(label) {
|
|
53847
|
-
return label && isString$2(label);
|
|
53848
|
-
}
|
|
53849
|
-
function _isAllowedValue(value) {
|
|
53850
|
-
if (isObject(value)) {
|
|
53851
|
-
return Object.keys(value).length > 0;
|
|
53852
|
-
}
|
|
53853
|
-
return _isAllowedPrimitive(value);
|
|
53854
|
-
}
|
|
53855
|
-
|
|
53856
53833
|
/**
|
|
53857
53834
|
* If the value is a valid expression, it is evaluated and returned. Otherwise, it is returned as-is.
|
|
53858
53835
|
* The function is memoized to minimize re-renders.
|
|
@@ -54183,6 +54160,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
54183
54160
|
}, [expressionLanguage, expressionContextInfo, value]);
|
|
54184
54161
|
}
|
|
54185
54162
|
|
|
54163
|
+
/**
|
|
54164
|
+
* Evaluate a unary test expression reactively. Returns null for invalid/missing expressions.
|
|
54165
|
+
* The function is memoized to minimize re-renders.
|
|
54166
|
+
*
|
|
54167
|
+
* @param {string | undefined} value - A unary test expression to evaluate.
|
|
54168
|
+
* @returns {boolean | null} - Evaluated result, or null if expression is invalid/missing.
|
|
54169
|
+
*/
|
|
54170
|
+
function useUnaryTestEvaluation(value) {
|
|
54171
|
+
const expressionLanguage = useService$2('expressionLanguage');
|
|
54172
|
+
const expressionContextInfo = q$2(LocalExpressionContext);
|
|
54173
|
+
return F$2(() => runUnaryTestEvaluation(expressionLanguage, value, expressionContextInfo), [expressionLanguage, expressionContextInfo, value]);
|
|
54174
|
+
}
|
|
54175
|
+
|
|
54186
54176
|
/**
|
|
54187
54177
|
* Returns the conditionally filtered data of a form reactively.
|
|
54188
54178
|
* Memoised to minimize re-renders
|
|
@@ -54981,7 +54971,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
54981
54971
|
const {
|
|
54982
54972
|
Element,
|
|
54983
54973
|
Hidden,
|
|
54984
|
-
Column
|
|
54974
|
+
Column,
|
|
54975
|
+
applyVisibilityConditions
|
|
54985
54976
|
} = q$2(FormRenderContext);
|
|
54986
54977
|
const {
|
|
54987
54978
|
formId
|
|
@@ -55005,7 +54996,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
55005
54996
|
|
|
55006
54997
|
// add precedence: global readonly > form field disabled
|
|
55007
54998
|
const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
|
|
55008
|
-
const
|
|
54999
|
+
const conditionResult = useUnaryTestEvaluation(field.conditional && field.conditional.hide || null);
|
|
55000
|
+
const hidden = applyVisibilityConditions ? conditionResult : null;
|
|
55009
55001
|
const instanceId = F$2(() => {
|
|
55010
55002
|
if (!formFieldInstanceRegistry) {
|
|
55011
55003
|
return null;
|
|
@@ -71032,7 +71024,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71032
71024
|
Element: Element$1,
|
|
71033
71025
|
Empty,
|
|
71034
71026
|
Row,
|
|
71035
|
-
hoverInfo: {}
|
|
71027
|
+
hoverInfo: {},
|
|
71028
|
+
applyVisibilityConditions: false
|
|
71036
71029
|
}), []);
|
|
71037
71030
|
const formContext = F$2(() => ({
|
|
71038
71031
|
getService(type, strict = true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-io/form-js-playground",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"description": "A form-js playground",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"url": "https://github.com/bpmn-io"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@bpmn-io/form-js-editor": "1.21.
|
|
49
|
-
"@bpmn-io/form-js-viewer": "1.21.
|
|
48
|
+
"@bpmn-io/form-js-editor": "1.21.1",
|
|
49
|
+
"@bpmn-io/form-js-viewer": "1.21.1",
|
|
50
50
|
"@codemirror/autocomplete": "^6.20.0",
|
|
51
51
|
"@codemirror/commands": "^6.10.1",
|
|
52
52
|
"@codemirror/lang-json": "^6.0.2",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"rollup-plugin-css-only": "^4.5.5",
|
|
72
72
|
"style-loader": "^4.0.0"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "b36907be7a2b3d872369b1c44d5a8b059a5d4c5d"
|
|
75
75
|
}
|