@oinone/kunlun-vue-admin-base 6.2.0 → 6.2.1
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/oinone-kunlun-vue-admin-base.css +1 -1
- package/dist/oinone-kunlun-vue-admin-base.esm.js +76 -35
- package/dist/oinone-kunlun-vue-admin-base.scss +1 -1
- package/dist/types/src/field/form/html/expressionRichtext/ExpressionRichText.vue.d.ts +53 -97
- package/dist/types/src/field/form/html/richtext/FormHtmlRichTextFieldWidget.d.ts +7 -0
- package/dist/types/src/field/form/html/richtext/RichText.vue.d.ts +4 -1
- package/package.json +9 -9
- package/src/field/form/html/expressionRichtext/ExpressionRichText.vue +39 -17
- package/src/field/form/html/richtext/FormHtmlRichTextFieldWidget.ts +16 -0
- package/src/field/form/html/richtext/RichText.vue +13 -8
|
@@ -1,105 +1,61 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
import { IVariableContextItem } from '@oinone/kunlun-vue-expression';
|
|
3
3
|
import '@wangeditor/editor/dist/css/style.css';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
default: string;
|
|
10
|
-
};
|
|
11
|
-
defaultContent: {
|
|
12
|
-
type: PropType<import("@wangeditor/editor").SlateDescendant[]>;
|
|
13
|
-
default: never[];
|
|
14
|
-
};
|
|
15
|
-
defaultHtml: {
|
|
16
|
-
type: StringConstructor;
|
|
17
|
-
default: string;
|
|
18
|
-
};
|
|
19
|
-
defaultConfig: {
|
|
20
|
-
type: PropType<Partial<import("@wangeditor/editor").IEditorConfig>>;
|
|
21
|
-
default: {};
|
|
22
|
-
};
|
|
23
|
-
modelValue: {
|
|
24
|
-
type: StringConstructor;
|
|
25
|
-
default: string;
|
|
26
|
-
};
|
|
27
|
-
}, {
|
|
28
|
-
box: import("vue").Ref<null>;
|
|
29
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
30
|
-
mode?: unknown;
|
|
31
|
-
defaultContent?: unknown;
|
|
32
|
-
defaultHtml?: unknown;
|
|
33
|
-
defaultConfig?: unknown;
|
|
34
|
-
modelValue?: unknown;
|
|
35
|
-
} & {
|
|
36
|
-
mode: string;
|
|
37
|
-
defaultContent: import("@wangeditor/editor").SlateDescendant[];
|
|
38
|
-
defaultHtml: string;
|
|
39
|
-
defaultConfig: Partial<import("@wangeditor/editor").IEditorConfig>;
|
|
40
|
-
modelValue: string;
|
|
41
|
-
}>, {
|
|
42
|
-
mode: string;
|
|
43
|
-
defaultContent: import("@wangeditor/editor").SlateDescendant[];
|
|
44
|
-
defaultHtml: string;
|
|
45
|
-
defaultConfig: Partial<import("@wangeditor/editor").IEditorConfig>;
|
|
46
|
-
modelValue: string;
|
|
47
|
-
}>;
|
|
48
|
-
Toolbar: import("vue").DefineComponent<{
|
|
49
|
-
editor: {
|
|
50
|
-
type: PropType<import("@wangeditor/editor").IDomEditor>;
|
|
51
|
-
};
|
|
52
|
-
mode: {
|
|
53
|
-
type: StringConstructor;
|
|
54
|
-
default: string;
|
|
55
|
-
};
|
|
56
|
-
defaultConfig: {
|
|
57
|
-
type: PropType<Partial<import("@wangeditor/editor").IToolbarConfig>>;
|
|
58
|
-
default: {};
|
|
59
|
-
};
|
|
60
|
-
}, {
|
|
61
|
-
selector: import("vue").Ref<null>;
|
|
62
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
63
|
-
editor?: unknown;
|
|
64
|
-
mode?: unknown;
|
|
65
|
-
defaultConfig?: unknown;
|
|
66
|
-
} & {
|
|
67
|
-
mode: string;
|
|
68
|
-
defaultConfig: Partial<import("@wangeditor/editor").IToolbarConfig>;
|
|
69
|
-
} & {
|
|
70
|
-
editor?: import("@wangeditor/editor").IDomEditor | undefined;
|
|
71
|
-
}>, {
|
|
72
|
-
mode: string;
|
|
73
|
-
defaultConfig: Partial<import("@wangeditor/editor").IToolbarConfig>;
|
|
74
|
-
}>;
|
|
4
|
+
import { CSSStyle } from '@oinone/kunlun-shared';
|
|
5
|
+
declare const _default: import("vue").DefineComponent<{
|
|
6
|
+
contextItems: PropType<IVariableContextItem[]>;
|
|
7
|
+
change: {
|
|
8
|
+
type: FunctionConstructor;
|
|
75
9
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
change: FunctionConstructor;
|
|
79
|
-
value: StringConstructor;
|
|
10
|
+
value: {
|
|
11
|
+
type: StringConstructor;
|
|
80
12
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
13
|
+
height: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
};
|
|
16
|
+
richTextToolbarExcludeKeys: {
|
|
17
|
+
type: PropType<string[]>;
|
|
18
|
+
default: () => never[];
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
editorStyle: import("vue").ComputedRef<CSSStyle>;
|
|
22
|
+
editorId: string;
|
|
23
|
+
mode: string;
|
|
24
|
+
defaultHtml: import("vue").Ref<string>;
|
|
25
|
+
toolbarConfig: import("vue").ComputedRef<{
|
|
26
|
+
insertKeys: {
|
|
27
|
+
index: number;
|
|
28
|
+
keys: string[];
|
|
29
|
+
};
|
|
30
|
+
excludeKeys: string[];
|
|
31
|
+
modalAppendToBody: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
editorConfig: import("vue").ComputedRef<{
|
|
34
|
+
placeholder: string;
|
|
35
|
+
EXTEND_CONF: {
|
|
36
|
+
contextItems: IVariableContextItem[] | undefined;
|
|
92
37
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
38
|
+
}>;
|
|
39
|
+
editorRef: import("vue").ShallowRef<any>;
|
|
40
|
+
handleCreated: (editor: any) => void;
|
|
41
|
+
handleDestroyed: (editor: any) => void;
|
|
42
|
+
handleChange: (editor: any) => void;
|
|
43
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
|
+
contextItems: PropType<IVariableContextItem[]>;
|
|
45
|
+
change: {
|
|
46
|
+
type: FunctionConstructor;
|
|
47
|
+
};
|
|
48
|
+
value: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
};
|
|
51
|
+
height: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
};
|
|
54
|
+
richTextToolbarExcludeKeys: {
|
|
55
|
+
type: PropType<string[]>;
|
|
56
|
+
default: () => never[];
|
|
103
57
|
};
|
|
104
|
-
}
|
|
58
|
+
}>>, {
|
|
59
|
+
richTextToolbarExcludeKeys: string[];
|
|
60
|
+
}>;
|
|
105
61
|
export default _default;
|
|
@@ -2,6 +2,13 @@ import { ValidatorInfo } from '../../../../typing';
|
|
|
2
2
|
import { FormStringFieldWidget } from '../../string';
|
|
3
3
|
export declare class FormHtmlRichTextFieldWidget extends FormStringFieldWidget {
|
|
4
4
|
initialize(props: any): this;
|
|
5
|
+
/**
|
|
6
|
+
* 富文本工具栏排除的key
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* richTextToolbarExcludeKeys="fullScreen,uploadImage"
|
|
10
|
+
*/
|
|
11
|
+
protected get richTextToolbarExcludeKeys(): string[] | null;
|
|
5
12
|
protected get encode(): boolean | undefined;
|
|
6
13
|
protected get height(): string | undefined;
|
|
7
14
|
validator(): Promise<ValidatorInfo>;
|
|
@@ -16,6 +16,7 @@ declare const _default: import("vue").DefineComponent<Readonly<{
|
|
|
16
16
|
maxLength?: any;
|
|
17
17
|
encode?: any;
|
|
18
18
|
height?: any;
|
|
19
|
+
richTextToolbarExcludeKeys?: any;
|
|
19
20
|
}>, {
|
|
20
21
|
handleCreated: (editor: any) => void;
|
|
21
22
|
handleChange: (editor: any) => void;
|
|
@@ -24,7 +25,7 @@ declare const _default: import("vue").DefineComponent<Readonly<{
|
|
|
24
25
|
defaultHtml: import("vue").Ref<string>;
|
|
25
26
|
editorRef: import("vue").ShallowRef<any>;
|
|
26
27
|
editorNodeRef: any;
|
|
27
|
-
toolbarConfig: Partial<IToolbarConfig
|
|
28
|
+
toolbarConfig: import("vue").ComputedRef<Partial<IToolbarConfig>>;
|
|
28
29
|
editorConfig: import("vue").ComputedRef<{
|
|
29
30
|
placeholder: any;
|
|
30
31
|
readOnly: boolean | undefined;
|
|
@@ -102,6 +103,7 @@ declare const _default: import("vue").DefineComponent<Readonly<{
|
|
|
102
103
|
maxLength?: any;
|
|
103
104
|
encode?: any;
|
|
104
105
|
height?: any;
|
|
106
|
+
richTextToolbarExcludeKeys?: any;
|
|
105
107
|
}>>>, {
|
|
106
108
|
readonly value?: any;
|
|
107
109
|
readonly field?: any;
|
|
@@ -115,5 +117,6 @@ declare const _default: import("vue").DefineComponent<Readonly<{
|
|
|
115
117
|
readonly maxLength?: any;
|
|
116
118
|
readonly encode?: any;
|
|
117
119
|
readonly height?: any;
|
|
120
|
+
readonly richTextToolbarExcludeKeys?: any;
|
|
118
121
|
}>;
|
|
119
122
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oinone/kunlun-vue-admin-base",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "rimraf dist",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"doc": "typedoc --out docs src/index.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@oinone/kunlun-vue-admin-layout": "6.2.
|
|
18
|
-
"@oinone/kunlun-vue-router": "6.2.
|
|
19
|
-
"@oinone/kunlun-vue-ui": "6.2.
|
|
20
|
-
"@oinone/kunlun-vue-ui-antd": "6.2.
|
|
21
|
-
"@oinone/kunlun-vue-ui-common": "6.2.
|
|
22
|
-
"@oinone/kunlun-vue-ui-el": "6.2.
|
|
23
|
-
"@oinone/kunlun-vue-widget": "6.2.
|
|
17
|
+
"@oinone/kunlun-vue-admin-layout": "6.2.1",
|
|
18
|
+
"@oinone/kunlun-vue-router": "6.2.1",
|
|
19
|
+
"@oinone/kunlun-vue-ui": "6.2.1",
|
|
20
|
+
"@oinone/kunlun-vue-ui-antd": "6.2.1",
|
|
21
|
+
"@oinone/kunlun-vue-ui-common": "6.2.1",
|
|
22
|
+
"@oinone/kunlun-vue-ui-el": "6.2.1",
|
|
23
|
+
"@oinone/kunlun-vue-widget": "6.2.1",
|
|
24
24
|
"@wangeditor/editor": "5.1.23",
|
|
25
25
|
"@wangeditor/editor-for-vue": "5.1.11",
|
|
26
26
|
"@wangeditor/plugin-upload-attachment": "1.1.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"element-plus": ">=2.2.17",
|
|
62
62
|
"vue": ">=3.2.40"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "ad1e6c63539b7d6baf64cf209f100b1c0bcc2d53"
|
|
65
65
|
}
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
@onCreated="handleCreated"
|
|
10
10
|
@onDestroyed="handleDestroyed"
|
|
11
11
|
@onChange="handleChange"
|
|
12
|
-
style="
|
|
12
|
+
:style="editorStyle"
|
|
13
13
|
/>
|
|
14
14
|
</div>
|
|
15
15
|
</template>
|
|
16
16
|
<script lang="ts">
|
|
17
|
-
import { computed, onBeforeUnmount, PropType, ref, shallowRef, watch } from 'vue';
|
|
17
|
+
import { computed, onBeforeUnmount, PropType, ref, shallowRef, watch, defineComponent } from 'vue';
|
|
18
18
|
import { ZH_CN_CODE } from '@oinone/kunlun-vue-ui-common';
|
|
19
19
|
import { translateValueByKey } from '@oinone/kunlun-engine';
|
|
20
20
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
|
|
21
|
-
import { i18nChangeLanguage } from '@wangeditor/editor';
|
|
21
|
+
import { DomEditor, i18nChangeLanguage } from '@wangeditor/editor';
|
|
22
22
|
import {
|
|
23
23
|
IVariableContextItem,
|
|
24
24
|
ExpressionElementClass,
|
|
@@ -27,16 +27,27 @@ import {
|
|
|
27
27
|
EXPRESSION_MODAL_PANEL_CLASS_NAME
|
|
28
28
|
} from '@oinone/kunlun-vue-expression';
|
|
29
29
|
import '@wangeditor/editor/dist/css/style.css';
|
|
30
|
-
import { uniqueKeyGenerator } from '@oinone/kunlun-shared';
|
|
30
|
+
import { CSSStyle, uniqueKeyGenerator } from '@oinone/kunlun-shared';
|
|
31
31
|
|
|
32
32
|
const EDITOR_DEFAULT_HTML = '<p><br></p>';
|
|
33
33
|
const EDITOR_EXP_MODAL_CLASS = 'exp-modal-in-body';
|
|
34
|
-
export default {
|
|
34
|
+
export default defineComponent({
|
|
35
35
|
components: { Editor, Toolbar },
|
|
36
36
|
props: {
|
|
37
37
|
contextItems: Array as PropType<IVariableContextItem[]>,
|
|
38
|
-
change:
|
|
39
|
-
|
|
38
|
+
change: {
|
|
39
|
+
type: Function
|
|
40
|
+
},
|
|
41
|
+
value: {
|
|
42
|
+
type: String
|
|
43
|
+
},
|
|
44
|
+
height: {
|
|
45
|
+
type: String
|
|
46
|
+
},
|
|
47
|
+
richTextToolbarExcludeKeys: {
|
|
48
|
+
type: Array as PropType<string[]>,
|
|
49
|
+
default: () => []
|
|
50
|
+
}
|
|
40
51
|
},
|
|
41
52
|
setup(props) {
|
|
42
53
|
const editorId = `${ExpressionElementClass}-${Math.random().toString().slice(-5)}`; //【注意】编辑器 id ,要全局唯一
|
|
@@ -50,21 +61,31 @@ export default {
|
|
|
50
61
|
i18nChangeLanguage('en');
|
|
51
62
|
}
|
|
52
63
|
|
|
53
|
-
const toolbarConfig = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
const toolbarConfig = computed(() => {
|
|
65
|
+
return {
|
|
66
|
+
insertKeys: {
|
|
67
|
+
index: 28, //
|
|
68
|
+
keys: [OioWangEditExpressionModalMenuConf.key]
|
|
69
|
+
},
|
|
70
|
+
excludeKeys: [...(props.richTextToolbarExcludeKeys || []), 'fullScreen', 'uploadImage', 'insertVideo'],
|
|
71
|
+
modalAppendToBody: true
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
|
|
62
75
|
const editorConfig = computed(() => {
|
|
63
76
|
return {
|
|
64
77
|
placeholder: `${translateValueByKey('请输入内容')}...`,
|
|
65
78
|
EXTEND_CONF: { contextItems: props.contextItems }
|
|
66
79
|
};
|
|
67
80
|
});
|
|
81
|
+
|
|
82
|
+
const editorStyle = computed(() => {
|
|
83
|
+
const style = {} as CSSStyle;
|
|
84
|
+
style.height = props.height || '400px';
|
|
85
|
+
style.overflowY = 'hidden';
|
|
86
|
+
return style;
|
|
87
|
+
});
|
|
88
|
+
|
|
68
89
|
watch(
|
|
69
90
|
() => props.contextItems,
|
|
70
91
|
(newVal) => {
|
|
@@ -137,6 +158,7 @@ export default {
|
|
|
137
158
|
};
|
|
138
159
|
|
|
139
160
|
return {
|
|
161
|
+
editorStyle,
|
|
140
162
|
editorId,
|
|
141
163
|
mode: 'simple',
|
|
142
164
|
defaultHtml,
|
|
@@ -148,7 +170,7 @@ export default {
|
|
|
148
170
|
handleChange
|
|
149
171
|
};
|
|
150
172
|
}
|
|
151
|
-
};
|
|
173
|
+
});
|
|
152
174
|
</script>
|
|
153
175
|
<style lang="scss">
|
|
154
176
|
.exp-modal-in-body.w-e-modal {
|
|
@@ -16,6 +16,22 @@ export class FormHtmlRichTextFieldWidget extends FormStringFieldWidget {
|
|
|
16
16
|
return this;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* 富文本工具栏排除的key
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* richTextToolbarExcludeKeys="fullScreen,uploadImage"
|
|
24
|
+
*/
|
|
25
|
+
@Widget.Reactive()
|
|
26
|
+
protected get richTextToolbarExcludeKeys(): string[] | null {
|
|
27
|
+
const { richTextToolbarExcludeKeys } = this.getDsl() as { richTextToolbarExcludeKeys?: string };
|
|
28
|
+
if (!richTextToolbarExcludeKeys) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return richTextToolbarExcludeKeys.split(',').map((v) => v.trim());
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
@Widget.Reactive()
|
|
20
36
|
protected get encode() {
|
|
21
37
|
const _encode = this.getDsl().encode;
|
|
@@ -118,7 +118,8 @@ export default defineComponent({
|
|
|
118
118
|
'disabled',
|
|
119
119
|
'maxLength',
|
|
120
120
|
'encode',
|
|
121
|
-
'height'
|
|
121
|
+
'height',
|
|
122
|
+
'richTextToolbarExcludeKeys'
|
|
122
123
|
],
|
|
123
124
|
setup(props) {
|
|
124
125
|
const editorId = `${DEFAULT_PREFIX}-richtext-${Math.random().toString().slice(-5)}`; // 【注意】编辑器 id ,要全局唯一
|
|
@@ -137,13 +138,17 @@ export default defineComponent({
|
|
|
137
138
|
return { 'form-rich-text-disabled': innerDisabled.value, 'form-rich-text-readonly': innerReadonly.value };
|
|
138
139
|
});
|
|
139
140
|
|
|
140
|
-
const toolbarConfig
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
const toolbarConfig = computed<Partial<IToolbarConfig>>(() => {
|
|
142
|
+
return {
|
|
143
|
+
// 插入哪些菜单
|
|
144
|
+
insertKeys: {
|
|
145
|
+
index: 0, // 自定义插入的位置
|
|
146
|
+
keys: ['uploadAttachment'] // “上传附件”菜单
|
|
147
|
+
},
|
|
148
|
+
excludeKeys: props.richTextToolbarExcludeKeys
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
|
|
147
152
|
const editorConfig = computed(() => {
|
|
148
153
|
return {
|
|
149
154
|
placeholder: props.placeholder || `${translateValueByKey('请输入内容')}...`,
|