cosey 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -0
- package/components/close/style/index.js +2 -2
- package/components/col/col.vue.js +1 -1
- package/components/col/style/index.js +3 -3
- package/components/config-provider/config-provider.d.ts +2 -0
- package/components/config-provider/config-provider.vue.js +13 -3
- package/components/context-menu/context-menu.vue.js +4 -4
- package/components/context-menu/context-sub-menu.vue.js +2 -2
- package/components/context-menu/style/index.js +2 -2
- package/components/editor/components/color-picker/color-picker.vue.js +15 -11
- package/components/editor/components/color-picker/useHistoryColor.js +3 -3
- package/components/editor/components/resize/resize.js +9 -9
- package/components/editor/components/resize/resize.style.js +20 -20
- package/components/editor/components/resize/resize.vue.js +2 -2
- package/components/editor/components/table-toolbar/table-toolbar.style.js +2 -2
- package/components/editor/components/table-toolbar/table-toolbar.vue.js +2 -2
- package/components/editor/components/toolbar/formats/font.vue.js +5 -1
- package/components/editor/components/toolbar/formats/header.vue.js +6 -2
- package/components/editor/components/toolbar/formats/link.vue.js +17 -13
- package/components/editor/components/toolbar/formats/size.vue.js +5 -1
- package/components/editor/components/toolbar/formats/source.vue.d.ts +2 -0
- package/components/editor/components/toolbar/formats/source.vue.js +78 -0
- package/components/editor/components/toolbar/formats/table.style.js +2 -2
- package/components/editor/components/toolbar/formats/video.vue.js +9 -5
- package/components/editor/components/toolbar/toolbar.vue.js +5 -0
- package/components/editor/formats/font.js +2 -2
- package/components/editor/formats/indent.js +1 -1
- package/components/editor/formats/kbd.d.ts +7 -0
- package/components/editor/formats/kbd.js +13 -0
- package/components/editor/modules/image-uploader/formats/image-loading.style.js +2 -2
- package/components/editor/quill.js +8 -6
- package/components/editor/style/index.js +25 -16
- package/components/field/components/autocomplete/autocomplete.vue.js +5 -1
- package/components/field/components/cascader/cascader.vue.js +5 -1
- package/components/field/components/checkbox-group/checkbox-group.vue.js +1 -1
- package/components/field/components/checkbox-group/panel.vue.js +10 -5
- package/components/field/components/date/date.vue.js +5 -1
- package/components/field/components/date-range/date-range.vue.js +6 -2
- package/components/field/components/date-time/date-time.vue.js +5 -1
- package/components/field/components/date-time-range/date-time-range.vue.js +6 -2
- package/components/field/components/dates/dates.vue.js +5 -1
- package/components/field/components/input/input.vue.js +5 -1
- package/components/field/components/input-tag/input-tag.vue.js +5 -1
- package/components/field/components/mention/mention.vue.js +5 -1
- package/components/field/components/month/month.vue.js +5 -1
- package/components/field/components/month-range/month-range.vue.js +6 -2
- package/components/field/components/months/months.vue.js +5 -1
- package/components/field/components/password/password.vue.js +5 -1
- package/components/field/components/select/select.d.ts +2 -2
- package/components/field/components/select/select.js +3 -3
- package/components/field/components/select/select.vue.js +5 -1
- package/components/field/components/select-v2/select-v2.d.ts +6 -3
- package/components/field/components/select-v2/select-v2.js +9 -0
- package/components/field/components/select-v2/select-v2.vue.js +21 -3
- package/components/field/components/textarea/textarea.vue.js +5 -1
- package/components/field/components/time/time.vue.js +5 -1
- package/components/field/components/time-range/time-range.vue.js +6 -2
- package/components/field/components/time-select/time-select.vue.js +5 -1
- package/components/field/components/tree-select/tree-select.vue.js +5 -1
- package/components/field/components/week/week.vue.js +6 -2
- package/components/field/components/year/year.vue.js +5 -1
- package/components/field/components/year-range/year-range.vue.js +6 -2
- package/components/field/components/years/years.vue.js +5 -1
- package/components/form/form-item.d.ts +1 -1
- package/components/form/form.d.ts +2 -0
- package/components/form/form.js +2 -2
- package/components/form/form.vue.d.ts +5 -0
- package/components/form/form.vue.js +6 -2
- package/components/form/index.d.ts +10 -1
- package/components/form/useBubbleTemplate.js +13 -5
- package/components/form-dialog/form-dialog.js +2 -2
- package/components/form-dialog/index.d.ts +4 -1552
- package/components/form-list/form-list.js +1 -1
- package/components/form-list/form-list.vue.js +5 -1
- package/components/form-list/index.d.ts +1 -1
- package/components/form-query/form-query.d.ts +2 -0
- package/components/form-query/form-query.vue.d.ts +5 -0
- package/components/form-query/form-query.vue.js +13 -7
- package/components/form-query/index.d.ts +9 -0
- package/components/highlight/style/index.js +2 -2
- package/components/horizontal-tree/horizontal-tree.vue.js +11 -6
- package/components/image-card/image-card.d.ts +1 -8
- package/components/image-card/image-card.vue.d.ts +4 -18
- package/components/image-card/index.d.ts +8 -29
- package/components/long-text/style/index.js +2 -2
- package/components/mask/style/index.js +2 -2
- package/components/row/row.vue.js +1 -1
- package/components/scroll-view/scroll-view.vue.js +1 -1
- package/components/scroll-view/style/index.js +9 -9
- package/components/table/index.d.ts +73 -78
- package/components/table/table-column/renderer.d.ts +2 -1
- package/components/table/table-column/renderer.js +2 -2
- package/components/table/table-column/table-column.d.ts +15 -15
- package/components/table/table-column/table-column.vue.d.ts +9 -5
- package/components/table/table-column/table-column.vue.js +5 -1
- package/components/table/table-column-editor/table-column-editor.vue.js +22 -14
- package/components/table/table-export/table-export.vue.js +31 -26
- package/components/table/table-query/table-query.d.ts +2 -0
- package/components/table/table-query/table-query.vue.d.ts +5 -0
- package/components/table/table.d.ts +22 -25
- package/components/table/table.vue.d.ts +45 -51
- package/components/table/table.vue.js +13 -9
- package/components/table/useTable.d.ts +2 -1
- package/components/table/useTable.js +2 -2
- package/components/table-action/index.d.ts +48 -6
- package/components/table-action/item.d.ts +16 -2
- package/components/table-action/item.vue.d.ts +34 -6
- package/components/table-action/item.vue.js +15 -9
- package/components/table-action/table-action.vue.d.ts +16 -2
- package/components/toggle/toggle.vue.js +5 -1
- package/components/upload/style/index.js +2 -2
- package/components/upload/upload-item.vue.d.ts +2 -2
- package/components/upload/upload-item.vue.js +16 -9
- package/components/upload/upload.vue.js +7 -1
- package/config/index.d.ts +1 -2
- package/config/index.js +2 -2
- package/config/nprogress.style.js +5 -5
- package/config/root-config-provider.vue.js +5 -5
- package/constant.d.ts +2 -2
- package/constant.js +2 -2
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useColorScheme.js +4 -4
- package/hooks/useDir.d.ts +2 -0
- package/hooks/useDir.js +20 -0
- package/hooks/useEcharts.d.ts +3 -2
- package/hooks/useEcharts.js +15 -3
- package/hooks/useLocale.d.ts +23 -371
- package/hooks/useLocale.js +26 -35
- package/hooks/useUpsert.d.ts +5 -3
- package/hooks/useUpsert.js +33 -25
- package/index.d.ts +1 -1
- package/index.js +4 -4
- package/layout/layout-auth/style/index.js +6 -6
- package/layout/layout-breadcrumb/layout-breadcrumb.vue.js +6 -2
- package/layout/layout-change-password/layout-change-password.vue.js +28 -22
- package/layout/layout-content/layout-content.vue.js +1 -1
- package/layout/layout-content/style/index.js +1 -1
- package/layout/layout-forbidden/layout-forbidden.vue.js +11 -6
- package/layout/layout-header/layout-header.vue.js +4 -4
- package/layout/layout-header/style/index.js +3 -3
- package/layout/layout-iframe/style/index.js +2 -2
- package/layout/layout-internal-server-error/layout-internal-server-error.vue.js +11 -6
- package/layout/layout-login/layout-login.vue.js +19 -14
- package/layout/layout-main/layout-main.vue.js +1 -1
- package/layout/layout-menu/layout-menu.vue.js +5 -1
- package/layout/layout-menu/style/index.js +1 -1
- package/layout/layout-not-found/layout-not-found.vue.js +11 -6
- package/layout/layout-search/layout-search.vue.js +22 -14
- package/layout/layout-sidebar/layout-sidebar.vue.js +8 -5
- package/layout/layout-sidebar/style/index.js +2 -2
- package/layout/layout-snug-aside/style/index.js +1 -1
- package/layout/layout-tabbar/layout-tabbar.vue.js +21 -13
- package/layout/layout-tabbar/style/index.js +1 -1
- package/layout/layout-top-snug-menu/layout-top-snug-menu.vue.js +24 -17
- package/layout/layout-user-menu/layout-user-menu.vue.js +10 -6
- package/locale/index.d.ts +10 -0
- package/locale/index.js +2 -0
- package/locale/lang/ar.d.ts +280 -0
- package/locale/lang/ar.js +129 -0
- package/locale/lang/en.d.ts +302 -0
- package/locale/lang/en.js +129 -0
- package/locale/lang/zh-cn.d.ts +301 -0
- package/locale/lang/zh-cn.js +129 -0
- package/package.json +10 -8
- package/request/useRequest.js +31 -23
- package/store/index.d.ts +1 -1
- package/store/index.js +6 -3
- package/store/layout.js +208 -190
- package/store/plugin.d.ts +9 -0
- package/store/plugin.js +22 -0
- package/store/user.d.ts +1 -1
- package/utils/css.d.ts +4 -0
- package/utils/css.js +5 -2
- package/utils/excel/bookFormats.js +5 -5
- package/utils/excel/xlsx.js +2 -2
- package/utils/index.js +1 -1
- package/utils/message-box.js +3 -1
- package/utils/tree.js +2 -2
- package/components/form-dialog/form-dialog.vue.d.ts +0 -675
package/hooks/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { useEcharts } from './useEcharts.js';
|
|
|
5
5
|
export { useFetch } from './useFetch.js';
|
|
6
6
|
export { useFloating } from './useFloating.js';
|
|
7
7
|
export { useFullPage } from './useFullPage.js';
|
|
8
|
-
export {
|
|
8
|
+
export { buildLocaleContext, buildTranslator, getOutsideLocale, localeContextKey, outsideLocale, translate, useLocale } from './useLocale.js';
|
|
9
9
|
export { useLockScroll } from './useLockScroll.js';
|
|
10
10
|
export { useLockscreenObserver } from './useLockscreenObserver.js';
|
|
11
11
|
export { useResizeObserver } from './useResizeObserver.js';
|
|
@@ -19,3 +19,4 @@ export { useRectObserver } from './useRectObserver.js';
|
|
|
19
19
|
export { treeCheckContextKey, useTreeCheck, useTreeCheckInject } from './useTreeCheck.js';
|
|
20
20
|
export { useOptionalComponent } from './useOptionalComponent.js';
|
|
21
21
|
export { useMounted } from './useMounted.js';
|
|
22
|
+
export { useDir } from './useDir.js';
|
package/hooks/useColorScheme.js
CHANGED
|
@@ -3,11 +3,11 @@ import { usePersist } from './usePersist.js';
|
|
|
3
3
|
import { isClient } from '../utils/env.js';
|
|
4
4
|
|
|
5
5
|
const colorSchemeContextSymbol = Symbol("colorScheme");
|
|
6
|
-
const colorSchemeKey = "colorScheme";
|
|
6
|
+
const colorSchemeKey = "Cosey:colorScheme";
|
|
7
7
|
const colorSchemeOptions = [
|
|
8
|
-
{ label: "
|
|
9
|
-
{ label: "
|
|
10
|
-
{ label: "
|
|
8
|
+
{ label: "co.colorScheme.auto", icon: "co:circle-half-full", value: "auto" },
|
|
9
|
+
{ label: "co.colorScheme.light", icon: "co:sun", value: "light" },
|
|
10
|
+
{ label: "co.colorScheme.dark", icon: "co:moon", value: "dark" }
|
|
11
11
|
];
|
|
12
12
|
function useColorSchemeProvide() {
|
|
13
13
|
const persist = usePersist();
|
package/hooks/useDir.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ref, watch, unref, readonly } from 'vue';
|
|
2
|
+
import { useLocale } from './useLocale.js';
|
|
3
|
+
import { getDir } from '../utils/css.js';
|
|
4
|
+
|
|
5
|
+
function useDir(el) {
|
|
6
|
+
const { lang } = useLocale();
|
|
7
|
+
const dir = ref("");
|
|
8
|
+
watch(lang, () => {
|
|
9
|
+
dir.value = getDir(unref(el));
|
|
10
|
+
});
|
|
11
|
+
watch(
|
|
12
|
+
() => unref(el),
|
|
13
|
+
() => {
|
|
14
|
+
dir.value = getDir(unref(el));
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
return readonly(dir);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { useDir };
|
package/hooks/useEcharts.d.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* 2. 自行销毁
|
|
6
6
|
* 3. 自动调整图表尺寸
|
|
7
7
|
* 4. 修改默认主题
|
|
8
|
+
* 5. 响应式渲染
|
|
8
9
|
*/
|
|
9
|
-
import { type Ref } from 'vue';
|
|
10
|
+
import { MaybeRef, type Ref } from 'vue';
|
|
10
11
|
import { echarts, type ECOption } from '../utils';
|
|
11
12
|
interface UseEchartsOptions {
|
|
12
13
|
option?: ECOption;
|
|
@@ -19,7 +20,7 @@ type OptionArgs = [ECOption, notMerge?: boolean, lazyUpdate?: boolean] | [
|
|
|
19
20
|
lazyUpdate?: boolean;
|
|
20
21
|
}
|
|
21
22
|
];
|
|
22
|
-
export declare function useEcharts(elRef: Ref<HTMLElement | null>, options?: UseEchartsOptions): {
|
|
23
|
+
export declare function useEcharts(elRef: Ref<HTMLElement | null>, options?: MaybeRef<UseEchartsOptions>): {
|
|
23
24
|
setOption: (...args: OptionArgs) => void;
|
|
24
25
|
chart: import("vue").ComputedRef<echarts.ECharts | null>;
|
|
25
26
|
};
|
package/hooks/useEcharts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { onBeforeUnmount, ref, watch, computed } from 'vue';
|
|
1
|
+
import { onBeforeUnmount, ref, unref, watch, computed } from 'vue';
|
|
2
2
|
import { useResizeObserver } from './useResizeObserver.js';
|
|
3
3
|
import '../utils/echarts/index.js';
|
|
4
4
|
import * as echarts from 'echarts/core';
|
|
@@ -14,14 +14,26 @@ function useEcharts(elRef, options = {}) {
|
|
|
14
14
|
onBeforeUnmount(() => {
|
|
15
15
|
dispose();
|
|
16
16
|
});
|
|
17
|
-
const optionQueue = ref(options.option ? [[options.option]] : []);
|
|
17
|
+
const optionQueue = ref(unref(options).option ? [[unref(options).option]] : []);
|
|
18
|
+
watch(
|
|
19
|
+
() => unref(options),
|
|
20
|
+
() => {
|
|
21
|
+
setOption(unref(options).option || {});
|
|
22
|
+
}
|
|
23
|
+
);
|
|
18
24
|
const setOption = (...args) => {
|
|
19
25
|
optionQueue.value = [...optionQueue.value, args];
|
|
20
26
|
};
|
|
21
27
|
const doSetOption = () => {
|
|
22
28
|
if (chart && optionQueue.value.length) {
|
|
23
29
|
for (const option of optionQueue.value) {
|
|
24
|
-
|
|
30
|
+
if (option.length === 1) {
|
|
31
|
+
chart.setOption(option[0], {
|
|
32
|
+
notMerge: true
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
chart.setOption(...option);
|
|
36
|
+
}
|
|
25
37
|
}
|
|
26
38
|
optionQueue.value = [];
|
|
27
39
|
}
|
package/hooks/useLocale.d.ts
CHANGED
|
@@ -1,372 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
colorpicker: {
|
|
11
|
-
confirm: string;
|
|
12
|
-
clear: string;
|
|
13
|
-
defaultLabel: string;
|
|
14
|
-
description: string;
|
|
15
|
-
alphaLabel: string;
|
|
16
|
-
};
|
|
17
|
-
datepicker: {
|
|
18
|
-
now: string;
|
|
19
|
-
today: string;
|
|
20
|
-
cancel: string;
|
|
21
|
-
clear: string;
|
|
22
|
-
confirm: string;
|
|
23
|
-
dateTablePrompt: string;
|
|
24
|
-
monthTablePrompt: string;
|
|
25
|
-
yearTablePrompt: string;
|
|
26
|
-
selectedDate: string;
|
|
27
|
-
selectDate: string;
|
|
28
|
-
selectTime: string;
|
|
29
|
-
startDate: string;
|
|
30
|
-
startTime: string;
|
|
31
|
-
endDate: string;
|
|
32
|
-
endTime: string;
|
|
33
|
-
prevYear: string;
|
|
34
|
-
nextYear: string;
|
|
35
|
-
prevMonth: string;
|
|
36
|
-
nextMonth: string;
|
|
37
|
-
year: string;
|
|
38
|
-
month1: string;
|
|
39
|
-
month2: string;
|
|
40
|
-
month3: string;
|
|
41
|
-
month4: string;
|
|
42
|
-
month5: string;
|
|
43
|
-
month6: string;
|
|
44
|
-
month7: string;
|
|
45
|
-
month8: string;
|
|
46
|
-
month9: string;
|
|
47
|
-
month10: string;
|
|
48
|
-
month11: string;
|
|
49
|
-
month12: string;
|
|
50
|
-
weeks: {
|
|
51
|
-
sun: string;
|
|
52
|
-
mon: string;
|
|
53
|
-
tue: string;
|
|
54
|
-
wed: string;
|
|
55
|
-
thu: string;
|
|
56
|
-
fri: string;
|
|
57
|
-
sat: string;
|
|
58
|
-
};
|
|
59
|
-
weeksFull: {
|
|
60
|
-
sun: string;
|
|
61
|
-
mon: string;
|
|
62
|
-
tue: string;
|
|
63
|
-
wed: string;
|
|
64
|
-
thu: string;
|
|
65
|
-
fri: string;
|
|
66
|
-
sat: string;
|
|
67
|
-
};
|
|
68
|
-
months: {
|
|
69
|
-
jan: string;
|
|
70
|
-
feb: string;
|
|
71
|
-
mar: string;
|
|
72
|
-
apr: string;
|
|
73
|
-
may: string;
|
|
74
|
-
jun: string;
|
|
75
|
-
jul: string;
|
|
76
|
-
aug: string;
|
|
77
|
-
sep: string;
|
|
78
|
-
oct: string;
|
|
79
|
-
nov: string;
|
|
80
|
-
dec: string;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
inputNumber: {
|
|
84
|
-
decrease: string;
|
|
85
|
-
increase: string;
|
|
86
|
-
};
|
|
87
|
-
select: {
|
|
88
|
-
loading: string;
|
|
89
|
-
noMatch: string;
|
|
90
|
-
noData: string;
|
|
91
|
-
placeholder: string;
|
|
92
|
-
};
|
|
93
|
-
dropdown: {
|
|
94
|
-
toggleDropdown: string;
|
|
95
|
-
};
|
|
96
|
-
mention: {
|
|
97
|
-
loading: string;
|
|
98
|
-
};
|
|
99
|
-
cascader: {
|
|
100
|
-
noMatch: string;
|
|
101
|
-
loading: string;
|
|
102
|
-
placeholder: string;
|
|
103
|
-
noData: string;
|
|
104
|
-
};
|
|
105
|
-
pagination: {
|
|
106
|
-
goto: string;
|
|
107
|
-
pagesize: string;
|
|
108
|
-
total: string;
|
|
109
|
-
pageClassifier: string;
|
|
110
|
-
page: string;
|
|
111
|
-
prev: string;
|
|
112
|
-
next: string;
|
|
113
|
-
currentPage: string;
|
|
114
|
-
prevPages: string;
|
|
115
|
-
nextPages: string;
|
|
116
|
-
deprecationWarning: string;
|
|
117
|
-
};
|
|
118
|
-
dialog: {
|
|
119
|
-
close: string;
|
|
120
|
-
};
|
|
121
|
-
drawer: {
|
|
122
|
-
close: string;
|
|
123
|
-
};
|
|
124
|
-
messagebox: {
|
|
125
|
-
title: string;
|
|
126
|
-
confirm: string;
|
|
127
|
-
cancel: string;
|
|
128
|
-
error: string;
|
|
129
|
-
close: string;
|
|
130
|
-
};
|
|
131
|
-
upload: {
|
|
132
|
-
deleteTip: string;
|
|
133
|
-
delete: string;
|
|
134
|
-
preview: string;
|
|
135
|
-
continue: string;
|
|
136
|
-
};
|
|
137
|
-
slider: {
|
|
138
|
-
defaultLabel: string;
|
|
139
|
-
defaultRangeStartLabel: string;
|
|
140
|
-
defaultRangeEndLabel: string;
|
|
141
|
-
};
|
|
142
|
-
table: {
|
|
143
|
-
emptyText: string;
|
|
144
|
-
confirmFilter: string;
|
|
145
|
-
resetFilter: string;
|
|
146
|
-
clearFilter: string;
|
|
147
|
-
sumText: string;
|
|
148
|
-
};
|
|
149
|
-
tour: {
|
|
150
|
-
next: string;
|
|
151
|
-
previous: string;
|
|
152
|
-
finish: string;
|
|
153
|
-
};
|
|
154
|
-
tree: {
|
|
155
|
-
emptyText: string;
|
|
156
|
-
};
|
|
157
|
-
transfer: {
|
|
158
|
-
noMatch: string;
|
|
159
|
-
noData: string;
|
|
160
|
-
titles: string[];
|
|
161
|
-
filterPlaceholder: string;
|
|
162
|
-
noCheckedFormat: string;
|
|
163
|
-
hasCheckedFormat: string;
|
|
164
|
-
};
|
|
165
|
-
image: {
|
|
166
|
-
error: string;
|
|
167
|
-
};
|
|
168
|
-
pageHeader: {
|
|
169
|
-
title: string;
|
|
170
|
-
};
|
|
171
|
-
popconfirm: {
|
|
172
|
-
confirmButtonText: string;
|
|
173
|
-
cancelButtonText: string;
|
|
174
|
-
};
|
|
175
|
-
carousel: {
|
|
176
|
-
leftArrow: string;
|
|
177
|
-
rightArrow: string;
|
|
178
|
-
indicator: string;
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
dayjs: dayjsZh.Locale;
|
|
183
|
-
};
|
|
184
|
-
en_US: {
|
|
185
|
-
ep: {
|
|
186
|
-
name: string;
|
|
187
|
-
el: {
|
|
188
|
-
breadcrumb: {
|
|
189
|
-
label: string;
|
|
190
|
-
};
|
|
191
|
-
colorpicker: {
|
|
192
|
-
confirm: string;
|
|
193
|
-
clear: string;
|
|
194
|
-
defaultLabel: string;
|
|
195
|
-
description: string;
|
|
196
|
-
alphaLabel: string;
|
|
197
|
-
};
|
|
198
|
-
datepicker: {
|
|
199
|
-
now: string;
|
|
200
|
-
today: string;
|
|
201
|
-
cancel: string;
|
|
202
|
-
clear: string;
|
|
203
|
-
confirm: string;
|
|
204
|
-
dateTablePrompt: string;
|
|
205
|
-
monthTablePrompt: string;
|
|
206
|
-
yearTablePrompt: string;
|
|
207
|
-
selectedDate: string;
|
|
208
|
-
selectDate: string;
|
|
209
|
-
selectTime: string;
|
|
210
|
-
startDate: string;
|
|
211
|
-
startTime: string;
|
|
212
|
-
endDate: string;
|
|
213
|
-
endTime: string;
|
|
214
|
-
prevYear: string;
|
|
215
|
-
nextYear: string;
|
|
216
|
-
prevMonth: string;
|
|
217
|
-
nextMonth: string;
|
|
218
|
-
year: string;
|
|
219
|
-
month1: string;
|
|
220
|
-
month2: string;
|
|
221
|
-
month3: string;
|
|
222
|
-
month4: string;
|
|
223
|
-
month5: string;
|
|
224
|
-
month6: string;
|
|
225
|
-
month7: string;
|
|
226
|
-
month8: string;
|
|
227
|
-
month9: string;
|
|
228
|
-
month10: string;
|
|
229
|
-
month11: string;
|
|
230
|
-
month12: string;
|
|
231
|
-
week: string;
|
|
232
|
-
weeks: {
|
|
233
|
-
sun: string;
|
|
234
|
-
mon: string;
|
|
235
|
-
tue: string;
|
|
236
|
-
wed: string;
|
|
237
|
-
thu: string;
|
|
238
|
-
fri: string;
|
|
239
|
-
sat: string;
|
|
240
|
-
};
|
|
241
|
-
weeksFull: {
|
|
242
|
-
sun: string;
|
|
243
|
-
mon: string;
|
|
244
|
-
tue: string;
|
|
245
|
-
wed: string;
|
|
246
|
-
thu: string;
|
|
247
|
-
fri: string;
|
|
248
|
-
sat: string;
|
|
249
|
-
};
|
|
250
|
-
months: {
|
|
251
|
-
jan: string;
|
|
252
|
-
feb: string;
|
|
253
|
-
mar: string;
|
|
254
|
-
apr: string;
|
|
255
|
-
may: string;
|
|
256
|
-
jun: string;
|
|
257
|
-
jul: string;
|
|
258
|
-
aug: string;
|
|
259
|
-
sep: string;
|
|
260
|
-
oct: string;
|
|
261
|
-
nov: string;
|
|
262
|
-
dec: string;
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
inputNumber: {
|
|
266
|
-
decrease: string;
|
|
267
|
-
increase: string;
|
|
268
|
-
};
|
|
269
|
-
select: {
|
|
270
|
-
loading: string;
|
|
271
|
-
noMatch: string;
|
|
272
|
-
noData: string;
|
|
273
|
-
placeholder: string;
|
|
274
|
-
};
|
|
275
|
-
mention: {
|
|
276
|
-
loading: string;
|
|
277
|
-
};
|
|
278
|
-
dropdown: {
|
|
279
|
-
toggleDropdown: string;
|
|
280
|
-
};
|
|
281
|
-
cascader: {
|
|
282
|
-
noMatch: string;
|
|
283
|
-
loading: string;
|
|
284
|
-
placeholder: string;
|
|
285
|
-
noData: string;
|
|
286
|
-
};
|
|
287
|
-
pagination: {
|
|
288
|
-
goto: string;
|
|
289
|
-
pagesize: string;
|
|
290
|
-
total: string;
|
|
291
|
-
pageClassifier: string;
|
|
292
|
-
page: string;
|
|
293
|
-
prev: string;
|
|
294
|
-
next: string;
|
|
295
|
-
currentPage: string;
|
|
296
|
-
prevPages: string;
|
|
297
|
-
nextPages: string;
|
|
298
|
-
deprecationWarning: string;
|
|
299
|
-
};
|
|
300
|
-
dialog: {
|
|
301
|
-
close: string;
|
|
302
|
-
};
|
|
303
|
-
drawer: {
|
|
304
|
-
close: string;
|
|
305
|
-
};
|
|
306
|
-
messagebox: {
|
|
307
|
-
title: string;
|
|
308
|
-
confirm: string;
|
|
309
|
-
cancel: string;
|
|
310
|
-
error: string;
|
|
311
|
-
close: string;
|
|
312
|
-
};
|
|
313
|
-
upload: {
|
|
314
|
-
deleteTip: string;
|
|
315
|
-
delete: string;
|
|
316
|
-
preview: string;
|
|
317
|
-
continue: string;
|
|
318
|
-
};
|
|
319
|
-
slider: {
|
|
320
|
-
defaultLabel: string;
|
|
321
|
-
defaultRangeStartLabel: string;
|
|
322
|
-
defaultRangeEndLabel: string;
|
|
323
|
-
};
|
|
324
|
-
table: {
|
|
325
|
-
emptyText: string;
|
|
326
|
-
confirmFilter: string;
|
|
327
|
-
resetFilter: string;
|
|
328
|
-
clearFilter: string;
|
|
329
|
-
sumText: string;
|
|
330
|
-
};
|
|
331
|
-
tour: {
|
|
332
|
-
next: string;
|
|
333
|
-
previous: string;
|
|
334
|
-
finish: string;
|
|
335
|
-
};
|
|
336
|
-
tree: {
|
|
337
|
-
emptyText: string;
|
|
338
|
-
};
|
|
339
|
-
transfer: {
|
|
340
|
-
noMatch: string;
|
|
341
|
-
noData: string;
|
|
342
|
-
titles: string[];
|
|
343
|
-
filterPlaceholder: string;
|
|
344
|
-
noCheckedFormat: string;
|
|
345
|
-
hasCheckedFormat: string;
|
|
346
|
-
};
|
|
347
|
-
image: {
|
|
348
|
-
error: string;
|
|
349
|
-
};
|
|
350
|
-
pageHeader: {
|
|
351
|
-
title: string;
|
|
352
|
-
};
|
|
353
|
-
popconfirm: {
|
|
354
|
-
confirmButtonText: string;
|
|
355
|
-
cancelButtonText: string;
|
|
356
|
-
};
|
|
357
|
-
carousel: {
|
|
358
|
-
leftArrow: string;
|
|
359
|
-
rightArrow: string;
|
|
360
|
-
indicator: string;
|
|
361
|
-
};
|
|
362
|
-
};
|
|
363
|
-
};
|
|
364
|
-
dayjs: dayjsZh.Locale;
|
|
365
|
-
};
|
|
1
|
+
import { type InjectionKey, type MaybeRef, type Ref } from 'vue';
|
|
2
|
+
import { type Language } from '../locale';
|
|
3
|
+
export type TranslatorOption = Record<string, string | number>;
|
|
4
|
+
export type Translator = (path: string, option?: TranslatorOption) => string;
|
|
5
|
+
export type LocaleContext = {
|
|
6
|
+
locale: Ref<Language>;
|
|
7
|
+
lang: Ref<string>;
|
|
8
|
+
t: Translator;
|
|
366
9
|
};
|
|
367
|
-
export declare
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
export declare
|
|
372
|
-
|
|
10
|
+
export declare const buildTranslator: (locale: MaybeRef<Language>) => Translator;
|
|
11
|
+
export declare const translate: (path: string, option: undefined | TranslatorOption, locale: Language) => string;
|
|
12
|
+
export declare const buildLocaleContext: (locale: MaybeRef<Language>) => LocaleContext;
|
|
13
|
+
export declare const localeContextKey: InjectionKey<Ref<Language | undefined>>;
|
|
14
|
+
export declare const outsideLocale: Ref<{
|
|
15
|
+
name: string;
|
|
16
|
+
el: import("../locale").TranslatePair;
|
|
17
|
+
co: import("../locale").TranslatePair;
|
|
18
|
+
}, Language | {
|
|
19
|
+
name: string;
|
|
20
|
+
el: import("../locale").TranslatePair;
|
|
21
|
+
co: import("../locale").TranslatePair;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const getOutsideLocale: () => LocaleContext;
|
|
24
|
+
export declare const useLocale: (localeOverrides?: Ref<Language | undefined>) => LocaleContext;
|
package/hooks/useLocale.js
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
import { inject,
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
|
-
import dayjsZh from 'dayjs/locale/zh-cn';
|
|
6
|
-
import dayEn from 'dayjs/locale/en';
|
|
1
|
+
import { ref, inject, computed, unref, isRef } from 'vue';
|
|
2
|
+
import { get } from 'lodash-es';
|
|
3
|
+
import stdin_default from '../locale/lang/en.js';
|
|
7
4
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const locale = ref();
|
|
21
|
-
const setLocale = (language) => {
|
|
22
|
-
const lang = mapLocale[language];
|
|
23
|
-
locale.value = lang.ep;
|
|
24
|
-
dayjs.locale(lang.dayjs);
|
|
25
|
-
};
|
|
26
|
-
setLocale("zh_CN");
|
|
27
|
-
const context = {
|
|
28
|
-
locale,
|
|
29
|
-
setLocale
|
|
5
|
+
const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
|
|
6
|
+
const translate = (path, option, locale) => get(locale, path, path).replace(
|
|
7
|
+
/\{(\w+)\}/g,
|
|
8
|
+
(_, key) => `${option?.[key] ?? `{${key}}`}`
|
|
9
|
+
);
|
|
10
|
+
const buildLocaleContext = (locale) => {
|
|
11
|
+
const lang = computed(() => unref(locale).name);
|
|
12
|
+
const localeRef = isRef(locale) ? locale : ref(locale);
|
|
13
|
+
return {
|
|
14
|
+
lang,
|
|
15
|
+
locale: localeRef,
|
|
16
|
+
t: buildTranslator(locale)
|
|
30
17
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
}
|
|
18
|
+
};
|
|
19
|
+
const localeContextKey = Symbol("localeContextKey");
|
|
20
|
+
const outsideLocale = ref(stdin_default);
|
|
21
|
+
const getOutsideLocale = () => {
|
|
22
|
+
return useLocale(outsideLocale);
|
|
23
|
+
};
|
|
24
|
+
const useLocale = (localeOverrides) => {
|
|
25
|
+
const locale = localeOverrides || inject(localeContextKey, ref());
|
|
26
|
+
return buildLocaleContext(computed(() => locale.value || stdin_default));
|
|
27
|
+
};
|
|
37
28
|
|
|
38
|
-
export {
|
|
29
|
+
export { buildLocaleContext, buildTranslator, getOutsideLocale, localeContextKey, outsideLocale, translate, useLocale };
|
package/hooks/useUpsert.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ref,
|
|
1
|
+
import { type ShallowRef, type Ref, MaybeRef } from 'vue';
|
|
2
2
|
export interface UseUpsertExposeOptions {
|
|
3
3
|
success?: () => any;
|
|
4
4
|
}
|
|
@@ -13,7 +13,7 @@ export interface UseUpsertOptions<Model, Row = Model, Data = Model> {
|
|
|
13
13
|
title?: string;
|
|
14
14
|
stuffTitle?: string;
|
|
15
15
|
model: Model;
|
|
16
|
-
show?:
|
|
16
|
+
show?: (type: UpsertType, row?: Row) => void;
|
|
17
17
|
details?: (row: Row) => any;
|
|
18
18
|
beforeFill?: (row: Row) => any;
|
|
19
19
|
beforeSubmit?: (model: Model) => Data | Promise<Data>;
|
|
@@ -37,8 +37,10 @@ export interface UseUpsertReturn<Model extends Record<string, any>, Row extends
|
|
|
37
37
|
formRef: any;
|
|
38
38
|
data: Ref<Data | undefined>;
|
|
39
39
|
expose: UseUpsertExpose<Row, Data>;
|
|
40
|
+
row: ShallowRef<Row | undefined>;
|
|
41
|
+
type: Ref<UpsertType>;
|
|
40
42
|
}
|
|
41
|
-
export declare function useUpsert<Model extends Record<string, any>, Row extends Record<string, any> = Model, Data = any>(options: UseUpsertOptions<Model, Row
|
|
43
|
+
export declare function useUpsert<Model extends Record<string, any>, Row extends Record<string, any> = Model, Data = any>(options: MaybeRef<UseUpsertOptions<Model, Row>>): UseUpsertReturn<Model, Row>;
|
|
42
44
|
export interface UseExternalUpsertOptions {
|
|
43
45
|
success?: () => any;
|
|
44
46
|
}
|