wj-elements 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +5009 -4417
- package/dist/dark.css +17 -0
- package/dist/light.css +17 -0
- package/dist/packages/wje-file-upload/file-upload.element.d.ts +1 -0
- package/dist/packages/wje-tree/tree.element.d.ts +160 -7
- package/dist/packages/wje-tree-item/tree-item.element.d.ts +26 -2
- package/dist/web-types.json +524 -494
- package/dist/wje-file-upload.js +1 -1
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-tree-item.js +28 -8
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +360 -32
- package/dist/wje-tree.js.map +1 -1
- package/package.json +1 -1
package/dist/dark.css
CHANGED
|
@@ -171,6 +171,9 @@
|
|
|
171
171
|
/* Divider */
|
|
172
172
|
--wje-divider-border-color: var(--wje-border-color);
|
|
173
173
|
|
|
174
|
+
/* File Upload */
|
|
175
|
+
--wje-file-upload-padding: 0;
|
|
176
|
+
|
|
174
177
|
/* File Upload - Item */
|
|
175
178
|
--wje-file-upload-item-border-width: 1px;
|
|
176
179
|
--wje-file-upload-item-border-style: solid;
|
|
@@ -273,6 +276,20 @@
|
|
|
273
276
|
/* Toast */
|
|
274
277
|
--wje-toast-stack-width: 300px;
|
|
275
278
|
|
|
279
|
+
/* Tree - Item */
|
|
280
|
+
--wje-tree-item-indent-guid-color: var(--wje-border-color);
|
|
281
|
+
--wje-tree-item-border-color: transparent;
|
|
282
|
+
--wje-tree-item-border-color-hover: transparent;
|
|
283
|
+
--wje-tree-item-border-color-selected: transparent;
|
|
284
|
+
--wje-tree-item-background: transparent;
|
|
285
|
+
--wje-tree-item-color: var(--wje-color);
|
|
286
|
+
--wje-tree-item-background-hover: var(--wje-color-contrast-1);
|
|
287
|
+
--wje-tree-item-color-hover: var(--wje-color-contrast-8);
|
|
288
|
+
--wje-tree-item-background-selected: var(--wje-color-primary-9);
|
|
289
|
+
--wje-tree-item-color-selected: var(--wje-color-contrast-0);
|
|
290
|
+
--wje-tree-item-drop-color: var(--wje-color-primary);
|
|
291
|
+
--wje-tree-item-drop-border-color: var(--wje-tree-item-drop-color);
|
|
292
|
+
|
|
276
293
|
/* Toolbar */
|
|
277
294
|
--wje-toolbar-background: var(--wje-background);
|
|
278
295
|
--wje-toolbar-border-color: var(--wje-border-color);
|
package/dist/light.css
CHANGED
|
@@ -402,6 +402,9 @@
|
|
|
402
402
|
--wje-divider-border-color: var(--wje-border-color);
|
|
403
403
|
--wje-divider-spacing: 0;
|
|
404
404
|
|
|
405
|
+
/* File Upload */
|
|
406
|
+
--wje-file-upload-padding: 0;
|
|
407
|
+
|
|
405
408
|
/* File Upload - Item */
|
|
406
409
|
--wje-file-upload-item-border-width: 1px;
|
|
407
410
|
--wje-file-upload-item-border-style: solid;
|
|
@@ -704,11 +707,25 @@
|
|
|
704
707
|
--wje-tree-item-padding-block: var(--wje-spacing-3x-small);
|
|
705
708
|
--wje-tree-item-indent: var(--wje-spacing-large);
|
|
706
709
|
--wje-tree-item-indent-guid-width: 0px;
|
|
710
|
+
--wje-tree-item-indent-guid-style: solid;
|
|
711
|
+
--wje-tree-item-indent-guid-color: var(--wje-border-color);
|
|
707
712
|
--wje-tree-item-border-radius: var(--wje-border-radius-medium);
|
|
713
|
+
--wje-tree-item-border-width: 0;
|
|
714
|
+
--wje-tree-item-border-style: solid;
|
|
715
|
+
--wje-tree-item-border-color: transparent;
|
|
716
|
+
--wje-tree-item-border-color-hover: transparent;
|
|
717
|
+
--wje-tree-item-border-color-selected: transparent;
|
|
708
718
|
--wje-tree-item-background: transparent;
|
|
709
719
|
--wje-tree-item-color: var(--wje-color);
|
|
710
720
|
--wje-tree-item-background-hover: var(--wje-color-contrast-1);
|
|
711
721
|
--wje-tree-item-color-hover: var(--wje-color-contrast-8);
|
|
712
722
|
--wje-tree-item-background-selected: var(--wje-color-primary-9);
|
|
713
723
|
--wje-tree-item-color-selected: var(--wje-color-contrast-0);
|
|
724
|
+
--wje-tree-item-drop-color: var(--wje-color-primary);
|
|
725
|
+
--wje-tree-item-drop-line-width: 2px;
|
|
726
|
+
--wje-tree-item-drop-line-border-radius: var(--wje-border-radius-pill);
|
|
727
|
+
--wje-tree-item-drop-border-width: 1px;
|
|
728
|
+
--wje-tree-item-drop-border-style: solid;
|
|
729
|
+
--wje-tree-item-drop-border-color: var(--wje-tree-item-drop-color);
|
|
730
|
+
--wje-tree-item-drop-border-radius: var(--wje-border-radius-medium);
|
|
714
731
|
}
|
|
@@ -10,6 +10,7 @@ import { Localizer } from '../utils/localize.js';
|
|
|
10
10
|
* @csspart native - The native file upload part.
|
|
11
11
|
* @csspart file-list - The file list part.
|
|
12
12
|
* @csspart upload-button - The label part.
|
|
13
|
+
* @cssproperty [--wje-file-upload-padding=0] - Controls the padding around the native file upload area.
|
|
13
14
|
* @event change - Fires when the file input changes.
|
|
14
15
|
* @event drop - Fires when a file is dropped into the component.
|
|
15
16
|
* @attribute {string} accepted-types - The accepted file types for upload.
|
|
@@ -6,6 +6,7 @@ import { default as WJElement } from '../wje-element/element.js';
|
|
|
6
6
|
* @documentation https://elements.webjet.sk/components/tree
|
|
7
7
|
* @status stable
|
|
8
8
|
* @augments {WJElement}
|
|
9
|
+
* @attribute {boolean} reorder - Enables moving tree items by dragging direct start slot content.
|
|
9
10
|
* @csspart native - The native container part of the tree.
|
|
10
11
|
* @slot - The default slot to place `wje-tree-item` child components.
|
|
11
12
|
* @tag wje-tree
|
|
@@ -17,6 +18,9 @@ export default class Tree extends WJElement {
|
|
|
17
18
|
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
18
19
|
*/
|
|
19
20
|
static get cssStyleSheet(): CSSStyleSheet;
|
|
21
|
+
draggedItem: HTMLElement;
|
|
22
|
+
dropTarget: any;
|
|
23
|
+
dropPosition: string;
|
|
20
24
|
/**
|
|
21
25
|
* Sets the selection attribute for the element.
|
|
22
26
|
* @param {string} value The value to set as the selection attribute.
|
|
@@ -28,6 +32,16 @@ export default class Tree extends WJElement {
|
|
|
28
32
|
* @returns {string} The current selection mode, either set by the element's attribute or the default value 'single'.
|
|
29
33
|
*/
|
|
30
34
|
get selection(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Enables reordering tree items by dragging an element assigned to the start slot.
|
|
37
|
+
* @param {boolean} value Whether reordering is enabled.
|
|
38
|
+
*/
|
|
39
|
+
set reorder(value: boolean);
|
|
40
|
+
/**
|
|
41
|
+
* Indicates whether tree items can be reordered with the start slot handle.
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
get reorder(): boolean;
|
|
31
45
|
/**
|
|
32
46
|
* A method called before the drawing or rendering process of tree items.
|
|
33
47
|
* It iterates through all `wje-tree-item` elements, updating their selection state
|
|
@@ -36,7 +50,7 @@ export default class Tree extends WJElement {
|
|
|
36
50
|
*/
|
|
37
51
|
beforeDraw(): void;
|
|
38
52
|
/**
|
|
39
|
-
* Draw method for the
|
|
53
|
+
* Draw method for the tree.
|
|
40
54
|
* @returns {object} Document fragment
|
|
41
55
|
*/
|
|
42
56
|
draw(): object;
|
|
@@ -59,19 +73,158 @@ export default class Tree extends WJElement {
|
|
|
59
73
|
* @param {Event} e The click event object.
|
|
60
74
|
*/
|
|
61
75
|
handleClick: (e: Event) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Starts dragging a tree item when the drag begins from the configured start slot handle.
|
|
78
|
+
* @param {DragEvent} e The drag event.
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
handleDragStart: (e: DragEvent) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Updates the current drop target and exposes a visual drop position.
|
|
84
|
+
* @param {DragEvent} e The drag event.
|
|
85
|
+
* @returns {void}
|
|
86
|
+
*/
|
|
87
|
+
handleDragOver: (e: DragEvent) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Completes a tree item move.
|
|
90
|
+
* @param {DragEvent} e The drop event.
|
|
91
|
+
* @returns {void}
|
|
92
|
+
*/
|
|
93
|
+
handleDrop: (e: DragEvent) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Clears drag state after the browser drag operation ends.
|
|
96
|
+
* @returns {void}
|
|
97
|
+
*/
|
|
98
|
+
handleDragEnd: () => void;
|
|
62
99
|
/**
|
|
63
100
|
* Retrieves all items that match the selector 'wje-tree-item' within the current context.
|
|
64
101
|
* @returns {Array<Element>} An array of all matching DOM elements.
|
|
65
102
|
*/
|
|
66
103
|
getAllItems(): Array<Element>;
|
|
67
104
|
/**
|
|
68
|
-
* Retrieves and appends
|
|
69
|
-
* @param {HTMLElement} item The DOM element to which the
|
|
70
|
-
* @param {
|
|
71
|
-
* @
|
|
105
|
+
* Retrieves and appends a template slot to a tree item.
|
|
106
|
+
* @param {HTMLElement} item The DOM element to which the slot content will be appended.
|
|
107
|
+
* @param {HTMLTemplateElement|null} template Template that may provide reusable slot content.
|
|
108
|
+
* @param {string} slotName Name of the projected slot content to clone.
|
|
109
|
+
* @returns {void}
|
|
110
|
+
*/
|
|
111
|
+
appendTemplateSlot(item: HTMLElement, template: HTMLTemplateElement | null, slotName: string): void;
|
|
112
|
+
/**
|
|
113
|
+
* Returns the internal class used to identify cloned template slot content.
|
|
114
|
+
* @param {string} slotName Name of the projected slot.
|
|
115
|
+
* @returns {string}
|
|
116
|
+
*/
|
|
117
|
+
getTemplateSlotClass(slotName: string): string;
|
|
118
|
+
/**
|
|
119
|
+
* Marks direct start slot content as the drag handle for reorderable trees.
|
|
120
|
+
* @param {HTMLElement} item Host item that receives draggable start content.
|
|
121
|
+
* @returns {void}
|
|
122
|
+
*/
|
|
123
|
+
setupReorderHandle(item: HTMLElement): void;
|
|
124
|
+
/**
|
|
125
|
+
* Finds a tree item from a composed event path.
|
|
126
|
+
* @param {Event} e User interaction that may originate inside shadow DOM.
|
|
127
|
+
* @returns {HTMLElement|null}
|
|
128
|
+
*/
|
|
129
|
+
getTreeItemFromEvent(e: Event): HTMLElement | null;
|
|
130
|
+
/**
|
|
131
|
+
* Checks whether the event started from a reorder handle.
|
|
132
|
+
* @param {Event} e User interaction to inspect.
|
|
133
|
+
* @returns {boolean}
|
|
134
|
+
*/
|
|
135
|
+
isReorderHandleEvent(e: Event): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Checks whether a node is a tree item element.
|
|
138
|
+
* @param {object} node The node to inspect.
|
|
139
|
+
* @returns {boolean}
|
|
140
|
+
*/
|
|
141
|
+
isTreeItem(node: object): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Returns direct tree item children for a tree or tree item parent.
|
|
144
|
+
* @param {HTMLElement} parent The parent element.
|
|
145
|
+
* @returns {HTMLElement[]}
|
|
146
|
+
*/
|
|
147
|
+
getDirectTreeItems(parent: HTMLElement): HTMLElement[];
|
|
148
|
+
/**
|
|
149
|
+
* Gets the index of a tree item among direct tree item siblings.
|
|
150
|
+
* @param {HTMLElement} item Element whose sibling position should be resolved.
|
|
151
|
+
* @returns {number}
|
|
152
|
+
*/
|
|
153
|
+
getTreeItemIndex(item: HTMLElement): number;
|
|
154
|
+
/**
|
|
155
|
+
* Determines whether the dragged item can be dropped on the target.
|
|
156
|
+
* @param {HTMLElement} draggedItem Item currently being moved.
|
|
157
|
+
* @param {HTMLElement} targetItem Candidate item under the pointer.
|
|
158
|
+
* @returns {boolean}
|
|
159
|
+
*/
|
|
160
|
+
canDrop(draggedItem: HTMLElement, targetItem: HTMLElement): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Resolves the drop position against the visible tree item row.
|
|
163
|
+
* @param {DragEvent} e Browser drag event carrying pointer coordinates.
|
|
164
|
+
* @param {HTMLElement|null} target Item used to calculate row boundaries.
|
|
165
|
+
* @returns {'before'|'inside'|'after'}
|
|
166
|
+
*/
|
|
167
|
+
getDropPosition(e: DragEvent, target: HTMLElement | null): "before" | "inside" | "after";
|
|
168
|
+
/**
|
|
169
|
+
* Applies the visual drop position to the current target item.
|
|
170
|
+
* @param {HTMLElement} target Item currently showing insertion feedback.
|
|
171
|
+
* @param {string} position Resolved insertion area for the target row.
|
|
172
|
+
* @returns {void}
|
|
173
|
+
*/
|
|
174
|
+
setDropState(target: HTMLElement, position: string): void;
|
|
175
|
+
/**
|
|
176
|
+
* Clears visual drop target state.
|
|
177
|
+
* @returns {void}
|
|
178
|
+
*/
|
|
179
|
+
clearDropState(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Clears the active drag state.
|
|
182
|
+
* @returns {void}
|
|
183
|
+
*/
|
|
184
|
+
clearDragState(): void;
|
|
185
|
+
/**
|
|
186
|
+
* Returns the internal class used to render a drop marker.
|
|
187
|
+
* @param {'before'|'inside'|'after'} position Drop marker position.
|
|
188
|
+
* @returns {string}
|
|
189
|
+
*/
|
|
190
|
+
getDropPositionClass(position: "before" | "inside" | "after"): string;
|
|
191
|
+
/**
|
|
192
|
+
* Moves a tree item relative to another tree item and syncs nesting metadata.
|
|
193
|
+
* @param {HTMLElement} draggedItem The item being moved.
|
|
194
|
+
* @param {HTMLElement} targetItem Item that receives or anchors the moved item.
|
|
195
|
+
* @param {'before'|'inside'|'after'} position The target position.
|
|
196
|
+
* @returns {object|null} Move detail, or null when the move is invalid.
|
|
197
|
+
*/
|
|
198
|
+
moveItem(draggedItem: HTMLElement, targetItem: HTMLElement, position?: "before" | "inside" | "after"): object | null;
|
|
199
|
+
/**
|
|
200
|
+
* Returns cloned direct tree item children for an event detail.
|
|
201
|
+
* @param {HTMLElement} parent Parent whose direct tree item children should be serialized.
|
|
202
|
+
* @returns {HTMLElement[]}
|
|
203
|
+
*/
|
|
204
|
+
getOrderElements(parent: HTMLElement): HTMLElement[];
|
|
205
|
+
/**
|
|
206
|
+
* Returns stable ids for direct tree item children when they are available.
|
|
207
|
+
* @param {HTMLElement} parent Parent whose direct tree item children should be serialized.
|
|
208
|
+
* @returns {Array<string|null>}
|
|
209
|
+
*/
|
|
210
|
+
getOrderIds(parent: HTMLElement): Array<string | null>;
|
|
211
|
+
/**
|
|
212
|
+
* Gets an application-facing id from a tree item.
|
|
213
|
+
* @param {HTMLElement|null} item Tree item to read.
|
|
214
|
+
* @returns {string|null}
|
|
215
|
+
*/
|
|
216
|
+
getItemId(item: HTMLElement | null): string | null;
|
|
217
|
+
/**
|
|
218
|
+
* Syncs item selection mode and nesting metadata after a DOM move.
|
|
219
|
+
* @returns {void}
|
|
220
|
+
*/
|
|
221
|
+
syncTreeItems(): void;
|
|
222
|
+
/**
|
|
223
|
+
* Redraws affected parent items so expand/collapse affordances match current children.
|
|
224
|
+
* @param {HTMLElement[]} items Items that may need refresh.
|
|
225
|
+
* @returns {void}
|
|
72
226
|
*/
|
|
73
|
-
|
|
74
|
-
getSlots(item: any, slotName: any): void;
|
|
227
|
+
refreshMovedItems(items: HTMLElement[]): void;
|
|
75
228
|
/**
|
|
76
229
|
* Updates the state of a checkbox, syncing the state both upwards to parent elements
|
|
77
230
|
* and downwards to child elements as necessary.
|
|
@@ -9,7 +9,21 @@
|
|
|
9
9
|
* @csspart native - The native container of the tree item.
|
|
10
10
|
* @cssproperty [--wje-tree-item-indent=var(--wje-spacing-large)] - Defines the indentation for nested tree items.
|
|
11
11
|
* @cssproperty [--wje-tree-item-indent-guid-width=0px] - Specifies the width of the guide element shown next to a tree item.
|
|
12
|
-
* @cssproperty [--wje-tree-item-
|
|
12
|
+
* @cssproperty [--wje-tree-item-indent-guid-style=solid] - Defines the guide border style for nested tree items.
|
|
13
|
+
* @cssproperty [--wje-tree-item-indent-guid-color=var(--wje-border-color)] - Defines the guide border color for nested tree items.
|
|
14
|
+
* @cssproperty [--wje-tree-item-border-radius=var(--wje-border-radius-medium)] - Sets the border radius of the tree item's container.
|
|
15
|
+
* @cssproperty [--wje-tree-item-border-width=0px] - Sets the border width of the tree item row.
|
|
16
|
+
* @cssproperty [--wje-tree-item-border-style=solid] - Sets the border style of the tree item row.
|
|
17
|
+
* @cssproperty [--wje-tree-item-border-color=transparent] - Sets the border color of the tree item row.
|
|
18
|
+
* @cssproperty [--wje-tree-item-border-color-hover=transparent] - Sets the border color of the hovered tree item row.
|
|
19
|
+
* @cssproperty [--wje-tree-item-border-color-selected=transparent] - Sets the border color of the selected tree item row.
|
|
20
|
+
* @cssproperty [--wje-tree-item-drop-color=var(--wje-color-primary)] - Sets the color of reorder drop indicators.
|
|
21
|
+
* @cssproperty [--wje-tree-item-drop-line-width=2px] - Sets the thickness of before/after reorder drop indicators.
|
|
22
|
+
* @cssproperty [--wje-tree-item-drop-line-border-radius=var(--wje-border-radius-pill)] - Sets the radius of before/after reorder drop indicators.
|
|
23
|
+
* @cssproperty [--wje-tree-item-drop-border-width=1px] - Sets the width of the inside reorder drop border.
|
|
24
|
+
* @cssproperty [--wje-tree-item-drop-border-style=solid] - Sets the style of the inside reorder drop border.
|
|
25
|
+
* @cssproperty [--wje-tree-item-drop-border-color=var(--wje-tree-item-drop-color)] - Sets the color of the inside reorder drop border.
|
|
26
|
+
* @cssproperty [--wje-tree-item-drop-border-radius=inherit] - Sets the radius of the inside reorder drop border.
|
|
13
27
|
* @tag wje-tree-item
|
|
14
28
|
*/
|
|
15
29
|
export default class TreeItem extends HTMLElement {
|
|
@@ -141,7 +155,7 @@ export default class TreeItem extends HTMLElement {
|
|
|
141
155
|
/**
|
|
142
156
|
* Checks whether the given node is a tree item.
|
|
143
157
|
* @param {object} node The node to check.
|
|
144
|
-
* @returns {boolean} Returns true
|
|
158
|
+
* @returns {boolean} Returns true when the node is a tree item element.
|
|
145
159
|
*/
|
|
146
160
|
isTreeItem(node: object): boolean;
|
|
147
161
|
/**
|
|
@@ -151,6 +165,16 @@ export default class TreeItem extends HTMLElement {
|
|
|
151
165
|
* @returns {void} Does not return a value.
|
|
152
166
|
*/
|
|
153
167
|
toggleChildren(): void;
|
|
168
|
+
/**
|
|
169
|
+
* Sets the rendered children visibility and optionally mirrors it to the expanded attribute.
|
|
170
|
+
* @param {boolean} expanded Whether child items should be visible.
|
|
171
|
+
* @param {object} [options] Configuration for attribute syncing.
|
|
172
|
+
* @param {boolean} [options.syncAttribute] Mirrors the visual state to the host attribute when true.
|
|
173
|
+
* @returns {void}
|
|
174
|
+
*/
|
|
175
|
+
setChildrenExpanded(expanded: boolean, options?: {
|
|
176
|
+
syncAttribute?: boolean;
|
|
177
|
+
}): void;
|
|
154
178
|
/**
|
|
155
179
|
* Syncs ARIA attributes on the host element.
|
|
156
180
|
*/
|