y-design-ssr 0.2.6 → 0.2.7

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 (101) hide show
  1. package/README.md +1 -1
  2. package/libs/button/index.css +1 -579
  3. package/libs/button/index.mjs +66 -111
  4. package/libs/button/index.umd.js +2 -203
  5. package/libs/cell/index.css +1 -1077
  6. package/libs/cell/index.mjs +105 -168
  7. package/libs/cell/index.umd.js +2 -301
  8. package/libs/checkbox/index.css +1 -1053
  9. package/libs/checkbox/index.mjs +128 -243
  10. package/libs/checkbox/index.umd.js +2 -370
  11. package/libs/checkboxGroup/index.css +1 -422
  12. package/libs/checkboxGroup/index.mjs +88 -174
  13. package/libs/checkboxGroup/index.umd.js +2 -266
  14. package/libs/col/index.css +1 -615
  15. package/libs/col/index.mjs +82 -247
  16. package/libs/col/index.umd.js +2 -306
  17. package/libs/countdown/index.css +1 -417
  18. package/libs/countdown/index.mjs +72 -180
  19. package/libs/countdown/index.umd.js +2 -232
  20. package/libs/dialog/index.css +1 -1405
  21. package/libs/dialog/index.mjs +477 -647
  22. package/libs/dialog/index.umd.js +2 -1129
  23. package/libs/empty/index.css +1 -457
  24. package/libs/empty/index.mjs +45 -92
  25. package/libs/empty/index.umd.js +2 -140
  26. package/libs/form/index.css +1 -477
  27. package/libs/form/index.mjs +127 -227
  28. package/libs/form/index.umd.js +2 -320
  29. package/libs/formItem/index.css +1 -477
  30. package/libs/formItem/index.mjs +127 -277
  31. package/libs/formItem/index.umd.js +2 -373
  32. package/libs/icon/index.css +1 -982
  33. package/libs/icon/index.mjs +59 -108
  34. package/libs/icon/index.umd.js +2 -187
  35. package/libs/index.css +1 -2902
  36. package/libs/index.mjs +2348 -3789
  37. package/libs/index.umd.js +2 -5509
  38. package/libs/input/index.css +1 -483
  39. package/libs/input/index.mjs +93 -184
  40. package/libs/input/index.umd.js +2 -275
  41. package/libs/layout/index.css +1 -684
  42. package/libs/layout/index.mjs +130 -230
  43. package/libs/layout/index.umd.js +2 -318
  44. package/libs/list/index.css +1 -440
  45. package/libs/list/index.mjs +208 -389
  46. package/libs/list/index.umd.js +2 -572
  47. package/libs/loading/index.css +1 -548
  48. package/libs/loading/index.mjs +119 -197
  49. package/libs/loading/index.umd.js +2 -322
  50. package/libs/locale/index.mjs +28 -0
  51. package/libs/locale/index.umd.js +1 -0
  52. package/libs/locale/package.json +6 -0
  53. package/libs/mask/index.css +1 -426
  54. package/libs/mask/index.mjs +71 -132
  55. package/libs/mask/index.umd.js +2 -202
  56. package/libs/popup/index.css +1 -465
  57. package/libs/popup/index.mjs +135 -211
  58. package/libs/popup/index.umd.js +2 -359
  59. package/libs/progress/index.css +1 -488
  60. package/libs/progress/index.mjs +129 -201
  61. package/libs/progress/index.umd.js +2 -323
  62. package/libs/pullrefresh/index.css +1 -441
  63. package/libs/pullrefresh/index.mjs +112 -242
  64. package/libs/pullrefresh/index.umd.js +2 -303
  65. package/libs/row/index.css +1 -485
  66. package/libs/row/index.mjs +90 -182
  67. package/libs/row/index.umd.js +2 -238
  68. package/libs/slider/index.css +1 -558
  69. package/libs/slider/index.mjs +161 -357
  70. package/libs/slider/index.umd.js +2 -454
  71. package/libs/stepper/index.css +1 -489
  72. package/libs/stepper/index.mjs +102 -182
  73. package/libs/stepper/index.umd.js +2 -270
  74. package/libs/style/index.css +1 -0
  75. package/libs/style/index.mjs +1 -0
  76. package/libs/style/index.umd.js +2 -0
  77. package/libs/style/package.json +6 -0
  78. package/libs/swipe/index.css +1 -506
  79. package/libs/swipe/index.mjs +260 -543
  80. package/libs/swipe/index.umd.js +2 -704
  81. package/libs/swipeItem/index.css +1 -424
  82. package/libs/swipeItem/index.mjs +53 -112
  83. package/libs/swipeItem/index.umd.js +2 -155
  84. package/libs/switch/index.css +1 -472
  85. package/libs/switch/index.mjs +63 -122
  86. package/libs/switch/index.umd.js +2 -201
  87. package/libs/tab/index.mjs +69 -132
  88. package/libs/tab/index.umd.js +1 -191
  89. package/libs/tabs/index.css +1 -514
  90. package/libs/tabs/index.mjs +411 -752
  91. package/libs/tabs/index.umd.js +2 -1021
  92. package/libs/toast/index.css +1 -1050
  93. package/libs/toast/index.mjs +115 -184
  94. package/libs/toast/index.umd.js +2 -307
  95. package/libs/tooltip/index.css +1 -514
  96. package/libs/tooltip/index.mjs +156 -294
  97. package/libs/tooltip/index.umd.js +2 -417
  98. package/libs/utils/index.mjs +76 -0
  99. package/libs/utils/index.umd.js +1 -0
  100. package/libs/utils/package.json +6 -0
  101. package/package.json +1 -4
@@ -1,40 +1,11 @@
1
- import { ref, reactive, inject, getCurrentInstance, watch, onUnmounted, defineComponent, computed, createVNode, withDirectives, vModelText } from "vue";
2
- const getMods = (el, mods) => {
3
- if (!mods) {
4
- return "";
5
- }
6
- if (typeof mods === "string") {
7
- return ` ${el}--${mods}`;
8
- }
9
- if (Array.isArray(mods)) {
10
- return mods.reduce((acc, cur) => acc + getMods(el, cur), "");
11
- }
12
- return Object.keys(mods).reduce(
13
- (acc, cur) => acc + (mods[cur] ? getMods(el, cur) : ""),
14
- ""
15
- );
16
- };
17
- const createBEM = (block) => {
18
- return (el, mods) => {
19
- let _el = el;
20
- let _mods = mods;
21
- if (_el && typeof _el !== "string") {
22
- _mods = _el;
23
- _el = "";
24
- }
25
- _el = _el ? `${block}__${_el}` : block;
26
- return `${_el}${getMods(_el, _mods)}`;
27
- };
28
- };
29
- const createGlobalBem = () => {
30
- return (el, mods) => {
31
- if (!mods) {
32
- return `y-${el}`;
33
- }
34
- return `${getMods(`y-${el}`, mods)}`;
35
- };
36
- };
37
- const defaultLang = {
1
+ import { ref as V, reactive as z, inject as E, getCurrentInstance as F, watch as x, onUnmounted as A, defineComponent as T, computed as f, createVNode as d, withDirectives as k, vModelText as w } from "vue";
2
+ const b = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((l, n) => l + b(e, n), "") : Object.keys(t).reduce(
3
+ (l, n) => l + (t[n] ? b(e, n) : ""),
4
+ ""
5
+ ) : "", D = (e) => (t, l) => {
6
+ let n = t, i = l;
7
+ return n && typeof n != "string" && (i = n, n = ""), n = n ? `${e}__${n}` : e, `${n}${b(n, i)}`;
8
+ }, R = () => (e, t) => t ? `${b(`y-${e}`, t)}` : `y-${e}`, W = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,50 +17,31 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ V("zh-CN");
21
+ z({
22
+ "zh-CN": W
52
23
  });
53
- const createNamespace = (name2) => {
54
- const prefixedName = `y-${name2}`;
55
- return [prefixedName, createBEM(prefixedName), createGlobalBem()];
56
- };
57
- const parseUnit = (val) => {
58
- if (isNaN(Number(val)) && typeof val === "string") {
59
- return val;
60
- }
61
- return `${val}px`;
62
- };
63
- const FORM_ITEM_PROVIDE = "y-form-item";
64
- const useFormItem = () => {
65
- const parent = inject(FORM_ITEM_PROVIDE, null);
66
- const instance = getCurrentInstance();
67
- if (parent && (instance == null ? void 0 : instance.proxy)) {
68
- const { setField } = parent;
69
- const { resetValidation, change, validateWithTrigger } = parent;
70
- watch(
71
- () => instance.proxy.modelValue,
24
+ const O = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, D(t), R()];
27
+ }, U = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, j = "y-form-item", G = () => {
28
+ const e = E(j, null), t = F();
29
+ if (e && (t != null && t.proxy)) {
30
+ const { setField: l } = e, { resetValidation: n, change: i, validateWithTrigger: s } = e;
31
+ return x(
32
+ () => t.proxy.modelValue,
72
33
  () => {
73
- if (parent.instance && parent.instance.exposed) {
74
- resetValidation();
75
- change();
76
- validateWithTrigger("onChange");
77
- }
34
+ e.instance && e.instance.exposed && (n(), i(), s("onChange"));
78
35
  }
79
- );
80
- setField(instance);
81
- onUnmounted(() => setField(null));
82
- return {
83
- parent
36
+ ), l(t), A(() => l(null)), {
37
+ parent: e
84
38
  };
85
39
  }
86
40
  return {
87
41
  parent: null
88
42
  };
89
- };
90
- const [name, bem, gbem] = createNamespace("stepper");
91
- const Stepper = /* @__PURE__ */ defineComponent({
92
- name,
43
+ }, [P, m, v] = O("stepper"), g = /* @__PURE__ */ T({
44
+ name: P,
93
45
  props: {
94
46
  modelValue: {
95
47
  type: [Number, String],
@@ -109,7 +61,7 @@ const Stepper = /* @__PURE__ */ defineComponent({
109
61
  },
110
62
  integer: {
111
63
  type: Boolean,
112
- default: false
64
+ default: !1
113
65
  },
114
66
  max: {
115
67
  type: Number,
@@ -117,11 +69,11 @@ const Stepper = /* @__PURE__ */ defineComponent({
117
69
  },
118
70
  disabled: {
119
71
  type: Boolean,
120
- default: false
72
+ default: !1
121
73
  },
122
74
  disableInput: {
123
75
  type: Boolean,
124
- default: false
76
+ default: !1
125
77
  },
126
78
  inputWidth: {
127
79
  type: [Number, String],
@@ -133,132 +85,100 @@ const Stepper = /* @__PURE__ */ defineComponent({
133
85
  }
134
86
  },
135
87
  emits: ["change", "blur", "subtract", "addit", "foucs", "update:modelValue"],
136
- setup(props, {
137
- slots,
138
- emit
88
+ setup(e, {
89
+ slots: t,
90
+ emit: l
139
91
  }) {
140
92
  const {
141
- parent
142
- } = useFormItem();
143
- const currentValue = ref(props.modelValue);
144
- const size = computed(() => props.size || (parent == null ? void 0 : parent.getProp("size")));
145
- const subDisabled = computed(() => props.modelValue <= props.min || props.disabled);
146
- const addDisabled = computed(() => props.modelValue >= props.max || props.disabled);
147
- const format = (value) => {
148
- let bool = props.integer;
149
- return value.toString().replace(/([^0-9\.\-])/g, "").replace(/\./g, ($1) => {
150
- if (bool)
151
- return "";
152
- bool = true;
153
- return $1;
154
- }).replace(/\-/g, (_, i) => i === 0 ? "-" : "");
93
+ parent: n
94
+ } = G(), i = V(e.modelValue), s = f(() => e.size || (n == null ? void 0 : n.getProp("size"))), y = f(() => e.modelValue <= e.min || e.disabled), p = f(() => e.modelValue >= e.max || e.disabled), h = (a) => {
95
+ let u = e.integer;
96
+ return a.toString().replace(/([^0-9\.\-])/g, "").replace(/\./g, (r) => u ? "" : (u = !0, r)).replace(/\-/g, (r, c) => c === 0 ? "-" : "");
97
+ }, o = (a) => {
98
+ const u = h(a);
99
+ i.value = u, l("update:modelValue", u), l("change", u);
155
100
  };
156
- const changeValue = (number) => {
157
- const fNumber = format(number);
158
- currentValue.value = fNumber;
159
- emit("update:modelValue", fNumber);
160
- emit("change", fNumber);
161
- };
162
- watch(() => props.modelValue, (value) => {
163
- currentValue.value = value;
101
+ x(() => e.modelValue, (a) => {
102
+ i.value = a;
164
103
  });
165
- const onFocus = (e) => emit("focus", e);
166
- const onChange = (e) => {
104
+ const $ = (a) => l("focus", a), _ = (a) => {
167
105
  const {
168
- value
169
- } = e.target;
170
- changeValue(value);
171
- };
172
- const onBlurReset = (e) => {
106
+ value: u
107
+ } = a.target;
108
+ o(u);
109
+ }, B = (a) => {
173
110
  const {
174
- value
175
- } = e.target;
176
- const number = Number(format(value));
177
- if (number && number < props.min)
178
- changeValue(props.min);
179
- else if (number && number > props.max)
180
- changeValue(props.max);
181
- else if (number)
182
- changeValue(number);
183
- if (parent) {
111
+ value: u
112
+ } = a.target, r = Number(h(u));
113
+ if (r && r < e.min ? o(e.min) : r && r > e.max ? o(e.max) : r && o(r), n) {
184
114
  const {
185
- validateWithTrigger
186
- } = parent;
187
- validateWithTrigger("onBlur");
115
+ validateWithTrigger: c
116
+ } = n;
117
+ c("onBlur");
188
118
  }
189
- emit("blur", e);
190
- };
191
- const onSubtract = () => {
192
- const number = Number(props.modelValue) - props.step;
193
- changeValue(number);
194
- emit("subtract", number);
195
- };
196
- const onAddit = () => {
197
- const number = Number(props.modelValue) + props.step;
198
- changeValue(number);
199
- emit("addit", number);
119
+ l("blur", a);
120
+ }, C = () => {
121
+ const a = Number(e.modelValue) - e.step;
122
+ o(a), l("subtract", a);
123
+ }, I = () => {
124
+ const a = Number(e.modelValue) + e.step;
125
+ o(a), l("addit", a);
200
126
  };
201
127
  return () => {
202
128
  const {
203
- min,
204
- max,
205
- inputWidth,
206
- placeholder,
207
- disabled,
208
- disableInput
209
- } = props;
210
- return createVNode("div", {
211
- "class": bem({
212
- [size.value]: size.value
129
+ min: a,
130
+ max: u,
131
+ inputWidth: r,
132
+ placeholder: c,
133
+ disabled: S,
134
+ disableInput: N
135
+ } = e;
136
+ return d("div", {
137
+ class: m({
138
+ [s.value]: s.value
213
139
  })
214
- }, [slots.subtraction ? slots.subtraction() : createVNode("button", {
215
- "type": "button",
216
- "disabled": subDisabled.value,
217
- "class": [bem("subtraction"), gbem("el", {
218
- clickable: !subDisabled.value
140
+ }, [t.subtraction ? t.subtraction() : d("button", {
141
+ type: "button",
142
+ disabled: y.value,
143
+ class: [m("subtraction"), v("el", {
144
+ clickable: !y.value
219
145
  })],
220
- "onClick": onSubtract
221
- }, null), withDirectives(createVNode("input", {
222
- "type": "text",
223
- "class": bem("input", {
224
- "only-disable": disableInput
146
+ onClick: C
147
+ }, null), k(d("input", {
148
+ type: "text",
149
+ class: m("input", {
150
+ "only-disable": N
225
151
  }),
226
- "style": {
227
- width: parseUnit(inputWidth)
152
+ style: {
153
+ width: U(r)
228
154
  },
229
- "onUpdate:modelValue": ($event) => currentValue.value = $event,
230
- "role": "spinbutton",
231
- "inputmode": "decimal",
232
- "aria-min": min,
233
- "aria-max": max,
234
- "aria-valuenow": currentValue.value,
235
- "onInput": onChange,
236
- "onBlur": onBlurReset,
237
- "onFocus": onFocus,
238
- "placeholder": placeholder,
239
- "disabled": disabled || disableInput
240
- }, null), [[vModelText, currentValue.value]]), slots.addition ? slots.addition() : createVNode("button", {
241
- "type": "button",
242
- "disabled": addDisabled.value,
243
- "class": [bem("addition"), gbem("el", {
244
- clickable: !addDisabled.value
155
+ "onUpdate:modelValue": (M) => i.value = M,
156
+ role: "spinbutton",
157
+ inputmode: "decimal",
158
+ "aria-min": a,
159
+ "aria-max": u,
160
+ "aria-valuenow": i.value,
161
+ onInput: _,
162
+ onBlur: B,
163
+ onFocus: $,
164
+ placeholder: c,
165
+ disabled: S || N
166
+ }, null), [[w, i.value]]), t.addition ? t.addition() : d("button", {
167
+ type: "button",
168
+ disabled: p.value,
169
+ class: [m("addition"), v("el", {
170
+ clickable: !p.value
245
171
  })],
246
- "onClick": onAddit
172
+ onClick: I
247
173
  }, null)]);
248
174
  };
249
175
  }
250
176
  });
251
- const reset = "";
252
- const libs = "";
253
- const font = "";
254
- const animation = "";
255
- const theme = "";
256
- const style = "";
257
- Stepper.install = (Vue) => {
258
- const { name: name2 } = Stepper;
259
- Vue.component(name2, Stepper);
177
+ g.install = (e) => {
178
+ const { name: t } = g;
179
+ e.component(t, g);
260
180
  };
261
181
  export {
262
- Stepper,
263
- Stepper as default
182
+ g as Stepper,
183
+ g as default
264
184
  };