@nutui/nutui 3.1.12 → 3.1.13-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 (97) hide show
  1. package/README.md +148 -37
  2. package/dist/nutui.d.ts +4 -1
  3. package/dist/nutui.es.js +1348 -560
  4. package/dist/nutui.umd.js +1356 -565
  5. package/dist/packages/_es/ActionSheet.js +1 -1
  6. package/dist/packages/_es/Address.js +3 -1
  7. package/dist/packages/_es/Avatar.js +1 -1
  8. package/dist/packages/_es/BackTop.js +1 -1
  9. package/dist/packages/_es/Badge.js +1 -1
  10. package/dist/packages/_es/Barrage.js +1 -1
  11. package/dist/packages/_es/Button.js +1 -1
  12. package/dist/packages/_es/Calendar.js +1 -1
  13. package/dist/packages/_es/Card.js +1 -1
  14. package/dist/packages/_es/Cascader.js +547 -0
  15. package/dist/packages/_es/Cell.js +1 -1
  16. package/dist/packages/_es/CellGroup.js +1 -1
  17. package/dist/packages/_es/Checkbox.js +1 -1
  18. package/dist/packages/_es/CheckboxGroup.js +1 -1
  19. package/dist/packages/_es/CircleProgress.js +1 -1
  20. package/dist/packages/_es/Col.js +1 -1
  21. package/dist/packages/_es/Collapse.js +1 -1
  22. package/dist/packages/_es/CollapseItem.js +1 -1
  23. package/dist/packages/_es/CountDown.js +2 -2
  24. package/dist/packages/_es/CountUp.js +3 -1
  25. package/dist/packages/_es/DatePicker.js +1 -1
  26. package/dist/packages/_es/Dialog.js +1 -1
  27. package/dist/packages/_es/Divider.js +1 -1
  28. package/dist/packages/_es/Drag.js +1 -1
  29. package/dist/packages/_es/Elevator.js +3 -2
  30. package/dist/packages/_es/FixedNav.js +1 -1
  31. package/dist/packages/_es/Form.js +1 -1
  32. package/dist/packages/_es/FormItem.js +1 -1
  33. package/dist/packages/_es/Grid.js +12 -0
  34. package/dist/packages/_es/GridItem.js +149 -0
  35. package/dist/packages/_es/Icon.js +1 -1
  36. package/dist/packages/_es/ImagePreview.js +1 -1
  37. package/dist/packages/_es/InfiniteLoading.js +1 -1
  38. package/dist/packages/_es/Input.js +1 -1
  39. package/dist/packages/_es/InputNumber.js +1 -1
  40. package/dist/packages/_es/Layout.js +1 -1
  41. package/dist/packages/_es/Menu.js +1 -1
  42. package/dist/packages/_es/MenuItem.js +1 -1
  43. package/dist/packages/_es/Navbar.js +1 -1
  44. package/dist/packages/_es/NoticeBar.js +6 -8
  45. package/dist/packages/_es/Notify.js +1 -1
  46. package/dist/packages/_es/NumberKeyboard.js +1 -1
  47. package/dist/packages/_es/OverLay.js +1 -1
  48. package/dist/packages/_es/Pagination.js +1 -1
  49. package/dist/packages/_es/Picker.js +1 -1
  50. package/dist/packages/_es/Popover.js +1 -1
  51. package/dist/packages/_es/Popup.js +1 -1
  52. package/dist/packages/_es/Price.js +1 -1
  53. package/dist/packages/_es/Progress.js +1 -1
  54. package/dist/packages/_es/Radio.js +1 -1
  55. package/dist/packages/_es/RadioGroup.js +1 -1
  56. package/dist/packages/_es/Range.js +1 -1
  57. package/dist/packages/_es/Rate.js +1 -1
  58. package/dist/packages/_es/Row.js +1 -1
  59. package/dist/packages/_es/SearchBar.js +1 -1
  60. package/dist/packages/_es/ShortPassword.js +1 -1
  61. package/dist/packages/_es/Signature.js +1 -1
  62. package/dist/packages/_es/Sku.js +1 -1
  63. package/dist/packages/_es/Step.js +1 -1
  64. package/dist/packages/_es/Steps.js +1 -1
  65. package/dist/packages/_es/Swipe.js +1 -1
  66. package/dist/packages/_es/Swiper.js +1 -1
  67. package/dist/packages/_es/SwiperItem.js +1 -1
  68. package/dist/packages/_es/Switch.js +1 -1
  69. package/dist/packages/_es/TabPane.js +1 -1
  70. package/dist/packages/_es/Tabbar.js +1 -1
  71. package/dist/packages/_es/TabbarItem.js +1 -1
  72. package/dist/packages/_es/Tabs.js +6 -2
  73. package/dist/packages/_es/Tag.js +1 -1
  74. package/dist/packages/_es/TextArea.js +1 -1
  75. package/dist/packages/_es/TimeDetail.js +1 -1
  76. package/dist/packages/_es/TimePannel.js +1 -1
  77. package/dist/packages/_es/TimeSelect.js +1 -1
  78. package/dist/packages/_es/Toast.js +1 -1
  79. package/dist/packages/_es/Uploader.js +1 -1
  80. package/dist/packages/_es/Video.js +1 -1
  81. package/dist/packages/_es/common.js +136 -0
  82. package/dist/packages/_es/component.js +1 -1
  83. package/dist/packages/_es/index.js +1 -1
  84. package/dist/packages/_es/index2.js +1 -1
  85. package/dist/packages/_es/index3.js +1 -1
  86. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  87. package/dist/packages/_es/pxCheck.js +1 -1
  88. package/dist/packages/_es/raf.js +1 -1
  89. package/dist/packages/_es/util.js +1 -1
  90. package/dist/packages/cascader/index.scss +81 -0
  91. package/dist/packages/grid/index.scss +10 -0
  92. package/dist/packages/griditem/index.scss +92 -0
  93. package/dist/packages/tabs/index.scss +16 -0
  94. package/dist/style.css +1 -1
  95. package/dist/styles/themes/default.scss +41 -38
  96. package/dist/styles/variables.scss +26 -0
  97. package/package.json +2 -3
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  /*!
18
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
18
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
19
19
  * (c) 2021 @jdf2e.
20
20
  * Released under the MIT License.
21
21
  */
@@ -402,6 +402,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
402
402
  return openBlock(), createElementBlock("view", {
403
403
  class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
404
404
  key: index2,
405
+ ref_for: true,
405
406
  ref: key,
406
407
  onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
407
408
  }, [
@@ -441,6 +442,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
441
442
  return openBlock(), createElementBlock("view", {
442
443
  class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
443
444
  key: index2,
445
+ ref_for: true,
444
446
  ref: key,
445
447
  onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
446
448
  }, [
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  /*!
18
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
18
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
19
19
  * (c) 2021 @jdf2e.
20
20
  * Released under the MIT License.
21
21
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -0,0 +1,547 @@
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
+ var __restKey = (key) => typeof key === "symbol" ? key : key + "";
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+ var __publicField = (obj, key, value) => {
34
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
35
+ return value;
36
+ };
37
+ /*!
38
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
39
+ * (c) 2021 @jdf2e.
40
+ * Released under the MIT License.
41
+ */
42
+ import { computed, ref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, createVNode } from "vue";
43
+ import { c as createComponent } from "./component.js";
44
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
45
+ const formatTree = (tree, parent, config) => tree.map((node) => {
46
+ const { value: valueKey = "value", text: textKey = "text", children: childrenKey = "children" } = config;
47
+ const _a = node, { [valueKey]: value, [textKey]: text, [childrenKey]: children } = _a, others = __objRest(_a, [__restKey(valueKey), __restKey(textKey), __restKey(childrenKey)]);
48
+ const newNode = __spreadProps(__spreadValues({
49
+ loading: false
50
+ }, others), {
51
+ level: parent ? (parent && parent.level || 0) + 1 : 0,
52
+ value,
53
+ text,
54
+ children,
55
+ _parent: parent
56
+ });
57
+ if (newNode.children && newNode.children.length) {
58
+ newNode.children = formatTree(newNode.children, newNode, config);
59
+ }
60
+ return newNode;
61
+ });
62
+ const eachTree = (tree, cb) => {
63
+ let i = 0;
64
+ let node;
65
+ while (node = tree[i++]) {
66
+ if (cb(node) === true) {
67
+ break;
68
+ }
69
+ if (node.children && node.children.length) {
70
+ eachTree(node.children, cb);
71
+ }
72
+ }
73
+ };
74
+ const defaultConvertConfig = {
75
+ topId: null,
76
+ idKey: "id",
77
+ pidKey: "pid",
78
+ sortKey: ""
79
+ };
80
+ const convertListToOptions = (list, options) => {
81
+ const mergedOptions = __spreadValues(__spreadValues({}, defaultConvertConfig), options || {});
82
+ const { topId, idKey, pidKey, sortKey } = mergedOptions;
83
+ let result = [];
84
+ let map = {};
85
+ list.forEach((node) => {
86
+ node = __spreadValues({}, node);
87
+ const { [idKey]: id, [pidKey]: pid } = node;
88
+ const children = map[pid] = map[pid] || [];
89
+ if (!result.length && pid === topId) {
90
+ result = children;
91
+ }
92
+ children.push(node);
93
+ node.children = map[id] || (map[id] = []);
94
+ });
95
+ if (sortKey) {
96
+ Object.keys(map).forEach((i) => {
97
+ if (map[i].length > 1) {
98
+ map[i].sort((a, b) => a[sortKey] - b[sortKey]);
99
+ }
100
+ });
101
+ }
102
+ map = null;
103
+ return result;
104
+ };
105
+ class Tree {
106
+ constructor(nodes, config) {
107
+ __publicField(this, "nodes");
108
+ __publicField(this, "config");
109
+ this.config = __spreadValues({
110
+ value: "value",
111
+ text: "text",
112
+ children: "children"
113
+ }, config || {});
114
+ this.nodes = formatTree(nodes, null, this.config);
115
+ }
116
+ updateChildren(nodes, parent) {
117
+ if (!parent) {
118
+ this.nodes = formatTree(nodes, null, this.config);
119
+ } else {
120
+ parent.children = formatTree(nodes, parent, this.config);
121
+ }
122
+ }
123
+ getNodeByValue(value) {
124
+ let foundNode;
125
+ eachTree(this.nodes, (node) => {
126
+ if (node.value === value) {
127
+ foundNode = node;
128
+ return true;
129
+ }
130
+ });
131
+ return foundNode;
132
+ }
133
+ getPathNodesByNode(node) {
134
+ const nodes = [];
135
+ while (node) {
136
+ nodes.unshift(node);
137
+ node = node._parent;
138
+ }
139
+ return nodes;
140
+ }
141
+ getPathNodesByValue(value) {
142
+ if (Array.isArray(value) && !value.length) {
143
+ return [];
144
+ }
145
+ const tail = Array.isArray(value) ? value[value.length - 1] : value;
146
+ const node = this.getNodeByValue(tail);
147
+ if (!node) {
148
+ return [];
149
+ }
150
+ return this.getPathNodesByNode(node);
151
+ }
152
+ isLeaf(node, lazy) {
153
+ const { leaf, children } = node;
154
+ const hasChildren = Array.isArray(children) && Boolean(children.length);
155
+ return leaf || !hasChildren && !lazy;
156
+ }
157
+ hasChildren(node, lazy) {
158
+ const isLeaf = this.isLeaf(node, lazy);
159
+ if (isLeaf) {
160
+ return false;
161
+ }
162
+ const { children } = node;
163
+ return Array.isArray(children) && Boolean(children.length);
164
+ }
165
+ }
166
+ const { create: create$1 } = createComponent("cascader-item");
167
+ const _sfc_main$1 = create$1({
168
+ props: {
169
+ visible: Boolean,
170
+ modelValue: Array,
171
+ options: {
172
+ type: Array,
173
+ default: () => []
174
+ },
175
+ lazy: Boolean,
176
+ lazyLoad: Function,
177
+ valueKey: {
178
+ type: String,
179
+ default: "value"
180
+ },
181
+ textKey: {
182
+ type: String,
183
+ default: "text"
184
+ },
185
+ childrenKey: {
186
+ type: String,
187
+ default: "children"
188
+ },
189
+ convertConfig: Object
190
+ },
191
+ components: {},
192
+ emits: ["update:modelValue", "change", "pathChange"],
193
+ setup(props, { emit }) {
194
+ const configs = computed(() => ({
195
+ lazy: props.lazy,
196
+ lazyLoad: props.lazyLoad,
197
+ valueKey: props.valueKey,
198
+ textKey: props.textKey,
199
+ childrenKey: props.childrenKey,
200
+ convertConfig: props.convertConfig
201
+ }));
202
+ const tabsCursor = ref(0);
203
+ const initLoading = ref(false);
204
+ const innerValue = ref(props.modelValue);
205
+ const tree = ref(new Tree([], {}));
206
+ const panes = ref([]);
207
+ const isLazy = computed(() => configs.value.lazy && Boolean(configs.value.lazyLoad));
208
+ const lazyLoadMap = new Map();
209
+ let currentProcessNode;
210
+ const init = async () => {
211
+ lazyLoadMap.clear();
212
+ panes.value = [];
213
+ tabsCursor.value = 0;
214
+ initLoading.value = false;
215
+ currentProcessNode = null;
216
+ let { options } = props;
217
+ if (configs.value.convertConfig) {
218
+ options = convertListToOptions(options, configs.value.convertConfig);
219
+ }
220
+ tree.value = new Tree(options, {
221
+ value: configs.value.valueKey,
222
+ text: configs.value.textKey,
223
+ children: configs.value.childrenKey
224
+ });
225
+ if (isLazy.value && !tree.value.nodes.length) {
226
+ await invokeLazyLoad({
227
+ root: true,
228
+ loading: true,
229
+ text: "",
230
+ value: ""
231
+ });
232
+ }
233
+ panes.value = [{ nodes: tree.value.nodes, selectedNode: null }];
234
+ syncValue();
235
+ };
236
+ const syncValue = async () => {
237
+ const currentValue = innerValue.value;
238
+ if (currentValue === void 0 || !tree.value.nodes.length) {
239
+ return;
240
+ }
241
+ if (currentValue.length === 0) {
242
+ tabsCursor.value = 0;
243
+ panes.value = [{ nodes: tree.value.nodes, selectedNode: null }];
244
+ return;
245
+ }
246
+ let needToSync = currentValue;
247
+ if (isLazy.value && Array.isArray(currentValue) && currentValue.length) {
248
+ needToSync = [];
249
+ let parent = tree.value.nodes.find((node) => node.value === currentValue[0]);
250
+ if (parent) {
251
+ needToSync = [parent.value];
252
+ initLoading.value = true;
253
+ const last = await currentValue.slice(1).reduce(async (p, value) => {
254
+ var _a;
255
+ const parent2 = await p;
256
+ await invokeLazyLoad(parent2);
257
+ const node = (_a = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _a.find((item) => item.value === value);
258
+ if (node) {
259
+ needToSync.push(value);
260
+ }
261
+ return Promise.resolve(node);
262
+ }, Promise.resolve(parent));
263
+ await invokeLazyLoad(last);
264
+ initLoading.value = false;
265
+ }
266
+ }
267
+ if (needToSync.length && currentValue === props.modelValue) {
268
+ const pathNodes = tree.value.getPathNodesByValue(needToSync);
269
+ pathNodes.map((node, index2) => {
270
+ tabsCursor.value = index2;
271
+ methods.handleNode(node, true);
272
+ });
273
+ }
274
+ };
275
+ const invokeLazyLoad = async (node) => {
276
+ if (!node) {
277
+ return;
278
+ }
279
+ if (!configs.value.lazyLoad) {
280
+ node.leaf = true;
281
+ return;
282
+ }
283
+ if (tree.value.isLeaf(node, isLazy.value) || tree.value.hasChildren(node, isLazy.value)) {
284
+ return;
285
+ }
286
+ node.loading = true;
287
+ const parent = node.root ? null : node;
288
+ let lazyLoadPromise = lazyLoadMap.get(node);
289
+ if (!lazyLoadPromise) {
290
+ lazyLoadPromise = new Promise((resolve) => {
291
+ var _a, _b;
292
+ (_b = (_a = configs.value).lazyLoad) == null ? void 0 : _b.call(_a, node, resolve);
293
+ });
294
+ lazyLoadMap.set(node, lazyLoadPromise);
295
+ }
296
+ const nodes = await lazyLoadPromise;
297
+ if (Array.isArray(nodes) && nodes.length > 0) {
298
+ tree.value.updateChildren(nodes, parent);
299
+ } else {
300
+ node.leaf = true;
301
+ }
302
+ node.loading = false;
303
+ lazyLoadMap.delete(node);
304
+ };
305
+ const emitChange = (pathNodes) => {
306
+ const emitValue = pathNodes.map((node) => node.value);
307
+ innerValue.value = emitValue;
308
+ emit("change", emitValue, pathNodes);
309
+ emit("update:modelValue", emitValue, pathNodes);
310
+ };
311
+ const methods = {
312
+ async handleNode(node, silent) {
313
+ const { disabled, loading } = node;
314
+ if (!silent && disabled || !panes.value[tabsCursor.value]) {
315
+ return;
316
+ }
317
+ if (tree.value.isLeaf(node, isLazy.value)) {
318
+ node.leaf = true;
319
+ panes.value[tabsCursor.value].selectedNode = node;
320
+ panes.value = panes.value.slice(0, node.level + 1);
321
+ if (!silent) {
322
+ const pathNodes = panes.value.map((pane) => pane.selectedNode);
323
+ emitChange(pathNodes);
324
+ emit("pathChange", pathNodes);
325
+ }
326
+ return;
327
+ }
328
+ if (tree.value.hasChildren(node, isLazy.value)) {
329
+ const level = node.level + 1;
330
+ panes.value[tabsCursor.value].selectedNode = node;
331
+ panes.value = panes.value.slice(0, level);
332
+ panes.value.push({
333
+ nodes: node.children || [],
334
+ selectedNode: null
335
+ });
336
+ tabsCursor.value = level;
337
+ if (!silent) {
338
+ const pathNodes = panes.value.map((pane) => pane.selectedNode);
339
+ emit("pathChange", pathNodes);
340
+ }
341
+ return;
342
+ }
343
+ currentProcessNode = node;
344
+ if (loading) {
345
+ return;
346
+ }
347
+ await invokeLazyLoad(node);
348
+ if (currentProcessNode === node) {
349
+ panes.value[tabsCursor.value].selectedNode = node;
350
+ methods.handleNode(node, silent);
351
+ }
352
+ },
353
+ handleTabClick(tab) {
354
+ currentProcessNode = null;
355
+ tabsCursor.value = tab.paneKey;
356
+ },
357
+ formatTabTitle(pane) {
358
+ return pane.selectedNode ? pane.selectedNode.text : "\u8BF7\u9009\u62E9";
359
+ },
360
+ isSelected(pane, node) {
361
+ return pane.selectedNode && pane.selectedNode.value === node.value;
362
+ }
363
+ };
364
+ watch([configs, () => props.options], () => {
365
+ init();
366
+ }, {
367
+ deep: true,
368
+ immediate: true
369
+ });
370
+ watch(() => props.modelValue, (value) => {
371
+ if (value !== innerValue.value) {
372
+ innerValue.value = value;
373
+ syncValue();
374
+ }
375
+ });
376
+ watch(() => props.visible, (val) => {
377
+ if (val && Array.isArray(innerValue.value) && innerValue.value.length > 0) {
378
+ syncValue();
379
+ }
380
+ });
381
+ return __spreadValues({ panes, initLoading, tabsCursor }, methods);
382
+ }
383
+ });
384
+ const _hoisted_1$1 = {
385
+ role: "menu",
386
+ class: "nut-cascader-pane"
387
+ };
388
+ const _hoisted_2 = ["aria-checked", "aria-disabled", "onClick"];
389
+ const _hoisted_3 = { class: "nut-cascader-item__title" };
390
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("view", { class: "nut-cascader-pane" }, null, -1);
391
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
392
+ const _component_nut_icon = resolveComponent("nut-icon");
393
+ const _component_nut_tabpane = resolveComponent("nut-tabpane");
394
+ const _component_nut_tabs = resolveComponent("nut-tabs");
395
+ return openBlock(), createBlock(_component_nut_tabs, {
396
+ class: "nut-cascader",
397
+ modelValue: _ctx.tabsCursor,
398
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.tabsCursor = $event),
399
+ onClick: _ctx.handleTabClick,
400
+ "title-scroll": ""
401
+ }, {
402
+ default: withCtx(() => [
403
+ !_ctx.initLoading && _ctx.panes.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.panes, (pane, index2) => {
404
+ return openBlock(), createBlock(_component_nut_tabpane, {
405
+ title: _ctx.formatTabTitle(pane),
406
+ key: index2
407
+ }, {
408
+ default: withCtx(() => [
409
+ createElementVNode("view", _hoisted_1$1, [
410
+ (openBlock(true), createElementBlock(Fragment, null, renderList(pane.nodes, (node) => {
411
+ return openBlock(), createElementBlock("view", {
412
+ key: node.value,
413
+ class: normalizeClass(["nut-cascader-item", { active: _ctx.isSelected(pane, node), disabled: node.disabled }]),
414
+ "aria-checked": _ctx.isSelected(pane, node),
415
+ "aria-disabled": node.disabled || void 0,
416
+ role: "menuitemradio",
417
+ onClick: ($event) => _ctx.handleNode(node, false)
418
+ }, [
419
+ createElementVNode("view", _hoisted_3, toDisplayString(node.text), 1),
420
+ node.loading ? (openBlock(), createBlock(_component_nut_icon, {
421
+ key: 0,
422
+ class: "nut-cascader-item__icon-loading",
423
+ name: "loading"
424
+ })) : (openBlock(), createBlock(_component_nut_icon, {
425
+ key: 1,
426
+ class: "nut-cascader-item__icon-check",
427
+ name: "checklist"
428
+ }))
429
+ ], 10, _hoisted_2);
430
+ }), 128))
431
+ ])
432
+ ]),
433
+ _: 2
434
+ }, 1032, ["title"]);
435
+ }), 128)) : (openBlock(), createBlock(_component_nut_tabpane, {
436
+ key: 1,
437
+ title: "Loading..."
438
+ }, {
439
+ default: withCtx(() => [
440
+ _hoisted_4
441
+ ]),
442
+ _: 1
443
+ }))
444
+ ]),
445
+ _: 1
446
+ }, 8, ["modelValue", "onClick"]);
447
+ }
448
+ var CascaderItem = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
449
+ const { create } = createComponent("cascader");
450
+ const _sfc_main = create({
451
+ components: {
452
+ [CascaderItem.name]: CascaderItem
453
+ },
454
+ props: {
455
+ modelValue: Array,
456
+ visible: Boolean,
457
+ title: String,
458
+ options: {
459
+ type: Array,
460
+ default: () => []
461
+ },
462
+ lazy: Boolean,
463
+ lazyLoad: Function,
464
+ valueKey: {
465
+ type: String,
466
+ default: "value"
467
+ },
468
+ textKey: {
469
+ type: String,
470
+ default: "text"
471
+ },
472
+ childrenKey: {
473
+ type: String,
474
+ default: "children"
475
+ },
476
+ convertConfig: Object
477
+ },
478
+ emits: ["update:modelValue", "change", "pathChange", "update:visible"],
479
+ setup(props, { emit }) {
480
+ const innerValue = ref(props.modelValue);
481
+ const innerVisible = computed({
482
+ get() {
483
+ return props.visible;
484
+ },
485
+ set(value) {
486
+ emit("update:visible", value);
487
+ }
488
+ });
489
+ const onChange = (value, pathNodes) => {
490
+ innerValue.value = value;
491
+ innerVisible.value = false;
492
+ emit("change", value, pathNodes);
493
+ emit("update:modelValue", value);
494
+ };
495
+ const onPathChange = (pathNodes) => {
496
+ emit("pathChange", pathNodes);
497
+ };
498
+ watch(() => props.modelValue, (value) => {
499
+ if (value !== innerValue.value) {
500
+ innerValue.value = value;
501
+ }
502
+ });
503
+ return {
504
+ onChange,
505
+ onPathChange,
506
+ innerValue,
507
+ innerVisible
508
+ };
509
+ }
510
+ });
511
+ const _hoisted_1 = {
512
+ key: 0,
513
+ class: "nut-cascader__bar"
514
+ };
515
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
516
+ const _component_nut_cascader_item = resolveComponent("nut-cascader-item");
517
+ const _component_nut_popup = resolveComponent("nut-popup");
518
+ return openBlock(), createBlock(_component_nut_popup, {
519
+ visible: _ctx.innerVisible,
520
+ "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.innerVisible = $event),
521
+ position: "bottom",
522
+ "pop-class": "nut-cascader__popup",
523
+ round: "",
524
+ closeable: true,
525
+ "destroy-on-close": false
526
+ }, {
527
+ default: withCtx(() => [
528
+ _ctx.title ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
529
+ createVNode(_component_nut_cascader_item, {
530
+ onChange: _ctx.onChange,
531
+ onPathChange: _ctx.onPathChange,
532
+ modelValue: _ctx.innerValue,
533
+ options: _ctx.options,
534
+ lazy: _ctx.lazy,
535
+ "lazy-load": _ctx.lazyLoad,
536
+ "value-key": _ctx.valueKey,
537
+ "text-key": _ctx.textKey,
538
+ "children-key": _ctx.childrenKey,
539
+ "convert-config": _ctx.convertConfig,
540
+ visible: _ctx.innerVisible
541
+ }, null, 8, ["onChange", "onPathChange", "modelValue", "options", "lazy", "lazy-load", "value-key", "text-key", "children-key", "convert-config", "visible"])
542
+ ]),
543
+ _: 1
544
+ }, 8, ["visible"]);
545
+ }
546
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
547
+ export { index as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */