@astryx-vue/core 0.2.2 → 0.2.3
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/THIRD_PARTY_NOTICES.md +2 -0
- package/dist/AppShell/index.d.ts +1 -1
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-Cb41gIAj.js → AppShell-Dd-D4bA2.js} +2 -2
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.d.ts +3 -2
- package/dist/Breadcrumbs/index.js +3 -2
- package/dist/{Breadcrumbs-CTQ7fjDn.js → Breadcrumbs-CWGfgLNK.js} +13 -8
- package/dist/Button/index.d.ts +1 -1
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/Calendar/index.d.ts +2 -2
- package/dist/Calendar/index.js +1 -1
- package/dist/Calendar-CnOsSjMY.js +656 -0
- package/dist/Card/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-X0cuQkvg.js → Carousel-JA7ilqI_.js} +2 -2
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-M0tiGrNT.js → Chat-C7WrCOE4.js} +3 -3
- package/dist/CheckboxIndicator/index.js +1 -1
- package/dist/CheckboxIndicator-D37cm2Rh.js +68 -0
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-CMsEE1_4.js → CheckboxInput-25Q8ItH-.js} +10 -9
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxList-BbCPiend.js → CheckboxList-CnCGnkZk.js} +77 -24
- package/dist/Citation/index.js +1 -1
- package/dist/{Citation-C1veUk5p.js → Citation-CtwrU33I.js} +2 -2
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.d.ts +1 -1
- package/dist/Code/index.js +2 -2
- package/dist/{Code-yb_KOFtJ.js → Code-BvefYRpx.js} +2 -1
- package/dist/{CodeBlock-DesTJAkm.js → CodeBlock-BZGzYeoL.js} +1 -1
- package/dist/Collapsible/index.d.ts +1 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-BestK35V.js → Collapsible-3YerR-FO.js} +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-BArt97V8.js → CommandPalette-BNbM9T9y.js} +1 -1
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-CAoig1RK.js → ComplexSelector-LtbLlrcj.js} +3 -3
- package/dist/ContextMenu/index.d.ts +3 -2
- package/dist/ContextMenu/index.js +3 -2
- package/dist/{ContextMenu-9Im6i43E.js → ContextMenu-DVQl0xL5.js} +204 -56
- package/dist/DateInput/index.d.ts +2 -2
- package/dist/DateInput/index.js +1 -1
- package/dist/DateInput-zm8sNc0t.js +743 -0
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-DwDy3eRo.js → DateRangeInput-DlVFzrf7.js} +54 -19
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-BYiaC9bn.js → DateTimeInput-C7Z-p6Yd.js} +54 -15
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/DropdownMenu/index.d.ts +3 -3
- package/dist/DropdownMenu/index.js +4 -3
- package/dist/{DropdownMenu-Dh-WAHKb.js → DropdownMenu-BoZChdev.js} +308 -63
- package/dist/DropdownMenu-u1psFjis.js +325 -0
- package/dist/DropdownMenuRadioItem.vue-uVM0FD2f.d.ts +564 -0
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-DLO6V12n.js → FileInput-QdlZn7qK.js} +2 -2
- package/dist/Icon/index.d.ts +4 -3
- package/dist/Icon/index.js +2 -2
- package/dist/{Icon-CJKjdJy-.js → Icon-bteSId7T.js} +113 -18
- package/dist/Indicator/index.d.ts +3 -0
- package/dist/Indicator/index.js +2 -0
- package/dist/InputGroup/index.d.ts +2 -2
- package/dist/InputGroup/index.js +3 -2
- package/dist/InputGroup-BzR6JRZb.js +129 -0
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-CdFCS_EA.js → Lightbox-BSzfqZ-u.js} +2 -2
- package/dist/List/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-BqKloI3w.js → Markdown-B6tSqenv.js} +8 -5
- package/dist/MetadataList/index.js +1 -1
- package/dist/{MetadataList-CvZkmisf.js → MetadataList-aN1tRn6W.js} +1 -1
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-Bwi0qXXM.js → MobileNavToggle-fqcSafkc.js} +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-BwJaJrkB.js → MoreMenu-B3brqdK_.js} +1 -1
- package/dist/MultiSelector/index.d.ts +2 -2
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-C-ETfFy_.js → MultiSelector-BD5PMgez.js} +303 -121
- package/dist/{NavDisclosure-DHrSNRDR.js → NavDisclosure-DbYLDXK0.js} +1 -1
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NavMenu/index.js +2 -2
- package/dist/{NavMenuItem-B-k7olt5.js → NavMenuItem-DrwIMHKO.js} +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-DjetVB8O.js → NumberInput-CBeU4lEl.js} +1 -1
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline-Bz9c-u5y.js → Outline--HVMSB6i.js} +1 -1
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-ED-KN9Y5.js → OverflowList-FMh7r-r_.js} +3 -3
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-Cb66HMEf.js → Pagination-DlIvESjx.js} +2 -2
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-Crhk9PNP.js → Popover-D7zqpFwU.js} +1 -1
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-CjU8y4mi.js → PowerSearch-CMG7Rb69.js} +14 -14
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-BqjdSCfJ.js → RadioGroup-CBqUPq_L.js} +16 -8
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioList-DI8ujXcT.js → RadioList-CPOJn9Th.js} +1 -1
- package/dist/Resizable/index.js +1 -1
- package/dist/{Resizable-D-TBCg0Y.js → Resizable-CXpvj1TZ.js} +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SegmentedControl/index.d.ts +1 -1
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/Selector/index.d.ts +2 -2
- package/dist/Selector/index.js +1 -1
- package/dist/Selector-BpPnuWH3.js +618 -0
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-DonEfiAx.js → SideNav-D4TupqgE.js} +3 -3
- package/dist/Stack/index.d.ts +1 -1
- package/dist/Stepper/index.d.ts +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-D2ZIcUNx.js → Stepper-H-6-T5Ps.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/TabList/index.d.ts +1 -1
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-D3F-stq-.js → TabList-BlzkrObv.js} +2 -2
- package/dist/Table/index.js +1 -1
- package/dist/{Table-CrP2Uffq.js → Table-nqA_njNz.js} +6 -6
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/Theme/index.d.ts +2 -1
- package/dist/Theme/index.js +1 -1
- package/dist/{Theme-BuUiiJNr.js → Theme-CejS9MHm.js} +21 -3
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-BC5JGPGZ.js → Thumbnail-CXb3m_Hv.js} +2 -2
- package/dist/{TimeField-DpHFrNv0.js → TimeField-B3cndWb0.js} +2 -2
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-DJLV0_4z.js → TimeInput-BHQ_LKGm.js} +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-GKNjjt5g.js → Timestamp-Cfuxbb3i.js} +2 -2
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.js +1 -1
- package/dist/{Token-Chu_eCVs.js → Token-CdVLH0_H.js} +2 -2
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-DRDpvQ_l.js → Tokenizer-DlD-S_8-.js} +3 -3
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-CEyWddtA.js → TopNav-DzV874G7.js} +5 -5
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-COS8US8e.js → TreeList-DEwvlZRV.js} +2 -2
- package/dist/Typeahead/index.d.ts +1 -1
- package/dist/Typeahead/index.js +1 -1
- package/dist/{Typeahead-P7cCqtaQ.js → Typeahead-DQ3tmqYe.js} +3 -3
- package/dist/{context-O2Vb8cJl.js → colorMode-CBgdgDSn.js} +1 -7
- package/dist/composables/index.d.ts +2 -2
- package/dist/composables/index.js +10 -5
- package/dist/{composables-CVfjp9h4.js → composables-DDI08XFF.js} +98 -1
- package/dist/context-Cws_tXTr.js +7 -0
- package/dist/context-D5-MwxnN.js +4 -0
- package/dist/{context-CiKncNSH.js → context-DmOLCubj.js} +82 -8
- package/dist/{index-DimuSES0.d.ts → index-B1x05arQ.d.ts} +3 -1
- package/dist/index-B9f1rUEv.d.ts +77 -0
- package/dist/{index-D-ZuubCK.d.ts → index-BB5yVIN-.d.ts} +2 -2
- package/dist/{index-Bu0Zd1uw.d.ts → index-BMn9ghAX.d.ts} +3 -3
- package/dist/{index-CJlBAXwj.d.ts → index-BRfR0lhb.d.ts} +41 -4
- package/dist/{index-DNRBbwp_.d.ts → index-BTAgQRP0.d.ts} +758 -111
- package/dist/{index-DA52oIdw.d.ts → index-BcJBLWJ0.d.ts} +2 -2
- package/dist/{index-jdjcb3Js.d.ts → index-Bqb_Fyju.d.ts} +2 -2
- package/dist/{index-CNjbOgty.d.ts → index-C-QpeUlQ.d.ts} +2 -2
- package/dist/{index-DGXviOlp.d.ts → index-C2sfHfBw.d.ts} +31 -5
- package/dist/{index-By2mSzUA.d.ts → index-CA6RbRWx.d.ts} +1 -1
- package/dist/{index-gW0HW02U.d.ts → index-COxy6LEW.d.ts} +1 -1
- package/dist/{index-CVn0GBdB.d.ts → index-Ca8VIE4l.d.ts} +1 -1
- package/dist/{index-CRizexSC.d.ts → index-Ch6BbxCP.d.ts} +2 -67
- package/dist/{index-DWH_HzXi.d.ts → index-ChWlKHjc.d.ts} +1 -1
- package/dist/{index-kVhSuA9t.d.ts → index-Ctu32CLv.d.ts} +4 -4
- package/dist/{index-DOUEn7V0.d.ts → index-D1Twv_fL.d.ts} +65 -6
- package/dist/{index-D_nYxnNv.d.ts → index-D7-WTV6I.d.ts} +1 -1
- package/dist/{index-c_TaW8mM.d.ts → index-D8o50qOE.d.ts} +1 -1
- package/dist/{index-D4I_obqR.d.ts → index-DAiGhkNZ.d.ts} +1 -1
- package/dist/{index-Cs5pcwY3.d.ts → index-DMQG6kdM.d.ts} +3 -3
- package/dist/index-D_UEJIU5.d.ts +83 -0
- package/dist/{index-fa72tWIU.d.ts → index-DkVEBdWa.d.ts} +2 -2
- package/dist/{index-B1TG2GPS.d.ts → index-DxsKyAxq.d.ts} +116 -44
- package/dist/{index-BHqRH7QW.d.ts → index-FEy8qFSD.d.ts} +2 -2
- package/dist/{index-qiZtHnGK.d.ts → index-LIyvJTW3.d.ts} +39 -0
- package/dist/{index-BKr7yvVv.d.ts → index-MPcg1Pm4.d.ts} +1 -1
- package/dist/{index-cGagYM1g.d.ts → index-ViSV0RBx.d.ts} +1 -1
- package/dist/{index-C7mxUcDR.d.ts → index-f4NGT-e2.d.ts} +4 -4
- package/dist/{index-DsyKhauk.d.ts → index-foQMNKZO.d.ts} +1 -1
- package/dist/{index-u5ozu0G7.d.ts → index-vP0EtrJJ.d.ts} +13 -3
- package/dist/{index-CZeoAr0a.d.ts → index-xfkEuGLY.d.ts} +2 -2
- package/dist/index.d.ts +76 -75
- package/dist/index.js +115 -107
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +2 -2
- package/dist/{locale-Cpk_nrLA.js → locale-CCwVnyMZ.js} +25 -1
- package/dist/searchResultMessage-DN0HeRRB.js +94 -0
- package/dist/semantic-CKH9XVqa.d.ts +54 -0
- package/dist/{types-pnljWjEE.d.ts → types-CwyibrRB.d.ts} +12 -11
- package/dist/types-jmqqnkKA.d.ts +163 -0
- package/dist/{useAnchoredListbox-7W90Ny-9.js → useAnchoredListbox-BN9LQnon.js} +1 -1
- package/dist/useDatePresentation-C07PnOCw.js +21 -0
- package/dist/{useMonthGrid-CmJsZTcB.js → useDateRange-CIXoE_8k.js} +1 -42
- package/dist/useDisclosureHandle-Df3HhAfC.js +24 -0
- package/dist/{useDismiss-CAiHU6QD.js → useDismiss-Cj8x_51F.js} +8 -4
- package/dist/useFieldControlState-voICDrys.js +18 -0
- package/dist/useHandleRef-6cdKugm8.js +17 -0
- package/dist/useIndicator-i1NORM7W.js +147 -0
- package/dist/useMenuDrillIn-OaEwjK44.js +520 -0
- package/dist/useMonthGrid-fGHSSrFc.js +43 -0
- package/dist/usePendingChange-ib-h8FZK.js +25 -0
- package/dist/useSubmenuMode-CZN9qrUo.js +37 -0
- package/package.json +5 -1
- package/styles/calendar.css +38 -3
- package/styles/check-indicator.css +17 -0
- package/styles/checkbox-indicator.css +29 -10
- package/styles/checkbox-input.css +0 -11
- package/styles/date-input.css +48 -0
- package/styles/dropdown-menu.css +163 -0
- package/styles/field.css +48 -0
- package/styles/icon.css +51 -3
- package/styles/input-group.css +32 -3
- package/styles/multi-selector.css +26 -0
- package/styles/radio-indicator.css +90 -0
- package/styles/radio.css +9 -42
- package/styles/selector.css +112 -14
- package/styles.css +2 -0
- package/dist/Calendar-BFaI5AMv.js +0 -352
- package/dist/CheckboxIndicator-DdJmksHt.js +0 -52
- package/dist/DateInput-BLocxqC3.js +0 -376
- package/dist/DropdownMenu-Ddfr-aEC.js +0 -164
- package/dist/InputGroup-ChrFVxzV.js +0 -42
- package/dist/Selector-DE2IEFML.js +0 -468
- package/dist/index-Bgv4ZmBl.d.ts +0 -72
- package/dist/index-DN7MXPHM.d.ts +0 -398
- package/dist/index-IbUN4M8V.d.ts +0 -40
- package/dist/types-DDAAT1Xd.d.ts +0 -285
- package/dist/useGridRovingFocus-DQQAOYH5.js +0 -99
- /package/dist/{index-BUXNRekN.d.ts → index-BXkNZF3q.d.ts} +0 -0
|
@@ -1,14 +1,43 @@
|
|
|
1
|
+
import { t as useAnnounce } from "./announce-Cnio10Wk.js";
|
|
1
2
|
import { t as useCombobox } from "./useCombobox-CTo5C-gc.js";
|
|
3
|
+
import { t as useDisclosureHandle } from "./useDisclosureHandle-Df3HhAfC.js";
|
|
4
|
+
import { t as useFieldControlState } from "./useFieldControlState-voICDrys.js";
|
|
2
5
|
import { n as useOverflow } from "./useOverflow-VrwF5oek.js";
|
|
3
|
-
import { a as useAstryxMessages } from "./context-
|
|
6
|
+
import { a as useAstryxMessages } from "./context-DmOLCubj.js";
|
|
4
7
|
import { t as _sfc_main$1 } from "./BottomSheet-Dg95HB1s.js";
|
|
5
|
-
import { t as _sfc_main$2 } from "./
|
|
6
|
-
import { t as _sfc_main$3 } from "./
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { t as _sfc_main$2 } from "./Icon-bteSId7T.js";
|
|
9
|
+
import { t as _sfc_main$3 } from "./Spinner-9cYUCnDy.js";
|
|
10
|
+
import { t as useIndicator } from "./useIndicator-i1NORM7W.js";
|
|
11
|
+
import { t as _sfc_main$4 } from "./Field-8zRxzDHE.js";
|
|
12
|
+
import { t as INPUT_GROUP_KEY } from "./context-D5-MwxnN.js";
|
|
13
|
+
import { n as fieldStatusPlacement, r as _sfc_main$5, t as searchResultMessage } from "./searchResultMessage-DN0HeRRB.js";
|
|
14
|
+
import { t as _sfc_main$6 } from "./Token-CdVLH0_H.js";
|
|
15
|
+
import { n as useAnchoredListbox, t as scrollOptionIntoView } from "./useAnchoredListbox-BN9LQnon.js";
|
|
16
|
+
import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, nextTick, normalizeClass, normalizeStyle, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, useId, useTemplateRef, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
|
|
10
17
|
import "../styles/visually-hidden-utility.css";
|
|
11
18
|
import "../styles/multi-selector.css";
|
|
19
|
+
//#region src/MultiSelector/createOption.ts
|
|
20
|
+
/** 创建行的值永远不是真实选项。选中它会走创建,而不是切换勾选。 */
|
|
21
|
+
const CREATE_VALUE_PREFIX = "__astryx_multi_selector_create__";
|
|
22
|
+
function createOptionValue(query) {
|
|
23
|
+
return `${CREATE_VALUE_PREFIX}${query}`;
|
|
24
|
+
}
|
|
25
|
+
function readCreateQuery(value) {
|
|
26
|
+
if (typeof value !== "string" || !value.startsWith("__astryx_multi_selector_create__")) return null;
|
|
27
|
+
return value.slice(32);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 输入去掉首尾空白后,和任何选项标签都不相同(忽略大小写)时,返回可以创建的文本。
|
|
31
|
+
* 空字符串、加载中、没开搜索,都不提供创建行。
|
|
32
|
+
*/
|
|
33
|
+
function resolveCreateQuery(input) {
|
|
34
|
+
if (!input.enabled) return null;
|
|
35
|
+
const trimmed = input.query.trim();
|
|
36
|
+
if (trimmed === "") return null;
|
|
37
|
+
const wanted = trimmed.toLowerCase();
|
|
38
|
+
return input.labels.some((label) => label.toLowerCase() === wanted) ? null : trimmed;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
12
41
|
//#region src/MultiSelector/interactionModality.ts
|
|
13
42
|
let modality = "keyboard";
|
|
14
43
|
let listening = false;
|
|
@@ -112,8 +141,12 @@ const _hoisted_1 = {
|
|
|
112
141
|
const _hoisted_2 = [
|
|
113
142
|
"disabled",
|
|
114
143
|
"aria-disabled",
|
|
144
|
+
"aria-readonly",
|
|
145
|
+
"aria-busy",
|
|
115
146
|
"role",
|
|
147
|
+
"aria-haspopup",
|
|
116
148
|
"aria-expanded",
|
|
149
|
+
"aria-controls",
|
|
117
150
|
"aria-autocomplete",
|
|
118
151
|
"aria-activedescendant",
|
|
119
152
|
"aria-describedby",
|
|
@@ -155,23 +188,26 @@ const _hoisted_13 = [
|
|
|
155
188
|
"placeholder",
|
|
156
189
|
"value"
|
|
157
190
|
];
|
|
158
|
-
const _hoisted_14 = [
|
|
191
|
+
const _hoisted_14 = ["aria-label"];
|
|
192
|
+
const _hoisted_15 = ["id", "data-option-id"];
|
|
193
|
+
const _hoisted_16 = { class: "astryx-multi-selector-option-label" };
|
|
194
|
+
const _hoisted_17 = [
|
|
159
195
|
"id",
|
|
160
196
|
"aria-selected",
|
|
161
197
|
"data-option-id"
|
|
162
198
|
];
|
|
163
|
-
const
|
|
164
|
-
const
|
|
199
|
+
const _hoisted_18 = { class: "astryx-multi-selector-option-label" };
|
|
200
|
+
const _hoisted_19 = {
|
|
165
201
|
key: 0,
|
|
166
202
|
class: "astryx-multi-selector-divider",
|
|
167
203
|
role: "separator"
|
|
168
204
|
};
|
|
169
|
-
const
|
|
205
|
+
const _hoisted_20 = {
|
|
170
206
|
key: 1,
|
|
171
207
|
class: "astryx-multi-selector-heading",
|
|
172
208
|
role: "presentation"
|
|
173
209
|
};
|
|
174
|
-
const
|
|
210
|
+
const _hoisted_21 = [
|
|
175
211
|
"id",
|
|
176
212
|
"aria-selected",
|
|
177
213
|
"aria-disabled",
|
|
@@ -179,15 +215,16 @@ const _hoisted_18 = [
|
|
|
179
215
|
"onMouseenter",
|
|
180
216
|
"onClick"
|
|
181
217
|
];
|
|
182
|
-
const
|
|
183
|
-
const
|
|
184
|
-
const
|
|
218
|
+
const _hoisted_22 = { class: "astryx-multi-selector-option-copy" };
|
|
219
|
+
const _hoisted_23 = { class: "astryx-multi-selector-option-label" };
|
|
220
|
+
const _hoisted_24 = {
|
|
185
221
|
key: 0,
|
|
186
222
|
class: "astryx-multi-selector-option-description"
|
|
187
223
|
};
|
|
188
|
-
const
|
|
189
|
-
key:
|
|
190
|
-
class: "astryx-multi-selector-empty"
|
|
224
|
+
const _hoisted_25 = {
|
|
225
|
+
key: 4,
|
|
226
|
+
class: "astryx-multi-selector-empty",
|
|
227
|
+
role: "presentation"
|
|
191
228
|
};
|
|
192
229
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
193
230
|
name: "AstryxMultiSelector",
|
|
@@ -210,6 +247,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
210
247
|
disabledReason: {},
|
|
211
248
|
status: { default: "default" },
|
|
212
249
|
statusMessage: {},
|
|
250
|
+
statusVariant: { default: "attached" },
|
|
213
251
|
size: { default: "md" },
|
|
214
252
|
variant: { default: "input" },
|
|
215
253
|
presentation: { default: "popover" },
|
|
@@ -239,7 +277,23 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
239
277
|
default: false
|
|
240
278
|
},
|
|
241
279
|
name: {},
|
|
242
|
-
width: {}
|
|
280
|
+
width: {},
|
|
281
|
+
isReadOnly: {
|
|
282
|
+
type: Boolean,
|
|
283
|
+
default: false
|
|
284
|
+
},
|
|
285
|
+
isLoading: {
|
|
286
|
+
type: Boolean,
|
|
287
|
+
default: false
|
|
288
|
+
},
|
|
289
|
+
formatValue: {},
|
|
290
|
+
hasCreate: {
|
|
291
|
+
type: Boolean,
|
|
292
|
+
default: false
|
|
293
|
+
},
|
|
294
|
+
handleRef: {},
|
|
295
|
+
emptyText: {},
|
|
296
|
+
emptySearchText: {}
|
|
243
297
|
},
|
|
244
298
|
emits: [
|
|
245
299
|
"update:modelValue",
|
|
@@ -250,7 +304,16 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
250
304
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
251
305
|
const props = __props;
|
|
252
306
|
const emit = __emit;
|
|
307
|
+
const CheckboxMark = useIndicator("checkbox");
|
|
253
308
|
const messages = useAstryxMessages();
|
|
309
|
+
const announce = useAnnounce();
|
|
310
|
+
const inputGroup = inject(INPUT_GROUP_KEY, null);
|
|
311
|
+
const inGroup = computed(() => inputGroup != null);
|
|
312
|
+
const control = useFieldControlState({
|
|
313
|
+
disabled: () => props.disabled || (inputGroup?.disabled.value ?? false),
|
|
314
|
+
readOnly: () => props.isReadOnly,
|
|
315
|
+
loading: () => props.isLoading
|
|
316
|
+
});
|
|
254
317
|
const triggerId = `astryx-multi-selector-${useId()}`;
|
|
255
318
|
const listboxId = `${triggerId}-listbox`;
|
|
256
319
|
const searchId = `${triggerId}-search`;
|
|
@@ -260,12 +323,14 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
260
323
|
const triggerRef = useTemplateRef("triggerRef");
|
|
261
324
|
const searchRef = useTemplateRef("searchRef");
|
|
262
325
|
const query = ref("");
|
|
263
|
-
const
|
|
326
|
+
const readOnlyId = `${triggerId}-readonly`;
|
|
327
|
+
const focusableDisabled = computed(() => control.isDisabled.value && Boolean(props.disabledReason?.trim()));
|
|
264
328
|
const selectedValues = computed(() => props.modelValue ?? []);
|
|
265
329
|
const placeholder = computed(() => props.placeholder ?? messages.value.multiSelector.placeholder);
|
|
266
330
|
const searchPlaceholder = computed(() => props.searchPlaceholder ?? messages.value.multiSelector.search);
|
|
267
331
|
const selectAllLabel = computed(() => props.selectAllLabel ?? messages.value.multiSelector.selectAll);
|
|
268
|
-
const emptyText = computed(() => messages.value.multiSelector.empty);
|
|
332
|
+
const emptyText = computed(() => props.emptyText ?? messages.value.multiSelector.empty);
|
|
333
|
+
const emptySearchText = computed(() => props.emptySearchText ?? messages.value.multiSelector.emptySearch);
|
|
269
334
|
const fieldStatus = computed(() => {
|
|
270
335
|
if (!props.statusMessage || props.status === "default") return void 0;
|
|
271
336
|
return {
|
|
@@ -273,19 +338,38 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
273
338
|
message: props.statusMessage
|
|
274
339
|
};
|
|
275
340
|
});
|
|
341
|
+
const effectiveStatusVariant = computed(() => fieldStatusPlacement(props.variant, props.statusVariant));
|
|
342
|
+
const statusGlyph = computed(() => {
|
|
343
|
+
if (props.status === "default" || effectiveStatusVariant.value === "detached") return void 0;
|
|
344
|
+
return props.status;
|
|
345
|
+
});
|
|
276
346
|
const rows = computed(() => flattenOptions(props.options, query.value));
|
|
277
347
|
const optionByValue = computed(() => {
|
|
278
348
|
const map = /* @__PURE__ */ new Map();
|
|
279
349
|
for (const row of flattenOptions(props.options, "")) if (row.kind === "option" && row.option) map.set(row.option.value, row.option);
|
|
280
350
|
return map;
|
|
281
351
|
});
|
|
352
|
+
const createQuery = computed(() => resolveCreateQuery({
|
|
353
|
+
enabled: props.hasCreate && props.searchable && !control.isLoading.value,
|
|
354
|
+
query: query.value,
|
|
355
|
+
labels: [...optionByValue.value.values()].map((option) => option.label)
|
|
356
|
+
}));
|
|
357
|
+
const createOption = computed(() => {
|
|
358
|
+
if (createQuery.value == null) return null;
|
|
359
|
+
return {
|
|
360
|
+
value: createOptionValue(createQuery.value),
|
|
361
|
+
label: messages.value.multiSelector.create(createQuery.value)
|
|
362
|
+
};
|
|
363
|
+
});
|
|
282
364
|
const selectable = computed(() => {
|
|
283
365
|
const items = rows.value.flatMap((row) => row.kind === "option" && row.option ? [row.option] : []);
|
|
284
|
-
|
|
285
|
-
|
|
366
|
+
const head = [];
|
|
367
|
+
if (createOption.value) head.push(createOption.value);
|
|
368
|
+
if (props.selectAll) head.push({
|
|
286
369
|
value: SELECT_ALL_VALUE,
|
|
287
370
|
label: selectAllLabel.value
|
|
288
|
-
}
|
|
371
|
+
});
|
|
372
|
+
return [...head, ...items];
|
|
289
373
|
});
|
|
290
374
|
const comboboxOptions = computed(() => selectable.value.map((option) => ({
|
|
291
375
|
value: option.value,
|
|
@@ -294,10 +378,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
294
378
|
description: option.description
|
|
295
379
|
})));
|
|
296
380
|
const dummyValue = ref(null);
|
|
381
|
+
const selectAllIndex = computed(() => props.selectAll ? createOption.value ? 1 : 0 : -1);
|
|
297
382
|
const combobox = useCombobox({
|
|
298
383
|
options: comboboxOptions,
|
|
299
384
|
modelValue: dummyValue,
|
|
300
|
-
isEnabled:
|
|
385
|
+
isEnabled: control.canActivate,
|
|
301
386
|
isSearchable: ref(false),
|
|
302
387
|
onChange: () => {},
|
|
303
388
|
onOpenChange: (isOpen) => {
|
|
@@ -335,7 +420,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
335
420
|
const option = optionByValue.value.get(value);
|
|
336
421
|
return option ? [option] : [];
|
|
337
422
|
}));
|
|
338
|
-
const enabledValues = computed(() => selectable.value.filter((option) => option.value !== "__astryx_select_all__" && !option.disabled).map((option) => option.value));
|
|
423
|
+
const enabledValues = computed(() => selectable.value.filter((option) => option.value !== "__astryx_select_all__" && readCreateQuery(option.value) == null && !option.disabled).map((option) => option.value));
|
|
339
424
|
const selectedEnabledCount = computed(() => enabledValues.value.filter((value) => selectedValues.value.includes(value)).length);
|
|
340
425
|
const selectAllState = computed(() => {
|
|
341
426
|
if (selectedEnabledCount.value === 0) return "unchecked";
|
|
@@ -354,10 +439,30 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
354
439
|
if (shown.length === 0) return "";
|
|
355
440
|
return extra > 0 ? `${shown.join(", ")} ${messages.value.multiSelector.more(extra)}` : shown.join(", ");
|
|
356
441
|
});
|
|
442
|
+
const formattedValue = computed(() => {
|
|
443
|
+
if (selectedOptions.value.length === 0 || props.formatValue == null || props.triggerDisplay === "badges") return void 0;
|
|
444
|
+
return props.formatValue(selectedOptions.value.map((option) => ({
|
|
445
|
+
value: option.value,
|
|
446
|
+
label: option.label
|
|
447
|
+
})));
|
|
448
|
+
});
|
|
449
|
+
const realMatchCount = computed(() => rows.value.filter((row) => row.kind === "option").length);
|
|
450
|
+
const showEmpty = computed(() => !control.isLoading.value && realMatchCount.value === 0 && createOption.value == null);
|
|
451
|
+
const announcement = computed(() => searchResultMessage({
|
|
452
|
+
isOpen: combobox.isOpen.value,
|
|
453
|
+
isLoading: control.isLoading.value,
|
|
454
|
+
query: query.value,
|
|
455
|
+
matchCount: realMatchCount.value,
|
|
456
|
+
hasCreateRow: createOption.value != null,
|
|
457
|
+
emptyText: emptyText.value,
|
|
458
|
+
emptySearchText: emptySearchText.value,
|
|
459
|
+
resultCount: messages.value.multiSelector.resultCount
|
|
460
|
+
}));
|
|
357
461
|
const describedBy = computed(() => {
|
|
358
462
|
return [
|
|
359
|
-
|
|
360
|
-
props.
|
|
463
|
+
inGroup.value ? inputGroup?.describedBy.value : void 0,
|
|
464
|
+
!inGroup.value && props.description ? `${triggerId}-description` : void 0,
|
|
465
|
+
!inGroup.value && props.statusMessage ? `${triggerId}-status` : void 0,
|
|
361
466
|
focusableDisabled.value ? disabledId : void 0
|
|
362
467
|
].filter(Boolean).join(" ") || void 0;
|
|
363
468
|
});
|
|
@@ -365,20 +470,40 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
365
470
|
emit("search", value);
|
|
366
471
|
if (combobox.isOpen.value) combobox.highlightFirst();
|
|
367
472
|
});
|
|
473
|
+
watch(announcement, (message) => {
|
|
474
|
+
if (message) announce(message);
|
|
475
|
+
});
|
|
476
|
+
watch(() => [props.hasCreate, props.searchable], ([create, search]) => {
|
|
477
|
+
const dev = import.meta.env?.DEV === true;
|
|
478
|
+
if (create && !search && dev) console.warn("[MultiSelector] hasCreate 需要同时开启 searchable,否则不会出现创建行。");
|
|
479
|
+
}, { immediate: true });
|
|
368
480
|
watch(() => combobox.activeIndex.value, (index) => {
|
|
369
481
|
if (!combobox.isOpen.value || index < 0) return;
|
|
370
482
|
const option = selectable.value[index];
|
|
371
483
|
nextTick(() => scrollOptionIntoView(listboxRef.value, option ? String(option.value) : void 0));
|
|
372
484
|
});
|
|
373
|
-
function commit(next) {
|
|
485
|
+
function commit(next, change) {
|
|
374
486
|
emit("update:modelValue", next);
|
|
375
|
-
emit("change", next);
|
|
487
|
+
emit("change", next, change);
|
|
488
|
+
}
|
|
489
|
+
function commitCreate(created) {
|
|
490
|
+
commit([...selectedValues.value, created], {
|
|
491
|
+
type: "create",
|
|
492
|
+
query: created
|
|
493
|
+
});
|
|
494
|
+
announce(messages.value.multiSelector.created(created));
|
|
495
|
+
query.value = "";
|
|
376
496
|
}
|
|
377
497
|
function isSelected(value) {
|
|
378
498
|
return selectedValues.value.includes(value);
|
|
379
499
|
}
|
|
380
500
|
function toggleValue(value) {
|
|
381
|
-
if (
|
|
501
|
+
if (!control.canActivate.value || control.isLoading.value) return;
|
|
502
|
+
const created = readCreateQuery(value);
|
|
503
|
+
if (created != null) {
|
|
504
|
+
commitCreate(created);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
382
507
|
if (value === "__astryx_select_all__") {
|
|
383
508
|
const allOn = selectAllState.value === "checked";
|
|
384
509
|
const enabled = new Set(enabledValues.value);
|
|
@@ -389,10 +514,26 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
389
514
|
commit(isSelected(value) ? selectedValues.value.filter((item) => item !== value) : [...selectedValues.value, value]);
|
|
390
515
|
}
|
|
391
516
|
function onTriggerClick() {
|
|
392
|
-
if (
|
|
517
|
+
if (control.canActivate.value) combobox.toggle();
|
|
518
|
+
}
|
|
519
|
+
function openPanel() {
|
|
520
|
+
if (control.canActivate.value) combobox.open();
|
|
393
521
|
}
|
|
522
|
+
function closePanel() {
|
|
523
|
+
combobox.close();
|
|
524
|
+
}
|
|
525
|
+
const handle = {
|
|
526
|
+
open: openPanel,
|
|
527
|
+
close: closePanel,
|
|
528
|
+
toggle: () => {
|
|
529
|
+
if (combobox.isOpen.value) closePanel();
|
|
530
|
+
else openPanel();
|
|
531
|
+
},
|
|
532
|
+
isOpen: () => combobox.isOpen.value
|
|
533
|
+
};
|
|
534
|
+
useDisclosureHandle(() => props.handleRef, handle);
|
|
394
535
|
function onKeyDown(event) {
|
|
395
|
-
if (
|
|
536
|
+
if (!control.canActivate.value || event.isComposing) return;
|
|
396
537
|
const searchInput = props.searchable && event.target instanceof HTMLInputElement;
|
|
397
538
|
switch (event.key) {
|
|
398
539
|
case "ArrowDown":
|
|
@@ -438,7 +579,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
438
579
|
if (combobox.isOpen.value && combobox.activeIndex.value >= 0) {
|
|
439
580
|
const option = selectable.value[combobox.activeIndex.value];
|
|
440
581
|
if (option && !option.disabled) toggleValue(option.value);
|
|
441
|
-
} else if (
|
|
582
|
+
} else if (combobox.isOpen.value && createQuery.value != null) commitCreate(createQuery.value);
|
|
583
|
+
else if (!combobox.isOpen.value) combobox.open();
|
|
442
584
|
break;
|
|
443
585
|
case "Escape":
|
|
444
586
|
if (combobox.isOpen.value) {
|
|
@@ -483,20 +625,22 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
483
625
|
}
|
|
484
626
|
__expose({
|
|
485
627
|
focus: () => (props.searchable && combobox.isOpen.value ? searchRef.value : triggerRef.value)?.focus(),
|
|
486
|
-
blur: () => triggerRef.value?.blur()
|
|
628
|
+
blur: () => triggerRef.value?.blur(),
|
|
629
|
+
...handle
|
|
487
630
|
});
|
|
488
631
|
return (_ctx, _cache) => {
|
|
489
632
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
490
|
-
createVNode(_sfc_main$
|
|
633
|
+
createVNode(_sfc_main$4, {
|
|
491
634
|
class: normalizeClass(["astryx-multi-selector", [`size-${props.size}`, `variant-${props.variant}`]]),
|
|
492
635
|
label: props.label,
|
|
493
636
|
"input-id": props.searchable && unref(combobox).isOpen.value ? searchId : triggerId,
|
|
494
|
-
|
|
495
|
-
"is-
|
|
496
|
-
"is-
|
|
497
|
-
"is-
|
|
498
|
-
|
|
499
|
-
status: fieldStatus.value,
|
|
637
|
+
"is-label-hidden": inGroup.value || props.labelHidden,
|
|
638
|
+
"is-disabled": unref(control).isDisabled.value,
|
|
639
|
+
"is-required": inGroup.value ? false : props.required,
|
|
640
|
+
"is-optional": inGroup.value ? false : props.optional,
|
|
641
|
+
description: inGroup.value ? void 0 : props.description,
|
|
642
|
+
status: inGroup.value ? void 0 : fieldStatus.value,
|
|
643
|
+
"status-variant": effectiveStatusVariant.value,
|
|
500
644
|
width: props.width
|
|
501
645
|
}, {
|
|
502
646
|
default: withCtx(() => [createElementVNode("div", {
|
|
@@ -504,7 +648,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
504
648
|
ref: anchorRef,
|
|
505
649
|
class: normalizeClass(["astryx-multi-selector-control", [`status-${props.status}`, {
|
|
506
650
|
"is-open": unref(combobox).isOpen.value,
|
|
507
|
-
"is-disabled":
|
|
651
|
+
"is-disabled": unref(control).isDisabled.value,
|
|
652
|
+
"is-readonly": unref(control).isReadOnly.value,
|
|
653
|
+
"is-loading": unref(control).isLoading.value,
|
|
508
654
|
"is-ghost": props.variant === "ghost"
|
|
509
655
|
}]])
|
|
510
656
|
}, [
|
|
@@ -515,76 +661,81 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
515
661
|
ref: triggerRef,
|
|
516
662
|
type: "button",
|
|
517
663
|
class: "astryx-multi-selector-trigger",
|
|
518
|
-
disabled:
|
|
664
|
+
disabled: unref(control).isDisabled.value && !focusableDisabled.value,
|
|
519
665
|
"aria-disabled": focusableDisabled.value ? "true" : void 0,
|
|
520
|
-
|
|
521
|
-
"aria-
|
|
522
|
-
|
|
523
|
-
"aria-
|
|
666
|
+
"aria-readonly": unref(control).isReadOnly.value || void 0,
|
|
667
|
+
"aria-busy": unref(control).isLoading.value || void 0,
|
|
668
|
+
role: props.searchable && !unref(control).isReadOnly.value ? void 0 : "combobox",
|
|
669
|
+
"aria-haspopup": unref(control).isReadOnly.value ? void 0 : "listbox",
|
|
670
|
+
"aria-expanded": unref(control).isReadOnly.value ? false : unref(combobox).isOpen.value,
|
|
671
|
+
"aria-controls": unref(control).isReadOnly.value ? void 0 : listboxId,
|
|
524
672
|
"aria-autocomplete": props.searchable ? void 0 : "none",
|
|
525
673
|
"aria-activedescendant": !props.searchable && unref(combobox).isOpen.value && unref(combobox).activeIndex.value >= 0 ? optionDomId(unref(combobox).activeIndex.value) : void 0,
|
|
526
|
-
"aria-describedby": describedBy.value,
|
|
674
|
+
"aria-describedby": [describedBy.value, unref(control).isReadOnly.value ? readOnlyId : void 0].filter(Boolean).join(" ") || void 0,
|
|
527
675
|
title: props.disabledReason,
|
|
528
676
|
onClick: onTriggerClick,
|
|
529
677
|
onKeydown: onKeyDown
|
|
530
|
-
}, [selectedOptions.value.length === 0 ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(placeholder.value), 1)) : props.triggerDisplay === "count" ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(unref(messages).multiSelector.selected(selectedOptions.value.length)), 1)) : props.triggerDisplay === "labels" ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(labelText.value), 1)) : (openBlock(), createElementBlock("span", {
|
|
678
|
+
}, [selectedOptions.value.length === 0 ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(placeholder.value), 1)) : props.triggerDisplay === "count" ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(formattedValue.value ?? unref(messages).multiSelector.selected(selectedOptions.value.length)), 1)) : props.triggerDisplay === "labels" ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(formattedValue.value ?? labelText.value), 1)) : (openBlock(), createElementBlock("span", {
|
|
531
679
|
key: 3,
|
|
532
680
|
ref: unref(overflow).containerRef,
|
|
533
681
|
class: "astryx-multi-selector-badges"
|
|
534
682
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(selectedOptions.value.slice(0, visibleBadgeCount.value), (option) => {
|
|
535
|
-
return openBlock(), createBlock(_sfc_main$
|
|
683
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
|
536
684
|
key: option.value,
|
|
537
685
|
label: option.label,
|
|
538
686
|
size: props.size === "lg" ? "md" : "sm"
|
|
539
687
|
}, null, 8, ["label", "size"]);
|
|
540
688
|
}), 128)), hiddenBadgeCount.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(unref(messages).multiSelector.more(hiddenBadgeCount.value)), 1)) : createCommentVNode("v-if", true)], 512))], 40, _hoisted_2),
|
|
541
|
-
|
|
689
|
+
unref(control).isLoading.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
542
690
|
key: 1,
|
|
691
|
+
class: "astryx-multi-selector-spinner",
|
|
692
|
+
size: "sm",
|
|
693
|
+
"aria-label": unref(messages).multiSelector.loading
|
|
694
|
+
}, null, 8, ["aria-label"])) : createCommentVNode("v-if", true),
|
|
695
|
+
props.clearable && selectedValues.value.length > 0 && unref(control).canActivate.value ? (openBlock(), createElementBlock("button", {
|
|
696
|
+
key: 2,
|
|
543
697
|
type: "button",
|
|
544
698
|
class: "astryx-multi-selector-clear",
|
|
545
699
|
"aria-label": unref(messages).multiSelector.clear,
|
|
546
700
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => commit([]), ["stop"]))
|
|
547
|
-
}, [
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
"
|
|
558
|
-
|
|
559
|
-
|
|
701
|
+
}, [createVNode(_sfc_main$2, {
|
|
702
|
+
icon: "close",
|
|
703
|
+
size: "sm"
|
|
704
|
+
})], 8, _hoisted_7)) : createCommentVNode("v-if", true),
|
|
705
|
+
statusGlyph.value ? (openBlock(), createBlock(_sfc_main$5, {
|
|
706
|
+
key: 3,
|
|
707
|
+
type: statusGlyph.value,
|
|
708
|
+
message: fieldStatus.value?.message,
|
|
709
|
+
tooltip: effectiveStatusVariant.value === "tooltip"
|
|
710
|
+
}, null, 8, [
|
|
711
|
+
"type",
|
|
712
|
+
"message",
|
|
713
|
+
"tooltip"
|
|
714
|
+
])) : unref(control).canActivate.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
715
|
+
key: 4,
|
|
560
716
|
class: normalizeClass(["astryx-multi-selector-chevron", { "is-open": unref(combobox).isOpen.value }]),
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
stroke: "currentColor",
|
|
570
|
-
"stroke-width": "1.5",
|
|
571
|
-
"stroke-linecap": "round",
|
|
572
|
-
"stroke-linejoin": "round"
|
|
573
|
-
})], -1)])], 2),
|
|
717
|
+
icon: "chevronDown",
|
|
718
|
+
size: "sm"
|
|
719
|
+
}, null, 8, ["class"])) : createCommentVNode("v-if", true),
|
|
720
|
+
unref(control).isReadOnly.value ? (openBlock(), createElementBlock("span", {
|
|
721
|
+
key: 5,
|
|
722
|
+
id: readOnlyId,
|
|
723
|
+
class: "astryx-visually-hidden"
|
|
724
|
+
}, toDisplayString(unref(messages).multiSelector.readOnly), 1)) : createCommentVNode("v-if", true),
|
|
574
725
|
props.triggerDisplay === "badges" ? (openBlock(), createElementBlock("span", {
|
|
575
|
-
key:
|
|
726
|
+
key: 6,
|
|
576
727
|
ref: unref(overflow).measureRef,
|
|
577
728
|
class: "astryx-multi-selector-measure",
|
|
578
729
|
"aria-hidden": "true"
|
|
579
730
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(selectedOptions.value, (option) => {
|
|
580
|
-
return openBlock(), createBlock(_sfc_main$
|
|
731
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
|
581
732
|
key: option.value,
|
|
582
733
|
label: option.label,
|
|
583
734
|
size: props.size === "lg" ? "md" : "sm"
|
|
584
735
|
}, null, 8, ["label", "size"]);
|
|
585
736
|
}), 128)), createElementVNode("span", _hoisted_8, toDisplayString(measureMoreLabel.value), 1)], 512)) : createCommentVNode("v-if", true),
|
|
586
737
|
focusableDisabled.value ? (openBlock(), createElementBlock("span", {
|
|
587
|
-
key:
|
|
738
|
+
key: 7,
|
|
588
739
|
id: disabledId,
|
|
589
740
|
class: "astryx-visually-hidden"
|
|
590
741
|
}, toDisplayString(props.disabledReason), 1)) : createCommentVNode("v-if", true),
|
|
@@ -603,12 +754,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
603
754
|
"class",
|
|
604
755
|
"label",
|
|
605
756
|
"input-id",
|
|
606
|
-
"description",
|
|
607
757
|
"is-label-hidden",
|
|
608
758
|
"is-disabled",
|
|
609
759
|
"is-required",
|
|
610
760
|
"is-optional",
|
|
761
|
+
"description",
|
|
611
762
|
"status",
|
|
763
|
+
"status-variant",
|
|
612
764
|
"width"
|
|
613
765
|
]),
|
|
614
766
|
isSheet.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
@@ -642,53 +794,83 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
642
794
|
key: 0,
|
|
643
795
|
class: "astryx-multi-selector-search",
|
|
644
796
|
"data-keyboard-focus": searchKeyboardFocus.value ? "true" : void 0
|
|
645
|
-
}, [
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
797
|
+
}, [
|
|
798
|
+
createVNode(_sfc_main$2, {
|
|
799
|
+
class: "astryx-multi-selector-search-icon",
|
|
800
|
+
icon: "search",
|
|
801
|
+
size: "sm"
|
|
802
|
+
}),
|
|
803
|
+
createElementVNode("input", {
|
|
804
|
+
id: searchId,
|
|
805
|
+
ref_key: "searchRef",
|
|
806
|
+
ref: searchRef,
|
|
807
|
+
class: "astryx-multi-selector-search-input",
|
|
808
|
+
type: "text",
|
|
809
|
+
role: "combobox",
|
|
810
|
+
autocomplete: "off",
|
|
811
|
+
"aria-label": searchPlaceholder.value,
|
|
812
|
+
"aria-expanded": unref(combobox).isOpen.value,
|
|
813
|
+
"aria-controls": listboxId,
|
|
814
|
+
"aria-autocomplete": "list",
|
|
815
|
+
"aria-activedescendant": unref(combobox).activeIndex.value >= 0 ? optionDomId(unref(combobox).activeIndex.value) : void 0,
|
|
816
|
+
placeholder: searchPlaceholder.value,
|
|
817
|
+
value: query.value,
|
|
818
|
+
onInput: onSearchInput,
|
|
819
|
+
onFocus: onSearchFocus,
|
|
820
|
+
onBlur: onSearchBlur,
|
|
821
|
+
onKeydown: onKeyDown
|
|
822
|
+
}, null, 40, _hoisted_13),
|
|
823
|
+
query.value ? (openBlock(), createElementBlock("button", {
|
|
824
|
+
key: 0,
|
|
825
|
+
type: "button",
|
|
826
|
+
class: "astryx-multi-selector-search-clear",
|
|
827
|
+
"aria-label": unref(messages).multiSelector.clear,
|
|
828
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(($event) => query.value = "", ["stop"]))
|
|
829
|
+
}, [createVNode(_sfc_main$2, {
|
|
830
|
+
icon: "close",
|
|
831
|
+
size: "sm"
|
|
832
|
+
})], 8, _hoisted_14)) : createCommentVNode("v-if", true)
|
|
833
|
+
], 8, _hoisted_12)) : createCommentVNode("v-if", true),
|
|
834
|
+
createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events, vue-a11y/mouse-events-have-key-events -- 创建行不进 Tab 序,方向键和回车由组合框处理。 "),
|
|
835
|
+
createOption.value ? (openBlock(), createElementBlock("div", {
|
|
667
836
|
key: 1,
|
|
668
837
|
id: optionDomId(0),
|
|
669
|
-
class: normalizeClass(["astryx-multi-selector-option is-
|
|
838
|
+
class: normalizeClass(["astryx-multi-selector-option is-create", { "is-active": unref(combobox).activeIndex.value === 0 }]),
|
|
839
|
+
role: "option",
|
|
840
|
+
"aria-selected": false,
|
|
841
|
+
"data-option-id": String(createOption.value.value),
|
|
842
|
+
tabindex: "-1",
|
|
843
|
+
onMousedown: _cache[3] || (_cache[3] = withModifiers(() => {}, ["prevent"])),
|
|
844
|
+
onMouseenter: _cache[4] || (_cache[4] = ($event) => highlight(0)),
|
|
845
|
+
onClick: _cache[5] || (_cache[5] = ($event) => toggleValue(createOption.value.value))
|
|
846
|
+
}, [createElementVNode("span", _hoisted_16, toDisplayString(createOption.value.label), 1)], 42, _hoisted_15)) : createCommentVNode("v-if", true),
|
|
847
|
+
createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events, vue-a11y/mouse-events-have-key-events -- 全选行不进 Tab 序,方向键和空格由组合框处理。 "),
|
|
848
|
+
props.selectAll && !unref(control).isLoading.value && realMatchCount.value > 0 ? (openBlock(), createElementBlock("div", {
|
|
849
|
+
key: 2,
|
|
850
|
+
id: optionDomId(selectAllIndex.value),
|
|
851
|
+
class: normalizeClass(["astryx-multi-selector-option is-select-all", { "is-active": unref(combobox).activeIndex.value === selectAllIndex.value }]),
|
|
670
852
|
role: "option",
|
|
671
853
|
"aria-selected": selectAllState.value === "checked",
|
|
672
854
|
"data-option-id": unref(SELECT_ALL_VALUE),
|
|
673
855
|
tabindex: "-1",
|
|
674
|
-
onMousedown: _cache[
|
|
675
|
-
onMouseenter: _cache[
|
|
676
|
-
onClick: _cache[
|
|
856
|
+
onMousedown: _cache[6] || (_cache[6] = withModifiers(() => {}, ["prevent"])),
|
|
857
|
+
onMouseenter: _cache[7] || (_cache[7] = ($event) => highlight(selectAllIndex.value)),
|
|
858
|
+
onClick: _cache[8] || (_cache[8] = ($event) => toggleValue(unref("__astryx_select_all__")))
|
|
677
859
|
}, [
|
|
678
|
-
props.checkboxPosition === "start" ? (openBlock(), createBlock(
|
|
860
|
+
props.checkboxPosition === "start" ? (openBlock(), createBlock(resolveDynamicComponent(unref(CheckboxMark)), {
|
|
679
861
|
key: 0,
|
|
680
862
|
state: selectAllState.value,
|
|
681
863
|
size: props.size === "lg" ? "md" : "sm"
|
|
682
864
|
}, null, 8, ["state", "size"])) : createCommentVNode("v-if", true),
|
|
683
|
-
createElementVNode("span",
|
|
684
|
-
props.checkboxPosition === "end" ? (openBlock(), createBlock(
|
|
865
|
+
createElementVNode("span", _hoisted_18, toDisplayString(selectAllLabel.value), 1),
|
|
866
|
+
props.checkboxPosition === "end" ? (openBlock(), createBlock(resolveDynamicComponent(unref(CheckboxMark)), {
|
|
685
867
|
key: 1,
|
|
686
868
|
state: selectAllState.value,
|
|
687
869
|
size: props.size === "lg" ? "md" : "sm"
|
|
688
870
|
}, null, 8, ["state", "size"])) : createCommentVNode("v-if", true)
|
|
689
|
-
], 42,
|
|
690
|
-
(openBlock(true), createElementBlock(Fragment,
|
|
691
|
-
return openBlock(), createElementBlock(Fragment, { key: row.key }, [row.kind === "divider" ? (openBlock(), createElementBlock("div",
|
|
871
|
+
], 42, _hoisted_17)) : createCommentVNode("v-if", true),
|
|
872
|
+
!unref(control).isLoading.value ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(rows.value, (row) => {
|
|
873
|
+
return openBlock(), createElementBlock(Fragment, { key: row.key }, [row.kind === "divider" ? (openBlock(), createElementBlock("div", _hoisted_19)) : row.kind === "heading" ? (openBlock(), createElementBlock("div", _hoisted_20, toDisplayString(row.label), 1)) : row.option ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events, vue-a11y/mouse-events-have-key-events -- 选项不进 Tab 序,方向键和空格由组合框处理。 "), createElementVNode("div", {
|
|
692
874
|
id: optionDomId(optionIndex(row.option.value)),
|
|
693
875
|
class: normalizeClass(["astryx-multi-selector-option", {
|
|
694
876
|
"is-active": optionIndex(row.option.value) === unref(combobox).activeIndex.value,
|
|
@@ -699,11 +881,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
699
881
|
"aria-disabled": row.option.disabled || void 0,
|
|
700
882
|
"data-option-id": String(row.option.value),
|
|
701
883
|
tabindex: "-1",
|
|
702
|
-
onMousedown: _cache[
|
|
884
|
+
onMousedown: _cache[9] || (_cache[9] = withModifiers(() => {}, ["prevent"])),
|
|
703
885
|
onMouseenter: ($event) => highlight(optionIndex(row.option.value)),
|
|
704
886
|
onClick: ($event) => toggleValue(row.option.value)
|
|
705
887
|
}, [
|
|
706
|
-
props.checkboxPosition === "start" ? (openBlock(), createBlock(
|
|
888
|
+
props.checkboxPosition === "start" ? (openBlock(), createBlock(resolveDynamicComponent(unref(CheckboxMark)), {
|
|
707
889
|
key: 0,
|
|
708
890
|
state: checkboxState(row.option),
|
|
709
891
|
size: props.size === "lg" ? "md" : "sm",
|
|
@@ -713,12 +895,12 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
713
895
|
"size",
|
|
714
896
|
"is-disabled"
|
|
715
897
|
])) : createCommentVNode("v-if", true),
|
|
716
|
-
createElementVNode("span",
|
|
898
|
+
createElementVNode("span", _hoisted_22, [_ctx.$slots.option ? renderSlot(_ctx.$slots, "option", {
|
|
717
899
|
option: row.option,
|
|
718
900
|
selected: isSelected(row.option.value),
|
|
719
901
|
active: optionIndex(row.option.value) === unref(combobox).activeIndex.value
|
|
720
|
-
}, void 0, void 0, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("span",
|
|
721
|
-
props.checkboxPosition === "end" ? (openBlock(), createBlock(
|
|
902
|
+
}, void 0, void 0, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("span", _hoisted_23, toDisplayString(row.option.label), 1), row.option.description ? (openBlock(), createElementBlock("span", _hoisted_24, toDisplayString(row.option.description), 1)) : createCommentVNode("v-if", true)], 64))]),
|
|
903
|
+
props.checkboxPosition === "end" ? (openBlock(), createBlock(resolveDynamicComponent(unref(CheckboxMark)), {
|
|
722
904
|
key: 1,
|
|
723
905
|
state: checkboxState(row.option),
|
|
724
906
|
size: props.size === "lg" ? "md" : "sm",
|
|
@@ -728,9 +910,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
728
910
|
"size",
|
|
729
911
|
"is-disabled"
|
|
730
912
|
])) : createCommentVNode("v-if", true)
|
|
731
|
-
], 42,
|
|
732
|
-
}), 128)),
|
|
733
|
-
|
|
913
|
+
], 42, _hoisted_21)], 2112)) : createCommentVNode("v-if", true)], 64);
|
|
914
|
+
}), 128)) : createCommentVNode("v-if", true),
|
|
915
|
+
showEmpty.value ? (openBlock(), createElementBlock("div", _hoisted_25, [!query.value.trim() ? renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(emptyText.value), 1)], void 0, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(emptySearchText.value), 1)], 64))])) : createCommentVNode("v-if", true)
|
|
734
916
|
], 14, _hoisted_11), [[vShow, unref(combobox).isOpen.value]])], 8, ["to"]))
|
|
735
917
|
], 64);
|
|
736
918
|
};
|