@cmstops/pro-compo 3.9.2-alpha.11 → 3.9.2-alpha.13

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/index.js CHANGED
@@ -28,3 +28,4 @@ export { default as docPreview } from "./docPreview/index.js";
28
28
  export { default as docHistory } from "./docHistory/index.js";
29
29
  export { default as videoThumb } from "./videoThumb/index.js";
30
30
  export { default as importData } from "./importData/index.js";
31
+ export { default as selectAddTo } from "./selectAddTo/index.js";
@@ -0,0 +1,178 @@
1
+ import { defineComponent, computed, ref, onMounted, resolveComponent, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString, createVNode, createCommentVNode } from "vue";
2
+ import { Modal, Tabs, Button } from "@arco-design/web-vue";
3
+ import ViewAllColumn from "./components/ViewAllColumn/index.js";
4
+ import "../typeIcons/style/index.js";
5
+ import { getConfigurationNew } from "./script/api.js";
6
+ import { DEFAULT_BASE_API } from "../config.js";
7
+ import useLoadUserInfo from "../hooks/user.js";
8
+ const _sfc_main = defineComponent({
9
+ ...{ name: "selectAddTo" },
10
+ __name: "component",
11
+ props: {
12
+ BASE_API: {},
13
+ visible: { type: Boolean },
14
+ title: {},
15
+ outsideSelectData: {},
16
+ defaultSelectedData: {},
17
+ maxSelect: {},
18
+ typeData: {},
19
+ userStore: {},
20
+ compoFilter: { type: Boolean, default: false },
21
+ typeKey: {}
22
+ },
23
+ emits: ["update:visible", "comfirm"],
24
+ setup(__props, { emit: __emit }) {
25
+ var _a, _b, _c;
26
+ const emit = __emit;
27
+ const props = __props;
28
+ const BASE_API = props.BASE_API || DEFAULT_BASE_API;
29
+ const visible = computed({
30
+ get() {
31
+ return props.visible;
32
+ },
33
+ set(value) {
34
+ setVisible(value);
35
+ }
36
+ });
37
+ const title = computed(() => {
38
+ let title2 = "";
39
+ switch (props.typeKey) {
40
+ case "series:video_album":
41
+ title2 = "\u6DFB\u52A0\u81F3\u89C6\u9891\u5408\u96C6";
42
+ break;
43
+ case "series:special_v3":
44
+ title2 = "\u6DFB\u52A0\u81F3\u4E13\u9898";
45
+ break;
46
+ case "series:audio_album":
47
+ title2 = "\u6DFB\u52A0\u81F3\u97F3\u9891\u5408\u96C6";
48
+ break;
49
+ case "series:article_album":
50
+ title2 = "\u6DFB\u52A0\u81F3\u653F\u60C5\u4EBA\u7269\u76F8\u5173\u62A5\u9053";
51
+ break;
52
+ }
53
+ return title2;
54
+ });
55
+ ((_c = (_b = (_a = window.situoyun) == null ? void 0 : _a.config) == null ? void 0 : _b.oem_config) == null ? void 0 : _c.mp_name) || "\u516C\u4F17\u53F7";
56
+ const selectedData = ref([]);
57
+ const hasSelected = computed(() => {
58
+ return selectedData.value.length > 0;
59
+ });
60
+ const typeDataController = computed(() => {
61
+ const ret = JSON.parse(JSON.stringify(props.typeData));
62
+ return ret;
63
+ });
64
+ const setVisible = (bool) => {
65
+ emit("update:visible", bool);
66
+ };
67
+ const selectedDataChangeHandle = (data) => {
68
+ selectedData.value = data;
69
+ };
70
+ const handleOk = () => {
71
+ setVisible(false);
72
+ };
73
+ const handleCancel = () => {
74
+ setVisible(false);
75
+ };
76
+ const comfirm = () => {
77
+ emit("comfirm", JSON.parse(JSON.stringify(selectedData.value)));
78
+ };
79
+ const { userInfo, getUserInfoHandle } = useLoadUserInfo(BASE_API);
80
+ const HandleOpen = () => {
81
+ selectedData.value = props.defaultSelectedData || [];
82
+ };
83
+ const HandleClose = () => {
84
+ selectedData.value = [];
85
+ };
86
+ const tabsChange = () => {
87
+ selectedData.value = [];
88
+ };
89
+ const configData = ref({});
90
+ const loadConfig = async () => {
91
+ var _a2;
92
+ const res = await getConfigurationNew(BASE_API, {
93
+ module: "third_party_services"
94
+ });
95
+ if (res.code === 0 && ((_a2 = res.message) == null ? void 0 : _a2.length)) {
96
+ res.message.forEach((item) => {
97
+ configData.value[item.key] = JSON.parse(item.value);
98
+ });
99
+ }
100
+ };
101
+ onMounted(() => {
102
+ if (props.userStore) {
103
+ userInfo.value = { BASE_API, ...props.userStore };
104
+ } else {
105
+ getUserInfoHandle();
106
+ }
107
+ loadConfig();
108
+ });
109
+ return (_ctx, _cache) => {
110
+ const _component_storeBox = resolveComponent("storeBox");
111
+ return openBlock(), createBlock(unref(Modal), {
112
+ footer: false,
113
+ "mask-closable": false,
114
+ visible: visible.value,
115
+ "body-class": "add-content-modal-body",
116
+ "modal-class": "add-content-modal-wrapper",
117
+ "title-align": "start",
118
+ "unmount-on-close": "",
119
+ width: "1020px",
120
+ onCancel: handleCancel,
121
+ onClose: HandleClose,
122
+ onOk: handleOk,
123
+ onOpen: HandleOpen
124
+ }, {
125
+ title: withCtx(() => [
126
+ createTextVNode(toDisplayString(title.value), 1)
127
+ ]),
128
+ default: withCtx(() => [
129
+ createVNode(unref(Tabs), {
130
+ class: "content-tabs",
131
+ justify: "",
132
+ "lazy-load": "",
133
+ onTabClick: tabsChange
134
+ }, {
135
+ default: withCtx(() => [
136
+ createCommentVNode(" \u680F\u76EE\u7A3F\u4EF6 "),
137
+ unref(userInfo) && unref(userInfo).repository_id ? (openBlock(), createBlock(ViewAllColumn, {
138
+ key: 0,
139
+ banner: typeDataController.value.docBanner,
140
+ "default-selected-data": selectedData.value,
141
+ "max-select": _ctx.maxSelect,
142
+ series: typeDataController.value.docSeries,
143
+ "type-data": typeDataController.value,
144
+ "user-info": unref(userInfo),
145
+ typeKey: _ctx.typeKey,
146
+ onChange: selectedDataChangeHandle
147
+ }, {
148
+ store: withCtx(() => [
149
+ createVNode(_component_storeBox, {
150
+ selectData: selectedData.value,
151
+ "onUpdate:selectData": _cache[0] || (_cache[0] = ($event) => selectedData.value = $event)
152
+ }, null, 8, ["selectData"])
153
+ ]),
154
+ options: withCtx(() => [
155
+ createVNode(unref(Button), {
156
+ disabled: !hasSelected.value,
157
+ type: "primary",
158
+ onClick: comfirm
159
+ }, {
160
+ default: withCtx(() => _cache[1] || (_cache[1] = [
161
+ createTextVNode("\u6DFB\u52A0 ")
162
+ ])),
163
+ _: 1,
164
+ __: [1]
165
+ }, 8, ["disabled"])
166
+ ]),
167
+ _: 1
168
+ }, 8, ["banner", "default-selected-data", "max-select", "series", "type-data", "user-info", "typeKey"])) : createCommentVNode("v-if", true)
169
+ ]),
170
+ _: 1
171
+ })
172
+ ]),
173
+ _: 1
174
+ }, 8, ["visible"]);
175
+ };
176
+ }
177
+ });
178
+ export { _sfc_main as default };
@@ -0,0 +1,165 @@
1
+ import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, createElementVNode, toDisplayString, createBlock } from "vue";
2
+ import { Space, Input, Select, Option, Tooltip } from "@arco-design/web-vue";
3
+ import { IconInfoCircle } from "@arco-design/web-vue/es/icon";
4
+ const _hoisted_1 = { class: "media-filter-container" };
5
+ const _hoisted_2 = { style: { "display": "flex", "align-items": "center", "gap": "5px" } };
6
+ const _hoisted_3 = { class: "sort-button" };
7
+ const _sfc_main = defineComponent({
8
+ ...{ name: "MediaFilter" },
9
+ __name: "index",
10
+ props: {
11
+ groupId: {},
12
+ tree: { default: () => [] },
13
+ series: { default: "all" },
14
+ banner: { default: "all" },
15
+ height: {},
16
+ userInfo: {}
17
+ },
18
+ emits: ["update:group_id", "search"],
19
+ setup(__props, { emit: __emit }) {
20
+ const props = __props;
21
+ const column_id = ref("all");
22
+ const emit = __emit;
23
+ const filter = ref({
24
+ keywords: "",
25
+ type: "",
26
+ cover_type: "",
27
+ banner: "",
28
+ sort: -1,
29
+ order: "create_time",
30
+ wordState: "precision"
31
+ });
32
+ const wordStateOptions = [
33
+ {
34
+ value: "precision",
35
+ label: "\u7CBE\u51C6\u641C",
36
+ desc: "\u4F1A\u4EE5\u8F93\u5165\u7684\u5B8C\u6574\u5173\u952E\u8BCD\u201C\u6210\u957F\u201D\u8FDB\u884C\u641C\u7D22\uFF0C\u641C\u7D22\u7ED3\u679C\u5173\u8054\u6027\u66F4\u9AD8\uFF0C\u4F46\u641C\u7D22\u7ED3\u679C\u66F4\u5C11"
37
+ },
38
+ {
39
+ value: "blur",
40
+ label: "\u6A21\u7CCA\u641C",
41
+ desc: "\u4F1A\u5C06\u8F93\u5165\u5185\u5BB9\u5206\u8BCD\uFF0C\u4F8B\u5982\u201C\u6210\u957F\u201D\u4F1A\u5206\u4E3A\u201C\u6210\u201D\u3001\u201C\u957F\u201D\u3001\u201C\u6210\u957F\u201D\uFF0C\u5185\u5BB9\u5305\u542B\u4E09\u4E2A\u8BCD\u4E2D\u4EFB\u610F\u4E00\u4E2A\u5747\u4F1A\u663E\u793A\u51FA\u6765\uFF0C\u641C\u7D22\u5185\u5BB9\u66F4\u52A0\u4E30\u5BCC"
42
+ }
43
+ ];
44
+ const sortMethodOptions = computed(() => {
45
+ return [
46
+ { value: "pub_time", label: "\u53D1\u5E03\u65F6\u95F4" },
47
+ { value: "create_time", label: "\u521B\u5EFA\u65F6\u95F4" }
48
+ ];
49
+ });
50
+ const checkout = (type) => {
51
+ filter.value.wordState = type;
52
+ };
53
+ const handleSearch = () => {
54
+ const params = JSON.parse(JSON.stringify(filter.value));
55
+ if (filter.value.wordState === "precision") {
56
+ params.precise_kw = params.keywords;
57
+ delete params.keywords;
58
+ }
59
+ delete params.wordState;
60
+ emit("search", params);
61
+ };
62
+ watch(
63
+ () => filter.value,
64
+ () => {
65
+ handleSearch();
66
+ },
67
+ { deep: true }
68
+ );
69
+ watch(
70
+ () => props.groupId,
71
+ (val) => {
72
+ column_id.value = val;
73
+ }
74
+ );
75
+ watch(
76
+ () => props.banner,
77
+ (val) => {
78
+ filter.value.banner = val === "all" ? "" : val;
79
+ },
80
+ { immediate: true }
81
+ );
82
+ watch(
83
+ () => column_id.value,
84
+ (val) => {
85
+ emit("update:group_id", val);
86
+ }
87
+ );
88
+ return (_ctx, _cache) => {
89
+ return openBlock(), createElementBlock("div", _hoisted_1, [
90
+ createVNode(unref(Space), { size: "small" }, {
91
+ default: withCtx(() => [
92
+ createVNode(unref(Input), {
93
+ modelValue: filter.value.keywords,
94
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => filter.value.keywords = $event),
95
+ "allow-clear": "",
96
+ class: "filter-item keyword",
97
+ placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9\u6807\u9898",
98
+ style: { width: "240px" },
99
+ onPressEnter: handleSearch
100
+ }, {
101
+ prepend: withCtx(() => [
102
+ createVNode(unref(Select), {
103
+ modelValue: filter.value.wordState,
104
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filter.value.wordState = $event),
105
+ placeholder: "\u8BF7\u9009\u62E9",
106
+ onSelect: checkout
107
+ }, {
108
+ default: withCtx(() => [
109
+ (openBlock(), createElementBlock(Fragment, null, renderList(wordStateOptions, (item, index) => {
110
+ return createVNode(unref(Option), {
111
+ key: index,
112
+ value: item.value,
113
+ label: item.label
114
+ }, {
115
+ default: withCtx(() => [
116
+ createElementVNode("div", _hoisted_2, [
117
+ createElementVNode("span", null, toDisplayString(item.label), 1),
118
+ createVNode(unref(Tooltip), {
119
+ effect: "dark",
120
+ content: item.desc,
121
+ position: "right"
122
+ }, {
123
+ default: withCtx(() => [
124
+ createVNode(unref(IconInfoCircle))
125
+ ]),
126
+ _: 2
127
+ }, 1032, ["content"])
128
+ ])
129
+ ]),
130
+ _: 2
131
+ }, 1032, ["value", "label"]);
132
+ }), 64))
133
+ ]),
134
+ _: 1
135
+ }, 8, ["modelValue"])
136
+ ]),
137
+ _: 1
138
+ }, 8, ["modelValue"])
139
+ ]),
140
+ _: 1
141
+ }),
142
+ createElementVNode("div", _hoisted_3, [
143
+ createVNode(unref(Select), {
144
+ modelValue: filter.value.order,
145
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => filter.value.order = $event),
146
+ class: "filter-item",
147
+ placeholder: "\u53D1\u5E03\u65F6\u95F4"
148
+ }, {
149
+ default: withCtx(() => [
150
+ (openBlock(true), createElementBlock(Fragment, null, renderList(sortMethodOptions.value, (item) => {
151
+ return openBlock(), createBlock(unref(Option), {
152
+ key: item.value,
153
+ label: item.label,
154
+ value: item.value
155
+ }, null, 8, ["label", "value"]);
156
+ }), 128))
157
+ ]),
158
+ _: 1
159
+ }, 8, ["modelValue"])
160
+ ])
161
+ ]);
162
+ };
163
+ }
164
+ });
165
+ export { _sfc_main as default };
@@ -0,0 +1,151 @@
1
+ import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, createCommentVNode, normalizeStyle, createTextVNode, toDisplayString } from "vue";
2
+ import { Popover, InputSearch, Scrollbar, Tree, Button } from "@arco-design/web-vue";
3
+ import { IconDragDotVertical, IconCaretRight } from "@arco-design/web-vue/es/icon";
4
+ import { getCategoryPath } from "../../../script/api.js";
5
+ const _hoisted_1 = { class: "column-selection-container" };
6
+ const _hoisted_2 = { class: "search-column" };
7
+ const _sfc_main = defineComponent({
8
+ ...{ name: "columnTree" },
9
+ __name: "index",
10
+ props: {
11
+ column_id: {},
12
+ tree: {},
13
+ height: {},
14
+ userInfo: {}
15
+ },
16
+ emits: ["update:column_id"],
17
+ setup(__props, { emit: __emit }) {
18
+ const props = __props;
19
+ const emit = __emit;
20
+ const treeOptions = {
21
+ title: "alias",
22
+ isLeaf: "leaf"
23
+ };
24
+ const selectAlias = ref("\u5168\u90E8\u5185\u5BB9");
25
+ const lastSearchKey = ref(window.localStorage.getItem("lastSearchKey") || "");
26
+ const searchKey = ref("");
27
+ const aTreeRef = ref();
28
+ const treeData = computed(() => {
29
+ if (!searchKey.value)
30
+ return props.tree;
31
+ return searchData(searchKey.value);
32
+ });
33
+ const searchData = (keyword) => {
34
+ const loop = (data) => {
35
+ const result = [];
36
+ data.forEach((item) => {
37
+ var _a;
38
+ if ((_a = item.alias) == null ? void 0 : _a.includes(keyword)) {
39
+ result.push({ ...item });
40
+ } else if (item.children) {
41
+ const filterData = loop(item.children);
42
+ if (filterData.length) {
43
+ result.push({
44
+ ...item,
45
+ children: filterData
46
+ });
47
+ }
48
+ }
49
+ });
50
+ return result;
51
+ };
52
+ return loop(props.tree);
53
+ };
54
+ const clickLastItem = () => {
55
+ aTreeRef.value.selectNode(lastSearchKey.value, true);
56
+ };
57
+ watch(
58
+ () => props.column_id,
59
+ (val) => {
60
+ setSelectAlias(val);
61
+ }
62
+ );
63
+ const setSelectAlias = async (id) => {
64
+ if (id === "all") {
65
+ selectAlias.value = "\u5168\u90E8\u5185\u5BB9";
66
+ return;
67
+ }
68
+ const { code, message } = await getCategoryPath(props.userInfo.BASE_API, {
69
+ repo: props.userInfo.repository_id,
70
+ category: id
71
+ });
72
+ if (code === 0) {
73
+ const pathArr = [];
74
+ for (const i of message) {
75
+ pathArr.push(i.category_alias);
76
+ }
77
+ selectAlias.value = pathArr.join("/");
78
+ }
79
+ };
80
+ const AddColumnSelected = (selectedKeys, data) => {
81
+ lastSearchKey.value = selectedKeys[0];
82
+ window.localStorage.setItem("lastSearchKey", lastSearchKey.value);
83
+ emit("update:column_id", data.node.id);
84
+ };
85
+ return (_ctx, _cache) => {
86
+ return openBlock(), createElementBlock("div", _hoisted_1, [
87
+ createVNode(unref(Popover), {
88
+ "content-style": { minWidth: "120px" },
89
+ "content-class": "column-selection-popover-content",
90
+ position: "bottom",
91
+ trigger: "click"
92
+ }, {
93
+ content: withCtx(() => [
94
+ createElementVNode("div", _hoisted_2, [
95
+ createVNode(unref(InputSearch), {
96
+ modelValue: searchKey.value,
97
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchKey.value = $event),
98
+ placeholder: "\u8BF7\u8F93\u5165\u680F\u76EE\u540D\u79F0"
99
+ }, null, 8, ["modelValue"])
100
+ ]),
101
+ lastSearchKey.value ? (openBlock(), createElementBlock("div", {
102
+ key: 0,
103
+ class: "last-search-key",
104
+ onClick: clickLastItem
105
+ }, "\u4E0A\u4E00\u6B21\u9009\u62E9 ")) : createCommentVNode("v-if", true),
106
+ createElementVNode("div", {
107
+ style: normalizeStyle({ minHeight: props.height + "px" }),
108
+ class: "column-selection-main"
109
+ }, [
110
+ createElementVNode("div", {
111
+ style: normalizeStyle({ height: props.height + "px" }),
112
+ class: "column-v"
113
+ }, [
114
+ createVNode(unref(Scrollbar), {
115
+ "outer-class": "column-outer-scrollbar",
116
+ style: { "height": "100%", "overflow": "auto" }
117
+ }, {
118
+ default: withCtx(() => [
119
+ createVNode(unref(Tree), {
120
+ ref_key: "aTreeRef",
121
+ ref: aTreeRef,
122
+ data: treeData.value,
123
+ "default-expand-all": false,
124
+ "field-names": treeOptions,
125
+ "block-node": "",
126
+ "check-strictly": "",
127
+ onSelect: AddColumnSelected
128
+ }, null, 8, ["data"])
129
+ ]),
130
+ _: 1
131
+ })
132
+ ], 4)
133
+ ], 4)
134
+ ]),
135
+ default: withCtx(() => [
136
+ createVNode(unref(Button), { class: "button" }, {
137
+ default: withCtx(() => [
138
+ createVNode(unref(IconDragDotVertical)),
139
+ createTextVNode(" " + toDisplayString(selectAlias.value) + " ", 1),
140
+ createVNode(unref(IconCaretRight))
141
+ ]),
142
+ _: 1
143
+ })
144
+ ]),
145
+ _: 1
146
+ })
147
+ ]);
148
+ };
149
+ }
150
+ });
151
+ export { _sfc_main as default };