@cmstops/pro-compo 3.9.1 → 3.9.2-alpha.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/hooks/useAttachement.js +2 -9
- 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 +169 -86
- 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/lib/config.js +1 -1
- package/lib/hooks/useAttachement.js +2 -9
- package/lib/hooks/usePopper.js +3 -3
- package/lib/index.css +39 -4
- package/lib/selectResourceModal/components/List/ListNormal/Filter.js +166 -83
- 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/package.json +1 -1
|
@@ -7,25 +7,42 @@ 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: "
|
|
13
|
-
const _hoisted_4 = {
|
|
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
17
|
style: { "width": "200px" }
|
|
17
18
|
};
|
|
18
|
-
const _hoisted_6 = {
|
|
19
|
+
const _hoisted_6 = {
|
|
20
|
+
class: "filter-item",
|
|
21
|
+
style: { "width": "180px" }
|
|
22
|
+
};
|
|
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
|
|
24
|
-
const
|
|
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
|
|
45
|
+
const _hoisted_14 = ["onClick"];
|
|
29
46
|
const _sfc_main = vue.defineComponent({
|
|
30
47
|
__name: "Filter",
|
|
31
48
|
props: {
|
|
@@ -39,6 +56,16 @@ const _sfc_main = vue.defineComponent({
|
|
|
39
56
|
const baseAPI = vue.inject("baseAPI");
|
|
40
57
|
const filterOptions = vue.inject("filterOptions");
|
|
41
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);
|
|
42
69
|
const { options, loading, load, loadMore, handleSearch } = useSelection({
|
|
43
70
|
labelStr: "alias",
|
|
44
71
|
valueStr: "id",
|
|
@@ -58,7 +85,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
58
85
|
});
|
|
59
86
|
const resourceSource = typeMap.RESOURCE_SOURCE_OPTIONS;
|
|
60
87
|
const resourceCatalog = typeMap.RESOURCE_CATALOG_OPTIONS;
|
|
61
|
-
const { tree
|
|
88
|
+
const { tree } = useAttachement.useDirectory({
|
|
62
89
|
BASE_API: baseAPI
|
|
63
90
|
});
|
|
64
91
|
const originFilter = {
|
|
@@ -117,82 +144,123 @@ const _sfc_main = vue.defineComponent({
|
|
|
117
144
|
filter.value.keyword = val;
|
|
118
145
|
filter.value.precise_keyword = "";
|
|
119
146
|
}
|
|
147
|
+
filter.value.sf = "";
|
|
120
148
|
}
|
|
121
149
|
});
|
|
122
|
-
vue.watch(
|
|
123
|
-
() => searchType.value,
|
|
124
|
-
() => {
|
|
125
|
-
searchInput.value = filter.value.keyword || filter.value.precise_keyword;
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
150
|
const isEmpty = vue.computed(() => {
|
|
129
|
-
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
|
+
}
|
|
130
157
|
return filter.value[key] === originFilter[key];
|
|
131
158
|
});
|
|
132
159
|
});
|
|
133
160
|
vue.watch(
|
|
134
161
|
() => filter.value,
|
|
135
|
-
() => {
|
|
136
|
-
const result = { ...
|
|
162
|
+
(val) => {
|
|
163
|
+
const result = { ...val };
|
|
137
164
|
Object.keys(result).forEach((key) => {
|
|
138
165
|
if (props.disableUploadBy && key === "upload_by")
|
|
139
166
|
delete result[key];
|
|
140
|
-
if (
|
|
141
|
-
|
|
167
|
+
if (result[key] === "" || result[key] === null || result[key] === void 0) {
|
|
168
|
+
if (key !== "catalog") {
|
|
169
|
+
delete result[key];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
142
172
|
});
|
|
143
|
-
if (
|
|
144
|
-
result.catalog
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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(",");
|
|
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;
|
|
159
178
|
}
|
|
160
179
|
}
|
|
180
|
+
emits("change", result);
|
|
181
|
+
refreshLayout();
|
|
161
182
|
},
|
|
162
|
-
{
|
|
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
|
-
|
|
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.
|
|
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
|
+
]),
|
|
175
243
|
vue.createCommentVNode(" \u5173\u952E\u8BCD "),
|
|
176
|
-
vue.createElementVNode("div",
|
|
244
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
177
245
|
vue.createVNode(vue.unref(webVue.Input), {
|
|
178
246
|
modelValue: searchInput.value,
|
|
179
|
-
"onUpdate:modelValue": _cache[
|
|
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[
|
|
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[
|
|
257
|
+
default: vue.withCtx(() => _cache[11] || (_cache[11] = [
|
|
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[
|
|
263
|
+
default: vue.withCtx(() => _cache[12] || (_cache[12] = [
|
|
196
264
|
vue.createTextVNode("\u6A21\u7CCA\u641C")
|
|
197
265
|
])),
|
|
198
266
|
_: 1
|
|
@@ -212,15 +280,32 @@ const _sfc_main = vue.defineComponent({
|
|
|
212
280
|
_: 1
|
|
213
281
|
}, 8, ["modelValue"])
|
|
214
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
|
+
]),
|
|
215
298
|
vue.createCommentVNode(" \u7D20\u6750\u7C7B\u578B "),
|
|
216
|
-
vue.createElementVNode("div",
|
|
299
|
+
vue.createElementVNode("div", _hoisted_7, [
|
|
217
300
|
vue.createVNode(vue.unref(webVue.Select), {
|
|
218
301
|
modelValue: filter.value.catalog,
|
|
219
|
-
"onUpdate:modelValue": _cache[
|
|
302
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => filter.value.catalog = $event),
|
|
220
303
|
disabled: (_a = vue.unref(filterOptions)) == null ? void 0 : _a.mediaTypeStrict,
|
|
304
|
+
"popup-container": "#resource-filter-pannel",
|
|
221
305
|
"allow-clear": "",
|
|
222
306
|
placeholder: "\u7C7B\u578B",
|
|
223
|
-
multiple: ""
|
|
307
|
+
multiple: "",
|
|
308
|
+
"max-tag-count": 1
|
|
224
309
|
}, {
|
|
225
310
|
default: vue.withCtx(() => [
|
|
226
311
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resourceCatalog), (item) => {
|
|
@@ -234,30 +319,23 @@ const _sfc_main = vue.defineComponent({
|
|
|
234
319
|
_: 1
|
|
235
320
|
}, 8, ["modelValue", "disabled"])
|
|
236
321
|
]),
|
|
237
|
-
vue.createCommentVNode(" \u76EE\u5F55 "),
|
|
238
|
-
vue.createVNode(vue.unref(webVue.TreeSelect), {
|
|
239
|
-
modelValue: filter.value.directory_id,
|
|
240
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => filter.value.directory_id = $event),
|
|
241
|
-
data: vue.unref(tree),
|
|
242
|
-
"load-more": vue.unref(loadDirMore),
|
|
243
|
-
placeholder: "\u8BF7\u9009\u62E9\u76EE\u5F55",
|
|
244
|
-
style: { "width": "180px" },
|
|
245
|
-
"allow-clear": ""
|
|
246
|
-
}, null, 8, ["modelValue", "data", "load-more"]),
|
|
247
322
|
vue.createCommentVNode(" \u65F6\u95F4\u8303\u56F4 "),
|
|
248
|
-
vue.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
+
]),
|
|
254
331
|
vue.createCommentVNode(" \u7D20\u6750\u4E0A\u4F20\u6765\u6E90 "),
|
|
255
|
-
vue.createElementVNode("div",
|
|
332
|
+
vue.createElementVNode("div", _hoisted_9, [
|
|
256
333
|
vue.createVNode(vue.unref(webVue.Select), {
|
|
257
334
|
modelValue: filter.value.source,
|
|
258
|
-
"onUpdate:modelValue": _cache[
|
|
335
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => filter.value.source = $event),
|
|
259
336
|
"allow-clear": "",
|
|
260
|
-
placeholder: "\u6765\u6E90"
|
|
337
|
+
placeholder: "\u6765\u6E90",
|
|
338
|
+
"popup-container": "#resource-filter-pannel"
|
|
261
339
|
}, {
|
|
262
340
|
default: vue.withCtx(() => [
|
|
263
341
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resourceSource), (item) => {
|
|
@@ -272,14 +350,15 @@ const _sfc_main = vue.defineComponent({
|
|
|
272
350
|
}, 8, ["modelValue"])
|
|
273
351
|
]),
|
|
274
352
|
vue.createCommentVNode(" \u7D20\u6750\u4E0A\u4F20\u4EBA "),
|
|
275
|
-
!_ctx.disableUploadBy ? (vue.openBlock(), vue.createElementBlock("div",
|
|
353
|
+
!_ctx.disableUploadBy ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
|
|
276
354
|
vue.createVNode(vue.unref(webVue.Select), {
|
|
277
355
|
modelValue: filter.value.upload_by,
|
|
278
|
-
"onUpdate:modelValue": _cache[
|
|
356
|
+
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => filter.value.upload_by = $event),
|
|
279
357
|
"allow-clear": "",
|
|
280
358
|
placeholder: "\u4E0A\u4F20\u4EBA",
|
|
281
359
|
loading: vue.unref(loading),
|
|
282
360
|
"allow-search": "",
|
|
361
|
+
"popup-container": "#resource-filter-pannel",
|
|
283
362
|
onSearch: vue.unref(handleSearch),
|
|
284
363
|
onDropdownReachBottom: vue.unref(loadMore)
|
|
285
364
|
}, {
|
|
@@ -294,40 +373,44 @@ const _sfc_main = vue.defineComponent({
|
|
|
294
373
|
]),
|
|
295
374
|
_: 1
|
|
296
375
|
}, 8, ["modelValue", "loading", "onSearch", "onDropdownReachBottom"])
|
|
297
|
-
])) : vue.createCommentVNode("v-if", true)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
+
]),
|
|
310
393
|
vue.createVNode(vue.unref(webVue.Button), {
|
|
311
394
|
type: "primary",
|
|
312
|
-
onClick: _cache[
|
|
395
|
+
onClick: _cache[9] || (_cache[9] = ($event) => emits("upload"))
|
|
313
396
|
}, {
|
|
314
397
|
icon: vue.withCtx(() => [
|
|
315
398
|
vue.createVNode(vue.unref(icon.IconUpload))
|
|
316
399
|
]),
|
|
317
400
|
default: vue.withCtx(() => [
|
|
318
|
-
_cache[
|
|
401
|
+
_cache[14] || (_cache[14] = vue.createTextVNode(" \u4E0A\u4F20 "))
|
|
319
402
|
]),
|
|
320
403
|
_: 1
|
|
321
404
|
})
|
|
322
405
|
])
|
|
323
406
|
]),
|
|
324
|
-
searchInput.value ? (vue.openBlock(), vue.createElementBlock("div",
|
|
407
|
+
searchInput.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, [
|
|
325
408
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resource.keywordsSelection), (item) => {
|
|
326
409
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
327
410
|
key: item.value,
|
|
328
411
|
class: vue.normalizeClass(["list-filter-tag", { active: filter.value.sf === item.value }]),
|
|
329
412
|
onClick: ($event) => filter.value.sf = item.value
|
|
330
|
-
}, vue.toDisplayString(item.name), 11,
|
|
413
|
+
}, vue.toDisplayString(item.name), 11, _hoisted_14);
|
|
331
414
|
}), 128))
|
|
332
415
|
])) : vue.createCommentVNode("v-if", true)
|
|
333
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;
|