@nutui/nutui 3.1.12-beta.0 → 3.1.12-beta.1
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.d.ts +4 -1
- package/dist/nutui.es.js +3943 -4130
- package/dist/nutui.umd.js +3947 -4201
- package/dist/packages/_es/ActionSheet.js +13 -12
- package/dist/packages/_es/Address.js +63 -49
- package/dist/packages/_es/Avatar.js +4 -5
- package/dist/packages/_es/BackTop.js +72 -109
- package/dist/packages/_es/Badge.js +4 -5
- package/dist/packages/_es/Barrage.js +63 -57
- package/dist/packages/_es/Button.js +5 -6
- package/dist/packages/_es/Calendar.js +27 -18
- package/dist/packages/_es/Card.js +104 -0
- package/dist/packages/_es/Cell.js +5 -13
- package/dist/packages/_es/CellGroup.js +4 -5
- package/dist/packages/_es/Checkbox.js +3 -3
- package/dist/packages/_es/CheckboxGroup.js +9 -4
- package/dist/packages/_es/CircleProgress.js +142 -46
- package/dist/packages/_es/Col.js +4 -5
- package/dist/packages/_es/Collapse.js +35 -10
- package/dist/packages/_es/CollapseItem.js +80 -35
- package/dist/packages/_es/CountDown.js +7 -5
- package/dist/packages/_es/CountUp.js +34 -31
- package/dist/packages/_es/DatePicker.js +451 -219
- package/dist/packages/_es/Dialog.js +24 -89
- package/dist/packages/_es/Divider.js +5 -6
- package/dist/packages/_es/Drag.js +76 -50
- package/dist/packages/_es/Elevator.js +81 -52
- package/dist/packages/_es/FixedNav.js +8 -9
- package/dist/packages/_es/Form.js +137 -0
- package/dist/packages/_es/FormItem.js +109 -0
- package/dist/packages/_es/Icon.js +6 -40
- package/dist/packages/_es/ImagePreview.js +23 -21
- package/dist/packages/_es/InfiniteLoading.js +95 -109
- package/dist/packages/_es/Input.js +22 -21
- package/dist/packages/_es/InputNumber.js +24 -18
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/Menu.js +16 -14
- package/dist/packages/_es/MenuItem.js +9 -11
- package/dist/packages/_es/Navbar.js +7 -7
- package/dist/packages/_es/NoticeBar.js +39 -26
- package/dist/packages/_es/Notify.js +30 -166
- package/dist/packages/_es/NumberKeyboard.js +10 -6
- package/dist/packages/_es/OverLay.js +22 -29
- package/dist/packages/_es/Pagination.js +8 -9
- package/dist/packages/_es/Picker.js +61 -447
- package/dist/packages/_es/Popover.js +146 -25
- package/dist/packages/_es/Popup.js +17 -77
- package/dist/packages/_es/Price.js +18 -7
- package/dist/packages/_es/Progress.js +23 -12
- package/dist/packages/_es/Radio.js +3 -3
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +37 -30
- package/dist/packages/_es/Rate.js +16 -20
- package/dist/packages/_es/Row.js +4 -5
- package/dist/packages/_es/SearchBar.js +7 -5
- package/dist/packages/_es/ShortPassword.js +89 -59
- package/dist/packages/_es/Signature.js +70 -71
- package/dist/packages/_es/Sku.js +54 -79
- package/dist/packages/_es/Step.js +10 -8
- package/dist/packages/_es/Steps.js +2 -2
- package/dist/packages/_es/Swipe.js +42 -27
- package/dist/packages/_es/Swiper.js +17 -418
- package/dist/packages/_es/SwiperItem.js +14 -39
- package/dist/packages/_es/Switch.js +4 -5
- package/dist/packages/_es/TabPane.js +4 -5
- package/dist/packages/_es/Tabbar.js +4 -5
- package/dist/packages/_es/TabbarItem.js +8 -9
- package/dist/packages/_es/Tabs.js +22 -16
- package/dist/packages/_es/Tag.js +5 -6
- package/dist/packages/_es/TextArea.js +16 -12
- package/dist/packages/_es/TimeDetail.js +7 -5
- package/dist/packages/_es/TimePannel.js +7 -5
- package/dist/packages/_es/TimeSelect.js +12 -7
- package/dist/packages/_es/Toast.js +41 -163
- package/dist/packages/_es/Uploader.js +109 -149
- package/dist/packages/_es/commonProps.js +30 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +1 -1
- package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
- package/dist/packages/_es/index2.js +40 -27
- package/dist/packages/_es/index3.js +413 -7
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +47 -0
- package/dist/packages/button/index.scss +6 -0
- package/dist/packages/card/index.scss +97 -0
- package/dist/packages/checkbox/index.scss +1 -1
- package/dist/packages/form/index.scss +2 -0
- package/dist/packages/formitem/index.scss +60 -0
- package/dist/packages/numberkeyboard/index.scss +1 -1
- package/dist/packages/switch/index.scss +1 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -2
- package/dist/styles/themes/default.scss +35 -32
- package/dist/styles/variables.scss +11 -1
- package/package.json +2 -2
- package/dist/packages/_es/Video.js +0 -405
- package/dist/packages/_es/plugin-vue_export-helper.js +0 -13
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,470 +14,86 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
var
|
|
17
|
+
var __require = typeof require !== "undefined" ? require : (x) => {
|
|
18
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
19
|
+
};
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
|
-
import { ref,
|
|
25
|
+
import { ref, onUpdated, watch, resolveComponent, openBlock, createBlock, withCtx, renderSlot } from "vue";
|
|
26
26
|
import { c as createComponent } from "./component.js";
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
import "./OverLay.js";
|
|
31
|
-
import "./Icon.js";
|
|
32
|
-
import "./pxCheck.js";
|
|
33
|
-
const commonProps = {
|
|
34
|
-
listData: {
|
|
35
|
-
type: Array,
|
|
36
|
-
default: () => {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
readonly: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: false
|
|
43
|
-
},
|
|
44
|
-
visibleItemCount: {
|
|
45
|
-
type: [Number, String],
|
|
46
|
-
default: 7
|
|
47
|
-
},
|
|
48
|
-
defaultIndex: {
|
|
49
|
-
type: [Number, String],
|
|
50
|
-
default: 0
|
|
51
|
-
},
|
|
52
|
-
itemHeight: {
|
|
53
|
-
type: [Number, String],
|
|
54
|
-
default: 35
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const MOMENTUM_LIMIT_DISTANCE = 15;
|
|
58
|
-
const MOMENTUM_LIMIT_TIME = 300;
|
|
59
|
-
const DEFAULT_DURATION = 200;
|
|
60
|
-
const { create: create$1 } = createComponent("picker-column");
|
|
61
|
-
function range(num, min, max) {
|
|
62
|
-
return Math.min(Math.max(num, min), max);
|
|
63
|
-
}
|
|
64
|
-
function stopPropagation(event) {
|
|
65
|
-
event.stopPropagation();
|
|
66
|
-
}
|
|
67
|
-
function preventDefault(event, isStopPropagation) {
|
|
68
|
-
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
69
|
-
event.preventDefault();
|
|
70
|
-
}
|
|
71
|
-
if (isStopPropagation) {
|
|
72
|
-
stopPropagation(event);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function getElementTranslateY(element) {
|
|
76
|
-
const style = window.getComputedStyle(element);
|
|
77
|
-
const transform = style.transform || style.webkitTransform;
|
|
78
|
-
const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
|
|
79
|
-
return Number(translateY);
|
|
80
|
-
}
|
|
81
|
-
function isObject(val) {
|
|
82
|
-
return val !== null && typeof val === "object";
|
|
83
|
-
}
|
|
84
|
-
function isOptionDisabled(option) {
|
|
85
|
-
return isObject(option) && option.disabled;
|
|
86
|
-
}
|
|
87
|
-
const _sfc_main$1 = create$1({
|
|
27
|
+
import { c as commonProps } from "./commonProps.js";
|
|
28
|
+
const { create } = createComponent("picker");
|
|
29
|
+
var _sfc_main = create({
|
|
88
30
|
props: __spreadValues({
|
|
89
|
-
|
|
90
|
-
}, commonProps),
|
|
91
|
-
emits: ["click", "change"],
|
|
92
|
-
setup(props, { emit }) {
|
|
93
|
-
const wrapper = ref();
|
|
94
|
-
const state = reactive({
|
|
95
|
-
index: props.defaultIndex,
|
|
96
|
-
offset: 0,
|
|
97
|
-
duration: 0,
|
|
98
|
-
options: props.listData,
|
|
99
|
-
moving: false,
|
|
100
|
-
startOffset: 0,
|
|
101
|
-
touchStartTime: 0,
|
|
102
|
-
momentumOffset: 0,
|
|
103
|
-
transitionEndTrigger: null
|
|
104
|
-
});
|
|
105
|
-
const touch = useTouch();
|
|
106
|
-
const wrapperStyle = computed(() => ({
|
|
107
|
-
transform: `translate3d(0, ${state.offset + baseOffset()}px, 0)`,
|
|
108
|
-
transitionDuration: `${state.duration}ms`,
|
|
109
|
-
transitionProperty: state.duration ? "all" : "none"
|
|
110
|
-
}));
|
|
111
|
-
const getIndexByOffset = (offset) => {
|
|
112
|
-
return range(Math.round(-offset / +props.itemHeight), 0, state.options.length - 1);
|
|
113
|
-
};
|
|
114
|
-
const baseOffset = () => {
|
|
115
|
-
return +props.itemHeight * (+props.visibleItemCount - 1) / 2;
|
|
116
|
-
};
|
|
117
|
-
const stopMomentum = () => {
|
|
118
|
-
state.moving = false;
|
|
119
|
-
state.duration = 0;
|
|
120
|
-
if (state.transitionEndTrigger) {
|
|
121
|
-
state.transitionEndTrigger();
|
|
122
|
-
state.transitionEndTrigger = null;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const adjustIndex = (index) => {
|
|
126
|
-
index = range(index, 0, state.options.length);
|
|
127
|
-
for (let i = index; i < state.options.length; i++) {
|
|
128
|
-
if (!isOptionDisabled(state.options[i]))
|
|
129
|
-
return i;
|
|
130
|
-
}
|
|
131
|
-
for (let i = index - 1; i >= 0; i--) {
|
|
132
|
-
if (!isOptionDisabled(state.options[i]))
|
|
133
|
-
return i;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const setIndex = (index, emitChange = false) => {
|
|
137
|
-
index = adjustIndex(index) || 0;
|
|
138
|
-
const offset = -index * +props.itemHeight;
|
|
139
|
-
const trigger = () => {
|
|
140
|
-
if (index !== state.index) {
|
|
141
|
-
state.index = index;
|
|
142
|
-
if (emitChange) {
|
|
143
|
-
emit("change", index);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
if (state.moving && offset !== state.offset) {
|
|
148
|
-
state.transitionEndTrigger = trigger;
|
|
149
|
-
} else {
|
|
150
|
-
trigger();
|
|
151
|
-
}
|
|
152
|
-
state.offset = offset;
|
|
153
|
-
};
|
|
154
|
-
const momentum = (distance, duration) => {
|
|
155
|
-
const speed = Math.abs(distance / duration);
|
|
156
|
-
distance = state.offset + speed / 0.03 * (distance < 0 ? -1 : 1);
|
|
157
|
-
const index = getIndexByOffset(distance);
|
|
158
|
-
setIndex(index, true);
|
|
159
|
-
};
|
|
160
|
-
const onTouchStart = (event) => {
|
|
161
|
-
if (props.readonly) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
touch.start(event);
|
|
165
|
-
if (state.moving) {
|
|
166
|
-
const translateY = getElementTranslateY(wrapper.value);
|
|
167
|
-
state.offset = Math.min(0, translateY - baseOffset());
|
|
168
|
-
state.startOffset = state.offset;
|
|
169
|
-
} else {
|
|
170
|
-
state.startOffset = state.offset;
|
|
171
|
-
}
|
|
172
|
-
state.duration = 0;
|
|
173
|
-
state.touchStartTime = Date.now();
|
|
174
|
-
state.momentumOffset = state.startOffset;
|
|
175
|
-
state.transitionEndTrigger = null;
|
|
176
|
-
};
|
|
177
|
-
const onTouchMove = (event) => {
|
|
178
|
-
if (props.readonly) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
state.moving = true;
|
|
182
|
-
touch.move(event);
|
|
183
|
-
if (touch.isVertical()) {
|
|
184
|
-
state.moving = true;
|
|
185
|
-
preventDefault(event, true);
|
|
186
|
-
}
|
|
187
|
-
const moveOffset = state.startOffset + touch.deltaY.value;
|
|
188
|
-
if (moveOffset > props.itemHeight) {
|
|
189
|
-
state.offset = props.itemHeight;
|
|
190
|
-
} else {
|
|
191
|
-
state.offset = state.startOffset + touch.deltaY.value;
|
|
192
|
-
}
|
|
193
|
-
const now = Date.now();
|
|
194
|
-
if (now - state.touchStartTime > MOMENTUM_LIMIT_TIME) {
|
|
195
|
-
state.touchStartTime = now;
|
|
196
|
-
state.momentumOffset = state.offset;
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
const onTouchEnd = () => {
|
|
200
|
-
const index = getIndexByOffset(state.offset);
|
|
201
|
-
state.duration = DEFAULT_DURATION;
|
|
202
|
-
setIndex(index, true);
|
|
203
|
-
const distance = state.offset - state.momentumOffset;
|
|
204
|
-
const duration = Date.now() - state.touchStartTime;
|
|
205
|
-
const allowMomentum = duration < MOMENTUM_LIMIT_TIME && Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
|
|
206
|
-
if (allowMomentum) {
|
|
207
|
-
momentum(distance, duration);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
onMounted(() => {
|
|
212
|
-
setIndex(+props.defaultIndex);
|
|
213
|
-
});
|
|
214
|
-
watch(() => props.listData, (val) => {
|
|
215
|
-
if (val) {
|
|
216
|
-
state.options = val;
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
watch(() => props.defaultIndex, (val) => {
|
|
220
|
-
setIndex(+val);
|
|
221
|
-
});
|
|
222
|
-
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
223
|
-
wrapper,
|
|
224
|
-
onTouchStart,
|
|
225
|
-
onTouchMove,
|
|
226
|
-
onTouchEnd,
|
|
227
|
-
wrapperStyle,
|
|
228
|
-
stopMomentum,
|
|
229
|
-
columns: state.options,
|
|
230
|
-
height: Number(props.visibleItemCount) * +props.itemHeight
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
235
|
-
return openBlock(), createElementBlock("view", {
|
|
236
|
-
class: "nut-picker__content",
|
|
237
|
-
style: normalizeStyle({ height: _ctx.height + "px" }),
|
|
238
|
-
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
|
239
|
-
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
|
|
240
|
-
onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
|
241
|
-
onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
|
242
|
-
onTransitionend: _cache[4] || (_cache[4] = (...args) => _ctx.stopMomentum && _ctx.stopMomentum(...args))
|
|
243
|
-
}, [
|
|
244
|
-
createElementVNode("view", {
|
|
245
|
-
class: "nut-picker__wrapper",
|
|
246
|
-
ref: "wrapper",
|
|
247
|
-
style: normalizeStyle(_ctx.wrapperStyle)
|
|
248
|
-
}, [
|
|
249
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
|
|
250
|
-
return openBlock(), createElementBlock("view", {
|
|
251
|
-
class: "nut-picker__item",
|
|
252
|
-
key: index
|
|
253
|
-
}, toDisplayString(_ctx.dataType === "cascade" ? item.text : item), 1);
|
|
254
|
-
}), 128))
|
|
255
|
-
], 4)
|
|
256
|
-
], 36);
|
|
257
|
-
}
|
|
258
|
-
var column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
259
|
-
const { create, componentName } = createComponent("picker");
|
|
260
|
-
const _sfc_main = create({
|
|
261
|
-
components: {
|
|
262
|
-
[column.name]: column,
|
|
263
|
-
[Popup.name]: Popup
|
|
264
|
-
},
|
|
265
|
-
props: __spreadValues(__spreadProps(__spreadValues({}, popupProps), {
|
|
266
|
-
title: {
|
|
267
|
-
type: String,
|
|
268
|
-
default: ""
|
|
269
|
-
},
|
|
270
|
-
cancelText: {
|
|
31
|
+
mode: {
|
|
271
32
|
type: String,
|
|
272
|
-
default: "
|
|
273
|
-
},
|
|
274
|
-
okText: {
|
|
275
|
-
type: String,
|
|
276
|
-
default: "\u786E\u5B9A"
|
|
33
|
+
default: "selector"
|
|
277
34
|
}
|
|
278
|
-
}
|
|
279
|
-
emits: ["
|
|
35
|
+
}, commonProps),
|
|
36
|
+
emits: ["confirm"],
|
|
280
37
|
setup(props, { emit }) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
formattedColumns: props.listData,
|
|
286
|
-
defaultIndex: props.defaultIndex
|
|
287
|
-
});
|
|
288
|
-
let _defaultIndex = props.defaultIndex;
|
|
289
|
-
let defaultIndexList = [];
|
|
290
|
-
const classes = computed(() => {
|
|
291
|
-
const prefixCls = componentName;
|
|
292
|
-
return {
|
|
293
|
-
[prefixCls]: true
|
|
294
|
-
};
|
|
295
|
-
});
|
|
296
|
-
const top = computed(() => {
|
|
297
|
-
return Number(+props.visibleItemCount - 1) / 2 * +props.itemHeight;
|
|
38
|
+
let value = ref([]);
|
|
39
|
+
let range = ref([]);
|
|
40
|
+
onUpdated(() => {
|
|
41
|
+
console.log("updated", props.listData);
|
|
298
42
|
});
|
|
299
|
-
const
|
|
300
|
-
return Number(props.visibleItemCount) * +props.itemHeight;
|
|
301
|
-
});
|
|
302
|
-
const dataType = computed(() => {
|
|
303
|
-
const firstColumn = state.formattedColumns[0];
|
|
304
|
-
if (typeof firstColumn === "object") {
|
|
305
|
-
if (firstColumn[childrenKey]) {
|
|
306
|
-
return "cascade";
|
|
307
|
-
} else if (firstColumn == null ? void 0 : firstColumn[valuesKey]) {
|
|
308
|
-
addDefaultIndexList(props.listData);
|
|
309
|
-
return "multipleColumns";
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
return "text";
|
|
313
|
-
});
|
|
314
|
-
const columnList = computed(() => {
|
|
315
|
-
if (dataType.value === "text") {
|
|
316
|
-
return [
|
|
317
|
-
{ values: state.formattedColumns, defaultIndex: state.defaultIndex }
|
|
318
|
-
];
|
|
319
|
-
} else if (dataType.value === "multipleColumns") {
|
|
320
|
-
return state.formattedColumns;
|
|
321
|
-
} else if (dataType.value === "cascade") {
|
|
322
|
-
return formatCascade(state.formattedColumns, state.defaultIndex);
|
|
323
|
-
}
|
|
324
|
-
return state.formattedColumns;
|
|
325
|
-
});
|
|
326
|
-
const addDefaultIndexList = (listData) => {
|
|
327
|
-
defaultIndexList = [];
|
|
328
|
-
listData.forEach((res) => {
|
|
329
|
-
defaultIndexList.push(res.defaultIndex || 0);
|
|
330
|
-
});
|
|
331
|
-
};
|
|
332
|
-
const formatCascade = (listData, defaultIndex) => {
|
|
333
|
-
const formatted = [];
|
|
334
|
-
let children = listData;
|
|
335
|
-
children.defaultIndex = defaultIndex;
|
|
336
|
-
while (children) {
|
|
337
|
-
formatted.push({
|
|
338
|
-
values: children,
|
|
339
|
-
defaultIndex: children.defaultIndex || 0
|
|
340
|
-
});
|
|
341
|
-
children = children == null ? void 0 : children[children.defaultIndex || 0].children;
|
|
342
|
-
}
|
|
343
|
-
addDefaultIndexList(formatted);
|
|
344
|
-
return formatted;
|
|
345
|
-
};
|
|
346
|
-
const getCascadeData = (listData, defaultIndex) => {
|
|
43
|
+
const onChange = (e) => {
|
|
347
44
|
var _a;
|
|
348
|
-
let
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
dataList.push(item.text);
|
|
354
|
-
arr = item.children;
|
|
45
|
+
let ret;
|
|
46
|
+
if (props.mode === "selector") {
|
|
47
|
+
ret = props.listData[e.detail.value];
|
|
48
|
+
} else if (props.mode === "multiSelector") {
|
|
49
|
+
ret = (_a = range.value) == null ? void 0 : _a.map((item, idx) => item[e.detail.value[idx]]).filter((res) => res);
|
|
355
50
|
}
|
|
356
|
-
|
|
357
|
-
};
|
|
358
|
-
const close = () => {
|
|
359
|
-
emit("close");
|
|
360
|
-
emit("update:visible", false);
|
|
51
|
+
emit("confirm", e.detail.value, ret);
|
|
361
52
|
};
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
53
|
+
watch(props.listData, (val) => {
|
|
54
|
+
try {
|
|
55
|
+
if (val.length) {
|
|
56
|
+
value.value = [];
|
|
57
|
+
range.value = [];
|
|
58
|
+
if (props.mode === "selector") {
|
|
59
|
+
range.value = props.listData;
|
|
60
|
+
} else if (props.mode === "multiSelector") {
|
|
61
|
+
val.forEach((item) => {
|
|
62
|
+
value.value.push(item.defaultIndex);
|
|
63
|
+
range.value.push(item.values);
|
|
64
|
+
});
|
|
374
65
|
}
|
|
375
|
-
cursor = cursor[cursor.defaultIndex || 0].children;
|
|
376
|
-
i++;
|
|
377
66
|
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
} else if (dataType.value === "multipleColumns") {
|
|
381
|
-
defaultIndexList[columnIndex] = dataIndex;
|
|
382
|
-
const val = defaultIndexList.map((res, i) => toRaw(state.formattedColumns)[i].values[res]);
|
|
383
|
-
emit("change", val);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.log("listData\u53C2\u6570\u683C\u5F0F\u9519\u8BEF", error);
|
|
384
69
|
}
|
|
70
|
+
}, { immediate: true, deep: true });
|
|
71
|
+
const onColumnChange = (e) => {
|
|
72
|
+
console.log("\u4FEE\u6539\u7684\u5217\u4E3A", e.detail.column, "\uFF0C\u503C\u4E3A", e.detail.value);
|
|
385
73
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
state.formattedColumns[i].defaultIndex = defaultIndexList[i];
|
|
393
|
-
}
|
|
394
|
-
const checkedArr = toRaw(state.formattedColumns).map((res) => res.values && res.values[res.defaultIndex]);
|
|
395
|
-
emit("confirm", checkedArr);
|
|
396
|
-
} else if (dataType.value === "cascade") {
|
|
397
|
-
emit("confirm", getCascadeData(toRaw(state.formattedColumns), state.defaultIndex));
|
|
398
|
-
}
|
|
399
|
-
emit("update:visible", false);
|
|
74
|
+
return {
|
|
75
|
+
confirm,
|
|
76
|
+
onChange,
|
|
77
|
+
value,
|
|
78
|
+
range,
|
|
79
|
+
onColumnChange
|
|
400
80
|
};
|
|
401
|
-
watch(() => props.visible, (val) => {
|
|
402
|
-
state.show = val;
|
|
403
|
-
});
|
|
404
|
-
watch(() => props.listData, (val) => {
|
|
405
|
-
state.formattedColumns = val;
|
|
406
|
-
});
|
|
407
|
-
return __spreadProps(__spreadValues({
|
|
408
|
-
classes
|
|
409
|
-
}, toRefs(state)), {
|
|
410
|
-
column,
|
|
411
|
-
dataType,
|
|
412
|
-
columnList,
|
|
413
|
-
top,
|
|
414
|
-
height,
|
|
415
|
-
close,
|
|
416
|
-
changeHandler,
|
|
417
|
-
confirm
|
|
418
|
-
});
|
|
419
81
|
}
|
|
420
82
|
});
|
|
421
|
-
const _hoisted_1 = { class: "nut-picker__bar" };
|
|
422
|
-
const _hoisted_2 = { class: "nut-picker__column" };
|
|
423
83
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
onClose: _ctx.close
|
|
438
|
-
}, {
|
|
439
|
-
default: withCtx(() => [
|
|
440
|
-
createElementVNode("view", _hoisted_1, [
|
|
441
|
-
createElementVNode("view", {
|
|
442
|
-
class: "nut-picker__left nut-picker__button",
|
|
443
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args))
|
|
444
|
-
}, toDisplayString(_ctx.cancelText), 1),
|
|
445
|
-
createElementVNode("view", null, toDisplayString(_ctx.title), 1),
|
|
446
|
-
createElementVNode("view", {
|
|
447
|
-
class: "nut-picker__button",
|
|
448
|
-
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirm())
|
|
449
|
-
}, toDisplayString(_ctx.okText), 1)
|
|
450
|
-
]),
|
|
451
|
-
createElementVNode("view", _hoisted_2, [
|
|
452
|
-
createElementVNode("view", {
|
|
453
|
-
class: "nut-picker__mask",
|
|
454
|
-
style: normalizeStyle({ backgroundSize: `100% ${_ctx.top}px` })
|
|
455
|
-
}, null, 4),
|
|
456
|
-
createElementVNode("view", {
|
|
457
|
-
class: "nut-picker__hairline",
|
|
458
|
-
style: normalizeStyle({ top: ` ${_ctx.top}px` })
|
|
459
|
-
}, null, 4),
|
|
460
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnList, (item, columnIndex) => {
|
|
461
|
-
return openBlock(), createElementBlock("view", {
|
|
462
|
-
class: "nut-picker__columnitem",
|
|
463
|
-
key: columnIndex
|
|
464
|
-
}, [
|
|
465
|
-
createVNode(_component_nut_picker_column, {
|
|
466
|
-
"list-data": item.values,
|
|
467
|
-
readonly: _ctx.readonly,
|
|
468
|
-
"default-index": item.defaultIndex,
|
|
469
|
-
"visible-item-count": _ctx.visibleItemCount,
|
|
470
|
-
"item-height": _ctx.itemHeight,
|
|
471
|
-
"data-type": _ctx.dataType,
|
|
472
|
-
onChange: (dataIndex) => {
|
|
473
|
-
_ctx.changeHandler(columnIndex, dataIndex);
|
|
474
|
-
}
|
|
475
|
-
}, null, 8, ["list-data", "readonly", "default-index", "visible-item-count", "item-height", "data-type", "onChange"])
|
|
476
|
-
]);
|
|
477
|
-
}), 128))
|
|
478
|
-
])
|
|
479
|
-
]),
|
|
480
|
-
_: 1
|
|
481
|
-
}, 8, ["style", "visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose"])
|
|
482
|
-
], 2);
|
|
84
|
+
const _component_picker = resolveComponent("picker");
|
|
85
|
+
return openBlock(), createBlock(_component_picker, {
|
|
86
|
+
mode: _ctx.mode,
|
|
87
|
+
range: _ctx.range,
|
|
88
|
+
onChange: _ctx.onChange,
|
|
89
|
+
onColumnchange: _ctx.onColumnChange,
|
|
90
|
+
value: _ctx.value
|
|
91
|
+
}, {
|
|
92
|
+
default: withCtx(() => [
|
|
93
|
+
renderSlot(_ctx.$slots, "default")
|
|
94
|
+
]),
|
|
95
|
+
_: 3
|
|
96
|
+
}, 8, ["mode", "range", "onChange", "onColumnchange", "value"]);
|
|
483
97
|
}
|
|
484
|
-
|
|
485
|
-
export {
|
|
98
|
+
_sfc_main.render = _sfc_render;
|
|
99
|
+
export { _sfc_main as default };
|