@nutui/nutui 3.1.18-beta.0 → 3.1.18
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 +41 -0
- package/LICENSE +1 -1
- package/README.md +6 -0
- package/dist/nutui.d.ts +3 -1
- package/dist/nutui.es.js +2230 -1192
- package/dist/nutui.umd.js +2240 -1201
- package/dist/packages/_es/ActionSheet.js +2 -2
- package/dist/packages/_es/Address.js +17 -11
- package/dist/packages/_es/Audio.js +2 -2
- package/dist/packages/_es/Avatar.js +2 -2
- package/dist/packages/_es/BackTop.js +5 -2
- package/dist/packages/_es/Badge.js +2 -2
- package/dist/packages/_es/Barrage.js +2 -2
- package/dist/packages/_es/Button.js +2 -2
- package/dist/packages/_es/Calendar.js +15 -16
- package/dist/packages/_es/Card.js +2 -2
- package/dist/packages/_es/Cascader.js +2 -2
- package/dist/packages/_es/Cell.js +24 -17
- package/dist/packages/_es/CellGroup.js +2 -2
- package/dist/packages/_es/Checkbox.js +4 -4
- package/dist/packages/_es/CheckboxGroup.js +3 -3
- package/dist/packages/_es/CircleProgress.js +2 -2
- package/dist/packages/_es/Col.js +2 -2
- package/dist/packages/_es/Collapse.js +2 -2
- package/dist/packages/_es/CollapseItem.js +28 -18
- package/dist/packages/_es/CountDown.js +4 -2
- package/dist/packages/_es/CountUp.js +25 -16
- package/dist/packages/_es/DatePicker.js +83 -47
- package/dist/packages/_es/Dialog.js +5 -3
- package/dist/packages/_es/Divider.js +2 -2
- package/dist/packages/_es/Drag.js +4 -4
- package/dist/packages/_es/Elevator.js +2 -2
- package/dist/packages/_es/Empty.js +2 -2
- package/dist/packages/_es/FixedNav.js +2 -2
- package/dist/packages/_es/Form.js +8 -6
- package/dist/packages/_es/FormItem.js +9 -6
- package/dist/packages/_es/Grid.js +2 -2
- package/dist/packages/_es/GridItem.js +2 -2
- package/dist/packages/_es/Icon.js +2 -2
- package/dist/packages/_es/ImagePreview.js +2 -2
- package/dist/packages/_es/Indicator.js +2 -2
- package/dist/packages/_es/InfiniteLoading.js +2 -2
- package/dist/packages/_es/Input.js +290 -66
- package/dist/packages/_es/InputNumber.js +2 -2
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/List.js +124 -0
- package/dist/packages/_es/Menu.js +2 -2
- package/dist/packages/_es/MenuItem.js +2 -2
- package/dist/packages/_es/Navbar.js +16 -10
- package/dist/packages/_es/NoticeBar.js +6 -5
- package/dist/packages/_es/Notify.js +7 -3
- package/dist/packages/_es/NumberKeyboard.js +9 -4
- package/dist/packages/_es/OverLay.js +2 -2
- package/dist/packages/_es/Pagination.js +2 -2
- package/dist/packages/_es/Picker.js +163 -157
- package/dist/packages/_es/Popover.js +2 -2
- package/dist/packages/_es/Popup.js +2 -2
- package/dist/packages/_es/Price.js +2 -2
- package/dist/packages/_es/Progress.js +14 -22
- package/dist/packages/_es/Radio.js +3 -3
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +129 -19
- package/dist/packages/_es/Rate.js +2 -2
- package/dist/packages/_es/Row.js +2 -2
- package/dist/packages/_es/SearchBar.js +2 -2
- package/dist/packages/_es/ShortPassword.js +2 -2
- package/dist/packages/_es/SideNavBar.js +2 -2
- package/dist/packages/_es/SideNavBarItem.js +2 -2
- package/dist/packages/_es/Signature.js +25 -6
- package/dist/packages/_es/Skeleton.js +2 -2
- package/dist/packages/_es/Sku.js +31 -13
- package/dist/packages/_es/Step.js +28 -12
- package/dist/packages/_es/Steps.js +8 -3
- package/dist/packages/_es/Sticky.js +2 -2
- package/dist/packages/_es/SubSideNavBar.js +2 -2
- package/dist/packages/_es/Swipe.js +2 -2
- package/dist/packages/_es/Swiper.js +2 -2
- package/dist/packages/_es/SwiperItem.js +2 -2
- package/dist/packages/_es/Switch.js +2 -2
- package/dist/packages/_es/TabPane.js +2 -2
- package/dist/packages/_es/Tabbar.js +2 -2
- package/dist/packages/_es/TabbarItem.js +17 -6
- package/dist/packages/_es/Table.js +2 -2
- package/dist/packages/_es/Tabs.js +8 -5
- package/dist/packages/_es/Tag.js +11 -5
- package/dist/packages/_es/TextArea.js +38 -6
- package/dist/packages/_es/TimeDetail.js +2 -2
- package/dist/packages/_es/TimePannel.js +2 -2
- package/dist/packages/_es/TimeSelect.js +2 -2
- package/dist/packages/_es/Toast.js +2 -2
- package/dist/packages/_es/Uploader.js +2 -4
- package/dist/packages/_es/Video.js +12 -8
- package/dist/packages/_es/common.js +2 -2
- package/dist/packages/_es/component.js +2 -2
- package/dist/packages/_es/index.js +2 -2
- package/dist/packages/_es/index2.js +2 -2
- package/dist/packages/_es/index3.js +2 -2
- package/dist/packages/_es/index4.js +2 -2
- package/dist/packages/_es/plugin-vue_export-helper.js +2 -2
- package/dist/packages/_es/pxCheck.js +2 -2
- package/dist/packages/_es/raf.js +2 -2
- package/dist/packages/_es/util.js +2 -2
- package/dist/packages/badge/index.scss +11 -13
- package/dist/packages/button/index.scss +1 -0
- package/dist/packages/calendar/index.scss +9 -4
- package/dist/packages/calendaritem/index.scss +0 -207
- package/dist/packages/cell/index.scss +6 -6
- package/dist/packages/checkbox/index.scss +4 -3
- package/dist/packages/collapseitem/index.scss +21 -11
- package/dist/packages/countdown/index.scss +3 -1
- package/dist/packages/divider/index.scss +8 -8
- package/dist/packages/elevator/index.scss +36 -36
- package/dist/packages/formitem/index.scss +15 -8
- package/dist/packages/indicator/index.scss +1 -1
- package/dist/packages/input/index.scss +70 -24
- package/dist/packages/inputnumber/index.scss +4 -2
- package/dist/packages/list/index.scss +24 -0
- package/dist/packages/menu/index.scss +3 -3
- package/dist/packages/navbar/index.scss +28 -8
- package/dist/packages/noticebar/index.scss +7 -8
- package/dist/packages/notify/index.scss +9 -0
- package/dist/packages/numberkeyboard/index.scss +22 -21
- package/dist/packages/oldpicker/index.scss +131 -0
- package/dist/packages/picker/index.scss +38 -32
- package/dist/packages/progress/index.scss +6 -5
- package/dist/packages/radio/index.scss +7 -6
- package/dist/packages/range/index.scss +109 -2
- package/dist/packages/searchbar/index.scss +7 -7
- package/dist/packages/sidenavbaritem/index.scss +5 -5
- package/dist/packages/step/index.scss +29 -29
- package/dist/packages/subsidenavbar/index.scss +10 -8
- package/dist/packages/tabbaritem/index.scss +15 -0
- package/dist/packages/timedetail/index.scss +13 -13
- package/dist/packages/timepannel/index.scss +7 -7
- package/dist/packages/timeselect/index.scss +3 -3
- package/dist/packages/uploader/index.scss +4 -4
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +39 -37
- package/dist/styles/themes/jdt.scss +91 -0
- package/dist/styles/variables-jdt.scss +727 -0
- package/dist/styles/variables.scss +250 -44
- package/package.json +2 -1
- package/dist/styles/themes/jdd.scss +0 -2
|
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.18
|
|
22
|
-
* (c)
|
|
21
|
+
* @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
25
|
import { h, ref, reactive, computed, watch, onMounted, onActivated, onDeactivated, onUnmounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, withDirectives, normalizeStyle, renderSlot, createBlock, createCommentVNode, createElementVNode, createTextVNode, toDisplayString, withModifiers, createVNode, vShow, Fragment, renderList } from "vue";
|
|
@@ -118,7 +118,7 @@ const _sfc_main = create({
|
|
|
118
118
|
});
|
|
119
119
|
const isEllipsis = computed(() => {
|
|
120
120
|
if (state.isCanScroll == null) {
|
|
121
|
-
return
|
|
121
|
+
return props.wrapable;
|
|
122
122
|
} else {
|
|
123
123
|
return !state.isCanScroll && !props.wrapable;
|
|
124
124
|
}
|
|
@@ -187,6 +187,7 @@ const _sfc_main = create({
|
|
|
187
187
|
const wrapWidth = wrap.value.getBoundingClientRect().width;
|
|
188
188
|
const offsetWidth = content.value.getBoundingClientRect().width;
|
|
189
189
|
state.isCanScroll = props.scrollable == null ? offsetWidth > wrapWidth : props.scrollable;
|
|
190
|
+
console.log(111, state.isCanScroll);
|
|
190
191
|
if (state.isCanScroll) {
|
|
191
192
|
state.wrapWidth = wrapWidth;
|
|
192
193
|
state.offsetWidth = offsetWidth;
|
|
@@ -195,7 +196,7 @@ const _sfc_main = create({
|
|
|
195
196
|
} else {
|
|
196
197
|
state.animationClass = "";
|
|
197
198
|
}
|
|
198
|
-
});
|
|
199
|
+
}, 0);
|
|
199
200
|
};
|
|
200
201
|
const handleClick = (event) => {
|
|
201
202
|
emit("click", event);
|
|
@@ -328,7 +329,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
328
329
|
createElementVNode("view", _hoisted_1, [
|
|
329
330
|
createElementVNode("view", {
|
|
330
331
|
ref: "content",
|
|
331
|
-
class: normalizeClass(["content",
|
|
332
|
+
class: normalizeClass(["content", _ctx.animationClass, { "nut-ellipsis": _ctx.isEllipsis }]),
|
|
332
333
|
style: normalizeStyle(_ctx.contentStyle),
|
|
333
334
|
onAnimationend: _cache[0] || (_cache[0] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args)),
|
|
334
335
|
onWebkitAnimationEnd: _cache[1] || (_cache[1] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args))
|
|
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.18
|
|
22
|
-
* (c)
|
|
21
|
+
* @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
25
|
import { reactive, onMounted, watch, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, vShow, createVNode, render } from "vue";
|
|
@@ -52,6 +52,10 @@ const _sfc_main = create({
|
|
|
52
52
|
type: Boolean,
|
|
53
53
|
default: false
|
|
54
54
|
},
|
|
55
|
+
position: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "top"
|
|
58
|
+
},
|
|
55
59
|
onClose: Function,
|
|
56
60
|
onClick: Function,
|
|
57
61
|
unmount: Function
|
|
@@ -107,7 +111,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
107
111
|
}, {
|
|
108
112
|
default: withCtx(() => [
|
|
109
113
|
withDirectives(createElementVNode("view", {
|
|
110
|
-
class: normalizeClass([
|
|
114
|
+
class: normalizeClass([`popup-${_ctx.position}`, "nut-notify", `nut-notify--${_ctx.type}`, [_ctx.className]]),
|
|
111
115
|
style: normalizeStyle({ color: _ctx.color, background: _ctx.background }),
|
|
112
116
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
|
|
113
117
|
}, [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.18
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { ref, computed, watch, onMounted, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, normalizeClass, createTextVNode } from "vue";
|
|
@@ -40,6 +40,10 @@ const _sfc_main = create({
|
|
|
40
40
|
overlay: {
|
|
41
41
|
type: Boolean,
|
|
42
42
|
default: true
|
|
43
|
+
},
|
|
44
|
+
isWrapTeleport: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true
|
|
43
47
|
}
|
|
44
48
|
},
|
|
45
49
|
emits: ["input", "delete", "close", "update:value"],
|
|
@@ -177,6 +181,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
177
181
|
position: "bottom",
|
|
178
182
|
overlay: _ctx.overlay,
|
|
179
183
|
onClickOverlay: _cache[7] || (_cache[7] = ($event) => _ctx.closeBoard()),
|
|
184
|
+
isWrapTeleport: _ctx.isWrapTeleport,
|
|
180
185
|
"overlay-class": "nut-numberkeyboard-overlay"
|
|
181
186
|
}, {
|
|
182
187
|
default: withCtx(() => [
|
|
@@ -231,7 +236,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
231
236
|
]),
|
|
232
237
|
_ctx.title == "" ? (openBlock(), createElementBlock("div", {
|
|
233
238
|
key: 0,
|
|
234
|
-
class: "key-board-wrapper",
|
|
239
|
+
class: "key-board-wrapper key-board-finish",
|
|
235
240
|
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.closeBoard())
|
|
236
241
|
}, [
|
|
237
242
|
createElementVNode("div", {
|
|
@@ -243,7 +248,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
243
248
|
], 512)
|
|
244
249
|
]),
|
|
245
250
|
_: 1
|
|
246
|
-
}, 8, ["visible", "overlay"]);
|
|
251
|
+
}, 8, ["visible", "overlay", "isWrapTeleport"]);
|
|
247
252
|
}
|
|
248
253
|
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
249
254
|
export { index as default };
|
|
@@ -15,8 +15,8 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
/*!
|
|
18
|
-
* @nutui/nutui v3.1.18
|
|
19
|
-
* (c)
|
|
18
|
+
* @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
|
|
19
|
+
* (c) 2022 @jdf2e.
|
|
20
20
|
* Released under the MIT License.
|
|
21
21
|
*/
|
|
22
22
|
import { computed, watch, onDeactivated, onBeforeUnmount, onMounted, onActivated, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, withModifiers, normalizeStyle, renderSlot, vShow } from "vue";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.18
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { toRefs, computed, watchEffect, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, createTextVNode, toDisplayString, Fragment, renderList, createCommentVNode } from "vue";
|
|
@@ -18,46 +18,35 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.18
|
|
22
|
-
* (c)
|
|
21
|
+
* @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
|
-
import { ref, reactive, computed, watch, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode,
|
|
25
|
+
import { ref, reactive, computed, watch, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, onBeforeUnmount, resolveComponent, createVNode, withCtx } from "vue";
|
|
26
26
|
import { c as createComponent } from "./component.js";
|
|
27
|
-
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
28
27
|
import Popup, { popupProps } from "./Popup.js";
|
|
28
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
29
|
import "./OverLay.js";
|
|
30
30
|
import "./Icon.js";
|
|
31
31
|
import "./pxCheck.js";
|
|
32
|
-
const commonProps = {
|
|
33
|
-
listData: {
|
|
34
|
-
type: Array,
|
|
35
|
-
default: () => {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
readonly: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: false
|
|
42
|
-
},
|
|
43
|
-
defaultIndex: {
|
|
44
|
-
type: [Number, String],
|
|
45
|
-
default: 0
|
|
46
|
-
},
|
|
47
|
-
itemHeight: {
|
|
48
|
-
type: [Number, String],
|
|
49
|
-
default: 35
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
32
|
const { create: create$1 } = createComponent("picker-column");
|
|
53
33
|
const _sfc_main$1 = create$1({
|
|
54
|
-
props:
|
|
55
|
-
|
|
34
|
+
props: {
|
|
35
|
+
value: [String, Number],
|
|
36
|
+
columnsType: String,
|
|
56
37
|
itemShow: {
|
|
57
38
|
type: Boolean,
|
|
58
39
|
default: false
|
|
40
|
+
},
|
|
41
|
+
column: {
|
|
42
|
+
type: Array,
|
|
43
|
+
default: () => []
|
|
44
|
+
},
|
|
45
|
+
readonly: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
59
48
|
}
|
|
60
|
-
},
|
|
49
|
+
},
|
|
61
50
|
emits: ["click", "change"],
|
|
62
51
|
setup(props, { emit }) {
|
|
63
52
|
const wrapper = ref();
|
|
@@ -67,7 +56,8 @@ const _sfc_main$1 = create$1({
|
|
|
67
56
|
endY: 0,
|
|
68
57
|
startTime: 0,
|
|
69
58
|
endTime: 0,
|
|
70
|
-
lastY: 0
|
|
59
|
+
lastY: 0,
|
|
60
|
+
lastTime: 0
|
|
71
61
|
},
|
|
72
62
|
currIndex: 1,
|
|
73
63
|
transformY: 0,
|
|
@@ -113,7 +103,7 @@ const _sfc_main$1 = create$1({
|
|
|
113
103
|
event.preventDefault();
|
|
114
104
|
let changedTouches = event.changedTouches[0];
|
|
115
105
|
state.touchParams.lastY = changedTouches.pageY;
|
|
116
|
-
state.touchParams.lastTime = event.
|
|
106
|
+
state.touchParams.lastTime = event.timeStamp || Date.now();
|
|
117
107
|
let move = state.touchParams.lastY - state.touchParams.startY;
|
|
118
108
|
let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
|
|
119
109
|
if (moveTime <= 300) {
|
|
@@ -150,8 +140,8 @@ const _sfc_main$1 = create$1({
|
|
|
150
140
|
if (updateMove > 0) {
|
|
151
141
|
updateMove = 0;
|
|
152
142
|
}
|
|
153
|
-
if (updateMove < -(props.
|
|
154
|
-
updateMove = -(props.
|
|
143
|
+
if (updateMove < -(props.column.length - 1) * state.lineSpacing) {
|
|
144
|
+
updateMove = -(props.column.length - 1) * state.lineSpacing;
|
|
155
145
|
}
|
|
156
146
|
let endMove = Math.round(updateMove / state.lineSpacing) * state.lineSpacing;
|
|
157
147
|
let deg = `${(Math.abs(Math.round(endMove / state.lineSpacing)) + 1) * state.rotation}deg`;
|
|
@@ -173,25 +163,22 @@ const _sfc_main$1 = create$1({
|
|
|
173
163
|
}
|
|
174
164
|
};
|
|
175
165
|
const setChooseValue = () => {
|
|
176
|
-
emit("change", state.currIndex - 1);
|
|
166
|
+
emit("change", props.column[state.currIndex - 1]);
|
|
177
167
|
};
|
|
178
168
|
const modifyStatus = (type) => {
|
|
179
|
-
|
|
169
|
+
const { column: column2 } = props;
|
|
170
|
+
let index = column2.findIndex((columnItem) => columnItem.value == props.value);
|
|
180
171
|
state.currIndex = index === -1 ? 1 : index + 1;
|
|
181
172
|
let move = index === -1 ? 0 : index * state.lineSpacing;
|
|
182
173
|
type && setChooseValue();
|
|
183
174
|
setMove(-move);
|
|
184
175
|
};
|
|
185
|
-
watch(() => props.
|
|
176
|
+
watch(() => props.column, (val) => {
|
|
186
177
|
state.transformY = 0;
|
|
187
178
|
modifyStatus(false);
|
|
188
179
|
}, {
|
|
189
180
|
deep: true
|
|
190
181
|
});
|
|
191
|
-
watch(() => props.defaultIndex, (val) => {
|
|
192
|
-
state.transformY = 0;
|
|
193
|
-
modifyStatus(false);
|
|
194
|
-
});
|
|
195
182
|
onMounted(() => {
|
|
196
183
|
modifyStatus(true);
|
|
197
184
|
});
|
|
@@ -206,7 +193,8 @@ const _sfc_main$1 = create$1({
|
|
|
206
193
|
onTouchMove,
|
|
207
194
|
onTouchEnd,
|
|
208
195
|
touchRollerStyle,
|
|
209
|
-
touchListStyle
|
|
196
|
+
touchListStyle,
|
|
197
|
+
setMove
|
|
210
198
|
});
|
|
211
199
|
}
|
|
212
200
|
});
|
|
@@ -227,12 +215,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
227
215
|
ref: "roller",
|
|
228
216
|
style: normalizeStyle(_ctx.touchRollerStyle)
|
|
229
217
|
}, [
|
|
230
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.
|
|
218
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.column, (item, index) => {
|
|
231
219
|
return openBlock(), createElementBlock("view", {
|
|
232
220
|
class: normalizeClass(["nut-picker-roller-item", { "nut-picker-roller-item-hidden": _ctx.isHidden(index + 1) }]),
|
|
233
221
|
style: normalizeStyle(_ctx.setRollerStyle(index + 1)),
|
|
234
|
-
key: item.
|
|
235
|
-
}, toDisplayString(
|
|
222
|
+
key: item.value ? item.value : index
|
|
223
|
+
}, toDisplayString(item.text), 7);
|
|
236
224
|
}), 128))
|
|
237
225
|
], 4),
|
|
238
226
|
createElementVNode("view", _hoisted_1$1, [
|
|
@@ -241,25 +229,29 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
241
229
|
ref: "list",
|
|
242
230
|
style: normalizeStyle(_ctx.touchListStyle)
|
|
243
231
|
}, [
|
|
244
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.
|
|
232
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.column, (item, index) => {
|
|
245
233
|
return openBlock(), createElementBlock("view", {
|
|
246
|
-
class: "nut-picker-item nut-picker-item-ref",
|
|
247
|
-
key: item.
|
|
248
|
-
}, toDisplayString(
|
|
234
|
+
class: normalizeClass(["nut-picker-item", "nut-picker-item-ref", item.className]),
|
|
235
|
+
key: item.value ? item.value : index
|
|
236
|
+
}, toDisplayString(item.text), 3);
|
|
249
237
|
}), 128)),
|
|
250
|
-
_ctx.
|
|
238
|
+
_ctx.column && _ctx.column.length === 1 ? (openBlock(), createElementBlock("view", _hoisted_2$1)) : createCommentVNode("", true)
|
|
251
239
|
], 4)
|
|
252
240
|
])
|
|
253
241
|
], 32);
|
|
254
242
|
}
|
|
255
243
|
var column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
256
|
-
const {
|
|
244
|
+
const { componentName, create } = createComponent("picker");
|
|
257
245
|
const _sfc_main = create({
|
|
258
246
|
components: {
|
|
259
247
|
[column.name]: column,
|
|
260
248
|
[Popup.name]: Popup
|
|
261
249
|
},
|
|
262
|
-
props:
|
|
250
|
+
props: __spreadProps(__spreadValues({}, popupProps), {
|
|
251
|
+
modelValue: {
|
|
252
|
+
type: Array,
|
|
253
|
+
default: () => []
|
|
254
|
+
},
|
|
263
255
|
title: {
|
|
264
256
|
type: String,
|
|
265
257
|
default: ""
|
|
@@ -271,144 +263,158 @@ const _sfc_main = create({
|
|
|
271
263
|
okText: {
|
|
272
264
|
type: String,
|
|
273
265
|
default: "\u786E\u5B9A"
|
|
266
|
+
},
|
|
267
|
+
columns: {
|
|
268
|
+
type: Array,
|
|
269
|
+
default: () => {
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
readonly: {
|
|
274
|
+
type: Boolean,
|
|
275
|
+
default: false
|
|
274
276
|
}
|
|
275
|
-
}),
|
|
276
|
-
emits: ["close", "change", "confirm", "update:visible"],
|
|
277
|
+
}),
|
|
278
|
+
emits: ["close", "change", "confirm", "update:visible", "update:modelValue"],
|
|
277
279
|
setup(props, { emit }) {
|
|
278
|
-
const childrenKey = "children";
|
|
279
|
-
const valuesKey = "values";
|
|
280
280
|
const state = reactive({
|
|
281
281
|
show: false,
|
|
282
|
-
formattedColumns: props.
|
|
283
|
-
defaultIndex: props.defaultIndex
|
|
282
|
+
formattedColumns: props.columns
|
|
284
283
|
});
|
|
285
|
-
let
|
|
286
|
-
let defaultIndexList = [];
|
|
284
|
+
let defaultValues = ref(props.modelValue);
|
|
287
285
|
const classes = computed(() => {
|
|
288
286
|
const prefixCls = componentName;
|
|
289
287
|
return {
|
|
290
288
|
[prefixCls]: true
|
|
291
289
|
};
|
|
292
290
|
});
|
|
293
|
-
const
|
|
291
|
+
const selectedOptions = computed(() => {
|
|
292
|
+
let optins = [];
|
|
293
|
+
columnsList.value.map((column2, index) => {
|
|
294
|
+
let currOptions = [];
|
|
295
|
+
currOptions = column2.filter((item) => item.value == defaultValues.value[index]);
|
|
296
|
+
optins.push(currOptions[0]);
|
|
297
|
+
});
|
|
298
|
+
return optins;
|
|
299
|
+
});
|
|
300
|
+
const columnsType = computed(() => {
|
|
294
301
|
const firstColumn = state.formattedColumns[0];
|
|
295
|
-
if (
|
|
296
|
-
if (firstColumn
|
|
302
|
+
if (firstColumn) {
|
|
303
|
+
if (Array.isArray(firstColumn)) {
|
|
304
|
+
return "multiple";
|
|
305
|
+
}
|
|
306
|
+
if ("children" in firstColumn) {
|
|
297
307
|
return "cascade";
|
|
298
|
-
} else if (firstColumn == null ? void 0 : firstColumn[valuesKey]) {
|
|
299
|
-
addDefaultIndexList(props.listData);
|
|
300
|
-
return "multipleColumns";
|
|
301
308
|
}
|
|
302
309
|
}
|
|
303
|
-
return "
|
|
310
|
+
return "single";
|
|
304
311
|
});
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
312
|
+
const columnsList = computed(() => {
|
|
313
|
+
switch (columnsType.value) {
|
|
314
|
+
case "multiple":
|
|
315
|
+
return state.formattedColumns;
|
|
316
|
+
case "cascade":
|
|
317
|
+
return formatCascade(state.formattedColumns, defaultValues.value);
|
|
318
|
+
default:
|
|
319
|
+
return [state.formattedColumns];
|
|
313
320
|
}
|
|
314
|
-
return state.formattedColumns;
|
|
315
321
|
});
|
|
316
|
-
const
|
|
317
|
-
defaultIndexList = [];
|
|
318
|
-
listData.forEach((res) => {
|
|
319
|
-
defaultIndexList.push(res.defaultIndex || 0);
|
|
320
|
-
});
|
|
321
|
-
};
|
|
322
|
-
const formatCascade = (listData, defaultIndex) => {
|
|
322
|
+
const formatCascade = (columns, defaultValues2) => {
|
|
323
323
|
const formatted = [];
|
|
324
|
-
let
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
324
|
+
let cursor = {
|
|
325
|
+
text: "",
|
|
326
|
+
value: "",
|
|
327
|
+
children: columns
|
|
328
|
+
};
|
|
329
|
+
let columnIndex = 0;
|
|
330
|
+
while (cursor && cursor.children) {
|
|
331
|
+
const options = cursor.children;
|
|
332
|
+
const value = defaultValues2[columnIndex];
|
|
333
|
+
let index = options.findIndex((columnItem) => columnItem.value == value);
|
|
334
|
+
if (index == -1)
|
|
335
|
+
index = 0;
|
|
336
|
+
cursor = cursor.children[index];
|
|
337
|
+
columnIndex++;
|
|
338
|
+
formatted.push(options);
|
|
332
339
|
}
|
|
333
|
-
addDefaultIndexList(formatted);
|
|
334
340
|
return formatted;
|
|
335
341
|
};
|
|
336
|
-
const getCascadeData = (listData, defaultIndex) => {
|
|
337
|
-
var _a;
|
|
338
|
-
let arr = listData;
|
|
339
|
-
arr.defaultIndex = defaultIndex;
|
|
340
|
-
const dataList = [];
|
|
341
|
-
while (arr) {
|
|
342
|
-
const item = arr[(_a = arr.defaultIndex) != null ? _a : 0];
|
|
343
|
-
dataList.push(item.text);
|
|
344
|
-
arr = item.children;
|
|
345
|
-
}
|
|
346
|
-
return dataList;
|
|
347
|
-
};
|
|
348
342
|
const close = () => {
|
|
349
343
|
emit("close");
|
|
350
344
|
emit("update:visible", false);
|
|
351
345
|
};
|
|
352
|
-
const changeHandler = (columnIndex,
|
|
353
|
-
if (
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
cursor
|
|
362
|
-
} else if (i > columnIndex) {
|
|
363
|
-
cursor.defaultIndex = 0;
|
|
346
|
+
const changeHandler = (columnIndex, option) => {
|
|
347
|
+
if (option && Object.keys(option).length) {
|
|
348
|
+
if (columnsType.value === "cascade") {
|
|
349
|
+
defaultValues.value[columnIndex] = option.value ? option.value : "";
|
|
350
|
+
let index = columnIndex;
|
|
351
|
+
let cursor = option;
|
|
352
|
+
while (cursor && cursor.children) {
|
|
353
|
+
defaultValues.value[index + 1] = cursor.children[0].value;
|
|
354
|
+
index++;
|
|
355
|
+
cursor = cursor.children[0];
|
|
364
356
|
}
|
|
365
|
-
|
|
366
|
-
|
|
357
|
+
} else {
|
|
358
|
+
defaultValues.value[columnIndex] = option.value ? option.value : "";
|
|
367
359
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
emit("change", val, columnIndex, dataIndex);
|
|
360
|
+
emit("change", {
|
|
361
|
+
columnIndex,
|
|
362
|
+
selectedValue: defaultValues.value,
|
|
363
|
+
selectedOptions: selectedOptions.value
|
|
364
|
+
});
|
|
374
365
|
}
|
|
375
366
|
};
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
for (let i = 0; i < defaultIndexList.length; i++) {
|
|
382
|
-
state.formattedColumns[i].defaultIndex = defaultIndexList[i];
|
|
383
|
-
}
|
|
384
|
-
const checkedArr = toRaw(state.formattedColumns).map((res) => res.values && res.values[res.defaultIndex]);
|
|
385
|
-
emit("confirm", checkedArr);
|
|
386
|
-
} else if (dataType.value === "cascade") {
|
|
387
|
-
emit("confirm", getCascadeData(toRaw(state.formattedColumns), state.defaultIndex));
|
|
388
|
-
}
|
|
367
|
+
const confirmHandler = () => {
|
|
368
|
+
emit("confirm", {
|
|
369
|
+
selectedValue: defaultValues.value,
|
|
370
|
+
selectedOptions: selectedOptions.value
|
|
371
|
+
});
|
|
389
372
|
emit("update:visible", false);
|
|
390
373
|
};
|
|
374
|
+
onMounted(() => {
|
|
375
|
+
if (props.visible)
|
|
376
|
+
state.show = props.visible;
|
|
377
|
+
});
|
|
378
|
+
onBeforeUnmount(() => {
|
|
379
|
+
if (props.visible)
|
|
380
|
+
state.show = false;
|
|
381
|
+
});
|
|
382
|
+
watch(() => props.modelValue, (newValues) => {
|
|
383
|
+
const isSameValue = JSON.stringify(newValues) === JSON.stringify(defaultValues.value);
|
|
384
|
+
if (!isSameValue) {
|
|
385
|
+
defaultValues.value = newValues;
|
|
386
|
+
}
|
|
387
|
+
}, { deep: true });
|
|
388
|
+
watch(defaultValues, (newValues) => {
|
|
389
|
+
const isSameValue = JSON.stringify(newValues) === JSON.stringify(props.modelValue);
|
|
390
|
+
if (!isSameValue) {
|
|
391
|
+
emit("update:modelValue", newValues);
|
|
392
|
+
}
|
|
393
|
+
}, { immediate: true });
|
|
391
394
|
watch(() => props.visible, (val) => {
|
|
392
395
|
state.show = val;
|
|
393
396
|
});
|
|
394
|
-
watch(() => props.
|
|
395
|
-
|
|
397
|
+
watch(() => props.columns, (val) => {
|
|
398
|
+
if (val.length)
|
|
399
|
+
state.formattedColumns = val;
|
|
396
400
|
});
|
|
397
401
|
return __spreadProps(__spreadValues({
|
|
398
402
|
classes
|
|
399
403
|
}, toRefs(state)), {
|
|
400
404
|
column,
|
|
401
|
-
|
|
402
|
-
|
|
405
|
+
columnsType,
|
|
406
|
+
columnsList,
|
|
403
407
|
close,
|
|
404
408
|
changeHandler,
|
|
405
|
-
|
|
409
|
+
confirmHandler,
|
|
410
|
+
defaultValues
|
|
406
411
|
});
|
|
407
412
|
}
|
|
408
413
|
});
|
|
409
414
|
const _hoisted_1 = { class: "nut-picker__bar" };
|
|
410
|
-
const _hoisted_2 = { class: "nut-
|
|
411
|
-
const _hoisted_3 =
|
|
415
|
+
const _hoisted_2 = { class: "nut-picker__title" };
|
|
416
|
+
const _hoisted_3 = { class: "nut-picker__column" };
|
|
417
|
+
const _hoisted_4 = /* @__PURE__ */ createElementVNode("view", { class: "nut-picker__hairline" }, null, -1);
|
|
412
418
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
413
419
|
const _component_nut_picker_column = resolveComponent("nut-picker-column");
|
|
414
420
|
const _component_nut_popup = resolveComponent("nut-popup");
|
|
@@ -423,44 +429,44 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
423
429
|
"lock-scroll": _ctx.lockScroll,
|
|
424
430
|
"close-on-click-overlay": _ctx.closeOnClickOverlay,
|
|
425
431
|
onClose: _ctx.close,
|
|
426
|
-
round: true
|
|
432
|
+
round: true,
|
|
433
|
+
isWrapTeleport: _ctx.isWrapTeleport
|
|
427
434
|
}, {
|
|
428
435
|
default: withCtx(() => [
|
|
429
436
|
createElementVNode("view", _hoisted_1, [
|
|
430
437
|
createElementVNode("view", {
|
|
431
|
-
class: "nut-picker__left nut-picker__button",
|
|
438
|
+
class: "nut-picker__cancel nut-picker__left nut-picker__button",
|
|
432
439
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args))
|
|
433
440
|
}, toDisplayString(_ctx.cancelText), 1),
|
|
434
|
-
createElementVNode("view",
|
|
441
|
+
createElementVNode("view", _hoisted_2, toDisplayString(_ctx.title), 1),
|
|
435
442
|
createElementVNode("view", {
|
|
436
|
-
class: "nut-picker__button",
|
|
437
|
-
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.
|
|
443
|
+
class: "nut-picker__confirm nut-picker__right nut-picker__button",
|
|
444
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirmHandler())
|
|
438
445
|
}, toDisplayString(_ctx.okText), 1)
|
|
439
446
|
]),
|
|
440
|
-
createElementVNode("view",
|
|
441
|
-
|
|
442
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.
|
|
447
|
+
createElementVNode("view", _hoisted_3, [
|
|
448
|
+
_hoisted_4,
|
|
449
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnsList, (column2, columnIndex) => {
|
|
443
450
|
return openBlock(), createElementBlock("view", {
|
|
444
451
|
class: "nut-picker__columnitem",
|
|
445
452
|
key: columnIndex
|
|
446
453
|
}, [
|
|
447
454
|
createVNode(_component_nut_picker_column, {
|
|
448
455
|
itemShow: _ctx.show,
|
|
449
|
-
|
|
456
|
+
column: column2,
|
|
450
457
|
readonly: _ctx.readonly,
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
_ctx.changeHandler(columnIndex, dataIndex);
|
|
458
|
+
columnsType: _ctx.columnsType,
|
|
459
|
+
value: _ctx.defaultValues[columnIndex],
|
|
460
|
+
onChange: (option) => {
|
|
461
|
+
_ctx.changeHandler(columnIndex, option);
|
|
456
462
|
}
|
|
457
|
-
}, null, 8, ["itemShow", "
|
|
463
|
+
}, null, 8, ["itemShow", "column", "readonly", "columnsType", "value", "onChange"])
|
|
458
464
|
]);
|
|
459
465
|
}), 128))
|
|
460
466
|
])
|
|
461
467
|
]),
|
|
462
468
|
_: 1
|
|
463
|
-
}, 8, ["visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose"])
|
|
469
|
+
}, 8, ["visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose", "isWrapTeleport"])
|
|
464
470
|
], 2);
|
|
465
471
|
}
|
|
466
472
|
var picker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.18
|
|
22
|
-
* (c)
|
|
21
|
+
* @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
25
|
import { ref, reactive, toRefs, computed, onMounted, watch, resolveComponent, openBlock, createElementBlock, withModifiers, normalizeClass, createElementVNode, renderSlot, Fragment, normalizeStyle, renderList, createVNode, createCommentVNode, toDisplayString } from "vue";
|
|
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.18
|
|
22
|
-
* (c)
|
|
21
|
+
* @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
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";
|