y-design-ssr 0.2.1 → 0.2.2
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 +579 -1
- package/libs/button/index.mjs +111 -66
- package/libs/button/index.umd.js +203 -2
- package/libs/cell/index.css +1077 -1
- package/libs/cell/index.mjs +167 -104
- package/libs/cell/index.umd.js +300 -2
- package/libs/checkbox/index.css +1053 -1
- package/libs/checkbox/index.mjs +242 -127
- package/libs/checkbox/index.umd.js +369 -2
- package/libs/checkboxGroup/index.css +422 -1
- package/libs/checkboxGroup/index.mjs +173 -87
- package/libs/checkboxGroup/index.umd.js +265 -2
- package/libs/col/index.css +615 -1
- package/libs/col/index.mjs +246 -81
- package/libs/col/index.umd.js +305 -2
- package/libs/countdown/index.css +417 -1
- package/libs/countdown/index.mjs +179 -71
- package/libs/countdown/index.umd.js +231 -2
- package/libs/dialog/index.css +1405 -1
- package/libs/dialog/index.mjs +646 -476
- package/libs/dialog/index.umd.js +1128 -2
- package/libs/empty/index.css +457 -1
- package/libs/empty/index.mjs +91 -44
- package/libs/empty/index.umd.js +139 -2
- package/libs/form/index.css +477 -1
- package/libs/form/index.mjs +226 -126
- package/libs/form/index.umd.js +319 -2
- package/libs/formItem/index.css +477 -1
- package/libs/formItem/index.mjs +276 -126
- package/libs/formItem/index.umd.js +372 -2
- package/libs/icon/index.css +982 -1
- package/libs/icon/index.mjs +107 -58
- package/libs/icon/index.umd.js +186 -2
- package/libs/index.css +2902 -1
- package/libs/index.mjs +3785 -2344
- package/libs/index.umd.js +5509 -2
- package/libs/input/index.css +483 -1
- package/libs/input/index.mjs +183 -92
- package/libs/input/index.umd.js +274 -2
- package/libs/layout/index.css +684 -1
- package/libs/layout/index.mjs +230 -130
- package/libs/layout/index.umd.js +318 -2
- package/libs/list/index.css +440 -1
- package/libs/list/index.mjs +388 -207
- package/libs/list/index.umd.js +571 -2
- package/libs/loading/index.css +548 -1
- package/libs/loading/index.mjs +196 -118
- package/libs/loading/index.umd.js +321 -2
- package/libs/mask/index.css +426 -1
- package/libs/mask/index.mjs +131 -70
- package/libs/mask/index.umd.js +201 -2
- package/libs/popup/index.css +465 -1
- package/libs/popup/index.mjs +210 -134
- package/libs/popup/index.umd.js +358 -2
- package/libs/progress/index.css +488 -1
- package/libs/progress/index.mjs +200 -128
- package/libs/progress/index.umd.js +322 -2
- package/libs/pullrefresh/index.css +441 -1
- package/libs/pullrefresh/index.mjs +241 -111
- package/libs/pullrefresh/index.umd.js +302 -2
- package/libs/row/index.css +485 -1
- package/libs/row/index.mjs +181 -89
- package/libs/row/index.umd.js +237 -2
- package/libs/slider/index.css +558 -1
- package/libs/slider/index.mjs +356 -160
- package/libs/slider/index.umd.js +453 -2
- package/libs/stepper/index.css +489 -1
- package/libs/stepper/index.mjs +181 -101
- package/libs/stepper/index.umd.js +269 -2
- package/libs/swipe/index.css +506 -1
- package/libs/swipe/index.mjs +542 -259
- package/libs/swipe/index.umd.js +703 -2
- package/libs/swipeItem/index.css +424 -1
- package/libs/swipeItem/index.mjs +111 -52
- package/libs/swipeItem/index.umd.js +154 -2
- package/libs/switch/index.css +472 -1
- package/libs/switch/index.mjs +121 -62
- package/libs/switch/index.umd.js +200 -2
- package/libs/tab/index.mjs +131 -68
- package/libs/tab/index.umd.js +190 -1
- package/libs/tabs/index.css +514 -1
- package/libs/tabs/index.mjs +751 -410
- package/libs/tabs/index.umd.js +1020 -2
- package/libs/toast/index.css +1050 -1
- package/libs/toast/index.mjs +183 -114
- package/libs/toast/index.umd.js +306 -2
- package/libs/tooltip/index.css +514 -1
- package/libs/tooltip/index.mjs +293 -155
- package/libs/tooltip/index.umd.js +416 -2
- package/package.json +2 -2
package/libs/progress/index.mjs
CHANGED
|
@@ -1,11 +1,40 @@
|
|
|
1
|
-
import { ref
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { ref, reactive, defineComponent, onMounted, onBeforeUpdate, onUnmounted, watch, nextTick, createVNode, Fragment } 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 = {
|
|
9
38
|
"pull-refresh": {
|
|
10
39
|
pulling: "下拉刷新...",
|
|
11
40
|
loosing: "释放刷新...",
|
|
@@ -17,15 +46,23 @@ const v = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t)
|
|
|
17
46
|
validateMessage: "请输入正确内容"
|
|
18
47
|
}
|
|
19
48
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"zh-CN":
|
|
49
|
+
ref("zh-CN");
|
|
50
|
+
reactive({
|
|
51
|
+
"zh-CN": defaultLang
|
|
23
52
|
});
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
return [
|
|
27
|
-
}
|
|
28
|
-
|
|
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 [name, bem] = createNamespace("progress");
|
|
64
|
+
const Progress = /* @__PURE__ */ defineComponent({
|
|
65
|
+
name,
|
|
29
66
|
props: {
|
|
30
67
|
// 进度
|
|
31
68
|
percent: {
|
|
@@ -65,12 +102,12 @@ const q = (e) => {
|
|
|
65
102
|
// 展示默认pivot
|
|
66
103
|
defaultPivot: {
|
|
67
104
|
type: Boolean,
|
|
68
|
-
default:
|
|
105
|
+
default: false
|
|
69
106
|
},
|
|
70
107
|
// 里程碑模式
|
|
71
108
|
modeMilestone: {
|
|
72
109
|
type: Boolean,
|
|
73
|
-
default:
|
|
110
|
+
default: false
|
|
74
111
|
},
|
|
75
112
|
// 里程碑节点
|
|
76
113
|
mileages: {
|
|
@@ -80,7 +117,7 @@ const q = (e) => {
|
|
|
80
117
|
// 动画
|
|
81
118
|
animation: {
|
|
82
119
|
type: Boolean,
|
|
83
|
-
default:
|
|
120
|
+
default: false
|
|
84
121
|
},
|
|
85
122
|
// 动画时长
|
|
86
123
|
duration: {
|
|
@@ -98,147 +135,182 @@ const q = (e) => {
|
|
|
98
135
|
default: "%"
|
|
99
136
|
}
|
|
100
137
|
},
|
|
101
|
-
setup(
|
|
102
|
-
slots
|
|
138
|
+
setup(props, {
|
|
139
|
+
slots
|
|
103
140
|
}) {
|
|
104
|
-
const
|
|
141
|
+
const progressRef = ref(null);
|
|
142
|
+
const pivotContentRef = ref(null);
|
|
143
|
+
const mileageRef = ref([]);
|
|
144
|
+
const widthData = reactive({
|
|
105
145
|
progressWidth: 0,
|
|
106
146
|
pivotContentWidth: 0,
|
|
107
147
|
mileageWidth: []
|
|
108
|
-
})
|
|
148
|
+
});
|
|
149
|
+
const growData = reactive({
|
|
109
150
|
number: 0,
|
|
110
151
|
oldPercent: 0,
|
|
111
152
|
timer: 0
|
|
112
153
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
154
|
+
onMounted(() => {
|
|
155
|
+
resize();
|
|
156
|
+
props.animation && grow();
|
|
157
|
+
window.addEventListener("resize", resize);
|
|
158
|
+
});
|
|
159
|
+
onBeforeUpdate(() => {
|
|
160
|
+
mileageRef.value = [];
|
|
161
|
+
});
|
|
162
|
+
onUnmounted(() => {
|
|
163
|
+
growData.timer && cancelAnimationFrame(growData.timer);
|
|
164
|
+
window.removeEventListener("resize", resize);
|
|
165
|
+
});
|
|
166
|
+
watch(() => props.percent, () => {
|
|
167
|
+
grow();
|
|
168
|
+
resizeWidth();
|
|
121
169
|
});
|
|
122
|
-
const
|
|
170
|
+
const grow = () => {
|
|
123
171
|
const {
|
|
124
|
-
duration
|
|
125
|
-
percent
|
|
126
|
-
} =
|
|
127
|
-
|
|
172
|
+
duration,
|
|
173
|
+
percent
|
|
174
|
+
} = props;
|
|
175
|
+
const step = Math.abs(percent - growData.oldPercent) / (duration / 16);
|
|
176
|
+
if (step === 0)
|
|
128
177
|
return;
|
|
129
|
-
let
|
|
130
|
-
const
|
|
131
|
-
|
|
178
|
+
let current = Number(growData.oldPercent);
|
|
179
|
+
const update = () => {
|
|
180
|
+
percent > growData.oldPercent ? current += step : current -= step;
|
|
181
|
+
if (percent > growData.oldPercent && current > percent || percent < growData.oldPercent && current < percent) {
|
|
182
|
+
current = percent;
|
|
183
|
+
} else {
|
|
184
|
+
growData.timer = requestAnimationFrame(update);
|
|
185
|
+
}
|
|
186
|
+
growData.oldPercent = current;
|
|
187
|
+
growData.number = parseInt(current.toString());
|
|
132
188
|
};
|
|
133
|
-
|
|
189
|
+
growData.timer && cancelAnimationFrame(growData.timer);
|
|
190
|
+
growData.timer = requestAnimationFrame(update);
|
|
191
|
+
};
|
|
192
|
+
watch(() => props.mileages, () => resizeMileage);
|
|
193
|
+
const resize = () => {
|
|
194
|
+
resizeWidth();
|
|
195
|
+
resizeMileage();
|
|
134
196
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}).catch((o) => {
|
|
142
|
-
throw new Error(o);
|
|
197
|
+
const resizeWidth = () => {
|
|
198
|
+
nextTick(() => {
|
|
199
|
+
widthData.progressWidth = progressRef.value && progressRef.value.offsetWidth || 0;
|
|
200
|
+
widthData.pivotContentWidth = pivotContentRef.value && pivotContentRef.value.offsetWidth || 0;
|
|
201
|
+
}).catch((e) => {
|
|
202
|
+
throw new Error(e);
|
|
143
203
|
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
204
|
+
};
|
|
205
|
+
const resizeMileage = () => {
|
|
206
|
+
nextTick(() => {
|
|
207
|
+
props.mileages.forEach((_, i) => {
|
|
208
|
+
widthData.mileageWidth[i] = mileageRef.value[i] && mileageRef.value[i].offsetWidth || 0;
|
|
148
209
|
});
|
|
149
|
-
}).catch((
|
|
150
|
-
throw new Error(
|
|
210
|
+
}).catch((e) => {
|
|
211
|
+
throw new Error(e);
|
|
151
212
|
});
|
|
152
|
-
}
|
|
153
|
-
|
|
213
|
+
};
|
|
214
|
+
const renderMileage = () => {
|
|
215
|
+
var _a;
|
|
154
216
|
const {
|
|
155
|
-
mileages
|
|
156
|
-
percent
|
|
157
|
-
animation:
|
|
158
|
-
} =
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
217
|
+
mileages,
|
|
218
|
+
percent,
|
|
219
|
+
animation: animation2
|
|
220
|
+
} = props;
|
|
221
|
+
const doms = [];
|
|
222
|
+
for (let i = 0; i < mileages.length; i++) {
|
|
223
|
+
doms[i] = createVNode("div", {
|
|
224
|
+
"ref": (el) => {
|
|
225
|
+
if (el)
|
|
226
|
+
mileageRef.value[i] = el;
|
|
163
227
|
},
|
|
164
|
-
class: [
|
|
165
|
-
key: `mileage${
|
|
166
|
-
style: {
|
|
167
|
-
left: `${(
|
|
228
|
+
"class": [bem("pivot-content", (animation2 ? growData.number : percent) >= mileages[i] ? "arrive" : "no-arrive")],
|
|
229
|
+
"key": `mileage${i}`,
|
|
230
|
+
"style": {
|
|
231
|
+
left: `${(widthData.progressWidth - widthData.mileageWidth[i]) * mileages[i] / 100}px`
|
|
168
232
|
}
|
|
169
|
-
}, [((
|
|
170
|
-
class:
|
|
171
|
-
}, [`${
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
233
|
+
}, [((_a = slots.mileage) == null ? void 0 : _a.call(slots)) || createVNode("div", {
|
|
234
|
+
"class": bem("pivot")
|
|
235
|
+
}, [`${mileages[i]}%`])]);
|
|
236
|
+
}
|
|
237
|
+
return doms;
|
|
238
|
+
};
|
|
239
|
+
const renderPivot = () => {
|
|
240
|
+
var _a;
|
|
175
241
|
const {
|
|
176
|
-
defaultPivot
|
|
177
|
-
textColor
|
|
178
|
-
percent
|
|
179
|
-
animation:
|
|
180
|
-
unit
|
|
181
|
-
} =
|
|
182
|
-
return
|
|
183
|
-
class:
|
|
184
|
-
style: {
|
|
185
|
-
color:
|
|
242
|
+
defaultPivot,
|
|
243
|
+
textColor,
|
|
244
|
+
percent,
|
|
245
|
+
animation: animation2,
|
|
246
|
+
unit
|
|
247
|
+
} = props;
|
|
248
|
+
return createVNode(Fragment, null, [((_a = slots.pivot) == null ? void 0 : _a.call(slots)) || defaultPivot && createVNode("div", {
|
|
249
|
+
"class": bem("pivot"),
|
|
250
|
+
"style": {
|
|
251
|
+
color: textColor
|
|
186
252
|
}
|
|
187
|
-
}, [
|
|
188
|
-
class:
|
|
189
|
-
}, [
|
|
253
|
+
}, [animation2 ? createVNode("div", {
|
|
254
|
+
"class": bem("number")
|
|
255
|
+
}, [createVNode("span", null, [growData.number, unit])]) : `${percent}${unit}`])]);
|
|
190
256
|
};
|
|
191
257
|
return () => {
|
|
192
258
|
const {
|
|
193
|
-
strokeWidth
|
|
194
|
-
trackColor
|
|
195
|
-
radius
|
|
196
|
-
percent
|
|
197
|
-
color
|
|
198
|
-
animation:
|
|
199
|
-
duration
|
|
200
|
-
timing
|
|
201
|
-
defaultPivot
|
|
202
|
-
pivotColor
|
|
203
|
-
modeMilestone
|
|
204
|
-
} =
|
|
205
|
-
return
|
|
206
|
-
class:
|
|
207
|
-
ref:
|
|
208
|
-
style: {
|
|
209
|
-
height:
|
|
210
|
-
background:
|
|
211
|
-
borderRadius:
|
|
259
|
+
strokeWidth,
|
|
260
|
+
trackColor,
|
|
261
|
+
radius,
|
|
262
|
+
percent,
|
|
263
|
+
color,
|
|
264
|
+
animation: animation2,
|
|
265
|
+
duration,
|
|
266
|
+
timing,
|
|
267
|
+
defaultPivot,
|
|
268
|
+
pivotColor,
|
|
269
|
+
modeMilestone
|
|
270
|
+
} = props;
|
|
271
|
+
return createVNode("div", {
|
|
272
|
+
"class": bem(),
|
|
273
|
+
"ref": progressRef,
|
|
274
|
+
"style": {
|
|
275
|
+
height: parseUnit(strokeWidth),
|
|
276
|
+
background: trackColor,
|
|
277
|
+
borderRadius: parseUnit(radius)
|
|
212
278
|
}
|
|
213
|
-
}, [
|
|
214
|
-
class:
|
|
215
|
-
animation:
|
|
279
|
+
}, [createVNode("span", {
|
|
280
|
+
"class": bem("portion", {
|
|
281
|
+
animation: animation2
|
|
216
282
|
}),
|
|
217
|
-
style: {
|
|
218
|
-
width: `${
|
|
219
|
-
background:
|
|
220
|
-
transitionDuration: `${
|
|
221
|
-
transitionTimingFunction:
|
|
283
|
+
"style": {
|
|
284
|
+
width: `${widthData.progressWidth * percent / 100}px`,
|
|
285
|
+
background: color,
|
|
286
|
+
transitionDuration: `${duration}ms`,
|
|
287
|
+
transitionTimingFunction: timing
|
|
222
288
|
}
|
|
223
|
-
}, [
|
|
224
|
-
ref:
|
|
225
|
-
class:
|
|
226
|
-
animation:
|
|
289
|
+
}, [createVNode("div", {
|
|
290
|
+
"ref": pivotContentRef,
|
|
291
|
+
"class": bem("pivot-content", {
|
|
292
|
+
animation: animation2
|
|
227
293
|
}),
|
|
228
|
-
style: {
|
|
229
|
-
left: `${(
|
|
230
|
-
background:
|
|
231
|
-
transitionDuration: `${
|
|
232
|
-
transitionTimingFunction:
|
|
294
|
+
"style": {
|
|
295
|
+
left: `${(widthData.progressWidth - widthData.pivotContentWidth) * percent / 100}px`,
|
|
296
|
+
background: defaultPivot ? pivotColor || color : "none",
|
|
297
|
+
transitionDuration: `${duration}ms`,
|
|
298
|
+
transitionTimingFunction: timing
|
|
233
299
|
}
|
|
234
|
-
}, [
|
|
300
|
+
}, [renderPivot()])]), modeMilestone && renderMileage()]);
|
|
235
301
|
};
|
|
236
302
|
}
|
|
237
303
|
});
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
304
|
+
const reset = "";
|
|
305
|
+
const libs = "";
|
|
306
|
+
const font = "";
|
|
307
|
+
const animation = "";
|
|
308
|
+
const theme = "";
|
|
309
|
+
const style = "";
|
|
310
|
+
Progress.install = (Vue) => {
|
|
311
|
+
const { name: name2 } = Progress;
|
|
312
|
+
Vue.component(name2, Progress);
|
|
241
313
|
};
|
|
242
314
|
export {
|
|
243
|
-
|
|
315
|
+
Progress as default
|
|
244
316
|
};
|