@threadlabs/looma 0.23.9 → 0.23.11
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/components/ui-combobox/ui-combobox.html +6 -0
- package/components/ui-combobox/ui-combobox.js +17 -1
- package/components/ui-disclosure/ui-disclosure.html +2 -4
- package/components/ui-tree/ui-tree.html +4 -0
- package/components/ui-tree/ui-tree.js +32 -6
- package/components/ui-tree-item/ui-tree-item.html +21 -8
- package/components/ui-tree-item/ui-tree-item.js +3 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/styles/ui-disclosure.css +0 -3
- package/styles/ui-tree-item.css +12 -4
- package/vanilla/UiCombobox.d.ts +2 -0
- package/vanilla/UiCombobox.js +1 -1
- package/vanilla/UiTree.d.ts +1 -0
- package/vanilla/UiTree.js +1 -1
- package/vanilla/UiTreeItem.js +25 -15
- package/vue/UiCombobox.d.ts +18 -0
- package/vue/UiCombobox.vue +39 -0
- package/vue/UiDisclosure.vue +1 -5
- package/vue/UiTree.d.ts +9 -0
- package/vue/UiTree.vue +31 -1
- package/vue/UiTreeItem.d.ts +3 -3
- package/vue/UiTreeItem.vue +55 -8
- package/vue/chunks/UiCombobox.js +46 -1
- package/vue/chunks/UiDisclosure.js +2 -2
- package/vue/chunks/UiTree.js +24 -1
- package/vue/chunks/UiTreeItem.js +39 -8
- package/vue/components.css +181 -178
package/vue/UiTreeItem.vue
CHANGED
|
@@ -4,6 +4,7 @@ import { computed, getCurrentInstance, provide, ref, useTemplateRef, watchSyncEf
|
|
|
4
4
|
import type { PropType } from 'vue'
|
|
5
5
|
import { createDispatch, useComponentHost } from './host'
|
|
6
6
|
import { checkedProp, propValidityState, vPropValidity } from './props'
|
|
7
|
+
import UiButton from './UiButton.vue'
|
|
7
8
|
|
|
8
9
|
defineOptions({ inheritAttrs: false })
|
|
9
10
|
|
|
@@ -109,7 +110,7 @@ const propValidityContract = {
|
|
|
109
110
|
required: false,
|
|
110
111
|
target: { attribute: 'sortable' },
|
|
111
112
|
description:
|
|
112
|
-
'Gives the item a move handle. Drag it, or activate it and choose a target by a second click or the keyboard. The tree reports reorder and leaves moving the
|
|
113
|
+
'Gives the item a move handle. Drag it, or activate it according to the tree\'s moveActivation and choose a target by a second click or the keyboard. A\n guided move exposes Cancel on this row. The tree reports reorder and leaves moving the item to you. Needs itemId; disabled items show no handle.',
|
|
113
114
|
default: false,
|
|
114
115
|
},
|
|
115
116
|
subtreeDepth: {
|
|
@@ -316,6 +317,7 @@ const internalExpanded = ref(false)
|
|
|
316
317
|
const structuralLevel = ref(1)
|
|
317
318
|
const tabStop = ref(false)
|
|
318
319
|
const isContainer = ref(false)
|
|
320
|
+
const moving = ref(false)
|
|
319
321
|
let guardedPrevious: any
|
|
320
322
|
const guarded = computed(() => {
|
|
321
323
|
if (!(structuralLevel.value == null || Number.isInteger(structuralLevel.value))) {
|
|
@@ -342,6 +344,7 @@ provide('html-next:ui-tree-item:internalExpanded', internalExpanded)
|
|
|
342
344
|
provide('html-next:ui-tree-item:structuralLevel', structuralLevel)
|
|
343
345
|
provide('html-next:ui-tree-item:tabStop', tabStop)
|
|
344
346
|
provide('html-next:ui-tree-item:isContainer', isContainer)
|
|
347
|
+
provide('html-next:ui-tree-item:moving', moving)
|
|
345
348
|
const hydrationNode = hydrationInstance?.vnode.el
|
|
346
349
|
if (
|
|
347
350
|
typeof window !== 'undefined' && hydrationNode != null
|
|
@@ -427,8 +430,21 @@ useComponentHost(() => import('../components/ui-tree-item/ui-tree-item.js'), {
|
|
|
427
430
|
actions: actionsElement,
|
|
428
431
|
children: childrenElement,
|
|
429
432
|
},
|
|
430
|
-
state: { internalExpanded, structuralLevel, tabStop, isContainer },
|
|
433
|
+
state: { internalExpanded, structuralLevel, tabStop, isContainer, moving },
|
|
431
434
|
})
|
|
435
|
+
|
|
436
|
+
function text(value: unknown): string {
|
|
437
|
+
if (Array.isArray(value)) return value.map(text).join(' ')
|
|
438
|
+
return value === null || value === undefined || typeof value === 'object' ? '' : String(value)
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function attribute(value: unknown): any {
|
|
442
|
+
if (
|
|
443
|
+
value === null || value === undefined || value === false
|
|
444
|
+
|| (typeof value === 'object' && !Array.isArray(value))
|
|
445
|
+
) return undefined
|
|
446
|
+
return value === true ? '' : text(value)
|
|
447
|
+
}
|
|
432
448
|
</script>
|
|
433
449
|
|
|
434
450
|
<template>
|
|
@@ -464,7 +480,22 @@ useComponentHost(() => import('../components/ui-tree-item/ui-tree-item.js'), {
|
|
|
464
480
|
class="drag-handle"
|
|
465
481
|
type="button"
|
|
466
482
|
draggable="true"
|
|
467
|
-
:aria-label="
|
|
483
|
+
:aria-label="typeof ((({
|
|
484
|
+
true: `Cancel moving ${checkedProps.label ?? ''}`,
|
|
485
|
+
false: `Drag ${checkedProps.label ?? ''} to reorder`,
|
|
486
|
+
}) as Record<string, any>)[`${moving}`]) === 'boolean'
|
|
487
|
+
? String(
|
|
488
|
+
(({
|
|
489
|
+
true: `Cancel moving ${checkedProps.label ?? ''}`,
|
|
490
|
+
false: `Drag ${checkedProps.label ?? ''} to reorder`,
|
|
491
|
+
}) as Record<string, any>)[`${moving}`],
|
|
492
|
+
)
|
|
493
|
+
: attribute(
|
|
494
|
+
(({
|
|
495
|
+
true: `Cancel moving ${checkedProps.label ?? ''}`,
|
|
496
|
+
false: `Drag ${checkedProps.label ?? ''} to reorder`,
|
|
497
|
+
}) as Record<string, any>)[`${moving}`],
|
|
498
|
+
)"
|
|
468
499
|
ref="dragHandle"
|
|
469
500
|
>
|
|
470
501
|
<svg
|
|
@@ -506,7 +537,15 @@ useComponentHost(() => import('../components/ui-tree-item/ui-tree-item.js'), {
|
|
|
506
537
|
<span class="label" ref="label"><span class="label-text" ref="labelText"><slot name="label">{{
|
|
507
538
|
checkedProps.label
|
|
508
539
|
}}</slot></span></span>
|
|
509
|
-
<span class="actions" ref="actions"><
|
|
540
|
+
<span class="actions" ref="actions"><UiButton
|
|
541
|
+
v-if="moving"
|
|
542
|
+
data-tree-cancel-move=""
|
|
543
|
+
variant="ghost"
|
|
544
|
+
tone="neutral"
|
|
545
|
+
size="sm"
|
|
546
|
+
aria-label="Cancel move"
|
|
547
|
+
>Cancel</UiButton>
|
|
548
|
+
<span><slot name="actions" /></span></span>
|
|
510
549
|
<span class="drop-indicator row-drop-indicator" aria-hidden="true"></span>
|
|
511
550
|
</div>
|
|
512
551
|
<div class="children" role="group" :hidden="guardedBinding2" ref="children"><slot /></div>
|
|
@@ -600,7 +639,12 @@ useComponentHost(() => import('../components/ui-tree-item/ui-tree-item.js'), {
|
|
|
600
639
|
background: var(--ui-disabled-surface);
|
|
601
640
|
}
|
|
602
641
|
|
|
603
|
-
[data-component~="ui-tree-item"][data-dragging] .row {
|
|
642
|
+
[data-component~="ui-tree-item"][data-dragging]:not([data-move-source]) .row {
|
|
643
|
+
opacity: 0.42;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
[data-component~="ui-tree-item"][data-move-source] > .row > .label,
|
|
647
|
+
[data-component~="ui-tree-item"][data-move-source] > .row > .leading {
|
|
604
648
|
opacity: 0.42;
|
|
605
649
|
}
|
|
606
650
|
|
|
@@ -775,7 +819,8 @@ useComponentHost(() => import('../components/ui-tree-item/ui-tree-item.js'), {
|
|
|
775
819
|
/* The controls sit over the label's end, so the text fades out where they begin. The fade is
|
|
776
820
|
the truncation mark while it shows: an ellipsis under it would read as a second one. */
|
|
777
821
|
.row:hover > .label,
|
|
778
|
-
.row:focus-within > .label
|
|
822
|
+
.row:focus-within > .label,
|
|
823
|
+
[data-component~="ui-tree-item"][data-move-source] > .row > .label {
|
|
779
824
|
text-overflow: clip;
|
|
780
825
|
mask-image: linear-gradient(
|
|
781
826
|
to right,
|
|
@@ -785,7 +830,8 @@ useComponentHost(() => import('../components/ui-tree-item/ui-tree-item.js'), {
|
|
|
785
830
|
}
|
|
786
831
|
|
|
787
832
|
.row:hover > .label:dir(rtl),
|
|
788
|
-
.row:focus-within > .label:dir(rtl)
|
|
833
|
+
.row:focus-within > .label:dir(rtl),
|
|
834
|
+
[data-component~="ui-tree-item"][data-move-source] > .row > .label:dir(rtl) {
|
|
789
835
|
mask-image: linear-gradient(
|
|
790
836
|
to left,
|
|
791
837
|
#000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-1)),
|
|
@@ -872,7 +918,8 @@ useComponentHost(() => import('../components/ui-tree-item/ui-tree-item.js'), {
|
|
|
872
918
|
}
|
|
873
919
|
|
|
874
920
|
.row:hover > .actions,
|
|
875
|
-
.row:focus-within > .actions
|
|
921
|
+
.row:focus-within > .actions,
|
|
922
|
+
[data-component~="ui-tree-item"][data-move-source] > .row > .actions {
|
|
876
923
|
opacity: 1;
|
|
877
924
|
pointer-events: auto;
|
|
878
925
|
}
|
package/vue/chunks/UiCombobox.js
CHANGED
|
@@ -9,6 +9,7 @@ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock
|
|
|
9
9
|
var _hoisted_1 = [
|
|
10
10
|
"data-allow-create",
|
|
11
11
|
"data-allow-free-text",
|
|
12
|
+
"data-auto-highlight",
|
|
12
13
|
"data-clearable",
|
|
13
14
|
"data-disabled",
|
|
14
15
|
"data-disclosure",
|
|
@@ -26,6 +27,7 @@ var _hoisted_1 = [
|
|
|
26
27
|
"data-query",
|
|
27
28
|
"data-readonly",
|
|
28
29
|
"data-required",
|
|
30
|
+
"data-select-on-tab",
|
|
29
31
|
"data-selected-values",
|
|
30
32
|
"data-size",
|
|
31
33
|
"data-token-separators",
|
|
@@ -140,6 +142,10 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
140
142
|
type: null,
|
|
141
143
|
default: false
|
|
142
144
|
},
|
|
145
|
+
autoHighlight: {
|
|
146
|
+
type: null,
|
|
147
|
+
default: "none"
|
|
148
|
+
},
|
|
143
149
|
clearable: {
|
|
144
150
|
type: null,
|
|
145
151
|
default: false
|
|
@@ -208,6 +214,10 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
208
214
|
type: null,
|
|
209
215
|
default: false
|
|
210
216
|
},
|
|
217
|
+
selectOnTab: {
|
|
218
|
+
type: null,
|
|
219
|
+
default: false
|
|
220
|
+
},
|
|
211
221
|
selectedValues: {
|
|
212
222
|
type: null,
|
|
213
223
|
default: null
|
|
@@ -263,6 +273,17 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
263
273
|
description: "Allows values that do not match an authored option.",
|
|
264
274
|
default: false
|
|
265
275
|
},
|
|
276
|
+
autoHighlight: {
|
|
277
|
+
type: {
|
|
278
|
+
kind: "terminal",
|
|
279
|
+
name: "keyword"
|
|
280
|
+
},
|
|
281
|
+
required: false,
|
|
282
|
+
target: { attribute: "autohighlight" },
|
|
283
|
+
description: "single highlights the only enabled authored suggestion while typing. Ambiguous results and an empty query stay unhighlighted. none preserves manual\n highlighting with the arrow keys.",
|
|
284
|
+
values: ["none", "single"],
|
|
285
|
+
default: "none"
|
|
286
|
+
},
|
|
266
287
|
clearable: {
|
|
267
288
|
type: {
|
|
268
289
|
kind: "terminal",
|
|
@@ -531,6 +552,16 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
531
552
|
description: "Requires a value: adds an asterisk to the label, marks the input required for native form validation, and makes validation report \"A value is required.\"\n when the field is left empty. In multiple mode a chosen item satisfies it, whatever is left in the input.",
|
|
532
553
|
default: false
|
|
533
554
|
},
|
|
555
|
+
selectOnTab: {
|
|
556
|
+
type: {
|
|
557
|
+
kind: "terminal",
|
|
558
|
+
name: "boolean"
|
|
559
|
+
},
|
|
560
|
+
required: false,
|
|
561
|
+
target: { attribute: "selectontab" },
|
|
562
|
+
description: "Commits a highlighted authored suggestion on forward Tab, then lets focus advance normally. In multiple mode a selected suggestion is retained without\n duplication or removal. Shift+Tab does not commit, and Tab never chooses the create offer.",
|
|
563
|
+
default: false
|
|
564
|
+
},
|
|
534
565
|
selectedValues: {
|
|
535
566
|
type: {
|
|
536
567
|
kind: "list",
|
|
@@ -584,6 +615,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
584
615
|
const acceptedProps = {
|
|
585
616
|
allowCreate: false,
|
|
586
617
|
allowFreeText: false,
|
|
618
|
+
autoHighlight: "none",
|
|
587
619
|
clearable: false,
|
|
588
620
|
disabled: false,
|
|
589
621
|
disclosure: false,
|
|
@@ -601,6 +633,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
601
633
|
query: null,
|
|
602
634
|
readonly: false,
|
|
603
635
|
required: false,
|
|
636
|
+
selectOnTab: false,
|
|
604
637
|
selectedValues: null,
|
|
605
638
|
size: "md",
|
|
606
639
|
tokenSeparators: null,
|
|
@@ -615,6 +648,10 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
615
648
|
kind: "terminal",
|
|
616
649
|
name: "boolean"
|
|
617
650
|
}, false, "allowFreeText", acceptedProps),
|
|
651
|
+
autoHighlight: checkedProp(props["autoHighlight"], {
|
|
652
|
+
kind: "terminal",
|
|
653
|
+
name: "keyword"
|
|
654
|
+
}, false, "autoHighlight", acceptedProps),
|
|
618
655
|
clearable: checkedProp(props["clearable"], {
|
|
619
656
|
kind: "terminal",
|
|
620
657
|
name: "boolean"
|
|
@@ -781,6 +818,10 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
781
818
|
kind: "terminal",
|
|
782
819
|
name: "boolean"
|
|
783
820
|
}, false, "required", acceptedProps),
|
|
821
|
+
selectOnTab: checkedProp(props["selectOnTab"], {
|
|
822
|
+
kind: "terminal",
|
|
823
|
+
name: "boolean"
|
|
824
|
+
}, false, "selectOnTab", acceptedProps),
|
|
784
825
|
selectedValues: checkedProp(props["selectedValues"], {
|
|
785
826
|
kind: "list",
|
|
786
827
|
item: {
|
|
@@ -1063,6 +1104,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
1063
1104
|
propNames: [
|
|
1064
1105
|
"allowCreate",
|
|
1065
1106
|
"allowFreeText",
|
|
1107
|
+
"autoHighlight",
|
|
1066
1108
|
"clearable",
|
|
1067
1109
|
"disabled",
|
|
1068
1110
|
"disclosure",
|
|
@@ -1080,6 +1122,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
1080
1122
|
"query",
|
|
1081
1123
|
"readonly",
|
|
1082
1124
|
"required",
|
|
1125
|
+
"selectOnTab",
|
|
1083
1126
|
"selectedValues",
|
|
1084
1127
|
"size",
|
|
1085
1128
|
"tokenSeparators",
|
|
@@ -1176,6 +1219,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
1176
1219
|
return withDirectives((openBlock(), createElementBlock("div", mergeProps({ "data-component": "ui-combobox" }, nativeAttrs(_ctx.$attrs), {
|
|
1177
1220
|
"data-allow-create": reflectedProp("allowCreate", "allow-create", checkedProps.value.allowCreate, void 0, false),
|
|
1178
1221
|
"data-allow-free-text": reflectedProp("allowFreeText", "allow-free-text", checkedProps.value.allowFreeText, void 0, false),
|
|
1222
|
+
"data-auto-highlight": reflectedProp("autoHighlight", "auto-highlight", checkedProps.value.autoHighlight, void 0, false),
|
|
1179
1223
|
"data-clearable": reflectedProp("clearable", "clearable", checkedProps.value.clearable, void 0, false),
|
|
1180
1224
|
"data-disabled": reflectedProp("disabled", "disabled", checkedProps.value.disabled, void 0, false),
|
|
1181
1225
|
"data-disclosure": reflectedProp("disclosure", "disclosure", checkedProps.value.disclosure, void 0, false),
|
|
@@ -1193,6 +1237,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
1193
1237
|
"data-query": reflectedProp("query", "query", checkedProps.value.query, void 0, false),
|
|
1194
1238
|
"data-readonly": reflectedProp("readonly", "readonly", checkedProps.value.readonly, void 0, false),
|
|
1195
1239
|
"data-required": reflectedProp("required", "required", checkedProps.value.required, void 0, false),
|
|
1240
|
+
"data-select-on-tab": reflectedProp("selectOnTab", "select-on-tab", checkedProps.value.selectOnTab, void 0, false),
|
|
1196
1241
|
"data-selected-values": reflectedProp("selectedValues", "selected-values", checkedProps.value.selectedValues, void 0, false),
|
|
1197
1242
|
"data-size": reflectedProp("size", "size", checkedProps.value.size, void 0, false),
|
|
1198
1243
|
"data-token-separators": reflectedProp("tokenSeparators", "token-separators", checkedProps.value.tokenSeparators, void 0, false),
|
|
@@ -1413,6 +1458,6 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
1413
1458
|
}]]);
|
|
1414
1459
|
};
|
|
1415
1460
|
}
|
|
1416
|
-
}), [["__scopeId", "data-v-
|
|
1461
|
+
}), [["__scopeId", "data-v-8e9a00eb"]]);
|
|
1417
1462
|
//#endregion
|
|
1418
1463
|
export { UiCombobox_default as t };
|
|
@@ -167,7 +167,7 @@ var UiDisclosure_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
167
167
|
},
|
|
168
168
|
required: false,
|
|
169
169
|
target: { attribute: "variant" },
|
|
170
|
-
description: "Navigation shares icon columns, spacing, type, hover, and corners with Nav Item. Plain retains the standard disclosure treatment.",
|
|
170
|
+
description: "Navigation shares icon columns, spacing, type, hover, and corners with Nav Item, while keeping expanded sections neutral: opening content is not route\n selection. Plain retains the standard disclosure treatment.",
|
|
171
171
|
values: ["plain", "navigation"],
|
|
172
172
|
default: "plain"
|
|
173
173
|
}
|
|
@@ -385,6 +385,6 @@ var UiDisclosure_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
385
385
|
}]]);
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
|
-
}), [["__scopeId", "data-v-
|
|
388
|
+
}), [["__scopeId", "data-v-a6fee58b"]]);
|
|
389
389
|
//#endregion
|
|
390
390
|
export { UiDisclosure_default as t };
|
package/vue/chunks/UiTree.js
CHANGED
|
@@ -9,6 +9,7 @@ var _hoisted_1 = [
|
|
|
9
9
|
"data-label",
|
|
10
10
|
"data-marquee",
|
|
11
11
|
"data-max-depth",
|
|
12
|
+
"data-move-activation",
|
|
12
13
|
"data-selection",
|
|
13
14
|
"data-ui-tree-state"
|
|
14
15
|
];
|
|
@@ -38,6 +39,10 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
|
|
|
38
39
|
type: null,
|
|
39
40
|
default: 0
|
|
40
41
|
},
|
|
42
|
+
moveActivation: {
|
|
43
|
+
type: null,
|
|
44
|
+
default: "click"
|
|
45
|
+
},
|
|
41
46
|
selection: {
|
|
42
47
|
type: null,
|
|
43
48
|
default: "none"
|
|
@@ -103,6 +108,17 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
|
|
|
103
108
|
description: "The deepest level a drag may produce, counting the top level as 1. A drop that would place the dragged item, or any item beneath it, deeper than this is\n refused and reported as reorder-rejected. 0 means no limit.",
|
|
104
109
|
default: 0
|
|
105
110
|
},
|
|
111
|
+
moveActivation: {
|
|
112
|
+
type: {
|
|
113
|
+
kind: "terminal",
|
|
114
|
+
name: "keyword"
|
|
115
|
+
},
|
|
116
|
+
required: false,
|
|
117
|
+
target: { attribute: "moveactivation" },
|
|
118
|
+
description: "Which handle activations start guided moving. click preserves two-click moving with any pointer. keyboard-touch leaves ordinary mouse and pen clicks inert\n while retaining keyboard activation and touch taps. Actual pointer dragging works in either mode. Guided moves show Cancel on the source row; Escape or\n reactivating that source handle also cancels without requesting a reorder.",
|
|
119
|
+
values: ["click", "keyboard-touch"],
|
|
120
|
+
default: "click"
|
|
121
|
+
},
|
|
106
122
|
selection: {
|
|
107
123
|
type: {
|
|
108
124
|
kind: "terminal",
|
|
@@ -126,6 +142,7 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
|
|
|
126
142
|
label: "Tree",
|
|
127
143
|
marquee: false,
|
|
128
144
|
maxDepth: 0,
|
|
145
|
+
moveActivation: "click",
|
|
129
146
|
selection: "none"
|
|
130
147
|
};
|
|
131
148
|
const checkedProps = computed(() => ({
|
|
@@ -149,6 +166,10 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
|
|
|
149
166
|
kind: "terminal",
|
|
150
167
|
name: "number"
|
|
151
168
|
}, false, "maxDepth", acceptedProps),
|
|
169
|
+
moveActivation: checkedProp(props["moveActivation"], {
|
|
170
|
+
kind: "terminal",
|
|
171
|
+
name: "keyword"
|
|
172
|
+
}, false, "moveActivation", acceptedProps),
|
|
152
173
|
selection: checkedProp(props["selection"], {
|
|
153
174
|
kind: "terminal",
|
|
154
175
|
name: "keyword"
|
|
@@ -236,6 +257,7 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
|
|
|
236
257
|
"label",
|
|
237
258
|
"marquee",
|
|
238
259
|
"maxDepth",
|
|
260
|
+
"moveActivation",
|
|
239
261
|
"selection"
|
|
240
262
|
],
|
|
241
263
|
propValidity: (name) => propValidityState({
|
|
@@ -253,6 +275,7 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
|
|
|
253
275
|
"data-label": reflectedProp("label", "label", checkedProps.value.label, void 0, false),
|
|
254
276
|
"data-marquee": reflectedProp("marquee", "marquee", checkedProps.value.marquee, void 0, false),
|
|
255
277
|
"data-max-depth": reflectedProp("maxDepth", "max-depth", checkedProps.value.maxDepth, void 0, false),
|
|
278
|
+
"data-move-activation": reflectedProp("moveActivation", "move-activation", checkedProps.value.moveActivation, void 0, false),
|
|
256
279
|
"data-selection": reflectedProp("selection", "selection", checkedProps.value.selection, void 0, false),
|
|
257
280
|
"data-ui-tree-state": hostState.value || void 0,
|
|
258
281
|
ref_key: "root",
|
|
@@ -263,6 +286,6 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
|
|
|
263
286
|
}]]);
|
|
264
287
|
};
|
|
265
288
|
}
|
|
266
|
-
}), [["__scopeId", "data-v-
|
|
289
|
+
}), [["__scopeId", "data-v-7845ed59"]]);
|
|
267
290
|
//#endregion
|
|
268
291
|
export { UiTree_default as t };
|
package/vue/chunks/UiTreeItem.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
2
2
|
import { r as useComponentHost, t as createDispatch } from "./host.js";
|
|
3
3
|
import { i as vPropValidity, n as propValidityState, t as checkedProp } from "./props.js";
|
|
4
|
-
import {
|
|
4
|
+
import { t as UiButton_default } from "./UiButton.js";
|
|
5
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, renderSlot, toDisplayString, unref, useTemplateRef, watchSyncEffect, withCtx, withDirectives } from "vue";
|
|
5
6
|
//#region .build/vue/UiTreeItem.vue?vue&type=script&setup=true&lang.ts
|
|
6
7
|
var _hoisted_1 = [
|
|
7
8
|
"aria-label",
|
|
@@ -245,7 +246,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
245
246
|
},
|
|
246
247
|
required: false,
|
|
247
248
|
target: { attribute: "sortable" },
|
|
248
|
-
description: "Gives the item a move handle. Drag it, or activate it and choose a target by a second click or the keyboard. The tree reports reorder and leaves moving the
|
|
249
|
+
description: "Gives the item a move handle. Drag it, or activate it according to the tree's moveActivation and choose a target by a second click or the keyboard. A\n guided move exposes Cancel on this row. The tree reports reorder and leaves moving the item to you. Needs itemId; disabled items show no handle.",
|
|
249
250
|
default: false
|
|
250
251
|
},
|
|
251
252
|
subtreeDepth: {
|
|
@@ -364,6 +365,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
364
365
|
const structuralLevel = ref(1);
|
|
365
366
|
const tabStop = ref(false);
|
|
366
367
|
const isContainer = ref(false);
|
|
368
|
+
const moving = ref(false);
|
|
367
369
|
let guardedPrevious;
|
|
368
370
|
const guarded = computed(() => {
|
|
369
371
|
if (!(structuralLevel.value == null || Number.isInteger(structuralLevel.value))) return guardedPrevious;
|
|
@@ -383,6 +385,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
383
385
|
provide("html-next:ui-tree-item:structuralLevel", structuralLevel);
|
|
384
386
|
provide("html-next:ui-tree-item:tabStop", tabStop);
|
|
385
387
|
provide("html-next:ui-tree-item:isContainer", isContainer);
|
|
388
|
+
provide("html-next:ui-tree-item:moving", moving);
|
|
386
389
|
const hydrationNode = hydrationInstance?.vnode.el;
|
|
387
390
|
if (typeof window !== "undefined" && hydrationNode != null && (!(hydrationNode instanceof Element) || hydrationNode.localName !== "div")) throw Object.assign(/* @__PURE__ */ new Error("HR005: Server markup for <ui-tree-item> has an incompatible root."), {
|
|
388
391
|
name: "HtmlDiagnosticError",
|
|
@@ -458,9 +461,18 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
458
461
|
internalExpanded,
|
|
459
462
|
structuralLevel,
|
|
460
463
|
tabStop,
|
|
461
|
-
isContainer
|
|
464
|
+
isContainer,
|
|
465
|
+
moving
|
|
462
466
|
}
|
|
463
467
|
});
|
|
468
|
+
function text(value) {
|
|
469
|
+
if (Array.isArray(value)) return value.map(text).join(" ");
|
|
470
|
+
return value === null || value === void 0 || typeof value === "object" ? "" : String(value);
|
|
471
|
+
}
|
|
472
|
+
function attribute(value) {
|
|
473
|
+
if (value === null || value === void 0 || value === false || typeof value === "object" && !Array.isArray(value)) return void 0;
|
|
474
|
+
return value === true ? "" : text(value);
|
|
475
|
+
}
|
|
464
476
|
return (_ctx, _cache) => {
|
|
465
477
|
return withDirectives((openBlock(), createElementBlock("div", mergeProps({
|
|
466
478
|
"data-component": "ui-tree-item",
|
|
@@ -494,7 +506,16 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
494
506
|
class: "drag-handle",
|
|
495
507
|
type: "button",
|
|
496
508
|
draggable: "true",
|
|
497
|
-
"aria-label":
|
|
509
|
+
"aria-label": typeof {
|
|
510
|
+
true: `Cancel moving ${checkedProps.value.label ?? ""}`,
|
|
511
|
+
false: `Drag ${checkedProps.value.label ?? ""} to reorder`
|
|
512
|
+
}[`${moving.value}`] === "boolean" ? String({
|
|
513
|
+
true: `Cancel moving ${checkedProps.value.label ?? ""}`,
|
|
514
|
+
false: `Drag ${checkedProps.value.label ?? ""} to reorder`
|
|
515
|
+
}[`${moving.value}`]) : attribute({
|
|
516
|
+
true: `Cancel moving ${checkedProps.value.label ?? ""}`,
|
|
517
|
+
false: `Drag ${checkedProps.value.label ?? ""} to reorder`
|
|
518
|
+
}[`${moving.value}`]),
|
|
498
519
|
ref: "dragHandle"
|
|
499
520
|
}, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
500
521
|
"aria-hidden": "true",
|
|
@@ -557,8 +578,18 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
557
578
|
}, null, 8, _hoisted_6)]),
|
|
558
579
|
createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "leading")], 512),
|
|
559
580
|
createElementVNode("span", _hoisted_8, [createElementVNode("span", _hoisted_9, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(checkedProps.value.label), 1)])], 512)], 512),
|
|
560
|
-
createElementVNode("span", _hoisted_10, [
|
|
561
|
-
|
|
581
|
+
createElementVNode("span", _hoisted_10, [moving.value ? (openBlock(), createBlock(UiButton_default, {
|
|
582
|
+
key: 0,
|
|
583
|
+
"data-tree-cancel-move": "",
|
|
584
|
+
variant: "ghost",
|
|
585
|
+
tone: "neutral",
|
|
586
|
+
size: "sm",
|
|
587
|
+
"aria-label": "Cancel move"
|
|
588
|
+
}, {
|
|
589
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Cancel", -1)])]),
|
|
590
|
+
_: 1
|
|
591
|
+
})) : createCommentVNode("v-if", true), createElementVNode("span", null, [renderSlot(_ctx.$slots, "actions")])], 512),
|
|
592
|
+
_cache[3] || (_cache[3] = createElementVNode("span", {
|
|
562
593
|
class: "drop-indicator row-drop-indicator",
|
|
563
594
|
"aria-hidden": "true"
|
|
564
595
|
}, null, -1))
|
|
@@ -569,7 +600,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
569
600
|
hidden: guardedBinding2.value,
|
|
570
601
|
ref: "children"
|
|
571
602
|
}, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_11),
|
|
572
|
-
_cache[
|
|
603
|
+
_cache[4] || (_cache[4] = createElementVNode("span", {
|
|
573
604
|
class: "drop-indicator subtree-drop-indicator",
|
|
574
605
|
"aria-hidden": "true"
|
|
575
606
|
}, null, -1))
|
|
@@ -579,6 +610,6 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
579
610
|
}]]);
|
|
580
611
|
};
|
|
581
612
|
}
|
|
582
|
-
}), [["__scopeId", "data-v-
|
|
613
|
+
}), [["__scopeId", "data-v-d2b1bbe0"]]);
|
|
583
614
|
//#endregion
|
|
584
615
|
export { UiTreeItem_default as t };
|