@cmstops/pro-compo 0.1.73 → 0.1.75
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/es/baseFilter/component.js +68 -130
- package/es/baseFilter/components/FilterGroup.d.ts +0 -0
- package/es/baseFilter/components/FilterGroup.js +179 -0
- package/es/baseFilter/components/filterItem.js +4 -2
- package/es/baseFilter/style/css.js +1 -0
- package/es/baseFilter/style/filterGroup.less +60 -0
- package/es/baseFilter/style/index.d.ts +1 -0
- package/es/baseFilter/style/index.js +1 -0
- package/es/baseFilter/useCalcWidth.d.ts +9 -0
- package/es/utils/typeMap.js +1 -10
- package/lib/baseFilter/component.js +66 -128
- package/lib/baseFilter/components/FilterGroup.js +180 -0
- package/lib/baseFilter/components/filterItem.js +3 -1
- package/lib/baseFilter/style/css.js +1 -0
- package/lib/baseFilter/style/filterGroup.less +60 -0
- package/lib/baseFilter/style/index.js +1 -0
- package/lib/utils/typeMap.js +0 -10
- package/package.json +1 -1
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, toRaw, openBlock, createElementBlock,
|
|
1
|
+
import { defineComponent, ref, computed, watch, toRaw, openBlock, createElementBlock, Fragment, createVNode, withCtx, renderList, createBlock, unref, normalizeStyle, createCommentVNode, withModifiers, renderSlot } from "vue";
|
|
2
2
|
import { InputSearch, Select, Option, RangePicker } from "@arco-design/web-vue";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import _sfc_main$1 from "./components/filterItem.js";
|
|
6
|
-
import { DEFAULT_BASE_API } from "../config.js";
|
|
7
|
-
const _hoisted_1 = { class: "base-filter-container" };
|
|
8
|
-
const _hoisted_2 = { class: "left" };
|
|
9
|
-
const _hoisted_3 = {
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "form-ul"
|
|
12
|
-
};
|
|
13
|
-
const _hoisted_4 = { class: "right" };
|
|
3
|
+
import _sfc_main$2 from "./components/filterItem.js";
|
|
4
|
+
import _sfc_main$1 from "./components/FilterGroup.js";
|
|
14
5
|
const _sfc_main = defineComponent({
|
|
15
6
|
...{ name: "baseFilter" },
|
|
16
7
|
__name: "component",
|
|
@@ -23,18 +14,30 @@ const _sfc_main = defineComponent({
|
|
|
23
14
|
setup(__props, { emit: __emit }) {
|
|
24
15
|
const props = __props;
|
|
25
16
|
const emit = __emit;
|
|
26
|
-
props.BASE_API || DEFAULT_BASE_API;
|
|
27
17
|
const render = ref(false);
|
|
28
18
|
const form = ref({});
|
|
29
19
|
const columnsKeys = computed(() => props.columns.map((column) => column.key));
|
|
30
20
|
const columnsMap = computed(() => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return
|
|
21
|
+
const map = props.columns.reduce((map2, column) => {
|
|
22
|
+
map2[column.key] = column;
|
|
23
|
+
return map2;
|
|
34
24
|
}, {});
|
|
25
|
+
return map;
|
|
35
26
|
});
|
|
36
|
-
const
|
|
37
|
-
|
|
27
|
+
const renderColumns = computed(() => {
|
|
28
|
+
let rangeKeys = props.columns.filter((column) => column.range).map((column) => column.range);
|
|
29
|
+
rangeKeys = [...new Set(rangeKeys)];
|
|
30
|
+
const _columns = props.columns.filter((column) => !column.range);
|
|
31
|
+
rangeKeys.forEach((key) => {
|
|
32
|
+
const rangeItem = props.columns.filter((column) => column.range === key);
|
|
33
|
+
rangeItem[0].key = key;
|
|
34
|
+
_columns.push(rangeItem[0]);
|
|
35
|
+
});
|
|
36
|
+
return _columns;
|
|
37
|
+
});
|
|
38
|
+
const getOptions = (item) => {
|
|
39
|
+
return item.options ? item.options : [];
|
|
40
|
+
};
|
|
38
41
|
const hasValue = computed(() => {
|
|
39
42
|
return (key) => {
|
|
40
43
|
var _a, _b;
|
|
@@ -106,10 +109,9 @@ const _sfc_main = defineComponent({
|
|
|
106
109
|
}
|
|
107
110
|
return _parmas;
|
|
108
111
|
};
|
|
109
|
-
const _mpTypeOptions = mpTypeOptions();
|
|
110
112
|
watch(
|
|
111
113
|
() => columnsKeys.value,
|
|
112
|
-
(
|
|
114
|
+
() => {
|
|
113
115
|
renderForm();
|
|
114
116
|
},
|
|
115
117
|
{ immediate: true }
|
|
@@ -121,110 +123,35 @@ const _sfc_main = defineComponent({
|
|
|
121
123
|
},
|
|
122
124
|
{ deep: true }
|
|
123
125
|
);
|
|
124
|
-
const seriesOptions = typeOptions();
|
|
125
126
|
return (_ctx, _cache) => {
|
|
126
|
-
return openBlock(), createElementBlock(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
modelValue: form.value.
|
|
138
|
-
"onUpdate:modelValue":
|
|
139
|
-
style: normalizeStyle({ width: styleWidth(columnsMap.value.
|
|
140
|
-
"allow-clear": "",
|
|
141
|
-
size: "medium",
|
|
142
|
-
placeholder: `\u8BF7\u8F93\u5165${(_a = columnsMap.value.word) == null ? void 0 : _a.label}`
|
|
143
|
-
}, null, 8, ["modelValue", "style", "placeholder"])
|
|
144
|
-
];
|
|
145
|
-
}),
|
|
146
|
-
_: 1
|
|
147
|
-
}, 8, ["active"])) : createCommentVNode("v-if", true),
|
|
148
|
-
hasKey("series") ? (openBlock(), createBlock(_sfc_main$1, {
|
|
149
|
-
key: 1,
|
|
150
|
-
active: hasValue.value("series")
|
|
151
|
-
}, {
|
|
152
|
-
default: withCtx(() => {
|
|
153
|
-
var _a;
|
|
154
|
-
return [
|
|
155
|
-
createVNode(unref(Select), {
|
|
156
|
-
modelValue: form.value.series,
|
|
157
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => form.value.series = $event),
|
|
158
|
-
"allow-clear": "",
|
|
159
|
-
style: normalizeStyle({ width: styleWidth(columnsMap.value.series) }),
|
|
160
|
-
placeholder: `\u8BF7\u9009\u62E9${(_a = columnsMap.value.series) == null ? void 0 : _a.label}`
|
|
161
|
-
}, {
|
|
162
|
-
default: withCtx(() => [
|
|
163
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(seriesOptions), (opt) => {
|
|
164
|
-
return openBlock(), createBlock(unref(Option), {
|
|
165
|
-
key: opt.value,
|
|
166
|
-
label: opt.label,
|
|
167
|
-
value: opt.value
|
|
168
|
-
}, null, 8, ["label", "value"]);
|
|
169
|
-
}), 128))
|
|
170
|
-
]),
|
|
171
|
-
_: 1
|
|
172
|
-
}, 8, ["modelValue", "style", "placeholder"])
|
|
173
|
-
];
|
|
174
|
-
}),
|
|
175
|
-
_: 1
|
|
176
|
-
}, 8, ["active"])) : createCommentVNode("v-if", true),
|
|
177
|
-
hasKey("pub_time") ? (openBlock(), createBlock(_sfc_main$1, {
|
|
178
|
-
key: 2,
|
|
179
|
-
active: hasValue.value("pub_time")
|
|
180
|
-
}, {
|
|
181
|
-
default: withCtx(() => [
|
|
182
|
-
createVNode(unref(RangePicker), {
|
|
183
|
-
modelValue: form.value.pub_time.range,
|
|
184
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => form.value.pub_time.range = $event),
|
|
185
|
-
style: normalizeStyle({ width: styleWidth(form.value.pub_time) }),
|
|
186
|
-
"value-format": "timestamp",
|
|
187
|
-
onClick: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
188
|
-
}, ["stop"]))
|
|
189
|
-
}, null, 8, ["modelValue", "style"])
|
|
190
|
-
]),
|
|
191
|
-
_: 1
|
|
192
|
-
}, 8, ["active"])) : createCommentVNode("v-if", true),
|
|
193
|
-
hasKey("mp_name") ? (openBlock(), createBlock(_sfc_main$1, {
|
|
194
|
-
key: 3,
|
|
195
|
-
active: hasValue.value("mp_name")
|
|
196
|
-
}, {
|
|
197
|
-
default: withCtx(() => {
|
|
198
|
-
var _a;
|
|
199
|
-
return [
|
|
200
|
-
createVNode(unref(InputSearch), {
|
|
201
|
-
modelValue: form.value.mp_name,
|
|
202
|
-
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => form.value.mp_name = $event),
|
|
203
|
-
style: normalizeStyle({ width: styleWidth(columnsMap.value.mp_name) }),
|
|
127
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
128
|
+
createVNode(_sfc_main$1, null, {
|
|
129
|
+
left: withCtx(() => [
|
|
130
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(renderColumns.value, (item, index) => {
|
|
131
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
132
|
+
key: index,
|
|
133
|
+
active: hasValue.value(item.key)
|
|
134
|
+
}, {
|
|
135
|
+
default: withCtx(() => [
|
|
136
|
+
item.component === "input" ? (openBlock(), createBlock(unref(InputSearch), {
|
|
137
|
+
key: 0,
|
|
138
|
+
modelValue: form.value[item.key],
|
|
139
|
+
"onUpdate:modelValue": ($event) => form.value[item.key] = $event,
|
|
140
|
+
style: normalizeStyle({ width: styleWidth(columnsMap.value[item.key]) }),
|
|
204
141
|
"allow-clear": "",
|
|
205
142
|
size: "medium",
|
|
206
|
-
placeholder: `\u8BF7\u8F93\u5165${
|
|
207
|
-
}, null, 8, ["modelValue", "style", "placeholder"])
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
hasKey("mp_type") ? (openBlock(), createBlock(_sfc_main$1, {
|
|
213
|
-
key: 4,
|
|
214
|
-
active: hasValue.value("mp_type")
|
|
215
|
-
}, {
|
|
216
|
-
default: withCtx(() => {
|
|
217
|
-
var _a;
|
|
218
|
-
return [
|
|
219
|
-
createVNode(unref(Select), {
|
|
220
|
-
modelValue: form.value.mp_type,
|
|
221
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => form.value.mp_type = $event),
|
|
222
|
-
style: normalizeStyle([{ width: styleWidth(columnsMap.value.mp_type) }, { "width": "150px" }]),
|
|
143
|
+
placeholder: `\u8BF7\u8F93\u5165${item.label}`
|
|
144
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "style", "placeholder"])) : createCommentVNode("v-if", true),
|
|
145
|
+
item.component === "select" ? (openBlock(), createBlock(unref(Select), {
|
|
146
|
+
key: 1,
|
|
147
|
+
modelValue: form.value[item.key],
|
|
148
|
+
"onUpdate:modelValue": ($event) => form.value[item.key] = $event,
|
|
223
149
|
"allow-clear": "",
|
|
224
|
-
|
|
150
|
+
style: normalizeStyle({ width: styleWidth(columnsMap.value[item.key]) }),
|
|
151
|
+
placeholder: `\u8BF7\u9009\u62E9${item.label}`
|
|
225
152
|
}, {
|
|
226
153
|
default: withCtx(() => [
|
|
227
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
154
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(getOptions(item), (opt) => {
|
|
228
155
|
return openBlock(), createBlock(unref(Option), {
|
|
229
156
|
key: opt.value,
|
|
230
157
|
label: opt.label,
|
|
@@ -232,18 +159,29 @@ const _sfc_main = defineComponent({
|
|
|
232
159
|
}, null, 8, ["label", "value"]);
|
|
233
160
|
}), 128))
|
|
234
161
|
]),
|
|
235
|
-
_:
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
162
|
+
_: 2
|
|
163
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "style", "placeholder"])) : createCommentVNode("v-if", true),
|
|
164
|
+
item.component === "range-picker" ? (openBlock(), createBlock(unref(RangePicker), {
|
|
165
|
+
key: 2,
|
|
166
|
+
modelValue: form.value[item.key].range,
|
|
167
|
+
"onUpdate:modelValue": ($event) => form.value[item.key].range = $event,
|
|
168
|
+
style: normalizeStyle({ width: styleWidth(form.value[item.key]) }),
|
|
169
|
+
"value-format": "timestamp",
|
|
170
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
171
|
+
}, ["stop"]))
|
|
172
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "style"])) : createCommentVNode("v-if", true)
|
|
173
|
+
]),
|
|
174
|
+
_: 2
|
|
175
|
+
}, 1032, ["active"]);
|
|
176
|
+
}), 128))
|
|
177
|
+
]),
|
|
178
|
+
right: withCtx(() => [
|
|
179
|
+
renderSlot(_ctx.$slots, "right")
|
|
180
|
+
]),
|
|
181
|
+
_: 3
|
|
182
|
+
}),
|
|
183
|
+
createCommentVNode(' <div class="base-filter-container">\n <div class="left">\n <div v-if="render" class="form-ul">\n <template v-for="(item, index) in renderColumns" :key="index">\n <filter-item :active="hasValue(item.key)">\n <a-input-search\n v-if="item.component === \'input\'"\n v-model="form[item.key]"\n :style="{ width: styleWidth(columnsMap[item.key]) }"\n allow-clear\n size="medium"\n :placeholder="`\u8BF7\u8F93\u5165${item.label}`"\n />\n <a-select\n v-if="item.component === \'select\'"\n v-model="form[item.key]"\n allow-clear\n :style="{ width: styleWidth(columnsMap[item.key]) }"\n :placeholder="`\u8BF7\u9009\u62E9${item.label}`"\n >\n <template v-for="opt in getOptions(item)" :key="opt.value">\n <a-option :label="opt.label" :value="opt.value"></a-option\n ></template>\n </a-select>\n <a-range-picker\n v-if="item.component === \'range-picker\'"\n v-model="form[item.key].range"\n :style="{ width: styleWidth(form[item.key]) }"\n value-format="timestamp"\n @click.stop\n />\n </filter-item>\n </template>\n </div>\n </div>\n <div class="right">\n <slot name="right"></slot>\n </div>\n </div> ')
|
|
184
|
+
], 2112);
|
|
247
185
|
};
|
|
248
186
|
}
|
|
249
187
|
});
|
|
File without changes
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, openBlock, createElementBlock, createElementVNode, withDirectives, createVNode, unref, withModifiers, withCtx, createTextVNode, vShow, renderSlot } from "vue";
|
|
2
|
+
import { Button } from "@arco-design/web-vue";
|
|
3
|
+
import { IconCaretDown } from "@arco-design/web-vue/es/icon";
|
|
4
|
+
import { createPopper } from "@popperjs/core";
|
|
5
|
+
const _hoisted_1 = { class: "filter-view-container" };
|
|
6
|
+
const _hoisted_2 = { class: "more-btn" };
|
|
7
|
+
const _hoisted_3 = { class: "right-prefix" };
|
|
8
|
+
const _hoisted_4 = { class: "filter-content" };
|
|
9
|
+
const _hoisted_5 = { class: "right" };
|
|
10
|
+
const _hoisted_6 = {
|
|
11
|
+
ref: "tempNode",
|
|
12
|
+
style: { "display": "none" }
|
|
13
|
+
};
|
|
14
|
+
const _sfc_main = defineComponent({
|
|
15
|
+
__name: "FilterGroup",
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const documentWidth = ref(0);
|
|
18
|
+
const overflowWidth = ref(0);
|
|
19
|
+
watch(
|
|
20
|
+
() => documentWidth.value,
|
|
21
|
+
(n) => checkOverflow()
|
|
22
|
+
);
|
|
23
|
+
watch(
|
|
24
|
+
() => overflowWidth.value,
|
|
25
|
+
(n) => setPannelItem()
|
|
26
|
+
);
|
|
27
|
+
const initDocWidthListener = function() {
|
|
28
|
+
window.onresize = (() => {
|
|
29
|
+
return () => {
|
|
30
|
+
documentWidth.value = document.body.clientWidth;
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
};
|
|
34
|
+
const filterItemsRef = ref();
|
|
35
|
+
const moreBtnRef = ref();
|
|
36
|
+
const dpPannelRef = ref();
|
|
37
|
+
const initPopper = function() {
|
|
38
|
+
createPopper(moreBtnRef.value, dpPannelRef.value, {
|
|
39
|
+
placement: "bottom-start"
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const popperShowFlag = ref(false);
|
|
43
|
+
function showPopper() {
|
|
44
|
+
popperShowFlag.value = true;
|
|
45
|
+
window.onclick = hidePopper;
|
|
46
|
+
}
|
|
47
|
+
function hidePopper() {
|
|
48
|
+
popperShowFlag.value = false;
|
|
49
|
+
}
|
|
50
|
+
const itemNodeArr = ref([]);
|
|
51
|
+
const itemWidthArr = ref([]);
|
|
52
|
+
const itemArr = ref([]);
|
|
53
|
+
function checkOverflow() {
|
|
54
|
+
if (!filterItemsRef.value)
|
|
55
|
+
return;
|
|
56
|
+
const parent = filterItemsRef.value.parentNode;
|
|
57
|
+
if (!itemNodeArr.value.length) {
|
|
58
|
+
itemNodeArr.value = mapNodes(filterItemsRef.value.childNodes);
|
|
59
|
+
itemWidthArr.value = itemNodeArr.value.map((node) => node.clientWidth + 10);
|
|
60
|
+
itemArr.value = itemWidthArr.value.map((_, idx) => idx);
|
|
61
|
+
}
|
|
62
|
+
const parentWidth = parent.clientWidth;
|
|
63
|
+
const leftWidth = getArrWidth(itemWidthArr.value);
|
|
64
|
+
const rightWidth = parent.childNodes[parent.childNodes.length - 1].clientWidth;
|
|
65
|
+
overflowWidth.value = leftWidth + rightWidth - parentWidth;
|
|
66
|
+
}
|
|
67
|
+
function mapNodes(nodes) {
|
|
68
|
+
const nodeArr = [];
|
|
69
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
70
|
+
const element = nodes[i];
|
|
71
|
+
nodeArr.push(element);
|
|
72
|
+
}
|
|
73
|
+
return nodeArr.filter((item) => item.clientWidth);
|
|
74
|
+
}
|
|
75
|
+
function getArrWidth(arr) {
|
|
76
|
+
return arr.reduce((prev, cur) => prev + cur, 0);
|
|
77
|
+
}
|
|
78
|
+
const pannelArray = ref("");
|
|
79
|
+
watch(
|
|
80
|
+
() => pannelArray.value,
|
|
81
|
+
(n, o) => refreshPannel(n, o)
|
|
82
|
+
);
|
|
83
|
+
function refreshPannel(newStr, oldStr) {
|
|
84
|
+
const nArr = newStr ? newStr.split(",") : [];
|
|
85
|
+
const oArr = oldStr ? oldStr.split(",") : [];
|
|
86
|
+
if (nArr.length && nArr.length > oArr.length) {
|
|
87
|
+
diff(nArr, oArr).forEach((index) => inNode(parseInt(index, 10)));
|
|
88
|
+
} else if (nArr.length >= 0 && nArr.length < oArr.length) {
|
|
89
|
+
diff(oArr, nArr).forEach((index) => outNode(parseInt(index, 10)));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const diff = (arr1, arr2) => {
|
|
93
|
+
const diff2 = [];
|
|
94
|
+
for (let i = 0; i < arr1.length; i++) {
|
|
95
|
+
const item = arr1[i];
|
|
96
|
+
if (!arr2.includes(item))
|
|
97
|
+
diff2.push(item);
|
|
98
|
+
}
|
|
99
|
+
return diff2;
|
|
100
|
+
};
|
|
101
|
+
function inNode(index) {
|
|
102
|
+
var _a, _b, _c;
|
|
103
|
+
const node = mapNodes((_a = filterItemsRef.value) == null ? void 0 : _a.childNodes)[index];
|
|
104
|
+
const temp = document.createElement("div");
|
|
105
|
+
temp.style.width = `${itemWidthArr.value[index]}px`;
|
|
106
|
+
temp.style.position = "absolute";
|
|
107
|
+
temp.style.left = `${50}px`;
|
|
108
|
+
(_b = filterItemsRef.value) == null ? void 0 : _b.replaceChild(temp, node);
|
|
109
|
+
(_c = dpPannelRef.value) == null ? void 0 : _c.appendChild(node);
|
|
110
|
+
}
|
|
111
|
+
function outNode(index) {
|
|
112
|
+
var _a;
|
|
113
|
+
const node = itemNodeArr.value[index];
|
|
114
|
+
(_a = filterItemsRef.value) == null ? void 0 : _a.replaceChild(
|
|
115
|
+
node,
|
|
116
|
+
mapNodes(filterItemsRef.value.childNodes)[index]
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function setPannelItem() {
|
|
120
|
+
let inPannelNum = 0;
|
|
121
|
+
if (overflowWidth.value > 0) {
|
|
122
|
+
const avgWidth = 120;
|
|
123
|
+
inPannelNum = Math.ceil((overflowWidth.value + 200) / avgWidth);
|
|
124
|
+
}
|
|
125
|
+
pannelArray.value = itemArr.value.slice(0, inPannelNum).join(",");
|
|
126
|
+
}
|
|
127
|
+
onMounted(() => {
|
|
128
|
+
initDocWidthListener();
|
|
129
|
+
initPopper();
|
|
130
|
+
setTimeout(() => checkOverflow());
|
|
131
|
+
});
|
|
132
|
+
return (_ctx, _cache) => {
|
|
133
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
134
|
+
createElementVNode("div", _hoisted_2, [
|
|
135
|
+
createElementVNode("div", {
|
|
136
|
+
ref_key: "moreBtnRef",
|
|
137
|
+
ref: moreBtnRef
|
|
138
|
+
}, [
|
|
139
|
+
withDirectives(createVNode(unref(Button), {
|
|
140
|
+
onClick: withModifiers(showPopper, ["stop"])
|
|
141
|
+
}, {
|
|
142
|
+
default: withCtx(() => [
|
|
143
|
+
createElementVNode("span", _hoisted_3, [
|
|
144
|
+
createTextVNode(" \u66F4\u591A\u7B5B\u9009 "),
|
|
145
|
+
createVNode(unref(IconCaretDown))
|
|
146
|
+
])
|
|
147
|
+
]),
|
|
148
|
+
_: 1
|
|
149
|
+
}, 512), [
|
|
150
|
+
[vShow, pannelArray.value]
|
|
151
|
+
])
|
|
152
|
+
], 512),
|
|
153
|
+
withDirectives(createElementVNode("div", {
|
|
154
|
+
id: "dpPannelRef",
|
|
155
|
+
ref_key: "dpPannelRef",
|
|
156
|
+
ref: dpPannelRef,
|
|
157
|
+
class: "filter-pannel"
|
|
158
|
+
}, null, 512), [
|
|
159
|
+
[vShow, popperShowFlag.value]
|
|
160
|
+
])
|
|
161
|
+
]),
|
|
162
|
+
createElementVNode("div", _hoisted_4, [
|
|
163
|
+
createElementVNode("div", {
|
|
164
|
+
ref_key: "filterItemsRef",
|
|
165
|
+
ref: filterItemsRef,
|
|
166
|
+
class: "left"
|
|
167
|
+
}, [
|
|
168
|
+
renderSlot(_ctx.$slots, "left")
|
|
169
|
+
], 512),
|
|
170
|
+
createElementVNode("div", _hoisted_5, [
|
|
171
|
+
renderSlot(_ctx.$slots, "right")
|
|
172
|
+
])
|
|
173
|
+
]),
|
|
174
|
+
createElementVNode("div", _hoisted_6, null, 512)
|
|
175
|
+
]);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
export { _sfc_main as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, withModifiers, renderSlot } from "vue";
|
|
2
2
|
const _sfc_main = defineComponent({
|
|
3
3
|
...{ name: "filter-item-view" },
|
|
4
4
|
__name: "filterItem",
|
|
@@ -8,7 +8,9 @@ const _sfc_main = defineComponent({
|
|
|
8
8
|
setup(__props) {
|
|
9
9
|
return (_ctx, _cache) => {
|
|
10
10
|
return openBlock(), createElementBlock("div", {
|
|
11
|
-
class: normalizeClass(["filter-item-view", { value: _ctx.active }])
|
|
11
|
+
class: normalizeClass(["filter-item-view", { value: _ctx.active }]),
|
|
12
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
13
|
+
}, ["stop"]))
|
|
12
14
|
}, [
|
|
13
15
|
renderSlot(_ctx.$slots, "default")
|
|
14
16
|
], 2);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// FilterGroup 内部样式
|
|
2
|
+
.filter-view-container {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
margin-bottom: 10px;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.filter-search {
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: 10px;
|
|
12
|
+
width: 180px;
|
|
13
|
+
margin-right: 10px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.filter-content {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex: 1;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.left {
|
|
25
|
+
display: flex;
|
|
26
|
+
gap: 10px;
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.right {
|
|
31
|
+
position: absolute;
|
|
32
|
+
right: 0;
|
|
33
|
+
z-index: 1;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-wrap: nowrap;
|
|
36
|
+
align-items: center;
|
|
37
|
+
height: 100%;
|
|
38
|
+
padding-left: 20px;
|
|
39
|
+
background: white;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.more-btn {
|
|
43
|
+
z-index: 10;
|
|
44
|
+
margin-right: 10px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.right-prefix {
|
|
48
|
+
display: flex;
|
|
49
|
+
gap: 10px;
|
|
50
|
+
align-items: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.filter-pannel {
|
|
54
|
+
display: flex;
|
|
55
|
+
gap: 10px;
|
|
56
|
+
padding: 10px;
|
|
57
|
+
background-color: white;
|
|
58
|
+
border-radius: 6px;
|
|
59
|
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
|
60
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export default function useCalcWidth(filterItemsRef: Ref<HTMLElement | undefined>, dpPannelRef: Ref<HTMLElement | undefined>, moreBtnRef: Ref<HTMLElement | undefined>): {
|
|
3
|
+
pannelArray: Ref<string>;
|
|
4
|
+
popperShowFlag: Ref<boolean>;
|
|
5
|
+
showPopper: () => void;
|
|
6
|
+
initDocWidthListener: () => void;
|
|
7
|
+
initPopper: () => void;
|
|
8
|
+
checkOverflow: () => void;
|
|
9
|
+
};
|
package/es/utils/typeMap.js
CHANGED
|
@@ -83,15 +83,6 @@ const mp_type_map = {
|
|
|
83
83
|
1: "\u4E2A\u4EBA\u53F7",
|
|
84
84
|
2: "\u7EC4\u7EC7\u53F7"
|
|
85
85
|
};
|
|
86
|
-
const mpTypeOptions = () => {
|
|
87
|
-
const arr = Object.keys(mp_type_map).map((key) => {
|
|
88
|
-
return {
|
|
89
|
-
value: key,
|
|
90
|
-
label: mp_type_map[key]
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
return arr;
|
|
94
|
-
};
|
|
95
86
|
const kongo_source_map = {
|
|
96
87
|
app: "\u5E94\u7528",
|
|
97
88
|
url: "\u94FE\u63A5",
|
|
@@ -161,4 +152,4 @@ const matrixPublishFormalStateMap = {
|
|
|
161
152
|
12: "\u672A\u77E5",
|
|
162
153
|
13: "\u79C1\u5BC6"
|
|
163
154
|
};
|
|
164
|
-
export { approveFlowStatusMap, calcApprovingDependent, calcApprovingUser, compoColumnsMap, componentsColumns, contentList_layout_map, contentList_list_type_map, contentList_relation_type_map, ilive_type_map, key_target_type_map, kongo_source_map, local_live_doc_status, local_live_doc_type, matrixPublishFormalStateMap, matrixPublishStateMap,
|
|
155
|
+
export { approveFlowStatusMap, calcApprovingDependent, calcApprovingUser, compoColumnsMap, componentsColumns, contentList_layout_map, contentList_list_type_map, contentList_relation_type_map, ilive_type_map, key_target_type_map, kongo_source_map, local_live_doc_status, local_live_doc_type, matrixPublishFormalStateMap, matrixPublishStateMap, mp_type_map };
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var vue = require("vue");
|
|
3
3
|
var webVue = require("@arco-design/web-vue");
|
|
4
|
-
var doc = require("../utils/doc.js");
|
|
5
|
-
var typeMap = require("../utils/typeMap.js");
|
|
6
4
|
var filterItem = require("./components/filterItem.js");
|
|
7
|
-
var
|
|
8
|
-
const _hoisted_1 = { class: "base-filter-container" };
|
|
9
|
-
const _hoisted_2 = { class: "left" };
|
|
10
|
-
const _hoisted_3 = {
|
|
11
|
-
key: 0,
|
|
12
|
-
class: "form-ul"
|
|
13
|
-
};
|
|
14
|
-
const _hoisted_4 = { class: "right" };
|
|
5
|
+
var FilterGroup = require("./components/FilterGroup.js");
|
|
15
6
|
const _sfc_main = vue.defineComponent({
|
|
16
7
|
...{ name: "baseFilter" },
|
|
17
8
|
__name: "component",
|
|
@@ -24,18 +15,30 @@ const _sfc_main = vue.defineComponent({
|
|
|
24
15
|
setup(__props, { emit: __emit }) {
|
|
25
16
|
const props = __props;
|
|
26
17
|
const emit = __emit;
|
|
27
|
-
props.BASE_API || config.DEFAULT_BASE_API;
|
|
28
18
|
const render = vue.ref(false);
|
|
29
19
|
const form = vue.ref({});
|
|
30
20
|
const columnsKeys = vue.computed(() => props.columns.map((column) => column.key));
|
|
31
21
|
const columnsMap = vue.computed(() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
22
|
+
const map = props.columns.reduce((map2, column) => {
|
|
23
|
+
map2[column.key] = column;
|
|
24
|
+
return map2;
|
|
35
25
|
}, {});
|
|
26
|
+
return map;
|
|
36
27
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
28
|
+
const renderColumns = vue.computed(() => {
|
|
29
|
+
let rangeKeys = props.columns.filter((column) => column.range).map((column) => column.range);
|
|
30
|
+
rangeKeys = [...new Set(rangeKeys)];
|
|
31
|
+
const _columns = props.columns.filter((column) => !column.range);
|
|
32
|
+
rangeKeys.forEach((key) => {
|
|
33
|
+
const rangeItem = props.columns.filter((column) => column.range === key);
|
|
34
|
+
rangeItem[0].key = key;
|
|
35
|
+
_columns.push(rangeItem[0]);
|
|
36
|
+
});
|
|
37
|
+
return _columns;
|
|
38
|
+
});
|
|
39
|
+
const getOptions = (item) => {
|
|
40
|
+
return item.options ? item.options : [];
|
|
41
|
+
};
|
|
39
42
|
const hasValue = vue.computed(() => {
|
|
40
43
|
return (key) => {
|
|
41
44
|
var _a, _b;
|
|
@@ -107,10 +110,9 @@ const _sfc_main = vue.defineComponent({
|
|
|
107
110
|
}
|
|
108
111
|
return _parmas;
|
|
109
112
|
};
|
|
110
|
-
const _mpTypeOptions = typeMap.mpTypeOptions();
|
|
111
113
|
vue.watch(
|
|
112
114
|
() => columnsKeys.value,
|
|
113
|
-
(
|
|
115
|
+
() => {
|
|
114
116
|
renderForm();
|
|
115
117
|
},
|
|
116
118
|
{ immediate: true }
|
|
@@ -122,110 +124,35 @@ const _sfc_main = vue.defineComponent({
|
|
|
122
124
|
},
|
|
123
125
|
{ deep: true }
|
|
124
126
|
);
|
|
125
|
-
const seriesOptions = doc.typeOptions();
|
|
126
127
|
return (_ctx, _cache) => {
|
|
127
|
-
return vue.openBlock(), vue.createElementBlock(
|
|
128
|
-
vue.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
modelValue: form.value.
|
|
139
|
-
"onUpdate:modelValue":
|
|
140
|
-
style: vue.normalizeStyle({ width: styleWidth(columnsMap.value.
|
|
141
|
-
"allow-clear": "",
|
|
142
|
-
size: "medium",
|
|
143
|
-
placeholder: `\u8BF7\u8F93\u5165${(_a = columnsMap.value.word) == null ? void 0 : _a.label}`
|
|
144
|
-
}, null, 8, ["modelValue", "style", "placeholder"])
|
|
145
|
-
];
|
|
146
|
-
}),
|
|
147
|
-
_: 1
|
|
148
|
-
}, 8, ["active"])) : vue.createCommentVNode("v-if", true),
|
|
149
|
-
hasKey("series") ? (vue.openBlock(), vue.createBlock(filterItem, {
|
|
150
|
-
key: 1,
|
|
151
|
-
active: hasValue.value("series")
|
|
152
|
-
}, {
|
|
153
|
-
default: vue.withCtx(() => {
|
|
154
|
-
var _a;
|
|
155
|
-
return [
|
|
156
|
-
vue.createVNode(vue.unref(webVue.Select), {
|
|
157
|
-
modelValue: form.value.series,
|
|
158
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => form.value.series = $event),
|
|
159
|
-
"allow-clear": "",
|
|
160
|
-
style: vue.normalizeStyle({ width: styleWidth(columnsMap.value.series) }),
|
|
161
|
-
placeholder: `\u8BF7\u9009\u62E9${(_a = columnsMap.value.series) == null ? void 0 : _a.label}`
|
|
162
|
-
}, {
|
|
163
|
-
default: vue.withCtx(() => [
|
|
164
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(seriesOptions), (opt) => {
|
|
165
|
-
return vue.openBlock(), vue.createBlock(vue.unref(webVue.Option), {
|
|
166
|
-
key: opt.value,
|
|
167
|
-
label: opt.label,
|
|
168
|
-
value: opt.value
|
|
169
|
-
}, null, 8, ["label", "value"]);
|
|
170
|
-
}), 128))
|
|
171
|
-
]),
|
|
172
|
-
_: 1
|
|
173
|
-
}, 8, ["modelValue", "style", "placeholder"])
|
|
174
|
-
];
|
|
175
|
-
}),
|
|
176
|
-
_: 1
|
|
177
|
-
}, 8, ["active"])) : vue.createCommentVNode("v-if", true),
|
|
178
|
-
hasKey("pub_time") ? (vue.openBlock(), vue.createBlock(filterItem, {
|
|
179
|
-
key: 2,
|
|
180
|
-
active: hasValue.value("pub_time")
|
|
181
|
-
}, {
|
|
182
|
-
default: vue.withCtx(() => [
|
|
183
|
-
vue.createVNode(vue.unref(webVue.RangePicker), {
|
|
184
|
-
modelValue: form.value.pub_time.range,
|
|
185
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => form.value.pub_time.range = $event),
|
|
186
|
-
style: vue.normalizeStyle({ width: styleWidth(form.value.pub_time) }),
|
|
187
|
-
"value-format": "timestamp",
|
|
188
|
-
onClick: _cache[3] || (_cache[3] = vue.withModifiers(() => {
|
|
189
|
-
}, ["stop"]))
|
|
190
|
-
}, null, 8, ["modelValue", "style"])
|
|
191
|
-
]),
|
|
192
|
-
_: 1
|
|
193
|
-
}, 8, ["active"])) : vue.createCommentVNode("v-if", true),
|
|
194
|
-
hasKey("mp_name") ? (vue.openBlock(), vue.createBlock(filterItem, {
|
|
195
|
-
key: 3,
|
|
196
|
-
active: hasValue.value("mp_name")
|
|
197
|
-
}, {
|
|
198
|
-
default: vue.withCtx(() => {
|
|
199
|
-
var _a;
|
|
200
|
-
return [
|
|
201
|
-
vue.createVNode(vue.unref(webVue.InputSearch), {
|
|
202
|
-
modelValue: form.value.mp_name,
|
|
203
|
-
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => form.value.mp_name = $event),
|
|
204
|
-
style: vue.normalizeStyle({ width: styleWidth(columnsMap.value.mp_name) }),
|
|
128
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
129
|
+
vue.createVNode(FilterGroup, null, {
|
|
130
|
+
left: vue.withCtx(() => [
|
|
131
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(renderColumns.value, (item, index) => {
|
|
132
|
+
return vue.openBlock(), vue.createBlock(filterItem, {
|
|
133
|
+
key: index,
|
|
134
|
+
active: hasValue.value(item.key)
|
|
135
|
+
}, {
|
|
136
|
+
default: vue.withCtx(() => [
|
|
137
|
+
item.component === "input" ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.InputSearch), {
|
|
138
|
+
key: 0,
|
|
139
|
+
modelValue: form.value[item.key],
|
|
140
|
+
"onUpdate:modelValue": ($event) => form.value[item.key] = $event,
|
|
141
|
+
style: vue.normalizeStyle({ width: styleWidth(columnsMap.value[item.key]) }),
|
|
205
142
|
"allow-clear": "",
|
|
206
143
|
size: "medium",
|
|
207
|
-
placeholder: `\u8BF7\u8F93\u5165${
|
|
208
|
-
}, null, 8, ["modelValue", "style", "placeholder"])
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
hasKey("mp_type") ? (vue.openBlock(), vue.createBlock(filterItem, {
|
|
214
|
-
key: 4,
|
|
215
|
-
active: hasValue.value("mp_type")
|
|
216
|
-
}, {
|
|
217
|
-
default: vue.withCtx(() => {
|
|
218
|
-
var _a;
|
|
219
|
-
return [
|
|
220
|
-
vue.createVNode(vue.unref(webVue.Select), {
|
|
221
|
-
modelValue: form.value.mp_type,
|
|
222
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => form.value.mp_type = $event),
|
|
223
|
-
style: vue.normalizeStyle([{ width: styleWidth(columnsMap.value.mp_type) }, { "width": "150px" }]),
|
|
144
|
+
placeholder: `\u8BF7\u8F93\u5165${item.label}`
|
|
145
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "style", "placeholder"])) : vue.createCommentVNode("v-if", true),
|
|
146
|
+
item.component === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Select), {
|
|
147
|
+
key: 1,
|
|
148
|
+
modelValue: form.value[item.key],
|
|
149
|
+
"onUpdate:modelValue": ($event) => form.value[item.key] = $event,
|
|
224
150
|
"allow-clear": "",
|
|
225
|
-
|
|
151
|
+
style: vue.normalizeStyle({ width: styleWidth(columnsMap.value[item.key]) }),
|
|
152
|
+
placeholder: `\u8BF7\u9009\u62E9${item.label}`
|
|
226
153
|
}, {
|
|
227
154
|
default: vue.withCtx(() => [
|
|
228
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
155
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getOptions(item), (opt) => {
|
|
229
156
|
return vue.openBlock(), vue.createBlock(vue.unref(webVue.Option), {
|
|
230
157
|
key: opt.value,
|
|
231
158
|
label: opt.label,
|
|
@@ -233,18 +160,29 @@ const _sfc_main = vue.defineComponent({
|
|
|
233
160
|
}, null, 8, ["label", "value"]);
|
|
234
161
|
}), 128))
|
|
235
162
|
]),
|
|
236
|
-
_:
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
163
|
+
_: 2
|
|
164
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "style", "placeholder"])) : vue.createCommentVNode("v-if", true),
|
|
165
|
+
item.component === "range-picker" ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.RangePicker), {
|
|
166
|
+
key: 2,
|
|
167
|
+
modelValue: form.value[item.key].range,
|
|
168
|
+
"onUpdate:modelValue": ($event) => form.value[item.key].range = $event,
|
|
169
|
+
style: vue.normalizeStyle({ width: styleWidth(form.value[item.key]) }),
|
|
170
|
+
"value-format": "timestamp",
|
|
171
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
|
|
172
|
+
}, ["stop"]))
|
|
173
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "style"])) : vue.createCommentVNode("v-if", true)
|
|
174
|
+
]),
|
|
175
|
+
_: 2
|
|
176
|
+
}, 1032, ["active"]);
|
|
177
|
+
}), 128))
|
|
178
|
+
]),
|
|
179
|
+
right: vue.withCtx(() => [
|
|
180
|
+
vue.renderSlot(_ctx.$slots, "right")
|
|
181
|
+
]),
|
|
182
|
+
_: 3
|
|
183
|
+
}),
|
|
184
|
+
vue.createCommentVNode(' <div class="base-filter-container">\n <div class="left">\n <div v-if="render" class="form-ul">\n <template v-for="(item, index) in renderColumns" :key="index">\n <filter-item :active="hasValue(item.key)">\n <a-input-search\n v-if="item.component === \'input\'"\n v-model="form[item.key]"\n :style="{ width: styleWidth(columnsMap[item.key]) }"\n allow-clear\n size="medium"\n :placeholder="`\u8BF7\u8F93\u5165${item.label}`"\n />\n <a-select\n v-if="item.component === \'select\'"\n v-model="form[item.key]"\n allow-clear\n :style="{ width: styleWidth(columnsMap[item.key]) }"\n :placeholder="`\u8BF7\u9009\u62E9${item.label}`"\n >\n <template v-for="opt in getOptions(item)" :key="opt.value">\n <a-option :label="opt.label" :value="opt.value"></a-option\n ></template>\n </a-select>\n <a-range-picker\n v-if="item.component === \'range-picker\'"\n v-model="form[item.key].range"\n :style="{ width: styleWidth(form[item.key]) }"\n value-format="timestamp"\n @click.stop\n />\n </filter-item>\n </template>\n </div>\n </div>\n <div class="right">\n <slot name="right"></slot>\n </div>\n </div> ')
|
|
185
|
+
], 2112);
|
|
248
186
|
};
|
|
249
187
|
}
|
|
250
188
|
});
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var vue = require("vue");
|
|
3
|
+
var webVue = require("@arco-design/web-vue");
|
|
4
|
+
var icon = require("@arco-design/web-vue/es/icon");
|
|
5
|
+
var core = require("@popperjs/core");
|
|
6
|
+
const _hoisted_1 = { class: "filter-view-container" };
|
|
7
|
+
const _hoisted_2 = { class: "more-btn" };
|
|
8
|
+
const _hoisted_3 = { class: "right-prefix" };
|
|
9
|
+
const _hoisted_4 = { class: "filter-content" };
|
|
10
|
+
const _hoisted_5 = { class: "right" };
|
|
11
|
+
const _hoisted_6 = {
|
|
12
|
+
ref: "tempNode",
|
|
13
|
+
style: { "display": "none" }
|
|
14
|
+
};
|
|
15
|
+
const _sfc_main = vue.defineComponent({
|
|
16
|
+
__name: "FilterGroup",
|
|
17
|
+
setup(__props) {
|
|
18
|
+
const documentWidth = vue.ref(0);
|
|
19
|
+
const overflowWidth = vue.ref(0);
|
|
20
|
+
vue.watch(
|
|
21
|
+
() => documentWidth.value,
|
|
22
|
+
(n) => checkOverflow()
|
|
23
|
+
);
|
|
24
|
+
vue.watch(
|
|
25
|
+
() => overflowWidth.value,
|
|
26
|
+
(n) => setPannelItem()
|
|
27
|
+
);
|
|
28
|
+
const initDocWidthListener = function() {
|
|
29
|
+
window.onresize = (() => {
|
|
30
|
+
return () => {
|
|
31
|
+
documentWidth.value = document.body.clientWidth;
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
};
|
|
35
|
+
const filterItemsRef = vue.ref();
|
|
36
|
+
const moreBtnRef = vue.ref();
|
|
37
|
+
const dpPannelRef = vue.ref();
|
|
38
|
+
const initPopper = function() {
|
|
39
|
+
core.createPopper(moreBtnRef.value, dpPannelRef.value, {
|
|
40
|
+
placement: "bottom-start"
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const popperShowFlag = vue.ref(false);
|
|
44
|
+
function showPopper() {
|
|
45
|
+
popperShowFlag.value = true;
|
|
46
|
+
window.onclick = hidePopper;
|
|
47
|
+
}
|
|
48
|
+
function hidePopper() {
|
|
49
|
+
popperShowFlag.value = false;
|
|
50
|
+
}
|
|
51
|
+
const itemNodeArr = vue.ref([]);
|
|
52
|
+
const itemWidthArr = vue.ref([]);
|
|
53
|
+
const itemArr = vue.ref([]);
|
|
54
|
+
function checkOverflow() {
|
|
55
|
+
if (!filterItemsRef.value)
|
|
56
|
+
return;
|
|
57
|
+
const parent = filterItemsRef.value.parentNode;
|
|
58
|
+
if (!itemNodeArr.value.length) {
|
|
59
|
+
itemNodeArr.value = mapNodes(filterItemsRef.value.childNodes);
|
|
60
|
+
itemWidthArr.value = itemNodeArr.value.map((node) => node.clientWidth + 10);
|
|
61
|
+
itemArr.value = itemWidthArr.value.map((_, idx) => idx);
|
|
62
|
+
}
|
|
63
|
+
const parentWidth = parent.clientWidth;
|
|
64
|
+
const leftWidth = getArrWidth(itemWidthArr.value);
|
|
65
|
+
const rightWidth = parent.childNodes[parent.childNodes.length - 1].clientWidth;
|
|
66
|
+
overflowWidth.value = leftWidth + rightWidth - parentWidth;
|
|
67
|
+
}
|
|
68
|
+
function mapNodes(nodes) {
|
|
69
|
+
const nodeArr = [];
|
|
70
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
71
|
+
const element = nodes[i];
|
|
72
|
+
nodeArr.push(element);
|
|
73
|
+
}
|
|
74
|
+
return nodeArr.filter((item) => item.clientWidth);
|
|
75
|
+
}
|
|
76
|
+
function getArrWidth(arr) {
|
|
77
|
+
return arr.reduce((prev, cur) => prev + cur, 0);
|
|
78
|
+
}
|
|
79
|
+
const pannelArray = vue.ref("");
|
|
80
|
+
vue.watch(
|
|
81
|
+
() => pannelArray.value,
|
|
82
|
+
(n, o) => refreshPannel(n, o)
|
|
83
|
+
);
|
|
84
|
+
function refreshPannel(newStr, oldStr) {
|
|
85
|
+
const nArr = newStr ? newStr.split(",") : [];
|
|
86
|
+
const oArr = oldStr ? oldStr.split(",") : [];
|
|
87
|
+
if (nArr.length && nArr.length > oArr.length) {
|
|
88
|
+
diff(nArr, oArr).forEach((index) => inNode(parseInt(index, 10)));
|
|
89
|
+
} else if (nArr.length >= 0 && nArr.length < oArr.length) {
|
|
90
|
+
diff(oArr, nArr).forEach((index) => outNode(parseInt(index, 10)));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const diff = (arr1, arr2) => {
|
|
94
|
+
const diff2 = [];
|
|
95
|
+
for (let i = 0; i < arr1.length; i++) {
|
|
96
|
+
const item = arr1[i];
|
|
97
|
+
if (!arr2.includes(item))
|
|
98
|
+
diff2.push(item);
|
|
99
|
+
}
|
|
100
|
+
return diff2;
|
|
101
|
+
};
|
|
102
|
+
function inNode(index) {
|
|
103
|
+
var _a, _b, _c;
|
|
104
|
+
const node = mapNodes((_a = filterItemsRef.value) == null ? void 0 : _a.childNodes)[index];
|
|
105
|
+
const temp = document.createElement("div");
|
|
106
|
+
temp.style.width = `${itemWidthArr.value[index]}px`;
|
|
107
|
+
temp.style.position = "absolute";
|
|
108
|
+
temp.style.left = `${50}px`;
|
|
109
|
+
(_b = filterItemsRef.value) == null ? void 0 : _b.replaceChild(temp, node);
|
|
110
|
+
(_c = dpPannelRef.value) == null ? void 0 : _c.appendChild(node);
|
|
111
|
+
}
|
|
112
|
+
function outNode(index) {
|
|
113
|
+
var _a;
|
|
114
|
+
const node = itemNodeArr.value[index];
|
|
115
|
+
(_a = filterItemsRef.value) == null ? void 0 : _a.replaceChild(
|
|
116
|
+
node,
|
|
117
|
+
mapNodes(filterItemsRef.value.childNodes)[index]
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function setPannelItem() {
|
|
121
|
+
let inPannelNum = 0;
|
|
122
|
+
if (overflowWidth.value > 0) {
|
|
123
|
+
const avgWidth = 120;
|
|
124
|
+
inPannelNum = Math.ceil((overflowWidth.value + 200) / avgWidth);
|
|
125
|
+
}
|
|
126
|
+
pannelArray.value = itemArr.value.slice(0, inPannelNum).join(",");
|
|
127
|
+
}
|
|
128
|
+
vue.onMounted(() => {
|
|
129
|
+
initDocWidthListener();
|
|
130
|
+
initPopper();
|
|
131
|
+
setTimeout(() => checkOverflow());
|
|
132
|
+
});
|
|
133
|
+
return (_ctx, _cache) => {
|
|
134
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
135
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
136
|
+
vue.createElementVNode("div", {
|
|
137
|
+
ref_key: "moreBtnRef",
|
|
138
|
+
ref: moreBtnRef
|
|
139
|
+
}, [
|
|
140
|
+
vue.withDirectives(vue.createVNode(vue.unref(webVue.Button), {
|
|
141
|
+
onClick: vue.withModifiers(showPopper, ["stop"])
|
|
142
|
+
}, {
|
|
143
|
+
default: vue.withCtx(() => [
|
|
144
|
+
vue.createElementVNode("span", _hoisted_3, [
|
|
145
|
+
vue.createTextVNode(" \u66F4\u591A\u7B5B\u9009 "),
|
|
146
|
+
vue.createVNode(vue.unref(icon.IconCaretDown))
|
|
147
|
+
])
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
}, 512), [
|
|
151
|
+
[vue.vShow, pannelArray.value]
|
|
152
|
+
])
|
|
153
|
+
], 512),
|
|
154
|
+
vue.withDirectives(vue.createElementVNode("div", {
|
|
155
|
+
id: "dpPannelRef",
|
|
156
|
+
ref_key: "dpPannelRef",
|
|
157
|
+
ref: dpPannelRef,
|
|
158
|
+
class: "filter-pannel"
|
|
159
|
+
}, null, 512), [
|
|
160
|
+
[vue.vShow, popperShowFlag.value]
|
|
161
|
+
])
|
|
162
|
+
]),
|
|
163
|
+
vue.createElementVNode("div", _hoisted_4, [
|
|
164
|
+
vue.createElementVNode("div", {
|
|
165
|
+
ref_key: "filterItemsRef",
|
|
166
|
+
ref: filterItemsRef,
|
|
167
|
+
class: "left"
|
|
168
|
+
}, [
|
|
169
|
+
vue.renderSlot(_ctx.$slots, "left")
|
|
170
|
+
], 512),
|
|
171
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
172
|
+
vue.renderSlot(_ctx.$slots, "right")
|
|
173
|
+
])
|
|
174
|
+
]),
|
|
175
|
+
vue.createElementVNode("div", _hoisted_6, null, 512)
|
|
176
|
+
]);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
module.exports = _sfc_main;
|
|
@@ -9,7 +9,9 @@ const _sfc_main = vue.defineComponent({
|
|
|
9
9
|
setup(__props) {
|
|
10
10
|
return (_ctx, _cache) => {
|
|
11
11
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
12
|
-
class: vue.normalizeClass(["filter-item-view", { value: _ctx.active }])
|
|
12
|
+
class: vue.normalizeClass(["filter-item-view", { value: _ctx.active }]),
|
|
13
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
|
|
14
|
+
}, ["stop"]))
|
|
13
15
|
}, [
|
|
14
16
|
vue.renderSlot(_ctx.$slots, "default")
|
|
15
17
|
], 2);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// FilterGroup 内部样式
|
|
2
|
+
.filter-view-container {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
margin-bottom: 10px;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.filter-search {
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: 10px;
|
|
12
|
+
width: 180px;
|
|
13
|
+
margin-right: 10px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.filter-content {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex: 1;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.left {
|
|
25
|
+
display: flex;
|
|
26
|
+
gap: 10px;
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.right {
|
|
31
|
+
position: absolute;
|
|
32
|
+
right: 0;
|
|
33
|
+
z-index: 1;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-wrap: nowrap;
|
|
36
|
+
align-items: center;
|
|
37
|
+
height: 100%;
|
|
38
|
+
padding-left: 20px;
|
|
39
|
+
background: white;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.more-btn {
|
|
43
|
+
z-index: 10;
|
|
44
|
+
margin-right: 10px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.right-prefix {
|
|
48
|
+
display: flex;
|
|
49
|
+
gap: 10px;
|
|
50
|
+
align-items: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.filter-pannel {
|
|
54
|
+
display: flex;
|
|
55
|
+
gap: 10px;
|
|
56
|
+
padding: 10px;
|
|
57
|
+
background-color: white;
|
|
58
|
+
border-radius: 6px;
|
|
59
|
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
|
60
|
+
}
|
package/lib/utils/typeMap.js
CHANGED
|
@@ -85,15 +85,6 @@ const mp_type_map = {
|
|
|
85
85
|
1: "\u4E2A\u4EBA\u53F7",
|
|
86
86
|
2: "\u7EC4\u7EC7\u53F7"
|
|
87
87
|
};
|
|
88
|
-
const mpTypeOptions = () => {
|
|
89
|
-
const arr = Object.keys(mp_type_map).map((key) => {
|
|
90
|
-
return {
|
|
91
|
-
value: key,
|
|
92
|
-
label: mp_type_map[key]
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
return arr;
|
|
96
|
-
};
|
|
97
88
|
const kongo_source_map = {
|
|
98
89
|
app: "\u5E94\u7528",
|
|
99
90
|
url: "\u94FE\u63A5",
|
|
@@ -178,5 +169,4 @@ exports.local_live_doc_status = local_live_doc_status;
|
|
|
178
169
|
exports.local_live_doc_type = local_live_doc_type;
|
|
179
170
|
exports.matrixPublishFormalStateMap = matrixPublishFormalStateMap;
|
|
180
171
|
exports.matrixPublishStateMap = matrixPublishStateMap;
|
|
181
|
-
exports.mpTypeOptions = mpTypeOptions;
|
|
182
172
|
exports.mp_type_map = mp_type_map;
|