@fmdevui/fm-dev 1.0.9 → 1.0.11

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 (64) hide show
  1. package/es/core/index.d.ts +2 -0
  2. package/es/core/ui/components/index.d.ts +2 -0
  3. package/es/core/ui/components/noticeBar/index.vue.d.ts +114 -0
  4. package/es/core/ui/components/noticeBar/style/css.d.ts +1 -0
  5. package/es/core/ui/components/noticeBar/style/index.d.ts +1 -0
  6. package/es/core/ui/components/svgIcon/index.d.ts +7 -0
  7. package/es/core/ui/components/svgIcon/svgicon.vue.d.ts +27 -0
  8. package/es/core/ui/components/transfer/index.vue.d.ts +59 -0
  9. package/es/core/ui/components/transfer/style/css.d.ts +1 -0
  10. package/es/core/ui/components/transfer/style/index.d.ts +1 -0
  11. package/es/core/ui/loading/index.d.ts +9 -0
  12. package/es/index.mjs +2 -0
  13. package/es/packages/core/index.mjs +2 -0
  14. package/es/packages/core/ui/components/index.mjs +18 -0
  15. package/es/packages/core/ui/components/noticeBar/index.vue.mjs +5 -0
  16. package/es/packages/core/ui/components/noticeBar/index.vue2.mjs +126 -0
  17. package/es/packages/core/ui/components/noticeBar/style/css.mjs +1 -0
  18. package/es/packages/core/ui/components/noticeBar/style/index.mjs +1 -0
  19. package/es/packages/core/ui/components/svgIcon/index.mjs +13 -0
  20. package/es/packages/core/ui/components/svgIcon/svgicon.vue.mjs +5 -0
  21. package/es/packages/core/ui/components/svgIcon/svgicon.vue2.mjs +87 -0
  22. package/es/packages/core/ui/components/transfer/index.vue.mjs +5 -0
  23. package/es/packages/core/ui/components/transfer/index.vue2.mjs +370 -0
  24. package/es/packages/core/ui/components/transfer/style/css.mjs +1 -0
  25. package/es/packages/core/ui/components/transfer/style/index.mjs +1 -0
  26. package/es/packages/core/ui/loading/index.mjs +40 -0
  27. package/index.css +1 -0
  28. package/index.js +6692 -3
  29. package/index.min.js +43 -24
  30. package/index.min.mjs +42 -23
  31. package/index.mjs +6692 -5
  32. package/lib/core/index.d.ts +2 -0
  33. package/lib/core/ui/components/index.d.ts +2 -0
  34. package/lib/core/ui/components/noticeBar/index.vue.d.ts +114 -0
  35. package/lib/core/ui/components/noticeBar/style/css.d.ts +1 -0
  36. package/lib/core/ui/components/noticeBar/style/index.d.ts +1 -0
  37. package/lib/core/ui/components/svgIcon/index.d.ts +7 -0
  38. package/lib/core/ui/components/svgIcon/svgicon.vue.d.ts +27 -0
  39. package/lib/core/ui/components/transfer/index.vue.d.ts +59 -0
  40. package/lib/core/ui/components/transfer/style/css.d.ts +1 -0
  41. package/lib/core/ui/components/transfer/style/index.d.ts +1 -0
  42. package/lib/core/ui/loading/index.d.ts +9 -0
  43. package/lib/index.js +47 -43
  44. package/lib/packages/core/index.js +47 -43
  45. package/lib/packages/core/ui/components/index.js +20 -0
  46. package/lib/packages/core/ui/components/noticeBar/index.vue.js +9 -0
  47. package/lib/packages/core/ui/components/noticeBar/index.vue2.js +130 -0
  48. package/lib/packages/core/ui/components/noticeBar/style/css.js +4 -0
  49. package/lib/packages/core/ui/components/noticeBar/style/index.js +4 -0
  50. package/lib/packages/core/ui/components/svgIcon/index.js +34 -0
  51. package/lib/packages/core/ui/components/svgIcon/svgicon.vue.js +9 -0
  52. package/lib/packages/core/ui/components/svgIcon/svgicon.vue2.js +91 -0
  53. package/lib/packages/core/ui/components/transfer/index.vue.js +9 -0
  54. package/lib/packages/core/ui/components/transfer/index.vue2.js +374 -0
  55. package/lib/packages/core/ui/components/transfer/style/css.js +4 -0
  56. package/lib/packages/core/ui/components/transfer/style/index.js +4 -0
  57. package/lib/packages/core/ui/loading/index.js +42 -0
  58. package/package.json +1 -1
  59. package/theme-chalk/index.css +1 -0
  60. package/theme-chalk/src/index.scss +2 -0
  61. package/theme-chalk/src/t-noticebar.scss +32 -0
  62. package/theme-chalk/src/t-transfer.scss +46 -0
  63. package/theme-chalk/t-t-noticebar.css +1 -0
  64. package/theme-chalk/t-t-transfer.css +1 -0
@@ -0,0 +1,370 @@
1
+ import { defineComponent, reactive, computed, watch, resolveComponent, createBlock, openBlock, withCtx, createVNode, createElementVNode, createTextVNode, toDisplayString, withDirectives, createElementBlock, Fragment, renderList, vShow } from 'vue';
2
+
3
+ const _hoisted_1 = { class: "fm-transfer-panel" };
4
+ const _hoisted_2 = { class: "fm-transfer-panel__header" };
5
+ const _hoisted_3 = { class: "fm-transfer-panel__body" };
6
+ const _hoisted_4 = { class: "fm-transfer-buttons__item" };
7
+ const _hoisted_5 = { class: "fm-transfer-buttons__item" };
8
+ const _hoisted_6 = { class: "fm-transfer-buttons__item" };
9
+ const _hoisted_7 = { class: "fm-transfer-buttons__item" };
10
+ const _hoisted_8 = { class: "fm-transfer-panel" };
11
+ const _hoisted_9 = { class: "fm-transfer-panel__header" };
12
+ const _hoisted_10 = { class: "fm-transfer-panel__body" };
13
+ var _sfc_main = /* @__PURE__ */ defineComponent({
14
+ ...{
15
+ name: "FmTransfer"
16
+ },
17
+ __name: "index",
18
+ props: {
19
+ leftTitle: String,
20
+ rightTitle: String,
21
+ options: {
22
+ type: Object,
23
+ default: () => ({
24
+ value: "id",
25
+ label: "name",
26
+ disabled: "disabled"
27
+ })
28
+ },
29
+ leftData: { type: Array, default: () => [] },
30
+ // 左边全部数据
31
+ rightData: { type: Array, default: () => [] }
32
+ // 右边全部数据
33
+ },
34
+ emits: ["left", "right", "allLeft", "allRight", "update:leftData", "update:rightData"],
35
+ setup(__props, { emit: __emit }) {
36
+ const props = __props;
37
+ const emits = __emit;
38
+ const state = reactive({
39
+ leftAllChecked: false,
40
+ // 左边是否全选
41
+ leftKeyword: "",
42
+ // 左边搜索关键词
43
+ leftChecked: [],
44
+ // 左边选中数据
45
+ rightAllChecked: false,
46
+ // 右边是否全选
47
+ rightKeyword: "",
48
+ // 右边搜索关键词
49
+ rightChecked: []
50
+ // 右边选中数据
51
+ });
52
+ const leftFilterData = computed(() => {
53
+ let result = props.leftData.filter((e) => e[props.options.label].toLowerCase().includes(state.leftKeyword.toLowerCase()));
54
+ if (state.leftChecked.length > 0) {
55
+ for (let i = state.leftChecked.length - 1; i >= 0; i--) {
56
+ const index = result.findIndex((e) => e[props.options.value] == state.leftChecked[i]);
57
+ if (index == -1) state.leftChecked.splice(i, 1);
58
+ }
59
+ }
60
+ return result;
61
+ });
62
+ const handleLeftAllChecked = (value) => {
63
+ state.leftChecked = value ? leftFilterData.value.filter((e) => e[props.options.disabled] == false).map((e) => e[props.options.value]) : [];
64
+ };
65
+ const leftIndeterminate = computed(() => {
66
+ const checkedLength = state.leftChecked.length;
67
+ const result = checkedLength > 0 && checkedLength < leftFilterData.value.filter((e) => e[props.options.disabled] == false).length;
68
+ return result;
69
+ });
70
+ watch(
71
+ () => state.leftChecked,
72
+ (val) => {
73
+ state.leftAllChecked = val.length > 0 && val.length == leftFilterData.value.filter((e) => e[props.options.disabled] == false).length;
74
+ }
75
+ );
76
+ const rightFilterData = computed(() => {
77
+ let result = props.rightData.filter((e) => e[props.options.label].toLowerCase().includes(state.rightKeyword.toLowerCase()));
78
+ if (state.rightChecked.length > 0) {
79
+ for (let i = state.rightChecked.length - 1; i >= 0; i--) {
80
+ const index = result.findIndex((e) => e[props.options.value] == state.rightChecked[i]);
81
+ if (index == -1) state.rightChecked.splice(i, 1);
82
+ }
83
+ }
84
+ return result;
85
+ });
86
+ const handleRightAllChecked = (value) => {
87
+ state.rightChecked = value ? rightFilterData.value.filter((e) => e[props.options.disabled] == false).map((e) => e[props.options.value]) : [];
88
+ };
89
+ const rightIndeterminate = computed(() => {
90
+ const checkedLength = state.rightChecked.length;
91
+ const result = checkedLength > 0 && checkedLength < rightFilterData.value.filter((e) => e[props.options.disabled] == false).length;
92
+ return result;
93
+ });
94
+ watch(
95
+ () => state.rightChecked,
96
+ (val) => {
97
+ state.rightAllChecked = val.length > 0 && val.length == rightFilterData.value.filter((e) => e[props.options.disabled] == false).length;
98
+ }
99
+ );
100
+ const dbClickToRight = (item) => {
101
+ if (item[props.options.value] && item[props.options.disabled] === false) {
102
+ let adds = props.leftData.filter((e) => item[props.options.value] == e[props.options.value]);
103
+ let cuts = props.leftData.filter((e) => item[props.options.value] != e[props.options.value]);
104
+ emits("update:leftData", cuts);
105
+ emits("update:rightData", props.rightData.concat(adds));
106
+ emits("right");
107
+ state.leftChecked = state.leftChecked.filter((e) => item[props.options.value] != e);
108
+ }
109
+ };
110
+ const toRight = () => {
111
+ if (state.leftChecked?.length > 0) {
112
+ let adds = props.leftData.filter((e) => state.leftChecked.some((x) => x == e[props.options.value]));
113
+ let cuts = props.leftData.filter((e) => state.leftChecked.every((x) => x != e[props.options.value]));
114
+ emits("update:leftData", cuts);
115
+ emits("update:rightData", props.rightData.concat(adds));
116
+ emits("right");
117
+ state.leftChecked = [];
118
+ }
119
+ };
120
+ const allToRight = () => {
121
+ if (leftFilterData.value?.length > 0) {
122
+ let temp = leftFilterData.value.filter((e) => e[props.options.disabled] == false);
123
+ let adds = props.leftData.filter((e) => temp.some((x) => x[props.options.value] == e[props.options.value]));
124
+ let cuts = props.leftData.filter((e) => temp.every((x) => x[props.options.value] != e[props.options.value]));
125
+ emits("update:leftData", cuts);
126
+ emits("update:rightData", props.rightData.concat(adds));
127
+ emits("allRight");
128
+ state.leftChecked = [];
129
+ }
130
+ };
131
+ const dbClickToLeft = (item) => {
132
+ if (item[props.options.value] && item[props.options.disabled] === false) {
133
+ let adds = props.rightData.filter((e) => item[props.options.value] == e[props.options.value]);
134
+ let cuts = props.rightData.filter((e) => item[props.options.value] != e[props.options.value]);
135
+ emits("update:leftData", props.leftData.concat(adds));
136
+ emits("update:rightData", cuts);
137
+ emits("left");
138
+ state.rightChecked = state.rightChecked.filter((e) => item[props.options.value] != e);
139
+ }
140
+ };
141
+ const toLeft = () => {
142
+ if (state.rightChecked?.length > 0) {
143
+ let adds = props.rightData.filter((e) => state.rightChecked.some((x) => x == e[props.options.value]));
144
+ let cuts = props.rightData.filter((e) => state.rightChecked.every((x) => x != e[props.options.value]));
145
+ emits("update:leftData", props.leftData.concat(adds));
146
+ emits("update:rightData", cuts);
147
+ emits("left");
148
+ state.rightChecked = [];
149
+ }
150
+ };
151
+ const allToLeft = () => {
152
+ if (rightFilterData.value?.length > 0) {
153
+ let temp = rightFilterData.value.filter((e) => e[props.options.disabled] == false);
154
+ let adds = props.rightData.filter((e) => temp.some((x) => x[props.options.value] == e[props.options.value]));
155
+ let cuts = props.rightData.filter((e) => temp.every((x) => x[props.options.value] != e[props.options.value]));
156
+ emits("update:leftData", props.leftData.concat(adds));
157
+ emits("update:rightData", cuts);
158
+ emits("allLeft");
159
+ state.rightChecked = [];
160
+ }
161
+ };
162
+ return (_ctx, _cache) => {
163
+ const _component_el_checkbox = resolveComponent("el-checkbox");
164
+ const _component_el_input = resolveComponent("el-input");
165
+ const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
166
+ const _component_el_col = resolveComponent("el-col");
167
+ const _component_el_button = resolveComponent("el-button");
168
+ const _component_el_row = resolveComponent("el-row");
169
+ return openBlock(), createBlock(_component_el_row, { gutter: 10 }, {
170
+ default: withCtx(() => [
171
+ createVNode(_component_el_col, { span: 10 }, {
172
+ default: withCtx(() => [
173
+ createElementVNode("div", _hoisted_1, [
174
+ createElementVNode("p", _hoisted_2, [
175
+ createVNode(_component_el_checkbox, {
176
+ modelValue: state.leftAllChecked,
177
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.leftAllChecked = $event),
178
+ indeterminate: leftIndeterminate.value,
179
+ "validate-event": false,
180
+ onChange: handleLeftAllChecked
181
+ }, {
182
+ default: withCtx(() => [
183
+ createTextVNode(
184
+ toDisplayString(props.leftTitle),
185
+ 1
186
+ /* TEXT */
187
+ )
188
+ ]),
189
+ _: 1
190
+ /* STABLE */
191
+ }, 8, ["modelValue", "indeterminate"]),
192
+ createElementVNode(
193
+ "span",
194
+ null,
195
+ toDisplayString(state.leftChecked.length) + "/" + toDisplayString(props.leftData.length),
196
+ 1
197
+ /* TEXT */
198
+ )
199
+ ]),
200
+ createElementVNode("div", _hoisted_3, [
201
+ createVNode(_component_el_input, {
202
+ class: "transfer-panel__filter",
203
+ modelValue: state.leftKeyword,
204
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => state.leftKeyword = $event),
205
+ placeholder: "\u641C\u7D22",
206
+ "prefix-icon": "ele-Search",
207
+ clearable: "",
208
+ "validate-event": false
209
+ }, null, 8, ["modelValue"]),
210
+ withDirectives(createVNode(_component_el_checkbox_group, {
211
+ modelValue: state.leftChecked,
212
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => state.leftChecked = $event),
213
+ "validate-event": false,
214
+ class: "fm-transfer-panel__list"
215
+ }, {
216
+ default: withCtx(() => [
217
+ (openBlock(true), createElementBlock(
218
+ Fragment,
219
+ null,
220
+ renderList(leftFilterData.value, (item, index) => {
221
+ return openBlock(), createBlock(_component_el_checkbox, {
222
+ key: index,
223
+ value: item[props.options.value],
224
+ label: item[props.options.label],
225
+ disabled: item[props.options.disabled],
226
+ "validate-event": false,
227
+ class: "fm-transfer-panel__item",
228
+ onDblclick: ($event) => dbClickToRight(item)
229
+ }, null, 8, ["value", "label", "disabled", "onDblclick"]);
230
+ }),
231
+ 128
232
+ /* KEYED_FRAGMENT */
233
+ ))
234
+ ]),
235
+ _: 1
236
+ /* STABLE */
237
+ }, 8, ["modelValue"]), [
238
+ [vShow, true]
239
+ ])
240
+ ])
241
+ ])
242
+ ]),
243
+ _: 1
244
+ /* STABLE */
245
+ }),
246
+ createVNode(_component_el_col, {
247
+ span: 4,
248
+ class: "fm-transfer-buttons"
249
+ }, {
250
+ default: withCtx(() => [
251
+ createElementVNode("div", _hoisted_4, [
252
+ createVNode(_component_el_button, {
253
+ type: "primary",
254
+ style: {},
255
+ icon: "ele-ArrowRight",
256
+ onClick: toRight
257
+ })
258
+ ]),
259
+ createElementVNode("div", _hoisted_5, [
260
+ createVNode(_component_el_button, {
261
+ type: "primary",
262
+ style: {},
263
+ icon: "ele-ArrowLeft",
264
+ onClick: toLeft
265
+ })
266
+ ]),
267
+ createElementVNode("div", _hoisted_6, [
268
+ createVNode(_component_el_button, {
269
+ type: "primary",
270
+ style: {},
271
+ icon: "ele-DArrowRight",
272
+ onClick: allToRight
273
+ })
274
+ ]),
275
+ createElementVNode("div", _hoisted_7, [
276
+ createVNode(_component_el_button, {
277
+ type: "primary",
278
+ style: {},
279
+ icon: "ele-DArrowLeft",
280
+ onClick: allToLeft
281
+ })
282
+ ])
283
+ ]),
284
+ _: 1
285
+ /* STABLE */
286
+ }),
287
+ createVNode(_component_el_col, { span: 10 }, {
288
+ default: withCtx(() => [
289
+ createElementVNode("div", _hoisted_8, [
290
+ createElementVNode("p", _hoisted_9, [
291
+ createVNode(_component_el_checkbox, {
292
+ modelValue: state.rightAllChecked,
293
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => state.rightAllChecked = $event),
294
+ indeterminate: rightIndeterminate.value,
295
+ "validate-event": false,
296
+ onChange: handleRightAllChecked
297
+ }, {
298
+ default: withCtx(() => [
299
+ createTextVNode(
300
+ toDisplayString(props.rightTitle),
301
+ 1
302
+ /* TEXT */
303
+ )
304
+ ]),
305
+ _: 1
306
+ /* STABLE */
307
+ }, 8, ["modelValue", "indeterminate"]),
308
+ createElementVNode(
309
+ "span",
310
+ null,
311
+ toDisplayString(state.rightChecked.length) + "/" + toDisplayString(props.rightData.length),
312
+ 1
313
+ /* TEXT */
314
+ )
315
+ ]),
316
+ createElementVNode("div", _hoisted_10, [
317
+ createVNode(_component_el_input, {
318
+ class: "transfer-panel__filter",
319
+ modelValue: state.rightKeyword,
320
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => state.rightKeyword = $event),
321
+ placeholder: "\u641C\u7D22",
322
+ "prefix-icon": "ele-Search",
323
+ clearable: "",
324
+ "validate-event": false
325
+ }, null, 8, ["modelValue"]),
326
+ withDirectives(createVNode(_component_el_checkbox_group, {
327
+ modelValue: state.rightChecked,
328
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => state.rightChecked = $event),
329
+ "validate-event": false,
330
+ class: "fm-transfer-panel__list"
331
+ }, {
332
+ default: withCtx(() => [
333
+ (openBlock(true), createElementBlock(
334
+ Fragment,
335
+ null,
336
+ renderList(rightFilterData.value, (item, index) => {
337
+ return openBlock(), createBlock(_component_el_checkbox, {
338
+ key: index,
339
+ value: item[props.options.value],
340
+ label: item[props.options.label],
341
+ disabled: item[props.options.disabled],
342
+ "validate-event": false,
343
+ class: "fm-transfer-panel__item",
344
+ onDblclick: ($event) => dbClickToLeft(item)
345
+ }, null, 8, ["value", "label", "disabled", "onDblclick"]);
346
+ }),
347
+ 128
348
+ /* KEYED_FRAGMENT */
349
+ ))
350
+ ]),
351
+ _: 1
352
+ /* STABLE */
353
+ }, 8, ["modelValue"]), [
354
+ [vShow, true]
355
+ ])
356
+ ])
357
+ ])
358
+ ]),
359
+ _: 1
360
+ /* STABLE */
361
+ })
362
+ ]),
363
+ _: 1
364
+ /* STABLE */
365
+ });
366
+ };
367
+ }
368
+ });
369
+
370
+ export { _sfc_main as default };
@@ -0,0 +1 @@
1
+ import 'fm-dev/theme-chalk/t-transfer.css';
@@ -0,0 +1 @@
1
+ import 'fm-dev/theme-chalk/src/t-transfer.scss';
@@ -0,0 +1,40 @@
1
+ import { nextTick } from 'vue';
2
+
3
+ const NextLoading = {
4
+ // 创建 loading
5
+ start: () => {
6
+ const bodys = document.body;
7
+ const div = document.createElement("div");
8
+ div.setAttribute("class", "loading-next");
9
+ const htmls = `
10
+ <div class="loading-next-box">
11
+ <div class="loading-next-box-warp">
12
+ <div class="loading-next-box-item"></div>
13
+ <div class="loading-next-box-item"></div>
14
+ <div class="loading-next-box-item"></div>
15
+ <div class="loading-next-box-item"></div>
16
+ <div class="loading-next-box-item"></div>
17
+ <div class="loading-next-box-item"></div>
18
+ <div class="loading-next-box-item"></div>
19
+ <div class="loading-next-box-item"></div>
20
+ <div class="loading-next-box-item"></div>
21
+ </div>
22
+ </div>
23
+ `;
24
+ div.innerHTML = htmls;
25
+ bodys.insertBefore(div, bodys.childNodes[0]);
26
+ window.nextLoading = true;
27
+ },
28
+ // 移除 loading
29
+ done: (time = 0) => {
30
+ nextTick(() => {
31
+ setTimeout(() => {
32
+ window.nextLoading = false;
33
+ const el = document.querySelector(".loading-next");
34
+ el?.parentNode?.removeChild(el);
35
+ }, time);
36
+ });
37
+ }
38
+ };
39
+
40
+ export { NextLoading };
package/index.css CHANGED
@@ -0,0 +1 @@
1
+ .fm-transfer-panel{box-sizing:border-box;display:inline-block;max-height:100%;overflow:hidden;position:relative;text-align:left;vertical-align:middle}.fm-transfer-panel,.fm-transfer-panel__header{box-shadow:0 0 0 1px var(--el-border-color,var(--el-border-color)) inset;width:100%}.fm-transfer-panel__header{align-items:center;display:flex;flex-wrap:nowrap;justify-content:space-between;padding:3px 6px}.fm-transfer-panel__body{height:400px}.fm-transfer-panel__body .transfer-panel__filter{padding:6px}.fm-transfer-panel__body .transfer-panel__list{height:calc(100% - 36px);overflow:auto;padding-top:10px}.fm-transfer-panel__body .transfer-panel__list .transfer-panel__item{display:block!important;padding-left:6px}.fm-transfer-buttons{align-items:center;display:flex;flex-direction:column;justify-content:center;text-align:center}.fm-transfer-buttons__item{padding-top:10px;width:100%}.fm-notice-bar{border-radius:4px;padding:0 15px;width:100%}.fm-notice-bar .notice-bar-warp{align-items:center;display:flex;height:inherit;width:100%}.fm-notice-bar .notice-bar-warp .notice-bar-warp-text-box{align-items:center;display:flex;flex:1;height:inherit;margin-right:35px;overflow:hidden;position:relative}.fm-notice-bar .notice-bar-warp .notice-bar-warp-left-icon{font-size:inherit!important;width:24px}.fm-notice-bar .notice-bar-warp .notice-bar-warp-right-icon{font-size:inherit!important;text-align:right;width:24px}.fm-notice-bar .notice-bar-warp .notice-bar-warp-right-icon:hover{cursor:pointer}