@bpmn-io/properties-panel 3.20.1 → 3.21.0
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/index.esm.js +41 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +41 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3069,6 +3069,28 @@ function HeaderButton(props) {
|
|
|
3069
3069
|
});
|
|
3070
3070
|
}
|
|
3071
3071
|
|
|
3072
|
+
/**
|
|
3073
|
+
* @typedef { {
|
|
3074
|
+
* [key: string]: string;
|
|
3075
|
+
* } } TranslateReplacements
|
|
3076
|
+
*/
|
|
3077
|
+
|
|
3078
|
+
/**
|
|
3079
|
+
* A simple translation stub to be used for multi-language support.
|
|
3080
|
+
* Can be easily replaced with a more sophisticated solution.
|
|
3081
|
+
*
|
|
3082
|
+
* @param {string} template to interpolate
|
|
3083
|
+
* @param {TranslateReplacements} [replacements] a map with substitutes
|
|
3084
|
+
*
|
|
3085
|
+
* @return {string} the translated string
|
|
3086
|
+
*/
|
|
3087
|
+
function translateFallback(template, replacements) {
|
|
3088
|
+
replacements = replacements || {};
|
|
3089
|
+
return template.replace(/{([^}]+)}/g, function (_, key) {
|
|
3090
|
+
return replacements[key] || '{' + key + '}';
|
|
3091
|
+
});
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3072
3094
|
function CollapsibleEntry(props) {
|
|
3073
3095
|
const {
|
|
3074
3096
|
element,
|
|
@@ -3076,7 +3098,8 @@ function CollapsibleEntry(props) {
|
|
|
3076
3098
|
id,
|
|
3077
3099
|
label,
|
|
3078
3100
|
open: shouldOpen,
|
|
3079
|
-
remove
|
|
3101
|
+
remove,
|
|
3102
|
+
translate = translateFallback
|
|
3080
3103
|
} = props;
|
|
3081
3104
|
const [open, setOpen] = hooks.useState(shouldOpen);
|
|
3082
3105
|
const toggleOpen = () => setOpen(!open);
|
|
@@ -3092,9 +3115,7 @@ function CollapsibleEntry(props) {
|
|
|
3092
3115
|
}
|
|
3093
3116
|
}, [onShow, setOpen])
|
|
3094
3117
|
};
|
|
3095
|
-
|
|
3096
|
-
// todo(pinussilvestrus): translate once we have a translate mechanism for the core
|
|
3097
|
-
const placeholderLabel = '<empty>';
|
|
3118
|
+
const placeholderLabel = translate('<empty>');
|
|
3098
3119
|
return jsxRuntime.jsxs("div", {
|
|
3099
3120
|
"data-entry-id": id,
|
|
3100
3121
|
class: classnames('bio-properties-panel-collapsible-entry', open ? 'open' : ''),
|
|
@@ -3107,14 +3128,14 @@ function CollapsibleEntry(props) {
|
|
|
3107
3128
|
children: label || placeholderLabel
|
|
3108
3129
|
}), jsxRuntime.jsx("button", {
|
|
3109
3130
|
type: "button",
|
|
3110
|
-
title:
|
|
3131
|
+
title: translate('Toggle list item'),
|
|
3111
3132
|
class: "bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow",
|
|
3112
3133
|
children: jsxRuntime.jsx(ArrowIcon, {
|
|
3113
3134
|
class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right'
|
|
3114
3135
|
})
|
|
3115
3136
|
}), remove ? jsxRuntime.jsx("button", {
|
|
3116
3137
|
type: "button",
|
|
3117
|
-
title:
|
|
3138
|
+
title: translate('Delete item'),
|
|
3118
3139
|
class: "bio-properties-panel-remove-entry",
|
|
3119
3140
|
onClick: remove,
|
|
3120
3141
|
children: jsxRuntime.jsx(DeleteIcon, {})
|
|
@@ -3142,7 +3163,8 @@ function CollapsibleEntry(props) {
|
|
|
3142
3163
|
function ListItem(props) {
|
|
3143
3164
|
const {
|
|
3144
3165
|
autoFocusEntry,
|
|
3145
|
-
autoOpen
|
|
3166
|
+
autoOpen,
|
|
3167
|
+
translate = translateFallback
|
|
3146
3168
|
} = props;
|
|
3147
3169
|
|
|
3148
3170
|
// focus specified entry on auto open
|
|
@@ -3164,7 +3186,8 @@ function ListItem(props) {
|
|
|
3164
3186
|
class: "bio-properties-panel-list-item",
|
|
3165
3187
|
children: jsxRuntime.jsx(CollapsibleEntry, {
|
|
3166
3188
|
...props,
|
|
3167
|
-
open: autoOpen
|
|
3189
|
+
open: autoOpen,
|
|
3190
|
+
translate: translate
|
|
3168
3191
|
})
|
|
3169
3192
|
});
|
|
3170
3193
|
}
|
|
@@ -3181,7 +3204,8 @@ function ListGroup(props) {
|
|
|
3181
3204
|
id,
|
|
3182
3205
|
items,
|
|
3183
3206
|
label,
|
|
3184
|
-
shouldOpen = true
|
|
3207
|
+
shouldOpen = true,
|
|
3208
|
+
translate = translateFallback
|
|
3185
3209
|
} = props;
|
|
3186
3210
|
hooks.useEffect(() => {
|
|
3187
3211
|
if (props.shouldSort != undefined) {
|
|
@@ -3283,20 +3307,22 @@ function ListGroup(props) {
|
|
|
3283
3307
|
class: "bio-properties-panel-group-header-buttons",
|
|
3284
3308
|
children: [add ? jsxRuntime.jsxs("button", {
|
|
3285
3309
|
type: "button",
|
|
3286
|
-
title:
|
|
3310
|
+
title: translate('Create new list item'),
|
|
3287
3311
|
class: "bio-properties-panel-group-header-button bio-properties-panel-add-entry",
|
|
3288
3312
|
onClick: handleAddClick,
|
|
3289
3313
|
children: [jsxRuntime.jsx(CreateIcon, {}), !hasItems ? jsxRuntime.jsx("span", {
|
|
3290
3314
|
class: "bio-properties-panel-add-entry-label",
|
|
3291
|
-
children:
|
|
3315
|
+
children: translate('Create')
|
|
3292
3316
|
}) : null]
|
|
3293
3317
|
}) : null, hasItems ? jsxRuntime.jsx("div", {
|
|
3294
|
-
title: `List contains
|
|
3318
|
+
title: translate(`List contains {numOfItems} item${items.length != 1 ? 's' : ''}`, {
|
|
3319
|
+
numOfItems: items.length
|
|
3320
|
+
}),
|
|
3295
3321
|
class: classnames('bio-properties-panel-list-badge', hasError ? 'bio-properties-panel-list-badge--error' : ''),
|
|
3296
3322
|
children: items.length
|
|
3297
3323
|
}) : null, hasItems ? jsxRuntime.jsx("button", {
|
|
3298
3324
|
type: "button",
|
|
3299
|
-
title:
|
|
3325
|
+
title: translate('Toggle section'),
|
|
3300
3326
|
class: "bio-properties-panel-group-header-button bio-properties-panel-arrow",
|
|
3301
3327
|
children: jsxRuntime.jsx(ArrowIcon, {
|
|
3302
3328
|
class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right'
|
|
@@ -3323,7 +3349,8 @@ function ListGroup(props) {
|
|
|
3323
3349
|
autoOpen: autoOpen,
|
|
3324
3350
|
element: element,
|
|
3325
3351
|
index: index,
|
|
3326
|
-
key: id
|
|
3352
|
+
key: id,
|
|
3353
|
+
translate: translate
|
|
3327
3354
|
});
|
|
3328
3355
|
})
|
|
3329
3356
|
})
|