@varlet/ui 2.21.0 → 2.21.1-alpha.1705566892480
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/es/index-bar/IndexBar.mjs +10 -2
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/picker/Picker.mjs +27 -34
- package/es/snackbar/Snackbar.mjs +21 -18
- package/es/snackbar/core.mjs +31 -36
- package/es/snackbar/props.mjs +1 -3
- package/es/snackbar/style/index.mjs +0 -1
- package/es/varlet.esm.js +2436 -2434
- package/highlight/web-types.en-US.json +10 -1
- package/highlight/web-types.zh-CN.json +10 -1
- package/lib/varlet.cjs.js +138 -142
- package/package.json +7 -7
- package/types/form.d.ts +1 -1
- package/types/indexBar.d.ts +1 -0
- package/umd/varlet.js +4 -4
|
@@ -36,7 +36,7 @@ import { props } from "./props.mjs";
|
|
|
36
36
|
import { createNamespace } from "../utils/components.mjs";
|
|
37
37
|
import { onSmartMounted } from "@varlet/use";
|
|
38
38
|
const { name, n, classes } = createNamespace("index-bar");
|
|
39
|
-
import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
39
|
+
import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
40
40
|
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
41
41
|
const _hoisted_1 = ["onClick"];
|
|
42
42
|
function __render__(_ctx, _cache) {
|
|
@@ -64,7 +64,15 @@ function __render__(_ctx, _cache) {
|
|
|
64
64
|
class: _normalizeClass(_ctx.classes(_ctx.n("anchor-item"), [_ctx.active === anchorName, _ctx.n("anchor-item--active")])),
|
|
65
65
|
style: _normalizeStyle({ color: _ctx.active === anchorName && _ctx.highlightColor ? _ctx.highlightColor : void 0 }),
|
|
66
66
|
onClick: ($event) => _ctx.anchorClick({ anchorName, manualCall: true })
|
|
67
|
-
},
|
|
67
|
+
}, [
|
|
68
|
+
_renderSlot(_ctx.$slots, "anchor-name", { anchorName }, () => [
|
|
69
|
+
_createTextVNode(
|
|
70
|
+
_toDisplayString(anchorName),
|
|
71
|
+
1
|
|
72
|
+
/* TEXT */
|
|
73
|
+
)
|
|
74
|
+
])
|
|
75
|
+
], 14, _hoisted_1);
|
|
68
76
|
}),
|
|
69
77
|
128
|
|
70
78
|
/* KEYED_FRAGMENT */
|
package/es/index.bundle.mjs
CHANGED
|
@@ -262,7 +262,7 @@ import './tooltip/style/index.mjs'
|
|
|
262
262
|
import './uploader/style/index.mjs'
|
|
263
263
|
import './watermark/style/index.mjs'
|
|
264
264
|
|
|
265
|
-
const version = '2.21.
|
|
265
|
+
const version = '2.21.1-alpha.1705566892480'
|
|
266
266
|
|
|
267
267
|
function install(app) {
|
|
268
268
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -174,7 +174,7 @@ export * from './tooltip/index.mjs'
|
|
|
174
174
|
export * from './uploader/index.mjs'
|
|
175
175
|
export * from './watermark/index.mjs'
|
|
176
176
|
|
|
177
|
-
const version = '2.21.
|
|
177
|
+
const version = '2.21.1-alpha.1705566892480'
|
|
178
178
|
|
|
179
179
|
function install(app) {
|
|
180
180
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/picker/Picker.mjs
CHANGED
|
@@ -232,18 +232,9 @@ const __sfc__ = defineComponent({
|
|
|
232
232
|
const columnHeight = computed(() => optionCount.value * optionHeight.value);
|
|
233
233
|
const { prevY, moveY, dragging, startTouch, moveTouch, endTouch } = useTouch();
|
|
234
234
|
let prevIndexes = [];
|
|
235
|
-
|
|
236
|
-
watch(() => props2.columns,
|
|
237
|
-
watch(
|
|
238
|
-
() => modelValue.value,
|
|
239
|
-
() => {
|
|
240
|
-
if (props2.cascade && props2.modelValue.length) {
|
|
241
|
-
buildScrollColumns();
|
|
242
|
-
} else {
|
|
243
|
-
updateScrollColumnsIndex();
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
);
|
|
235
|
+
initScrollColumns();
|
|
236
|
+
watch(() => props2.columns, initScrollColumns, { deep: true });
|
|
237
|
+
watch(() => modelValue.value, initScrollColumns);
|
|
247
238
|
function getOptionKey(key) {
|
|
248
239
|
const keyMap = {
|
|
249
240
|
text: props2.textKey,
|
|
@@ -260,7 +251,7 @@ const __sfc__ = defineComponent({
|
|
|
260
251
|
prevIndexes = [...indexes];
|
|
261
252
|
}
|
|
262
253
|
function normalizeNormalMode(columns) {
|
|
263
|
-
return columns.map((column) => {
|
|
254
|
+
return columns.map((column, idx) => {
|
|
264
255
|
const scrollColumn = {
|
|
265
256
|
id: sid++,
|
|
266
257
|
prevY: 0,
|
|
@@ -274,6 +265,9 @@ const __sfc__ = defineComponent({
|
|
|
274
265
|
scrollEl: null,
|
|
275
266
|
scrolling: false
|
|
276
267
|
};
|
|
268
|
+
const value = modelValue.value[idx];
|
|
269
|
+
const index = scrollColumn.column.findIndex((option) => value === getValue(option));
|
|
270
|
+
scrollColumn.index = index === -1 ? 0 : index;
|
|
277
271
|
scrollTo(scrollColumn);
|
|
278
272
|
return scrollColumn;
|
|
279
273
|
});
|
|
@@ -283,7 +277,7 @@ const __sfc__ = defineComponent({
|
|
|
283
277
|
createChildren(scrollColumns2, column);
|
|
284
278
|
return scrollColumns2;
|
|
285
279
|
}
|
|
286
|
-
function createChildren(scrollColumns2, children) {
|
|
280
|
+
function createChildren(scrollColumns2, children, syncModelValue = true) {
|
|
287
281
|
var _a;
|
|
288
282
|
if (children.length) {
|
|
289
283
|
const scrollColumn = {
|
|
@@ -300,31 +294,30 @@ const __sfc__ = defineComponent({
|
|
|
300
294
|
scrolling: false
|
|
301
295
|
};
|
|
302
296
|
scrollColumns2.push(scrollColumn);
|
|
303
|
-
if (
|
|
304
|
-
const
|
|
297
|
+
if (syncModelValue) {
|
|
298
|
+
const value = modelValue.value[scrollColumns2.length - 1];
|
|
299
|
+
const index = children.findIndex((option) => value === getValue(option));
|
|
305
300
|
scrollColumn.index = index === -1 ? 0 : index;
|
|
306
301
|
}
|
|
307
302
|
scrollTo(scrollColumn);
|
|
308
|
-
createChildren(
|
|
303
|
+
createChildren(
|
|
304
|
+
scrollColumns2,
|
|
305
|
+
(_a = scrollColumn.column[scrollColumn.index][getOptionKey("children")]) != null ? _a : [],
|
|
306
|
+
syncModelValue
|
|
307
|
+
);
|
|
309
308
|
}
|
|
310
309
|
}
|
|
311
310
|
function rebuildChildren(scrollColumn) {
|
|
312
311
|
var _a;
|
|
313
312
|
scrollColumns.value.splice(scrollColumns.value.indexOf(scrollColumn) + 1);
|
|
314
|
-
createChildren(
|
|
313
|
+
createChildren(
|
|
314
|
+
scrollColumns.value,
|
|
315
|
+
(_a = scrollColumn.column[scrollColumn.index][getOptionKey("children")]) != null ? _a : [],
|
|
316
|
+
false
|
|
317
|
+
);
|
|
315
318
|
}
|
|
316
|
-
function
|
|
319
|
+
function initScrollColumns() {
|
|
317
320
|
scrollColumns.value = props2.cascade ? normalizeCascadeMode(props2.columns) : normalizeNormalMode(props2.columns);
|
|
318
|
-
if (!props2.cascade) {
|
|
319
|
-
updateScrollColumnsIndex();
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
function updateScrollColumnsIndex() {
|
|
323
|
-
scrollColumns.value.forEach((scrollColumn, idx) => {
|
|
324
|
-
const index = scrollColumn.column.findIndex((option) => modelValue.value[idx] === getValue(option));
|
|
325
|
-
scrollColumn.index = index === -1 ? 0 : index;
|
|
326
|
-
scrollTo(scrollColumn);
|
|
327
|
-
});
|
|
328
321
|
const { indexes } = getPicked();
|
|
329
322
|
setPrevIndexes(indexes);
|
|
330
323
|
}
|
|
@@ -413,23 +406,23 @@ const __sfc__ = defineComponent({
|
|
|
413
406
|
scrollTo(scrollColumn, shouldMomentum ? MOMENTUM_TRANSITION_DURATION : TRANSITION_DURATION);
|
|
414
407
|
scrollColumn.scrolling = scrollColumn.translate !== oldTranslate;
|
|
415
408
|
if (!scrollColumn.scrolling) {
|
|
416
|
-
|
|
409
|
+
handleScrollColumnChange(scrollColumn);
|
|
417
410
|
}
|
|
418
411
|
}
|
|
419
412
|
function handleTransitionend(scrollColumn) {
|
|
420
413
|
scrollColumn.scrolling = false;
|
|
421
|
-
|
|
414
|
+
handleScrollColumnChange(scrollColumn);
|
|
422
415
|
}
|
|
423
416
|
function isSamePicked() {
|
|
424
417
|
const { indexes } = getPicked();
|
|
425
418
|
return indexes.every((index, idx) => index === prevIndexes[idx]);
|
|
426
419
|
}
|
|
427
|
-
function
|
|
428
|
-
const {
|
|
420
|
+
function handleScrollColumnChange(scrollColumn) {
|
|
421
|
+
const { onChange, cascade } = props2;
|
|
429
422
|
if (isSamePicked()) {
|
|
430
423
|
return;
|
|
431
424
|
}
|
|
432
|
-
if (cascade
|
|
425
|
+
if (cascade) {
|
|
433
426
|
rebuildChildren(scrollColumn);
|
|
434
427
|
}
|
|
435
428
|
const hasScrolling = scrollColumns.value.some((scrollColumn2) => scrollColumn2.scrolling);
|
package/es/snackbar/Snackbar.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { defineComponent } from "vue";
|
|
|
3
3
|
import { createNamespace, useTeleport } from "../utils/components.mjs";
|
|
4
4
|
import { props } from "./props.mjs";
|
|
5
5
|
const { name, n } = createNamespace("snackbar");
|
|
6
|
-
import { renderSlot as _renderSlot,
|
|
6
|
+
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, Transition as _Transition, Teleport as _Teleport, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
7
7
|
function __render__(_ctx, _cache) {
|
|
8
8
|
const _component_var_snackbar_core = _resolveComponent("var-snackbar-core");
|
|
9
9
|
return _openBlock(), _createBlock(_Teleport, {
|
|
@@ -18,25 +18,28 @@ function __render__(_ctx, _cache) {
|
|
|
18
18
|
default: _withCtx(() => [
|
|
19
19
|
_createVNode(_component_var_snackbar_core, _mergeProps(_ctx.$props, {
|
|
20
20
|
class: _ctx.n("transition")
|
|
21
|
-
}), {
|
|
22
|
-
icon: _withCtx(() => [
|
|
23
|
-
_renderSlot(_ctx.$slots, "icon")
|
|
24
|
-
]),
|
|
25
|
-
action: _withCtx(() => [
|
|
26
|
-
_renderSlot(_ctx.$slots, "action")
|
|
27
|
-
]),
|
|
21
|
+
}), _createSlots({
|
|
28
22
|
default: _withCtx(() => [
|
|
29
|
-
_renderSlot(_ctx.$slots, "default"
|
|
30
|
-
_createTextVNode(
|
|
31
|
-
_toDisplayString(_ctx.content),
|
|
32
|
-
1
|
|
33
|
-
/* TEXT */
|
|
34
|
-
)
|
|
35
|
-
])
|
|
23
|
+
_renderSlot(_ctx.$slots, "default")
|
|
36
24
|
]),
|
|
37
|
-
_:
|
|
38
|
-
/*
|
|
39
|
-
},
|
|
25
|
+
_: 2
|
|
26
|
+
/* DYNAMIC */
|
|
27
|
+
}, [
|
|
28
|
+
_ctx.$slots.icon ? {
|
|
29
|
+
name: "icon",
|
|
30
|
+
fn: _withCtx(() => [
|
|
31
|
+
_renderSlot(_ctx.$slots, "icon")
|
|
32
|
+
]),
|
|
33
|
+
key: "0"
|
|
34
|
+
} : void 0,
|
|
35
|
+
_ctx.$slots.action ? {
|
|
36
|
+
name: "action",
|
|
37
|
+
fn: _withCtx(() => [
|
|
38
|
+
_renderSlot(_ctx.$slots, "action")
|
|
39
|
+
]),
|
|
40
|
+
key: "1"
|
|
41
|
+
} : void 0
|
|
42
|
+
]), 1040, ["class"])
|
|
40
43
|
]),
|
|
41
44
|
_: 3
|
|
42
45
|
/* FORWARDED */
|
package/es/snackbar/core.mjs
CHANGED
|
@@ -16,7 +16,9 @@ const ICON_TYPE_DICT = {
|
|
|
16
16
|
error: "error",
|
|
17
17
|
loading: ""
|
|
18
18
|
};
|
|
19
|
-
import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createElementBlock as _createElementBlock, normalizeStyle as _normalizeStyle, vShow as _vShow, withDirectives as _withDirectives } from "vue";
|
|
19
|
+
import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createElementBlock as _createElementBlock, normalizeStyle as _normalizeStyle, vShow as _vShow, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
20
|
+
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
21
|
+
const _hoisted_1 = { key: 0 };
|
|
20
22
|
function __render__(_ctx, _cache) {
|
|
21
23
|
const _component_var_icon = _resolveComponent("var-icon");
|
|
22
24
|
const _component_var_loading = _resolveComponent("var-loading");
|
|
@@ -59,32 +61,24 @@ function __render__(_ctx, _cache) {
|
|
|
59
61
|
2
|
|
60
62
|
/* CLASS */
|
|
61
63
|
),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_ctx.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
color: _ctx.loadingColor,
|
|
77
|
-
radius: _ctx.loadingRadius
|
|
78
|
-
}, null, 8, ["type", "size", "color", "radius"])) : _createCommentVNode("v-if", true),
|
|
79
|
-
_renderSlot(_ctx.$slots, "icon")
|
|
80
|
-
],
|
|
81
|
-
2
|
|
82
|
-
/* CLASS */
|
|
83
|
-
),
|
|
64
|
+
_ctx.iconName || _ctx.type === "loading" || _ctx.$slots.icon ? (_openBlock(), _createElementBlock("div", _hoisted_1, [
|
|
65
|
+
_ctx.iconName ? (_openBlock(), _createBlock(_component_var_icon, {
|
|
66
|
+
key: 0,
|
|
67
|
+
name: _ctx.iconName
|
|
68
|
+
}, null, 8, ["name"])) : _createCommentVNode("v-if", true),
|
|
69
|
+
_ctx.type === "loading" ? (_openBlock(), _createBlock(_component_var_loading, {
|
|
70
|
+
key: 1,
|
|
71
|
+
type: _ctx.loadingType,
|
|
72
|
+
size: _ctx.loadingSize,
|
|
73
|
+
color: _ctx.loadingColor,
|
|
74
|
+
radius: _ctx.loadingRadius
|
|
75
|
+
}, null, 8, ["type", "size", "color", "radius"])) : _createCommentVNode("v-if", true),
|
|
76
|
+
_renderSlot(_ctx.$slots, "icon")
|
|
77
|
+
])) : _createCommentVNode("v-if", true),
|
|
84
78
|
_ctx.$slots.action ? (_openBlock(), _createElementBlock(
|
|
85
79
|
"div",
|
|
86
80
|
{
|
|
87
|
-
key:
|
|
81
|
+
key: 1,
|
|
88
82
|
class: _normalizeClass(_ctx.n("action"))
|
|
89
83
|
},
|
|
90
84
|
[
|
|
@@ -118,24 +112,25 @@ const __sfc__ = defineComponent({
|
|
|
118
112
|
() => props2.show,
|
|
119
113
|
() => props2.lockScroll
|
|
120
114
|
);
|
|
121
|
-
const isForbidClick = computed(() =>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return "";
|
|
125
|
-
return ICON_TYPE_DICT[props2.type];
|
|
115
|
+
const isForbidClick = computed(() => {
|
|
116
|
+
const { type, forbidClick } = props2;
|
|
117
|
+
return type === "loading" || forbidClick;
|
|
126
118
|
});
|
|
127
|
-
const
|
|
119
|
+
const iconName = computed(() => !props2.type ? "" : ICON_TYPE_DICT[props2.type]);
|
|
120
|
+
function updateAfterDuration() {
|
|
128
121
|
timer.value = setTimeout(() => {
|
|
129
|
-
props2.type !== "loading"
|
|
122
|
+
if (props2.type !== "loading") {
|
|
123
|
+
call(props2["onUpdate:show"], false);
|
|
124
|
+
}
|
|
130
125
|
}, props2.duration);
|
|
131
|
-
}
|
|
126
|
+
}
|
|
132
127
|
watch(
|
|
133
128
|
() => props2.show,
|
|
134
129
|
(show) => {
|
|
135
130
|
if (show) {
|
|
136
131
|
call(props2.onOpen);
|
|
137
132
|
updateAfterDuration();
|
|
138
|
-
} else
|
|
133
|
+
} else {
|
|
139
134
|
clearTimeout(timer.value);
|
|
140
135
|
call(props2.onClose);
|
|
141
136
|
}
|
|
@@ -156,11 +151,11 @@ const __sfc__ = defineComponent({
|
|
|
156
151
|
});
|
|
157
152
|
return {
|
|
158
153
|
SNACKBAR_TYPE,
|
|
159
|
-
n,
|
|
160
|
-
classes,
|
|
161
154
|
zIndex,
|
|
162
155
|
iconName,
|
|
163
|
-
isForbidClick
|
|
156
|
+
isForbidClick,
|
|
157
|
+
n,
|
|
158
|
+
classes
|
|
164
159
|
};
|
|
165
160
|
}
|
|
166
161
|
});
|
package/es/snackbar/props.mjs
CHANGED