@opentinyvue/vue-cascader-view 2.21.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/LICENSE +22 -0
- package/index.d.ts +2 -0
- package/lib/index.js +637 -0
- package/package.json +24 -0
- package/src/mobile-first.vue.d.ts +2 -0
- package/src/option.vue.d.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - present TinyVue Authors.
|
|
4
|
+
Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/cascader-view/vue';
|
|
2
|
+
import { defineComponent, $prefix, setup, $props } from '@opentinyvue/vue-common';
|
|
3
|
+
import { IconChevronRight, IconChevronUp, IconSearch, IconOperationfaild, IconChevronLeft } from '@opentinyvue/vue-icon';
|
|
4
|
+
import Button from '@opentinyvue/vue-button';
|
|
5
|
+
import ActionSheet from '@opentinyvue/vue-action-sheet';
|
|
6
|
+
import Exception from '@opentinyvue/vue-exception';
|
|
7
|
+
import Checkbox from '@opentinyvue/vue-checkbox';
|
|
8
|
+
|
|
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;
|
|
15
|
+
}
|
|
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
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
exports: scriptExports,
|
|
35
|
+
options
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function _extends() {
|
|
40
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
41
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
42
|
+
var t = arguments[e];
|
|
43
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
44
|
+
}
|
|
45
|
+
return n;
|
|
46
|
+
}, _extends.apply(null, arguments);
|
|
47
|
+
}
|
|
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 cursor-pointer select-none",
|
|
54
|
+
on: {
|
|
55
|
+
"click": function click($event) {
|
|
56
|
+
return _vm.$emit("click", $event);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [_vm.option ? _c("span", {
|
|
60
|
+
staticClass: "w-11 h-11 flex-none flex items-center justify-center relative",
|
|
61
|
+
on: {
|
|
62
|
+
"click": function click($event) {
|
|
63
|
+
$event.stopPropagation();
|
|
64
|
+
return _vm.$emit("check", _vm.option);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, [_c("div", {
|
|
68
|
+
staticClass: "absolute left-0 right-0 top-0 bottom-0 z-20"
|
|
69
|
+
}), _c("tiny-checkbox", {
|
|
70
|
+
attrs: {
|
|
71
|
+
"custom-class": "flex h-full w-full items-center justify-center",
|
|
72
|
+
"model-value": !_vm.option.indeterminate && _vm.option.checked,
|
|
73
|
+
"indeterminate": _vm.option.indeterminate,
|
|
74
|
+
"disabled": _vm.data.disabled
|
|
75
|
+
}
|
|
76
|
+
})], 1) : _vm._e(), _c("div", {
|
|
77
|
+
class: ["flex-auto flex w-full text-sm py-3", {
|
|
78
|
+
"truncate": _vm.ellipsis
|
|
79
|
+
}],
|
|
80
|
+
on: {
|
|
81
|
+
"click": function click($event) {
|
|
82
|
+
$event.stopPropagation();
|
|
83
|
+
return _vm.$emit("expand", _vm.option);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [_vm._t("default", function() {
|
|
87
|
+
return [_c("div", {
|
|
88
|
+
class: ["flex-auto", {
|
|
89
|
+
"truncate": _vm.ellipsis
|
|
90
|
+
}]
|
|
91
|
+
}, [_c("div", {
|
|
92
|
+
staticClass: "flex"
|
|
93
|
+
}, [_c("div", {
|
|
94
|
+
class: [{
|
|
95
|
+
"min-w-[theme(spacing.14)]": !_vm.textField3
|
|
96
|
+
}, {
|
|
97
|
+
"truncate": _vm.ellipsis
|
|
98
|
+
}]
|
|
99
|
+
}, [_vm._v(" " + _vm._s(_vm.data[_vm.textField]) + " ")]), _vm.textField2 ? _c("div", {
|
|
100
|
+
class: ["ml-5 text-color-text-placeholder", {
|
|
101
|
+
"truncate": _vm.ellipsis
|
|
102
|
+
}]
|
|
103
|
+
}, [_vm._v(" " + _vm._s(_vm.data[_vm.textField2]) + " ")]) : _vm._e()]), _vm.textField3 ? _c("div", {
|
|
104
|
+
class: ["text-color-text-placeholder", {
|
|
105
|
+
"truncate": _vm.ellipsis
|
|
106
|
+
}]
|
|
107
|
+
}, [_vm._v(" " + _vm._s(_vm.data[_vm.textField3]) + " ")]) : _vm._e()]), !_vm.loading && !_vm.option.isLeaf ? _c("div", {
|
|
108
|
+
staticClass: "flex flex-none w-8 items-center justify-end ml-2"
|
|
109
|
+
}, [_c("IconChevronRight", {
|
|
110
|
+
attrs: {
|
|
111
|
+
"custom-class": "w-4 h-4 fill-current"
|
|
112
|
+
}
|
|
113
|
+
})], 1) : _vm._e(), _vm.option.loading ? _c("div", {
|
|
114
|
+
staticClass: "flex flex-none w-5 items-center justify-center ml-2"
|
|
115
|
+
}, [_c("svg", {
|
|
116
|
+
staticClass: "animate-[spin_1.5s_linear_infinite] fill-current",
|
|
117
|
+
attrs: {
|
|
118
|
+
"viewBox": "25 25 50 50"
|
|
119
|
+
}
|
|
120
|
+
}, [_c("circle", {
|
|
121
|
+
staticClass: "stroke-color-brand tiny-loading-path",
|
|
122
|
+
attrs: {
|
|
123
|
+
"cx": "50",
|
|
124
|
+
"cy": "50",
|
|
125
|
+
"r": "24",
|
|
126
|
+
"fill": "none"
|
|
127
|
+
}
|
|
128
|
+
})])]) : _vm._e()];
|
|
129
|
+
})], 2)]);
|
|
130
|
+
};
|
|
131
|
+
var staticRenderFns$1 = [];
|
|
132
|
+
var __vue2_script$1 = {
|
|
133
|
+
emits: ["click"],
|
|
134
|
+
components: {
|
|
135
|
+
TinyCheckbox: Checkbox,
|
|
136
|
+
IconChevronRight: IconChevronRight()
|
|
137
|
+
},
|
|
138
|
+
props: ["selected", "ellipsis", "option", "textField", "textField2", "textField3", "loading"],
|
|
139
|
+
computed: {
|
|
140
|
+
data: function data() {
|
|
141
|
+
return this.option.data || this.option;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var __cssModules$1 = {};
|
|
146
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1);
|
|
147
|
+
function __vue2_injectStyles$1(context) {
|
|
148
|
+
for (var o in __cssModules$1) {
|
|
149
|
+
this[o] = __cssModules$1[o];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
var Option = /* @__PURE__ */ function() {
|
|
153
|
+
return __component__$1.exports;
|
|
154
|
+
}();
|
|
155
|
+
var $constants = {
|
|
156
|
+
defaultNodeConfig: {
|
|
157
|
+
lazy: false,
|
|
158
|
+
load: null,
|
|
159
|
+
isLeaf: "leaf",
|
|
160
|
+
afterLoad: null,
|
|
161
|
+
currentNodeKey: null,
|
|
162
|
+
checkStrictly: false,
|
|
163
|
+
checkDescendants: null,
|
|
164
|
+
defaultCheckedKeys: null,
|
|
165
|
+
defaultExpandedKeys: null,
|
|
166
|
+
autoExpandParent: null,
|
|
167
|
+
defaultExpandAll: null,
|
|
168
|
+
filterNodeMethod: null
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
var __vue2_script = defineComponent({
|
|
172
|
+
name: $prefix + "CascaderView",
|
|
173
|
+
emits: ["click", "update:text", "update:visible", "close", "update:modelValue", "search-click", "confirm"],
|
|
174
|
+
components: {
|
|
175
|
+
TinyOption: Option,
|
|
176
|
+
TinyActionSheet: ActionSheet,
|
|
177
|
+
TinyButton: Button,
|
|
178
|
+
TinyException: Exception,
|
|
179
|
+
IconChevronRight: IconChevronRight(),
|
|
180
|
+
IconChevronUp: IconChevronUp(),
|
|
181
|
+
IconSearch: IconSearch(),
|
|
182
|
+
IconOperationfaild: IconOperationfaild(),
|
|
183
|
+
IconChevronLeft: IconChevronLeft()
|
|
184
|
+
},
|
|
185
|
+
props: _extends({}, $props, {
|
|
186
|
+
_constants: {
|
|
187
|
+
type: Object,
|
|
188
|
+
default: function _default() {
|
|
189
|
+
return $constants;
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
data: {
|
|
193
|
+
type: Array,
|
|
194
|
+
default: function _default2() {
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
modelValue: [Number, String, Array],
|
|
199
|
+
visible: {
|
|
200
|
+
type: Boolean,
|
|
201
|
+
default: false
|
|
202
|
+
},
|
|
203
|
+
valueField: {
|
|
204
|
+
type: String,
|
|
205
|
+
default: "id"
|
|
206
|
+
},
|
|
207
|
+
textField: {
|
|
208
|
+
type: String,
|
|
209
|
+
default: "label"
|
|
210
|
+
},
|
|
211
|
+
textField2: {
|
|
212
|
+
type: String,
|
|
213
|
+
default: ""
|
|
214
|
+
},
|
|
215
|
+
textField3: {
|
|
216
|
+
type: String,
|
|
217
|
+
default: ""
|
|
218
|
+
},
|
|
219
|
+
title: String,
|
|
220
|
+
textSplit: {
|
|
221
|
+
type: String,
|
|
222
|
+
default: "; "
|
|
223
|
+
},
|
|
224
|
+
showHeader: {
|
|
225
|
+
type: Boolean,
|
|
226
|
+
default: true
|
|
227
|
+
},
|
|
228
|
+
customClass: [String, Object, Array],
|
|
229
|
+
mask: {
|
|
230
|
+
type: Boolean,
|
|
231
|
+
default: true
|
|
232
|
+
},
|
|
233
|
+
ellipsis: {
|
|
234
|
+
type: Boolean,
|
|
235
|
+
default: false
|
|
236
|
+
},
|
|
237
|
+
searchConfig: {
|
|
238
|
+
type: Object,
|
|
239
|
+
default: function _default3() {
|
|
240
|
+
return {
|
|
241
|
+
options: [],
|
|
242
|
+
searchMethod: null,
|
|
243
|
+
openSearchSlot: false
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
childrenField: {
|
|
248
|
+
type: String,
|
|
249
|
+
default: "children"
|
|
250
|
+
},
|
|
251
|
+
nodeConfig: {
|
|
252
|
+
type: Object,
|
|
253
|
+
default: function _default4() {
|
|
254
|
+
return $constants.defaultNodeConfig;
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
lockScroll: {
|
|
258
|
+
type: Boolean,
|
|
259
|
+
default: true
|
|
260
|
+
},
|
|
261
|
+
emitPath: {
|
|
262
|
+
type: Boolean,
|
|
263
|
+
default: true
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
setup: function setup$1(props, context) {
|
|
267
|
+
return setup({
|
|
268
|
+
props,
|
|
269
|
+
context,
|
|
270
|
+
renderless,
|
|
271
|
+
api,
|
|
272
|
+
mono: true
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
var render = function render2() {
|
|
277
|
+
var _vm = this;
|
|
278
|
+
var _h = _vm.$createElement;
|
|
279
|
+
var _c = _vm._self._c || _h;
|
|
280
|
+
return _c("div", {
|
|
281
|
+
attrs: {
|
|
282
|
+
"data-tag": "tiny-cascader-view"
|
|
283
|
+
}
|
|
284
|
+
}, [_c("tiny-action-sheet", {
|
|
285
|
+
ref: "actionSheet",
|
|
286
|
+
attrs: {
|
|
287
|
+
"title": _vm.title,
|
|
288
|
+
"lock-scroll": _vm.lockScroll,
|
|
289
|
+
"mask": _vm.mask,
|
|
290
|
+
"show-header": _vm.showHeader,
|
|
291
|
+
"custom-class": _vm.m("h-full max-h-full rounded-none text-color-text-primary pb-0", _vm.customClass),
|
|
292
|
+
"visible": _vm.visible
|
|
293
|
+
},
|
|
294
|
+
on: {
|
|
295
|
+
"update:visible": function updateVisible($event) {
|
|
296
|
+
return _vm.$emit("update:visible", $event);
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
scopedSlots: _vm._u([{
|
|
300
|
+
key: "header-left",
|
|
301
|
+
fn: function fn() {
|
|
302
|
+
return [_c("IconChevronLeft", {
|
|
303
|
+
staticClass: "h-5 w-5 fill-color-text-primary cursor-pointer",
|
|
304
|
+
on: {
|
|
305
|
+
"click": _vm.close
|
|
306
|
+
}
|
|
307
|
+
})];
|
|
308
|
+
},
|
|
309
|
+
proxy: true
|
|
310
|
+
}, {
|
|
311
|
+
key: "header-right",
|
|
312
|
+
fn: function fn() {
|
|
313
|
+
return [_c("div")];
|
|
314
|
+
},
|
|
315
|
+
proxy: true
|
|
316
|
+
}, {
|
|
317
|
+
key: "body-top",
|
|
318
|
+
fn: function fn() {
|
|
319
|
+
return [_c("div", {
|
|
320
|
+
staticClass: "flex leading-6 pb-4 px-4 text-base items-center border-b-0.5 border-color-border-separator",
|
|
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"
|
|
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.inputKeyword],
|
|
350
|
+
"keyup": function keyup($event) {
|
|
351
|
+
if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) return null;
|
|
352
|
+
return _vm.searchMethod.apply(null, arguments);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
})], 1), _c("div", {
|
|
356
|
+
staticClass: "flex items-center pl-3 cursor-pointer"
|
|
357
|
+
}, [_c("div", {
|
|
358
|
+
on: {
|
|
359
|
+
"click": _vm.searchMethod
|
|
360
|
+
}
|
|
361
|
+
}, [_vm._v(_vm._s(_vm.t("ui.select.search")))])])]), _c("div", {
|
|
362
|
+
directives: [{
|
|
363
|
+
name: "show",
|
|
364
|
+
rawName: "v-show",
|
|
365
|
+
value: !_vm.state.search.show,
|
|
366
|
+
expression: "!state.search.show"
|
|
367
|
+
}],
|
|
368
|
+
staticClass: "h-11 flex flex-none items-center border-b-0.5 border-color-border-separator overflow-auto whitespace-nowrap scrollbar-size-0",
|
|
369
|
+
attrs: {
|
|
370
|
+
"data-tag": "nav-box"
|
|
371
|
+
}
|
|
372
|
+
}, [_c("div", {
|
|
373
|
+
staticClass: "px-4 flex"
|
|
374
|
+
}, [_vm._l(_vm.state.computedNavList, function(option, index) {
|
|
375
|
+
return _c("div", {
|
|
376
|
+
key: index,
|
|
377
|
+
staticClass: "flex-none flex items-center"
|
|
378
|
+
}, [index !== 0 ? _c("span", {
|
|
379
|
+
staticClass: "px-2 text-color-text-placeholder flex items-center"
|
|
380
|
+
}, [_c("IconChevronRight", {
|
|
381
|
+
attrs: {
|
|
382
|
+
"custom-class": "w-4 h-4 fill-current"
|
|
383
|
+
}
|
|
384
|
+
})], 1) : _vm._e(), _c("span", {
|
|
385
|
+
class: ["flex-none max-w-[theme(spacing.24)] truncate", {
|
|
386
|
+
"text-color-brand": index === _vm.state.level
|
|
387
|
+
}, _vm.disabledNavOption(index, option) ? "text-color-text-disabled" : "cursor-pointer"],
|
|
388
|
+
on: {
|
|
389
|
+
"click": function click($event) {
|
|
390
|
+
return _vm.setLevel(index, option);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}, [_vm._v(_vm._s(option.data[_vm.textField]))])]);
|
|
394
|
+
}), _c("div", {
|
|
395
|
+
staticClass: "flex-auto"
|
|
396
|
+
})], 2)])];
|
|
397
|
+
},
|
|
398
|
+
proxy: true
|
|
399
|
+
}, {
|
|
400
|
+
key: "body-bottom",
|
|
401
|
+
fn: function fn() {
|
|
402
|
+
return [_c("div", {
|
|
403
|
+
staticClass: "flex items-center py-4 px-3 border-t border-color-bg-4 shadow-sm",
|
|
404
|
+
attrs: {
|
|
405
|
+
"data-tag": "view-footer"
|
|
406
|
+
}
|
|
407
|
+
}, [_c("div", {
|
|
408
|
+
staticClass: "cursor-pointer pr-2 leading-5.5",
|
|
409
|
+
on: {
|
|
410
|
+
"click": function click($event) {
|
|
411
|
+
$event.stopPropagation();
|
|
412
|
+
return _vm.toggleCheckList(true);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}, [_c("span", [_vm._v(_vm._s(_vm.t("ui.select.selectedNum", {
|
|
416
|
+
num: _vm.state.computedCheckList.length
|
|
417
|
+
})))]), _c("IconChevronUp", {
|
|
418
|
+
directives: [{
|
|
419
|
+
name: "show",
|
|
420
|
+
rawName: "v-show",
|
|
421
|
+
value: _vm.state.computedCheckList.length,
|
|
422
|
+
expression: "state.computedCheckList.length"
|
|
423
|
+
}],
|
|
424
|
+
staticClass: "flex-none w-4 h-4 ml-2 fill-current"
|
|
425
|
+
})], 1), _c("div", {
|
|
426
|
+
staticClass: "flex-auto"
|
|
427
|
+
}), _c("tiny-button", {
|
|
428
|
+
staticClass: "flex-none ml-3 w-28",
|
|
429
|
+
attrs: {
|
|
430
|
+
"tiny_mode": "mobile-first",
|
|
431
|
+
"type": "primary",
|
|
432
|
+
"size": "medium",
|
|
433
|
+
"reset-time": 0
|
|
434
|
+
},
|
|
435
|
+
on: {
|
|
436
|
+
"click": _vm.confirm
|
|
437
|
+
}
|
|
438
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.button.confirm")) + " ")])], 1)];
|
|
439
|
+
},
|
|
440
|
+
proxy: true
|
|
441
|
+
}])
|
|
442
|
+
}, [_c("div", {
|
|
443
|
+
directives: [{
|
|
444
|
+
name: "show",
|
|
445
|
+
rawName: "v-show",
|
|
446
|
+
value: !_vm.state.search.show,
|
|
447
|
+
expression: "!state.search.show"
|
|
448
|
+
}],
|
|
449
|
+
staticClass: "flex-auto",
|
|
450
|
+
attrs: {
|
|
451
|
+
"data-tag": "tabs"
|
|
452
|
+
}
|
|
453
|
+
}, _vm._l(_vm.state.options, function(currentList, index) {
|
|
454
|
+
return _c("div", {
|
|
455
|
+
directives: [{
|
|
456
|
+
name: "show",
|
|
457
|
+
rawName: "v-show",
|
|
458
|
+
value: index === _vm.state.level,
|
|
459
|
+
expression: "index === state.level"
|
|
460
|
+
}],
|
|
461
|
+
key: index,
|
|
462
|
+
staticClass: "flex flex-col px-4 overflow-auto pt-2",
|
|
463
|
+
attrs: {
|
|
464
|
+
"data-tag": "tab-item"
|
|
465
|
+
}
|
|
466
|
+
}, _vm._l(currentList, function(item, OptIndex) {
|
|
467
|
+
return _c("tiny-option", {
|
|
468
|
+
key: item.data[_vm.valueField],
|
|
469
|
+
attrs: {
|
|
470
|
+
"ellipsis": _vm.ellipsis,
|
|
471
|
+
"text-field": _vm.textField,
|
|
472
|
+
"text-field2": _vm.textField2,
|
|
473
|
+
"text-field3": _vm.textField3,
|
|
474
|
+
"loading": _vm.state.loading,
|
|
475
|
+
"option": item
|
|
476
|
+
},
|
|
477
|
+
on: {
|
|
478
|
+
"check": function check($event) {
|
|
479
|
+
return _vm.selectOption(item);
|
|
480
|
+
},
|
|
481
|
+
"expand": _vm.nodeExpand
|
|
482
|
+
}
|
|
483
|
+
}, [_vm._t("default", null, {
|
|
484
|
+
"item": item,
|
|
485
|
+
"index": OptIndex
|
|
486
|
+
})], 2);
|
|
487
|
+
}), 1);
|
|
488
|
+
}), 0), _c("div", {
|
|
489
|
+
class: [_vm.state.search.show ? "flex flex-col flex-auto" : "hidden"],
|
|
490
|
+
attrs: {
|
|
491
|
+
"data-tag": "search-box"
|
|
492
|
+
}
|
|
493
|
+
}, [_c("div", {
|
|
494
|
+
staticClass: "flex-auto overflow-auto flex flex-col",
|
|
495
|
+
attrs: {
|
|
496
|
+
"data-tag": "search-body"
|
|
497
|
+
}
|
|
498
|
+
}, [_c("div", {
|
|
499
|
+
class: ["flex flex-col px-4"]
|
|
500
|
+
}, _vm._l(_vm.state.search.filterOptions, function(item, index) {
|
|
501
|
+
return _c("tiny-option", {
|
|
502
|
+
key: index,
|
|
503
|
+
attrs: {
|
|
504
|
+
"ellipsis": _vm.ellipsis,
|
|
505
|
+
"text-field": _vm.textField,
|
|
506
|
+
"text-field2": _vm.textField2,
|
|
507
|
+
"text-field3": _vm.textField3,
|
|
508
|
+
"option": item.node
|
|
509
|
+
},
|
|
510
|
+
on: {
|
|
511
|
+
"check": function check($event) {
|
|
512
|
+
return _vm.searchSelectHandler(item.node, index);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}, [_vm.searchConfig.openSearchSlot ? _vm._t("search-item", null, {
|
|
516
|
+
"item": item,
|
|
517
|
+
"index": index
|
|
518
|
+
}) : _vm._t("default", function() {
|
|
519
|
+
return [_c("div", {
|
|
520
|
+
class: ["flex-auto", {
|
|
521
|
+
"truncate": _vm.ellipsis
|
|
522
|
+
}]
|
|
523
|
+
}, _vm._l(_vm.renderSearchOption(item.data[_vm.textField]), function(text, spanIndex) {
|
|
524
|
+
return _c("span", {
|
|
525
|
+
key: spanIndex
|
|
526
|
+
}, [spanIndex ? _c("span", {
|
|
527
|
+
staticClass: "text-color-brand"
|
|
528
|
+
}, [_vm._v(_vm._s(_vm.state.search.input))]) : _vm._e(), _vm._v(_vm._s(text))]);
|
|
529
|
+
}), 0)];
|
|
530
|
+
}, {
|
|
531
|
+
"item": item,
|
|
532
|
+
"index": index
|
|
533
|
+
})], 2);
|
|
534
|
+
}), 1), _c("div", {
|
|
535
|
+
directives: [{
|
|
536
|
+
name: "show",
|
|
537
|
+
rawName: "v-show",
|
|
538
|
+
value: _vm.state.search.loaded && !_vm.state.search.filterOptions.length,
|
|
539
|
+
expression: "state.search.loaded && !state.search.filterOptions.length"
|
|
540
|
+
}],
|
|
541
|
+
staticClass: "w-full flex justify-center items-center text-center flex-auto"
|
|
542
|
+
}, [_c("tiny-exception", {
|
|
543
|
+
attrs: {
|
|
544
|
+
"component-page": "",
|
|
545
|
+
"type": "noresult",
|
|
546
|
+
"tiny_mode": "mobile-first",
|
|
547
|
+
"tiny_mode_root": ""
|
|
548
|
+
}
|
|
549
|
+
})], 1)])])]), _c("tiny-action-sheet", {
|
|
550
|
+
attrs: {
|
|
551
|
+
"data-tag": "selected-box",
|
|
552
|
+
"custom-class": "h-3/4 text-color-text-primary",
|
|
553
|
+
"title": _vm.t("ui.select.selected"),
|
|
554
|
+
"show-footer": "",
|
|
555
|
+
"lock-scroll": false,
|
|
556
|
+
"menus": _vm.state.selected.options,
|
|
557
|
+
"visible": _vm.state.selected.show
|
|
558
|
+
},
|
|
559
|
+
on: {
|
|
560
|
+
"update:visible": function updateVisible($event) {
|
|
561
|
+
_vm.state.selected.show = $event;
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
scopedSlots: _vm._u([{
|
|
565
|
+
key: "header-left",
|
|
566
|
+
fn: function fn() {
|
|
567
|
+
return [_c("div", {
|
|
568
|
+
staticClass: "cursor-pointer text-color-brand",
|
|
569
|
+
on: {
|
|
570
|
+
"click": _vm.clean
|
|
571
|
+
}
|
|
572
|
+
}, [_vm._v(_vm._s(_vm.t("ui.datepicker.clear")))])];
|
|
573
|
+
},
|
|
574
|
+
proxy: true
|
|
575
|
+
}, {
|
|
576
|
+
key: "footer",
|
|
577
|
+
fn: function fn() {
|
|
578
|
+
return [_c("tiny-button", {
|
|
579
|
+
attrs: {
|
|
580
|
+
"tiny_mode": "mobile-first",
|
|
581
|
+
"custom-class": "flex-1 w-full mx-4 sm:mx-0",
|
|
582
|
+
"type": "primary",
|
|
583
|
+
"size": "medium",
|
|
584
|
+
"reset-time": 0
|
|
585
|
+
},
|
|
586
|
+
on: {
|
|
587
|
+
"click": function click($event) {
|
|
588
|
+
return _vm.toggleCheckList(false);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.button.confirm")) + " ")])];
|
|
592
|
+
},
|
|
593
|
+
proxy: true
|
|
594
|
+
}])
|
|
595
|
+
}, [_c("div", {
|
|
596
|
+
staticClass: "h-full overflow-auto scrollbar-size-0"
|
|
597
|
+
}, _vm._l(_vm.state.computedSelectedList, function(item, index) {
|
|
598
|
+
return _c("tiny-option", {
|
|
599
|
+
key: index
|
|
600
|
+
}, [_c("div", {
|
|
601
|
+
staticClass: "flex flex-auto px-4 items-center overflow-hidden"
|
|
602
|
+
}, [_c("div", {
|
|
603
|
+
staticClass: "flex-auto truncate min-w-[theme(spacing.14)]"
|
|
604
|
+
}, [_vm._v(" " + _vm._s(item.waitLoad ? item.data[_vm.valueField] : item.getPathText(_vm.textField, " / ")) + " ")]), _c("div", {
|
|
605
|
+
staticClass: "flex-none pl-4 text-right"
|
|
606
|
+
}, [_c("IconOperationfaild", {
|
|
607
|
+
staticClass: "w-5 h-5 fill-color-text-placeholder",
|
|
608
|
+
on: {
|
|
609
|
+
"click": function click($event) {
|
|
610
|
+
return _vm.removeOption(item);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
})], 1)])]);
|
|
614
|
+
}), 1)])], 1);
|
|
615
|
+
};
|
|
616
|
+
var staticRenderFns = [];
|
|
617
|
+
var __cssModules = {};
|
|
618
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
619
|
+
function __vue2_injectStyles(context) {
|
|
620
|
+
for (var o in __cssModules) {
|
|
621
|
+
this[o] = __cssModules[o];
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
var CascaderView = /* @__PURE__ */ function() {
|
|
625
|
+
return __component__.exports;
|
|
626
|
+
}();
|
|
627
|
+
var version = "2.21.0";
|
|
628
|
+
CascaderView.model = {
|
|
629
|
+
prop: "modelValue",
|
|
630
|
+
event: "update:modelValue"
|
|
631
|
+
};
|
|
632
|
+
CascaderView.install = function(Vue) {
|
|
633
|
+
Vue.component(CascaderView.name, CascaderView);
|
|
634
|
+
};
|
|
635
|
+
CascaderView.version = version;
|
|
636
|
+
|
|
637
|
+
export { CascaderView as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-cascader-view",
|
|
3
|
+
"version": "2.21.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@opentinyvue/vue-icon": "~2.21.0",
|
|
11
|
+
"@opentinyvue/vue-button": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-exception": "~2.21.0",
|
|
13
|
+
"@opentinyvue/vue-action-sheet": "~2.21.0",
|
|
14
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
15
|
+
"@opentinyvue/vue-renderless": "~3.21.0",
|
|
16
|
+
"@opentinyvue/vue-checkbox": "~2.21.0"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"types": "index.d.ts",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "pnpm -w build:ui $npm_package_name",
|
|
22
|
+
"//postversion": "pnpm build"
|
|
23
|
+
}
|
|
24
|
+
}
|