@cmstops/pro-compo 0.3.38 → 0.3.39

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.
@@ -1,29 +1,7 @@
1
- import { defineComponent, ref, provide, computed, openBlock, createBlock, unref, withCtx, createElementBlock, createCommentVNode, createElementVNode, createVNode, withDirectives, vShow, createTextVNode } from "vue";
2
- import { Drawer, Tabs, Button, TabPane, Scrollbar, Pagination } from "@arco-design/web-vue";
3
- import { IconClose } from "@arco-design/web-vue/es/icon";
4
- import emptyData from "../emptyData/index.js";
5
- import _sfc_main$1 from "./components/ListFilter/index.js";
6
- import _sfc_main$2 from "./components/ListContent/index.js";
7
- import _sfc_main$4 from "./components/ListSelected/index.js";
8
- import _sfc_main$3 from "./components/ListContentLocal/index.js";
9
- import useAttachement from "../hooks/useAttachement.js";
10
- import { DEFAULT_BASE_API } from "../config.js";
11
- const _hoisted_1 = {
12
- key: 0,
13
- class: "resource-select-container"
14
- };
15
- const _hoisted_2 = { class: "resource-select-header" };
16
- const _hoisted_3 = {
17
- key: 0,
18
- class: "resource-select-filter"
19
- };
20
- const _hoisted_4 = { class: "resource-select-content" };
21
- const _hoisted_5 = { class: "resource-select-footer" };
22
- const _hoisted_6 = { class: "footer-left" };
23
- const _hoisted_7 = {
24
- key: 0,
25
- class: "footer-right"
26
- };
1
+ import { defineComponent, ref, openBlock, createElementBlock, createBlock, unref, withCtx, createVNode, createCommentVNode } from "vue";
2
+ import { Drawer, Modal } from "@arco-design/web-vue";
3
+ import _sfc_main$1 from "./components/Main/index.js";
4
+ const _hoisted_1 = { class: "resource-select-wrap" };
27
5
  const _sfc_main = defineComponent({
28
6
  ...{ name: "selectResourceModal" },
29
7
  __name: "component",
@@ -32,193 +10,63 @@ const _sfc_main = defineComponent({
32
10
  visible: { type: Boolean },
33
11
  userInfo: {},
34
12
  maxcount: {},
13
+ wrap: {},
35
14
  filterOptions: {}
36
15
  },
37
16
  emits: ["update:visible", "submit"],
38
17
  setup(__props, { emit: __emit }) {
39
18
  const props = __props;
40
19
  const emits = __emit;
41
- const BASE_API = props.BASE_API || DEFAULT_BASE_API;
42
- const activeKey = ref("all");
43
- provide("userInfo", computed(() => props.userInfo));
44
- provide("baseAPI", BASE_API);
45
- const {
46
- list,
47
- total,
48
- limit,
49
- loading,
50
- changeKey,
51
- changeFilter,
52
- changePage,
53
- changeSize
54
- } = useAttachement({ key: "all", BASE_API });
55
- const selected = ref([]);
56
- const selectedKeys = computed(() => selected.value.map((item) => item.id));
57
- const disableSelect = computed(() => props.maxcount && selected.value.length >= props.maxcount);
58
- function handleSelect(params) {
59
- const { id } = params;
60
- const index = selected.value.findIndex((item) => item.id === id);
61
- if (index > -1)
62
- selected.value.splice(index, 1);
63
- else
64
- selected.value.push(params);
65
- }
66
- function handleClear() {
67
- selected.value = [];
68
- }
69
- function handleClose() {
70
- handleClear();
20
+ const wrapMode = ref(props.wrap || "modal");
21
+ const handleClose = () => {
71
22
  emits("update:visible", false);
72
- }
73
- const handleSelectOne = (params) => {
74
- if (Array.isArray(params))
75
- emits("submit", params);
76
- else
77
- emits("submit", [params]);
78
- handleClose();
79
23
  };
80
- function handleConfirm() {
81
- handleSelectOne(selected.value);
82
- }
83
- function handleToUpload() {
84
- changeKey("local");
85
- activeKey.value = "local";
86
- }
24
+ const handleSubmit = (data) => {
25
+ emits("submit", JSON.parse(JSON.stringify(data)));
26
+ };
87
27
  return (_ctx, _cache) => {
88
- return openBlock(), createBlock(unref(Drawer), {
89
- visible: _ctx.visible,
90
- width: "1024px",
91
- header: false,
92
- footer: false,
93
- class: "resource-select-drawer"
94
- }, {
95
- default: withCtx(() => [
96
- _ctx.userInfo ? (openBlock(), createElementBlock("div", _hoisted_1, [
97
- createCommentVNode(" \u5934\u90E8 "),
98
- createElementVNode("div", _hoisted_2, [
99
- createVNode(unref(Tabs), {
100
- "active-key": activeKey.value,
101
- "onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
102
- onChange: unref(changeKey)
103
- }, {
104
- extra: withCtx(() => [
105
- createVNode(unref(Button), {
106
- type: "secondary",
107
- shape: "round",
108
- onClick: handleClose
109
- }, {
110
- icon: withCtx(() => [
111
- createVNode(unref(IconClose))
112
- ]),
113
- _: 1
114
- })
115
- ]),
116
- default: withCtx(() => [
117
- createVNode(unref(TabPane), {
118
- key: "all",
119
- title: "\u5168\u90E8\u7D20\u6750"
120
- }),
121
- createVNode(unref(TabPane), {
122
- key: "my",
123
- title: "\u6211\u7684\u7D20\u6750"
124
- }),
125
- createVNode(unref(TabPane), {
126
- key: "remind",
127
- title: "\u63D0\u9192\u6211\u7684"
128
- }),
129
- createVNode(unref(TabPane), {
130
- key: "local",
131
- title: "\u672C\u5730\u7D20\u6750"
132
- })
133
- ]),
134
- _: 1
135
- }, 8, ["active-key", "onChange"])
136
- ]),
137
- createCommentVNode(" \u7B5B\u9009 "),
138
- activeKey.value !== "local" ? (openBlock(), createElementBlock("div", _hoisted_3, [
139
- createVNode(_sfc_main$1, {
140
- "disable-upload-by": activeKey.value !== "all",
141
- filterOptions: _ctx.filterOptions,
142
- onChange: unref(changeFilter),
143
- onUpload: handleToUpload
144
- }, null, 8, ["disable-upload-by", "filterOptions", "onChange"])
145
- ])) : createCommentVNode("v-if", true),
146
- createCommentVNode(" \u5217\u8868\u90E8\u5206 "),
147
- createElementVNode("div", _hoisted_4, [
148
- createVNode(unref(Scrollbar), {
149
- "outer-style": { height: "100%" },
150
- style: { "height": "100%", "overflow": "auto" }
151
- }, {
152
- default: withCtx(() => [
153
- withDirectives(createVNode(_sfc_main$2, {
154
- loading: unref(loading),
155
- list: unref(list),
156
- disable: disableSelect.value,
157
- "select-keys": selectedKeys.value,
158
- onSelect: handleSelect,
159
- onSelectOne: handleSelectOne
160
- }, null, 8, ["loading", "list", "disable", "select-keys"]), [
161
- [vShow, activeKey.value !== "local"]
162
- ]),
163
- withDirectives(createVNode(_sfc_main$3, {
164
- disable: disableSelect.value,
165
- "select-keys": selectedKeys.value,
166
- onSelect: handleSelect,
167
- onSelectOne: handleSelectOne
168
- }, null, 8, ["disable", "select-keys"]), [
169
- [vShow, activeKey.value === "local"]
170
- ])
171
- ]),
172
- _: 1
173
- })
174
- ]),
175
- createCommentVNode(" \u5E95\u90E8 "),
176
- createElementVNode("div", _hoisted_5, [
177
- createElementVNode("div", _hoisted_6, [
178
- activeKey.value !== "local" ? (openBlock(), createBlock(unref(Pagination), {
179
- key: 0,
180
- total: unref(total),
181
- "page-size": unref(limit),
182
- "show-total": "",
183
- "show-page-size": "",
184
- "base-size": 3,
185
- "buffer-size": 1,
186
- onChange: _cache[1] || (_cache[1] = (e) => unref(changePage)((e - 1) * unref(limit))),
187
- onPageSizeChange: unref(changeSize)
188
- }, null, 8, ["total", "page-size", "onPageSizeChange"])) : createCommentVNode("v-if", true)
189
- ]),
190
- selected.value.length ? (openBlock(), createElementBlock("div", _hoisted_7, [
191
- createVNode(_sfc_main$4, {
192
- maxcount: _ctx.maxcount,
193
- selected: selected.value,
194
- onRemove: handleSelect,
195
- onClear: handleClear
196
- }, null, 8, ["maxcount", "selected"]),
197
- createVNode(unref(Button), { onClick: handleClose }, {
198
- default: withCtx(() => [
199
- createTextVNode("\u53D6\u6D88")
200
- ]),
201
- _: 1
202
- }),
203
- createVNode(unref(Button), {
204
- type: "primary",
205
- onClick: handleConfirm
206
- }, {
207
- default: withCtx(() => [
208
- createTextVNode("\u786E\u5B9A")
209
- ]),
210
- _: 1
211
- })
212
- ])) : createCommentVNode("v-if", true)
213
- ])
214
- ])) : (openBlock(), createBlock(unref(emptyData), {
215
- key: 1,
216
- type: "empty",
217
- customTip: "\u6682\u65E0\u6743\u9650"
218
- }))
219
- ]),
220
- _: 1
221
- }, 8, ["visible"]);
28
+ return openBlock(), createElementBlock("div", _hoisted_1, [
29
+ wrapMode.value === "drawer" ? (openBlock(), createBlock(unref(Drawer), {
30
+ key: 0,
31
+ visible: _ctx.visible,
32
+ width: "1024px",
33
+ header: false,
34
+ footer: false,
35
+ class: "resource-select-drawer"
36
+ }, {
37
+ default: withCtx(() => [
38
+ createVNode(_sfc_main$1, {
39
+ BASE_API: _ctx.BASE_API,
40
+ userInfo: _ctx.userInfo,
41
+ maxcount: _ctx.maxcount,
42
+ filterOptions: _ctx.filterOptions,
43
+ onClose: handleClose,
44
+ onSubmit: handleSubmit
45
+ }, null, 8, ["BASE_API", "userInfo", "maxcount", "filterOptions"])
46
+ ]),
47
+ _: 1
48
+ }, 8, ["visible"])) : wrapMode.value === "modal" ? (openBlock(), createBlock(unref(Modal), {
49
+ key: 1,
50
+ visible: _ctx.visible,
51
+ width: "986px",
52
+ "body-class": "resource-select-modal-body",
53
+ "hide-title": false,
54
+ closable: false,
55
+ footer: false
56
+ }, {
57
+ default: withCtx(() => [
58
+ createVNode(_sfc_main$1, {
59
+ BASE_API: _ctx.BASE_API,
60
+ userInfo: _ctx.userInfo,
61
+ maxcount: _ctx.maxcount,
62
+ filterOptions: _ctx.filterOptions,
63
+ onClose: handleClose,
64
+ onSubmit: handleSubmit
65
+ }, null, 8, ["BASE_API", "userInfo", "maxcount", "filterOptions"])
66
+ ]),
67
+ _: 1
68
+ }, 8, ["visible"])) : createCommentVNode("v-if", true)
69
+ ]);
222
70
  };
223
71
  }
224
72
  });
@@ -0,0 +1,215 @@
1
+ import { defineComponent, ref, provide, computed, openBlock, createElementBlock, createCommentVNode, createElementVNode, createVNode, unref, withCtx, withDirectives, vShow, createBlock, createTextVNode } from "vue";
2
+ import { Tabs, Button, TabPane, Scrollbar, Pagination } from "@arco-design/web-vue";
3
+ import { IconClose } from "@arco-design/web-vue/es/icon";
4
+ import emptyData from "../../../emptyData/index.js";
5
+ import _sfc_main$1 from "../ListFilter/index.js";
6
+ import _sfc_main$2 from "../ListContent/index.js";
7
+ import _sfc_main$4 from "../ListSelected/index.js";
8
+ import _sfc_main$3 from "../ListContentLocal/index.js";
9
+ import useAttachement from "../../../hooks/useAttachement.js";
10
+ import { DEFAULT_BASE_API } from "../../../config.js";
11
+ const _hoisted_1 = { class: "resource-select-main" };
12
+ const _hoisted_2 = {
13
+ key: 0,
14
+ class: "resource-select-container"
15
+ };
16
+ const _hoisted_3 = { class: "resource-select-header" };
17
+ const _hoisted_4 = {
18
+ key: 0,
19
+ class: "resource-select-filter"
20
+ };
21
+ const _hoisted_5 = { class: "resource-select-content" };
22
+ const _hoisted_6 = { class: "resource-select-footer" };
23
+ const _hoisted_7 = { class: "footer-left" };
24
+ const _hoisted_8 = {
25
+ key: 0,
26
+ class: "footer-right"
27
+ };
28
+ const _sfc_main = defineComponent({
29
+ __name: "index",
30
+ props: {
31
+ BASE_API: {},
32
+ userInfo: {},
33
+ maxcount: {},
34
+ filterOptions: {}
35
+ },
36
+ emits: ["close", "submit"],
37
+ setup(__props, { emit: __emit }) {
38
+ const props = __props;
39
+ const emits = __emit;
40
+ const BASE_API = props.BASE_API || DEFAULT_BASE_API;
41
+ const activeKey = ref("all");
42
+ provide("userInfo", computed(() => props.userInfo));
43
+ provide("baseAPI", BASE_API);
44
+ const {
45
+ list,
46
+ total,
47
+ limit,
48
+ loading,
49
+ changeKey,
50
+ changeFilter,
51
+ changePage,
52
+ changeSize
53
+ } = useAttachement({ key: "all", BASE_API });
54
+ const selected = ref([]);
55
+ const selectedKeys = computed(() => selected.value.map((item) => item.id));
56
+ const disableSelect = computed(() => props.maxcount && selected.value.length >= props.maxcount);
57
+ function handleSelect(params) {
58
+ const { id } = params;
59
+ const index = selected.value.findIndex((item) => item.id === id);
60
+ if (index > -1)
61
+ selected.value.splice(index, 1);
62
+ else
63
+ selected.value.push(params);
64
+ }
65
+ function handleClear() {
66
+ selected.value = [];
67
+ }
68
+ function handleClose() {
69
+ handleClear();
70
+ emits("close");
71
+ }
72
+ const handleSelectOne = (params) => {
73
+ if (Array.isArray(params))
74
+ emits("submit", params);
75
+ else
76
+ emits("submit", [params]);
77
+ handleClose();
78
+ };
79
+ function handleConfirm() {
80
+ handleSelectOne(selected.value);
81
+ }
82
+ function handleToUpload() {
83
+ changeKey("local");
84
+ activeKey.value = "local";
85
+ }
86
+ return (_ctx, _cache) => {
87
+ return openBlock(), createElementBlock("div", _hoisted_1, [
88
+ _ctx.userInfo ? (openBlock(), createElementBlock("div", _hoisted_2, [
89
+ createCommentVNode(" \u5934\u90E8 "),
90
+ createElementVNode("div", _hoisted_3, [
91
+ createVNode(unref(Tabs), {
92
+ "active-key": activeKey.value,
93
+ "onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
94
+ onChange: unref(changeKey)
95
+ }, {
96
+ extra: withCtx(() => [
97
+ createVNode(unref(Button), {
98
+ type: "secondary",
99
+ shape: "round",
100
+ onClick: handleClose
101
+ }, {
102
+ icon: withCtx(() => [
103
+ createVNode(unref(IconClose))
104
+ ]),
105
+ _: 1
106
+ })
107
+ ]),
108
+ default: withCtx(() => [
109
+ createVNode(unref(TabPane), {
110
+ key: "all",
111
+ title: "\u5168\u90E8\u7D20\u6750"
112
+ }),
113
+ createVNode(unref(TabPane), {
114
+ key: "my",
115
+ title: "\u6211\u7684\u7D20\u6750"
116
+ }),
117
+ createVNode(unref(TabPane), {
118
+ key: "remind",
119
+ title: "\u63D0\u9192\u6211\u7684"
120
+ }),
121
+ createVNode(unref(TabPane), {
122
+ key: "local",
123
+ title: "\u672C\u5730\u7D20\u6750"
124
+ })
125
+ ]),
126
+ _: 1
127
+ }, 8, ["active-key", "onChange"])
128
+ ]),
129
+ createCommentVNode(" \u7B5B\u9009 "),
130
+ activeKey.value !== "local" ? (openBlock(), createElementBlock("div", _hoisted_4, [
131
+ createVNode(_sfc_main$1, {
132
+ "disable-upload-by": activeKey.value !== "all",
133
+ filterOptions: _ctx.filterOptions,
134
+ onChange: unref(changeFilter),
135
+ onUpload: handleToUpload
136
+ }, null, 8, ["disable-upload-by", "filterOptions", "onChange"])
137
+ ])) : createCommentVNode("v-if", true),
138
+ createCommentVNode(" \u5217\u8868\u90E8\u5206 "),
139
+ createElementVNode("div", _hoisted_5, [
140
+ createVNode(unref(Scrollbar), {
141
+ "outer-style": { height: "100%" },
142
+ style: { "height": "100%", "overflow": "auto" }
143
+ }, {
144
+ default: withCtx(() => [
145
+ withDirectives(createVNode(_sfc_main$2, {
146
+ loading: unref(loading),
147
+ list: unref(list),
148
+ disable: disableSelect.value,
149
+ "select-keys": selectedKeys.value,
150
+ onSelect: handleSelect,
151
+ onSelectOne: handleSelectOne
152
+ }, null, 8, ["loading", "list", "disable", "select-keys"]), [
153
+ [vShow, activeKey.value !== "local"]
154
+ ]),
155
+ withDirectives(createVNode(_sfc_main$3, {
156
+ disable: disableSelect.value,
157
+ "select-keys": selectedKeys.value,
158
+ onSelect: handleSelect,
159
+ onSelectOne: handleSelectOne
160
+ }, null, 8, ["disable", "select-keys"]), [
161
+ [vShow, activeKey.value === "local"]
162
+ ])
163
+ ]),
164
+ _: 1
165
+ })
166
+ ]),
167
+ createCommentVNode(" \u5E95\u90E8 "),
168
+ createElementVNode("div", _hoisted_6, [
169
+ createElementVNode("div", _hoisted_7, [
170
+ activeKey.value !== "local" ? (openBlock(), createBlock(unref(Pagination), {
171
+ key: 0,
172
+ total: unref(total),
173
+ "page-size": unref(limit),
174
+ "show-total": "",
175
+ "show-page-size": "",
176
+ "base-size": 3,
177
+ "buffer-size": 1,
178
+ onChange: _cache[1] || (_cache[1] = (e) => unref(changePage)((e - 1) * unref(limit))),
179
+ onPageSizeChange: unref(changeSize)
180
+ }, null, 8, ["total", "page-size", "onPageSizeChange"])) : createCommentVNode("v-if", true)
181
+ ]),
182
+ selected.value.length ? (openBlock(), createElementBlock("div", _hoisted_8, [
183
+ createVNode(_sfc_main$4, {
184
+ maxcount: _ctx.maxcount,
185
+ selected: selected.value,
186
+ onRemove: handleSelect,
187
+ onClear: handleClear
188
+ }, null, 8, ["maxcount", "selected"]),
189
+ createVNode(unref(Button), { onClick: handleClose }, {
190
+ default: withCtx(() => [
191
+ createTextVNode("\u53D6\u6D88")
192
+ ]),
193
+ _: 1
194
+ }),
195
+ createVNode(unref(Button), {
196
+ type: "primary",
197
+ onClick: handleConfirm
198
+ }, {
199
+ default: withCtx(() => [
200
+ createTextVNode("\u786E\u5B9A")
201
+ ]),
202
+ _: 1
203
+ })
204
+ ])) : createCommentVNode("v-if", true)
205
+ ])
206
+ ])) : (openBlock(), createBlock(unref(emptyData), {
207
+ key: 1,
208
+ type: "empty",
209
+ customTip: "\u6682\u65E0\u6743\u9650"
210
+ }))
211
+ ]);
212
+ };
213
+ }
214
+ });
215
+ export { _sfc_main as default };
@@ -155,6 +155,13 @@
155
155
  background-color: #165dff;
156
156
  border-color: #165dff;
157
157
  }
158
+ .resource-select-modal-body {
159
+ height: 70vh;
160
+ padding: 0;
161
+ }
162
+ .resource-select-main {
163
+ height: 100%;
164
+ }
158
165
  .resource-select-drawer .arco-drawer-body {
159
166
  box-sizing: border-box;
160
167
  padding: 0;
@@ -4,6 +4,15 @@
4
4
  @import './listContentLocal.less';
5
5
  @import './listCardWrapper.less';
6
6
 
7
+ .resource-select-modal-body {
8
+ height: 70vh;
9
+ padding: 0;
10
+ }
11
+
12
+ .resource-select-main {
13
+ height: 100%;
14
+ }
15
+
7
16
  .resource-select-drawer {
8
17
  .arco-drawer-body {
9
18
  box-sizing: border-box;
package/lib/index.css CHANGED
@@ -4484,6 +4484,13 @@
4484
4484
  background-color: #165dff;
4485
4485
  border-color: #165dff;
4486
4486
  }
4487
+ .resource-select-modal-body {
4488
+ height: 70vh;
4489
+ padding: 0;
4490
+ }
4491
+ .resource-select-main {
4492
+ height: 100%;
4493
+ }
4487
4494
  .resource-select-drawer .arco-drawer-body {
4488
4495
  box-sizing: border-box;
4489
4496
  padding: 0;