@cmstops/pro-compo 3.0.0-rc.0 → 3.0.0-stable.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 +49 -4
- package/dist/index.min.css +1 -1
- package/es/baseFilter/component.js +71 -14
- package/es/config.js +1 -1
- package/es/docHistory/component.js +41 -12
- package/es/docHistory/style/index.css +4 -0
- package/es/docHistory/style/index.less +5 -0
- package/es/hooks/useAttachement.js +2 -9
- package/es/hooks/usePopper.d.ts +1 -1
- package/es/hooks/usePopper.js +3 -3
- package/es/hooks/useUpload.d.ts +50 -2
- package/es/hooks/useUpload.js +43 -4
- package/es/index.css +49 -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/ListLocal/index.js +8 -3
- package/es/selectResourceModal/components/List/ListNormal/Filter.js +201 -89
- package/es/selectResourceModal/components/List/ListNormal/index.js +23 -7
- 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 +45 -4
- package/es/selectResourceModal/style/index.less +14 -0
- package/es/selectResourceModal/style/list.less +40 -4
- package/es/utils/index.js +6 -6
- package/lib/baseFilter/component.js +69 -12
- package/lib/config.js +1 -1
- package/lib/docHistory/component.js +39 -10
- package/lib/docHistory/style/index.css +4 -0
- package/lib/docHistory/style/index.less +5 -0
- package/lib/hooks/useAttachement.js +2 -9
- package/lib/hooks/usePopper.js +3 -3
- package/lib/hooks/useUpload.js +43 -3
- package/lib/index.css +49 -4
- package/lib/selectResourceModal/components/List/ListLocal/index.js +6 -1
- package/lib/selectResourceModal/components/List/ListNormal/Filter.js +198 -86
- package/lib/selectResourceModal/components/List/ListNormal/index.js +22 -6
- package/lib/selectResourceModal/hooks/useResponsiveFilter.js +144 -0
- package/lib/selectResourceModal/scripts/useCompoLf.js +1 -1
- package/lib/selectResourceModal/style/index.css +45 -4
- package/lib/selectResourceModal/style/index.less +14 -0
- package/lib/selectResourceModal/style/list.less +40 -4
- package/lib/utils/index.js +6 -6
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, nextTick, toRaw, openBlock, createElementBlock, Fragment, createElementVNode, withModifiers, createVNode, withCtx, renderList, createBlock, unref, normalizeStyle, createCommentVNode
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, ref, computed, watch, nextTick, toRaw, openBlock, createElementBlock, Fragment, createElementVNode, withModifiers, createVNode, withCtx, renderList, createBlock, renderSlot, unref, createTextVNode, toDisplayString, normalizeStyle, createCommentVNode } from "vue";
|
|
2
|
+
import { InputGroup, Select, Option, Input, InputSearch, RangePicker, RadioGroup, Radio } from "@arco-design/web-vue";
|
|
3
3
|
import _sfc_main$2 from "./components/filterItem.js";
|
|
4
4
|
import _sfc_main$1 from "./components/FilterGroup.js";
|
|
5
5
|
const _sfc_main = defineComponent({
|
|
@@ -37,9 +37,11 @@ const _sfc_main = defineComponent({
|
|
|
37
37
|
});
|
|
38
38
|
return _columns;
|
|
39
39
|
});
|
|
40
|
-
const getOptions = (
|
|
41
|
-
return item
|
|
42
|
-
|
|
40
|
+
const getOptions = computed(() => {
|
|
41
|
+
return (item) => {
|
|
42
|
+
return item.options ? item.options : [];
|
|
43
|
+
};
|
|
44
|
+
});
|
|
43
45
|
const hasValue = computed(() => {
|
|
44
46
|
return (key) => {
|
|
45
47
|
var _a, _b;
|
|
@@ -76,7 +78,10 @@ const _sfc_main = defineComponent({
|
|
|
76
78
|
_form[column.range] = rangeTemp[column.range];
|
|
77
79
|
} else if (column.component === "select") {
|
|
78
80
|
_form[column.key] = column.defaultValue || null;
|
|
79
|
-
} else {
|
|
81
|
+
} else if (column.component === "input-group") {
|
|
82
|
+
_form[column.selectKey] = column.selectDefaultValue || "";
|
|
83
|
+
_form[column.inputKey] = column.inputDefaultValue || "";
|
|
84
|
+
} else if (column.component) {
|
|
80
85
|
_form[column.key] = column.defaultValue || "";
|
|
81
86
|
}
|
|
82
87
|
});
|
|
@@ -178,17 +183,48 @@ const _sfc_main = defineComponent({
|
|
|
178
183
|
active: hasValue.value(item.key)
|
|
179
184
|
}, {
|
|
180
185
|
default: withCtx(() => [
|
|
181
|
-
item.component === "input" ? (openBlock(), createBlock(unref(
|
|
182
|
-
|
|
186
|
+
item.slot ? renderSlot(_ctx.$slots, item.slot, { key: 0 }) : item.component === "input-group" ? (openBlock(), createBlock(unref(InputGroup), { key: 1 }, {
|
|
187
|
+
default: withCtx(() => [
|
|
188
|
+
createVNode(unref(Select), {
|
|
189
|
+
modelValue: form.value[item.selectKey],
|
|
190
|
+
"onUpdate:modelValue": ($event) => form.value[item.selectKey] = $event,
|
|
191
|
+
"default-active-first-option": "",
|
|
192
|
+
style: { "width": "100px" }
|
|
193
|
+
}, {
|
|
194
|
+
default: withCtx(() => [
|
|
195
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(item.selectOptions, (option, idx) => {
|
|
196
|
+
return openBlock(), createBlock(unref(Option), {
|
|
197
|
+
key: idx,
|
|
198
|
+
value: option.value
|
|
199
|
+
}, {
|
|
200
|
+
default: withCtx(() => [
|
|
201
|
+
createTextVNode(toDisplayString(option.label), 1)
|
|
202
|
+
]),
|
|
203
|
+
_: 2
|
|
204
|
+
}, 1032, ["value"]);
|
|
205
|
+
}), 128))
|
|
206
|
+
]),
|
|
207
|
+
_: 2
|
|
208
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"]),
|
|
209
|
+
createVNode(unref(Input), {
|
|
210
|
+
modelValue: form.value[item.inputKey],
|
|
211
|
+
"onUpdate:modelValue": ($event) => form.value[item.inputKey] = $event,
|
|
212
|
+
placeholder: item.placeholder ? item.placeholder : `\u8BF7\u8F93\u5165${item.inputLabel}`,
|
|
213
|
+
style: { "width": "180px" }
|
|
214
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
|
|
215
|
+
]),
|
|
216
|
+
_: 2
|
|
217
|
+
}, 1024)) : item.component === "input" ? (openBlock(), createBlock(unref(InputSearch), {
|
|
218
|
+
key: 2,
|
|
183
219
|
modelValue: form.value[item.key],
|
|
184
220
|
"onUpdate:modelValue": ($event) => form.value[item.key] = $event,
|
|
185
221
|
style: normalizeStyle({ width: styleWidth(columnsMap.value[item.key]) }),
|
|
186
222
|
"allow-clear": "",
|
|
187
223
|
size: "medium",
|
|
188
|
-
placeholder: `\u8BF7\u8F93\u5165${item.label}`
|
|
224
|
+
placeholder: item.placeholder ? item.placeholder : `\u8BF7\u8F93\u5165${item.label}`
|
|
189
225
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "style", "placeholder"])) : createCommentVNode("v-if", true),
|
|
190
226
|
item.component === "select" ? (openBlock(), createBlock(unref(Select), {
|
|
191
|
-
key:
|
|
227
|
+
key: 3,
|
|
192
228
|
modelValue: form.value[item.key],
|
|
193
229
|
"onUpdate:modelValue": ($event) => form.value[item.key] = $event,
|
|
194
230
|
"popup-container": "#base-filter-popup-container",
|
|
@@ -196,13 +232,13 @@ const _sfc_main = defineComponent({
|
|
|
196
232
|
"allow-search": item.allowSearch,
|
|
197
233
|
"default-active-first-option": false,
|
|
198
234
|
style: normalizeStyle({ width: styleWidth(columnsMap.value[item.key]) }),
|
|
199
|
-
placeholder: `\u8BF7\u9009\u62E9${item.label}`,
|
|
235
|
+
placeholder: item.placeholder ? item.placeholder : `\u8BF7\u9009\u62E9${item.label}`,
|
|
200
236
|
onSearch: ($event) => handleSelectSearch($event, item),
|
|
201
237
|
onPopupVisibleChange: ($event) => handleSelectPopupChange($event, item),
|
|
202
238
|
onChange: ($event) => handleSelectChange($event, item)
|
|
203
239
|
}, {
|
|
204
240
|
default: withCtx(() => [
|
|
205
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(getOptions(item), (opt) => {
|
|
241
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(getOptions.value(item), (opt) => {
|
|
206
242
|
return openBlock(), createBlock(unref(Option), {
|
|
207
243
|
key: opt.value,
|
|
208
244
|
label: opt.label,
|
|
@@ -213,7 +249,7 @@ const _sfc_main = defineComponent({
|
|
|
213
249
|
_: 2
|
|
214
250
|
}, 1032, ["modelValue", "onUpdate:modelValue", "allow-search", "style", "placeholder", "onSearch", "onPopupVisibleChange", "onChange"])) : createCommentVNode("v-if", true),
|
|
215
251
|
item.component === "range-picker" ? (openBlock(), createBlock(unref(RangePicker), {
|
|
216
|
-
key:
|
|
252
|
+
key: 4,
|
|
217
253
|
modelValue: form.value[item.key].range,
|
|
218
254
|
"onUpdate:modelValue": ($event) => form.value[item.key].range = $event,
|
|
219
255
|
style: normalizeStyle({ width: styleWidth(form.value[item.key]) }),
|
|
@@ -224,7 +260,28 @@ const _sfc_main = defineComponent({
|
|
|
224
260
|
"popup-container": "#base-filter-popup-container",
|
|
225
261
|
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
226
262
|
}, ["stop"]))
|
|
227
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "style"])) : createCommentVNode("v-if", true)
|
|
263
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "style"])) : createCommentVNode("v-if", true),
|
|
264
|
+
item.component === "radio" ? (openBlock(), createBlock(unref(RadioGroup), {
|
|
265
|
+
key: 5,
|
|
266
|
+
modelValue: form.value[item.key],
|
|
267
|
+
"onUpdate:modelValue": ($event) => form.value[item.key] = $event,
|
|
268
|
+
type: "button"
|
|
269
|
+
}, {
|
|
270
|
+
default: withCtx(() => [
|
|
271
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(item.options || [], (option, idx) => {
|
|
272
|
+
return openBlock(), createBlock(unref(Radio), {
|
|
273
|
+
key: idx,
|
|
274
|
+
value: option.value
|
|
275
|
+
}, {
|
|
276
|
+
default: withCtx(() => [
|
|
277
|
+
createTextVNode(toDisplayString(option.label), 1)
|
|
278
|
+
]),
|
|
279
|
+
_: 2
|
|
280
|
+
}, 1032, ["value"]);
|
|
281
|
+
}), 128))
|
|
282
|
+
]),
|
|
283
|
+
_: 2
|
|
284
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true)
|
|
228
285
|
]),
|
|
229
286
|
_: 2
|
|
230
287
|
}, 1032, ["active"]);
|
package/es/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2
|
-
const DEFAULT_BASE_API = ((_b = (_a = window.situoyun) == null ? void 0 : _a.env) == null ? void 0 : _b.BASE_HOST) || "https://site.cmstop.xyz";
|
|
2
|
+
const DEFAULT_BASE_API = ((_b = (_a = window.situoyun) == null ? void 0 : _a.env) == null ? void 0 : _b.BASE_HOST) || "https://site.r.cmstop.xyz";
|
|
3
3
|
const DEFAULT_BASE_ACCOUNT_HOST = ((_d = (_c = window.situoyun) == null ? void 0 : _c.env) == null ? void 0 : _d.BASE_ACCOUNT_HOST) || "https://account.cmstop.xyz";
|
|
4
4
|
const DEFAULT_UPLOAD_CHUNK_SIZE = ((_f = (_e = window.situoyun) == null ? void 0 : _e.env) == null ? void 0 : _f.UPLOAD_CHUNK_SIZE) || 5242880;
|
|
5
5
|
const DEFAULT_UPLOAD_URL = ((_h = (_g = window.situoyun) == null ? void 0 : _g.env) == null ? void 0 : _h.BASE_STATIC_FILE_API) || "https://oss.cmstop.xyz/maple/v1";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, computed, watch, onMounted, openBlock, createBlock,
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, computed, watch, onMounted, openBlock, createBlock, resolveDynamicComponent, mergeProps, withCtx, createVNode, unref, createTextVNode, createElementVNode, createElementBlock, Fragment, createCommentVNode } from "vue";
|
|
2
|
+
import { Button, Spin, Scrollbar, Drawer, Modal } from "@arco-design/web-vue";
|
|
3
3
|
import { DEFAULT_BASE_API } from "../config.js";
|
|
4
4
|
import { useDocHistory } from "./scripts/useDocHistory.js";
|
|
5
5
|
import _sfc_main$2 from "./components/DocHistoryList/index.js";
|
|
@@ -13,9 +13,11 @@ const _sfc_main = defineComponent({
|
|
|
13
13
|
__name: "component",
|
|
14
14
|
props: {
|
|
15
15
|
BASE_API: {},
|
|
16
|
+
wrap: { default: "drawer" },
|
|
16
17
|
visible: { type: Boolean },
|
|
17
18
|
docInfo: {},
|
|
18
|
-
pub: { type: Boolean }
|
|
19
|
+
pub: { type: Boolean },
|
|
20
|
+
currentIdx: {}
|
|
19
21
|
},
|
|
20
22
|
emits: ["update:visible", "select"],
|
|
21
23
|
setup(__props, { emit: __emit }) {
|
|
@@ -27,6 +29,20 @@ const _sfc_main = defineComponent({
|
|
|
27
29
|
emits("update:visible", val);
|
|
28
30
|
}
|
|
29
31
|
});
|
|
32
|
+
const wrapProps = computed(() => {
|
|
33
|
+
if (props.wrap === "drawer") {
|
|
34
|
+
return {
|
|
35
|
+
class: "doc-history-drawer-wrap",
|
|
36
|
+
title: "\u7248\u672C\u8BB0\u5F55",
|
|
37
|
+
width: 1e3
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
bodyClass: "doc-history-modal-wrap",
|
|
42
|
+
title: "\u7248\u672C\u8BB0\u5F55",
|
|
43
|
+
width: 1e3
|
|
44
|
+
};
|
|
45
|
+
});
|
|
30
46
|
const BASE_API = props.BASE_API || DEFAULT_BASE_API;
|
|
31
47
|
const {
|
|
32
48
|
initParams,
|
|
@@ -37,6 +53,10 @@ const _sfc_main = defineComponent({
|
|
|
37
53
|
list,
|
|
38
54
|
current
|
|
39
55
|
} = useDocHistory(BASE_API);
|
|
56
|
+
const wrapComponent = {
|
|
57
|
+
drawer: Drawer,
|
|
58
|
+
modal: Modal
|
|
59
|
+
};
|
|
40
60
|
function handeRevert() {
|
|
41
61
|
emits("select", list.value[current.value]);
|
|
42
62
|
}
|
|
@@ -49,20 +69,29 @@ const _sfc_main = defineComponent({
|
|
|
49
69
|
},
|
|
50
70
|
{ immediate: true }
|
|
51
71
|
);
|
|
52
|
-
|
|
72
|
+
watch(
|
|
73
|
+
() => props.currentIdx,
|
|
74
|
+
(val) => {
|
|
75
|
+
if (val) {
|
|
76
|
+
handleSelect(val);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{ immediate: true }
|
|
80
|
+
);
|
|
81
|
+
onMounted(async () => {
|
|
53
82
|
if (!props.docInfo)
|
|
54
83
|
return;
|
|
55
84
|
initParams(props.docInfo.id, props.pub);
|
|
56
|
-
loadData();
|
|
85
|
+
await loadData();
|
|
86
|
+
if (props.currentIdx) {
|
|
87
|
+
handleSelect(props.currentIdx);
|
|
88
|
+
}
|
|
57
89
|
});
|
|
58
90
|
return (_ctx, _cache) => {
|
|
59
|
-
return openBlock(), createBlock(
|
|
91
|
+
return openBlock(), createBlock(resolveDynamicComponent(wrapComponent[_ctx.wrap]), mergeProps({
|
|
60
92
|
visible: vis.value,
|
|
61
|
-
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => vis.value = $event)
|
|
62
|
-
|
|
63
|
-
title: "\u7248\u672C\u8BB0\u5F55",
|
|
64
|
-
width: 1e3
|
|
65
|
-
}, {
|
|
93
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => vis.value = $event)
|
|
94
|
+
}, wrapProps.value), {
|
|
66
95
|
footer: withCtx(() => [
|
|
67
96
|
createVNode(unref(Button), {
|
|
68
97
|
type: "primary",
|
|
@@ -123,7 +152,7 @@ const _sfc_main = defineComponent({
|
|
|
123
152
|
])
|
|
124
153
|
]),
|
|
125
154
|
_: 1
|
|
126
|
-
},
|
|
155
|
+
}, 16, ["visible"]);
|
|
127
156
|
};
|
|
128
157
|
}
|
|
129
158
|
});
|
|
@@ -110,7 +110,7 @@ function getSysRsPage(BASE_API, params) {
|
|
|
110
110
|
}
|
|
111
111
|
function getDirectory(BASE_API, params) {
|
|
112
112
|
return request(BASE_API, {
|
|
113
|
-
url: "/poplar/v3/
|
|
113
|
+
url: "/poplar/v3/directory/tree",
|
|
114
114
|
method: "get",
|
|
115
115
|
params
|
|
116
116
|
});
|
|
@@ -123,14 +123,7 @@ function useDirectory(options) {
|
|
|
123
123
|
if (code === 0) {
|
|
124
124
|
if (!Array.isArray(message.data))
|
|
125
125
|
return [];
|
|
126
|
-
return message.data
|
|
127
|
-
return {
|
|
128
|
-
title: alias,
|
|
129
|
-
key: id,
|
|
130
|
-
isLeaf: false,
|
|
131
|
-
children: []
|
|
132
|
-
};
|
|
133
|
-
});
|
|
126
|
+
return message.data;
|
|
134
127
|
}
|
|
135
128
|
return [];
|
|
136
129
|
}
|
package/es/hooks/usePopper.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Placement } from '@popperjs/core';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
export default function usePopper(pannel: Ref<HTMLElement | undefined>, triggerEl: Ref<HTMLElement | undefined>): {
|
|
4
|
-
initPopper: (placement?: Placement) => void;
|
|
4
|
+
initPopper: (placement?: Placement, of?: number[] | undefined) => void;
|
|
5
5
|
show: () => void;
|
|
6
6
|
hide: () => void;
|
|
7
7
|
visible: Ref<boolean, boolean>;
|
package/es/hooks/usePopper.js
CHANGED
|
@@ -8,16 +8,16 @@ function usePopper(pannel, triggerEl) {
|
|
|
8
8
|
};
|
|
9
9
|
const show = () => {
|
|
10
10
|
visible.value = true;
|
|
11
|
-
window.onclick = (
|
|
11
|
+
window.onclick = () => {
|
|
12
12
|
hide();
|
|
13
13
|
visible.value = false;
|
|
14
14
|
window.onclick = null;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
const initPopper = (placement = "bottom-start") => {
|
|
17
|
+
const initPopper = (placement = "bottom-start", of) => {
|
|
18
18
|
if (!pannel.value || !triggerEl.value)
|
|
19
19
|
return;
|
|
20
|
-
const offset = [0, 10];
|
|
20
|
+
const offset = of != null ? of : [0, 10];
|
|
21
21
|
if (window.__POWERED_BY_WUJIE__) {
|
|
22
22
|
offset[1] = -54;
|
|
23
23
|
}
|
package/es/hooks/useUpload.d.ts
CHANGED
|
@@ -7,24 +7,72 @@ export declare type TypeAddMediaParam = {
|
|
|
7
7
|
directory_id: number;
|
|
8
8
|
size: number;
|
|
9
9
|
};
|
|
10
|
+
declare type WaterMark = {
|
|
11
|
+
id: string;
|
|
12
|
+
position: string;
|
|
13
|
+
url: string;
|
|
14
|
+
title: string;
|
|
15
|
+
};
|
|
16
|
+
declare type UploadTemplate = {
|
|
17
|
+
watermark?: {
|
|
18
|
+
default?: WaterMark;
|
|
19
|
+
images: WaterMark[];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
10
22
|
export declare function getSize(value: number): string;
|
|
11
23
|
export declare function addMedia(BASE_API: string, params: TypeAddMediaParam): Promise<import("axios").AxiosResponse<any, any>>;
|
|
12
24
|
export declare function getMediaDetails(BASE_API: string, repoId: number, id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
13
25
|
export declare function reTranscodeMedia(BASE_API: string, media_id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
14
26
|
declare type UploadOptions = {
|
|
15
|
-
noAddMedia
|
|
27
|
+
noAddMedia?: boolean;
|
|
28
|
+
};
|
|
29
|
+
declare type UploadFileOptions = {
|
|
30
|
+
template?: UploadTemplate;
|
|
16
31
|
};
|
|
17
32
|
export default function useUpload(options?: UploadOptions): {
|
|
18
33
|
list: import("vue").Ref<any[], any[]>;
|
|
19
|
-
uploadFile: (BASE_API: string, file: any, dir: number | undefined, repoId: number, callback?: CallbackFunc | undefined) => void;
|
|
34
|
+
uploadFile: (BASE_API: string, file: any, dir: number | undefined, repoId: number, callback?: CallbackFunc | undefined, upOptions?: UploadFileOptions | undefined) => void;
|
|
20
35
|
reTranscode: (BASE_API: string, file: any) => Promise<boolean>;
|
|
21
36
|
transcodingFile: (BASE_API: string, file: any, repoId: number) => void;
|
|
22
37
|
recordTaskStatusChange: (file: any, progress: number, isTrans?: boolean | undefined) => void;
|
|
23
38
|
removeRecord: (file: any) => void;
|
|
24
39
|
};
|
|
40
|
+
export declare function getWatermarkTemplate(BASE_API: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
25
41
|
export declare function useUploadConfig(): {
|
|
26
42
|
config: import("vue").Ref<any, any>;
|
|
43
|
+
template: import("vue").Ref<{
|
|
44
|
+
watermark?: {
|
|
45
|
+
default?: {
|
|
46
|
+
id: string;
|
|
47
|
+
position: string;
|
|
48
|
+
url: string;
|
|
49
|
+
title: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
images: {
|
|
52
|
+
id: string;
|
|
53
|
+
position: string;
|
|
54
|
+
url: string;
|
|
55
|
+
title: string;
|
|
56
|
+
}[];
|
|
57
|
+
} | undefined;
|
|
58
|
+
}, UploadTemplate | {
|
|
59
|
+
watermark?: {
|
|
60
|
+
default?: {
|
|
61
|
+
id: string;
|
|
62
|
+
position: string;
|
|
63
|
+
url: string;
|
|
64
|
+
title: string;
|
|
65
|
+
} | undefined;
|
|
66
|
+
images: {
|
|
67
|
+
id: string;
|
|
68
|
+
position: string;
|
|
69
|
+
url: string;
|
|
70
|
+
title: string;
|
|
71
|
+
}[];
|
|
72
|
+
} | undefined;
|
|
73
|
+
}>;
|
|
27
74
|
checkFileSizeOutLimit: (file: File, callback: (msg: string) => void) => boolean;
|
|
28
75
|
initUploadConfig: (BASE_API: string, domainId: number) => Promise<void>;
|
|
76
|
+
initTemplate: (BASE_API: string) => Promise<void>;
|
|
29
77
|
};
|
|
30
78
|
export {};
|
package/es/hooks/useUpload.js
CHANGED
|
@@ -73,7 +73,7 @@ function useUpload(options) {
|
|
|
73
73
|
list.value = originList;
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
const uploadFile = (BASE_API, file, dir = 0, repoId, callback) => {
|
|
76
|
+
const uploadFile = (BASE_API, file, dir = 0, repoId, callback, upOptions) => {
|
|
77
77
|
const newFile = {
|
|
78
78
|
id: file.id || generateUUID(),
|
|
79
79
|
sig_id: file.sig_id || generateUUID(),
|
|
@@ -93,18 +93,24 @@ function useUpload(options) {
|
|
|
93
93
|
};
|
|
94
94
|
const uploading = upload.start(progress);
|
|
95
95
|
uploading.then(async (url) => {
|
|
96
|
+
var _a;
|
|
96
97
|
if (options == null ? void 0 : options.noAddMedia) {
|
|
97
98
|
recordTaskStatusChange({ ...newFile, status: 0, url }, 1);
|
|
98
99
|
callback && callback({ ...newFile, url }, "success");
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
102
|
+
const params = {};
|
|
103
|
+
if ((_a = upOptions == null ? void 0 : upOptions.template) == null ? void 0 : _a.watermark) {
|
|
104
|
+
params.watermark = upOptions.template.watermark.default;
|
|
105
|
+
}
|
|
101
106
|
const { code, message } = await addMedia(BASE_API, {
|
|
102
107
|
url,
|
|
103
108
|
size: newFile.size,
|
|
104
109
|
directory_id: dir,
|
|
105
110
|
repository_id: repoId,
|
|
106
111
|
catalog: newFile.type,
|
|
107
|
-
alias: newFile.name
|
|
112
|
+
alias: newFile.name,
|
|
113
|
+
...params
|
|
108
114
|
});
|
|
109
115
|
if (code !== 0) {
|
|
110
116
|
console.log("\u{1F525}\u{1F525}\u{1F525}\u{1F525}\u{1F525} \u4E0A\u4F20\u5931\u8D25\uFF1A", newFile.name, code, message);
|
|
@@ -194,9 +200,16 @@ function getConfiguration(BASE_API, params) {
|
|
|
194
200
|
params
|
|
195
201
|
});
|
|
196
202
|
}
|
|
203
|
+
function getWatermarkTemplate(BASE_API) {
|
|
204
|
+
return request(BASE_API, {
|
|
205
|
+
url: `/poplar/v2/material/image/watermark`,
|
|
206
|
+
method: "get"
|
|
207
|
+
});
|
|
208
|
+
}
|
|
197
209
|
function useUploadConfig() {
|
|
198
210
|
const { get, set, remove } = useLocalstorage("LOCAL_UPLOAD_CONFIG");
|
|
199
211
|
const config = ref(get() || {});
|
|
212
|
+
const template = ref({});
|
|
200
213
|
async function initUploadConfig(BASE_API, domainId) {
|
|
201
214
|
if (config.value.size_config_enabled != null)
|
|
202
215
|
return;
|
|
@@ -245,11 +258,37 @@ function useUploadConfig() {
|
|
|
245
258
|
);
|
|
246
259
|
return false;
|
|
247
260
|
}
|
|
261
|
+
async function initTemplate(BASE_API) {
|
|
262
|
+
try {
|
|
263
|
+
const { code, message } = await getWatermarkTemplate(BASE_API);
|
|
264
|
+
if (code !== 0)
|
|
265
|
+
return;
|
|
266
|
+
if (message) {
|
|
267
|
+
let defaultWaterMark;
|
|
268
|
+
if (Array.isArray(message.images)) {
|
|
269
|
+
message.images.forEach((item) => {
|
|
270
|
+
if (message.default === item.id)
|
|
271
|
+
defaultWaterMark = item;
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
template.value = {
|
|
275
|
+
watermark: {
|
|
276
|
+
default: defaultWaterMark,
|
|
277
|
+
images: message.images
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
} catch (e) {
|
|
282
|
+
console.error(e);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
248
285
|
window.addEventListener("beforeunload", remove, false);
|
|
249
286
|
return {
|
|
250
287
|
config,
|
|
288
|
+
template,
|
|
251
289
|
checkFileSizeOutLimit,
|
|
252
|
-
initUploadConfig
|
|
290
|
+
initUploadConfig,
|
|
291
|
+
initTemplate
|
|
253
292
|
};
|
|
254
293
|
}
|
|
255
|
-
export { addMedia, useUpload as default, getMediaDetails, getSize, reTranscodeMedia, useUploadConfig };
|
|
294
|
+
export { addMedia, useUpload as default, getMediaDetails, getSize, getWatermarkTemplate, reTranscodeMedia, useUploadConfig };
|
package/es/index.css
CHANGED
|
@@ -4529,11 +4529,13 @@
|
|
|
4529
4529
|
}
|
|
4530
4530
|
.resource-list-footer,
|
|
4531
4531
|
.resource-list-header,
|
|
4532
|
+
.resource-list-content .resource-list-content-empty,
|
|
4532
4533
|
.resource-list-content .arco-scrollbar-container {
|
|
4533
4534
|
padding: 0 40px;
|
|
4534
4535
|
}
|
|
4535
4536
|
.resource-list-footer {
|
|
4536
4537
|
display: flex;
|
|
4538
|
+
flex-wrap: wrap;
|
|
4537
4539
|
justify-content: space-between;
|
|
4538
4540
|
padding-bottom: 20px;
|
|
4539
4541
|
}
|
|
@@ -4543,6 +4545,10 @@
|
|
|
4543
4545
|
gap: 10px;
|
|
4544
4546
|
align-items: center;
|
|
4545
4547
|
justify-content: flex-end;
|
|
4548
|
+
margin-top: 10px;
|
|
4549
|
+
}
|
|
4550
|
+
.resource-list-footer .footer-right .list-selected-wrapper {
|
|
4551
|
+
font-size: 12px;
|
|
4546
4552
|
}
|
|
4547
4553
|
.resource-list-content-loading {
|
|
4548
4554
|
display: flex;
|
|
@@ -4554,7 +4560,7 @@
|
|
|
4554
4560
|
.resource-list .list-item-grid {
|
|
4555
4561
|
display: grid;
|
|
4556
4562
|
grid-gap: 20px;
|
|
4557
|
-
grid-template-columns: repeat(
|
|
4563
|
+
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
|
4558
4564
|
}
|
|
4559
4565
|
.resource-list .list-content {
|
|
4560
4566
|
margin-top: 30px;
|
|
@@ -4597,7 +4603,8 @@
|
|
|
4597
4603
|
}
|
|
4598
4604
|
.resource-list .list-filter-wrapper .list-filter-tags {
|
|
4599
4605
|
display: flex;
|
|
4600
|
-
|
|
4606
|
+
flex-wrap: wrap;
|
|
4607
|
+
gap: 10px;
|
|
4601
4608
|
margin-top: 10px;
|
|
4602
4609
|
}
|
|
4603
4610
|
.resource-list .list-filter-wrapper .list-filter-tags .list-filter-tag {
|
|
@@ -4618,16 +4625,41 @@
|
|
|
4618
4625
|
justify-content: space-between;
|
|
4619
4626
|
}
|
|
4620
4627
|
.resource-list .list-filter-wrapper .list-filter .filter-list {
|
|
4628
|
+
position: relative;
|
|
4629
|
+
/** 给 popup 一个参考 */
|
|
4621
4630
|
display: flex;
|
|
4622
|
-
flex-wrap: wrap;
|
|
4623
|
-
gap: 10px;
|
|
4624
4631
|
}
|
|
4625
4632
|
.resource-list .list-filter-wrapper .list-filter .filter-list .filter-item {
|
|
4626
4633
|
width: 100px;
|
|
4634
|
+
margin-right: 10px;
|
|
4635
|
+
}
|
|
4636
|
+
.resource-list .list-filter-wrapper .list-filter .filter-list .arco-trigger-popup {
|
|
4637
|
+
z-index: 100000 !important;
|
|
4627
4638
|
}
|
|
4628
4639
|
.resource-list .list-filter-wrapper .list-filter .arco-input-prepend {
|
|
4629
4640
|
padding: 0;
|
|
4630
4641
|
}
|
|
4642
|
+
.resource-list .list-filter-wrapper .list-filter .more-btn {
|
|
4643
|
+
position: relative;
|
|
4644
|
+
/** 给 poperjs 一个参考 */
|
|
4645
|
+
}
|
|
4646
|
+
.resource-list .list-filter-wrapper .list-filter .more-btn .filter-pannel {
|
|
4647
|
+
inset: 40px auto auto auto !important;
|
|
4648
|
+
}
|
|
4649
|
+
.resource-list .list-filter-wrapper .filter-extra {
|
|
4650
|
+
display: flex;
|
|
4651
|
+
gap: 10px;
|
|
4652
|
+
}
|
|
4653
|
+
.resource-list .list-filter-wrapper .filter-pannel {
|
|
4654
|
+
z-index: 100000;
|
|
4655
|
+
display: flex;
|
|
4656
|
+
flex-direction: column;
|
|
4657
|
+
gap: 10px;
|
|
4658
|
+
padding: 10px;
|
|
4659
|
+
background-color: #fff;
|
|
4660
|
+
border-radius: 4px;
|
|
4661
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
4662
|
+
}
|
|
4631
4663
|
.resource-list .title {
|
|
4632
4664
|
display: flex;
|
|
4633
4665
|
gap: 8px;
|
|
@@ -4641,6 +4673,10 @@
|
|
|
4641
4673
|
height: 16px;
|
|
4642
4674
|
background-color: #4886ff;
|
|
4643
4675
|
}
|
|
4676
|
+
.resource-select-wrap {
|
|
4677
|
+
width: 100%;
|
|
4678
|
+
height: 100%;
|
|
4679
|
+
}
|
|
4644
4680
|
.resource-select-modal-body {
|
|
4645
4681
|
height: 80vh;
|
|
4646
4682
|
padding: 0;
|
|
@@ -4669,6 +4705,11 @@
|
|
|
4669
4705
|
.resource-select-container .resource-select-header .arco-tabs-content {
|
|
4670
4706
|
display: none !important;
|
|
4671
4707
|
}
|
|
4708
|
+
.resource-select-container .resource-list-content .resource-list-content-empty {
|
|
4709
|
+
box-sizing: border-box;
|
|
4710
|
+
width: 100%;
|
|
4711
|
+
height: 100%;
|
|
4712
|
+
}
|
|
4672
4713
|
.iframe-container {
|
|
4673
4714
|
position: relative;
|
|
4674
4715
|
height: 95vh;
|
|
@@ -4925,6 +4966,10 @@
|
|
|
4925
4966
|
.doc-history-drawer .arco-drawer-footer {
|
|
4926
4967
|
text-align: left;
|
|
4927
4968
|
}
|
|
4969
|
+
.doc-history-modal-wrap {
|
|
4970
|
+
height: 70vh;
|
|
4971
|
+
padding: 0;
|
|
4972
|
+
}
|
|
4928
4973
|
.video-thumb {
|
|
4929
4974
|
display: flex;
|
|
4930
4975
|
flex-direction: column;
|