@peng_kai/kit 0.2.0-beta.3 → 0.2.0-beta.30
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/admin/adminPlugin.ts +11 -1
- package/admin/components/filter/src/FilterDrawer.vue +153 -153
- package/admin/components/filter/src/FilterParam.vue +1 -1
- package/admin/components/filter/src/FilterReset.vue +12 -9
- package/admin/components/rich-text/index.ts +1 -1
- package/admin/components/rich-text/src/RichText.new.vue +164 -0
- package/admin/components/rich-text/src/RichText.vue +3 -6
- package/admin/components/rich-text/src/editorConfig.ts +126 -0
- package/admin/components/rich-text/src/imageUploader.ts +20 -18
- package/admin/components/scroll-nav/index.ts +1 -1
- package/admin/components/scroll-nav/src/ScrollNav.vue +1 -1
- package/admin/components/settings/index.ts +1 -0
- package/admin/components/settings/src/Settings.vue +333 -0
- package/admin/components/text/index.ts +13 -13
- package/admin/components/text/src/Amount.vue +121 -121
- package/admin/components/text/src/Datetime.vue +1 -1
- package/admin/components/text/src/Duration.vue +26 -26
- package/admin/components/text/src/Hash.vue +51 -51
- package/admin/components/text/src/createTagGetter.ts +13 -13
- package/admin/components/upload/index.ts +1 -0
- package/admin/components/upload/src/PictureCardUpload.vue +1 -1
- package/admin/components/upload/src/helpers.ts +37 -0
- package/admin/defines/route/defineRoute.ts +2 -4
- package/admin/defines/route/getRoutes.ts +4 -4
- package/admin/defines/route/index.ts +1 -1
- package/admin/defines/route-guard/defineRouteGuard.ts +1 -4
- package/admin/defines/route-guard/getRouteGuards.ts +5 -7
- package/admin/defines/startup/defineStartup.ts +1 -3
- package/admin/defines/startup/runStartup.ts +4 -6
- package/admin/layout/large/Breadcrumb.vue +2 -2
- package/admin/layout/large/Content.vue +2 -2
- package/admin/layout/large/Menu.vue +2 -2
- package/admin/layout/large/PageTab.vue +2 -2
- package/admin/permission/routerGuard.ts +1 -1
- package/admin/permission/vuePlugin.ts +1 -0
- package/admin/route-guards/index.ts +3 -3
- package/admin/route-guards/pageProgress.ts +27 -27
- package/admin/stores/createUsePageStore.ts +1 -3
- package/admin/styles/classCover.scss +107 -0
- package/admin/styles/globalCover.scss +54 -54
- package/admin/styles/index.scss +14 -12
- package/antd/components/InputNumberRange.vue +59 -59
- package/antd/directives/formLabelAlign.ts +36 -36
- package/antd/hooks/useAntdDrawer.ts +73 -73
- package/antd/hooks/useAntdForm.ts +1 -1
- package/antd/hooks/useAntdModal.ts +4 -1
- package/antd/hooks/useAntdTable.ts +2 -1
- package/libs/dayjs.ts +7 -0
- package/libs/echarts.ts +1 -1
- package/libs/vue-i18n.ts +21 -0
- package/package.json +36 -35
- package/request/helpers.ts +68 -68
- package/request/interceptors/returnResultType.ts +3 -3
- package/request/interceptors/toLogin.ts +43 -26
- package/request/request.ts +0 -3
- package/request/type.d.ts +92 -92
- package/stylelint.config.cjs +7 -7
- package/tsconfig.json +50 -50
- package/utils/LocaleManager.ts +125 -0
- package/utils/date.ts +1 -9
- package/vite/index.mjs +34 -8
- package/vue/components/infinite-query/index.ts +1 -1
- package/vue/components/infinite-query/src/InfiniteQuery.vue +199 -199
- package/vue/components/infinite-query/src/useCreateTrigger.ts +39 -39
package/admin/adminPlugin.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { inject } from 'vue';
|
|
1
2
|
import type { App } from 'vue';
|
|
2
3
|
import type { Router } from 'vue-router';
|
|
3
4
|
import type { TUseMenuStore } from './stores/createUseMenuStore';
|
|
@@ -5,7 +6,7 @@ import type { TUsePageStore } from './stores/createUsePageStore';
|
|
|
5
6
|
import type { TUsePageTabStore } from './stores/createUsePageTabStore';
|
|
6
7
|
import type { TRole, TUsePermissionStore } from './stores/createUsePermissionStore';
|
|
7
8
|
|
|
8
|
-
interface IOtions {
|
|
9
|
+
export interface IOtions {
|
|
9
10
|
meta: {
|
|
10
11
|
appId: string
|
|
11
12
|
appName: string
|
|
@@ -20,6 +21,7 @@ interface IOtions {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
const PROVIDE_KEY = 'TT_ADMIN';
|
|
23
25
|
let _meta: IOtions['meta'];
|
|
24
26
|
let _deps: IOtions['deps'];
|
|
25
27
|
|
|
@@ -27,6 +29,10 @@ export const adminPlugin = {
|
|
|
27
29
|
install(_app: App, options: IOtions) {
|
|
28
30
|
_meta = options.meta;
|
|
29
31
|
_deps = options.deps;
|
|
32
|
+
_app.provide(PROVIDE_KEY, {
|
|
33
|
+
meta: this.meta,
|
|
34
|
+
deps: this.deps,
|
|
35
|
+
});
|
|
30
36
|
},
|
|
31
37
|
meta: new Proxy({} as IOtions['meta'], {
|
|
32
38
|
get(_, p) {
|
|
@@ -45,3 +51,7 @@ export const adminPlugin = {
|
|
|
45
51
|
},
|
|
46
52
|
}),
|
|
47
53
|
};
|
|
54
|
+
|
|
55
|
+
export function injectTTAdmin() {
|
|
56
|
+
return inject<IOtions>(PROVIDE_KEY);
|
|
57
|
+
}
|
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref } from 'vue';
|
|
3
|
-
import { Button as AButton, Drawer as ADrawer, Dropdown as ADropdown } from 'ant-design-vue';
|
|
4
|
-
|
|
5
|
-
defineOptions({
|
|
6
|
-
inheritAttrs: false,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const props = withDefaults(defineProps<{
|
|
10
|
-
loading?: boolean
|
|
11
|
-
filterQuery?: any
|
|
12
|
-
filterParams?: any
|
|
13
|
-
filterForm?: any
|
|
14
|
-
}>(), {
|
|
15
|
-
loading: undefined,
|
|
16
|
-
});
|
|
17
|
-
const emits = defineEmits<{
|
|
18
|
-
(e: 'filter'): void
|
|
19
|
-
(e: 'reset', value: number): void
|
|
20
|
-
}>();
|
|
21
|
-
|
|
22
|
-
const filterVisible = ref(false);
|
|
23
|
-
const loading = computed(() => {
|
|
24
|
-
const _loading1 = props.loading;
|
|
25
|
-
const _loading2: boolean = props.filterQuery?.isFetching.value;
|
|
26
|
-
|
|
27
|
-
if (_loading1 === undefined && _loading2 === undefined)
|
|
28
|
-
return false;
|
|
29
|
-
|
|
30
|
-
if (_loading1 !== undefined)
|
|
31
|
-
return _loading1;
|
|
32
|
-
|
|
33
|
-
return _loading2;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
function filter() {
|
|
37
|
-
props.filterParams?.update?.();
|
|
38
|
-
emits('filter');
|
|
39
|
-
filterVisible.value = false;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function reset() {
|
|
43
|
-
props.filterForm?.$form.resetFields?.();
|
|
44
|
-
props.filterParams?.update?.();
|
|
45
|
-
emits('reset', 1);
|
|
46
|
-
filterVisible.value = false;
|
|
47
|
-
}
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<template>
|
|
51
|
-
<div class="p-3 bg-$antd-colorBgContainer text-14px rounded-2" v-bind="$attrs">
|
|
52
|
-
<!-- .filter-params 为空时显示 .filter-params-tips -->
|
|
53
|
-
|
|
54
|
-
<div class="m--3 p-3" @click="filterVisible = true">
|
|
55
|
-
<div class="filter-params">
|
|
56
|
-
<slot name="params" />
|
|
57
|
-
</div>
|
|
58
|
-
<div class="filter-params-tips">
|
|
59
|
-
条件筛选,点击打开
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<!-- 操作区 -->
|
|
64
|
-
<div v-if="$slots.actions || $slots.moreActions" class="actions">
|
|
65
|
-
<slot name="actions" />
|
|
66
|
-
|
|
67
|
-
<ADropdown v-if="$slots.moreActions" trigger="click" destroyPopupOnHide>
|
|
68
|
-
<AButton type="link" size="small">
|
|
69
|
-
更多
|
|
70
|
-
</AButton>
|
|
71
|
-
<template #overlay>
|
|
72
|
-
<slot name="moreActions" />
|
|
73
|
-
</template>
|
|
74
|
-
</ADropdown>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<ADrawer
|
|
79
|
-
v-model:open="filterVisible" class="filter-drawer" placement="bottom"
|
|
80
|
-
height="50vh"
|
|
81
|
-
>
|
|
82
|
-
<template #extra>
|
|
83
|
-
<AButton class="mr-3 my--3" :disabled="loading" @click="reset()">
|
|
84
|
-
重置
|
|
85
|
-
</AButton>
|
|
86
|
-
<AButton class="my--3" type="primary" :loading="loading" @click="filter()">
|
|
87
|
-
筛选
|
|
88
|
-
</AButton>
|
|
89
|
-
</template>
|
|
90
|
-
<template #default>
|
|
91
|
-
<slot />
|
|
92
|
-
</template>
|
|
93
|
-
</ADrawer>
|
|
94
|
-
</template>
|
|
95
|
-
|
|
96
|
-
<style scoped lang="scss">
|
|
97
|
-
.filter-params {
|
|
98
|
-
display: flex;
|
|
99
|
-
flex-wrap: wrap;
|
|
100
|
-
justify-content: flex-start;
|
|
101
|
-
gap: 5px 15px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// .filter-params 为空时显示 .filter-params-tips
|
|
105
|
-
.filter-params-tips {
|
|
106
|
-
display: none;
|
|
107
|
-
color: theme('colors.gray.DEFAULT');
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.filter-params:empty {
|
|
111
|
-
display: none;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.filter-params:empty + .filter-params-tips {
|
|
115
|
-
display: block;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.actions {
|
|
119
|
-
display: flex;
|
|
120
|
-
align-items: center;
|
|
121
|
-
justify-content: flex-end;
|
|
122
|
-
border-top: 1px solid var(--antd-colorBorderSecondary);
|
|
123
|
-
margin-top: 0.75rem;
|
|
124
|
-
padding-top: 0.75rem;
|
|
125
|
-
}
|
|
126
|
-
</style>
|
|
127
|
-
|
|
128
|
-
<style lang="scss">
|
|
129
|
-
.filter-drawer {
|
|
130
|
-
.ant-drawer-header {
|
|
131
|
-
padding: 16px;
|
|
132
|
-
|
|
133
|
-
.ant-drawer-close {
|
|
134
|
-
--expand: 5px;
|
|
135
|
-
|
|
136
|
-
padding: var(--expand);
|
|
137
|
-
margin: calc(var(--expand) * -1) var(--expand) calc(var(--expand) * -1) 0;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.ant-drawer-body {
|
|
142
|
-
padding: 16px;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.ant-form-item {
|
|
146
|
-
margin-bottom: 0;
|
|
147
|
-
|
|
148
|
-
.ant-form-item-label {
|
|
149
|
-
padding-bottom: 0;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
</style>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
import { Button as AButton, Drawer as ADrawer, Dropdown as ADropdown } from 'ant-design-vue';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
inheritAttrs: false,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<{
|
|
10
|
+
loading?: boolean
|
|
11
|
+
filterQuery?: any
|
|
12
|
+
filterParams?: any
|
|
13
|
+
filterForm?: any
|
|
14
|
+
}>(), {
|
|
15
|
+
loading: undefined,
|
|
16
|
+
});
|
|
17
|
+
const emits = defineEmits<{
|
|
18
|
+
(e: 'filter'): void
|
|
19
|
+
(e: 'reset', value: number): void
|
|
20
|
+
}>();
|
|
21
|
+
|
|
22
|
+
const filterVisible = ref(false);
|
|
23
|
+
const loading = computed(() => {
|
|
24
|
+
const _loading1 = props.loading;
|
|
25
|
+
const _loading2: boolean = props.filterQuery?.isFetching.value;
|
|
26
|
+
|
|
27
|
+
if (_loading1 === undefined && _loading2 === undefined)
|
|
28
|
+
return false;
|
|
29
|
+
|
|
30
|
+
if (_loading1 !== undefined)
|
|
31
|
+
return _loading1;
|
|
32
|
+
|
|
33
|
+
return _loading2;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
function filter() {
|
|
37
|
+
props.filterParams?.update?.();
|
|
38
|
+
emits('filter');
|
|
39
|
+
filterVisible.value = false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function reset() {
|
|
43
|
+
props.filterForm?.$form.resetFields?.();
|
|
44
|
+
props.filterParams?.update?.();
|
|
45
|
+
emits('reset', 1);
|
|
46
|
+
filterVisible.value = false;
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div class="p-3 bg-$antd-colorBgContainer text-14px rounded-2" v-bind="$attrs">
|
|
52
|
+
<!-- .filter-params 为空时显示 .filter-params-tips -->
|
|
53
|
+
|
|
54
|
+
<div class="m--3 p-3" @click="filterVisible = true">
|
|
55
|
+
<div class="filter-params">
|
|
56
|
+
<slot name="params" />
|
|
57
|
+
</div>
|
|
58
|
+
<div class="filter-params-tips">
|
|
59
|
+
条件筛选,点击打开
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<!-- 操作区 -->
|
|
64
|
+
<div v-if="$slots.actions || $slots.moreActions" class="actions">
|
|
65
|
+
<slot name="actions" />
|
|
66
|
+
|
|
67
|
+
<ADropdown v-if="$slots.moreActions" trigger="click" destroyPopupOnHide>
|
|
68
|
+
<AButton type="link" size="small">
|
|
69
|
+
更多
|
|
70
|
+
</AButton>
|
|
71
|
+
<template #overlay>
|
|
72
|
+
<slot name="moreActions" />
|
|
73
|
+
</template>
|
|
74
|
+
</ADropdown>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<ADrawer
|
|
79
|
+
v-model:open="filterVisible" class="filter-drawer" placement="bottom"
|
|
80
|
+
height="50vh"
|
|
81
|
+
>
|
|
82
|
+
<template #extra>
|
|
83
|
+
<AButton class="mr-3 my--3" :disabled="loading" @click="reset()">
|
|
84
|
+
重置
|
|
85
|
+
</AButton>
|
|
86
|
+
<AButton class="my--3" type="primary" :loading="loading" @click="filter()">
|
|
87
|
+
筛选
|
|
88
|
+
</AButton>
|
|
89
|
+
</template>
|
|
90
|
+
<template #default>
|
|
91
|
+
<slot />
|
|
92
|
+
</template>
|
|
93
|
+
</ADrawer>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<style scoped lang="scss">
|
|
97
|
+
.filter-params {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-wrap: wrap;
|
|
100
|
+
justify-content: flex-start;
|
|
101
|
+
gap: 5px 15px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// .filter-params 为空时显示 .filter-params-tips
|
|
105
|
+
.filter-params-tips {
|
|
106
|
+
display: none;
|
|
107
|
+
color: theme('colors.gray.DEFAULT');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.filter-params:empty {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.filter-params:empty + .filter-params-tips {
|
|
115
|
+
display: block;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.actions {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: flex-end;
|
|
122
|
+
border-top: 1px solid var(--antd-colorBorderSecondary);
|
|
123
|
+
margin-top: 0.75rem;
|
|
124
|
+
padding-top: 0.75rem;
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
127
|
+
|
|
128
|
+
<style lang="scss">
|
|
129
|
+
.filter-drawer {
|
|
130
|
+
.ant-drawer-header {
|
|
131
|
+
padding: 16px;
|
|
132
|
+
|
|
133
|
+
.ant-drawer-close {
|
|
134
|
+
--expand: 5px;
|
|
135
|
+
|
|
136
|
+
padding: var(--expand);
|
|
137
|
+
margin: calc(var(--expand) * -1) var(--expand) calc(var(--expand) * -1) 0;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ant-drawer-body {
|
|
142
|
+
padding: 16px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ant-form-item {
|
|
146
|
+
margin-bottom: 0;
|
|
147
|
+
|
|
148
|
+
.ant-form-item-label {
|
|
149
|
+
padding-bottom: 0;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
</style>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import isNil from 'lodash-es/isNil';
|
|
3
3
|
import isFinite from 'lodash-es/isFinite';
|
|
4
4
|
import bignumber from 'bignumber.js';
|
|
5
|
-
import
|
|
5
|
+
import dayjs from '../../../../libs/dayjs';
|
|
6
6
|
|
|
7
7
|
export const paramTypes = { numberRange, datetimeRange, options };
|
|
8
8
|
|
|
@@ -41,21 +41,24 @@ function reset() {
|
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
43
|
<template>
|
|
44
|
-
<div class="flex-none flex w-min ml-auto">
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
<div class="btns flex-none flex w-min ml-auto gap-2">
|
|
45
|
+
<slot :loading="loading" :filter="filter" :reset="reset">
|
|
46
|
+
<AButton class="filter-btn" type="primary" htmlType="submit" :loading="loading" @click="filter()">
|
|
47
|
+
查询
|
|
48
|
+
</AButton>
|
|
49
|
+
<AButton :disabled="loading" @click="reset()">
|
|
50
|
+
重置
|
|
51
|
+
</AButton>
|
|
52
|
+
</slot>
|
|
51
53
|
</div>
|
|
52
54
|
</template>
|
|
53
55
|
|
|
54
56
|
<style scoped lang="scss">
|
|
55
|
-
.filter-btn
|
|
57
|
+
.filter-btn,
|
|
58
|
+
:slotted(.filter-btn) {
|
|
56
59
|
position: relative;
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
.ant-btn-loading-icon{
|
|
59
62
|
position: absolute;
|
|
60
63
|
left: 50%;
|
|
61
64
|
transform: translateX(-50%);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as RichText } from './src/RichText.vue';
|
|
1
|
+
export { default as RichText } from './src/RichText.new.vue';
|
|
2
2
|
export { createImageUploaderForAws3 } from './src/imageUploader';
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useIntervalFn } from '@vueuse/core';
|
|
3
|
+
import CKEditor from '@ckeditor/ckeditor5-vue';
|
|
4
|
+
import { shallowRef } from 'vue';
|
|
5
|
+
import { useInjectDisabled } from 'ant-design-vue/es/config-provider/DisabledContext';
|
|
6
|
+
import { defaultConfig } from './editorConfig';
|
|
7
|
+
import 'https://cdn.ckeditor.com/ckeditor5/41.1.0/super-build/ckeditor.js';
|
|
8
|
+
import 'https://cdn.ckeditor.com/ckeditor5/41.1.0/super-build/translations/zh-cn.js';
|
|
9
|
+
|
|
10
|
+
function useClassicEditor() {
|
|
11
|
+
const ClassicEditor = shallowRef();
|
|
12
|
+
|
|
13
|
+
const { pause } = useIntervalFn(() => {
|
|
14
|
+
ClassicEditor.value = (window as any).CKEDITOR?.ClassicEditor;
|
|
15
|
+
ClassicEditor.value && pause();
|
|
16
|
+
}, 500);
|
|
17
|
+
|
|
18
|
+
return ClassicEditor;
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
const props = defineProps(['modelValue', 'disabled', 'plugins']);
|
|
24
|
+
const emits = defineEmits<{
|
|
25
|
+
(e: 'update:modelValue', value: string): void
|
|
26
|
+
}>();
|
|
27
|
+
|
|
28
|
+
const ClassicEditor = useClassicEditor();
|
|
29
|
+
const disabled = useInjectDisabled();
|
|
30
|
+
const editorConfig = { ...defaultConfig };
|
|
31
|
+
editorConfig.extraPlugins = props.plugins;
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div class="editor-wrapper">
|
|
36
|
+
<CKEditor.component
|
|
37
|
+
v-if="ClassicEditor"
|
|
38
|
+
:modelValue="props.modelValue"
|
|
39
|
+
:editor="ClassicEditor"
|
|
40
|
+
:config="editorConfig"
|
|
41
|
+
:disabled="props.disabled ?? disabled"
|
|
42
|
+
@update:modelValue="v => emits('update:modelValue', v)"
|
|
43
|
+
/>
|
|
44
|
+
<div v-else class="flex justify-center">
|
|
45
|
+
<i class="i-svg-spinners:180-ring-with-bg block text-5 text-$loading-color" />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<style scoped lang="scss">
|
|
51
|
+
.editor-wrapper {
|
|
52
|
+
--loading-color: var(--antd-colorPrimary);
|
|
53
|
+
|
|
54
|
+
:deep(.ck-editor__main > .ck-content) {
|
|
55
|
+
height: 500px;
|
|
56
|
+
overflow: auto;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:root.dark .editor-wrapper {
|
|
61
|
+
/* Overrides the border radius setting in the theme. */
|
|
62
|
+
// --ck-border-radius: 4px;
|
|
63
|
+
|
|
64
|
+
/* Overrides the default font size in the theme. */
|
|
65
|
+
// --ck-font-size-base: 14px;
|
|
66
|
+
|
|
67
|
+
/* Helper variables to avoid duplication in the colors. */
|
|
68
|
+
--ck-custom-background: hsl(270deg 1% 29%);
|
|
69
|
+
--ck-custom-foreground: hsl(255deg 3% 18%);
|
|
70
|
+
--ck-custom-border: hsl(300deg 1% 22%);
|
|
71
|
+
--ck-custom-white: hsl(0deg 0% 100%);
|
|
72
|
+
|
|
73
|
+
/* -- Overrides generic colors. ------------------------------------------------------------- */
|
|
74
|
+
|
|
75
|
+
--ck-color-base-foreground: var(--ck-custom-background);
|
|
76
|
+
--ck-color-focus-border: hsl(208deg 90% 62%);
|
|
77
|
+
--ck-color-text: hsl(0deg 0% 98%);
|
|
78
|
+
--ck-color-shadow-drop: hsl(0deg 0% 0% / 20%);
|
|
79
|
+
--ck-color-shadow-inner: hsl(0deg 0% 0% / 10%);
|
|
80
|
+
|
|
81
|
+
/* -- Overrides the default .ck-button class colors. ---------------------------------------- */
|
|
82
|
+
|
|
83
|
+
--ck-color-button-default-background: var(--ck-custom-background);
|
|
84
|
+
--ck-color-button-default-hover-background: hsl(270deg 1% 22%);
|
|
85
|
+
--ck-color-button-default-active-background: hsl(270deg 2% 20%);
|
|
86
|
+
--ck-color-button-default-active-shadow: hsl(270deg 2% 23%);
|
|
87
|
+
--ck-color-button-default-disabled-background: var(--ck-custom-background);
|
|
88
|
+
--ck-color-button-on-background: var(--ck-custom-foreground);
|
|
89
|
+
--ck-color-button-on-hover-background: hsl(255deg 4% 16%);
|
|
90
|
+
--ck-color-button-on-active-background: hsl(255deg 4% 14%);
|
|
91
|
+
--ck-color-button-on-active-shadow: hsl(240deg 3% 19%);
|
|
92
|
+
--ck-color-button-on-disabled-background: var(--ck-custom-foreground);
|
|
93
|
+
--ck-color-button-action-background: hsl(168deg 76% 42%);
|
|
94
|
+
--ck-color-button-action-hover-background: hsl(168deg 76% 38%);
|
|
95
|
+
--ck-color-button-action-active-background: hsl(168deg 76% 36%);
|
|
96
|
+
--ck-color-button-action-active-shadow: hsl(168deg 75% 34%);
|
|
97
|
+
--ck-color-button-action-disabled-background: hsl(168deg 76% 42%);
|
|
98
|
+
--ck-color-button-action-text: var(--ck-custom-white);
|
|
99
|
+
--ck-color-button-save: hsl(120deg 100% 46%);
|
|
100
|
+
--ck-color-button-cancel: hsl(15deg 100% 56%);
|
|
101
|
+
|
|
102
|
+
/* -- Overrides the default .ck-dropdown class colors. -------------------------------------- */
|
|
103
|
+
|
|
104
|
+
--ck-color-dropdown-panel-background: var(--ck-custom-background);
|
|
105
|
+
--ck-color-dropdown-panel-border: var(--ck-custom-foreground);
|
|
106
|
+
|
|
107
|
+
/* -- Overrides the default .ck-splitbutton class colors. ----------------------------------- */
|
|
108
|
+
|
|
109
|
+
--ck-color-split-button-hover-background: var(--ck-color-button-default-hover-background);
|
|
110
|
+
--ck-color-split-button-hover-border: var(--ck-custom-foreground);
|
|
111
|
+
|
|
112
|
+
/* -- Overrides the default .ck-input class colors. ----------------------------------------- */
|
|
113
|
+
|
|
114
|
+
--ck-color-input-background: var(--ck-custom-background);
|
|
115
|
+
--ck-color-input-border: hsl(257deg 3% 43%);
|
|
116
|
+
--ck-color-input-text: hsl(0deg 0% 98%);
|
|
117
|
+
--ck-color-input-disabled-background: hsl(255deg 4% 21%);
|
|
118
|
+
--ck-color-input-disabled-border: hsl(250deg 3% 38%);
|
|
119
|
+
--ck-color-input-disabled-text: hsl(0deg 0% 78%);
|
|
120
|
+
|
|
121
|
+
/* -- Overrides the default .ck-labeled-field-view class colors. ---------------------------- */
|
|
122
|
+
|
|
123
|
+
--ck-color-labeled-field-label-background: var(--ck-custom-background);
|
|
124
|
+
|
|
125
|
+
/* -- Overrides the default .ck-list class colors. ------------------------------------------ */
|
|
126
|
+
|
|
127
|
+
--ck-color-list-background: var(--ck-custom-background);
|
|
128
|
+
--ck-color-list-button-hover-background: var(--ck-custom-foreground);
|
|
129
|
+
--ck-color-list-button-on-background: hsl(208deg 88% 52%);
|
|
130
|
+
--ck-color-list-button-on-text: var(--ck-custom-white);
|
|
131
|
+
|
|
132
|
+
/* -- Overrides the default .ck-balloon-panel class colors. --------------------------------- */
|
|
133
|
+
|
|
134
|
+
--ck-color-panel-background: var(--ck-custom-background);
|
|
135
|
+
--ck-color-panel-border: var(--ck-custom-border);
|
|
136
|
+
|
|
137
|
+
/* -- Overrides the default .ck-toolbar class colors. --------------------------------------- */
|
|
138
|
+
|
|
139
|
+
--ck-color-toolbar-background: var(--ck-custom-background);
|
|
140
|
+
--ck-color-toolbar-border: var(--ck-custom-border);
|
|
141
|
+
|
|
142
|
+
/* -- Overrides the default .ck-tooltip class colors. --------------------------------------- */
|
|
143
|
+
|
|
144
|
+
--ck-color-tooltip-background: hsl(252deg 7% 14%);
|
|
145
|
+
--ck-color-tooltip-text: hsl(0deg 0% 93%);
|
|
146
|
+
|
|
147
|
+
/* -- Overrides the default colors used by the ckeditor5-image package. --------------------- */
|
|
148
|
+
|
|
149
|
+
--ck-color-image-caption-background: hsl(0deg 0% 97%);
|
|
150
|
+
--ck-color-image-caption-text: hsl(0deg 0% 20%);
|
|
151
|
+
|
|
152
|
+
/* -- Overrides the default colors used by the ckeditor5-widget package. -------------------- */
|
|
153
|
+
|
|
154
|
+
--ck-color-widget-blurred-border: hsl(0deg 0% 87%);
|
|
155
|
+
--ck-color-widget-hover-border: hsl(43deg 100% 68%);
|
|
156
|
+
--ck-color-widget-editable-focus-background: var(--ck-custom-white);
|
|
157
|
+
|
|
158
|
+
/* -- Overrides the default colors used by the ckeditor5-link package. ---------------------- */
|
|
159
|
+
|
|
160
|
+
--ck-color-link-default: hsl(190deg 100% 75%);
|
|
161
|
+
--ck-color-base-background: #141414;
|
|
162
|
+
--ck-color-base-border: #424242;
|
|
163
|
+
}
|
|
164
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { defineModel, defineProps, withDefaults } from 'vue';
|
|
3
3
|
import CKEditor from '@ckeditor/ckeditor5-vue';
|
|
4
4
|
import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';
|
|
5
5
|
import { Alignment } from '@ckeditor/ckeditor5-alignment';
|
|
@@ -212,18 +212,15 @@ const props = withDefaults(defineProps<{
|
|
|
212
212
|
modelValue: '',
|
|
213
213
|
plugins: () => [],
|
|
214
214
|
});
|
|
215
|
-
const emits = defineEmits<{
|
|
216
|
-
(e: 'update:modelValue', value: string): void
|
|
217
|
-
}>();
|
|
218
215
|
|
|
219
|
-
const
|
|
216
|
+
const modelValue = defineModel({ default: '' });
|
|
220
217
|
const localeEditorConfig = { ...editorConfig };
|
|
221
218
|
localeEditorConfig.extraPlugins = [...props.plugins];
|
|
222
219
|
</script>
|
|
223
220
|
|
|
224
221
|
<template>
|
|
225
222
|
<div class="editor-wrapper">
|
|
226
|
-
<CKEditor.component v-model="
|
|
223
|
+
<CKEditor.component v-model="modelValue" :editor="ClassicEditor" :config="localeEditorConfig" />
|
|
227
224
|
</div>
|
|
228
225
|
</template>
|
|
229
226
|
|