orion-design 0.1.31 → 0.1.32
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 +14 -30
- package/dist/Throne/index.js.map +1 -1
- package/dist/components/Button/index.js +33 -40
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +89 -122
- 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 +68 -127
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.js +656 -836
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +18 -30
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/LovPagetable.vue.d.ts +492 -0
- package/dist/components/LovTable/index.d.ts +246 -0
- package/dist/components/LovTable/index.js +106 -179
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/index.js +56 -111
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/types.d.ts +1 -1
- package/dist/components/Modal/types.js +3 -4
- 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/Pagetable.d.ts +92 -1
- package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +13 -0
- package/dist/components/Pagetable/hooks/useColumns.js +85 -88
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.d.ts +155 -0
- package/dist/components/Pagetable/index.js +596 -683
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +54 -92
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/hooks/useColumns.js +74 -82
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.js +469 -579
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +54 -92
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +74 -100
- 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 +358 -603
- 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 +4 -6
- 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 +39 -74
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +19 -29
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +5 -9
- 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 +17 -22
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +39 -74
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +8 -9
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +7 -14
- 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 +25 -49
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +61 -103
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +50 -65
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +4 -8
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +11 -12
- 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 +2 -4
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +14 -18
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +20 -46
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +10 -18
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +4 -5
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +3 -4
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +8 -9
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +10 -16
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +38 -41
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +22 -41
- 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 +43 -85
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +15 -27
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +25 -29
- 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 +18 -35
- 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 +30 -46
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +6 -12
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +3 -5
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +4 -5
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +54 -100
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +220 -231
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.js +20 -20
- package/dist/components/index.js +35 -38
- package/dist/components/index.js.map +1 -1
- package/dist/error/OrionError.js +4 -8
- package/dist/error/OrionError.js.map +1 -1
- package/dist/index.css +1 -797
- package/dist/index.js +36 -36
- package/dist/print/LodopFuncs.js +43 -101
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +108 -200
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +14 -17
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +13 -16
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +14 -17
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +22 -47
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +25 -40
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +10 -16
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +201 -305
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +5 -11
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +5 -11
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +4 -9
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +5 -11
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +33 -48
- 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 +93 -191
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +25 -35
- 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
- package/dist/_commonjsHelpers-DWwsNxpa.js +0 -9
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +0 -1
- package/dist/components-B3d9m_tn.js +0 -27
- package/dist/components-B3d9m_tn.js.map +0 -1
- package/dist/functions-BeMkokbY.js +0 -63
- package/dist/functions-BeMkokbY.js.map +0 -1
- package/dist/index-BOKLZnqH.js +0 -54
- package/dist/index-BOKLZnqH.js.map +0 -1
- package/dist/index-D1m0KTpK.js +0 -69
- package/dist/index-D1m0KTpK.js.map +0 -1
- package/dist/index-DR5ZP7mD.js +0 -160
- package/dist/index-DR5ZP7mD.js.map +0 -1
- package/dist/index-DkwIULcN.js +0 -200
- package/dist/index-DkwIULcN.js.map +0 -1
@@ -1,132 +1,106 @@
|
|
1
1
|
import "lodash-es";
|
2
|
-
import { defineComponent, ref, onMounted, watch, onBeforeUnmount, createVNode } from "vue";
|
3
|
-
import { withInstall } from "../_util/vue/install.js";
|
2
|
+
import { defineComponent as g, ref as l, onMounted as x, watch as s, onBeforeUnmount as b, createVNode as i } from "vue";
|
3
|
+
import { withInstall as y } from "../_util/vue/install.js";
|
4
4
|
import "element-plus";
|
5
|
-
import
|
6
|
-
import { booleanType, functionType } from "../_util/type.js";
|
7
|
-
import { createEditor, createToolbar } from "@wangeditor/editor";
|
8
|
-
const
|
5
|
+
import f from "../../error/OrionError.js";
|
6
|
+
import { booleanType as w, functionType as T } from "../_util/type.js";
|
7
|
+
import { createEditor as E, createToolbar as I } from "@wangeditor/editor";
|
8
|
+
const R = () => ({
|
9
9
|
modelValue: String,
|
10
|
-
readonly:
|
11
|
-
uploadImage:
|
12
|
-
})
|
13
|
-
const RichTextEditor = /* @__PURE__ */ defineComponent({
|
10
|
+
readonly: w(!1),
|
11
|
+
uploadImage: T()
|
12
|
+
}), C = /* @__PURE__ */ g({
|
14
13
|
name: "ORichTextEditor",
|
15
|
-
inheritAttrs:
|
16
|
-
props:
|
14
|
+
inheritAttrs: !1,
|
15
|
+
props: R(),
|
17
16
|
emits: ["update:modelValue"],
|
18
|
-
setup(
|
19
|
-
slots,
|
20
|
-
attrs,
|
21
|
-
emit,
|
22
|
-
expose
|
17
|
+
setup(t, {
|
18
|
+
slots: O,
|
19
|
+
attrs: V,
|
20
|
+
emit: m,
|
21
|
+
expose: p
|
23
22
|
}) {
|
24
|
-
const
|
25
|
-
|
26
|
-
const editorContainerDOMRef = ref();
|
27
|
-
const toolbarContainerDOMRef = ref();
|
28
|
-
expose({
|
23
|
+
const e = l(null), h = l(), d = l(), u = l();
|
24
|
+
return p({
|
29
25
|
focus: () => {
|
30
|
-
var
|
31
|
-
(
|
26
|
+
var o;
|
27
|
+
(o = e.value) == null || o.focus();
|
32
28
|
}
|
33
|
-
})
|
34
|
-
|
35
|
-
const editorConfig = {
|
29
|
+
}), x(() => {
|
30
|
+
const o = {
|
36
31
|
placeholder: "请输入内容...",
|
37
|
-
onChange(
|
38
|
-
const
|
39
|
-
|
32
|
+
onChange(a) {
|
33
|
+
const n = a.getHtml();
|
34
|
+
m("update:modelValue", n);
|
40
35
|
},
|
41
|
-
readOnly:
|
42
|
-
autoFocus:
|
43
|
-
scroll:
|
36
|
+
readOnly: t.readonly,
|
37
|
+
autoFocus: !0,
|
38
|
+
scroll: !0,
|
44
39
|
MENU_CONF: {
|
45
40
|
uploadImage: {
|
46
41
|
// 自定义上传
|
47
|
-
async customUpload(
|
48
|
-
if (
|
49
|
-
const
|
50
|
-
if (
|
42
|
+
async customUpload(a, n) {
|
43
|
+
if (t.uploadImage) {
|
44
|
+
const r = await t.uploadImage(a);
|
45
|
+
if (r == null || r === !1)
|
51
46
|
return;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
} else {
|
58
|
-
throw new OrionError(`RichTextEditor: 未实现文件上传接口onUpload。`);
|
59
|
-
}
|
47
|
+
if (!r.url)
|
48
|
+
throw new f("RichTextEditor: 图片上传接口 uploadImage 的返回数据中未包含 url 字段。");
|
49
|
+
n(r.url, r.alt, r.href);
|
50
|
+
} else
|
51
|
+
throw new f("RichTextEditor: 未实现文件上传接口onUpload。");
|
60
52
|
}
|
61
53
|
}
|
62
54
|
}
|
63
|
-
}
|
64
|
-
|
65
|
-
|
66
|
-
html: props.modelValue,
|
55
|
+
}, c = E({
|
56
|
+
selector: d.value,
|
57
|
+
html: t.modelValue,
|
67
58
|
// 初始值
|
68
|
-
config:
|
59
|
+
config: o,
|
69
60
|
mode: "default"
|
70
61
|
});
|
71
|
-
|
72
|
-
const
|
62
|
+
e.value = c;
|
63
|
+
const v = {
|
73
64
|
excludeKeys: ["blockquote", "bulletedList", "numberedList", "todo", "emotion", "insertLink", "insertImage", "group-video", "insertTable", "codeBlock"]
|
74
65
|
};
|
75
|
-
|
76
|
-
editor,
|
77
|
-
selector:
|
78
|
-
config:
|
66
|
+
I({
|
67
|
+
editor: c,
|
68
|
+
selector: u.value,
|
69
|
+
config: v,
|
79
70
|
mode: "default"
|
80
71
|
// or 'simple'
|
81
72
|
});
|
82
|
-
})
|
83
|
-
|
84
|
-
|
85
|
-
|
73
|
+
}), s(() => t.modelValue, (o) => {
|
74
|
+
e.value && e.value.setHtml(o || "");
|
75
|
+
}), s(() => t.readonly, (o) => {
|
76
|
+
e.value && (o ? e.value.disable() : e.value.enable());
|
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
|
86
85
|
}
|
87
|
-
}
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
} else {
|
93
|
-
editorRef.value.enable();
|
94
|
-
}
|
86
|
+
}, [i("div", {
|
87
|
+
class: "orion-rich-text-toolbar-container",
|
88
|
+
ref: u,
|
89
|
+
style: {
|
90
|
+
borderBottom: "1px solid #ccc"
|
95
91
|
}
|
96
|
-
})
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
-
};
|
92
|
+
}, null), i("div", {
|
93
|
+
class: "orion-rich-text-editor-container",
|
94
|
+
ref: d,
|
95
|
+
style: {
|
96
|
+
overflowY: "hidden"
|
97
|
+
}
|
98
|
+
}, null)]);
|
124
99
|
}
|
125
|
-
})
|
126
|
-
|
127
|
-
RichTextEditor
|
100
|
+
}), F = y(
|
101
|
+
C
|
128
102
|
);
|
129
103
|
export {
|
130
|
-
|
104
|
+
F as default
|
131
105
|
};
|
132
106
|
//# 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"],"mappings":";;;;;;;AASO,MAAMA,
|
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","index","withInstall","RichTextEditor"],"mappings":"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"}
|
@@ -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":[],"mappings":"AAqBa,
|
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":["tabsRootContextKey"],"mappings":"AAqBa,MAAAA,IACX,OAAO,oBAAoB;"}
|