index4.js 62 KB

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