y-design-ssr 0.2.6 → 0.2.8

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 (129) hide show
  1. package/README.md +1 -1
  2. package/libs/button/index.css +1 -579
  3. package/libs/button/index.d.ts +0 -1
  4. package/libs/button/index.mjs +65 -111
  5. package/libs/button/index.umd.js +2 -203
  6. package/libs/cell/index.css +1 -1077
  7. package/libs/cell/index.d.ts +0 -1
  8. package/libs/cell/index.mjs +104 -168
  9. package/libs/cell/index.umd.js +2 -301
  10. package/libs/checkbox/index.css +1 -1053
  11. package/libs/checkbox/index.d.ts +0 -1
  12. package/libs/checkbox/index.mjs +127 -243
  13. package/libs/checkbox/index.umd.js +2 -370
  14. package/libs/checkboxGroup/index.css +1 -422
  15. package/libs/checkboxGroup/index.d.ts +0 -1
  16. package/libs/checkboxGroup/index.mjs +87 -174
  17. package/libs/checkboxGroup/index.umd.js +2 -266
  18. package/libs/col/index.css +1 -615
  19. package/libs/col/index.d.ts +0 -1
  20. package/libs/col/index.mjs +81 -247
  21. package/libs/col/index.umd.js +2 -306
  22. package/libs/countdown/index.css +1 -417
  23. package/libs/countdown/index.d.ts +0 -1
  24. package/libs/countdown/index.mjs +71 -180
  25. package/libs/countdown/index.umd.js +2 -232
  26. package/libs/dialog/index.css +1 -1405
  27. package/libs/dialog/index.d.ts +0 -1
  28. package/libs/dialog/index.mjs +476 -647
  29. package/libs/dialog/index.umd.js +2 -1129
  30. package/libs/empty/index.css +1 -457
  31. package/libs/empty/index.d.ts +0 -1
  32. package/libs/empty/index.mjs +44 -92
  33. package/libs/empty/index.umd.js +2 -140
  34. package/libs/form/index.css +1 -477
  35. package/libs/form/index.d.ts +0 -1
  36. package/libs/form/index.mjs +126 -227
  37. package/libs/form/index.umd.js +2 -320
  38. package/libs/formItem/index.css +1 -477
  39. package/libs/formItem/index.d.ts +0 -1
  40. package/libs/formItem/index.mjs +126 -277
  41. package/libs/formItem/index.umd.js +2 -373
  42. package/libs/icon/index.css +1 -982
  43. package/libs/icon/index.d.ts +0 -1
  44. package/libs/icon/index.mjs +58 -108
  45. package/libs/icon/index.umd.js +2 -187
  46. package/libs/index.css +1 -2902
  47. package/libs/index.mjs +2348 -3789
  48. package/libs/index.umd.js +2 -5509
  49. package/libs/input/index.css +1 -483
  50. package/libs/input/index.d.ts +0 -1
  51. package/libs/input/index.mjs +92 -184
  52. package/libs/input/index.umd.js +2 -275
  53. package/libs/layout/index.css +1 -684
  54. package/libs/layout/index.mjs +130 -230
  55. package/libs/layout/index.umd.js +2 -318
  56. package/libs/list/index.css +1 -440
  57. package/libs/list/index.d.ts +0 -1
  58. package/libs/list/index.mjs +207 -389
  59. package/libs/list/index.umd.js +2 -572
  60. package/libs/loading/index.css +1 -548
  61. package/libs/loading/index.d.ts +0 -1
  62. package/libs/loading/index.mjs +118 -197
  63. package/libs/loading/index.umd.js +2 -322
  64. package/libs/locale/index.mjs +28 -0
  65. package/libs/locale/index.umd.js +1 -0
  66. package/libs/locale/package.json +6 -0
  67. package/libs/mask/index.css +1 -426
  68. package/libs/mask/index.d.ts +0 -1
  69. package/libs/mask/index.mjs +70 -132
  70. package/libs/mask/index.umd.js +2 -202
  71. package/libs/popup/index.css +1 -465
  72. package/libs/popup/index.d.ts +0 -1
  73. package/libs/popup/index.mjs +134 -211
  74. package/libs/popup/index.umd.js +2 -359
  75. package/libs/progress/index.css +1 -488
  76. package/libs/progress/index.d.ts +0 -1
  77. package/libs/progress/index.mjs +128 -201
  78. package/libs/progress/index.umd.js +2 -323
  79. package/libs/pullrefresh/index.css +1 -441
  80. package/libs/pullrefresh/index.d.ts +0 -1
  81. package/libs/pullrefresh/index.mjs +111 -242
  82. package/libs/pullrefresh/index.umd.js +2 -303
  83. package/libs/row/index.css +1 -485
  84. package/libs/row/index.d.ts +0 -1
  85. package/libs/row/index.mjs +89 -182
  86. package/libs/row/index.umd.js +2 -238
  87. package/libs/slider/index.css +1 -558
  88. package/libs/slider/index.d.ts +0 -1
  89. package/libs/slider/index.mjs +160 -357
  90. package/libs/slider/index.umd.js +2 -454
  91. package/libs/stepper/index.css +1 -489
  92. package/libs/stepper/index.d.ts +0 -1
  93. package/libs/stepper/index.mjs +101 -182
  94. package/libs/stepper/index.umd.js +2 -270
  95. package/libs/style/index.css +1 -0
  96. package/libs/style/index.mjs +1 -0
  97. package/libs/style/index.umd.js +2 -0
  98. package/libs/style/package.json +6 -0
  99. package/libs/swipe/index.css +1 -506
  100. package/libs/swipe/index.d.ts +0 -1
  101. package/libs/swipe/index.mjs +259 -543
  102. package/libs/swipe/index.umd.js +2 -704
  103. package/libs/swipeItem/index.css +1 -424
  104. package/libs/swipeItem/index.d.ts +0 -1
  105. package/libs/swipeItem/index.mjs +52 -112
  106. package/libs/swipeItem/index.umd.js +2 -155
  107. package/libs/switch/index.css +1 -472
  108. package/libs/switch/index.d.ts +0 -1
  109. package/libs/switch/index.mjs +62 -122
  110. package/libs/switch/index.umd.js +2 -201
  111. package/libs/tab/index.d.ts +0 -1
  112. package/libs/tab/index.mjs +68 -132
  113. package/libs/tab/index.umd.js +1 -191
  114. package/libs/tabs/index.css +1 -514
  115. package/libs/tabs/index.d.ts +0 -1
  116. package/libs/tabs/index.mjs +410 -752
  117. package/libs/tabs/index.umd.js +2 -1021
  118. package/libs/toast/index.css +1 -1050
  119. package/libs/toast/index.d.ts +0 -1
  120. package/libs/toast/index.mjs +114 -184
  121. package/libs/toast/index.umd.js +2 -307
  122. package/libs/tooltip/index.css +1 -514
  123. package/libs/tooltip/index.d.ts +0 -1
  124. package/libs/tooltip/index.mjs +155 -294
  125. package/libs/tooltip/index.umd.js +2 -417
  126. package/libs/utils/index.mjs +76 -0
  127. package/libs/utils/index.umd.js +1 -0
  128. package/libs/utils/package.json +6 -0
  129. package/package.json +2 -5
@@ -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,99 @@ 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 default
264
183
  };