@nutui/nutui 3.1.6 → 3.1.7

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 (92) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/nutui.d.ts +7 -1
  3. package/dist/nutui.es.js +1097 -517
  4. package/dist/nutui.umd.js +1158 -571
  5. package/dist/packages/_es/ActionSheet.js +158 -0
  6. package/dist/packages/_es/Address.js +525 -0
  7. package/dist/packages/_es/Avatar.js +87 -0
  8. package/dist/packages/_es/BackTop.js +159 -0
  9. package/dist/packages/_es/Badge.js +90 -0
  10. package/dist/packages/_es/Barrage.js +118 -0
  11. package/dist/packages/_es/Button.js +124 -0
  12. package/dist/packages/_es/Calendar.js +700 -0
  13. package/dist/packages/_es/Cell.js +95 -0
  14. package/dist/packages/_es/CellGroup.js +42 -0
  15. package/dist/packages/_es/Checkbox.js +109 -0
  16. package/dist/packages/_es/CheckboxGroup.js +62 -0
  17. package/dist/packages/_es/CircleProgress.js +109 -0
  18. package/dist/packages/_es/Col.js +53 -0
  19. package/dist/packages/_es/Collapse.js +89 -0
  20. package/dist/packages/_es/CollapseItem.js +257 -0
  21. package/dist/packages/_es/CountDown.js +224 -0
  22. package/dist/packages/_es/CountUp.js +547 -0
  23. package/dist/packages/_es/DatePicker.js +282 -0
  24. package/dist/packages/_es/Dialog.js +313 -0
  25. package/dist/packages/_es/Divider.js +49 -0
  26. package/dist/packages/_es/Drag.js +198 -0
  27. package/dist/packages/_es/Elevator.js +207 -0
  28. package/dist/packages/_es/FixedNav.js +127 -0
  29. package/dist/packages/_es/Icon.js +44 -0
  30. package/dist/packages/_es/ImagePreview.js +109 -0
  31. package/dist/packages/_es/InfiniteLoading.js +265 -0
  32. package/dist/packages/_es/Input.js +183 -0
  33. package/dist/packages/_es/InputNumber.js +172 -0
  34. package/dist/packages/_es/Layout.js +10 -0
  35. package/dist/packages/_es/MenuItem.js +180 -0
  36. package/dist/packages/_es/Navbar.js +160 -0
  37. package/dist/packages/_es/NoticeBar.js +389 -0
  38. package/dist/packages/_es/Notify.js +233 -0
  39. package/dist/packages/_es/NumberKeyboard.js +248 -0
  40. package/dist/packages/_es/OverLay.js +118 -0
  41. package/dist/packages/_es/Pagination.js +163 -0
  42. package/dist/packages/_es/Picker.js +485 -0
  43. package/dist/packages/_es/Popover.js +157 -0
  44. package/dist/packages/_es/Popup.js +268 -0
  45. package/dist/packages/_es/Price.js +104 -0
  46. package/dist/packages/_es/Progress.js +131 -0
  47. package/dist/packages/_es/Radio.js +72 -0
  48. package/dist/packages/_es/RadioGroup.js +37 -0
  49. package/dist/packages/_es/Range.js +350 -0
  50. package/dist/packages/_es/Rate.js +129 -0
  51. package/dist/packages/_es/Row.js +61 -0
  52. package/dist/packages/_es/ShortPassword.js +221 -0
  53. package/dist/packages/_es/Signature.js +167 -0
  54. package/dist/packages/_es/Step.js +116 -0
  55. package/dist/packages/_es/Steps.js +52 -0
  56. package/dist/packages/_es/Swipe.js +193 -0
  57. package/dist/packages/_es/Swiper.js +429 -0
  58. package/dist/packages/_es/SwiperItem.js +60 -0
  59. package/dist/packages/_es/Switch.js +90 -0
  60. package/dist/packages/_es/Tab.js +179 -0
  61. package/dist/packages/_es/TabPane.js +42 -0
  62. package/dist/packages/_es/TabPanel.js +30 -0
  63. package/dist/packages/_es/Tabbar.js +73 -0
  64. package/dist/packages/_es/TabbarItem.js +142 -0
  65. package/dist/packages/_es/Tag.js +98 -0
  66. package/dist/packages/_es/TextArea.js +127 -0
  67. package/dist/packages/_es/Toast.js +317 -0
  68. package/dist/packages/_es/Uploader.js +400 -0
  69. package/dist/packages/_es/Video.js +405 -0
  70. package/dist/packages/_es/component.js +26 -0
  71. package/dist/packages/_es/index.js +64 -0
  72. package/dist/packages/_es/index2.js +13 -0
  73. package/dist/packages/_es/plugin-vue_export-helper.js +12 -0
  74. package/dist/packages/_es/pxCheck.js +9 -0
  75. package/dist/packages/_es/raf.js +19 -0
  76. package/dist/packages/avatar/index.scss +0 -1
  77. package/dist/packages/badge/index.scss +35 -0
  78. package/dist/packages/calendar/index.scss +13 -0
  79. package/dist/packages/imagepreview/index.scss +48 -0
  80. package/dist/packages/input/index.scss +14 -7
  81. package/dist/packages/pagination/index.scss +51 -0
  82. package/dist/packages/popover/index.scss +159 -0
  83. package/dist/packages/shortpassword/index.scss +19 -7
  84. package/dist/packages/tabpane/index.scss +1 -0
  85. package/dist/packages/tabs/index.scss +1 -0
  86. package/dist/packages/tag/index.scss +47 -0
  87. package/dist/packages/uploader/index.scss +0 -1
  88. package/dist/style.css +1 -1
  89. package/dist/style.es.js +2 -1
  90. package/dist/styles/themes/default.scss +35 -28
  91. package/dist/styles/variables.scss +55 -32
  92. package/package.json +7 -7
@@ -0,0 +1,268 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ /*!
21
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
22
+ * (c) 2021 @jdf2e.
23
+ * Released under the MIT License.
24
+ */
25
+ import { reactive, computed, onMounted, onBeforeUnmount, onBeforeMount, onActivated, onDeactivated, watch, toRefs, resolveComponent, openBlock, createBlock, Teleport, normalizeClass, normalizeStyle, createCommentVNode, createVNode, Transition, withCtx, withDirectives, createElementVNode, renderSlot, createElementBlock, vShow } from "vue";
26
+ import overlay, { overlayProps } from "./OverLay.js";
27
+ import _sfc_main$1 from "./Icon.js";
28
+ import { c as createComponent } from "./component.js";
29
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
+ import "./pxCheck.js";
31
+ let count = 0;
32
+ const CLSNAME = "nut-overflow-hidden";
33
+ const useLockScroll = (isLock) => {
34
+ const lock = () => {
35
+ if (isLock()) {
36
+ !count && document.body.classList.add(CLSNAME);
37
+ count++;
38
+ }
39
+ };
40
+ const unlock = () => {
41
+ if (isLock() && count) {
42
+ count--;
43
+ !count && document.body.classList.remove(CLSNAME);
44
+ }
45
+ };
46
+ return [lock, unlock];
47
+ };
48
+ const { componentName, create } = createComponent("popup");
49
+ let _zIndex = 2e3;
50
+ const popupProps = __spreadProps(__spreadValues({}, overlayProps), {
51
+ position: {
52
+ type: String,
53
+ default: "center"
54
+ },
55
+ transition: String,
56
+ style: {
57
+ type: Object
58
+ },
59
+ popClass: {
60
+ type: String,
61
+ default: ""
62
+ },
63
+ closeable: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ closeIconPosition: {
68
+ type: String,
69
+ default: "top-right"
70
+ },
71
+ closeIcon: {
72
+ type: String,
73
+ default: "close"
74
+ },
75
+ destroyOnClose: {
76
+ type: Boolean,
77
+ default: true
78
+ },
79
+ teleport: {
80
+ type: [String, Element],
81
+ default: "body"
82
+ },
83
+ overlay: {
84
+ type: Boolean,
85
+ default: true
86
+ },
87
+ round: {
88
+ type: Boolean,
89
+ default: false
90
+ }
91
+ });
92
+ const _sfc_main = create({
93
+ components: {
94
+ [overlay.name]: overlay,
95
+ [_sfc_main$1.name]: _sfc_main$1
96
+ },
97
+ props: __spreadValues({}, popupProps),
98
+ emits: [
99
+ "click",
100
+ "click-close-icon",
101
+ "open",
102
+ "close",
103
+ "opend",
104
+ "closed",
105
+ "update:visible",
106
+ "click-overlay"
107
+ ],
108
+ setup(props, { emit }) {
109
+ const state = reactive({
110
+ zIndex: props.zIndex ? props.zIndex : _zIndex,
111
+ showSlot: true,
112
+ transitionName: `popup-fade-${props.position}`,
113
+ overLayCount: 1,
114
+ keepAlive: false
115
+ });
116
+ const [lockScroll, unlockScroll] = useLockScroll(() => props.lockScroll);
117
+ const classes = computed(() => {
118
+ const prefixCls = componentName;
119
+ return {
120
+ [prefixCls]: true,
121
+ ["round"]: props.round,
122
+ [`popup-${props.position}`]: true,
123
+ [props.popClass]: true
124
+ };
125
+ });
126
+ const popStyle = computed(() => {
127
+ return __spreadValues({
128
+ zIndex: state.zIndex,
129
+ animationDuration: props.duration ? `${props.duration}s` : "initial"
130
+ }, props.style);
131
+ });
132
+ const open = () => {
133
+ if (!props.visible) {
134
+ if (props.zIndex !== void 0) {
135
+ _zIndex = Number(props.zIndex);
136
+ }
137
+ emit("update:visible", true);
138
+ lockScroll();
139
+ state.zIndex = ++_zIndex;
140
+ }
141
+ if (props.destroyOnClose) {
142
+ state.showSlot = true;
143
+ }
144
+ emit("open");
145
+ };
146
+ const close = () => {
147
+ if (props.visible) {
148
+ unlockScroll();
149
+ emit("update:visible", false);
150
+ if (props.destroyOnClose) {
151
+ setTimeout(() => {
152
+ state.showSlot = false;
153
+ emit("close");
154
+ }, +props.duration * 1e3);
155
+ }
156
+ }
157
+ };
158
+ const onClick = (e) => {
159
+ emit("click", e);
160
+ };
161
+ const onClickCloseIcon = (e) => {
162
+ emit("click-close-icon", e);
163
+ close();
164
+ };
165
+ const onClickOverlay = (e) => {
166
+ if (props.closeOnClickOverlay) {
167
+ emit("click-overlay", e);
168
+ close();
169
+ }
170
+ };
171
+ const onOpened = (e) => {
172
+ emit("opend", e);
173
+ };
174
+ const onClosed = (e) => {
175
+ emit("closed", e);
176
+ };
177
+ onMounted(() => {
178
+ props.transition ? state.transitionName = props.transition : state.transitionName = `popup-slide-${props.position}`;
179
+ props.visible && open();
180
+ });
181
+ onBeforeUnmount(() => {
182
+ props.visible && close();
183
+ });
184
+ onBeforeMount(() => {
185
+ if (props.visible) {
186
+ unlockScroll();
187
+ }
188
+ });
189
+ onActivated(() => {
190
+ if (state.keepAlive) {
191
+ emit("update:visible", true);
192
+ state.keepAlive = false;
193
+ }
194
+ });
195
+ onDeactivated(() => {
196
+ if (props.visible) {
197
+ close();
198
+ state.keepAlive = true;
199
+ }
200
+ });
201
+ watch(() => props.visible, (value) => {
202
+ if (value) {
203
+ open();
204
+ } else {
205
+ close();
206
+ }
207
+ });
208
+ watch(() => props.position, (value) => {
209
+ value === "center" ? state.transitionName = "popup-fade" : state.transitionName = `popup-slide-${value}`;
210
+ });
211
+ return __spreadProps(__spreadValues({}, toRefs(state)), {
212
+ popStyle,
213
+ classes,
214
+ onClick,
215
+ onClickCloseIcon,
216
+ onClickOverlay,
217
+ onOpened,
218
+ onClosed
219
+ });
220
+ }
221
+ });
222
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
223
+ const _component_nut_overlay = resolveComponent("nut-overlay");
224
+ const _component_nut_icon = resolveComponent("nut-icon");
225
+ return openBlock(), createBlock(Teleport, { to: _ctx.teleport }, [
226
+ _ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
227
+ key: 0,
228
+ visible: _ctx.visible,
229
+ "close-on-click-overlay": _ctx.closeOnClickOverlay,
230
+ class: normalizeClass(_ctx.overlayClass),
231
+ style: normalizeStyle(_ctx.overlayStyle),
232
+ "z-index": _ctx.zIndex,
233
+ "lock-scroll": _ctx.lockScroll,
234
+ duration: _ctx.duration,
235
+ onClick: _ctx.onClickOverlay
236
+ }, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
237
+ createVNode(Transition, {
238
+ name: _ctx.transitionName,
239
+ onAfterEnter: _ctx.onOpened,
240
+ onAfterLeave: _ctx.onClosed
241
+ }, {
242
+ default: withCtx(() => [
243
+ withDirectives(createElementVNode("view", {
244
+ class: normalizeClass(_ctx.classes),
245
+ style: normalizeStyle(_ctx.popStyle),
246
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args))
247
+ }, [
248
+ _ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
249
+ _ctx.closeable ? (openBlock(), createElementBlock("view", {
250
+ key: 1,
251
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
252
+ class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
253
+ }, [
254
+ createVNode(_component_nut_icon, {
255
+ name: _ctx.closeIcon,
256
+ size: "12px"
257
+ }, null, 8, ["name"])
258
+ ], 2)) : createCommentVNode("", true)
259
+ ], 6), [
260
+ [vShow, _ctx.visible]
261
+ ])
262
+ ]),
263
+ _: 3
264
+ }, 8, ["name", "onAfterEnter", "onAfterLeave"])
265
+ ], 8, ["to"]);
266
+ }
267
+ var Popup = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
268
+ export { Popup as default, popupProps };
@@ -0,0 +1,104 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { computed, openBlock, createElementBlock, normalizeClass, createCommentVNode, createElementVNode, toDisplayString } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { componentName, create } = createComponent("price");
10
+ const _sfc_main = create({
11
+ props: {
12
+ price: {
13
+ type: [Number, String],
14
+ default: 0
15
+ },
16
+ needSymbol: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ symbol: {
21
+ type: String,
22
+ default: "¥"
23
+ },
24
+ decimalDigits: {
25
+ type: Number,
26
+ default: 2
27
+ },
28
+ thousands: {
29
+ type: Boolean,
30
+ default: false
31
+ }
32
+ },
33
+ setup(props) {
34
+ const classes = computed(() => {
35
+ return {
36
+ [componentName]: true
37
+ };
38
+ });
39
+ const showSymbol = computed(() => {
40
+ const symbol = props.needSymbol ? props.symbol : "";
41
+ return symbol;
42
+ });
43
+ const checkPoint = (price) => {
44
+ return String(price).indexOf(".") > 0;
45
+ };
46
+ const formatThousands = (num) => {
47
+ if (Number(num) == 0) {
48
+ num = 0;
49
+ }
50
+ if (checkPoint(num)) {
51
+ num = Number(num).toFixed(props.decimalDigits);
52
+ num = typeof num.split(".") === "string" ? num.split(".") : num.split(".")[0];
53
+ } else {
54
+ num = num.toString();
55
+ }
56
+ if (props.thousands) {
57
+ return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,");
58
+ } else {
59
+ return num;
60
+ }
61
+ };
62
+ const formatDecimal = (decimalNum) => {
63
+ if (Number(decimalNum) == 0) {
64
+ decimalNum = 0;
65
+ }
66
+ if (checkPoint(decimalNum)) {
67
+ decimalNum = Number(decimalNum).toFixed(props.decimalDigits);
68
+ decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1];
69
+ } else {
70
+ decimalNum = 0;
71
+ }
72
+ const result = "0." + decimalNum;
73
+ const resultFixed = Number(result).toFixed(props.decimalDigits);
74
+ return String(resultFixed).substring(2, resultFixed.length);
75
+ };
76
+ return {
77
+ classes,
78
+ showSymbol,
79
+ checkPoint,
80
+ formatThousands,
81
+ formatDecimal
82
+ };
83
+ }
84
+ });
85
+ const _hoisted_1 = ["innerHTML"];
86
+ const _hoisted_2 = { class: "nut-price--big" };
87
+ const _hoisted_3 = /* @__PURE__ */ createElementVNode("view", { class: "nut-price--point" }, ".", -1);
88
+ const _hoisted_4 = { class: "nut-price--small" };
89
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
90
+ return openBlock(), createElementBlock("view", {
91
+ class: normalizeClass(_ctx.classes)
92
+ }, [
93
+ _ctx.needSymbol ? (openBlock(), createElementBlock("view", {
94
+ key: 0,
95
+ class: "nut-price--symbol",
96
+ innerHTML: _ctx.showSymbol
97
+ }, null, 8, _hoisted_1)) : createCommentVNode("", true),
98
+ createElementVNode("view", _hoisted_2, toDisplayString(_ctx.formatThousands(_ctx.price)), 1),
99
+ _hoisted_3,
100
+ createElementVNode("view", _hoisted_4, toDisplayString(_ctx.formatDecimal(_ctx.price)), 1)
101
+ ], 2);
102
+ }
103
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
104
+ export { index as default };
@@ -0,0 +1,131 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { ref, computed, watch, onMounted, resolveComponent, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, toDisplayString, createCommentVNode, createBlock } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { create } = createComponent("progress");
10
+ const _sfc_main = create({
11
+ props: {
12
+ percentage: {
13
+ type: [Number, String],
14
+ default: 0,
15
+ required: true
16
+ },
17
+ size: {
18
+ type: String,
19
+ default: "base"
20
+ },
21
+ status: {
22
+ type: String,
23
+ default: ""
24
+ },
25
+ strokeWidth: {
26
+ type: [Number, String],
27
+ default: ""
28
+ },
29
+ textInside: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ showText: {
34
+ type: Boolean,
35
+ default: true
36
+ },
37
+ strokeColor: {
38
+ type: String,
39
+ default: ""
40
+ },
41
+ textColor: {
42
+ tyep: String,
43
+ default: ""
44
+ },
45
+ iconName: {
46
+ type: String,
47
+ default: "checked"
48
+ },
49
+ iconColor: {
50
+ type: String,
51
+ default: "#439422"
52
+ }
53
+ },
54
+ setup(props, { emit }) {
55
+ const height = ref(props.strokeWidth + "px");
56
+ const progressOuter = ref();
57
+ const left = ref();
58
+ const bgStyle = computed(() => {
59
+ return {
60
+ width: props.percentage + "%",
61
+ background: props.strokeColor || ""
62
+ };
63
+ });
64
+ const textStyle = computed(() => {
65
+ return {
66
+ color: props.textColor || ""
67
+ };
68
+ });
69
+ watch(() => props.percentage, (values) => {
70
+ console.log("progressOuter.value.offsetWidth", progressOuter.value.offsetWidth);
71
+ console.log("values", values);
72
+ left.value = progressOuter.value.offsetWidth * Number(values) * 0.01 - 5 + "px";
73
+ });
74
+ onMounted(() => {
75
+ left.value = progressOuter.value.offsetWidth * Number(props.percentage) * 0.01 - 5 + "px";
76
+ });
77
+ return {
78
+ height,
79
+ bgStyle,
80
+ textStyle,
81
+ progressOuter,
82
+ left
83
+ };
84
+ }
85
+ });
86
+ const _hoisted_1 = { class: "nut-progress" };
87
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
88
+ const _component_nut_icon = resolveComponent("nut-icon");
89
+ return openBlock(), createElementBlock("div", _hoisted_1, [
90
+ createElementVNode("div", {
91
+ class: normalizeClass(["nut-progress-outer", [
92
+ _ctx.showText && !_ctx.textInside ? "nut-progress-outer-part" : "",
93
+ _ctx.size ? "nut-progress-" + _ctx.size : ""
94
+ ]]),
95
+ ref: "progressOuter",
96
+ style: normalizeStyle({ height: _ctx.height })
97
+ }, [
98
+ createElementVNode("div", {
99
+ class: normalizeClass(["nut-progress-inner", _ctx.status == "active" ? "nut-active" : ""]),
100
+ style: normalizeStyle(_ctx.bgStyle)
101
+ }, [
102
+ _ctx.showText && _ctx.textInside ? (openBlock(), createElementBlock("div", {
103
+ key: 0,
104
+ class: "nut-progress-text nut-progress-insidetext",
105
+ style: normalizeStyle({ lineHeight: _ctx.height, left: _ctx.left })
106
+ }, [
107
+ createElementVNode("span", {
108
+ style: normalizeStyle(_ctx.textStyle)
109
+ }, toDisplayString(_ctx.percentage) + "%", 5)
110
+ ], 4)) : createCommentVNode("", true)
111
+ ], 6)
112
+ ], 6),
113
+ _ctx.showText && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
114
+ key: 0,
115
+ class: "nut-progress-text",
116
+ style: normalizeStyle({ lineHeight: _ctx.height })
117
+ }, [
118
+ _ctx.status == "active" || _ctx.status == "" ? (openBlock(), createElementBlock("span", {
119
+ key: 0,
120
+ style: normalizeStyle(_ctx.textStyle)
121
+ }, toDisplayString(_ctx.percentage) + "%", 5)) : _ctx.status == "icon" ? (openBlock(), createBlock(_component_nut_icon, {
122
+ key: 1,
123
+ size: "16px",
124
+ name: _ctx.iconName,
125
+ color: _ctx.iconColor
126
+ }, null, 8, ["name", "color"])) : createCommentVNode("", true)
127
+ ], 4)) : createCommentVNode("", true)
128
+ ]);
129
+ }
130
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
131
+ export { index as default };
@@ -0,0 +1,72 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { inject, computed, h } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import _sfc_main$1 from "./Icon.js";
9
+ import "./pxCheck.js";
10
+ const { componentName, create } = createComponent("radio");
11
+ const _sfc_main = create({
12
+ props: {
13
+ disabled: {
14
+ type: Boolean,
15
+ default: false
16
+ },
17
+ label: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ iconName: {
22
+ type: String,
23
+ default: "check-normal"
24
+ },
25
+ iconActiveName: {
26
+ type: String,
27
+ default: "check-checked"
28
+ },
29
+ iconSize: {
30
+ type: [String, Number],
31
+ default: 18
32
+ }
33
+ },
34
+ setup(props, { emit, slots }) {
35
+ let parent = inject("parent");
36
+ const isCurValue = computed(() => {
37
+ return parent.label.value === props.label;
38
+ });
39
+ const color = computed(() => {
40
+ return !props.disabled ? isCurValue.value ? "nut-radio__icon" : "nut-radio__icon--unchecked" : "nut-radio__icon--disable";
41
+ });
42
+ const position = computed(() => {
43
+ return parent.position;
44
+ });
45
+ const renderIcon = () => {
46
+ const { iconName, iconSize, iconActiveName } = props;
47
+ return h(_sfc_main$1, {
48
+ name: isCurValue.value ? iconActiveName : iconName,
49
+ size: iconSize,
50
+ class: color.value
51
+ });
52
+ };
53
+ const renderLabel = () => {
54
+ var _a;
55
+ return h("view", {
56
+ class: `${componentName}__label ${props.disabled ? `${componentName}__label--disabled` : ""}`
57
+ }, (_a = slots.default) == null ? void 0 : _a.call(slots));
58
+ };
59
+ const handleClick = () => {
60
+ if (isCurValue.value || props.disabled)
61
+ return;
62
+ parent.updateValue(props.label);
63
+ };
64
+ return () => {
65
+ return h("view", {
66
+ class: `${componentName} ${position.value === "left" ? `${componentName}--reverse` : ""}`,
67
+ onClick: handleClick
68
+ }, [renderIcon(), renderLabel()]);
69
+ };
70
+ }
71
+ });
72
+ export { _sfc_main as default };
@@ -0,0 +1,37 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { provide, readonly, computed, watch, h } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ const { componentName, create } = createComponent("radiogroup");
9
+ const _sfc_main = create({
10
+ props: {
11
+ modelValue: {
12
+ type: [Number, String, Boolean],
13
+ default: ""
14
+ },
15
+ textPosition: {
16
+ type: String,
17
+ default: "right"
18
+ }
19
+ },
20
+ emits: ["change", "update:modelValue"],
21
+ setup(props, { emit, slots }) {
22
+ const updateValue = (value) => emit("update:modelValue", value);
23
+ provide("parent", {
24
+ label: readonly(computed(() => props.modelValue)),
25
+ position: props.textPosition,
26
+ updateValue
27
+ });
28
+ watch(() => props.modelValue, (value) => emit("change", value));
29
+ return () => {
30
+ var _a;
31
+ return h("view", {
32
+ class: `${componentName}`
33
+ }, (_a = slots.default) == null ? void 0 : _a.call(slots));
34
+ };
35
+ }
36
+ });
37
+ export { _sfc_main as default };