@bpmn-io/properties-panel 0.10.2 → 0.11.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 +8 -0
- package/dist/index.esm.js +62 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +61 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -229,8 +229,9 @@ DeleteIcon.defaultProps = {
|
|
|
229
229
|
|
|
230
230
|
function Group(props) {
|
|
231
231
|
const {
|
|
232
|
-
|
|
232
|
+
element,
|
|
233
233
|
entries = [],
|
|
234
|
+
id,
|
|
234
235
|
label
|
|
235
236
|
} = props;
|
|
236
237
|
const [open, setOpen] = useLayoutState(['groups', id, 'open'], false);
|
|
@@ -278,7 +279,16 @@ function Group(props) {
|
|
|
278
279
|
})]
|
|
279
280
|
}), jsxRuntime.jsx("div", {
|
|
280
281
|
class: classnames__default["default"]('bio-properties-panel-group-entries', open ? 'open' : ''),
|
|
281
|
-
children: entries.map(
|
|
282
|
+
children: entries.map(entry => {
|
|
283
|
+
const {
|
|
284
|
+
component: Component,
|
|
285
|
+
id
|
|
286
|
+
} = entry;
|
|
287
|
+
return preact.createElement(Component, { ...entry,
|
|
288
|
+
key: id,
|
|
289
|
+
element: element
|
|
290
|
+
});
|
|
291
|
+
})
|
|
282
292
|
})]
|
|
283
293
|
});
|
|
284
294
|
}
|
|
@@ -296,7 +306,7 @@ const DEFAULT_LAYOUT = {
|
|
|
296
306
|
const DEFAULT_DESCRIPTION = {};
|
|
297
307
|
/**
|
|
298
308
|
* @typedef { {
|
|
299
|
-
* component: import('preact').
|
|
309
|
+
* component: import('preact').Component,
|
|
300
310
|
* id: String,
|
|
301
311
|
* isEdited?: Function
|
|
302
312
|
* } } EntryDefinition
|
|
@@ -424,13 +434,13 @@ function PropertiesPanel(props) {
|
|
|
424
434
|
class: "bio-properties-panel-scroll-container",
|
|
425
435
|
children: groups.map(group => {
|
|
426
436
|
const {
|
|
427
|
-
component:
|
|
437
|
+
component: Component = Group,
|
|
428
438
|
id
|
|
429
439
|
} = group;
|
|
430
|
-
return
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
440
|
+
return preact.createElement(Component, { ...group,
|
|
441
|
+
key: id,
|
|
442
|
+
element: element
|
|
443
|
+
});
|
|
434
444
|
})
|
|
435
445
|
})]
|
|
436
446
|
})
|
|
@@ -563,11 +573,12 @@ function HeaderButton(props) {
|
|
|
563
573
|
|
|
564
574
|
function CollapsibleEntry(props) {
|
|
565
575
|
const {
|
|
566
|
-
|
|
576
|
+
element,
|
|
567
577
|
entries = [],
|
|
578
|
+
id,
|
|
568
579
|
label,
|
|
569
|
-
|
|
570
|
-
|
|
580
|
+
open: shouldOpen,
|
|
581
|
+
remove
|
|
571
582
|
} = props;
|
|
572
583
|
const [open, setOpen] = hooks.useState(shouldOpen);
|
|
573
584
|
|
|
@@ -599,15 +610,24 @@ function CollapsibleEntry(props) {
|
|
|
599
610
|
}) : null]
|
|
600
611
|
}), jsxRuntime.jsx("div", {
|
|
601
612
|
class: classnames__default["default"]('bio-properties-panel-collapsible-entry-entries', open ? 'open' : ''),
|
|
602
|
-
children: entries.map(
|
|
613
|
+
children: entries.map(entry => {
|
|
614
|
+
const {
|
|
615
|
+
component: Component,
|
|
616
|
+
id
|
|
617
|
+
} = entry;
|
|
618
|
+
return preact.createElement(Component, { ...entry,
|
|
619
|
+
key: id,
|
|
620
|
+
element: element
|
|
621
|
+
});
|
|
622
|
+
})
|
|
603
623
|
})]
|
|
604
624
|
});
|
|
605
625
|
}
|
|
606
626
|
|
|
607
627
|
function ListItem(props) {
|
|
608
628
|
const {
|
|
609
|
-
|
|
610
|
-
|
|
629
|
+
autoFocusEntry,
|
|
630
|
+
autoOpen
|
|
611
631
|
} = props; // focus specified entry on auto open
|
|
612
632
|
|
|
613
633
|
hooks.useEffect(() => {
|
|
@@ -640,13 +660,13 @@ const noop = () => {};
|
|
|
640
660
|
|
|
641
661
|
function ListGroup(props) {
|
|
642
662
|
const {
|
|
663
|
+
add,
|
|
643
664
|
element,
|
|
644
665
|
id,
|
|
645
666
|
items,
|
|
646
667
|
label,
|
|
647
|
-
|
|
648
|
-
shouldSort = true
|
|
649
|
-
shouldOpen = true
|
|
668
|
+
shouldOpen = true,
|
|
669
|
+
shouldSort = true
|
|
650
670
|
} = props;
|
|
651
671
|
const [open, setOpen] = useLayoutState(['groups', id, 'open'], false);
|
|
652
672
|
const [ordering, setOrdering] = hooks.useState([]);
|
|
@@ -764,11 +784,16 @@ function ListGroup(props) {
|
|
|
764
784
|
return;
|
|
765
785
|
}
|
|
766
786
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
787
|
+
const {
|
|
788
|
+
id
|
|
789
|
+
} = item;
|
|
790
|
+
return preact.createElement(ListItem, { ...item,
|
|
791
|
+
element: element,
|
|
792
|
+
index: index,
|
|
793
|
+
key: id // if item was added, open first or last item based on ordering
|
|
794
|
+
,
|
|
795
|
+
autoOpen: newItemAdded && (shouldSort ? index === 0 : index === ordering.length - 1)
|
|
796
|
+
});
|
|
772
797
|
})
|
|
773
798
|
})]
|
|
774
799
|
});
|
|
@@ -891,7 +916,7 @@ function List(props) {
|
|
|
891
916
|
id,
|
|
892
917
|
element,
|
|
893
918
|
items = [],
|
|
894
|
-
|
|
919
|
+
component,
|
|
895
920
|
label = '<empty>',
|
|
896
921
|
open: shouldOpen,
|
|
897
922
|
onAdd,
|
|
@@ -961,12 +986,13 @@ function List(props) {
|
|
|
961
986
|
})]
|
|
962
987
|
}), hasItems && jsxRuntime.jsx(ItemsList, {
|
|
963
988
|
autoFocusEntry: autoFocusEntry,
|
|
989
|
+
component: component,
|
|
990
|
+
element: element,
|
|
964
991
|
id: id,
|
|
965
|
-
open: open,
|
|
966
992
|
items: sortedItems,
|
|
967
993
|
newItems: newItems,
|
|
968
994
|
onRemove: onRemove,
|
|
969
|
-
|
|
995
|
+
open: open
|
|
970
996
|
})]
|
|
971
997
|
});
|
|
972
998
|
}
|
|
@@ -974,12 +1000,13 @@ function List(props) {
|
|
|
974
1000
|
function ItemsList(props) {
|
|
975
1001
|
const {
|
|
976
1002
|
autoFocusEntry,
|
|
1003
|
+
component: Component,
|
|
1004
|
+
element,
|
|
977
1005
|
id,
|
|
978
1006
|
items,
|
|
979
1007
|
newItems,
|
|
980
|
-
open,
|
|
981
1008
|
onRemove,
|
|
982
|
-
|
|
1009
|
+
open
|
|
983
1010
|
} = props;
|
|
984
1011
|
const getKey = useKeyFactory();
|
|
985
1012
|
const newItem = newItems[0];
|
|
@@ -1006,7 +1033,13 @@ function ItemsList(props) {
|
|
|
1006
1033
|
const key = getKey(item);
|
|
1007
1034
|
return jsxRuntime.jsxs("li", {
|
|
1008
1035
|
class: "bio-properties-panel-list-entry-item",
|
|
1009
|
-
children: [
|
|
1036
|
+
children: [jsxRuntime.jsx(Component, {
|
|
1037
|
+
element: element,
|
|
1038
|
+
id: id,
|
|
1039
|
+
index: index,
|
|
1040
|
+
item: item,
|
|
1041
|
+
open: item === newItem
|
|
1042
|
+
}), onRemove && jsxRuntime.jsx("button", {
|
|
1010
1043
|
type: "button",
|
|
1011
1044
|
title: "Delete item",
|
|
1012
1045
|
class: "bio-properties-panel-remove-entry bio-properties-panel-remove-list-entry",
|