@opentinyvue/vue-filter 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 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
@@ -0,0 +1,2 @@
1
+ import Filter from './src/index';
2
+ export default Filter;
package/lib/index.js ADDED
@@ -0,0 +1,51 @@
1
+ function _extends() {
2
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
3
+ for (var e = 1; e < arguments.length; e++) {
4
+ var t = arguments[e];
5
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6
+ }
7
+ return n;
8
+ }, _extends.apply(null, arguments);
9
+ }
10
+ import { defineComponent, $prefix, $props, $setup } from "@opentinyvue/vue-common";
11
+ import MobileFirstTemplate from "./mobile-first.js";
12
+ var template = function template2(mode) {
13
+ var _process$env;
14
+ typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
15
+ return MobileFirstTemplate;
16
+ };
17
+ var Filter = defineComponent({
18
+ name: $prefix + "Filter",
19
+ props: _extends({}, $props, {
20
+ data: Array,
21
+ modelValue: Array,
22
+ columnNum: {
23
+ type: Number,
24
+ default: 3
25
+ },
26
+ filterGroup: Array,
27
+ filterValue: Array,
28
+ panelClass: String,
29
+ manual: Boolean,
30
+ customClass: String
31
+ }),
32
+ setup: function setup(props, context) {
33
+ return $setup({
34
+ props,
35
+ context,
36
+ template
37
+ });
38
+ }
39
+ });
40
+ var version = "2.21.0";
41
+ Filter.model = {
42
+ prop: "modelValue",
43
+ event: "update:modelValue"
44
+ };
45
+ Filter.install = function(Vue) {
46
+ Vue.component(Filter.name, Filter);
47
+ };
48
+ Filter.version = version;
49
+ export {
50
+ Filter as default
51
+ };
@@ -0,0 +1,437 @@
1
+ import { renderless as renderless$1, api as api$1 } from '@opentinyvue/vue-renderless/filter/vue';
2
+ import { defineComponent, setup, $props } from '@opentinyvue/vue-common';
3
+ import { IconSubScript, IconUnfilter, IconChevronDown, IconChevronUp } from '@opentinyvue/vue-icon';
4
+ import { renderless, api } from '@opentinyvue/vue-renderless/filter/tag-group';
5
+ import FilterBar from '@opentinyvue/vue-filter-bar';
6
+ import Button from '@opentinyvue/vue-button';
7
+
8
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
9
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
10
+ if (render) {
11
+ options.render = render;
12
+ options.staticRenderFns = staticRenderFns;
13
+ options._compiled = true;
14
+ }
15
+ var hook;
16
+ if (injectStyles) {
17
+ hook = injectStyles;
18
+ }
19
+ if (hook) {
20
+ if (options.functional) {
21
+ options._injectStyles = hook;
22
+ var originalRender = options.render;
23
+ options.render = function renderWithStyleInjection(h, context) {
24
+ hook.call(context);
25
+ return originalRender(h, context);
26
+ };
27
+ } else {
28
+ var existing = options.beforeCreate;
29
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
30
+ }
31
+ }
32
+ return {
33
+ exports: scriptExports,
34
+ options
35
+ };
36
+ }
37
+
38
+ function _extends() {
39
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
40
+ for (var e = 1; e < arguments.length; e++) {
41
+ var t = arguments[e];
42
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
43
+ }
44
+ return n;
45
+ }, _extends.apply(null, arguments);
46
+ }
47
+ var __vue2_script$1 = defineComponent({
48
+ emits: ["click", "update:modelValue"],
49
+ components: {
50
+ IconSubScript: IconSubScript()
51
+ },
52
+ model: {
53
+ prop: "modelValue",
54
+ event: "update:modelValue"
55
+ },
56
+ props: _extends({}, $props, {
57
+ modelValue: [String, Number, Array],
58
+ data: Array,
59
+ type: String,
60
+ multiple: Boolean,
61
+ columnNum: Number,
62
+ label: String
63
+ }),
64
+ setup: function setup$1(props, context) {
65
+ return setup({
66
+ props,
67
+ context,
68
+ renderless,
69
+ api,
70
+ mono: true
71
+ });
72
+ }
73
+ });
74
+ var render$1 = function render$12() {
75
+ var _vm = this;
76
+ var _h = _vm.$createElement;
77
+ var _c = _vm._self._c || _h;
78
+ return _c("div", {
79
+ staticClass: "clear-both",
80
+ attrs: {
81
+ "data-tag": "tiny-filter-tag-group overflow-hidden"
82
+ }
83
+ }, [_vm.label ? _c("div", {
84
+ staticClass: "h-5 text-sm leading-5 overflow-hidden text-ellipsis whitespace-nowrap",
85
+ attrs: {
86
+ "data-tag": "tag-group-label"
87
+ }
88
+ }, [_vm._v(" " + _vm._s(_vm.label) + " ")]) : _vm._e(), _c("div", {
89
+ staticClass: "text-left -mr-3 overflow-hidden clear-both",
90
+ attrs: {
91
+ "data-tag": "tag-group-tags"
92
+ }
93
+ }, [_c("div", {
94
+ directives: [{
95
+ name: "show",
96
+ rawName: "v-show",
97
+ value: _vm.type === "tag" && _vm.multiple,
98
+ expression: "type === 'tag' && multiple"
99
+ }],
100
+ class: ["h-9 mt-3 float-left relative"],
101
+ style: {
102
+ width: _vm.state.tagWidth
103
+ }
104
+ }, [_c("span", {
105
+ class: ["h-full block p-2 text-center rounded-sm truncate cursor-pointer border-0.5 mr-3", _vm.state.selected.length === 0 ? "border-current text-color-brand bg-color-info-primary-subtler" : "border-transparent bg-color-bg-3"],
106
+ on: {
107
+ "click": function click($event) {
108
+ $event.stopPropagation();
109
+ return _vm.selectOptionAll.apply(null, arguments);
110
+ }
111
+ }
112
+ }, [_vm._v(_vm._s(_vm.t("ui.base.all")))])]), _vm._l(_vm.data, function(item, index) {
113
+ return _c("div", {
114
+ key: index,
115
+ class: ["h-9 mt-3 float-left relative"],
116
+ style: {
117
+ width: _vm.state.tagWidth
118
+ }
119
+ }, [_vm.state.selected.indexOf(item.value) !== -1 && _vm.multiple ? _c("IconSubScript", {
120
+ staticClass: "absolute right-3 w-4 h-4 fill-color-icon-focus"
121
+ }) : _vm._e(), _c("span", {
122
+ class: ["h-full block p-2 text-center rounded-sm truncate cursor-pointer border-0.5 mr-3", _vm.state.selected.indexOf(item.value) !== -1 ? "border-current text-color-brand bg-color-info-primary-subtler" : "border-transparent bg-color-bg-3"],
123
+ attrs: {
124
+ "title": item.label
125
+ },
126
+ on: {
127
+ "click": function click($event) {
128
+ $event.stopPropagation();
129
+ return _vm.selectOption(item.value);
130
+ }
131
+ }
132
+ }, [_vm._v(_vm._s(item.label))])], 1);
133
+ })], 2)]);
134
+ };
135
+ var staticRenderFns$1 = [];
136
+ var __cssModules$1 = {};
137
+ var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1);
138
+ function __vue2_injectStyles$1(context) {
139
+ for (var o in __cssModules$1) {
140
+ this[o] = __cssModules$1[o];
141
+ }
142
+ }
143
+ var TagGroup = /* @__PURE__ */ function() {
144
+ return __component__$1.exports;
145
+ }();
146
+ var __vue2_script = defineComponent({
147
+ components: {
148
+ TagGroup,
149
+ TinyFilterBar: FilterBar,
150
+ TinyButton: Button,
151
+ IconUnfilter: IconUnfilter(),
152
+ IconChevronDown: IconChevronDown(),
153
+ IconChevronUp: IconChevronUp()
154
+ },
155
+ emits: ["update:modelValue", "cancel", "panel", "update:filter-value"],
156
+ props: _extends({}, $props, {
157
+ data: Array,
158
+ modelValue: Array,
159
+ columnNum: {
160
+ type: Number,
161
+ default: 3
162
+ },
163
+ filterGroup: Array,
164
+ filterValue: Array,
165
+ panelClass: String,
166
+ manual: Boolean,
167
+ customClass: String
168
+ }),
169
+ setup: function setup2(props, context) {
170
+ return setup({
171
+ props,
172
+ context,
173
+ renderless: renderless$1,
174
+ api: api$1
175
+ });
176
+ }
177
+ });
178
+ var render = function render2() {
179
+ var _vm = this;
180
+ var _h = _vm.$createElement;
181
+ var _c = _vm._self._c || _h;
182
+ return _c("div", {
183
+ ref: "root",
184
+ class: _vm.m("text-sm text-color-text-primary relative", _vm.customClass),
185
+ attrs: {
186
+ "data-tag": "tiny-filter"
187
+ }
188
+ }, [_c("tiny-filter-bar", {
189
+ attrs: {
190
+ "model-value": _vm.state.showPanelIndex,
191
+ "data": _vm.state.labelList
192
+ },
193
+ on: {
194
+ "click": _vm.panelToggle
195
+ },
196
+ scopedSlots: _vm._u([_vm.filterGroup ? {
197
+ key: "icon",
198
+ fn: function fn() {
199
+ return [_c("div", {
200
+ staticClass: "w-full",
201
+ attrs: {
202
+ "data-tag": "filter-icon"
203
+ },
204
+ on: {
205
+ "click": function click($event) {
206
+ return _vm.panelToggle("filter");
207
+ }
208
+ }
209
+ }, [_vm._t("icon", function() {
210
+ return [_c("div", {
211
+ staticClass: "w-10 ml-2 flex-none flex justify-center cursor-pointer"
212
+ }, [_c("IconUnfilter", {
213
+ class: _vm.state.filterPanel.show || _vm.state.hasFilterValue ? " text-color-brand" : "",
214
+ attrs: {
215
+ "custom-class": "w-5 h-5 fill-current"
216
+ }
217
+ })], 1)];
218
+ }, {
219
+ "active": _vm.state.filterPanel.show || _vm.state.hasFilterValue,
220
+ "show": _vm.state.filterPanel.show
221
+ })], 2)];
222
+ },
223
+ proxy: true
224
+ } : null], null, true)
225
+ }, [_vm._t("default", null, {
226
+ "active": _vm.state.showPanelIndex,
227
+ "value": _vm.modelValue,
228
+ "labels": _vm.state.labelList
229
+ })], 2), _c("div", {
230
+ ref: "maskPoint"
231
+ }), _c("div", {
232
+ directives: [{
233
+ name: "show",
234
+ rawName: "v-show",
235
+ value: !_vm.manual && _vm.state.showPanel,
236
+ expression: "!manual && state.showPanel"
237
+ }],
238
+ ref: "panelMask",
239
+ staticClass: "fixed left-0 right-0 z-40 w-full h-full bg-color-bg-7",
240
+ attrs: {
241
+ "data-tag": "panel-mask"
242
+ },
243
+ on: {
244
+ "click": _vm.cancel
245
+ }
246
+ }), _c("div", {
247
+ directives: [{
248
+ name: "show",
249
+ rawName: "v-show",
250
+ value: !_vm.manual && _vm.state.showPanel,
251
+ expression: "!manual && state.showPanel"
252
+ }],
253
+ ref: "panel",
254
+ class: _vm.m("absolute top-11 flex flex-col z-40 w-full bg-color-bg-1 overflow-hidden", _vm.panelClass),
255
+ attrs: {
256
+ "data-tag": "tiny-filter-panel"
257
+ }
258
+ }, [_c("div", {
259
+ directives: [{
260
+ name: "show",
261
+ rawName: "v-show",
262
+ value: _vm.state.selectPanel.config.type !== "list",
263
+ expression: "state.selectPanel.config.type !== 'list'"
264
+ }],
265
+ staticClass: "flex-auto m-5 overflow-x-visible overflow-y-auto scrollbar-size-0",
266
+ attrs: {
267
+ "data-tag": "panel-scrollbar"
268
+ }
269
+ }, [_c("TagGroup", {
270
+ directives: [{
271
+ name: "show",
272
+ rawName: "v-show",
273
+ value: _vm.state.showPanelIndex !== -1,
274
+ expression: "state.showPanelIndex !== -1"
275
+ }],
276
+ attrs: {
277
+ "data-tag": "select-group",
278
+ "data": _vm.state.selectPanel.config.options,
279
+ "label": _vm.state.selectPanel.config.label,
280
+ "type": _vm.state.selectPanel.config.type,
281
+ "multiple": _vm.state.selectPanel.config.multiple,
282
+ "column-num": _vm.columnNum
283
+ },
284
+ on: {
285
+ "click": _vm.selectOption
286
+ },
287
+ model: {
288
+ value: _vm.state.selectPanel.selected,
289
+ callback: function callback($$v) {
290
+ _vm.$set(_vm.state.selectPanel, "selected", $$v);
291
+ },
292
+ expression: "state.selectPanel.selected"
293
+ }
294
+ }), _vm.filterGroup ? _vm._l(_vm.filterGroup, function(item, index) {
295
+ return _c("TagGroup", {
296
+ directives: [{
297
+ name: "show",
298
+ rawName: "v-show",
299
+ value: _vm.state.filterPanel.show,
300
+ expression: "state.filterPanel.show"
301
+ }],
302
+ key: index,
303
+ class: [{
304
+ "mt-5": index !== 0
305
+ }],
306
+ attrs: {
307
+ "data-tag": "filter-group",
308
+ "data": item.options,
309
+ "label": item.label,
310
+ "type": item.type,
311
+ "multiple": item.multiple,
312
+ "column-num": _vm.columnNum
313
+ },
314
+ on: {
315
+ "click": function click($event) {
316
+ return _vm.filterSelectOption($event, index);
317
+ }
318
+ },
319
+ model: {
320
+ value: _vm.state.filterPanel.selected[index],
321
+ callback: function callback($$v) {
322
+ _vm.$set(_vm.state.filterPanel.selected, index, $$v);
323
+ },
324
+ expression: "state.filterPanel.selected[index]"
325
+ }
326
+ });
327
+ }) : _vm._e()], 2), _c("div", {
328
+ directives: [{
329
+ name: "show",
330
+ rawName: "v-show",
331
+ value: _vm.state.selectPanel.config.type === "list",
332
+ expression: "state.selectPanel.config.type === 'list'"
333
+ }],
334
+ staticClass: "leading-[theme(spacing.12)] cursor-pointer h-full py-2 overflow-x-visible overflow-y-auto scrollbar-size-0",
335
+ attrs: {
336
+ "data-tag": "filter-list"
337
+ }
338
+ }, [_vm.state.selectPanel.config.showAll ? _c("div", {
339
+ class: ["px-5 truncate", {
340
+ "text-color-brand": _vm.state.selectPanel.selected.length === 0
341
+ }],
342
+ on: {
343
+ "click": function click($event) {
344
+ $event.stopPropagation();
345
+ return _vm.selectOption();
346
+ }
347
+ }
348
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.base.all")) + " ")]) : _vm._e(), _vm._l(_vm.state.selectPanel.config.options, function(item, index) {
349
+ return _c("div", {
350
+ key: index,
351
+ class: ["px-5 truncate", {
352
+ "text-color-brand": _vm.state.selectPanel.selected.indexOf(item.value) !== -1
353
+ }],
354
+ attrs: {
355
+ "title": item.label
356
+ },
357
+ on: {
358
+ "click": function click($event) {
359
+ $event.stopPropagation();
360
+ return _vm.selectOption(item.value);
361
+ }
362
+ }
363
+ }, [_vm._v(" " + _vm._s(item.label) + " ")]);
364
+ })], 2), _c("div", {
365
+ directives: [{
366
+ name: "show",
367
+ rawName: "v-show",
368
+ value: _vm.state.selectPanel.config.multiple || _vm.state.filterPanel.show,
369
+ expression: "state.selectPanel.config.multiple || state.filterPanel.show"
370
+ }],
371
+ staticClass: "flex items-center justify-end mx-5 mb-5",
372
+ attrs: {
373
+ "data-tag": "filter-footer"
374
+ }
375
+ }, [_vm._t("footer", function() {
376
+ return [_c("tiny-button", {
377
+ directives: [{
378
+ name: "show",
379
+ rawName: "v-show",
380
+ value: !_vm.state.selectPanel.config.multiple,
381
+ expression: "!state.selectPanel.config.multiple"
382
+ }],
383
+ key: "btn1",
384
+ attrs: {
385
+ "tiny_mode": "mobile-first",
386
+ "size": "medium",
387
+ "custom-class": "sm:max-w-full mr-4 flex-1"
388
+ },
389
+ on: {
390
+ "click": _vm.cancel
391
+ }
392
+ }, [_vm._v(_vm._s(_vm.t("ui.base.cancel")))]), _c("tiny-button", {
393
+ key: "btn2",
394
+ attrs: {
395
+ "tiny_mode": "mobile-first",
396
+ "size": "medium",
397
+ "reset-time": 0,
398
+ "custom-class": "sm:max-w-full mr-4 flex-1"
399
+ },
400
+ on: {
401
+ "click": function click($event) {
402
+ return _vm.reset(_vm.state.filterPanel.show);
403
+ }
404
+ }
405
+ }, [_vm._v(_vm._s(_vm.t("ui.base.reset")))]), _c("tiny-button", {
406
+ key: "btn3",
407
+ attrs: {
408
+ "tiny_mode": "mobile-first",
409
+ "type": "primary",
410
+ "size": "medium",
411
+ "custom-class": "sm:max-w-full flex-1"
412
+ },
413
+ on: {
414
+ "click": function click($event) {
415
+ return _vm.confirm(_vm.state.filterPanel.show);
416
+ }
417
+ }
418
+ }, [_vm._v(_vm._s(_vm.t("ui.base.confirm")))])];
419
+ }, {
420
+ "cancel": _vm.cancel,
421
+ "reset": _vm.reset,
422
+ "confirm": _vm.confirm
423
+ })], 2)])], 1);
424
+ };
425
+ var staticRenderFns = [];
426
+ var __cssModules = {};
427
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
428
+ function __vue2_injectStyles(context) {
429
+ for (var o in __cssModules) {
430
+ this[o] = __cssModules[o];
431
+ }
432
+ }
433
+ var mobileFirst = /* @__PURE__ */ function() {
434
+ return __component__.exports;
435
+ }();
436
+
437
+ export { mobileFirst as default };
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@opentinyvue/vue-filter",
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-button": "~2.21.0",
11
+ "@opentinyvue/vue-common": "~2.21.0",
12
+ "@opentinyvue/vue-filter-bar": "~2.21.0",
13
+ "@opentinyvue/vue-renderless": "~3.21.0",
14
+ "@opentinyvue/vue-icon": "~2.21.0"
15
+ },
16
+ "license": "MIT",
17
+ "types": "index.d.ts",
18
+ "scripts": {
19
+ "build": "pnpm -w build:ui $npm_package_name",
20
+ "//postversion": "pnpm build"
21
+ }
22
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;