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