@ctzy-web-client/plugin-component-vue 1.0.23 → 1.0.25

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 (131) hide show
  1. package/es/advance-select/advance-operation.mjs +51 -37
  2. package/es/advance-select/advance-option.mjs +167 -97
  3. package/es/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.mjs +7 -0
  4. package/es/advance-select/advance-select.mjs +368 -310
  5. package/es/advance-select/index.mjs +5 -5
  6. package/es/application-slot/breadcrumb-item.mjs +20 -17
  7. package/es/application-slot/header-tools-item.mjs +20 -17
  8. package/es/breadcrumb-select/breadcrumb-select.mjs +134 -112
  9. package/es/contextmenu/contextmenu-item.mjs +19 -15
  10. package/es/contextmenu/contextmenu.mjs +72 -56
  11. package/es/data-form/data-form-item.mjs +48 -30
  12. package/es/data-form/data-form.mjs +213 -166
  13. package/es/data-form/form-components/bwa-date-picker.mjs +51 -39
  14. package/es/data-form/form-components/bwa-date-time-picker.mjs +56 -44
  15. package/es/data-form/form-components/bwa-input-float.mjs +48 -37
  16. package/es/data-form/form-components/bwa-input-integer.mjs +68 -50
  17. package/es/data-form/form-components/bwa-input.mjs +43 -32
  18. package/es/data-form/form-components/bwa-multi-select.mjs +40 -29
  19. package/es/data-form/form-components/bwa-rich-text-tinymce.mjs +554 -218
  20. package/es/data-form/form-components/bwa-rich-text.mjs +404 -316
  21. package/es/data-form/form-components/bwa-select.mjs +84 -70
  22. package/es/data-form/form-components/bwa-textarea.mjs +38 -27
  23. package/es/data-form/form-components/bwa-upload.mjs +172 -148
  24. package/es/data-form/form-components/bwa-user-multi-select.mjs +35 -24
  25. package/es/data-form/form-components/bwa-user-select.mjs +86 -61
  26. package/es/data-table/data-column-view.mjs +146 -115
  27. package/es/data-table/data-table-card.mjs +48 -40
  28. package/es/data-table/data-table-column.mjs +58 -45
  29. package/es/data-table/data-table.mjs +402 -316
  30. package/es/datatable-settings/datatable-settings.mjs +329 -254
  31. package/es/date-range/date-picker.mjs +130 -116
  32. package/es/date-range/date-range.mjs +215 -161
  33. package/es/drag-list/drag-item.mjs +56 -42
  34. package/es/drag-list/drag-list.mjs +60 -47
  35. package/es/dragable/dragable-item.mjs +23 -18
  36. package/es/dragable/dragable-operation.mjs +32 -24
  37. package/es/dragable/dragable.mjs +32 -23
  38. package/es/filter-panel/conditions/date-range-condition.mjs +50 -40
  39. package/es/filter-panel/conditions/department-condition/department-condition.mjs +99 -72
  40. package/es/filter-panel/conditions/department-condition/department-node.mjs +73 -59
  41. package/es/filter-panel/conditions/input-condition.mjs +90 -76
  42. package/es/filter-panel/conditions/multi-user-condition.mjs +67 -57
  43. package/es/filter-panel/conditions/multiple-menu-condition.mjs +54 -35
  44. package/es/filter-panel/conditions/single-menu-condition.mjs +65 -60
  45. package/es/filter-panel/conditions/single-user-condition.mjs +67 -57
  46. package/es/filter-panel/filter-panel-item.mjs +54 -39
  47. package/es/filter-panel/filter-panel.mjs +153 -135
  48. package/es/layout/layout.mjs +85 -78
  49. package/es/menu/menu-item.mjs +67 -52
  50. package/es/menu/menu.mjs +70 -53
  51. package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +28 -0
  52. package/es/panel/panel.mjs +53 -40
  53. package/es/pct-filter-panel/pct-compents/pct-Input-condition.mjs +74 -63
  54. package/es/pct-filter-panel/pct-compents/pct-date-range-condition.mjs +76 -67
  55. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +406 -178
  56. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +153 -138
  57. package/es/pct-filter-panel/pct-filter-panel-item.mjs +55 -40
  58. package/es/pct-filter-panel/pct-filter-panel.mjs +247 -227
  59. package/es/progress/progress-item.mjs +81 -61
  60. package/es/progress/progress.mjs +78 -64
  61. package/es/where-filter-panel/where-filter-panel.mjs +15 -12
  62. package/lib/advance-select/advance-operation.js +50 -36
  63. package/lib/advance-select/advance-option.js +166 -96
  64. package/lib/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.js +12 -0
  65. package/lib/advance-select/advance-select.js +366 -308
  66. package/lib/application-slot/breadcrumb-item.js +19 -16
  67. package/lib/application-slot/header-tools-item.js +19 -16
  68. package/lib/breadcrumb-select/breadcrumb-select.js +133 -111
  69. package/lib/contextmenu/contextmenu-item.js +18 -14
  70. package/lib/contextmenu/contextmenu.js +71 -55
  71. package/lib/data-form/data-form-item.js +47 -29
  72. package/lib/data-form/data-form.js +212 -165
  73. package/lib/data-form/form-components/bwa-date-picker.js +50 -38
  74. package/lib/data-form/form-components/bwa-date-time-picker.js +55 -43
  75. package/lib/data-form/form-components/bwa-input-float.js +47 -36
  76. package/lib/data-form/form-components/bwa-input-integer.js +67 -49
  77. package/lib/data-form/form-components/bwa-input.js +42 -31
  78. package/lib/data-form/form-components/bwa-multi-select.js +39 -28
  79. package/lib/data-form/form-components/bwa-rich-text-tinymce.js +553 -217
  80. package/lib/data-form/form-components/bwa-rich-text.js +403 -315
  81. package/lib/data-form/form-components/bwa-select.js +83 -69
  82. package/lib/data-form/form-components/bwa-textarea.js +37 -26
  83. package/lib/data-form/form-components/bwa-upload.js +171 -147
  84. package/lib/data-form/form-components/bwa-user-multi-select.js +34 -23
  85. package/lib/data-form/form-components/bwa-user-select.js +85 -60
  86. package/lib/data-table/data-column-view.js +146 -115
  87. package/lib/data-table/data-table-card.js +48 -40
  88. package/lib/data-table/data-table-column.js +57 -44
  89. package/lib/data-table/data-table.js +401 -315
  90. package/lib/datatable-settings/datatable-settings.js +328 -253
  91. package/lib/date-range/date-picker.js +129 -115
  92. package/lib/date-range/date-range.js +214 -160
  93. package/lib/drag-list/drag-item.js +55 -41
  94. package/lib/drag-list/drag-list.js +59 -46
  95. package/lib/dragable/dragable-item.js +22 -17
  96. package/lib/dragable/dragable-operation.js +31 -23
  97. package/lib/dragable/dragable.js +31 -22
  98. package/lib/filter-panel/conditions/date-range-condition.js +49 -39
  99. package/lib/filter-panel/conditions/department-condition/department-condition.js +98 -71
  100. package/lib/filter-panel/conditions/department-condition/department-node.js +72 -58
  101. package/lib/filter-panel/conditions/input-condition.js +89 -75
  102. package/lib/filter-panel/conditions/multi-user-condition.js +66 -56
  103. package/lib/filter-panel/conditions/multiple-menu-condition.js +53 -34
  104. package/lib/filter-panel/conditions/single-menu-condition.js +64 -59
  105. package/lib/filter-panel/conditions/single-user-condition.js +66 -56
  106. package/lib/filter-panel/filter-panel-item.js +53 -38
  107. package/lib/filter-panel/filter-panel.js +152 -134
  108. package/lib/layout/layout.js +84 -77
  109. package/lib/menu/menu-item.js +66 -51
  110. package/lib/menu/menu.js +69 -52
  111. package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +32 -0
  112. package/lib/panel/panel.js +52 -39
  113. package/lib/pct-filter-panel/pct-compents/pct-Input-condition.js +73 -62
  114. package/lib/pct-filter-panel/pct-compents/pct-date-range-condition.js +75 -66
  115. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +405 -177
  116. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +152 -137
  117. package/lib/pct-filter-panel/pct-filter-panel-item.js +54 -39
  118. package/lib/pct-filter-panel/pct-filter-panel.js +246 -226
  119. package/lib/progress/progress-item.js +80 -60
  120. package/lib/progress/progress.js +77 -63
  121. package/lib/where-filter-panel/where-filter-panel.js +14 -11
  122. package/package.json +2 -1
  123. package/src/advance-select/advance-option.vue +64 -13
  124. package/src/data-form/form-components/bwa-rich-text-tinymce.vue +1 -1
  125. package/src/datatable-settings/datatable-settings.vue +33 -3
  126. package/src/date-range/date-picker.vue +1 -1
  127. package/src/filter-panel/filter-panel.vue +2 -2
  128. package/src/pct-filter-panel/pct-compents/pct-Input-condition.vue +64 -64
  129. package/src/pct-filter-panel/pct-compents/pct-date-range-condition.vue +61 -61
  130. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +302 -178
  131. package/src/pct-filter-panel/pct-filter-panel.vue +4 -4
@@ -14,229 +14,565 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
14
14
  var TinyMCEEditor__default = /*#__PURE__*/_interopDefaultLegacy(TinyMCEEditor);
15
15
 
16
16
  const _hoisted_1 = ["onClick"];
17
- const __default__ = vue.defineComponent({
18
- name: "BwaRichText"
19
- });
20
- const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
21
- props: {
22
- placeholder: {
23
- type: String,
24
- default: ""
25
- },
26
- modelValue: {
27
- type: null
28
- },
29
- disabled: {
30
- type: Boolean,
31
- default: false
32
- }
33
- },
34
- emits: ["update:modelValue"],
17
+ // import { useActiveElement } from '@vueuse/core';
18
+ // import { filter, fromEvent } from 'rxjs';
19
+
20
+
21
+ const _sfc_main = {
22
+ __name: 'bwa-rich-text-tinymce',
23
+ props: {
24
+ placeholder: {
25
+ type: String,
26
+ default: '',
27
+ },
28
+ modelValue: {
29
+ type: null,
30
+ },
31
+ disabled: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ },
36
+ emits: ['update:modelValue'],
35
37
  setup(__props, { emit }) {
36
- const props = __props;
37
- let resolve = null;
38
- const setupPromise = new Promise((relv) => {
39
- resolve = relv;
40
- });
41
- const initOptions = {
42
- promotion: false,
43
- language: "zh-Hans",
44
- setup: resolve
45
- };
46
- const ns = webBaseClientVue.useNamespace("rich-text");
47
- const fileService = webBaseClientVue.useService("FileService");
48
- const editorRef = vue.ref(null);
49
- const tinyMCEEditorRef = vue.ref(null);
50
- const currentScope = vue.getCurrentScope();
51
- const value = vue.computed({
52
- get: () => props.modelValue || "",
53
- set: (v) => {
54
- emit("update:modelValue", v);
55
- }
56
- });
57
- const focusing = vue.ref(false);
58
- const AT_REGEXP = /[^\da-zA-Z]@[^@]*$/;
59
- const atPersonInfos = vue.reactive({
60
- node: null,
61
- content: "",
62
- selection: null,
63
- index: -1,
64
- style: null
65
- });
66
- const selectPersonSubject = new rxjs.Subject();
67
- const handlePersonSelect = selectPersonSubject.next.bind(selectPersonSubject);
68
- window.atPersonInfos = atPersonInfos;
69
- vue.onMounted(async () => {
70
- const editor = await setupPromise;
71
- window.editor = editor;
72
- const inputObservable = new rxjs.Observable((observer) => {
73
- const next = observer.next.bind(observer);
74
- editor.on("input", next);
75
- return () => {
76
- editor.off("input", next);
77
- };
78
- });
79
- editor.on("change", (event) => {
80
- console.log(event);
81
- });
82
- const getSelection = (event) => {
83
- if (typeof event.target.nodeType === "number" && typeof event.target.tagName === "string") {
84
- return event.target.ownerDocument.getSelection();
85
- }
86
- return event.target.iframeElement.contentDocument.getSelection();
87
- };
88
- const subject = new rxjs.Subject();
89
- inputObservable.pipe(
90
- rxjs.map((event) => {
91
- if (event.data !== "@") {
92
- return null;
93
- }
94
- const selection = event.currentTarget.ownerDocument.getSelection();
95
- const focusNode = selection.focusNode;
96
- if (focusNode.nodeType !== Node.TEXT_NODE) {
97
- return null;
98
- }
99
- const content = focusNode.data.slice(0, selection.focusOffset);
100
- const match = content.match(AT_REGEXP);
101
- if (!match) {
102
- return null;
103
- }
104
- return {
105
- event,
106
- selection,
107
- index: match[0].indexOf("@") + match.index,
108
- node: focusNode,
109
- content,
110
- range: selection.getRangeAt(0)
111
- };
112
- }),
113
- rxjs.filter(Boolean),
114
- rxjs.mergeMap(({ event, index, node, content, range }) => {
115
- const changeObservable = new rxjs.Observable((observer) => {
116
- const next = observer.next.bind(observer);
117
- editor.on("change input undo redo", next);
118
- return () => {
119
- editor.off("change input undo redo", next);
120
- };
121
- });
122
- return rxjs.merge(rxjs.from([event]), changeObservable).pipe(
123
- rxjs.delayWhen(() => rxjs.timer(0)),
124
- rxjs.map((event2) => {
125
- const selection = getSelection(event2);
126
- const content2 = node.data.slice(index, selection.focusOffset);
127
- console.log(content2);
128
- if (!content2) {
129
- subject.next();
130
- return null;
131
- }
132
- return {
133
- index,
134
- node,
135
- content: content2,
136
- range: selection.getRangeAt(0)
137
- };
138
- }),
139
- rxjs.filter(Boolean),
140
- rxjs.takeUntil(
141
- rxjs.merge(
142
- inputObservable.pipe(rxjs.filter((event2) => event2.data === "@")),
143
- subject
144
- ).pipe(
145
- rxjs.tap(() => {
146
- atPersonInfos.node = null;
147
- atPersonInfos.content = "";
148
- atPersonInfos.selection = null;
149
- atPersonInfos.index = -1;
150
- atPersonInfos.style = null;
151
- })
152
- )
153
- )
154
- );
155
- })
156
- ).subscribe(({ index, node, selection, content, range }) => {
157
- const searchContent = content.slice(1);
158
- const { x: offsetX, y: offsetY, height } = range.getBoundingClientRect();
159
- const iframeElement = editor.iframeElement;
160
- const { x: iframeX, y: iframeY } = iframeElement.getBoundingClientRect();
161
- atPersonInfos.node = node;
162
- atPersonInfos.content = content;
163
- atPersonInfos.selection = selection;
164
- atPersonInfos.index = index;
165
- atPersonInfos.style = {
166
- "--left": iframeX + offsetX + "px",
167
- "--top": iframeY + offsetY + height + "px"
168
- };
169
- });
170
- selectPersonSubject.subscribe(() => {
171
- if (!atPersonInfos.node) {
172
- return;
173
- }
174
- const { node, index, content } = atPersonInfos;
175
- const document = node.ownerDocument;
176
- const documentFragment = document.createDocumentFragment();
177
- if (index) {
178
- const textNode = document.createTextNode(node.data.slice(0, index));
179
- documentFragment.appendChild(textNode);
180
- }
181
- const span = document.createElement("span");
182
- span.innerText = content;
183
- documentFragment.appendChild(span);
184
- const contentEndIndex = index + content.length;
185
- if (contentEndIndex < node.data.length) {
186
- const textNode = document.createTextNode(
187
- node.data.slice(contentEndIndex)
188
- );
189
- documentFragment.appendChild(textNode);
190
- }
191
- const parent = node.parentElement;
192
- parent.insertBefore(documentFragment, node);
193
- parent.removeChild(node);
194
- subject.next();
195
- });
196
- currentScope.run(() => {
197
- });
198
- });
199
- return (_ctx, _cache) => {
200
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
201
- vue.createElementVNode("div", {
202
- class: vue.normalizeClass(vue.unref(ns).b())
203
- }, [
204
- vue.createElementVNode("div", {
205
- class: vue.normalizeClass(vue.unref(ns).e("editor")),
206
- ref_key: "editorRef",
207
- ref: editorRef
208
- }, [
209
- vue.createVNode(vue.unref(TinyMCEEditor__default["default"]), {
210
- init: initOptions,
211
- disabled: __props.disabled,
212
- tinymceScriptSrc: "/tinymce/tinymce.js",
213
- ref_key: "tinyMCEEditorRef",
214
- ref: tinyMCEEditorRef
215
- }, null, 8, ["disabled"])
216
- ], 2)
217
- ], 2),
218
- (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
219
- vue.createElementVNode("div", {
220
- class: vue.normalizeClass(vue.unref(ns).e("at-list-wrapper"))
221
- }, [
222
- atPersonInfos.style ? (vue.openBlock(), vue.createElementBlock("div", {
38
+
39
+ const props = __props;
40
+
41
+ defineOptions({
42
+ name: 'BwaRichText',
43
+ });
44
+
45
+
46
+
47
+ let resolve = null;
48
+
49
+ const setupPromise = new Promise((relv) => {
50
+ resolve = relv;
51
+ });
52
+
53
+ const initOptions = {
54
+ promotion: false,
55
+ language: 'zh-Hans',
56
+ setup: resolve,
57
+ };
58
+
59
+ // const DIGIAL_LETTER_REGEXP = /^[\da-z]/i;
60
+
61
+
62
+
63
+ const ns = webBaseClientVue.useNamespace('rich-text');
64
+
65
+ const fileService = webBaseClientVue.useService('FileService');
66
+
67
+ /** @type {import('vue').Ref<HTMLElement>} */
68
+ const editorRef = vue.ref(null);
69
+ const tinyMCEEditorRef = vue.ref(null);
70
+
71
+ // const editing = computed(() => {
72
+ // const element = unref(useActiveElement());
73
+
74
+ // if (!element.classList.contains('ql-editor')) {
75
+ // return false;
76
+ // }
77
+
78
+ // const el = unref(editorRef);
79
+
80
+ // return el?.contains(element) ?? false;
81
+ // });
82
+
83
+ const currentScope = vue.getCurrentScope();
84
+
85
+ // const toolbarOptions = [
86
+ // [{ header: [1, 2, 3, 4, 5, 6, false] }],
87
+ // [{ font: [] }],
88
+ // ['bold', 'italic', 'underline', 'strike'],
89
+ // [{ align: [] }],
90
+ // ['blockquote', 'code-block'],
91
+ // [{ header: 1 }, { header: 2 }],
92
+ // [{ list: 'ordered' }, { list: 'bullet' }],
93
+ // [{ script: 'sub' }, { script: 'super' }],
94
+ // [{ indent: '-1' }, { indent: '+1' }],
95
+ // [{ color: [] }, { background: [] }],
96
+ // ['clean'],
97
+ // ];
98
+
99
+ const value = vue.computed({
100
+ get: () => props.modelValue || '',
101
+ set: (v) => {
102
+ emit('update:modelValue', v);
103
+ },
104
+ });
105
+
106
+ // const updateImage = async (file) => {
107
+ // if (!unref(fileService)) {
108
+ // return;
109
+ // }
110
+
111
+ // const uploadFileResult = await unref(fileService).uploadFile(file);
112
+
113
+ // if (uploadFileResult.code != 0) {
114
+ // return uploadFileResult;
115
+ // }
116
+
117
+ // const fileID = uploadFileResult.data.id;
118
+
119
+ // const filePathResult = await unref(fileService).getFilePath(fileID);
120
+
121
+ // if (filePathResult.code != 0) {
122
+ // return filePathResult;
123
+ // }
124
+
125
+ // return {
126
+ // ...filePathResult,
127
+ // data: { id: fileID, path: filePathResult.data },
128
+ // };
129
+ // };
130
+
131
+ const focusing = vue.ref(false);
132
+
133
+ const AT_REGEXP = /[^\da-zA-Z]@[^@]*$/;
134
+
135
+ const atPersonInfos = vue.reactive({
136
+ node: null,
137
+ content: '',
138
+ selection: null,
139
+ index: -1,
140
+ style: null,
141
+ });
142
+
143
+ const selectPersonSubject = new rxjs.Subject();
144
+
145
+ const handlePersonSelect = selectPersonSubject.next.bind(selectPersonSubject);
146
+
147
+ // const handlePersonSelect = () => {
148
+ // if (!atPersonInfos.node) {
149
+ // return;
150
+ // }
151
+
152
+ // const { node, index, content } = atPersonInfos;
153
+
154
+ // const document = node.ownerDocument;
155
+
156
+ // const documentFragment = document.createDocumentFragment();
157
+
158
+ // if (index) {
159
+ // const textNode = document.createTextNode(node.data.slice(0, index));
160
+
161
+ // documentFragment.appendChild(textNode);
162
+ // }
163
+
164
+ // const span = document.createElement('span');
165
+ // span.innerText = content;
166
+
167
+ // documentFragment.appendChild(span);
168
+
169
+ // const contentEndIndex = index + content.length;
170
+ // if (contentEndIndex < node.data.length) {
171
+ // const textNode = document.createTextNode(node.data.slice(contentEndIndex));
172
+
173
+ // documentFragment.appendChild(textNode);
174
+ // }
175
+
176
+ // const parent = node.parentElement;
177
+
178
+ // parent.insertBefore(documentFragment, node);
179
+ // parent.removeChild(node);
180
+
181
+ // // console.log(
182
+ // // documentFragment
183
+ // // atPersonInfos.node.data,
184
+ // // atPersonInfos.index,
185
+ // // atPersonInfos.content.length
186
+ // // );
187
+
188
+ // // atPersonInfos.node.data;
189
+ // };
190
+
191
+ window.atPersonInfos = atPersonInfos;
192
+
193
+ vue.onMounted(async () => {
194
+ const editor = await setupPromise;
195
+
196
+ window.editor = editor;
197
+
198
+ // const focusObservable = new Observable((observer) => {
199
+ // editor.on('focus', observer.next.bind(observer));
200
+
201
+ // return () => {
202
+ // editor.off('focus', observer.next.bind(observer));
203
+ // };
204
+ // });
205
+
206
+ // const blurObservable = new Observable((observer) => {
207
+ // editor.on('blur', observer.next.bind(observer));
208
+
209
+ // return () => {
210
+ // editor.off('blur', observer.next.bind(observer));
211
+ // };
212
+ // });
213
+
214
+ const inputObservable = new rxjs.Observable((observer) => {
215
+ const next = observer.next.bind(observer);
216
+ editor.on('input', next);
217
+
218
+ return () => {
219
+ editor.off('input', next);
220
+ };
221
+ });
222
+
223
+ editor.on('change', (event) => {
224
+ console.log(event);
225
+ });
226
+
227
+ const getSelection = (event) => {
228
+ if (
229
+ typeof event.target.nodeType === 'number' &&
230
+ typeof event.target.tagName === 'string'
231
+ ) {
232
+ return event.target.ownerDocument.getSelection();
233
+ }
234
+
235
+ return event.target.iframeElement.contentDocument.getSelection();
236
+ };
237
+
238
+ const subject = new rxjs.Subject();
239
+
240
+ inputObservable
241
+ .pipe(
242
+ rxjs.map((event) => {
243
+ if (event.data !== '@') {
244
+ return null;
245
+ }
246
+
247
+ const selection = event.currentTarget.ownerDocument.getSelection();
248
+
249
+ const focusNode = selection.focusNode;
250
+
251
+ if (focusNode.nodeType !== Node.TEXT_NODE) {
252
+ return null;
253
+ }
254
+
255
+ const content = focusNode.data.slice(0, selection.focusOffset);
256
+
257
+ const match = content.match(AT_REGEXP);
258
+
259
+ if (!match) {
260
+ return null;
261
+ }
262
+
263
+ return {
264
+ event: event,
265
+ selection,
266
+ index: match[0].indexOf('@') + match.index,
267
+ node: focusNode,
268
+ content,
269
+ range: selection.getRangeAt(0),
270
+ };
271
+ }),
272
+ rxjs.filter(Boolean),
273
+ rxjs.mergeMap(({ event, index, node, content, range }) => {
274
+ const changeObservable = new rxjs.Observable((observer) => {
275
+ const next = observer.next.bind(observer);
276
+ editor.on('change input undo redo', next);
277
+
278
+ return () => {
279
+ editor.off('change input undo redo', next);
280
+ };
281
+ });
282
+
283
+ return rxjs.merge(rxjs.from([event]), changeObservable).pipe(
284
+ rxjs.delayWhen(() => rxjs.timer(0)),
285
+ rxjs.map((event) => {
286
+ const selection = getSelection(event);
287
+
288
+ const content = node.data.slice(index, selection.focusOffset);
289
+
290
+ console.log(content);
291
+
292
+ if (!content) {
293
+ subject.next();
294
+ return null;
295
+ }
296
+
297
+ return {
298
+ index,
299
+ node,
300
+ content,
301
+ range: selection.getRangeAt(0),
302
+ };
303
+ }),
304
+ rxjs.filter(Boolean),
305
+ rxjs.takeUntil(
306
+ rxjs.merge(
307
+ inputObservable.pipe(rxjs.filter((event) => event.data === '@')),
308
+ subject
309
+ ).pipe(
310
+ rxjs.tap(() => {
311
+ atPersonInfos.node = null;
312
+ atPersonInfos.content = '';
313
+ atPersonInfos.selection = null;
314
+ atPersonInfos.index = -1;
315
+ atPersonInfos.style = null;
316
+ })
317
+ )
318
+ )
319
+ );
320
+ })
321
+ )
322
+ .subscribe(({ index, node, selection, content, range }) => {
323
+ const searchContent = content.slice(1);
324
+
325
+ const { x: offsetX, y: offsetY, height } = range.getBoundingClientRect();
326
+
327
+ const iframeElement = editor.iframeElement;
328
+ const { x: iframeX, y: iframeY } = iframeElement.getBoundingClientRect();
329
+
330
+ atPersonInfos.node = node;
331
+ atPersonInfos.content = content;
332
+ atPersonInfos.selection = selection;
333
+ atPersonInfos.index = index;
334
+ atPersonInfos.style = {
335
+ '--left': iframeX + offsetX + 'px',
336
+ '--top': iframeY + offsetY + height + 'px',
337
+ };
338
+ });
339
+
340
+ selectPersonSubject.subscribe(() => {
341
+ if (!atPersonInfos.node) {
342
+ return;
343
+ }
344
+
345
+ const { node, index, content } = atPersonInfos;
346
+
347
+ const document = node.ownerDocument;
348
+
349
+ const documentFragment = document.createDocumentFragment();
350
+
351
+ if (index) {
352
+ const textNode = document.createTextNode(node.data.slice(0, index));
353
+
354
+ documentFragment.appendChild(textNode);
355
+ }
356
+
357
+ const span = document.createElement('span');
358
+ span.innerText = content;
359
+
360
+ documentFragment.appendChild(span);
361
+
362
+ const contentEndIndex = index + content.length;
363
+ if (contentEndIndex < node.data.length) {
364
+ const textNode = document.createTextNode(
365
+ node.data.slice(contentEndIndex)
366
+ );
367
+
368
+ documentFragment.appendChild(textNode);
369
+ }
370
+
371
+ const parent = node.parentElement;
372
+
373
+ parent.insertBefore(documentFragment, node);
374
+ parent.removeChild(node);
375
+
376
+ subject.next();
377
+ });
378
+
379
+ // editor.on('keydown', (event) => {ƒ
380
+
381
+ // editor.on('focus', () => {
382
+ // focusing.value = true;
383
+ // });
384
+
385
+ // editor.on('blur', () => {
386
+ // focusing.value = false;
387
+ // });
388
+
389
+ // editor.on('input', (event) => {
390
+ // if (event.data !== '@') {
391
+ // return;
392
+ // }
393
+
394
+ // /** @type {Selection} */
395
+ // const selection = event.target.ownerDocument.getSelection();
396
+
397
+ // console.dir(selection.focusNode);
398
+
399
+ // const focusNode = selection.focusNode;
400
+
401
+ // if (focusNode.nodeType !== Node.TEXT_NODE) {
402
+ // return;
403
+ // }
404
+
405
+ // const content = focusNode.data.slice(0, selection.focusOffset);
406
+
407
+ // const match = content.match(AT_REGEXP);
408
+
409
+ // if (!match) {
410
+ // return;
411
+ // }
412
+
413
+ // const index = match.index;
414
+
415
+ // const range = selection.getRangeAt(0);
416
+
417
+ // const boundary = range.getBoundingClientRect();
418
+
419
+ // console.log(boundary);
420
+ // });
421
+
422
+ // editor.on('SelectionChange', (...args) => {
423
+ // console.log(...args);
424
+ // });
425
+
426
+ // const editor = new Quill(unref(editorRef), {
427
+ // modules: { toolbar: toolbarOptions },
428
+ // theme: 'snow',
429
+ // placeholder: props.placeholder,
430
+ // });
431
+
432
+ // window.aaa = editor;
433
+
434
+ // watch(
435
+ // value,
436
+ // (value) => {
437
+ // if (editor.root.innerHTML !== value) {
438
+ // editor.root.innerHTML = value;
439
+ // }
440
+ // },
441
+ // { immediate: true }
442
+ // );
443
+
444
+ // watch(
445
+ // computed(() => props.disabled),
446
+ // (disabled) => {
447
+ // editor.enable(!disabled);
448
+ // },
449
+ // { immediate: true }
450
+ // );
451
+
452
+ // const atPersonSubcription = fromEvent(document, 'keydown')
453
+ // .pipe(
454
+ // filter(() => unref(editing)),
455
+ // filter((/** @type {KeyboardEvent}*/ e) => e.key === '@')
456
+ // )
457
+ // .subscribe((/** @type {KeyboardEvent}*/ e) => {
458
+ // const selection = editor.getSelection();
459
+
460
+ // if (selection.index > 1) {
461
+ // const preChar = editor.getContents(
462
+ // selection.index - 1,
463
+ // selection.index
464
+ // );
465
+
466
+ // if (
467
+ // preChar.ops.length === 1 &&
468
+ // DIGIAL_LETTER_REGEXP.test(preChar.ops[0].insert)
469
+ // ) {
470
+ // return;
471
+ // }
472
+ // }
473
+
474
+ // e.preventDefault();
475
+ // e.stopPropagation();
476
+
477
+ // console.log(editor.getContents());
478
+
479
+ // // atPersionInfo.value = {
480
+ // // startIndex: selection.index,
481
+ // // endIndex: selection.index + 1,
482
+ // // };
483
+ // });
484
+
485
+ // const handleTextChange = () => {
486
+ // value.value = editor.root.innerHTML;
487
+ // };
488
+
489
+ // const handlePaste = (evt) => {
490
+ // if (
491
+ // evt.clipboardData &&
492
+ // evt.clipboardData.files &&
493
+ // evt.clipboardData.files.length
494
+ // ) {
495
+ // evt.preventDefault();
496
+ // [].forEach.call(evt.clipboardData.files, async (file) => {
497
+ // if (file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) {
498
+ // const filePathResult = await updateImage(file);
499
+
500
+ // if (filePathResult.code != 0) {
501
+ // return;
502
+ // }
503
+
504
+ // const fileData = filePathResult.data;
505
+
506
+ // var range = editor.getSelection();
507
+ // if (range && fileData) {
508
+ // // 在当前光标位置插入图�?
509
+ // editor.insertEmbed(range.index, 'image', fileData.path);
510
+ // editor.formatText(range.index, 1, {
511
+ // alt: fileData.id,
512
+ // });
513
+ // // 将光标移动到图片后面
514
+ // editor.setSelection(range.index + 1);
515
+ // }
516
+ // }
517
+ // });
518
+ // }
519
+ // };
520
+
521
+ currentScope.run(() => {
522
+ // editor.on('text-change', handleTextChange);
523
+ // editor.root.addEventListener('paste', handlePaste);
524
+ // onScopeDispose(() => {
525
+ // editor.off('text-change', handleTextChange);
526
+ // editor.root.removeEventListener('paste', handlePaste);
527
+ // atPersonSubcription.unsubscribe();
528
+ // });
529
+ });
530
+ });
531
+
532
+ return (_ctx, _cache) => {
533
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
534
+ vue.createElementVNode("div", {
535
+ class: vue.normalizeClass(vue.unref(ns).b())
536
+ }, [
537
+ vue.createElementVNode("div", {
538
+ class: vue.normalizeClass(vue.unref(ns).e('editor')),
539
+ ref_key: "editorRef",
540
+ ref: editorRef
541
+ }, [
542
+ vue.createVNode(vue.unref(TinyMCEEditor__default["default"]), {
543
+ init: initOptions,
544
+ disabled: __props.disabled,
545
+ tinymceScriptSrc: "/tinymce/tinymce.js",
546
+ ref_key: "tinyMCEEditorRef",
547
+ ref: tinyMCEEditorRef
548
+ }, null, 8 /* PROPS */, ["disabled"])
549
+ ], 2 /* CLASS */)
550
+ ], 2 /* CLASS */),
551
+ (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
552
+ vue.createElementVNode("div", {
553
+ class: vue.normalizeClass(vue.unref(ns).e('at-list-wrapper'))
554
+ }, [
555
+ (atPersonInfos.style)
556
+ ? (vue.openBlock(), vue.createElementBlock("div", {
223
557
  key: 0,
224
- class: vue.normalizeClass(vue.unref(ns).e("at-list")),
558
+ class: vue.normalizeClass(vue.unref(ns).e('at-list')),
225
559
  style: vue.normalizeStyle(atPersonInfos.style)
226
560
  }, [
227
561
  (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(4, (i) => {
228
562
  return vue.createElementVNode("div", {
229
563
  key: i,
230
- onClick: ($event) => vue.unref(handlePersonSelect)(i)
231
- }, " \u7528\u6237" + vue.toDisplayString(i), 9, _hoisted_1);
232
- }), 64))
233
- ], 6)) : vue.createCommentVNode("v-if", true)
234
- ], 2)
235
- ]))
236
- ], 64);
237
- };
238
- }
239
- });
240
- var bwaRichTextTinymce = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__file", "bwa-rich-text-tinymce.vue"]]);
564
+ onClick: $event => (vue.unref(handlePersonSelect)(i))
565
+ }, " 用户" + vue.toDisplayString(i), 9 /* TEXT, PROPS */, _hoisted_1)
566
+ }), 64 /* STABLE_FRAGMENT */))
567
+ ], 6 /* CLASS, STYLE */))
568
+ : vue.createCommentVNode("v-if", true)
569
+ ], 2 /* CLASS */)
570
+ ]))
571
+ ], 64 /* STABLE_FRAGMENT */))
572
+ }
573
+ }
574
+
575
+ };
576
+ var bwaRichTextTinymce = /*#__PURE__*/_pluginVue_exportHelper["default"](_sfc_main, [['__file',"bwa-rich-text-tinymce.vue"]]);
241
577
 
242
578
  exports["default"] = bwaRichTextTinymce;