@ctzy-web-client/plugin-component-vue 1.0.22 → 1.0.24
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/advance-select/advance-operation.mjs +51 -37
- package/es/advance-select/advance-option.mjs +167 -97
- package/es/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.mjs +7 -0
- package/es/advance-select/advance-select.mjs +368 -310
- package/es/advance-select/index.mjs +5 -5
- package/es/application-slot/breadcrumb-item.mjs +20 -17
- package/es/application-slot/header-tools-item.mjs +20 -17
- package/es/breadcrumb-select/breadcrumb-select.mjs +134 -112
- package/es/contextmenu/contextmenu-item.mjs +19 -15
- package/es/contextmenu/contextmenu.mjs +72 -56
- package/es/data-form/data-form-item.mjs +48 -30
- package/es/data-form/data-form.mjs +213 -166
- package/es/data-form/form-components/bwa-date-picker.mjs +51 -39
- package/es/data-form/form-components/bwa-date-time-picker.mjs +56 -44
- package/es/data-form/form-components/bwa-input-float.mjs +48 -37
- package/es/data-form/form-components/bwa-input-integer.mjs +68 -50
- package/es/data-form/form-components/bwa-input.mjs +43 -32
- package/es/data-form/form-components/bwa-multi-select.mjs +40 -29
- package/es/data-form/form-components/bwa-rich-text-tinymce.mjs +554 -218
- package/es/data-form/form-components/bwa-rich-text.mjs +404 -316
- package/es/data-form/form-components/bwa-select.mjs +84 -70
- package/es/data-form/form-components/bwa-textarea.mjs +38 -27
- package/es/data-form/form-components/bwa-upload.mjs +172 -148
- package/es/data-form/form-components/bwa-user-multi-select.mjs +35 -24
- package/es/data-form/form-components/bwa-user-select.mjs +86 -61
- package/es/data-table/data-column-view.mjs +146 -115
- package/es/data-table/data-table-card.mjs +48 -40
- package/es/data-table/data-table-column.mjs +58 -45
- package/es/data-table/data-table.mjs +402 -316
- package/es/datatable-settings/datatable-settings.mjs +329 -254
- package/es/date-range/date-picker.mjs +130 -116
- package/es/date-range/date-range.mjs +215 -168
- package/es/drag-list/drag-item.mjs +56 -42
- package/es/drag-list/drag-list.mjs +60 -47
- package/es/dragable/dragable-item.mjs +23 -18
- package/es/dragable/dragable-operation.mjs +32 -24
- package/es/dragable/dragable.mjs +32 -23
- package/es/filter-panel/conditions/date-range-condition.mjs +50 -40
- package/es/filter-panel/conditions/department-condition/department-condition.mjs +99 -72
- package/es/filter-panel/conditions/department-condition/department-node.mjs +73 -59
- package/es/filter-panel/conditions/input-condition.mjs +90 -76
- package/es/filter-panel/conditions/multi-user-condition.mjs +67 -57
- package/es/filter-panel/conditions/multiple-menu-condition.mjs +54 -35
- package/es/filter-panel/conditions/single-menu-condition.mjs +65 -60
- package/es/filter-panel/conditions/single-user-condition.mjs +67 -57
- package/es/filter-panel/filter-panel-item.mjs +54 -39
- package/es/filter-panel/filter-panel.mjs +153 -135
- package/es/layout/layout.mjs +85 -78
- package/es/menu/menu-item.mjs +67 -52
- package/es/menu/menu.mjs +70 -53
- package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +28 -0
- package/es/panel/panel.mjs +53 -40
- package/es/pct-filter-panel/pct-compents/pct-Input-condition.mjs +74 -63
- package/es/pct-filter-panel/pct-compents/pct-date-range-condition.mjs +76 -67
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +406 -178
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +153 -138
- package/es/pct-filter-panel/pct-filter-panel-item.mjs +55 -40
- package/es/pct-filter-panel/pct-filter-panel.mjs +247 -227
- package/es/progress/progress-item.mjs +81 -61
- package/es/progress/progress.mjs +78 -64
- package/es/where-filter-panel/where-filter-panel.mjs +15 -12
- package/lib/advance-select/advance-operation.js +50 -36
- package/lib/advance-select/advance-option.js +166 -96
- package/lib/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.js +12 -0
- package/lib/advance-select/advance-select.js +366 -308
- package/lib/application-slot/breadcrumb-item.js +19 -16
- package/lib/application-slot/header-tools-item.js +19 -16
- package/lib/breadcrumb-select/breadcrumb-select.js +133 -111
- package/lib/contextmenu/contextmenu-item.js +18 -14
- package/lib/contextmenu/contextmenu.js +71 -55
- package/lib/data-form/data-form-item.js +47 -29
- package/lib/data-form/data-form.js +212 -165
- package/lib/data-form/form-components/bwa-date-picker.js +50 -38
- package/lib/data-form/form-components/bwa-date-time-picker.js +55 -43
- package/lib/data-form/form-components/bwa-input-float.js +47 -36
- package/lib/data-form/form-components/bwa-input-integer.js +67 -49
- package/lib/data-form/form-components/bwa-input.js +42 -31
- package/lib/data-form/form-components/bwa-multi-select.js +39 -28
- package/lib/data-form/form-components/bwa-rich-text-tinymce.js +553 -217
- package/lib/data-form/form-components/bwa-rich-text.js +403 -315
- package/lib/data-form/form-components/bwa-select.js +83 -69
- package/lib/data-form/form-components/bwa-textarea.js +37 -26
- package/lib/data-form/form-components/bwa-upload.js +171 -147
- package/lib/data-form/form-components/bwa-user-multi-select.js +34 -23
- package/lib/data-form/form-components/bwa-user-select.js +85 -60
- package/lib/data-table/data-column-view.js +146 -115
- package/lib/data-table/data-table-card.js +48 -40
- package/lib/data-table/data-table-column.js +57 -44
- package/lib/data-table/data-table.js +401 -315
- package/lib/datatable-settings/datatable-settings.js +328 -253
- package/lib/date-range/date-picker.js +129 -115
- package/lib/date-range/date-range.js +213 -170
- package/lib/drag-list/drag-item.js +55 -41
- package/lib/drag-list/drag-list.js +59 -46
- package/lib/dragable/dragable-item.js +22 -17
- package/lib/dragable/dragable-operation.js +31 -23
- package/lib/dragable/dragable.js +31 -22
- package/lib/filter-panel/conditions/date-range-condition.js +49 -39
- package/lib/filter-panel/conditions/department-condition/department-condition.js +98 -71
- package/lib/filter-panel/conditions/department-condition/department-node.js +72 -58
- package/lib/filter-panel/conditions/input-condition.js +89 -75
- package/lib/filter-panel/conditions/multi-user-condition.js +66 -56
- package/lib/filter-panel/conditions/multiple-menu-condition.js +53 -34
- package/lib/filter-panel/conditions/single-menu-condition.js +64 -59
- package/lib/filter-panel/conditions/single-user-condition.js +66 -56
- package/lib/filter-panel/filter-panel-item.js +53 -38
- package/lib/filter-panel/filter-panel.js +152 -134
- package/lib/layout/layout.js +84 -77
- package/lib/menu/menu-item.js +66 -51
- package/lib/menu/menu.js +69 -52
- package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +32 -0
- package/lib/panel/panel.js +52 -39
- package/lib/pct-filter-panel/pct-compents/pct-Input-condition.js +73 -62
- package/lib/pct-filter-panel/pct-compents/pct-date-range-condition.js +75 -66
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +405 -177
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +152 -137
- package/lib/pct-filter-panel/pct-filter-panel-item.js +54 -39
- package/lib/pct-filter-panel/pct-filter-panel.js +246 -226
- package/lib/progress/progress-item.js +80 -60
- package/lib/progress/progress.js +77 -63
- package/lib/where-filter-panel/where-filter-panel.js +14 -11
- package/package.json +2 -1
- package/src/advance-select/advance-option.vue +64 -13
- package/src/data-form/form-components/bwa-rich-text-tinymce.vue +1 -1
- package/src/datatable-settings/datatable-settings.vue +33 -3
- package/src/date-range/date-picker.vue +1 -1
- package/src/date-range/date-range.vue +3 -3
- package/src/filter-panel/filter-panel.vue +2 -2
- package/src/pct-filter-panel/pct-compents/pct-Input-condition.vue +64 -64
- package/src/pct-filter-panel/pct-compents/pct-date-range-condition.vue +61 -61
- package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +302 -178
- package/src/pct-filter-panel/pct-filter-panel.vue +4 -4
|
@@ -13,321 +13,409 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
|
|
14
14
|
var Quill__default = /*#__PURE__*/_interopDefaultLegacy(Quill);
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
emits: ["update:modelValue", "update:userIds"],
|
|
16
|
+
const _sfc_main = {
|
|
17
|
+
__name: 'bwa-rich-text',
|
|
18
|
+
props: {
|
|
19
|
+
placeholder: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: '',
|
|
22
|
+
},
|
|
23
|
+
modelValue: {
|
|
24
|
+
type: null,
|
|
25
|
+
},
|
|
26
|
+
disabled: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
showAt: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
userIds: {
|
|
35
|
+
typee: Array,
|
|
36
|
+
default: () => [],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
emits: ['update:modelValue', 'update:userIds'],
|
|
42
40
|
setup(__props, { expose, emit }) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
41
|
+
|
|
42
|
+
const props = __props;
|
|
43
|
+
|
|
44
|
+
let editor = null;
|
|
45
|
+
|
|
46
|
+
const userService = webBaseClientVue.useService('UserService');
|
|
47
|
+
|
|
48
|
+
const loading = vue.ref(false);
|
|
49
|
+
const userList = vue.ref([
|
|
50
|
+
{ value: '1', label: '用户1' },
|
|
51
|
+
{ value: '2', label: '用户2' },
|
|
52
|
+
{ value: '3', label: '用户3' },
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
const handleChange = ([userId]) => {
|
|
56
|
+
if (!editor || !userId) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const userInfo = vue.unref(userList).find((item) => item.value === userId);
|
|
61
|
+
|
|
62
|
+
if (!userInfo) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
editor.focus();
|
|
67
|
+
|
|
68
|
+
//获取当前光标位置
|
|
69
|
+
let length = editor.getSelection()
|
|
70
|
+
? editor.getSelection().index || 0
|
|
71
|
+
: editor.getLength();
|
|
72
|
+
|
|
73
|
+
// 设置@
|
|
74
|
+
editor.insertEmbed(
|
|
75
|
+
length,
|
|
76
|
+
'at',
|
|
77
|
+
{ id: userInfo.value, desc: userInfo.label },
|
|
78
|
+
'user'
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
editor.insertText(length + 1, ' ');
|
|
82
|
+
|
|
83
|
+
//设置光标
|
|
84
|
+
editor.setSelection(length + 2);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const loadUserList = async (search = '') => {
|
|
88
|
+
try {
|
|
89
|
+
if (vue.unref(loading)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
loading.value = true;
|
|
94
|
+
if (!vue.unref(userService)) {
|
|
95
|
+
ElementPlus.ElMessage.error('无法获取用户');
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const userListResult = await vue.unref(userService).getUserList({
|
|
100
|
+
name: search,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (userListResult.code != 0) {
|
|
104
|
+
ElementPlus.ElMessage.error(userListResult.msg);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
userList.value = userListResult.data;
|
|
109
|
+
} finally {
|
|
110
|
+
loading.value = false;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const handleVisibleChange = (visible) => {
|
|
115
|
+
if (!visible) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
loadUserList();
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
const virtualRef = vue.ref(null);
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
defineOptions({
|
|
129
|
+
name: 'BwaRichText',
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const ns = webBaseClientVue.useNamespace('rich-text');
|
|
133
|
+
|
|
134
|
+
const fileService = webBaseClientVue.useService('FileService');
|
|
135
|
+
|
|
136
|
+
const quillEditorContainer = vue.ref(null);
|
|
137
|
+
const quillEditorRef = vue.ref(null);
|
|
138
|
+
|
|
139
|
+
const currentScope = vue.getCurrentScope();
|
|
140
|
+
|
|
141
|
+
const editorInstance = vue.ref(null);
|
|
142
|
+
|
|
143
|
+
const toolbarOptions = [
|
|
144
|
+
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
|
145
|
+
[{ font: [] }],
|
|
146
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
147
|
+
[{ align: [] }],
|
|
148
|
+
['blockquote', 'code-block'],
|
|
149
|
+
[{ header: 1 }, { header: 2 }],
|
|
150
|
+
[{ list: 'ordered' }, { list: 'bullet' }],
|
|
151
|
+
[{ script: 'sub' }, { script: 'super' }],
|
|
152
|
+
[{ indent: '-1' }, { indent: '+1' }],
|
|
153
|
+
[{ color: [] }, { background: [] }],
|
|
154
|
+
['clean'].concat(props.showAt ? ['at'] : []),
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
const value = vue.computed({
|
|
158
|
+
get: () => props.modelValue || '',
|
|
159
|
+
set: (v) => {
|
|
160
|
+
// 解决当只有一张图片的时候 回显html报文异常
|
|
161
|
+
let str = '';
|
|
162
|
+
if (!v && editor && editor.root.innerHTML && editor.root.innerHTML.indexOf('<img') != -1) {
|
|
163
|
+
str = editor.root.innerHTML;
|
|
164
|
+
}
|
|
165
|
+
emit('update:modelValue', v || str);
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const userIds = vue.computed({
|
|
170
|
+
get: () => props.userIds,
|
|
171
|
+
set: (v) => {
|
|
172
|
+
emit('update:userIds', v);
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const updateImage = async (file) => {
|
|
177
|
+
if (!vue.unref(fileService)) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const uploadFileResult = await vue.unref(fileService).uploadFile(file);
|
|
182
|
+
|
|
183
|
+
if (uploadFileResult.code != 0) {
|
|
184
|
+
return uploadFileResult;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const fileID = uploadFileResult.data.id;
|
|
188
|
+
|
|
189
|
+
const filePathResult = await vue.unref(fileService).getFilePath(fileID);
|
|
190
|
+
|
|
191
|
+
if (filePathResult.code != 0) {
|
|
192
|
+
return filePathResult;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
...filePathResult,
|
|
197
|
+
data: { id: fileID, path: filePathResult.data },
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
const quillEditorRefClick = () => {
|
|
201
|
+
if (!editor) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
editor.focus();
|
|
205
|
+
};
|
|
206
|
+
vue.onMounted(() => {
|
|
207
|
+
editor = new Quill__default["default"](vue.unref(quillEditorRef), {
|
|
208
|
+
theme: 'snow',
|
|
209
|
+
placeholder: props.placeholder,
|
|
210
|
+
modules: {
|
|
211
|
+
toolbar: {
|
|
212
|
+
container: toolbarOptions,
|
|
213
|
+
handlers: {
|
|
214
|
+
at: function (value) {},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
virtualRef.value = quillEditorContainer.value.querySelector('button.ql-at');
|
|
221
|
+
|
|
222
|
+
editorInstance.value = vue.markRaw(editor);
|
|
223
|
+
|
|
224
|
+
const el = document.createElement('div');
|
|
225
|
+
|
|
226
|
+
const getUserIds = (html) => {
|
|
227
|
+
el.innerHTML = html;
|
|
228
|
+
|
|
229
|
+
const items = Array.from(el.querySelectorAll('span.ptp-at-item'));
|
|
230
|
+
|
|
231
|
+
userIds.value = [
|
|
232
|
+
...new Set(items.map((item) => item.getAttribute('d-id'))),
|
|
233
|
+
];
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
getUserIds(vue.unref(value));
|
|
237
|
+
|
|
238
|
+
const handleTextChange = (delta, oldDelta, source) => {
|
|
239
|
+
const _value = editor.getText() === '\n' ? '' : editor.root.innerHTML;
|
|
240
|
+
|
|
241
|
+
value.value = _value;
|
|
242
|
+
|
|
243
|
+
getUserIds(_value);
|
|
244
|
+
// if (source === 'user') {
|
|
245
|
+
// var range = editor.getLength();
|
|
246
|
+
// console.log(range)
|
|
247
|
+
// // if (range != null) {
|
|
248
|
+
// // setTimeout(() => {
|
|
249
|
+
// // editor.setSelection(range.index, range.length); // 重新设置选区
|
|
250
|
+
// // }, 300)
|
|
251
|
+
// // }
|
|
252
|
+
// }
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const handlePaste = (evt) => {
|
|
256
|
+
if (
|
|
257
|
+
evt.clipboardData &&
|
|
258
|
+
evt.clipboardData.files &&
|
|
259
|
+
evt.clipboardData.files.length
|
|
260
|
+
) {
|
|
261
|
+
evt.preventDefault();
|
|
262
|
+
[].forEach.call(evt.clipboardData.files, async (file) => {
|
|
263
|
+
console.log(file);
|
|
264
|
+
if (file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) {
|
|
265
|
+
const filePathResult = await updateImage(file);
|
|
266
|
+
|
|
267
|
+
if (filePathResult.code != 0) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const fileData = filePathResult.data;
|
|
272
|
+
// const fileData = { id: 1, path: 'https://img1.baidu.com/it/u=2335299816,3552592887&fm=253&fmt=auto&app=138&f=JPEG?w=126&h=189' }
|
|
273
|
+
var range = editor.getSelection();
|
|
274
|
+
if (range && fileData) {
|
|
275
|
+
// 在当前光标位置插入图片
|
|
276
|
+
editor.insertEmbed(range.index, 'image', fileData.path);
|
|
277
|
+
editor.formatText(range.index, 1, {
|
|
278
|
+
alt: fileData.id,
|
|
279
|
+
});
|
|
280
|
+
// 将光标移动到图片后面
|
|
281
|
+
setTimeout(() => {
|
|
282
|
+
editor.setSelection(range.index + 1);
|
|
283
|
+
// console.log(editor.getSelection(), editor.getLength())
|
|
284
|
+
// editor.setSelection(editor.getSelection().index, editor.getSelection().length);
|
|
285
|
+
}, 300);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
currentScope.run(() => {
|
|
293
|
+
vue.watch(
|
|
294
|
+
vue.computed(() => props.disabled),
|
|
295
|
+
(disabled) => {
|
|
296
|
+
editor.enable(!disabled);
|
|
297
|
+
},
|
|
298
|
+
{ immediate: true }
|
|
299
|
+
);
|
|
300
|
+
const getFilePaths = async (alt) => {
|
|
301
|
+
const filePathResult = await vue.unref(fileService).getFilePath(alt);
|
|
302
|
+
return filePathResult
|
|
303
|
+
};
|
|
304
|
+
let artArr2 = []; // 防止重复加载图片
|
|
305
|
+
vue.watch(
|
|
306
|
+
value,
|
|
307
|
+
async () => {
|
|
308
|
+
if ((vue.unref(value).indexOf('data:image/png') != -1 || vue.unref(value).indexOf('base64') != -1)) {
|
|
309
|
+
editor.root.innerHTML = vue.unref(value);
|
|
310
|
+
return
|
|
311
|
+
}
|
|
312
|
+
// console.log(unref(value))
|
|
313
|
+
if (!vue.unref(value)) {
|
|
314
|
+
artArr2 = [];
|
|
315
|
+
}
|
|
316
|
+
let afterHtml = '';
|
|
317
|
+
let artArr = [];
|
|
318
|
+
let artArrOption = [];
|
|
319
|
+
if (vue.unref(value).indexOf('<img') != -1) {
|
|
320
|
+
vue.unref(value).replace(/<img [^>]*alt=['"]([^'"]+)[^>]*>/gi, (img, alt) => {
|
|
321
|
+
if (!artArr2.includes(alt)) {
|
|
322
|
+
artArr.push(alt);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
for (const alt of artArr) {
|
|
326
|
+
artArrOption.push({
|
|
327
|
+
alt,
|
|
328
|
+
src: await getFilePaths(alt)
|
|
329
|
+
// src: 'https://img1.baidu.com/it/u=2335299816,3552592887&fm=253&fmt=auto&app=138&f=JPEG?w=126&h=189'
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
// console.log(artArrOption)
|
|
333
|
+
afterHtml = vue.unref(value).replace(/<img [^>]*alt=['"]([^'"]+)[^>]*>/gi, (img, alt) => {
|
|
334
|
+
if (artArr.includes(alt)) {
|
|
335
|
+
return `<img src="${artArrOption.find(a => a.alt === alt)?.src.data}" alt="${alt}">`
|
|
336
|
+
} else {
|
|
337
|
+
return img
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
console.log('afterHtml =>', afterHtml);
|
|
343
|
+
artArr2 = [...artArr2, ...artArr];
|
|
344
|
+
artArr = [];
|
|
345
|
+
artArrOption = [];
|
|
346
|
+
if (editor.root.innerHTML === (afterHtml || vue.unref(value))) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const range = editor.getSelection();
|
|
350
|
+
editor.root.innerHTML = afterHtml || vue.unref(value);
|
|
351
|
+
setTimeout(() => {
|
|
352
|
+
if (range) {
|
|
353
|
+
editor.setSelection(range.index + 1);
|
|
354
|
+
editor.focus();
|
|
355
|
+
}
|
|
356
|
+
}, 100);
|
|
357
|
+
},
|
|
358
|
+
{ immediate: true }
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
editor.on('text-change', handleTextChange);
|
|
362
|
+
|
|
363
|
+
editor.root.addEventListener('paste', handlePaste);
|
|
364
|
+
|
|
365
|
+
vue.onScopeDispose(() => {
|
|
366
|
+
editor.off('text-change', handleTextChange);
|
|
367
|
+
|
|
368
|
+
editor.root.removeEventListener('paste', handlePaste);
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
expose({
|
|
374
|
+
getEditorInstance() {
|
|
375
|
+
return vue.unref(editorInstance);
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
return (_ctx, _cache) => {
|
|
380
|
+
const _component_BwaAdvanceOption = vue.resolveComponent("BwaAdvanceOption");
|
|
381
|
+
const _component_BwaAdvanceSelect = vue.resolveComponent("BwaAdvanceSelect");
|
|
382
|
+
|
|
383
|
+
return (vue.openBlock(), vue.createElementBlock("div", {
|
|
384
|
+
class: vue.normalizeClass(vue.unref(ns).b()),
|
|
385
|
+
ref_key: "quillEditorContainer",
|
|
386
|
+
ref: quillEditorContainer
|
|
387
|
+
}, [
|
|
388
|
+
vue.createElementVNode("div", {
|
|
389
|
+
class: vue.normalizeClass(vue.unref(ns).e('editor')),
|
|
390
|
+
ref_key: "quillEditorRef",
|
|
391
|
+
ref: quillEditorRef,
|
|
392
|
+
onClick: quillEditorRefClick
|
|
393
|
+
}, null, 2 /* CLASS */),
|
|
394
|
+
vue.createVNode(_component_BwaAdvanceSelect, {
|
|
395
|
+
showSelection: false,
|
|
396
|
+
"virtual-triggering": true,
|
|
397
|
+
"virtual-ref": virtualRef.value,
|
|
398
|
+
loading: loading.value,
|
|
399
|
+
onSearch: loadUserList,
|
|
400
|
+
"onUpdate:modelValue": handleChange,
|
|
401
|
+
onVisibleChange: handleVisibleChange
|
|
402
|
+
}, {
|
|
403
|
+
default: vue.withCtx(() => [
|
|
404
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(userList.value, (item) => {
|
|
405
|
+
return (vue.openBlock(), vue.createBlock(_component_BwaAdvanceOption, {
|
|
406
|
+
key: item.value,
|
|
407
|
+
value: item.value,
|
|
408
|
+
label: item.label
|
|
409
|
+
}, null, 8 /* PROPS */, ["value", "label"]))
|
|
410
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
411
|
+
]),
|
|
412
|
+
_: 1 /* STABLE */
|
|
413
|
+
}, 8 /* PROPS */, ["virtual-ref", "loading"])
|
|
414
|
+
], 2 /* CLASS */))
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
};
|
|
419
|
+
var RichText = /*#__PURE__*/_pluginVue_exportHelper["default"](_sfc_main, [['__file',"bwa-rich-text.vue"]]);
|
|
332
420
|
|
|
333
421
|
exports["default"] = RichText;
|