@cmstops/pro-compo 3.9.2-alpha.0 → 3.9.2-alpha.2

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.
@@ -7,28 +7,46 @@ var useAttachement = require("../../../../hooks/useAttachement.js");
7
7
  var typeMap = require("../../../../utils/typeMap.js");
8
8
  var selectionApis = require("../../../scripts/selectionApis.js");
9
9
  var resource = require("../../../../utils/resource.js");
10
+ var useResponsiveFilter = require("../../../hooks/useResponsiveFilter.js");
10
11
  const _hoisted_1 = { class: "list-filter-wrapper" };
11
12
  const _hoisted_2 = { class: "list-filter" };
12
- const _hoisted_3 = { class: "filter-list" };
13
- const _hoisted_4 = { style: { "width": "200px" } };
13
+ const _hoisted_3 = { class: "more-btn" };
14
+ const _hoisted_4 = { class: "right-prefix" };
14
15
  const _hoisted_5 = {
15
16
  class: "filter-item",
16
- style: { "width": "170px" }
17
+ style: { "width": "200px" }
18
+ };
19
+ const _hoisted_6 = {
20
+ class: "filter-item",
21
+ style: { "width": "180px" }
17
22
  };
18
- const _hoisted_6 = { class: "filter-item" };
19
23
  const _hoisted_7 = {
24
+ class: "filter-item",
25
+ style: { "width": "170px" }
26
+ };
27
+ const _hoisted_8 = {
28
+ class: "filter-item",
29
+ style: { "width": "240px" }
30
+ };
31
+ const _hoisted_9 = {
32
+ class: "filter-item",
33
+ style: { "width": "240px" }
34
+ };
35
+ const _hoisted_10 = {
20
36
  key: 0,
21
37
  class: "filter-item"
22
38
  };
23
- const _hoisted_8 = { class: "filter-extra" };
24
- const _hoisted_9 = {
39
+ const _hoisted_11 = { class: "filter-extra" };
40
+ const _hoisted_12 = { class: "filter-item" };
41
+ const _hoisted_13 = {
25
42
  key: 0,
26
43
  class: "list-filter-tags"
27
44
  };
28
- const _hoisted_10 = ["onClick"];
45
+ const _hoisted_14 = ["onClick"];
29
46
  const _sfc_main = vue.defineComponent({
30
47
  __name: "Filter",
31
48
  props: {
49
+ smallScreen: { type: Boolean },
32
50
  disableUploadBy: { type: Boolean }
33
51
  },
34
52
  emits: ["upload", "change"],
@@ -39,6 +57,16 @@ const _sfc_main = vue.defineComponent({
39
57
  const baseAPI = vue.inject("baseAPI");
40
58
  const filterOptions = vue.inject("filterOptions");
41
59
  const domainId = vue.computed(() => userInfo == null ? void 0 : userInfo.value.domain_id);
60
+ const filterItemsRef = vue.ref();
61
+ const {
62
+ moreBtnRef,
63
+ popperPanelRef,
64
+ hiddenElementList,
65
+ visible,
66
+ show,
67
+ hide,
68
+ refreshLayout
69
+ } = useResponsiveFilter.useResponsiveFilter(filterItemsRef);
42
70
  const { options, loading, load, loadMore, handleSearch } = useSelection({
43
71
  labelStr: "alias",
44
72
  valueStr: "id",
@@ -117,82 +145,122 @@ const _sfc_main = vue.defineComponent({
117
145
  filter.value.keyword = val;
118
146
  filter.value.precise_keyword = "";
119
147
  }
148
+ filter.value.sf = "";
120
149
  }
121
150
  });
122
- vue.watch(
123
- () => searchType.value,
124
- () => {
125
- searchInput.value = filter.value.keyword || filter.value.precise_keyword;
126
- }
127
- );
128
151
  const isEmpty = vue.computed(() => {
129
- return Object.keys(filter.value).every((key) => {
152
+ return Object.keys(originFilter).every((key) => {
153
+ if (key === "catalog") {
154
+ const currentCatalog = filter.value[key] || [];
155
+ const originCatalog = originFilter[key] || [];
156
+ return currentCatalog.length === originCatalog.length && currentCatalog.every((v) => originCatalog.includes(v));
157
+ }
130
158
  return filter.value[key] === originFilter[key];
131
159
  });
132
160
  });
133
161
  vue.watch(
134
162
  () => filter.value,
135
- () => {
136
- const result = { ...filter.value };
163
+ (val) => {
164
+ const result = { ...val };
137
165
  Object.keys(result).forEach((key) => {
138
166
  if (props.disableUploadBy && key === "upload_by")
139
167
  delete result[key];
140
- if (!result[key])
141
- delete result[key];
168
+ if (result[key] === "" || result[key] === null || result[key] === void 0) {
169
+ if (key !== "catalog") {
170
+ delete result[key];
171
+ }
172
+ }
142
173
  });
143
- if (!result.catalog)
144
- result.catalog = "image,video,audio";
145
- else
146
- result.catalog = result.catalog.join(",");
147
- emits("change", result);
148
- },
149
- { deep: true, immediate: true }
150
- );
151
- vue.watch(
152
- () => filterOptions == null ? void 0 : filterOptions.value,
153
- () => {
154
- var _a;
155
- if ((_a = filterOptions == null ? void 0 : filterOptions.value) == null ? void 0 : _a.mediaType) {
156
- filter.value.catalog = filterOptions == null ? void 0 : filterOptions.value.mediaType.split(",");
157
- if (filterOptions == null ? void 0 : filterOptions.value.mediaTypeStrict) {
158
- originFilter.catalog = filterOptions == null ? void 0 : filterOptions.value.mediaType.split(",");
174
+ if (result.catalog && Array.isArray(result.catalog)) {
175
+ if (result.catalog.length > 0) {
176
+ result.catalog = result.catalog.join(",");
177
+ } else {
178
+ delete result.catalog;
159
179
  }
160
180
  }
181
+ emits("change", result);
161
182
  },
162
- { immediate: true, deep: true }
183
+ { deep: true, immediate: true }
163
184
  );
164
185
  vue.onMounted(() => {
186
+ var _a;
165
187
  load();
188
+ if ((_a = filterOptions == null ? void 0 : filterOptions.value) == null ? void 0 : _a.mediaType) {
189
+ const initialCatalog = filterOptions.value.mediaType.split(",");
190
+ filter.value.catalog = initialCatalog;
191
+ if (filterOptions.value.mediaTypeStrict) {
192
+ originFilter.catalog = initialCatalog;
193
+ }
194
+ }
166
195
  });
167
196
  __expose({
168
- resetFilter: handleReset
197
+ filter,
198
+ handleReset
169
199
  });
170
200
  return (_ctx, _cache) => {
171
201
  var _a;
172
202
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
203
+ vue.createCommentVNode(" Use filterItemsRef's parentElement as the container for boundary checks "),
173
204
  vue.createElementVNode("div", _hoisted_2, [
174
- vue.createElementVNode("div", _hoisted_3, [
205
+ vue.createCommentVNode(" Filter Items Container "),
206
+ vue.createElementVNode("div", {
207
+ id: "resource-filter-pannel",
208
+ ref_key: "filterItemsRef",
209
+ ref: filterItemsRef,
210
+ class: "filter-list"
211
+ }, [
212
+ vue.createCommentVNode(" More Filters Button and Popper Panel "),
213
+ vue.createElementVNode("div", _hoisted_3, [
214
+ vue.createElementVNode("div", {
215
+ ref_key: "moreBtnRef",
216
+ ref: moreBtnRef
217
+ }, [
218
+ vue.withDirectives(vue.createVNode(vue.unref(webVue.Button), {
219
+ style: { marginRight: "10px" },
220
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => vue.unref(visible) ? vue.unref(hide)() : vue.unref(show)(), ["stop"]))
221
+ }, {
222
+ default: vue.withCtx(() => [
223
+ vue.createElementVNode("span", _hoisted_4, [
224
+ _cache[11] || (_cache[11] = vue.createTextVNode(" \u66F4\u591A ")),
225
+ vue.createVNode(vue.unref(icon.IconCaretDown))
226
+ ])
227
+ ]),
228
+ _: 1
229
+ }, 512), [
230
+ [vue.vShow, vue.unref(hiddenElementList).length]
231
+ ])
232
+ ], 512),
233
+ vue.withDirectives(vue.createElementVNode("div", {
234
+ ref_key: "popperPanelRef",
235
+ ref: popperPanelRef,
236
+ class: "filter-pannel",
237
+ onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
238
+ }, ["stop"]))
239
+ }, null, 512), [
240
+ [vue.vShow, vue.unref(visible)]
241
+ ])
242
+ ]),
175
243
  vue.createCommentVNode(" \u5173\u952E\u8BCD "),
176
- vue.createElementVNode("div", _hoisted_4, [
244
+ vue.createElementVNode("div", _hoisted_5, [
177
245
  vue.createVNode(vue.unref(webVue.Input), {
178
246
  modelValue: searchInput.value,
179
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchInput.value = $event),
247
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => searchInput.value = $event),
180
248
  "allow-clear": "",
181
249
  placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD"
182
250
  }, {
183
251
  prepend: vue.withCtx(() => [
184
252
  vue.createVNode(vue.unref(webVue.Dropdown), {
185
- onSelect: _cache[0] || (_cache[0] = (e) => searchType.value = e)
253
+ onSelect: _cache[2] || (_cache[2] = (e) => searchType.value = e)
186
254
  }, {
187
255
  content: vue.withCtx(() => [
188
256
  vue.createVNode(vue.unref(webVue.Doption), { value: 0 }, {
189
- default: vue.withCtx(() => _cache[8] || (_cache[8] = [
257
+ default: vue.withCtx(() => _cache[12] || (_cache[12] = [
190
258
  vue.createTextVNode("\u7CBE\u51C6\u641C")
191
259
  ])),
192
260
  _: 1
193
261
  }),
194
262
  vue.createVNode(vue.unref(webVue.Doption), { value: 1 }, {
195
- default: vue.withCtx(() => _cache[9] || (_cache[9] = [
263
+ default: vue.withCtx(() => _cache[13] || (_cache[13] = [
196
264
  vue.createTextVNode("\u6A21\u7CCA\u641C")
197
265
  ])),
198
266
  _: 1
@@ -213,24 +281,27 @@ const _sfc_main = vue.defineComponent({
213
281
  }, 8, ["modelValue"])
214
282
  ]),
215
283
  vue.createCommentVNode(" \u76EE\u5F55 "),
216
- vue.createVNode(vue.unref(webVue.TreeSelect), {
217
- modelValue: filter.value.directory_id,
218
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => filter.value.directory_id = $event),
219
- data: vue.unref(tree),
220
- placeholder: "\u8BF7\u9009\u62E9\u76EE\u5F55",
221
- style: { "width": "120px" },
222
- "field-names": {
223
- title: "alias",
224
- key: "id"
225
- },
226
- "allow-clear": ""
227
- }, null, 8, ["modelValue", "data"]),
284
+ vue.createElementVNode("div", _hoisted_6, [
285
+ vue.createVNode(vue.unref(webVue.TreeSelect), {
286
+ modelValue: filter.value.directory_id,
287
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => filter.value.directory_id = $event),
288
+ data: vue.unref(tree),
289
+ "popup-container": "#resource-filter-pannel",
290
+ placeholder: "\u8BF7\u9009\u62E9\u76EE\u5F55",
291
+ "field-names": {
292
+ title: "alias",
293
+ key: "id"
294
+ },
295
+ "allow-clear": ""
296
+ }, null, 8, ["modelValue", "data"])
297
+ ]),
228
298
  vue.createCommentVNode(" \u7D20\u6750\u7C7B\u578B "),
229
- vue.createElementVNode("div", _hoisted_5, [
299
+ vue.createElementVNode("div", _hoisted_7, [
230
300
  vue.createVNode(vue.unref(webVue.Select), {
231
301
  modelValue: filter.value.catalog,
232
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => filter.value.catalog = $event),
302
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => filter.value.catalog = $event),
233
303
  disabled: (_a = vue.unref(filterOptions)) == null ? void 0 : _a.mediaTypeStrict,
304
+ "popup-container": "#resource-filter-pannel",
234
305
  "allow-clear": "",
235
306
  placeholder: "\u7C7B\u578B",
236
307
  multiple: "",
@@ -249,19 +320,22 @@ const _sfc_main = vue.defineComponent({
249
320
  }, 8, ["modelValue", "disabled"])
250
321
  ]),
251
322
  vue.createCommentVNode(" \u65F6\u95F4\u8303\u56F4 "),
252
- vue.createVNode(vue.unref(webVue.RangePicker), {
253
- modelValue: rangeTime.value,
254
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => rangeTime.value = $event),
255
- "allow-clear": "",
256
- style: { "width": "240px" }
257
- }, null, 8, ["modelValue"]),
323
+ vue.createElementVNode("div", _hoisted_8, [
324
+ vue.createVNode(vue.unref(webVue.RangePicker), {
325
+ modelValue: rangeTime.value,
326
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => rangeTime.value = $event),
327
+ "allow-clear": "",
328
+ "popup-container": "#resource-filter-pannel"
329
+ }, null, 8, ["modelValue"])
330
+ ]),
258
331
  vue.createCommentVNode(" \u7D20\u6750\u4E0A\u4F20\u6765\u6E90 "),
259
- vue.createElementVNode("div", _hoisted_6, [
332
+ vue.createElementVNode("div", _hoisted_9, [
260
333
  vue.createVNode(vue.unref(webVue.Select), {
261
334
  modelValue: filter.value.source,
262
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => filter.value.source = $event),
335
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => filter.value.source = $event),
263
336
  "allow-clear": "",
264
- placeholder: "\u6765\u6E90"
337
+ placeholder: "\u6765\u6E90",
338
+ "popup-container": "#resource-filter-pannel"
265
339
  }, {
266
340
  default: vue.withCtx(() => [
267
341
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resourceSource), (item) => {
@@ -276,14 +350,15 @@ const _sfc_main = vue.defineComponent({
276
350
  }, 8, ["modelValue"])
277
351
  ]),
278
352
  vue.createCommentVNode(" \u7D20\u6750\u4E0A\u4F20\u4EBA "),
279
- !_ctx.disableUploadBy ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
353
+ !_ctx.disableUploadBy ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
280
354
  vue.createVNode(vue.unref(webVue.Select), {
281
355
  modelValue: filter.value.upload_by,
282
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => filter.value.upload_by = $event),
356
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => filter.value.upload_by = $event),
283
357
  "allow-clear": "",
284
358
  placeholder: "\u4E0A\u4F20\u4EBA",
285
359
  loading: vue.unref(loading),
286
360
  "allow-search": "",
361
+ "popup-container": "#resource-filter-pannel",
287
362
  onSearch: vue.unref(handleSearch),
288
363
  onDropdownReachBottom: vue.unref(loadMore)
289
364
  }, {
@@ -298,40 +373,54 @@ const _sfc_main = vue.defineComponent({
298
373
  ]),
299
374
  _: 1
300
375
  }, 8, ["modelValue", "loading", "onSearch", "onDropdownReachBottom"])
301
- ])) : vue.createCommentVNode("v-if", true),
302
- !isEmpty.value ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Button), {
303
- key: 1,
304
- type: "text",
305
- onClick: handleReset
376
+ ])) : vue.createCommentVNode("v-if", true)
377
+ ], 512),
378
+ vue.createElementVNode("div", _hoisted_11, [
379
+ vue.createCommentVNode(" \u91CD\u7F6E\u6309\u94AE - Wrap in filter-item to be managed by the hook "),
380
+ vue.withDirectives(vue.createElementVNode("div", _hoisted_12, [
381
+ vue.createVNode(vue.unref(webVue.Button), {
382
+ type: "text",
383
+ onClick: handleReset
384
+ }, {
385
+ default: vue.withCtx(() => _cache[14] || (_cache[14] = [
386
+ vue.createTextVNode(" \u91CD\u7F6E ")
387
+ ])),
388
+ _: 1
389
+ })
390
+ ], 512), [
391
+ [vue.vShow, !isEmpty.value]
392
+ ]),
393
+ _ctx.smallScreen ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Button), {
394
+ key: 0,
395
+ type: "primary",
396
+ onClick: _cache[9] || (_cache[9] = ($event) => emits("upload"))
306
397
  }, {
307
- default: vue.withCtx(() => _cache[10] || (_cache[10] = [
308
- vue.createTextVNode(" \u91CD\u7F6E ")
309
- ])),
398
+ icon: vue.withCtx(() => [
399
+ vue.createVNode(vue.unref(icon.IconUpload))
400
+ ]),
310
401
  _: 1
311
- })) : vue.createCommentVNode("v-if", true)
312
- ]),
313
- vue.createElementVNode("div", _hoisted_8, [
314
- vue.createVNode(vue.unref(webVue.Button), {
402
+ })) : (vue.openBlock(), vue.createBlock(vue.unref(webVue.Button), {
403
+ key: 1,
315
404
  type: "primary",
316
- onClick: _cache[7] || (_cache[7] = ($event) => emits("upload"))
405
+ onClick: _cache[10] || (_cache[10] = ($event) => emits("upload"))
317
406
  }, {
318
407
  icon: vue.withCtx(() => [
319
408
  vue.createVNode(vue.unref(icon.IconUpload))
320
409
  ]),
321
410
  default: vue.withCtx(() => [
322
- _cache[11] || (_cache[11] = vue.createTextVNode(" \u4E0A\u4F20 "))
411
+ _cache[15] || (_cache[15] = vue.createTextVNode(" \u4E0A\u4F20 "))
323
412
  ]),
324
413
  _: 1
325
- })
414
+ }))
326
415
  ])
327
416
  ]),
328
- searchInput.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9, [
417
+ searchInput.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, [
329
418
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resource.keywordsSelection), (item) => {
330
419
  return vue.openBlock(), vue.createElementBlock("div", {
331
420
  key: item.value,
332
421
  class: vue.normalizeClass(["list-filter-tag", { active: filter.value.sf === item.value }]),
333
422
  onClick: ($event) => filter.value.sf = item.value
334
- }, vue.toDisplayString(item.name), 11, _hoisted_10);
423
+ }, vue.toDisplayString(item.name), 11, _hoisted_14);
335
424
  }), 128))
336
425
  ])) : vue.createCommentVNode("v-if", true)
337
426
  ]);
@@ -28,14 +28,15 @@ const _sfc_main = vue.defineComponent({
28
28
  } = useAttachement["default"]({ key: props.activeKey, BASE_API });
29
29
  vue.watch(() => props.activeKey, changeKey);
30
30
  const listWrapper = vue.ref(null);
31
- const showPageSize = vue.ref(true);
31
+ const smallScreen = vue.ref(false);
32
32
  vue.watch(
33
33
  () => {
34
34
  var _a;
35
35
  return (_a = listWrapper.value) == null ? void 0 : _a.offsetWidth;
36
36
  },
37
37
  (val) => {
38
- showPageSize.value = !(val && val < 480);
38
+ console.log(val);
39
+ smallScreen.value = !!(val && val < 600);
39
40
  },
40
41
  { immediate: true }
41
42
  );
@@ -52,9 +53,10 @@ const _sfc_main = vue.defineComponent({
52
53
  ]),
53
54
  header: vue.withCtx(() => [
54
55
  vue.createVNode(Filter, {
56
+ smallScreen: smallScreen.value,
55
57
  onChange: vue.unref(changeFilter),
56
58
  onUpload: _cache[0] || (_cache[0] = ($event) => emits("change-tab", "local"))
57
- }, null, 8, ["onChange"])
59
+ }, null, 8, ["smallScreen", "onChange"])
58
60
  ]),
59
61
  footer: vue.withCtx(() => [
60
62
  vue.createVNode(vue.unref(webVue.Pagination), {
@@ -63,7 +65,7 @@ const _sfc_main = vue.defineComponent({
63
65
  total: vue.unref(total),
64
66
  "page-size": vue.unref(limit),
65
67
  "show-total": "",
66
- "show-page-size": showPageSize.value,
68
+ "show-page-size": !smallScreen.value,
67
69
  "base-size": 3,
68
70
  "buffer-size": 1,
69
71
  onChange: _cache[2] || (_cache[2] = (e) => vue.unref(changePage)((e - 1) * vue.unref(limit))),
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ var vue = require("vue");
4
+ var usePopper = require("../../hooks/usePopper.js");
5
+ const getRect = (el) => {
6
+ if (!el || typeof el.getClientRects !== "function")
7
+ return { right: 0, width: 0 };
8
+ const rects = el.getClientRects();
9
+ if (rects.length === 0)
10
+ return { right: 0, width: 0 };
11
+ const rect = rects[0];
12
+ return {
13
+ right: rect.right,
14
+ width: rect.width
15
+ };
16
+ };
17
+ function useResponsiveFilter(filterItemsRef) {
18
+ const moreBtnRef = vue.ref();
19
+ const popperPanelRef = vue.ref();
20
+ const { initPopper, show, visible, hide } = usePopper(
21
+ popperPanelRef,
22
+ moreBtnRef
23
+ );
24
+ const windowWidth = vue.ref(0);
25
+ const filterContainerRightBoundary = vue.ref(0);
26
+ const hiddenElementList = vue.ref([]);
27
+ const initWidths = () => {
28
+ var _a, _b;
29
+ windowWidth.value = ((_a = document.body) == null ? void 0 : _a.clientWidth) || 0;
30
+ const containerElement = (_b = filterItemsRef.value) == null ? void 0 : _b.parentElement;
31
+ if (containerElement) {
32
+ filterContainerRightBoundary.value = getRect(containerElement).right;
33
+ }
34
+ };
35
+ const initResizeListener = () => {
36
+ window.addEventListener("resize", refreshLayout);
37
+ };
38
+ const removeResizeListener = () => {
39
+ window.removeEventListener("resize", refreshLayout);
40
+ };
41
+ const hideElement = (el) => {
42
+ var _a, _b, _c;
43
+ const { width } = getRect(el);
44
+ if (width > 0 && ((_a = filterItemsRef.value) == null ? void 0 : _a.contains(el))) {
45
+ hiddenElementList.value.push({ width, el });
46
+ (_b = filterItemsRef.value) == null ? void 0 : _b.removeChild(el);
47
+ (_c = popperPanelRef.value) == null ? void 0 : _c.insertBefore(el, popperPanelRef.value.firstChild);
48
+ }
49
+ };
50
+ const showElement = () => {
51
+ var _a, _b;
52
+ if (!hiddenElementList.value.length || !filterItemsRef.value)
53
+ return;
54
+ const popEl = hiddenElementList.value.pop();
55
+ if (!popEl)
56
+ return;
57
+ const { el } = popEl;
58
+ (_a = popperPanelRef.value) == null ? void 0 : _a.removeChild(el);
59
+ (_b = filterItemsRef.value) == null ? void 0 : _b.appendChild(el);
60
+ };
61
+ const checkOverflow = () => {
62
+ if (!filterItemsRef.value)
63
+ return -1;
64
+ const containerRight = filterContainerRightBoundary.value;
65
+ const children = filterItemsRef.value.children;
66
+ let currentRightmostBoundary = getRect(filterItemsRef.value).right - getRect(filterItemsRef.value).width;
67
+ for (let i = children.length - 1; i >= 0; i--) {
68
+ const item = children[i];
69
+ if (!item || !item.classList || !item.classList.contains("filter-item"))
70
+ continue;
71
+ const itemRect = getRect(item);
72
+ if (itemRect.right > containerRight - 300) {
73
+ hideElement(item);
74
+ } else {
75
+ currentRightmostBoundary = Math.max(
76
+ currentRightmostBoundary,
77
+ itemRect.right
78
+ );
79
+ }
80
+ }
81
+ return currentRightmostBoundary;
82
+ };
83
+ const refreshLayout = async () => {
84
+ await vue.nextTick();
85
+ initWidths();
86
+ if (!filterItemsRef.value || !popperPanelRef.value)
87
+ return;
88
+ const containerRight = filterContainerRightBoundary.value;
89
+ let lastVisibleItemRight = checkOverflow();
90
+ if (lastVisibleItemRight === -1 && filterItemsRef.value.children.length > 0) {
91
+ lastVisibleItemRight = getRect(filterItemsRef.value).left;
92
+ } else if (filterItemsRef.value.children.length === 0) {
93
+ lastVisibleItemRight = getRect(filterItemsRef.value).left;
94
+ }
95
+ await vue.nextTick();
96
+ let availableSpace = containerRight - lastVisibleItemRight;
97
+ while (hiddenElementList.value.length > 0) {
98
+ const nextHiddenItem = hiddenElementList.value[hiddenElementList.value.length - 1];
99
+ const nextHiddenItemWidth = nextHiddenItem.width;
100
+ if (availableSpace > nextHiddenItemWidth + 10) {
101
+ showElement();
102
+ await vue.nextTick();
103
+ const visibleElements = Array.from(
104
+ filterItemsRef.value.children
105
+ );
106
+ if (visibleElements.length > 0) {
107
+ lastVisibleItemRight = visibleElements.reduce((maxRight, el) => {
108
+ var _a;
109
+ if ((_a = el.classList) == null ? void 0 : _a.contains("filter-item")) {
110
+ return Math.max(maxRight, getRect(el).right);
111
+ }
112
+ return maxRight;
113
+ }, getRect(filterItemsRef.value).left);
114
+ } else {
115
+ lastVisibleItemRight = getRect(filterItemsRef.value).left;
116
+ }
117
+ availableSpace = containerRight - lastVisibleItemRight;
118
+ } else {
119
+ break;
120
+ }
121
+ }
122
+ };
123
+ vue.onMounted(async () => {
124
+ initResizeListener();
125
+ initPopper("bottom-start", [0, 40]);
126
+ await vue.nextTick();
127
+ initWidths();
128
+ await vue.nextTick();
129
+ refreshLayout();
130
+ });
131
+ vue.onUnmounted(() => {
132
+ removeResizeListener();
133
+ });
134
+ return {
135
+ moreBtnRef,
136
+ popperPanelRef,
137
+ hiddenElementList,
138
+ visible,
139
+ show,
140
+ hide,
141
+ refreshLayout
142
+ };
143
+ }
144
+ exports.useResponsiveFilter = useResponsiveFilter;
@@ -172,11 +172,13 @@
172
172
  }
173
173
  .resource-list-footer,
174
174
  .resource-list-header,
175
+ .resource-list-content .resource-list-content-empty,
175
176
  .resource-list-content .arco-scrollbar-container {
176
177
  padding: 0 40px;
177
178
  }
178
179
  .resource-list-footer {
179
180
  display: flex;
181
+ flex-wrap: wrap;
180
182
  justify-content: space-between;
181
183
  padding-bottom: 20px;
182
184
  }
@@ -186,6 +188,10 @@
186
188
  gap: 10px;
187
189
  align-items: center;
188
190
  justify-content: flex-end;
191
+ margin-top: 10px;
192
+ }
193
+ .resource-list-footer .footer-right .list-selected-wrapper {
194
+ font-size: 12px;
189
195
  }
190
196
  .resource-list-content-loading {
191
197
  display: flex;
@@ -240,7 +246,8 @@
240
246
  }
241
247
  .resource-list .list-filter-wrapper .list-filter-tags {
242
248
  display: flex;
243
- justify-content: space-between;
249
+ flex-wrap: wrap;
250
+ gap: 10px;
244
251
  margin-top: 10px;
245
252
  }
246
253
  .resource-list .list-filter-wrapper .list-filter-tags .list-filter-tag {
@@ -261,16 +268,41 @@
261
268
  justify-content: space-between;
262
269
  }
263
270
  .resource-list .list-filter-wrapper .list-filter .filter-list {
271
+ position: relative;
272
+ /** 给 popup 一个参考 */
264
273
  display: flex;
265
- flex-wrap: wrap;
266
- gap: 10px;
267
274
  }
268
275
  .resource-list .list-filter-wrapper .list-filter .filter-list .filter-item {
269
276
  width: 100px;
277
+ margin-right: 10px;
278
+ }
279
+ .resource-list .list-filter-wrapper .list-filter .filter-list .arco-trigger-popup {
280
+ z-index: 100000 !important;
270
281
  }
271
282
  .resource-list .list-filter-wrapper .list-filter .arco-input-prepend {
272
283
  padding: 0;
273
284
  }
285
+ .resource-list .list-filter-wrapper .list-filter .more-btn {
286
+ position: relative;
287
+ /** 给 poperjs 一个参考 */
288
+ }
289
+ .resource-list .list-filter-wrapper .list-filter .more-btn .filter-pannel {
290
+ inset: 40px auto auto auto !important;
291
+ }
292
+ .resource-list .list-filter-wrapper .filter-extra {
293
+ display: flex;
294
+ gap: 10px;
295
+ }
296
+ .resource-list .list-filter-wrapper .filter-pannel {
297
+ z-index: 100000;
298
+ display: flex;
299
+ flex-direction: column;
300
+ gap: 10px;
301
+ padding: 10px;
302
+ background-color: #fff;
303
+ border-radius: 4px;
304
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
305
+ }
274
306
  .resource-list .title {
275
307
  display: flex;
276
308
  gap: 8px;
@@ -316,3 +348,8 @@
316
348
  .resource-select-container .resource-select-header .arco-tabs-content {
317
349
  display: none !important;
318
350
  }
351
+ .resource-select-container .resource-list-content .resource-list-content-empty {
352
+ box-sizing: border-box;
353
+ width: 100%;
354
+ height: 100%;
355
+ }
@@ -43,4 +43,13 @@
43
43
  display: none !important;
44
44
  }
45
45
  }
46
+
47
+ // 内容区域样式
48
+ .resource-list-content {
49
+ .resource-list-content-empty {
50
+ box-sizing: border-box;
51
+ width: 100%;
52
+ height: 100%;
53
+ }
54
+ }
46
55
  }