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.
- package/libs/button/index.css +1 -579
- package/libs/button/index.mjs +66 -111
- package/libs/button/index.umd.js +2 -203
- package/libs/button/package.json +1 -8
- package/libs/cell/index.css +1 -1077
- package/libs/cell/index.mjs +104 -167
- package/libs/cell/index.umd.js +2 -300
- package/libs/cell/package.json +1 -8
- package/libs/checkbox/index.css +1 -1053
- package/libs/checkbox/index.mjs +127 -242
- package/libs/checkbox/index.umd.js +2 -369
- package/libs/checkbox/package.json +1 -8
- package/libs/checkboxGroup/index.css +1 -422
- package/libs/checkboxGroup/index.mjs +87 -173
- package/libs/checkboxGroup/index.umd.js +2 -265
- package/libs/checkboxGroup/package.json +1 -8
- package/libs/col/index.css +1 -615
- package/libs/col/index.mjs +81 -246
- package/libs/col/index.umd.js +2 -305
- package/libs/col/package.json +1 -8
- package/libs/countdown/index.css +1 -417
- package/libs/countdown/index.mjs +71 -179
- package/libs/countdown/index.umd.js +2 -231
- package/libs/countdown/package.json +1 -8
- package/libs/dialog/index.css +1 -1405
- package/libs/dialog/index.mjs +476 -646
- package/libs/dialog/index.umd.js +2 -1128
- package/libs/dialog/package.json +1 -8
- package/libs/empty/index.css +1 -457
- package/libs/empty/index.mjs +44 -91
- package/libs/empty/index.umd.js +2 -139
- package/libs/empty/package.json +1 -8
- package/libs/form/index.css +1 -477
- package/libs/form/index.mjs +126 -226
- package/libs/form/index.umd.js +2 -319
- package/libs/form/package.json +1 -8
- package/libs/formItem/index.css +1 -477
- package/libs/formItem/index.mjs +126 -276
- package/libs/formItem/index.umd.js +2 -372
- package/libs/formItem/package.json +1 -8
- package/libs/icon/index.css +1 -982
- package/libs/icon/index.mjs +58 -107
- package/libs/icon/index.umd.js +2 -186
- package/libs/icon/package.json +1 -8
- package/libs/index.css +1 -2902
- package/libs/index.mjs +2348 -3789
- package/libs/index.umd.js +2 -5509
- package/libs/input/index.css +1 -483
- package/libs/input/index.mjs +92 -183
- package/libs/input/index.umd.js +2 -274
- package/libs/input/package.json +1 -8
- package/libs/layout/index.css +1 -684
- package/libs/layout/index.mjs +130 -230
- package/libs/layout/index.umd.js +2 -318
- package/libs/layout/package.json +1 -8
- package/libs/list/index.css +1 -440
- package/libs/list/index.mjs +207 -388
- package/libs/list/index.umd.js +2 -571
- package/libs/list/package.json +1 -8
- package/libs/loading/index.css +1 -548
- package/libs/loading/index.mjs +118 -196
- package/libs/loading/index.umd.js +2 -321
- package/libs/loading/package.json +1 -8
- package/libs/mask/index.css +1 -426
- package/libs/mask/index.mjs +70 -131
- package/libs/mask/index.umd.js +2 -201
- package/libs/mask/package.json +1 -8
- package/libs/popup/index.css +1 -465
- package/libs/popup/index.mjs +134 -210
- package/libs/popup/index.umd.js +2 -358
- package/libs/popup/package.json +1 -8
- package/libs/progress/index.css +1 -488
- package/libs/progress/index.mjs +128 -200
- package/libs/progress/index.umd.js +2 -322
- package/libs/progress/package.json +1 -8
- package/libs/pullrefresh/index.css +1 -441
- package/libs/pullrefresh/index.mjs +111 -241
- package/libs/pullrefresh/index.umd.js +2 -302
- package/libs/pullrefresh/package.json +1 -8
- package/libs/row/index.css +1 -485
- package/libs/row/index.mjs +89 -181
- package/libs/row/index.umd.js +2 -237
- package/libs/row/package.json +1 -8
- package/libs/slider/index.css +1 -558
- package/libs/slider/index.mjs +160 -356
- package/libs/slider/index.umd.js +2 -453
- package/libs/slider/package.json +1 -8
- package/libs/stepper/index.css +1 -489
- package/libs/stepper/index.mjs +101 -181
- package/libs/stepper/index.umd.js +2 -269
- package/libs/stepper/package.json +1 -8
- package/libs/swipe/index.css +1 -506
- package/libs/swipe/index.mjs +259 -542
- package/libs/swipe/index.umd.js +2 -703
- package/libs/swipe/package.json +1 -8
- package/libs/swipeItem/index.css +1 -424
- package/libs/swipeItem/index.mjs +52 -111
- package/libs/swipeItem/index.umd.js +2 -154
- package/libs/swipeItem/package.json +1 -8
- package/libs/switch/index.css +1 -472
- package/libs/switch/index.mjs +62 -121
- package/libs/switch/index.umd.js +2 -200
- package/libs/switch/package.json +1 -8
- package/libs/tab/index.mjs +68 -131
- package/libs/tab/index.umd.js +1 -190
- package/libs/tab/package.json +1 -8
- package/libs/tabs/index.css +1 -514
- package/libs/tabs/index.mjs +410 -751
- package/libs/tabs/index.umd.js +2 -1020
- package/libs/tabs/package.json +1 -8
- package/libs/toast/index.css +1 -1050
- package/libs/toast/index.mjs +114 -183
- package/libs/toast/index.umd.js +2 -306
- package/libs/toast/package.json +1 -8
- package/libs/tooltip/index.css +1 -514
- package/libs/tooltip/index.mjs +155 -293
- package/libs/tooltip/index.umd.js +2 -416
- package/libs/tooltip/package.json +1 -8
- package/package.json +5 -12
package/libs/input/index.mjs
CHANGED
|
@@ -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
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
13
|
-
resetValidation();
|
|
14
|
-
change();
|
|
15
|
-
validateWithTrigger("onChange");
|
|
16
|
-
}
|
|
9
|
+
e.instance && e.instance.exposed && (n(), o(), u("onChange"));
|
|
17
10
|
}
|
|
18
|
-
)
|
|
19
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
"zh-CN":
|
|
36
|
+
T("zh-CN");
|
|
37
|
+
D({
|
|
38
|
+
"zh-CN": K
|
|
79
39
|
});
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
return [
|
|
83
|
-
}
|
|
84
|
-
|
|
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:
|
|
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:
|
|
84
|
+
default: !1
|
|
128
85
|
},
|
|
129
86
|
readonly: {
|
|
130
87
|
type: Boolean,
|
|
131
|
-
default:
|
|
88
|
+
default: !1
|
|
132
89
|
},
|
|
133
90
|
disabled: {
|
|
134
91
|
type: Boolean,
|
|
135
|
-
default:
|
|
92
|
+
default: !1
|
|
136
93
|
}
|
|
137
94
|
},
|
|
138
95
|
emits: ["click", "input", "keypress", "focus", "blur", "update:modelValue"],
|
|
139
|
-
setup(
|
|
140
|
-
emit
|
|
96
|
+
setup(e, {
|
|
97
|
+
emit: t
|
|
141
98
|
}) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
} =
|
|
179
|
-
|
|
112
|
+
validateWithTrigger: r
|
|
113
|
+
} = n;
|
|
114
|
+
r("onBlur");
|
|
180
115
|
}
|
|
181
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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:
|
|
219
|
-
border,
|
|
220
|
-
readonly,
|
|
221
|
-
autocomplete,
|
|
222
|
-
placeholder
|
|
223
|
-
} =
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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":
|
|
149
|
+
"text-align": g
|
|
232
150
|
},
|
|
233
|
-
disabled,
|
|
234
|
-
readonly,
|
|
235
|
-
placeholder,
|
|
236
|
-
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
|
|
258
|
-
|
|
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
|
-
|
|
176
|
+
f as default
|
|
268
177
|
};
|