@ibiz-template/vue3-components 0.7.26 → 0.7.28-alpha.0
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/dist/{index-RwYoggQd.js → index-HNRMy1_g.js} +1 -1
- package/dist/index-QB7iGpIB.js +4 -0
- package/dist/{index-s7g1-ymW.js → index-xa8K5AHD.js} +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/wang-editor-YqnK5uQU.js +1 -0
- package/dist/{xlsx-util-Rf5FMxyR.js → xlsx-util-nADTbeWP.js} +1 -1
- package/es/common/action-toolbar/action-toolbar.mjs +1 -1
- package/es/common/custom-theme/custom-theme.mjs +1 -1
- package/es/common/data-import2/data-import2.mjs +4 -1
- package/es/control/context-menu/context-menu.mjs +2 -2
- package/es/control/dashboard/custom-dashboard-container/custom-dashboard-container.d.ts +0 -1
- package/es/control/dashboard/custom-dashboard-container/custom-dashboard-container.mjs +1 -1
- package/es/control/dashboard/dashboard-design/dashboard-design.mjs +3 -3
- package/es/control/drtab/drtab-control.util.mjs +7 -11
- package/es/control/form/form-detail/form-button/form-button.mjs +1 -1
- package/es/control/form/form-detail/form-item/form-item-container/form-item-container.css +1 -1
- package/es/control/form/form-detail/form-item/form-item-container/form-item-container.d.ts +28 -0
- package/es/control/form/form-detail/form-item/form-item-container/form-item-container.mjs +52 -7
- package/es/control/form/form-detail/form-item/form-item.mjs +4 -0
- package/es/control/grid/grid/grid-control.util.d.ts +0 -2
- package/es/control/grid/grid/grid-control.util.mjs +24 -83
- package/es/control/grid/grid/grid.css +1 -1
- package/es/control/grid/grid/grid.d.ts +0 -2
- package/es/control/grid/grid/grid.mjs +1 -7
- package/es/control/grid/grid/index.d.ts +0 -2
- package/es/control/report-panel/report-panel.mjs +5 -0
- package/es/control/search-bar/search-bar.mjs +2 -2
- package/es/control/toolbar/export-excel/export-excel.mjs +2 -2
- package/es/control/toolbar/short-cut-button/short-cut-button.mjs +4 -1
- package/es/control/toolbar/toolbar.css +1 -1
- package/es/control/toolbar/toolbar.mjs +146 -10
- package/es/control/tree/index.d.ts +9 -0
- package/es/control/tree/tree.d.ts +9 -0
- package/es/control/tree/tree.mjs +5 -1
- package/es/editor/data-picker/ibiz-mpicker/ibiz-mpicker.css +1 -1
- package/es/editor/data-picker/ibiz-picker/ibiz-picker.mjs +2 -2
- package/es/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.css +1 -1
- package/es/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.d.ts +4 -0
- package/es/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.mjs +48 -3
- package/es/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.mjs +2 -2
- package/es/editor/data-picker/picker-editor.controller.d.ts +2 -2
- package/es/editor/dropdown-list/dropdown-list-editor.controller.d.ts +6 -0
- package/es/editor/dropdown-list/dropdown-list-editor.controller.mjs +10 -1
- package/es/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.d.ts +1 -1
- package/es/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.mjs +17 -4
- package/es/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.css +1 -1
- package/es/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.d.ts +3 -1
- package/es/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.mjs +26 -12
- package/es/editor/html/html-editor.controller.d.ts +88 -0
- package/es/editor/html/html-editor.controller.mjs +169 -6
- package/es/editor/html/wang-editor/component/emoji/emoji.css +1 -0
- package/es/editor/html/wang-editor/component/emoji/emoji.d.ts +17 -0
- package/es/editor/html/wang-editor/component/emoji/emoji.mjs +42 -0
- package/es/editor/html/wang-editor/component/index.d.ts +1 -0
- package/es/editor/html/wang-editor/component/index.mjs +3 -0
- package/es/editor/html/wang-editor/element/emoji.d.ts +7 -0
- package/es/editor/html/wang-editor/element/emoji.mjs +22 -0
- package/es/editor/html/wang-editor/element/index.d.ts +1 -0
- package/es/editor/html/wang-editor/element/index.mjs +3 -0
- package/es/editor/html/wang-editor/index.d.ts +4 -0
- package/es/editor/html/wang-editor/index.mjs +11 -0
- package/es/editor/html/wang-editor/module/ai-module.d.ts +67 -0
- package/es/editor/html/wang-editor/module/ai-module.mjs +76 -0
- package/es/editor/html/wang-editor/module/emoji-module.d.ts +7 -0
- package/es/editor/html/wang-editor/module/emoji-module.mjs +125 -0
- package/es/editor/html/wang-editor/module/index.d.ts +2 -0
- package/es/editor/html/wang-editor/module/index.mjs +4 -0
- package/es/editor/html/wang-editor/plugin/index.d.ts +1 -0
- package/es/editor/html/wang-editor/plugin/index.mjs +3 -0
- package/es/editor/html/wang-editor/plugin/plugin.d.ts +7 -0
- package/es/editor/html/wang-editor/plugin/plugin.mjs +23 -0
- package/es/editor/html/wang-editor/wang-editor.css +1 -1
- package/es/editor/html/wang-editor/wang-editor.mjs +7 -7
- package/es/editor/span/span/span.mjs +3 -1
- package/es/editor/text-box/ibiz-input-number/ibiz-input-number.mjs +12 -10
- package/es/editor/text-box/input/input.mjs +3 -0
- package/es/editor/user/ibiz-searchcond-edit/ibiz-searchcond-edit.mjs +1 -1
- package/es/locale/en/index.d.ts +4 -0
- package/es/locale/en/index.mjs +5 -1
- package/es/locale/zh-CN/index.d.ts +4 -0
- package/es/locale/zh-CN/index.mjs +5 -1
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/h.mjs +89 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/helpers/attachto.mjs +47 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/hooks.mjs +1 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/htmldomapi.mjs +115 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/index.mjs +18 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/init.mjs +376 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/is.mjs +9 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/jsx.mjs +64 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/attributes.mjs +59 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/class.mjs +28 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/dataset.mjs +42 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/eventlisteners.mjs +85 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/props.mjs +24 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/style.mjs +115 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/thunk.mjs +52 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/tovnode.mjs +62 -0
- package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/vnode.mjs +6 -0
- package/es/panel-component/nav-tabs/nav-tabs.controller.mjs +3 -2
- package/es/panel-component/panel-button/panel-button.mjs +1 -1
- package/es/view-engine/edit-view.engine.mjs +3 -2
- package/es/view-engine/opt-view.engine.mjs +2 -1
- package/es/view-engine/pickup-tree-view.engine.mjs +1 -0
- package/es/web-app/attach-environment-config.mjs +2 -1
- package/lib/common/action-toolbar/action-toolbar.cjs +1 -1
- package/lib/common/custom-theme/custom-theme.cjs +1 -1
- package/lib/common/data-import2/data-import2.cjs +4 -1
- package/lib/control/context-menu/context-menu.cjs +2 -2
- package/lib/control/dashboard/custom-dashboard-container/custom-dashboard-container.cjs +1 -1
- package/lib/control/dashboard/dashboard-design/dashboard-design.cjs +3 -3
- package/lib/control/drtab/drtab-control.util.cjs +7 -11
- package/lib/control/form/form-detail/form-button/form-button.cjs +1 -1
- package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.cjs +51 -6
- package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.css +1 -1
- package/lib/control/form/form-detail/form-item/form-item.cjs +4 -0
- package/lib/control/grid/grid/grid-control.util.cjs +24 -83
- package/lib/control/grid/grid/grid.cjs +1 -7
- package/lib/control/grid/grid/grid.css +1 -1
- package/lib/control/report-panel/report-panel.cjs +5 -0
- package/lib/control/search-bar/search-bar.cjs +2 -2
- package/lib/control/toolbar/export-excel/export-excel.cjs +2 -2
- package/lib/control/toolbar/short-cut-button/short-cut-button.cjs +4 -1
- package/lib/control/toolbar/toolbar.cjs +146 -10
- package/lib/control/toolbar/toolbar.css +1 -1
- package/lib/control/tree/tree.cjs +5 -1
- package/lib/editor/data-picker/ibiz-mpicker/ibiz-mpicker.css +1 -1
- package/lib/editor/data-picker/ibiz-picker/ibiz-picker.cjs +2 -2
- package/lib/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.cjs +48 -3
- package/lib/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.css +1 -1
- package/lib/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.cjs +2 -2
- package/lib/editor/dropdown-list/dropdown-list-editor.controller.cjs +10 -1
- package/lib/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.cjs +17 -4
- package/lib/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.cjs +24 -10
- package/lib/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.css +1 -1
- package/lib/editor/html/html-editor.controller.cjs +169 -6
- package/lib/editor/html/wang-editor/component/emoji/emoji.cjs +44 -0
- package/lib/editor/html/wang-editor/component/emoji/emoji.css +1 -0
- package/lib/editor/html/wang-editor/component/index.cjs +7 -0
- package/lib/editor/html/wang-editor/element/emoji.cjs +24 -0
- package/lib/editor/html/wang-editor/element/index.cjs +7 -0
- package/lib/editor/html/wang-editor/index.cjs +19 -0
- package/lib/editor/html/wang-editor/module/ai-module.cjs +78 -0
- package/lib/editor/html/wang-editor/module/emoji-module.cjs +127 -0
- package/lib/editor/html/wang-editor/module/index.cjs +9 -0
- package/lib/editor/html/wang-editor/plugin/index.cjs +7 -0
- package/lib/editor/html/wang-editor/plugin/plugin.cjs +25 -0
- package/lib/editor/html/wang-editor/wang-editor.cjs +7 -7
- package/lib/editor/html/wang-editor/wang-editor.css +1 -1
- package/lib/editor/span/span/span.cjs +2 -0
- package/lib/editor/text-box/ibiz-input-number/ibiz-input-number.cjs +12 -10
- package/lib/editor/text-box/input/input.cjs +3 -0
- package/lib/editor/user/ibiz-searchcond-edit/ibiz-searchcond-edit.cjs +1 -1
- package/lib/locale/en/index.cjs +5 -1
- package/lib/locale/zh-CN/index.cjs +5 -1
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/h.cjs +93 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/helpers/attachto.cjs +49 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/hooks.cjs +2 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/htmldomapi.cjs +117 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/index.cjs +42 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/init.cjs +378 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/is.cjs +12 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/jsx.cjs +67 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/attributes.cjs +61 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/class.cjs +30 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/dataset.cjs +44 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/eventlisteners.cjs +87 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/props.cjs +26 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/style.cjs +117 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/thunk.cjs +54 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/tovnode.cjs +64 -0
- package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/vnode.cjs +8 -0
- package/lib/panel-component/nav-tabs/nav-tabs.controller.cjs +3 -2
- package/lib/panel-component/panel-button/panel-button.cjs +1 -1
- package/lib/view-engine/edit-view.engine.cjs +3 -2
- package/lib/view-engine/opt-view.engine.cjs +2 -1
- package/lib/view-engine/pickup-tree-view.engine.cjs +1 -0
- package/lib/web-app/attach-environment-config.cjs +2 -1
- package/package.json +8 -7
- package/dist/index-28jZm-aB.js +0 -4
- package/dist/wang-editor-XpJH4SXt.js +0 -1
- package/es/editor/html/wang-editor/ai/ai-modules.d.ts +0 -10
- package/es/editor/html/wang-editor/ai/ai-modules.mjs +0 -32
- package/lib/editor/html/wang-editor/ai/ai-modules.cjs +0 -34
- /package/es/node_modules/.pnpm/{@ibiz-template_core@0.7.26_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1 → @ibiz-template_core@0.7.28-alpha.0_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1}/node_modules/@ibiz-template/core/out/utils/namespace/namespace.mjs +0 -0
- /package/lib/node_modules/.pnpm/{@ibiz-template_core@0.7.26_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1 → @ibiz-template_core@0.7.28-alpha.0_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1}/node_modules/@ibiz-template/core/out/utils/namespace/namespace.cjs +0 -0
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, computed, watch, createVNode, resolveComponent, defineComponent } from 'vue';
|
|
2
2
|
import { getDropdownProps, getEditorEmits, useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
-
import { strToBase64, base64ToStr } from '@ibiz-template/core';
|
|
3
|
+
import { strToBase64, isEmoji, base64ToStr } from '@ibiz-template/core';
|
|
4
4
|
import './ibiz-emoji-picker.css';
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
|
-
function _isSlot(s) {
|
|
8
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
9
|
-
}
|
|
10
7
|
const IBizEmojiPicker = /* @__PURE__ */ defineComponent({
|
|
11
8
|
name: "IBizEmojiPicker",
|
|
12
9
|
props: getDropdownProps(),
|
|
@@ -16,8 +13,15 @@ const IBizEmojiPicker = /* @__PURE__ */ defineComponent({
|
|
|
16
13
|
}) {
|
|
17
14
|
const ns = useNamespace("emoji-picker");
|
|
18
15
|
const c = props.controller;
|
|
16
|
+
const emojiRef = ref();
|
|
19
17
|
const emoji = ref("");
|
|
20
18
|
const visible = ref(false);
|
|
19
|
+
const showFormDefaultContent = computed(() => {
|
|
20
|
+
if (props.controlParams && props.controlParams.editmode === "hover" && !props.readonly) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
});
|
|
21
25
|
const onAddEmoji = (e) => {
|
|
22
26
|
e.stopPropagation();
|
|
23
27
|
e.preventDefault();
|
|
@@ -29,14 +33,17 @@ const IBizEmojiPicker = /* @__PURE__ */ defineComponent({
|
|
|
29
33
|
emoji.value = "";
|
|
30
34
|
visible.value = false;
|
|
31
35
|
emit("change", "");
|
|
36
|
+
emojiRef.value.click();
|
|
32
37
|
};
|
|
33
38
|
const onSelect = (val) => {
|
|
34
|
-
emoji.value = val.data;
|
|
35
39
|
visible.value = false;
|
|
40
|
+
emoji.value = val.data;
|
|
36
41
|
emit("change", strToBase64(val.data));
|
|
37
42
|
};
|
|
38
|
-
watch(() => props.value, (newVal) => {
|
|
39
|
-
|
|
43
|
+
watch(() => props.value, (newVal, oldVal) => {
|
|
44
|
+
if (newVal !== oldVal) {
|
|
45
|
+
emoji.value = newVal && isEmoji("".concat(newVal)) ? base64ToStr(newVal) : newVal;
|
|
46
|
+
}
|
|
40
47
|
}, {
|
|
41
48
|
immediate: true
|
|
42
49
|
});
|
|
@@ -77,12 +84,16 @@ const IBizEmojiPicker = /* @__PURE__ */ defineComponent({
|
|
|
77
84
|
}
|
|
78
85
|
return content;
|
|
79
86
|
};
|
|
87
|
+
const renderFormDefaultContent = () => {
|
|
88
|
+
return createVNode("div", {
|
|
89
|
+
"class": [ns.b("form-default-content"), ns.is("clear", !!emoji.value)]
|
|
90
|
+
}, [emoji.value ? emoji.value : "-"]);
|
|
91
|
+
};
|
|
80
92
|
const renderReference = () => {
|
|
81
|
-
let _slot;
|
|
82
93
|
return createVNode(resolveComponent("el-button"), {
|
|
83
94
|
"class": [ns.e("button"), ns.is("clear", !!emoji.value)]
|
|
84
|
-
},
|
|
85
|
-
default: () => [
|
|
95
|
+
}, {
|
|
96
|
+
default: () => [showFormDefaultContent.value && renderFormDefaultContent(), renderButtonContent()]
|
|
86
97
|
});
|
|
87
98
|
};
|
|
88
99
|
return {
|
|
@@ -90,6 +101,8 @@ const IBizEmojiPicker = /* @__PURE__ */ defineComponent({
|
|
|
90
101
|
c,
|
|
91
102
|
emoji,
|
|
92
103
|
visible,
|
|
104
|
+
emojiRef,
|
|
105
|
+
showFormDefaultContent,
|
|
93
106
|
onSelect,
|
|
94
107
|
onAddEmoji,
|
|
95
108
|
onClearEmoji,
|
|
@@ -98,7 +111,8 @@ const IBizEmojiPicker = /* @__PURE__ */ defineComponent({
|
|
|
98
111
|
},
|
|
99
112
|
render() {
|
|
100
113
|
return createVNode("div", {
|
|
101
|
-
"
|
|
114
|
+
"ref": "emojiRef",
|
|
115
|
+
"class": [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : "", this.ns.is("active", this.visible), this.ns.is("show-default", this.showFormDefaultContent)]
|
|
102
116
|
}, [createVNode(resolveComponent("el-popover"), {
|
|
103
117
|
"trigger": "click",
|
|
104
118
|
"placement": "bottom-start",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EditorController, IAppDEService } from '@ibiz-template/runtime';
|
|
2
2
|
import { IAppDEACMode, IHtml } from '@ibiz/model-core';
|
|
3
|
+
import { IDomEditor } from '@wangeditor/editor';
|
|
3
4
|
/**
|
|
4
5
|
* html框编辑器控制器
|
|
5
6
|
*
|
|
@@ -39,5 +40,92 @@ export declare class HtmlEditorController extends EditorController<IHtml> {
|
|
|
39
40
|
* @type {boolean}
|
|
40
41
|
*/
|
|
41
42
|
chatCompletion: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* wangEditor 实例
|
|
45
|
+
*
|
|
46
|
+
* @private
|
|
47
|
+
* @type {IDomEditor}
|
|
48
|
+
* @memberof HtmlEditorController
|
|
49
|
+
*/
|
|
50
|
+
private wangEditor;
|
|
51
|
+
/**
|
|
52
|
+
* 气泡容器
|
|
53
|
+
*
|
|
54
|
+
* @type {(IOverlayPopoverContainer | null)}
|
|
55
|
+
* @memberof HtmlEditorController
|
|
56
|
+
*/
|
|
57
|
+
private overlay;
|
|
58
|
+
/**
|
|
59
|
+
* 清除回调
|
|
60
|
+
*
|
|
61
|
+
* @private
|
|
62
|
+
* @memberof HtmlEditorController
|
|
63
|
+
*/
|
|
64
|
+
private cleanup;
|
|
65
|
+
/**
|
|
66
|
+
* 预定义阻止捕获事件code
|
|
67
|
+
*
|
|
68
|
+
* @private
|
|
69
|
+
* @type {number[]}
|
|
70
|
+
* @memberof HtmlEditorController
|
|
71
|
+
*/
|
|
72
|
+
private presetPreventEvents;
|
|
73
|
+
/**
|
|
74
|
+
* 预定义阻止冒泡事件code
|
|
75
|
+
*
|
|
76
|
+
* @private
|
|
77
|
+
* @type {number[]}
|
|
78
|
+
* @memberof HtmlEditorController
|
|
79
|
+
*/
|
|
80
|
+
private presetPreventPropEvents;
|
|
81
|
+
/**
|
|
82
|
+
* 初始化
|
|
83
|
+
*
|
|
84
|
+
* @protected
|
|
85
|
+
* @return {*} {Promise<void>}
|
|
86
|
+
* @memberof HtmlEditorController
|
|
87
|
+
*/
|
|
42
88
|
protected onInit(): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* 自定义注册
|
|
91
|
+
*
|
|
92
|
+
* @private
|
|
93
|
+
* @memberof HtmlEditorController
|
|
94
|
+
*/
|
|
95
|
+
private customRegister;
|
|
96
|
+
/**
|
|
97
|
+
* wangEditor 创建完成
|
|
98
|
+
*
|
|
99
|
+
* @private
|
|
100
|
+
* @param {IDomEditor} editor
|
|
101
|
+
* @memberof HtmlEditorController
|
|
102
|
+
*/
|
|
103
|
+
onCreated(editor: IDomEditor): void;
|
|
104
|
+
/**
|
|
105
|
+
* 监听事件
|
|
106
|
+
*
|
|
107
|
+
* @private
|
|
108
|
+
* @memberof HtmlEditorController
|
|
109
|
+
*/
|
|
110
|
+
private listenEvent;
|
|
111
|
+
/**
|
|
112
|
+
* 打开表情选择
|
|
113
|
+
*
|
|
114
|
+
* @memberof HtmlEditorController
|
|
115
|
+
*/
|
|
116
|
+
private openEmojiSelect;
|
|
117
|
+
/**
|
|
118
|
+
* 添加表情
|
|
119
|
+
*
|
|
120
|
+
* @param {string} data
|
|
121
|
+
* @memberof HtmlEditorController
|
|
122
|
+
*/
|
|
123
|
+
private addEmojiNode;
|
|
124
|
+
/**
|
|
125
|
+
* 销毁
|
|
126
|
+
*
|
|
127
|
+
* @private
|
|
128
|
+
* @memberof HtmlEditorController
|
|
129
|
+
*/
|
|
130
|
+
onDestroyed(): void;
|
|
43
131
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import { h } from 'vue';
|
|
1
2
|
import { EditorController, getDeACMode } from '@ibiz-template/runtime';
|
|
3
|
+
import { NOOP, listenJSEvent } from '@ibiz-template/core';
|
|
2
4
|
import { Boot } from '@wangeditor/editor';
|
|
3
|
-
import
|
|
5
|
+
import './wang-editor/index.mjs';
|
|
6
|
+
import { AIMenu } from './wang-editor/module/ai-module.mjs';
|
|
7
|
+
import { EmojiElem } from './wang-editor/element/emoji.mjs';
|
|
8
|
+
import { EmojiModule } from './wang-editor/module/emoji-module.mjs';
|
|
9
|
+
import { Plugin } from './wang-editor/plugin/plugin.mjs';
|
|
10
|
+
import { Emoji } from './wang-editor/component/emoji/emoji.mjs';
|
|
4
11
|
|
|
5
12
|
"use strict";
|
|
6
13
|
var __defProp = Object.defineProperty;
|
|
@@ -43,9 +50,55 @@ class HtmlEditorController extends EditorController {
|
|
|
43
50
|
* @type {boolean}
|
|
44
51
|
*/
|
|
45
52
|
__publicField(this, "chatCompletion", false);
|
|
53
|
+
/**
|
|
54
|
+
* wangEditor 实例
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
* @type {IDomEditor}
|
|
58
|
+
* @memberof HtmlEditorController
|
|
59
|
+
*/
|
|
60
|
+
__publicField(this, "wangEditor");
|
|
61
|
+
/**
|
|
62
|
+
* 气泡容器
|
|
63
|
+
*
|
|
64
|
+
* @type {(IOverlayPopoverContainer | null)}
|
|
65
|
+
* @memberof HtmlEditorController
|
|
66
|
+
*/
|
|
67
|
+
__publicField(this, "overlay", null);
|
|
68
|
+
/**
|
|
69
|
+
* 清除回调
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
* @memberof HtmlEditorController
|
|
73
|
+
*/
|
|
74
|
+
__publicField(this, "cleanup", NOOP);
|
|
75
|
+
/**
|
|
76
|
+
* 预定义阻止捕获事件code
|
|
77
|
+
*
|
|
78
|
+
* @private
|
|
79
|
+
* @type {number[]}
|
|
80
|
+
* @memberof HtmlEditorController
|
|
81
|
+
*/
|
|
82
|
+
__publicField(this, "presetPreventEvents", [13, 38, 40]);
|
|
83
|
+
/**
|
|
84
|
+
* 预定义阻止冒泡事件code
|
|
85
|
+
*
|
|
86
|
+
* @private
|
|
87
|
+
* @type {number[]}
|
|
88
|
+
* @memberof HtmlEditorController
|
|
89
|
+
*/
|
|
90
|
+
__publicField(this, "presetPreventPropEvents", [27]);
|
|
46
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* 初始化
|
|
94
|
+
*
|
|
95
|
+
* @protected
|
|
96
|
+
* @return {*} {Promise<void>}
|
|
97
|
+
* @memberof HtmlEditorController
|
|
98
|
+
*/
|
|
47
99
|
async onInit() {
|
|
48
100
|
await super.onInit();
|
|
101
|
+
this.customRegister();
|
|
49
102
|
if (this.editorParams) {
|
|
50
103
|
const { uploadParams, exportParams } = this.editorParams;
|
|
51
104
|
if (uploadParams) {
|
|
@@ -85,14 +138,124 @@ class HtmlEditorController extends EditorController {
|
|
|
85
138
|
}
|
|
86
139
|
}
|
|
87
140
|
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 自定义注册
|
|
144
|
+
*
|
|
145
|
+
* @private
|
|
146
|
+
* @memberof HtmlEditorController
|
|
147
|
+
*/
|
|
148
|
+
customRegister() {
|
|
88
149
|
if (!window.aichartRegister) {
|
|
89
|
-
Boot.registerMenu(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
150
|
+
Boot.registerMenu(AIMenu);
|
|
151
|
+
window.aichartRegister = true;
|
|
152
|
+
}
|
|
153
|
+
if (!window.customElements.get("emoji-elem")) {
|
|
154
|
+
window.customElements.define("emoji-elem", EmojiElem);
|
|
155
|
+
}
|
|
156
|
+
if (!window.emojiIsRegiter) {
|
|
157
|
+
Boot.registerModule(EmojiModule);
|
|
158
|
+
window.emojiIsRegiter = true;
|
|
159
|
+
}
|
|
160
|
+
if (!window.wangEditorPlugin) {
|
|
161
|
+
Boot.registerPlugin(Plugin);
|
|
162
|
+
window.wangEditorPlugin = true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* wangEditor 创建完成
|
|
167
|
+
*
|
|
168
|
+
* @private
|
|
169
|
+
* @param {IDomEditor} editor
|
|
170
|
+
* @memberof HtmlEditorController
|
|
171
|
+
*/
|
|
172
|
+
onCreated(editor) {
|
|
173
|
+
this.wangEditor = editor;
|
|
174
|
+
this.listenEvent();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* 监听事件
|
|
178
|
+
*
|
|
179
|
+
* @private
|
|
180
|
+
* @memberof HtmlEditorController
|
|
181
|
+
*/
|
|
182
|
+
listenEvent() {
|
|
183
|
+
const container = this.wangEditor.getEditableContainer();
|
|
184
|
+
this.wangEditor.on("openEmojiSelect", () => this.openEmojiSelect());
|
|
185
|
+
this.cleanup = listenJSEvent(container, "keydown", (event) => {
|
|
186
|
+
var _a;
|
|
187
|
+
if (this.overlay && this.presetPreventEvents.includes(event.keyCode)) {
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
}
|
|
190
|
+
if (this.overlay && this.presetPreventPropEvents.includes(event.keyCode)) {
|
|
191
|
+
event.stopPropagation();
|
|
192
|
+
(_a = this.overlay) == null ? void 0 : _a.dismiss();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* 打开表情选择
|
|
198
|
+
*
|
|
199
|
+
* @memberof HtmlEditorController
|
|
200
|
+
*/
|
|
201
|
+
async openEmojiSelect() {
|
|
202
|
+
const domSelection = document.getSelection();
|
|
203
|
+
const { focusNode } = domSelection;
|
|
204
|
+
if (focusNode) {
|
|
205
|
+
this.overlay = ibiz.overlay.createPopover(
|
|
206
|
+
(modal) => {
|
|
207
|
+
return h(Emoji, {
|
|
208
|
+
modal
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
void 0,
|
|
212
|
+
{
|
|
213
|
+
width: "auto",
|
|
214
|
+
noArrow: true,
|
|
215
|
+
autoClose: true,
|
|
216
|
+
placement: "bottom-start"
|
|
93
217
|
}
|
|
218
|
+
);
|
|
219
|
+
await this.overlay.present(focusNode.parentNode);
|
|
220
|
+
this.overlay.onWillDismiss().then((result) => {
|
|
221
|
+
var _a;
|
|
222
|
+
const _result = result;
|
|
223
|
+
const item = (_a = _result.data) == null ? void 0 : _a[0];
|
|
224
|
+
if (_result.ok && item) {
|
|
225
|
+
this.addEmojiNode(item);
|
|
226
|
+
}
|
|
227
|
+
this.overlay = null;
|
|
94
228
|
});
|
|
95
|
-
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 添加表情
|
|
233
|
+
*
|
|
234
|
+
* @param {string} data
|
|
235
|
+
* @memberof HtmlEditorController
|
|
236
|
+
*/
|
|
237
|
+
addEmojiNode(data) {
|
|
238
|
+
const emojiNode = {
|
|
239
|
+
data,
|
|
240
|
+
type: "emoji",
|
|
241
|
+
children: [{ text: "" }]
|
|
242
|
+
};
|
|
243
|
+
this.wangEditor.restoreSelection();
|
|
244
|
+
this.wangEditor.insertNode(emojiNode);
|
|
245
|
+
this.wangEditor.move(1);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* 销毁
|
|
249
|
+
*
|
|
250
|
+
* @private
|
|
251
|
+
* @memberof HtmlEditorController
|
|
252
|
+
*/
|
|
253
|
+
onDestroyed() {
|
|
254
|
+
if (this.cleanup !== NOOP) {
|
|
255
|
+
this.cleanup();
|
|
256
|
+
}
|
|
257
|
+
if (this.overlay) {
|
|
258
|
+
this.overlay.dismiss();
|
|
96
259
|
}
|
|
97
260
|
}
|
|
98
261
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-html-emoji{width:auto;height:auto}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { IModal } from '@ibiz-template/runtime';
|
|
3
|
+
import './emoji.scss';
|
|
4
|
+
export declare const Emoji: import("vue").DefineComponent<{
|
|
5
|
+
modal: {
|
|
6
|
+
type: PropType<IModal>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
}, {
|
|
10
|
+
ns: import("@ibiz-template/core").Namespace;
|
|
11
|
+
onSelect: (val: IData) => void;
|
|
12
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
modal: {
|
|
14
|
+
type: PropType<IModal>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
}>>, {}, {}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { resolveComponent, createVNode, defineComponent } from 'vue';
|
|
2
|
+
import { strToBase64 } from '@ibiz-template/core';
|
|
3
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
4
|
+
import './emoji.css';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
const Emoji = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "IBizHtmlEmoji",
|
|
9
|
+
props: {
|
|
10
|
+
modal: {
|
|
11
|
+
type: Object,
|
|
12
|
+
required: true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(props) {
|
|
16
|
+
const ns = useNamespace("html-emoji");
|
|
17
|
+
const onSelect = (val) => {
|
|
18
|
+
const modalData = {
|
|
19
|
+
ok: true,
|
|
20
|
+
data: [{
|
|
21
|
+
emoji: strToBase64(val.data)
|
|
22
|
+
}]
|
|
23
|
+
};
|
|
24
|
+
props.modal.dismiss(modalData);
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
ns,
|
|
28
|
+
onSelect
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
render() {
|
|
32
|
+
return createVNode("div", {
|
|
33
|
+
"class": this.ns.b()
|
|
34
|
+
}, [createVNode(resolveComponent("iBizEmojiSelect"), {
|
|
35
|
+
"dark": true,
|
|
36
|
+
"continuousList": true,
|
|
37
|
+
"onSelect": this.onSelect
|
|
38
|
+
}, null)]);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export { Emoji };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './emoji/emoji';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
class EmojiElem extends HTMLElement {
|
|
3
|
+
// 监听的 attr
|
|
4
|
+
static get observedAttributes() {
|
|
5
|
+
return ["data-value"];
|
|
6
|
+
}
|
|
7
|
+
attributeChangedCallback(tag, oldValue, newValue) {
|
|
8
|
+
if (tag === "data-value") {
|
|
9
|
+
if (newValue && oldValue === newValue)
|
|
10
|
+
return;
|
|
11
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
12
|
+
const document = shadow.ownerDocument;
|
|
13
|
+
const box = document.createElement("span");
|
|
14
|
+
box.innerHTML = newValue;
|
|
15
|
+
box.part.add("box");
|
|
16
|
+
box.classList.add("emoji-elem_box");
|
|
17
|
+
shadow.appendChild(box);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { EmojiElem };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmojiElem } from './emoji';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './module/index.mjs';
|
|
2
|
+
import './element/index.mjs';
|
|
3
|
+
import './plugin/index.mjs';
|
|
4
|
+
import './component/index.mjs';
|
|
5
|
+
export { AIMenu } from './module/ai-module.mjs';
|
|
6
|
+
export { EmojiModule } from './module/emoji-module.mjs';
|
|
7
|
+
export { EmojiElem } from './element/emoji.mjs';
|
|
8
|
+
export { Plugin } from './plugin/plugin.mjs';
|
|
9
|
+
export { Emoji } from './component/emoji/emoji.mjs';
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { IButtonMenu, IDomEditor } from '@wangeditor/editor';
|
|
2
|
+
/**
|
|
3
|
+
* AI菜单项
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @class AIButtonMenu
|
|
7
|
+
* @implements {IButtonMenu}
|
|
8
|
+
*/
|
|
9
|
+
declare class AIButtonMenu implements IButtonMenu {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
* @type {string}
|
|
14
|
+
* @memberof AIButtonMenu
|
|
15
|
+
*/
|
|
16
|
+
title: string;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof AIButtonMenu
|
|
22
|
+
*/
|
|
23
|
+
iconSvg: string;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @memberof AIButtonMenu
|
|
29
|
+
*/
|
|
30
|
+
tag: string;
|
|
31
|
+
/**
|
|
32
|
+
* 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false
|
|
33
|
+
*
|
|
34
|
+
* @return {*} {boolean}
|
|
35
|
+
* @memberof AIButtonMenu
|
|
36
|
+
*/
|
|
37
|
+
isActive(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 获取菜单执行时的 value ,用不到则返回空 字符串或 false
|
|
40
|
+
*
|
|
41
|
+
* @return {*} {(string | boolean)}
|
|
42
|
+
* @memberof AIButtonMenu
|
|
43
|
+
*/
|
|
44
|
+
getValue(): string | boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false
|
|
47
|
+
*
|
|
48
|
+
* @return {*} {boolean}
|
|
49
|
+
* @memberof AIButtonMenu
|
|
50
|
+
*/
|
|
51
|
+
isDisabled(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 点击菜单时触发的函数
|
|
54
|
+
*
|
|
55
|
+
* @param {IDomEditor} editor
|
|
56
|
+
* @memberof AIButtonMenu
|
|
57
|
+
*/
|
|
58
|
+
exec(editor: IDomEditor): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Ai菜单
|
|
62
|
+
*/
|
|
63
|
+
export declare const AIMenu: {
|
|
64
|
+
key: string;
|
|
65
|
+
factory(): AIButtonMenu;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
class AIButtonMenu {
|
|
9
|
+
constructor() {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
* @type {string}
|
|
14
|
+
* @memberof AIButtonMenu
|
|
15
|
+
*/
|
|
16
|
+
__publicField(this, "title", "AI");
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof AIButtonMenu
|
|
22
|
+
*/
|
|
23
|
+
__publicField(this, "iconSvg", '<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <text x="0" y="13" font-size="16" fill="black">AI</text></svg>');
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @memberof AIButtonMenu
|
|
29
|
+
*/
|
|
30
|
+
__publicField(this, "tag", "button");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false
|
|
34
|
+
*
|
|
35
|
+
* @return {*} {boolean}
|
|
36
|
+
* @memberof AIButtonMenu
|
|
37
|
+
*/
|
|
38
|
+
isActive() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 获取菜单执行时的 value ,用不到则返回空 字符串或 false
|
|
43
|
+
*
|
|
44
|
+
* @return {*} {(string | boolean)}
|
|
45
|
+
* @memberof AIButtonMenu
|
|
46
|
+
*/
|
|
47
|
+
getValue() {
|
|
48
|
+
return "aichart";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false
|
|
52
|
+
*
|
|
53
|
+
* @return {*} {boolean}
|
|
54
|
+
* @memberof AIButtonMenu
|
|
55
|
+
*/
|
|
56
|
+
isDisabled() {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 点击菜单时触发的函数
|
|
61
|
+
*
|
|
62
|
+
* @param {IDomEditor} editor
|
|
63
|
+
* @memberof AIButtonMenu
|
|
64
|
+
*/
|
|
65
|
+
exec(editor) {
|
|
66
|
+
editor.emit("aiClick");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const AIMenu = {
|
|
70
|
+
key: "aichart",
|
|
71
|
+
factory() {
|
|
72
|
+
return new AIButtonMenu();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { AIMenu };
|