index-487cde8c.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. import { X as inject, G as onUnmounted, a as computed, r as ref, n as reactive, V as onDeactivated, Y as isRef, w as watch, o as onMounted, B as unref, g as getCurrentInstance, U as provide, z as nextTick, p as onActivated, Z as isVNode, d as defineComponent, c as createVNode, m as mergeProps } from "./index-5e4623ce.js";
  2. function noop() {
  3. }
  4. const extend = Object.assign;
  5. const inBrowser$1 = typeof window !== "undefined";
  6. const isObject = (val) => val !== null && typeof val === "object";
  7. const isDef = (val) => val !== void 0 && val !== null;
  8. const isFunction = (val) => typeof val === "function";
  9. const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
  10. const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
  11. const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
  12. const isIOS$1 = () => inBrowser$1 ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
  13. function get(object, path) {
  14. const keys = path.split(".");
  15. let result = object;
  16. keys.forEach((key) => {
  17. var _a;
  18. result = isObject(result) ? (_a = result[key]) != null ? _a : "" : "";
  19. });
  20. return result;
  21. }
  22. function pick(obj, keys, ignoreUndefined) {
  23. return keys.reduce(
  24. (ret, key) => {
  25. if (!ignoreUndefined || obj[key] !== void 0) {
  26. ret[key] = obj[key];
  27. }
  28. return ret;
  29. },
  30. {}
  31. );
  32. }
  33. const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
  34. const toArray = (item) => Array.isArray(item) ? item : [item];
  35. const unknownProp = null;
  36. const numericProp = [Number, String];
  37. const truthProp = {
  38. type: Boolean,
  39. default: true
  40. };
  41. const makeRequiredProp = (type) => ({
  42. type,
  43. required: true
  44. });
  45. const makeArrayProp = () => ({
  46. type: Array,
  47. default: () => []
  48. });
  49. const makeNumberProp = (defaultVal) => ({
  50. type: Number,
  51. default: defaultVal
  52. });
  53. const makeNumericProp = (defaultVal) => ({
  54. type: numericProp,
  55. default: defaultVal
  56. });
  57. const makeStringProp = (defaultVal) => ({
  58. type: String,
  59. default: defaultVal
  60. });
  61. var inBrowser = typeof window !== "undefined";
  62. var isWindow = (val) => val === window;
  63. var makeDOMRect = (width2, height2) => ({
  64. top: 0,
  65. left: 0,
  66. right: width2,
  67. bottom: height2,
  68. width: width2,
  69. height: height2
  70. });
  71. var useRect = (elementOrRef) => {
  72. const element = unref(elementOrRef);
  73. if (isWindow(element)) {
  74. const width2 = element.innerWidth;
  75. const height2 = element.innerHeight;
  76. return makeDOMRect(width2, height2);
  77. }
  78. if (element == null ? void 0 : element.getBoundingClientRect) {
  79. return element.getBoundingClientRect();
  80. }
  81. return makeDOMRect(0, 0);
  82. };
  83. function useParent(key) {
  84. const parent = inject(key, null);
  85. if (parent) {
  86. const instance = getCurrentInstance();
  87. const { link, unlink, internalChildren } = parent;
  88. link(instance);
  89. onUnmounted(() => unlink(instance));
  90. const index = computed(() => internalChildren.indexOf(instance));
  91. return {
  92. parent,
  93. index
  94. };
  95. }
  96. return {
  97. parent: null,
  98. index: ref(-1)
  99. };
  100. }
  101. function flattenVNodes(children) {
  102. const result = [];
  103. const traverse = (children2) => {
  104. if (Array.isArray(children2)) {
  105. children2.forEach((child) => {
  106. var _a;
  107. if (isVNode(child)) {
  108. result.push(child);
  109. if ((_a = child.component) == null ? void 0 : _a.subTree) {
  110. result.push(child.component.subTree);
  111. traverse(child.component.subTree.children);
  112. }
  113. if (child.children) {
  114. traverse(child.children);
  115. }
  116. }
  117. });
  118. }
  119. };
  120. traverse(children);
  121. return result;
  122. }
  123. var findVNodeIndex = (vnodes, vnode) => {
  124. const index = vnodes.indexOf(vnode);
  125. if (index === -1) {
  126. return vnodes.findIndex(
  127. (item) => vnode.key !== void 0 && vnode.key !== null && item.type === vnode.type && item.key === vnode.key
  128. );
  129. }
  130. return index;
  131. };
  132. function sortChildren(parent, publicChildren, internalChildren) {
  133. const vnodes = flattenVNodes(parent.subTree.children);
  134. internalChildren.sort(
  135. (a, b) => findVNodeIndex(vnodes, a.vnode) - findVNodeIndex(vnodes, b.vnode)
  136. );
  137. const orderedPublicChildren = internalChildren.map((item) => item.proxy);
  138. publicChildren.sort((a, b) => {
  139. const indexA = orderedPublicChildren.indexOf(a);
  140. const indexB = orderedPublicChildren.indexOf(b);
  141. return indexA - indexB;
  142. });
  143. }
  144. function useChildren(key) {
  145. const publicChildren = reactive([]);
  146. const internalChildren = reactive([]);
  147. const parent = getCurrentInstance();
  148. const linkChildren = (value) => {
  149. const link = (child) => {
  150. if (child.proxy) {
  151. internalChildren.push(child);
  152. publicChildren.push(child.proxy);
  153. sortChildren(parent, publicChildren, internalChildren);
  154. }
  155. };
  156. const unlink = (child) => {
  157. const index = internalChildren.indexOf(child);
  158. publicChildren.splice(index, 1);
  159. internalChildren.splice(index, 1);
  160. };
  161. provide(
  162. key,
  163. Object.assign(
  164. {
  165. link,
  166. unlink,
  167. children: publicChildren,
  168. internalChildren
  169. },
  170. value
  171. )
  172. );
  173. };
  174. return {
  175. children: publicChildren,
  176. linkChildren
  177. };
  178. }
  179. function onMountedOrActivated(hook) {
  180. let mounted;
  181. onMounted(() => {
  182. hook();
  183. nextTick(() => {
  184. mounted = true;
  185. });
  186. });
  187. onActivated(() => {
  188. if (mounted) {
  189. hook();
  190. }
  191. });
  192. }
  193. function useEventListener(type, listener, options = {}) {
  194. if (!inBrowser) {
  195. return;
  196. }
  197. const { target = window, passive = false, capture = false } = options;
  198. let cleaned = false;
  199. let attached;
  200. const add = (target2) => {
  201. if (cleaned) {
  202. return;
  203. }
  204. const element = unref(target2);
  205. if (element && !attached) {
  206. element.addEventListener(type, listener, {
  207. capture,
  208. passive
  209. });
  210. attached = true;
  211. }
  212. };
  213. const remove = (target2) => {
  214. if (cleaned) {
  215. return;
  216. }
  217. const element = unref(target2);
  218. if (element && attached) {
  219. element.removeEventListener(type, listener, capture);
  220. attached = false;
  221. }
  222. };
  223. onUnmounted(() => remove(target));
  224. onDeactivated(() => remove(target));
  225. onMountedOrActivated(() => add(target));
  226. let stopWatch;
  227. if (isRef(target)) {
  228. stopWatch = watch(target, (val, oldVal) => {
  229. remove(oldVal);
  230. add(val);
  231. });
  232. }
  233. return () => {
  234. stopWatch == null ? void 0 : stopWatch();
  235. remove(target);
  236. cleaned = true;
  237. };
  238. }
  239. function useClickAway(target, listener, options = {}) {
  240. if (!inBrowser) {
  241. return;
  242. }
  243. const { eventName = "click" } = options;
  244. const onClick = (event) => {
  245. const targets = Array.isArray(target) ? target : [target];
  246. const isClickAway = targets.every((item) => {
  247. const element = unref(item);
  248. return element && !element.contains(event.target);
  249. });
  250. if (isClickAway) {
  251. listener(event);
  252. }
  253. };
  254. useEventListener(eventName, onClick, { target: document });
  255. }
  256. var width;
  257. var height;
  258. function useWindowSize() {
  259. if (!width) {
  260. width = ref(0);
  261. height = ref(0);
  262. if (inBrowser) {
  263. const update = () => {
  264. width.value = window.innerWidth;
  265. height.value = window.innerHeight;
  266. };
  267. update();
  268. window.addEventListener("resize", update, { passive: true });
  269. window.addEventListener("orientationchange", update, { passive: true });
  270. }
  271. }
  272. return { width, height };
  273. }
  274. var overflowScrollReg = /scroll|auto|overlay/i;
  275. var defaultRoot = inBrowser ? window : void 0;
  276. function isElement(node) {
  277. const ELEMENT_NODE_TYPE = 1;
  278. return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE;
  279. }
  280. function getScrollParent(el, root = defaultRoot) {
  281. let node = el;
  282. while (node && node !== root && isElement(node)) {
  283. const { overflowY } = window.getComputedStyle(node);
  284. if (overflowScrollReg.test(overflowY)) {
  285. return node;
  286. }
  287. node = node.parentNode;
  288. }
  289. return root;
  290. }
  291. function useScrollParent(el, root = defaultRoot) {
  292. const scrollParent = ref();
  293. onMounted(() => {
  294. if (el.value) {
  295. scrollParent.value = getScrollParent(el.value, root);
  296. }
  297. });
  298. return scrollParent;
  299. }
  300. var CUSTOM_FIELD_INJECTION_KEY = Symbol("van-field");
  301. function useCustomFieldValue(customValue) {
  302. const field = inject(CUSTOM_FIELD_INJECTION_KEY, null);
  303. if (field && !field.customValue.value) {
  304. field.customValue.value = customValue;
  305. watch(customValue, () => {
  306. field.resetValidation();
  307. field.validateWithTrigger("onChange");
  308. });
  309. }
  310. }
  311. function getScrollTop(el) {
  312. const top = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
  313. return Math.max(top, 0);
  314. }
  315. function setScrollTop(el, value) {
  316. if ("scrollTop" in el) {
  317. el.scrollTop = value;
  318. } else {
  319. el.scrollTo(el.scrollX, value);
  320. }
  321. }
  322. function getRootScrollTop() {
  323. return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
  324. }
  325. function setRootScrollTop(value) {
  326. setScrollTop(window, value);
  327. setScrollTop(document.body, value);
  328. }
  329. const isIOS = isIOS$1();
  330. function resetScroll() {
  331. if (isIOS) {
  332. setRootScrollTop(getRootScrollTop());
  333. }
  334. }
  335. const stopPropagation = (event) => event.stopPropagation();
  336. function preventDefault(event, isStopPropagation) {
  337. if (typeof event.cancelable !== "boolean" || event.cancelable) {
  338. event.preventDefault();
  339. }
  340. if (isStopPropagation) {
  341. stopPropagation(event);
  342. }
  343. }
  344. const { width: windowWidth, height: windowHeight } = useWindowSize();
  345. function isContainingBlock(el) {
  346. const css = window.getComputedStyle(el);
  347. return css.transform !== "none" || css.perspective !== "none" || ["transform", "perspective", "filter"].some(
  348. (value) => (css.willChange || "").includes(value)
  349. );
  350. }
  351. function getContainingBlock(el) {
  352. let node = el.parentElement;
  353. while (node) {
  354. if (node && node.tagName !== "HTML" && node.tagName !== "BODY" && isContainingBlock(node)) {
  355. return node;
  356. }
  357. node = node.parentElement;
  358. }
  359. return null;
  360. }
  361. function addUnit(value) {
  362. if (isDef(value)) {
  363. return isNumeric(value) ? `${value}px` : String(value);
  364. }
  365. return void 0;
  366. }
  367. function getSizeStyle(originSize) {
  368. if (isDef(originSize)) {
  369. if (Array.isArray(originSize)) {
  370. return {
  371. width: addUnit(originSize[0]),
  372. height: addUnit(originSize[1])
  373. };
  374. }
  375. const size = addUnit(originSize);
  376. return {
  377. width: size,
  378. height: size
  379. };
  380. }
  381. }
  382. function getZIndexStyle(zIndex) {
  383. const style = {};
  384. if (zIndex !== void 0) {
  385. style.zIndex = +zIndex;
  386. }
  387. return style;
  388. }
  389. let rootFontSize;
  390. function getRootFontSize() {
  391. if (!rootFontSize) {
  392. const doc = document.documentElement;
  393. const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
  394. rootFontSize = parseFloat(fontSize);
  395. }
  396. return rootFontSize;
  397. }
  398. function convertRem(value) {
  399. value = value.replace(/rem/g, "");
  400. return +value * getRootFontSize();
  401. }
  402. function convertVw(value) {
  403. value = value.replace(/vw/g, "");
  404. return +value * windowWidth.value / 100;
  405. }
  406. function convertVh(value) {
  407. value = value.replace(/vh/g, "");
  408. return +value * windowHeight.value / 100;
  409. }
  410. function unitToPx(value) {
  411. if (typeof value === "number") {
  412. return value;
  413. }
  414. if (inBrowser$1) {
  415. if (value.includes("rem")) {
  416. return convertRem(value);
  417. }
  418. if (value.includes("vw")) {
  419. return convertVw(value);
  420. }
  421. if (value.includes("vh")) {
  422. return convertVh(value);
  423. }
  424. }
  425. return parseFloat(value);
  426. }
  427. const camelizeRE = /-(\w)/g;
  428. const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
  429. function padZero(num, targetLength = 2) {
  430. let str = num + "";
  431. while (str.length < targetLength) {
  432. str = "0" + str;
  433. }
  434. return str;
  435. }
  436. const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
  437. function trimExtraChar(value, char, regExp) {
  438. const index = value.indexOf(char);
  439. if (index === -1) {
  440. return value;
  441. }
  442. if (char === "-" && index !== 0) {
  443. return value.slice(0, index);
  444. }
  445. return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
  446. }
  447. function formatNumber(value, allowDot = true, allowMinus = true) {
  448. if (allowDot) {
  449. value = trimExtraChar(value, ".", /\./g);
  450. } else {
  451. value = value.split(".")[0];
  452. }
  453. if (allowMinus) {
  454. value = trimExtraChar(value, "-", /-/g);
  455. } else {
  456. value = value.replace(/-/, "");
  457. }
  458. const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
  459. return value.replace(regExp, "");
  460. }
  461. function addNumber(num1, num2) {
  462. const cardinal = 10 ** 10;
  463. return Math.round((num1 + num2) * cardinal) / cardinal;
  464. }
  465. const { hasOwnProperty } = Object.prototype;
  466. function assignKey(to, from, key) {
  467. const val = from[key];
  468. if (!isDef(val)) {
  469. return;
  470. }
  471. if (!hasOwnProperty.call(to, key) || !isObject(val)) {
  472. to[key] = val;
  473. } else {
  474. to[key] = deepAssign(Object(to[key]), val);
  475. }
  476. }
  477. function deepAssign(to, from) {
  478. Object.keys(from).forEach((key) => {
  479. assignKey(to, from, key);
  480. });
  481. return to;
  482. }
  483. var stdin_default$3 = {
  484. name: "姓名",
  485. tel: "电话",
  486. save: "保存",
  487. clear: "清空",
  488. cancel: "取消",
  489. confirm: "确认",
  490. delete: "删除",
  491. loading: "加载中...",
  492. noCoupon: "暂无优惠券",
  493. nameEmpty: "请填写姓名",
  494. addContact: "添加联系人",
  495. telInvalid: "请填写正确的电话",
  496. vanCalendar: {
  497. end: "结束",
  498. start: "开始",
  499. title: "日期选择",
  500. weekdays: ["日", "一", "二", "三", "四", "五", "六"],
  501. monthTitle: (year, month) => `${year}年${month}月`,
  502. rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
  503. },
  504. vanCascader: {
  505. select: "请选择"
  506. },
  507. vanPagination: {
  508. prev: "上一页",
  509. next: "下一页"
  510. },
  511. vanPullRefresh: {
  512. pulling: "下拉即可刷新...",
  513. loosing: "释放即可刷新..."
  514. },
  515. vanSubmitBar: {
  516. label: "合计:"
  517. },
  518. vanCoupon: {
  519. unlimited: "无门槛",
  520. discount: (discount) => `${discount}折`,
  521. condition: (condition) => `满${condition}元可用`
  522. },
  523. vanCouponCell: {
  524. title: "优惠券",
  525. count: (count) => `${count}张可用`
  526. },
  527. vanCouponList: {
  528. exchange: "兑换",
  529. close: "不使用",
  530. enable: "可用",
  531. disabled: "不可用",
  532. placeholder: "输入优惠码"
  533. },
  534. vanAddressEdit: {
  535. area: "地区",
  536. areaEmpty: "请选择地区",
  537. addressEmpty: "请填写详细地址",
  538. addressDetail: "详细地址",
  539. defaultAddress: "设为默认收货地址"
  540. },
  541. vanAddressList: {
  542. add: "新增地址"
  543. }
  544. };
  545. const lang = ref("zh-CN");
  546. const messages = reactive({
  547. "zh-CN": stdin_default$3
  548. });
  549. const Locale = {
  550. messages() {
  551. return messages[lang.value];
  552. },
  553. use(newLang, newMessages) {
  554. lang.value = newLang;
  555. this.add({ [newLang]: newMessages });
  556. },
  557. add(newMessages = {}) {
  558. deepAssign(messages, newMessages);
  559. }
  560. };
  561. var stdin_default$2 = Locale;
  562. function createTranslate(name2) {
  563. const prefix = camelize(name2) + ".";
  564. return (path, ...args) => {
  565. const messages2 = stdin_default$2.messages();
  566. const message = get(messages2, prefix + path) || get(messages2, path);
  567. return isFunction(message) ? message(...args) : message;
  568. };
  569. }
  570. function genBem(name2, mods) {
  571. if (!mods) {
  572. return "";
  573. }
  574. if (typeof mods === "string") {
  575. return ` ${name2}--${mods}`;
  576. }
  577. if (Array.isArray(mods)) {
  578. return mods.reduce(
  579. (ret, item) => ret + genBem(name2, item),
  580. ""
  581. );
  582. }
  583. return Object.keys(mods).reduce(
  584. (ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
  585. ""
  586. );
  587. }
  588. function createBEM(name2) {
  589. return (el, mods) => {
  590. if (el && typeof el !== "string") {
  591. mods = el;
  592. el = "";
  593. }
  594. el = el ? `${name2}__${el}` : name2;
  595. return `${el}${genBem(el, mods)}`;
  596. };
  597. }
  598. function createNamespace(name2) {
  599. const prefixedName = `van-${name2}`;
  600. return [
  601. prefixedName,
  602. createBEM(prefixedName),
  603. createTranslate(prefixedName)
  604. ];
  605. }
  606. const BORDER = "van-hairline";
  607. const BORDER_TOP = `${BORDER}--top`;
  608. const BORDER_LEFT = `${BORDER}--left`;
  609. const BORDER_BOTTOM = `${BORDER}--bottom`;
  610. const BORDER_SURROUND = `${BORDER}--surround`;
  611. const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
  612. const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
  613. const HAPTICS_FEEDBACK = "van-haptics-feedback";
  614. const FORM_KEY = Symbol("van-form");
  615. const LONG_PRESS_START_TIME = 500;
  616. const TAP_OFFSET = 5;
  617. function withInstall(options) {
  618. options.install = (app) => {
  619. const { name: name2 } = options;
  620. if (name2) {
  621. app.component(name2, options);
  622. app.component(camelize(`-${name2}`), options);
  623. }
  624. };
  625. return options;
  626. }
  627. const [name$2, bem$2] = createNamespace("badge");
  628. const badgeProps = {
  629. dot: Boolean,
  630. max: numericProp,
  631. tag: makeStringProp("div"),
  632. color: String,
  633. offset: Array,
  634. content: numericProp,
  635. showZero: truthProp,
  636. position: makeStringProp("top-right")
  637. };
  638. var stdin_default$1 = defineComponent({
  639. name: name$2,
  640. props: badgeProps,
  641. setup(props, {
  642. slots
  643. }) {
  644. const hasContent = () => {
  645. if (slots.content) {
  646. return true;
  647. }
  648. const {
  649. content,
  650. showZero
  651. } = props;
  652. return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0");
  653. };
  654. const renderContent = () => {
  655. const {
  656. dot,
  657. max,
  658. content
  659. } = props;
  660. if (!dot && hasContent()) {
  661. if (slots.content) {
  662. return slots.content();
  663. }
  664. if (isDef(max) && isNumeric(content) && +content > +max) {
  665. return `${max}+`;
  666. }
  667. return content;
  668. }
  669. };
  670. const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`;
  671. const style = computed(() => {
  672. const style2 = {
  673. background: props.color
  674. };
  675. if (props.offset) {
  676. const [x, y] = props.offset;
  677. const {
  678. position
  679. } = props;
  680. const [offsetY, offsetX] = position.split("-");
  681. if (slots.default) {
  682. if (typeof y === "number") {
  683. style2[offsetY] = addUnit(offsetY === "top" ? y : -y);
  684. } else {
  685. style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y);
  686. }
  687. if (typeof x === "number") {
  688. style2[offsetX] = addUnit(offsetX === "left" ? x : -x);
  689. } else {
  690. style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x);
  691. }
  692. } else {
  693. style2.marginTop = addUnit(y);
  694. style2.marginLeft = addUnit(x);
  695. }
  696. }
  697. return style2;
  698. });
  699. const renderBadge = () => {
  700. if (hasContent() || props.dot) {
  701. return createVNode("div", {
  702. "class": bem$2([props.position, {
  703. dot: props.dot,
  704. fixed: !!slots.default
  705. }]),
  706. "style": style.value
  707. }, [renderContent()]);
  708. }
  709. };
  710. return () => {
  711. if (slots.default) {
  712. const {
  713. tag
  714. } = props;
  715. return createVNode(tag, {
  716. "class": bem$2("wrapper")
  717. }, {
  718. default: () => [slots.default(), renderBadge()]
  719. });
  720. }
  721. return renderBadge();
  722. };
  723. }
  724. });
  725. const Badge = withInstall(stdin_default$1);
  726. const [name$1, bem$1] = createNamespace("config-provider");
  727. const CONFIG_PROVIDER_KEY = Symbol(name$1);
  728. const [name, bem] = createNamespace("icon");
  729. const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
  730. const iconProps = {
  731. dot: Boolean,
  732. tag: makeStringProp("i"),
  733. name: String,
  734. size: numericProp,
  735. badge: numericProp,
  736. color: String,
  737. badgeProps: Object,
  738. classPrefix: String
  739. };
  740. var stdin_default = defineComponent({
  741. name,
  742. props: iconProps,
  743. setup(props, {
  744. slots
  745. }) {
  746. const config = inject(CONFIG_PROVIDER_KEY, null);
  747. const classPrefix = computed(() => props.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem());
  748. return () => {
  749. const {
  750. tag,
  751. dot,
  752. name: name2,
  753. size,
  754. badge,
  755. color
  756. } = props;
  757. const isImageIcon = isImage(name2);
  758. return createVNode(Badge, mergeProps({
  759. "dot": dot,
  760. "tag": tag,
  761. "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
  762. "style": {
  763. color,
  764. fontSize: addUnit(size)
  765. },
  766. "content": badge
  767. }, props.badgeProps), {
  768. default: () => {
  769. var _a;
  770. return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && createVNode("img", {
  771. "class": bem("image"),
  772. "src": name2
  773. }, null)];
  774. }
  775. });
  776. };
  777. }
  778. });
  779. const Icon = withInstall(stdin_default);
  780. export {
  781. toArray as $,
  782. useScrollParent as A,
  783. BORDER_TOP_BOTTOM as B,
  784. useClickAway as C,
  785. useEventListener as D,
  786. useRect as E,
  787. windowHeight as F,
  788. unknownProp as G,
  789. HAPTICS_FEEDBACK as H,
  790. Icon as I,
  791. getContainingBlock as J,
  792. BORDER_BOTTOM as K,
  793. LONG_PRESS_START_TIME as L,
  794. makeRequiredProp as M,
  795. inBrowser$1 as N,
  796. windowWidth as O,
  797. getScrollTop as P,
  798. noop as Q,
  799. isFunction as R,
  800. BORDER_LEFT as S,
  801. BORDER_TOP as T,
  802. unitToPx as U,
  803. BORDER_UNSET_TOP_BOTTOM as V,
  804. FORM_KEY as W,
  805. getRootScrollTop as X,
  806. setRootScrollTop as Y,
  807. isPromise as Z,
  808. CUSTOM_FIELD_INJECTION_KEY as _,
  809. useParent as a,
  810. getScrollParent as a0,
  811. makeNumberProp as a1,
  812. BORDER_SURROUND as a2,
  813. TAP_OFFSET as a3,
  814. onMountedOrActivated as a4,
  815. Badge as b,
  816. createNamespace as c,
  817. addUnit as d,
  818. extend as e,
  819. getSizeStyle as f,
  820. getZIndexStyle as g,
  821. useCustomFieldValue as h,
  822. isObject as i,
  823. formatNumber as j,
  824. isDef as k,
  825. addNumber as l,
  826. makeNumericProp as m,
  827. numericProp as n,
  828. makeArrayProp as o,
  829. preventDefault as p,
  830. padZero as q,
  831. resetScroll as r,
  832. clamp as s,
  833. truthProp as t,
  834. useChildren as u,
  835. isDate as v,
  836. withInstall as w,
  837. isSameValue as x,
  838. pick as y,
  839. makeStringProp as z
  840. };