@opentinyvue/vue-cascader-mobile 2.22.0 → 3.22.0

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/lib/index.js CHANGED
@@ -4,37 +4,41 @@ import { IconCheck, IconYes, IconLoading, IconCheckedSur, IconHalfselect, IconSe
4
4
  import Button from '@opentinyvue/vue-button';
5
5
  import ActionSheet from '@opentinyvue/vue-action-sheet';
6
6
  import Exception from '@opentinyvue/vue-exception';
7
+ import { resolveComponent, openBlock, createElementBlock, createBlock, resolveDynamicComponent, normalizeClass, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createVNode, withDirectives, withCtx, Fragment, renderList, vShow, vModelText, createTextVNode } from 'vue';
7
8
  import { t } from '@opentinyvue/vue-locale';
8
9
 
9
- function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
10
- var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
11
- if (render) {
12
- options.render = render;
13
- options.staticRenderFns = staticRenderFns;
14
- options._compiled = true;
10
+ function _createForOfIteratorHelperLoose(r, e) {
11
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
12
+ if (t) return (t = t.call(r)).next.bind(t);
13
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
14
+ t && (r = t);
15
+ var o = 0;
16
+ return function() {
17
+ return o >= r.length ? { done: true } : { done: false, value: r[o++] };
18
+ };
15
19
  }
16
- var hook;
17
- if (injectStyles) {
18
- hook = injectStyles;
19
- }
20
- if (hook) {
21
- if (options.functional) {
22
- options._injectStyles = hook;
23
- var originalRender = options.render;
24
- options.render = function renderWithStyleInjection(h, context) {
25
- hook.call(context);
26
- return originalRender(h, context);
27
- };
28
- } else {
29
- var existing = options.beforeCreate;
30
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
31
- }
20
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
21
+ }
22
+ function _unsupportedIterableToArray(r, a) {
23
+ if (r) {
24
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
25
+ var t = {}.toString.call(r).slice(8, -1);
26
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
32
27
  }
33
- return {
34
- exports: scriptExports,
35
- options
36
- };
37
28
  }
29
+ function _arrayLikeToArray(r, a) {
30
+ (null == a || a > r.length) && (a = r.length);
31
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
32
+ return n;
33
+ }
34
+ var _export_sfc = function _export_sfc2(sfc, props) {
35
+ var target = sfc.__vccOpts || sfc;
36
+ for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
37
+ var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
38
+ target[key] = val;
39
+ }
40
+ return target;
41
+ };
38
42
 
39
43
  function _extends() {
40
44
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
@@ -45,77 +49,7 @@ function _extends() {
45
49
  return n;
46
50
  }, _extends.apply(null, arguments);
47
51
  }
48
- var render$1 = function render$12() {
49
- var _vm = this;
50
- var _h = _vm.$createElement;
51
- var _c = _vm._self._c || _h;
52
- return _c("div", {
53
- staticClass: "flex items-start leading-5.5 py-3 cursor-pointer select-none",
54
- on: {
55
- "click": function click($event) {
56
- return _vm.$emit("click", $event);
57
- }
58
- }
59
- }, [_vm.multiple ? _c(_vm.selected ? "icon-checked-sur" : "icon-check", {
60
- tag: "component",
61
- class: ["flex-none mt-1 mr-2", _vm.selected ? "fill-color-brand" : "fill-color-icon-disabled"],
62
- attrs: {
63
- "custom-class": "w-4.5 h-4.5"
64
- }
65
- }) : _vm._e(), _c("div", {
66
- class: ["flex-auto flex w-full text-sm", {
67
- "truncate": _vm.ellipsis
68
- }, {
69
- "text-color-brand": !_vm.multiple && _vm.selected
70
- }]
71
- }, [_vm._t("default", function() {
72
- return [_c("div", {
73
- class: ["flex-auto", {
74
- "truncate": _vm.ellipsis
75
- }]
76
- }, [_c("div", {
77
- staticClass: "flex"
78
- }, [_c("div", {
79
- class: [{
80
- "min-w-[theme(spacing.14)]": !_vm.textField3
81
- }, {
82
- "truncate": _vm.ellipsis
83
- }]
84
- }, [_vm._v(" " + _vm._s(_vm.data[_vm.textField]) + " ")]), _vm.textField2 ? _c("div", {
85
- class: ["ml-5 text-color-text-placeholder", {
86
- "truncate": _vm.ellipsis
87
- }]
88
- }, [_vm._v(" " + _vm._s(_vm.data[_vm.textField2]) + " ")]) : _vm._e()]), _vm.textField3 ? _c("div", {
89
- class: ["text-color-text-placeholder", {
90
- "truncate": _vm.ellipsis
91
- }]
92
- }, [_vm._v(" " + _vm._s(_vm.data[_vm.textField3]) + " ")]) : _vm._e()]), !_vm.loading && !_vm.multiple && _vm.selected ? _c("div", {
93
- staticClass: "flex flex-none w-5 items-center justify-center ml-2"
94
- }, [_c("IconYes", {
95
- staticClass: "fill-color-brand",
96
- attrs: {
97
- "custom-class": "w-5 h-5"
98
- }
99
- })], 1) : _vm._e(), _vm.option.loading ? _c("div", {
100
- staticClass: "flex flex-none w-5 items-center justify-center ml-2"
101
- }, [_c("svg", {
102
- staticClass: "animate-[spin_1.5s_linear_infinite] fill-current",
103
- attrs: {
104
- "viewBox": "25 25 50 50"
105
- }
106
- }, [_c("circle", {
107
- staticClass: "stroke-color-brand tiny-loading-path",
108
- attrs: {
109
- "cx": "50",
110
- "cy": "50",
111
- "r": "24",
112
- "fill": "none"
113
- }
114
- })])]) : _vm._e()];
115
- })], 2)], 1);
116
- };
117
- var staticRenderFns$1 = [];
118
- var __vue2_script$1 = {
52
+ var _sfc_main$1 = {
119
53
  emits: ["click"],
120
54
  components: {
121
55
  IconCheck: IconCheck(),
@@ -131,16 +65,109 @@ var __vue2_script$1 = {
131
65
  }
132
66
  }
133
67
  };
134
- var __cssModules$1 = {};
135
- var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1);
136
- function __vue2_injectStyles$1(context) {
137
- for (var o in __cssModules$1) {
138
- this[o] = __cssModules$1[o];
139
- }
68
+ var _hoisted_1$1 = {
69
+ class: "flex"
70
+ };
71
+ var _hoisted_2$1 = {
72
+ key: 0,
73
+ class: "flex flex-none w-5 items-center justify-center ml-2"
74
+ };
75
+ var _hoisted_3$1 = {
76
+ key: 1,
77
+ class: "flex flex-none w-5 items-center justify-center ml-2"
78
+ };
79
+ var _hoisted_4$1 = /* @__PURE__ */ createElementVNode(
80
+ "svg",
81
+ {
82
+ class: "animate-[spin_1.5s_linear_infinite] fill-current",
83
+ viewBox: "25 25 50 50"
84
+ },
85
+ [/* @__PURE__ */ createElementVNode("circle", {
86
+ class: "stroke-color-brand tiny-loading-path",
87
+ cx: "50",
88
+ cy: "50",
89
+ r: "24",
90
+ fill: "none"
91
+ })],
92
+ -1
93
+ /* HOISTED */
94
+ );
95
+ var _hoisted_5$1 = [_hoisted_4$1];
96
+ function _sfc_render$1(_ctx, _cache, $props2, $setup, $data, $options) {
97
+ var _component_IconYes = resolveComponent("IconYes");
98
+ return openBlock(), createElementBlock("div", {
99
+ class: "flex items-start leading-5.5 py-3 cursor-pointer select-none",
100
+ onClick: _cache[0] || (_cache[0] = function($event) {
101
+ return _ctx.$emit("click", $event);
102
+ })
103
+ }, [$props2.multiple ? (openBlock(), createBlock(resolveDynamicComponent($props2.selected ? "icon-checked-sur" : "icon-check"), {
104
+ key: 0,
105
+ class: normalizeClass(["flex-none mt-1 mr-2", $props2.selected ? "fill-color-brand" : "fill-color-icon-disabled"]),
106
+ "custom-class": "w-4.5 h-4.5"
107
+ }, null, 8, ["class"])) : createCommentVNode("v-if", true), createElementVNode(
108
+ "div",
109
+ {
110
+ class: normalizeClass(["flex-auto flex w-full text-sm", {
111
+ "truncate": $props2.ellipsis
112
+ }, {
113
+ "text-color-brand": !$props2.multiple && $props2.selected
114
+ }])
115
+ },
116
+ [renderSlot(_ctx.$slots, "default", {}, function() {
117
+ return [createElementVNode(
118
+ "div",
119
+ {
120
+ class: normalizeClass(["flex-auto", {
121
+ "truncate": $props2.ellipsis
122
+ }])
123
+ },
124
+ [createElementVNode("div", _hoisted_1$1, [createElementVNode(
125
+ "div",
126
+ {
127
+ class: normalizeClass([{
128
+ "min-w-[theme(spacing.14)]": !$props2.textField3
129
+ }, {
130
+ "truncate": $props2.ellipsis
131
+ }])
132
+ },
133
+ toDisplayString($options.data[$props2.textField]),
134
+ 3
135
+ /* TEXT, CLASS */
136
+ ), $props2.textField2 ? (openBlock(), createElementBlock(
137
+ "div",
138
+ {
139
+ key: 0,
140
+ class: normalizeClass(["ml-5 text-color-text-placeholder", {
141
+ "truncate": $props2.ellipsis
142
+ }])
143
+ },
144
+ toDisplayString($options.data[$props2.textField2]),
145
+ 3
146
+ /* TEXT, CLASS */
147
+ )) : createCommentVNode("v-if", true)]), $props2.textField3 ? (openBlock(), createElementBlock(
148
+ "div",
149
+ {
150
+ key: 0,
151
+ class: normalizeClass(["text-color-text-placeholder", {
152
+ "truncate": $props2.ellipsis
153
+ }])
154
+ },
155
+ toDisplayString($options.data[$props2.textField3]),
156
+ 3
157
+ /* TEXT, CLASS */
158
+ )) : createCommentVNode("v-if", true)],
159
+ 2
160
+ /* CLASS */
161
+ ), !$props2.loading && !$props2.multiple && $props2.selected ? (openBlock(), createElementBlock("div", _hoisted_2$1, [createVNode(_component_IconYes, {
162
+ "custom-class": "w-5 h-5",
163
+ class: "fill-color-brand"
164
+ })])) : createCommentVNode("v-if", true), $props2.option.loading ? (openBlock(), createElementBlock("div", _hoisted_3$1, _hoisted_5$1)) : createCommentVNode("v-if", true)];
165
+ })],
166
+ 2
167
+ /* CLASS */
168
+ )]);
140
169
  }
141
- var Option = /* @__PURE__ */ function() {
142
- return __component__$1.exports;
143
- }();
170
+ var Option = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
144
171
  var $constants = {
145
172
  defaultNodeConfig: {
146
173
  lazy: false,
@@ -157,7 +184,7 @@ var $constants = {
157
184
  filterNodeMethod: null
158
185
  }
159
186
  };
160
- var __vue2_script = defineComponent({
187
+ var _sfc_main = defineComponent({
161
188
  name: $prefix + "CascaderMobile",
162
189
  emits: ["click", "search-click", "node-expand", "close", "update:modelValue", "confirm", "update:visible", "update:text"],
163
190
  components: {
@@ -250,290 +277,324 @@ var __vue2_script = defineComponent({
250
277
  });
251
278
  }
252
279
  });
253
- var render = function render2() {
254
- var _vm = this;
255
- var _h = _vm.$createElement;
256
- var _c = _vm._self._c || _h;
257
- return _c("div", {
258
- directives: [{
259
- name: "show",
260
- rawName: "v-show",
261
- value: _vm.visible,
262
- expression: "visible"
263
- }],
264
- attrs: {
265
- "data-tag": "tiny-cascader-mobile"
266
- }
267
- }, [_c("tiny-action-sheet", {
268
- attrs: {
269
- "tiny_mode": "mobile-first",
270
- "title": _vm.title,
280
+ var _hoisted_1 = {
281
+ "data-tag": "tiny-cascader-mobile"
282
+ };
283
+ var _hoisted_2 = {
284
+ class: "h-11 flex-none flex items-center border-b-0.5 border-color-border-separator overflow-auto whitespace-nowrap scrollbar-size-0"
285
+ };
286
+ var _hoisted_3 = {
287
+ class: "px-4 flex"
288
+ };
289
+ var _hoisted_4 = {
290
+ key: 0,
291
+ class: "px-2 text-color-text-placeholder"
292
+ };
293
+ var _hoisted_5 = ["onClick"];
294
+ var _hoisted_6 = /* @__PURE__ */ createElementVNode(
295
+ "div",
296
+ {
297
+ class: "flex-auto"
298
+ },
299
+ null,
300
+ -1
301
+ /* HOISTED */
302
+ );
303
+ var _hoisted_7 = {
304
+ "data-tag": "search-header",
305
+ class: "flex leading-6 pt-4 pb-4 px-4 text-base items-center"
306
+ };
307
+ var _hoisted_8 = {
308
+ class: "flex-auto flex items-center h-8 py-1 px-3 bg-color-bg-4 rounded-full"
309
+ };
310
+ var _hoisted_9 = ["placeholder"];
311
+ var _hoisted_10 = {
312
+ class: "flex items-center pl-3 cursor-pointer"
313
+ };
314
+ var _hoisted_11 = {
315
+ "data-tag": "tabs",
316
+ class: "flex-auto"
317
+ };
318
+ var _hoisted_12 = {
319
+ "data-tag": "search-box",
320
+ class: "flex flex-col flex-auto"
321
+ };
322
+ var _hoisted_13 = {
323
+ "data-tag": "search-body",
324
+ class: "flex-auto overflow-auto flex flex-col"
325
+ };
326
+ var _hoisted_14 = {
327
+ class: /* @__PURE__ */ normalizeClass(["flex flex-col px-4"])
328
+ };
329
+ var _hoisted_15 = {
330
+ key: 0,
331
+ class: "text-color-brand"
332
+ };
333
+ var _hoisted_16 = {
334
+ class: "w-full flex justify-center items-center text-center flex-auto"
335
+ };
336
+ function _sfc_render(_ctx, _cache, $props2, $setup, $data, $options) {
337
+ var _component_IconSearch = resolveComponent("IconSearch");
338
+ var _component_tiny_option = resolveComponent("tiny-option");
339
+ var _component_tiny_exception = resolveComponent("tiny-exception");
340
+ var _component_tiny_button = resolveComponent("tiny-button");
341
+ var _component_tiny_action_sheet = resolveComponent("tiny-action-sheet");
342
+ return withDirectives((openBlock(), createElementBlock(
343
+ "div",
344
+ _hoisted_1,
345
+ [createVNode(_component_tiny_action_sheet, {
346
+ tiny_mode: "mobile-first",
347
+ title: _ctx.title,
271
348
  "show-footer": "",
272
- "visible": _vm.state.toggle,
273
- "show-header": !_vm.state.search.show,
349
+ visible: _ctx.state.toggle,
350
+ "onUpdate:visible": _cache[4] || (_cache[4] = function($event) {
351
+ return _ctx.$emit("update:visible", $event);
352
+ }),
353
+ onClose: _ctx.close,
354
+ "show-header": !_ctx.state.search.show,
274
355
  "custom-class": ["min-h-[95%] pb-4"]
275
- },
276
- on: {
277
- "update:visible": function updateVisible($event) {
278
- return _vm.$emit("update:visible", $event);
279
- },
280
- "close": _vm.close
281
- },
282
- scopedSlots: _vm._u([{
283
- key: "body-top",
284
- fn: function fn() {
285
- return [_c("div", {
286
- directives: [{
287
- name: "show",
288
- rawName: "v-show",
289
- value: !_vm.state.search.show,
290
- expression: "!state.search.show"
291
- }],
292
- staticClass: "h-11 flex-none flex items-center border-b-0.5 border-color-border-separator overflow-auto whitespace-nowrap scrollbar-size-0"
293
- }, [_c("div", {
294
- staticClass: "px-4 flex"
295
- }, [_vm._l(_vm.state.computedNavList, function(option, index) {
296
- return _c("div", {
297
- key: index,
298
- staticClass: "flex-none flex leading-5.5"
299
- }, [index <= _vm.state.level ? [index !== 0 ? _c("span", {
300
- staticClass: "px-2 text-color-text-placeholder"
301
- }, [_vm._v("/")]) : _vm._e(), _c("span", {
302
- class: ["flex-none max-w-[theme(spacing.24)] truncate", {
303
- "text-color-brand": index === _vm.state.level
304
- }, _vm.disabledNavOption(index, option) ? "text-color-text-disabled" : "cursor-pointer"],
305
- on: {
306
- "click": function click($event) {
307
- return _vm.setLevel(index, option);
308
- }
309
- }
310
- }, [_vm._v(_vm._s(option.data[_vm.textField]))])] : _vm._e()], 2);
311
- }), _c("div", {
312
- staticClass: "flex-auto"
313
- })], 2)]), _c("div", {
314
- directives: [{
315
- name: "show",
316
- rawName: "v-show",
317
- value: _vm.state.search.show,
318
- expression: "state.search.show"
319
- }],
320
- staticClass: "flex leading-6 pt-4 pb-4 px-4 text-base items-center",
321
- attrs: {
322
- "data-tag": "search-header"
323
- }
324
- }, [_c("div", {
325
- staticClass: "flex-auto flex items-center h-8 py-1 px-3 bg-color-bg-4 rounded-full"
326
- }, [_c("IconSearch", {
327
- staticClass: "mr-1 fill-color-icon-disabled",
328
- attrs: {
329
- "custom-class": "h-4 w-4"
330
- }
331
- }), _c("input", {
332
- directives: [{
333
- name: "model",
334
- rawName: "v-model",
335
- value: _vm.state.search.input,
336
- expression: "state.search.input"
337
- }],
338
- staticClass: "h-5 flex-auto text-xs bg-transparent outline-0",
339
- attrs: {
340
- "placeholder": _vm.t("ui.select.pleaseSearch")
341
- },
342
- domProps: {
343
- "value": _vm.state.search.input
344
- },
345
- on: {
346
- "input": [function($event) {
347
- if ($event.target.composing) return;
348
- _vm.$set(_vm.state.search, "input", $event.target.value);
349
- }, _vm.searchMethod]
350
- }
351
- })], 1), _c("div", {
352
- staticClass: "flex items-center pl-3 cursor-pointer"
353
- }, [_c("div", {
354
- on: {
355
- "click": function click($event) {
356
- return _vm.searchBoxToggle(false);
357
- }
358
- }
359
- }, [_vm._v(_vm._s(_vm.t("ui.base.cancel")))])])])];
360
- },
361
- proxy: true
362
- }, {
363
- key: "header-left",
364
- fn: function fn() {
365
- return [!_vm.state.search.show ? _c("IconSearch", {
366
- staticClass: "cursor-pointer",
367
- attrs: {
368
- "custom-class": "h-5 w-5"
369
- },
370
- on: {
371
- "click": function click($event) {
372
- return _vm.searchBoxToggle(true);
373
- }
374
- }
375
- }) : _vm._e()];
376
- },
377
- proxy: true
378
- }, {
379
- key: "footer",
380
- fn: function fn() {
381
- return [_c("tiny-button", {
382
- directives: [{
383
- name: "show",
384
- rawName: "v-show",
385
- value: _vm.state.showButton,
386
- expression: "state.showButton"
387
- }],
388
- staticClass: "flex-1 mx-4 sm:mx-0",
389
- attrs: {
390
- "tiny_mode": "mobile-first",
391
- "type": "primary",
392
- "reset-time": 0
393
- },
394
- on: {
395
- "click": _vm.confirm
396
- }
397
- }, [_vm._v(_vm._s(_vm.t("ui.button.confirm")))])];
398
- },
399
- proxy: true
400
- }])
401
- }, [_c("div", {
402
- directives: [{
403
- name: "show",
404
- rawName: "v-show",
405
- value: !_vm.state.search.show,
406
- expression: "!state.search.show"
407
- }],
408
- staticClass: "flex-auto",
409
- attrs: {
410
- "data-tag": "tabs"
411
- }
412
- }, _vm._l(_vm.state.options, function(currentList, index) {
413
- return _c("div", {
414
- directives: [{
415
- name: "show",
416
- rawName: "v-show",
417
- value: index === _vm.state.level,
418
- expression: "index === state.level"
419
- }],
420
- key: index,
421
- staticClass: "flex flex-col px-4 overflow-auto pt-2",
422
- attrs: {
423
- "data-tag": "tab-item"
424
- }
425
- }, _vm._l(currentList, function(item, itemIndex) {
426
- return _c("tiny-option", {
427
- key: item.data[_vm.valueField],
428
- attrs: {
429
- "multiple": _vm.multiple,
430
- "ellipsis": _vm.ellipsis,
431
- "text-field": _vm.textField,
432
- "text-field2": _vm.textField2,
433
- "text-field3": _vm.textField3,
434
- "loading": _vm.state.loading,
435
- "option": item,
436
- "selected": _vm.isSelected(item)
437
- },
438
- on: {
439
- "click": function click($event) {
440
- return _vm.selectOption(item, $event);
441
- }
442
- }
443
- }, [_vm._t("default", null, {
444
- "item": item,
445
- "index": itemIndex
446
- })], 2);
447
- }), 1);
448
- }), 0), _c("div", {
449
- directives: [{
450
- name: "show",
451
- rawName: "v-show",
452
- value: _vm.state.search.show,
453
- expression: "state.search.show"
454
- }],
455
- staticClass: "flex flex-col flex-auto",
456
- attrs: {
457
- "data-tag": "search-box"
458
- }
459
- }, [_c("div", {
460
- staticClass: "flex-auto overflow-auto flex flex-col",
461
- attrs: {
462
- "data-tag": "search-body"
463
- }
464
- }, [_c("div", {
465
- directives: [{
466
- name: "show",
467
- rawName: "v-show",
468
- value: _vm.state.search.filterOptions.length,
469
- expression: "state.search.filterOptions.length"
470
- }],
471
- class: ["flex flex-col px-4"]
472
- }, _vm._l(_vm.state.search.filterOptions, function(item, index) {
473
- return _c("tiny-option", {
474
- key: index,
475
- attrs: {
476
- "multiple": _vm.multiple,
477
- "ellipsis": _vm.ellipsis,
478
- "text-field": _vm.textField,
479
- "text-field2": _vm.textField2,
480
- "text-field3": _vm.textField3,
481
- "option": item,
482
- "selected": _vm.isSelected(item)
483
- },
484
- on: {
485
- "click": function click($event) {
486
- return _vm.searchSelectHandler(item, index);
487
- }
488
- }
489
- }, [_vm.searchConfig.openSearchSlot ? _vm._t("search-item", null, {
490
- "item": item,
491
- "index": index
492
- }) : _vm._t("default", function() {
493
- return [_c("div", {
494
- class: ["flex-auto", {
495
- "truncate": _vm.ellipsis
496
- }]
497
- }, _vm._l(_vm.renderSearchOption(item[_vm.textField]), function(text, textIndex) {
498
- return _c("span", {
499
- key: text
500
- }, [textIndex ? _c("span", {
501
- staticClass: "text-color-brand"
502
- }, [_vm._v(_vm._s(_vm.state.search.input))]) : _vm._e(), _vm._v(_vm._s(text) + " ")]);
503
- }), 0)];
504
356
  }, {
505
- "item": item,
506
- "index": index
507
- })], 2);
508
- }), 1), _c("div", {
509
- directives: [{
510
- name: "show",
511
- rawName: "v-show",
512
- value: _vm.state.search.input && !_vm.state.search.filterOptions.length,
513
- expression: "state.search.input && !state.search.filterOptions.length"
514
- }],
515
- staticClass: "w-full flex justify-center items-center text-center flex-auto"
516
- }, [_c("tiny-exception", {
517
- attrs: {
518
- "component-page": "",
519
- "type": "noresult",
520
- "tiny_mode": "mobile-first",
521
- "tiny_mode_root": ""
522
- }
523
- })], 1)])])])], 1);
524
- };
525
- var staticRenderFns = [];
526
- var __cssModules = {};
527
- var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
528
- function __vue2_injectStyles(context) {
529
- for (var o in __cssModules) {
530
- this[o] = __cssModules[o];
531
- }
357
+ "body-top": withCtx(function() {
358
+ return [withDirectives(createElementVNode(
359
+ "div",
360
+ _hoisted_2,
361
+ [createElementVNode("div", _hoisted_3, [(openBlock(true), createElementBlock(
362
+ Fragment,
363
+ null,
364
+ renderList(_ctx.state.computedNavList, function(option, index) {
365
+ return openBlock(), createElementBlock("div", {
366
+ key: index,
367
+ class: "flex-none flex leading-5.5"
368
+ }, [index <= _ctx.state.level ? (openBlock(), createElementBlock(
369
+ Fragment,
370
+ {
371
+ key: 0
372
+ },
373
+ [index !== 0 ? (openBlock(), createElementBlock("span", _hoisted_4, "/")) : createCommentVNode("v-if", true), createElementVNode("span", {
374
+ class: normalizeClass(["flex-none max-w-[theme(spacing.24)] truncate", {
375
+ "text-color-brand": index === _ctx.state.level
376
+ }, _ctx.disabledNavOption(index, option) ? "text-color-text-disabled" : "cursor-pointer"]),
377
+ onClick: function onClick($event) {
378
+ return _ctx.setLevel(index, option);
379
+ }
380
+ }, toDisplayString(option.data[_ctx.textField]), 11, _hoisted_5)],
381
+ 64
382
+ /* STABLE_FRAGMENT */
383
+ )) : createCommentVNode("v-if", true)]);
384
+ }),
385
+ 128
386
+ /* KEYED_FRAGMENT */
387
+ )), _hoisted_6])],
388
+ 512
389
+ /* NEED_PATCH */
390
+ ), [[vShow, !_ctx.state.search.show]]), withDirectives(createElementVNode(
391
+ "div",
392
+ _hoisted_7,
393
+ [createElementVNode("div", _hoisted_8, [createVNode(_component_IconSearch, {
394
+ "custom-class": "h-4 w-4",
395
+ class: "mr-1 fill-color-icon-disabled"
396
+ }), withDirectives(createElementVNode("input", {
397
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = function($event) {
398
+ return _ctx.state.search.input = $event;
399
+ }),
400
+ class: "h-5 flex-auto text-xs bg-transparent outline-0",
401
+ placeholder: _ctx.t("ui.select.pleaseSearch"),
402
+ onInput: _cache[1] || (_cache[1] = function() {
403
+ return _ctx.searchMethod && _ctx.searchMethod.apply(_ctx, arguments);
404
+ })
405
+ }, null, 40, _hoisted_9), [[vModelText, _ctx.state.search.input]])]), createElementVNode("div", _hoisted_10, [createElementVNode(
406
+ "div",
407
+ {
408
+ onClick: _cache[2] || (_cache[2] = function($event) {
409
+ return _ctx.searchBoxToggle(false);
410
+ })
411
+ },
412
+ toDisplayString(_ctx.t("ui.base.cancel")),
413
+ 1
414
+ /* TEXT */
415
+ )])],
416
+ 512
417
+ /* NEED_PATCH */
418
+ ), [[vShow, _ctx.state.search.show]])];
419
+ }),
420
+ "header-left": withCtx(function() {
421
+ return [!_ctx.state.search.show ? (openBlock(), createBlock(_component_IconSearch, {
422
+ key: 0,
423
+ "custom-class": "h-5 w-5",
424
+ class: "cursor-pointer",
425
+ onClick: _cache[3] || (_cache[3] = function($event) {
426
+ return _ctx.searchBoxToggle(true);
427
+ })
428
+ })) : createCommentVNode("v-if", true)];
429
+ }),
430
+ footer: withCtx(function() {
431
+ return [withDirectives(createVNode(_component_tiny_button, {
432
+ tiny_mode: "mobile-first",
433
+ class: "flex-1 mx-4 sm:mx-0",
434
+ type: "primary",
435
+ "reset-time": 0,
436
+ onClick: _ctx.confirm
437
+ }, {
438
+ default: withCtx(function() {
439
+ return [createTextVNode(
440
+ toDisplayString(_ctx.t("ui.button.confirm")),
441
+ 1
442
+ /* TEXT */
443
+ )];
444
+ }),
445
+ _: 1
446
+ /* STABLE */
447
+ }, 8, ["onClick"]), [[vShow, _ctx.state.showButton]])];
448
+ }),
449
+ default: withCtx(function() {
450
+ return [withDirectives(createElementVNode(
451
+ "div",
452
+ _hoisted_11,
453
+ [(openBlock(true), createElementBlock(
454
+ Fragment,
455
+ null,
456
+ renderList(_ctx.state.options, function(currentList, index) {
457
+ return withDirectives((openBlock(), createElementBlock("div", {
458
+ "data-tag": "tab-item",
459
+ key: index,
460
+ class: "flex flex-col px-4 overflow-auto pt-2"
461
+ }, [(openBlock(true), createElementBlock(
462
+ Fragment,
463
+ null,
464
+ renderList(currentList, function(item, itemIndex) {
465
+ return openBlock(), createBlock(_component_tiny_option, {
466
+ key: item.data[_ctx.valueField],
467
+ multiple: _ctx.multiple,
468
+ ellipsis: _ctx.ellipsis,
469
+ "text-field": _ctx.textField,
470
+ "text-field2": _ctx.textField2,
471
+ "text-field3": _ctx.textField3,
472
+ loading: _ctx.state.loading,
473
+ option: item,
474
+ selected: _ctx.isSelected(item),
475
+ onClick: function onClick($event) {
476
+ return _ctx.selectOption(item, $event);
477
+ }
478
+ }, {
479
+ default: withCtx(function() {
480
+ return [renderSlot(_ctx.$slots, "default", {
481
+ item,
482
+ index: itemIndex
483
+ })];
484
+ }),
485
+ _: 2
486
+ /* DYNAMIC */
487
+ }, 1032, ["multiple", "ellipsis", "text-field", "text-field2", "text-field3", "loading", "option", "selected", "onClick"]);
488
+ }),
489
+ 128
490
+ /* KEYED_FRAGMENT */
491
+ ))])), [[vShow, index === _ctx.state.level]]);
492
+ }),
493
+ 128
494
+ /* KEYED_FRAGMENT */
495
+ ))],
496
+ 512
497
+ /* NEED_PATCH */
498
+ ), [[vShow, !_ctx.state.search.show]]), withDirectives(createElementVNode(
499
+ "div",
500
+ _hoisted_12,
501
+ [createElementVNode("div", _hoisted_13, [withDirectives(createElementVNode(
502
+ "div",
503
+ _hoisted_14,
504
+ [(openBlock(true), createElementBlock(
505
+ Fragment,
506
+ null,
507
+ renderList(_ctx.state.search.filterOptions, function(item, index) {
508
+ return openBlock(), createBlock(_component_tiny_option, {
509
+ key: index,
510
+ multiple: _ctx.multiple,
511
+ ellipsis: _ctx.ellipsis,
512
+ "text-field": _ctx.textField,
513
+ "text-field2": _ctx.textField2,
514
+ "text-field3": _ctx.textField3,
515
+ option: item,
516
+ selected: _ctx.isSelected(item),
517
+ onClick: function onClick($event) {
518
+ return _ctx.searchSelectHandler(item, index);
519
+ }
520
+ }, {
521
+ default: withCtx(function() {
522
+ return [_ctx.searchConfig.openSearchSlot ? renderSlot(_ctx.$slots, "search-item", {
523
+ key: 0,
524
+ item,
525
+ index
526
+ }) : renderSlot(_ctx.$slots, "default", {
527
+ key: 1,
528
+ item,
529
+ index
530
+ }, function() {
531
+ return [createElementVNode(
532
+ "div",
533
+ {
534
+ class: normalizeClass(["flex-auto", {
535
+ "truncate": _ctx.ellipsis
536
+ }])
537
+ },
538
+ [(openBlock(true), createElementBlock(
539
+ Fragment,
540
+ null,
541
+ renderList(_ctx.renderSearchOption(item[_ctx.textField]), function(text, textIndex) {
542
+ return openBlock(), createElementBlock("span", {
543
+ key: text
544
+ }, [textIndex ? (openBlock(), createElementBlock(
545
+ "span",
546
+ _hoisted_15,
547
+ toDisplayString(_ctx.state.search.input),
548
+ 1
549
+ /* TEXT */
550
+ )) : createCommentVNode("v-if", true), createTextVNode(
551
+ toDisplayString(text),
552
+ 1
553
+ /* TEXT */
554
+ )]);
555
+ }),
556
+ 128
557
+ /* KEYED_FRAGMENT */
558
+ ))],
559
+ 2
560
+ /* CLASS */
561
+ )];
562
+ })];
563
+ }),
564
+ _: 2
565
+ /* DYNAMIC */
566
+ }, 1032, ["multiple", "ellipsis", "text-field", "text-field2", "text-field3", "option", "selected", "onClick"]);
567
+ }),
568
+ 128
569
+ /* KEYED_FRAGMENT */
570
+ ))],
571
+ 512
572
+ /* NEED_PATCH */
573
+ ), [[vShow, _ctx.state.search.filterOptions.length]]), withDirectives(createElementVNode(
574
+ "div",
575
+ _hoisted_16,
576
+ [createVNode(_component_tiny_exception, {
577
+ "component-page": "",
578
+ type: "noresult",
579
+ tiny_mode: "mobile-first",
580
+ tiny_mode_root: ""
581
+ })],
582
+ 512
583
+ /* NEED_PATCH */
584
+ ), [[vShow, _ctx.state.search.input && !_ctx.state.search.filterOptions.length]])])],
585
+ 512
586
+ /* NEED_PATCH */
587
+ ), [[vShow, _ctx.state.search.show]])];
588
+ }),
589
+ _: 3
590
+ /* FORWARDED */
591
+ }, 8, ["title", "visible", "onClose", "show-header"])],
592
+ 512
593
+ /* NEED_PATCH */
594
+ )), [[vShow, _ctx.visible]]);
532
595
  }
533
- var CascaderMobile = /* @__PURE__ */ function() {
534
- return __component__.exports;
535
- }();
536
- var version = "2.22.0";
596
+ var CascaderMobile = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
597
+ var version = "3.22.0";
537
598
  CascaderMobile.model = {
538
599
  prop: "modelValue",
539
600
  event: "update:modelValue"
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@opentinyvue/vue-cascader-mobile",
3
- "version": "2.22.0",
3
+ "version": "3.22.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
7
7
  "sideEffects": false,
8
8
  "type": "module",
9
9
  "dependencies": {
10
- "@opentinyvue/vue-button": "~2.22.0",
11
- "@opentinyvue/vue-action-sheet": "~2.22.0",
12
- "@opentinyvue/vue-exception": "~2.22.0",
13
- "@opentinyvue/vue-common": "~2.22.0",
10
+ "@opentinyvue/vue-button": "~3.22.0",
11
+ "@opentinyvue/vue-action-sheet": "~3.22.0",
12
+ "@opentinyvue/vue-exception": "~3.22.0",
13
+ "@opentinyvue/vue-common": "~3.22.0",
14
14
  "@opentinyvue/vue-renderless": "~3.22.0",
15
- "@opentinyvue/vue-icon": "~2.22.0",
16
- "@opentinyvue/vue-locale": "~2.22.0"
15
+ "@opentinyvue/vue-icon": "~3.22.0",
16
+ "@opentinyvue/vue-locale": "~3.22.0"
17
17
  },
18
18
  "license": "MIT",
19
19
  "types": "index.d.ts",
@@ -1,2 +1,233 @@
1
- declare const _default: any;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<{
2
+ _constants: {
3
+ type: ObjectConstructor;
4
+ default: () => {
5
+ defaultNodeConfig: {
6
+ lazy: boolean;
7
+ load: null;
8
+ isLeaf: string;
9
+ afterLoad: null;
10
+ currentNodeKey: null;
11
+ checkStrictly: boolean;
12
+ checkDescendants: null;
13
+ defaultCheckedKeys: null;
14
+ defaultExpandedKeys: null;
15
+ autoExpandParent: null;
16
+ defaultExpandAll: null;
17
+ filterNodeMethod: null;
18
+ };
19
+ };
20
+ };
21
+ data: {
22
+ type: ArrayConstructor;
23
+ default: () => never[];
24
+ };
25
+ modelValue: (StringConstructor | NumberConstructor | ArrayConstructor)[];
26
+ visible: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ ellipsis: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ valueField: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ placeholder: {
39
+ type: (StringConstructor | ArrayConstructor)[];
40
+ default: any;
41
+ };
42
+ childrenField: {
43
+ type: StringConstructor;
44
+ default: string;
45
+ };
46
+ textField: {
47
+ type: StringConstructor;
48
+ default: string;
49
+ };
50
+ textField2: {
51
+ type: StringConstructor;
52
+ default: string;
53
+ };
54
+ textField3: {
55
+ type: StringConstructor;
56
+ default: string;
57
+ };
58
+ title: StringConstructor;
59
+ textSplit: {
60
+ type: StringConstructor;
61
+ default: string;
62
+ };
63
+ showHeader: {
64
+ type: BooleanConstructor;
65
+ default: boolean;
66
+ };
67
+ multiple: BooleanConstructor;
68
+ searchConfig: {
69
+ type: ObjectConstructor;
70
+ default: () => {
71
+ options: never[];
72
+ searchMethod: null;
73
+ openSearchSlot: boolean;
74
+ };
75
+ };
76
+ nodeConfig: {
77
+ type: ObjectConstructor;
78
+ default: () => {
79
+ lazy: boolean;
80
+ load: null;
81
+ isLeaf: string;
82
+ afterLoad: null;
83
+ currentNodeKey: null;
84
+ checkStrictly: boolean;
85
+ checkDescendants: null;
86
+ defaultCheckedKeys: null;
87
+ defaultExpandedKeys: null;
88
+ autoExpandParent: null;
89
+ defaultExpandAll: null;
90
+ filterNodeMethod: null;
91
+ };
92
+ };
93
+ tiny_mode: StringConstructor;
94
+ tiny_mode_root: BooleanConstructor;
95
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
96
+ tiny_renderless: FunctionConstructor;
97
+ tiny_theme: StringConstructor;
98
+ tiny_chart_theme: ObjectConstructor;
99
+ }, {
100
+ t: (this: any, path: any, options?: any) => any;
101
+ vm: any;
102
+ f: (props: any, attrs?: {}) => {};
103
+ a: (attrs: any, filters: any, include: any) => {};
104
+ d: (props: any) => void;
105
+ dp: (props: any) => void;
106
+ gcls: (key: any) => any;
107
+ m: (...cssClasses: any[]) => string;
108
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, ("click" | "close" | "update:modelValue" | "update:visible" | "confirm" | "node-expand" | "update:text" | "search-click")[], "click" | "close" | "update:modelValue" | "update:visible" | "confirm" | "node-expand" | "update:text" | "search-click", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
109
+ _constants: {
110
+ type: ObjectConstructor;
111
+ default: () => {
112
+ defaultNodeConfig: {
113
+ lazy: boolean;
114
+ load: null;
115
+ isLeaf: string;
116
+ afterLoad: null;
117
+ currentNodeKey: null;
118
+ checkStrictly: boolean;
119
+ checkDescendants: null;
120
+ defaultCheckedKeys: null;
121
+ defaultExpandedKeys: null;
122
+ autoExpandParent: null;
123
+ defaultExpandAll: null;
124
+ filterNodeMethod: null;
125
+ };
126
+ };
127
+ };
128
+ data: {
129
+ type: ArrayConstructor;
130
+ default: () => never[];
131
+ };
132
+ modelValue: (StringConstructor | NumberConstructor | ArrayConstructor)[];
133
+ visible: {
134
+ type: BooleanConstructor;
135
+ default: boolean;
136
+ };
137
+ ellipsis: {
138
+ type: BooleanConstructor;
139
+ default: boolean;
140
+ };
141
+ valueField: {
142
+ type: StringConstructor;
143
+ default: string;
144
+ };
145
+ placeholder: {
146
+ type: (StringConstructor | ArrayConstructor)[];
147
+ default: any;
148
+ };
149
+ childrenField: {
150
+ type: StringConstructor;
151
+ default: string;
152
+ };
153
+ textField: {
154
+ type: StringConstructor;
155
+ default: string;
156
+ };
157
+ textField2: {
158
+ type: StringConstructor;
159
+ default: string;
160
+ };
161
+ textField3: {
162
+ type: StringConstructor;
163
+ default: string;
164
+ };
165
+ title: StringConstructor;
166
+ textSplit: {
167
+ type: StringConstructor;
168
+ default: string;
169
+ };
170
+ showHeader: {
171
+ type: BooleanConstructor;
172
+ default: boolean;
173
+ };
174
+ multiple: BooleanConstructor;
175
+ searchConfig: {
176
+ type: ObjectConstructor;
177
+ default: () => {
178
+ options: never[];
179
+ searchMethod: null;
180
+ openSearchSlot: boolean;
181
+ };
182
+ };
183
+ nodeConfig: {
184
+ type: ObjectConstructor;
185
+ default: () => {
186
+ lazy: boolean;
187
+ load: null;
188
+ isLeaf: string;
189
+ afterLoad: null;
190
+ currentNodeKey: null;
191
+ checkStrictly: boolean;
192
+ checkDescendants: null;
193
+ defaultCheckedKeys: null;
194
+ defaultExpandedKeys: null;
195
+ autoExpandParent: null;
196
+ defaultExpandAll: null;
197
+ filterNodeMethod: null;
198
+ };
199
+ };
200
+ tiny_mode: StringConstructor;
201
+ tiny_mode_root: BooleanConstructor;
202
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
203
+ tiny_renderless: FunctionConstructor;
204
+ tiny_theme: StringConstructor;
205
+ tiny_chart_theme: ObjectConstructor;
206
+ }>> & {
207
+ onClick?: ((...args: any[]) => any) | undefined;
208
+ onClose?: ((...args: any[]) => any) | undefined;
209
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
210
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
211
+ onConfirm?: ((...args: any[]) => any) | undefined;
212
+ "onNode-expand"?: ((...args: any[]) => any) | undefined;
213
+ "onUpdate:text"?: ((...args: any[]) => any) | undefined;
214
+ "onSearch-click"?: ((...args: any[]) => any) | undefined;
215
+ }, {
216
+ data: unknown[];
217
+ ellipsis: boolean;
218
+ visible: boolean;
219
+ tiny_mode_root: boolean;
220
+ _constants: Record<string, any>;
221
+ textField: string;
222
+ valueField: string;
223
+ showHeader: boolean;
224
+ placeholder: string | unknown[];
225
+ multiple: boolean;
226
+ searchConfig: Record<string, any>;
227
+ childrenField: string;
228
+ textSplit: string;
229
+ nodeConfig: Record<string, any>;
230
+ textField2: string;
231
+ textField3: string;
232
+ }, {}>;
2
233
  export default _default;
@@ -1,2 +1,33 @@
1
- declare const _default: import("vue/types/vue").ExtendedVue<import("vue").default, any, any, any, Record<"option" | "ellipsis" | "selected" | "loading" | "textField" | "multiple" | "textField2" | "textField3", any>>;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
2
+ ellipsis?: any;
3
+ option?: any;
4
+ selected?: any;
5
+ loading?: any;
6
+ textField?: any;
7
+ multiple?: any;
8
+ textField2?: any;
9
+ textField3?: any;
10
+ }>, any, any, {
11
+ data(): any;
12
+ }, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, "click"[], "click", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
13
+ ellipsis?: any;
14
+ option?: any;
15
+ selected?: any;
16
+ loading?: any;
17
+ textField?: any;
18
+ multiple?: any;
19
+ textField2?: any;
20
+ textField3?: any;
21
+ }>>> & {
22
+ onClick?: ((...args: any[]) => any) | undefined;
23
+ }, {
24
+ readonly ellipsis?: any;
25
+ readonly option?: any;
26
+ readonly selected?: any;
27
+ readonly loading?: any;
28
+ readonly textField?: any;
29
+ readonly multiple?: any;
30
+ readonly textField2?: any;
31
+ readonly textField3?: any;
32
+ }, {}>;
2
33
  export default _default;