@openremote/or-tree-menu 1.24.0 → 1.24.2
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/custom-elements-jsx.d.ts +338 -151
- package/dist/umd/index.bundle.js +3 -3
- package/dist/umd/index.bundle.js.map +1 -1
- package/dist/umd/index.js +3 -3
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.orbundle.js +36 -36
- package/dist/umd/index.orbundle.js.map +1 -1
- package/package.json +7 -4
package/custom-elements-jsx.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { *, OrTreeMenu } from "./lib/index.d.ts";
|
|
1
|
+
import type { OrTreeMenu } from "./lib/index.d.ts";
|
|
3
2
|
import type { OrTreeGroup } from "./lib/or-tree-group.d.ts";
|
|
4
3
|
import type { OrTreeNode } from "./lib/or-tree-node.d.ts";
|
|
5
4
|
|
|
@@ -29,7 +28,6 @@ export type ScopedElements<
|
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
type BaseProps<T extends HTMLElement> = {
|
|
32
|
-
|
|
33
31
|
/** Content added between the opening and closing tags of the element */
|
|
34
32
|
children?: any;
|
|
35
33
|
/** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
|
|
@@ -52,6 +50,8 @@ type BaseProps<T extends HTMLElement> = {
|
|
|
52
50
|
key?: string | number;
|
|
53
51
|
/** Specifies the language of the element. */
|
|
54
52
|
lang?: string;
|
|
53
|
+
/** Defines the element's semantic role for accessibility APIs. */
|
|
54
|
+
role?: string;
|
|
55
55
|
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
56
56
|
part?: string;
|
|
57
57
|
/** Use the ref attribute with a variable to assign a DOM element to the variable once the element is rendered. */
|
|
@@ -72,195 +72,376 @@ type BaseProps<T extends HTMLElement> = {
|
|
|
72
72
|
popovertarget?: "top" | "bottom" | "left" | "right" | "auto";
|
|
73
73
|
/** Specifies the action to be performed on a popover element being controlled by a control element. */
|
|
74
74
|
popovertargetaction?: "show" | "hide" | "toggle";
|
|
75
|
-
|
|
76
|
-
} ;
|
|
77
|
-
|
|
78
|
-
type BaseEvents = {
|
|
79
|
-
|
|
80
|
-
|
|
81
75
|
};
|
|
82
76
|
|
|
83
|
-
|
|
77
|
+
type BaseEvents = {};
|
|
84
78
|
|
|
85
79
|
export type OrTreeMenuProps = {
|
|
86
80
|
/** List of node items in the menu.
|
|
87
81
|
Uses the TreeNode format for rendering the OrTreeNode elements. */
|
|
88
|
-
|
|
82
|
+
nodes?: OrTreeMenu["nodes"];
|
|
89
83
|
/** Changes the allowed selection method within the tree.
|
|
90
84
|
Common options are `LEAF`, `SINGLE` and `MULTI`. */
|
|
91
|
-
|
|
85
|
+
selection?: OrTreeMenu["selection"];
|
|
92
86
|
/** Disables and enables dragging of nodes into groups. */
|
|
93
|
-
|
|
87
|
+
draggable?: OrTreeMenu["draggable"];
|
|
94
88
|
/** Removes the header from the tree menu. */
|
|
95
|
-
"no-header"?: OrTreeMenu[
|
|
89
|
+
"no-header"?: OrTreeMenu["noHeader"];
|
|
96
90
|
/** Removes the header from the tree menu. */
|
|
97
|
-
|
|
91
|
+
noHeader?: OrTreeMenu["noHeader"];
|
|
98
92
|
/** Adjusts the title in the menu header. */
|
|
99
|
-
"menu-title"?: OrTreeMenu[
|
|
93
|
+
"menu-title"?: OrTreeMenu["menuTitle"];
|
|
100
94
|
/** Adjusts the title in the menu header. */
|
|
101
|
-
|
|
95
|
+
menuTitle?: OrTreeMenu["menuTitle"];
|
|
102
96
|
/** List of options available to sort the object with */
|
|
103
|
-
"sort-options"?: OrTreeMenu[
|
|
97
|
+
"sort-options"?: OrTreeMenu["sortOptions"];
|
|
104
98
|
/** List of options available to sort the object with */
|
|
105
|
-
|
|
99
|
+
sortOptions?: OrTreeMenu["sortOptions"];
|
|
106
100
|
/** Represents the selected sorting option */
|
|
107
|
-
"sort-by"?: OrTreeMenu[
|
|
101
|
+
"sort-by"?: OrTreeMenu["sortBy"];
|
|
108
102
|
/** Represents the selected sorting option */
|
|
109
|
-
|
|
103
|
+
sortBy?: OrTreeMenu["sortBy"];
|
|
110
104
|
/** Automatically prioritizes the groups, and positions these on top. */
|
|
111
|
-
"group-first"?: OrTreeMenu[
|
|
105
|
+
"group-first"?: OrTreeMenu["groupFirst"];
|
|
112
106
|
/** Automatically prioritizes the groups, and positions these on top. */
|
|
113
|
-
|
|
107
|
+
groupFirst?: OrTreeMenu["groupFirst"];
|
|
114
108
|
|
|
115
109
|
/** */
|
|
116
|
-
|
|
110
|
+
onnodes?: (e: OrTreeDragEvent) => void;
|
|
111
|
+
/** Triggers upon selecting a node, and dispatches a list of the nodes selected. */
|
|
112
|
+
"onor-tree-select"?: (e: OrTreeSelectEvent) => void;
|
|
113
|
+
/** Triggers upon dragging a node to a new group, and dispatches a list of dragged nodes, the group node, and the updated list of all nodes. */
|
|
114
|
+
"onor-tree-drag"?: (e: OrTreeDragEvent) => void;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type OrTreeMenuSolidJsProps = {
|
|
118
|
+
/** List of node items in the menu.
|
|
119
|
+
Uses the TreeNode format for rendering the OrTreeNode elements. */
|
|
120
|
+
"prop:nodes"?: OrTreeMenu["nodes"];
|
|
121
|
+
/** Changes the allowed selection method within the tree.
|
|
122
|
+
Common options are `LEAF`, `SINGLE` and `MULTI`. */
|
|
123
|
+
"prop:selection"?: OrTreeMenu["selection"];
|
|
124
|
+
/** Disables and enables dragging of nodes into groups. */
|
|
125
|
+
"prop:draggable"?: OrTreeMenu["draggable"];
|
|
126
|
+
/** Removes the header from the tree menu. */
|
|
127
|
+
"bool:no-header"?: OrTreeMenu["noHeader"];
|
|
128
|
+
/** Removes the header from the tree menu. */
|
|
129
|
+
"prop:noHeader"?: OrTreeMenu["noHeader"];
|
|
130
|
+
/** Adjusts the title in the menu header. */
|
|
131
|
+
"attr:menu-title"?: OrTreeMenu["menuTitle"];
|
|
132
|
+
/** Adjusts the title in the menu header. */
|
|
133
|
+
"prop:menuTitle"?: OrTreeMenu["menuTitle"];
|
|
134
|
+
/** List of options available to sort the object with */
|
|
135
|
+
"attr:sort-options"?: OrTreeMenu["sortOptions"];
|
|
136
|
+
/** List of options available to sort the object with */
|
|
137
|
+
"prop:sortOptions"?: OrTreeMenu["sortOptions"];
|
|
138
|
+
/** Represents the selected sorting option */
|
|
139
|
+
"attr:sort-by"?: OrTreeMenu["sortBy"];
|
|
140
|
+
/** Represents the selected sorting option */
|
|
141
|
+
"prop:sortBy"?: OrTreeMenu["sortBy"];
|
|
142
|
+
/** Automatically prioritizes the groups, and positions these on top. */
|
|
143
|
+
"bool:group-first"?: OrTreeMenu["groupFirst"];
|
|
144
|
+
/** Automatically prioritizes the groups, and positions these on top. */
|
|
145
|
+
"prop:groupFirst"?: OrTreeMenu["groupFirst"];
|
|
117
146
|
/** */
|
|
118
|
-
"
|
|
147
|
+
"on:nodes"?: (e: OrTreeDragEvent) => void;
|
|
119
148
|
/** Triggers upon selecting a node, and dispatches a list of the nodes selected. */
|
|
120
|
-
"
|
|
149
|
+
"on:or-tree-select"?: (e: OrTreeSelectEvent) => void;
|
|
121
150
|
/** Triggers upon dragging a node to a new group, and dispatches a list of dragged nodes, the group node, and the updated list of all nodes. */
|
|
122
|
-
"
|
|
123
|
-
}
|
|
151
|
+
"on:or-tree-drag"?: (e: OrTreeDragEvent) => void;
|
|
124
152
|
|
|
153
|
+
/** Set the innerHTML of the element */
|
|
154
|
+
innerHTML?: string;
|
|
155
|
+
/** Set the textContent of the element */
|
|
156
|
+
textContent?: string | number;
|
|
157
|
+
};
|
|
125
158
|
|
|
126
159
|
export type OrTreeGroupProps = {
|
|
127
160
|
/** Determines the visibility of child nodes.
|
|
128
161
|
Setting this to `false` hides them, and acts as a 'collapsed' state. */
|
|
129
|
-
|
|
162
|
+
expanded?: OrTreeGroup["expanded"];
|
|
130
163
|
/** Only allows child nodes to be selected, making the expander (parent node) readonly.
|
|
131
164
|
If this is set to false, only the chevron icon can be used to collapse/expand the list. */
|
|
132
|
-
|
|
165
|
+
leaf?: OrTreeGroup["leaf"];
|
|
133
166
|
/** Makes the group readonly */
|
|
134
|
-
|
|
135
|
-
|
|
167
|
+
readonly?: OrTreeGroup["readonly"];
|
|
168
|
+
};
|
|
136
169
|
|
|
137
|
-
|
|
170
|
+
export type OrTreeGroupSolidJsProps = {
|
|
171
|
+
/** Determines the visibility of child nodes.
|
|
172
|
+
Setting this to `false` hides them, and acts as a 'collapsed' state. */
|
|
173
|
+
"prop:expanded"?: OrTreeGroup["expanded"];
|
|
174
|
+
/** Only allows child nodes to be selected, making the expander (parent node) readonly.
|
|
175
|
+
If this is set to false, only the chevron icon can be used to collapse/expand the list. */
|
|
176
|
+
"prop:leaf"?: OrTreeGroup["leaf"];
|
|
177
|
+
/** Makes the group readonly */
|
|
178
|
+
"prop:readonly"?: OrTreeGroup["readonly"];
|
|
138
179
|
|
|
180
|
+
/** Set the innerHTML of the element */
|
|
181
|
+
innerHTML?: string;
|
|
182
|
+
/** Set the textContent of the element */
|
|
183
|
+
textContent?: string | number;
|
|
184
|
+
};
|
|
139
185
|
|
|
140
186
|
export type OrTreeNodeProps = {
|
|
141
187
|
/** HTML attribute that only applies CSS, showing this node cannot be interacted with. */
|
|
142
|
-
|
|
188
|
+
readonly?: OrTreeNode["readonly"];
|
|
143
189
|
/** HTML attribute that only applies CSS, marking the node as 'selected'. */
|
|
144
|
-
|
|
145
|
-
|
|
190
|
+
selected?: OrTreeNode["selected"];
|
|
191
|
+
};
|
|
146
192
|
|
|
147
|
-
|
|
193
|
+
export type OrTreeNodeSolidJsProps = {
|
|
194
|
+
/** HTML attribute that only applies CSS, showing this node cannot be interacted with. */
|
|
195
|
+
"prop:readonly"?: OrTreeNode["readonly"];
|
|
196
|
+
/** HTML attribute that only applies CSS, marking the node as 'selected'. */
|
|
197
|
+
"prop:selected"?: OrTreeNode["selected"];
|
|
148
198
|
|
|
149
|
-
|
|
199
|
+
/** Set the innerHTML of the element */
|
|
200
|
+
innerHTML?: string;
|
|
201
|
+
/** Set the textContent of the element */
|
|
202
|
+
textContent?: string | number;
|
|
203
|
+
};
|
|
150
204
|
|
|
205
|
+
export type CustomElements = {
|
|
206
|
+
/**
|
|
207
|
+
* A component for displaying a hierarchical, tree-like structure of elements.
|
|
208
|
+
* Common use cases are visualizing parent-child relationships, or for grouping elements together.
|
|
209
|
+
*
|
|
210
|
+
* ## Attributes & Properties
|
|
211
|
+
*
|
|
212
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
213
|
+
*
|
|
214
|
+
* - `nodes`: List of node items in the menu.
|
|
215
|
+
* Uses the TreeNode format for rendering the OrTreeNode elements.
|
|
216
|
+
* - `selection`: Changes the allowed selection method within the tree.
|
|
217
|
+
* Common options are `LEAF`, `SINGLE` and `MULTI`.
|
|
218
|
+
* - `draggable`: Disables and enables dragging of nodes into groups.
|
|
219
|
+
* - `no-header`/`noHeader`: Removes the header from the tree menu.
|
|
220
|
+
* - `menu-title`/`menuTitle`: Adjusts the title in the menu header.
|
|
221
|
+
* - `sort-options`/`sortOptions`: List of options available to sort the object with
|
|
222
|
+
* - `sort-by`/`sortBy`: Represents the selected sorting option
|
|
223
|
+
* - `group-first`/`groupFirst`: Automatically prioritizes the groups, and positions these on top.
|
|
224
|
+
*
|
|
225
|
+
* ## Events
|
|
226
|
+
*
|
|
227
|
+
* Events that will be emitted by the component.
|
|
228
|
+
*
|
|
229
|
+
* - `nodes`: undefined
|
|
230
|
+
* - `undefined`: undefined
|
|
231
|
+
* - `or-tree-select`: Triggers upon selecting a node, and dispatches a list of the nodes selected.
|
|
232
|
+
* - `or-tree-drag`: Triggers upon dragging a node to a new group, and dispatches a list of dragged nodes, the group node, and the updated list of all nodes.
|
|
233
|
+
*
|
|
234
|
+
* ## Methods
|
|
235
|
+
*
|
|
236
|
+
* Methods that can be called to access component functionality.
|
|
237
|
+
*
|
|
238
|
+
* - `moveNodesToGroup(nodesToMove: TreeNode[], groupNode?: TreeNode) => void`: Function that moves an array of TreeNode into another TreeNode, by adding them to their children.
|
|
239
|
+
* The function takes care of removing the nodes from the former group, and makes sure no duplicates end up in the list.
|
|
240
|
+
* - `deselectAllNodes() => void`: Public function that deselects all tree nodes.
|
|
241
|
+
* - `expandGroup(groupId: string) => void`: Programmatically finds a group by its ID and sets it to be expanded.
|
|
242
|
+
* This is called by the parent component after a new node is added to a tree group.
|
|
243
|
+
*/
|
|
244
|
+
"or-tree-menu": Partial<OrTreeMenuProps & BaseProps<OrTreeMenu> & BaseEvents>;
|
|
151
245
|
|
|
152
246
|
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
247
|
+
*
|
|
248
|
+
*
|
|
249
|
+
* ## Attributes & Properties
|
|
250
|
+
*
|
|
251
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
252
|
+
*
|
|
253
|
+
* - `expanded`: Determines the visibility of child nodes.
|
|
254
|
+
* Setting this to `false` hides them, and acts as a 'collapsed' state.
|
|
255
|
+
* - `leaf`: Only allows child nodes to be selected, making the expander (parent node) readonly.
|
|
256
|
+
* If this is set to false, only the chevron icon can be used to collapse/expand the list.
|
|
257
|
+
* - `readonly`: Makes the group readonly
|
|
258
|
+
*
|
|
259
|
+
* ## Slots
|
|
260
|
+
*
|
|
261
|
+
* Areas where markup can be added to the component.
|
|
262
|
+
*
|
|
263
|
+
* - `(default)`: Default slot for child nodes within the group
|
|
264
|
+
* - `parent`: Slot for inserting a parent node
|
|
265
|
+
*
|
|
266
|
+
* ## Methods
|
|
267
|
+
*
|
|
268
|
+
* Methods that can be called to access component functionality.
|
|
269
|
+
*
|
|
270
|
+
* - `select() => void`: Selects the group (parent) node.
|
|
271
|
+
* - `selectAll() => void`: Selects the group node itself, and all children nodes within that group.
|
|
272
|
+
* - `deselect() => void`: Deselects the group (parent) node.
|
|
273
|
+
* - `deselectAll() => void`: Deselects the group node itself, and all children nodes within that group.
|
|
274
|
+
* - `getGroupNode() => OrTreeNode | undefined`: Returns the group (parent) node (OrTreeNode) using a query selector.
|
|
275
|
+
* - `getChildNodes() => OrTreeNode[]`: Returns a list of all children nodes (OrTreeNode) within the group, using a query selector.
|
|
276
|
+
*
|
|
277
|
+
* ## CSS Parts
|
|
278
|
+
*
|
|
279
|
+
* Custom selectors for styling elements within the component.
|
|
280
|
+
*
|
|
281
|
+
* - `chevron`: The chevron icon element for expanding/collapsing the group.
|
|
282
|
+
*/
|
|
283
|
+
"or-tree-group": Partial<
|
|
284
|
+
OrTreeGroupProps & BaseProps<OrTreeGroup> & BaseEvents
|
|
285
|
+
>;
|
|
191
286
|
|
|
287
|
+
/**
|
|
288
|
+
*
|
|
289
|
+
*
|
|
290
|
+
* ## Attributes & Properties
|
|
291
|
+
*
|
|
292
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
293
|
+
*
|
|
294
|
+
* - `readonly`: HTML attribute that only applies CSS, showing this node cannot be interacted with.
|
|
295
|
+
* - `selected`: HTML attribute that only applies CSS, marking the node as 'selected'.
|
|
296
|
+
*
|
|
297
|
+
* ## Slots
|
|
298
|
+
*
|
|
299
|
+
* Areas where markup can be added to the component.
|
|
300
|
+
*
|
|
301
|
+
* - `prefix`: Appends elements to the left hand side of the node, commonly used for icons.
|
|
302
|
+
* - `(default)`: Default slot for the main content, commonly used for text.
|
|
303
|
+
* - `suffix`: Appends elements to the right hand side of the node.
|
|
304
|
+
*
|
|
305
|
+
* ## CSS Custom Properties
|
|
306
|
+
*
|
|
307
|
+
* CSS variables available for styling the component.
|
|
308
|
+
*
|
|
309
|
+
* - `--or-tree-node-height`: Controls the height of the node (default: `undefined`)
|
|
310
|
+
* - `--or-tree-node-indent`: Controls the left padding of the node (default: `undefined`)
|
|
311
|
+
* - `--or-tree-node-background`: Sets the default background (default: `undefined`)
|
|
312
|
+
* - `--or-tree-node-background--hovered`: Sets the background while hovering (default: `undefined`)
|
|
313
|
+
* - `--or-tree-node-background--selected`: Sets the background when selected (default: `undefined`)
|
|
314
|
+
* - `--or-tree-node-color--selected`: Sets the primary color of the node when selected (default: `undefined`)
|
|
315
|
+
*/
|
|
316
|
+
"or-tree-node": Partial<OrTreeNodeProps & BaseProps<OrTreeNode> & BaseEvents>;
|
|
317
|
+
};
|
|
192
318
|
|
|
319
|
+
export type CustomElementsSolidJs = {
|
|
193
320
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
321
|
+
* A component for displaying a hierarchical, tree-like structure of elements.
|
|
322
|
+
* Common use cases are visualizing parent-child relationships, or for grouping elements together.
|
|
323
|
+
*
|
|
324
|
+
* ## Attributes & Properties
|
|
325
|
+
*
|
|
326
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
327
|
+
*
|
|
328
|
+
* - `nodes`: List of node items in the menu.
|
|
329
|
+
* Uses the TreeNode format for rendering the OrTreeNode elements.
|
|
330
|
+
* - `selection`: Changes the allowed selection method within the tree.
|
|
331
|
+
* Common options are `LEAF`, `SINGLE` and `MULTI`.
|
|
332
|
+
* - `draggable`: Disables and enables dragging of nodes into groups.
|
|
333
|
+
* - `no-header`/`noHeader`: Removes the header from the tree menu.
|
|
334
|
+
* - `menu-title`/`menuTitle`: Adjusts the title in the menu header.
|
|
335
|
+
* - `sort-options`/`sortOptions`: List of options available to sort the object with
|
|
336
|
+
* - `sort-by`/`sortBy`: Represents the selected sorting option
|
|
337
|
+
* - `group-first`/`groupFirst`: Automatically prioritizes the groups, and positions these on top.
|
|
338
|
+
*
|
|
339
|
+
* ## Events
|
|
340
|
+
*
|
|
341
|
+
* Events that will be emitted by the component.
|
|
342
|
+
*
|
|
343
|
+
* - `nodes`: undefined
|
|
344
|
+
* - `undefined`: undefined
|
|
345
|
+
* - `or-tree-select`: Triggers upon selecting a node, and dispatches a list of the nodes selected.
|
|
346
|
+
* - `or-tree-drag`: Triggers upon dragging a node to a new group, and dispatches a list of dragged nodes, the group node, and the updated list of all nodes.
|
|
347
|
+
*
|
|
348
|
+
* ## Methods
|
|
349
|
+
*
|
|
350
|
+
* Methods that can be called to access component functionality.
|
|
351
|
+
*
|
|
352
|
+
* - `moveNodesToGroup(nodesToMove: TreeNode[], groupNode?: TreeNode) => void`: Function that moves an array of TreeNode into another TreeNode, by adding them to their children.
|
|
353
|
+
* The function takes care of removing the nodes from the former group, and makes sure no duplicates end up in the list.
|
|
354
|
+
* - `deselectAllNodes() => void`: Public function that deselects all tree nodes.
|
|
355
|
+
* - `expandGroup(groupId: string) => void`: Programmatically finds a group by its ID and sets it to be expanded.
|
|
356
|
+
* This is called by the parent component after a new node is added to a tree group.
|
|
357
|
+
*/
|
|
358
|
+
"or-tree-menu": Partial<
|
|
359
|
+
OrTreeMenuProps &
|
|
360
|
+
OrTreeMenuSolidJsProps &
|
|
361
|
+
BaseProps<OrTreeMenu> &
|
|
362
|
+
BaseEvents
|
|
363
|
+
>;
|
|
231
364
|
|
|
365
|
+
/**
|
|
366
|
+
*
|
|
367
|
+
*
|
|
368
|
+
* ## Attributes & Properties
|
|
369
|
+
*
|
|
370
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
371
|
+
*
|
|
372
|
+
* - `expanded`: Determines the visibility of child nodes.
|
|
373
|
+
* Setting this to `false` hides them, and acts as a 'collapsed' state.
|
|
374
|
+
* - `leaf`: Only allows child nodes to be selected, making the expander (parent node) readonly.
|
|
375
|
+
* If this is set to false, only the chevron icon can be used to collapse/expand the list.
|
|
376
|
+
* - `readonly`: Makes the group readonly
|
|
377
|
+
*
|
|
378
|
+
* ## Slots
|
|
379
|
+
*
|
|
380
|
+
* Areas where markup can be added to the component.
|
|
381
|
+
*
|
|
382
|
+
* - `(default)`: Default slot for child nodes within the group
|
|
383
|
+
* - `parent`: Slot for inserting a parent node
|
|
384
|
+
*
|
|
385
|
+
* ## Methods
|
|
386
|
+
*
|
|
387
|
+
* Methods that can be called to access component functionality.
|
|
388
|
+
*
|
|
389
|
+
* - `select() => void`: Selects the group (parent) node.
|
|
390
|
+
* - `selectAll() => void`: Selects the group node itself, and all children nodes within that group.
|
|
391
|
+
* - `deselect() => void`: Deselects the group (parent) node.
|
|
392
|
+
* - `deselectAll() => void`: Deselects the group node itself, and all children nodes within that group.
|
|
393
|
+
* - `getGroupNode() => OrTreeNode | undefined`: Returns the group (parent) node (OrTreeNode) using a query selector.
|
|
394
|
+
* - `getChildNodes() => OrTreeNode[]`: Returns a list of all children nodes (OrTreeNode) within the group, using a query selector.
|
|
395
|
+
*
|
|
396
|
+
* ## CSS Parts
|
|
397
|
+
*
|
|
398
|
+
* Custom selectors for styling elements within the component.
|
|
399
|
+
*
|
|
400
|
+
* - `chevron`: The chevron icon element for expanding/collapsing the group.
|
|
401
|
+
*/
|
|
402
|
+
"or-tree-group": Partial<
|
|
403
|
+
OrTreeGroupProps &
|
|
404
|
+
OrTreeGroupSolidJsProps &
|
|
405
|
+
BaseProps<OrTreeGroup> &
|
|
406
|
+
BaseEvents
|
|
407
|
+
>;
|
|
232
408
|
|
|
233
409
|
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
410
|
+
*
|
|
411
|
+
*
|
|
412
|
+
* ## Attributes & Properties
|
|
413
|
+
*
|
|
414
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
415
|
+
*
|
|
416
|
+
* - `readonly`: HTML attribute that only applies CSS, showing this node cannot be interacted with.
|
|
417
|
+
* - `selected`: HTML attribute that only applies CSS, marking the node as 'selected'.
|
|
418
|
+
*
|
|
419
|
+
* ## Slots
|
|
420
|
+
*
|
|
421
|
+
* Areas where markup can be added to the component.
|
|
422
|
+
*
|
|
423
|
+
* - `prefix`: Appends elements to the left hand side of the node, commonly used for icons.
|
|
424
|
+
* - `(default)`: Default slot for the main content, commonly used for text.
|
|
425
|
+
* - `suffix`: Appends elements to the right hand side of the node.
|
|
426
|
+
*
|
|
427
|
+
* ## CSS Custom Properties
|
|
428
|
+
*
|
|
429
|
+
* CSS variables available for styling the component.
|
|
430
|
+
*
|
|
431
|
+
* - `--or-tree-node-height`: Controls the height of the node (default: `undefined`)
|
|
432
|
+
* - `--or-tree-node-indent`: Controls the left padding of the node (default: `undefined`)
|
|
433
|
+
* - `--or-tree-node-background`: Sets the default background (default: `undefined`)
|
|
434
|
+
* - `--or-tree-node-background--hovered`: Sets the background while hovering (default: `undefined`)
|
|
435
|
+
* - `--or-tree-node-background--selected`: Sets the background when selected (default: `undefined`)
|
|
436
|
+
* - `--or-tree-node-color--selected`: Sets the primary color of the node when selected (default: `undefined`)
|
|
437
|
+
*/
|
|
438
|
+
"or-tree-node": Partial<
|
|
439
|
+
OrTreeNodeProps &
|
|
440
|
+
OrTreeNodeSolidJsProps &
|
|
441
|
+
BaseProps<OrTreeNode> &
|
|
442
|
+
BaseEvents
|
|
443
|
+
>;
|
|
444
|
+
};
|
|
264
445
|
|
|
265
446
|
export type CustomCssProperties = {
|
|
266
447
|
/** Controls the height of the node */
|
|
@@ -275,51 +456,57 @@ export type CustomCssProperties = {
|
|
|
275
456
|
"--or-tree-node-background--selected"?: string;
|
|
276
457
|
/** Sets the primary color of the node when selected */
|
|
277
458
|
"--or-tree-node-color--selected"?: string;
|
|
278
|
-
}
|
|
279
|
-
|
|
459
|
+
};
|
|
280
460
|
|
|
281
|
-
declare module
|
|
461
|
+
declare module "react" {
|
|
282
462
|
namespace JSX {
|
|
283
463
|
interface IntrinsicElements extends CustomElements {}
|
|
284
464
|
}
|
|
285
465
|
export interface CSSProperties extends CustomCssProperties {}
|
|
286
466
|
}
|
|
287
467
|
|
|
288
|
-
declare module
|
|
468
|
+
declare module "preact" {
|
|
289
469
|
namespace JSX {
|
|
290
470
|
interface IntrinsicElements extends CustomElements {}
|
|
291
471
|
}
|
|
292
472
|
export interface CSSProperties extends CustomCssProperties {}
|
|
293
473
|
}
|
|
294
474
|
|
|
295
|
-
declare module
|
|
475
|
+
declare module "@builder.io/qwik" {
|
|
296
476
|
namespace JSX {
|
|
297
477
|
interface IntrinsicElements extends CustomElements {}
|
|
298
478
|
}
|
|
299
479
|
export interface CSSProperties extends CustomCssProperties {}
|
|
300
480
|
}
|
|
301
481
|
|
|
302
|
-
declare module
|
|
482
|
+
declare module "@stencil/core" {
|
|
303
483
|
namespace JSX {
|
|
304
484
|
interface IntrinsicElements extends CustomElements {}
|
|
305
485
|
}
|
|
306
486
|
export interface CSSProperties extends CustomCssProperties {}
|
|
307
487
|
}
|
|
308
488
|
|
|
309
|
-
declare module
|
|
489
|
+
declare module "hono/jsx" {
|
|
310
490
|
namespace JSX {
|
|
311
491
|
interface IntrinsicElements extends CustomElements {}
|
|
312
492
|
}
|
|
313
493
|
export interface CSSProperties extends CustomCssProperties {}
|
|
314
494
|
}
|
|
315
495
|
|
|
316
|
-
declare module
|
|
496
|
+
declare module "react-native" {
|
|
317
497
|
namespace JSX {
|
|
318
498
|
interface IntrinsicElements extends CustomElements {}
|
|
319
499
|
}
|
|
320
500
|
export interface CSSProperties extends CustomCssProperties {}
|
|
321
501
|
}
|
|
322
502
|
|
|
503
|
+
declare module "solid-js" {
|
|
504
|
+
namespace JSX {
|
|
505
|
+
interface IntrinsicElements extends CustomElementsSolidJs {}
|
|
506
|
+
}
|
|
507
|
+
export interface CSSProperties extends CustomCssProperties {}
|
|
508
|
+
}
|
|
509
|
+
|
|
323
510
|
declare global {
|
|
324
511
|
namespace JSX {
|
|
325
512
|
interface IntrinsicElements extends CustomElements {}
|
package/dist/umd/index.bundle.js
CHANGED
|
@@ -726,10 +726,10 @@
|
|
|
726
726
|
${this._getSortActionTemplate(this.sortBy,this.sortOptions)}
|
|
727
727
|
</div>
|
|
728
728
|
</div>
|
|
729
|
-
`}_getSortActionTemplate(t,e){return function(t,e,n,i,r,a=!
|
|
729
|
+
`}_getSortActionTemplate(t,e){return function(t,e,n,i,r=!1,a=!0,o=!1,l=!1,d="menu",c=!1){let s=null;return j`
|
|
730
730
|
<span>
|
|
731
|
-
<span @click="${t=>{if(e){if(s
|
|
732
|
-
${e?j`<or-mwc-menu ?multiselect="${
|
|
731
|
+
<span @click="${t=>{if(e){if(c&&s){var n,i;let e,r=t.currentTarget;n=s,(i=r)||(i=document.body),e=i.getBoundingClientRect(),Object.assign(n.style,{position:"fixed",top:`${e.bottom}px`,left:`${e.left}px`,zIndex:"1000",display:"block"})}t.currentTarget.parentElement.lastElementChild.open()}}}">${t}</span>
|
|
732
|
+
${e?j`<or-mwc-menu ?multiselect="${r}" @or-mwc-menu-closed="${()=>{}}" @or-mwc-menu-changed="${t=>{i&&i(t.detail)}}" .translateValues="${a}" .values="${n}" .menuItems="${e}" .midHeight="${o}" .fullWidth="${l}" id="${d}" ${tN(t=>s=t)}></or-mwc-menu>`:""}
|
|
733
733
|
</span>
|
|
734
734
|
`}(j`<or-mwc-input type=${t2.BUTTON} icon="sort-variant" title="${is.i18next.t("sort")}"></or-mwc-input>`,(e||[]).map(t=>({value:t,text:t})),t,t=>this._onSortClick(String(t)))}_getErrorTemplate(){return j``}_onSortClick(t){this.sortBy=t}_onTreeGroupClick(t){let e=t.currentTarget,n=e.parentElement,i=(t,e)=>{t.select(),this._lastSelectedNode=e,this._notifyNodesSelect()};switch(this.selection){case t5.LEAF:return;case t5.MULTI:if(t.shiftKey&&this._lastSelectedNode){let t=Array.from(this._uiNodes||[]),e=n.getGroupNode();if(e){let n=t.indexOf(e),i=t.indexOf(this._lastSelectedNode);this._selectNodesBetween(t,n,i);return}}else if(t.ctrlKey)return void i(n,e);this.deselectAllNodes(),i(n,e);return;case t5.SINGLE:this.deselectAllNodes(),i(n,e);return}}_onTreeNodeClick(t){let e=t.currentTarget;if(e)if(this.selection===t5.MULTI){if(t.shiftKey&&this._lastSelectedNode){let t=Array.from(this._uiNodes||[]),n=t.indexOf(this._lastSelectedNode),i=t.indexOf(e);if(n>-1&&i>-1)return void this._selectNodesBetween(t,n,i)}else if(t.ctrlKey)return void this._selectNode(e);this.deselectAllNodes(),this._selectNode(e);return}else{this.deselectAllNodes(),this._selectNode(e);return}}_onDragStart(t,e){var n;t.target?null==(n=t.dataTransfer)||n.setData("treeNode",JSON.stringify(e)):t.preventDefault()}_onDragOverList(t){this.draggable&&t.preventDefault()}_onDragOverSingleNode(t,e,n){if(this.draggable&&(t.preventDefault(),n)){let t=this._getUiNodeFromTree(n);null==t||t.setAttribute("drophover","true")}}_onDragOverGroup(t,e){this.draggable&&(t.preventDefault(),t.currentTarget.setAttribute("drophover","true"))}_onDragLeaveSingleNode(t,e,n){if(n&&this.draggable){t.preventDefault();let e=this._getUiNodeFromTree(n);null==e||e.removeAttribute("drophover")}}_onDragLeaveGroup(t,e){this.draggable&&t.currentTarget.removeAttribute("drophover")}_onDragDropList(t){this._onDragDropGroup(t)}_onDragDropSingleNode(t,e,n){this._onDragDropGroup(t,n)}_onDragDropGroup(t,e){var n,i;if(this.draggable){t.preventDefault(),t.stopPropagation(),e&&(null==(n=this._getUiNodeFromTree(e))||n.removeAttribute("drophover"));let r=[],a=null==(i=t.dataTransfer)?void 0:i.getData("treeNode");if(a){let t=JSON.parse(a);t&&r.push(t)}if(this.selection===t5.MULTI){let t=this._findSelectedTreeNodes();(t=t.filter(t=>!t.children)).length>0&&(this.deselectAllNodes(),r.push(...t.filter(t=>!r.find(e=>JSON.stringify(e)===JSON.stringify(t)))))}(null==e?void 0:e.children)&&(r=r.filter(t=>{var n;return!(null==(n=e.children)?void 0:n.find(e=>e.id===t.id))})),r.length>0&&this._dispatchCancellableDragEvent(r,e,this.nodes).then(()=>{this.nodes=iK(r,e,this.nodes)}).catch(t=>{})}}_dispatchCancellableDragEvent(t,e,n=[]){return new Promise((i,r)=>{this.dispatchEvent(new iJ(t,e,n))?i():r()})}_selectNode(t,e=!0){if(t){if(e){let e=[...this._findSelectedTreeNodes()],n=this._getTreeNodeFromTree(t);if(n&&e.push(n),!this._dispatchSelectEvent(e))return}t.selected=!0,this._lastSelectedNode=t}}_selectNodesBetween(t,e,n,i=!0){let r=[];if(e<n)for(let i=e;i<=n;i++)r.push(t[i]);else if(e>n)for(let i=n;i<=e;i++)r.push(t[i]);if(i){let t=r.map(t=>this._getTreeNodeFromTree(t)).filter(t=>t);if(!this._notifyNodesSelect(t))return}r.forEach(t=>this._selectNode(t))}_notifyNodesSelect(t){var e,n,i,r;return e=this,n=void 0,i=void 0,r=function*(){return yield this.getUpdateComplete(),t||(t=this._findSelectedTreeNodes()),this._dispatchSelectEvent(t)},new(i||(i=Promise))(function(t,a){function o(t){try{d(r.next(t))}catch(t){a(t)}}function l(t){try{d(r.throw(t))}catch(t){a(t)}}function d(e){var n;e.done?t(e.value):((n=e.value)instanceof i?n:new i(function(t){t(n)})).then(o,l)}d((r=r.apply(e,n||[])).next())})}_findSelectedTreeNodes(t=Array.from(this._uiNodes||[]),e=this._treeNodeCache){let n=t.filter(t=>t.selected),i=Array.from(e.entries());return n.map(t=>i.find(e=>e[1]===t.id)).map(t=>null==t?void 0:t[0]).filter(t=>void 0!==t)}_getTreeNodeFromTree(t,e=this._treeNodeCache){var n;return null==(n=Array.from(e.entries()).find(e=>e[1]===t.id))?void 0:n[0]}_getUiNodeFromTree(t,e=this._treeNodeCache){var n;let i=Array.from(e.entries()),r=JSON.stringify(t),a=null==(n=i.find(t=>JSON.stringify(t[0])===r))?void 0:n[1];return a?this.shadowRoot.getElementById(a):void 0}_dispatchSelectEvent(t){return this.dispatchEvent(new iW(t||[]))}deselectAllNodes(){(this._uiGroups||[]).forEach(t=>t.deselect()),(this._uiNodes||[]).forEach(t=>t.selected=!1)}_sortNodes(t,e,n=!1){console.debug(`Sorting nodes in the tree menu using '${e}'`);let i=t.filter(t=>void 0!==t.children);if(i.forEach(t=>{var n;return null==(n=t.children)?void 0:n.sort(this._getSortFunction(e))}),n){let n=t.filter(t=>void 0===t.children);return i.sort(this._getSortFunction(e)),n.sort(this._getSortFunction(e)),[...i,...n]}return t.sort(this._getSortFunction(e))}_setTreeNodeId(t,e=io.Util.generateUniqueUUID()){return this._treeNodeCache.get(t)?this._treeNodeCache.get(t):(this._treeNodeCache.set(t,e),e)}_getSortFunction(t){return t===t4.Z_TO_A?(t,e)=>e.label.localeCompare(t.label):io.Util.sortByString(t=>t.label)}expandGroup(t){this.updateComplete.then(()=>{let e=this.nodes.find(e=>e.id===t&&e.children);e&&(e.expanded=!0,this.requestUpdate())})}};i5([tf({type:Array})],i3.prototype,"nodes",void 0),i5([tf({type:String})],i3.prototype,"selection",void 0),i5([tf({type:Boolean})],i3.prototype,"draggable",void 0),i5([tf({type:Boolean,attribute:"no-header"})],i3.prototype,"noHeader",void 0),i5([tf({type:String,attribute:"menu-title"})],i3.prototype,"menuTitle",void 0),i5([tf({type:Array,attribute:"sort-options"})],i3.prototype,"sortOptions",void 0),i5([tf({type:String,attribute:"sort-by",reflect:!0})],i3.prototype,"sortBy",void 0),i5([tf({type:Boolean,attribute:"group-first"})],i3.prototype,"groupFirst",void 0),i5([tv("or-tree-node")],i3.prototype,"_uiNodes",void 0),i5([tv("or-tree-group")],i3.prototype,"_uiGroups",void 0),i3=i5([tp("or-tree-menu")],i3)})(),o})());
|
|
735
735
|
//# sourceMappingURL=index.bundle.js.map
|