@webority/ui-elements 0.168.0 → 0.169.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/dist/{WuiCommentThread-AYovTYSA.js → WuiCommentThread-RB100aB1.js} +1 -1
- package/dist/{WuiContextMenu-CyejQsef.js → WuiContextMenu-ClMVFeos.js} +1 -1
- package/dist/{WuiDataTable-BniN81KC.js → WuiDataTable-D0tGIVtG.js} +1 -1
- package/dist/{WuiDatePicker-q0s8tL_E.js → WuiDatePicker-BiZciUAZ.js} +1 -1
- package/dist/{WuiDateRange-p2r5A9CY.js → WuiDateRange-DSq6Mj4v.js} +1 -1
- package/dist/{WuiDrawer-CQ7nRHUD.js → WuiDrawer-n8WlVPq_.js} +1 -1
- package/dist/{WuiDropdown-BQC04Q48.js → WuiDropdown-D2jEbCfv.js} +1 -1
- package/dist/{WuiEntryGrid-DPAYNu1v.js → WuiEntryGrid-Bm5_MizA.js} +1 -1
- package/dist/WuiGantt-BsQUCR2U.js +1 -0
- package/dist/{WuiHoverCard-DRZh88zM.js → WuiHoverCard-DmApQa9R.js} +1 -1
- package/dist/{WuiInlineEdit-CEjs5Ruk.js → WuiInlineEdit-C64O31MF.js} +1 -1
- package/dist/{WuiLightbox-DDQAOabU.js → WuiLightbox-cm5eHcMK.js} +1 -1
- package/dist/{WuiMentionInput-CkhrCz_2.js → WuiMentionInput-D7HC7U2Q.js} +1 -1
- package/dist/{WuiModal-BRILsSMq.js → WuiModal-DuBerYTv.js} +1 -1
- package/dist/{WuiNavigationMenu-BCnqv7e-.js → WuiNavigationMenu-VG-ZJstT.js} +1 -1
- package/dist/{WuiNotificationCenter-BCXT3Y7m.js → WuiNotificationCenter-hluDIzO8.js} +1 -1
- package/dist/{WuiOverflow-DtetLQHW.js → WuiOverflow-MzrZwzud.js} +1 -1
- package/dist/{WuiPhone-B6jgFRSi.js → WuiPhone-C03OuI7-.js} +1 -1
- package/dist/{WuiPopover-BzVxNSs1.js → WuiPopover-BxQj74kE.js} +1 -1
- package/dist/{WuiRelativeTime-DTGKGHbK.js → WuiRelativeTime-CujAFS_w.js} +1 -1
- package/dist/WuiSelect-DpZbgU4v.js +9 -0
- package/dist/{WuiShortcuts-DSjwaZx7.js → WuiShortcuts-CSFOyAKI.js} +1 -1
- package/dist/{WuiTimePicker-C5XouoR7.js → WuiTimePicker-BxcImgm1.js} +1 -1
- package/dist/{WuiTour-BDOGWyNA.js → WuiTour-Beop0n-H.js} +1 -1
- package/dist/WuiTree-DGclk55_.js +1 -0
- package/dist/WuiTreePicker-CBhasmC5.js +1 -0
- package/dist/{WuiWhatsNew-DOo54GiH.js → WuiWhatsNew-BtWJkzTv.js} +1 -1
- package/dist/anchorOverlay-DSzkGQPi.js +1 -0
- package/dist/avatarHtml-BtbN7cA5.js +1 -0
- package/dist/{calendarMath-CFjBxJYM.js → calendarMath-ChZ_s7HH.js} +1 -1
- package/dist/{chips-CemguTKJ.js → chips-IbfKMhVk.js} +1 -1
- package/dist/{dataTable-CKz4Oncc.js → dataTable-sRTzep19.js} +1 -1
- package/dist/{drawerDiscard-BjykHS_G.js → drawerDiscard-CIZZuKmY.js} +1 -1
- package/dist/elements/comment-thread.js +1 -1
- package/dist/elements/context-menu.js +1 -1
- package/dist/elements/data-table.js +1 -1
- package/dist/elements/date-range.js +1 -1
- package/dist/elements/datepicker.js +1 -1
- package/dist/elements/drawer.js +1 -1
- package/dist/elements/dropdown.js +1 -1
- package/dist/elements/entry-grid.js +1 -1
- package/dist/elements/filter-popover.js +1 -1
- package/dist/elements/gantt.js +1 -0
- package/dist/elements/hover-card.js +1 -1
- package/dist/elements/inline-edit.js +1 -1
- package/dist/elements/kanban.js +1 -1
- package/dist/elements/lightbox.js +1 -1
- package/dist/elements/mention-input.js +1 -1
- package/dist/elements/modal.js +1 -1
- package/dist/elements/navigation-menu.js +1 -1
- package/dist/elements/notification-center.js +1 -1
- package/dist/elements/overflow.js +1 -1
- package/dist/elements/phone.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/relative-time.js +1 -1
- package/dist/elements/select.js +1 -1
- package/dist/elements/shortcuts.js +1 -1
- package/dist/elements/timepicker.js +1 -1
- package/dist/elements/tour.js +1 -1
- package/dist/elements/tree-picker.js +1 -0
- package/dist/elements/tree.js +1 -1
- package/dist/elements/whats-new.js +1 -1
- package/dist/{fileViewer.g-B5XQ5WKr.js → fileViewer.g-DQ-YkF8l.js} +1 -1
- package/dist/{fileViewerImage-B0Q9zdgW.js → fileViewerImage-DT0a9KaL.js} +1 -1
- package/dist/{fileViewerMedia-D3fdG-Ti.js → fileViewerMedia-BFNxdaYX.js} +1 -1
- package/dist/{fileViewerPdf-DeRWa1JE.js → fileViewerPdf-Boo6uXQO.js} +1 -1
- package/dist/{filterPopover-DmeVG4_N.js → filterPopover-BVBxgtc5.js} +1 -1
- package/dist/{formatters-Dy4kQQ_h.js → formatters-CMTSYlW9.js} +1 -1
- package/dist/gantt.g-TdTxeruW.js +1 -0
- package/dist/helpers.js +1 -1
- package/dist/initials-Qb6ITcri.js +1 -0
- package/dist/{inlineEditText-BUO5sZxN.js → inlineEditText-5FT8SGqR.js} +1 -1
- package/dist/{kanban-CEZmyYFY.js → kanban-CRRLqNn_.js} +1 -1
- package/dist/{kanbanModel-Dp5c1rTs.js → kanbanModel-sAwpMCpn.js} +1 -1
- package/dist/listboxKeyNav-DtlIOryj.js +1 -0
- package/dist/loader-Cf_ozcXz.js +1 -0
- package/dist/{nativeOverlay-C1Rw2gIW.js → nativeOverlay-D3VmY8qn.js} +1 -1
- package/dist/{notificationDays-B7cbYu4q.js → notificationDays-DQlrEZ3z.js} +1 -1
- package/dist/{relativeTime-CdFw-ekO.js → relativeTime-CQuwuwZ-.js} +1 -1
- package/dist/search-BVox4aaA.js +1 -0
- package/dist/server.js +1 -1
- package/dist/text/en.json +145 -0
- package/dist/text.js +1 -1
- package/dist/treePicker.g-BR35ru5f.js +1 -0
- package/dist/ui-chart.global.js +2 -2
- package/dist/ui-chart.js +2 -2
- package/dist/ui-elements/carousel.global.js +1 -1
- package/dist/ui-elements/code-block.global.js +1 -1
- package/dist/ui-elements/command-palette.global.js +1 -1
- package/dist/ui-elements/comment-thread.global.js +1 -1
- package/dist/ui-elements/consent-banner.global.js +1 -1
- package/dist/ui-elements/context-menu.global.js +1 -1
- package/dist/ui-elements/date-range.global.js +1 -1
- package/dist/ui-elements/drawer.global.js +1 -1
- package/dist/ui-elements/dropdown.global.js +1 -1
- package/dist/ui-elements/entry-grid.global.js +2 -2
- package/dist/ui-elements/gantt.global.js +1 -0
- package/dist/ui-elements/glyphs.global.js +1 -1
- package/dist/ui-elements/image-crop.global.js +1 -1
- package/dist/ui-elements/inline-edit.global.js +1 -1
- package/dist/ui-elements/kanban.global.js +1 -1
- package/dist/ui-elements/lead-popup.global.js +1 -1
- package/dist/ui-elements/lightbox.global.js +1 -1
- package/dist/ui-elements/markdown.global.js +1 -1
- package/dist/ui-elements/org-tree.global.js +1 -1
- package/dist/ui-elements/phone.global.js +1 -1
- package/dist/ui-elements/popover.global.js +1 -1
- package/dist/ui-elements/saved-views.global.js +1 -1
- package/dist/ui-elements/select-chips.global.js +1 -1
- package/dist/ui-elements/select-recents.global.js +1 -1
- package/dist/ui-elements/select-search.global.js +1 -1
- package/dist/ui-elements/select-window.global.js +1 -0
- package/dist/ui-elements/slider.global.js +1 -1
- package/dist/ui-elements/sortable.global.js +1 -1
- package/dist/ui-elements/status-icon.global.js +1 -1
- package/dist/ui-elements/timepicker.global.js +1 -1
- package/dist/ui-elements/tour.global.js +1 -1
- package/dist/ui-elements/tree-picker.global.js +1 -0
- package/dist/ui-elements/tree.global.js +1 -1
- package/dist/ui-elements/wizard.global.js +1 -1
- package/dist/ui-elements.global.js +21 -21
- package/dist/ui-elements.js +1 -1
- package/dist/ui-file-viewer.global.js +1 -1
- package/dist/ui-file-viewer.js +1 -1
- package/dist/ui-tour.global.js +1 -1
- package/dist/window-BZWK3rQk.js +1 -0
- package/package.json +13 -5
- package/types/WuiGantt.d.ts +70 -0
- package/types/WuiSelect.d.ts +9 -0
- package/types/WuiTree.d.ts +37 -2
- package/types/WuiTreePicker.d.ts +64 -0
- package/types/chartSpec.d.ts +1 -1
- package/types/elements/gantt.d.ts +2 -0
- package/types/elements/tree-picker.d.ts +2 -0
- package/types/formatters.d.ts +6 -4
- package/types/ganttLayout.d.ts +116 -0
- package/types/ganttTable.d.ts +24 -0
- package/types/ganttTypes.d.ts +43 -0
- package/types/global/parts/select-window.d.ts +1 -0
- package/types/global/shared.d.ts +4 -0
- package/types/globals.d.ts +5 -1
- package/types/helpers.d.ts +3 -0
- package/types/index.d.ts +5 -1
- package/types/initials.d.ts +5 -0
- package/types/listboxKeyNav.d.ts +13 -0
- package/types/select/list.d.ts +58 -2
- package/types/select/window.d.ts +39 -0
- package/types/select/windowLoad.d.ts +1 -0
- package/types/select/windowLoadGlobal.d.ts +1 -0
- package/types/select/windowThreshold.d.ts +1 -0
- package/types/select/windowed.d.ts +2 -0
- package/types/text/web/catalogue.g.d.ts +12 -0
- package/types/text/web/gantt.g.d.ts +47 -0
- package/types/text/web/idleTimeoutDialog.g.d.ts +7 -0
- package/types/text/web/index.g.d.ts +6 -0
- package/types/text/web/loadMore.g.d.ts +8 -0
- package/types/text/web/queryBuilder.g.d.ts +59 -0
- package/types/text/web/transferList.g.d.ts +18 -0
- package/types/text/web/treePicker.g.d.ts +12 -0
- package/types/treePicker/treeKeys.d.ts +46 -0
- package/types/treePicker/treePickerView.d.ts +31 -0
- package/types/treePicker/treeState.d.ts +42 -0
- package/dist/WuiSelect-CMHoPHlx.js +0 -9
- package/dist/WuiTree-CeYbyaCx.js +0 -1
- package/dist/anchorOverlay-B8fu8hjz.js +0 -1
- package/dist/listboxKeyNav-CF7tMDGG.js +0 -1
- package/dist/loader-CQJFj96n.js +0 -1
- package/dist/search-Cj1YQUwK.js +0 -1
|
@@ -47,8 +47,10 @@ export * from "./filterBar.g.ts";
|
|
|
47
47
|
export * from "./floatingDock.g.ts";
|
|
48
48
|
export * from "./formatters.g.ts";
|
|
49
49
|
export * from "./formulaSteps.g.ts";
|
|
50
|
+
export * from "./gantt.g.ts";
|
|
50
51
|
export * from "./hoverCard.g.ts";
|
|
51
52
|
export * from "./httpFailure.g.ts";
|
|
53
|
+
export * from "./idleTimeoutDialog.g.ts";
|
|
52
54
|
export * from "./imageCrop.g.ts";
|
|
53
55
|
export * from "./imagePicker.g.ts";
|
|
54
56
|
export * from "./infoTip.g.ts";
|
|
@@ -61,6 +63,7 @@ export * from "./kpiTile.g.ts";
|
|
|
61
63
|
export * from "./labelHelp.g.ts";
|
|
62
64
|
export * from "./leadPopup.g.ts";
|
|
63
65
|
export * from "./lightbox.g.ts";
|
|
66
|
+
export * from "./loadMore.g.ts";
|
|
64
67
|
export * from "./mentionInput.g.ts";
|
|
65
68
|
export * from "./modal.g.ts";
|
|
66
69
|
export * from "./modalCardRenderer.g.ts";
|
|
@@ -81,6 +84,7 @@ export * from "./phone.g.ts";
|
|
|
81
84
|
export * from "./phoneNumberInput.g.ts";
|
|
82
85
|
export * from "./pricingCard.g.ts";
|
|
83
86
|
export * from "./qrCode.g.ts";
|
|
87
|
+
export * from "./queryBuilder.g.ts";
|
|
84
88
|
export * from "./radio.g.ts";
|
|
85
89
|
export * from "./radioGroup.g.ts";
|
|
86
90
|
export * from "./rating.g.ts";
|
|
@@ -123,7 +127,9 @@ export * from "./timePicker.g.ts";
|
|
|
123
127
|
export * from "./toast.g.ts";
|
|
124
128
|
export * from "./tour.g.ts";
|
|
125
129
|
export * from "./tourAdvance.g.ts";
|
|
130
|
+
export * from "./transferList.g.ts";
|
|
126
131
|
export * from "./tree.g.ts";
|
|
132
|
+
export * from "./treePicker.g.ts";
|
|
127
133
|
export * from "./unsavedChanges.g.ts";
|
|
128
134
|
export * from "./updateBar.g.ts";
|
|
129
135
|
export * from "./value.g.ts";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type QueryBuilderText = {
|
|
2
|
+
readonly addConditionLabel: string;
|
|
3
|
+
readonly addGroupLabel: string;
|
|
4
|
+
readonly andLabel: string;
|
|
5
|
+
readonly applyLabel: string;
|
|
6
|
+
readonly cancelLabel: string;
|
|
7
|
+
readonly clearAllLabel: string;
|
|
8
|
+
readonly closeLabel: string;
|
|
9
|
+
readonly conditionCountTextOne: string;
|
|
10
|
+
readonly conditionCountTextOther: string;
|
|
11
|
+
readonly datePlaceholder: string;
|
|
12
|
+
readonly emptySummaryText: string;
|
|
13
|
+
readonly emptyText: string;
|
|
14
|
+
readonly emptyTitle: string;
|
|
15
|
+
readonly emptyValueText: string;
|
|
16
|
+
readonly fieldLabel: string;
|
|
17
|
+
readonly filtersCountLabel: string;
|
|
18
|
+
readonly filtersLabel: string;
|
|
19
|
+
readonly groupCountTextOne: string;
|
|
20
|
+
readonly groupCountTextOther: string;
|
|
21
|
+
readonly incompleteTextOne: string;
|
|
22
|
+
readonly incompleteTextOther: string;
|
|
23
|
+
readonly matchAllLabel: string;
|
|
24
|
+
readonly matchAnyLabel: string;
|
|
25
|
+
readonly matchLabel: string;
|
|
26
|
+
readonly matchSuffixText: string;
|
|
27
|
+
readonly maxPlaceholder: string;
|
|
28
|
+
readonly minPlaceholder: string;
|
|
29
|
+
readonly multiPlaceholder: string;
|
|
30
|
+
readonly noLabel: string;
|
|
31
|
+
readonly operatorBetween: string;
|
|
32
|
+
readonly operatorContains: string;
|
|
33
|
+
readonly operatorGt: string;
|
|
34
|
+
readonly operatorGtDate: string;
|
|
35
|
+
readonly operatorInLast: string;
|
|
36
|
+
readonly operatorIs: string;
|
|
37
|
+
readonly operatorIsAnyOf: string;
|
|
38
|
+
readonly operatorIsEmpty: string;
|
|
39
|
+
readonly operatorIsNot: string;
|
|
40
|
+
readonly operatorLabel: string;
|
|
41
|
+
readonly operatorLt: string;
|
|
42
|
+
readonly operatorLtDate: string;
|
|
43
|
+
readonly orLabel: string;
|
|
44
|
+
readonly panelTitle: string;
|
|
45
|
+
readonly rangeJoinText: string;
|
|
46
|
+
readonly removeClauseLabel: string;
|
|
47
|
+
readonly removeConditionLabel: string;
|
|
48
|
+
readonly removeGroupLabel: string;
|
|
49
|
+
readonly singlePlaceholder: string;
|
|
50
|
+
readonly textPlaceholder: string;
|
|
51
|
+
readonly unitDays: string;
|
|
52
|
+
readonly unitLabel: string;
|
|
53
|
+
readonly unitMonths: string;
|
|
54
|
+
readonly unitWeeks: string;
|
|
55
|
+
readonly valueLabel: string;
|
|
56
|
+
readonly valueRequiredText: string;
|
|
57
|
+
readonly yesLabel: string;
|
|
58
|
+
};
|
|
59
|
+
export declare const QUERY_BUILDER_TEXT: QueryBuilderText;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type TransferListText = {
|
|
2
|
+
readonly addAllLabel: string;
|
|
3
|
+
readonly addLabel: string;
|
|
4
|
+
readonly availableTitle: string;
|
|
5
|
+
readonly chosenTitle: string;
|
|
6
|
+
readonly dragHintText: string;
|
|
7
|
+
readonly emptyAvailableText: string;
|
|
8
|
+
readonly emptyAvailableTitle: string;
|
|
9
|
+
readonly emptyChosenText: string;
|
|
10
|
+
readonly emptyChosenTitle: string;
|
|
11
|
+
readonly noMatchText: string;
|
|
12
|
+
readonly orderHintText: string;
|
|
13
|
+
readonly removeAllLabel: string;
|
|
14
|
+
readonly removeLabel: string;
|
|
15
|
+
readonly searchLabel: string;
|
|
16
|
+
readonly searchPlaceholder: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const TRANSFER_LIST_TEXT: TransferListText;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type TreePickerText = {
|
|
2
|
+
readonly chosenTitle: string;
|
|
3
|
+
readonly clearAllLabel: string;
|
|
4
|
+
readonly emptyText: string;
|
|
5
|
+
readonly emptyTitle: string;
|
|
6
|
+
readonly noMatchText: string;
|
|
7
|
+
readonly removeLabel: string;
|
|
8
|
+
readonly searchLabel: string;
|
|
9
|
+
readonly searchPlaceholder: string;
|
|
10
|
+
readonly selectedText: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const TREE_PICKER_TEXT: TreePickerText;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FlatTreeRow, TreePickerMode } from "./treeState.ts";
|
|
2
|
+
export type TreeKeyAction = {
|
|
3
|
+
type: "move";
|
|
4
|
+
to: "next" | "prev" | "first" | "last";
|
|
5
|
+
} | {
|
|
6
|
+
type: "expand";
|
|
7
|
+
} | {
|
|
8
|
+
type: "collapse";
|
|
9
|
+
} | {
|
|
10
|
+
type: "focusParent";
|
|
11
|
+
} | {
|
|
12
|
+
type: "focusFirstChild";
|
|
13
|
+
} | {
|
|
14
|
+
type: "toggle";
|
|
15
|
+
} | {
|
|
16
|
+
type: "choose";
|
|
17
|
+
} | {
|
|
18
|
+
type: "open";
|
|
19
|
+
} | {
|
|
20
|
+
type: "close";
|
|
21
|
+
} | {
|
|
22
|
+
type: "removeLastChip";
|
|
23
|
+
} | {
|
|
24
|
+
type: "typeahead";
|
|
25
|
+
char: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: "none";
|
|
28
|
+
};
|
|
29
|
+
export interface TreeKeyContext {
|
|
30
|
+
mode: TreePickerMode;
|
|
31
|
+
open: boolean;
|
|
32
|
+
searchEmpty: boolean;
|
|
33
|
+
row: Pick<FlatTreeRow, "hasChildren" | "disabled"> | null;
|
|
34
|
+
expanded: boolean;
|
|
35
|
+
hasParent: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface TreeKeyInput {
|
|
38
|
+
key: string;
|
|
39
|
+
shiftKey?: boolean;
|
|
40
|
+
altKey?: boolean;
|
|
41
|
+
ctrlKey?: boolean;
|
|
42
|
+
metaKey?: boolean;
|
|
43
|
+
isComposing?: boolean;
|
|
44
|
+
keyCode?: number;
|
|
45
|
+
}
|
|
46
|
+
export declare function treeKeyAction(input: TreeKeyInput, ctx: TreeKeyContext): TreeKeyAction;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FlatTreeRow, TreeCheckState } from "./treeState.ts";
|
|
2
|
+
export interface TreePickerViewText {
|
|
3
|
+
chosenTitle: string;
|
|
4
|
+
clearAllLabel: string;
|
|
5
|
+
emptyTitle: string;
|
|
6
|
+
emptyText: string;
|
|
7
|
+
noMatchText: string;
|
|
8
|
+
removeLabel: string;
|
|
9
|
+
searchLabel: string;
|
|
10
|
+
searchPlaceholder: string;
|
|
11
|
+
selectedText: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TreePickerViewModel {
|
|
14
|
+
rows: readonly FlatTreeRow[];
|
|
15
|
+
checkOf: (row: FlatTreeRow) => TreeCheckState;
|
|
16
|
+
focusId: string | null;
|
|
17
|
+
expanded: ReadonlySet<string>;
|
|
18
|
+
query: string;
|
|
19
|
+
chosen: readonly {
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
group: string | null;
|
|
23
|
+
}[];
|
|
24
|
+
selection: "single" | "multiple";
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
invalid: boolean;
|
|
27
|
+
status: string;
|
|
28
|
+
text: TreePickerViewText;
|
|
29
|
+
uid: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function paintTreePickerView(host: HTMLElement, model: TreePickerViewModel): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type TreePickerNode = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
icon?: string | undefined;
|
|
5
|
+
children?: TreePickerNode[] | undefined;
|
|
6
|
+
hasChildren?: boolean | undefined;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type TreePickerMode = "single" | "multiple";
|
|
10
|
+
export type TreePickerValue = string | string[];
|
|
11
|
+
export type TreeCheckState = "checked" | "unchecked" | "mixed";
|
|
12
|
+
export interface FlatTreeRow {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
icon: string | null;
|
|
16
|
+
parentId: string | null;
|
|
17
|
+
level: number;
|
|
18
|
+
index: number;
|
|
19
|
+
hasChildren: boolean;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
leafIds: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
export interface FlatTree {
|
|
24
|
+
rows: readonly FlatTreeRow[];
|
|
25
|
+
byId: ReadonlyMap<string, FlatTreeRow>;
|
|
26
|
+
}
|
|
27
|
+
export declare function flattenTree(nodes: readonly TreePickerNode[], expanded: ReadonlySet<string>): FlatTree;
|
|
28
|
+
export declare function allRowsFlat(nodes: readonly TreePickerNode[]): FlatTree;
|
|
29
|
+
export declare function checkStateOf(row: FlatTreeRow, selected: ReadonlySet<string>): TreeCheckState;
|
|
30
|
+
export declare function toggleNode(nodes: readonly TreePickerNode[], mode: TreePickerMode, selected: readonly string[], id: string): string[];
|
|
31
|
+
export declare function selectedLeafIds(nodes: readonly TreePickerNode[], selected: readonly string[]): string[];
|
|
32
|
+
export declare function clearSelection(): string[];
|
|
33
|
+
export declare function removeSelected(selected: readonly string[], id: string): string[];
|
|
34
|
+
export declare function summariseSelection(nodes: readonly TreePickerNode[], selected: readonly string[]): {
|
|
35
|
+
count: number;
|
|
36
|
+
labels: string[];
|
|
37
|
+
};
|
|
38
|
+
export declare function treePickerValue(mode: TreePickerMode, selected: readonly string[]): TreePickerValue;
|
|
39
|
+
export declare function filterTree(nodes: readonly TreePickerNode[], query: string): {
|
|
40
|
+
nodes: TreePickerNode[];
|
|
41
|
+
expanded: Set<string>;
|
|
42
|
+
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./anchorOverlay-B8fu8hjz.js";import{i as t,n,r,t as i}from"./optionLabel-B2cU4Ax0.js";import{n as a}from"./devWarn-DXdRWZs3.js";import{r as o}from"./dom-Do1pAA12.js";import{t as s}from"./elementBase-Cxeyx0tU.js";import{r as c,t as l}from"./fieldState-D-zQcXUS.js";import{n as u,t as d}from"./formMirror-9IpSgeZb.js";import{n as f}from"./loader-CQJFj96n.js";import{t as p}from"./iconGlyphs.g-DxSJLQJ8.js";import{t as m}from"./imeSafeEnter-DPs9qL3S.js";import{n as h,t as g}from"./listboxKeyNav-CF7tMDGG.js";import{a as _,l as v,s as y}from"./nativeOverlay-C1Rw2gIW.js";import{r as b}from"./textStore-opIEM4lu.js";import{n as x,r as S,t as C}from"./search.g-B5d1s59A.js";var w=e=>{let t=String(e??``).trim();return/^(https?:)?\/\//i.test(t)||/^\/(?!\/)/.test(t)||/^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t)?t:``},T=(e,t=`wui-opt-avatar`)=>{let r=w(e.avatar);return!r&&!e.initials?``:`<span class="avatar ${t}" aria-hidden="true"><span class="avatar-face">${n(e.initials??``)}</span>${r?`<img class="avatar-img" src="${E(r)}" alt="" />`:``}</span>`},E=e=>String(e??``).replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`),D=()=>b(`select`,S);function O(e,n){let r=String(n??``).trim().toLowerCase();return r?e.filter(e=>[t(e),e.description,e.meta].some(e=>String(e??``).toLowerCase().includes(r))):e}var k=/* @__PURE__ */ new WeakMap;function ee(e,t,r={}){let{selected:i=[],query:a=``,status:o=`idle`,emptyText:s=D().emptyText,searchingText:c=D().searchingText,hintText:l=D().hintText,actionRow:u=[],recents:d=null}=r,f=new Set(i.map(String)),p=O(t,a),m=e.id,h=0,g=()=>`${m}-opt-${h++}`,_=e=>`<button type="button" role="option" id="${n(g())}" class="wui-select-option wui-select-add" data-value="${n(e.value)}" data-custom="true" aria-selected="false">${n(e.label)}</button>`,v=u.filter(e=>e.position===`top`).map(_).join(``),y=d?.options.length?`<div class="wui-select-group">${n(d.label)}</div>${d.options.map(e=>A(e,g(),f.has(String(e.value)))).join(``)}<div class="wui-select-sep" aria-hidden="true"></div>`:``,b=``,x=``;for(let e of p)e.group&&e.group!==b&&(x+=`<div class="wui-select-group">${n(e.group)}</div>`),b=e.group??``,x+=A(e,g(),f.has(String(e.value)));let S=u.filter(e=>e.position===`bottom`).map(_).join(``),C=``;o===`loading`?C=`<div class="wui-select-loading"><span class="wui-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>${n(c)}</div>`:o===`hint`?C=`<div class="wui-select-hint">${n(l)}</div>`:(o===`empty`||p.length===0&&u.length===0)&&(C=`<div class="wui-select-empty">${n(s)}</div>`);let w=v+y+x+S+C;k.get(e)!==w&&(k.set(e,w),e.innerHTML=w)}function A(e,t,i){let a=!!e.disabled,o=a&&e.disabledHint?` title="${n(e.disabledHint)}"`:``,s=`id="${n(t)}" role="option" data-value="${n(e.value)}" aria-selected="${i}"${a?` aria-disabled="true"`:``}${o}`,c=`<span class="wui-select-check" aria-hidden="true">${p(`check`)}</span>`;if(!e.description&&!e.meta)return`<button type="button" class="wui-select-option${i?` selected`:``}" ${s}>${T(e)}<span class="wui-select-opt-name">${r(e)}</span>${c}</button>`;let l=e.description?`<span class="wui-select-opt-desc">${n(e.description)}</span>`:``,u=e.meta?`<span class="wui-select-opt-meta">${n(e.meta)}</span>`:``;return`<div class="wui-select-option wui-select-option-rich${i?` selected`:``}" ${s}>${T(e)}<span class="wui-select-option-text"><span class="wui-opt-label">${r(e)}</span>${l}</span>${u}${c}</div>`}var j=Object.freeze([`single`,`multiple`,`search`,`tag`,`country`]),M=e=>e===`multiple`||e===`tag`,N={recents:()=>import(`./recents-BQ0fD7Y0.js`),chips:()=>import(`./chips-CemguTKJ.js`),search:()=>import(`./search-Cj1YQUwK.js`),country:()=>import(`./country-B7jmc--B.js`)};function P(e){let t=Object.hasOwn(N,e)?N[e]:void 0;return t?t():Promise.reject(/* @__PURE__ */ Error(`Unknown <wui-select> part: ${e}.`))}var F=e=>typeof e.loadOptions==`function`||!!e.getAttribute(`source`)||e.hasAttribute(`remote`),I=()=>b(`select`,S),L=()=>b(`search`,C),R=()=>b(`field`,x),z=class extends s{static formAssociated=!0;_internals;_value;_optionsProp;_partOptions;_known;_loadOptionsFn;_validateFn;_declared;_query;_ownsFilter;_active;_status;_error;_nav;_parts;_partSig;_partsMounted;_partToken;_rendered;_searchShown;_defaultValue;_warnedMode;_warnedDensity;_hoverTimer;_hoverOpened;_onHoverOver;_onHoverOut;_panelShown;_pressOpen;static get observedAttributes(){return/* @__PURE__ */ `mode.value.placeholder.search-placeholder.empty-text.searchable.clearable.disabled.readonly.loading.required.size.density.icon.prefix.open.open-on-hover.aria-label.aria-describedby.aria-invalid.min-chars.debounce.source.remote.allow-custom.add-label.searching-text.hint-text.value-label.value-avatar.value-initials.max-tags.allow-duplicates.separators.pattern.invalid-message.create-label.collapse-chips.selected-text.clear-all-label.countries.suggested.suggested-label.all-countries-label.recents-key.recents-limit.recents-label`.split(`.`)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._partOptions=null,this._known=/* @__PURE__ */ new Map,this._loadOptionsFn=null,this._validateFn=null,this._declared=void 0,this._query=``,this._ownsFilter=!1,this._active=-1,this._status=`idle`,this._error=``,this._nav=null,this._parts=null,this._partSig=``,this._partsMounted=!1,this._partToken=0,this._rendered=!1,this._searchShown=!1,this._defaultValue=void 0,this._warnedMode=null,this._hoverTimer=null,this._hoverOpened=!1,this._panelShown=!1,this._pressOpen=null,this._onHoverOver=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&(this._clearHover(),!this._menuOpen()&&this._hoverEligible()&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,!this._menuOpen()&&this._hoverEligible()&&(this._open({focus:!1}),this._hoverOpened=!0)},U)))},this._onHoverOut=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&!this._hoverZone(e.relatedTarget)&&(this._clearHover(),this._menuOpen()&&this.hasAttribute(`open-on-hover`)&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,this._close()},W)))}}connectedCallback(){this.addEventListener(`pointerover`,this._onHoverOver),this.addEventListener(`pointerout`,this._onHoverOut),this._rendered||this.render(),this._ensureParts(),this._mountParts()}disconnectedCallback(){this.removeEventListener(`pointerover`,this._onHoverOver),this.removeEventListener(`pointerout`,this._onHoverOut),this._clearHover(),this._dropMenu(),this._teardown(),this._teardownParts()}attributeChangedCallback(e,t,n){e===`value`?(this._value=Y(n,M(this.mode)),this._applyValue()):e===`aria-invalid`?this._syncInvalid():e===`open`?this._rendered&&(this.hasAttribute(`open`)?this._open({focus:!1}):this._close({force:!0})):e===`open-on-hover`?this.hasAttribute(`open-on-hover`)||this._clearHover():(e===`mode`&&(this._value=Y(this._value,M(this.mode)),this._partOptions=null,this._known.clear(),this._ensureParts()),(e===`source`||e===`remote`||e===`recents-key`)&&this._ensureParts(),J.has(e)?this._rendered&&(this._drawValue(),this.renderList()):q.has(e)?this._remountParts():this._rendered&&this.render())}formResetCallback(){if(this.value=this._defaultValue??``,!this._rendered)return;let e=this._refs();e.input&&(e.input.value=``,e.input.removeAttribute(`aria-invalid`)),e.search&&(e.search.value=``),this.setError(``),this._query!==``&&this._onQueryChange(``)}get mode(){let e=this.getAttribute(`mode`);return e===null?`single`:V(e)?e:(e!==this._warnedMode&&(this._warnedMode=e,a(`<wui-select> mode "${e}" is not one of ${j.join(`, `)}; it is treated as "single".`)),`single`)}_checkDensity(){let e=this.getAttribute(`density`);e===null||H.includes(e)||e===this._warnedDensity||(this._warnedDensity=e,a(`<wui-select> density "${e}" is not one of ${H.join(`, `)}; it is treated as "comfortable".`))}set mode(e){this.setAttribute(`mode`,String(e))}get value(){return Array.isArray(this._value)?this._value.slice():this._value}set value(e){this._value=Y(e,M(this.mode)),this._applyValue()}get options(){return this._readOptions()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.mode!==`country`&&(this._partOptions=null);for(let e of this._activePartsList())e.onOptions?.();if(this._rendered){if(this.mode===`single`&&this.getAttribute(`searchable`)===null&&this._autoSearch()!==this._searchShown){this.render();return}this._drawValue(),this.renderList()}}get loadOptions(){return this._loadOptionsFn}set loadOptions(e){this._loadOptionsFn=typeof e==`function`?e:null,this._ensureParts()}get validate(){return this._validateFn}set validate(e){this._validateFn=typeof e==`function`?e:null}commit(e,t={}){this.value=e,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!!t.isCustom}}))}setPartOptions(e){this._partOptions=Array.isArray(e)?e:null,this._drawValue(),this.renderList()}setStatus(e){this._status=e,this.renderList()}setError(e){this._error=e?String(e):``,this._syncError()}openMenu(){l(this)||this._open({focus:!1})}closeMenu({focusControl:e=!1}={}){this._close(),e&&this._refs().control?.focus()}renderList(){let e=this._refs();e.list&&(ee(e.list,this._listOptions(),{selected:this._selectedValues(),query:this._ownsFilter?``:this._query,status:this._status,emptyText:this.getAttribute(`empty-text`)||I().emptyText,searchingText:this.getAttribute(`searching-text`)||I().searchingText,hintText:this.getAttribute(`hint-text`)||void 0,actionRow:this._actionRows(),recents:this._recents()}),this._active>=this._visible().length&&(this._active=-1),this._active>=0&&this._setActive(this._active,{reveal:!1}),this._anchorMenu())}render(){this._dropMenu();let e=this._carry();this._teardownParts(),this._snapshotDeclared();let t=this.mode;this._checkDensity();let r=M(t),i=t===`tag`,a=r&&(i||this.hasAttribute(`allow-custom`));this._value=Y(this._value,r),this._defaultValue===void 0&&r&&this._value.length===0&&(this._value=this._declaredSelected()),r||this._preselect(),this._defaultValue===void 0&&(this._defaultValue=Y(this._value,r));let o=this.getAttribute(`size`),s=o===`sm`?` wui-select-sm`:o===`lg`?` wui-select-lg`:o===`xl`?` wui-select-xl`:``,l=this.getAttribute(`icon`),u=this.getAttribute(`prefix`),d=this.hasAttribute(`clearable`),f=this.hasAttribute(`disabled`);this.id||=`wui-select-${Math.random().toString(36).slice(2,9)}`;let m=`${this.id}-listbox`,h=`${this.id}-entry-error`,g=this.getAttribute(`aria-describedby`)?.trim(),_=g?`${g} ${h}`:h,v=this.hasAttribute(`aria-invalid`)||this._error?` aria-invalid="true"`:``,y=this.hasAttribute(`required`)&&!a?` aria-required="true"`:``,b=` aria-label="${n(this._accessibleName())}" aria-describedby="${n(_)}"${v}${y}`,x=a?``:` role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${n(m)}"`,S=r?`<div class="input wui-select-control wui-select-multi"${x}${b}${f?` aria-disabled="true"`:i?``:` tabindex="0"`}>`:`<button type="button" class="input wui-select-control"${x}${b}${f?` disabled`:``}>`,C=`${l?p(l,{className:`wui-select-icon`}):``}${u?`<span class="wui-select-prefix">${n(u)}</span>`:``}<span class="wui-select-value" data-label></span>${d?`<span class="wui-select-reset" role="button" aria-label="${n(I().clearSelectionLabel)}" hidden>${p(`x`)}</span>`:``}${p(`chevron-down`,{className:`wui-select-caret`})}`,w=this.getAttribute(`searchable`),T=w===null?t===`multiple`||t===`country`||this._autoSearch():w!==`false`,E=t===`search`||T&&!a;this._searchShown=E;let D=this.getAttribute(`search-placeholder`)||(t===`country`?I().countrySearchPlaceholder:L().placeholder),O=E?`<div class="wui-select-search">${p(`search`)}<input class="wui-select-input" placeholder="${n(D)}" aria-label="${n(D)}" aria-autocomplete="list" /><button type="button" class="wui-select-clear" aria-label="${n(L().clearLabel)}" hidden>${p(`x`)}</button></div>`:``;this.innerHTML=`
|
|
2
|
-
<div class="wui-select${s}">
|
|
3
|
-
${S}${C}${r?`</div>`:`</button>`}
|
|
4
|
-
<div class="wui-select-menu wui-select-menu-fixed" popover="auto">
|
|
5
|
-
${O}
|
|
6
|
-
<div class="wui-select-options" role="listbox" id="${n(m)}" tabindex="-1"${r?` aria-multiselectable="true"`:``}></div>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="field-error wui-select-error" id="${n(h)}" aria-live="polite"${this._error?``:` hidden`}>${n(this._error)}</div>`,this._rendered=!0,this._syncMirror(),this._syncValidity(),this._drawValue(),this._syncReset(),this.renderList(),this._wire(),c(this,this.querySelector(`.wui-select-control`)),this._mountParts(e)}_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||I().fallbackName}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>{let t={value:e.getAttribute(`value`)??$(e).trim(),label:e.innerHTML,[i]:!0,selected:e.hasAttribute(`selected`)};for(let[n,r]of te){let i=e.getAttribute(n);i&&(t[r]=i)}return e.hasAttribute(`disabled`)&&(t.disabled=!0),t}))}_readOptions(){return this.mode===`country`?this._partOptions||[]:this._partOptions?this._partOptions:this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_listOptions(){let e=this._readOptions(),t=this.getAttribute(`value-label`);if(this.mode!==`search`||!t||this._value===``)return e;let n=String(this._value);return e.some(e=>String(e.value)===n)?e:[...e,{value:n,label:t}]}_declaredSelected(){return this._optionsProp?[]:(this._declared??[]).filter(e=>e.selected).map(e=>String(e.value))}_preselect(){let e=this._readOptions(),t=this._value!==``&&e.find(e=>String(e.value)===this._value)||e.find(e=>`selected`in e&&!!e.selected);t&&(this._value=String(t.value))}_optionFor(e){let t=String(e),n=this._readOptions().find(e=>String(e.value)===t);return n?(this._known.set(t,n),n):this._known.get(t)}_placeholder(){return this.getAttribute(`placeholder`)||K()[this.mode]}_hasValue(){return Array.isArray(this._value)?this._value.length>0:this._value!==``}_selectedValues(){return Array.isArray(this._value)?this._value:this._value===``?this._listOptions().some(e=>String(e.value)===``)?[``]:[]:[this._value]}_applyValue(){this._syncMirror(),this._syncValidity(),this._rendered&&(this._drawValue(),this._syncReset(),this.renderList())}_syncMirror(){M(this.mode)?u(this,this._selectedValues()):d(this,this._value)}_drawValue(){let e=this._refs();if(!e.value)return;let t=M(this.mode),i=t?void 0:this._optionFor(this._value);this._syncTitle(i),this._syncValueAvatar(),this._activePartsList().some(e=>e.renderValue?.()===!0)||(t?(e.value.classList.remove(`wui-select-placeholder`),e.value.textContent=``):(e.value.classList.toggle(`wui-select-placeholder`,!i),e.value.innerHTML=i?r(i):n(this._placeholder())))}_syncTitle(e){let n=this.querySelector(`.wui-select-control`);if(!n)return;let r=e&&!this.hasAttribute(`title`)?t(e).trim():``;r?n.setAttribute(`title`,r):n.removeAttribute(`title`)}_syncValueAvatar(){let e=this.querySelector(`.wui-select-control`);if(!e)return;e.querySelector(`:scope > .wui-select-value-avatar`)?.remove();let t=!M(this.mode)&&this._hasValue()?T({avatar:this.getAttribute(`value-avatar`),initials:this.getAttribute(`value-initials`)},`avatar-xs`):``;e.classList.toggle(`wui-has-value-avatar`,!!t),t&&e.insertAdjacentHTML(`afterbegin`,`<span class="wui-select-value-avatar" aria-hidden="true">${t}</span>`)}_syncValidity(){let e=this._internals;if(typeof e?.setValidity==`function`){if(this.hasAttribute(`required`)&&!this._hasValue()){let t=this.querySelector(`.wui-select-control`);e.setValidity({valueMissing:!0},R().requiredFieldMessage,t instanceof HTMLElement?t:void 0)}else e.setValidity({})}}_syncReset(){let e=Q(this,`.wui-select-reset`,HTMLElement);e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._hasValue()&&!l(this)))}_syncInvalid(){let e=this.querySelector(`.wui-select-control`);e&&(this.hasAttribute(`aria-invalid`)||this._error?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}_syncError(){let e=Q(this,`.wui-select-error`,HTMLElement);e&&(e.textContent=this._error,e.hidden=!this._error),this._syncInvalid()}_refs(){return{control:Q(this,`.wui-select-control`,HTMLElement),value:Q(this,`.wui-select-value`,HTMLElement),menu:Q(this,`.wui-select-menu`,HTMLElement),list:Q(this,`.wui-select-options`,HTMLElement),search:Q(this,`.wui-select-search input`,HTMLInputElement),input:Q(this,`.wui-select-draft`,HTMLInputElement)}}_menuOpen(){let e=Q(this,`.wui-select-menu`,HTMLElement);return e!==null&&y(e)}_hoverZone(e){if(!(e instanceof Element))return!1;let t=e.closest(`.wui-select-control, .wui-select-menu`);return t!==null&&this.contains(t)}_hoverEligible(){if(!this.hasAttribute(`open-on-hover`)||l(this)||this.mode===`tag`)return!1;let e=this._refs();return e.search===null&&e.input===null}_clearHover(){this._hoverTimer!==null&&clearTimeout(this._hoverTimer),this._hoverTimer=null}_autoSearch(){return this.mode===`single`&&this.getAttribute(`searchable`)===null&&this._readOptions().length>G}_visible(){let e=this._refs();return e.list?ie(e.list,`.wui-select-option`):[]}_setActive(e,{reveal:t=!0}={}){let n=this._refs();if(!n.list||!n.control)return;let r=this._visible();this._active=e;let i=e>=0?r[e]??null:null;h(n.list,i),i?(t&&i.scrollIntoView({block:`nearest`}),n.control.setAttribute(`aria-activedescendant`,i.id)):n.control.removeAttribute(`aria-activedescendant`)}_actionRows(){let e=[];for(let t of this._activePartsList()){let n=t.actionRow?.(this._query);n&&e.push(n)}return e}_recents(){if(this._query.trim()!==``)return null;for(let e of this._activePartsList()){let t=e.recents?.(this._listOptions());if(t)return t}return null}_menuPlacement(e,t){let n=this.hasAttribute(`open`)?{below:!0}:{};if(this.getAttribute(`density`)!==`compact`)return{matchWidth:!0,...n};let r=e.getBoundingClientRect();return t.style.width=`max-content`,t.style.minWidth=`${r.width}px`,t.style.maxWidth=`280px`,n}_anchorMenu(){let t=this._refs();t.control&&t.menu&&this._menuOpen()&&e(t.control,t.menu,this._menuPlacement(t.control,t.menu))}_showMenu(e,t){v(e,t,{...this._menuPlacement(e,t),mode:`auto`,keepOffscreen:this.hasAttribute(`open`),onClosed:()=>this._onPanelClosed()}),this._panelShown=!0}_onPanelClosed(){if(!this._panelShown)return;this._panelShown=!1;let e=this._refs();e.control&&(e.control.setAttribute(`aria-expanded`,`false`),this._setActive(-1),this._nav?.clearTypeahead(),this.dispatchEvent(new CustomEvent(`wui-select:close`,{bubbles:!0})))}_open({focus:e=!0}={}){let t=this._refs();if(!t.menu||!t.control)return;let n=this._menuOpen();this._hoverOpened=!1,t.control.setAttribute(`aria-expanded`,`true`),this._query=t.input?t.input.value:``,this._ownsFilter=this._ownsFilter&&this._query!==``;let r=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement);if(r&&(r.hidden=!0),t.search&&(t.search.value=``),this.renderList(),n||this._showMenu(t.control,t.menu),e&&(t.search?.focus(),this._setActive(this._visible().findIndex(e=>e.classList.contains(`selected`)))),!n){this.dispatchEvent(new CustomEvent(`wui-select:open`,{bubbles:!0}));for(let e of this._activePartsList())e.onOpen?.()}}_close({force:e=!1}={}){if(!e&&this.hasAttribute(`open`))return;let t=this._refs();if(!t.menu||!t.control)return;this._hoverOpened=!1;let n=t.menu.contains(document.activeElement);y(t.menu)&&_(t.menu),this._onPanelClosed(),n&&t.control.focus()}_onQueryChange(e){this._query=e,this._setActive(-1);let t=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement);t&&(t.hidden=!e);let n=!1;for(let t of this._activePartsList())t.onQuery?.(e)===!0&&(n=!0);this._ownsFilter=n,this.renderList()}_pick(e){if(e.getAttribute(`aria-disabled`)===`true`)return;let t=e.dataset.custom===`true`,n=e.dataset.value??``,r=t?{value:n,label:$(e).trim()}:this._listOptions().find(e=>String(e.value)===n)??{value:n,label:n},i=this._activePartsList().some(e=>e.onPick?.(r,{isCustom:t})===!0);M(this.mode)||(i||this.commit(n,{isCustom:t}),this._close(),this._refs().control?.focus())}_draftOpens(){return this.mode===`multiple`?this.hasAttribute(`allow-custom`):this.mode===`tag`&&F(this)}_onKeyDown(e){if(!l(this)){for(let t of this._activePartsList())if(t.onKey?.(e)===!0)return;if(!this._menuOpen()){if(e.target instanceof HTMLInputElement){if(e.key!==`ArrowDown`||!this._draftOpens())return;this._open({focus:!1})}else{(e.key===`ArrowDown`||m(e)||e.key===` `)&&(e.preventDefault(),this._open({focus:!0}));return}}o(this._nav,`Listbox keys are not wired.`).handler(e)}}_wire(){this._teardown();let e=this._refs(),t=e.control,n=e.list;if(!t||!e.menu||!n)return;let r=o(Q(this,`.wui-select`,HTMLElement),`The select wrapper is missing.`),i=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement),a=Q(this,`.wui-select-reset`,HTMLElement);this._nav=g({getVisibleOptions:()=>this._visible(),getActive:()=>this._active,setActive:e=>this._setActive(e),onEnter:(e,t)=>{if(e)this._pick(e);else if(this._query.trim()!==``){let e=t.find(e=>e.dataset.custom===`true`);if(e)this._pick(e);else if(t.length===1){let e=t[0];e&&this._pick(e)}}},onEscape:e=>{e.preventDefault(),this._nav?.clearTypeahead(),this._close(),t.focus()}}),r.addEventListener(`keydown`,e=>this._onKeyDown(e)),r.addEventListener(`input`,e=>{let t=e.target;if(!(t instanceof HTMLInputElement)||!t.matches(`.wui-select-input, .wui-select-draft`))return;this._onQueryChange(t.value);let n=t.matches(`.wui-select-draft`),r=this._visible().length>0||this._actionRows().length>0;n&&r&&!this._menuOpen()&&!l(this)&&this._draftOpens()&&this._open({focus:!1})}),r.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||!this._activePartsList().some(e=>e.onBlur?.()===!0)&&t&&this._close()}),i?.addEventListener(`click`,()=>{let t=o(e.search,`The search input is missing.`);t.value=``,this._onQueryChange(``),t.focus()}),t.addEventListener(`pointerdown`,()=>{this._pressOpen=this._menuOpen()}),t.addEventListener(`click`,e=>{if(e.target instanceof Element&&e.target.closest(`[data-remove]`))return;if(this.mode===`tag`){if(l(this))return;this._refs().input?.focus(),!this._menuOpen()&&this._draftOpens()&&this._open({focus:!1});return}if(e.target instanceof HTMLInputElement){!this._menuOpen()&&!l(this)&&this._open({focus:!1});return}let t=e.detail>0&&this._pressOpen!==null?this._pressOpen:this._menuOpen();this._pressOpen=null,this._clearHover(),this._hoverOpened&&t?(this._hoverOpened=!1,this._open({focus:!0})):t?this._close():l(this)||this._open({focus:!0})}),a?.addEventListener(`click`,e=>{e.stopPropagation(),this.commit(M(this.mode)?[]:``),this._close(),t.focus()}),n.addEventListener(`click`,n=>{let r=Z(n).closest(`.wui-select-option`);if(r instanceof HTMLElement&&(this._pick(r),M(this.mode))){let n=this.querySelector(`.wui-select-draft`);(e.search??(n instanceof HTMLElement?n:t)).focus()}}),n.addEventListener(`mousedown`,e=>{M(this.mode)&&e.target instanceof Element&&e.target.closest(`.wui-select-option`)&&e.preventDefault()}),n.addEventListener(`mousemove`,e=>{let t=Z(e).closest(`.wui-select-option`);t instanceof HTMLElement&&!t.classList.contains(`is-active`)&&this._setActive(this._visible().indexOf(t),{reveal:!1})}),n.addEventListener(`mouseleave`,()=>this._setActive(-1)),n.addEventListener(`error`,e=>{let t=e.target;t instanceof Element&&t.classList.contains(`avatar-img`)&&t.remove()},!0),this.hasAttribute(`open`)&&this._open({focus:!1})}_teardown(){this._nav?.teardown()}_dropMenu(){let e=Q(this,`.wui-select-menu`,HTMLElement);e&&_(e)}_activePartsList(){return this._partsMounted?o(this._parts,`The mounted parts are missing.`):[]}_ensureParts(){if(!this.isConnected)return;let e=ne(this,this.mode),t=e.join(`,`);if(t===this._partSig)return;this._teardownParts(),this._parts=null,this._partSig=t;let n=++this._partToken;Promise.all(e.map(e=>ae(this,e))).then(e=>{n===this._partToken&&(this._parts=e.filter(e=>e!==null),this._mountParts())})}_mountParts(e={draft:``,query:``}){if(!this._parts||this._partsMounted||!this._rendered||!this.isConnected)return;this._partsMounted=!0;let t=B(this._refs());for(let n of this._parts)n.mount(this,t,{carry:e});this._drawValue(),this.renderList()}_teardownParts(){let e=this._activePartsList();this._partsMounted=!1;for(let t of e)t.teardown()}_remountParts(){if(!this._partsMounted)return;let e=this._carry();this._teardownParts(),this._mountParts(e)}_carry(){let e=this._refs();return{draft:e.input?.value??``,query:e.search?.value??``}}},B=e=>{let{control:t,value:n,menu:r,list:i}=e;return{control:o(t,`control missing`),value:o(n,`value missing`),menu:o(r,`menu missing`),list:o(i,`list missing`),search:e.search,input:e.input}},V=e=>j.includes(e),H=[`comfortable`,`compact`],U=150,W=250,G=10,K=()=>{let e=I();return{single:e.placeholder,search:e.placeholder,multiple:e.placeholder,tag:e.tagPlaceholder,country:e.countryPlaceholder}},q=/* @__PURE__ */ new Set([`countries`,`suggested`,`suggested-label`,`all-countries-label`,`max-tags`,`pattern`,`collapse-chips`,`source`,`remote`,`min-chars`]),J=/* @__PURE__ */ new Set([`separators`,`allow-duplicates`,`invalid-message`,`create-label`,`add-label`,`selected-text`,`clear-all-label`,`value-label`,`value-avatar`,`value-initials`,`hint-text`,`recents-key`,`recents-limit`,`recents-label`]),te=[[`icon`,`icon`],[`description`,`description`],[`meta`,`meta`],[`group`,`group`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],Y=(e,t)=>t?Array.isArray(e)?e.map(String):e==null||e===``?[]:String(e).split(`,`).map(e=>e.trim()).filter(Boolean):Array.isArray(e)?e.length?String(e[0]):``:e==null?``:String(e),X=(e,t)=>t===`multiple`?F(e)?[`chips`,`search`]:[`chips`]:t===`search`?[`search`]:t===`country`?[`country`]:t===`tag`?F(e)?[`chips`,`search`]:[`chips`]:[],ne=(e,t)=>e.hasAttribute(`recents-key`)?[`recents`,...X(e,t)]:X(e,t),re=e=>typeof e==`object`&&!!e&&`default`in e&&typeof e.default==`function`,Z=e=>{if(e.target instanceof Element)return e.target;throw Error(`The event target is not an element.`)},Q=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},ie=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),$=e=>{let t=e.textContent;if(t===null)throw Error(`The element has no text.`);return t},ae=(e,t)=>P(t).then(e=>{if(!re(e))throw Error(`The part ${t} has no default export.`);return e.default()}).catch(()=>(document.dispatchEvent(new CustomEvent(f,{bubbles:!0,composed:!0,detail:{chunk:t}})),e.setError(I().partLoadMessage),null));export{F as n,O as r,z as t};
|
package/dist/WuiTree-CeYbyaCx.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./devWarn-DXdRWZs3.js";import{t}from"./elementBase-Cxeyx0tU.js";import{n,t as r}from"./formMirror-9IpSgeZb.js";import{t as i}from"./iconGlyphs.g-DxSJLQJ8.js";import{t as a}from"./listboxKeyNav-CF7tMDGG.js";import{l as o}from"./wuiHttp-DGbD7Fra.js";import{r as s}from"./textStore-opIEM4lu.js";import{t as c}from"./tree.g-RId8xZSk.js";var l=()=>s(`tree`,c),u=[`none`,`single`,`multiple`],d=e=>u.some(t=>t===e),f=`parentId`,p=`:scope > input[data-wui-mirror]`,m=[`nodes`,`selection`,`selected`,`values`,`loadChildren`,`loadUrl`,`name`],h=0;function g(e,t,n){let r=document.createElement(e);t&&(r.className=t);for(let[e,t]of Object.entries(n??{}))t!=null&&r.setAttribute(e,String(t));return r}var _=class extends t{_uid;_seq;_roots;_byId;_prev;_staged;_els;_checked;_selected;_focusId;_loader;_list;_live;_ready;_nav;_onKeyDown;_onClick;_onFocusIn;static get observedAttributes(){return[`selection`,`selected`,`name`,`aria-label`,`loading-text`,`error-text`]}constructor(){super(),this._uid=`wui-tree-${++h}`,this._seq=0,this._roots=[],this._byId=/* @__PURE__ */ new Map,this._prev=null,this._staged=null,this._els=/* @__PURE__ */ new Map,this._checked=/* @__PURE__ */ new Set,this._selected=null,this._focusId=null,this._loader=null,this._list=null,this._live=null,this._ready=!1,this._nav=a({getVisibleOptions:()=>this._visible().map(e=>{let t=this._els.get(e.id)?.row;if(!t)throw Error(`Row for node "${e.id}" is not rendered.`);return t}),getActive:()=>this._visible().findIndex(e=>e.id===this._focusId),setActive:e=>this._focusNode(this._visible()[e]),onEnter:()=>{let e=this._focusId===null?void 0:this._byId.get(this._focusId);e&&this._activate(e)}}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>{let t=this._nodeFrom(e.target);t&&t.id!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e=/* @__PURE__ */ new Map;for(let t of m)Object.hasOwn(this,t)&&(e.set(t,Reflect.get(this,t)),Reflect.deleteProperty(this,t));if(!this._ready){this._ready=!0;let e=this._readScript();this.replaceChildren(),this._list=g(`ul`,`wui-tree`),this._list.setAttribute(`role`,`tree`),this._live=g(`div`,`visually-hidden`,{role:`status`,"aria-live":`polite`}),this.append(this._list,this._live),e&&this._adoptAll(e)}for(let[t,n]of e)Reflect.set(this,t,n);this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this._render(),this._loadOpenNodes()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this._nav.teardown()}attributeChangedCallback(e,t,n){e===`selected`&&(this._selected=n),this._ready&&this.isConnected&&this._render()}get nodes(){return this._roots.map(e=>e.raw)}set nodes(e){this._adoptAll(e??[]),this._render(),this._loadOpenNodes()}get selection(){let e=this.getAttribute(`selection`);return d(e)?e:`none`}set selection(e){this.setAttribute(`selection`,String(e))}get selected(){return this._selected}set selected(e){this._selected=e==null?null:String(e),this._render()}get values(){let e=[],t=n=>{for(let r of n)this._state(r)===`checked`&&e.push(r.id),r.children&&t(r.children)};return t(this._roots),[...e,...[...this._checked].filter(e=>!this._byId.has(e))]}set values(e){this._checked.clear();for(let t of e??[]){let e=this._byId.get(String(t));e?this._setChecked(e,!0):this._checked.add(String(t))}this._render()}get loadChildren(){return this._loader}set loadChildren(e){this._loader=typeof e==`function`?e:null}get loadUrl(){return this.getAttribute(`load-url`)}set loadUrl(e){e==null?this.removeAttribute(`load-url`):this.setAttribute(`load-url`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}get loadingText(){return this.getAttribute(`loading-text`)??l().loadingText}set loadingText(e){this.setAttribute(`loading-text`,String(e??``))}get errorText(){return this.getAttribute(`error-text`)??l().errorText}set errorText(e){this.setAttribute(`error-text`,String(e??``))}_readScript(){let t=this.querySelector(`:scope > script[type='application/json']`);if(!t)return null;try{return JSON.parse(t.textContent??``)}catch(t){return e(`[@webority/ui-elements] <wui-tree> could not read its JSON nodes:`,t instanceof Error?t.message:void 0),null}}_adoptAll(e){let t=this._byId;this._prev=t,this._byId=/* @__PURE__ */ new Map;let n;try{n=this._adoptStaged(e,null,1)}catch(e){throw this._byId=t,e}finally{this._prev=null}this._roots=n;for(let e of t.keys())this._byId.has(e)||this._checked.delete(e);for(let e of this._roots)this._passChecksDown(e);this._focusId&&!this._byId.has(this._focusId)&&(this._focusId=null)}_adoptStaged(e,t,n){let r=[],i=[];this._staged={ids:r,checks:i};try{let r=this._adopt(e,t,n);for(let e of i)this._checked.add(e);return r}catch(e){for(let e of r)this._byId.delete(e);throw e}finally{this._staged=null}}_adopt(e,t,n){if(!Array.isArray(e))throw Error(`<wui-tree> nodes must be an array.`);return e.map(e=>{let r=e?.id==null?``:String(e.id);if(!r)throw Error(`<wui-tree> every node needs an id.`);if(this._byId.has(r))throw Error(`<wui-tree> node id "${r}" is used twice.`);let i=this._prev?.get(r),a={id:r,raw:e,parent:t,level:n,seq:++this._seq,label:e.label==null?r:String(e.label),icon:e.icon||null,badge:e.badge==null||e.badge===``?null:String(e.badge),badgeTone:e.badgeTone||null,disabled:!!e.disabled,hasChildren:!!e.hasChildren,children:null,expanded:i?i.expanded:!!e.expanded,loading:!1,failed:!1};this._byId.set(r,a),this._staged?.ids.push(r);let o=e.children??(e.hasChildren?i?.children?.map(e=>e.raw):void 0);return Array.isArray(o)&&(a.children=this._adopt(o,a,n+1)),a.loading=!!i?.loading&&a.children===null&&a.hasChildren,e.checked&&!i&&this._staged?.checks.push(r),a})}_passChecksDown(e){e.children?.length&&this._checked.has(e.id)&&(this._checked.delete(e.id),this._setChecked(e,!0));for(let t of e.children??[])this._passChecksDown(t)}_loadOpenNodes(){queueMicrotask(()=>{if(this.isConnected)for(let e of[...this._byId.values()])e.expanded&&e.children===null&&e.hasChildren&&!e.loading&&this._load(e)})}_isBranch(e){return e.children?e.children.length>0:e.hasChildren}_visible(){let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&r.children&&t(r.children)};return t(this._roots),e}_state(e){if(e.children?.length){let t=0,n=0;for(let r of e.children){let e=this._state(r);e===`checked`?t++:e===`unchecked`&&n++}return t===e.children.length?`checked`:n===e.children.length?`unchecked`:`mixed`}return this._checked.has(e.id)?`checked`:`unchecked`}_setChecked(e,t){if(e.children?.length)for(let n of e.children)n.disabled||this._setChecked(n,t);else t?this._checked.add(e.id):this._checked.delete(e.id)}_nodeFrom(e){if(!(e instanceof Element))return null;let t=e.closest(`li.wui-tree-item`);if(!t)return null;for(let[e,n]of this._els)if(n.li===t)return this._byId.get(e)??null;return null}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-tree:${e}`,{detail:t,bubbles:!0,composed:!0}))}_announce(e){this._live&&(this._live.textContent=e)}_setRoving(e){let t=this._focusId===null?void 0:this._els.get(this._focusId);t&&(t.li.tabIndex=-1),this._focusId=e.id;let n=this._els.get(e.id);n&&(n.li.tabIndex=0)}_focusNode(e){e&&(this._setRoving(e),this._els.get(e.id)?.li.focus())}_activate(e){e.disabled||(this.selection===`single`&&(this._selected=e.id,this._render(),this._syncForm()),this._emit(`select`,{id:e.id,node:e.raw}))}_enabledLeaves(e){return e.disabled?[]:e.children?.length?e.children.flatMap(e=>this._enabledLeaves(e)):[e]}_toggleCheck(e){let t=this._enabledLeaves(e);if(!t.length)return;let n=!t.every(e=>this._checked.has(e.id));this._setChecked(e,n),this._render(),this._syncForm(),this._emit(`check`,{id:e.id,checked:n,values:this.values})}_toggleExpand(e){!e.disabled&&this._isBranch(e)&&(e.expanded?(e.expanded=!1,this._render()):this._expand(e))}_expand(e){e.expanded=!0,e.children===null?this._load(e):this._render()}async _load(e){if(e.loading)return;e.loading=!0,e.failed=!1,this._announce(this.loadingText),this._render();let t=[],n=null;try{t=await this._fetchChildren(e)}catch(e){n=e}let r=this._byId.get(e.id);if(!r)this._announce(``);else if(r.loading){if(r.loading=!1,!n)try{r.children=this._adoptStaged(t,r,r.level+1),this._passChecksDown(r),this._announce(``)}catch(e){n=e}n&&(r.failed=!0,r.expanded=!1,this._announce(this.errorText),this._emit(`error`,{id:r.id,message:n instanceof Error?n.message:String(n)})),this._render(),this._syncForm()}}async _fetchChildren(e){if(this._loader)return this._loader(e.raw);let t=this.getAttribute(`load-url`);if(!t)throw Error(`<wui-tree> has a node with children to load but no loadChildren or load-url.`);let n=new URL(t,window.location.href);n.searchParams.set(f,e.id);let r=await o(n.href,{headers:{Accept:`application/json`}});if(!r.ok)throw Error(`Loading children answered ${r.kind}.`);return JSON.parse(r.html)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=this._nodeFrom(t);n&&!n.disabled&&(this._focusNode(n),t.closest(`.wui-tree-toggle`)?this._toggleExpand(n):t.closest(`.wui-tree-check`)?(e.preventDefault(),this._toggleCheck(n)):this._activate(n))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=this._nodeFrom(e.target);if(t&&e.target===this._els.get(t.id)?.li){if(e.key===`ArrowRight`){if(e.preventDefault(),!this._isBranch(t)||t.disabled)return;t.expanded?t.children?.length&&this._focusNode(t.children[0]):this._expand(t)}else e.key===`ArrowLeft`?(e.preventDefault(),t.expanded&&this._isBranch(t)&&!t.disabled?this._toggleExpand(t):t.parent&&this._focusNode(t.parent)):e.key===` `?(e.preventDefault(),this.selection===`multiple`?this._toggleCheck(t):this.selection===`single`&&this._activate(t)):this._nav.handler(e)}}_syncForm(){let e=this.selection;if(e===`multiple`)n(this,this.values);else if(e===`single`)r(this,this._selected??``);else for(let e of this.querySelectorAll(p))e.remove()}_render(){if(!this._list)return;let e=document.activeElement,t=!!e&&this._list.contains(e),n=this._visible();n.some(e=>e.id===this._focusId)||(this._focusId=(n.find(e=>e.id===this._selected)??n[0])?.id??null),this._els=/* @__PURE__ */ new Map;let r=this.getAttribute(`aria-label`);r?this._list.setAttribute(`aria-label`,r):this._list.removeAttribute(`aria-label`),this._list.replaceChildren(...this._buildLevel(this._roots)),t&&this._focusId&&this._els.get(this._focusId)?.li.focus(),this._syncForm()}_buildLevel(e){return e.map((t,n)=>this._buildItem(t,n+1,e.length))}_buildItem(e,t,n){let r=this.selection,a=this._isBranch(e),o=this._state(e),s=g(`li`,`wui-tree-item`,{role:`treeitem`,tabindex:e.id===this._focusId?0:-1,"aria-level":e.level,"aria-setsize":n,"aria-posinset":t,"aria-labelledby":`${this._uid}-${e.seq}`,"aria-describedby":e.badge?`${this._uid}-${e.seq}-badge`:null});a&&s.setAttribute(`aria-expanded`,String(e.expanded)),e.disabled&&s.setAttribute(`aria-disabled`,`true`),e.loading&&s.setAttribute(`aria-busy`,`true`),r===`single`&&s.setAttribute(`aria-selected`,String(e.id===this._selected)),r===`multiple`&&s.setAttribute(`aria-checked`,o===`mixed`?`mixed`:String(o===`checked`));let c=g(`div`,`wui-tree-row`,{role:`presentation`});c.style.setProperty(`--wui-tree-level`,String(e.level-1)),r===`single`&&e.id===this._selected&&c.classList.add(`wui-tree-row-selected`),e.failed&&c.classList.add(`wui-tree-row-error`);let l=g(`span`,a?`wui-tree-toggle`:`wui-tree-toggle wui-tree-toggle-leaf`,{"aria-hidden":`true`});if(a&&(l.innerHTML=i(`chevron-right`,{size:16})),c.append(l),r===`multiple`){let t=g(`input`,`form-check-input wui-tree-check`,{type:`checkbox`,tabindex:-1,"aria-hidden":`true`});t.checked=o===`checked`,t.indeterminate=o===`mixed`,t.disabled=e.disabled,t.addEventListener(`mousedown`,e=>e.preventDefault()),c.append(t)}if(e.icon){let t=g(`span`,`wui-tree-icon`,{"aria-hidden":`true`});t.innerHTML=i(e.icon,{size:16}),c.append(t)}let u=g(`span`,`wui-tree-label`,{id:`${this._uid}-${e.seq}`});if(u.textContent=e.label,c.append(u),e.badge){let t=g(`span`,`badge wui-tree-badge${e.badgeTone&&e.badgeTone!==`neutral`?` badge-${e.badgeTone}`:``}`,{id:`${this._uid}-${e.seq}-badge`});t.textContent=e.badge,c.append(t)}if(e.loading&&c.append(g(`span`,`wui-tree-spinner`,{"aria-hidden":`true`})),s.append(c),e.expanded&&e.children?.length){let t=g(`ul`,`wui-tree-group`,{role:`group`});t.append(...this._buildLevel(e.children)),s.append(t)}return this._els.set(e.id,{li:s,row:c}),s}};export{_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){let n=t.offsetWidth,r=t.offsetHeight,i=e.right+4+n>window.innerWidth-4,a=i?e.left-4-n:e.right+4;t.style.left=`${Math.max(4,a)}px`,t.style.top=`${Math.max(4,Math.min(e.top,window.innerHeight-r-4))}px`,t.dataset.side=i?`start`:`end`}var t={top:`bottom`,bottom:`top`,start:`end`,end:`start`},n=[`bottom`,`top`,`end`,`start`];function r(e,t){return e===`bottom`?window.innerHeight-t.bottom:e===`top`?t.top:e===`end`?window.innerWidth-t.right:t.left}function i(e,t,n,r){return e===`start`?t:e===`end`?n-r:t+(n-t-r)/2}function a(e,t,n){return Math.max(8,Math.min(e,t-n-8))}function o(e,o,s,c){let l=c.gap??4,u=c.align??`start`,d=o.offsetWidth,f=o.offsetHeight,p=s===`auto`?n.reduce((t,n)=>r(n,e)>r(t,e)?n:t):s,m=p===`top`||p===`bottom`,h=(m?f:d)+l,g=r(p,e)<h&&r(t[p],e)>r(p,e)?t[p]:p,_,v;if(m){v=g===`bottom`?e.bottom+l:Math.max(4,e.top-f-l);let t=i(u,e.left,e.right,d);c.flipAlign&&u===`start`&&t+d>window.innerWidth-4&&e.right-d>=4?t=e.right-d:c.flipAlign&&u===`end`&&t<4&&e.left+d<=window.innerWidth-4&&(t=e.left),_=Math.max(4,Math.min(t,window.innerWidth-d-4))}else _=Math.max(4,g===`end`?e.right+l:e.left-d-l),v=Math.max(4,Math.min(i(u,e.top,e.bottom,f),window.innerHeight-f-4));o.style.left=`${_}px`,o.style.top=`${v}px`,o.dataset.side=g;let y=c.arrow;if(y){if(m){let t=(e.left+e.right)/2-_-y.offsetWidth/2;y.style.left=`${a(t,d,y.offsetWidth)}px`}else{let t=(e.top+e.bottom)/2-v-y.offsetHeight/2;y.style.top=`${a(t,f,y.offsetHeight)}px`}}}function s(t,n,r={}){if(!t)throw Error(`anchorOverlay: missing trigger`);if(!n)throw Error(`anchorOverlay: missing panel`);n.style.position=`fixed`;let i=t.getBoundingClientRect();if(r.beside){e(i,n);return}if(r.side!==void 0){n.classList.remove(`drop-up`),n.style.maxHeight=``,o(i,n,r.side,r);return}let a=r.clampHeight?n.scrollTop:0;r.clampHeight&&(n.style.maxHeight=``);let s=n.offsetHeight,c=window.innerHeight-i.bottom,l=!r.below&&c<s+4&&i.top>c;if(n.classList.toggle(`drop-up`,l),n.style.top=l?`${Math.max(4,i.top-s-4)}px`:`${i.bottom+4}px`,r.clampHeight){let e=l?i.top-8:window.innerHeight-i.bottom-8;e<s&&(n.style.maxHeight=`${Math.max(e,0)}px`),n.scrollTop=a}r.matchWidth&&(i.width>=300?(n.style.minWidth=`${i.width}px`,n.style.width=`${i.width}px`,n.style.maxWidth=`${i.width}px`):(n.style.minWidth=`${i.width}px`,n.style.width=`max-content`,n.style.maxWidth=`${Math.min(400,window.innerWidth-8)}px`));let u=n.offsetWidth;if(r.alignEnd){let e=i.right-u,t=e>=8?e:i.left,r=Math.max(8,Math.min(t,window.innerWidth-u-8));n.style.left=`${r}px`}else{let e=r.flipAlign&&i.left+u>window.innerWidth-4&&i.right-u>=4,t=Math.min(e?i.right-u:i.left,window.innerWidth-u-4);n.style.left=`${Math.max(4,t)}px`}}function c(e,t){l(e),e._reanchor=t,e._reanchorScroll=n=>{n.composedPath().includes(e)||t()},window.addEventListener(`resize`,e._reanchor),window.addEventListener(`scroll`,e._reanchorScroll,!0)}function l(e){if(!e?._reanchor)return;window.removeEventListener(`resize`,e._reanchor);let t=e._reanchorScroll;t&&window.removeEventListener(`scroll`,t,!0),e._reanchor=null,e._reanchorScroll=null}export{c as n,l as r,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./imeSafeEnter-DPs9qL3S.js";var t=e=>e.target instanceof Element?e.target.tagName:void 0;function n(n){let{getVisibleOptions:r,getActive:i,setActive:a,onEnter:o,onEscape:s,onTypeahead:c,typeaheadMs:l=500}=n,u=``,d=null,f=()=>{clearTimeout(d??void 0),d=null,u=``};return{handler:n=>{let p=r(),m=i(),h=t(n)===`INPUT`||t(n)===`TEXTAREA`;if(n.key===`ArrowDown`)n.preventDefault(),a(Math.min(m+1,p.length-1));else if(n.key===`ArrowUp`)n.preventDefault(),a(Math.max(m-1,0));else if(n.key===`Home`&&!h)n.preventDefault(),p.length&&a(0);else if(n.key===`End`&&!h)n.preventDefault(),p.length&&a(p.length-1);else if(n.key===`PageDown`&&!h){if(n.preventDefault(),!p.length)return;a(Math.min(Math.max(0,m)+8,p.length-1))}else if(n.key===`PageUp`&&!h){if(n.preventDefault(),!p.length)return;a(Math.max(Math.max(0,m)-8,0))}else if(e(n))o&&(n.preventDefault(),o(p[m],p));else if(n.key===`Escape`)s&&s(n);else if(n.key.length===1&&!n.ctrlKey&&!n.metaKey&&!n.altKey&&t(n)!==`INPUT`&&t(n)!==`TEXTAREA`){n.preventDefault(),clearTimeout(d??void 0),u+=n.key.toLowerCase(),d=setTimeout(f,l);let e=p.findIndex(e=>e.textContent.trim().toLowerCase().startsWith(u));e>=0&&(a(e),c&&c(n.key,e,p))}},clearTypeahead:f,teardown:f}}function r(e,t){let n=e.querySelector(`.is-active`);n!==t&&(n?.classList.remove(`is-active`),t?.classList.add(`is-active`))}export{r as n,n as t};
|
package/dist/loader-CQJFj96n.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.freeze({carousel:{entries:[`elements/carousel.ts`],tags:[`wui-carousel`]},"code-block":{entries:[`elements/code-block.ts`],tags:[`wui-code-block`]},"command-palette":{entries:[`elements/command-palette.ts`],tags:[`wui-command-palette`]},"comment-thread":{entries:[`elements/comment-thread.ts`],tags:[`wui-mention-input`,`wui-comment-thread`]},"consent-banner":{entries:[`elements/consent-banner.ts`],tags:[`wui-consent-banner`]},"context-menu":{entries:[`elements/context-menu.ts`],tags:[`wui-context-menu`]},"date-range":{entries:[`elements/date-range.ts`],tags:[`wui-date-range`]},drawer:{entries:[`elements/drawer.ts`],tags:[`wui-drawer`]},dropdown:{entries:[`elements/dropdown.ts`],tags:[`wui-dropdown`]},"entry-grid":{entries:[`elements/entry-grid.ts`],tags:[`wui-entry-grid`]},"image-crop":{entries:[`elements/image-crop.ts`],tags:[`wui-image-crop`]},"inline-edit":{entries:[`elements/inline-edit.ts`],tags:[`wui-inline-edit`]},kanban:{entries:[`elements/kanban.ts`],tags:[`wui-kanban`]},"lead-popup":{entries:[`elements/lead-popup.ts`],tags:[`wui-lead-popup`]},lightbox:{entries:[`elements/lightbox.ts`],tags:[`wui-lightbox`]},"org-tree":{entries:[`elements/org-tree.ts`],tags:[`wui-org-tree`]},markdown:{entries:[`elements/markdown.ts`],tags:[`wui-markdown`]},phone:{entries:[`elements/phone.ts`,`global/parts/select-country.ts`],tags:[`wui-phone`]},popover:{entries:[`elements/popover.ts`],tags:[`wui-popover`]},"saved-views":{entries:[`elements/saved-views.ts`],tags:[`wui-saved-views`]},glyphs:{entries:[`global/parts/glyphs.ts`],tags:[]},"select-chips":{entries:[`global/parts/select-chips.ts`],tags:[]},"select-recents":{entries:[`global/parts/select-recents.ts`],tags:[]},"select-search":{entries:[`global/parts/select-search.ts`],tags:[]},slider:{entries:[`elements/slider.ts`],tags:[`wui-slider`]},sortable:{entries:[`elements/sortable.ts`],tags:[`wui-sortable`]},"status-icon":{entries:[`elements/status-icon.ts`],tags:[`wui-status-icon`]},timepicker:{entries:[`elements/timepicker.ts`],tags:[`wui-timepicker`]},tour:{entries:[`elements/tour.ts`],tags:[`wui-tour`]},tree:{entries:[`elements/tree.ts`],tags:[`wui-tree`]},wizard:{entries:[`elements/wizard.ts`],tags:[`wui-wizard-step`,`wui-wizard`]},chart:{file:`ui-chart.global.js`,tags:[`wui-chart`],selfContained:!0},calendar:{file:`ui-calendar.global.js`,tags:[`wui-calendar`],selfContained:!0},"rich-text":{file:`ui-rich-text.global.js`,tags:[`wui-rich-text`],selfContained:!0},"file-viewer":{file:`ui-file-viewer.global.js`,tags:[`wui-file-viewer`],selfContained:!0}});Object.freeze({anchorOverlay:`anchorOverlay.ts`,buttonClass:`buttonClass.ts`,calendarMath:`calendarMath.ts`,copyText:`copyText.ts`,dataTable:`dataTable.ts`,defineElement:`defineElement.ts`,devWarn:`devWarn.ts`,dom:`dom.ts`,drawerText:`text/web/drawer.g.ts`,elementBase:`elementBase.ts`,fieldState:`fieldState.ts`,formatters:`formatters.ts`,formMirror:`formMirror.ts`,glyphs:`global/glyphs.ts`,iconGlyphs:`iconGlyphs.g.ts`,imeSafeEnter:`imeSafeEnter.ts`,isDrawn:`isDrawn.ts`,listboxKeyNav:`listboxKeyNav.ts`,loader:`global/loader.ts`,mentionText:`mentionText.ts`,menuKeyNav:`menuKeyNav.ts`,nativeOverlay:`nativeOverlay.ts`,notificationDays:`notificationDays.ts`,optionLabel:`optionLabel.ts`,partRegistry:`select/partRegistry.ts`,selectList:`select/list.ts`,selectRemote:`select/remote.ts`,selectText:`text/web/select.g.ts`,stepperHeader:`stepperHeader.ts`,tableSelect:`tableSelect.ts`,textMatch:`textMatch.ts`,textStore:`text/textStore.ts`,tooltips:`tooltips.ts`,wuiHttp:`server/wuiHttp.ts`,WuiSelect:`WuiSelect.ts`,zone:`zone.ts`});var t=`wui-elements:defined`,n=`wui-elements:load-error`,r=/* @__PURE__ */ new Map;for(let[t,n]of Object.entries(e))for(let e of n.tags)r.set(e,t);[...r.keys()].join(`,`);export{n,t};
|
package/dist/search-Cj1YQUwK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./devWarn-DXdRWZs3.js";import{i as t}from"./optionLabel-B2cU4Ax0.js";import{r as n}from"./textStore-opIEM4lu.js";import{r}from"./search.g-B5d1s59A.js";import{t as i}from"./customRule-BXJdj57A.js";import{n as a}from"./WuiSelect-CMHoPHlx.js";var o=()=>n(`select`,r),s=(e,n)=>{let r=n.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>t(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)},c=e=>{let t=[...e.querySelectorAll(`.wui-select-option`)].filter(e=>e.dataset.custom!==`true`&&e.getAttribute(`aria-disabled`)!==`true`);return t.length===1?t[0]?.dataset.value??null:null};function l(){let t,n,r=0,l,u=null,d=null,f=``,p=null,m=!1,h=()=>a(t),g=()=>typeof t.loadOptions!=`function`&&!t.getAttribute(`source`),_=(e,n,r)=>{let i=t.getAttribute(e);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},v=()=>_(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),y=()=>_(`debounce`,250,e=>Number.isFinite(e)&&e>=0),b=()=>{u?.abort(),u=null};function x(e,n){if(typeof t.loadOptions==`function`)return t.loadOptions(e,{signal:n});let r=t.getAttribute(`source`);if(r===null)throw Error(`search source attribute missing`);let i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(e)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function S(n,r,i){r?(e(`wui-select: search failed`,i),t.setPartOptions([]),t.setStatus(`empty`)):(t.setPartOptions(n),t.setStatus(n.length?`idle`:`empty`))}async function C(e,t,n){let i=[],a=!1,o=null;try{if(i=await x(e,n),!Array.isArray(i))throw TypeError(`search results must be an array`)}catch(e){a=!0,o=e??/* @__PURE__ */ Error(`search failed`)}finally{t===r&&(u=null,S(i,a,o))}}function w(e){let n=r;b(),g()?(m=!0,t.setStatus(`loading`)):(u=new AbortController,t.setStatus(`loading`),C(e,n,u.signal))}let T=(e,n)=>t.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:n}}));function E(e){r+=1,b(),clearTimeout(l),l=void 0,e.trim().length<v()?(t.setPartOptions([]),t.setStatus(`hint`)):(T(e,r),w(e))}return{mount(e,r,i={}){t=e,n=r;let a=n.search?.value??``;n.search&&i.carry?.query&&a===``&&(n.search.value=i.carry.query),a.trim()!==``&&t._onQueryChange(a)},onQuery(e){if(r+=1,b(),clearTimeout(l),l=void 0,f=e,p=null,m=!1,!h())return!1;if(e.trim().length<v())return t.setPartOptions([]),t.setStatus(`hint`),!0;let n=r;return l=setTimeout(()=>{l=void 0,T(e,n),w(e)},y()),!0},onOpen(){if(h()){if(p!==null){let e=p;p=null,E(e)}else v()===0&&t._query.trim()===``&&E(``)}},onOptions(){m&&(m=!1,t.setStatus(t.options.length?`idle`:`empty`))},onBlur(){if(t.mode!==`search`)return!1;let e=(n.search?.value??``).trim();if(!e||e===String(t.value))return!1;if(t.hasAttribute(`allow-custom`)&&!s(t,e)){let n=i(t,e);return n?(t.setError(n),!1):(t.commit(e,{isCustom:!0}),!0)}let r=c(n.list);return r===null||r===String(t.value)?!1:(t.commit(r,{isCustom:!1}),t.closeMenu(),!0)},actionRow(e){if(d=null,t.mode!==`search`||!t.hasAttribute(`allow-custom`))return null;let n=e.trim();return!n||s(t,n)?null:(d={position:`bottom`,label:(t.getAttribute(`add-label`)??o().addLabel).replaceAll(`{query}`,n),value:n},d)},onPick(e){if(!d||e.value!==d.value||e.label!==d.label)return!1;let n=d.value;return d=null,t.commit(n,{isCustom:!0}),!0},renderValue(){let e=t.value;if(t.mode!==`search`||!e||t.options.some(t=>String(t.value)===String(e)))return!1;let r=t.getAttribute(`value-label`);return r?(n.value.classList.remove(`wui-select-placeholder`),n.value.textContent=r,!0):!1},teardown(){(l!==void 0||u!==null||m)&&(p=f),m=!1,r+=1,clearTimeout(l),l=void 0,b(),d=null}}}export{l as default};
|