orion-design 0.1.30 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -5
- package/dist/Throne/index.js +30 -14
- package/dist/Throne/index.js.map +1 -1
- package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
- package/dist/components/Button/index.js +40 -33
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +122 -89
- package/dist/components/Flex/index.js.map +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.js +2 -2
- package/dist/components/Form/LovInput/LovInput.js.map +1 -1
- package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
- package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
- package/dist/components/Form/LovInput/index.js +4 -4
- package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
- package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
- package/dist/components/Form/hooks/index.js +128 -66
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.js +836 -656
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +30 -18
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/index.js +179 -105
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/index.js +111 -56
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/types.js +4 -3
- package/dist/components/Modal/types.js.map +1 -1
- package/dist/components/Modal/useModal.js +5 -5
- package/dist/components/Modal/useModal.js.map +1 -1
- package/dist/components/Pagetable/hooks/useColumns.js +88 -80
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.js +687 -542
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +92 -54
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/hooks/useColumns.js +82 -74
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.js +579 -469
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +92 -54
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +100 -74
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/Tabs/constants.js +2 -2
- package/dist/components/Tabs/constants.js.map +1 -1
- package/dist/components/Tabs/index.js +603 -358
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tab-bar.js +6 -6
- package/dist/components/Tabs/tab-bar.js.map +1 -1
- package/dist/components/Tabs/tab-pane.js +3 -3
- package/dist/components/Tabs/tab-pane.js.map +1 -1
- package/dist/components/_constants/aria.js +2 -2
- package/dist/components/_constants/aria.js.map +1 -1
- package/dist/components/_constants/event.js +6 -4
- package/dist/components/_constants/event.js.map +1 -1
- package/dist/components/_constants/index.js +6 -6
- package/dist/components/_hooks/index.js +7 -7
- package/dist/components/_hooks/use-namespace/index.js +74 -39
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +29 -19
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +9 -5
- package/dist/components/_util/arrays.js.map +1 -1
- package/dist/components/_util/browser.js +6 -6
- package/dist/components/_util/browser.js.map +1 -1
- package/dist/components/_util/classNames.js +22 -17
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +74 -39
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +9 -8
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +14 -7
- package/dist/components/_util/dom/event.js.map +1 -1
- package/dist/components/_util/dom/index.js +36 -36
- package/dist/components/_util/dom/position.js +49 -25
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +103 -61
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +65 -50
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +8 -4
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +12 -11
- package/dist/components/_util/error.js.map +1 -1
- package/dist/components/_util/functions.js +3 -3
- package/dist/components/_util/i18n.js +2 -2
- package/dist/components/_util/i18n.js.map +1 -1
- package/dist/components/_util/index.js +137 -137
- package/dist/components/_util/isValid.js +4 -2
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +18 -14
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +46 -20
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +18 -10
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +5 -4
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +4 -3
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +9 -8
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +16 -10
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +41 -38
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +41 -22
- package/dist/components/_util/types.js.map +1 -1
- package/dist/components/_util/typescript.js +2 -2
- package/dist/components/_util/typescript.js.map +1 -1
- package/dist/components/_util/util.js +85 -43
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +27 -15
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +29 -25
- package/dist/components/_util/vue/icon.js.map +1 -1
- package/dist/components/_util/vue/index.js +41 -41
- package/dist/components/_util/vue/install.js +35 -18
- package/dist/components/_util/vue/install.js.map +1 -1
- package/dist/components/_util/vue/props/index.js +6 -6
- package/dist/components/_util/vue/props/runtime.js +46 -30
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +12 -6
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +5 -3
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +5 -4
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +100 -54
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +231 -220
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.js +20 -20
- package/dist/components/index.js +38 -35
- package/dist/components/index.js.map +1 -1
- package/dist/components-B3d9m_tn.js +27 -0
- package/dist/components-B3d9m_tn.js.map +1 -0
- package/dist/error/OrionError.js +8 -4
- package/dist/error/OrionError.js.map +1 -1
- package/dist/functions-BeMkokbY.js +63 -0
- package/dist/functions-BeMkokbY.js.map +1 -0
- package/dist/index-BOKLZnqH.js +54 -0
- package/dist/index-BOKLZnqH.js.map +1 -0
- package/dist/index-D1m0KTpK.js +69 -0
- package/dist/index-D1m0KTpK.js.map +1 -0
- package/dist/index-DR5ZP7mD.js +160 -0
- package/dist/index-DR5ZP7mD.js.map +1 -0
- package/dist/index-DkwIULcN.js +200 -0
- package/dist/index-DkwIULcN.js.map +1 -0
- package/dist/index.css +797 -1
- package/dist/index.js +36 -36
- package/dist/print/LodopFuncs.js +101 -43
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +200 -108
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +17 -14
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +16 -13
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +17 -14
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +47 -22
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +40 -25
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +16 -10
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +305 -201
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +11 -5
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +11 -5
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +9 -4
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +11 -5
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +48 -33
- package/dist/utils/DateUtil.js.map +1 -1
- package/dist/utils/NumberUtil.js +6 -6
- package/dist/utils/NumberUtil.js.map +1 -1
- package/dist/utils/cloneDeep.js +2 -2
- package/dist/utils/delay.js +3 -3
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/functions.js +3 -3
- package/dist/utils/index.js +12 -12
- package/dist/utils/md5.js +191 -93
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +35 -25
- package/dist/utils/uuid.js.map +1 -1
- package/dist/version/index.js +2 -2
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +2 -2
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
@@ -1,106 +1,132 @@
|
|
1
1
|
import "lodash-es";
|
2
|
-
import { defineComponent
|
3
|
-
import { withInstall
|
2
|
+
import { defineComponent, ref, onMounted, watch, onBeforeUnmount, createVNode } from "vue";
|
3
|
+
import { withInstall } from "../_util/vue/install.js";
|
4
4
|
import "element-plus";
|
5
|
-
import
|
6
|
-
import { booleanType
|
7
|
-
import { createEditor
|
8
|
-
const
|
5
|
+
import OrionError from "../../error/OrionError.js";
|
6
|
+
import { booleanType, functionType } from "../_util/type.js";
|
7
|
+
import { createEditor, createToolbar } from "@wangeditor/editor";
|
8
|
+
const richTextEditorProps = () => ({
|
9
9
|
modelValue: String,
|
10
|
-
readonly:
|
11
|
-
uploadImage:
|
12
|
-
})
|
10
|
+
readonly: booleanType(false),
|
11
|
+
uploadImage: functionType()
|
12
|
+
});
|
13
|
+
const RichTextEditor = /* @__PURE__ */ defineComponent({
|
13
14
|
name: "ORichTextEditor",
|
14
|
-
inheritAttrs:
|
15
|
-
props:
|
15
|
+
inheritAttrs: false,
|
16
|
+
props: richTextEditorProps(),
|
16
17
|
emits: ["update:modelValue"],
|
17
|
-
setup(
|
18
|
-
slots
|
19
|
-
attrs
|
20
|
-
emit
|
21
|
-
expose
|
18
|
+
setup(props, {
|
19
|
+
slots,
|
20
|
+
attrs,
|
21
|
+
emit,
|
22
|
+
expose
|
22
23
|
}) {
|
23
|
-
const
|
24
|
-
|
24
|
+
const editorRef = ref(null);
|
25
|
+
const editorWrapperDOMRef = ref();
|
26
|
+
const editorContainerDOMRef = ref();
|
27
|
+
const toolbarContainerDOMRef = ref();
|
28
|
+
expose({
|
25
29
|
focus: () => {
|
26
|
-
var
|
27
|
-
(
|
30
|
+
var _a;
|
31
|
+
(_a = editorRef.value) == null ? void 0 : _a.focus();
|
28
32
|
}
|
29
|
-
})
|
30
|
-
|
33
|
+
});
|
34
|
+
onMounted(() => {
|
35
|
+
const editorConfig = {
|
31
36
|
placeholder: "请输入内容...",
|
32
|
-
onChange(
|
33
|
-
const
|
34
|
-
|
37
|
+
onChange(editor2) {
|
38
|
+
const html = editor2.getHtml();
|
39
|
+
emit("update:modelValue", html);
|
35
40
|
},
|
36
|
-
readOnly:
|
37
|
-
autoFocus:
|
38
|
-
scroll:
|
41
|
+
readOnly: props.readonly,
|
42
|
+
autoFocus: true,
|
43
|
+
scroll: true,
|
39
44
|
MENU_CONF: {
|
40
45
|
uploadImage: {
|
41
46
|
// 自定义上传
|
42
|
-
async customUpload(
|
43
|
-
if (
|
44
|
-
const
|
45
|
-
if (
|
47
|
+
async customUpload(file, insertFn) {
|
48
|
+
if (props.uploadImage) {
|
49
|
+
const ret = await props.uploadImage(file);
|
50
|
+
if (ret == null || ret === false) {
|
46
51
|
return;
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
+
}
|
53
|
+
if (!ret.url) {
|
54
|
+
throw new OrionError(`RichTextEditor: 图片上传接口 uploadImage 的返回数据中未包含 url 字段。`);
|
55
|
+
}
|
56
|
+
insertFn(ret.url, ret.alt, ret.href);
|
57
|
+
} else {
|
58
|
+
throw new OrionError(`RichTextEditor: 未实现文件上传接口onUpload。`);
|
59
|
+
}
|
52
60
|
}
|
53
61
|
}
|
54
62
|
}
|
55
|
-
}
|
56
|
-
|
57
|
-
|
63
|
+
};
|
64
|
+
const editor = createEditor({
|
65
|
+
selector: editorContainerDOMRef.value,
|
66
|
+
html: props.modelValue,
|
58
67
|
// 初始值
|
59
|
-
config:
|
68
|
+
config: editorConfig,
|
60
69
|
mode: "default"
|
61
70
|
});
|
62
|
-
|
63
|
-
const
|
71
|
+
editorRef.value = editor;
|
72
|
+
const toolbarConfig = {
|
64
73
|
excludeKeys: ["blockquote", "bulletedList", "numberedList", "todo", "emotion", "insertLink", "insertImage", "group-video", "insertTable", "codeBlock"]
|
65
74
|
};
|
66
|
-
|
67
|
-
editor
|
68
|
-
selector:
|
69
|
-
config:
|
75
|
+
createToolbar({
|
76
|
+
editor,
|
77
|
+
selector: toolbarContainerDOMRef.value,
|
78
|
+
config: toolbarConfig,
|
70
79
|
mode: "default"
|
71
80
|
// or 'simple'
|
72
81
|
});
|
73
|
-
})
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}), b(() => {
|
78
|
-
e.value != null && (e.value.destroy(), e.value = null);
|
79
|
-
}), () => i("div", {
|
80
|
-
class: "orion-rich-text-editor—wrapper",
|
81
|
-
ref: h,
|
82
|
-
style: {
|
83
|
-
border: "1px solid #ccc",
|
84
|
-
zIndex: 100
|
85
|
-
}
|
86
|
-
}, [i("div", {
|
87
|
-
class: "orion-rich-text-toolbar-container",
|
88
|
-
ref: u,
|
89
|
-
style: {
|
90
|
-
borderBottom: "1px solid #ccc"
|
82
|
+
});
|
83
|
+
watch(() => props.modelValue, (modelValue) => {
|
84
|
+
if (editorRef.value) {
|
85
|
+
editorRef.value.setHtml(modelValue || "");
|
91
86
|
}
|
92
|
-
}
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
87
|
+
});
|
88
|
+
watch(() => props.readonly, (readonly) => {
|
89
|
+
if (editorRef.value) {
|
90
|
+
if (readonly) {
|
91
|
+
editorRef.value.disable();
|
92
|
+
} else {
|
93
|
+
editorRef.value.enable();
|
94
|
+
}
|
97
95
|
}
|
98
|
-
}
|
96
|
+
});
|
97
|
+
onBeforeUnmount(() => {
|
98
|
+
if (editorRef.value == null) return;
|
99
|
+
editorRef.value.destroy();
|
100
|
+
editorRef.value = null;
|
101
|
+
});
|
102
|
+
return () => {
|
103
|
+
return createVNode("div", {
|
104
|
+
"class": "orion-rich-text-editor—wrapper",
|
105
|
+
"ref": editorWrapperDOMRef,
|
106
|
+
"style": {
|
107
|
+
border: "1px solid #ccc",
|
108
|
+
zIndex: 100
|
109
|
+
}
|
110
|
+
}, [createVNode("div", {
|
111
|
+
"class": "orion-rich-text-toolbar-container",
|
112
|
+
"ref": toolbarContainerDOMRef,
|
113
|
+
"style": {
|
114
|
+
borderBottom: "1px solid #ccc"
|
115
|
+
}
|
116
|
+
}, null), createVNode("div", {
|
117
|
+
"class": "orion-rich-text-editor-container",
|
118
|
+
"ref": editorContainerDOMRef,
|
119
|
+
"style": {
|
120
|
+
overflowY: "hidden"
|
121
|
+
}
|
122
|
+
}, null)]);
|
123
|
+
};
|
99
124
|
}
|
100
|
-
})
|
101
|
-
|
125
|
+
});
|
126
|
+
const index = withInstall(
|
127
|
+
RichTextEditor
|
102
128
|
);
|
103
129
|
export {
|
104
|
-
|
130
|
+
index as default
|
105
131
|
};
|
106
132
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx","../../../src/components/RichTextEditor/index.ts"],"sourcesContent":["import { computed, defineComponent, ref, onBeforeUnmount, onMounted, watch } from 'vue'\r\nimport type { PropType, ExtractPropTypes, CSSProperties, Plugin, App } from 'vue'\r\nimport classNames from '../_util/classNames'\r\nimport OrionError from '../../error/OrionError'\r\nimport { anyType, booleanType, functionType, objectType, someType, stringType, tuple } from '../_util/type'\r\n\r\nimport { createEditor, createToolbar, DomEditor } from '@wangeditor/editor'\r\nimport type { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor/editor'\r\n\r\nexport const richTextEditorProps = () => ({\r\n modelValue: String,\r\n readonly: booleanType(false),\r\n uploadImage: functionType<(file: File) => { url: string; alt?: string; href?: string } | null | false>(),\r\n})\r\n\r\nexport type RichTextEditorProps = Partial<ExtractPropTypes<ReturnType<typeof richTextEditorProps>>>\r\n\r\ntype InsertFnType = (url: string, alt: string, href: string) => void\r\n\r\nexport default defineComponent({\r\n name: 'ORichTextEditor',\r\n inheritAttrs: false,\r\n props: richTextEditorProps(),\r\n emits: ['update:modelValue'],\r\n setup(props, { slots, attrs, emit, expose }) {\r\n const editorRef = ref<IDomEditor | null>(null) // TS 语法\r\n const editorWrapperDOMRef = ref<HTMLDivElement>()\r\n const editorContainerDOMRef = ref<HTMLDivElement>()\r\n const toolbarContainerDOMRef = ref<HTMLDivElement>()\r\n\r\n expose({\r\n focus: () => {\r\n editorRef.value?.focus()\r\n },\r\n })\r\n\r\n onMounted(() => {\r\n // 编辑器配置\r\n const editorConfig: IEditorConfig = {\r\n placeholder: '请输入内容...',\r\n onChange(editor) {\r\n const html = editor.getHtml()\r\n emit('update:modelValue', html)\r\n },\r\n readOnly: props.readonly,\r\n autoFocus: true,\r\n scroll: true,\r\n MENU_CONF: {\r\n uploadImage: {\r\n // 自定义上传\r\n async customUpload(file: File, insertFn: InsertFnType) {\r\n if (props.uploadImage) {\r\n const ret = await props.uploadImage(file)\r\n\r\n if (ret == null || ret === false) {\r\n return\r\n }\r\n\r\n if (!ret.url) {\r\n throw new OrionError(`RichTextEditor: 图片上传接口 uploadImage 的返回数据中未包含 url 字段。`)\r\n }\r\n\r\n insertFn(ret.url, ret.alt, ret.href)\r\n } else {\r\n throw new OrionError(`RichTextEditor: 未实现文件上传接口onUpload。`)\r\n }\r\n },\r\n },\r\n },\r\n }\r\n const editor = createEditor({\r\n selector: editorContainerDOMRef.value!,\r\n html: props.modelValue, // 初始值\r\n config: editorConfig,\r\n mode: 'default',\r\n })\r\n editorRef.value = editor\r\n\r\n // 工具栏配置\r\n const toolbarConfig: Partial<IToolbarConfig> = {\r\n excludeKeys: ['blockquote', 'bulletedList', 'numberedList', 'todo', 'emotion', 'insertLink', 'insertImage', 'group-video', 'insertTable', 'codeBlock'],\r\n }\r\n\r\n const toolbar = createToolbar({\r\n editor,\r\n selector: toolbarContainerDOMRef.value!,\r\n config: toolbarConfig,\r\n mode: 'default', // or 'simple'\r\n })\r\n\r\n // const t = DomEditor.getToolbar(editor)\r\n // const curToolbarConfig = t.getConfig()\r\n // console.log(curToolbarConfig.toolbarKeys) // 当前菜单排序和分组\r\n })\r\n\r\n watch(\r\n () => props.modelValue,\r\n (modelValue) => {\r\n if (editorRef.value) {\r\n editorRef.value.setHtml(modelValue || '')\r\n }\r\n }\r\n )\r\n\r\n watch(\r\n () => props.readonly,\r\n (readonly) => {\r\n if (editorRef.value) {\r\n if (readonly) {\r\n editorRef.value.disable()\r\n } else {\r\n editorRef.value.enable()\r\n }\r\n }\r\n }\r\n )\r\n\r\n onBeforeUnmount(() => {\r\n if (editorRef.value == null) return\r\n editorRef.value.destroy()\r\n editorRef.value = null\r\n })\r\n\r\n return () => {\r\n return (\r\n <div class=\"orion-rich-text-editor—wrapper\" ref={editorWrapperDOMRef} style={{ border: '1px solid #ccc', zIndex: 100 }}>\r\n <div class=\"orion-rich-text-toolbar-container\" ref={toolbarContainerDOMRef} style={{ borderBottom: '1px solid #ccc' }}></div>\r\n <div class=\"orion-rich-text-editor-container\" ref={editorContainerDOMRef} style={{ overflowY: 'hidden' }}></div>\r\n </div>\r\n )\r\n }\r\n },\r\n})\r\n","import { withInstall } from '../_util'\r\n\r\nimport RichTextEditor from './RichTextEditor'\r\n\r\nexport type { RichTextEditorProps } from \"./RichTextEditor\"\r\n\r\nexport default withInstall<typeof RichTextEditor, {}>(\r\n RichTextEditor\r\n)\r\n"],"names":["richTextEditorProps","modelValue","String","readonly","booleanType","uploadImage","functionType","defineComponent","name","inheritAttrs","props","emits","setup","slots","attrs","emit","expose","editorRef","ref","editorWrapperDOMRef","editorContainerDOMRef","toolbarContainerDOMRef","focus","value","onMounted","editorConfig","placeholder","onChange","editor","html","getHtml","readOnly","autoFocus","scroll","MENU_CONF","customUpload","file","insertFn","ret","url","OrionError","alt","href","createEditor","selector","config","mode","toolbarConfig","excludeKeys","createToolbar","watch","setHtml","disable","enable","onBeforeUnmount","destroy","_createVNode","border","zIndex","borderBottom","overflowY"
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx","../../../src/components/RichTextEditor/index.ts"],"sourcesContent":["import { computed, defineComponent, ref, onBeforeUnmount, onMounted, watch } from 'vue'\r\nimport type { PropType, ExtractPropTypes, CSSProperties, Plugin, App } from 'vue'\r\nimport classNames from '../_util/classNames'\r\nimport OrionError from '../../error/OrionError'\r\nimport { anyType, booleanType, functionType, objectType, someType, stringType, tuple } from '../_util/type'\r\n\r\nimport { createEditor, createToolbar, DomEditor } from '@wangeditor/editor'\r\nimport type { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor/editor'\r\n\r\nexport const richTextEditorProps = () => ({\r\n modelValue: String,\r\n readonly: booleanType(false),\r\n uploadImage: functionType<(file: File) => { url: string; alt?: string; href?: string } | null | false>(),\r\n})\r\n\r\nexport type RichTextEditorProps = Partial<ExtractPropTypes<ReturnType<typeof richTextEditorProps>>>\r\n\r\ntype InsertFnType = (url: string, alt: string, href: string) => void\r\n\r\nexport default defineComponent({\r\n name: 'ORichTextEditor',\r\n inheritAttrs: false,\r\n props: richTextEditorProps(),\r\n emits: ['update:modelValue'],\r\n setup(props, { slots, attrs, emit, expose }) {\r\n const editorRef = ref<IDomEditor | null>(null) // TS 语法\r\n const editorWrapperDOMRef = ref<HTMLDivElement>()\r\n const editorContainerDOMRef = ref<HTMLDivElement>()\r\n const toolbarContainerDOMRef = ref<HTMLDivElement>()\r\n\r\n expose({\r\n focus: () => {\r\n editorRef.value?.focus()\r\n },\r\n })\r\n\r\n onMounted(() => {\r\n // 编辑器配置\r\n const editorConfig: IEditorConfig = {\r\n placeholder: '请输入内容...',\r\n onChange(editor) {\r\n const html = editor.getHtml()\r\n emit('update:modelValue', html)\r\n },\r\n readOnly: props.readonly,\r\n autoFocus: true,\r\n scroll: true,\r\n MENU_CONF: {\r\n uploadImage: {\r\n // 自定义上传\r\n async customUpload(file: File, insertFn: InsertFnType) {\r\n if (props.uploadImage) {\r\n const ret = await props.uploadImage(file)\r\n\r\n if (ret == null || ret === false) {\r\n return\r\n }\r\n\r\n if (!ret.url) {\r\n throw new OrionError(`RichTextEditor: 图片上传接口 uploadImage 的返回数据中未包含 url 字段。`)\r\n }\r\n\r\n insertFn(ret.url, ret.alt, ret.href)\r\n } else {\r\n throw new OrionError(`RichTextEditor: 未实现文件上传接口onUpload。`)\r\n }\r\n },\r\n },\r\n },\r\n }\r\n const editor = createEditor({\r\n selector: editorContainerDOMRef.value!,\r\n html: props.modelValue, // 初始值\r\n config: editorConfig,\r\n mode: 'default',\r\n })\r\n editorRef.value = editor\r\n\r\n // 工具栏配置\r\n const toolbarConfig: Partial<IToolbarConfig> = {\r\n excludeKeys: ['blockquote', 'bulletedList', 'numberedList', 'todo', 'emotion', 'insertLink', 'insertImage', 'group-video', 'insertTable', 'codeBlock'],\r\n }\r\n\r\n const toolbar = createToolbar({\r\n editor,\r\n selector: toolbarContainerDOMRef.value!,\r\n config: toolbarConfig,\r\n mode: 'default', // or 'simple'\r\n })\r\n\r\n // const t = DomEditor.getToolbar(editor)\r\n // const curToolbarConfig = t.getConfig()\r\n // console.log(curToolbarConfig.toolbarKeys) // 当前菜单排序和分组\r\n })\r\n\r\n watch(\r\n () => props.modelValue,\r\n (modelValue) => {\r\n if (editorRef.value) {\r\n editorRef.value.setHtml(modelValue || '')\r\n }\r\n }\r\n )\r\n\r\n watch(\r\n () => props.readonly,\r\n (readonly) => {\r\n if (editorRef.value) {\r\n if (readonly) {\r\n editorRef.value.disable()\r\n } else {\r\n editorRef.value.enable()\r\n }\r\n }\r\n }\r\n )\r\n\r\n onBeforeUnmount(() => {\r\n if (editorRef.value == null) return\r\n editorRef.value.destroy()\r\n editorRef.value = null\r\n })\r\n\r\n return () => {\r\n return (\r\n <div class=\"orion-rich-text-editor—wrapper\" ref={editorWrapperDOMRef} style={{ border: '1px solid #ccc', zIndex: 100 }}>\r\n <div class=\"orion-rich-text-toolbar-container\" ref={toolbarContainerDOMRef} style={{ borderBottom: '1px solid #ccc' }}></div>\r\n <div class=\"orion-rich-text-editor-container\" ref={editorContainerDOMRef} style={{ overflowY: 'hidden' }}></div>\r\n </div>\r\n )\r\n }\r\n },\r\n})\r\n","import { withInstall } from '../_util'\r\n\r\nimport RichTextEditor from './RichTextEditor'\r\n\r\nexport type { RichTextEditorProps } from \"./RichTextEditor\"\r\n\r\nexport default withInstall<typeof RichTextEditor, {}>(\r\n RichTextEditor\r\n)\r\n"],"names":["richTextEditorProps","modelValue","String","readonly","booleanType","uploadImage","functionType","defineComponent","name","inheritAttrs","props","emits","setup","slots","attrs","emit","expose","editorRef","ref","editorWrapperDOMRef","editorContainerDOMRef","toolbarContainerDOMRef","focus","value","onMounted","editorConfig","placeholder","onChange","editor","html","getHtml","readOnly","autoFocus","scroll","MENU_CONF","customUpload","file","insertFn","ret","url","OrionError","alt","href","createEditor","selector","config","mode","toolbarConfig","excludeKeys","createToolbar","watch","setHtml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,cAAc;AAAA,QAAiB;AAAA,MAAC,GAAA,IAAA,GAAAH,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,QAAA,OAClEpC;AAAAA,QAAqB,SAAS;AAAA,UAAEwC,WAAW;AAAA,QAAS;AAAA,MAAC,GAAA,IAAA,CAAA,CAAA;AAAA;EAIhH;AACF,CAAC;AC9HD,MAAA,QAAe;AAAA,EACb;AACF;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../src/components/Tabs/constants.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref, Slots, UnwrapRef } from 'vue'\r\nimport type { TabsProps } from './tabs'\r\nimport type { TabPaneProps } from './tab-pane'\r\n\r\nexport type TabsPaneContext = UnwrapRef<{\r\n uid: number\r\n slots: Slots\r\n props: TabPaneProps\r\n paneName: ComputedRef<string | number | undefined>\r\n active: ComputedRef<boolean>\r\n index: Ref<string | undefined>\r\n}>\r\n\r\nexport interface TabsRootContext {\r\n props: TabsProps\r\n currentName: Ref<string | number>\r\n registerPane: (pane: TabsPaneContext) => void\r\n sortPane: (pane: TabsPaneContext) => void\r\n unregisterPane: (uid: number) => void\r\n}\r\n\r\nexport const tabsRootContextKey: InjectionKey<TabsRootContext> =\r\n Symbol('tabsRootContextKey')\r\n"],"names":[
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/components/Tabs/constants.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref, Slots, UnwrapRef } from 'vue'\r\nimport type { TabsProps } from './tabs'\r\nimport type { TabPaneProps } from './tab-pane'\r\n\r\nexport type TabsPaneContext = UnwrapRef<{\r\n uid: number\r\n slots: Slots\r\n props: TabPaneProps\r\n paneName: ComputedRef<string | number | undefined>\r\n active: ComputedRef<boolean>\r\n index: Ref<string | undefined>\r\n}>\r\n\r\nexport interface TabsRootContext {\r\n props: TabsProps\r\n currentName: Ref<string | number>\r\n registerPane: (pane: TabsPaneContext) => void\r\n sortPane: (pane: TabsPaneContext) => void\r\n unregisterPane: (uid: number) => void\r\n}\r\n\r\nexport const tabsRootContextKey: InjectionKey<TabsRootContext> =\r\n Symbol('tabsRootContextKey')\r\n"],"names":[],"mappings":"AAqBa,MAAA,qBACX,OAAO,oBAAoB;"}
|