@nutui/nutui 4.0.11 → 4.0.12
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/dist/nutui.es.js +1 -1
- package/dist/nutui.js +2 -2
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +48 -48
- package/dist/styles/themes/jdb.scss +48 -48
- package/dist/styles/themes/jddkh.scss +48 -48
- package/dist/styles/themes/jdt.scss +48 -48
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -4
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,118 +1,165 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { inject
|
|
3
|
-
import { p as
|
|
4
|
-
import { CheckNormal
|
|
1
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
2
|
+
import { inject, reactive, computed, watch, onMounted, getCurrentInstance, onBeforeUnmount, h } from "vue";
|
|
3
|
+
import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
|
|
4
|
+
import { CheckNormal, Checked, CheckDisabled } from "@nutui/icons-vue";
|
|
5
5
|
import "../locale/lang";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
emits: ["change", "update:modelValue"],
|
|
40
|
-
setup(t, { emit: v, slots: e }) {
|
|
41
|
-
const n = I("parent", null), u = z({
|
|
42
|
-
partialSelect: t.indeterminate
|
|
43
|
-
}), d = r(() => !!n), k = r(() => d.value ? n.value.value.includes(t.label) : t.modelValue), o = r(() => d.value && n.disabled.value ? n.disabled.value : t.disabled), _ = r(() => !!t.modelValue), y = r(() => o.value ? "nut-checkbox__icon--disable" : u.partialSelect ? "nut-checkbox__icon--indeterminate" : k.value ? "nut-checkbox__icon" : "nut-checkbox__icon--unchecked");
|
|
44
|
-
let m = "";
|
|
45
|
-
const x = (a, i) => {
|
|
46
|
-
m = "click", v("update:modelValue", a), v("change", a, i);
|
|
47
|
-
};
|
|
48
|
-
S(
|
|
49
|
-
() => t.modelValue,
|
|
50
|
-
(a) => {
|
|
51
|
-
m == "click" ? m = "" : v("change", a);
|
|
6
|
+
const component = (componentName2, components) => {
|
|
7
|
+
return {
|
|
8
|
+
components,
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false
|
|
13
|
+
},
|
|
14
|
+
disabled: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
},
|
|
18
|
+
textPosition: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "right"
|
|
21
|
+
},
|
|
22
|
+
iconSize: {
|
|
23
|
+
type: [String, Number],
|
|
24
|
+
default: ""
|
|
25
|
+
},
|
|
26
|
+
label: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ""
|
|
29
|
+
},
|
|
30
|
+
indeterminate: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
shape: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "round"
|
|
37
|
+
// button
|
|
52
38
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, f = u.partialSelect ? i.CheckDisabled : k.value ? i.Checked : i.CheckNormal, l = j(a);
|
|
60
|
-
return b(f, {
|
|
61
|
-
width: l,
|
|
62
|
-
height: l,
|
|
63
|
-
size: l,
|
|
64
|
-
class: y.value
|
|
39
|
+
},
|
|
40
|
+
emits: ["change", "update:modelValue"],
|
|
41
|
+
setup(props, { emit, slots }) {
|
|
42
|
+
const parent = inject("parent", null);
|
|
43
|
+
const state = reactive({
|
|
44
|
+
partialSelect: props.indeterminate
|
|
65
45
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
46
|
+
const hasParent = computed(() => !!parent);
|
|
47
|
+
const pValue = computed(() => {
|
|
48
|
+
if (hasParent.value) {
|
|
49
|
+
return parent.value.value.includes(props.label);
|
|
50
|
+
} else {
|
|
51
|
+
return props.modelValue;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const pDisabled = computed(() => {
|
|
55
|
+
return hasParent.value ? parent.disabled.value ? parent.disabled.value : props.disabled : props.disabled;
|
|
56
|
+
});
|
|
57
|
+
const checked = computed(() => !!props.modelValue);
|
|
58
|
+
const color = computed(() => {
|
|
59
|
+
return !pDisabled.value ? state.partialSelect ? "nut-checkbox__icon--indeterminate" : !pValue.value ? "nut-checkbox__icon--unchecked" : "nut-checkbox__icon" : "nut-checkbox__icon--disable";
|
|
60
|
+
});
|
|
61
|
+
let updateType = "";
|
|
62
|
+
const emitChange = (value, label) => {
|
|
63
|
+
updateType = "click";
|
|
64
|
+
emit("update:modelValue", value);
|
|
65
|
+
emit("change", value, label);
|
|
66
|
+
};
|
|
67
|
+
watch(
|
|
68
|
+
() => props.modelValue,
|
|
69
|
+
(v) => {
|
|
70
|
+
if (updateType == "click") {
|
|
71
|
+
updateType = "";
|
|
72
|
+
} else {
|
|
73
|
+
emit("change", v);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
83
76
|
);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
const renderIcon = () => {
|
|
78
|
+
const { iconSize } = props;
|
|
79
|
+
const iconNodeMap = {
|
|
80
|
+
CheckNormal: slots.icon ? slots.icon : components.CheckNormal,
|
|
81
|
+
Checked: slots.checkedIcon ? slots.checkedIcon : components.Checked,
|
|
82
|
+
CheckDisabled: slots.indeterminate ? slots.indeterminate : components.CheckDisabled
|
|
83
|
+
};
|
|
84
|
+
const iconNode = state.partialSelect ? iconNodeMap.CheckDisabled : !pValue.value ? iconNodeMap.CheckNormal : iconNodeMap.Checked;
|
|
85
|
+
const size = pxCheck(iconSize);
|
|
86
|
+
return h(iconNode, {
|
|
87
|
+
width: size,
|
|
88
|
+
height: size,
|
|
89
|
+
size,
|
|
90
|
+
class: color.value
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const renderLabel = () => {
|
|
94
|
+
var _a;
|
|
95
|
+
return h(
|
|
96
|
+
"view",
|
|
97
|
+
{
|
|
98
|
+
class: `${componentName2}__label ${pDisabled.value ? `${componentName2}__label--disabled` : ""}`
|
|
99
|
+
},
|
|
100
|
+
(_a = slots.default) == null ? void 0 : _a.call(slots)
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
const renderButton = () => {
|
|
104
|
+
var _a;
|
|
105
|
+
return h(
|
|
106
|
+
"view",
|
|
107
|
+
{
|
|
108
|
+
class: `${componentName2}__button ${pValue.value && `${componentName2}__button--active`} ${pDisabled.value ? `${componentName2}__button--disabled` : ""}`
|
|
109
|
+
},
|
|
110
|
+
(_a = slots.default) == null ? void 0 : _a.call(slots)
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
const handleClick = (e) => {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
if (pDisabled.value)
|
|
116
|
+
return;
|
|
117
|
+
if (checked.value && state.partialSelect) {
|
|
118
|
+
state.partialSelect = false;
|
|
119
|
+
emitChange(checked.value, (_a = slots.default) == null ? void 0 : _a.call(slots)[0].children);
|
|
89
120
|
return;
|
|
90
121
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
122
|
+
emitChange(!checked.value, (_b = slots.default) == null ? void 0 : _b.call(slots)[0].children);
|
|
123
|
+
if (hasParent.value) {
|
|
124
|
+
const value = parent.value.value;
|
|
125
|
+
const max = parent.max.value;
|
|
126
|
+
const { label } = props;
|
|
127
|
+
const index = value.indexOf(label);
|
|
128
|
+
if (index > -1) {
|
|
129
|
+
value.splice(index, 1);
|
|
130
|
+
} else if (index <= -1 && (value.length < max || !max)) {
|
|
131
|
+
value.push(label);
|
|
132
|
+
}
|
|
133
|
+
parent.updateValue(value);
|
|
94
134
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
135
|
+
};
|
|
136
|
+
onMounted(() => {
|
|
137
|
+
hasParent.value && parent.link(getCurrentInstance());
|
|
138
|
+
});
|
|
139
|
+
onBeforeUnmount(() => {
|
|
140
|
+
hasParent.value && parent.unlink(getCurrentInstance());
|
|
141
|
+
});
|
|
142
|
+
watch(
|
|
143
|
+
() => props.indeterminate,
|
|
144
|
+
(newVal) => {
|
|
145
|
+
state.partialSelect = newVal;
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
return () => {
|
|
149
|
+
return h(
|
|
150
|
+
"view",
|
|
151
|
+
{
|
|
152
|
+
class: `${componentName2} ${componentName2}--${props.shape} ${props.textPosition === "left" ? `${componentName2}--reverse` : ""}`,
|
|
153
|
+
onClick: handleClick
|
|
154
|
+
},
|
|
155
|
+
[props.shape == "button" ? renderButton() : [renderIcon(), renderLabel()]]
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
const { create, componentName } = createComponent("checkbox");
|
|
162
|
+
const _sfc_main = create(component(componentName, { CheckNormal, Checked, CheckDisabled }));
|
|
116
163
|
export {
|
|
117
|
-
|
|
164
|
+
_sfc_main as default
|
|
118
165
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { reactive
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
1
|
+
import { reactive, provide, computed, watch, h } from "vue";
|
|
2
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
3
|
+
import { u as useExpose } from "./index-79c5dc33.js";
|
|
4
4
|
import "../locale/lang";
|
|
5
|
-
const { create
|
|
5
|
+
const { create, componentName } = createComponent("checkbox-group");
|
|
6
|
+
const _sfc_main = create({
|
|
6
7
|
props: {
|
|
7
8
|
modelValue: {
|
|
8
9
|
type: Array,
|
|
@@ -10,7 +11,7 @@ const { create: m, componentName: y } = g("checkbox-group"), E = m({
|
|
|
10
11
|
},
|
|
11
12
|
disabled: {
|
|
12
13
|
type: Boolean,
|
|
13
|
-
default:
|
|
14
|
+
default: false
|
|
14
15
|
},
|
|
15
16
|
max: {
|
|
16
17
|
type: Number,
|
|
@@ -18,48 +19,68 @@ const { create: m, componentName: y } = g("checkbox-group"), E = m({
|
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
21
|
emits: ["change", "update:modelValue"],
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
22
|
+
setup(props, { slots, emit }) {
|
|
23
|
+
const state = reactive({
|
|
23
24
|
children: []
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
e.proxy && (d.children = d.children.filter((a) => a !== e.proxy));
|
|
28
|
-
}, s = (e) => {
|
|
29
|
-
r("update:modelValue", e), r("change", e);
|
|
30
|
-
}, p = (e) => {
|
|
31
|
-
const a = [];
|
|
32
|
-
e && d.children.forEach((l) => {
|
|
33
|
-
l != null && l.disabled || a.push(l == null ? void 0 : l.label);
|
|
34
|
-
}), r("update:modelValue", a);
|
|
35
|
-
}, f = () => {
|
|
36
|
-
const e = d.children.filter((a) => a != null && a.disabled ? !1 : !o.modelValue.includes(a.label)).map((a) => a.label);
|
|
37
|
-
r("update:modelValue", e);
|
|
25
|
+
});
|
|
26
|
+
const link = (child) => {
|
|
27
|
+
child.proxy && state.children.push(child.proxy);
|
|
38
28
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(
|
|
49
|
-
|
|
29
|
+
const unlink = (child) => {
|
|
30
|
+
child.proxy && (state.children = state.children.filter((p) => p !== child.proxy));
|
|
31
|
+
};
|
|
32
|
+
const updateValue = (value) => {
|
|
33
|
+
emit("update:modelValue", value);
|
|
34
|
+
emit("change", value);
|
|
35
|
+
};
|
|
36
|
+
const toggleAll = (checked) => {
|
|
37
|
+
const values = [];
|
|
38
|
+
if (checked) {
|
|
39
|
+
state.children.forEach((item) => {
|
|
40
|
+
if (!(item == null ? void 0 : item.disabled)) {
|
|
41
|
+
values.push(item == null ? void 0 : item.label);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
emit("update:modelValue", values);
|
|
46
|
+
};
|
|
47
|
+
const toggleReverse = () => {
|
|
48
|
+
const value = state.children.filter((item) => {
|
|
49
|
+
if (item == null ? void 0 : item.disabled) {
|
|
50
|
+
return false;
|
|
51
|
+
} else {
|
|
52
|
+
return !props.modelValue.includes(item.label);
|
|
53
|
+
}
|
|
54
|
+
}).map((item) => item.label);
|
|
55
|
+
emit("update:modelValue", value);
|
|
56
|
+
};
|
|
57
|
+
provide("parent", {
|
|
58
|
+
value: computed(() => props.modelValue),
|
|
59
|
+
disabled: computed(() => props.disabled),
|
|
60
|
+
max: computed(() => props.max),
|
|
61
|
+
updateValue,
|
|
62
|
+
link,
|
|
63
|
+
unlink
|
|
64
|
+
});
|
|
65
|
+
watch(
|
|
66
|
+
() => props.modelValue,
|
|
67
|
+
(value) => {
|
|
68
|
+
emit("change", value);
|
|
50
69
|
}
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
);
|
|
71
|
+
useExpose({ toggleAll, toggleReverse });
|
|
72
|
+
return () => {
|
|
73
|
+
var _a;
|
|
74
|
+
return h(
|
|
54
75
|
"view",
|
|
55
76
|
{
|
|
56
|
-
class:
|
|
77
|
+
class: componentName
|
|
57
78
|
},
|
|
58
|
-
(
|
|
79
|
+
(_a = slots.default) == null ? void 0 : _a.call(slots)
|
|
59
80
|
);
|
|
60
81
|
};
|
|
61
82
|
}
|
|
62
83
|
});
|
|
63
84
|
export {
|
|
64
|
-
|
|
85
|
+
_sfc_main as default
|
|
65
86
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { useSlots
|
|
2
|
-
import { g as
|
|
3
|
-
import { _ as
|
|
1
|
+
import { useSlots, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, Fragment, renderList, renderSlot, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
import { g as isObject, c as createComponent } from "./component-81a4c1d0.js";
|
|
3
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
4
4
|
import "../locale/lang";
|
|
5
|
-
const { componentName
|
|
5
|
+
const { componentName, create } = createComponent("circle-progress");
|
|
6
|
+
const _sfc_main = create({
|
|
6
7
|
props: {
|
|
7
8
|
progress: {
|
|
8
9
|
type: [Number, String],
|
|
9
|
-
required:
|
|
10
|
+
required: true
|
|
10
11
|
},
|
|
11
12
|
strokeWidth: {
|
|
12
13
|
type: [Number, String],
|
|
@@ -30,94 +31,122 @@ const { componentName: D, create: W } = j("circle-progress"), F = W({
|
|
|
30
31
|
},
|
|
31
32
|
clockwise: {
|
|
32
33
|
type: Boolean,
|
|
33
|
-
default:
|
|
34
|
+
default: true
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
|
-
setup(
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
return `M 50 50 m 0 -45 a 45 45 0 1 ${t} 0 90 a 45 45 0 1, ${t} 0 -90`;
|
|
42
|
-
}), y = r(() => h(e.color) ? `url(#${a})` : e.color), i = r(() => {
|
|
43
|
-
let t = 283, d = t * Number(e.progress) / 100;
|
|
37
|
+
setup(props) {
|
|
38
|
+
const slotDefault = !!useSlots().default;
|
|
39
|
+
const refRandomId = Math.random().toString(36).slice(-8);
|
|
40
|
+
const classes = computed(() => {
|
|
41
|
+
const prefixCls = componentName;
|
|
44
42
|
return {
|
|
45
|
-
|
|
46
|
-
strokeDasharray: `${d}px ${t}px`
|
|
43
|
+
[prefixCls]: true
|
|
47
44
|
};
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
});
|
|
46
|
+
const path = computed(() => {
|
|
47
|
+
const isWise = props.clockwise ? 1 : 0;
|
|
48
|
+
return `M 50 50 m 0 -45 a 45 45 0 1 ${isWise} 0 90 a 45 45 0 1, ${isWise} 0 -90`;
|
|
49
|
+
});
|
|
50
|
+
const hoverColor = computed(() => {
|
|
51
|
+
return isObject(props.color) ? `url(#${refRandomId})` : props.color;
|
|
52
|
+
});
|
|
53
|
+
const hoverStyle = computed(() => {
|
|
54
|
+
let perimeter = 283;
|
|
55
|
+
let offset = perimeter * Number(props.progress) / 100;
|
|
56
|
+
return {
|
|
57
|
+
stroke: isObject(props.color) ? `url(#${refRandomId})` : props.color,
|
|
58
|
+
strokeDasharray: `${offset}px ${perimeter}px`
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const pathStyle = computed(() => {
|
|
62
|
+
return {
|
|
63
|
+
stroke: props.pathColor
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
const stop = computed(() => {
|
|
67
|
+
if (!isObject(props.color)) {
|
|
52
68
|
return;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
}
|
|
70
|
+
let color = props.color;
|
|
71
|
+
const colorArr = Object.keys(color).sort((a, b) => parseFloat(a) - parseFloat(b));
|
|
72
|
+
let stopArr = [];
|
|
73
|
+
colorArr.map((item) => {
|
|
74
|
+
let obj = {
|
|
58
75
|
key: "",
|
|
59
76
|
value: ""
|
|
60
77
|
};
|
|
61
|
-
|
|
62
|
-
|
|
78
|
+
obj.key = item;
|
|
79
|
+
obj.value = color[item];
|
|
80
|
+
stopArr.push(obj);
|
|
81
|
+
});
|
|
82
|
+
return stopArr;
|
|
63
83
|
});
|
|
64
84
|
return {
|
|
65
|
-
classes
|
|
66
|
-
hoverStyle
|
|
67
|
-
pathStyle
|
|
68
|
-
path
|
|
69
|
-
hoverColor
|
|
70
|
-
stop
|
|
71
|
-
slotDefault
|
|
72
|
-
refRandomId
|
|
85
|
+
classes,
|
|
86
|
+
hoverStyle,
|
|
87
|
+
pathStyle,
|
|
88
|
+
path,
|
|
89
|
+
hoverColor,
|
|
90
|
+
stop,
|
|
91
|
+
slotDefault,
|
|
92
|
+
refRandomId
|
|
73
93
|
};
|
|
74
94
|
}
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
});
|
|
96
|
+
const _hoisted_1 = { viewBox: "0 0 100 100" };
|
|
97
|
+
const _hoisted_2 = ["id"];
|
|
98
|
+
const _hoisted_3 = ["offset", "stop-color"];
|
|
99
|
+
const _hoisted_4 = ["d", "stroke-width"];
|
|
100
|
+
const _hoisted_5 = ["d", "stroke", "stroke-linecap", "stroke-width"];
|
|
101
|
+
const _hoisted_6 = { class: "nut-circle-progress__text" };
|
|
102
|
+
const _hoisted_7 = { key: 0 };
|
|
103
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
104
|
+
return openBlock(), createElementBlock("div", {
|
|
105
|
+
class: normalizeClass(_ctx.classes),
|
|
106
|
+
style: normalizeStyle({ height: Number(_ctx.radius) * 2 + "px", width: Number(_ctx.radius) * 2 + "px" })
|
|
80
107
|
}, [
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
id:
|
|
108
|
+
(openBlock(), createElementBlock("svg", _hoisted_1, [
|
|
109
|
+
createElementVNode("defs", null, [
|
|
110
|
+
createElementVNode("linearGradient", {
|
|
111
|
+
id: _ctx.refRandomId,
|
|
85
112
|
x1: "100%",
|
|
86
113
|
y1: "0%",
|
|
87
114
|
x2: "0%",
|
|
88
115
|
y2: "0%"
|
|
89
116
|
}, [
|
|
90
|
-
(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
117
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stop, (item, index2) => {
|
|
118
|
+
return openBlock(), createElementBlock("stop", {
|
|
119
|
+
key: index2,
|
|
120
|
+
offset: item.key,
|
|
121
|
+
"stop-color": item.value
|
|
122
|
+
}, null, 8, _hoisted_3);
|
|
123
|
+
}), 128))
|
|
124
|
+
], 8, _hoisted_2)
|
|
96
125
|
]),
|
|
97
|
-
|
|
126
|
+
createElementVNode("path", {
|
|
98
127
|
class: "nut-circle-progress__path",
|
|
99
|
-
style:
|
|
100
|
-
d:
|
|
128
|
+
style: normalizeStyle(_ctx.pathStyle),
|
|
129
|
+
d: _ctx.path,
|
|
101
130
|
fill: "none",
|
|
102
|
-
"stroke-width":
|
|
103
|
-
}, " > ", 12,
|
|
104
|
-
|
|
131
|
+
"stroke-width": _ctx.strokeWidth
|
|
132
|
+
}, " > ", 12, _hoisted_4),
|
|
133
|
+
createElementVNode("path", {
|
|
105
134
|
class: "nut-circle-progress__hover",
|
|
106
|
-
style:
|
|
107
|
-
d:
|
|
135
|
+
style: normalizeStyle(_ctx.hoverStyle),
|
|
136
|
+
d: _ctx.path,
|
|
108
137
|
fill: "none",
|
|
109
|
-
stroke:
|
|
110
|
-
"stroke-linecap":
|
|
111
|
-
"stroke-width":
|
|
112
|
-
}, null, 12,
|
|
138
|
+
stroke: _ctx.hoverColor,
|
|
139
|
+
"stroke-linecap": _ctx.strokeLinecap,
|
|
140
|
+
"stroke-width": _ctx.strokeWidth
|
|
141
|
+
}, null, 12, _hoisted_5)
|
|
113
142
|
])),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
143
|
+
createElementVNode("div", _hoisted_6, [
|
|
144
|
+
renderSlot(_ctx.$slots, "default"),
|
|
145
|
+
!_ctx.slotDefault ? (openBlock(), createElementBlock("div", _hoisted_7, toDisplayString(_ctx.progress) + "%", 1)) : createCommentVNode("", true)
|
|
117
146
|
])
|
|
118
147
|
], 6);
|
|
119
148
|
}
|
|
120
|
-
const
|
|
149
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
121
150
|
export {
|
|
122
|
-
|
|
151
|
+
index as default
|
|
123
152
|
};
|