@bpmn-io/properties-panel 3.0.0 → 3.2.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/assets/properties-panel.css +77 -1
- package/dist/index.esm.js +439 -138
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +361 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@ var hooks = require('../preact/hooks');
|
|
|
6
6
|
var minDash = require('min-dash');
|
|
7
7
|
var compat = require('../preact/compat');
|
|
8
8
|
var jsxRuntime = require('../preact/jsx-runtime');
|
|
9
|
+
var preact = require('../preact');
|
|
9
10
|
var classnames = require('classnames');
|
|
10
11
|
var minDom = require('min-dom');
|
|
11
|
-
var preact = require('../preact');
|
|
12
12
|
var feelers = require('feelers');
|
|
13
13
|
var FeelEditor = require('@bpmn-io/feel-editor');
|
|
14
14
|
|
|
@@ -175,6 +175,162 @@ const LayoutContext = preact.createContext({
|
|
|
175
175
|
setLayoutForKey: () => {}
|
|
176
176
|
});
|
|
177
177
|
|
|
178
|
+
const TooltipContext = preact.createContext({
|
|
179
|
+
tooltip: {},
|
|
180
|
+
getTooltipForId: () => {}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Accesses the global TooltipContext and returns a tooltip for a given id and element.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```jsx
|
|
188
|
+
* function TextField(props) {
|
|
189
|
+
* const tooltip = useTooltipContext('input1', element);
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @param {string} id
|
|
194
|
+
* @param {object} element
|
|
195
|
+
*
|
|
196
|
+
* @returns {string}
|
|
197
|
+
*/
|
|
198
|
+
function useTooltipContext(id, element) {
|
|
199
|
+
const {
|
|
200
|
+
getTooltipForId
|
|
201
|
+
} = hooks.useContext(TooltipContext);
|
|
202
|
+
return getTooltipForId(id, element);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function TooltipWrapper(props) {
|
|
206
|
+
const {
|
|
207
|
+
forId,
|
|
208
|
+
element
|
|
209
|
+
} = props;
|
|
210
|
+
const contextDescription = useTooltipContext(forId, element);
|
|
211
|
+
const value = props.value || contextDescription;
|
|
212
|
+
if (!value) {
|
|
213
|
+
return props.children;
|
|
214
|
+
}
|
|
215
|
+
return jsxRuntime.jsx(Tooltip, {
|
|
216
|
+
...props,
|
|
217
|
+
value: value,
|
|
218
|
+
forId: prefixId$8(forId)
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function Tooltip(props) {
|
|
222
|
+
const {
|
|
223
|
+
forId,
|
|
224
|
+
value
|
|
225
|
+
} = props;
|
|
226
|
+
const [visible, setShow] = compat.useState(false);
|
|
227
|
+
let timeout = null;
|
|
228
|
+
const wrapperRef = hooks.useRef(null);
|
|
229
|
+
const tooltipRef = hooks.useRef(null);
|
|
230
|
+
const showTooltip = async event => {
|
|
231
|
+
const show = () => !visible && setShow(true);
|
|
232
|
+
if (event instanceof MouseEvent) {
|
|
233
|
+
timeout = setTimeout(show, 200);
|
|
234
|
+
} else {
|
|
235
|
+
show();
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const hideTooltip = () => setShow(false);
|
|
239
|
+
const hideTooltipViaEscape = e => {
|
|
240
|
+
e.code === 'Escape' && hideTooltip();
|
|
241
|
+
};
|
|
242
|
+
const isTooltipHovered = ({
|
|
243
|
+
x,
|
|
244
|
+
y
|
|
245
|
+
}) => {
|
|
246
|
+
const tooltip = tooltipRef.current;
|
|
247
|
+
const wrapper = wrapperRef.current;
|
|
248
|
+
return tooltip && (inBounds(x, y, wrapper.getBoundingClientRect()) || inBounds(x, y, tooltip.getBoundingClientRect()));
|
|
249
|
+
};
|
|
250
|
+
compat.useEffect(() => {
|
|
251
|
+
const {
|
|
252
|
+
current
|
|
253
|
+
} = wrapperRef;
|
|
254
|
+
if (!current) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const hideHoveredTooltip = e => {
|
|
258
|
+
const isFocused = document.activeElement === wrapperRef.current || document.activeElement.closest('.bio-properties-panel-tooltip');
|
|
259
|
+
if (visible && !isTooltipHovered({
|
|
260
|
+
x: e.x,
|
|
261
|
+
y: e.y
|
|
262
|
+
}) && !isFocused) {
|
|
263
|
+
hideTooltip();
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const hideFocusedTooltip = e => {
|
|
267
|
+
const {
|
|
268
|
+
relatedTarget
|
|
269
|
+
} = e;
|
|
270
|
+
const isTooltipChild = el => el && !!el.closest('.bio-properties-panel-tooltip');
|
|
271
|
+
if (visible && !isHovered(wrapperRef.current) && !isTooltipChild(relatedTarget)) {
|
|
272
|
+
hideTooltip();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
document.addEventListener('focusout', hideFocusedTooltip);
|
|
276
|
+
document.addEventListener('mousemove', hideHoveredTooltip);
|
|
277
|
+
return () => {
|
|
278
|
+
document.removeEventListener('mousemove', hideHoveredTooltip);
|
|
279
|
+
document.removeEventListener('focusout', hideFocusedTooltip);
|
|
280
|
+
};
|
|
281
|
+
}, [wrapperRef.current, visible]);
|
|
282
|
+
return jsxRuntime.jsxs("div", {
|
|
283
|
+
class: "bio-properties-panel-tooltip-wrapper",
|
|
284
|
+
tabIndex: "0",
|
|
285
|
+
ref: wrapperRef,
|
|
286
|
+
onMouseEnter: showTooltip,
|
|
287
|
+
onMouseLeave: () => clearTimeout(timeout),
|
|
288
|
+
onFocus: showTooltip,
|
|
289
|
+
onKeyDown: hideTooltipViaEscape,
|
|
290
|
+
onMouseDown: e => {
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
},
|
|
293
|
+
children: [props.children, visible ? jsxRuntime.jsxs("div", {
|
|
294
|
+
class: "bio-properties-panel-tooltip",
|
|
295
|
+
role: "tooltip",
|
|
296
|
+
id: "bio-properties-panel-tooltip",
|
|
297
|
+
"aria-labelledby": forId,
|
|
298
|
+
style: getTooltipPosition(wrapperRef.current),
|
|
299
|
+
ref: tooltipRef,
|
|
300
|
+
onClick: e => e.stopPropagation(),
|
|
301
|
+
children: [jsxRuntime.jsx("div", {
|
|
302
|
+
class: "bio-properties-panel-tooltip-content",
|
|
303
|
+
children: value
|
|
304
|
+
}), jsxRuntime.jsx("div", {
|
|
305
|
+
class: "bio-properties-panel-tooltip-arrow"
|
|
306
|
+
})]
|
|
307
|
+
}) : null]
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// helper
|
|
312
|
+
function inBounds(x, y, bounds) {
|
|
313
|
+
const {
|
|
314
|
+
top,
|
|
315
|
+
right,
|
|
316
|
+
bottom,
|
|
317
|
+
left
|
|
318
|
+
} = bounds;
|
|
319
|
+
return x >= left && x <= right && y >= top && y <= bottom;
|
|
320
|
+
}
|
|
321
|
+
function getTooltipPosition(refElement) {
|
|
322
|
+
const refPosition = refElement.getBoundingClientRect();
|
|
323
|
+
const right = `calc(100% - ${refPosition.x}px)`;
|
|
324
|
+
const top = `${refPosition.top - 10}px`;
|
|
325
|
+
return `right: ${right}; top: ${top};`;
|
|
326
|
+
}
|
|
327
|
+
function isHovered(element) {
|
|
328
|
+
return element.matches(':hover');
|
|
329
|
+
}
|
|
330
|
+
function prefixId$8(id) {
|
|
331
|
+
return `bio-properties-panel-${id}`;
|
|
332
|
+
}
|
|
333
|
+
|
|
178
334
|
/**
|
|
179
335
|
* Accesses the global DescriptionContext and returns a description for a given id and element.
|
|
180
336
|
*
|
|
@@ -203,6 +359,12 @@ function useError(id) {
|
|
|
203
359
|
} = hooks.useContext(ErrorsContext);
|
|
204
360
|
return errors[id];
|
|
205
361
|
}
|
|
362
|
+
function useErrors() {
|
|
363
|
+
const {
|
|
364
|
+
errors
|
|
365
|
+
} = hooks.useContext(ErrorsContext);
|
|
366
|
+
return errors;
|
|
367
|
+
}
|
|
206
368
|
|
|
207
369
|
/**
|
|
208
370
|
* Subscribe to an event immediately. Update subscription after inputs changed.
|
|
@@ -469,6 +631,10 @@ function Group(props) {
|
|
|
469
631
|
setEdited(hasOneEditedEntry);
|
|
470
632
|
}, [entries]);
|
|
471
633
|
|
|
634
|
+
// set error state depending on all entries
|
|
635
|
+
const allErrors = useErrors();
|
|
636
|
+
const hasErrors = entries.some(entry => allErrors[entry.id]);
|
|
637
|
+
|
|
472
638
|
// set css class when group is sticky to top
|
|
473
639
|
useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
|
|
474
640
|
const propertiesPanelContext = {
|
|
@@ -485,10 +651,18 @@ function Group(props) {
|
|
|
485
651
|
children: [jsxRuntime.jsx("div", {
|
|
486
652
|
title: label,
|
|
487
653
|
class: "bio-properties-panel-group-header-title",
|
|
488
|
-
children:
|
|
654
|
+
children: jsxRuntime.jsx(TooltipWrapper, {
|
|
655
|
+
value: props.tooltip,
|
|
656
|
+
forId: 'group-' + id,
|
|
657
|
+
element: element,
|
|
658
|
+
children: label
|
|
659
|
+
})
|
|
489
660
|
}), jsxRuntime.jsxs("div", {
|
|
490
661
|
class: "bio-properties-panel-group-header-buttons",
|
|
491
|
-
children: [
|
|
662
|
+
children: [jsxRuntime.jsx(DataMarker, {
|
|
663
|
+
edited: edited,
|
|
664
|
+
hasErrors: hasErrors
|
|
665
|
+
}), jsxRuntime.jsx("button", {
|
|
492
666
|
title: "Toggle section",
|
|
493
667
|
class: "bio-properties-panel-group-header-button bio-properties-panel-arrow",
|
|
494
668
|
children: jsxRuntime.jsx(ArrowIcon, {
|
|
@@ -515,11 +689,24 @@ function Group(props) {
|
|
|
515
689
|
})]
|
|
516
690
|
});
|
|
517
691
|
}
|
|
518
|
-
function DataMarker() {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
}
|
|
692
|
+
function DataMarker(props) {
|
|
693
|
+
const {
|
|
694
|
+
edited,
|
|
695
|
+
hasErrors
|
|
696
|
+
} = props;
|
|
697
|
+
if (hasErrors) {
|
|
698
|
+
return jsxRuntime.jsx("div", {
|
|
699
|
+
title: "Section contains an error",
|
|
700
|
+
class: "bio-properties-panel-dot bio-properties-panel-dot--error"
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
if (edited) {
|
|
704
|
+
return jsxRuntime.jsx("div", {
|
|
705
|
+
title: "Section contains data",
|
|
706
|
+
class: "bio-properties-panel-dot"
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
return null;
|
|
523
710
|
}
|
|
524
711
|
|
|
525
712
|
/**
|
|
@@ -551,6 +738,7 @@ function Placeholder(props) {
|
|
|
551
738
|
|
|
552
739
|
const DEFAULT_LAYOUT = {};
|
|
553
740
|
const DEFAULT_DESCRIPTION = {};
|
|
741
|
+
const DEFAULT_TOOLTIP = {};
|
|
554
742
|
|
|
555
743
|
/**
|
|
556
744
|
* @typedef { {
|
|
@@ -591,12 +779,22 @@ const DEFAULT_DESCRIPTION = {};
|
|
|
591
779
|
* [id: String]: GetDescriptionFunction
|
|
592
780
|
* } } DescriptionConfig
|
|
593
781
|
*
|
|
782
|
+
* @typedef { {
|
|
783
|
+
* [id: String]: GetTooltipFunction
|
|
784
|
+
* } } TooltipConfig
|
|
785
|
+
*
|
|
594
786
|
* @callback { {
|
|
595
787
|
* @param {string} id
|
|
596
788
|
* @param {Object} element
|
|
597
789
|
* @returns {string}
|
|
598
790
|
* } } GetDescriptionFunction
|
|
599
791
|
*
|
|
792
|
+
* @callback { {
|
|
793
|
+
* @param {string} id
|
|
794
|
+
* @param {Object} element
|
|
795
|
+
* @returns {string}
|
|
796
|
+
* } } GetTooltipFunction
|
|
797
|
+
*
|
|
600
798
|
* @typedef { {
|
|
601
799
|
* getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
|
|
602
800
|
* getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
|
|
@@ -617,6 +815,8 @@ const DEFAULT_DESCRIPTION = {};
|
|
|
617
815
|
* @param {Function} [props.layoutChanged]
|
|
618
816
|
* @param {DescriptionConfig} [props.descriptionConfig]
|
|
619
817
|
* @param {Function} [props.descriptionLoaded]
|
|
818
|
+
* @param {TooltipConfig} [props.tooltipConfig]
|
|
819
|
+
* @param {Function} [props.tooltipLoaded]
|
|
620
820
|
* @param {Object} [props.eventBus]
|
|
621
821
|
*/
|
|
622
822
|
function PropertiesPanel(props) {
|
|
@@ -629,6 +829,8 @@ function PropertiesPanel(props) {
|
|
|
629
829
|
layoutChanged,
|
|
630
830
|
descriptionConfig,
|
|
631
831
|
descriptionLoaded,
|
|
832
|
+
tooltipConfig,
|
|
833
|
+
tooltipLoaded,
|
|
632
834
|
eventBus
|
|
633
835
|
} = props;
|
|
634
836
|
|
|
@@ -674,6 +876,21 @@ function PropertiesPanel(props) {
|
|
|
674
876
|
description,
|
|
675
877
|
getDescriptionForId
|
|
676
878
|
};
|
|
879
|
+
|
|
880
|
+
// set-up tooltip context
|
|
881
|
+
const tooltip = hooks.useMemo(() => createTooltipContext(tooltipConfig), [tooltipConfig]);
|
|
882
|
+
hooks.useEffect(() => {
|
|
883
|
+
if (typeof tooltipLoaded === 'function') {
|
|
884
|
+
tooltipLoaded(tooltip);
|
|
885
|
+
}
|
|
886
|
+
}, [tooltip, tooltipLoaded]);
|
|
887
|
+
const getTooltipForId = (id, element) => {
|
|
888
|
+
return tooltip[id] && tooltip[id](element);
|
|
889
|
+
};
|
|
890
|
+
const tooltipContext = {
|
|
891
|
+
tooltip,
|
|
892
|
+
getTooltipForId
|
|
893
|
+
};
|
|
677
894
|
const [errors, setErrors] = hooks.useState({});
|
|
678
895
|
const onSetErrors = ({
|
|
679
896
|
errors
|
|
@@ -708,29 +925,32 @@ function PropertiesPanel(props) {
|
|
|
708
925
|
value: errorsContext,
|
|
709
926
|
children: jsxRuntime.jsx(DescriptionContext.Provider, {
|
|
710
927
|
value: descriptionContext,
|
|
711
|
-
children: jsxRuntime.jsx(
|
|
712
|
-
value:
|
|
713
|
-
children: jsxRuntime.jsx(
|
|
714
|
-
value:
|
|
715
|
-
children: jsxRuntime.
|
|
716
|
-
|
|
717
|
-
children:
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
928
|
+
children: jsxRuntime.jsx(TooltipContext.Provider, {
|
|
929
|
+
value: tooltipContext,
|
|
930
|
+
children: jsxRuntime.jsx(LayoutContext.Provider, {
|
|
931
|
+
value: layoutContext,
|
|
932
|
+
children: jsxRuntime.jsx(EventContext.Provider, {
|
|
933
|
+
value: eventContext,
|
|
934
|
+
children: jsxRuntime.jsxs("div", {
|
|
935
|
+
class: "bio-properties-panel",
|
|
936
|
+
children: [jsxRuntime.jsx(Header, {
|
|
937
|
+
element: element,
|
|
938
|
+
headerProvider: headerProvider
|
|
939
|
+
}), jsxRuntime.jsx("div", {
|
|
940
|
+
class: "bio-properties-panel-scroll-container",
|
|
941
|
+
children: groups.map(group => {
|
|
942
|
+
const {
|
|
943
|
+
component: Component = Group,
|
|
944
|
+
id
|
|
945
|
+
} = group;
|
|
946
|
+
return preact.createElement(Component, {
|
|
947
|
+
...group,
|
|
948
|
+
key: id,
|
|
949
|
+
element: element
|
|
950
|
+
});
|
|
951
|
+
})
|
|
952
|
+
})]
|
|
953
|
+
})
|
|
734
954
|
})
|
|
735
955
|
})
|
|
736
956
|
})
|
|
@@ -753,6 +973,12 @@ function createDescriptionContext(overrides = {}) {
|
|
|
753
973
|
...overrides
|
|
754
974
|
};
|
|
755
975
|
}
|
|
976
|
+
function createTooltipContext(overrides = {}) {
|
|
977
|
+
return {
|
|
978
|
+
...DEFAULT_TOOLTIP,
|
|
979
|
+
...overrides
|
|
980
|
+
};
|
|
981
|
+
}
|
|
756
982
|
|
|
757
983
|
// hooks //////////////////
|
|
758
984
|
|
|
@@ -1087,6 +1313,18 @@ function ListGroup(props) {
|
|
|
1087
1313
|
setAddTriggered(true);
|
|
1088
1314
|
add(e);
|
|
1089
1315
|
};
|
|
1316
|
+
const allErrors = useErrors();
|
|
1317
|
+
const hasError = items.some(item => {
|
|
1318
|
+
if (allErrors[item.id]) {
|
|
1319
|
+
return true;
|
|
1320
|
+
}
|
|
1321
|
+
if (!item.entries) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// also check if the error is nested, e.g. for name-value entries
|
|
1326
|
+
return item.entries.some(entry => allErrors[entry.id]);
|
|
1327
|
+
});
|
|
1090
1328
|
return jsxRuntime.jsxs("div", {
|
|
1091
1329
|
class: "bio-properties-panel-group",
|
|
1092
1330
|
"data-group-id": 'group-' + id,
|
|
@@ -1097,7 +1335,12 @@ function ListGroup(props) {
|
|
|
1097
1335
|
children: [jsxRuntime.jsx("div", {
|
|
1098
1336
|
title: label,
|
|
1099
1337
|
class: "bio-properties-panel-group-header-title",
|
|
1100
|
-
children:
|
|
1338
|
+
children: jsxRuntime.jsx(TooltipWrapper, {
|
|
1339
|
+
value: props.tooltip,
|
|
1340
|
+
forId: 'group-' + id,
|
|
1341
|
+
element: element,
|
|
1342
|
+
children: label
|
|
1343
|
+
})
|
|
1101
1344
|
}), jsxRuntime.jsxs("div", {
|
|
1102
1345
|
class: "bio-properties-panel-group-header-buttons",
|
|
1103
1346
|
children: [add ? jsxRuntime.jsxs("button", {
|
|
@@ -1110,7 +1353,7 @@ function ListGroup(props) {
|
|
|
1110
1353
|
}) : null]
|
|
1111
1354
|
}) : null, hasItems ? jsxRuntime.jsx("div", {
|
|
1112
1355
|
title: `List contains ${items.length} item${items.length != 1 ? 's' : ''}`,
|
|
1113
|
-
class: "bio-properties-panel-list-badge
|
|
1356
|
+
class: classnames__default["default"]('bio-properties-panel-list-badge', hasError ? 'bio-properties-panel-list-badge--error' : ''),
|
|
1114
1357
|
children: items.length
|
|
1115
1358
|
}) : null, hasItems ? jsxRuntime.jsx("button", {
|
|
1116
1359
|
title: "Toggle section",
|
|
@@ -1188,7 +1431,8 @@ function Checkbox(props) {
|
|
|
1188
1431
|
disabled,
|
|
1189
1432
|
value = false,
|
|
1190
1433
|
onFocus,
|
|
1191
|
-
onBlur
|
|
1434
|
+
onBlur,
|
|
1435
|
+
tooltip
|
|
1192
1436
|
} = props;
|
|
1193
1437
|
const [localValue, setLocalValue] = hooks.useState(value);
|
|
1194
1438
|
const handleChangeCallback = ({
|
|
@@ -1223,7 +1467,12 @@ function Checkbox(props) {
|
|
|
1223
1467
|
}), jsxRuntime.jsx("label", {
|
|
1224
1468
|
for: prefixId$7(id),
|
|
1225
1469
|
class: "bio-properties-panel-label",
|
|
1226
|
-
children:
|
|
1470
|
+
children: jsxRuntime.jsx(TooltipWrapper, {
|
|
1471
|
+
value: tooltip,
|
|
1472
|
+
forId: id,
|
|
1473
|
+
element: props.element,
|
|
1474
|
+
children: label
|
|
1475
|
+
})
|
|
1227
1476
|
})]
|
|
1228
1477
|
});
|
|
1229
1478
|
}
|
|
@@ -1238,6 +1487,7 @@ function Checkbox(props) {
|
|
|
1238
1487
|
* @param {Function} props.setValue
|
|
1239
1488
|
* @param {Function} props.onFocus
|
|
1240
1489
|
* @param {Function} props.onBlur
|
|
1490
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
1241
1491
|
* @param {boolean} [props.disabled]
|
|
1242
1492
|
*/
|
|
1243
1493
|
function CheckboxEntry(props) {
|
|
@@ -1250,7 +1500,8 @@ function CheckboxEntry(props) {
|
|
|
1250
1500
|
setValue,
|
|
1251
1501
|
disabled,
|
|
1252
1502
|
onFocus,
|
|
1253
|
-
onBlur
|
|
1503
|
+
onBlur,
|
|
1504
|
+
tooltip
|
|
1254
1505
|
} = props;
|
|
1255
1506
|
const value = getValue(element);
|
|
1256
1507
|
const error = useError(id);
|
|
@@ -1264,7 +1515,9 @@ function CheckboxEntry(props) {
|
|
|
1264
1515
|
onChange: setValue,
|
|
1265
1516
|
onFocus: onFocus,
|
|
1266
1517
|
onBlur: onBlur,
|
|
1267
|
-
value: value
|
|
1518
|
+
value: value,
|
|
1519
|
+
tooltip: tooltip,
|
|
1520
|
+
element: element
|
|
1268
1521
|
}, element), error && jsxRuntime.jsx("div", {
|
|
1269
1522
|
class: "bio-properties-panel-error",
|
|
1270
1523
|
children: error
|
|
@@ -1526,7 +1779,8 @@ function ToggleSwitch(props) {
|
|
|
1526
1779
|
inline,
|
|
1527
1780
|
onFocus,
|
|
1528
1781
|
onBlur,
|
|
1529
|
-
inputRef
|
|
1782
|
+
inputRef,
|
|
1783
|
+
tooltip
|
|
1530
1784
|
} = props;
|
|
1531
1785
|
const [localValue, setLocalValue] = hooks.useState(value);
|
|
1532
1786
|
const handleInputCallback = async () => {
|
|
@@ -1549,7 +1803,12 @@ function ToggleSwitch(props) {
|
|
|
1549
1803
|
children: [jsxRuntime.jsx("label", {
|
|
1550
1804
|
class: "bio-properties-panel-label",
|
|
1551
1805
|
for: prefixId$6(id),
|
|
1552
|
-
children:
|
|
1806
|
+
children: jsxRuntime.jsx(TooltipWrapper, {
|
|
1807
|
+
value: tooltip,
|
|
1808
|
+
forId: id,
|
|
1809
|
+
element: props.element,
|
|
1810
|
+
children: label
|
|
1811
|
+
})
|
|
1553
1812
|
}), jsxRuntime.jsxs("div", {
|
|
1554
1813
|
class: "bio-properties-panel-field-wrapper",
|
|
1555
1814
|
children: [jsxRuntime.jsxs("label", {
|
|
@@ -1587,6 +1846,7 @@ function ToggleSwitch(props) {
|
|
|
1587
1846
|
* @param {Function} props.setValue
|
|
1588
1847
|
* @param {Function} props.onFocus
|
|
1589
1848
|
* @param {Function} props.onBlur
|
|
1849
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
1590
1850
|
*/
|
|
1591
1851
|
function ToggleSwitchEntry(props) {
|
|
1592
1852
|
const {
|
|
@@ -1599,7 +1859,8 @@ function ToggleSwitchEntry(props) {
|
|
|
1599
1859
|
getValue,
|
|
1600
1860
|
setValue,
|
|
1601
1861
|
onFocus,
|
|
1602
|
-
onBlur
|
|
1862
|
+
onBlur,
|
|
1863
|
+
tooltip
|
|
1603
1864
|
} = props;
|
|
1604
1865
|
const value = getValue(element);
|
|
1605
1866
|
return jsxRuntime.jsxs("div", {
|
|
@@ -1613,7 +1874,9 @@ function ToggleSwitchEntry(props) {
|
|
|
1613
1874
|
onFocus: onFocus,
|
|
1614
1875
|
onBlur: onBlur,
|
|
1615
1876
|
switcherLabel: switcherLabel,
|
|
1616
|
-
inline: inline
|
|
1877
|
+
inline: inline,
|
|
1878
|
+
tooltip: tooltip,
|
|
1879
|
+
element: element
|
|
1617
1880
|
}), jsxRuntime.jsx(Description, {
|
|
1618
1881
|
forId: id,
|
|
1619
1882
|
element: element,
|
|
@@ -1795,7 +2058,8 @@ function FeelTextfield(props) {
|
|
|
1795
2058
|
disabled = false,
|
|
1796
2059
|
variables,
|
|
1797
2060
|
tooltipContainer,
|
|
1798
|
-
OptionalComponent = OptionalFeelInput
|
|
2061
|
+
OptionalComponent = OptionalFeelInput,
|
|
2062
|
+
tooltip
|
|
1799
2063
|
} = props;
|
|
1800
2064
|
const [localValue, _setLocalValue] = hooks.useState(value);
|
|
1801
2065
|
const editorRef = useShowEntryEvent(id);
|
|
@@ -1911,7 +2175,12 @@ function FeelTextfield(props) {
|
|
|
1911
2175
|
for: prefixId$4(id),
|
|
1912
2176
|
class: "bio-properties-panel-label",
|
|
1913
2177
|
onClick: () => setFocus(),
|
|
1914
|
-
children: [
|
|
2178
|
+
children: [jsxRuntime.jsx(TooltipWrapper, {
|
|
2179
|
+
value: tooltip,
|
|
2180
|
+
forId: id,
|
|
2181
|
+
element: props.element,
|
|
2182
|
+
children: label
|
|
2183
|
+
}), jsxRuntime.jsx(FeelIcon, {
|
|
1915
2184
|
label: label,
|
|
1916
2185
|
feel: feel,
|
|
1917
2186
|
onClick: handleFeelToggle,
|
|
@@ -2171,6 +2440,7 @@ const OptionalFeelCheckbox = compat.forwardRef((props, ref) => {
|
|
|
2171
2440
|
* @param {Function} props.variables
|
|
2172
2441
|
* @param {Function} props.onFocus
|
|
2173
2442
|
* @param {Function} props.onBlur
|
|
2443
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
2174
2444
|
*/
|
|
2175
2445
|
function FeelEntry(props) {
|
|
2176
2446
|
const {
|
|
@@ -2191,7 +2461,8 @@ function FeelEntry(props) {
|
|
|
2191
2461
|
example,
|
|
2192
2462
|
variables,
|
|
2193
2463
|
onFocus,
|
|
2194
|
-
onBlur
|
|
2464
|
+
onBlur,
|
|
2465
|
+
tooltip
|
|
2195
2466
|
} = props;
|
|
2196
2467
|
const [validationError, setValidationError] = hooks.useState(null);
|
|
2197
2468
|
const [localError, setLocalError] = hooks.useState(null);
|
|
@@ -2241,7 +2512,8 @@ function FeelEntry(props) {
|
|
|
2241
2512
|
value: value,
|
|
2242
2513
|
variables: variables,
|
|
2243
2514
|
tooltipContainer: tooltipContainer,
|
|
2244
|
-
OptionalComponent: props.OptionalComponent
|
|
2515
|
+
OptionalComponent: props.OptionalComponent,
|
|
2516
|
+
tooltip: tooltip
|
|
2245
2517
|
}), error && jsxRuntime.jsx("div", {
|
|
2246
2518
|
class: "bio-properties-panel-error",
|
|
2247
2519
|
children: error
|
|
@@ -2765,7 +3037,8 @@ function Select(props) {
|
|
|
2765
3037
|
value = '',
|
|
2766
3038
|
disabled,
|
|
2767
3039
|
onFocus,
|
|
2768
|
-
onBlur
|
|
3040
|
+
onBlur,
|
|
3041
|
+
tooltip
|
|
2769
3042
|
} = props;
|
|
2770
3043
|
const ref = useShowEntryEvent(id);
|
|
2771
3044
|
const [localValue, setLocalValue] = hooks.useState(value);
|
|
@@ -2789,7 +3062,12 @@ function Select(props) {
|
|
|
2789
3062
|
children: [jsxRuntime.jsx("label", {
|
|
2790
3063
|
for: prefixId$3(id),
|
|
2791
3064
|
class: "bio-properties-panel-label",
|
|
2792
|
-
children:
|
|
3065
|
+
children: jsxRuntime.jsx(TooltipWrapper, {
|
|
3066
|
+
value: tooltip,
|
|
3067
|
+
forId: id,
|
|
3068
|
+
element: props.element,
|
|
3069
|
+
children: label
|
|
3070
|
+
})
|
|
2793
3071
|
}), jsxRuntime.jsx("select", {
|
|
2794
3072
|
ref: ref,
|
|
2795
3073
|
id: prefixId$3(id),
|
|
@@ -2834,6 +3112,7 @@ function Select(props) {
|
|
|
2834
3112
|
* @param {Function} props.getOptions
|
|
2835
3113
|
* @param {boolean} [props.disabled]
|
|
2836
3114
|
* @param {Function} [props.validate]
|
|
3115
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
2837
3116
|
*/
|
|
2838
3117
|
function SelectEntry(props) {
|
|
2839
3118
|
const {
|
|
@@ -2847,7 +3126,8 @@ function SelectEntry(props) {
|
|
|
2847
3126
|
disabled,
|
|
2848
3127
|
onFocus,
|
|
2849
3128
|
onBlur,
|
|
2850
|
-
validate
|
|
3129
|
+
validate,
|
|
3130
|
+
tooltip
|
|
2851
3131
|
} = props;
|
|
2852
3132
|
const options = getOptions(element);
|
|
2853
3133
|
const globalError = useError(id);
|
|
@@ -2879,7 +3159,9 @@ function SelectEntry(props) {
|
|
|
2879
3159
|
onFocus: onFocus,
|
|
2880
3160
|
onBlur: onBlur,
|
|
2881
3161
|
options: options,
|
|
2882
|
-
disabled: disabled
|
|
3162
|
+
disabled: disabled,
|
|
3163
|
+
tooltip: tooltip,
|
|
3164
|
+
element: element
|
|
2883
3165
|
}, element), error && jsxRuntime.jsx("div", {
|
|
2884
3166
|
class: "bio-properties-panel-error",
|
|
2885
3167
|
children: error
|
|
@@ -2975,7 +3257,8 @@ function TextArea(props) {
|
|
|
2975
3257
|
onFocus,
|
|
2976
3258
|
onBlur,
|
|
2977
3259
|
autoResize,
|
|
2978
|
-
rows = autoResize ? 1 : 2
|
|
3260
|
+
rows = autoResize ? 1 : 2,
|
|
3261
|
+
tooltip
|
|
2979
3262
|
} = props;
|
|
2980
3263
|
const [localValue, setLocalValue] = hooks.useState(value);
|
|
2981
3264
|
const ref = useShowEntryEvent(id);
|
|
@@ -3003,7 +3286,12 @@ function TextArea(props) {
|
|
|
3003
3286
|
children: [jsxRuntime.jsx("label", {
|
|
3004
3287
|
for: prefixId$1(id),
|
|
3005
3288
|
class: "bio-properties-panel-label",
|
|
3006
|
-
children:
|
|
3289
|
+
children: jsxRuntime.jsx(TooltipWrapper, {
|
|
3290
|
+
value: tooltip,
|
|
3291
|
+
forId: id,
|
|
3292
|
+
element: props.element,
|
|
3293
|
+
children: label
|
|
3294
|
+
})
|
|
3007
3295
|
}), jsxRuntime.jsx("textarea", {
|
|
3008
3296
|
ref: ref,
|
|
3009
3297
|
id: prefixId$1(id),
|
|
@@ -3052,7 +3340,8 @@ function TextAreaEntry(props) {
|
|
|
3052
3340
|
validate,
|
|
3053
3341
|
onFocus,
|
|
3054
3342
|
onBlur,
|
|
3055
|
-
autoResize
|
|
3343
|
+
autoResize,
|
|
3344
|
+
tooltip
|
|
3056
3345
|
} = props;
|
|
3057
3346
|
const globalError = useError(id);
|
|
3058
3347
|
const [localError, setLocalError] = hooks.useState(null);
|
|
@@ -3086,7 +3375,9 @@ function TextAreaEntry(props) {
|
|
|
3086
3375
|
debounce: debounce,
|
|
3087
3376
|
monospace: monospace,
|
|
3088
3377
|
disabled: disabled,
|
|
3089
|
-
autoResize: autoResize
|
|
3378
|
+
autoResize: autoResize,
|
|
3379
|
+
tooltip: tooltip,
|
|
3380
|
+
element: element
|
|
3090
3381
|
}, element), error && jsxRuntime.jsx("div", {
|
|
3091
3382
|
class: "bio-properties-panel-error",
|
|
3092
3383
|
children: error
|
|
@@ -3116,7 +3407,8 @@ function Textfield(props) {
|
|
|
3116
3407
|
onInput,
|
|
3117
3408
|
onFocus,
|
|
3118
3409
|
onBlur,
|
|
3119
|
-
value = ''
|
|
3410
|
+
value = '',
|
|
3411
|
+
tooltip
|
|
3120
3412
|
} = props;
|
|
3121
3413
|
const [localValue, setLocalValue] = hooks.useState(value || '');
|
|
3122
3414
|
const ref = useShowEntryEvent(id);
|
|
@@ -3140,7 +3432,12 @@ function Textfield(props) {
|
|
|
3140
3432
|
children: [jsxRuntime.jsx("label", {
|
|
3141
3433
|
for: prefixId(id),
|
|
3142
3434
|
class: "bio-properties-panel-label",
|
|
3143
|
-
children:
|
|
3435
|
+
children: jsxRuntime.jsx(TooltipWrapper, {
|
|
3436
|
+
value: tooltip,
|
|
3437
|
+
forId: id,
|
|
3438
|
+
element: props.element,
|
|
3439
|
+
children: label
|
|
3440
|
+
})
|
|
3144
3441
|
}), jsxRuntime.jsx("input", {
|
|
3145
3442
|
ref: ref,
|
|
3146
3443
|
id: prefixId(id),
|
|
@@ -3170,6 +3467,7 @@ function Textfield(props) {
|
|
|
3170
3467
|
* @param {Function} props.setValue
|
|
3171
3468
|
* @param {Function} props.onFocus
|
|
3172
3469
|
* @param {Function} props.onBlur
|
|
3470
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
3173
3471
|
* @param {Function} props.validate
|
|
3174
3472
|
*/
|
|
3175
3473
|
function TextfieldEntry(props) {
|
|
@@ -3184,7 +3482,8 @@ function TextfieldEntry(props) {
|
|
|
3184
3482
|
setValue,
|
|
3185
3483
|
validate,
|
|
3186
3484
|
onFocus,
|
|
3187
|
-
onBlur
|
|
3485
|
+
onBlur,
|
|
3486
|
+
tooltip
|
|
3188
3487
|
} = props;
|
|
3189
3488
|
const globalError = useError(id);
|
|
3190
3489
|
const [localError, setLocalError] = hooks.useState(null);
|
|
@@ -3215,7 +3514,9 @@ function TextfieldEntry(props) {
|
|
|
3215
3514
|
onInput: onInput,
|
|
3216
3515
|
onFocus: onFocus,
|
|
3217
3516
|
onBlur: onBlur,
|
|
3218
|
-
value: value
|
|
3517
|
+
value: value,
|
|
3518
|
+
tooltip: tooltip,
|
|
3519
|
+
element: element
|
|
3219
3520
|
}, element), error && jsxRuntime.jsx("div", {
|
|
3220
3521
|
class: "bio-properties-panel-error",
|
|
3221
3522
|
children: error
|
|
@@ -3289,6 +3590,7 @@ exports.TemplatingEntry = TemplatingEntry;
|
|
|
3289
3590
|
exports.TextAreaEntry = TextAreaEntry;
|
|
3290
3591
|
exports.TextFieldEntry = TextfieldEntry;
|
|
3291
3592
|
exports.ToggleSwitchEntry = ToggleSwitchEntry;
|
|
3593
|
+
exports.TooltipContext = TooltipContext;
|
|
3292
3594
|
exports.isCheckboxEntryEdited = isEdited$8;
|
|
3293
3595
|
exports.isFeelEntryEdited = isEdited$5;
|
|
3294
3596
|
exports.isNumberFieldEntryEdited = isEdited$6;
|
|
@@ -3300,6 +3602,7 @@ exports.isTextFieldEntryEdited = isEdited;
|
|
|
3300
3602
|
exports.isToggleSwitchEntryEdited = isEdited$7;
|
|
3301
3603
|
exports.useDescriptionContext = useDescriptionContext;
|
|
3302
3604
|
exports.useError = useError;
|
|
3605
|
+
exports.useErrors = useErrors;
|
|
3303
3606
|
exports.useEvent = useEvent;
|
|
3304
3607
|
exports.useKeyFactory = useKeyFactory;
|
|
3305
3608
|
exports.useLayoutState = useLayoutState;
|
|
@@ -3307,4 +3610,5 @@ exports.usePrevious = usePrevious;
|
|
|
3307
3610
|
exports.useShowEntryEvent = useShowEntryEvent;
|
|
3308
3611
|
exports.useStaticCallback = useStaticCallback;
|
|
3309
3612
|
exports.useStickyIntersectionObserver = useStickyIntersectionObserver;
|
|
3613
|
+
exports.useTooltipContext = useTooltipContext;
|
|
3310
3614
|
//# sourceMappingURL=index.js.map
|