y-design-ssr 0.2.3 → 0.2.5

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 (120) hide show
  1. package/README.md +21 -16
  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/button/package.json +1 -7
  6. package/libs/cell/index.css +1 -1077
  7. package/libs/cell/index.mjs +104 -167
  8. package/libs/cell/index.umd.js +2 -300
  9. package/libs/cell/package.json +1 -7
  10. package/libs/checkbox/index.css +1 -1053
  11. package/libs/checkbox/index.mjs +127 -242
  12. package/libs/checkbox/index.umd.js +2 -369
  13. package/libs/checkbox/package.json +1 -7
  14. package/libs/checkboxGroup/index.css +1 -422
  15. package/libs/checkboxGroup/index.mjs +87 -173
  16. package/libs/checkboxGroup/index.umd.js +2 -265
  17. package/libs/checkboxGroup/package.json +1 -7
  18. package/libs/col/index.css +1 -615
  19. package/libs/col/index.mjs +81 -246
  20. package/libs/col/index.umd.js +2 -305
  21. package/libs/col/package.json +1 -7
  22. package/libs/countdown/index.css +1 -417
  23. package/libs/countdown/index.mjs +71 -179
  24. package/libs/countdown/index.umd.js +2 -231
  25. package/libs/countdown/package.json +1 -7
  26. package/libs/dialog/index.css +1 -1405
  27. package/libs/dialog/index.mjs +476 -646
  28. package/libs/dialog/index.umd.js +2 -1128
  29. package/libs/dialog/package.json +1 -7
  30. package/libs/empty/index.css +1 -457
  31. package/libs/empty/index.mjs +44 -91
  32. package/libs/empty/index.umd.js +2 -139
  33. package/libs/empty/package.json +1 -7
  34. package/libs/form/index.css +1 -477
  35. package/libs/form/index.mjs +126 -226
  36. package/libs/form/index.umd.js +2 -319
  37. package/libs/form/package.json +1 -7
  38. package/libs/formItem/index.css +1 -477
  39. package/libs/formItem/index.mjs +126 -276
  40. package/libs/formItem/index.umd.js +2 -372
  41. package/libs/formItem/package.json +1 -7
  42. package/libs/icon/index.css +1 -982
  43. package/libs/icon/index.mjs +58 -107
  44. package/libs/icon/index.umd.js +2 -186
  45. package/libs/icon/package.json +1 -7
  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.mjs +92 -183
  51. package/libs/input/index.umd.js +2 -274
  52. package/libs/input/package.json +1 -7
  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/layout/package.json +1 -7
  57. package/libs/list/index.css +1 -440
  58. package/libs/list/index.mjs +207 -388
  59. package/libs/list/index.umd.js +2 -571
  60. package/libs/list/package.json +1 -7
  61. package/libs/loading/index.css +1 -548
  62. package/libs/loading/index.mjs +118 -196
  63. package/libs/loading/index.umd.js +2 -321
  64. package/libs/loading/package.json +1 -7
  65. package/libs/mask/index.css +1 -426
  66. package/libs/mask/index.mjs +70 -131
  67. package/libs/mask/index.umd.js +2 -201
  68. package/libs/mask/package.json +1 -7
  69. package/libs/popup/index.css +1 -465
  70. package/libs/popup/index.mjs +134 -210
  71. package/libs/popup/index.umd.js +2 -358
  72. package/libs/popup/package.json +1 -7
  73. package/libs/progress/index.css +1 -488
  74. package/libs/progress/index.mjs +128 -200
  75. package/libs/progress/index.umd.js +2 -322
  76. package/libs/progress/package.json +1 -7
  77. package/libs/pullrefresh/index.css +1 -441
  78. package/libs/pullrefresh/index.mjs +111 -241
  79. package/libs/pullrefresh/index.umd.js +2 -302
  80. package/libs/pullrefresh/package.json +1 -7
  81. package/libs/row/index.css +1 -485
  82. package/libs/row/index.mjs +89 -181
  83. package/libs/row/index.umd.js +2 -237
  84. package/libs/row/package.json +1 -7
  85. package/libs/slider/index.css +1 -558
  86. package/libs/slider/index.mjs +160 -356
  87. package/libs/slider/index.umd.js +2 -453
  88. package/libs/slider/package.json +1 -7
  89. package/libs/stepper/index.css +1 -489
  90. package/libs/stepper/index.mjs +101 -181
  91. package/libs/stepper/index.umd.js +2 -269
  92. package/libs/stepper/package.json +1 -7
  93. package/libs/swipe/index.css +1 -506
  94. package/libs/swipe/index.mjs +259 -542
  95. package/libs/swipe/index.umd.js +2 -703
  96. package/libs/swipe/package.json +1 -7
  97. package/libs/swipeItem/index.css +1 -424
  98. package/libs/swipeItem/index.mjs +52 -111
  99. package/libs/swipeItem/index.umd.js +2 -154
  100. package/libs/swipeItem/package.json +1 -7
  101. package/libs/switch/index.css +1 -472
  102. package/libs/switch/index.mjs +62 -121
  103. package/libs/switch/index.umd.js +2 -200
  104. package/libs/switch/package.json +1 -7
  105. package/libs/tab/index.mjs +68 -131
  106. package/libs/tab/index.umd.js +1 -190
  107. package/libs/tab/package.json +1 -7
  108. package/libs/tabs/index.css +1 -514
  109. package/libs/tabs/index.mjs +410 -751
  110. package/libs/tabs/index.umd.js +2 -1020
  111. package/libs/tabs/package.json +1 -7
  112. package/libs/toast/index.css +1 -1050
  113. package/libs/toast/index.mjs +114 -183
  114. package/libs/toast/index.umd.js +2 -306
  115. package/libs/toast/package.json +1 -7
  116. package/libs/tooltip/index.css +1 -514
  117. package/libs/tooltip/index.mjs +155 -293
  118. package/libs/tooltip/index.umd.js +2 -416
  119. package/libs/tooltip/package.json +1 -7
  120. package/package.json +7 -11
@@ -1,67 +1,27 @@
1
- import { inject, getCurrentInstance, watch, onUnmounted, ref, reactive, defineComponent, onMounted, onBeforeUnmount, computed, withDirectives, createVNode, mergeProps, vModelText, vModelDynamic } from "vue";
2
- const FORM_ITEM_PROVIDE = "y-form-item";
3
- const useFormItem = () => {
4
- const parent = inject(FORM_ITEM_PROVIDE, null);
5
- const instance = getCurrentInstance();
6
- if (parent && (instance == null ? void 0 : instance.proxy)) {
7
- const { setField } = parent;
8
- const { resetValidation, change, validateWithTrigger } = parent;
9
- watch(
10
- () => instance.proxy.modelValue,
1
+ import { inject as k, getCurrentInstance as b, watch as s, onUnmounted as I, ref as T, reactive as D, defineComponent as W, onMounted as F, onBeforeUnmount as O, computed as P, withDirectives as h, createVNode as v, mergeProps as x, vModelText as U, vModelDynamic as j } from "vue";
2
+ const A = "y-form-item", R = () => {
3
+ const e = k(A, null), t = b();
4
+ if (e && (t != null && t.proxy)) {
5
+ const { setField: a } = e, { resetValidation: n, change: o, validateWithTrigger: u } = e;
6
+ return s(
7
+ () => t.proxy.modelValue,
11
8
  () => {
12
- if (parent.instance && parent.instance.exposed) {
13
- resetValidation();
14
- change();
15
- validateWithTrigger("onChange");
16
- }
9
+ e.instance && e.instance.exposed && (n(), o(), u("onChange"));
17
10
  }
18
- );
19
- setField(instance);
20
- onUnmounted(() => setField(null));
21
- return {
22
- parent
11
+ ), a(t), I(() => a(null)), {
12
+ parent: e
23
13
  };
24
14
  }
25
15
  return {
26
16
  parent: null
27
17
  };
28
- };
29
- const getMods = (el, mods) => {
30
- if (!mods) {
31
- return "";
32
- }
33
- if (typeof mods === "string") {
34
- return ` ${el}--${mods}`;
35
- }
36
- if (Array.isArray(mods)) {
37
- return mods.reduce((acc, cur) => acc + getMods(el, cur), "");
38
- }
39
- return Object.keys(mods).reduce(
40
- (acc, cur) => acc + (mods[cur] ? getMods(el, cur) : ""),
41
- ""
42
- );
43
- };
44
- const createBEM = (block) => {
45
- return (el, mods) => {
46
- let _el = el;
47
- let _mods = mods;
48
- if (_el && typeof _el !== "string") {
49
- _mods = _el;
50
- _el = "";
51
- }
52
- _el = _el ? `${block}__${_el}` : block;
53
- return `${_el}${getMods(_el, _mods)}`;
54
- };
55
- };
56
- const createGlobalBem = () => {
57
- return (el, mods) => {
58
- if (!mods) {
59
- return `y-${el}`;
60
- }
61
- return `${getMods(`y-${el}`, mods)}`;
62
- };
63
- };
64
- const defaultLang = {
18
+ }, c = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((a, n) => a + c(e, n), "") : Object.keys(t).reduce(
19
+ (a, n) => a + (t[n] ? c(e, n) : ""),
20
+ ""
21
+ ) : "", G = (e) => (t, a) => {
22
+ let n = t, o = a;
23
+ return n && typeof n != "string" && (o = n, n = ""), n = n ? `${e}__${n}` : e, `${n}${c(n, o)}`;
24
+ }, H = () => (e, t) => t ? `${c(`y-${e}`, t)}` : `y-${e}`, K = {
65
25
  "pull-refresh": {
66
26
  pulling: "下拉刷新...",
67
27
  loosing: "释放刷新...",
@@ -73,18 +33,15 @@ const defaultLang = {
73
33
  validateMessage: "请输入正确内容"
74
34
  }
75
35
  };
76
- ref("zh-CN");
77
- reactive({
78
- "zh-CN": defaultLang
36
+ T("zh-CN");
37
+ D({
38
+ "zh-CN": K
79
39
  });
80
- const createNamespace = (name2) => {
81
- const prefixedName = `y-${name2}`;
82
- return [prefixedName, createBEM(prefixedName), createGlobalBem()];
83
- };
84
- const [name, bem] = createNamespace("input");
85
- const ENTER_CODE = 13;
86
- const Input = /* @__PURE__ */ defineComponent({
87
- name,
40
+ const q = (e) => {
41
+ const t = `y-${e}`;
42
+ return [t, G(t), H()];
43
+ }, [J, Q] = q("input"), X = 13, f = /* @__PURE__ */ W({
44
+ name: J,
88
45
  props: {
89
46
  modelValue: {
90
47
  type: [String, Number],
@@ -96,7 +53,7 @@ const Input = /* @__PURE__ */ defineComponent({
96
53
  },
97
54
  border: {
98
55
  type: Boolean,
99
- default: false
56
+ default: !1
100
57
  },
101
58
  placeholder: {
102
59
  type: String,
@@ -124,145 +81,97 @@ const Input = /* @__PURE__ */ defineComponent({
124
81
  },
125
82
  showWordLimit: {
126
83
  type: Boolean,
127
- default: false
84
+ default: !1
128
85
  },
129
86
  readonly: {
130
87
  type: Boolean,
131
- default: false
88
+ default: !1
132
89
  },
133
90
  disabled: {
134
91
  type: Boolean,
135
- default: false
92
+ default: !1
136
93
  }
137
94
  },
138
95
  emits: ["click", "input", "keypress", "focus", "blur", "update:modelValue"],
139
- setup(props, {
140
- emit
96
+ setup(e, {
97
+ emit: t
141
98
  }) {
142
- const instance = getCurrentInstance();
143
- const {
144
- parent
145
- } = useFormItem();
146
- let limitEl = null;
147
- const setLimit = (value, oldValue) => {
148
- if (value === oldValue)
149
- return;
150
- if (limitEl) {
151
- limitEl.innerHTML = `${props.modelValue.toString().length}/${props.maxLength}`;
152
- }
153
- };
154
- const setLimitContainer = (value, oldValue) => {
155
- if (value === oldValue)
156
- return;
157
- if (value) {
158
- limitEl = document.createElement("div");
159
- limitEl.className = "y-input__limit-num";
160
- const el = instance == null ? void 0 : instance.vnode.el;
161
- el.insertAdjacentElement("afterend", limitEl);
162
- if (props.maxLength)
163
- setLimit(props.maxLength);
164
- } else {
165
- limitEl && limitEl.remove();
166
- limitEl = null;
167
- }
99
+ const a = b(), {
100
+ parent: n
101
+ } = R();
102
+ let o = null;
103
+ const u = (l, r) => {
104
+ l !== r && o && (o.innerHTML = `${e.modelValue.toString().length}/${e.maxLength}`);
105
+ }, m = (l, r) => {
106
+ l !== r && (l ? (o = document.createElement("div"), o.className = "y-input__limit-num", (a == null ? void 0 : a.vnode.el).insertAdjacentElement("afterend", o), e.maxLength && u(e.maxLength)) : (o && o.remove(), o = null));
168
107
  };
169
- watch(() => props.showWordLimit, setLimitContainer);
170
- watch(() => props.modelValue, setLimit);
171
- watch(() => props.maxLength, setLimit);
172
- const onFocus = (e) => emit("focus", e);
173
- const onClick = (e) => emit("click", e);
174
- const onBlur = (e) => {
175
- if (parent) {
108
+ s(() => e.showWordLimit, m), s(() => e.modelValue, u), s(() => e.maxLength, u);
109
+ const L = (l) => t("focus", l), V = (l) => t("click", l), $ = (l) => {
110
+ if (n) {
176
111
  const {
177
- validateWithTrigger
178
- } = parent;
179
- validateWithTrigger("onBlur");
112
+ validateWithTrigger: r
113
+ } = n;
114
+ r("onBlur");
180
115
  }
181
- emit("blur", e);
116
+ t("blur", l);
117
+ }, N = (l) => {
118
+ t("update:modelValue", l.target.value), t("input", l);
119
+ }, B = (l) => {
120
+ l.keyCode === X && (n != null && n.getProp("enterable") || l.preventDefault(), e.type === "search" && (a == null ? void 0 : a.vnode.el).blur()), t("keypress", l);
182
121
  };
183
- const onInput = (e) => {
184
- emit("update:modelValue", e.target.value);
185
- emit("input", e);
186
- };
187
- const onKeypress = (e) => {
188
- if (e.keyCode === ENTER_CODE) {
189
- if (!(parent == null ? void 0 : parent.getProp("enterable"))) {
190
- e.preventDefault();
191
- }
192
- if (props.type === "search") {
193
- const el = instance == null ? void 0 : instance.vnode.el;
194
- el.blur();
195
- }
196
- }
197
- emit("keypress", e);
198
- };
199
- onMounted(() => {
200
- setLimitContainer(props.showWordLimit);
201
- setLimit(props.maxLength);
122
+ F(() => {
123
+ m(e.showWordLimit), u(e.maxLength);
124
+ }), O(() => {
125
+ o && o.remove(), o = null;
202
126
  });
203
- onBeforeUnmount(() => {
204
- limitEl && limitEl.remove();
205
- limitEl = null;
206
- });
207
- const visible = computed({
208
- get: () => props.modelValue,
209
- set: (value) => emit("update:modelValue", value)
127
+ const i = P({
128
+ get: () => e.modelValue,
129
+ set: (l) => t("update:modelValue", l)
210
130
  });
211
131
  return () => {
212
132
  const {
213
- type,
214
- rows,
215
- align,
216
- disabled,
217
- maxLength,
218
- size: inputSize,
219
- border,
220
- readonly,
221
- autocomplete,
222
- placeholder
223
- } = props;
224
- const size = inputSize || (parent == null ? void 0 : parent.getProp("size"));
225
- const attrs = {
226
- class: bem({
227
- [size]: size,
228
- border
133
+ type: l,
134
+ rows: r,
135
+ align: g,
136
+ disabled: C,
137
+ maxLength: E,
138
+ size: M,
139
+ border: _,
140
+ readonly: w,
141
+ autocomplete: S,
142
+ placeholder: z
143
+ } = e, y = M || (n == null ? void 0 : n.getProp("size")), p = {
144
+ class: Q({
145
+ [y]: y,
146
+ border: _
229
147
  }),
230
148
  style: {
231
- "text-align": align
149
+ "text-align": g
232
150
  },
233
- disabled,
234
- readonly,
235
- placeholder,
236
- maxlength: maxLength,
237
- onInput,
238
- autocomplete,
239
- onFocus,
240
- onClick,
241
- onKeypress,
242
- onBlur
151
+ disabled: C,
152
+ readonly: w,
153
+ placeholder: z,
154
+ maxlength: E,
155
+ onInput: N,
156
+ autocomplete: S,
157
+ onFocus: L,
158
+ onClick: V,
159
+ onKeypress: B,
160
+ onBlur: $
243
161
  };
244
- if (type === "textarea") {
245
- return withDirectives(createVNode("textarea", mergeProps(attrs, {
246
- "rows": rows,
247
- "onUpdate:modelValue": ($event) => visible.value = $event
248
- }), null), [[vModelText, visible.value]]);
249
- }
250
- return withDirectives(createVNode("input", mergeProps(attrs, {
251
- "onUpdate:modelValue": ($event) => visible.value = $event,
252
- "type": type
253
- }), null), [[vModelDynamic, visible.value]]);
162
+ return l === "textarea" ? h(v("textarea", x(p, {
163
+ rows: r,
164
+ "onUpdate:modelValue": (d) => i.value = d
165
+ }), null), [[U, i.value]]) : h(v("input", x(p, {
166
+ "onUpdate:modelValue": (d) => i.value = d,
167
+ type: l
168
+ }), null), [[j, i.value]]);
254
169
  };
255
170
  }
256
171
  });
257
- const reset = "";
258
- const libs = "";
259
- const font = "";
260
- const animation = "";
261
- const theme = "";
262
- const style = "";
263
- Input.install = (Vue) => {
264
- Vue.component(Input.name, Input);
172
+ f.install = (e) => {
173
+ e.component(f.name, f);
265
174
  };
266
175
  export {
267
- Input as default
176
+ f as default
268
177
  };