vant 3.4.8 → 3.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/changelog.generated.md +31 -39
  2. package/es/empty/Empty.js +10 -13
  3. package/es/empty/Images.d.ts +4 -0
  4. package/es/empty/Images.js +271 -0
  5. package/es/field/Field.js +6 -3
  6. package/es/field/types.d.ts +1 -1
  7. package/es/form/Form.d.ts +13 -13
  8. package/es/form/Form.js +6 -3
  9. package/es/form/index.d.ts +9 -9
  10. package/es/index.d.ts +1 -1
  11. package/es/index.js +1 -1
  12. package/es/loading/Loading.js +3 -1
  13. package/es/uploader/Uploader.js +2 -2
  14. package/es/uploader/utils.d.ts +0 -1
  15. package/es/uploader/utils.js +2 -4
  16. package/es/utils/basic.d.ts +1 -0
  17. package/es/utils/basic.js +3 -1
  18. package/lib/empty/Empty.js +10 -13
  19. package/lib/empty/Images.d.ts +4 -0
  20. package/lib/empty/Images.js +290 -0
  21. package/lib/field/Field.js +5 -2
  22. package/lib/field/types.d.ts +1 -1
  23. package/lib/form/Form.d.ts +13 -13
  24. package/lib/form/Form.js +5 -2
  25. package/lib/form/index.d.ts +9 -9
  26. package/lib/index.d.ts +1 -1
  27. package/lib/index.js +1 -1
  28. package/lib/loading/Loading.js +3 -1
  29. package/lib/uploader/Uploader.js +1 -1
  30. package/lib/uploader/utils.d.ts +0 -1
  31. package/lib/uploader/utils.js +2 -4
  32. package/lib/utils/basic.d.ts +1 -0
  33. package/lib/utils/basic.js +3 -1
  34. package/lib/vant.cjs.js +233 -49
  35. package/lib/vant.cjs.min.js +1 -1
  36. package/lib/vant.es.js +233 -49
  37. package/lib/vant.es.min.js +233 -49
  38. package/lib/vant.js +233 -49
  39. package/lib/vant.min.js +1 -1
  40. package/package.json +1 -1
  41. package/vetur/attributes.json +276 -276
  42. package/vetur/tags.json +90 -90
  43. package/vetur/web-types.json +1070 -1070
  44. package/es/empty/Network.d.ts +0 -1
  45. package/es/empty/Network.js +0 -89
  46. package/lib/empty/Network.d.ts +0 -1
  47. package/lib/empty/Network.js +0 -108
package/lib/vant.cjs.js CHANGED
@@ -25,6 +25,7 @@ function pick(obj, keys, ignoreUndefined) {
25
25
  return ret;
26
26
  }, {});
27
27
  }
28
+ const toArray = (item) => Array.isArray(item) ? item : [item];
28
29
  const unknownProp = null;
29
30
  const numericProp = [Number, String];
30
31
  const truthProp = {
@@ -317,10 +318,10 @@ const Locale = {
317
318
  };
318
319
  var stdin_default$1C = Locale;
319
320
  function createTranslate(name2) {
320
- const prefix2 = camelize(name2) + ".";
321
+ const prefix = camelize(name2) + ".";
321
322
  return (path, ...args) => {
322
323
  const messages2 = stdin_default$1C.messages();
323
- const message = get(messages2, prefix2 + path) || get(messages2, path);
324
+ const message = get(messages2, prefix + path) || get(messages2, path);
324
325
  return isFunction(message) ? message(...args) : message;
325
326
  };
326
327
  }
@@ -677,7 +678,9 @@ var stdin_default$1x = vue.defineComponent({
677
678
  return vue.createVNode("div", {
678
679
  "class": bem$1m([type, {
679
680
  vertical
680
- }])
681
+ }]),
682
+ "aria-live": "polite",
683
+ "aria-busy": true
681
684
  }, [vue.createVNode("span", {
682
685
  "class": bem$1m("spinner", type),
683
686
  "style": spinnerStyle.value
@@ -2334,9 +2337,12 @@ const formProps = {
2334
2337
  scrollToError: Boolean,
2335
2338
  validateFirst: Boolean,
2336
2339
  submitOnEnter: truthProp,
2337
- validateTrigger: makeStringProp("onBlur"),
2338
2340
  showErrorMessage: truthProp,
2339
- errorMessageAlign: String
2341
+ errorMessageAlign: String,
2342
+ validateTrigger: {
2343
+ type: [String, Array],
2344
+ default: "onBlur"
2345
+ }
2340
2346
  };
2341
2347
  var stdin_default$1m = vue.defineComponent({
2342
2348
  name: name$1f,
@@ -2549,7 +2555,7 @@ function cutString(str, maxlength) {
2549
2555
  return [...str].slice(0, maxlength).join("");
2550
2556
  }
2551
2557
  let current = 0;
2552
- function useId() {
2558
+ function useId$1() {
2553
2559
  const vm = vue.getCurrentInstance();
2554
2560
  const { name: name2 = "unknown" } = (vm == null ? void 0 : vm.type) || {};
2555
2561
  return `${name2}-${++current}`;
@@ -2609,7 +2615,7 @@ var stdin_default$1l = vue.defineComponent({
2609
2615
  emit,
2610
2616
  slots
2611
2617
  }) {
2612
- const id = useId();
2618
+ const id = useId$1();
2613
2619
  const state = vue.reactive({
2614
2620
  focused: false,
2615
2621
  validateFailed: false,
@@ -2699,10 +2705,13 @@ var stdin_default$1l = vue.defineComponent({
2699
2705
  });
2700
2706
  const validateWithTrigger = (trigger) => {
2701
2707
  if (form && props.rules) {
2702
- const defaultTrigger = form.props.validateTrigger === trigger;
2708
+ const {
2709
+ validateTrigger
2710
+ } = form.props;
2711
+ const defaultTrigger = toArray(validateTrigger).includes(trigger);
2703
2712
  const rules = props.rules.filter((rule) => {
2704
2713
  if (rule.trigger) {
2705
- return rule.trigger === trigger;
2714
+ return toArray(rule.trigger).includes(trigger);
2706
2715
  }
2707
2716
  return defaultTrigger;
2708
2717
  });
@@ -5940,7 +5949,7 @@ var stdin_default$10 = vue.defineComponent({
5940
5949
  const root = vue.ref();
5941
5950
  const navRef = vue.ref();
5942
5951
  const wrapRef = vue.ref();
5943
- const id = useId();
5952
+ const id = useId$1();
5944
5953
  const scroller = use.useScrollParent(root);
5945
5954
  const [titleRefs, setTitleRefs] = useRefs();
5946
5955
  const {
@@ -6330,7 +6339,7 @@ var stdin_default$_ = vue.defineComponent({
6330
6339
  setup(props, {
6331
6340
  slots
6332
6341
  }) {
6333
- const id = useId();
6342
+ const id = useId$1();
6334
6343
  const inited = vue.ref(false);
6335
6344
  const {
6336
6345
  parent,
@@ -7701,31 +7710,78 @@ var stdin_default$L = vue.defineComponent({
7701
7710
  }
7702
7711
  });
7703
7712
  const CouponCell = withInstall(stdin_default$L);
7704
- const prefix = "van-empty-network-";
7713
+ const getId = (num) => `van-empty-${num}`;
7714
+ const useId = (num) => `url(#${getId(num)})`;
7705
7715
  const renderStop = (color, offset, opacity) => vue.createVNode("stop", {
7706
7716
  "stop-color": color,
7707
7717
  "offset": `${offset}%`,
7708
7718
  "stop-opacity": opacity
7709
7719
  }, null);
7710
- const Network = vue.createVNode("svg", {
7720
+ const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
7721
+ const renderShadow = (id) => [vue.createVNode("defs", null, [vue.createVNode("radialGradient", {
7722
+ "id": getId(id),
7723
+ "cx": "50%",
7724
+ "cy": "54%",
7725
+ "fx": "50%",
7726
+ "fy": "54%",
7727
+ "r": "297%",
7728
+ "gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)"
7729
+ }, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), vue.createVNode("ellipse", {
7730
+ "fill": useId(id),
7731
+ "opacity": ".8",
7732
+ "cx": "80",
7733
+ "cy": "140",
7734
+ "rx": "46",
7735
+ "ry": "8"
7736
+ }, null)];
7737
+ const renderBuilding = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
7738
+ "id": getId("a"),
7739
+ "x1": "64%",
7740
+ "y1": "100%",
7741
+ "x2": "64%"
7742
+ }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
7743
+ "opacity": ".8"
7744
+ }, [vue.createVNode("path", {
7745
+ "d": "M36 131V53H16v20H2v58h34z",
7746
+ "fill": useId("a")
7747
+ }, null), vue.createVNode("path", {
7748
+ "d": "M123 15h22v14h9v77h-31V15z",
7749
+ "fill": useId("a")
7750
+ }, null)])];
7751
+ const renderCloud = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
7752
+ "id": getId("b"),
7753
+ "x1": "64%",
7754
+ "y1": "97%",
7755
+ "x2": "64%",
7756
+ "y2": "0%"
7757
+ }, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
7758
+ "opacity": ".8"
7759
+ }, [vue.createVNode("path", {
7760
+ "d": "M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",
7761
+ "fill": useId("b")
7762
+ }, null), vue.createVNode("path", {
7763
+ "d": "M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",
7764
+ "fill": useId("b")
7765
+ }, null)])];
7766
+ const renderNetwork = () => vue.createVNode("svg", {
7711
7767
  "viewBox": "0 0 160 160"
7712
7768
  }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
7713
- "id": `${prefix}1`,
7769
+ "id": getId(1),
7714
7770
  "x1": "64%",
7715
7771
  "y1": "100%",
7716
7772
  "x2": "64%"
7717
7773
  }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), vue.createVNode("linearGradient", {
7718
- "id": `${prefix}2`,
7774
+ "id": getId(2),
7719
7775
  "x1": "50%",
7720
7776
  "x2": "50%",
7721
7777
  "y2": "84%"
7722
7778
  }, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), vue.createVNode("linearGradient", {
7723
- "id": `${prefix}3`,
7779
+ "id": getId(3),
7724
7780
  "x1": "100%",
7725
7781
  "x2": "100%",
7726
7782
  "y2": "100%"
7727
- }, [renderStop("#EAEDF0", 0), renderStop("#DCDEE0", 100)]), vue.createVNode("radialGradient", {
7728
- "id": `${prefix}4`,
7783
+ }, [renderStops("#EAEDF0", "#DCDEE0")]), vue.createVNode("radialGradient", {
7784
+ "id": getId(4),
7729
7785
  "cx": "50%",
7730
7786
  "cy": "0%",
7731
7787
  "fx": "50%",
@@ -7734,36 +7790,28 @@ const Network = vue.createVNode("svg", {
7734
7790
  "gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
7735
7791
  }, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), vue.createVNode("g", {
7736
7792
  "fill": "none"
7737
- }, [vue.createVNode("g", {
7738
- "opacity": ".8"
7739
- }, [vue.createVNode("path", {
7740
- "d": "M36 131V53H16v20H2v58h34z",
7741
- "fill": `url(#${prefix}1)`
7742
- }, null), vue.createVNode("path", {
7743
- "d": "M123 15h22v14h9v77h-31V15z",
7744
- "fill": `url(#${prefix}1)`
7745
- }, null)]), vue.createVNode("path", {
7746
- "fill": `url(#${prefix}4)`,
7793
+ }, [renderBuilding(), vue.createVNode("path", {
7794
+ "fill": useId(4),
7747
7795
  "d": "M0 139h160v21H0z"
7748
7796
  }, null), vue.createVNode("path", {
7749
7797
  "d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
7750
- "fill": `url(#${prefix}2)`
7798
+ "fill": useId(2)
7751
7799
  }, null), vue.createVNode("g", {
7752
7800
  "opacity": ".6",
7753
7801
  "stroke-linecap": "round",
7754
7802
  "stroke-width": "7"
7755
7803
  }, [vue.createVNode("path", {
7756
7804
  "d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
7757
- "stroke": `url(#${prefix}3)`
7805
+ "stroke": useId(3)
7758
7806
  }, null), vue.createVNode("path", {
7759
7807
  "d": "M53 36a34 34 0 0 0 0 48",
7760
- "stroke": `url(#${prefix}3)`
7808
+ "stroke": useId(3)
7761
7809
  }, null), vue.createVNode("path", {
7762
7810
  "d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
7763
- "stroke": `url(#${prefix}3)`
7811
+ "stroke": useId(3)
7764
7812
  }, null), vue.createVNode("path", {
7765
7813
  "d": "M106 84a34 34 0 0 0 0-48",
7766
- "stroke": `url(#${prefix}3)`
7814
+ "stroke": useId(3)
7767
7815
  }, null)]), vue.createVNode("g", {
7768
7816
  "transform": "translate(31 105)"
7769
7817
  }, [vue.createVNode("rect", {
@@ -7786,8 +7834,153 @@ const Network = vue.createVNode("svg", {
7786
7834
  "height": "6",
7787
7835
  "rx": "1.1"
7788
7836
  }, null)])])]);
7837
+ const renderMaterial = () => vue.createVNode("svg", {
7838
+ "viewBox": "0 0 160 160"
7839
+ }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
7840
+ "x1": "50%",
7841
+ "x2": "50%",
7842
+ "y2": "100%",
7843
+ "id": getId(5)
7844
+ }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
7845
+ "x1": "95%",
7846
+ "y1": "48%",
7847
+ "x2": "5.5%",
7848
+ "y2": "51%",
7849
+ "id": getId(6)
7850
+ }, [renderStops("#EAEDF1", "#DCDEE0")]), vue.createVNode("linearGradient", {
7851
+ "y1": "45%",
7852
+ "x2": "100%",
7853
+ "y2": "54%",
7854
+ "id": getId(7)
7855
+ }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), vue.createVNode("g", {
7856
+ "transform": "translate(36 50)",
7857
+ "fill": "none"
7858
+ }, [vue.createVNode("g", {
7859
+ "transform": "translate(8)"
7860
+ }, [vue.createVNode("rect", {
7861
+ "fill": "#EBEDF0",
7862
+ "opacity": ".6",
7863
+ "x": "38",
7864
+ "y": "13",
7865
+ "width": "36",
7866
+ "height": "53",
7867
+ "rx": "2"
7868
+ }, null), vue.createVNode("rect", {
7869
+ "fill": useId(5),
7870
+ "width": "64",
7871
+ "height": "66",
7872
+ "rx": "2"
7873
+ }, null), vue.createVNode("rect", {
7874
+ "fill": "#FFF",
7875
+ "x": "6",
7876
+ "y": "6",
7877
+ "width": "52",
7878
+ "height": "55",
7879
+ "rx": "1"
7880
+ }, null), vue.createVNode("g", {
7881
+ "transform": "translate(15 17)",
7882
+ "fill": useId(6)
7883
+ }, [vue.createVNode("rect", {
7884
+ "width": "34",
7885
+ "height": "6",
7886
+ "rx": "1"
7887
+ }, null), vue.createVNode("path", {
7888
+ "d": "M0 14h34v6H0z"
7889
+ }, null), vue.createVNode("rect", {
7890
+ "y": "28",
7891
+ "width": "34",
7892
+ "height": "6",
7893
+ "rx": "1"
7894
+ }, null)])]), vue.createVNode("rect", {
7895
+ "fill": useId(7),
7896
+ "y": "61",
7897
+ "width": "88",
7898
+ "height": "28",
7899
+ "rx": "1"
7900
+ }, null), vue.createVNode("rect", {
7901
+ "fill": "#F7F8FA",
7902
+ "x": "29",
7903
+ "y": "72",
7904
+ "width": "30",
7905
+ "height": "6",
7906
+ "rx": "1"
7907
+ }, null)])]);
7908
+ const renderError = () => vue.createVNode("svg", {
7909
+ "viewBox": "0 0 160 160"
7910
+ }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
7911
+ "x1": "50%",
7912
+ "x2": "50%",
7913
+ "y2": "100%",
7914
+ "id": getId(8)
7915
+ }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), vue.createVNode("path", {
7916
+ "d": "m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",
7917
+ "fill": useId(8)
7918
+ }, null)]);
7919
+ const renderSearch = () => vue.createVNode("svg", {
7920
+ "viewBox": "0 0 160 160"
7921
+ }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
7922
+ "x1": "50%",
7923
+ "y1": "100%",
7924
+ "x2": "50%",
7925
+ "id": getId(9)
7926
+ }, [renderStops("#EEE", "#D8D8D8")]), vue.createVNode("linearGradient", {
7927
+ "x1": "100%",
7928
+ "y1": "50%",
7929
+ "y2": "50%",
7930
+ "id": getId(10)
7931
+ }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
7932
+ "x1": "50%",
7933
+ "x2": "50%",
7934
+ "y2": "100%",
7935
+ "id": getId(11)
7936
+ }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
7937
+ "x1": "50%",
7938
+ "x2": "50%",
7939
+ "y2": "100%",
7940
+ "id": getId(12)
7941
+ }, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), vue.createVNode("g", {
7942
+ "transform": "rotate(-45 113 -4)",
7943
+ "fill": "none"
7944
+ }, [vue.createVNode("rect", {
7945
+ "fill": useId(9),
7946
+ "x": "24",
7947
+ "y": "52.8",
7948
+ "width": "5.8",
7949
+ "height": "19",
7950
+ "rx": "1"
7951
+ }, null), vue.createVNode("rect", {
7952
+ "fill": useId(10),
7953
+ "x": "22.1",
7954
+ "y": "67.3",
7955
+ "width": "9.9",
7956
+ "height": "28",
7957
+ "rx": "1"
7958
+ }, null), vue.createVNode("circle", {
7959
+ "stroke": useId(11),
7960
+ "stroke-width": "8",
7961
+ "cx": "27",
7962
+ "cy": "27",
7963
+ "r": "27"
7964
+ }, null), vue.createVNode("circle", {
7965
+ "fill": useId(12),
7966
+ "cx": "27",
7967
+ "cy": "27",
7968
+ "r": "16"
7969
+ }, null), vue.createVNode("path", {
7970
+ "d": "M37 7c-8 0-15 5-16 12",
7971
+ "stroke": useId(11),
7972
+ "stroke-width": "3",
7973
+ "opacity": ".5",
7974
+ "stroke-linecap": "round",
7975
+ "transform": "rotate(45 29 13)"
7976
+ }, null)])]);
7789
7977
  const [name$E, bem$D] = createNamespace("empty");
7790
- const PRESET_IMAGES = ["error", "search", "default"];
7978
+ const PRESET_IMAGES = {
7979
+ error: renderError,
7980
+ search: renderSearch,
7981
+ network: renderNetwork,
7982
+ default: renderMaterial
7983
+ };
7791
7984
  const emptyProps = {
7792
7985
  image: makeStringProp("default"),
7793
7986
  imageSize: [Number, String, Array],
@@ -7800,20 +7993,12 @@ var stdin_default$K = vue.defineComponent({
7800
7993
  slots
7801
7994
  }) {
7802
7995
  const renderImage = () => {
7996
+ var _a;
7803
7997
  if (slots.image) {
7804
7998
  return slots.image();
7805
7999
  }
7806
- let {
7807
- image
7808
- } = props;
7809
- if (image === "network") {
7810
- return Network;
7811
- }
7812
- if (PRESET_IMAGES.includes(image)) {
7813
- image = `https://img.yzcdn.cn/vant/empty-image-${image}.png`;
7814
- }
7815
- return vue.createVNode("img", {
7816
- "src": image
8000
+ return ((_a = PRESET_IMAGES[props.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || vue.createVNode("img", {
8001
+ "src": props.image
7817
8002
  }, null);
7818
8003
  };
7819
8004
  const renderDescription = () => {
@@ -8715,7 +8900,7 @@ var stdin_default$D = vue.defineComponent({
8715
8900
  setup(props, {
8716
8901
  slots
8717
8902
  }) {
8718
- const id = useId();
8903
+ const id = useId$1();
8719
8904
  const root = vue.ref();
8720
8905
  const barRef = vue.ref();
8721
8906
  const offset = vue.ref(0);
@@ -11539,7 +11724,7 @@ var stdin_default$j = vue.defineComponent({
11539
11724
  slots,
11540
11725
  attrs
11541
11726
  }) {
11542
- const id = useId();
11727
+ const id = useId$1();
11543
11728
  const filedRef = vue.ref();
11544
11729
  const onCancel = () => {
11545
11730
  if (!slots.action) {
@@ -13094,7 +13279,6 @@ var stdin_default$6 = vue.defineComponent({
13094
13279
  });
13095
13280
  const TreeSelect = withInstall(stdin_default$6);
13096
13281
  const [name, bem, t] = createNamespace("uploader");
13097
- const toArray = (item) => Array.isArray(item) ? item : [item];
13098
13282
  function readFileContent(file, resultType) {
13099
13283
  return new Promise((resolve) => {
13100
13284
  if (resultType === "file") {
@@ -14353,7 +14537,7 @@ const Lazyload = {
14353
14537
  });
14354
14538
  }
14355
14539
  };
14356
- const version = "3.4.8";
14540
+ const version = "3.4.9";
14357
14541
  function install(app) {
14358
14542
  const components = [
14359
14543
  ActionBar,