@nutui/nutui 3.1.22-beta.5 → 3.1.23-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.
Files changed (168) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +20412 -4214
  4. package/dist/nutui.umd.js +20518 -4216
  5. package/dist/packages/_es/ActionSheet.js +149 -17
  6. package/dist/packages/_es/Address.js +535 -110
  7. package/dist/packages/_es/AddressList.js +615 -113
  8. package/dist/packages/_es/Animate.js +59 -17
  9. package/dist/packages/_es/Audio.js +257 -53
  10. package/dist/packages/_es/AudioOperate.js +100 -13
  11. package/dist/packages/_es/Avatar.js +162 -38
  12. package/dist/packages/_es/AvatarGroup.js +73 -14
  13. package/dist/packages/_es/BackTop.js +156 -43
  14. package/dist/packages/_es/Badge.js +86 -14
  15. package/dist/packages/_es/Barrage.js +120 -41
  16. package/dist/packages/_es/Button.js +128 -23
  17. package/dist/packages/_es/Calendar.js +246 -30
  18. package/dist/packages/_es/CalendarItem.js +1 -1
  19. package/dist/packages/_es/Card.js +107 -10
  20. package/dist/packages/_es/Cascader.js +496 -147
  21. package/dist/packages/_es/Category.js +58 -15
  22. package/dist/packages/_es/CategoryPane.js +111 -11
  23. package/dist/packages/_es/Cell.js +108 -21
  24. package/dist/packages/_es/CellGroup.js +44 -9
  25. package/dist/packages/_es/Checkbox.js +134 -29
  26. package/dist/packages/_es/CheckboxGroup.js +79 -29
  27. package/dist/packages/_es/CircleProgress.js +150 -28
  28. package/dist/packages/_es/Col.js +56 -14
  29. package/dist/packages/_es/Collapse.js +109 -32
  30. package/dist/packages/_es/CollapseItem.js +253 -59
  31. package/dist/packages/_es/Comment.js +434 -64
  32. package/dist/packages/_es/ConfigProvider.js +20 -8
  33. package/dist/packages/_es/CountDown.js +238 -56
  34. package/dist/packages/_es/CountUp.js +539 -140
  35. package/dist/packages/_es/DatePicker.js +315 -98
  36. package/dist/packages/_es/Dialog.js +289 -60
  37. package/dist/packages/_es/Divider.js +65 -13
  38. package/dist/packages/_es/Drag.js +197 -56
  39. package/dist/packages/_es/Ecard.js +159 -24
  40. package/dist/packages/_es/Elevator.js +255 -58
  41. package/dist/packages/_es/Ellipsis.js +200 -58
  42. package/dist/packages/_es/Empty.js +71 -12
  43. package/dist/packages/_es/FixedNav.js +122 -15
  44. package/dist/packages/_es/Form.js +151 -64
  45. package/dist/packages/_es/FormItem.js +114 -15
  46. package/dist/packages/_es/Grid.js +6 -5
  47. package/dist/packages/_es/GridItem.js +144 -33
  48. package/dist/packages/_es/Icon.js +40 -15
  49. package/dist/packages/_es/Image.js +137 -26
  50. package/dist/packages/_es/ImagePreview.js +547 -76
  51. package/dist/packages/_es/Indicator.js +62 -15
  52. package/dist/packages/_es/InfiniteLoading.js +249 -57
  53. package/dist/packages/_es/Input.js +433 -51
  54. package/dist/packages/_es/InputNumber.js +160 -41
  55. package/dist/packages/_es/Layout.js +5 -4
  56. package/dist/packages/_es/List.js +106 -18
  57. package/dist/packages/_es/Menu.js +168 -44
  58. package/dist/packages/_es/MenuItem.js +173 -37
  59. package/dist/packages/_es/Navbar.js +192 -30
  60. package/dist/packages/_es/NoticeBar.js +380 -74
  61. package/dist/packages/_es/Notify.js +227 -72
  62. package/dist/packages/_es/NumberKeyboard.js +272 -41
  63. package/dist/packages/_es/OldPicker.js +457 -130
  64. package/dist/packages/_es/OverLay.js +98 -24
  65. package/dist/packages/_es/Pagination.js +157 -39
  66. package/dist/packages/_es/Picker.js +454 -129
  67. package/dist/packages/_es/Popover.js +957 -318
  68. package/dist/packages/_es/Popup.js +299 -55
  69. package/dist/packages/_es/Price.js +118 -16
  70. package/dist/packages/_es/Progress.js +146 -14
  71. package/dist/packages/_es/PullRefresh.js +339 -84
  72. package/dist/packages/_es/Radio.js +90 -22
  73. package/dist/packages/_es/RadioGroup.js +37 -8
  74. package/dist/packages/_es/Range.js +408 -83
  75. package/dist/packages/_es/Rate.js +192 -36
  76. package/dist/packages/_es/Row.js +64 -22
  77. package/dist/packages/_es/SearchBar.js +238 -37
  78. package/dist/packages/_es/ShortPassword.js +225 -35
  79. package/dist/packages/_es/SideNavBar.js +81 -24
  80. package/dist/packages/_es/SideNavBarItem.js +46 -11
  81. package/dist/packages/_es/Signature.js +160 -41
  82. package/dist/packages/_es/Skeleton.js +136 -20
  83. package/dist/packages/_es/Sku.js +491 -84
  84. package/dist/packages/_es/Step.js +115 -20
  85. package/dist/packages/_es/Steps.js +53 -18
  86. package/dist/packages/_es/Sticky.js +138 -53
  87. package/dist/packages/_es/SubSideNavBar.js +82 -17
  88. package/dist/packages/_es/Swipe.js +178 -41
  89. package/dist/packages/_es/Swiper.js +433 -121
  90. package/dist/packages/_es/SwiperItem.js +53 -22
  91. package/dist/packages/_es/Switch.js +116 -21
  92. package/dist/packages/_es/TabPane.js +39 -12
  93. package/dist/packages/_es/Tabbar.js +72 -17
  94. package/dist/packages/_es/TabbarItem.js +151 -29
  95. package/dist/packages/_es/Table.js +178 -18
  96. package/dist/packages/_es/Tabs.js +202 -43
  97. package/dist/packages/_es/Tag.js +97 -20
  98. package/dist/packages/_es/TextArea.js +160 -42
  99. package/dist/packages/_es/TimeDetail.js +79 -18
  100. package/dist/packages/_es/TimePannel.js +48 -14
  101. package/dist/packages/_es/TimeSelect.js +112 -15
  102. package/dist/packages/_es/Toast.js +310 -71
  103. package/dist/packages/_es/Uploader.js +455 -104
  104. package/dist/packages/_es/Video.js +332 -74
  105. package/dist/packages/_es/common.js +128 -38
  106. package/dist/packages/_es/component.js +76 -35
  107. package/dist/packages/_es/index.js +6 -5
  108. package/dist/packages/_es/index2.js +30 -9
  109. package/dist/packages/_es/index3.js +8 -6
  110. package/dist/packages/_es/index4.js +64 -13
  111. package/dist/packages/_es/index5.js +780 -164
  112. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  113. package/dist/packages/_es/pxCheck.js +5 -3
  114. package/dist/packages/_es/raf.js +15 -8
  115. package/dist/packages/imagepreview/index.scss +6 -1
  116. package/dist/packages/locale/lang/baseLang.js +3 -3
  117. package/dist/packages/locale/lang/en-US.js +105 -5
  118. package/dist/packages/locale/lang/id-ID.js +105 -5
  119. package/dist/packages/locale/lang/index.js +38 -16
  120. package/dist/packages/locale/lang/zh-CN.js +105 -5
  121. package/dist/packages/locale/lang/zh-TW.js +105 -5
  122. package/dist/packages/picker/index.scss +13 -0
  123. package/dist/smartips/attributes.json +8 -0
  124. package/dist/smartips/tags.json +3 -1
  125. package/dist/smartips/web-types.json +19 -1
  126. package/dist/style.css +1 -1
  127. package/dist/style.es.js +1 -1
  128. package/dist/styles/themes/default.scss +49 -49
  129. package/dist/styles/themes/jdb.scss +49 -49
  130. package/dist/styles/themes/jdt.scss +49 -49
  131. package/dist/styles/variables-jdb.scss +4 -1
  132. package/dist/styles/variables-jdt.scss +4 -1
  133. package/dist/styles/variables.scss +1 -1
  134. package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
  135. package/dist/types/__VUE/address/index.vue.d.ts +4 -4
  136. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  137. package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
  138. package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  142. package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
  143. package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
  144. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
  146. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  147. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  148. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  149. package/dist/types/__VUE/input/index.vue.d.ts +2 -2
  150. package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
  151. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  153. package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
  154. package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
  155. package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
  156. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  157. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  158. package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
  159. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
  162. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  164. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  165. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
  167. package/dist/types/index.d.ts +1 -1
  168. package/package.json +1 -2
@@ -1,126 +1,551 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref as e, computed as t, reactive as l, onMounted as s, watch as a, toRefs as i, nextTick as o, resolveComponent as n, openBlock as c, createBlock as r, withCtx as u, createElementVNode as d, withDirectives as v, createVNode as p, vShow as m, toDisplayString as y, createCommentVNode as f, createElementBlock as g, Fragment as h, renderList as b, normalizeClass as x, normalizeStyle as w, createTextVNode as k } from "vue";
7
- import { c as A } from "./component.js";
8
- import { popupProps as I } from "./Popup.js";
9
- import { _ as C } from "./plugin-vue_export-helper.js";
6
+ import { ref, computed, reactive, onMounted, watch, toRefs, nextTick, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, withDirectives, createVNode, vShow, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle, createTextVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { popupProps } from "./Popup.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
11
  import "./OverLay.js";
12
12
  import "./Icon.js";
13
13
  import "./pxCheck.js";
14
- const { componentName: T, create: S, translate: N } = A("address"), E = S({ inheritAttrs: false, props: { ...I, modelValue: { type: Array, default: () => [] }, type: { type: String, default: "custom" }, customAddressTitle: { type: String, default: "" }, province: { type: Array, default: () => [] }, city: { type: Array, default: () => [] }, country: { type: Array, default: () => [] }, town: { type: Array, default: () => [] }, isShowCustomAddress: { type: Boolean, default: true }, existAddress: { type: Array, default: () => [] }, existAddressTitle: { type: String, default: "" }, customAndExistTitle: { type: String, default: "" }, defaultIcon: { type: String, default: "location2" }, selectedIcon: { type: String, default: "Check" }, closeBtnIcon: { type: String, default: "circle-close" }, backBtnIcon: { type: String, default: "left" }, height: { type: [String, Number], default: "200px" }, columnsPlaceholder: { type: [String, Array], default: "" } }, emits: ["update:visible", "update:modelValue", "type", "change", "selected", "close", "close-mask", "switch-module"], setup(n2, { emit: c2 }) {
15
- const r2 = e(null), u2 = e(null), d2 = e(n2.visible), v2 = e(n2.type), p2 = e(0), m2 = e(["province", "city", "country", "town"]), y2 = e([""]), f2 = t(() => n2.type === "custom2"), g2 = (e2) => {
16
- if (!Array.isArray(e2))
17
- throw new TypeError("params muse be array.");
18
- if (!e2.length)
19
- return [];
20
- e2.forEach((e3) => {
21
- e3.title;
14
+ const { componentName, create, translate } = createComponent("address");
15
+ const _sfc_main = create({
16
+ inheritAttrs: false,
17
+ props: {
18
+ ...popupProps,
19
+ modelValue: {
20
+ type: Array,
21
+ default: () => []
22
+ },
23
+ type: {
24
+ type: String,
25
+ default: "custom"
26
+ },
27
+ customAddressTitle: {
28
+ type: String,
29
+ default: ""
30
+ },
31
+ province: {
32
+ type: Array,
33
+ default: () => []
34
+ },
35
+ city: {
36
+ type: Array,
37
+ default: () => []
38
+ },
39
+ country: {
40
+ type: Array,
41
+ default: () => []
42
+ },
43
+ town: {
44
+ type: Array,
45
+ default: () => []
46
+ },
47
+ isShowCustomAddress: {
48
+ type: Boolean,
49
+ default: true
50
+ },
51
+ existAddress: {
52
+ type: Array,
53
+ default: () => []
54
+ },
55
+ existAddressTitle: {
56
+ type: String,
57
+ default: ""
58
+ },
59
+ customAndExistTitle: {
60
+ type: String,
61
+ default: ""
62
+ },
63
+ defaultIcon: {
64
+ type: String,
65
+ default: "location2"
66
+ },
67
+ selectedIcon: {
68
+ type: String,
69
+ default: "Check"
70
+ },
71
+ closeBtnIcon: {
72
+ type: String,
73
+ default: "circle-close"
74
+ },
75
+ backBtnIcon: {
76
+ type: String,
77
+ default: "left"
78
+ },
79
+ height: {
80
+ type: [String, Number],
81
+ default: "200px"
82
+ },
83
+ columnsPlaceholder: {
84
+ type: [String, Array],
85
+ default: ""
86
+ }
87
+ },
88
+ emits: ["update:visible", "update:modelValue", "type", "change", "selected", "close", "close-mask", "switch-module"],
89
+ setup(props, { emit }) {
90
+ const regionLine = ref(null);
91
+ const tabRegion = ref(null);
92
+ const showPopup = ref(props.visible);
93
+ const privateType = ref(props.type);
94
+ const tabIndex = ref(0);
95
+ const tabName = ref(["province", "city", "country", "town"]);
96
+ const tabNameDefault = ref([""]);
97
+ const isCustom2 = computed(() => props.type === "custom2");
98
+ const transformData = (data) => {
99
+ if (!Array.isArray(data))
100
+ throw new TypeError("params muse be array.");
101
+ if (!data.length)
102
+ return [];
103
+ data.forEach((item) => {
104
+ if (!item.title) {
105
+ console.error("[NutUI] <Address> \u8BF7\u68C0\u67E5\u6570\u7EC4\u9009\u9879\u7684 title \u503C\u662F\u5426\u6709\u8BBE\u7F6E ,title \u4E3A\u5FC5\u586B\u9879 .");
106
+ return;
107
+ }
108
+ });
109
+ const newData = [];
110
+ data = data.sort((a, b) => {
111
+ return a.title.localeCompare(b.title);
112
+ });
113
+ data.forEach((item) => {
114
+ const index2 = newData.findIndex((value) => value.title === item.title);
115
+ if (index2 <= -1) {
116
+ newData.push({
117
+ title: item.title,
118
+ list: [].concat(item)
119
+ });
120
+ } else {
121
+ newData[index2] = {
122
+ title: item.title,
123
+ list: newData[index2].list.concat(item)
124
+ };
125
+ }
126
+ });
127
+ return newData;
128
+ };
129
+ const regionList = reactive({
130
+ province: isCustom2.value ? transformData(props.province) : props.province,
131
+ city: isCustom2.value ? transformData(props.city) : props.city,
132
+ country: isCustom2.value ? transformData(props.country) : props.country,
133
+ town: isCustom2.value ? transformData(props.town) : props.town
22
134
  });
23
- const t2 = [];
24
- return (e2 = e2.sort((e3, t3) => e3.title.localeCompare(t3.title))).forEach((e3) => {
25
- const l2 = t2.findIndex((t3) => t3.title === e3.title);
26
- l2 <= -1 ? t2.push({ title: e3.title, list: [].concat(e3) }) : t2[l2] = { title: e3.title, list: t2[l2].list.concat(e3) };
27
- }), t2;
28
- }, h2 = l({ province: f2.value ? g2(n2.province) : n2.province, city: f2.value ? g2(n2.city) : n2.city, country: f2.value ? g2(n2.country) : n2.country, town: f2.value ? g2(n2.town) : n2.town }), b2 = l({ province: {}, city: {}, country: {}, town: {} });
29
- let x2 = l({});
30
- const w2 = e("self"), k2 = e(20);
31
- s(() => {
32
- I2();
33
- });
34
- const A2 = () => {
35
- if (n2.modelValue.length > 0) {
36
- p2.value = n2.modelValue.length - 1;
37
- for (let e2 = 0; e2 < n2.modelValue.length; e2++) {
38
- if (h2[m2.value[e2]].length == 0) {
39
- p2.value = e2 - 1;
40
- break;
135
+ const selectedRegion = reactive({
136
+ province: {},
137
+ city: {},
138
+ country: {},
139
+ town: {}
140
+ });
141
+ let selectedExistAddress = reactive({});
142
+ const closeWay = ref("self");
143
+ const lineDistance = ref(20);
144
+ onMounted(() => {
145
+ customPlaceholder();
146
+ });
147
+ const initCustomSelected = () => {
148
+ if (props.modelValue.length > 0) {
149
+ tabIndex.value = props.modelValue.length - 1;
150
+ for (let index2 = 0; index2 < props.modelValue.length; index2++) {
151
+ if (regionList[tabName.value[index2]].length == 0) {
152
+ tabIndex.value = index2 - 1;
153
+ break;
154
+ } else {
155
+ const val = props.modelValue[index2];
156
+ const arr = regionList[tabName.value[index2]];
157
+ if (privateType.value == "custom") {
158
+ selectedRegion[tabName.value[index2]] = arr.filter((item) => item.id == val)[0];
159
+ } else if (privateType.value == "custom2") {
160
+ let sumArr = [];
161
+ arr.map((item) => {
162
+ sumArr.push(...item.list);
163
+ });
164
+ selectedRegion[tabName.value[index2]] = sumArr.filter((item) => item.id == val)[0];
165
+ }
166
+ }
41
167
  }
42
- {
43
- const t2 = n2.modelValue[e2], l2 = h2[m2.value[e2]];
44
- if (v2.value == "custom")
45
- b2[m2.value[e2]] = l2.filter((e3) => e3.id == t2)[0];
46
- else if (v2.value == "custom2") {
47
- let s2 = [];
48
- l2.map((e3) => {
49
- s2.push(...e3.list);
50
- }), b2[m2.value[e2]] = s2.filter((e3) => e3.id == t2)[0];
168
+ lineAnimation();
169
+ }
170
+ };
171
+ const customPlaceholder = () => {
172
+ let selectStr = translate("select");
173
+ let typeD = Object.prototype.toString.call(props.columnsPlaceholder || selectStr);
174
+ if (typeD == "[object String]") {
175
+ tabNameDefault.value = new Array(4).fill(props.columnsPlaceholder || selectStr);
176
+ } else if (typeD == "[object Array]") {
177
+ tabNameDefault.value = new Array(4).fill("");
178
+ tabNameDefault.value.forEach((val, index2) => {
179
+ if (props.columnsPlaceholder[index2]) {
180
+ tabNameDefault.value[index2] = props.columnsPlaceholder[index2];
181
+ } else {
182
+ tabNameDefault.value[index2] = selectStr;
51
183
  }
184
+ });
185
+ }
186
+ };
187
+ const getTabName = (item, index2) => {
188
+ if (item.name)
189
+ return item.name;
190
+ if (tabIndex.value < index2) {
191
+ return item.name;
192
+ } else {
193
+ return tabNameDefault.value[index2];
194
+ }
195
+ };
196
+ const handClose = (type = "self") => {
197
+ if (!props.closeBtnIcon)
198
+ return;
199
+ closeWay.value = type == "cross" ? "cross" : "self";
200
+ showPopup.value = false;
201
+ };
202
+ const clickOverlay = () => {
203
+ closeWay.value = "mask";
204
+ };
205
+ const lineAnimation = () => {
206
+ nextTick(() => {
207
+ const name = tabRegion.value && tabRegion.value.getElementsByClassName("active")[0];
208
+ if (name) {
209
+ const distance = name.offsetLeft;
210
+ lineDistance.value = distance ? distance : 20;
52
211
  }
212
+ });
213
+ };
214
+ const nextAreaList = (item) => {
215
+ const calBack = {
216
+ next: "",
217
+ value: "",
218
+ custom: tabName.value[tabIndex.value]
219
+ };
220
+ selectedRegion[tabName.value[tabIndex.value]] = item;
221
+ for (let i = tabIndex.value; i < 4; i++) {
222
+ selectedRegion[tabName.value[i + 1]] = {};
53
223
  }
54
- S2();
55
- }
56
- }, I2 = () => {
57
- let e2 = N("select"), t2 = Object.prototype.toString.call(n2.columnsPlaceholder || e2);
58
- t2 == "[object String]" ? y2.value = new Array(4).fill(n2.columnsPlaceholder || e2) : t2 == "[object Array]" && (y2.value = new Array(4).fill(""), y2.value.forEach((t3, l2) => {
59
- n2.columnsPlaceholder[l2] ? y2.value[l2] = n2.columnsPlaceholder[l2] : y2.value[l2] = e2;
60
- }));
61
- }, C2 = (e2, t2) => e2.name || p2.value < t2 ? e2.name : y2.value[t2], T2 = (e2 = "self") => {
62
- n2.closeBtnIcon && (w2.value = e2 == "cross" ? "cross" : "self", d2.value = false);
63
- }, S2 = () => {
64
- o(() => {
65
- const e2 = u2.value && u2.value.getElementsByClassName("active")[0];
66
- if (e2) {
67
- const t2 = e2.offsetLeft;
68
- k2.value = t2 || 20;
224
+ if (tabIndex.value < 3) {
225
+ tabIndex.value = tabIndex.value + 1;
226
+ lineAnimation();
227
+ calBack.next = tabName.value[tabIndex.value];
228
+ calBack.value = item;
229
+ emit("change", calBack);
230
+ } else {
231
+ handClose();
232
+ emit("update:modelValue");
233
+ }
234
+ };
235
+ const changeRegionTab = (item, key, index2) => {
236
+ if (getTabName(item, index2)) {
237
+ tabIndex.value = index2;
238
+ lineAnimation();
239
+ }
240
+ };
241
+ const selectedExist = (item) => {
242
+ const copyExistAdd = props.existAddress;
243
+ let prevExistAdd = {};
244
+ copyExistAdd.forEach((list, index2) => {
245
+ if (list && list.selectedAddress) {
246
+ prevExistAdd = list;
247
+ }
248
+ list.selectedAddress = false;
249
+ });
250
+ item.selectedAddress = true;
251
+ selectedExistAddress = item;
252
+ emit("selected", prevExistAdd, item, copyExistAdd);
253
+ handClose();
254
+ };
255
+ const initAddress = () => {
256
+ for (let i = 0; i < tabName.value.length; i++) {
257
+ selectedRegion[tabName.value[i]] = {};
258
+ }
259
+ tabIndex.value = 0;
260
+ lineAnimation();
261
+ };
262
+ const close = () => {
263
+ const resCopy = Object.assign({
264
+ addressIdStr: "",
265
+ addressStr: ""
266
+ }, selectedRegion);
267
+ const res = {
268
+ data: {},
269
+ type: privateType.value
270
+ };
271
+ if (privateType.value == "custom" || privateType.value == "custom2") {
272
+ const { province, city, country, town } = resCopy;
273
+ resCopy.addressIdStr = [
274
+ province.id || 0,
275
+ city.id || 0,
276
+ country.id || 0,
277
+ town.id || 0
278
+ ].join("_");
279
+ resCopy.addressStr = [
280
+ province.name,
281
+ city.name,
282
+ country.name,
283
+ town.name
284
+ ].join("");
285
+ res.data = resCopy;
286
+ } else {
287
+ res.data = selectedExistAddress;
288
+ }
289
+ initAddress();
290
+ if (closeWay.value == "self") {
291
+ emit("close", res);
292
+ } else {
293
+ emit("close-mask", { closeWay });
294
+ }
295
+ emit("update:visible", false);
296
+ };
297
+ const switchModule = () => {
298
+ if (privateType.value == "exist") {
299
+ privateType.value = "custom";
300
+ } else {
301
+ privateType.value = "exist";
302
+ }
303
+ initAddress();
304
+ emit("switch-module", { type: privateType.value });
305
+ };
306
+ const handleElevatorItem = (key, item) => {
307
+ nextAreaList(item);
308
+ };
309
+ watch(() => props.visible, (value) => {
310
+ showPopup.value = value;
311
+ });
312
+ watch(() => showPopup.value, (value) => {
313
+ if (value == false) {
314
+ close();
315
+ } else {
316
+ initCustomSelected();
69
317
  }
70
318
  });
71
- }, E2 = (e2) => {
72
- const t2 = { next: "", value: "", custom: m2.value[p2.value] };
73
- b2[m2.value[p2.value]] = e2;
74
- for (let e3 = p2.value; e3 < 4; e3++)
75
- b2[m2.value[e3 + 1]] = {};
76
- p2.value < 3 ? (p2.value = p2.value + 1, S2(), t2.next = m2.value[p2.value], t2.value = e2, c2("change", t2)) : (T2(), c2("update:modelValue"));
77
- }, j2 = () => {
78
- for (let e2 = 0; e2 < m2.value.length; e2++)
79
- b2[m2.value[e2]] = {};
80
- p2.value = 0, S2();
81
- }, R2 = () => {
82
- const e2 = Object.assign({ addressIdStr: "", addressStr: "" }, b2), t2 = { data: {}, type: v2.value };
83
- if (v2.value == "custom" || v2.value == "custom2") {
84
- const { province: l2, city: s2, country: a2, town: i2 } = e2;
85
- e2.addressIdStr = [l2.id || 0, s2.id || 0, a2.id || 0, i2.id || 0].join("_"), e2.addressStr = [l2.name, s2.name, a2.name, i2.name].join(""), t2.data = e2;
86
- } else
87
- t2.data = x2;
88
- j2(), w2.value == "self" ? c2("close", t2) : c2("close-mask", { closeWay: w2 }), c2("update:visible", false);
89
- };
90
- return a(() => n2.visible, (e2) => {
91
- d2.value = e2;
92
- }), a(() => d2.value, (e2) => {
93
- e2 == 0 ? R2() : A2();
94
- }), a(() => n2.province, (e2) => {
95
- h2.province = f2.value ? g2(e2) : e2;
96
- }), a(() => n2.city, (e2) => {
97
- h2.city = f2.value ? g2(e2) : e2;
98
- }), a(() => n2.country, (e2) => {
99
- h2.country = f2.value ? g2(e2) : e2;
100
- }), a(() => n2.town, (e2) => {
101
- h2.town = f2.value ? g2(e2) : e2;
102
- }), a(() => n2.existAddress, (e2) => {
103
- e2.forEach((e3, t2) => {
104
- e3.selectedAddress && (x2 = e3);
319
+ watch(() => props.province, (value) => {
320
+ regionList.province = isCustom2.value ? transformData(value) : value;
321
+ });
322
+ watch(() => props.city, (value) => {
323
+ regionList.city = isCustom2.value ? transformData(value) : value;
324
+ });
325
+ watch(() => props.country, (value) => {
326
+ regionList.country = isCustom2.value ? transformData(value) : value;
327
+ });
328
+ watch(() => props.town, (value) => {
329
+ regionList.town = isCustom2.value ? transformData(value) : value;
330
+ });
331
+ watch(() => props.existAddress, (value) => {
332
+ value.forEach((item, index2) => {
333
+ if (item.selectedAddress) {
334
+ selectedExistAddress = item;
335
+ }
336
+ });
105
337
  });
106
- }), { showPopup: d2, privateType: v2, tabIndex: p2, tabName: m2, regionList: h2, selectedRegion: b2, selectedExistAddress: x2, switchModule: () => {
107
- v2.value == "exist" ? v2.value = "custom" : v2.value = "exist", j2(), c2("switch-module", { type: v2.value });
108
- }, closeWay: w2, close: R2, getTabName: C2, nextAreaList: E2, regionLine: r2, tabRegion: u2, lineDistance: k2, changeRegionTab: (e2, t2, l2) => {
109
- C2(e2, l2) && (p2.value = l2, S2());
110
- }, selectedExist: (e2) => {
111
- const t2 = n2.existAddress;
112
- let l2 = {};
113
- t2.forEach((e3, t3) => {
114
- e3 && e3.selectedAddress && (l2 = e3), e3.selectedAddress = false;
115
- }), e2.selectedAddress = true, x2 = e2, c2("selected", l2, e2, t2), T2();
116
- }, clickOverlay: () => {
117
- w2.value = "mask";
118
- }, handClose: T2, handleElevatorItem: (e2, t2) => {
119
- E2(t2);
120
- }, initCustomSelected: A2, ...i(n2), translate: N };
121
- } }), j = { class: "nut-address" }, R = { class: "nut-address__header" }, L = { class: "nut-address__header__title" }, _ = { key: 0, class: "custom-address" }, B = { class: "region-tab", ref: "tabRegion" }, P = ["onClick"], O = { class: "region-con" }, V = { class: "region-group" }, W = ["onClick"], M = { key: 1, class: "custom-address" }, D = { class: "region-tab", ref: "tabRegion" }, z = ["onClick"], U = { class: "elevator-group" }, q = { key: 2, class: "exist-address" }, F = { class: "exist-address-group" }, G = { class: "exist-ul" }, H = ["onClick"], J = { class: "exist-item-info" }, K = { key: 0, class: "exist-item-info-top" }, Q = { class: "exist-item-info-name" }, X = { class: "exist-item-info-phone" }, Y = { class: "exist-item-info-bottom" }, Z = { class: "btn" };
122
- var $ = C(E, [["render", function(e2, t2, l2, s2, a2, i2) {
123
- const o2 = n("nut-icon"), A2 = n("nut-elevator"), I2 = n("nut-popup");
124
- return c(), r(I2, { position: "bottom", "lock-scroll": e2.lockScroll, onClose: e2.close, onClickOverlay: e2.clickOverlay, onOpen: t2[3] || (t2[3] = (t3) => e2.closeWay = "self"), visible: e2.showPopup, "onUpdate:visible": t2[4] || (t2[4] = (t3) => e2.showPopup = t3), isWrapTeleport: e2.isWrapTeleport, teleport: e2.teleport }, { default: u(() => [d("view", j, [d("view", R, [d("view", { class: "arrow-back", onClick: t2[0] || (t2[0] = (...t3) => e2.switchModule && e2.switchModule(...t3)) }, [v(p(o2, { name: e2.backBtnIcon, color: "#cccccc" }, null, 8, ["name"]), [[m, e2.type == "exist" && e2.privateType == "custom" && e2.backBtnIcon]])]), d("view", L, y(e2.privateType == "custom" ? e2.customAddressTitle || e2.translate("selectRegion") : e2.existAddressTitle || e2.translate("deliveryTo")), 1), d("view", { class: "arrow-close", onClick: t2[1] || (t2[1] = (t3) => e2.handClose("cross")) }, [e2.closeBtnIcon ? (c(), r(o2, { key: 0, name: e2.closeBtnIcon, color: "#cccccc", size: "18px" }, null, 8, ["name"])) : f("", true)])]), e2.privateType == "custom" ? (c(), g("view", _, [d("view", B, [(c(true), g(h, null, b(e2.selectedRegion, (t3, l3, s3) => (c(), g("view", { class: x(["tab-item", [s3 == e2.tabIndex ? "active" : ""]]), key: s3, onClick: (a3) => e2.changeRegionTab(t3, l3, s3) }, [d("view", null, y(e2.getTabName(t3, s3)), 1)], 10, P))), 128)), d("view", { class: "region-tab-line", ref: "regionLine", style: w({ left: e2.lineDistance + "px" }) }, null, 4)], 512), d("view", O, [d("ul", V, [(c(true), g(h, null, b(e2.regionList[e2.tabName[e2.tabIndex]], (t3, l3) => (c(), g("li", { key: l3, class: x(["region-item", [e2.selectedRegion[e2.tabName[e2.tabIndex]].id == t3.id ? "active" : ""]]), onClick: (l4) => e2.nextAreaList(t3) }, [e2.selectedRegion[e2.tabName[e2.tabIndex]].id == t3.id ? (c(), r(o2, { key: 0, class: "region-item-icon", type: "self", name: e2.selectedIcon, size: "13px" }, null, 8, ["name"])) : f("", true), k(y(t3.name), 1)], 10, W))), 128))])])])) : e2.privateType == "custom2" ? (c(), g("view", M, [d("view", D, [(c(true), g(h, null, b(e2.selectedRegion, (t3, l3, s3) => (c(), g("view", { class: x(["tab-item", [s3 == e2.tabIndex ? "active" : ""]]), key: s3, onClick: (a3) => e2.changeRegionTab(t3, l3, s3) }, [d("view", null, y(e2.getTabName(t3, s3)), 1)], 10, z))), 128)), d("view", { class: "region-tab-line", ref: "regionLine", style: w({ left: e2.lineDistance + "px" }) }, null, 4)], 512), d("view", U, [p(A2, { height: e2.height, "index-list": e2.regionList[e2.tabName[e2.tabIndex]], onClickItem: e2.handleElevatorItem }, null, 8, ["height", "index-list", "onClickItem"])])])) : e2.privateType == "exist" ? (c(), g("view", q, [d("div", F, [d("ul", G, [(c(true), g(h, null, b(e2.existAddress, (t3, l3) => (c(), g("li", { class: x(["exist-item", [t3.selectedAddress ? "active" : ""]]), key: l3, onClick: (l4) => e2.selectedExist(t3) }, [p(o2, { class: "exist-item-icon", type: "self", name: t3.selectedAddress ? e2.selectedIcon : e2.defaultIcon, size: "13px" }, null, 8, ["name"]), d("div", J, [t3.name && t3.phone ? (c(), g("div", K, [d("div", Q, y(t3.name), 1), d("div", X, y(t3.phone), 1)])) : f("", true), d("div", Y, [d("view", null, y(t3.provinceName + t3.cityName + t3.countyName + t3.townName + t3.addressDetail), 1)])])], 10, H))), 128))])]), e2.isShowCustomAddress ? (c(), g("div", { key: 0, class: "choose-other", onClick: t2[2] || (t2[2] = (...t3) => e2.switchModule && e2.switchModule(...t3)) }, [d("div", Z, y(e2.customAndExistTitle || e2.translate("chooseAnotherAddress")), 1)])) : f("", true)])) : f("", true)])]), _: 1 }, 8, ["lock-scroll", "onClose", "onClickOverlay", "visible", "isWrapTeleport", "teleport"]);
125
- }]]);
126
- export { $ as default };
338
+ return {
339
+ showPopup,
340
+ privateType,
341
+ tabIndex,
342
+ tabName,
343
+ regionList,
344
+ selectedRegion,
345
+ selectedExistAddress,
346
+ switchModule,
347
+ closeWay,
348
+ close,
349
+ getTabName,
350
+ nextAreaList,
351
+ regionLine,
352
+ tabRegion,
353
+ lineDistance,
354
+ changeRegionTab,
355
+ selectedExist,
356
+ clickOverlay,
357
+ handClose,
358
+ handleElevatorItem,
359
+ initCustomSelected,
360
+ ...toRefs(props),
361
+ translate
362
+ };
363
+ }
364
+ });
365
+ const _hoisted_1 = { class: "nut-address" };
366
+ const _hoisted_2 = { class: "nut-address__header" };
367
+ const _hoisted_3 = { class: "nut-address__header__title" };
368
+ const _hoisted_4 = {
369
+ key: 0,
370
+ class: "custom-address"
371
+ };
372
+ const _hoisted_5 = {
373
+ class: "region-tab",
374
+ ref: "tabRegion"
375
+ };
376
+ const _hoisted_6 = ["onClick"];
377
+ const _hoisted_7 = { class: "region-con" };
378
+ const _hoisted_8 = { class: "region-group" };
379
+ const _hoisted_9 = ["onClick"];
380
+ const _hoisted_10 = {
381
+ key: 1,
382
+ class: "custom-address"
383
+ };
384
+ const _hoisted_11 = {
385
+ class: "region-tab",
386
+ ref: "tabRegion"
387
+ };
388
+ const _hoisted_12 = ["onClick"];
389
+ const _hoisted_13 = { class: "elevator-group" };
390
+ const _hoisted_14 = {
391
+ key: 2,
392
+ class: "exist-address"
393
+ };
394
+ const _hoisted_15 = { class: "exist-address-group" };
395
+ const _hoisted_16 = { class: "exist-ul" };
396
+ const _hoisted_17 = ["onClick"];
397
+ const _hoisted_18 = { class: "exist-item-info" };
398
+ const _hoisted_19 = {
399
+ key: 0,
400
+ class: "exist-item-info-top"
401
+ };
402
+ const _hoisted_20 = { class: "exist-item-info-name" };
403
+ const _hoisted_21 = { class: "exist-item-info-phone" };
404
+ const _hoisted_22 = { class: "exist-item-info-bottom" };
405
+ const _hoisted_23 = { class: "btn" };
406
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
407
+ const _component_nut_icon = resolveComponent("nut-icon");
408
+ const _component_nut_elevator = resolveComponent("nut-elevator");
409
+ const _component_nut_popup = resolveComponent("nut-popup");
410
+ return openBlock(), createBlock(_component_nut_popup, {
411
+ position: "bottom",
412
+ "lock-scroll": _ctx.lockScroll,
413
+ onClose: _ctx.close,
414
+ onClickOverlay: _ctx.clickOverlay,
415
+ onOpen: _cache[3] || (_cache[3] = ($event) => _ctx.closeWay = "self"),
416
+ visible: _ctx.showPopup,
417
+ "onUpdate:visible": _cache[4] || (_cache[4] = ($event) => _ctx.showPopup = $event),
418
+ isWrapTeleport: _ctx.isWrapTeleport,
419
+ teleport: _ctx.teleport
420
+ }, {
421
+ default: withCtx(() => [
422
+ createElementVNode("view", _hoisted_1, [
423
+ createElementVNode("view", _hoisted_2, [
424
+ createElementVNode("view", {
425
+ class: "arrow-back",
426
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.switchModule && _ctx.switchModule(...args))
427
+ }, [
428
+ withDirectives(createVNode(_component_nut_icon, {
429
+ name: _ctx.backBtnIcon,
430
+ color: "#cccccc"
431
+ }, null, 8, ["name"]), [
432
+ [vShow, _ctx.type == "exist" && _ctx.privateType == "custom" && _ctx.backBtnIcon]
433
+ ])
434
+ ]),
435
+ createElementVNode("view", _hoisted_3, toDisplayString(_ctx.privateType == "custom" ? _ctx.customAddressTitle || _ctx.translate("selectRegion") : _ctx.existAddressTitle || _ctx.translate("deliveryTo")), 1),
436
+ createElementVNode("view", {
437
+ class: "arrow-close",
438
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handClose("cross"))
439
+ }, [
440
+ _ctx.closeBtnIcon ? (openBlock(), createBlock(_component_nut_icon, {
441
+ key: 0,
442
+ name: _ctx.closeBtnIcon,
443
+ color: "#cccccc",
444
+ size: "18px"
445
+ }, null, 8, ["name"])) : createCommentVNode("", true)
446
+ ])
447
+ ]),
448
+ _ctx.privateType == "custom" ? (openBlock(), createElementBlock("view", _hoisted_4, [
449
+ createElementVNode("view", _hoisted_5, [
450
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index2) => {
451
+ return openBlock(), createElementBlock("view", {
452
+ class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
453
+ key: index2,
454
+ onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
455
+ }, [
456
+ createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index2)), 1)
457
+ ], 10, _hoisted_6);
458
+ }), 128)),
459
+ createElementVNode("view", {
460
+ class: "region-tab-line",
461
+ ref: "regionLine",
462
+ style: normalizeStyle({ left: _ctx.lineDistance + "px" })
463
+ }, null, 4)
464
+ ], 512),
465
+ createElementVNode("view", _hoisted_7, [
466
+ createElementVNode("ul", _hoisted_8, [
467
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.regionList[_ctx.tabName[_ctx.tabIndex]], (item, index2) => {
468
+ return openBlock(), createElementBlock("li", {
469
+ key: index2,
470
+ class: normalizeClass(["region-item", [_ctx.selectedRegion[_ctx.tabName[_ctx.tabIndex]].id == item.id ? "active" : ""]]),
471
+ onClick: ($event) => _ctx.nextAreaList(item)
472
+ }, [
473
+ _ctx.selectedRegion[_ctx.tabName[_ctx.tabIndex]].id == item.id ? (openBlock(), createBlock(_component_nut_icon, {
474
+ key: 0,
475
+ class: "region-item-icon",
476
+ type: "self",
477
+ name: _ctx.selectedIcon,
478
+ size: "13px"
479
+ }, null, 8, ["name"])) : createCommentVNode("", true),
480
+ createTextVNode(toDisplayString(item.name), 1)
481
+ ], 10, _hoisted_9);
482
+ }), 128))
483
+ ])
484
+ ])
485
+ ])) : _ctx.privateType == "custom2" ? (openBlock(), createElementBlock("view", _hoisted_10, [
486
+ createElementVNode("view", _hoisted_11, [
487
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index2) => {
488
+ return openBlock(), createElementBlock("view", {
489
+ class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
490
+ key: index2,
491
+ onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
492
+ }, [
493
+ createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index2)), 1)
494
+ ], 10, _hoisted_12);
495
+ }), 128)),
496
+ createElementVNode("view", {
497
+ class: "region-tab-line",
498
+ ref: "regionLine",
499
+ style: normalizeStyle({ left: _ctx.lineDistance + "px" })
500
+ }, null, 4)
501
+ ], 512),
502
+ createElementVNode("view", _hoisted_13, [
503
+ createVNode(_component_nut_elevator, {
504
+ height: _ctx.height,
505
+ "index-list": _ctx.regionList[_ctx.tabName[_ctx.tabIndex]],
506
+ onClickItem: _ctx.handleElevatorItem
507
+ }, null, 8, ["height", "index-list", "onClickItem"])
508
+ ])
509
+ ])) : _ctx.privateType == "exist" ? (openBlock(), createElementBlock("view", _hoisted_14, [
510
+ createElementVNode("div", _hoisted_15, [
511
+ createElementVNode("ul", _hoisted_16, [
512
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.existAddress, (item, index2) => {
513
+ return openBlock(), createElementBlock("li", {
514
+ class: normalizeClass(["exist-item", [item.selectedAddress ? "active" : ""]]),
515
+ key: index2,
516
+ onClick: ($event) => _ctx.selectedExist(item)
517
+ }, [
518
+ createVNode(_component_nut_icon, {
519
+ class: "exist-item-icon",
520
+ type: "self",
521
+ name: item.selectedAddress ? _ctx.selectedIcon : _ctx.defaultIcon,
522
+ size: "13px"
523
+ }, null, 8, ["name"]),
524
+ createElementVNode("div", _hoisted_18, [
525
+ item.name && item.phone ? (openBlock(), createElementBlock("div", _hoisted_19, [
526
+ createElementVNode("div", _hoisted_20, toDisplayString(item.name), 1),
527
+ createElementVNode("div", _hoisted_21, toDisplayString(item.phone), 1)
528
+ ])) : createCommentVNode("", true),
529
+ createElementVNode("div", _hoisted_22, [
530
+ createElementVNode("view", null, toDisplayString(item.provinceName + item.cityName + item.countyName + item.townName + item.addressDetail), 1)
531
+ ])
532
+ ])
533
+ ], 10, _hoisted_17);
534
+ }), 128))
535
+ ])
536
+ ]),
537
+ _ctx.isShowCustomAddress ? (openBlock(), createElementBlock("div", {
538
+ key: 0,
539
+ class: "choose-other",
540
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.switchModule && _ctx.switchModule(...args))
541
+ }, [
542
+ createElementVNode("div", _hoisted_23, toDisplayString(_ctx.customAndExistTitle || _ctx.translate("chooseAnotherAddress")), 1)
543
+ ])) : createCommentVNode("", true)
544
+ ])) : createCommentVNode("", true)
545
+ ])
546
+ ]),
547
+ _: 1
548
+ }, 8, ["lock-scroll", "onClose", "onClickOverlay", "visible", "isWrapTeleport", "teleport"]);
549
+ }
550
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
551
+ export { index as default };