@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,158 @@
|
|
|
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 { c as createComponent } from "./component.js";
|
|
26
|
+
import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, createElementVNode, toDisplayString, createCommentVNode, Fragment, renderList, normalizeStyle, createTextVNode } from "vue";
|
|
27
|
+
import { popupProps } from "./Popup.js";
|
|
28
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
|
+
import "./OverLay.js";
|
|
30
|
+
import "./Icon.js";
|
|
31
|
+
import "./pxCheck.js";
|
|
32
|
+
const { componentName, create } = createComponent("actionsheet");
|
|
33
|
+
const _sfc_main = create({
|
|
34
|
+
props: __spreadProps(__spreadValues({}, popupProps), {
|
|
35
|
+
cancelTxt: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: ""
|
|
38
|
+
},
|
|
39
|
+
optionTag: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "name"
|
|
42
|
+
},
|
|
43
|
+
optionSubTag: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "subname"
|
|
46
|
+
},
|
|
47
|
+
chooseTagValue: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: ""
|
|
50
|
+
},
|
|
51
|
+
title: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: ""
|
|
54
|
+
},
|
|
55
|
+
color: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "#ee0a24"
|
|
58
|
+
},
|
|
59
|
+
description: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: ""
|
|
62
|
+
},
|
|
63
|
+
menuItems: {
|
|
64
|
+
type: Array,
|
|
65
|
+
default: () => []
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
emits: ["cancel", "choose", "update:visible"],
|
|
69
|
+
setup(props, { emit }) {
|
|
70
|
+
const classes = computed(() => {
|
|
71
|
+
const prefixCls = componentName;
|
|
72
|
+
return {
|
|
73
|
+
[prefixCls]: true
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
const isHighlight = (item) => {
|
|
77
|
+
return props.chooseTagValue && props.chooseTagValue === item[props.optionTag] ? props.color : "#1a1a1a";
|
|
78
|
+
};
|
|
79
|
+
const cancelActionSheet = () => {
|
|
80
|
+
emit("cancel");
|
|
81
|
+
emit("update:visible", false);
|
|
82
|
+
};
|
|
83
|
+
const chooseItem = (item, index2) => {
|
|
84
|
+
if (!item.disable) {
|
|
85
|
+
emit("choose", item, index2);
|
|
86
|
+
emit("update:visible", false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const close = () => {
|
|
90
|
+
emit("close");
|
|
91
|
+
emit("update:visible", false);
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
isHighlight,
|
|
95
|
+
cancelActionSheet,
|
|
96
|
+
chooseItem,
|
|
97
|
+
close,
|
|
98
|
+
classes
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
const _hoisted_1 = { class: "nut-actionsheet-panel" };
|
|
103
|
+
const _hoisted_2 = {
|
|
104
|
+
key: 0,
|
|
105
|
+
class: "nut-actionsheet-title"
|
|
106
|
+
};
|
|
107
|
+
const _hoisted_3 = {
|
|
108
|
+
key: 1,
|
|
109
|
+
class: "nut-actionsheet-item desc"
|
|
110
|
+
};
|
|
111
|
+
const _hoisted_4 = {
|
|
112
|
+
key: 2,
|
|
113
|
+
class: "nut-actionsheet-menu"
|
|
114
|
+
};
|
|
115
|
+
const _hoisted_5 = ["onClick"];
|
|
116
|
+
const _hoisted_6 = { class: "subdesc" };
|
|
117
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
118
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
119
|
+
return openBlock(), createElementBlock("view", {
|
|
120
|
+
class: normalizeClass(_ctx.classes)
|
|
121
|
+
}, [
|
|
122
|
+
createVNode(_component_nut_popup, {
|
|
123
|
+
"pop-class": "popclass",
|
|
124
|
+
visible: _ctx.visible,
|
|
125
|
+
position: "bottom",
|
|
126
|
+
round: "",
|
|
127
|
+
onClickOverlay: _ctx.close
|
|
128
|
+
}, {
|
|
129
|
+
default: withCtx(() => [
|
|
130
|
+
createElementVNode("view", _hoisted_1, [
|
|
131
|
+
_ctx.title ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
132
|
+
_ctx.description ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.description), 1)) : createCommentVNode("", true),
|
|
133
|
+
_ctx.menuItems.length ? (openBlock(), createElementBlock("view", _hoisted_4, [
|
|
134
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, (item, index2) => {
|
|
135
|
+
return openBlock(), createElementBlock("view", {
|
|
136
|
+
class: normalizeClass(["nut-actionsheet-item", { "nut-actionsheet-item-disabled": item.disable }]),
|
|
137
|
+
style: normalizeStyle({ color: _ctx.isHighlight(item) }),
|
|
138
|
+
key: index2,
|
|
139
|
+
onClick: ($event) => _ctx.chooseItem(item, index2)
|
|
140
|
+
}, [
|
|
141
|
+
createTextVNode(toDisplayString(item[_ctx.optionTag]), 1),
|
|
142
|
+
createElementVNode("view", _hoisted_6, toDisplayString(item[_ctx.optionSubTag]), 1)
|
|
143
|
+
], 14, _hoisted_5);
|
|
144
|
+
}), 128))
|
|
145
|
+
])) : createCommentVNode("", true),
|
|
146
|
+
_ctx.cancelTxt ? (openBlock(), createElementBlock("view", {
|
|
147
|
+
key: 3,
|
|
148
|
+
class: "nut-actionsheet-cancel",
|
|
149
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancelActionSheet && _ctx.cancelActionSheet(...args))
|
|
150
|
+
}, toDisplayString(_ctx.cancelTxt), 1)) : createCommentVNode("", true)
|
|
151
|
+
])
|
|
152
|
+
]),
|
|
153
|
+
_: 1
|
|
154
|
+
}, 8, ["visible", "onClickOverlay"])
|
|
155
|
+
], 2);
|
|
156
|
+
}
|
|
157
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
158
|
+
export { index as default };
|
|
@@ -0,0 +1,525 @@
|
|
|
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 { ref, reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, withDirectives, createVNode, vShow, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle, createTextVNode, nextTick } from "vue";
|
|
26
|
+
import { c as createComponent } from "./component.js";
|
|
27
|
+
import pinyin from "pinyin";
|
|
28
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
|
+
const transformData = (regionData) => {
|
|
30
|
+
if (!Array.isArray(regionData))
|
|
31
|
+
throw new TypeError("params muse be array.");
|
|
32
|
+
if (!regionData.length)
|
|
33
|
+
return [];
|
|
34
|
+
const newData = [];
|
|
35
|
+
regionData = regionData.map((item) => {
|
|
36
|
+
if (!item.name)
|
|
37
|
+
return new Error("the data must includes `name` props");
|
|
38
|
+
let code = pinyin(item.name, {
|
|
39
|
+
style: pinyin.STYLE_NORMAL
|
|
40
|
+
});
|
|
41
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
42
|
+
firstCode: code[0][0].charAt(0).toUpperCase()
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
regionData = regionData.sort((a, b) => {
|
|
46
|
+
return a.firstCode.localeCompare(b.firstCode);
|
|
47
|
+
});
|
|
48
|
+
regionData.forEach((item) => {
|
|
49
|
+
const index2 = newData.findIndex((value) => value.title === item.firstCode);
|
|
50
|
+
if (index2 <= -1) {
|
|
51
|
+
newData.push({
|
|
52
|
+
title: item.firstCode,
|
|
53
|
+
list: [].concat(item)
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
newData[index2] = {
|
|
57
|
+
title: item.firstCode,
|
|
58
|
+
list: newData[index2].list.concat(item)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return newData;
|
|
63
|
+
};
|
|
64
|
+
const { componentName, create } = createComponent("address");
|
|
65
|
+
const _sfc_main = create({
|
|
66
|
+
inheritAttrs: false,
|
|
67
|
+
props: {
|
|
68
|
+
visible: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: false
|
|
71
|
+
},
|
|
72
|
+
type: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: "custom"
|
|
75
|
+
},
|
|
76
|
+
customAddressTitle: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: "\u8BF7\u9009\u62E9\u6240\u5728\u5730\u533A"
|
|
79
|
+
},
|
|
80
|
+
province: {
|
|
81
|
+
type: Array,
|
|
82
|
+
default: () => []
|
|
83
|
+
},
|
|
84
|
+
city: {
|
|
85
|
+
type: Array,
|
|
86
|
+
default: () => []
|
|
87
|
+
},
|
|
88
|
+
country: {
|
|
89
|
+
type: Array,
|
|
90
|
+
default: () => []
|
|
91
|
+
},
|
|
92
|
+
town: {
|
|
93
|
+
type: Array,
|
|
94
|
+
default: () => []
|
|
95
|
+
},
|
|
96
|
+
isShowCustomAddress: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: true
|
|
99
|
+
},
|
|
100
|
+
existAddress: {
|
|
101
|
+
type: Array,
|
|
102
|
+
default: () => []
|
|
103
|
+
},
|
|
104
|
+
existAddressTitle: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: "\u914D\u9001\u81F3"
|
|
107
|
+
},
|
|
108
|
+
customAndExistTitle: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: "\u9009\u62E9\u5176\u4ED6\u5730\u5740"
|
|
111
|
+
},
|
|
112
|
+
defaultIcon: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: "location2"
|
|
115
|
+
},
|
|
116
|
+
selectedIcon: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: "Check"
|
|
119
|
+
},
|
|
120
|
+
closeBtnIcon: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: "circle-close"
|
|
123
|
+
},
|
|
124
|
+
backBtnIcon: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: "left"
|
|
127
|
+
},
|
|
128
|
+
height: {
|
|
129
|
+
type: [String, Number],
|
|
130
|
+
default: "200px"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
emits: [
|
|
134
|
+
"update:visible",
|
|
135
|
+
"type",
|
|
136
|
+
"change",
|
|
137
|
+
"selected",
|
|
138
|
+
"close",
|
|
139
|
+
"close-mask",
|
|
140
|
+
"switch-module"
|
|
141
|
+
],
|
|
142
|
+
setup(props, { emit }) {
|
|
143
|
+
const regionLine = ref(null);
|
|
144
|
+
const tabItemRef = reactive({
|
|
145
|
+
province: ref(null),
|
|
146
|
+
city: ref(null),
|
|
147
|
+
country: ref(null),
|
|
148
|
+
town: ref(null)
|
|
149
|
+
});
|
|
150
|
+
const showPopup = ref(props.visible);
|
|
151
|
+
const privateType = ref(props.type);
|
|
152
|
+
const tabIndex = ref(0);
|
|
153
|
+
const tabName = ref(["province", "city", "country", "town"]);
|
|
154
|
+
const isCustom2 = computed(() => props.type === "custom2");
|
|
155
|
+
const regionList = reactive({
|
|
156
|
+
province: isCustom2.value ? transformData(props.province) : props.province,
|
|
157
|
+
city: isCustom2.value ? transformData(props.city) : props.city,
|
|
158
|
+
country: isCustom2.value ? transformData(props.country) : props.country,
|
|
159
|
+
town: isCustom2.value ? transformData(props.town) : props.town
|
|
160
|
+
});
|
|
161
|
+
const selectedRegion = reactive({
|
|
162
|
+
province: {},
|
|
163
|
+
city: {},
|
|
164
|
+
country: {},
|
|
165
|
+
town: {}
|
|
166
|
+
});
|
|
167
|
+
let selectedExistAddress = reactive({});
|
|
168
|
+
const closeWay = ref("self");
|
|
169
|
+
const lineDistance = ref(20);
|
|
170
|
+
const getTabName = (item, index2) => {
|
|
171
|
+
if (item.name)
|
|
172
|
+
return item.name;
|
|
173
|
+
if (tabIndex.value < index2) {
|
|
174
|
+
return item.name;
|
|
175
|
+
} else {
|
|
176
|
+
return "\u8BF7\u9009\u62E9";
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const handClose = (type = "self") => {
|
|
180
|
+
if (!props.closeBtnIcon)
|
|
181
|
+
return;
|
|
182
|
+
closeWay.value = type == "cross" ? "cross" : "self";
|
|
183
|
+
showPopup.value = false;
|
|
184
|
+
};
|
|
185
|
+
const clickOverlay = () => {
|
|
186
|
+
closeWay.value = "mask";
|
|
187
|
+
};
|
|
188
|
+
const lineAnimation = () => {
|
|
189
|
+
const name = tabItemRef[tabName.value[tabIndex.value]];
|
|
190
|
+
nextTick(() => {
|
|
191
|
+
if (name) {
|
|
192
|
+
const distance = name.offsetLeft;
|
|
193
|
+
lineDistance.value = distance;
|
|
194
|
+
console.log(name);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
const nextAreaList = (item) => {
|
|
199
|
+
const calBack = {
|
|
200
|
+
next: "",
|
|
201
|
+
value: "",
|
|
202
|
+
custom: tabName.value[tabIndex.value]
|
|
203
|
+
};
|
|
204
|
+
selectedRegion[tabName.value[tabIndex.value]] = item;
|
|
205
|
+
for (let i = tabIndex.value; i < tabIndex.value - 1; i++) {
|
|
206
|
+
selectedRegion[tabName.value[i + 1]] = {};
|
|
207
|
+
}
|
|
208
|
+
if (tabIndex.value < 3) {
|
|
209
|
+
tabIndex.value = tabIndex.value + 1;
|
|
210
|
+
lineAnimation();
|
|
211
|
+
calBack.next = tabName.value[tabIndex.value];
|
|
212
|
+
calBack.value = item;
|
|
213
|
+
emit("change", calBack);
|
|
214
|
+
} else {
|
|
215
|
+
handClose();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const changeRegionTab = (item, key, index2) => {
|
|
219
|
+
if (getTabName(item, index2)) {
|
|
220
|
+
tabIndex.value = index2;
|
|
221
|
+
lineAnimation();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const selectedExist = (item) => {
|
|
225
|
+
const copyExistAdd = props.existAddress;
|
|
226
|
+
let prevExistAdd = {};
|
|
227
|
+
copyExistAdd.forEach((list, index2) => {
|
|
228
|
+
if (list && list.selectedAddress) {
|
|
229
|
+
prevExistAdd = list;
|
|
230
|
+
}
|
|
231
|
+
list.selectedAddress = false;
|
|
232
|
+
});
|
|
233
|
+
item.selectedAddress = true;
|
|
234
|
+
selectedExistAddress = item;
|
|
235
|
+
emit("selected", prevExistAdd, item, copyExistAdd);
|
|
236
|
+
handClose();
|
|
237
|
+
};
|
|
238
|
+
const initAddress = () => {
|
|
239
|
+
for (let i = 0; i < tabName.value.length; i++) {
|
|
240
|
+
selectedRegion[tabName.value[i]] = {};
|
|
241
|
+
}
|
|
242
|
+
tabIndex.value = 0;
|
|
243
|
+
lineAnimation();
|
|
244
|
+
};
|
|
245
|
+
const close = () => {
|
|
246
|
+
const resCopy = Object.assign({
|
|
247
|
+
addressIdStr: "",
|
|
248
|
+
addressStr: ""
|
|
249
|
+
}, selectedRegion);
|
|
250
|
+
const res = {
|
|
251
|
+
data: {},
|
|
252
|
+
type: privateType.value
|
|
253
|
+
};
|
|
254
|
+
if (privateType.value == "custom" || privateType.value == "custom2") {
|
|
255
|
+
const { province, city, country, town } = resCopy;
|
|
256
|
+
resCopy.addressIdStr = [
|
|
257
|
+
province.id || 0,
|
|
258
|
+
city.id || 0,
|
|
259
|
+
country.id || 0,
|
|
260
|
+
town.id || 0
|
|
261
|
+
].join("_");
|
|
262
|
+
resCopy.addressStr = [
|
|
263
|
+
province.name,
|
|
264
|
+
city.name,
|
|
265
|
+
country.name,
|
|
266
|
+
town.name
|
|
267
|
+
].join("");
|
|
268
|
+
res.data = resCopy;
|
|
269
|
+
} else {
|
|
270
|
+
res.data = selectedExistAddress;
|
|
271
|
+
}
|
|
272
|
+
initAddress();
|
|
273
|
+
if (closeWay.value == "self") {
|
|
274
|
+
emit("close", res);
|
|
275
|
+
} else {
|
|
276
|
+
emit("close-mask", { closeWay });
|
|
277
|
+
}
|
|
278
|
+
emit("update:visible", false);
|
|
279
|
+
};
|
|
280
|
+
const switchModule = () => {
|
|
281
|
+
if (privateType.value == "exist") {
|
|
282
|
+
privateType.value = "custom";
|
|
283
|
+
} else {
|
|
284
|
+
privateType.value = "exist";
|
|
285
|
+
}
|
|
286
|
+
initAddress();
|
|
287
|
+
emit("switch-module", { type: privateType.value });
|
|
288
|
+
};
|
|
289
|
+
const handleElevatorItem = (key, item) => {
|
|
290
|
+
nextAreaList(item);
|
|
291
|
+
};
|
|
292
|
+
watch(() => props.visible, (value) => {
|
|
293
|
+
showPopup.value = value;
|
|
294
|
+
});
|
|
295
|
+
watch(() => showPopup.value, (value) => {
|
|
296
|
+
if (value == false) {
|
|
297
|
+
close();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
watch(() => props.province, (value) => {
|
|
301
|
+
regionList.province = isCustom2.value ? transformData(value) : value;
|
|
302
|
+
});
|
|
303
|
+
watch(() => props.city, (value) => {
|
|
304
|
+
regionList.city = isCustom2.value ? transformData(value) : value;
|
|
305
|
+
});
|
|
306
|
+
watch(() => props.country, (value) => {
|
|
307
|
+
regionList.country = isCustom2.value ? transformData(value) : value;
|
|
308
|
+
});
|
|
309
|
+
watch(() => props.town, (value) => {
|
|
310
|
+
regionList.town = isCustom2.value ? transformData(value) : value;
|
|
311
|
+
});
|
|
312
|
+
watch(() => props.existAddress, (value) => {
|
|
313
|
+
value.forEach((item, index2) => {
|
|
314
|
+
if (item.selectedAddress) {
|
|
315
|
+
selectedExistAddress = item;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
return __spreadValues(__spreadValues({
|
|
320
|
+
showPopup,
|
|
321
|
+
privateType,
|
|
322
|
+
tabIndex,
|
|
323
|
+
tabName,
|
|
324
|
+
regionList,
|
|
325
|
+
selectedRegion,
|
|
326
|
+
selectedExistAddress,
|
|
327
|
+
switchModule,
|
|
328
|
+
closeWay,
|
|
329
|
+
close,
|
|
330
|
+
getTabName,
|
|
331
|
+
nextAreaList,
|
|
332
|
+
regionLine,
|
|
333
|
+
lineDistance,
|
|
334
|
+
changeRegionTab,
|
|
335
|
+
selectedExist,
|
|
336
|
+
clickOverlay,
|
|
337
|
+
handClose,
|
|
338
|
+
handleElevatorItem
|
|
339
|
+
}, toRefs(props)), toRefs(tabItemRef));
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
const _hoisted_1 = { class: "nut-address" };
|
|
343
|
+
const _hoisted_2 = { class: "nut-address__header" };
|
|
344
|
+
const _hoisted_3 = { class: "nut-address__header__title" };
|
|
345
|
+
const _hoisted_4 = {
|
|
346
|
+
key: 0,
|
|
347
|
+
class: "custom-address"
|
|
348
|
+
};
|
|
349
|
+
const _hoisted_5 = { class: "region-tab" };
|
|
350
|
+
const _hoisted_6 = ["onClick"];
|
|
351
|
+
const _hoisted_7 = { class: "region-con" };
|
|
352
|
+
const _hoisted_8 = { class: "region-group" };
|
|
353
|
+
const _hoisted_9 = ["onClick"];
|
|
354
|
+
const _hoisted_10 = {
|
|
355
|
+
key: 1,
|
|
356
|
+
class: "custom-address"
|
|
357
|
+
};
|
|
358
|
+
const _hoisted_11 = { class: "region-tab" };
|
|
359
|
+
const _hoisted_12 = ["onClick"];
|
|
360
|
+
const _hoisted_13 = { class: "elevator-group" };
|
|
361
|
+
const _hoisted_14 = {
|
|
362
|
+
key: 2,
|
|
363
|
+
class: "exist-address"
|
|
364
|
+
};
|
|
365
|
+
const _hoisted_15 = { class: "exist-address-group" };
|
|
366
|
+
const _hoisted_16 = { class: "exist-ul" };
|
|
367
|
+
const _hoisted_17 = ["onClick"];
|
|
368
|
+
const _hoisted_18 = { class: "exist-item-info" };
|
|
369
|
+
const _hoisted_19 = {
|
|
370
|
+
key: 0,
|
|
371
|
+
class: "exist-item-info-top"
|
|
372
|
+
};
|
|
373
|
+
const _hoisted_20 = { class: "exist-item-info-name" };
|
|
374
|
+
const _hoisted_21 = { class: "exist-item-info-phone" };
|
|
375
|
+
const _hoisted_22 = { class: "exist-item-info-bottom" };
|
|
376
|
+
const _hoisted_23 = { class: "btn" };
|
|
377
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
378
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
379
|
+
const _component_nut_elevator = resolveComponent("nut-elevator");
|
|
380
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
381
|
+
return openBlock(), createBlock(_component_nut_popup, {
|
|
382
|
+
position: "bottom",
|
|
383
|
+
onClose: _ctx.close,
|
|
384
|
+
onClickOverlay: _ctx.clickOverlay,
|
|
385
|
+
onOpen: _cache[3] || (_cache[3] = ($event) => _ctx.closeWay = "self"),
|
|
386
|
+
visible: _ctx.showPopup,
|
|
387
|
+
"onUpdate:visible": _cache[4] || (_cache[4] = ($event) => _ctx.showPopup = $event)
|
|
388
|
+
}, {
|
|
389
|
+
default: withCtx(() => [
|
|
390
|
+
createElementVNode("view", _hoisted_1, [
|
|
391
|
+
createElementVNode("view", _hoisted_2, [
|
|
392
|
+
createElementVNode("view", {
|
|
393
|
+
class: "arrow-back",
|
|
394
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.switchModule && _ctx.switchModule(...args))
|
|
395
|
+
}, [
|
|
396
|
+
withDirectives(createVNode(_component_nut_icon, {
|
|
397
|
+
name: _ctx.backBtnIcon,
|
|
398
|
+
color: "#cccccc"
|
|
399
|
+
}, null, 8, ["name"]), [
|
|
400
|
+
[vShow, _ctx.privateType == "custom" && _ctx.backBtnIcon]
|
|
401
|
+
])
|
|
402
|
+
]),
|
|
403
|
+
createElementVNode("view", _hoisted_3, toDisplayString(_ctx.privateType == "custom" ? _ctx.customAddressTitle : _ctx.existAddressTitle), 1),
|
|
404
|
+
createElementVNode("view", {
|
|
405
|
+
class: "arrow-close",
|
|
406
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handClose("cross"))
|
|
407
|
+
}, [
|
|
408
|
+
_ctx.closeBtnIcon ? (openBlock(), createBlock(_component_nut_icon, {
|
|
409
|
+
key: 0,
|
|
410
|
+
name: _ctx.closeBtnIcon,
|
|
411
|
+
color: "#cccccc",
|
|
412
|
+
size: "18px"
|
|
413
|
+
}, null, 8, ["name"])) : createCommentVNode("", true)
|
|
414
|
+
])
|
|
415
|
+
]),
|
|
416
|
+
_ctx.privateType == "custom" ? (openBlock(), createElementBlock("view", _hoisted_4, [
|
|
417
|
+
createElementVNode("view", _hoisted_5, [
|
|
418
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index2) => {
|
|
419
|
+
return openBlock(), createElementBlock("view", {
|
|
420
|
+
class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
|
|
421
|
+
key: index2,
|
|
422
|
+
ref: key,
|
|
423
|
+
onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
|
|
424
|
+
}, [
|
|
425
|
+
createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index2)), 1)
|
|
426
|
+
], 10, _hoisted_6);
|
|
427
|
+
}), 128)),
|
|
428
|
+
createElementVNode("view", {
|
|
429
|
+
class: "region-tab-line",
|
|
430
|
+
ref: "regionLine",
|
|
431
|
+
style: normalizeStyle({ left: _ctx.lineDistance + "px" })
|
|
432
|
+
}, null, 4)
|
|
433
|
+
]),
|
|
434
|
+
createElementVNode("view", _hoisted_7, [
|
|
435
|
+
createElementVNode("ul", _hoisted_8, [
|
|
436
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.regionList[_ctx.tabName[_ctx.tabIndex]], (item, index2) => {
|
|
437
|
+
return openBlock(), createElementBlock("li", {
|
|
438
|
+
key: index2,
|
|
439
|
+
class: normalizeClass(["region-item", [
|
|
440
|
+
_ctx.selectedRegion[_ctx.tabName[_ctx.tabIndex]].id == item.id ? "active" : ""
|
|
441
|
+
]]),
|
|
442
|
+
onClick: ($event) => _ctx.nextAreaList(item)
|
|
443
|
+
}, [
|
|
444
|
+
_ctx.selectedRegion[_ctx.tabName[_ctx.tabIndex]].id == item.id ? (openBlock(), createBlock(_component_nut_icon, {
|
|
445
|
+
key: 0,
|
|
446
|
+
class: "region-item-icon",
|
|
447
|
+
type: "self",
|
|
448
|
+
name: _ctx.selectedIcon,
|
|
449
|
+
color: "#FA2C19",
|
|
450
|
+
size: "13px"
|
|
451
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
452
|
+
createTextVNode(toDisplayString(item.name), 1)
|
|
453
|
+
], 10, _hoisted_9);
|
|
454
|
+
}), 128))
|
|
455
|
+
])
|
|
456
|
+
])
|
|
457
|
+
])) : _ctx.privateType == "custom2" ? (openBlock(), createElementBlock("view", _hoisted_10, [
|
|
458
|
+
createElementVNode("view", _hoisted_11, [
|
|
459
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index2) => {
|
|
460
|
+
return openBlock(), createElementBlock("view", {
|
|
461
|
+
class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
|
|
462
|
+
key: index2,
|
|
463
|
+
ref: key,
|
|
464
|
+
onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
|
|
465
|
+
}, [
|
|
466
|
+
createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index2)), 1)
|
|
467
|
+
], 10, _hoisted_12);
|
|
468
|
+
}), 128)),
|
|
469
|
+
createElementVNode("view", {
|
|
470
|
+
class: "region-tab-line",
|
|
471
|
+
ref: "regionLine",
|
|
472
|
+
style: normalizeStyle({ left: _ctx.lineDistance + "px" })
|
|
473
|
+
}, null, 4)
|
|
474
|
+
]),
|
|
475
|
+
createElementVNode("view", _hoisted_13, [
|
|
476
|
+
createVNode(_component_nut_elevator, {
|
|
477
|
+
height: _ctx.height,
|
|
478
|
+
"index-list": _ctx.regionList[_ctx.tabName[_ctx.tabIndex]],
|
|
479
|
+
onClickItem: _ctx.handleElevatorItem
|
|
480
|
+
}, null, 8, ["height", "index-list", "onClickItem"])
|
|
481
|
+
])
|
|
482
|
+
])) : _ctx.privateType == "exist" ? (openBlock(), createElementBlock("view", _hoisted_14, [
|
|
483
|
+
createElementVNode("div", _hoisted_15, [
|
|
484
|
+
createElementVNode("ul", _hoisted_16, [
|
|
485
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.existAddress, (item, index2) => {
|
|
486
|
+
return openBlock(), createElementBlock("li", {
|
|
487
|
+
class: normalizeClass(["exist-item", [item.selectedAddress ? "active" : ""]]),
|
|
488
|
+
key: index2,
|
|
489
|
+
onClick: ($event) => _ctx.selectedExist(item)
|
|
490
|
+
}, [
|
|
491
|
+
createVNode(_component_nut_icon, {
|
|
492
|
+
class: "exist-item-icon",
|
|
493
|
+
type: "self",
|
|
494
|
+
name: item.selectedAddress ? _ctx.selectedIcon : _ctx.defaultIcon,
|
|
495
|
+
color: item.selectedAddress ? "#FA2C19" : "",
|
|
496
|
+
size: "13px"
|
|
497
|
+
}, null, 8, ["name", "color"]),
|
|
498
|
+
createElementVNode("div", _hoisted_18, [
|
|
499
|
+
item.name && item.phone ? (openBlock(), createElementBlock("div", _hoisted_19, [
|
|
500
|
+
createElementVNode("div", _hoisted_20, toDisplayString(item.name), 1),
|
|
501
|
+
createElementVNode("div", _hoisted_21, toDisplayString(item.phone), 1)
|
|
502
|
+
])) : createCommentVNode("", true),
|
|
503
|
+
createElementVNode("div", _hoisted_22, [
|
|
504
|
+
createElementVNode("view", null, toDisplayString(item.provinceName + item.cityName + item.countyName + item.townName + item.addressDetail), 1)
|
|
505
|
+
])
|
|
506
|
+
])
|
|
507
|
+
], 10, _hoisted_17);
|
|
508
|
+
}), 128))
|
|
509
|
+
])
|
|
510
|
+
]),
|
|
511
|
+
_ctx.isShowCustomAddress ? (openBlock(), createElementBlock("div", {
|
|
512
|
+
key: 0,
|
|
513
|
+
class: "choose-other",
|
|
514
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.switchModule && _ctx.switchModule(...args))
|
|
515
|
+
}, [
|
|
516
|
+
createElementVNode("div", _hoisted_23, toDisplayString(_ctx.customAndExistTitle), 1)
|
|
517
|
+
])) : createCommentVNode("", true)
|
|
518
|
+
])) : createCommentVNode("", true)
|
|
519
|
+
])
|
|
520
|
+
]),
|
|
521
|
+
_: 1
|
|
522
|
+
}, 8, ["onClose", "onClickOverlay", "visible"]);
|
|
523
|
+
}
|
|
524
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
525
|
+
export { index as default };
|