@varlet/ui 3.2.10 → 3.2.11
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/bottom-navigation/BottomNavigation.mjs +59 -32
- package/es/bottom-navigation/props.mjs +1 -0
- package/es/checkbox-group/CheckboxGroup.mjs +21 -4
- package/es/checkbox-group/CheckboxGroupOption.mjs +28 -0
- package/es/checkbox-group/props.mjs +1 -0
- package/es/checkbox-group/style/index.mjs +1 -0
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/utils/shared.mjs +6 -2
- package/es/varlet.esm.js +3488 -3433
- package/highlight/web-types.en-US.json +19 -1
- package/highlight/web-types.zh-CN.json +19 -1
- package/lib/varlet.cjs.js +401 -332
- package/package.json +7 -7
- package/types/bottomNavigation.d.ts +1 -0
- package/types/checkboxGroup.d.ts +10 -1
- package/umd/varlet.js +5 -5
|
@@ -19,7 +19,7 @@ import { defineComponent, ref, computed, onUpdated, watch } from "vue";
|
|
|
19
19
|
import { props } from "./props.mjs";
|
|
20
20
|
import { useBottomNavigationItems } from "./provide.mjs";
|
|
21
21
|
import { createNamespace } from "../utils/components.mjs";
|
|
22
|
-
import { isNumber, normalizeToArray, call } from "@varlet/shared";
|
|
22
|
+
import { isNumber, normalizeToArray, call, getRect } from "@varlet/shared";
|
|
23
23
|
import { onSmartMounted } from "@varlet/use";
|
|
24
24
|
const { name, n, classes } = createNamespace("bottom-navigation");
|
|
25
25
|
const { n: nItem } = createNamespace("bottom-navigation-item");
|
|
@@ -29,42 +29,59 @@ const RIGHT_SPACE_CLASS = nItem("--right-space");
|
|
|
29
29
|
const defaultFabProps = {
|
|
30
30
|
type: "primary"
|
|
31
31
|
};
|
|
32
|
-
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementBlock as _createElementBlock } from "vue";
|
|
32
|
+
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementBlock as _createElementBlock, Fragment as _Fragment } from "vue";
|
|
33
33
|
function __render__(_ctx, _cache) {
|
|
34
34
|
const _component_var_button = _resolveComponent("var-button");
|
|
35
35
|
return _openBlock(), _createElementBlock(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class: _normalizeClass(
|
|
39
|
-
_ctx.classes(
|
|
40
|
-
_ctx.n(),
|
|
41
|
-
_ctx.n("$--box"),
|
|
42
|
-
[_ctx.fixed, _ctx.n("--fixed")],
|
|
43
|
-
[_ctx.border, _ctx.n("--border")],
|
|
44
|
-
[_ctx.safeArea, _ctx.n("--safe-area")],
|
|
45
|
-
[_ctx.variant, _ctx.n("--variant")]
|
|
46
|
-
)
|
|
47
|
-
),
|
|
48
|
-
ref: "bottomNavigationDom",
|
|
49
|
-
style: _normalizeStyle(`z-index:${_ctx.zIndex}`)
|
|
50
|
-
},
|
|
36
|
+
_Fragment,
|
|
37
|
+
null,
|
|
51
38
|
[
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
39
|
+
_createElementVNode(
|
|
40
|
+
"div",
|
|
41
|
+
_mergeProps({
|
|
42
|
+
class: _ctx.classes(
|
|
43
|
+
_ctx.n(),
|
|
44
|
+
_ctx.n("$--box"),
|
|
45
|
+
[_ctx.fixed, _ctx.n("--fixed")],
|
|
46
|
+
[_ctx.border, _ctx.n("--border")],
|
|
47
|
+
[_ctx.safeArea, _ctx.n("--safe-area")],
|
|
48
|
+
[_ctx.variant, _ctx.n("--variant")]
|
|
49
|
+
),
|
|
50
|
+
ref: "bottomNavigationDom",
|
|
51
|
+
style: `z-index:${_ctx.zIndex}`
|
|
52
|
+
}, _ctx.$attrs),
|
|
53
|
+
[
|
|
54
|
+
_renderSlot(_ctx.$slots, "default"),
|
|
55
|
+
_ctx.$slots.fab ? (_openBlock(), _createBlock(_component_var_button, _mergeProps({
|
|
56
|
+
key: 0,
|
|
57
|
+
class: _ctx.classes(_ctx.n("fab"), [_ctx.length % 2, _ctx.n("--fab-right"), _ctx.n("--fab-center")]),
|
|
58
|
+
"var-bottom-navigation__fab": "",
|
|
59
|
+
onClick: _ctx.handleFabClick
|
|
60
|
+
}, _ctx.fabProps), {
|
|
61
|
+
default: _withCtx(() => [
|
|
62
|
+
_renderSlot(_ctx.$slots, "fab")
|
|
63
|
+
]),
|
|
64
|
+
_: 3
|
|
65
|
+
/* FORWARDED */
|
|
66
|
+
}, 16, ["class", "onClick"])) : _createCommentVNode("v-if", true)
|
|
67
|
+
],
|
|
68
|
+
16
|
|
69
|
+
/* FULL_PROPS */
|
|
70
|
+
),
|
|
71
|
+
_ctx.fixed && _ctx.placeholder ? (_openBlock(), _createElementBlock(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
key: 0,
|
|
75
|
+
class: _normalizeClass(_ctx.n("placeholder")),
|
|
76
|
+
style: _normalizeStyle({ height: _ctx.placeholderHeight })
|
|
77
|
+
},
|
|
78
|
+
null,
|
|
79
|
+
6
|
|
80
|
+
/* CLASS, STYLE */
|
|
81
|
+
)) : _createCommentVNode("v-if", true)
|
|
65
82
|
],
|
|
66
|
-
|
|
67
|
-
/*
|
|
83
|
+
64
|
|
84
|
+
/* STABLE_FRAGMENT */
|
|
68
85
|
);
|
|
69
86
|
}
|
|
70
87
|
const __sfc__ = defineComponent({
|
|
@@ -77,6 +94,7 @@ const __sfc__ = defineComponent({
|
|
|
77
94
|
const activeColor = computed(() => props2.activeColor);
|
|
78
95
|
const inactiveColor = computed(() => props2.inactiveColor);
|
|
79
96
|
const variant = computed(() => props2.variant);
|
|
97
|
+
const placeholderHeight = ref();
|
|
80
98
|
const fabProps = ref({});
|
|
81
99
|
const { length, bottomNavigationItems, bindBottomNavigationItem } = useBottomNavigationItems();
|
|
82
100
|
const bottomNavigationProvider = {
|
|
@@ -96,6 +114,7 @@ const __sfc__ = defineComponent({
|
|
|
96
114
|
{ immediate: true, deep: true }
|
|
97
115
|
);
|
|
98
116
|
onSmartMounted(() => {
|
|
117
|
+
resizePlaceholder();
|
|
99
118
|
if (!slots.fab) {
|
|
100
119
|
return;
|
|
101
120
|
}
|
|
@@ -182,10 +201,18 @@ const __sfc__ = defineComponent({
|
|
|
182
201
|
function handleFabClick() {
|
|
183
202
|
call(props2.onFabClick);
|
|
184
203
|
}
|
|
204
|
+
function resizePlaceholder() {
|
|
205
|
+
if (!props2.fixed || !props2.placeholder) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const { height } = getRect(bottomNavigationDom.value);
|
|
209
|
+
placeholderHeight.value = `${height}px`;
|
|
210
|
+
}
|
|
185
211
|
return {
|
|
186
212
|
length,
|
|
187
213
|
bottomNavigationDom,
|
|
188
214
|
fabProps,
|
|
215
|
+
placeholderHeight,
|
|
189
216
|
n,
|
|
190
217
|
classes,
|
|
191
218
|
handleFabClick
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import VarFormDetails from "../form-details/index.mjs";
|
|
2
|
+
import CheckboxGroupOption from "./CheckboxGroupOption.mjs";
|
|
2
3
|
import { defineComponent, computed, watch, nextTick } from "vue";
|
|
3
4
|
import { props } from "./props.mjs";
|
|
4
5
|
import { useValidation, createNamespace } from "../utils/components.mjs";
|
|
5
6
|
import { useCheckboxes } from "./provide.mjs";
|
|
6
7
|
import { useForm } from "../form/provide.mjs";
|
|
7
|
-
import { uniq, call } from "@varlet/shared";
|
|
8
|
+
import { uniq, call, isArray } from "@varlet/shared";
|
|
8
9
|
const { name, n, classes } = createNamespace("checkbox-group");
|
|
9
|
-
import {
|
|
10
|
+
import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, createVNode as _createVNode } from "vue";
|
|
10
11
|
function __render__(_ctx, _cache) {
|
|
12
|
+
const _component_checkbox_group_option = _resolveComponent("checkbox-group-option");
|
|
11
13
|
const _component_var_form_details = _resolveComponent("var-form-details");
|
|
12
14
|
return _openBlock(), _createElementBlock(
|
|
13
15
|
"div",
|
|
@@ -21,6 +23,19 @@ function __render__(_ctx, _cache) {
|
|
|
21
23
|
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n(`--${_ctx.direction}`)))
|
|
22
24
|
},
|
|
23
25
|
[
|
|
26
|
+
_ctx.checkboxGroupOptions.length ? (_openBlock(true), _createElementBlock(
|
|
27
|
+
_Fragment,
|
|
28
|
+
{ key: 0 },
|
|
29
|
+
_renderList(_ctx.checkboxGroupOptions, (option) => {
|
|
30
|
+
return _openBlock(), _createBlock(_component_checkbox_group_option, {
|
|
31
|
+
key: option.value.toString(),
|
|
32
|
+
checked: _ctx.modelValue.includes(option.value),
|
|
33
|
+
option
|
|
34
|
+
}, null, 8, ["checked", "option"]);
|
|
35
|
+
}),
|
|
36
|
+
128
|
|
37
|
+
/* KEYED_FRAGMENT */
|
|
38
|
+
)) : _createCommentVNode("v-if", true),
|
|
24
39
|
_renderSlot(_ctx.$slots, "default")
|
|
25
40
|
],
|
|
26
41
|
2
|
|
@@ -34,11 +49,12 @@ function __render__(_ctx, _cache) {
|
|
|
34
49
|
}
|
|
35
50
|
const __sfc__ = defineComponent({
|
|
36
51
|
name,
|
|
37
|
-
components: { VarFormDetails },
|
|
52
|
+
components: { VarFormDetails, CheckboxGroupOption },
|
|
38
53
|
props,
|
|
39
54
|
setup(props2) {
|
|
40
55
|
const max = computed(() => props2.max);
|
|
41
56
|
const checkedCount = computed(() => props2.modelValue.length);
|
|
57
|
+
const checkboxGroupOptions = computed(() => isArray(props2.options) ? props2.options : []);
|
|
42
58
|
const { length, checkboxes, bindCheckboxes } = useCheckboxes();
|
|
43
59
|
const { bindForm } = useForm();
|
|
44
60
|
const {
|
|
@@ -88,7 +104,7 @@ const __sfc__ = defineComponent({
|
|
|
88
104
|
change(modelValue.filter((value) => value !== changedValue));
|
|
89
105
|
}
|
|
90
106
|
function syncCheckboxes() {
|
|
91
|
-
|
|
107
|
+
checkboxes.forEach(({ sync }) => sync(props2.modelValue));
|
|
92
108
|
}
|
|
93
109
|
function resetWithAnimation() {
|
|
94
110
|
checkboxes.forEach((checkbox) => checkbox.resetWithAnimation());
|
|
@@ -116,6 +132,7 @@ const __sfc__ = defineComponent({
|
|
|
116
132
|
}
|
|
117
133
|
return {
|
|
118
134
|
errorMessage,
|
|
135
|
+
checkboxGroupOptions,
|
|
119
136
|
n,
|
|
120
137
|
classes,
|
|
121
138
|
checkAll,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createVNode as _createVNode } from "vue";
|
|
2
|
+
import { defineComponent } from "vue";
|
|
3
|
+
import Checkbox from "../checkbox/index.mjs";
|
|
4
|
+
import { isFunction } from "@varlet/shared";
|
|
5
|
+
|
|
6
|
+
var stdin_default = defineComponent({
|
|
7
|
+
name: "CheckboxGroupOption",
|
|
8
|
+
props: {
|
|
9
|
+
checked: Boolean,
|
|
10
|
+
option: Object
|
|
11
|
+
},
|
|
12
|
+
setup(props) {
|
|
13
|
+
return () => {
|
|
14
|
+
if (props.option == null) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
return _createVNode(Checkbox, {
|
|
18
|
+
"checkedValue": props.option.value,
|
|
19
|
+
"disabled": props.option.disabled
|
|
20
|
+
}, {
|
|
21
|
+
default: () => [isFunction(props.option.label) ? props.option.label(props.option, props.checked) : props.option.label]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
stdin_default as default
|
|
28
|
+
};
|
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 = '3.2.
|
|
265
|
+
const version = '3.2.11'
|
|
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 = '3.2.
|
|
177
|
+
const version = '3.2.11'
|
|
178
178
|
|
|
179
179
|
function install(app) {
|
|
180
180
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/utils/shared.mjs
CHANGED
|
@@ -36,9 +36,13 @@ const createCache = (max) => {
|
|
|
36
36
|
const linear = (value) => value;
|
|
37
37
|
const cubic = (value) => value ** 3;
|
|
38
38
|
const easeInOutCubic = (value) => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
|
|
39
|
-
const padStart = (str
|
|
40
|
-
if (str
|
|
39
|
+
const padStart = (str, maxLength, fillString = "") => {
|
|
40
|
+
if (str === void 0) {
|
|
41
|
+
str = "";
|
|
42
|
+
}
|
|
43
|
+
if (str.length >= maxLength) {
|
|
41
44
|
return str;
|
|
45
|
+
}
|
|
42
46
|
const len = maxLength - str.length;
|
|
43
47
|
const repeatCount = Math.floor(len / fillString.length);
|
|
44
48
|
return fillString.repeat(repeatCount) + fillString.slice(0, len % fillString.length) + str;
|