index3.js 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233
  1. import { P as s, _ as d, aV as zn, a as q, m as pe, c as Qe, aW as Nn, K as I, b as Vn, i as Ln, aX as Hn, N as An, n as Wn, S as Kn, O as _n, aY as jn, aZ as Xn, J as Fe, a_ as Un, a$ as Gn, b0 as Yn, b1 as qn, t as Pe, b2 as je, b3 as Xe, I as Z, b4 as Je, g as Qn, f as Jn } from "./index2.js";
  2. import { defineComponent as ce, computed as N, ref as se, createVNode as p, isVNode as Zn, cloneVNode as kn, inject as De, provide as Ee, shallowRef as W, watchEffect as Ze, onMounted as re, watch as ae, createTextVNode as Te, Fragment as ge, onBeforeUnmount as Oe, isRef as eo, reactive as Ue, toRefs as no } from "vue";
  3. import { B as oo } from "./statusUtils.js";
  4. import { p as ke } from "./pickAttrs.js";
  5. import { e as en } from "./index4.js";
  6. function to(e, n) {
  7. if (!n || !n.length)
  8. return null;
  9. let o = !1;
  10. function t(l, m) {
  11. let [v, ...x] = m;
  12. if (!v)
  13. return [l];
  14. const b = l.split(v);
  15. return o = o || b.length > 1, b.reduce((u, C) => [...u, ...t(C, x)], []).filter((u) => u);
  16. }
  17. const i = t(e, n);
  18. return o ? i : null;
  19. }
  20. var io = function(e, n) {
  21. var o = {};
  22. for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
  23. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
  24. n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
  25. return o;
  26. };
  27. const lo = (e) => {
  28. const n = e === !0 ? 0 : 1;
  29. return {
  30. bottomLeft: {
  31. points: ["tl", "bl"],
  32. offset: [0, 4],
  33. overflow: {
  34. adjustX: n,
  35. adjustY: 1
  36. }
  37. },
  38. bottomRight: {
  39. points: ["tr", "br"],
  40. offset: [0, 4],
  41. overflow: {
  42. adjustX: n,
  43. adjustY: 1
  44. }
  45. },
  46. topLeft: {
  47. points: ["bl", "tl"],
  48. offset: [0, -4],
  49. overflow: {
  50. adjustX: n,
  51. adjustY: 1
  52. }
  53. },
  54. topRight: {
  55. points: ["br", "tr"],
  56. offset: [0, -4],
  57. overflow: {
  58. adjustX: n,
  59. adjustY: 1
  60. }
  61. }
  62. };
  63. }, ao = ce({
  64. name: "SelectTrigger",
  65. inheritAttrs: !1,
  66. props: {
  67. dropdownAlign: Object,
  68. visible: {
  69. type: Boolean,
  70. default: void 0
  71. },
  72. disabled: {
  73. type: Boolean,
  74. default: void 0
  75. },
  76. dropdownClassName: String,
  77. dropdownStyle: s.object,
  78. placement: String,
  79. empty: {
  80. type: Boolean,
  81. default: void 0
  82. },
  83. prefixCls: String,
  84. popupClassName: String,
  85. animation: String,
  86. transitionName: String,
  87. getPopupContainer: Function,
  88. dropdownRender: Function,
  89. containerWidth: Number,
  90. dropdownMatchSelectWidth: s.oneOfType([Number, Boolean]).def(!0),
  91. popupElement: s.any,
  92. direction: String,
  93. getTriggerDOMNode: Function,
  94. onPopupVisibleChange: Function,
  95. onPopupMouseEnter: Function,
  96. onPopupFocusin: Function,
  97. onPopupFocusout: Function
  98. },
  99. setup(e, n) {
  100. let {
  101. slots: o,
  102. attrs: t,
  103. expose: i
  104. } = n;
  105. const l = N(() => {
  106. const {
  107. dropdownMatchSelectWidth: v
  108. } = e;
  109. return lo(v);
  110. }), m = se();
  111. return i({
  112. getPopupElement: () => m.value
  113. }), () => {
  114. const v = d(d({}, e), t), {
  115. empty: x = !1
  116. } = v, b = io(v, ["empty"]), {
  117. visible: u,
  118. dropdownAlign: C,
  119. prefixCls: M,
  120. popupElement: $,
  121. dropdownClassName: g,
  122. dropdownStyle: h,
  123. direction: w = "ltr",
  124. placement: c,
  125. dropdownMatchSelectWidth: f,
  126. containerWidth: P,
  127. dropdownRender: S,
  128. animation: E,
  129. transitionName: T,
  130. getPopupContainer: y,
  131. getTriggerDOMNode: X,
  132. onPopupVisibleChange: D,
  133. onPopupMouseEnter: V,
  134. onPopupFocusin: R,
  135. onPopupFocusout: Y
  136. } = b, L = `${M}-dropdown`;
  137. let U = $;
  138. S && (U = S({
  139. menuNode: $,
  140. props: e
  141. }));
  142. const F = E ? `${L}-${E}` : T, B = d({
  143. minWidth: `${P}px`
  144. }, h);
  145. return typeof f == "number" ? B.width = `${f}px` : f && (B.width = `${P}px`), p(zn, q(q({}, e), {}, {
  146. showAction: D ? ["click"] : [],
  147. hideAction: D ? ["click"] : [],
  148. popupPlacement: c || (w === "rtl" ? "bottomRight" : "bottomLeft"),
  149. builtinPlacements: l.value,
  150. prefixCls: L,
  151. popupTransitionName: F,
  152. popupAlign: C,
  153. popupVisible: u,
  154. getPopupContainer: y,
  155. popupClassName: pe(g, {
  156. [`${L}-empty`]: x
  157. }),
  158. popupStyle: B,
  159. getTriggerDOMNode: X,
  160. onPopupVisibleChange: D
  161. }), {
  162. default: o.default,
  163. popup: () => p("div", {
  164. ref: m,
  165. onMouseenter: V,
  166. onFocusin: R,
  167. onFocusout: Y
  168. }, [U])
  169. });
  170. };
  171. }
  172. }), ue = (e, n) => {
  173. let {
  174. slots: o
  175. } = n;
  176. var t;
  177. const {
  178. class: i,
  179. customizeIcon: l,
  180. customizeIconProps: m,
  181. onMousedown: v,
  182. onClick: x
  183. } = e;
  184. let b;
  185. return typeof l == "function" ? b = l(m) : b = Zn(l) ? kn(l) : l, p("span", {
  186. class: i,
  187. onMousedown: (u) => {
  188. u.preventDefault(), v && v(u);
  189. },
  190. style: {
  191. userSelect: "none",
  192. WebkitUserSelect: "none"
  193. },
  194. unselectable: "on",
  195. onClick: x,
  196. "aria-hidden": !0
  197. }, [b !== void 0 ? b : p("span", {
  198. class: i.split(/\s+/).map((u) => `${u}-icon`)
  199. }, [(t = o.default) === null || t === void 0 ? void 0 : t.call(o)])]);
  200. };
  201. ue.inheritAttrs = !1;
  202. ue.displayName = "TransBtn";
  203. ue.props = {
  204. class: String,
  205. customizeIcon: s.any,
  206. customizeIconProps: s.any,
  207. onMousedown: Function,
  208. onClick: Function
  209. };
  210. const ro = {
  211. inputRef: s.any,
  212. prefixCls: String,
  213. id: String,
  214. inputElement: s.VueNode,
  215. disabled: {
  216. type: Boolean,
  217. default: void 0
  218. },
  219. autofocus: {
  220. type: Boolean,
  221. default: void 0
  222. },
  223. autocomplete: String,
  224. editable: {
  225. type: Boolean,
  226. default: void 0
  227. },
  228. activeDescendantId: String,
  229. value: String,
  230. open: {
  231. type: Boolean,
  232. default: void 0
  233. },
  234. tabindex: s.oneOfType([s.number, s.string]),
  235. /** Pass accessibility props to input */
  236. attrs: s.object,
  237. onKeydown: {
  238. type: Function
  239. },
  240. onMousedown: {
  241. type: Function
  242. },
  243. onChange: {
  244. type: Function
  245. },
  246. onPaste: {
  247. type: Function
  248. },
  249. onCompositionstart: {
  250. type: Function
  251. },
  252. onCompositionend: {
  253. type: Function
  254. },
  255. onFocus: {
  256. type: Function
  257. },
  258. onBlur: {
  259. type: Function
  260. }
  261. }, nn = ce({
  262. compatConfig: {
  263. MODE: 3
  264. },
  265. name: "SelectInput",
  266. inheritAttrs: !1,
  267. props: ro,
  268. setup(e) {
  269. let n = null;
  270. const o = De("VCSelectContainerEvent");
  271. return () => {
  272. var t;
  273. const {
  274. prefixCls: i,
  275. id: l,
  276. inputElement: m,
  277. disabled: v,
  278. tabindex: x,
  279. autofocus: b,
  280. autocomplete: u,
  281. editable: C,
  282. activeDescendantId: M,
  283. value: $,
  284. onKeydown: g,
  285. onMousedown: h,
  286. onChange: w,
  287. onPaste: c,
  288. onCompositionstart: f,
  289. onCompositionend: P,
  290. onFocus: S,
  291. onBlur: E,
  292. open: T,
  293. inputRef: y,
  294. attrs: X
  295. } = e;
  296. let D = m || p(oo, null, null);
  297. const V = D.props || {}, {
  298. onKeydown: R,
  299. onInput: Y,
  300. onFocus: L,
  301. onBlur: U,
  302. onMousedown: F,
  303. onCompositionstart: B,
  304. onCompositionend: oe,
  305. style: te
  306. } = V;
  307. return D = Qe(D, d(d(d(d(d({
  308. type: "search"
  309. }, V), {
  310. id: l,
  311. ref: y,
  312. disabled: v,
  313. tabindex: x,
  314. lazy: !1,
  315. autocomplete: u || "off",
  316. autofocus: b,
  317. class: pe(`${i}-selection-search-input`, (t = D == null ? void 0 : D.props) === null || t === void 0 ? void 0 : t.class),
  318. role: "combobox",
  319. "aria-expanded": T,
  320. "aria-haspopup": "listbox",
  321. "aria-owns": `${l}_list`,
  322. "aria-autocomplete": "list",
  323. "aria-controls": `${l}_list`,
  324. "aria-activedescendant": M
  325. }), X), {
  326. value: C ? $ : "",
  327. readonly: !C,
  328. unselectable: C ? null : "on",
  329. style: d(d({}, te), {
  330. opacity: C ? null : 0
  331. }),
  332. onKeydown: (O) => {
  333. g(O), R && R(O);
  334. },
  335. onMousedown: (O) => {
  336. h(O), F && F(O);
  337. },
  338. onInput: (O) => {
  339. w(O), Y && Y(O);
  340. },
  341. onCompositionstart(O) {
  342. f(O), B && B(O);
  343. },
  344. onCompositionend(O) {
  345. P(O), oe && oe(O);
  346. },
  347. onPaste: c,
  348. onFocus: function() {
  349. clearTimeout(n), L && L(arguments.length <= 0 ? void 0 : arguments[0]), S && S(arguments.length <= 0 ? void 0 : arguments[0]), o == null || o.focus(arguments.length <= 0 ? void 0 : arguments[0]);
  350. },
  351. onBlur: function() {
  352. for (var O = arguments.length, J = new Array(O), ie = 0; ie < O; ie++)
  353. J[ie] = arguments[ie];
  354. n = setTimeout(() => {
  355. U && U(J[0]), E && E(J[0]), o == null || o.blur(J[0]);
  356. }, 100);
  357. }
  358. }), D.type === "textarea" ? {} : {
  359. type: "search"
  360. }), !0, !0), D;
  361. };
  362. }
  363. }), on = Symbol("TreeSelectLegacyContextPropsKey");
  364. function Yo(e) {
  365. return Ee(on, e);
  366. }
  367. function Me() {
  368. return De(on, {});
  369. }
  370. const so = {
  371. id: String,
  372. prefixCls: String,
  373. values: s.array,
  374. open: {
  375. type: Boolean,
  376. default: void 0
  377. },
  378. searchValue: String,
  379. inputRef: s.any,
  380. placeholder: s.any,
  381. disabled: {
  382. type: Boolean,
  383. default: void 0
  384. },
  385. mode: String,
  386. showSearch: {
  387. type: Boolean,
  388. default: void 0
  389. },
  390. autofocus: {
  391. type: Boolean,
  392. default: void 0
  393. },
  394. autocomplete: String,
  395. activeDescendantId: String,
  396. tabindex: s.oneOfType([s.number, s.string]),
  397. compositionStatus: Boolean,
  398. removeIcon: s.any,
  399. choiceTransitionName: String,
  400. maxTagCount: s.oneOfType([s.number, s.string]),
  401. maxTagTextLength: Number,
  402. maxTagPlaceholder: s.any.def(() => (e) => `+ ${e.length} ...`),
  403. tagRender: Function,
  404. onToggleOpen: {
  405. type: Function
  406. },
  407. onRemove: Function,
  408. onInputChange: Function,
  409. onInputPaste: Function,
  410. onInputKeyDown: Function,
  411. onInputMouseDown: Function,
  412. onInputCompositionStart: Function,
  413. onInputCompositionEnd: Function
  414. }, Ge = (e) => {
  415. e.preventDefault(), e.stopPropagation();
  416. }, uo = ce({
  417. name: "MultipleSelectSelector",
  418. inheritAttrs: !1,
  419. props: so,
  420. setup(e) {
  421. const n = W(), o = W(0), t = W(!1), i = Me(), l = N(() => `${e.prefixCls}-selection`), m = N(() => e.open || e.mode === "tags" ? e.searchValue : ""), v = N(() => e.mode === "tags" || e.showSearch && (e.open || t.value)), x = se("");
  422. Ze(() => {
  423. x.value = m.value;
  424. }), re(() => {
  425. ae(x, () => {
  426. o.value = n.value.scrollWidth;
  427. }, {
  428. flush: "post",
  429. immediate: !0
  430. });
  431. });
  432. function b(g, h, w, c, f) {
  433. return p("span", {
  434. class: pe(`${l.value}-item`, {
  435. [`${l.value}-item-disabled`]: w
  436. }),
  437. title: typeof g == "string" || typeof g == "number" ? g.toString() : void 0
  438. }, [p("span", {
  439. class: `${l.value}-item-content`
  440. }, [h]), c && p(ue, {
  441. class: `${l.value}-item-remove`,
  442. onMousedown: Ge,
  443. onClick: f,
  444. customizeIcon: e.removeIcon
  445. }, {
  446. default: () => [Te("×")]
  447. })]);
  448. }
  449. function u(g, h, w, c, f, P) {
  450. var S;
  451. const E = (y) => {
  452. Ge(y), e.onToggleOpen(!open);
  453. };
  454. let T = P;
  455. return i.keyEntities && (T = ((S = i.keyEntities[g]) === null || S === void 0 ? void 0 : S.node) || {}), p("span", {
  456. key: g,
  457. onMousedown: E
  458. }, [e.tagRender({
  459. label: h,
  460. value: g,
  461. disabled: w,
  462. closable: c,
  463. onClose: f,
  464. option: T
  465. })]);
  466. }
  467. function C(g) {
  468. const {
  469. disabled: h,
  470. label: w,
  471. value: c,
  472. option: f
  473. } = g, P = !e.disabled && !h;
  474. let S = w;
  475. if (typeof e.maxTagTextLength == "number" && (typeof w == "string" || typeof w == "number")) {
  476. const T = String(S);
  477. T.length > e.maxTagTextLength && (S = `${T.slice(0, e.maxTagTextLength)}...`);
  478. }
  479. const E = (T) => {
  480. var y;
  481. T && T.stopPropagation(), (y = e.onRemove) === null || y === void 0 || y.call(e, g);
  482. };
  483. return typeof e.tagRender == "function" ? u(c, S, h, P, E, f) : b(w, S, h, P, E);
  484. }
  485. function M(g) {
  486. const {
  487. maxTagPlaceholder: h = (c) => `+ ${c.length} ...`
  488. } = e, w = typeof h == "function" ? h(g) : h;
  489. return b(w, w, !1);
  490. }
  491. const $ = (g) => {
  492. const h = g.target.composing;
  493. x.value = g.target.value, h || e.onInputChange(g);
  494. };
  495. return () => {
  496. const {
  497. id: g,
  498. prefixCls: h,
  499. values: w,
  500. open: c,
  501. inputRef: f,
  502. placeholder: P,
  503. disabled: S,
  504. autofocus: E,
  505. autocomplete: T,
  506. activeDescendantId: y,
  507. tabindex: X,
  508. compositionStatus: D,
  509. onInputPaste: V,
  510. onInputKeyDown: R,
  511. onInputMouseDown: Y,
  512. onInputCompositionStart: L,
  513. onInputCompositionEnd: U
  514. } = e, F = p("div", {
  515. class: `${l.value}-search`,
  516. style: {
  517. width: o.value + "px"
  518. },
  519. key: "input"
  520. }, [p(nn, {
  521. inputRef: f,
  522. open: c,
  523. prefixCls: h,
  524. id: g,
  525. inputElement: null,
  526. disabled: S,
  527. autofocus: E,
  528. autocomplete: T,
  529. editable: v.value,
  530. activeDescendantId: y,
  531. value: x.value,
  532. onKeydown: R,
  533. onMousedown: Y,
  534. onChange: $,
  535. onPaste: V,
  536. onCompositionstart: L,
  537. onCompositionend: U,
  538. tabindex: X,
  539. attrs: ke(e, !0),
  540. onFocus: () => t.value = !0,
  541. onBlur: () => t.value = !1
  542. }, null), p("span", {
  543. ref: n,
  544. class: `${l.value}-search-mirror`,
  545. "aria-hidden": !0
  546. }, [x.value, Te(" ")])]), B = p(Nn, {
  547. prefixCls: `${l.value}-overflow`,
  548. data: w,
  549. renderItem: C,
  550. renderRest: M,
  551. suffix: F,
  552. itemKey: "key",
  553. maxCount: e.maxTagCount,
  554. key: "overflow"
  555. }, null);
  556. return p(ge, null, [B, !w.length && !m.value && !D && p("span", {
  557. class: `${l.value}-placeholder`
  558. }, [P])]);
  559. };
  560. }
  561. }), co = {
  562. inputElement: s.any,
  563. id: String,
  564. prefixCls: String,
  565. values: s.array,
  566. open: {
  567. type: Boolean,
  568. default: void 0
  569. },
  570. searchValue: String,
  571. inputRef: s.any,
  572. placeholder: s.any,
  573. compositionStatus: {
  574. type: Boolean,
  575. default: void 0
  576. },
  577. disabled: {
  578. type: Boolean,
  579. default: void 0
  580. },
  581. mode: String,
  582. showSearch: {
  583. type: Boolean,
  584. default: void 0
  585. },
  586. autofocus: {
  587. type: Boolean,
  588. default: void 0
  589. },
  590. autocomplete: String,
  591. activeDescendantId: String,
  592. tabindex: s.oneOfType([s.number, s.string]),
  593. activeValue: String,
  594. backfill: {
  595. type: Boolean,
  596. default: void 0
  597. },
  598. optionLabelRender: Function,
  599. onInputChange: Function,
  600. onInputPaste: Function,
  601. onInputKeyDown: Function,
  602. onInputMouseDown: Function,
  603. onInputCompositionStart: Function,
  604. onInputCompositionEnd: Function
  605. }, Re = ce({
  606. name: "SingleSelector",
  607. setup(e) {
  608. const n = W(!1), o = N(() => e.mode === "combobox"), t = N(() => o.value || e.showSearch), i = N(() => {
  609. let u = e.searchValue || "";
  610. return o.value && e.activeValue && !n.value && (u = e.activeValue), u;
  611. }), l = Me();
  612. ae([o, () => e.activeValue], () => {
  613. o.value && (n.value = !1);
  614. }, {
  615. immediate: !0
  616. });
  617. const m = N(() => e.mode !== "combobox" && !e.open && !e.showSearch ? !1 : !!i.value || e.compositionStatus), v = N(() => {
  618. const u = e.values[0];
  619. return u && (typeof u.label == "string" || typeof u.label == "number") ? u.label.toString() : void 0;
  620. }), x = () => {
  621. if (e.values[0])
  622. return null;
  623. const u = m.value ? {
  624. visibility: "hidden"
  625. } : void 0;
  626. return p("span", {
  627. class: `${e.prefixCls}-selection-placeholder`,
  628. style: u
  629. }, [e.placeholder]);
  630. }, b = (u) => {
  631. u.target.composing || (n.value = !0, e.onInputChange(u));
  632. };
  633. return () => {
  634. var u, C, M, $;
  635. const {
  636. inputElement: g,
  637. prefixCls: h,
  638. id: w,
  639. values: c,
  640. inputRef: f,
  641. disabled: P,
  642. autofocus: S,
  643. autocomplete: E,
  644. activeDescendantId: T,
  645. open: y,
  646. tabindex: X,
  647. optionLabelRender: D,
  648. onInputKeyDown: V,
  649. onInputMouseDown: R,
  650. onInputPaste: Y,
  651. onInputCompositionStart: L,
  652. onInputCompositionEnd: U
  653. } = e, F = c[0];
  654. let B = null;
  655. if (F && l.customSlots) {
  656. const oe = (u = F.key) !== null && u !== void 0 ? u : F.value, te = ((C = l.keyEntities[oe]) === null || C === void 0 ? void 0 : C.node) || {};
  657. B = l.customSlots[(M = te.slots) === null || M === void 0 ? void 0 : M.title] || l.customSlots.title || F.label, typeof B == "function" && (B = B(te));
  658. } else
  659. B = D && F ? D(F.option) : F == null ? void 0 : F.label;
  660. return p(ge, null, [p("span", {
  661. class: `${h}-selection-search`
  662. }, [p(nn, {
  663. inputRef: f,
  664. prefixCls: h,
  665. id: w,
  666. open: y,
  667. inputElement: g,
  668. disabled: P,
  669. autofocus: S,
  670. autocomplete: E,
  671. editable: t.value,
  672. activeDescendantId: T,
  673. value: i.value,
  674. onKeydown: V,
  675. onMousedown: R,
  676. onChange: b,
  677. onPaste: Y,
  678. onCompositionstart: L,
  679. onCompositionend: U,
  680. tabindex: X,
  681. attrs: ke(e, !0)
  682. }, null)]), !o.value && F && !m.value && p("span", {
  683. class: `${h}-selection-item`,
  684. title: v.value
  685. }, [p(ge, {
  686. key: ($ = F.key) !== null && $ !== void 0 ? $ : F.value
  687. }, [B])]), x()]);
  688. };
  689. }
  690. });
  691. Re.props = co;
  692. Re.inheritAttrs = !1;
  693. function po(e) {
  694. return ![
  695. // System function button
  696. I.ESC,
  697. I.SHIFT,
  698. I.BACKSPACE,
  699. I.TAB,
  700. I.WIN_KEY,
  701. I.ALT,
  702. I.META,
  703. I.WIN_KEY_RIGHT,
  704. I.CTRL,
  705. I.SEMICOLON,
  706. I.EQUALS,
  707. I.CAPS_LOCK,
  708. I.CONTEXT_MENU,
  709. // F1-F12
  710. I.F1,
  711. I.F2,
  712. I.F3,
  713. I.F4,
  714. I.F5,
  715. I.F6,
  716. I.F7,
  717. I.F8,
  718. I.F9,
  719. I.F10,
  720. I.F11,
  721. I.F12
  722. ].includes(e);
  723. }
  724. function tn() {
  725. let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 250, n = null, o;
  726. Oe(() => {
  727. clearTimeout(o);
  728. });
  729. function t(i) {
  730. (i || n === null) && (n = i), clearTimeout(o), o = setTimeout(() => {
  731. n = null;
  732. }, e);
  733. }
  734. return [() => n, t];
  735. }
  736. const mo = ce({
  737. name: "Selector",
  738. inheritAttrs: !1,
  739. props: {
  740. id: String,
  741. prefixCls: String,
  742. showSearch: {
  743. type: Boolean,
  744. default: void 0
  745. },
  746. open: {
  747. type: Boolean,
  748. default: void 0
  749. },
  750. /** Display in the Selector value, it's not same as `value` prop */
  751. values: s.array,
  752. multiple: {
  753. type: Boolean,
  754. default: void 0
  755. },
  756. mode: String,
  757. searchValue: String,
  758. activeValue: String,
  759. inputElement: s.any,
  760. autofocus: {
  761. type: Boolean,
  762. default: void 0
  763. },
  764. activeDescendantId: String,
  765. tabindex: s.oneOfType([s.number, s.string]),
  766. disabled: {
  767. type: Boolean,
  768. default: void 0
  769. },
  770. placeholder: s.any,
  771. removeIcon: s.any,
  772. // Tags
  773. maxTagCount: s.oneOfType([s.number, s.string]),
  774. maxTagTextLength: Number,
  775. maxTagPlaceholder: s.any,
  776. tagRender: Function,
  777. optionLabelRender: Function,
  778. /** Check if `tokenSeparators` contains `\n` or `\r\n` */
  779. tokenWithEnter: {
  780. type: Boolean,
  781. default: void 0
  782. },
  783. // Motion
  784. choiceTransitionName: String,
  785. onToggleOpen: {
  786. type: Function
  787. },
  788. /** `onSearch` returns go next step boolean to check if need do toggle open */
  789. onSearch: Function,
  790. onSearchSubmit: Function,
  791. onRemove: Function,
  792. onInputKeyDown: {
  793. type: Function
  794. },
  795. /**
  796. * @private get real dom for trigger align.
  797. * This may be removed after React provides replacement of `findDOMNode`
  798. */
  799. domRef: Function
  800. },
  801. setup(e, n) {
  802. let {
  803. expose: o
  804. } = n;
  805. const t = en(), i = se(!1), [l, m] = tn(0), v = (c) => {
  806. const {
  807. which: f
  808. } = c;
  809. (f === I.UP || f === I.DOWN) && c.preventDefault(), e.onInputKeyDown && e.onInputKeyDown(c), f === I.ENTER && e.mode === "tags" && !i.value && !e.open && e.onSearchSubmit(c.target.value), po(f) && e.onToggleOpen(!0);
  810. }, x = () => {
  811. m(!0);
  812. };
  813. let b = null;
  814. const u = (c) => {
  815. e.onSearch(c, !0, i.value) !== !1 && e.onToggleOpen(!0);
  816. }, C = () => {
  817. i.value = !0;
  818. }, M = (c) => {
  819. i.value = !1, e.mode !== "combobox" && u(c.target.value);
  820. }, $ = (c) => {
  821. let {
  822. target: {
  823. value: f
  824. }
  825. } = c;
  826. if (e.tokenWithEnter && b && /[\r\n]/.test(b)) {
  827. const P = b.replace(/[\r\n]+$/, "").replace(/\r\n/g, " ").replace(/[\r\n]/g, " ");
  828. f = f.replace(P, b);
  829. }
  830. b = null, u(f);
  831. }, g = (c) => {
  832. const {
  833. clipboardData: f
  834. } = c;
  835. b = f.getData("text");
  836. }, h = (c) => {
  837. let {
  838. target: f
  839. } = c;
  840. f !== t.current && (document.body.style.msTouchAction !== void 0 ? setTimeout(() => {
  841. t.current.focus();
  842. }) : t.current.focus());
  843. }, w = (c) => {
  844. const f = l();
  845. c.target !== t.current && !f && c.preventDefault(), (e.mode !== "combobox" && (!e.showSearch || !f) || !e.open) && (e.open && e.onSearch("", !0, !1), e.onToggleOpen());
  846. };
  847. return o({
  848. focus: () => {
  849. t.current.focus();
  850. },
  851. blur: () => {
  852. t.current.blur();
  853. }
  854. }), () => {
  855. const {
  856. prefixCls: c,
  857. domRef: f,
  858. mode: P
  859. } = e, S = {
  860. inputRef: t,
  861. onInputKeyDown: v,
  862. onInputMouseDown: x,
  863. onInputChange: $,
  864. onInputPaste: g,
  865. compositionStatus: i.value,
  866. onInputCompositionStart: C,
  867. onInputCompositionEnd: M
  868. }, E = P === "multiple" || P === "tags" ? p(uo, q(q({}, e), S), null) : p(Re, q(q({}, e), S), null);
  869. return p("div", {
  870. ref: f,
  871. class: `${c}-selector`,
  872. onClick: h,
  873. onMousedown: w
  874. }, [E]);
  875. };
  876. }
  877. });
  878. function fo(e, n, o) {
  879. function t(i) {
  880. var l, m, v;
  881. let x = i.target;
  882. x.shadowRoot && i.composed && (x = i.composedPath()[0] || x);
  883. const b = [(l = e[0]) === null || l === void 0 ? void 0 : l.value, (v = (m = e[1]) === null || m === void 0 ? void 0 : m.value) === null || v === void 0 ? void 0 : v.getPopupElement()];
  884. n.value && b.every((u) => u && !u.contains(x) && u !== x) && o(!1);
  885. }
  886. re(() => {
  887. window.addEventListener("mousedown", t);
  888. }), Oe(() => {
  889. window.removeEventListener("mousedown", t);
  890. });
  891. }
  892. function go() {
  893. let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10;
  894. const n = W(!1);
  895. let o;
  896. const t = () => {
  897. clearTimeout(o);
  898. };
  899. return re(() => {
  900. t();
  901. }), [n, (l, m) => {
  902. t(), o = setTimeout(() => {
  903. n.value = l, m && m();
  904. }, e);
  905. }, t];
  906. }
  907. const ln = Symbol("BaseSelectContextKey");
  908. function ho(e) {
  909. return Ee(ln, e);
  910. }
  911. function qo() {
  912. return De(ln, {});
  913. }
  914. const vo = () => {
  915. if (typeof navigator == "undefined" || typeof window == "undefined")
  916. return !1;
  917. const e = navigator.userAgent || navigator.vendor || window.opera;
  918. return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e == null ? void 0 : e.substring(0, 4));
  919. };
  920. function bo(e) {
  921. if (!eo(e)) return Ue(e);
  922. const n = new Proxy({}, {
  923. get(o, t, i) {
  924. return Reflect.get(e.value, t, i);
  925. },
  926. set(o, t, i) {
  927. return e.value[t] = i, !0;
  928. },
  929. deleteProperty(o, t) {
  930. return Reflect.deleteProperty(e.value, t);
  931. },
  932. has(o, t) {
  933. return Reflect.has(e.value, t);
  934. },
  935. ownKeys() {
  936. return Object.keys(e.value);
  937. },
  938. getOwnPropertyDescriptor() {
  939. return {
  940. enumerable: !0,
  941. configurable: !0
  942. };
  943. }
  944. });
  945. return Ue(n);
  946. }
  947. var So = function(e, n) {
  948. var o = {};
  949. for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
  950. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
  951. n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
  952. return o;
  953. };
  954. const yo = ["value", "onChange", "removeIcon", "placeholder", "autofocus", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "choiceTransitionName", "onInputKeyDown", "onPopupScroll", "tabindex", "OptionList", "notFoundContent"], wo = () => ({
  955. prefixCls: String,
  956. id: String,
  957. omitDomProps: Array,
  958. // >>> Value
  959. displayValues: Array,
  960. onDisplayValuesChange: Function,
  961. // >>> Active
  962. /** Current dropdown list active item string value */
  963. activeValue: String,
  964. /** Link search input with target element */
  965. activeDescendantId: String,
  966. onActiveValueChange: Function,
  967. // >>> Search
  968. searchValue: String,
  969. /** Trigger onSearch, return false to prevent trigger open event */
  970. onSearch: Function,
  971. /** Trigger when search text match the `tokenSeparators`. Will provide split content */
  972. onSearchSplit: Function,
  973. maxLength: Number,
  974. OptionList: s.any,
  975. /** Tell if provided `options` is empty */
  976. emptyOptions: Boolean
  977. }), Io = () => ({
  978. showSearch: {
  979. type: Boolean,
  980. default: void 0
  981. },
  982. tagRender: {
  983. type: Function
  984. },
  985. optionLabelRender: {
  986. type: Function
  987. },
  988. direction: {
  989. type: String
  990. },
  991. // MISC
  992. tabindex: Number,
  993. autofocus: Boolean,
  994. notFoundContent: s.any,
  995. placeholder: s.any,
  996. onClear: Function,
  997. choiceTransitionName: String,
  998. // >>> Mode
  999. mode: String,
  1000. // >>> Status
  1001. disabled: {
  1002. type: Boolean,
  1003. default: void 0
  1004. },
  1005. loading: {
  1006. type: Boolean,
  1007. default: void 0
  1008. },
  1009. // >>> Open
  1010. open: {
  1011. type: Boolean,
  1012. default: void 0
  1013. },
  1014. defaultOpen: {
  1015. type: Boolean,
  1016. default: void 0
  1017. },
  1018. onDropdownVisibleChange: {
  1019. type: Function
  1020. },
  1021. // >>> Customize Input
  1022. /** @private Internal usage. Do not use in your production. */
  1023. getInputElement: {
  1024. type: Function
  1025. },
  1026. /** @private Internal usage. Do not use in your production. */
  1027. getRawInputElement: {
  1028. type: Function
  1029. },
  1030. // >>> Selector
  1031. maxTagTextLength: Number,
  1032. maxTagCount: {
  1033. type: [String, Number]
  1034. },
  1035. maxTagPlaceholder: s.any,
  1036. // >>> Search
  1037. tokenSeparators: {
  1038. type: Array
  1039. },
  1040. // >>> Icons
  1041. allowClear: {
  1042. type: Boolean,
  1043. default: void 0
  1044. },
  1045. showArrow: {
  1046. type: Boolean,
  1047. default: void 0
  1048. },
  1049. inputIcon: s.any,
  1050. /** Clear all icon */
  1051. clearIcon: s.any,
  1052. /** Selector remove icon */
  1053. removeIcon: s.any,
  1054. // >>> Dropdown
  1055. animation: String,
  1056. transitionName: String,
  1057. dropdownStyle: {
  1058. type: Object
  1059. },
  1060. dropdownClassName: String,
  1061. dropdownMatchSelectWidth: {
  1062. type: [Boolean, Number],
  1063. default: void 0
  1064. },
  1065. dropdownRender: {
  1066. type: Function
  1067. },
  1068. dropdownAlign: Object,
  1069. placement: {
  1070. type: String
  1071. },
  1072. getPopupContainer: {
  1073. type: Function
  1074. },
  1075. // >>> Focus
  1076. showAction: {
  1077. type: Array
  1078. },
  1079. onBlur: {
  1080. type: Function
  1081. },
  1082. onFocus: {
  1083. type: Function
  1084. },
  1085. // >>> Rest Events
  1086. onKeyup: Function,
  1087. onKeydown: Function,
  1088. onMousedown: Function,
  1089. onPopupScroll: Function,
  1090. onInputKeyDown: Function,
  1091. onMouseenter: Function,
  1092. onMouseleave: Function,
  1093. onClick: Function
  1094. }), xo = () => d(d({}, wo()), Io());
  1095. function Co(e) {
  1096. return e === "tags" || e === "multiple";
  1097. }
  1098. const Qo = ce({
  1099. compatConfig: {
  1100. MODE: 3
  1101. },
  1102. name: "BaseSelect",
  1103. inheritAttrs: !1,
  1104. props: Vn(xo(), {
  1105. showAction: [],
  1106. notFoundContent: "Not Found"
  1107. }),
  1108. setup(e, n) {
  1109. let {
  1110. attrs: o,
  1111. expose: t,
  1112. slots: i
  1113. } = n;
  1114. const l = N(() => Co(e.mode)), m = N(() => e.showSearch !== void 0 ? e.showSearch : l.value || e.mode === "combobox"), v = W(!1);
  1115. re(() => {
  1116. v.value = vo();
  1117. });
  1118. const x = Me(), b = W(null), u = en(), C = W(null), M = W(null), $ = W(null), g = se(!1), [h, w, c] = go();
  1119. t({
  1120. focus: () => {
  1121. var a;
  1122. (a = M.value) === null || a === void 0 || a.focus();
  1123. },
  1124. blur: () => {
  1125. var a;
  1126. (a = M.value) === null || a === void 0 || a.blur();
  1127. },
  1128. scrollTo: (a) => {
  1129. var r;
  1130. return (r = $.value) === null || r === void 0 ? void 0 : r.scrollTo(a);
  1131. }
  1132. });
  1133. const S = N(() => {
  1134. var a;
  1135. if (e.mode !== "combobox")
  1136. return e.searchValue;
  1137. const r = (a = e.displayValues[0]) === null || a === void 0 ? void 0 : a.value;
  1138. return typeof r == "string" || typeof r == "number" ? String(r) : "";
  1139. }), E = e.open !== void 0 ? e.open : e.defaultOpen, T = W(E), y = W(E), X = (a) => {
  1140. T.value = e.open !== void 0 ? e.open : a, y.value = T.value;
  1141. };
  1142. ae(() => e.open, () => {
  1143. X(e.open);
  1144. });
  1145. const D = N(() => !e.notFoundContent && e.emptyOptions);
  1146. Ze(() => {
  1147. y.value = T.value, (e.disabled || D.value && y.value && e.mode === "combobox") && (y.value = !1);
  1148. });
  1149. const V = N(() => D.value ? !1 : y.value), R = (a) => {
  1150. const r = a !== void 0 ? a : !y.value;
  1151. y.value !== r && !e.disabled && (X(r), e.onDropdownVisibleChange && e.onDropdownVisibleChange(r));
  1152. }, Y = N(() => (e.tokenSeparators || []).some((a) => [`
  1153. `, `\r
  1154. `].includes(a))), L = (a, r, z) => {
  1155. var H, _;
  1156. let A = !0, j = a;
  1157. (H = e.onActiveValueChange) === null || H === void 0 || H.call(e, null);
  1158. const K = z ? null : to(a, e.tokenSeparators);
  1159. return e.mode !== "combobox" && K && (j = "", (_ = e.onSearchSplit) === null || _ === void 0 || _.call(e, K), R(!1), A = !1), e.onSearch && S.value !== j && e.onSearch(j, {
  1160. source: r ? "typing" : "effect"
  1161. }), A;
  1162. }, U = (a) => {
  1163. var r;
  1164. !a || !a.trim() || (r = e.onSearch) === null || r === void 0 || r.call(e, a, {
  1165. source: "submit"
  1166. });
  1167. };
  1168. ae(y, () => {
  1169. !y.value && !l.value && e.mode !== "combobox" && L("", !1, !1);
  1170. }, {
  1171. immediate: !0,
  1172. flush: "post"
  1173. }), ae(() => e.disabled, () => {
  1174. T.value && e.disabled && X(!1), e.disabled && !g.value && w(!1);
  1175. }, {
  1176. immediate: !0
  1177. });
  1178. const [F, B] = tn(), oe = function(a) {
  1179. var r;
  1180. const z = F(), {
  1181. which: H
  1182. } = a;
  1183. if (H === I.ENTER && (e.mode !== "combobox" && a.preventDefault(), y.value || R(!0)), B(!!S.value), H === I.BACKSPACE && !z && l.value && !S.value && e.displayValues.length) {
  1184. const K = [...e.displayValues];
  1185. let k = null;
  1186. for (let G = K.length - 1; G >= 0; G -= 1) {
  1187. const ee = K[G];
  1188. if (!ee.disabled) {
  1189. K.splice(G, 1), k = ee;
  1190. break;
  1191. }
  1192. }
  1193. k && e.onDisplayValuesChange(K, {
  1194. type: "remove",
  1195. values: [k]
  1196. });
  1197. }
  1198. for (var _ = arguments.length, A = new Array(_ > 1 ? _ - 1 : 0), j = 1; j < _; j++)
  1199. A[j - 1] = arguments[j];
  1200. y.value && $.value && $.value.onKeydown(a, ...A), (r = e.onKeydown) === null || r === void 0 || r.call(e, a, ...A);
  1201. }, te = function(a) {
  1202. for (var r = arguments.length, z = new Array(r > 1 ? r - 1 : 0), H = 1; H < r; H++)
  1203. z[H - 1] = arguments[H];
  1204. y.value && $.value && $.value.onKeyup(a, ...z), e.onKeyup && e.onKeyup(a, ...z);
  1205. }, O = (a) => {
  1206. const r = e.displayValues.filter((z) => z !== a);
  1207. e.onDisplayValuesChange(r, {
  1208. type: "remove",
  1209. values: [a]
  1210. });
  1211. }, J = W(!1), ie = function() {
  1212. w(!0), e.disabled || (e.onFocus && !J.value && e.onFocus(...arguments), e.showAction && e.showAction.includes("focus") && R(!0)), J.value = !0;
  1213. }, he = se(!1), rn = function() {
  1214. if (he.value || (g.value = !0, w(!1, () => {
  1215. J.value = !1, g.value = !1, R(!1);
  1216. }), e.disabled))
  1217. return;
  1218. const a = S.value;
  1219. a && (e.mode === "tags" ? e.onSearch(a, {
  1220. source: "submit"
  1221. }) : e.mode === "multiple" && e.onSearch("", {
  1222. source: "blur"
  1223. })), e.onBlur && e.onBlur(...arguments);
  1224. }, sn = () => {
  1225. he.value = !0;
  1226. }, un = () => {
  1227. he.value = !1;
  1228. };
  1229. Ee("VCSelectContainerEvent", {
  1230. focus: ie,
  1231. blur: rn
  1232. });
  1233. const Q = [];
  1234. re(() => {
  1235. Q.forEach((a) => clearTimeout(a)), Q.splice(0, Q.length);
  1236. }), Oe(() => {
  1237. Q.forEach((a) => clearTimeout(a)), Q.splice(0, Q.length);
  1238. });
  1239. const cn = function(a) {
  1240. var r, z;
  1241. const {
  1242. target: H
  1243. } = a, _ = (r = C.value) === null || r === void 0 ? void 0 : r.getPopupElement();
  1244. if (_ && _.contains(H)) {
  1245. const k = setTimeout(() => {
  1246. var G;
  1247. const ee = Q.indexOf(k);
  1248. ee !== -1 && Q.splice(ee, 1), c(), !v.value && !_.contains(document.activeElement) && ((G = M.value) === null || G === void 0 || G.focus());
  1249. });
  1250. Q.push(k);
  1251. }
  1252. for (var A = arguments.length, j = new Array(A > 1 ? A - 1 : 0), K = 1; K < A; K++)
  1253. j[K - 1] = arguments[K];
  1254. (z = e.onMousedown) === null || z === void 0 || z.call(e, a, ...j);
  1255. }, ve = W(null), dn = () => {
  1256. };
  1257. return re(() => {
  1258. ae(V, () => {
  1259. var a;
  1260. if (V.value) {
  1261. const r = Math.ceil((a = b.value) === null || a === void 0 ? void 0 : a.offsetWidth);
  1262. ve.value !== r && !Number.isNaN(r) && (ve.value = r);
  1263. }
  1264. }, {
  1265. immediate: !0,
  1266. flush: "post"
  1267. });
  1268. }), fo([b, C], V, R), ho(bo(d(d({}, no(e)), {
  1269. open: y,
  1270. triggerOpen: V,
  1271. showSearch: m,
  1272. multiple: l,
  1273. toggleOpen: R
  1274. }))), () => {
  1275. const a = d(d({}, e), o), {
  1276. prefixCls: r,
  1277. id: z,
  1278. open: H,
  1279. defaultOpen: _,
  1280. mode: A,
  1281. // Search related
  1282. showSearch: j,
  1283. searchValue: K,
  1284. onSearch: k,
  1285. // Icons
  1286. allowClear: G,
  1287. clearIcon: ee,
  1288. showArrow: Be,
  1289. inputIcon: pn,
  1290. // Others
  1291. disabled: be,
  1292. loading: me,
  1293. getInputElement: ze,
  1294. getPopupContainer: mn,
  1295. placement: fn,
  1296. // Dropdown
  1297. animation: gn,
  1298. transitionName: hn,
  1299. dropdownStyle: vn,
  1300. dropdownClassName: bn,
  1301. dropdownMatchSelectWidth: Sn,
  1302. dropdownRender: yn,
  1303. dropdownAlign: wn,
  1304. showAction: Bo,
  1305. direction: In,
  1306. // Tags
  1307. tokenSeparators: zo,
  1308. tagRender: xn,
  1309. optionLabelRender: Cn,
  1310. // Events
  1311. onPopupScroll: No,
  1312. onDropdownVisibleChange: Vo,
  1313. onFocus: Lo,
  1314. onBlur: Ho,
  1315. onKeyup: Ao,
  1316. onKeydown: Wo,
  1317. onMousedown: Ko,
  1318. onClear: Se,
  1319. omitDomProps: ye,
  1320. getRawInputElement: Ne,
  1321. displayValues: fe,
  1322. onDisplayValuesChange: $n,
  1323. emptyOptions: Pn,
  1324. activeDescendantId: Tn,
  1325. activeValue: Fn,
  1326. OptionList: Dn
  1327. } = a, En = So(a, ["prefixCls", "id", "open", "defaultOpen", "mode", "showSearch", "searchValue", "onSearch", "allowClear", "clearIcon", "showArrow", "inputIcon", "disabled", "loading", "getInputElement", "getPopupContainer", "placement", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "showAction", "direction", "tokenSeparators", "tagRender", "optionLabelRender", "onPopupScroll", "onDropdownVisibleChange", "onFocus", "onBlur", "onKeyup", "onKeydown", "onMousedown", "onClear", "omitDomProps", "getRawInputElement", "displayValues", "onDisplayValuesChange", "emptyOptions", "activeDescendantId", "activeValue", "OptionList"]), Ve = A === "combobox" && ze && ze() || null, de = typeof Ne == "function" && Ne(), we = d({}, En);
  1328. let Le;
  1329. de && (Le = (ne) => {
  1330. R(ne);
  1331. }), yo.forEach((ne) => {
  1332. delete we[ne];
  1333. }), ye == null || ye.forEach((ne) => {
  1334. delete we[ne];
  1335. });
  1336. const He = Be !== void 0 ? Be : me || !l.value && A !== "combobox";
  1337. let Ae;
  1338. He && (Ae = p(ue, {
  1339. class: pe(`${r}-arrow`, {
  1340. [`${r}-arrow-loading`]: me
  1341. }),
  1342. customizeIcon: pn,
  1343. customizeIconProps: {
  1344. loading: me,
  1345. searchValue: S.value,
  1346. open: y.value,
  1347. focused: h.value,
  1348. showSearch: m.value
  1349. }
  1350. }, null));
  1351. let We;
  1352. const On = () => {
  1353. Se == null || Se(), $n([], {
  1354. type: "clear",
  1355. values: fe
  1356. }), L("", !1, !1);
  1357. };
  1358. !be && G && (fe.length || S.value) && (We = p(ue, {
  1359. class: `${r}-clear`,
  1360. onMousedown: On,
  1361. customizeIcon: ee
  1362. }, {
  1363. default: () => [Te("×")]
  1364. }));
  1365. const Mn = p(Dn, {
  1366. ref: $
  1367. }, d(d({}, x.customSlots), {
  1368. option: i.option
  1369. })), Rn = pe(r, o.class, {
  1370. [`${r}-focused`]: h.value,
  1371. [`${r}-multiple`]: l.value,
  1372. [`${r}-single`]: !l.value,
  1373. [`${r}-allow-clear`]: G,
  1374. [`${r}-show-arrow`]: He,
  1375. [`${r}-disabled`]: be,
  1376. [`${r}-loading`]: me,
  1377. [`${r}-open`]: y.value,
  1378. [`${r}-customize-input`]: Ve,
  1379. [`${r}-show-search`]: m.value
  1380. }), Ke = p(ao, {
  1381. ref: C,
  1382. disabled: be,
  1383. prefixCls: r,
  1384. visible: V.value,
  1385. popupElement: Mn,
  1386. containerWidth: ve.value,
  1387. animation: gn,
  1388. transitionName: hn,
  1389. dropdownStyle: vn,
  1390. dropdownClassName: bn,
  1391. direction: In,
  1392. dropdownMatchSelectWidth: Sn,
  1393. dropdownRender: yn,
  1394. dropdownAlign: wn,
  1395. placement: fn,
  1396. getPopupContainer: mn,
  1397. empty: Pn,
  1398. getTriggerDOMNode: () => u.current,
  1399. onPopupVisibleChange: Le,
  1400. onPopupMouseEnter: dn,
  1401. onPopupFocusin: sn,
  1402. onPopupFocusout: un
  1403. }, {
  1404. default: () => de ? Ln(de) && Qe(de, {
  1405. ref: u
  1406. }, !1, !0) : p(mo, q(q({}, e), {}, {
  1407. domRef: u,
  1408. prefixCls: r,
  1409. inputElement: Ve,
  1410. ref: M,
  1411. id: z,
  1412. showSearch: m.value,
  1413. mode: A,
  1414. activeDescendantId: Tn,
  1415. tagRender: xn,
  1416. optionLabelRender: Cn,
  1417. values: fe,
  1418. open: y.value,
  1419. onToggleOpen: R,
  1420. activeValue: Fn,
  1421. searchValue: S.value,
  1422. onSearch: L,
  1423. onSearchSubmit: U,
  1424. onRemove: O,
  1425. tokenWithEnter: Y.value
  1426. }), null)
  1427. });
  1428. let Ie;
  1429. return de ? Ie = Ke : Ie = p("div", q(q({}, we), {}, {
  1430. class: Rn,
  1431. ref: b,
  1432. onMousedown: cn,
  1433. onKeydown: oe,
  1434. onKeyup: te
  1435. }), [h.value && !y.value && p("span", {
  1436. style: {
  1437. width: 0,
  1438. height: 0,
  1439. position: "absolute",
  1440. overflow: "hidden",
  1441. opacity: 0
  1442. },
  1443. "aria-live": "polite"
  1444. }, [`${fe.map((ne) => {
  1445. let {
  1446. label: _e,
  1447. value: Bn
  1448. } = ne;
  1449. return ["number", "string"].includes(typeof _e) ? _e : Bn;
  1450. }).join(", ")}`]), Ke, Ae, We]), Ie;
  1451. };
  1452. }
  1453. });
  1454. let Ye = 0;
  1455. const $o = process.env.NODE_ENV !== "test" && Hn();
  1456. function Po() {
  1457. let e;
  1458. return $o ? (e = Ye, Ye += 1) : e = "TEST_OR_SSR", e;
  1459. }
  1460. function Jo() {
  1461. let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : se("");
  1462. const n = `rc_select_${Po()}`;
  1463. return e.value || n;
  1464. }
  1465. function Zo(e) {
  1466. let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  1467. const {
  1468. loading: o,
  1469. multiple: t,
  1470. prefixCls: i,
  1471. hasFeedback: l,
  1472. feedbackIcon: m,
  1473. showArrow: v
  1474. } = e, x = e.suffixIcon || n.suffixIcon && n.suffixIcon(), b = e.clearIcon || n.clearIcon && n.clearIcon(), u = e.menuItemSelectedIcon || n.menuItemSelectedIcon && n.menuItemSelectedIcon(), C = e.removeIcon || n.removeIcon && n.removeIcon(), M = b != null ? b : p(An, null, null), $ = (c) => p(ge, null, [v !== !1 && c, l && m]);
  1475. let g = null;
  1476. if (x !== void 0)
  1477. g = $(x);
  1478. else if (o)
  1479. g = $(p(Wn, {
  1480. spin: !0
  1481. }, null));
  1482. else {
  1483. const c = `${i}-suffix`;
  1484. g = (f) => {
  1485. let {
  1486. open: P,
  1487. showSearch: S
  1488. } = f;
  1489. return $(P && S ? p(jn, {
  1490. class: c
  1491. }, null) : p(Xn, {
  1492. class: c
  1493. }, null));
  1494. };
  1495. }
  1496. let h = null;
  1497. u !== void 0 ? h = u : t ? h = p(Kn, null, null) : h = null;
  1498. let w = null;
  1499. return C !== void 0 ? w = C : w = p(_n, null, null), {
  1500. clearIcon: M,
  1501. suffixIcon: g,
  1502. itemIcon: h,
  1503. removeIcon: w
  1504. };
  1505. }
  1506. const qe = (e) => {
  1507. const {
  1508. controlPaddingHorizontal: n
  1509. } = e;
  1510. return {
  1511. position: "relative",
  1512. display: "block",
  1513. minHeight: e.controlHeight,
  1514. padding: `${(e.controlHeight - e.fontSize * e.lineHeight) / 2}px ${n}px`,
  1515. color: e.colorText,
  1516. fontWeight: "normal",
  1517. fontSize: e.fontSize,
  1518. lineHeight: e.lineHeight,
  1519. boxSizing: "border-box"
  1520. };
  1521. }, To = (e) => {
  1522. const {
  1523. antCls: n,
  1524. componentCls: o
  1525. } = e, t = `${o}-item`;
  1526. return [
  1527. {
  1528. [`${o}-dropdown`]: d(d({}, Fe(e)), {
  1529. position: "absolute",
  1530. top: -9999,
  1531. zIndex: e.zIndexPopup,
  1532. boxSizing: "border-box",
  1533. padding: e.paddingXXS,
  1534. overflow: "hidden",
  1535. fontSize: e.fontSize,
  1536. // Fix select render lag of long text in chrome
  1537. // https://github.com/ant-design/ant-design/issues/11456
  1538. // https://github.com/ant-design/ant-design/issues/11843
  1539. fontVariant: "initial",
  1540. backgroundColor: e.colorBgElevated,
  1541. borderRadius: e.borderRadiusLG,
  1542. outline: "none",
  1543. boxShadow: e.boxShadowSecondary,
  1544. [`
  1545. &${n}-slide-up-enter${n}-slide-up-enter-active${o}-dropdown-placement-bottomLeft,
  1546. &${n}-slide-up-appear${n}-slide-up-appear-active${o}-dropdown-placement-bottomLeft
  1547. `]: {
  1548. animationName: Un
  1549. },
  1550. [`
  1551. &${n}-slide-up-enter${n}-slide-up-enter-active${o}-dropdown-placement-topLeft,
  1552. &${n}-slide-up-appear${n}-slide-up-appear-active${o}-dropdown-placement-topLeft
  1553. `]: {
  1554. animationName: Gn
  1555. },
  1556. [`&${n}-slide-up-leave${n}-slide-up-leave-active${o}-dropdown-placement-bottomLeft`]: {
  1557. animationName: Yn
  1558. },
  1559. [`&${n}-slide-up-leave${n}-slide-up-leave-active${o}-dropdown-placement-topLeft`]: {
  1560. animationName: qn
  1561. },
  1562. "&-hidden": {
  1563. display: "none"
  1564. },
  1565. "&-empty": {
  1566. color: e.colorTextDisabled
  1567. },
  1568. // ========================= Options =========================
  1569. [`${t}-empty`]: d(d({}, qe(e)), {
  1570. color: e.colorTextDisabled
  1571. }),
  1572. [`${t}`]: d(d({}, qe(e)), {
  1573. cursor: "pointer",
  1574. transition: `background ${e.motionDurationSlow} ease`,
  1575. borderRadius: e.borderRadiusSM,
  1576. // =========== Group ============
  1577. "&-group": {
  1578. color: e.colorTextDescription,
  1579. fontSize: e.fontSizeSM,
  1580. cursor: "default"
  1581. },
  1582. // =========== Option ===========
  1583. "&-option": {
  1584. display: "flex",
  1585. "&-content": d({
  1586. flex: "auto"
  1587. }, Pe),
  1588. "&-state": {
  1589. flex: "none"
  1590. },
  1591. [`&-active:not(${t}-option-disabled)`]: {
  1592. backgroundColor: e.controlItemBgHover
  1593. },
  1594. [`&-selected:not(${t}-option-disabled)`]: {
  1595. color: e.colorText,
  1596. fontWeight: e.fontWeightStrong,
  1597. backgroundColor: e.controlItemBgActive,
  1598. [`${t}-option-state`]: {
  1599. color: e.colorPrimary
  1600. }
  1601. },
  1602. "&-disabled": {
  1603. [`&${t}-option-selected`]: {
  1604. backgroundColor: e.colorBgContainerDisabled
  1605. },
  1606. color: e.colorTextDisabled,
  1607. cursor: "not-allowed"
  1608. },
  1609. "&-grouped": {
  1610. paddingInlineStart: e.controlPaddingHorizontal * 2
  1611. }
  1612. }
  1613. }),
  1614. // =========================== RTL ===========================
  1615. "&-rtl": {
  1616. direction: "rtl"
  1617. }
  1618. })
  1619. },
  1620. // Follow code may reuse in other components
  1621. je(e, "slide-up"),
  1622. je(e, "slide-down"),
  1623. Xe(e, "move-up"),
  1624. Xe(e, "move-down")
  1625. ];
  1626. }, le = 2;
  1627. function an(e) {
  1628. let {
  1629. controlHeightSM: n,
  1630. controlHeight: o,
  1631. lineWidth: t
  1632. } = e;
  1633. const i = (o - n) / 2 - t, l = Math.ceil(i / 2);
  1634. return [i, l];
  1635. }
  1636. function xe(e, n) {
  1637. const {
  1638. componentCls: o,
  1639. iconCls: t
  1640. } = e, i = `${o}-selection-overflow`, l = e.controlHeightSM, [m] = an(e), v = n ? `${o}-${n}` : "";
  1641. return {
  1642. [`${o}-multiple${v}`]: {
  1643. fontSize: e.fontSize,
  1644. /**
  1645. * Do not merge `height` & `line-height` under style with `selection` & `search`, since chrome
  1646. * may update to redesign with its align logic.
  1647. */
  1648. // =========================== Overflow ===========================
  1649. [i]: {
  1650. position: "relative",
  1651. display: "flex",
  1652. flex: "auto",
  1653. flexWrap: "wrap",
  1654. maxWidth: "100%",
  1655. "&-item": {
  1656. flex: "none",
  1657. alignSelf: "center",
  1658. maxWidth: "100%",
  1659. display: "inline-flex"
  1660. }
  1661. },
  1662. // ========================= Selector =========================
  1663. [`${o}-selector`]: {
  1664. display: "flex",
  1665. flexWrap: "wrap",
  1666. alignItems: "center",
  1667. // Multiple is little different that horizontal is follow the vertical
  1668. padding: `${m - le}px ${le * 2}px`,
  1669. borderRadius: e.borderRadius,
  1670. [`${o}-show-search&`]: {
  1671. cursor: "text"
  1672. },
  1673. [`${o}-disabled&`]: {
  1674. background: e.colorBgContainerDisabled,
  1675. cursor: "not-allowed"
  1676. },
  1677. "&:after": {
  1678. display: "inline-block",
  1679. width: 0,
  1680. margin: `${le}px 0`,
  1681. lineHeight: `${l}px`,
  1682. content: '"\\a0"'
  1683. }
  1684. },
  1685. [`
  1686. &${o}-show-arrow ${o}-selector,
  1687. &${o}-allow-clear ${o}-selector
  1688. `]: {
  1689. paddingInlineEnd: e.fontSizeIcon + e.controlPaddingHorizontal
  1690. },
  1691. // ======================== Selections ========================
  1692. [`${o}-selection-item`]: {
  1693. position: "relative",
  1694. display: "flex",
  1695. flex: "none",
  1696. boxSizing: "border-box",
  1697. maxWidth: "100%",
  1698. height: l,
  1699. marginTop: le,
  1700. marginBottom: le,
  1701. lineHeight: `${l - e.lineWidth * 2}px`,
  1702. background: e.colorFillSecondary,
  1703. border: `${e.lineWidth}px solid ${e.colorSplit}`,
  1704. borderRadius: e.borderRadiusSM,
  1705. cursor: "default",
  1706. transition: `font-size ${e.motionDurationSlow}, line-height ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,
  1707. userSelect: "none",
  1708. marginInlineEnd: le * 2,
  1709. paddingInlineStart: e.paddingXS,
  1710. paddingInlineEnd: e.paddingXS / 2,
  1711. [`${o}-disabled&`]: {
  1712. color: e.colorTextDisabled,
  1713. borderColor: e.colorBorder,
  1714. cursor: "not-allowed"
  1715. },
  1716. // It's ok not to do this, but 24px makes bottom narrow in view should adjust
  1717. "&-content": {
  1718. display: "inline-block",
  1719. marginInlineEnd: e.paddingXS / 2,
  1720. overflow: "hidden",
  1721. whiteSpace: "pre",
  1722. textOverflow: "ellipsis"
  1723. },
  1724. "&-remove": d(d({}, Je()), {
  1725. display: "inline-block",
  1726. color: e.colorIcon,
  1727. fontWeight: "bold",
  1728. fontSize: 10,
  1729. lineHeight: "inherit",
  1730. cursor: "pointer",
  1731. [`> ${t}`]: {
  1732. verticalAlign: "-0.2em"
  1733. },
  1734. "&:hover": {
  1735. color: e.colorIconHover
  1736. }
  1737. })
  1738. },
  1739. // ========================== Input ==========================
  1740. [`${i}-item + ${i}-item`]: {
  1741. [`${o}-selection-search`]: {
  1742. marginInlineStart: 0
  1743. }
  1744. },
  1745. [`${o}-selection-search`]: {
  1746. display: "inline-flex",
  1747. position: "relative",
  1748. maxWidth: "100%",
  1749. marginInlineStart: e.inputPaddingHorizontalBase - m,
  1750. "\n &-input,\n &-mirror\n ": {
  1751. height: l,
  1752. fontFamily: e.fontFamily,
  1753. lineHeight: `${l}px`,
  1754. transition: `all ${e.motionDurationSlow}`
  1755. },
  1756. "&-input": {
  1757. width: "100%",
  1758. minWidth: 4.1
  1759. // fix search cursor missing
  1760. },
  1761. "&-mirror": {
  1762. position: "absolute",
  1763. top: 0,
  1764. insetInlineStart: 0,
  1765. insetInlineEnd: "auto",
  1766. zIndex: 999,
  1767. whiteSpace: "pre",
  1768. visibility: "hidden"
  1769. }
  1770. },
  1771. // ======================= Placeholder =======================
  1772. [`${o}-selection-placeholder `]: {
  1773. position: "absolute",
  1774. top: "50%",
  1775. insetInlineStart: e.inputPaddingHorizontalBase,
  1776. insetInlineEnd: e.inputPaddingHorizontalBase,
  1777. transform: "translateY(-50%)",
  1778. transition: `all ${e.motionDurationSlow}`
  1779. }
  1780. }
  1781. };
  1782. }
  1783. function Fo(e) {
  1784. const {
  1785. componentCls: n
  1786. } = e, o = Z(e, {
  1787. controlHeight: e.controlHeightSM,
  1788. controlHeightSM: e.controlHeightXS,
  1789. borderRadius: e.borderRadiusSM,
  1790. borderRadiusSM: e.borderRadiusXS
  1791. }), [, t] = an(e);
  1792. return [
  1793. xe(e),
  1794. // ======================== Small ========================
  1795. // Shared
  1796. xe(o, "sm"),
  1797. // Padding
  1798. {
  1799. [`${n}-multiple${n}-sm`]: {
  1800. [`${n}-selection-placeholder`]: {
  1801. insetInlineStart: e.controlPaddingHorizontalSM - e.lineWidth,
  1802. insetInlineEnd: "auto"
  1803. },
  1804. // https://github.com/ant-design/ant-design/issues/29559
  1805. [`${n}-selection-search`]: {
  1806. marginInlineStart: t
  1807. }
  1808. }
  1809. },
  1810. // ======================== Large ========================
  1811. // Shared
  1812. xe(Z(e, {
  1813. fontSize: e.fontSizeLG,
  1814. controlHeight: e.controlHeightLG,
  1815. controlHeightSM: e.controlHeight,
  1816. borderRadius: e.borderRadiusLG,
  1817. borderRadiusSM: e.borderRadius
  1818. }), "lg")
  1819. ];
  1820. }
  1821. function Ce(e, n) {
  1822. const {
  1823. componentCls: o,
  1824. inputPaddingHorizontalBase: t,
  1825. borderRadius: i
  1826. } = e, l = e.controlHeight - e.lineWidth * 2, m = Math.ceil(e.fontSize * 1.25), v = n ? `${o}-${n}` : "";
  1827. return {
  1828. [`${o}-single${v}`]: {
  1829. fontSize: e.fontSize,
  1830. // ========================= Selector =========================
  1831. [`${o}-selector`]: d(d({}, Fe(e)), {
  1832. display: "flex",
  1833. borderRadius: i,
  1834. [`${o}-selection-search`]: {
  1835. position: "absolute",
  1836. top: 0,
  1837. insetInlineStart: t,
  1838. insetInlineEnd: t,
  1839. bottom: 0,
  1840. "&-input": {
  1841. width: "100%"
  1842. }
  1843. },
  1844. [`
  1845. ${o}-selection-item,
  1846. ${o}-selection-placeholder
  1847. `]: {
  1848. padding: 0,
  1849. lineHeight: `${l}px`,
  1850. transition: `all ${e.motionDurationSlow}`,
  1851. // Firefox inline-block position calculation is not same as Chrome & Safari. Patch this:
  1852. "@supports (-moz-appearance: meterbar)": {
  1853. lineHeight: `${l}px`
  1854. }
  1855. },
  1856. [`${o}-selection-item`]: {
  1857. position: "relative",
  1858. userSelect: "none"
  1859. },
  1860. [`${o}-selection-placeholder`]: {
  1861. transition: "none",
  1862. pointerEvents: "none"
  1863. },
  1864. // For common baseline align
  1865. [[
  1866. "&:after",
  1867. /* For '' value baseline align */
  1868. `${o}-selection-item:after`,
  1869. /* For undefined value baseline align */
  1870. `${o}-selection-placeholder:after`
  1871. ].join(",")]: {
  1872. display: "inline-block",
  1873. width: 0,
  1874. visibility: "hidden",
  1875. content: '"\\a0"'
  1876. }
  1877. }),
  1878. [`
  1879. &${o}-show-arrow ${o}-selection-item,
  1880. &${o}-show-arrow ${o}-selection-placeholder
  1881. `]: {
  1882. paddingInlineEnd: m
  1883. },
  1884. // Opacity selection if open
  1885. [`&${o}-open ${o}-selection-item`]: {
  1886. color: e.colorTextPlaceholder
  1887. },
  1888. // ========================== Input ==========================
  1889. // We only change the style of non-customize input which is only support by `combobox` mode.
  1890. // Not customize
  1891. [`&:not(${o}-customize-input)`]: {
  1892. [`${o}-selector`]: {
  1893. width: "100%",
  1894. height: e.controlHeight,
  1895. padding: `0 ${t}px`,
  1896. [`${o}-selection-search-input`]: {
  1897. height: l
  1898. },
  1899. "&:after": {
  1900. lineHeight: `${l}px`
  1901. }
  1902. }
  1903. },
  1904. [`&${o}-customize-input`]: {
  1905. [`${o}-selector`]: {
  1906. "&:after": {
  1907. display: "none"
  1908. },
  1909. [`${o}-selection-search`]: {
  1910. position: "static",
  1911. width: "100%"
  1912. },
  1913. [`${o}-selection-placeholder`]: {
  1914. position: "absolute",
  1915. insetInlineStart: 0,
  1916. insetInlineEnd: 0,
  1917. padding: `0 ${t}px`,
  1918. "&:after": {
  1919. display: "none"
  1920. }
  1921. }
  1922. }
  1923. }
  1924. }
  1925. };
  1926. }
  1927. function Do(e) {
  1928. const {
  1929. componentCls: n
  1930. } = e, o = e.controlPaddingHorizontalSM - e.lineWidth;
  1931. return [
  1932. Ce(e),
  1933. // ======================== Small ========================
  1934. // Shared
  1935. Ce(Z(e, {
  1936. controlHeight: e.controlHeightSM,
  1937. borderRadius: e.borderRadiusSM
  1938. }), "sm"),
  1939. // padding
  1940. {
  1941. [`${n}-single${n}-sm`]: {
  1942. [`&:not(${n}-customize-input)`]: {
  1943. [`${n}-selection-search`]: {
  1944. insetInlineStart: o,
  1945. insetInlineEnd: o
  1946. },
  1947. [`${n}-selector`]: {
  1948. padding: `0 ${o}px`
  1949. },
  1950. // With arrow should provides `padding-right` to show the arrow
  1951. [`&${n}-show-arrow ${n}-selection-search`]: {
  1952. insetInlineEnd: o + e.fontSize * 1.5
  1953. },
  1954. [`
  1955. &${n}-show-arrow ${n}-selection-item,
  1956. &${n}-show-arrow ${n}-selection-placeholder
  1957. `]: {
  1958. paddingInlineEnd: e.fontSize * 1.5
  1959. }
  1960. }
  1961. }
  1962. },
  1963. // ======================== Large ========================
  1964. // Shared
  1965. Ce(Z(e, {
  1966. controlHeight: e.controlHeightLG,
  1967. fontSize: e.fontSizeLG,
  1968. borderRadius: e.borderRadiusLG
  1969. }), "lg")
  1970. ];
  1971. }
  1972. const Eo = (e) => {
  1973. const {
  1974. componentCls: n
  1975. } = e;
  1976. return {
  1977. position: "relative",
  1978. backgroundColor: e.colorBgContainer,
  1979. border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,
  1980. transition: `all ${e.motionDurationMid} ${e.motionEaseInOut}`,
  1981. input: {
  1982. cursor: "pointer"
  1983. },
  1984. [`${n}-show-search&`]: {
  1985. cursor: "text",
  1986. input: {
  1987. cursor: "auto",
  1988. color: "inherit"
  1989. }
  1990. },
  1991. [`${n}-disabled&`]: {
  1992. color: e.colorTextDisabled,
  1993. background: e.colorBgContainerDisabled,
  1994. cursor: "not-allowed",
  1995. [`${n}-multiple&`]: {
  1996. background: e.colorBgContainerDisabled
  1997. },
  1998. input: {
  1999. cursor: "not-allowed"
  2000. }
  2001. }
  2002. };
  2003. }, $e = function(e, n) {
  2004. let o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
  2005. const {
  2006. componentCls: t,
  2007. borderHoverColor: i,
  2008. outlineColor: l,
  2009. antCls: m
  2010. } = n, v = o ? {
  2011. [`${t}-selector`]: {
  2012. borderColor: i
  2013. }
  2014. } : {};
  2015. return {
  2016. [e]: {
  2017. [`&:not(${t}-disabled):not(${t}-customize-input):not(${m}-pagination-size-changer)`]: d(d({}, v), {
  2018. [`${t}-focused& ${t}-selector`]: {
  2019. borderColor: i,
  2020. boxShadow: `0 0 0 ${n.controlOutlineWidth}px ${l}`,
  2021. borderInlineEndWidth: `${n.controlLineWidth}px !important`,
  2022. outline: 0
  2023. },
  2024. [`&:hover ${t}-selector`]: {
  2025. borderColor: i,
  2026. borderInlineEndWidth: `${n.controlLineWidth}px !important`
  2027. }
  2028. })
  2029. }
  2030. };
  2031. }, Oo = (e) => {
  2032. const {
  2033. componentCls: n
  2034. } = e;
  2035. return {
  2036. [`${n}-selection-search-input`]: {
  2037. margin: 0,
  2038. padding: 0,
  2039. background: "transparent",
  2040. border: "none",
  2041. outline: "none",
  2042. appearance: "none",
  2043. "&::-webkit-search-cancel-button": {
  2044. display: "none",
  2045. "-webkit-appearance": "none"
  2046. }
  2047. }
  2048. };
  2049. }, Mo = (e) => {
  2050. const {
  2051. componentCls: n,
  2052. inputPaddingHorizontalBase: o,
  2053. iconCls: t
  2054. } = e;
  2055. return {
  2056. [n]: d(d({}, Fe(e)), {
  2057. position: "relative",
  2058. display: "inline-block",
  2059. cursor: "pointer",
  2060. [`&:not(${n}-customize-input) ${n}-selector`]: d(d({}, Eo(e)), Oo(e)),
  2061. // [`&:not(&-disabled):hover ${selectCls}-selector`]: {
  2062. // ...genHoverStyle(token),
  2063. // },
  2064. // ======================== Selection ========================
  2065. [`${n}-selection-item`]: d({
  2066. flex: 1,
  2067. fontWeight: "normal"
  2068. }, Pe),
  2069. // ======================= Placeholder =======================
  2070. [`${n}-selection-placeholder`]: d(d({}, Pe), {
  2071. flex: 1,
  2072. color: e.colorTextPlaceholder,
  2073. pointerEvents: "none"
  2074. }),
  2075. // ========================== Arrow ==========================
  2076. [`${n}-arrow`]: d(d({}, Je()), {
  2077. position: "absolute",
  2078. top: "50%",
  2079. insetInlineStart: "auto",
  2080. insetInlineEnd: o,
  2081. height: e.fontSizeIcon,
  2082. marginTop: -e.fontSizeIcon / 2,
  2083. color: e.colorTextQuaternary,
  2084. fontSize: e.fontSizeIcon,
  2085. lineHeight: 1,
  2086. textAlign: "center",
  2087. pointerEvents: "none",
  2088. display: "flex",
  2089. alignItems: "center",
  2090. [t]: {
  2091. verticalAlign: "top",
  2092. transition: `transform ${e.motionDurationSlow}`,
  2093. "> svg": {
  2094. verticalAlign: "top"
  2095. },
  2096. [`&:not(${n}-suffix)`]: {
  2097. pointerEvents: "auto"
  2098. }
  2099. },
  2100. [`${n}-disabled &`]: {
  2101. cursor: "not-allowed"
  2102. },
  2103. "> *:not(:last-child)": {
  2104. marginInlineEnd: 8
  2105. // FIXME: magic
  2106. }
  2107. }),
  2108. // ========================== Clear ==========================
  2109. [`${n}-clear`]: {
  2110. position: "absolute",
  2111. top: "50%",
  2112. insetInlineStart: "auto",
  2113. insetInlineEnd: o,
  2114. zIndex: 1,
  2115. display: "inline-block",
  2116. width: e.fontSizeIcon,
  2117. height: e.fontSizeIcon,
  2118. marginTop: -e.fontSizeIcon / 2,
  2119. color: e.colorTextQuaternary,
  2120. fontSize: e.fontSizeIcon,
  2121. fontStyle: "normal",
  2122. lineHeight: 1,
  2123. textAlign: "center",
  2124. textTransform: "none",
  2125. background: e.colorBgContainer,
  2126. cursor: "pointer",
  2127. opacity: 0,
  2128. transition: `color ${e.motionDurationMid} ease, opacity ${e.motionDurationSlow} ease`,
  2129. textRendering: "auto",
  2130. "&:before": {
  2131. display: "block"
  2132. },
  2133. "&:hover": {
  2134. color: e.colorTextTertiary
  2135. }
  2136. },
  2137. "&:hover": {
  2138. [`${n}-clear`]: {
  2139. opacity: 1
  2140. }
  2141. }
  2142. }),
  2143. // ========================= Feedback ==========================
  2144. [`${n}-has-feedback`]: {
  2145. [`${n}-clear`]: {
  2146. insetInlineEnd: o + e.fontSize + e.paddingXXS
  2147. }
  2148. }
  2149. };
  2150. }, Ro = (e) => {
  2151. const {
  2152. componentCls: n
  2153. } = e;
  2154. return [
  2155. {
  2156. [n]: {
  2157. // ==================== BorderLess ====================
  2158. [`&-borderless ${n}-selector`]: {
  2159. backgroundColor: "transparent !important",
  2160. borderColor: "transparent !important",
  2161. boxShadow: "none !important"
  2162. },
  2163. // ==================== In Form ====================
  2164. [`&${n}-in-form-item`]: {
  2165. width: "100%"
  2166. }
  2167. }
  2168. },
  2169. // =====================================================
  2170. // == LTR ==
  2171. // =====================================================
  2172. // Base
  2173. Mo(e),
  2174. // Single
  2175. Do(e),
  2176. // Multiple
  2177. Fo(e),
  2178. // Dropdown
  2179. To(e),
  2180. // =====================================================
  2181. // == RTL ==
  2182. // =====================================================
  2183. {
  2184. [`${n}-rtl`]: {
  2185. direction: "rtl"
  2186. }
  2187. },
  2188. // =====================================================
  2189. // == Status ==
  2190. // =====================================================
  2191. $e(n, Z(e, {
  2192. borderHoverColor: e.colorPrimaryHover,
  2193. outlineColor: e.controlOutline
  2194. })),
  2195. $e(`${n}-status-error`, Z(e, {
  2196. borderHoverColor: e.colorErrorHover,
  2197. outlineColor: e.colorErrorOutline
  2198. }), !0),
  2199. $e(`${n}-status-warning`, Z(e, {
  2200. borderHoverColor: e.colorWarningHover,
  2201. outlineColor: e.colorWarningOutline
  2202. }), !0),
  2203. // =====================================================
  2204. // == Space Compact ==
  2205. // =====================================================
  2206. Jn(e, {
  2207. borderElCls: `${n}-selector`,
  2208. focusElCls: `${n}-focused`
  2209. })
  2210. ];
  2211. }, ko = Qn("Select", (e, n) => {
  2212. let {
  2213. rootPrefixCls: o
  2214. } = n;
  2215. const t = Z(e, {
  2216. rootPrefixCls: o,
  2217. inputPaddingHorizontalBase: e.paddingSM - 1
  2218. });
  2219. return [Ro(t)];
  2220. }, (e) => ({
  2221. zIndexPopup: e.zIndexPopupBase + 50
  2222. }));
  2223. export {
  2224. Qo as B,
  2225. Jo as a,
  2226. Io as b,
  2227. ko as c,
  2228. Me as d,
  2229. Yo as e,
  2230. Zo as g,
  2231. bo as t,
  2232. qo as u
  2233. };