@cmstops/pro-compo 0.3.30 → 0.3.32

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.
Files changed (71) hide show
  1. package/dist/index.css +84 -0
  2. package/dist/index.min.css +1 -1
  3. package/es/hooks/useAttachement.d.ts +20 -0
  4. package/es/hooks/useAttachement.js +95 -0
  5. package/es/hooks/useSelection.d.ts +23 -0
  6. package/es/hooks/useSelection.js +59 -0
  7. package/es/index.css +84 -0
  8. package/es/index.d.ts +2 -0
  9. package/es/index.js +2 -0
  10. package/es/index.less +2 -0
  11. package/es/selectResourceModal/component.d.ts +0 -0
  12. package/es/selectResourceModal/component.js +211 -0
  13. package/es/selectResourceModal/components/ListContent/index.d.ts +0 -0
  14. package/es/selectResourceModal/components/ListContent/index.js +92 -0
  15. package/es/selectResourceModal/components/ListFilter/index.d.ts +0 -0
  16. package/es/selectResourceModal/components/ListFilter/index.js +259 -0
  17. package/es/selectResourceModal/components/ListFilter/scripts/api.d.ts +1 -0
  18. package/es/selectResourceModal/components/ListFilter/scripts/api.js +9 -0
  19. package/es/selectResourceModal/components/ListSelected/index.d.ts +0 -0
  20. package/es/selectResourceModal/components/ListSelected/index.js +91 -0
  21. package/es/selectResourceModal/index.d.ts +2 -0
  22. package/es/selectResourceModal/index.js +7 -0
  23. package/es/selectResourceModal/style/css.js +4 -0
  24. package/es/selectResourceModal/style/index.css +31 -0
  25. package/es/selectResourceModal/style/index.d.ts +4 -0
  26. package/es/selectResourceModal/style/index.js +4 -0
  27. package/es/selectResourceModal/style/index.less +39 -0
  28. package/es/selectResourceModal/style/listContent.less +67 -0
  29. package/es/selectResourceModal/style/listFilter.less +17 -0
  30. package/es/selectResourceModal/style/listSelected.less +67 -0
  31. package/es/selectThumb/component.js +10 -5
  32. package/es/selectThumb/components/card.js +111 -59
  33. package/es/thumbCard/component.d.ts +0 -0
  34. package/es/thumbCard/component.js +114 -0
  35. package/es/thumbCard/index.d.ts +2 -0
  36. package/es/thumbCard/index.js +7 -0
  37. package/es/thumbCard/style/css.js +1 -0
  38. package/es/thumbCard/style/index.css +53 -0
  39. package/es/thumbCard/style/index.d.ts +1 -0
  40. package/es/thumbCard/style/index.js +1 -0
  41. package/es/thumbCard/style/index.less +70 -0
  42. package/es/utils/typeMap.d.ts +19 -0
  43. package/es/utils/typeMap.js +17 -1
  44. package/lib/hooks/useAttachement.js +100 -0
  45. package/lib/hooks/useSelection.js +60 -0
  46. package/lib/index.css +84 -0
  47. package/lib/index.js +4 -0
  48. package/lib/index.less +2 -0
  49. package/lib/selectResourceModal/component.js +212 -0
  50. package/lib/selectResourceModal/components/ListContent/index.js +93 -0
  51. package/lib/selectResourceModal/components/ListFilter/index.js +260 -0
  52. package/lib/selectResourceModal/components/ListFilter/scripts/api.js +11 -0
  53. package/lib/selectResourceModal/components/ListSelected/index.js +92 -0
  54. package/lib/selectResourceModal/index.js +8 -0
  55. package/lib/selectResourceModal/style/css.js +5 -0
  56. package/lib/selectResourceModal/style/index.css +31 -0
  57. package/lib/selectResourceModal/style/index.js +5 -0
  58. package/lib/selectResourceModal/style/index.less +39 -0
  59. package/lib/selectResourceModal/style/listContent.less +67 -0
  60. package/lib/selectResourceModal/style/listFilter.less +17 -0
  61. package/lib/selectResourceModal/style/listSelected.less +67 -0
  62. package/lib/selectThumb/component.js +10 -5
  63. package/lib/selectThumb/components/card.js +110 -58
  64. package/lib/thumbCard/component.js +115 -0
  65. package/lib/thumbCard/index.js +8 -0
  66. package/lib/thumbCard/style/css.js +2 -0
  67. package/lib/thumbCard/style/index.css +53 -0
  68. package/lib/thumbCard/style/index.js +2 -0
  69. package/lib/thumbCard/style/index.less +70 -0
  70. package/lib/utils/typeMap.js +20 -0
  71. package/package.json +2 -2
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var vue = require("vue");
3
+ function getLabelValue(list, options) {
4
+ const { labelStr, valueStr } = options;
5
+ return list.map((item) => {
6
+ return {
7
+ label: item[labelStr],
8
+ value: item[valueStr]
9
+ };
10
+ });
11
+ }
12
+ function useSelection(params) {
13
+ const { func, labelStr, valueStr } = params;
14
+ const lVParams = { labelStr, valueStr };
15
+ const limit = vue.ref(10);
16
+ const offset = vue.ref(0);
17
+ const keyword = vue.ref("");
18
+ const options = vue.ref([]);
19
+ const loading = vue.ref(false);
20
+ const queryParams = vue.computed(() => {
21
+ return {
22
+ limit: limit.value,
23
+ offset: offset.value,
24
+ keyword: keyword.value
25
+ };
26
+ });
27
+ async function load(more) {
28
+ loading.value = !more;
29
+ try {
30
+ const list = await func(queryParams.value);
31
+ if (more) {
32
+ options.value = options.value.concat(getLabelValue(list, lVParams));
33
+ } else {
34
+ options.value = getLabelValue(list, lVParams);
35
+ }
36
+ } catch (e) {
37
+ console.log(e);
38
+ } finally {
39
+ loading.value = false;
40
+ }
41
+ }
42
+ function loadMore() {
43
+ offset.value += limit.value;
44
+ load(true);
45
+ }
46
+ function handleSearch(kw) {
47
+ keyword.value = kw;
48
+ offset.value = 0;
49
+ load();
50
+ }
51
+ return {
52
+ options,
53
+ loading,
54
+ keyword,
55
+ load,
56
+ handleSearch,
57
+ loadMore
58
+ };
59
+ }
60
+ module.exports = useSelection;
package/lib/index.css CHANGED
@@ -4243,3 +4243,87 @@
4243
4243
  color: #fff;
4244
4244
  font-size: 18px;
4245
4245
  }
4246
+ .thumb-select-wrapper {
4247
+ position: relative;
4248
+ display: flex;
4249
+ align-items: center;
4250
+ justify-content: center;
4251
+ width: 100%;
4252
+ height: 100%;
4253
+ overflow: hidden;
4254
+ border-radius: 2px;
4255
+ cursor: pointer;
4256
+ }
4257
+ .thumb-select-wrapper .thumb-add {
4258
+ color: var(--color-text-2);
4259
+ font-size: 16px;
4260
+ cursor: pointer;
4261
+ }
4262
+ .thumb-select-wrapper .thumb-image img {
4263
+ width: 100%;
4264
+ height: 100%;
4265
+ }
4266
+ .thumb-select-wrapper .thumb-handler-list {
4267
+ position: absolute;
4268
+ bottom: 0;
4269
+ display: flex;
4270
+ gap: 10px;
4271
+ align-items: center;
4272
+ justify-content: center;
4273
+ width: 100%;
4274
+ height: 40px;
4275
+ opacity: 0;
4276
+ transition: all 0.3s ease-in-out;
4277
+ }
4278
+ .thumb-select-wrapper .thumb-handler-list .handler-item {
4279
+ padding: 0 8px;
4280
+ color: #fff;
4281
+ font-size: 12px;
4282
+ line-height: 26px;
4283
+ background-color: #000000b3;
4284
+ border-radius: 2px;
4285
+ cursor: pointer;
4286
+ }
4287
+ .thumb-select-wrapper .thumb-handler-list .handler-item:hover {
4288
+ color: rgba(255, 255, 255, 0.7);
4289
+ }
4290
+ .thumb-select-wrapper:hover .thumb-handler-list {
4291
+ opacity: 1;
4292
+ }
4293
+ .arco-dropdown-option-content {
4294
+ display: flex;
4295
+ gap: 8px;
4296
+ align-items: center;
4297
+ font-size: 14px;
4298
+ }
4299
+ .resource-select-container {
4300
+ display: flex;
4301
+ flex-direction: column;
4302
+ gap: 10px;
4303
+ box-sizing: border-box;
4304
+ height: 100%;
4305
+ }
4306
+ .resource-select-container .resource-select-filter,
4307
+ .resource-select-container .resource-select-content,
4308
+ .resource-select-container .resource-select-footer {
4309
+ padding: 0 16px 0;
4310
+ }
4311
+ .resource-select-container .resource-select-header .arco-tabs-nav::before {
4312
+ display: none;
4313
+ }
4314
+ .resource-select-container .resource-select-header .arco-tabs-content {
4315
+ display: none !important;
4316
+ }
4317
+ .resource-select-container .resource-select-content {
4318
+ flex: 1;
4319
+ overflow: hidden;
4320
+ }
4321
+ .resource-select-container .resource-select-footer {
4322
+ display: flex;
4323
+ justify-content: space-between;
4324
+ }
4325
+ .resource-select-container .resource-select-footer .footer-right {
4326
+ display: flex;
4327
+ gap: 10px;
4328
+ align-items: center;
4329
+ }
package/lib/index.js CHANGED
@@ -24,6 +24,8 @@ var index$j = require("./dataTags/index.js");
24
24
  var index$k = require("./colorPalette/index.js");
25
25
  var index$l = require("./resourceGridList/index.js");
26
26
  var index$m = require("./mediaView/index.js");
27
+ var index$n = require("./thumbCard/index.js");
28
+ var index$o = require("./selectResourceModal/index.js");
27
29
  exports["default"] = components;
28
30
  exports.appCenter = index;
29
31
  exports.messageBox = index$1;
@@ -48,3 +50,5 @@ exports.dataTags = index$j;
48
50
  exports.colorPalette = index$k;
49
51
  exports.resourceGridList = index$l;
50
52
  exports.mediaView = index$m;
53
+ exports.thumbCard = index$n;
54
+ exports.selectResourceModal = index$o;
package/lib/index.less CHANGED
@@ -22,3 +22,5 @@
22
22
  @import './colorPalette/style/index.less';
23
23
  @import './resourceGridList/style/index.less';
24
24
  @import './mediaView/style/index.less';
25
+ @import './thumbCard/style/index.less';
26
+ @import './selectResourceModal/style/index.less';
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ var vue = require("vue");
3
+ var webVue = require("@arco-design/web-vue");
4
+ var index$3 = require("../emptyData/index.js");
5
+ var index = require("./components/ListFilter/index.js");
6
+ var index$1 = require("./components/ListContent/index.js");
7
+ var index$2 = require("./components/ListSelected/index.js");
8
+ var useAttachement = require("../hooks/useAttachement.js");
9
+ var config = require("../config.js");
10
+ const _hoisted_1 = {
11
+ key: 0,
12
+ class: "resource-select-container"
13
+ };
14
+ const _hoisted_2 = { class: "resource-select-header" };
15
+ const _hoisted_3 = {
16
+ key: 0,
17
+ class: "resource-select-filter"
18
+ };
19
+ const _hoisted_4 = { class: "resource-select-content" };
20
+ const _hoisted_5 = { class: "resource-select-footer" };
21
+ const _hoisted_6 = { class: "footer-left" };
22
+ const _hoisted_7 = {
23
+ key: 0,
24
+ class: "footer-right"
25
+ };
26
+ const _sfc_main = vue.defineComponent({
27
+ ...{ name: "selectResourceModal" },
28
+ __name: "component",
29
+ props: {
30
+ BASE_API: {},
31
+ visible: { type: Boolean },
32
+ userInfo: {},
33
+ maxcount: {}
34
+ },
35
+ emits: ["update:visible", "submit"],
36
+ setup(__props, { emit: __emit }) {
37
+ const props = __props;
38
+ const emits = __emit;
39
+ const BASE_API = props.BASE_API || config.DEFAULT_BASE_API;
40
+ const activeKey = vue.ref("all");
41
+ vue.provide("userInfo", vue.computed(() => props.userInfo));
42
+ vue.provide("baseAPI", BASE_API);
43
+ const {
44
+ list,
45
+ total,
46
+ limit,
47
+ loading,
48
+ changeKey,
49
+ changeFilter,
50
+ changePage,
51
+ changeSize,
52
+ loadData
53
+ } = useAttachement["default"]({ key: "all", BASE_API });
54
+ const selected = vue.ref([]);
55
+ const selectedKeys = vue.computed(() => selected.value.map((item) => item.id));
56
+ const disableSelect = vue.computed(() => props.maxcount && selected.value.length >= props.maxcount);
57
+ function handleSelect(params) {
58
+ const { id } = params;
59
+ const index2 = selected.value.findIndex((item) => item.id === id);
60
+ if (index2 > -1)
61
+ selected.value.splice(index2, 1);
62
+ else
63
+ selected.value.push(params);
64
+ }
65
+ function handleClear() {
66
+ selected.value = [];
67
+ }
68
+ function handleClose() {
69
+ handleClear();
70
+ emits("update:visible", false);
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
+ vue.onMounted(() => {
87
+ loadData();
88
+ });
89
+ return (_ctx, _cache) => {
90
+ return vue.openBlock(), vue.createBlock(vue.unref(webVue.Drawer), {
91
+ visible: _ctx.visible,
92
+ width: "1024px",
93
+ header: false,
94
+ footer: false
95
+ }, {
96
+ default: vue.withCtx(() => [
97
+ _ctx.userInfo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
98
+ vue.createCommentVNode(" \u5934\u90E8 "),
99
+ vue.createElementVNode("div", _hoisted_2, [
100
+ vue.createVNode(vue.unref(webVue.Tabs), {
101
+ "active-key": activeKey.value,
102
+ "onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
103
+ onChange: vue.unref(changeKey)
104
+ }, {
105
+ extra: vue.withCtx(() => [
106
+ vue.createVNode(vue.unref(webVue.Button), {
107
+ type: "text",
108
+ onClick: handleClose
109
+ }, {
110
+ default: vue.withCtx(() => [
111
+ vue.createTextVNode("\u5173\u95ED")
112
+ ]),
113
+ _: 1
114
+ })
115
+ ]),
116
+ default: vue.withCtx(() => [
117
+ vue.createVNode(vue.unref(webVue.TabPane), {
118
+ key: "all",
119
+ title: "\u5168\u90E8\u7D20\u6750"
120
+ }),
121
+ vue.createVNode(vue.unref(webVue.TabPane), {
122
+ key: "my",
123
+ title: "\u6211\u7684\u7D20\u6750"
124
+ }),
125
+ vue.createVNode(vue.unref(webVue.TabPane), {
126
+ key: "remind",
127
+ title: "\u63D0\u9192\u6211\u7684"
128
+ }),
129
+ vue.createVNode(vue.unref(webVue.TabPane), {
130
+ key: "local",
131
+ title: "\u672C\u5730\u7D20\u6750"
132
+ })
133
+ ]),
134
+ _: 1
135
+ }, 8, ["active-key", "onChange"])
136
+ ]),
137
+ vue.createCommentVNode(" \u7B5B\u9009 "),
138
+ activeKey.value !== "local" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
139
+ vue.createVNode(index, {
140
+ "disable-upload-by": activeKey.value !== "all",
141
+ onChange: vue.unref(changeFilter),
142
+ onUpload: handleToUpload
143
+ }, null, 8, ["disable-upload-by", "onChange"])
144
+ ])) : vue.createCommentVNode("v-if", true),
145
+ vue.createCommentVNode(" \u5217\u8868\u90E8\u5206 "),
146
+ vue.createElementVNode("div", _hoisted_4, [
147
+ vue.createVNode(vue.unref(webVue.Scrollbar), {
148
+ "outer-style": { height: "100%" },
149
+ style: { "height": "100%", "overflow": "auto" }
150
+ }, {
151
+ default: vue.withCtx(() => [
152
+ vue.createVNode(index$1, {
153
+ loading: vue.unref(loading),
154
+ list: vue.unref(list),
155
+ disable: disableSelect.value,
156
+ "select-keys": selectedKeys.value,
157
+ onSelect: handleSelect,
158
+ onSelectOne: handleSelectOne
159
+ }, null, 8, ["loading", "list", "disable", "select-keys"])
160
+ ]),
161
+ _: 1
162
+ })
163
+ ]),
164
+ vue.createCommentVNode(" \u5E95\u90E8 "),
165
+ vue.createElementVNode("div", _hoisted_5, [
166
+ vue.createElementVNode("div", _hoisted_6, [
167
+ activeKey.value !== "local" ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Pagination), {
168
+ key: 0,
169
+ total: vue.unref(total),
170
+ "page-size": vue.unref(limit),
171
+ "show-total": "",
172
+ "show-page-size": "",
173
+ onChange: _cache[1] || (_cache[1] = (e) => vue.unref(changePage)((e - 1) * vue.unref(limit))),
174
+ onPageSizeChange: vue.unref(changeSize)
175
+ }, null, 8, ["total", "page-size", "onPageSizeChange"])) : vue.createCommentVNode("v-if", true)
176
+ ]),
177
+ selected.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
178
+ vue.createVNode(index$2, {
179
+ maxcount: _ctx.maxcount,
180
+ selected: selected.value,
181
+ onRemove: handleSelect,
182
+ onClear: handleClear
183
+ }, null, 8, ["maxcount", "selected"]),
184
+ vue.createVNode(vue.unref(webVue.Button), { onClick: handleClose }, {
185
+ default: vue.withCtx(() => [
186
+ vue.createTextVNode("\u53D6\u6D88")
187
+ ]),
188
+ _: 1
189
+ }),
190
+ vue.createVNode(vue.unref(webVue.Button), {
191
+ type: "primary",
192
+ onClick: handleConfirm
193
+ }, {
194
+ default: vue.withCtx(() => [
195
+ vue.createTextVNode("\u786E\u5B9A")
196
+ ]),
197
+ _: 1
198
+ })
199
+ ])) : vue.createCommentVNode("v-if", true)
200
+ ])
201
+ ])) : (vue.openBlock(), vue.createBlock(vue.unref(index$3), {
202
+ key: 1,
203
+ type: "empty",
204
+ customTip: "\u6682\u65E0\u6743\u9650"
205
+ }))
206
+ ]),
207
+ _: 1
208
+ }, 8, ["visible"]);
209
+ };
210
+ }
211
+ });
212
+ module.exports = _sfc_main;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var vue = require("vue");
3
+ var webVue = require("@arco-design/web-vue");
4
+ var index$1 = require("../../../emptyData/index.js");
5
+ var index = require("../../../thumbCard/index.js");
6
+ const _hoisted_1 = { class: "card-list-wrapper" };
7
+ const _hoisted_2 = { class: "card-wrapper" };
8
+ const _hoisted_3 = { class: "card-alias" };
9
+ const _hoisted_4 = ["onClick"];
10
+ const _hoisted_5 = {
11
+ key: 0,
12
+ class: "check-box active"
13
+ };
14
+ const _hoisted_6 = {
15
+ key: 1,
16
+ class: "check-box"
17
+ };
18
+ const _sfc_main = vue.defineComponent({
19
+ __name: "index",
20
+ props: {
21
+ loading: { type: Boolean },
22
+ list: {},
23
+ selectKeys: {},
24
+ disable: { type: Boolean }
25
+ },
26
+ emits: ["select", "select-one"],
27
+ setup(__props, { emit: __emit }) {
28
+ const props = __props;
29
+ const emits = __emit;
30
+ const handlersKey = vue.computed(() => {
31
+ var _a;
32
+ if (((_a = props.selectKeys) == null ? void 0 : _a.length) > 0 || props.disable)
33
+ return [];
34
+ return [{ label: "\u9009\u7528", key: "select" }];
35
+ });
36
+ function handleOption(params) {
37
+ const { key, item } = params;
38
+ if (key === "select") {
39
+ emits("select-one", item);
40
+ }
41
+ }
42
+ function handleCheck(params) {
43
+ emits("select", params);
44
+ }
45
+ const selectedOrder = vue.computed(() => {
46
+ var _a;
47
+ const result = {};
48
+ (_a = props.selectKeys) == null ? void 0 : _a.forEach((key, index2) => {
49
+ result[key] = index2 + 1;
50
+ });
51
+ return result;
52
+ });
53
+ return (_ctx, _cache) => {
54
+ var _a, _b;
55
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
56
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.list, (item) => {
57
+ return vue.openBlock(), vue.createElementBlock("div", {
58
+ key: item.id,
59
+ class: "card-wrapper-image"
60
+ }, [
61
+ vue.createElementVNode("div", _hoisted_2, [
62
+ vue.createVNode(vue.unref(index), {
63
+ url: item.url,
64
+ thumb: item.thumb,
65
+ catalog: item.catalog,
66
+ meta: item,
67
+ "handlers-key": handlersKey.value,
68
+ onHandle: handleOption
69
+ }, null, 8, ["url", "thumb", "catalog", "meta", "handlers-key"])
70
+ ]),
71
+ vue.createElementVNode("div", _hoisted_3, vue.toDisplayString(item.alias), 1),
72
+ vue.createElementVNode("div", {
73
+ class: "check-box-wrapper",
74
+ onClick: () => handleCheck(item)
75
+ }, [
76
+ selectedOrder.value[item.id] ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, vue.toDisplayString(selectedOrder.value[item.id]), 1)) : !_ctx.disable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6)) : vue.createCommentVNode("v-if", true)
77
+ ], 8, _hoisted_4)
78
+ ]);
79
+ }), 128)),
80
+ vue.createCommentVNode(" \u7A7A\u72B6\u6001 "),
81
+ ((_a = _ctx.list) == null ? void 0 : _a.length) === 0 && _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Spin), {
82
+ key: 0,
83
+ loading: true
84
+ })) : !((_b = _ctx.list) == null ? void 0 : _b.length) ? (vue.openBlock(), vue.createBlock(vue.unref(index$1), {
85
+ key: 1,
86
+ type: "empty",
87
+ customTip: "\u6682\u65E0\u6570\u636E"
88
+ })) : vue.createCommentVNode("v-if", true)
89
+ ]);
90
+ };
91
+ }
92
+ });
93
+ module.exports = _sfc_main;