y-design-ssr 0.2.3 → 0.2.4

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 (119) hide show
  1. package/libs/button/index.css +1 -579
  2. package/libs/button/index.mjs +66 -111
  3. package/libs/button/index.umd.js +2 -203
  4. package/libs/button/package.json +1 -8
  5. package/libs/cell/index.css +1 -1077
  6. package/libs/cell/index.mjs +104 -167
  7. package/libs/cell/index.umd.js +2 -300
  8. package/libs/cell/package.json +1 -8
  9. package/libs/checkbox/index.css +1 -1053
  10. package/libs/checkbox/index.mjs +127 -242
  11. package/libs/checkbox/index.umd.js +2 -369
  12. package/libs/checkbox/package.json +1 -8
  13. package/libs/checkboxGroup/index.css +1 -422
  14. package/libs/checkboxGroup/index.mjs +87 -173
  15. package/libs/checkboxGroup/index.umd.js +2 -265
  16. package/libs/checkboxGroup/package.json +1 -8
  17. package/libs/col/index.css +1 -615
  18. package/libs/col/index.mjs +81 -246
  19. package/libs/col/index.umd.js +2 -305
  20. package/libs/col/package.json +1 -8
  21. package/libs/countdown/index.css +1 -417
  22. package/libs/countdown/index.mjs +71 -179
  23. package/libs/countdown/index.umd.js +2 -231
  24. package/libs/countdown/package.json +1 -8
  25. package/libs/dialog/index.css +1 -1405
  26. package/libs/dialog/index.mjs +476 -646
  27. package/libs/dialog/index.umd.js +2 -1128
  28. package/libs/dialog/package.json +1 -8
  29. package/libs/empty/index.css +1 -457
  30. package/libs/empty/index.mjs +44 -91
  31. package/libs/empty/index.umd.js +2 -139
  32. package/libs/empty/package.json +1 -8
  33. package/libs/form/index.css +1 -477
  34. package/libs/form/index.mjs +126 -226
  35. package/libs/form/index.umd.js +2 -319
  36. package/libs/form/package.json +1 -8
  37. package/libs/formItem/index.css +1 -477
  38. package/libs/formItem/index.mjs +126 -276
  39. package/libs/formItem/index.umd.js +2 -372
  40. package/libs/formItem/package.json +1 -8
  41. package/libs/icon/index.css +1 -982
  42. package/libs/icon/index.mjs +58 -107
  43. package/libs/icon/index.umd.js +2 -186
  44. package/libs/icon/package.json +1 -8
  45. package/libs/index.css +1 -2902
  46. package/libs/index.mjs +2348 -3789
  47. package/libs/index.umd.js +2 -5509
  48. package/libs/input/index.css +1 -483
  49. package/libs/input/index.mjs +92 -183
  50. package/libs/input/index.umd.js +2 -274
  51. package/libs/input/package.json +1 -8
  52. package/libs/layout/index.css +1 -684
  53. package/libs/layout/index.mjs +130 -230
  54. package/libs/layout/index.umd.js +2 -318
  55. package/libs/layout/package.json +1 -8
  56. package/libs/list/index.css +1 -440
  57. package/libs/list/index.mjs +207 -388
  58. package/libs/list/index.umd.js +2 -571
  59. package/libs/list/package.json +1 -8
  60. package/libs/loading/index.css +1 -548
  61. package/libs/loading/index.mjs +118 -196
  62. package/libs/loading/index.umd.js +2 -321
  63. package/libs/loading/package.json +1 -8
  64. package/libs/mask/index.css +1 -426
  65. package/libs/mask/index.mjs +70 -131
  66. package/libs/mask/index.umd.js +2 -201
  67. package/libs/mask/package.json +1 -8
  68. package/libs/popup/index.css +1 -465
  69. package/libs/popup/index.mjs +134 -210
  70. package/libs/popup/index.umd.js +2 -358
  71. package/libs/popup/package.json +1 -8
  72. package/libs/progress/index.css +1 -488
  73. package/libs/progress/index.mjs +128 -200
  74. package/libs/progress/index.umd.js +2 -322
  75. package/libs/progress/package.json +1 -8
  76. package/libs/pullrefresh/index.css +1 -441
  77. package/libs/pullrefresh/index.mjs +111 -241
  78. package/libs/pullrefresh/index.umd.js +2 -302
  79. package/libs/pullrefresh/package.json +1 -8
  80. package/libs/row/index.css +1 -485
  81. package/libs/row/index.mjs +89 -181
  82. package/libs/row/index.umd.js +2 -237
  83. package/libs/row/package.json +1 -8
  84. package/libs/slider/index.css +1 -558
  85. package/libs/slider/index.mjs +160 -356
  86. package/libs/slider/index.umd.js +2 -453
  87. package/libs/slider/package.json +1 -8
  88. package/libs/stepper/index.css +1 -489
  89. package/libs/stepper/index.mjs +101 -181
  90. package/libs/stepper/index.umd.js +2 -269
  91. package/libs/stepper/package.json +1 -8
  92. package/libs/swipe/index.css +1 -506
  93. package/libs/swipe/index.mjs +259 -542
  94. package/libs/swipe/index.umd.js +2 -703
  95. package/libs/swipe/package.json +1 -8
  96. package/libs/swipeItem/index.css +1 -424
  97. package/libs/swipeItem/index.mjs +52 -111
  98. package/libs/swipeItem/index.umd.js +2 -154
  99. package/libs/swipeItem/package.json +1 -8
  100. package/libs/switch/index.css +1 -472
  101. package/libs/switch/index.mjs +62 -121
  102. package/libs/switch/index.umd.js +2 -200
  103. package/libs/switch/package.json +1 -8
  104. package/libs/tab/index.mjs +68 -131
  105. package/libs/tab/index.umd.js +1 -190
  106. package/libs/tab/package.json +1 -8
  107. package/libs/tabs/index.css +1 -514
  108. package/libs/tabs/index.mjs +410 -751
  109. package/libs/tabs/index.umd.js +2 -1020
  110. package/libs/tabs/package.json +1 -8
  111. package/libs/toast/index.css +1 -1050
  112. package/libs/toast/index.mjs +114 -183
  113. package/libs/toast/index.umd.js +2 -306
  114. package/libs/toast/package.json +1 -8
  115. package/libs/tooltip/index.css +1 -514
  116. package/libs/tooltip/index.mjs +155 -293
  117. package/libs/tooltip/index.umd.js +2 -416
  118. package/libs/tooltip/package.json +1 -8
  119. package/package.json +5 -12
@@ -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
  };