@bpmn-io/form-js-editor 1.8.8 → 1.9.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/LICENSE +22 -22
- package/dist/index.cjs +80 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +80 -75
- package/dist/index.es.js.map +1 -1
- package/dist/types/features/properties-panel/PropertiesPanelHeaderProvider.d.ts +6 -5
- package/package.json +3 -4
package/dist/index.es.js
CHANGED
|
@@ -9010,83 +9010,64 @@ function hasIntegerPathSegment(path) {
|
|
|
9010
9010
|
return path.split('.').some(segment => /^\d+$/.test(segment));
|
|
9011
9011
|
}
|
|
9012
9012
|
|
|
9013
|
-
|
|
9013
|
+
const headerlessTypes = ['spacer', 'separator', 'expression', 'html'];
|
|
9014
|
+
function getPropertiesPanelHeaderProvider(options = {}) {
|
|
9014
9015
|
const {
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9016
|
+
getDocumentationRef,
|
|
9017
|
+
formFields
|
|
9018
|
+
} = options;
|
|
9019
|
+
return {
|
|
9020
|
+
getElementLabel: field => {
|
|
9021
|
+
const {
|
|
9022
|
+
type
|
|
9023
|
+
} = field;
|
|
9024
|
+
if (headerlessTypes.includes(type)) {
|
|
9025
|
+
return '';
|
|
9026
|
+
}
|
|
9027
|
+
if (type === 'text') {
|
|
9028
|
+
return textToLabel(field.text);
|
|
9029
|
+
}
|
|
9030
|
+
if (type === 'image') {
|
|
9031
|
+
return field.alt;
|
|
9032
|
+
}
|
|
9033
|
+
if (type === 'default') {
|
|
9034
|
+
return field.id;
|
|
9035
|
+
}
|
|
9036
|
+
return field.label;
|
|
9037
|
+
},
|
|
9038
|
+
getElementIcon: field => {
|
|
9039
|
+
const {
|
|
9040
|
+
type
|
|
9041
|
+
} = field;
|
|
9042
|
+
const fieldDefinition = formFields.get(type).config;
|
|
9043
|
+
const Icon = fieldDefinition.icon || iconsByType(type);
|
|
9044
|
+
if (Icon) {
|
|
9045
|
+
return () => jsx(Icon, {
|
|
9046
|
+
width: "36",
|
|
9047
|
+
height: "36",
|
|
9048
|
+
viewBox: "0 0 54 54"
|
|
9049
|
+
});
|
|
9050
|
+
} else if (fieldDefinition.iconUrl) {
|
|
9051
|
+
return getPaletteIcon({
|
|
9052
|
+
iconUrl: fieldDefinition.iconUrl,
|
|
9053
|
+
label: fieldDefinition.label
|
|
9054
|
+
});
|
|
9055
|
+
}
|
|
9056
|
+
},
|
|
9057
|
+
getTypeLabel: field => {
|
|
9058
|
+
const {
|
|
9059
|
+
type
|
|
9060
|
+
} = field;
|
|
9061
|
+
if (type === 'default') {
|
|
9062
|
+
return 'Form';
|
|
9063
|
+
}
|
|
9064
|
+
const fieldDefinition = formFields.get(type).config;
|
|
9065
|
+
return fieldDefinition.label || type;
|
|
9066
|
+
},
|
|
9067
|
+
getDocumentationRef
|
|
9068
|
+
};
|
|
9029
9069
|
}
|
|
9030
9070
|
|
|
9031
|
-
const headerlessTypes = ['spacer', 'separator', 'expression', 'html'];
|
|
9032
|
-
const PropertiesPanelHeaderProvider = {
|
|
9033
|
-
getElementLabel: field => {
|
|
9034
|
-
const {
|
|
9035
|
-
type
|
|
9036
|
-
} = field;
|
|
9037
|
-
if (headerlessTypes.includes(type)) {
|
|
9038
|
-
return '';
|
|
9039
|
-
}
|
|
9040
|
-
if (type === 'text') {
|
|
9041
|
-
return textToLabel(field.text);
|
|
9042
|
-
}
|
|
9043
|
-
if (type === 'image') {
|
|
9044
|
-
return field.alt;
|
|
9045
|
-
}
|
|
9046
|
-
if (type === 'default') {
|
|
9047
|
-
return field.id;
|
|
9048
|
-
}
|
|
9049
|
-
return field.label;
|
|
9050
|
-
},
|
|
9051
|
-
getElementIcon: field => {
|
|
9052
|
-
const {
|
|
9053
|
-
type
|
|
9054
|
-
} = field;
|
|
9055
|
-
|
|
9056
|
-
// @Note: We know that we are inside the properties panel context,
|
|
9057
|
-
// so we can savely use the hook here.
|
|
9058
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
9059
|
-
const fieldDefinition = useService('formFields').get(type).config;
|
|
9060
|
-
const Icon = fieldDefinition.icon || iconsByType(type);
|
|
9061
|
-
if (Icon) {
|
|
9062
|
-
return () => jsx(Icon, {
|
|
9063
|
-
width: "36",
|
|
9064
|
-
height: "36",
|
|
9065
|
-
viewBox: "0 0 54 54"
|
|
9066
|
-
});
|
|
9067
|
-
} else if (fieldDefinition.iconUrl) {
|
|
9068
|
-
return getPaletteIcon({
|
|
9069
|
-
iconUrl: fieldDefinition.iconUrl,
|
|
9070
|
-
label: fieldDefinition.label
|
|
9071
|
-
});
|
|
9072
|
-
}
|
|
9073
|
-
},
|
|
9074
|
-
getTypeLabel: field => {
|
|
9075
|
-
const {
|
|
9076
|
-
type
|
|
9077
|
-
} = field;
|
|
9078
|
-
if (type === 'default') {
|
|
9079
|
-
return 'Form';
|
|
9080
|
-
}
|
|
9081
|
-
|
|
9082
|
-
// @Note: We know that we are inside the properties panel context,
|
|
9083
|
-
// so we can savely use the hook here.
|
|
9084
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
9085
|
-
const fieldDefinition = useService('formFields').get(type).config;
|
|
9086
|
-
return fieldDefinition.label || type;
|
|
9087
|
-
}
|
|
9088
|
-
};
|
|
9089
|
-
|
|
9090
9071
|
/**
|
|
9091
9072
|
* Provide placeholders for empty and multiple state.
|
|
9092
9073
|
*/
|
|
@@ -9103,6 +9084,7 @@ const PropertiesPanelPlaceholderProvider = {
|
|
|
9103
9084
|
}
|
|
9104
9085
|
};
|
|
9105
9086
|
|
|
9087
|
+
const EMPTY = {};
|
|
9106
9088
|
function PropertiesPanel(props) {
|
|
9107
9089
|
const {
|
|
9108
9090
|
eventBus,
|
|
@@ -9112,7 +9094,7 @@ function PropertiesPanel(props) {
|
|
|
9112
9094
|
const formEditor = injector.get('formEditor');
|
|
9113
9095
|
const modeling = injector.get('modeling');
|
|
9114
9096
|
const selectionModule = injector.get('selection');
|
|
9115
|
-
const propertiesPanelConfig = injector.get('config.propertiesPanel') ||
|
|
9097
|
+
const propertiesPanelConfig = injector.get('config.propertiesPanel') || EMPTY;
|
|
9116
9098
|
const {
|
|
9117
9099
|
feelPopupContainer
|
|
9118
9100
|
} = propertiesPanelConfig;
|
|
@@ -9166,6 +9148,11 @@ function PropertiesPanel(props) {
|
|
|
9166
9148
|
return updater(groups);
|
|
9167
9149
|
}, []);
|
|
9168
9150
|
}, [providers, selectedFormField, editField]);
|
|
9151
|
+
const formFields = getService('formFields');
|
|
9152
|
+
const PropertiesPanelHeaderProvider = useMemo(() => getPropertiesPanelHeaderProvider({
|
|
9153
|
+
getDocumentationRef: propertiesPanelConfig.getDocumentationRef,
|
|
9154
|
+
formFields
|
|
9155
|
+
}), [formFields, propertiesPanelConfig]);
|
|
9169
9156
|
return jsx("div", {
|
|
9170
9157
|
class: "fjs-properties-panel",
|
|
9171
9158
|
"data-field": selectedFormField && selectedFormField.id,
|
|
@@ -9339,6 +9326,24 @@ function Action(props) {
|
|
|
9339
9326
|
});
|
|
9340
9327
|
}
|
|
9341
9328
|
|
|
9329
|
+
function useService(type, strict) {
|
|
9330
|
+
const {
|
|
9331
|
+
getService
|
|
9332
|
+
} = useContext(FormPropertiesPanelContext);
|
|
9333
|
+
return getService(type, strict);
|
|
9334
|
+
}
|
|
9335
|
+
|
|
9336
|
+
/**
|
|
9337
|
+
* Retrieve list of variables from the form schema.
|
|
9338
|
+
*
|
|
9339
|
+
* @returns { string[] } list of variables used in form schema
|
|
9340
|
+
*/
|
|
9341
|
+
function useVariables() {
|
|
9342
|
+
const form = useService('formEditor');
|
|
9343
|
+
const schema = form.getSchema();
|
|
9344
|
+
return getSchemaVariables(schema);
|
|
9345
|
+
}
|
|
9346
|
+
|
|
9342
9347
|
function AltTextEntry(props) {
|
|
9343
9348
|
const {
|
|
9344
9349
|
editField,
|