@cmstops/pro-compo 0.3.100 → 3.9.0-beta.1
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/dist/index.css +39 -4
- package/dist/index.min.css +1 -1
- package/es/config.js +1 -1
- package/es/editMetaInfo/components/metaInfoForm.js +4 -2
- package/es/hooks/useAttachement.d.ts +26 -7
- package/es/hooks/useAttachement.js +42 -2
- package/es/hooks/usePopper.d.ts +1 -1
- package/es/hooks/usePopper.js +3 -3
- package/es/index.css +39 -4
- package/es/selectResourceModal/__demo__/module/DivWrapper.d.ts +268 -0
- package/es/selectResourceModal/__demo__/module/basic.d.ts +299 -0
- package/es/selectResourceModal/components/List/ListNormal/Filter.js +174 -76
- package/es/selectResourceModal/components/List/ListNormal/index.js +21 -6
- package/es/selectResourceModal/hooks/useResponsiveFilter.d.ts +21 -0
- package/es/selectResourceModal/hooks/useResponsiveFilter.js +142 -0
- package/es/selectResourceModal/scripts/useCompoLf.js +1 -1
- package/es/selectResourceModal/style/index.css +39 -4
- package/es/selectResourceModal/style/index.less +5 -0
- package/es/selectResourceModal/style/list.less +39 -4
- package/es/selectThumb/component.js +57 -3
- package/lib/config.js +1 -1
- package/lib/editMetaInfo/components/metaInfoForm.js +4 -2
- package/lib/hooks/useAttachement.js +42 -0
- package/lib/hooks/usePopper.js +3 -3
- package/lib/index.css +39 -4
- package/lib/selectResourceModal/components/List/ListNormal/Filter.js +171 -73
- package/lib/selectResourceModal/components/List/ListNormal/index.js +20 -5
- package/lib/selectResourceModal/hooks/useResponsiveFilter.js +144 -0
- package/lib/selectResourceModal/scripts/useCompoLf.js +1 -1
- package/lib/selectResourceModal/style/index.css +39 -4
- package/lib/selectResourceModal/style/index.less +5 -0
- package/lib/selectResourceModal/style/list.less +39 -4
- package/lib/selectThumb/component.js +56 -2
- package/package.json +1 -1
|
@@ -3,28 +3,46 @@ var vue = require("vue");
|
|
|
3
3
|
var webVue = require("@arco-design/web-vue");
|
|
4
4
|
var icon = require("@arco-design/web-vue/es/icon");
|
|
5
5
|
var useSelection = require("../../../../hooks/useSelection.js");
|
|
6
|
+
var useAttachement = require("../../../../hooks/useAttachement.js");
|
|
6
7
|
var typeMap = require("../../../../utils/typeMap.js");
|
|
7
8
|
var selectionApis = require("../../../scripts/selectionApis.js");
|
|
8
9
|
var resource = require("../../../../utils/resource.js");
|
|
10
|
+
var useResponsiveFilter = require("../../../hooks/useResponsiveFilter.js");
|
|
9
11
|
const _hoisted_1 = { class: "list-filter-wrapper" };
|
|
10
12
|
const _hoisted_2 = { class: "list-filter" };
|
|
11
|
-
const _hoisted_3 = { class: "
|
|
12
|
-
const _hoisted_4 = {
|
|
13
|
+
const _hoisted_3 = { class: "more-btn" };
|
|
14
|
+
const _hoisted_4 = { class: "right-prefix" };
|
|
13
15
|
const _hoisted_5 = {
|
|
14
16
|
class: "filter-item",
|
|
15
17
|
style: { "width": "200px" }
|
|
16
18
|
};
|
|
17
|
-
const _hoisted_6 = {
|
|
19
|
+
const _hoisted_6 = {
|
|
20
|
+
class: "filter-item",
|
|
21
|
+
style: { "width": "180px" }
|
|
22
|
+
};
|
|
18
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 = {
|
|
19
36
|
key: 0,
|
|
20
37
|
class: "filter-item"
|
|
21
38
|
};
|
|
22
|
-
const
|
|
23
|
-
const
|
|
39
|
+
const _hoisted_11 = { class: "filter-extra" };
|
|
40
|
+
const _hoisted_12 = { class: "filter-item" };
|
|
41
|
+
const _hoisted_13 = {
|
|
24
42
|
key: 0,
|
|
25
43
|
class: "list-filter-tags"
|
|
26
44
|
};
|
|
27
|
-
const
|
|
45
|
+
const _hoisted_14 = ["onClick"];
|
|
28
46
|
const _sfc_main = vue.defineComponent({
|
|
29
47
|
__name: "Filter",
|
|
30
48
|
props: {
|
|
@@ -38,6 +56,16 @@ const _sfc_main = vue.defineComponent({
|
|
|
38
56
|
const baseAPI = vue.inject("baseAPI");
|
|
39
57
|
const filterOptions = vue.inject("filterOptions");
|
|
40
58
|
const domainId = vue.computed(() => userInfo == null ? void 0 : userInfo.value.domain_id);
|
|
59
|
+
const filterItemsRef = vue.ref();
|
|
60
|
+
const {
|
|
61
|
+
moreBtnRef,
|
|
62
|
+
popperPanelRef,
|
|
63
|
+
hiddenElementList,
|
|
64
|
+
visible,
|
|
65
|
+
show,
|
|
66
|
+
hide,
|
|
67
|
+
refreshLayout
|
|
68
|
+
} = useResponsiveFilter.useResponsiveFilter(filterItemsRef);
|
|
41
69
|
const { options, loading, load, loadMore, handleSearch } = useSelection({
|
|
42
70
|
labelStr: "alias",
|
|
43
71
|
valueStr: "id",
|
|
@@ -57,6 +85,9 @@ const _sfc_main = vue.defineComponent({
|
|
|
57
85
|
});
|
|
58
86
|
const resourceSource = typeMap.RESOURCE_SOURCE_OPTIONS;
|
|
59
87
|
const resourceCatalog = typeMap.RESOURCE_CATALOG_OPTIONS;
|
|
88
|
+
const { tree } = useAttachement.useDirectory({
|
|
89
|
+
BASE_API: baseAPI
|
|
90
|
+
});
|
|
60
91
|
const originFilter = {
|
|
61
92
|
catalog: [],
|
|
62
93
|
source: "",
|
|
@@ -65,7 +96,8 @@ const _sfc_main = vue.defineComponent({
|
|
|
65
96
|
keyword: "",
|
|
66
97
|
precise_keyword: "",
|
|
67
98
|
upload_by: null,
|
|
68
|
-
sf: ""
|
|
99
|
+
sf: "",
|
|
100
|
+
directory_id: void 0
|
|
69
101
|
};
|
|
70
102
|
const filter = vue.ref(JSON.parse(JSON.stringify(originFilter)));
|
|
71
103
|
const handleReset = () => {
|
|
@@ -112,82 +144,123 @@ const _sfc_main = vue.defineComponent({
|
|
|
112
144
|
filter.value.keyword = val;
|
|
113
145
|
filter.value.precise_keyword = "";
|
|
114
146
|
}
|
|
147
|
+
filter.value.sf = "";
|
|
115
148
|
}
|
|
116
149
|
});
|
|
117
|
-
vue.watch(
|
|
118
|
-
() => searchType.value,
|
|
119
|
-
() => {
|
|
120
|
-
searchInput.value = filter.value.keyword || filter.value.precise_keyword;
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
150
|
const isEmpty = vue.computed(() => {
|
|
124
|
-
return Object.keys(
|
|
151
|
+
return Object.keys(originFilter).every((key) => {
|
|
152
|
+
if (key === "catalog") {
|
|
153
|
+
const currentCatalog = filter.value[key] || [];
|
|
154
|
+
const originCatalog = originFilter[key] || [];
|
|
155
|
+
return currentCatalog.length === originCatalog.length && currentCatalog.every((v) => originCatalog.includes(v));
|
|
156
|
+
}
|
|
125
157
|
return filter.value[key] === originFilter[key];
|
|
126
158
|
});
|
|
127
159
|
});
|
|
128
160
|
vue.watch(
|
|
129
161
|
() => filter.value,
|
|
130
|
-
() => {
|
|
131
|
-
const result = { ...
|
|
162
|
+
(val) => {
|
|
163
|
+
const result = { ...val };
|
|
132
164
|
Object.keys(result).forEach((key) => {
|
|
133
165
|
if (props.disableUploadBy && key === "upload_by")
|
|
134
166
|
delete result[key];
|
|
135
|
-
if (
|
|
136
|
-
|
|
167
|
+
if (result[key] === "" || result[key] === null || result[key] === void 0) {
|
|
168
|
+
if (key !== "catalog") {
|
|
169
|
+
delete result[key];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
137
172
|
});
|
|
138
|
-
if (
|
|
139
|
-
result.catalog
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
{ deep: true, immediate: true }
|
|
145
|
-
);
|
|
146
|
-
vue.watch(
|
|
147
|
-
() => filterOptions == null ? void 0 : filterOptions.value,
|
|
148
|
-
() => {
|
|
149
|
-
var _a;
|
|
150
|
-
if ((_a = filterOptions == null ? void 0 : filterOptions.value) == null ? void 0 : _a.mediaType) {
|
|
151
|
-
filter.value.catalog = filterOptions == null ? void 0 : filterOptions.value.mediaType.split(",");
|
|
152
|
-
if (filterOptions == null ? void 0 : filterOptions.value.mediaTypeStrict) {
|
|
153
|
-
originFilter.catalog = filterOptions == null ? void 0 : filterOptions.value.mediaType.split(",");
|
|
173
|
+
if (result.catalog && Array.isArray(result.catalog)) {
|
|
174
|
+
if (result.catalog.length > 0) {
|
|
175
|
+
result.catalog = result.catalog.join(",");
|
|
176
|
+
} else {
|
|
177
|
+
delete result.catalog;
|
|
154
178
|
}
|
|
155
179
|
}
|
|
180
|
+
emits("change", result);
|
|
181
|
+
refreshLayout();
|
|
156
182
|
},
|
|
157
|
-
{
|
|
183
|
+
{ deep: true, immediate: true }
|
|
158
184
|
);
|
|
159
185
|
vue.onMounted(() => {
|
|
186
|
+
var _a;
|
|
160
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
|
+
}
|
|
161
195
|
});
|
|
162
196
|
__expose({
|
|
163
|
-
|
|
197
|
+
filter,
|
|
198
|
+
handleReset
|
|
164
199
|
});
|
|
165
200
|
return (_ctx, _cache) => {
|
|
166
201
|
var _a;
|
|
167
202
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
203
|
+
vue.createCommentVNode(" Use filterItemsRef's parentElement as the container for boundary checks "),
|
|
168
204
|
vue.createElementVNode("div", _hoisted_2, [
|
|
169
|
-
vue.
|
|
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[10] || (_cache[10] = vue.createTextVNode(" \u66F4\u591A\u7B5B\u9009 ")),
|
|
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
|
+
]),
|
|
170
243
|
vue.createCommentVNode(" \u5173\u952E\u8BCD "),
|
|
171
|
-
vue.createElementVNode("div",
|
|
244
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
172
245
|
vue.createVNode(vue.unref(webVue.Input), {
|
|
173
246
|
modelValue: searchInput.value,
|
|
174
|
-
"onUpdate:modelValue": _cache[
|
|
247
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => searchInput.value = $event),
|
|
175
248
|
"allow-clear": "",
|
|
176
249
|
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD"
|
|
177
250
|
}, {
|
|
178
251
|
prepend: vue.withCtx(() => [
|
|
179
252
|
vue.createVNode(vue.unref(webVue.Dropdown), {
|
|
180
|
-
onSelect: _cache[
|
|
253
|
+
onSelect: _cache[2] || (_cache[2] = (e) => searchType.value = e)
|
|
181
254
|
}, {
|
|
182
255
|
content: vue.withCtx(() => [
|
|
183
256
|
vue.createVNode(vue.unref(webVue.Doption), { value: 0 }, {
|
|
184
|
-
default: vue.withCtx(() => _cache[
|
|
257
|
+
default: vue.withCtx(() => _cache[11] || (_cache[11] = [
|
|
185
258
|
vue.createTextVNode("\u7CBE\u51C6\u641C")
|
|
186
259
|
])),
|
|
187
260
|
_: 1
|
|
188
261
|
}),
|
|
189
262
|
vue.createVNode(vue.unref(webVue.Doption), { value: 1 }, {
|
|
190
|
-
default: vue.withCtx(() => _cache[
|
|
263
|
+
default: vue.withCtx(() => _cache[12] || (_cache[12] = [
|
|
191
264
|
vue.createTextVNode("\u6A21\u7CCA\u641C")
|
|
192
265
|
])),
|
|
193
266
|
_: 1
|
|
@@ -207,15 +280,32 @@ const _sfc_main = vue.defineComponent({
|
|
|
207
280
|
_: 1
|
|
208
281
|
}, 8, ["modelValue"])
|
|
209
282
|
]),
|
|
283
|
+
vue.createCommentVNode(" \u76EE\u5F55 "),
|
|
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
|
+
]),
|
|
210
298
|
vue.createCommentVNode(" \u7D20\u6750\u7C7B\u578B "),
|
|
211
|
-
vue.createElementVNode("div",
|
|
299
|
+
vue.createElementVNode("div", _hoisted_7, [
|
|
212
300
|
vue.createVNode(vue.unref(webVue.Select), {
|
|
213
301
|
modelValue: filter.value.catalog,
|
|
214
|
-
"onUpdate:modelValue": _cache[
|
|
302
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => filter.value.catalog = $event),
|
|
215
303
|
disabled: (_a = vue.unref(filterOptions)) == null ? void 0 : _a.mediaTypeStrict,
|
|
304
|
+
"popup-container": "#resource-filter-pannel",
|
|
216
305
|
"allow-clear": "",
|
|
217
306
|
placeholder: "\u7C7B\u578B",
|
|
218
|
-
multiple: ""
|
|
307
|
+
multiple: "",
|
|
308
|
+
"max-tag-count": 1
|
|
219
309
|
}, {
|
|
220
310
|
default: vue.withCtx(() => [
|
|
221
311
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resourceCatalog), (item) => {
|
|
@@ -230,19 +320,22 @@ const _sfc_main = vue.defineComponent({
|
|
|
230
320
|
}, 8, ["modelValue", "disabled"])
|
|
231
321
|
]),
|
|
232
322
|
vue.createCommentVNode(" \u65F6\u95F4\u8303\u56F4 "),
|
|
233
|
-
vue.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
+
]),
|
|
239
331
|
vue.createCommentVNode(" \u7D20\u6750\u4E0A\u4F20\u6765\u6E90 "),
|
|
240
|
-
vue.createElementVNode("div",
|
|
332
|
+
vue.createElementVNode("div", _hoisted_9, [
|
|
241
333
|
vue.createVNode(vue.unref(webVue.Select), {
|
|
242
334
|
modelValue: filter.value.source,
|
|
243
|
-
"onUpdate:modelValue": _cache[
|
|
335
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => filter.value.source = $event),
|
|
244
336
|
"allow-clear": "",
|
|
245
|
-
placeholder: "\u6765\u6E90"
|
|
337
|
+
placeholder: "\u6765\u6E90",
|
|
338
|
+
"popup-container": "#resource-filter-pannel"
|
|
246
339
|
}, {
|
|
247
340
|
default: vue.withCtx(() => [
|
|
248
341
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resourceSource), (item) => {
|
|
@@ -257,14 +350,15 @@ const _sfc_main = vue.defineComponent({
|
|
|
257
350
|
}, 8, ["modelValue"])
|
|
258
351
|
]),
|
|
259
352
|
vue.createCommentVNode(" \u7D20\u6750\u4E0A\u4F20\u4EBA "),
|
|
260
|
-
!_ctx.disableUploadBy ? (vue.openBlock(), vue.createElementBlock("div",
|
|
353
|
+
!_ctx.disableUploadBy ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
|
|
261
354
|
vue.createVNode(vue.unref(webVue.Select), {
|
|
262
355
|
modelValue: filter.value.upload_by,
|
|
263
|
-
"onUpdate:modelValue": _cache[
|
|
356
|
+
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => filter.value.upload_by = $event),
|
|
264
357
|
"allow-clear": "",
|
|
265
358
|
placeholder: "\u4E0A\u4F20\u4EBA",
|
|
266
359
|
loading: vue.unref(loading),
|
|
267
360
|
"allow-search": "",
|
|
361
|
+
"popup-container": "#resource-filter-pannel",
|
|
268
362
|
onSearch: vue.unref(handleSearch),
|
|
269
363
|
onDropdownReachBottom: vue.unref(loadMore)
|
|
270
364
|
}, {
|
|
@@ -279,40 +373,44 @@ const _sfc_main = vue.defineComponent({
|
|
|
279
373
|
]),
|
|
280
374
|
_: 1
|
|
281
375
|
}, 8, ["modelValue", "loading", "onSearch", "onDropdownReachBottom"])
|
|
282
|
-
])) : vue.createCommentVNode("v-if", true)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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[13] || (_cache[13] = [
|
|
386
|
+
vue.createTextVNode(" \u91CD\u7F6E ")
|
|
387
|
+
])),
|
|
388
|
+
_: 1
|
|
389
|
+
})
|
|
390
|
+
], 512), [
|
|
391
|
+
[vue.vShow, !isEmpty.value]
|
|
392
|
+
]),
|
|
295
393
|
vue.createVNode(vue.unref(webVue.Button), {
|
|
296
394
|
type: "primary",
|
|
297
|
-
onClick: _cache[
|
|
395
|
+
onClick: _cache[9] || (_cache[9] = ($event) => emits("upload"))
|
|
298
396
|
}, {
|
|
299
397
|
icon: vue.withCtx(() => [
|
|
300
398
|
vue.createVNode(vue.unref(icon.IconUpload))
|
|
301
399
|
]),
|
|
302
400
|
default: vue.withCtx(() => [
|
|
303
|
-
_cache[
|
|
401
|
+
_cache[14] || (_cache[14] = vue.createTextVNode(" \u4E0A\u4F20 "))
|
|
304
402
|
]),
|
|
305
403
|
_: 1
|
|
306
404
|
})
|
|
307
405
|
])
|
|
308
406
|
]),
|
|
309
|
-
searchInput.value ? (vue.openBlock(), vue.createElementBlock("div",
|
|
407
|
+
searchInput.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, [
|
|
310
408
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resource.keywordsSelection), (item) => {
|
|
311
409
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
312
410
|
key: item.value,
|
|
313
411
|
class: vue.normalizeClass(["list-filter-tag", { active: filter.value.sf === item.value }]),
|
|
314
412
|
onClick: ($event) => filter.value.sf = item.value
|
|
315
|
-
}, vue.toDisplayString(item.name), 11,
|
|
413
|
+
}, vue.toDisplayString(item.name), 11, _hoisted_14);
|
|
316
414
|
}), 128))
|
|
317
415
|
])) : vue.createCommentVNode("v-if", true)
|
|
318
416
|
]);
|
|
@@ -4,7 +4,6 @@ var webVue = require("@arco-design/web-vue");
|
|
|
4
4
|
var ListWraper = require("../ListWraper.js");
|
|
5
5
|
var useAttachement = require("../../../../hooks/useAttachement.js");
|
|
6
6
|
var Filter = require("./Filter.js");
|
|
7
|
-
const _hoisted_1 = { class: "list-item-grid" };
|
|
8
7
|
const _sfc_main = vue.defineComponent({
|
|
9
8
|
__name: "index",
|
|
10
9
|
props: {
|
|
@@ -28,6 +27,18 @@ const _sfc_main = vue.defineComponent({
|
|
|
28
27
|
changeKey
|
|
29
28
|
} = useAttachement["default"]({ key: props.activeKey, BASE_API });
|
|
30
29
|
vue.watch(() => props.activeKey, changeKey);
|
|
30
|
+
const listWrapper = vue.ref(null);
|
|
31
|
+
const showPageSize = vue.ref(true);
|
|
32
|
+
vue.watch(
|
|
33
|
+
() => {
|
|
34
|
+
var _a;
|
|
35
|
+
return (_a = listWrapper.value) == null ? void 0 : _a.offsetWidth;
|
|
36
|
+
},
|
|
37
|
+
(val) => {
|
|
38
|
+
showPageSize.value = !(val && val < 480);
|
|
39
|
+
},
|
|
40
|
+
{ immediate: true }
|
|
41
|
+
);
|
|
31
42
|
vue.onMounted(() => {
|
|
32
43
|
loadData();
|
|
33
44
|
});
|
|
@@ -52,22 +63,26 @@ const _sfc_main = vue.defineComponent({
|
|
|
52
63
|
total: vue.unref(total),
|
|
53
64
|
"page-size": vue.unref(limit),
|
|
54
65
|
"show-total": "",
|
|
55
|
-
"show-page-size":
|
|
66
|
+
"show-page-size": showPageSize.value,
|
|
56
67
|
"base-size": 3,
|
|
57
68
|
"buffer-size": 1,
|
|
58
69
|
onChange: _cache[2] || (_cache[2] = (e) => vue.unref(changePage)((e - 1) * vue.unref(limit))),
|
|
59
70
|
onPageSizeChange: vue.unref(changeSize)
|
|
60
|
-
}, null, 8, ["current", "total", "page-size", "onPageSizeChange"])
|
|
71
|
+
}, null, 8, ["current", "total", "page-size", "show-page-size", "onPageSizeChange"])
|
|
61
72
|
]),
|
|
62
73
|
default: vue.withCtx(() => [
|
|
63
|
-
vue.createElementVNode("div",
|
|
74
|
+
vue.createElementVNode("div", {
|
|
75
|
+
ref_key: "listWrapper",
|
|
76
|
+
ref: listWrapper,
|
|
77
|
+
class: "list-item-grid"
|
|
78
|
+
}, [
|
|
64
79
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (item) => {
|
|
65
80
|
return vue.renderSlot(_ctx.$slots, "item", {
|
|
66
81
|
key: item.id,
|
|
67
82
|
item
|
|
68
83
|
});
|
|
69
84
|
}), 128))
|
|
70
|
-
])
|
|
85
|
+
], 512)
|
|
71
86
|
]),
|
|
72
87
|
_: 3
|
|
73
88
|
}, 8, ["loading", "is-empty"]);
|
|
@@ -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;
|