Search.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. import { a1 as _e, d as O, Q as Se, P as W, p as Q, c as z, _ as M, o as L, c0 as re, u as pe, x as Ne, y as Be, af as Oe, br as ue, ay as $e, D as Ie } from "./index2.js";
  2. import { defineComponent as X, ref as te, createVNode as g, shallowRef as K, watch as se, computed as J, onMounted as ve, Fragment as me, nextTick as ie, onBeforeUpdate as Pe, onBeforeUnmount as Fe } from "vue";
  3. import { u as Ae, F as je, N as de } from "./FormItemContext.js";
  4. import { g as Ee, a as ee } from "./statusUtils.js";
  5. import { B as ze } from "./BaseInput.js";
  6. import { u as Re } from "./index16.js";
  7. import { i as Te } from "./isPlainObject.js";
  8. const H = (e) => e != null && (Array.isArray(e) ? _e(e).length : !0);
  9. function ne(e) {
  10. return H(e.prefix) || H(e.suffix) || H(e.allowClear);
  11. }
  12. function q(e) {
  13. return H(e.addonBefore) || H(e.addonAfter);
  14. }
  15. function fe(e) {
  16. return typeof e == "undefined" || e === null ? "" : String(e);
  17. }
  18. function ce(e, v, t, a) {
  19. if (!t)
  20. return;
  21. const o = v;
  22. if (v.type === "click") {
  23. Object.defineProperty(o, "target", {
  24. writable: !0
  25. }), Object.defineProperty(o, "currentTarget", {
  26. writable: !0
  27. });
  28. const f = e.cloneNode(!0);
  29. o.target = f, o.currentTarget = f, f.value = "", t(o);
  30. return;
  31. }
  32. if (a !== void 0) {
  33. Object.defineProperty(o, "target", {
  34. writable: !0
  35. }), Object.defineProperty(o, "currentTarget", {
  36. writable: !0
  37. }), o.target = e, o.currentTarget = e, e.value = a, t(o);
  38. return;
  39. }
  40. t(o);
  41. }
  42. function ke(e, v) {
  43. if (!e) return;
  44. e.focus(v);
  45. const {
  46. cursor: t
  47. } = v || {};
  48. if (t) {
  49. const a = e.value.length;
  50. switch (t) {
  51. case "start":
  52. e.setSelectionRange(0, 0);
  53. break;
  54. case "end":
  55. e.setSelectionRange(a, a);
  56. break;
  57. default:
  58. e.setSelectionRange(0, a);
  59. }
  60. }
  61. }
  62. const Me = () => ({
  63. addonBefore: W.any,
  64. addonAfter: W.any,
  65. prefix: W.any,
  66. suffix: W.any,
  67. clearIcon: W.any,
  68. affixWrapperClassName: String,
  69. groupClassName: String,
  70. wrapperClassName: String,
  71. inputClassName: String,
  72. allowClear: {
  73. type: Boolean,
  74. default: void 0
  75. }
  76. }), ge = () => O(O({}, Me()), {
  77. value: {
  78. type: [String, Number, Symbol],
  79. default: void 0
  80. },
  81. defaultValue: {
  82. type: [String, Number, Symbol],
  83. default: void 0
  84. },
  85. inputElement: W.any,
  86. prefixCls: String,
  87. disabled: {
  88. type: Boolean,
  89. default: void 0
  90. },
  91. focused: {
  92. type: Boolean,
  93. default: void 0
  94. },
  95. triggerFocus: Function,
  96. readonly: {
  97. type: Boolean,
  98. default: void 0
  99. },
  100. handleReset: Function,
  101. hidden: {
  102. type: Boolean,
  103. default: void 0
  104. }
  105. }), ye = () => O(O({}, ge()), {
  106. id: String,
  107. placeholder: {
  108. type: [String, Number]
  109. },
  110. autocomplete: String,
  111. type: Se("text"),
  112. name: String,
  113. size: {
  114. type: String
  115. },
  116. autofocus: {
  117. type: Boolean,
  118. default: void 0
  119. },
  120. lazy: {
  121. type: Boolean,
  122. default: !0
  123. },
  124. maxlength: Number,
  125. loading: {
  126. type: Boolean,
  127. default: void 0
  128. },
  129. bordered: {
  130. type: Boolean,
  131. default: void 0
  132. },
  133. showCount: {
  134. type: [Boolean, Object]
  135. },
  136. htmlSize: Number,
  137. onPressEnter: Function,
  138. onKeydown: Function,
  139. onKeyup: Function,
  140. onFocus: Function,
  141. onBlur: Function,
  142. onChange: Function,
  143. onInput: Function,
  144. "onUpdate:value": Function,
  145. onCompositionstart: Function,
  146. onCompositionend: Function,
  147. valueModifiers: Object,
  148. hidden: {
  149. type: Boolean,
  150. default: void 0
  151. },
  152. status: String
  153. }), Ve = X({
  154. name: "BaseInput",
  155. inheritAttrs: !1,
  156. props: ge(),
  157. setup(e, v) {
  158. let {
  159. slots: t,
  160. attrs: a
  161. } = v;
  162. const o = te(), f = (m) => {
  163. var c;
  164. if (!((c = o.value) === null || c === void 0) && c.contains(m.target)) {
  165. const {
  166. triggerFocus: S
  167. } = e;
  168. S == null || S();
  169. }
  170. }, d = () => {
  171. var m;
  172. const {
  173. allowClear: c,
  174. value: S,
  175. disabled: b,
  176. readonly: P,
  177. handleReset: $,
  178. suffix: T = t.suffix,
  179. prefixCls: F
  180. } = e;
  181. if (!c)
  182. return null;
  183. const N = !b && !P && S, p = `${F}-clear-icon`, A = ((m = t.clearIcon) === null || m === void 0 ? void 0 : m.call(t)) || "*";
  184. return g("span", {
  185. onClick: $,
  186. onMousedown: (x) => x.preventDefault(),
  187. class: z({
  188. [`${p}-hidden`]: !N,
  189. [`${p}-has-suffix`]: !!T
  190. }, p),
  191. role: "button",
  192. tabindex: -1
  193. }, [A]);
  194. };
  195. return () => {
  196. var m, c;
  197. const {
  198. focused: S,
  199. value: b,
  200. disabled: P,
  201. allowClear: $,
  202. readonly: T,
  203. hidden: F,
  204. prefixCls: N,
  205. prefix: p = (m = t.prefix) === null || m === void 0 ? void 0 : m.call(t),
  206. suffix: A = (c = t.suffix) === null || c === void 0 ? void 0 : c.call(t),
  207. addonAfter: x = t.addonAfter,
  208. addonBefore: B = t.addonBefore,
  209. inputElement: V,
  210. affixWrapperClassName: r,
  211. wrapperClassName: C,
  212. groupClassName: n
  213. } = e;
  214. let i = Q(V, {
  215. value: b,
  216. hidden: F
  217. });
  218. if (ne({
  219. prefix: p,
  220. suffix: A,
  221. allowClear: $
  222. })) {
  223. const u = `${N}-affix-wrapper`, y = z(u, {
  224. [`${u}-disabled`]: P,
  225. [`${u}-focused`]: S,
  226. [`${u}-readonly`]: T,
  227. [`${u}-input-with-clear-btn`]: A && $ && b
  228. }, !q({
  229. addonAfter: x,
  230. addonBefore: B
  231. }) && a.class, r), I = (A || $) && g("span", {
  232. class: `${N}-suffix`
  233. }, [d(), A]);
  234. i = g("span", {
  235. class: y,
  236. style: a.style,
  237. hidden: !q({
  238. addonAfter: x,
  239. addonBefore: B
  240. }) && F,
  241. onMousedown: f,
  242. ref: o
  243. }, [p && g("span", {
  244. class: `${N}-prefix`
  245. }, [p]), Q(V, {
  246. style: null,
  247. value: b,
  248. hidden: null
  249. }), I]);
  250. }
  251. if (q({
  252. addonAfter: x,
  253. addonBefore: B
  254. })) {
  255. const u = `${N}-group`, y = `${u}-addon`, I = z(`${N}-wrapper`, u, C), k = z(`${N}-group-wrapper`, a.class, n);
  256. return g("span", {
  257. class: k,
  258. style: a.style,
  259. hidden: F
  260. }, [g("span", {
  261. class: I
  262. }, [B && g("span", {
  263. class: y
  264. }, [B]), Q(i, {
  265. style: null,
  266. hidden: null
  267. }), x && g("span", {
  268. class: y
  269. }, [x])])]);
  270. }
  271. return i;
  272. };
  273. }
  274. });
  275. var De = function(e, v) {
  276. var t = {};
  277. for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && v.indexOf(a) < 0 && (t[a] = e[a]);
  278. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, a = Object.getOwnPropertySymbols(e); o < a.length; o++)
  279. v.indexOf(a[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[o]) && (t[a[o]] = e[a[o]]);
  280. return t;
  281. };
  282. const We = X({
  283. name: "VCInput",
  284. inheritAttrs: !1,
  285. props: ye(),
  286. setup(e, v) {
  287. let {
  288. slots: t,
  289. attrs: a,
  290. expose: o,
  291. emit: f
  292. } = v;
  293. const d = K(e.value === void 0 ? e.defaultValue : e.value), m = K(!1), c = K(), S = K();
  294. se(() => e.value, () => {
  295. d.value = e.value;
  296. }), se(() => e.disabled, () => {
  297. e.disabled && (m.value = !1);
  298. });
  299. const b = (n) => {
  300. c.value && ke(c.value.input, n);
  301. }, P = () => {
  302. var n;
  303. (n = c.value.input) === null || n === void 0 || n.blur();
  304. }, $ = (n, i, u) => {
  305. var y;
  306. (y = c.value.input) === null || y === void 0 || y.setSelectionRange(n, i, u);
  307. }, T = () => {
  308. var n;
  309. (n = c.value.input) === null || n === void 0 || n.select();
  310. };
  311. o({
  312. focus: b,
  313. blur: P,
  314. input: J(() => {
  315. var n;
  316. return (n = c.value.input) === null || n === void 0 ? void 0 : n.input;
  317. }),
  318. stateValue: d,
  319. setSelectionRange: $,
  320. select: T
  321. });
  322. const F = (n) => {
  323. f("change", n);
  324. }, N = (n, i) => {
  325. d.value !== n && (e.value === void 0 ? d.value = n : ie(() => {
  326. var u;
  327. c.value.input.value !== d.value && ((u = S.value) === null || u === void 0 || u.$forceUpdate());
  328. }), ie(() => {
  329. i && i();
  330. }));
  331. }, p = (n) => {
  332. const {
  333. value: i
  334. } = n.target;
  335. if (d.value === i) return;
  336. const u = n.target.value;
  337. ce(c.value.input, n, F), N(u);
  338. }, A = (n) => {
  339. n.keyCode === 13 && f("pressEnter", n), f("keydown", n);
  340. }, x = (n) => {
  341. m.value = !0, f("focus", n);
  342. }, B = (n) => {
  343. m.value = !1, f("blur", n);
  344. }, V = (n) => {
  345. ce(c.value.input, n, F), N("", () => {
  346. b();
  347. });
  348. }, r = () => {
  349. var n, i;
  350. const {
  351. addonBefore: u = t.addonBefore,
  352. addonAfter: y = t.addonAfter,
  353. disabled: I,
  354. valueModifiers: k = {},
  355. htmlSize: l,
  356. autocomplete: s,
  357. prefixCls: h,
  358. inputClassName: w,
  359. prefix: j = (n = t.prefix) === null || n === void 0 ? void 0 : n.call(t),
  360. suffix: E = (i = t.suffix) === null || i === void 0 ? void 0 : i.call(t),
  361. allowClear: R,
  362. type: G = "text"
  363. } = e, U = L(e, [
  364. "prefixCls",
  365. "onPressEnter",
  366. "addonBefore",
  367. "addonAfter",
  368. "prefix",
  369. "suffix",
  370. "allowClear",
  371. // Input elements must be either controlled or uncontrolled,
  372. // specify either the value prop, or the defaultValue prop, but not both.
  373. "defaultValue",
  374. "size",
  375. "bordered",
  376. "htmlSize",
  377. "lazy",
  378. "showCount",
  379. "valueModifiers",
  380. "showCount",
  381. "affixWrapperClassName",
  382. "groupClassName",
  383. "inputClassName",
  384. "wrapperClassName"
  385. ]), D = O(O(O({}, U), a), {
  386. autocomplete: s,
  387. onChange: p,
  388. onInput: p,
  389. onFocus: x,
  390. onBlur: B,
  391. onKeydown: A,
  392. class: z(h, {
  393. [`${h}-disabled`]: I
  394. }, w, !q({
  395. addonAfter: y,
  396. addonBefore: u
  397. }) && !ne({
  398. prefix: j,
  399. suffix: E,
  400. allowClear: R
  401. }) && a.class),
  402. ref: c,
  403. key: "ant-input",
  404. size: l,
  405. type: G,
  406. lazy: e.lazy
  407. });
  408. return k.lazy && delete D.onInput, D.autofocus || delete D.autofocus, g(ze, L(D, ["size"]), null);
  409. }, C = () => {
  410. var n;
  411. const {
  412. maxlength: i,
  413. suffix: u = (n = t.suffix) === null || n === void 0 ? void 0 : n.call(t),
  414. showCount: y,
  415. prefixCls: I
  416. } = e, k = Number(i) > 0;
  417. if (u || y) {
  418. const l = [...fe(d.value)].length, s = typeof y == "object" ? y.formatter({
  419. count: l,
  420. maxlength: i
  421. }) : `${l}${k ? ` / ${i}` : ""}`;
  422. return g(me, null, [!!y && g("span", {
  423. class: z(`${I}-show-count-suffix`, {
  424. [`${I}-show-count-has-suffix`]: !!u
  425. })
  426. }, [s]), u]);
  427. }
  428. return null;
  429. };
  430. return ve(() => {
  431. process.env.NODE_ENV === "test" && e.autofocus && b();
  432. }), () => {
  433. const {
  434. prefixCls: n,
  435. disabled: i
  436. } = e, u = De(e, ["prefixCls", "disabled"]);
  437. return g(Ve, M(M(M({}, u), a), {}, {
  438. ref: S,
  439. prefixCls: n,
  440. inputElement: r(),
  441. handleReset: V,
  442. value: fe(d.value),
  443. focused: m.value,
  444. triggerFocus: b,
  445. suffix: C(),
  446. disabled: i
  447. }), t);
  448. };
  449. }
  450. }), ae = () => L(ye(), ["wrapperClassName", "groupClassName", "inputClassName", "affixWrapperClassName"]), Ze = () => O(O({}, L(ae(), ["prefix", "addonBefore", "addonAfter", "suffix"])), {
  451. rows: Number,
  452. autosize: {
  453. type: [Boolean, Object],
  454. default: void 0
  455. },
  456. autoSize: {
  457. type: [Boolean, Object],
  458. default: void 0
  459. },
  460. onResize: {
  461. type: Function
  462. },
  463. onCompositionstart: re(),
  464. onCompositionend: re(),
  465. valueModifiers: Object
  466. });
  467. var Ue = function(e, v) {
  468. var t = {};
  469. for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && v.indexOf(a) < 0 && (t[a] = e[a]);
  470. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, a = Object.getOwnPropertySymbols(e); o < a.length; o++)
  471. v.indexOf(a[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[o]) && (t[a[o]] = e[a[o]]);
  472. return t;
  473. };
  474. const Ke = X({
  475. compatConfig: {
  476. MODE: 3
  477. },
  478. name: "AInput",
  479. inheritAttrs: !1,
  480. props: ae(),
  481. setup(e, v) {
  482. let {
  483. slots: t,
  484. attrs: a,
  485. expose: o,
  486. emit: f
  487. } = v;
  488. const d = te(), m = Ae(), c = je.useInject(), S = J(() => Ee(c.status, e.status)), {
  489. direction: b,
  490. prefixCls: P,
  491. size: $,
  492. autocomplete: T
  493. } = pe("input", e), {
  494. compactSize: F,
  495. compactItemClassnames: N
  496. } = Ne(P, b), p = J(() => F.value || $.value), [A, x] = Re(P), B = Be();
  497. o({
  498. focus: (l) => {
  499. var s;
  500. (s = d.value) === null || s === void 0 || s.focus(l);
  501. },
  502. blur: () => {
  503. var l;
  504. (l = d.value) === null || l === void 0 || l.blur();
  505. },
  506. input: d,
  507. setSelectionRange: (l, s, h) => {
  508. var w;
  509. (w = d.value) === null || w === void 0 || w.setSelectionRange(l, s, h);
  510. },
  511. select: () => {
  512. var l;
  513. (l = d.value) === null || l === void 0 || l.select();
  514. }
  515. });
  516. const i = te([]), u = () => {
  517. i.value.push(setTimeout(() => {
  518. var l, s, h, w;
  519. !((l = d.value) === null || l === void 0) && l.input && ((s = d.value) === null || s === void 0 ? void 0 : s.input.getAttribute("type")) === "password" && (!((h = d.value) === null || h === void 0) && h.input.hasAttribute("value")) && ((w = d.value) === null || w === void 0 || w.input.removeAttribute("value"));
  520. }));
  521. };
  522. ve(() => {
  523. u();
  524. }), Pe(() => {
  525. i.value.forEach((l) => clearTimeout(l));
  526. }), Fe(() => {
  527. i.value.forEach((l) => clearTimeout(l));
  528. });
  529. const y = (l) => {
  530. u(), f("blur", l), m.onFieldBlur();
  531. }, I = (l) => {
  532. u(), f("focus", l);
  533. }, k = (l) => {
  534. f("update:value", l.target.value), f("change", l), f("input", l), m.onFieldChange();
  535. };
  536. return () => {
  537. var l, s, h, w, j, E;
  538. const {
  539. hasFeedback: R,
  540. feedbackIcon: G
  541. } = c, {
  542. allowClear: U,
  543. bordered: D = !0,
  544. prefix: Y = (l = t.prefix) === null || l === void 0 ? void 0 : l.call(t),
  545. suffix: Z = (s = t.suffix) === null || s === void 0 ? void 0 : s.call(t),
  546. addonAfter: oe = (h = t.addonAfter) === null || h === void 0 ? void 0 : h.call(t),
  547. addonBefore: le = (w = t.addonBefore) === null || w === void 0 ? void 0 : w.call(t),
  548. id: be = (j = m.id) === null || j === void 0 ? void 0 : j.value
  549. } = e, xe = Ue(e, ["allowClear", "bordered", "prefix", "suffix", "addonAfter", "addonBefore", "id"]), Ce = (R || Z) && g(me, null, [Z, R && G]), _ = P.value, he = ne({
  550. prefix: Y,
  551. suffix: Z
  552. }) || !!R, we = t.clearIcon || (() => g(Oe, null, null));
  553. return A(g(We, M(M(M({}, a), L(xe, ["onUpdate:value", "onChange", "onInput"])), {}, {
  554. onChange: k,
  555. id: be,
  556. disabled: (E = e.disabled) !== null && E !== void 0 ? E : B.value,
  557. ref: d,
  558. prefixCls: _,
  559. autocomplete: T.value,
  560. onBlur: y,
  561. onFocus: I,
  562. prefix: Y,
  563. suffix: Ce,
  564. allowClear: U,
  565. addonAfter: oe && g(ue, null, {
  566. default: () => [g(de, null, {
  567. default: () => [oe]
  568. })]
  569. }),
  570. addonBefore: le && g(ue, null, {
  571. default: () => [g(de, null, {
  572. default: () => [le]
  573. })]
  574. }),
  575. class: [a.class, N.value],
  576. inputClassName: z({
  577. [`${_}-sm`]: p.value === "small",
  578. [`${_}-lg`]: p.value === "large",
  579. [`${_}-rtl`]: b.value === "rtl",
  580. [`${_}-borderless`]: !D
  581. }, !he && ee(_, S.value), x.value),
  582. affixWrapperClassName: z({
  583. [`${_}-affix-wrapper-sm`]: p.value === "small",
  584. [`${_}-affix-wrapper-lg`]: p.value === "large",
  585. [`${_}-affix-wrapper-rtl`]: b.value === "rtl",
  586. [`${_}-affix-wrapper-borderless`]: !D
  587. }, ee(`${_}-affix-wrapper`, S.value, R), x.value),
  588. wrapperClassName: z({
  589. [`${_}-group-rtl`]: b.value === "rtl"
  590. }, x.value),
  591. groupClassName: z({
  592. [`${_}-group-wrapper-sm`]: p.value === "small",
  593. [`${_}-group-wrapper-lg`]: p.value === "large",
  594. [`${_}-group-wrapper-rtl`]: b.value === "rtl"
  595. }, ee(`${_}-group-wrapper`, S.value, R), x.value)
  596. }), O(O({}, t), {
  597. clearIcon: we
  598. })));
  599. };
  600. }
  601. });
  602. var Le = function(e, v) {
  603. var t = {};
  604. for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && v.indexOf(a) < 0 && (t[a] = e[a]);
  605. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, a = Object.getOwnPropertySymbols(e); o < a.length; o++)
  606. v.indexOf(a[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[o]) && (t[a[o]] = e[a[o]]);
  607. return t;
  608. };
  609. const et = X({
  610. compatConfig: {
  611. MODE: 3
  612. },
  613. name: "AInputSearch",
  614. inheritAttrs: !1,
  615. props: O(O({}, ae()), {
  616. inputPrefixCls: String,
  617. // 不能设置默认值 https://github.com/vueComponent/ant-design-vue/issues/1916
  618. enterButton: W.any,
  619. onSearch: {
  620. type: Function
  621. }
  622. }),
  623. setup(e, v) {
  624. let {
  625. slots: t,
  626. attrs: a,
  627. expose: o,
  628. emit: f
  629. } = v;
  630. const d = K(), m = K(!1);
  631. o({
  632. focus: () => {
  633. var r;
  634. (r = d.value) === null || r === void 0 || r.focus();
  635. },
  636. blur: () => {
  637. var r;
  638. (r = d.value) === null || r === void 0 || r.blur();
  639. }
  640. });
  641. const b = (r) => {
  642. f("update:value", r.target.value), r && r.target && r.type === "click" && f("search", r.target.value, r), f("change", r);
  643. }, P = (r) => {
  644. var C;
  645. document.activeElement === ((C = d.value) === null || C === void 0 ? void 0 : C.input) && r.preventDefault();
  646. }, $ = (r) => {
  647. var C, n;
  648. f("search", (n = (C = d.value) === null || C === void 0 ? void 0 : C.input) === null || n === void 0 ? void 0 : n.stateValue, r);
  649. }, T = (r) => {
  650. m.value || e.loading || $(r);
  651. }, F = (r) => {
  652. m.value = !0, f("compositionstart", r);
  653. }, N = (r) => {
  654. m.value = !1, f("compositionend", r);
  655. }, {
  656. prefixCls: p,
  657. getPrefixCls: A,
  658. direction: x,
  659. size: B
  660. } = pe("input-search", e), V = J(() => A("input", e.inputPrefixCls));
  661. return () => {
  662. var r, C, n, i;
  663. const {
  664. disabled: u,
  665. loading: y,
  666. addonAfter: I = (r = t.addonAfter) === null || r === void 0 ? void 0 : r.call(t),
  667. suffix: k = (C = t.suffix) === null || C === void 0 ? void 0 : C.call(t)
  668. } = e, l = Le(e, ["disabled", "loading", "addonAfter", "suffix"]);
  669. let {
  670. enterButton: s = (i = (n = t.enterButton) === null || n === void 0 ? void 0 : n.call(t)) !== null && i !== void 0 ? i : !1
  671. } = e;
  672. s = s || s === "";
  673. const h = typeof s == "boolean" ? g($e, null, null) : null, w = `${p.value}-button`, j = Array.isArray(s) ? s[0] : s;
  674. let E;
  675. const R = j.type && Te(j.type) && j.type.__ANT_BUTTON;
  676. if (R || j.tagName === "button")
  677. E = Q(j, O({
  678. onMousedown: P,
  679. onClick: $,
  680. key: "enterButton"
  681. }, R ? {
  682. class: w,
  683. size: B.value
  684. } : {}), !1);
  685. else {
  686. const U = h && !s;
  687. E = g(Ie, {
  688. class: w,
  689. type: s ? "primary" : void 0,
  690. size: B.value,
  691. disabled: u,
  692. key: "enterButton",
  693. onMousedown: P,
  694. onClick: $,
  695. loading: y,
  696. icon: U ? h : null
  697. }, {
  698. default: () => [U ? null : h || s]
  699. });
  700. }
  701. I && (E = [E, I]);
  702. const G = z(p.value, {
  703. [`${p.value}-rtl`]: x.value === "rtl",
  704. [`${p.value}-${B.value}`]: !!B.value,
  705. [`${p.value}-with-button`]: !!s
  706. }, a.class);
  707. return g(Ke, M(M(M({
  708. ref: d
  709. }, L(l, ["onUpdate:value", "onSearch", "enterButton"])), a), {}, {
  710. onPressEnter: T,
  711. onCompositionstart: F,
  712. onCompositionend: N,
  713. size: B.value,
  714. prefixCls: V.value,
  715. addonAfter: E,
  716. suffix: k,
  717. onChange: b,
  718. class: G,
  719. disabled: u
  720. }), t);
  721. };
  722. }
  723. });
  724. export {
  725. Ke as I,
  726. et as _,
  727. ke as a,
  728. fe as f,
  729. ae as i,
  730. ce as r,
  731. Ze as t
  732. };