@solar-taro/ui-vant 1.3.1 → 1.3.3

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 (150) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/cascader/index.scss +7 -2
  3. package/cascader/index.vue.d.ts +102 -0
  4. package/cascader-picker/index.vue.d.ts +6 -6
  5. package/date-range-picker/index.vue.d.ts +3 -3
  6. package/index.d.ts +1 -0
  7. package/index.js +24 -22
  8. package/index10.js +50 -243
  9. package/index100.js +17 -5
  10. package/index101.js +10 -4
  11. package/index102.js +5 -4
  12. package/index103.js +4 -5
  13. package/index104.js +4 -6
  14. package/index105.js +6 -10
  15. package/index106.js +6 -6
  16. package/index107.js +10 -18
  17. package/index108.js +6 -4
  18. package/index109.js +793 -4
  19. package/index11.js +247 -38
  20. package/index110.js +6 -3
  21. package/index111.js +16 -2
  22. package/index112.js +4 -14
  23. package/index113.js +5 -8
  24. package/index114.js +3 -5
  25. package/index115.js +2 -4
  26. package/index116.js +14 -5
  27. package/index117.js +8 -6
  28. package/index118.js +5 -5
  29. package/index119.js +6 -3
  30. package/index12.js +44 -17
  31. package/index120.js +5 -17
  32. package/index121.js +5 -5
  33. package/index122.js +5 -3
  34. package/index123.js +3 -10
  35. package/index124.js +17 -5
  36. package/index125.js +5 -4
  37. package/index126.js +31 -5
  38. package/index128.js +4 -3
  39. package/index129.js +9 -4
  40. package/index13.js +15 -25
  41. package/index130.js +5 -4
  42. package/index131.js +4 -10
  43. package/index132.js +5 -6
  44. package/index133.js +3 -7
  45. package/index134.js +3 -3
  46. package/index135.js +4 -7
  47. package/index136.js +11 -3
  48. package/index137.js +9 -0
  49. package/index138.js +9 -0
  50. package/index139.js +7 -0
  51. package/index14.js +28 -4
  52. package/index140.js +10 -0
  53. package/index141.js +5 -0
  54. package/index15.js +5 -64
  55. package/index16.js +64 -2
  56. package/index17.js +1 -1
  57. package/index18.js +1 -1
  58. package/index19.js +1 -1
  59. package/index2.js +1 -1
  60. package/index20.js +1 -1
  61. package/index21.js +1 -1
  62. package/index22.js +1 -1
  63. package/index23.js +1 -1
  64. package/index24.js +1 -1
  65. package/index25.js +3 -9
  66. package/index26.js +2 -9
  67. package/index27.js +2 -6
  68. package/index28.js +5 -3
  69. package/index29.js +9 -6
  70. package/index3.js +165 -118
  71. package/index30.js +8 -62
  72. package/index31.js +13 -3
  73. package/index32.js +63 -8
  74. package/index33.js +3 -6
  75. package/index34.js +8 -4
  76. package/index35.js +7 -2
  77. package/index36.js +2 -4
  78. package/index37.js +2 -10
  79. package/index38.js +5 -4
  80. package/index39.js +10 -4
  81. package/index4.js +113 -157
  82. package/index40.js +4 -2
  83. package/index41.js +4 -4
  84. package/index42.js +3 -8
  85. package/index43.js +3 -4
  86. package/index44.js +7 -4
  87. package/index45.js +4 -6
  88. package/index46.js +5 -6
  89. package/index47.js +7 -9
  90. package/index48.js +6 -5
  91. package/index49.js +9 -7
  92. package/index5.js +166 -27
  93. package/index50.js +5 -5
  94. package/index51.js +6 -9
  95. package/index52.js +4 -6
  96. package/index53.js +9 -17
  97. package/index54.js +4 -9
  98. package/index55.js +17 -6
  99. package/index56.js +9 -10
  100. package/index57.js +6 -3
  101. package/index58.js +12 -7
  102. package/index59.js +3 -9
  103. package/index6.js +29 -95
  104. package/index60.js +2 -2
  105. package/index61.js +7 -5
  106. package/index62.js +9 -5
  107. package/index63.js +6 -9
  108. package/index64.js +5 -15
  109. package/index65.js +9 -6
  110. package/index66.js +15 -5
  111. package/index67.js +5 -8
  112. package/index68.js +5 -6
  113. package/index69.js +8 -5
  114. package/index7.js +93 -39
  115. package/index70.js +6 -5
  116. package/index71.js +4 -5
  117. package/index72.js +5 -6
  118. package/index73.js +7 -26
  119. package/index74.js +6 -5
  120. package/index75.js +26 -40
  121. package/index76.js +3 -4
  122. package/index77.js +39 -5
  123. package/index78.js +7 -15
  124. package/index79.js +5 -7
  125. package/index8.js +40 -263
  126. package/index80.js +15 -2
  127. package/index81.js +8 -3
  128. package/index82.js +2 -4
  129. package/index83.js +3 -4
  130. package/index84.js +13 -4
  131. package/index85.js +5 -4
  132. package/index86.js +3 -4
  133. package/index87.js +3 -14
  134. package/index88.js +4 -3
  135. package/index89.js +4 -13
  136. package/index9.js +262 -54
  137. package/index90.js +4 -5
  138. package/index91.js +4 -14
  139. package/index92.js +14 -8
  140. package/index93.js +14 -3
  141. package/index94.js +8 -5
  142. package/index95.js +3 -6
  143. package/index96.js +5 -5
  144. package/index97.js +5 -7
  145. package/index98.js +5 -17
  146. package/index99.js +7 -10
  147. package/opper-controller/index.scss +12 -0
  148. package/package.json +1 -1
  149. package/select-picker/index.vue.d.ts +4 -4
  150. package/selector/index.vue.d.ts +10 -10
package/index4.js CHANGED
@@ -1,175 +1,131 @@
1
- import { defineComponent as P, computed as u, ref as k, renderSlot as S, openBlock as H, createElementBlock as z, createCommentVNode as Y, createElementVNode as j, mergeProps as x, resolveDirective as A, withDirectives as G, unref as J, toDisplayString as K, normalizeClass as L, Fragment as O } from "vue";
2
- import { date as m } from "@solar-taro/core";
3
- import { vDatetimePicker as Q } from "./index13.js";
4
- const R = S, o = H, i = z, U = Y, l = j, W = x, X = A, D = G, w = J, c = K, V = L, Z = O, ee = ["label", "value", "placeholder", "required"], te = { name: "right-icon" }, ae = ["show", "title"], ne = { class: "sun-date-range-picker-input-group" }, le = {
5
- key: 0,
6
- class: "sun-date-range-picker-input-value"
7
- }, re = {
8
- key: 1,
9
- class: "sun-date-range-picker-input-placeholder"
10
- }, oe = { class: "sun-date-range-picker-input-label" }, ie = {
11
- key: 0,
12
- name: "down",
13
- color: "var(--color-gray)"
14
- }, ue = {
15
- key: 0,
16
- class: "date-range-picker-input-value"
17
- }, se = {
18
- key: 1,
19
- class: "sun-date-range-picker-input-placeholder"
20
- }, de = { class: "sun-date-range-picker-input-label" }, ce = ["id", "type", "value", "min-date", "max-date"], ve = { class: "sun-date-range-picker-btn-wrapper" };
21
- let pe = 1;
22
- const ge = /* @__PURE__ */ P({
1
+ import { defineComponent as E, ref as N, computed as r, mergeProps as I, createElementVNode as L, openBlock as P, createElementBlock as $, createCommentVNode as q } from "vue";
2
+ import y from "./index28.js";
3
+ const D = I, A = L, v = P, h = $, T = q, j = ["show"], z = ["title", "value-key", "columns", "loading"], H = /* @__PURE__ */ E({
4
+ inheritAttrs: !1,
23
5
  __name: "index",
24
6
  props: {
25
- id: { default: () => `van-datetime-picker-${pe++}` },
26
- type: { default: "date" },
27
- label: {},
7
+ show: { type: Boolean },
8
+ labelKey: { default: "fullName" },
9
+ valueKey: { default: "id" },
10
+ pidKey: { default: "pid" },
11
+ searchable: { type: Boolean, default: !0 },
28
12
  title: {},
29
- placeholder: {},
13
+ loading: { type: Boolean },
14
+ options: { default: () => [] },
30
15
  modelValue: {},
31
- required: { type: Boolean },
32
- format: {},
33
- minDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() - 5, 0, 0, 0, 0, 0).getTime() },
34
- maxDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 5, 0, 0, 0, 0, 0).getTime() }
16
+ required: { type: Boolean }
35
17
  },
36
- emits: ["update:modelValue", "confirm", "clear", "close"],
37
- setup(b, { emit: C }) {
38
- const a = b, s = C, _ = " ~ ", n = u(() => ({
39
- ref: k([...a.modelValue])
40
- })), $ = u(
41
- () => n.value.ref.value[d.value] || B()
42
- ), f = k(!1), d = k(0), M = u(() => {
43
- const [t, e] = a.modelValue;
44
- return t && e ? m(t, v.value) + _ + m(e, v.value) : "";
45
- }), T = u(() => a.modelValue.length && !a.required), v = u(() => {
46
- if (a.format)
47
- return a.format;
48
- switch (a.type) {
49
- case "date":
50
- return "yyyy-MM-dd";
51
- case "datetime":
52
- return "yyyy-MM-dd HH:mm";
53
- }
54
- }), q = u(() => {
55
- if (a.title)
56
- return a.title;
57
- switch (a.type) {
58
- case "date":
59
- return "请选择日期";
60
- case "datetime":
61
- return "请选择时间";
62
- }
63
- }), y = u(() => {
64
- if (a.placeholder)
65
- return a.placeholder;
66
- switch (a.type) {
67
- case "date":
68
- return ["开始日期", "结束日期"];
69
- case "datetime":
70
- return ["开始时间", "结束时间"];
18
+ emits: ["close", "cancel", "confirm", "update:show", "update:modelValue"],
19
+ setup(K, { emit: g }) {
20
+ const u = g, n = K, a = N(""), d = r(() => {
21
+ const e = y(n.options);
22
+ for (let t = 0; t < e.length - 1; t++) {
23
+ const o = e[t];
24
+ for (let l = 0; l < o.length; l++) {
25
+ const i = o[l];
26
+ i.children = e[t + 1].filter((s) => s[n.pidKey] === i[n.valueKey]);
27
+ }
71
28
  }
29
+ return e[0];
30
+ }), p = r(() => y(d.value).map((e) => c(e)).flat()), C = r(() => {
31
+ const e = n.options[n.options.length - 1].find((t) => t[n.valueKey] === n.modelValue);
32
+ return e ? x(e) : m();
72
33
  });
73
- function B() {
74
- const t = /* @__PURE__ */ new Date(), e = t.getMinutes();
75
- switch (a.type) {
76
- case "date":
77
- return t.setHours(0, 0, 0, 0);
78
- case "datetime":
79
- return t.setMinutes(e - e % 5);
80
- }
34
+ function w() {
35
+ n.required || u("update:modelValue", null), u("cancel", n.modelValue), f();
36
+ }
37
+ function f() {
38
+ u("update:show", !1), u("close");
81
39
  }
82
- function h() {
83
- f.value = !0, p(0);
40
+ function V({ detail: e }) {
41
+ const t = e.value[e.value.length - 1];
42
+ u("update:modelValue", t[n.valueKey]), u("confirm", B(t)), u("update:show", !1);
84
43
  }
85
- function g() {
86
- f.value = !1, s("close");
44
+ function k({ detail: e }) {
45
+ const { picker: t, value: o, index: l } = e;
46
+ !a.value && l < n.options.length - 1 && t.setColumnValues(
47
+ l + 1,
48
+ n.options[l + 1].filter((i) => i[n.pidKey] === o[l][n.valueKey])
49
+ );
87
50
  }
88
- function F() {
89
- n.value.ref.value = [], s("clear", a.modelValue), s("update:modelValue", []);
51
+ function b({ detail: e }) {
52
+ a.value = e.trim().toLowerCase(), m();
90
53
  }
91
- function p(t) {
92
- d.value = t;
54
+ function B(e) {
55
+ const t = [n.options[n.options.length - 1].find((o) => o[n.valueKey] === e[n.valueKey] && o[n.pidKey] === e[n.pidKey])];
56
+ for (let o = n.options.length - 2; o >= 0; o--)
57
+ t.unshift(
58
+ n.options[o].find((l) => {
59
+ var i;
60
+ return l[n.valueKey] === ((i = t[0]) == null ? void 0 : i[n.pidKey]);
61
+ })
62
+ );
63
+ return t;
93
64
  }
94
- function E(t) {
95
- n.value.ref.value[d.value] = t;
65
+ function c(e, t = "") {
66
+ var i;
67
+ let o = [], l = t + e[n.labelKey];
68
+ return (i = e.children) != null && i.length ? e.children.forEach((s) => {
69
+ o = o.concat(c(s, l + " / "));
70
+ }) : (e[n.labelKey] = l, o.push(e)), o;
96
71
  }
97
- function I() {
98
- const [t, e] = n.value.ref.value;
99
- if (!t || !e)
100
- return p(t ? 1 : 0);
101
- s("update:modelValue", [...n.value.ref.value]), s("confirm", n.value.ref.value), g();
72
+ function m() {
73
+ var o;
74
+ if (a.value)
75
+ return [{
76
+ values: p.value.filter((l) => l[n.labelKey].toLowerCase().includes(a.value))
77
+ }];
78
+ const e = [];
79
+ let t = d.value;
80
+ for (; t; )
81
+ e.push({ values: t }), t = (o = t[0]) == null ? void 0 : o.children;
82
+ return e;
83
+ }
84
+ function x(e) {
85
+ if (a.value) {
86
+ const o = p.value.filter((l) => l[n.labelKey].toLowerCase().includes(a.value));
87
+ return [{
88
+ values: o,
89
+ defaultIndex: o.findIndex((l) => l[n.valueKey] === e[n.valueKey])
90
+ }];
91
+ }
92
+ const t = [];
93
+ for (let o = n.options.length - 1; o >= 0; o--) {
94
+ const l = n.options[o].filter((i) => i[n.pidKey] === e[n.pidKey]);
95
+ t[o] = {
96
+ values: l,
97
+ defaultIndex: l.findIndex((i) => i[n.valueKey] === e[n.valueKey])
98
+ }, o > 0 && (e = n.options[o - 1].find((i) => i[n.valueKey] === e[n.pidKey]));
99
+ }
100
+ return t;
102
101
  }
103
- return (t, e) => {
104
- const N = X("readonly");
105
- return o(), i(Z, null, [
106
- R(t.$slots, "default", { present: h }, () => [
107
- D((o(), i("van-field", W(t.$attrs, {
108
- label: t.label,
109
- value: M.value,
110
- placeholder: y.value.join(_),
111
- required: t.required,
112
- onClickInput: e[1] || (e[1] = (r) => h())
113
- }), [
114
- l("slot-view", te, [
115
- T.value ? (o(), i("van-icon", {
116
- key: 0,
117
- name: "clear",
118
- onTap: e[0] || (e[0] = (r) => F())
119
- }, null, 32)) : U("", !0)
120
- ])
121
- ], 16, ee)), [
122
- [N]
123
- ])
124
- ]),
125
- l("van-action-sheet", {
126
- show: f.value,
127
- title: q.value,
128
- "close-on-click-overlay": !0,
129
- onClose: e[6] || (e[6] = (r) => g()),
130
- onCancel: e[7] || (e[7] = (r) => g())
131
- }, [
132
- l("view", ne, [
133
- l("view", {
134
- class: V(["sun-date-range-picker-input", { "sun-date-range-picker-input-active": d.value === 0 }]),
135
- onTap: e[2] || (e[2] = (r) => p(0))
136
- }, [
137
- n.value.ref.value[0] ? (o(), i("view", le, c(w(m)(n.value.ref.value[0], v.value)), 1)) : (o(), i("view", re, "请选择")),
138
- l("view", oe, c(y.value[0]), 1)
139
- ], 34),
140
- (o(), i("van-icon", ie)),
141
- l("view", {
142
- class: V(["sun-date-range-picker-input", { "sun-date-range-picker-input-active": d.value === 1 }]),
143
- onTap: e[3] || (e[3] = (r) => p(1))
144
- }, [
145
- n.value.ref.value[1] ? (o(), i("view", ue, c(w(m)(n.value.ref.value[1], v.value)), 1)) : (o(), i("view", se, "请选择")),
146
- l("view", de, c(y.value[1]), 1)
147
- ], 34)
148
- ]),
149
- D(l("van-datetime-picker", {
150
- id: t.id,
151
- type: t.type,
152
- "show-toolbar": !1,
153
- value: $.value,
154
- "min-date": t.minDate,
155
- "max-date": t.maxDate,
156
- onInput: e[4] || (e[4] = (r) => E(r.detail))
157
- }, null, 40, ce), [
158
- [w(Q)]
159
- ]),
160
- l("view", ve, [
161
- l("van-button", {
162
- type: "primary",
163
- round: "true",
164
- block: "true",
165
- onTap: e[5] || (e[5] = (r) => I())
166
- }, c(n.value.ref.value[0] && n.value.ref.value[1] ? "确定" : "继续"), 33)
167
- ])
168
- ], 40, ae)
169
- ], 64);
170
- };
102
+ return (e, t) => (v(), h("van-popup", {
103
+ show: e.show,
104
+ position: "bottom",
105
+ round: !0,
106
+ "close-on-click-overlay": !0,
107
+ onClose: t[4] || (t[4] = (o) => f())
108
+ }, [
109
+ A("van-picker", D(e.$attrs, {
110
+ title: e.title,
111
+ "show-toolbar": !0,
112
+ "value-key": e.labelKey,
113
+ columns: C.value,
114
+ loading: e.loading,
115
+ onCancel: t[0] || (t[0] = (o) => w()),
116
+ onConfirm: t[1] || (t[1] = (o) => V(o)),
117
+ onChange: t[2] || (t[2] = (o) => k(o))
118
+ }), null, 16, z),
119
+ e.searchable && e.options.length ? (v(), h("van-search", {
120
+ key: 0,
121
+ shape: "round",
122
+ "input-align": "center",
123
+ placeholder: "请输入搜索关键词",
124
+ onChange: t[3] || (t[3] = (o) => b(o))
125
+ }, null, 32)) : T("", !0)
126
+ ], 40, j));
171
127
  }
172
128
  });
173
129
  export {
174
- ge as default
130
+ H as default
175
131
  };
package/index40.js CHANGED
@@ -1,5 +1,7 @@
1
- import e from "./index80.js";
2
- var t = typeof self == "object" && self && self.Object === Object && self, r = e || t || Function("return this")();
1
+ var n = 9007199254740991;
2
+ function r(t) {
3
+ return typeof t == "number" && t > -1 && t % 1 == 0 && t <= n;
4
+ }
3
5
  export {
4
6
  r as default
5
7
  };
package/index41.js CHANGED
@@ -1,6 +1,6 @@
1
- function e() {
2
- return !1;
3
- }
1
+ import f from "./index42.js";
2
+ import t from "./index43.js";
3
+ var r = typeof exports == "object" && exports && !exports.nodeType && exports, e = r && typeof module == "object" && module && !module.nodeType && module, u = e && e.exports === r, o = u ? f.Buffer : void 0, p = o ? o.isBuffer : void 0, a = p || t;
4
4
  export {
5
- e as default
5
+ a as default
6
6
  };
package/index42.js CHANGED
@@ -1,10 +1,5 @@
1
- import t from "./index88.js";
2
- import e from "./index89.js";
3
- import o from "./index90.js";
4
- var i = "[object Null]", f = "[object Undefined]", r = t ? t.toStringTag : void 0;
5
- function m(n) {
6
- return n == null ? n === void 0 ? f : i : r && r in Object(n) ? e(n) : o(n);
7
- }
1
+ import e from "./index82.js";
2
+ var t = typeof self == "object" && self && self.Object === Object && self, r = e || t || Function("return this")();
8
3
  export {
9
- m as default
4
+ r as default
10
5
  };
package/index43.js CHANGED
@@ -1,7 +1,6 @@
1
- function n(t) {
2
- var e = typeof t;
3
- return t != null && (e == "object" || e == "function");
1
+ function e() {
2
+ return !1;
4
3
  }
5
4
  export {
6
- n as default
5
+ e as default
7
6
  };
package/index44.js CHANGED
@@ -1,7 +1,10 @@
1
- import o from "./index45.js";
2
- import p from "./index46.js";
3
- import a from "./index47.js";
4
- var r = a && a.isMap, m = r ? p(r) : o;
1
+ import t from "./index83.js";
2
+ import e from "./index84.js";
3
+ import o from "./index85.js";
4
+ var i = "[object Null]", f = "[object Undefined]", r = t ? t.toStringTag : void 0;
5
+ function m(n) {
6
+ return n == null ? n === void 0 ? f : i : r && r in Object(n) ? e(n) : o(n);
7
+ }
5
8
  export {
6
9
  m as default
7
10
  };
package/index45.js CHANGED
@@ -1,9 +1,7 @@
1
- import a from "./index73.js";
2
- import r from "./index34.js";
3
- var e = "[object Map]";
4
- function i(t) {
5
- return r(t) && a(t) == e;
1
+ function n(t) {
2
+ var e = typeof t;
3
+ return t != null && (e == "object" || e == "function");
6
4
  }
7
5
  export {
8
- i as default
6
+ n as default
9
7
  };
package/index46.js CHANGED
@@ -1,8 +1,7 @@
1
- function t(n) {
2
- return function(r) {
3
- return n(r);
4
- };
5
- }
1
+ import o from "./index47.js";
2
+ import p from "./index48.js";
3
+ import a from "./index49.js";
4
+ var r = a && a.isMap, m = r ? p(r) : o;
6
5
  export {
7
- t as default
6
+ m as default
8
7
  };
package/index47.js CHANGED
@@ -1,11 +1,9 @@
1
- import p from "./index80.js";
2
- var t = typeof exports == "object" && exports && !exports.nodeType && exports, e = t && typeof module == "object" && module && !module.nodeType && module, u = e && e.exports === t, r = u && p.process, l = function() {
3
- try {
4
- var o = e && e.require && e.require("util").types;
5
- return o || r && r.binding && r.binding("util");
6
- } catch {
7
- }
8
- }();
1
+ import a from "./index75.js";
2
+ import r from "./index36.js";
3
+ var e = "[object Map]";
4
+ function i(t) {
5
+ return r(t) && a(t) == e;
6
+ }
9
7
  export {
10
- l as default
8
+ i as default
11
9
  };
package/index48.js CHANGED
@@ -1,7 +1,8 @@
1
- import t from "./index49.js";
2
- import o from "./index46.js";
3
- import e from "./index47.js";
4
- var r = e && e.isSet, m = r ? o(r) : t;
1
+ function t(n) {
2
+ return function(r) {
3
+ return n(r);
4
+ };
5
+ }
5
6
  export {
6
- m as default
7
+ t as default
7
8
  };
package/index49.js CHANGED
@@ -1,9 +1,11 @@
1
- import e from "./index73.js";
2
- import r from "./index34.js";
3
- var o = "[object Set]";
4
- function s(t) {
5
- return r(t) && e(t) == o;
6
- }
1
+ import p from "./index82.js";
2
+ var t = typeof exports == "object" && exports && !exports.nodeType && exports, e = t && typeof module == "object" && module && !module.nodeType && module, u = e && e.exports === t, r = u && p.process, l = function() {
3
+ try {
4
+ var o = e && e.require && e.require("util").types;
5
+ return o || r && r.binding && r.binding("util");
6
+ } catch {
7
+ }
8
+ }();
7
9
  export {
8
- s as default
10
+ l as default
9
11
  };
package/index5.js CHANGED
@@ -1,36 +1,175 @@
1
- import { defineComponent as c, computed as i, renderSlot as m, createElementVNode as d, openBlock as u, createElementBlock as p, createCommentVNode as _, normalizeClass as k } from "vue";
2
- const t = m, n = d, s = u, l = p, v = _, B = k, f = { class: "sun-item-inner" }, h = { class: "sun-item-content-wrapper" }, w = {
1
+ import { defineComponent as P, computed as u, ref as k, renderSlot as S, openBlock as H, createElementBlock as z, createCommentVNode as Y, createElementVNode as j, mergeProps as x, resolveDirective as A, withDirectives as G, unref as J, toDisplayString as K, normalizeClass as L, Fragment as O } from "vue";
2
+ import { date as m } from "@solar-taro/core";
3
+ import { vDatetimePicker as Q } from "./index14.js";
4
+ const R = S, o = H, i = z, U = Y, l = j, W = x, X = A, D = G, w = J, c = K, V = L, Z = O, ee = ["label", "value", "placeholder", "required"], te = { name: "right-icon" }, ae = ["show", "title"], ne = { class: "sun-date-range-picker-input-group" }, le = {
3
5
  key: 0,
4
- class: "sun-item-detail-icon",
5
- name: "arrow",
6
- color: "var(--arrow-color)"
7
- }, E = /* @__PURE__ */ c({
6
+ class: "sun-date-range-picker-input-value"
7
+ }, re = {
8
+ key: 1,
9
+ class: "sun-date-range-picker-input-placeholder"
10
+ }, oe = { class: "sun-date-range-picker-input-label" }, ie = {
11
+ key: 0,
12
+ name: "down",
13
+ color: "var(--color-gray)"
14
+ }, ue = {
15
+ key: 0,
16
+ class: "date-range-picker-input-value"
17
+ }, se = {
18
+ key: 1,
19
+ class: "sun-date-range-picker-input-placeholder"
20
+ }, de = { class: "sun-date-range-picker-input-label" }, ce = ["id", "type", "value", "min-date", "max-date"], ve = { class: "sun-date-range-picker-btn-wrapper" };
21
+ let pe = 1;
22
+ const ge = /* @__PURE__ */ P({
8
23
  __name: "index",
9
24
  props: {
10
- detail: { type: Boolean },
11
- lines: { type: Boolean, default: !0 },
12
- clickable: { type: Boolean }
25
+ id: { default: () => `van-datetime-picker-${pe++}` },
26
+ type: { default: "date" },
27
+ label: {},
28
+ title: {},
29
+ placeholder: {},
30
+ modelValue: {},
31
+ required: { type: Boolean },
32
+ format: {},
33
+ minDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() - 5, 0, 0, 0, 0, 0).getTime() },
34
+ maxDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 5, 0, 0, 0, 0, 0).getTime() }
13
35
  },
14
- setup(a) {
15
- const o = a, r = i(() => ({
16
- "sun-item-lines-none": !o.lines,
17
- "sun-item-clickable": o.detail || o.clickable
18
- }));
19
- return (e, C) => (s(), l("view", {
20
- class: B(["sun-item", r.value]),
21
- "hover-class": "hover"
22
- }, [
23
- t(e.$slots, "start"),
24
- n("view", f, [
25
- n("view", h, [
26
- t(e.$slots, "default")
36
+ emits: ["update:modelValue", "confirm", "clear", "close"],
37
+ setup(b, { emit: C }) {
38
+ const a = b, s = C, _ = " ~ ", n = u(() => ({
39
+ ref: k([...a.modelValue])
40
+ })), $ = u(
41
+ () => n.value.ref.value[d.value] || B()
42
+ ), f = k(!1), d = k(0), M = u(() => {
43
+ const [t, e] = a.modelValue;
44
+ return t && e ? m(t, v.value) + _ + m(e, v.value) : "";
45
+ }), T = u(() => a.modelValue.length && !a.required), v = u(() => {
46
+ if (a.format)
47
+ return a.format;
48
+ switch (a.type) {
49
+ case "date":
50
+ return "yyyy-MM-dd";
51
+ case "datetime":
52
+ return "yyyy-MM-dd HH:mm";
53
+ }
54
+ }), q = u(() => {
55
+ if (a.title)
56
+ return a.title;
57
+ switch (a.type) {
58
+ case "date":
59
+ return "请选择日期";
60
+ case "datetime":
61
+ return "请选择时间";
62
+ }
63
+ }), y = u(() => {
64
+ if (a.placeholder)
65
+ return a.placeholder;
66
+ switch (a.type) {
67
+ case "date":
68
+ return ["开始日期", "结束日期"];
69
+ case "datetime":
70
+ return ["开始时间", "结束时间"];
71
+ }
72
+ });
73
+ function B() {
74
+ const t = /* @__PURE__ */ new Date(), e = t.getMinutes();
75
+ switch (a.type) {
76
+ case "date":
77
+ return t.setHours(0, 0, 0, 0);
78
+ case "datetime":
79
+ return t.setMinutes(e - e % 5);
80
+ }
81
+ }
82
+ function h() {
83
+ f.value = !0, p(0);
84
+ }
85
+ function g() {
86
+ f.value = !1, s("close");
87
+ }
88
+ function F() {
89
+ n.value.ref.value = [], s("clear", a.modelValue), s("update:modelValue", []);
90
+ }
91
+ function p(t) {
92
+ d.value = t;
93
+ }
94
+ function E(t) {
95
+ n.value.ref.value[d.value] = t;
96
+ }
97
+ function I() {
98
+ const [t, e] = n.value.ref.value;
99
+ if (!t || !e)
100
+ return p(t ? 1 : 0);
101
+ s("update:modelValue", [...n.value.ref.value]), s("confirm", n.value.ref.value), g();
102
+ }
103
+ return (t, e) => {
104
+ const N = X("readonly");
105
+ return o(), i(Z, null, [
106
+ R(t.$slots, "default", { present: h }, () => [
107
+ D((o(), i("van-field", W(t.$attrs, {
108
+ label: t.label,
109
+ value: M.value,
110
+ placeholder: y.value.join(_),
111
+ required: t.required,
112
+ onClickInput: e[1] || (e[1] = (r) => h())
113
+ }), [
114
+ l("slot-view", te, [
115
+ T.value ? (o(), i("van-icon", {
116
+ key: 0,
117
+ name: "clear",
118
+ onTap: e[0] || (e[0] = (r) => F())
119
+ }, null, 32)) : U("", !0)
120
+ ])
121
+ ], 16, ee)), [
122
+ [N]
123
+ ])
27
124
  ]),
28
- t(e.$slots, "end"),
29
- e.detail ? (s(), l("van-icon", w)) : v("", !0)
30
- ])
31
- ], 2));
125
+ l("van-action-sheet", {
126
+ show: f.value,
127
+ title: q.value,
128
+ "close-on-click-overlay": !0,
129
+ onClose: e[6] || (e[6] = (r) => g()),
130
+ onCancel: e[7] || (e[7] = (r) => g())
131
+ }, [
132
+ l("view", ne, [
133
+ l("view", {
134
+ class: V(["sun-date-range-picker-input", { "sun-date-range-picker-input-active": d.value === 0 }]),
135
+ onTap: e[2] || (e[2] = (r) => p(0))
136
+ }, [
137
+ n.value.ref.value[0] ? (o(), i("view", le, c(w(m)(n.value.ref.value[0], v.value)), 1)) : (o(), i("view", re, "请选择")),
138
+ l("view", oe, c(y.value[0]), 1)
139
+ ], 34),
140
+ (o(), i("van-icon", ie)),
141
+ l("view", {
142
+ class: V(["sun-date-range-picker-input", { "sun-date-range-picker-input-active": d.value === 1 }]),
143
+ onTap: e[3] || (e[3] = (r) => p(1))
144
+ }, [
145
+ n.value.ref.value[1] ? (o(), i("view", ue, c(w(m)(n.value.ref.value[1], v.value)), 1)) : (o(), i("view", se, "请选择")),
146
+ l("view", de, c(y.value[1]), 1)
147
+ ], 34)
148
+ ]),
149
+ D(l("van-datetime-picker", {
150
+ id: t.id,
151
+ type: t.type,
152
+ "show-toolbar": !1,
153
+ value: $.value,
154
+ "min-date": t.minDate,
155
+ "max-date": t.maxDate,
156
+ onInput: e[4] || (e[4] = (r) => E(r.detail))
157
+ }, null, 40, ce), [
158
+ [w(Q)]
159
+ ]),
160
+ l("view", ve, [
161
+ l("van-button", {
162
+ type: "primary",
163
+ round: "true",
164
+ block: "true",
165
+ onTap: e[5] || (e[5] = (r) => I())
166
+ }, c(n.value.ref.value[0] && n.value.ref.value[1] ? "确定" : "继续"), 33)
167
+ ])
168
+ ], 40, ae)
169
+ ], 64);
170
+ };
32
171
  }
33
172
  });
34
173
  export {
35
- E as default
174
+ ge as default
36
175
  };