@opentinyvue/vue-filter 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
@@ -37,7 +37,7 @@ var Filter = defineComponent({
37
37
  });
38
38
  }
39
39
  });
40
- var version = "2.22.0";
40
+ var version = "3.22.0";
41
41
  Filter.model = {
42
42
  prop: "modelValue",
43
43
  event: "update:modelValue"
@@ -2,38 +2,42 @@ import { renderless as renderless$1, api as api$1 } from '@opentinyvue/vue-rende
2
2
  import { defineComponent, setup, $props } from '@opentinyvue/vue-common';
3
3
  import { IconSubScript, IconUnfilter, IconChevronDown, IconChevronUp } from '@opentinyvue/vue-icon';
4
4
  import { renderless, api } from '@opentinyvue/vue-renderless/filter/tag-group';
5
+ import { resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, withDirectives, normalizeClass, normalizeStyle, withModifiers, vShow, Fragment, renderList, createBlock, createVNode, createSlots, withCtx, renderSlot, createTextVNode } from 'vue';
5
6
  import FilterBar from '@opentinyvue/vue-filter-bar';
6
7
  import Button from '@opentinyvue/vue-button';
7
8
 
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;
9
+ function _createForOfIteratorHelperLoose(r, e) {
10
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
11
+ if (t) return (t = t.call(r)).next.bind(t);
12
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
13
+ t && (r = t);
14
+ var o = 0;
15
+ return function() {
16
+ return o >= r.length ? { done: true } : { done: false, value: r[o++] };
17
+ };
14
18
  }
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
- }
19
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20
+ }
21
+ function _unsupportedIterableToArray(r, a) {
22
+ if (r) {
23
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
24
+ var t = {}.toString.call(r).slice(8, -1);
25
+ 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;
31
26
  }
32
- return {
33
- exports: scriptExports,
34
- options
35
- };
36
27
  }
28
+ function _arrayLikeToArray(r, a) {
29
+ (null == a || a > r.length) && (a = r.length);
30
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
31
+ return n;
32
+ }
33
+ var _export_sfc = function _export_sfc2(sfc, props) {
34
+ var target = sfc.__vccOpts || sfc;
35
+ for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
36
+ var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
37
+ target[key] = val;
38
+ }
39
+ return target;
40
+ };
37
41
 
38
42
  function _extends() {
39
43
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
@@ -44,7 +48,7 @@ function _extends() {
44
48
  return n;
45
49
  }, _extends.apply(null, arguments);
46
50
  }
47
- var __vue2_script$1 = defineComponent({
51
+ var _sfc_main$1 = defineComponent({
48
52
  emits: ["click", "update:modelValue"],
49
53
  components: {
50
54
  IconSubScript: IconSubScript()
@@ -71,79 +75,83 @@ var __vue2_script$1 = defineComponent({
71
75
  });
72
76
  }
73
77
  });
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)]);
78
+ var _hoisted_1$1 = {
79
+ "data-tag": "tiny-filter-tag-group overflow-hidden",
80
+ class: "clear-both"
134
81
  };
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
- }
82
+ var _hoisted_2$1 = {
83
+ key: 0,
84
+ "data-tag": "tag-group-label",
85
+ class: "h-5 text-sm leading-5 overflow-hidden text-ellipsis whitespace-nowrap"
86
+ };
87
+ var _hoisted_3$1 = {
88
+ "data-tag": "tag-group-tags",
89
+ class: "text-left -mr-3 overflow-hidden clear-both"
90
+ };
91
+ var _hoisted_4$1 = ["title", "onClick"];
92
+ function _sfc_render$1(_ctx, _cache, $props2, $setup, $data, $options) {
93
+ var _component_IconSubScript = resolveComponent("IconSubScript");
94
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [_ctx.label ? (openBlock(), createElementBlock(
95
+ "div",
96
+ _hoisted_2$1,
97
+ toDisplayString(_ctx.label),
98
+ 1
99
+ /* TEXT */
100
+ )) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_3$1, [withDirectives(createElementVNode(
101
+ "div",
102
+ {
103
+ class: normalizeClass(["h-9 mt-3 float-left relative"]),
104
+ style: normalizeStyle({
105
+ width: _ctx.state.tagWidth
106
+ })
107
+ },
108
+ [createElementVNode(
109
+ "span",
110
+ {
111
+ class: normalizeClass(["h-full block p-2 text-center rounded-sm truncate cursor-pointer border-0.5 mr-3", _ctx.state.selected.length === 0 ? "border-current text-color-brand bg-color-info-primary-subtler" : "border-transparent bg-color-bg-3"]),
112
+ onClick: _cache[0] || (_cache[0] = withModifiers(function() {
113
+ return _ctx.selectOptionAll && _ctx.selectOptionAll.apply(_ctx, arguments);
114
+ }, ["stop"]))
115
+ },
116
+ toDisplayString(_ctx.t("ui.base.all")),
117
+ 3
118
+ /* TEXT, CLASS */
119
+ )],
120
+ 4
121
+ /* STYLE */
122
+ ), [[vShow, _ctx.type === "tag" && _ctx.multiple]]), (openBlock(true), createElementBlock(
123
+ Fragment,
124
+ null,
125
+ renderList(_ctx.data, function(item, index) {
126
+ return openBlock(), createElementBlock(
127
+ "div",
128
+ {
129
+ key: index,
130
+ class: normalizeClass(["h-9 mt-3 float-left relative"]),
131
+ style: normalizeStyle({
132
+ width: _ctx.state.tagWidth
133
+ })
134
+ },
135
+ [_ctx.state.selected.indexOf(item.value) !== -1 && _ctx.multiple ? (openBlock(), createBlock(_component_IconSubScript, {
136
+ key: 0,
137
+ class: "absolute right-3 w-4 h-4 fill-color-icon-focus"
138
+ })) : createCommentVNode("v-if", true), createElementVNode("span", {
139
+ class: normalizeClass(["h-full block p-2 text-center rounded-sm truncate cursor-pointer border-0.5 mr-3", _ctx.state.selected.indexOf(item.value) !== -1 ? "border-current text-color-brand bg-color-info-primary-subtler" : "border-transparent bg-color-bg-3"]),
140
+ title: item.label,
141
+ onClick: withModifiers(function($event) {
142
+ return _ctx.selectOption(item.value);
143
+ }, ["stop"])
144
+ }, toDisplayString(item.label), 11, _hoisted_4$1)],
145
+ 4
146
+ /* STYLE */
147
+ );
148
+ }),
149
+ 128
150
+ /* KEYED_FRAGMENT */
151
+ ))])]);
142
152
  }
143
- var TagGroup = /* @__PURE__ */ function() {
144
- return __component__$1.exports;
145
- }();
146
- var __vue2_script = defineComponent({
153
+ var TagGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
154
+ var _sfc_main = defineComponent({
147
155
  components: {
148
156
  TagGroup,
149
157
  TinyFilterBar: FilterBar,
@@ -175,263 +183,254 @@ var __vue2_script = defineComponent({
175
183
  });
176
184
  }
177
185
  });
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
186
+ var _hoisted_1 = {
187
+ class: "w-10 ml-2 flex-none flex justify-center cursor-pointer"
188
+ };
189
+ var _hoisted_2 = {
190
+ ref: "maskPoint"
191
+ };
192
+ var _hoisted_3 = {
193
+ "data-tag": "panel-scrollbar",
194
+ class: "flex-auto m-5 overflow-x-visible overflow-y-auto scrollbar-size-0"
195
+ };
196
+ var _hoisted_4 = {
197
+ "data-tag": "filter-list",
198
+ class: "leading-[theme(spacing.12)] cursor-pointer h-full py-2 overflow-x-visible overflow-y-auto scrollbar-size-0"
199
+ };
200
+ var _hoisted_5 = ["title", "onClick"];
201
+ var _hoisted_6 = {
202
+ "data-tag": "filter-footer",
203
+ class: "flex items-center justify-end mx-5 mb-5"
204
+ };
205
+ function _sfc_render(_ctx, _cache, $props2, $setup, $data, $options) {
206
+ var _component_IconUnfilter = resolveComponent("IconUnfilter");
207
+ var _component_tiny_filter_bar = resolveComponent("tiny-filter-bar");
208
+ var _component_TagGroup = resolveComponent("TagGroup");
209
+ var _component_tiny_button = resolveComponent("tiny-button");
210
+ return openBlock(), createElementBlock(
211
+ "div",
212
+ {
213
+ ref: "root",
214
+ "data-tag": "tiny-filter",
215
+ class: normalizeClass(_ctx.m("text-sm text-color-text-primary relative", _ctx.customClass))
286
216
  },
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
- }
217
+ [createVNode(_component_tiny_filter_bar, {
218
+ "model-value": _ctx.state.showPanelIndex,
219
+ data: _ctx.state.labelList,
220
+ onClick: _ctx.panelToggle
221
+ }, createSlots({
222
+ default: withCtx(function() {
223
+ return [renderSlot(_ctx.$slots, "default", {
224
+ active: _ctx.state.showPanelIndex,
225
+ value: _ctx.modelValue,
226
+ labels: _ctx.state.labelList
227
+ })];
228
+ }),
229
+ _: 2
230
+ /* DYNAMIC */
231
+ }, [_ctx.filterGroup ? {
232
+ name: "icon",
233
+ fn: withCtx(function() {
234
+ return [createElementVNode("div", {
235
+ "data-tag": "filter-icon",
236
+ class: "w-full",
237
+ onClick: _cache[0] || (_cache[0] = function($event) {
238
+ return _ctx.panelToggle("filter");
239
+ })
240
+ }, [renderSlot(_ctx.$slots, "icon", {
241
+ active: _ctx.state.filterPanel.show || _ctx.state.hasFilterValue,
242
+ show: _ctx.state.filterPanel.show
243
+ }, function() {
244
+ return [createElementVNode("div", _hoisted_1, [createVNode(_component_IconUnfilter, {
245
+ "custom-class": "w-5 h-5 fill-current",
246
+ class: normalizeClass(_ctx.state.filterPanel.show || _ctx.state.hasFilterValue ? " text-color-brand" : "")
247
+ }, null, 8, ["class"])])];
248
+ })])];
249
+ }),
250
+ key: "0"
251
+ } : void 0]), 1032, ["model-value", "data", "onClick"]), createElementVNode(
252
+ "div",
253
+ _hoisted_2,
254
+ null,
255
+ 512
256
+ /* NEED_PATCH */
257
+ ), withDirectives(createElementVNode(
258
+ "div",
259
+ {
260
+ ref: "panelMask",
261
+ "data-tag": "panel-mask",
262
+ class: "fixed left-0 right-0 z-40 w-full h-full bg-color-bg-7",
263
+ onClick: _cache[1] || (_cache[1] = function() {
264
+ return _ctx.cancel && _ctx.cancel.apply(_ctx, arguments);
265
+ })
318
266
  },
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"
267
+ null,
268
+ 512
269
+ /* NEED_PATCH */
270
+ ), [[vShow, !_ctx.manual && _ctx.state.showPanel]]), withDirectives(createElementVNode(
271
+ "div",
272
+ {
273
+ ref: "panel",
274
+ "data-tag": "tiny-filter-panel",
275
+ class: normalizeClass(_ctx.m("absolute top-11 flex flex-col z-40 w-full bg-color-bg-1 overflow-hidden", _ctx.panelClass))
388
276
  },
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
- }
277
+ [withDirectives(createElementVNode(
278
+ "div",
279
+ _hoisted_3,
280
+ [withDirectives(createVNode(_component_TagGroup, {
281
+ "data-tag": "select-group",
282
+ modelValue: _ctx.state.selectPanel.selected,
283
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = function($event) {
284
+ return _ctx.state.selectPanel.selected = $event;
285
+ }),
286
+ data: _ctx.state.selectPanel.config.options,
287
+ label: _ctx.state.selectPanel.config.label,
288
+ type: _ctx.state.selectPanel.config.type,
289
+ multiple: _ctx.state.selectPanel.config.multiple,
290
+ "column-num": _ctx.columnNum,
291
+ onClick: _ctx.selectOption
292
+ }, null, 8, ["modelValue", "data", "label", "type", "multiple", "column-num", "onClick"]), [[vShow, _ctx.state.showPanelIndex !== -1]]), _ctx.filterGroup ? (openBlock(true), createElementBlock(
293
+ Fragment,
294
+ {
295
+ key: 0
296
+ },
297
+ renderList(_ctx.filterGroup, function(item, index) {
298
+ return withDirectives((openBlock(), createBlock(_component_TagGroup, {
299
+ "data-tag": "filter-group",
300
+ key: index,
301
+ modelValue: _ctx.state.filterPanel.selected[index],
302
+ "onUpdate:modelValue": function onUpdateModelValue($event) {
303
+ return _ctx.state.filterPanel.selected[index] = $event;
304
+ },
305
+ data: item.options,
306
+ label: item.label,
307
+ type: item.type,
308
+ multiple: item.multiple,
309
+ "column-num": _ctx.columnNum,
310
+ class: normalizeClass([{
311
+ "mt-5": index !== 0
312
+ }]),
313
+ onClick: function onClick($event) {
314
+ return _ctx.filterSelectOption($event, index);
315
+ }
316
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data", "label", "type", "multiple", "column-num", "class", "onClick"])), [[vShow, _ctx.state.filterPanel.show]]);
317
+ }),
318
+ 128
319
+ /* KEYED_FRAGMENT */
320
+ )) : createCommentVNode("v-if", true)],
321
+ 512
322
+ /* NEED_PATCH */
323
+ ), [[vShow, _ctx.state.selectPanel.config.type !== "list"]]), withDirectives(createElementVNode(
324
+ "div",
325
+ _hoisted_4,
326
+ [_ctx.state.selectPanel.config.showAll ? (openBlock(), createElementBlock(
327
+ "div",
328
+ {
329
+ key: 0,
330
+ class: normalizeClass(["px-5 truncate", {
331
+ "text-color-brand": _ctx.state.selectPanel.selected.length === 0
332
+ }]),
333
+ onClick: _cache[3] || (_cache[3] = withModifiers(function($event) {
334
+ return _ctx.selectOption();
335
+ }, ["stop"]))
336
+ },
337
+ toDisplayString(_ctx.t("ui.base.all")),
338
+ 3
339
+ /* TEXT, CLASS */
340
+ )) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(
341
+ Fragment,
342
+ null,
343
+ renderList(_ctx.state.selectPanel.config.options, function(item, index) {
344
+ return openBlock(), createElementBlock("div", {
345
+ key: index,
346
+ title: item.label,
347
+ class: normalizeClass(["px-5 truncate", {
348
+ "text-color-brand": _ctx.state.selectPanel.selected.indexOf(item.value) !== -1
349
+ }]),
350
+ onClick: withModifiers(function($event) {
351
+ return _ctx.selectOption(item.value);
352
+ }, ["stop"])
353
+ }, toDisplayString(item.label), 11, _hoisted_5);
354
+ }),
355
+ 128
356
+ /* KEYED_FRAGMENT */
357
+ ))],
358
+ 512
359
+ /* NEED_PATCH */
360
+ ), [[vShow, _ctx.state.selectPanel.config.type === "list"]]), withDirectives(createElementVNode(
361
+ "div",
362
+ _hoisted_6,
363
+ [renderSlot(_ctx.$slots, "footer", {
364
+ cancel: _ctx.cancel,
365
+ reset: _ctx.reset,
366
+ confirm: _ctx.confirm
367
+ }, function() {
368
+ return [withDirectives(createVNode(_component_tiny_button, {
369
+ tiny_mode: "mobile-first",
370
+ key: "btn1",
371
+ size: "medium",
372
+ "custom-class": "sm:max-w-full mr-4 flex-1",
373
+ onClick: _ctx.cancel
374
+ }, {
375
+ default: withCtx(function() {
376
+ return [createTextVNode(
377
+ toDisplayString(_ctx.t("ui.base.cancel")),
378
+ 1
379
+ /* TEXT */
380
+ )];
381
+ }),
382
+ _: 1
383
+ /* STABLE */
384
+ }, 8, ["onClick"]), [[vShow, !_ctx.state.selectPanel.config.multiple]]), createVNode(_component_tiny_button, {
385
+ tiny_mode: "mobile-first",
386
+ key: "btn2",
387
+ size: "medium",
388
+ "reset-time": 0,
389
+ "custom-class": "sm:max-w-full mr-4 flex-1",
390
+ onClick: _cache[4] || (_cache[4] = function($event) {
391
+ return _ctx.reset(_ctx.state.filterPanel.show);
392
+ })
393
+ }, {
394
+ default: withCtx(function() {
395
+ return [createTextVNode(
396
+ toDisplayString(_ctx.t("ui.base.reset")),
397
+ 1
398
+ /* TEXT */
399
+ )];
400
+ }),
401
+ _: 1
402
+ /* STABLE */
403
+ }), createVNode(_component_tiny_button, {
404
+ tiny_mode: "mobile-first",
405
+ key: "btn3",
406
+ type: "primary",
407
+ size: "medium",
408
+ "custom-class": "sm:max-w-full flex-1",
409
+ onClick: _cache[5] || (_cache[5] = function($event) {
410
+ return _ctx.confirm(_ctx.state.filterPanel.show);
411
+ })
412
+ }, {
413
+ default: withCtx(function() {
414
+ return [createTextVNode(
415
+ toDisplayString(_ctx.t("ui.base.confirm")),
416
+ 1
417
+ /* TEXT */
418
+ )];
419
+ }),
420
+ _: 1
421
+ /* STABLE */
422
+ })];
423
+ })],
424
+ 512
425
+ /* NEED_PATCH */
426
+ ), [[vShow, _ctx.state.selectPanel.config.multiple || _ctx.state.filterPanel.show]])],
427
+ 2
428
+ /* CLASS */
429
+ ), [[vShow, !_ctx.manual && _ctx.state.showPanel]])],
430
+ 2
431
+ /* CLASS */
432
+ );
432
433
  }
433
- var mobileFirst = /* @__PURE__ */ function() {
434
- return __component__.exports;
435
- }();
434
+ var mobileFirst = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
436
435
 
437
436
  export { mobileFirst as default };
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@opentinyvue/vue-filter",
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-common": "~2.22.0",
12
- "@opentinyvue/vue-filter-bar": "~2.22.0",
10
+ "@opentinyvue/vue-button": "~3.22.0",
11
+ "@opentinyvue/vue-common": "~3.22.0",
12
+ "@opentinyvue/vue-filter-bar": "~3.22.0",
13
13
  "@opentinyvue/vue-renderless": "~3.22.0",
14
- "@opentinyvue/vue-icon": "~2.22.0"
14
+ "@opentinyvue/vue-icon": "~3.22.0"
15
15
  },
16
16
  "license": "MIT",
17
17
  "types": "index.d.ts",
package/src/index.d.ts CHANGED
@@ -1,2 +1,44 @@
1
- declare const _default: any;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<{
2
+ data: ArrayConstructor;
3
+ modelValue: ArrayConstructor;
4
+ columnNum: {
5
+ type: NumberConstructor;
6
+ default: number;
7
+ };
8
+ filterGroup: ArrayConstructor;
9
+ filterValue: ArrayConstructor;
10
+ panelClass: StringConstructor;
11
+ manual: BooleanConstructor;
12
+ customClass: StringConstructor;
13
+ tiny_mode: StringConstructor;
14
+ tiny_mode_root: BooleanConstructor;
15
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
16
+ tiny_renderless: FunctionConstructor;
17
+ tiny_theme: StringConstructor;
18
+ tiny_chart_theme: ObjectConstructor;
19
+ }, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
20
+ [key: string]: any;
21
+ }>, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
22
+ data: ArrayConstructor;
23
+ modelValue: ArrayConstructor;
24
+ columnNum: {
25
+ type: NumberConstructor;
26
+ default: number;
27
+ };
28
+ filterGroup: ArrayConstructor;
29
+ filterValue: ArrayConstructor;
30
+ panelClass: StringConstructor;
31
+ manual: BooleanConstructor;
32
+ customClass: StringConstructor;
33
+ tiny_mode: StringConstructor;
34
+ tiny_mode_root: BooleanConstructor;
35
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
36
+ tiny_renderless: FunctionConstructor;
37
+ tiny_theme: StringConstructor;
38
+ tiny_chart_theme: ObjectConstructor;
39
+ }>>, {
40
+ manual: boolean;
41
+ tiny_mode_root: boolean;
42
+ columnNum: number;
43
+ }, {}>;
2
44
  export default _default;
@@ -1,2 +1,56 @@
1
- declare const _default: any;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<{
2
+ data: ArrayConstructor;
3
+ modelValue: ArrayConstructor;
4
+ columnNum: {
5
+ type: NumberConstructor;
6
+ default: number;
7
+ };
8
+ filterGroup: ArrayConstructor;
9
+ filterValue: ArrayConstructor;
10
+ panelClass: StringConstructor;
11
+ manual: BooleanConstructor;
12
+ customClass: StringConstructor;
13
+ tiny_mode: StringConstructor;
14
+ tiny_mode_root: BooleanConstructor;
15
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
16
+ tiny_renderless: FunctionConstructor;
17
+ tiny_theme: StringConstructor;
18
+ tiny_chart_theme: ObjectConstructor;
19
+ }, {
20
+ t: (this: any, path: any, options?: any) => any;
21
+ vm: any;
22
+ f: (props: any, attrs?: {}) => {};
23
+ a: (attrs: any, filters: any, include: any) => {};
24
+ d: (props: any) => void;
25
+ dp: (props: any) => void;
26
+ gcls: (key: any) => any;
27
+ m: (...cssClasses: any[]) => string;
28
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, ("cancel" | "update:modelValue" | "panel" | "update:filter-value")[], "cancel" | "update:modelValue" | "panel" | "update:filter-value", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
29
+ data: ArrayConstructor;
30
+ modelValue: ArrayConstructor;
31
+ columnNum: {
32
+ type: NumberConstructor;
33
+ default: number;
34
+ };
35
+ filterGroup: ArrayConstructor;
36
+ filterValue: ArrayConstructor;
37
+ panelClass: StringConstructor;
38
+ manual: BooleanConstructor;
39
+ customClass: StringConstructor;
40
+ tiny_mode: StringConstructor;
41
+ tiny_mode_root: BooleanConstructor;
42
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
43
+ tiny_renderless: FunctionConstructor;
44
+ tiny_theme: StringConstructor;
45
+ tiny_chart_theme: ObjectConstructor;
46
+ }>> & {
47
+ onCancel?: ((...args: any[]) => any) | undefined;
48
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
49
+ onPanel?: ((...args: any[]) => any) | undefined;
50
+ "onUpdate:filter-value"?: ((...args: any[]) => any) | undefined;
51
+ }, {
52
+ manual: boolean;
53
+ tiny_mode_root: boolean;
54
+ columnNum: number;
55
+ }, {}>;
2
56
  export default _default;
@@ -1,2 +1,43 @@
1
- declare const _default: any;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<{
2
+ modelValue: (StringConstructor | NumberConstructor | ArrayConstructor)[];
3
+ data: ArrayConstructor;
4
+ type: StringConstructor;
5
+ multiple: BooleanConstructor;
6
+ columnNum: NumberConstructor;
7
+ label: StringConstructor;
8
+ tiny_mode: StringConstructor;
9
+ tiny_mode_root: BooleanConstructor;
10
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
11
+ tiny_renderless: FunctionConstructor;
12
+ tiny_theme: StringConstructor;
13
+ tiny_chart_theme: ObjectConstructor;
14
+ }, {
15
+ t: (this: any, path: any, options?: any) => any;
16
+ vm: any;
17
+ f: (props: any, attrs?: {}) => {};
18
+ a: (attrs: any, filters: any, include: any) => {};
19
+ d: (props: any) => void;
20
+ dp: (props: any) => void;
21
+ gcls: (key: any) => any;
22
+ m: (...cssClasses: any[]) => string;
23
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, ("click" | "update:modelValue")[], "click" | "update:modelValue", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
24
+ modelValue: (StringConstructor | NumberConstructor | ArrayConstructor)[];
25
+ data: ArrayConstructor;
26
+ type: StringConstructor;
27
+ multiple: BooleanConstructor;
28
+ columnNum: NumberConstructor;
29
+ label: StringConstructor;
30
+ tiny_mode: StringConstructor;
31
+ tiny_mode_root: BooleanConstructor;
32
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
33
+ tiny_renderless: FunctionConstructor;
34
+ tiny_theme: StringConstructor;
35
+ tiny_chart_theme: ObjectConstructor;
36
+ }>> & {
37
+ onClick?: ((...args: any[]) => any) | undefined;
38
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
39
+ }, {
40
+ tiny_mode_root: boolean;
41
+ multiple: boolean;
42
+ }, {}>;
2
43
  export default _default;