@bpmn-io/properties-panel 0.10.1 → 0.12.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/CHANGELOG.md +130 -112
- package/LICENSE +20 -20
- package/README.md +34 -34
- package/assets/properties-panel.css +897 -891
- package/dist/index.esm.js +334 -231
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +334 -229
- package/dist/index.js.map +1 -1
- package/package.json +88 -87
package/dist/index.esm.js
CHANGED
|
@@ -3,17 +3,17 @@ import { isFunction, get, assign, set, sortBy, find, isNumber, debounce } from '
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { jsxs, jsx } from '../preact/jsx-runtime';
|
|
5
5
|
import { query } from 'min-dom';
|
|
6
|
-
import { createContext } from '../preact';
|
|
6
|
+
import { createContext, createElement } from '../preact';
|
|
7
7
|
import '../preact/compat';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @typedef { { getElementLabel: Function, getTypeLabel: Function, getElementIcon: Function } } HeaderProvider
|
|
9
|
+
/**
|
|
10
|
+
* @typedef { { getElementLabel: Function, getTypeLabel: Function, getElementIcon: Function } } HeaderProvider
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* @param {Object} props
|
|
15
|
-
* @param {Object} props.element,
|
|
16
|
-
* @param {HeaderProvider} props.headerProvider
|
|
13
|
+
/**
|
|
14
|
+
* @param {Object} props
|
|
15
|
+
* @param {Object} props.element,
|
|
16
|
+
* @param {HeaderProvider} props.headerProvider
|
|
17
17
|
*/
|
|
18
18
|
function Header(props) {
|
|
19
19
|
const {
|
|
@@ -52,11 +52,11 @@ function Header(props) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* @pinussilvestrus: we need to introduce our own hook to persist the previous
|
|
57
|
-
* state on updates.
|
|
58
|
-
*
|
|
59
|
-
* cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
|
|
55
|
+
/**
|
|
56
|
+
* @pinussilvestrus: we need to introduce our own hook to persist the previous
|
|
57
|
+
* state on updates.
|
|
58
|
+
*
|
|
59
|
+
* cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
function usePrevious(value) {
|
|
@@ -68,24 +68,24 @@ function usePrevious(value) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const KEY_LENGTH = 6;
|
|
71
|
-
/**
|
|
72
|
-
* Create a persistent key factory for plain objects without id.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```jsx
|
|
76
|
-
* function List({ objects }) {
|
|
77
|
-
* const getKey = useKeyFactory();
|
|
78
|
-
* return (<ol>{
|
|
79
|
-
* objects.map(obj => {
|
|
80
|
-
* const key = getKey(obj);
|
|
81
|
-
* return <li key={key}>obj.name</li>
|
|
82
|
-
* })
|
|
83
|
-
* }</ol>);
|
|
84
|
-
* }
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* @param {any[]} dependencies
|
|
88
|
-
* @returns {(element: object) => string}
|
|
71
|
+
/**
|
|
72
|
+
* Create a persistent key factory for plain objects without id.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```jsx
|
|
76
|
+
* function List({ objects }) {
|
|
77
|
+
* const getKey = useKeyFactory();
|
|
78
|
+
* return (<ol>{
|
|
79
|
+
* objects.map(obj => {
|
|
80
|
+
* const key = getKey(obj);
|
|
81
|
+
* return <li key={key}>obj.name</li>
|
|
82
|
+
* })
|
|
83
|
+
* }</ol>);
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @param {any[]} dependencies
|
|
88
|
+
* @returns {(element: object) => string}
|
|
89
89
|
*/
|
|
90
90
|
|
|
91
91
|
function useKeyFactory(dependencies = []) {
|
|
@@ -117,20 +117,20 @@ const LayoutContext = createContext({
|
|
|
117
117
|
setLayoutForKey: () => {}
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
/**
|
|
121
|
-
* Creates a state that persists in the global LayoutContext.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```jsx
|
|
125
|
-
* function Group(props) {
|
|
126
|
-
* const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
|
|
127
|
-
* }
|
|
128
|
-
* ```
|
|
129
|
-
*
|
|
130
|
-
* @param {(string|number)[]} path
|
|
131
|
-
* @param {any} [defaultValue]
|
|
132
|
-
*
|
|
133
|
-
* @returns {[ any, Function ]}
|
|
120
|
+
/**
|
|
121
|
+
* Creates a state that persists in the global LayoutContext.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```jsx
|
|
125
|
+
* function Group(props) {
|
|
126
|
+
* const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @param {(string|number)[]} path
|
|
131
|
+
* @param {any} [defaultValue]
|
|
132
|
+
*
|
|
133
|
+
* @returns {[ any, Function ]}
|
|
134
134
|
*/
|
|
135
135
|
|
|
136
136
|
function useLayoutState(path, defaultValue) {
|
|
@@ -151,20 +151,20 @@ function useLayoutState(path, defaultValue) {
|
|
|
151
151
|
return [value, setState];
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/**
|
|
155
|
-
* Accesses the global DescriptionContext and returns a description for a given id and element.
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* ```jsx
|
|
159
|
-
* function TextField(props) {
|
|
160
|
-
* const description = useDescriptionContext('input1', element);
|
|
161
|
-
* }
|
|
162
|
-
* ```
|
|
163
|
-
*
|
|
164
|
-
* @param {string} id
|
|
165
|
-
* @param {djs.model.Base} element
|
|
166
|
-
*
|
|
167
|
-
* @returns {string}
|
|
154
|
+
/**
|
|
155
|
+
* Accesses the global DescriptionContext and returns a description for a given id and element.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```jsx
|
|
159
|
+
* function TextField(props) {
|
|
160
|
+
* const description = useDescriptionContext('input1', element);
|
|
161
|
+
* }
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @param {string} id
|
|
165
|
+
* @param {djs.model.Base} element
|
|
166
|
+
*
|
|
167
|
+
* @returns {string}
|
|
168
168
|
*/
|
|
169
169
|
|
|
170
170
|
function useDescriptionContext(id, element) {
|
|
@@ -219,10 +219,54 @@ DeleteIcon.defaultProps = {
|
|
|
219
219
|
height: "16"
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
+
var FeelRequiredIcon = function FeelRequiredIcon(props) {
|
|
223
|
+
return jsxs("svg", { ...props,
|
|
224
|
+
children: [jsx("path", {
|
|
225
|
+
d: "M5.8 7.06V5.95h4.307v1.11H5.8zm0 3.071v-1.11h4.307v1.11H5.8z",
|
|
226
|
+
fill: "#505562"
|
|
227
|
+
}), jsx("path", {
|
|
228
|
+
fillRule: "evenodd",
|
|
229
|
+
clipRule: "evenodd",
|
|
230
|
+
d: "M8 3.268A4.732 4.732 0 1 0 12.732 8H14a6 6 0 1 1-6-6v1.268z",
|
|
231
|
+
fill: "#505562"
|
|
232
|
+
}), jsx("path", {
|
|
233
|
+
d: "m11.28 6.072-.832-.56 1.016-1.224L10 3.848l.312-.912 1.392.584L11.632 2h1.032l-.072 1.52 1.392-.584.312.912-1.464.44 1.008 1.224-.832.552-.864-1.296-.864 1.304z",
|
|
234
|
+
fill: "#505562"
|
|
235
|
+
})]
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
FeelRequiredIcon.defaultProps = {
|
|
240
|
+
viewBox: "0 0 16 16",
|
|
241
|
+
fill: "none",
|
|
242
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
var FeelOptionalIcon = function FeelOptionalIcon(props) {
|
|
246
|
+
return jsxs("svg", { ...props,
|
|
247
|
+
children: [jsx("path", {
|
|
248
|
+
d: "M5.845 7.04V5.93h4.307v1.11H5.845zm0 3.07V9h4.307v1.11H5.845z",
|
|
249
|
+
fill: "#505562"
|
|
250
|
+
}), jsx("path", {
|
|
251
|
+
fillRule: "evenodd",
|
|
252
|
+
clipRule: "evenodd",
|
|
253
|
+
d: "M3.286 8a4.714 4.714 0 1 0 9.428 0 4.714 4.714 0 0 0-9.428 0zM8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2z",
|
|
254
|
+
fill: "#505562"
|
|
255
|
+
})]
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
FeelOptionalIcon.defaultProps = {
|
|
260
|
+
viewBox: "0 0 16 16",
|
|
261
|
+
fill: "none",
|
|
262
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
263
|
+
};
|
|
264
|
+
|
|
222
265
|
function Group(props) {
|
|
223
266
|
const {
|
|
224
|
-
|
|
267
|
+
element,
|
|
225
268
|
entries = [],
|
|
269
|
+
id,
|
|
226
270
|
label
|
|
227
271
|
} = props;
|
|
228
272
|
const [open, setOpen] = useLayoutState(['groups', id, 'open'], false);
|
|
@@ -270,7 +314,16 @@ function Group(props) {
|
|
|
270
314
|
})]
|
|
271
315
|
}), jsx("div", {
|
|
272
316
|
class: classnames('bio-properties-panel-group-entries', open ? 'open' : ''),
|
|
273
|
-
children: entries.map(
|
|
317
|
+
children: entries.map(entry => {
|
|
318
|
+
const {
|
|
319
|
+
component: Component,
|
|
320
|
+
id
|
|
321
|
+
} = entry;
|
|
322
|
+
return createElement(Component, { ...entry,
|
|
323
|
+
key: id,
|
|
324
|
+
element: element
|
|
325
|
+
});
|
|
326
|
+
})
|
|
274
327
|
})]
|
|
275
328
|
});
|
|
276
329
|
}
|
|
@@ -286,64 +339,64 @@ const DEFAULT_LAYOUT = {
|
|
|
286
339
|
open: true
|
|
287
340
|
};
|
|
288
341
|
const DEFAULT_DESCRIPTION = {};
|
|
289
|
-
/**
|
|
290
|
-
* @typedef { {
|
|
291
|
-
* component: import('preact').
|
|
292
|
-
* id: String,
|
|
293
|
-
* isEdited?: Function
|
|
294
|
-
* } } EntryDefinition
|
|
295
|
-
*
|
|
296
|
-
* @typedef { {
|
|
297
|
-
* autoFocusEntry: String,
|
|
298
|
-
* autoOpen?: Boolean,
|
|
299
|
-
* entries: Array<EntryDefinition>,
|
|
300
|
-
* id: String,
|
|
301
|
-
* label: String,
|
|
302
|
-
* remove: (event: MouseEvent) => void
|
|
303
|
-
* } } ListItemDefinition
|
|
304
|
-
*
|
|
305
|
-
* @typedef { {
|
|
306
|
-
* add: (event: MouseEvent) => void,
|
|
307
|
-
* component: import('preact').Component,
|
|
308
|
-
* element: Object,
|
|
309
|
-
* id: String,
|
|
310
|
-
* items: Array<ListItemDefinition>,
|
|
311
|
-
* label: String,
|
|
312
|
-
* shouldSort?: Boolean,
|
|
313
|
-
* shouldOpen?: Boolean
|
|
314
|
-
* } } ListGroupDefinition
|
|
315
|
-
*
|
|
316
|
-
* @typedef { {
|
|
317
|
-
* component?: import('preact').Component,
|
|
318
|
-
* entries: Array<EntryDefinition>,
|
|
319
|
-
* id: String,
|
|
320
|
-
* label: String
|
|
321
|
-
* } } GroupDefinition
|
|
322
|
-
*
|
|
323
|
-
* @typedef { {
|
|
324
|
-
* [id: String]: GetDescriptionFunction
|
|
325
|
-
* } } DescriptionConfig
|
|
326
|
-
*
|
|
327
|
-
* @callback { {
|
|
328
|
-
* @param {string} id
|
|
329
|
-
* @param {djs.model.base} element
|
|
330
|
-
* @returns {string}
|
|
331
|
-
* } } GetDescriptionFunction
|
|
332
|
-
*
|
|
342
|
+
/**
|
|
343
|
+
* @typedef { {
|
|
344
|
+
* component: import('preact').Component,
|
|
345
|
+
* id: String,
|
|
346
|
+
* isEdited?: Function
|
|
347
|
+
* } } EntryDefinition
|
|
348
|
+
*
|
|
349
|
+
* @typedef { {
|
|
350
|
+
* autoFocusEntry: String,
|
|
351
|
+
* autoOpen?: Boolean,
|
|
352
|
+
* entries: Array<EntryDefinition>,
|
|
353
|
+
* id: String,
|
|
354
|
+
* label: String,
|
|
355
|
+
* remove: (event: MouseEvent) => void
|
|
356
|
+
* } } ListItemDefinition
|
|
357
|
+
*
|
|
358
|
+
* @typedef { {
|
|
359
|
+
* add: (event: MouseEvent) => void,
|
|
360
|
+
* component: import('preact').Component,
|
|
361
|
+
* element: Object,
|
|
362
|
+
* id: String,
|
|
363
|
+
* items: Array<ListItemDefinition>,
|
|
364
|
+
* label: String,
|
|
365
|
+
* shouldSort?: Boolean,
|
|
366
|
+
* shouldOpen?: Boolean
|
|
367
|
+
* } } ListGroupDefinition
|
|
368
|
+
*
|
|
369
|
+
* @typedef { {
|
|
370
|
+
* component?: import('preact').Component,
|
|
371
|
+
* entries: Array<EntryDefinition>,
|
|
372
|
+
* id: String,
|
|
373
|
+
* label: String
|
|
374
|
+
* } } GroupDefinition
|
|
375
|
+
*
|
|
376
|
+
* @typedef { {
|
|
377
|
+
* [id: String]: GetDescriptionFunction
|
|
378
|
+
* } } DescriptionConfig
|
|
379
|
+
*
|
|
380
|
+
* @callback { {
|
|
381
|
+
* @param {string} id
|
|
382
|
+
* @param {djs.model.base} element
|
|
383
|
+
* @returns {string}
|
|
384
|
+
* } } GetDescriptionFunction
|
|
385
|
+
*
|
|
333
386
|
*/
|
|
334
387
|
|
|
335
|
-
/**
|
|
336
|
-
* A basic properties panel component. Describes *how* content will be rendered, accepts
|
|
337
|
-
* data from implementor to describe *what* will be rendered.
|
|
338
|
-
*
|
|
339
|
-
* @param {Object} props
|
|
340
|
-
* @param {Object} props.element
|
|
341
|
-
* @param {import('./components/Header').HeaderProvider} props.headerProvider
|
|
342
|
-
* @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
|
|
343
|
-
* @param {Object} [props.layoutConfig]
|
|
344
|
-
* @param {Function} [props.layoutChanged]
|
|
345
|
-
* @param {DescriptionConfig} [props.descriptionConfig]
|
|
346
|
-
* @param {Function} [props.descriptionLoaded]
|
|
388
|
+
/**
|
|
389
|
+
* A basic properties panel component. Describes *how* content will be rendered, accepts
|
|
390
|
+
* data from implementor to describe *what* will be rendered.
|
|
391
|
+
*
|
|
392
|
+
* @param {Object} props
|
|
393
|
+
* @param {Object} props.element
|
|
394
|
+
* @param {import('./components/Header').HeaderProvider} props.headerProvider
|
|
395
|
+
* @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
|
|
396
|
+
* @param {Object} [props.layoutConfig]
|
|
397
|
+
* @param {Function} [props.layoutChanged]
|
|
398
|
+
* @param {DescriptionConfig} [props.descriptionConfig]
|
|
399
|
+
* @param {Function} [props.descriptionLoaded]
|
|
347
400
|
*/
|
|
348
401
|
|
|
349
402
|
function PropertiesPanel(props) {
|
|
@@ -416,13 +469,13 @@ function PropertiesPanel(props) {
|
|
|
416
469
|
class: "bio-properties-panel-scroll-container",
|
|
417
470
|
children: groups.map(group => {
|
|
418
471
|
const {
|
|
419
|
-
component:
|
|
472
|
+
component: Component = Group,
|
|
420
473
|
id
|
|
421
474
|
} = group;
|
|
422
|
-
return
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
475
|
+
return createElement(Component, { ...group,
|
|
476
|
+
key: id,
|
|
477
|
+
element: element
|
|
478
|
+
});
|
|
426
479
|
})
|
|
427
480
|
})]
|
|
428
481
|
})
|
|
@@ -510,17 +563,17 @@ function MenuItem({
|
|
|
510
563
|
children: item.entry
|
|
511
564
|
});
|
|
512
565
|
}
|
|
513
|
-
/**
|
|
514
|
-
*
|
|
515
|
-
* @param {Array<null | Element>} ignoredElements
|
|
516
|
-
* @param {Function} callback
|
|
566
|
+
/**
|
|
567
|
+
*
|
|
568
|
+
* @param {Array<null | Element>} ignoredElements
|
|
569
|
+
* @param {Function} callback
|
|
517
570
|
*/
|
|
518
571
|
|
|
519
572
|
|
|
520
573
|
function useGlobalClick(ignoredElements, callback) {
|
|
521
574
|
useEffect(() => {
|
|
522
|
-
/**
|
|
523
|
-
* @param {MouseEvent} event
|
|
575
|
+
/**
|
|
576
|
+
* @param {MouseEvent} event
|
|
524
577
|
*/
|
|
525
578
|
function listener(event) {
|
|
526
579
|
if (ignoredElements.some(element => element && element.contains(event.target))) {
|
|
@@ -555,11 +608,12 @@ function HeaderButton(props) {
|
|
|
555
608
|
|
|
556
609
|
function CollapsibleEntry(props) {
|
|
557
610
|
const {
|
|
558
|
-
|
|
611
|
+
element,
|
|
559
612
|
entries = [],
|
|
613
|
+
id,
|
|
560
614
|
label,
|
|
561
|
-
|
|
562
|
-
|
|
615
|
+
open: shouldOpen,
|
|
616
|
+
remove
|
|
563
617
|
} = props;
|
|
564
618
|
const [open, setOpen] = useState(shouldOpen);
|
|
565
619
|
|
|
@@ -591,15 +645,24 @@ function CollapsibleEntry(props) {
|
|
|
591
645
|
}) : null]
|
|
592
646
|
}), jsx("div", {
|
|
593
647
|
class: classnames('bio-properties-panel-collapsible-entry-entries', open ? 'open' : ''),
|
|
594
|
-
children: entries.map(
|
|
648
|
+
children: entries.map(entry => {
|
|
649
|
+
const {
|
|
650
|
+
component: Component,
|
|
651
|
+
id
|
|
652
|
+
} = entry;
|
|
653
|
+
return createElement(Component, { ...entry,
|
|
654
|
+
key: id,
|
|
655
|
+
element: element
|
|
656
|
+
});
|
|
657
|
+
})
|
|
595
658
|
})]
|
|
596
659
|
});
|
|
597
660
|
}
|
|
598
661
|
|
|
599
662
|
function ListItem(props) {
|
|
600
663
|
const {
|
|
601
|
-
|
|
602
|
-
|
|
664
|
+
autoFocusEntry,
|
|
665
|
+
autoOpen
|
|
603
666
|
} = props; // focus specified entry on auto open
|
|
604
667
|
|
|
605
668
|
useEffect(() => {
|
|
@@ -625,20 +688,20 @@ function ListItem(props) {
|
|
|
625
688
|
}
|
|
626
689
|
|
|
627
690
|
const noop = () => {};
|
|
628
|
-
/**
|
|
629
|
-
* @param {import('../PropertiesPanel').ListGroupDefinition} props
|
|
691
|
+
/**
|
|
692
|
+
* @param {import('../PropertiesPanel').ListGroupDefinition} props
|
|
630
693
|
*/
|
|
631
694
|
|
|
632
695
|
|
|
633
696
|
function ListGroup(props) {
|
|
634
697
|
const {
|
|
698
|
+
add,
|
|
635
699
|
element,
|
|
636
700
|
id,
|
|
637
701
|
items,
|
|
638
702
|
label,
|
|
639
|
-
|
|
640
|
-
shouldSort = true
|
|
641
|
-
shouldOpen = true
|
|
703
|
+
shouldOpen = true,
|
|
704
|
+
shouldSort = true
|
|
642
705
|
} = props;
|
|
643
706
|
const [open, setOpen] = useLayoutState(['groups', id, 'open'], false);
|
|
644
707
|
const [ordering, setOrdering] = useState([]);
|
|
@@ -756,18 +819,23 @@ function ListGroup(props) {
|
|
|
756
819
|
return;
|
|
757
820
|
}
|
|
758
821
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
822
|
+
const {
|
|
823
|
+
id
|
|
824
|
+
} = item;
|
|
825
|
+
return createElement(ListItem, { ...item,
|
|
826
|
+
element: element,
|
|
827
|
+
index: index,
|
|
828
|
+
key: id // if item was added, open first or last item based on ordering
|
|
829
|
+
,
|
|
830
|
+
autoOpen: newItemAdded && (shouldSort ? index === 0 : index === ordering.length - 1)
|
|
831
|
+
});
|
|
764
832
|
})
|
|
765
833
|
})]
|
|
766
834
|
});
|
|
767
835
|
} // helpers ////////////////////
|
|
768
836
|
|
|
769
|
-
/**
|
|
770
|
-
* Sorts given items alphanumeric by label
|
|
837
|
+
/**
|
|
838
|
+
* Sorts given items alphanumeric by label
|
|
771
839
|
*/
|
|
772
840
|
|
|
773
841
|
function sortItems(items) {
|
|
@@ -831,15 +899,15 @@ function Checkbox(props) {
|
|
|
831
899
|
})]
|
|
832
900
|
});
|
|
833
901
|
}
|
|
834
|
-
/**
|
|
835
|
-
* @param {Object} props
|
|
836
|
-
* @param {Object} props.element
|
|
837
|
-
* @param {String} props.id
|
|
838
|
-
* @param {String} props.description
|
|
839
|
-
* @param {String} props.label
|
|
840
|
-
* @param {Function} props.getValue
|
|
841
|
-
* @param {Function} props.setValue
|
|
842
|
-
* @param {boolean} [props.disabled]
|
|
902
|
+
/**
|
|
903
|
+
* @param {Object} props
|
|
904
|
+
* @param {Object} props.element
|
|
905
|
+
* @param {String} props.id
|
|
906
|
+
* @param {String} props.description
|
|
907
|
+
* @param {String} props.label
|
|
908
|
+
* @param {Function} props.getValue
|
|
909
|
+
* @param {Function} props.setValue
|
|
910
|
+
* @param {boolean} [props.disabled]
|
|
843
911
|
*/
|
|
844
912
|
|
|
845
913
|
|
|
@@ -883,7 +951,7 @@ function List(props) {
|
|
|
883
951
|
id,
|
|
884
952
|
element,
|
|
885
953
|
items = [],
|
|
886
|
-
|
|
954
|
+
component,
|
|
887
955
|
label = '<empty>',
|
|
888
956
|
open: shouldOpen,
|
|
889
957
|
onAdd,
|
|
@@ -906,8 +974,8 @@ function List(props) {
|
|
|
906
974
|
setOpen(false);
|
|
907
975
|
}
|
|
908
976
|
}, [open, hasItems]);
|
|
909
|
-
/**
|
|
910
|
-
* @param {MouseEvent} event
|
|
977
|
+
/**
|
|
978
|
+
* @param {MouseEvent} event
|
|
911
979
|
*/
|
|
912
980
|
|
|
913
981
|
function addItem(event) {
|
|
@@ -953,12 +1021,13 @@ function List(props) {
|
|
|
953
1021
|
})]
|
|
954
1022
|
}), hasItems && jsx(ItemsList, {
|
|
955
1023
|
autoFocusEntry: autoFocusEntry,
|
|
1024
|
+
component: component,
|
|
1025
|
+
element: element,
|
|
956
1026
|
id: id,
|
|
957
|
-
open: open,
|
|
958
1027
|
items: sortedItems,
|
|
959
1028
|
newItems: newItems,
|
|
960
1029
|
onRemove: onRemove,
|
|
961
|
-
|
|
1030
|
+
open: open
|
|
962
1031
|
})]
|
|
963
1032
|
});
|
|
964
1033
|
}
|
|
@@ -966,12 +1035,13 @@ function List(props) {
|
|
|
966
1035
|
function ItemsList(props) {
|
|
967
1036
|
const {
|
|
968
1037
|
autoFocusEntry,
|
|
1038
|
+
component: Component,
|
|
1039
|
+
element,
|
|
969
1040
|
id,
|
|
970
1041
|
items,
|
|
971
1042
|
newItems,
|
|
972
|
-
open,
|
|
973
1043
|
onRemove,
|
|
974
|
-
|
|
1044
|
+
open
|
|
975
1045
|
} = props;
|
|
976
1046
|
const getKey = useKeyFactory();
|
|
977
1047
|
const newItem = newItems[0];
|
|
@@ -998,7 +1068,13 @@ function ItemsList(props) {
|
|
|
998
1068
|
const key = getKey(item);
|
|
999
1069
|
return jsxs("li", {
|
|
1000
1070
|
class: "bio-properties-panel-list-entry-item",
|
|
1001
|
-
children: [
|
|
1071
|
+
children: [jsx(Component, {
|
|
1072
|
+
element: element,
|
|
1073
|
+
id: id,
|
|
1074
|
+
index: index,
|
|
1075
|
+
item: item,
|
|
1076
|
+
open: item === newItem
|
|
1077
|
+
}), onRemove && jsx("button", {
|
|
1002
1078
|
type: "button",
|
|
1003
1079
|
title: "Delete item",
|
|
1004
1080
|
class: "bio-properties-panel-remove-entry bio-properties-panel-remove-list-entry",
|
|
@@ -1009,14 +1085,14 @@ function ItemsList(props) {
|
|
|
1009
1085
|
})
|
|
1010
1086
|
});
|
|
1011
1087
|
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Place new items in the beginning of the list and sort the rest with provided function.
|
|
1014
|
-
*
|
|
1015
|
-
* @template Item
|
|
1016
|
-
* @param {Item[]} currentItems
|
|
1017
|
-
* @param {(a: Item, b: Item) => 0 | 1 | -1} [compareFn] function used to sort items
|
|
1018
|
-
* @param {boolean} [shouldReset=false] set to `true` to reset state of the hook
|
|
1019
|
-
* @returns {Item[]}
|
|
1088
|
+
/**
|
|
1089
|
+
* Place new items in the beginning of the list and sort the rest with provided function.
|
|
1090
|
+
*
|
|
1091
|
+
* @template Item
|
|
1092
|
+
* @param {Item[]} currentItems
|
|
1093
|
+
* @param {(a: Item, b: Item) => 0 | 1 | -1} [compareFn] function used to sort items
|
|
1094
|
+
* @param {boolean} [shouldReset=false] set to `true` to reset state of the hook
|
|
1095
|
+
* @returns {Item[]}
|
|
1020
1096
|
*/
|
|
1021
1097
|
|
|
1022
1098
|
|
|
@@ -1102,19 +1178,19 @@ function NumberField(props) {
|
|
|
1102
1178
|
})]
|
|
1103
1179
|
});
|
|
1104
1180
|
}
|
|
1105
|
-
/**
|
|
1106
|
-
* @param {Object} props
|
|
1107
|
-
* @param {Boolean} props.debounce
|
|
1108
|
-
* @param {String} props.description
|
|
1109
|
-
* @param {Boolean} props.disabled
|
|
1110
|
-
* @param {Object} props.element
|
|
1111
|
-
* @param {Function} props.getValue
|
|
1112
|
-
* @param {String} props.id
|
|
1113
|
-
* @param {String} props.label
|
|
1114
|
-
* @param {String} props.max
|
|
1115
|
-
* @param {String} props.min
|
|
1116
|
-
* @param {Function} props.setValue
|
|
1117
|
-
* @param {String} props.step
|
|
1181
|
+
/**
|
|
1182
|
+
* @param {Object} props
|
|
1183
|
+
* @param {Boolean} props.debounce
|
|
1184
|
+
* @param {String} props.description
|
|
1185
|
+
* @param {Boolean} props.disabled
|
|
1186
|
+
* @param {Object} props.element
|
|
1187
|
+
* @param {Function} props.getValue
|
|
1188
|
+
* @param {String} props.id
|
|
1189
|
+
* @param {String} props.label
|
|
1190
|
+
* @param {String} props.max
|
|
1191
|
+
* @param {String} props.min
|
|
1192
|
+
* @param {Function} props.setValue
|
|
1193
|
+
* @param {String} props.step
|
|
1118
1194
|
*/
|
|
1119
1195
|
|
|
1120
1196
|
|
|
@@ -1200,16 +1276,16 @@ function Select(props) {
|
|
|
1200
1276
|
})]
|
|
1201
1277
|
});
|
|
1202
1278
|
}
|
|
1203
|
-
/**
|
|
1204
|
-
* @param {object} props
|
|
1205
|
-
* @param {object} props.element
|
|
1206
|
-
* @param {string} props.id
|
|
1207
|
-
* @param {string} [props.description]
|
|
1208
|
-
* @param {string} props.label
|
|
1209
|
-
* @param {Function} props.getValue
|
|
1210
|
-
* @param {Function} props.setValue
|
|
1211
|
-
* @param {Function} props.getOptions
|
|
1212
|
-
* @param {boolean} [props.disabled]
|
|
1279
|
+
/**
|
|
1280
|
+
* @param {object} props
|
|
1281
|
+
* @param {object} props.element
|
|
1282
|
+
* @param {string} props.id
|
|
1283
|
+
* @param {string} [props.description]
|
|
1284
|
+
* @param {string} props.label
|
|
1285
|
+
* @param {Function} props.getValue
|
|
1286
|
+
* @param {Function} props.setValue
|
|
1287
|
+
* @param {Function} props.getOptions
|
|
1288
|
+
* @param {boolean} [props.disabled]
|
|
1213
1289
|
*/
|
|
1214
1290
|
|
|
1215
1291
|
|
|
@@ -1279,6 +1355,7 @@ function Simple(props) {
|
|
|
1279
1355
|
disabled: disabled,
|
|
1280
1356
|
class: "bio-properties-panel-input",
|
|
1281
1357
|
onInput: handleInput,
|
|
1358
|
+
"aria-label": value || '<empty>',
|
|
1282
1359
|
onFocus: onFocus,
|
|
1283
1360
|
onBlur: onBlur,
|
|
1284
1361
|
value: value || ''
|
|
@@ -1293,12 +1370,27 @@ function prefixId$3(id) {
|
|
|
1293
1370
|
return `bio-properties-panel-${id}`;
|
|
1294
1371
|
}
|
|
1295
1372
|
|
|
1373
|
+
function FeelIcon(props) {
|
|
1374
|
+
const {
|
|
1375
|
+
label,
|
|
1376
|
+
feel = false
|
|
1377
|
+
} = props;
|
|
1378
|
+
const feelRequiredLabel = ' must be a FEEL expression';
|
|
1379
|
+
const feelOptionalLabel = ' can optionally be a FEEL expression';
|
|
1380
|
+
return jsx("i", {
|
|
1381
|
+
class: "bio-properties-panel-feel-icon",
|
|
1382
|
+
title: label + (feel === 'required' ? feelRequiredLabel : feelOptionalLabel),
|
|
1383
|
+
children: feel === 'required' ? jsx(FeelRequiredIcon, {}) : jsx(FeelOptionalIcon, {})
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1296
1387
|
function TextArea(props) {
|
|
1297
1388
|
const {
|
|
1298
1389
|
id,
|
|
1299
1390
|
label,
|
|
1300
1391
|
rows = 2,
|
|
1301
1392
|
debounce,
|
|
1393
|
+
feel,
|
|
1302
1394
|
onInput,
|
|
1303
1395
|
value = '',
|
|
1304
1396
|
disabled,
|
|
@@ -1311,10 +1403,13 @@ function TextArea(props) {
|
|
|
1311
1403
|
}, [onInput, debounce]);
|
|
1312
1404
|
return jsxs("div", {
|
|
1313
1405
|
class: "bio-properties-panel-textarea",
|
|
1314
|
-
children: [
|
|
1406
|
+
children: [jsxs("label", {
|
|
1315
1407
|
for: prefixId$2(id),
|
|
1316
1408
|
class: "bio-properties-panel-label",
|
|
1317
|
-
children: label
|
|
1409
|
+
children: [label, feel && jsx(FeelIcon, {
|
|
1410
|
+
feel: feel,
|
|
1411
|
+
label: label
|
|
1412
|
+
})]
|
|
1318
1413
|
}), jsx("textarea", {
|
|
1319
1414
|
id: prefixId$2(id),
|
|
1320
1415
|
name: id,
|
|
@@ -1329,18 +1424,18 @@ function TextArea(props) {
|
|
|
1329
1424
|
})]
|
|
1330
1425
|
});
|
|
1331
1426
|
}
|
|
1332
|
-
/**
|
|
1333
|
-
* @param {object} props
|
|
1334
|
-
* @param {object} props.element
|
|
1335
|
-
* @param {string} props.id
|
|
1336
|
-
* @param {string} props.description
|
|
1337
|
-
* @param {boolean} props.debounce
|
|
1338
|
-
* @param {string} props.label
|
|
1339
|
-
* @param {Function} props.getValue
|
|
1340
|
-
* @param {Function} props.setValue
|
|
1341
|
-
* @param {number} props.rows
|
|
1342
|
-
* @param {boolean} props.monospace
|
|
1343
|
-
* @param {boolean} [props.disabled]
|
|
1427
|
+
/**
|
|
1428
|
+
* @param {object} props
|
|
1429
|
+
* @param {object} props.element
|
|
1430
|
+
* @param {string} props.id
|
|
1431
|
+
* @param {string} props.description
|
|
1432
|
+
* @param {boolean} props.debounce
|
|
1433
|
+
* @param {string} props.label
|
|
1434
|
+
* @param {Function} props.getValue
|
|
1435
|
+
* @param {Function} props.setValue
|
|
1436
|
+
* @param {number} props.rows
|
|
1437
|
+
* @param {boolean} props.monospace
|
|
1438
|
+
* @param {boolean} [props.disabled]
|
|
1344
1439
|
*/
|
|
1345
1440
|
|
|
1346
1441
|
|
|
@@ -1350,6 +1445,7 @@ function TextAreaEntry(props) {
|
|
|
1350
1445
|
id,
|
|
1351
1446
|
description,
|
|
1352
1447
|
debounce,
|
|
1448
|
+
feel,
|
|
1353
1449
|
label,
|
|
1354
1450
|
getValue,
|
|
1355
1451
|
setValue,
|
|
@@ -1369,6 +1465,7 @@ function TextAreaEntry(props) {
|
|
|
1369
1465
|
rows: rows,
|
|
1370
1466
|
debounce: debounce,
|
|
1371
1467
|
monospace: monospace,
|
|
1468
|
+
feel: feel,
|
|
1372
1469
|
disabled: disabled
|
|
1373
1470
|
}), jsx(Description, {
|
|
1374
1471
|
forId: id,
|
|
@@ -1392,6 +1489,7 @@ function Textfield(props) {
|
|
|
1392
1489
|
id,
|
|
1393
1490
|
label,
|
|
1394
1491
|
onInput,
|
|
1492
|
+
feel = false,
|
|
1395
1493
|
value = ''
|
|
1396
1494
|
} = props;
|
|
1397
1495
|
const handleInput = useMemo(() => {
|
|
@@ -1401,10 +1499,13 @@ function Textfield(props) {
|
|
|
1401
1499
|
}, [onInput, debounce]);
|
|
1402
1500
|
return jsxs("div", {
|
|
1403
1501
|
class: "bio-properties-panel-textfield",
|
|
1404
|
-
children: [
|
|
1502
|
+
children: [jsxs("label", {
|
|
1405
1503
|
for: prefixId$1(id),
|
|
1406
1504
|
class: "bio-properties-panel-label",
|
|
1407
|
-
children: label
|
|
1505
|
+
children: [label, feel && jsx(FeelIcon, {
|
|
1506
|
+
feel: feel,
|
|
1507
|
+
label: label
|
|
1508
|
+
})]
|
|
1408
1509
|
}), jsx("input", {
|
|
1409
1510
|
id: prefixId$1(id),
|
|
1410
1511
|
type: "text",
|
|
@@ -1420,17 +1521,17 @@ function Textfield(props) {
|
|
|
1420
1521
|
})]
|
|
1421
1522
|
});
|
|
1422
1523
|
}
|
|
1423
|
-
/**
|
|
1424
|
-
* @param {Object} props
|
|
1425
|
-
* @param {Object} props.element
|
|
1426
|
-
* @param {String} props.id
|
|
1427
|
-
* @param {String} props.description
|
|
1428
|
-
* @param {Boolean} props.debounce
|
|
1429
|
-
* @param {Boolean} props.disabled
|
|
1430
|
-
* @param {String} props.label
|
|
1431
|
-
* @param {Function} props.getValue
|
|
1432
|
-
* @param {Function} props.setValue
|
|
1433
|
-
* @param {Function} props.validate
|
|
1524
|
+
/**
|
|
1525
|
+
* @param {Object} props
|
|
1526
|
+
* @param {Object} props.element
|
|
1527
|
+
* @param {String} props.id
|
|
1528
|
+
* @param {String} props.description
|
|
1529
|
+
* @param {Boolean} props.debounce
|
|
1530
|
+
* @param {Boolean} props.disabled
|
|
1531
|
+
* @param {String} props.label
|
|
1532
|
+
* @param {Function} props.getValue
|
|
1533
|
+
* @param {Function} props.setValue
|
|
1534
|
+
* @param {Function} props.validate
|
|
1434
1535
|
*/
|
|
1435
1536
|
|
|
1436
1537
|
|
|
@@ -1441,6 +1542,7 @@ function TextfieldEntry(props) {
|
|
|
1441
1542
|
description,
|
|
1442
1543
|
debounce,
|
|
1443
1544
|
disabled,
|
|
1545
|
+
feel,
|
|
1444
1546
|
label,
|
|
1445
1547
|
getValue,
|
|
1446
1548
|
setValue,
|
|
@@ -1482,7 +1584,8 @@ function TextfieldEntry(props) {
|
|
|
1482
1584
|
value: value,
|
|
1483
1585
|
onInput: handleChange,
|
|
1484
1586
|
debounce: debounce,
|
|
1485
|
-
disabled: disabled
|
|
1587
|
+
disabled: disabled,
|
|
1588
|
+
feel: feel
|
|
1486
1589
|
}), jsx(Description, {
|
|
1487
1590
|
forId: id,
|
|
1488
1591
|
element: element,
|
|
@@ -1541,15 +1644,15 @@ function ToggleSwitch(props) {
|
|
|
1541
1644
|
})]
|
|
1542
1645
|
});
|
|
1543
1646
|
}
|
|
1544
|
-
/**
|
|
1545
|
-
* @param {Object} props
|
|
1546
|
-
* @param {Object} props.element
|
|
1547
|
-
* @param {String} props.id
|
|
1548
|
-
* @param {String} props.description
|
|
1549
|
-
* @param {String} props.label
|
|
1550
|
-
* @param {String} props.switcherLabel
|
|
1551
|
-
* @param {Function} props.getValue
|
|
1552
|
-
* @param {Function} props.setValue
|
|
1647
|
+
/**
|
|
1648
|
+
* @param {Object} props
|
|
1649
|
+
* @param {Object} props.element
|
|
1650
|
+
* @param {String} props.id
|
|
1651
|
+
* @param {String} props.description
|
|
1652
|
+
* @param {String} props.label
|
|
1653
|
+
* @param {String} props.switcherLabel
|
|
1654
|
+
* @param {Function} props.getValue
|
|
1655
|
+
* @param {Function} props.setValue
|
|
1553
1656
|
*/
|
|
1554
1657
|
|
|
1555
1658
|
|
|
@@ -1605,5 +1708,5 @@ var index = {
|
|
|
1605
1708
|
debounceInput: ['factory', debounceInput]
|
|
1606
1709
|
};
|
|
1607
1710
|
|
|
1608
|
-
export { ArrowIcon, CheckboxEntry, CollapsibleEntry, CreateIcon, index as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DropdownButton, Group, Header, HeaderButton, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, PropertiesPanel, SelectEntry, Simple as SimpleEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, isEdited$6 as isCheckboxEntryEdited, isEdited$5 as isNumberFieldEntryEdited, isEdited$4 as isSelectEntryEdited, isEdited$3 as isSimpleEntryEdited, isEdited$2 as isTextAreaEntryEdited, isEdited$1 as isTextFieldEntryEdited, isEdited as isToggleSwitchEntryEdited, useDescriptionContext, useKeyFactory, useLayoutState, usePrevious };
|
|
1711
|
+
export { ArrowIcon, CheckboxEntry, CollapsibleEntry, CreateIcon, index as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DropdownButton, FeelOptionalIcon, FeelRequiredIcon, Group, Header, HeaderButton, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, PropertiesPanel, SelectEntry, Simple as SimpleEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, isEdited$6 as isCheckboxEntryEdited, isEdited$5 as isNumberFieldEntryEdited, isEdited$4 as isSelectEntryEdited, isEdited$3 as isSimpleEntryEdited, isEdited$2 as isTextAreaEntryEdited, isEdited$1 as isTextFieldEntryEdited, isEdited as isToggleSwitchEntryEdited, useDescriptionContext, useKeyFactory, useLayoutState, usePrevious };
|
|
1609
1712
|
//# sourceMappingURL=index.esm.js.map
|