vant 4.6.1 → 4.6.3
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/README.md +1 -1
- package/es/address-list/AddressList.d.ts +13 -0
- package/es/address-list/AddressList.mjs +3 -2
- package/es/address-list/index.d.ts +9 -0
- package/es/checkbox/Checkbox.d.ts +14 -23
- package/es/checkbox/Checkbox.mjs +2 -1
- package/es/checkbox/Checker.d.ts +6 -15
- package/es/checkbox/Checker.mjs +18 -6
- package/es/checkbox/index.d.ts +2 -9
- package/es/checkbox-group/CheckboxGroup.d.ts +14 -1
- package/es/checkbox-group/CheckboxGroup.mjs +2 -1
- package/es/checkbox-group/index.d.ts +9 -0
- package/es/field/Field.d.ts +25 -0
- package/es/field/Field.mjs +9 -0
- package/es/field/index.d.ts +13 -0
- package/es/floating-bubble/FloatingBubble.d.ts +16 -21
- package/es/floating-bubble/FloatingBubble.mjs +6 -8
- package/es/floating-bubble/index.css +1 -1
- package/es/floating-bubble/index.d.ts +19 -19
- package/es/floating-bubble/types.d.ts +12 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/pagination/index.css +1 -1
- package/es/radio/Radio.d.ts +18 -25
- package/es/radio/Radio.mjs +5 -3
- package/es/radio/index.css +1 -1
- package/es/radio/index.d.ts +4 -9
- package/es/radio/types.d.ts +1 -0
- package/es/radio-group/RadioGroup.d.ts +4 -0
- package/es/radio-group/RadioGroup.mjs +1 -0
- package/es/radio-group/index.d.ts +2 -0
- package/es/search/Search.d.ts +19 -0
- package/es/search/index.d.ts +13 -0
- package/es/tab/Tab.mjs +2 -2
- package/es/text-ellipsis/TextEllipsis.d.ts +13 -0
- package/es/text-ellipsis/TextEllipsis.mjs +50 -19
- package/es/text-ellipsis/index.d.ts +9 -0
- package/es/utils/basic.d.ts +8 -0
- package/es/utils/basic.mjs +28 -7
- package/es/utils/create.mjs +1 -2
- package/es/utils/deep-assign.mjs +1 -1
- package/es/utils/deep-clone.mjs +1 -1
- package/es/utils/dom.mjs +1 -1
- package/es/utils/format.mjs +1 -1
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.mjs +0 -1
- package/es/utils/interceptor.mjs +1 -2
- package/lib/address-list/AddressList.d.ts +13 -0
- package/lib/address-list/AddressList.js +3 -2
- package/lib/address-list/index.d.ts +9 -0
- package/lib/checkbox/Checkbox.d.ts +14 -23
- package/lib/checkbox/Checkbox.js +1 -0
- package/lib/checkbox/Checker.d.ts +6 -15
- package/lib/checkbox/Checker.js +17 -5
- package/lib/checkbox/index.d.ts +2 -9
- package/lib/checkbox-group/CheckboxGroup.d.ts +14 -1
- package/lib/checkbox-group/CheckboxGroup.js +1 -0
- package/lib/checkbox-group/index.d.ts +9 -0
- package/lib/field/Field.d.ts +25 -0
- package/lib/field/Field.js +9 -0
- package/lib/field/index.d.ts +13 -0
- package/lib/floating-bubble/FloatingBubble.d.ts +16 -21
- package/lib/floating-bubble/FloatingBubble.js +6 -8
- package/lib/floating-bubble/index.css +1 -1
- package/lib/floating-bubble/index.d.ts +19 -19
- package/lib/floating-bubble/types.d.ts +12 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/pagination/index.css +1 -1
- package/lib/radio/Radio.d.ts +18 -25
- package/lib/radio/Radio.js +4 -2
- package/lib/radio/index.css +1 -1
- package/lib/radio/index.d.ts +4 -9
- package/lib/radio/types.d.ts +1 -0
- package/lib/radio-group/RadioGroup.d.ts +4 -0
- package/lib/radio-group/RadioGroup.js +1 -0
- package/lib/radio-group/index.d.ts +2 -0
- package/lib/search/Search.d.ts +19 -0
- package/lib/search/index.d.ts +13 -0
- package/lib/tab/Tab.js +2 -2
- package/lib/text-ellipsis/TextEllipsis.d.ts +13 -0
- package/lib/text-ellipsis/TextEllipsis.js +49 -18
- package/lib/text-ellipsis/index.d.ts +9 -0
- package/lib/utils/basic.d.ts +8 -0
- package/lib/utils/basic.js +29 -8
- package/lib/utils/create.js +1 -2
- package/lib/utils/deep-assign.js +3 -3
- package/lib/utils/deep-clone.js +3 -3
- package/lib/utils/dom.js +2 -2
- package/lib/utils/format.js +4 -4
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/interceptor.js +1 -2
- package/lib/vant.cjs.js +107 -48
- package/lib/vant.es.js +107 -48
- package/lib/vant.js +172 -59
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
- package/es/utils/validate.d.ts +0 -9
- package/es/utils/validate.mjs +0 -22
- package/lib/utils/validate.d.ts +0 -9
- package/lib/utils/validate.js +0 -41
@@ -1,5 +1,5 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, onMounted, defineComponent } from "vue";
|
2
|
+
import { ref, watch, computed, onMounted, defineComponent } from "vue";
|
3
3
|
import { useEventListener } from "@vant/use";
|
4
4
|
import { makeNumericProp, makeStringProp, createNamespace } from "../utils/index.mjs";
|
5
5
|
const [name, bem] = createNamespace("text-ellipsis");
|
@@ -8,7 +8,8 @@ const textEllipsisProps = {
|
|
8
8
|
dots: makeStringProp("..."),
|
9
9
|
content: makeStringProp(""),
|
10
10
|
expandText: makeStringProp(""),
|
11
|
-
collapseText: makeStringProp("")
|
11
|
+
collapseText: makeStringProp(""),
|
12
|
+
position: makeStringProp("end")
|
12
13
|
};
|
13
14
|
var stdin_default = defineComponent({
|
14
15
|
name,
|
@@ -21,6 +22,7 @@ var stdin_default = defineComponent({
|
|
21
22
|
const expanded = ref(false);
|
22
23
|
const hasAction = ref(false);
|
23
24
|
const root = ref();
|
25
|
+
const actionText = computed(() => expanded.value ? props.expandText : props.collapseText);
|
24
26
|
const pxToNum = (value) => {
|
25
27
|
if (!value)
|
26
28
|
return 0;
|
@@ -49,24 +51,53 @@ var stdin_default = defineComponent({
|
|
49
51
|
};
|
50
52
|
const calcEllipsisText = (container2, maxHeight2) => {
|
51
53
|
const {
|
52
|
-
dots,
|
53
54
|
content,
|
54
|
-
|
55
|
+
position,
|
56
|
+
dots
|
55
57
|
} = props;
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
const end = content.length;
|
59
|
+
const calcEllipse = () => {
|
60
|
+
const tail = (left, right) => {
|
61
|
+
if (right - left <= 1) {
|
62
|
+
if (position === "end") {
|
63
|
+
return content.slice(0, left) + dots;
|
64
|
+
}
|
65
|
+
return dots + content.slice(right, end);
|
66
|
+
}
|
67
|
+
const middle2 = Math.round(left + right >> 1);
|
68
|
+
if (position === "end") {
|
69
|
+
container2.innerText = content.slice(0, middle2) + dots + actionText.value;
|
70
|
+
} else {
|
71
|
+
container2.innerText = dots + content.slice(middle2, end) + actionText.value;
|
72
|
+
}
|
73
|
+
if (container2.offsetHeight > maxHeight2) {
|
74
|
+
if (position === "end") {
|
75
|
+
return tail(left, middle2);
|
76
|
+
}
|
77
|
+
return tail(middle2, right);
|
78
|
+
}
|
79
|
+
if (position === "end") {
|
80
|
+
return tail(middle2, right);
|
81
|
+
}
|
82
|
+
return tail(left, middle2);
|
83
|
+
};
|
84
|
+
container2.innerText = tail(0, end);
|
85
|
+
};
|
86
|
+
const middleTail = (leftPart, rightPart) => {
|
87
|
+
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
88
|
+
return content.slice(0, leftPart[1]) + dots + dots + content.slice(rightPart[1], end);
|
67
89
|
}
|
68
|
-
|
69
|
-
|
90
|
+
const leftMiddle = Math.floor(leftPart[0] + leftPart[1] >> 1);
|
91
|
+
const rightMiddle = Math.ceil(rightPart[0] + rightPart[1] >> 1);
|
92
|
+
container2.innerText = props.content.slice(0, leftMiddle) + props.dots + actionText.value + props.dots + props.content.slice(rightMiddle, end);
|
93
|
+
if (container2.offsetHeight >= maxHeight2) {
|
94
|
+
return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
|
95
|
+
}
|
96
|
+
return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
|
97
|
+
};
|
98
|
+
const middle = 0 + end >> 1;
|
99
|
+
props.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end]) : calcEllipse();
|
100
|
+
return container2.innerText;
|
70
101
|
};
|
71
102
|
const container = cloneContainer();
|
72
103
|
if (!container)
|
@@ -76,7 +107,7 @@ var stdin_default = defineComponent({
|
|
76
107
|
paddingTop,
|
77
108
|
lineHeight
|
78
109
|
} = container.style;
|
79
|
-
const maxHeight = (Number(props.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
|
110
|
+
const maxHeight = Math.ceil((Number(props.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
|
80
111
|
if (maxHeight < container.offsetHeight) {
|
81
112
|
hasAction.value = true;
|
82
113
|
text.value = calcEllipsisText(container, maxHeight);
|
@@ -95,7 +126,7 @@ var stdin_default = defineComponent({
|
|
95
126
|
"onClick": onClickAction
|
96
127
|
}, [expanded.value ? props.collapseText : props.expandText]);
|
97
128
|
onMounted(calcEllipsised);
|
98
|
-
watch(() => [props.content, props.rows], calcEllipsised);
|
129
|
+
watch(() => [props.content, props.rows, props.position], calcEllipsised);
|
99
130
|
useEventListener("resize", calcEllipsised);
|
100
131
|
return () => _createVNode("div", {
|
101
132
|
"ref": root,
|
@@ -19,6 +19,10 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
|
|
19
19
|
type: import("vue").PropType<string>;
|
20
20
|
default: string;
|
21
21
|
};
|
22
|
+
position: {
|
23
|
+
type: import("vue").PropType<string>;
|
24
|
+
default: string;
|
25
|
+
};
|
22
26
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
23
27
|
rows: {
|
24
28
|
type: (NumberConstructor | StringConstructor)[];
|
@@ -40,10 +44,15 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
|
|
40
44
|
type: import("vue").PropType<string>;
|
41
45
|
default: string;
|
42
46
|
};
|
47
|
+
position: {
|
48
|
+
type: import("vue").PropType<string>;
|
49
|
+
default: string;
|
50
|
+
};
|
43
51
|
}>> & {
|
44
52
|
onClickAction?: ((...args: any[]) => any) | undefined;
|
45
53
|
}, {
|
46
54
|
content: string;
|
55
|
+
position: string;
|
47
56
|
rows: string | number;
|
48
57
|
dots: string;
|
49
58
|
expandText: string;
|
package/es/utils/basic.d.ts
CHANGED
@@ -9,6 +9,14 @@ export declare const extend: {
|
|
9
9
|
export declare const inBrowser: boolean;
|
10
10
|
export type Numeric = number | string;
|
11
11
|
export type ComponentInstance = ComponentPublicInstance<{}, any>;
|
12
|
+
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
13
|
+
export declare const isDef: <T>(val: T) => val is NonNullable<T>;
|
14
|
+
export declare const isFunction: (val: unknown) => val is Function;
|
15
|
+
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
16
|
+
export declare const isDate: (val: unknown) => val is Date;
|
17
|
+
export declare function isMobile(value: string): boolean;
|
18
|
+
export declare const isNumeric: (val: Numeric) => val is string;
|
19
|
+
export declare const isIOS: () => boolean;
|
12
20
|
export declare function get(object: any, path: string): any;
|
13
21
|
export type Writeable<T> = {
|
14
22
|
-readonly [P in keyof T]: T[P];
|
package/es/utils/basic.mjs
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
-
import { isObject } from "./validate.mjs";
|
2
1
|
function noop() {
|
3
2
|
}
|
4
3
|
const extend = Object.assign;
|
5
4
|
const inBrowser = typeof window !== "undefined";
|
5
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
6
|
+
const isDef = (val) => val !== void 0 && val !== null;
|
7
|
+
const isFunction = (val) => typeof val === "function";
|
8
|
+
const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
9
|
+
const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
10
|
+
function isMobile(value) {
|
11
|
+
value = value.replace(/[^-|\d]/g, "");
|
12
|
+
return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
|
13
|
+
}
|
14
|
+
const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
|
15
|
+
const isIOS = () => inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
|
6
16
|
function get(object, path) {
|
7
17
|
const keys = path.split(".");
|
8
18
|
let result = object;
|
@@ -13,12 +23,15 @@ function get(object, path) {
|
|
13
23
|
return result;
|
14
24
|
}
|
15
25
|
function pick(obj, keys, ignoreUndefined) {
|
16
|
-
return keys.reduce(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
26
|
+
return keys.reduce(
|
27
|
+
(ret, key) => {
|
28
|
+
if (!ignoreUndefined || obj[key] !== void 0) {
|
29
|
+
ret[key] = obj[key];
|
30
|
+
}
|
31
|
+
return ret;
|
32
|
+
},
|
33
|
+
{}
|
34
|
+
);
|
22
35
|
}
|
23
36
|
const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
|
24
37
|
const toArray = (item) => Array.isArray(item) ? item : [item];
|
@@ -26,6 +39,14 @@ export {
|
|
26
39
|
extend,
|
27
40
|
get,
|
28
41
|
inBrowser,
|
42
|
+
isDate,
|
43
|
+
isDef,
|
44
|
+
isFunction,
|
45
|
+
isIOS,
|
46
|
+
isMobile,
|
47
|
+
isNumeric,
|
48
|
+
isObject,
|
49
|
+
isPromise,
|
29
50
|
isSameValue,
|
30
51
|
noop,
|
31
52
|
pick,
|
package/es/utils/create.mjs
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import { get } from "./basic.mjs";
|
1
|
+
import { get, isFunction } from "./basic.mjs";
|
2
2
|
import { camelize } from "./format.mjs";
|
3
|
-
import { isFunction } from "./validate.mjs";
|
4
3
|
import locale from "../locale/index.mjs";
|
5
4
|
function createTranslate(name) {
|
6
5
|
const prefix = camelize(name) + ".";
|
package/es/utils/deep-assign.mjs
CHANGED
package/es/utils/deep-clone.mjs
CHANGED
package/es/utils/dom.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useRect, useWindowSize } from "@vant/use";
|
2
2
|
import { unref } from "vue";
|
3
|
-
import { isIOS as checkIsIOS } from "./
|
3
|
+
import { isIOS as checkIsIOS } from "./basic.mjs";
|
4
4
|
function getScrollTop(el) {
|
5
5
|
const top = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
|
6
6
|
return Math.max(top, 0);
|
package/es/utils/format.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { inBrowser } from "./basic.mjs";
|
2
2
|
import { windowWidth, windowHeight } from "./dom.mjs";
|
3
|
-
import { isDef, isNumeric } from "./
|
3
|
+
import { isDef, isNumeric } from "./basic.mjs";
|
4
4
|
function addUnit(value) {
|
5
5
|
if (isDef(value)) {
|
6
6
|
return isNumeric(value) ? `${value}px` : String(value);
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.mjs
CHANGED
package/es/utils/interceptor.mjs
CHANGED
@@ -15,6 +15,10 @@ export declare const addressListProps: {
|
|
15
15
|
type: import("vue").PropType<AddressListAddress[]>;
|
16
16
|
default: () => never[];
|
17
17
|
};
|
18
|
+
showAddButton: {
|
19
|
+
type: BooleanConstructor;
|
20
|
+
default: true;
|
21
|
+
};
|
18
22
|
addButtonText: StringConstructor;
|
19
23
|
defaultTagText: StringConstructor;
|
20
24
|
rightIcon: {
|
@@ -38,6 +42,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
38
42
|
type: import("vue").PropType<AddressListAddress[]>;
|
39
43
|
default: () => never[];
|
40
44
|
};
|
45
|
+
showAddButton: {
|
46
|
+
type: BooleanConstructor;
|
47
|
+
default: true;
|
48
|
+
};
|
41
49
|
addButtonText: StringConstructor;
|
42
50
|
defaultTagText: StringConstructor;
|
43
51
|
rightIcon: {
|
@@ -59,6 +67,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
59
67
|
type: import("vue").PropType<AddressListAddress[]>;
|
60
68
|
default: () => never[];
|
61
69
|
};
|
70
|
+
showAddButton: {
|
71
|
+
type: BooleanConstructor;
|
72
|
+
default: true;
|
73
|
+
};
|
62
74
|
addButtonText: StringConstructor;
|
63
75
|
defaultTagText: StringConstructor;
|
64
76
|
rightIcon: {
|
@@ -78,5 +90,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
78
90
|
switchable: boolean;
|
79
91
|
list: AddressListAddress[];
|
80
92
|
disabledList: AddressListAddress[];
|
93
|
+
showAddButton: boolean;
|
81
94
|
}, {}>;
|
82
95
|
export default _default;
|
@@ -44,6 +44,7 @@ const addressListProps = {
|
|
44
44
|
switchable: import_utils.truthProp,
|
45
45
|
disabledText: String,
|
46
46
|
disabledList: (0, import_utils.makeArrayProp)(),
|
47
|
+
showAddButton: import_utils.truthProp,
|
47
48
|
addButtonText: String,
|
48
49
|
defaultTagText: String,
|
49
50
|
rightIcon: (0, import_utils.makeStringProp)("edit")
|
@@ -85,7 +86,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
85
86
|
return list.map((item, index) => renderItem(item, index, disabled));
|
86
87
|
}
|
87
88
|
};
|
88
|
-
const renderBottom = () => (0, import_vue.createVNode)("div", {
|
89
|
+
const renderBottom = () => props.showAddButton ? (0, import_vue.createVNode)("div", {
|
89
90
|
"class": [bem("bottom"), "van-safe-area-bottom"]
|
90
91
|
}, [(0, import_vue.createVNode)(import_button.Button, {
|
91
92
|
"round": true,
|
@@ -94,7 +95,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
94
95
|
"text": props.addButtonText || t("add"),
|
95
96
|
"class": bem("add"),
|
96
97
|
"onClick": () => emit("add")
|
97
|
-
}, null)]);
|
98
|
+
}, null)]) : void 0;
|
98
99
|
return () => {
|
99
100
|
var _a, _b;
|
100
101
|
const List = renderList(props.list);
|
@@ -13,6 +13,10 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
|
|
13
13
|
type: import("vue").PropType<import("./AddressListItem").AddressListAddress[]>;
|
14
14
|
default: () => never[];
|
15
15
|
};
|
16
|
+
showAddButton: {
|
17
|
+
type: BooleanConstructor;
|
18
|
+
default: true;
|
19
|
+
};
|
16
20
|
addButtonText: StringConstructor;
|
17
21
|
defaultTagText: StringConstructor;
|
18
22
|
rightIcon: {
|
@@ -34,6 +38,10 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
|
|
34
38
|
type: import("vue").PropType<import("./AddressListItem").AddressListAddress[]>;
|
35
39
|
default: () => never[];
|
36
40
|
};
|
41
|
+
showAddButton: {
|
42
|
+
type: BooleanConstructor;
|
43
|
+
default: true;
|
44
|
+
};
|
37
45
|
addButtonText: StringConstructor;
|
38
46
|
defaultTagText: StringConstructor;
|
39
47
|
rightIcon: {
|
@@ -53,6 +61,7 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
|
|
53
61
|
switchable: boolean;
|
54
62
|
list: import("./AddressListItem").AddressListAddress[];
|
55
63
|
disabledList: import("./AddressListItem").AddressListAddress[];
|
64
|
+
showAddButton: boolean;
|
56
65
|
}, {}>>;
|
57
66
|
export default AddressList;
|
58
67
|
export { addressListProps } from './AddressList';
|
@@ -1,17 +1,15 @@
|
|
1
|
-
import { type ExtractPropTypes } from 'vue';
|
1
|
+
import { type PropType, type ExtractPropTypes } from 'vue';
|
2
|
+
import { type CheckerShape } from './Checker';
|
2
3
|
export declare const checkboxProps: {
|
3
|
-
name:
|
4
|
-
shape: {
|
5
|
-
type: import("vue").PropType<import("./Checker").CheckerShape>;
|
6
|
-
default: import("./Checker").CheckerShape;
|
7
|
-
};
|
4
|
+
name: PropType<unknown>;
|
8
5
|
disabled: BooleanConstructor;
|
9
6
|
iconSize: (NumberConstructor | StringConstructor)[];
|
10
|
-
modelValue:
|
7
|
+
modelValue: PropType<unknown>;
|
11
8
|
checkedColor: StringConstructor;
|
12
|
-
labelPosition:
|
9
|
+
labelPosition: PropType<import("./Checker").CheckerLabelPosition>;
|
13
10
|
labelDisabled: BooleanConstructor;
|
14
11
|
} & {
|
12
|
+
shape: PropType<CheckerShape>;
|
15
13
|
bindGroup: {
|
16
14
|
type: BooleanConstructor;
|
17
15
|
default: true;
|
@@ -19,35 +17,29 @@ export declare const checkboxProps: {
|
|
19
17
|
};
|
20
18
|
export type CheckboxProps = ExtractPropTypes<typeof checkboxProps>;
|
21
19
|
declare const _default: import("vue").DefineComponent<{
|
22
|
-
name:
|
23
|
-
shape: {
|
24
|
-
type: import("vue").PropType<import("./Checker").CheckerShape>;
|
25
|
-
default: import("./Checker").CheckerShape;
|
26
|
-
};
|
20
|
+
name: PropType<unknown>;
|
27
21
|
disabled: BooleanConstructor;
|
28
22
|
iconSize: (NumberConstructor | StringConstructor)[];
|
29
|
-
modelValue:
|
23
|
+
modelValue: PropType<unknown>;
|
30
24
|
checkedColor: StringConstructor;
|
31
|
-
labelPosition:
|
25
|
+
labelPosition: PropType<import("./Checker").CheckerLabelPosition>;
|
32
26
|
labelDisabled: BooleanConstructor;
|
33
27
|
} & {
|
28
|
+
shape: PropType<CheckerShape>;
|
34
29
|
bindGroup: {
|
35
30
|
type: BooleanConstructor;
|
36
31
|
default: true;
|
37
32
|
};
|
38
33
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
39
|
-
name:
|
40
|
-
shape: {
|
41
|
-
type: import("vue").PropType<import("./Checker").CheckerShape>;
|
42
|
-
default: import("./Checker").CheckerShape;
|
43
|
-
};
|
34
|
+
name: PropType<unknown>;
|
44
35
|
disabled: BooleanConstructor;
|
45
36
|
iconSize: (NumberConstructor | StringConstructor)[];
|
46
|
-
modelValue:
|
37
|
+
modelValue: PropType<unknown>;
|
47
38
|
checkedColor: StringConstructor;
|
48
|
-
labelPosition:
|
39
|
+
labelPosition: PropType<import("./Checker").CheckerLabelPosition>;
|
49
40
|
labelDisabled: BooleanConstructor;
|
50
41
|
} & {
|
42
|
+
shape: PropType<CheckerShape>;
|
51
43
|
bindGroup: {
|
52
44
|
type: BooleanConstructor;
|
53
45
|
default: true;
|
@@ -57,7 +49,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
57
49
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
58
50
|
}, {
|
59
51
|
disabled: boolean;
|
60
|
-
shape: import("./Checker").CheckerShape;
|
61
52
|
labelDisabled: boolean;
|
62
53
|
bindGroup: boolean;
|
63
54
|
}, {}>;
|
package/lib/checkbox/Checkbox.js
CHANGED
@@ -40,6 +40,7 @@ var import_use_expose = require("../composables/use-expose");
|
|
40
40
|
var import_Checker = __toESM(require("./Checker"));
|
41
41
|
const [name, bem] = (0, import_utils.createNamespace)("checkbox");
|
42
42
|
const checkboxProps = (0, import_utils.extend)({}, import_Checker.checkerProps, {
|
43
|
+
shape: String,
|
43
44
|
bindGroup: import_utils.truthProp
|
44
45
|
});
|
45
46
|
var stdin_default = (0, import_vue2.defineComponent)({
|
@@ -1,24 +1,22 @@
|
|
1
1
|
import { type PropType } from 'vue';
|
2
2
|
import { type Numeric } from '../utils';
|
3
|
+
import type { RadioShape } from '../radio';
|
3
4
|
export type CheckerShape = 'square' | 'round';
|
4
5
|
export type CheckerDirection = 'horizontal' | 'vertical';
|
5
6
|
export type CheckerLabelPosition = 'left' | 'right';
|
6
7
|
export type CheckerParent = {
|
7
8
|
props: {
|
9
|
+
max?: Numeric;
|
10
|
+
shape?: CheckerShape | RadioShape;
|
8
11
|
disabled?: boolean;
|
9
12
|
iconSize?: Numeric;
|
10
13
|
direction?: CheckerDirection;
|
11
|
-
checkedColor?: string;
|
12
14
|
modelValue?: unknown | unknown[];
|
13
|
-
|
15
|
+
checkedColor?: string;
|
14
16
|
};
|
15
17
|
};
|
16
18
|
export declare const checkerProps: {
|
17
19
|
name: PropType<unknown>;
|
18
|
-
shape: {
|
19
|
-
type: PropType<CheckerShape>;
|
20
|
-
default: CheckerShape;
|
21
|
-
};
|
22
20
|
disabled: BooleanConstructor;
|
23
21
|
iconSize: (NumberConstructor | StringConstructor)[];
|
24
22
|
modelValue: PropType<unknown>;
|
@@ -28,10 +26,6 @@ export declare const checkerProps: {
|
|
28
26
|
};
|
29
27
|
declare const _default: import("vue").DefineComponent<{
|
30
28
|
name: PropType<unknown>;
|
31
|
-
shape: {
|
32
|
-
type: PropType<CheckerShape>;
|
33
|
-
default: CheckerShape;
|
34
|
-
};
|
35
29
|
disabled: BooleanConstructor;
|
36
30
|
iconSize: (NumberConstructor | StringConstructor)[];
|
37
31
|
modelValue: PropType<unknown>;
|
@@ -44,6 +38,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
44
38
|
required: true;
|
45
39
|
};
|
46
40
|
role: StringConstructor;
|
41
|
+
shape: PropType<"dot" | "round" | "square">;
|
47
42
|
parent: PropType<CheckerParent | null>;
|
48
43
|
checked: BooleanConstructor;
|
49
44
|
bindGroup: {
|
@@ -52,10 +47,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
52
47
|
};
|
53
48
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "toggle")[], "click" | "toggle", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
54
49
|
name: PropType<unknown>;
|
55
|
-
shape: {
|
56
|
-
type: PropType<CheckerShape>;
|
57
|
-
default: CheckerShape;
|
58
|
-
};
|
59
50
|
disabled: BooleanConstructor;
|
60
51
|
iconSize: (NumberConstructor | StringConstructor)[];
|
61
52
|
modelValue: PropType<unknown>;
|
@@ -68,6 +59,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
68
59
|
required: true;
|
69
60
|
};
|
70
61
|
role: StringConstructor;
|
62
|
+
shape: PropType<"dot" | "round" | "square">;
|
71
63
|
parent: PropType<CheckerParent | null>;
|
72
64
|
checked: BooleanConstructor;
|
73
65
|
bindGroup: {
|
@@ -80,7 +72,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
80
72
|
}, {
|
81
73
|
checked: boolean;
|
82
74
|
disabled: boolean;
|
83
|
-
shape: CheckerShape;
|
84
75
|
labelDisabled: boolean;
|
85
76
|
bindGroup: boolean;
|
86
77
|
}, {}>;
|
package/lib/checkbox/Checker.js
CHANGED
@@ -27,7 +27,6 @@ var import_utils = require("../utils");
|
|
27
27
|
var import_icon = require("../icon");
|
28
28
|
const checkerProps = {
|
29
29
|
name: import_utils.unknownProp,
|
30
|
-
shape: (0, import_utils.makeStringProp)("round"),
|
31
30
|
disabled: Boolean,
|
32
31
|
iconSize: import_utils.numericProp,
|
33
32
|
modelValue: import_utils.unknownProp,
|
@@ -39,6 +38,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
39
38
|
props: (0, import_utils.extend)({}, checkerProps, {
|
40
39
|
bem: (0, import_utils.makeRequiredProp)(Function),
|
41
40
|
role: String,
|
41
|
+
shape: String,
|
42
42
|
parent: Object,
|
43
43
|
checked: Boolean,
|
44
44
|
bindGroup: import_utils.truthProp
|
@@ -77,6 +77,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
77
77
|
};
|
78
78
|
}
|
79
79
|
});
|
80
|
+
const shape = (0, import_vue2.computed)(() => {
|
81
|
+
return props.shape || getParentProp("shape") || "round";
|
82
|
+
});
|
80
83
|
const onClick = (event) => {
|
81
84
|
const {
|
82
85
|
target
|
@@ -89,27 +92,36 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
89
92
|
emit("click", event);
|
90
93
|
};
|
91
94
|
const renderIcon = () => {
|
95
|
+
var _a, _b;
|
92
96
|
const {
|
93
97
|
bem,
|
94
|
-
shape,
|
95
98
|
checked
|
96
99
|
} = props;
|
97
100
|
const iconSize = props.iconSize || getParentProp("iconSize");
|
98
101
|
return (0, import_vue.createVNode)("div", {
|
99
102
|
"ref": iconRef,
|
100
|
-
"class": bem("icon", [shape, {
|
103
|
+
"class": bem("icon", [shape.value, {
|
101
104
|
disabled: disabled.value,
|
102
105
|
checked
|
103
106
|
}]),
|
104
|
-
"style": {
|
107
|
+
"style": shape.value !== "dot" ? {
|
105
108
|
fontSize: (0, import_utils.addUnit)(iconSize)
|
109
|
+
} : {
|
110
|
+
width: (0, import_utils.addUnit)(iconSize),
|
111
|
+
height: (0, import_utils.addUnit)(iconSize),
|
112
|
+
borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
|
106
113
|
}
|
107
114
|
}, [slots.icon ? slots.icon({
|
108
115
|
checked,
|
109
116
|
disabled: disabled.value
|
110
|
-
}) : (0, import_vue.createVNode)(import_icon.Icon, {
|
117
|
+
}) : shape.value !== "dot" ? (0, import_vue.createVNode)(import_icon.Icon, {
|
111
118
|
"name": "success",
|
112
119
|
"style": iconStyle.value
|
120
|
+
}, null) : (0, import_vue.createVNode)("div", {
|
121
|
+
"class": bem("icon--dot__icon"),
|
122
|
+
"style": {
|
123
|
+
backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
|
124
|
+
}
|
113
125
|
}, null)]);
|
114
126
|
};
|
115
127
|
const renderLabel = () => {
|
package/lib/checkbox/index.d.ts
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
export declare const Checkbox: import("../utils").WithInstall<import("vue").DefineComponent<{
|
2
2
|
name: import("vue").PropType<unknown>;
|
3
|
-
shape: {
|
4
|
-
type: import("vue").PropType<import("./Checker").CheckerShape>;
|
5
|
-
default: import("./Checker").CheckerShape;
|
6
|
-
};
|
7
3
|
disabled: BooleanConstructor;
|
8
4
|
iconSize: (NumberConstructor | StringConstructor)[];
|
9
5
|
modelValue: import("vue").PropType<unknown>;
|
@@ -11,16 +7,13 @@ export declare const Checkbox: import("../utils").WithInstall<import("vue").Defi
|
|
11
7
|
labelPosition: import("vue").PropType<import("./Checker").CheckerLabelPosition>;
|
12
8
|
labelDisabled: BooleanConstructor;
|
13
9
|
} & {
|
10
|
+
shape: import("vue").PropType<import("./Checker").CheckerShape>;
|
14
11
|
bindGroup: {
|
15
12
|
type: BooleanConstructor;
|
16
13
|
default: true;
|
17
14
|
};
|
18
15
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
19
16
|
name: import("vue").PropType<unknown>;
|
20
|
-
shape: {
|
21
|
-
type: import("vue").PropType<import("./Checker").CheckerShape>;
|
22
|
-
default: import("./Checker").CheckerShape;
|
23
|
-
};
|
24
17
|
disabled: BooleanConstructor;
|
25
18
|
iconSize: (NumberConstructor | StringConstructor)[];
|
26
19
|
modelValue: import("vue").PropType<unknown>;
|
@@ -28,6 +21,7 @@ export declare const Checkbox: import("../utils").WithInstall<import("vue").Defi
|
|
28
21
|
labelPosition: import("vue").PropType<import("./Checker").CheckerLabelPosition>;
|
29
22
|
labelDisabled: BooleanConstructor;
|
30
23
|
} & {
|
24
|
+
shape: import("vue").PropType<import("./Checker").CheckerShape>;
|
31
25
|
bindGroup: {
|
32
26
|
type: BooleanConstructor;
|
33
27
|
default: true;
|
@@ -37,7 +31,6 @@ export declare const Checkbox: import("../utils").WithInstall<import("vue").Defi
|
|
37
31
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
38
32
|
}, {
|
39
33
|
disabled: boolean;
|
40
|
-
shape: import("./Checker").CheckerShape;
|
41
34
|
labelDisabled: boolean;
|
42
35
|
bindGroup: boolean;
|
43
36
|
}, {}>>;
|