@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.
- package/CHANGELOG.md +40 -0
- package/dist/nutui.d.ts +7 -1
- package/dist/nutui.es.js +1097 -517
- package/dist/nutui.umd.js +1158 -571
- package/dist/packages/_es/ActionSheet.js +158 -0
- package/dist/packages/_es/Address.js +525 -0
- package/dist/packages/_es/Avatar.js +87 -0
- package/dist/packages/_es/BackTop.js +159 -0
- package/dist/packages/_es/Badge.js +90 -0
- package/dist/packages/_es/Barrage.js +118 -0
- package/dist/packages/_es/Button.js +124 -0
- package/dist/packages/_es/Calendar.js +700 -0
- package/dist/packages/_es/Cell.js +95 -0
- package/dist/packages/_es/CellGroup.js +42 -0
- package/dist/packages/_es/Checkbox.js +109 -0
- package/dist/packages/_es/CheckboxGroup.js +62 -0
- package/dist/packages/_es/CircleProgress.js +109 -0
- package/dist/packages/_es/Col.js +53 -0
- package/dist/packages/_es/Collapse.js +89 -0
- package/dist/packages/_es/CollapseItem.js +257 -0
- package/dist/packages/_es/CountDown.js +224 -0
- package/dist/packages/_es/CountUp.js +547 -0
- package/dist/packages/_es/DatePicker.js +282 -0
- package/dist/packages/_es/Dialog.js +313 -0
- package/dist/packages/_es/Divider.js +49 -0
- package/dist/packages/_es/Drag.js +198 -0
- package/dist/packages/_es/Elevator.js +207 -0
- package/dist/packages/_es/FixedNav.js +127 -0
- package/dist/packages/_es/Icon.js +44 -0
- package/dist/packages/_es/ImagePreview.js +109 -0
- package/dist/packages/_es/InfiniteLoading.js +265 -0
- package/dist/packages/_es/Input.js +183 -0
- package/dist/packages/_es/InputNumber.js +172 -0
- package/dist/packages/_es/Layout.js +10 -0
- package/dist/packages/_es/MenuItem.js +180 -0
- package/dist/packages/_es/Navbar.js +160 -0
- package/dist/packages/_es/NoticeBar.js +389 -0
- package/dist/packages/_es/Notify.js +233 -0
- package/dist/packages/_es/NumberKeyboard.js +248 -0
- package/dist/packages/_es/OverLay.js +118 -0
- package/dist/packages/_es/Pagination.js +163 -0
- package/dist/packages/_es/Picker.js +485 -0
- package/dist/packages/_es/Popover.js +157 -0
- package/dist/packages/_es/Popup.js +268 -0
- package/dist/packages/_es/Price.js +104 -0
- package/dist/packages/_es/Progress.js +131 -0
- package/dist/packages/_es/Radio.js +72 -0
- package/dist/packages/_es/RadioGroup.js +37 -0
- package/dist/packages/_es/Range.js +350 -0
- package/dist/packages/_es/Rate.js +129 -0
- package/dist/packages/_es/Row.js +61 -0
- package/dist/packages/_es/ShortPassword.js +221 -0
- package/dist/packages/_es/Signature.js +167 -0
- package/dist/packages/_es/Step.js +116 -0
- package/dist/packages/_es/Steps.js +52 -0
- package/dist/packages/_es/Swipe.js +193 -0
- package/dist/packages/_es/Swiper.js +429 -0
- package/dist/packages/_es/SwiperItem.js +60 -0
- package/dist/packages/_es/Switch.js +90 -0
- package/dist/packages/_es/Tab.js +179 -0
- package/dist/packages/_es/TabPane.js +42 -0
- package/dist/packages/_es/TabPanel.js +30 -0
- package/dist/packages/_es/Tabbar.js +73 -0
- package/dist/packages/_es/TabbarItem.js +142 -0
- package/dist/packages/_es/Tag.js +98 -0
- package/dist/packages/_es/TextArea.js +127 -0
- package/dist/packages/_es/Toast.js +317 -0
- package/dist/packages/_es/Uploader.js +400 -0
- package/dist/packages/_es/Video.js +405 -0
- package/dist/packages/_es/component.js +26 -0
- package/dist/packages/_es/index.js +64 -0
- package/dist/packages/_es/index2.js +13 -0
- package/dist/packages/_es/plugin-vue_export-helper.js +12 -0
- package/dist/packages/_es/pxCheck.js +9 -0
- package/dist/packages/_es/raf.js +19 -0
- package/dist/packages/avatar/index.scss +0 -1
- package/dist/packages/badge/index.scss +35 -0
- package/dist/packages/calendar/index.scss +13 -0
- package/dist/packages/imagepreview/index.scss +48 -0
- package/dist/packages/input/index.scss +14 -7
- package/dist/packages/pagination/index.scss +51 -0
- package/dist/packages/popover/index.scss +159 -0
- package/dist/packages/shortpassword/index.scss +19 -7
- package/dist/packages/tabpane/index.scss +1 -0
- package/dist/packages/tabs/index.scss +1 -0
- package/dist/packages/tag/index.scss +47 -0
- package/dist/packages/uploader/index.scss +0 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +2 -1
- package/dist/styles/themes/default.scss +35 -28
- package/dist/styles/variables.scss +55 -32
- package/package.json +7 -7
|
@@ -0,0 +1,350 @@
|
|
|
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 { unref, ref, computed, toRefs, openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, normalizeStyle, normalizeClass, withModifiers, Fragment, renderList, renderSlot } from "vue";
|
|
26
|
+
import { c as createComponent } from "./component.js";
|
|
27
|
+
import { u as useTouch } from "./index.js";
|
|
28
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
|
+
function isWindow(val) {
|
|
30
|
+
return val === window;
|
|
31
|
+
}
|
|
32
|
+
const useRect = (elementRef) => {
|
|
33
|
+
const element = unref(elementRef);
|
|
34
|
+
if (isWindow(element)) {
|
|
35
|
+
const width = element.innerWidth;
|
|
36
|
+
const height = element.innerHeight;
|
|
37
|
+
return {
|
|
38
|
+
top: 0,
|
|
39
|
+
left: 0,
|
|
40
|
+
right: width,
|
|
41
|
+
bottom: height,
|
|
42
|
+
width,
|
|
43
|
+
height
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (element && element.getBoundingClientRect) {
|
|
47
|
+
return element.getBoundingClientRect();
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
top: 0,
|
|
51
|
+
left: 0,
|
|
52
|
+
right: 0,
|
|
53
|
+
bottom: 0,
|
|
54
|
+
width: 0,
|
|
55
|
+
height: 0
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const { componentName, create } = createComponent("range");
|
|
59
|
+
const _sfc_main = create({
|
|
60
|
+
props: {
|
|
61
|
+
range: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
disabled: Boolean,
|
|
66
|
+
activeColor: String,
|
|
67
|
+
inactiveColor: String,
|
|
68
|
+
buttonColor: String,
|
|
69
|
+
hiddenRange: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
hiddenTag: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
min: {
|
|
78
|
+
type: [Number, String],
|
|
79
|
+
default: 0
|
|
80
|
+
},
|
|
81
|
+
max: {
|
|
82
|
+
type: [Number, String],
|
|
83
|
+
default: 100
|
|
84
|
+
},
|
|
85
|
+
step: {
|
|
86
|
+
type: [Number, String],
|
|
87
|
+
default: 1
|
|
88
|
+
},
|
|
89
|
+
modelValue: {
|
|
90
|
+
type: [Number, Array],
|
|
91
|
+
default: 0
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
emits: ["change", "drag-end", "drag-start", "update:modelValue"],
|
|
95
|
+
setup(props, { emit, slots }) {
|
|
96
|
+
const buttonIndex = ref(0);
|
|
97
|
+
let startValue;
|
|
98
|
+
let currentValue;
|
|
99
|
+
const root = ref();
|
|
100
|
+
const dragStatus = ref();
|
|
101
|
+
const touch = useTouch();
|
|
102
|
+
const scope = computed(() => Number(props.max) - Number(props.min));
|
|
103
|
+
const classes = computed(() => {
|
|
104
|
+
const prefixCls = componentName;
|
|
105
|
+
return {
|
|
106
|
+
[prefixCls]: true,
|
|
107
|
+
[`${prefixCls}-disabled`]: props.disabled,
|
|
108
|
+
[`${prefixCls}-show-number`]: !props.hiddenRange
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
const wrapperStyle = computed(() => {
|
|
112
|
+
return {
|
|
113
|
+
background: props.inactiveColor
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
const buttonStyle = computed(() => {
|
|
117
|
+
return {
|
|
118
|
+
borderColor: props.buttonColor
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
const isRange = (val) => !!props.range && Array.isArray(val);
|
|
122
|
+
const calcMainAxis = () => {
|
|
123
|
+
const { modelValue, min } = props;
|
|
124
|
+
if (isRange(modelValue)) {
|
|
125
|
+
return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
|
|
126
|
+
}
|
|
127
|
+
return `${(modelValue - Number(min)) * 100 / scope.value}%`;
|
|
128
|
+
};
|
|
129
|
+
const calcOffset = () => {
|
|
130
|
+
const { modelValue, min } = props;
|
|
131
|
+
if (isRange(modelValue)) {
|
|
132
|
+
return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
|
|
133
|
+
}
|
|
134
|
+
return `0%`;
|
|
135
|
+
};
|
|
136
|
+
const barStyle = computed(() => {
|
|
137
|
+
return {
|
|
138
|
+
width: calcMainAxis(),
|
|
139
|
+
left: calcOffset(),
|
|
140
|
+
background: props.activeColor,
|
|
141
|
+
transition: dragStatus.value ? "none" : void 0
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
const format = (value) => {
|
|
145
|
+
const { min, max, step } = props;
|
|
146
|
+
value = Math.max(+min, Math.min(value, +max));
|
|
147
|
+
return Math.round(value / +step) * +step;
|
|
148
|
+
};
|
|
149
|
+
const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
|
|
150
|
+
const handleOverlap = (value) => {
|
|
151
|
+
if (value[0] > value[1]) {
|
|
152
|
+
return value.slice(0).reverse();
|
|
153
|
+
}
|
|
154
|
+
return value;
|
|
155
|
+
};
|
|
156
|
+
const updateValue = (value, end) => {
|
|
157
|
+
if (isRange(value)) {
|
|
158
|
+
value = handleOverlap(value).map(format);
|
|
159
|
+
} else {
|
|
160
|
+
value = format(value);
|
|
161
|
+
}
|
|
162
|
+
if (!isSameValue(value, props.modelValue)) {
|
|
163
|
+
emit("update:modelValue", value);
|
|
164
|
+
}
|
|
165
|
+
if (end && !isSameValue(value, startValue)) {
|
|
166
|
+
emit("change", value);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const onClick = (event) => {
|
|
170
|
+
if (props.disabled) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const { min, modelValue } = props;
|
|
174
|
+
const rect = useRect(root);
|
|
175
|
+
const delta = event.clientX - rect.left;
|
|
176
|
+
const total = rect.width;
|
|
177
|
+
const value = Number(min) + delta / total * scope.value;
|
|
178
|
+
if (isRange(modelValue)) {
|
|
179
|
+
const [left, right] = modelValue;
|
|
180
|
+
const middle = (left + right) / 2;
|
|
181
|
+
if (value <= middle) {
|
|
182
|
+
updateValue([value, right], true);
|
|
183
|
+
} else {
|
|
184
|
+
updateValue([left, value], true);
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
updateValue(value, true);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const onTouchStart = (event) => {
|
|
191
|
+
if (props.disabled) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
touch.start(event);
|
|
195
|
+
currentValue = props.modelValue;
|
|
196
|
+
if (isRange(currentValue)) {
|
|
197
|
+
startValue = currentValue.map(format);
|
|
198
|
+
} else {
|
|
199
|
+
startValue = format(currentValue);
|
|
200
|
+
}
|
|
201
|
+
dragStatus.value = "start";
|
|
202
|
+
};
|
|
203
|
+
const onTouchMove = (event) => {
|
|
204
|
+
if (props.disabled) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (dragStatus.value === "start") {
|
|
208
|
+
emit("drag-start");
|
|
209
|
+
}
|
|
210
|
+
touch.move(event);
|
|
211
|
+
dragStatus.value = "draging";
|
|
212
|
+
const rect = useRect(root);
|
|
213
|
+
const delta = touch.deltaX.value;
|
|
214
|
+
const total = rect.width;
|
|
215
|
+
const diff = delta / total * scope.value;
|
|
216
|
+
if (isRange(startValue)) {
|
|
217
|
+
currentValue[buttonIndex.value] = startValue[buttonIndex.value] + diff;
|
|
218
|
+
} else {
|
|
219
|
+
currentValue = startValue + diff;
|
|
220
|
+
}
|
|
221
|
+
updateValue(currentValue);
|
|
222
|
+
event.stopPropagation();
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
};
|
|
225
|
+
const onTouchEnd = () => {
|
|
226
|
+
if (props.disabled) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (dragStatus.value === "draging") {
|
|
230
|
+
updateValue(currentValue, true);
|
|
231
|
+
emit("drag-end");
|
|
232
|
+
}
|
|
233
|
+
dragStatus.value = "";
|
|
234
|
+
};
|
|
235
|
+
const curValue = (idx) => {
|
|
236
|
+
const value = typeof idx === "number" ? props.modelValue[idx] : props.modelValue;
|
|
237
|
+
return value;
|
|
238
|
+
};
|
|
239
|
+
return __spreadProps(__spreadValues({
|
|
240
|
+
root,
|
|
241
|
+
classes,
|
|
242
|
+
wrapperStyle,
|
|
243
|
+
buttonStyle,
|
|
244
|
+
onClick,
|
|
245
|
+
onTouchStart,
|
|
246
|
+
onTouchMove,
|
|
247
|
+
onTouchEnd
|
|
248
|
+
}, toRefs(props)), {
|
|
249
|
+
barStyle,
|
|
250
|
+
curValue,
|
|
251
|
+
buttonIndex
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
const _hoisted_1 = { class: "nut-range-container" };
|
|
256
|
+
const _hoisted_2 = {
|
|
257
|
+
key: 0,
|
|
258
|
+
class: "min"
|
|
259
|
+
};
|
|
260
|
+
const _hoisted_3 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"];
|
|
261
|
+
const _hoisted_4 = {
|
|
262
|
+
key: 0,
|
|
263
|
+
class: "number"
|
|
264
|
+
};
|
|
265
|
+
const _hoisted_5 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"];
|
|
266
|
+
const _hoisted_6 = {
|
|
267
|
+
key: 0,
|
|
268
|
+
class: "number"
|
|
269
|
+
};
|
|
270
|
+
const _hoisted_7 = {
|
|
271
|
+
key: 1,
|
|
272
|
+
class: "max"
|
|
273
|
+
};
|
|
274
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
275
|
+
return openBlock(), createElementBlock("view", _hoisted_1, [
|
|
276
|
+
!_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(+_ctx.min), 1)) : createCommentVNode("", true),
|
|
277
|
+
createElementVNode("view", {
|
|
278
|
+
ref: "root",
|
|
279
|
+
style: normalizeStyle(_ctx.wrapperStyle),
|
|
280
|
+
class: normalizeClass(_ctx.classes),
|
|
281
|
+
onClick: _cache[9] || (_cache[9] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"]))
|
|
282
|
+
}, [
|
|
283
|
+
createElementVNode("view", {
|
|
284
|
+
class: "nut-range-bar",
|
|
285
|
+
style: normalizeStyle(_ctx.barStyle)
|
|
286
|
+
}, [
|
|
287
|
+
_ctx.range ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList([0, 1], (index2) => {
|
|
288
|
+
return createElementVNode("view", {
|
|
289
|
+
key: index2,
|
|
290
|
+
role: "slider",
|
|
291
|
+
class: normalizeClass({
|
|
292
|
+
"nut-range-button-wrapper-left": index2 == 0,
|
|
293
|
+
"nut-range-button-wrapper-right": index2 == 1
|
|
294
|
+
}),
|
|
295
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
296
|
+
"aria-valuemin": +_ctx.min,
|
|
297
|
+
"aria-valuenow": _ctx.curValue(index2),
|
|
298
|
+
"aria-valuemax": +_ctx.max,
|
|
299
|
+
"aria-orientation": "horizontal",
|
|
300
|
+
onTouchstart: withModifiers((e) => {
|
|
301
|
+
if (typeof index2 === "number") {
|
|
302
|
+
_ctx.buttonIndex = index2;
|
|
303
|
+
}
|
|
304
|
+
_ctx.onTouchStart(e);
|
|
305
|
+
}, ["stop", "prevent"]),
|
|
306
|
+
onTouchmove: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args), ["stop", "prevent"])),
|
|
307
|
+
onTouchend: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
|
|
308
|
+
onTouchcancel: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
|
|
309
|
+
onClick: _cache[3] || (_cache[3] = (e) => e.stopPropagation())
|
|
310
|
+
}, [
|
|
311
|
+
_ctx.$slots.button ? renderSlot(_ctx.$slots, "button", { key: 0 }) : (openBlock(), createElementBlock("view", {
|
|
312
|
+
key: 1,
|
|
313
|
+
class: "nut-range-button",
|
|
314
|
+
style: normalizeStyle(_ctx.buttonStyle)
|
|
315
|
+
}, [
|
|
316
|
+
!_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_4, toDisplayString(_ctx.curValue(index2)), 1)) : createCommentVNode("", true)
|
|
317
|
+
], 4))
|
|
318
|
+
], 42, _hoisted_3);
|
|
319
|
+
}), 64)) : (openBlock(), createElementBlock("view", {
|
|
320
|
+
key: 1,
|
|
321
|
+
role: "slider",
|
|
322
|
+
class: "nut-range-button-wrapper",
|
|
323
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
324
|
+
"aria-valuemin": +_ctx.min,
|
|
325
|
+
"aria-valuenow": _ctx.curValue(),
|
|
326
|
+
"aria-valuemax": +_ctx.max,
|
|
327
|
+
"aria-orientation": "horizontal",
|
|
328
|
+
onTouchstart: _cache[4] || (_cache[4] = withModifiers((e) => {
|
|
329
|
+
_ctx.onTouchStart(e);
|
|
330
|
+
}, ["stop", "prevent"])),
|
|
331
|
+
onTouchmove: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args), ["stop", "prevent"])),
|
|
332
|
+
onTouchend: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
|
|
333
|
+
onTouchcancel: _cache[7] || (_cache[7] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
|
|
334
|
+
onClick: _cache[8] || (_cache[8] = (e) => e.stopPropagation())
|
|
335
|
+
}, [
|
|
336
|
+
_ctx.$slots.button ? renderSlot(_ctx.$slots, "button", { key: 0 }) : (openBlock(), createElementBlock("view", {
|
|
337
|
+
key: 1,
|
|
338
|
+
class: "nut-range-button",
|
|
339
|
+
style: normalizeStyle(_ctx.buttonStyle)
|
|
340
|
+
}, [
|
|
341
|
+
!_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_6, toDisplayString(_ctx.curValue(_ctx.index)), 1)) : createCommentVNode("", true)
|
|
342
|
+
], 4))
|
|
343
|
+
], 40, _hoisted_5))
|
|
344
|
+
], 4)
|
|
345
|
+
], 6),
|
|
346
|
+
!_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(+_ctx.max), 1)) : createCommentVNode("", true)
|
|
347
|
+
]);
|
|
348
|
+
}
|
|
349
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
350
|
+
export { index as default };
|
|
@@ -0,0 +1,129 @@
|
|
|
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, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, normalizeStyle, createVNode, createBlock, createCommentVNode } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
|
+
const { componentName, create } = createComponent("rate");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
count: {
|
|
14
|
+
type: [String, Number],
|
|
15
|
+
default: 5
|
|
16
|
+
},
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: [String, Number],
|
|
19
|
+
default: 0
|
|
20
|
+
},
|
|
21
|
+
iconSize: {
|
|
22
|
+
type: [String, Number],
|
|
23
|
+
default: 18
|
|
24
|
+
},
|
|
25
|
+
activeColor: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
voidColor: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
},
|
|
33
|
+
uncheckedIcon: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "star-n"
|
|
36
|
+
},
|
|
37
|
+
checkedIcon: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "star-fill-n"
|
|
40
|
+
},
|
|
41
|
+
readonly: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
allowHalf: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
spacing: {
|
|
54
|
+
type: [String, Number],
|
|
55
|
+
default: 14
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
emits: ["update:modelValue", "change"],
|
|
59
|
+
setup(props, { emit }) {
|
|
60
|
+
const classes = computed(() => {
|
|
61
|
+
const prefixCls = componentName;
|
|
62
|
+
return {
|
|
63
|
+
[prefixCls]: true
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
const onClick = (e, index2) => {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
if (props.disabled || props.readonly)
|
|
70
|
+
return;
|
|
71
|
+
let value = 0;
|
|
72
|
+
if (index2 === 1 && props.modelValue === index2)
|
|
73
|
+
;
|
|
74
|
+
else {
|
|
75
|
+
value = index2;
|
|
76
|
+
if (props.allowHalf) {
|
|
77
|
+
if ((e == null ? void 0 : e.target).className.includes("__icon--half")) {
|
|
78
|
+
value -= 0.5;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
emit("update:modelValue", value);
|
|
83
|
+
emit("change", value);
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
classes,
|
|
87
|
+
onClick,
|
|
88
|
+
pxCheck
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
const _hoisted_1 = ["onClick"];
|
|
93
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
94
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
95
|
+
return openBlock(), createElementBlock("view", {
|
|
96
|
+
class: normalizeClass(_ctx.classes)
|
|
97
|
+
}, [
|
|
98
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.count, (n) => {
|
|
99
|
+
return openBlock(), createElementBlock("view", {
|
|
100
|
+
class: "nut-rate-item",
|
|
101
|
+
key: n,
|
|
102
|
+
onClick: ($event) => _ctx.onClick($event, n),
|
|
103
|
+
style: normalizeStyle({ marginRight: _ctx.pxCheck(_ctx.spacing) })
|
|
104
|
+
}, [
|
|
105
|
+
createVNode(_component_nut_icon, {
|
|
106
|
+
size: _ctx.iconSize,
|
|
107
|
+
class: normalizeClass(["nut-rate-item__icon", { "nut-rate-item__icon--disabled": _ctx.disabled || n > _ctx.modelValue }]),
|
|
108
|
+
color: n <= _ctx.modelValue ? _ctx.activeColor : _ctx.voidColor,
|
|
109
|
+
name: n <= _ctx.modelValue ? _ctx.checkedIcon : _ctx.uncheckedIcon
|
|
110
|
+
}, null, 8, ["size", "class", "color", "name"]),
|
|
111
|
+
_ctx.allowHalf && _ctx.modelValue + 1 > n ? (openBlock(), createBlock(_component_nut_icon, {
|
|
112
|
+
key: 0,
|
|
113
|
+
class: "nut-rate-item__icon nut-rate-item__icon--half",
|
|
114
|
+
color: n <= _ctx.modelValue ? _ctx.activeColor : _ctx.voidColor,
|
|
115
|
+
size: _ctx.iconSize,
|
|
116
|
+
name: _ctx.checkedIcon
|
|
117
|
+
}, null, 8, ["color", "size", "name"])) : _ctx.allowHalf && _ctx.modelValue + 1 < n ? (openBlock(), createBlock(_component_nut_icon, {
|
|
118
|
+
key: 1,
|
|
119
|
+
class: "nut-rate-item__icon nut-rate-item__icon--disabled nut-rate-item__icon--half",
|
|
120
|
+
color: _ctx.voidColor,
|
|
121
|
+
size: _ctx.iconSize,
|
|
122
|
+
name: _ctx.uncheckedIcon
|
|
123
|
+
}, null, 8, ["color", "size", "name"])) : createCommentVNode("", true)
|
|
124
|
+
], 12, _hoisted_1);
|
|
125
|
+
}), 128))
|
|
126
|
+
], 2);
|
|
127
|
+
}
|
|
128
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
129
|
+
export { index as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
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, openBlock, createElementBlock, normalizeClass, renderSlot } 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("row");
|
|
10
|
+
const _sfc_main = create({
|
|
11
|
+
props: {
|
|
12
|
+
type: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ""
|
|
15
|
+
},
|
|
16
|
+
gutter: {
|
|
17
|
+
type: [String, Number],
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
justify: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "start"
|
|
23
|
+
},
|
|
24
|
+
align: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "flex-start"
|
|
27
|
+
},
|
|
28
|
+
wrap: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "nowrap"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
setup(props) {
|
|
34
|
+
const prefixCls = componentName;
|
|
35
|
+
provide("gutter", props.gutter);
|
|
36
|
+
const getClass = (prefix, type) => {
|
|
37
|
+
return prefix ? type ? `nut-row-${prefix}-${type}` : "" : `nut-row-${type}`;
|
|
38
|
+
};
|
|
39
|
+
const getClasses = () => {
|
|
40
|
+
return `
|
|
41
|
+
${getClass("", props.type)}
|
|
42
|
+
${getClass("justify", props.justify)}
|
|
43
|
+
${getClass("align", props.align)}
|
|
44
|
+
${getClass("flex", props.wrap)}
|
|
45
|
+
${prefixCls}
|
|
46
|
+
`;
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
getClasses
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
54
|
+
return openBlock(), createElementBlock("view", {
|
|
55
|
+
class: normalizeClass(_ctx.getClasses())
|
|
56
|
+
}, [
|
|
57
|
+
renderSlot(_ctx.$slots, "default")
|
|
58
|
+
], 2);
|
|
59
|
+
}
|
|
60
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
61
|
+
export { index as default };
|