Skip to content

Commit 6bc147a

Browse files
committed
chore(dice-admin):update framework
1 parent 63cadc6 commit 6bc147a

40 files changed

+328
-191
lines changed

dice-admin/src/components/Application/src/search/useMenuSearch.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { type Menu } from '@/router/types';
2-
import { type AnyFunction } from '@vben/types';
3-
import { ref, onBeforeMount, unref, Ref, nextTick } from 'vue';
1+
import { useI18n } from '@/hooks/web/useI18n';
2+
import { useGo } from '@/hooks/web/usePage';
43
import { getMenus } from '@/router/menus';
5-
import { cloneDeep } from 'lodash-es';
4+
import { type Menu } from '@/router/types';
65
import { filter, forEach } from '@/utils/helper/treeHelper';
7-
import { useGo } from '@/hooks/web/usePage';
86
import { useScrollTo } from '@vben/hooks';
7+
import { type AnyFunction } from '@vben/types';
98
import { onKeyStroke, useDebounceFn } from '@vueuse/core';
10-
import { useI18n } from '@/hooks/web/useI18n';
9+
import { cloneDeep } from 'lodash-es';
10+
import { Ref, nextTick, onBeforeMount, ref, unref } from 'vue';
1111

1212
export interface SearchResult {
1313
name: string;
@@ -42,7 +42,7 @@ export function useMenuSearch(refs: Ref<HTMLElement[]>, scrollWrap: Ref, emit: A
4242
const list = await getMenus();
4343
menuList = cloneDeep(list);
4444
forEach(menuList, (item) => {
45-
item.name = t(item.name);
45+
item.name = t(item.meta?.title || item.name);
4646
});
4747
});
4848

@@ -56,7 +56,7 @@ export function useMenuSearch(refs: Ref<HTMLElement[]>, scrollWrap: Ref, emit: A
5656
}
5757
const reg = createSearchReg(unref(keyword));
5858
const filterMenu = filter(menuList, (item) => {
59-
return reg.test(item.name) && !item.hideMenu;
59+
return reg.test(item.name?.toLowerCase()) && !item.hideMenu;
6060
});
6161
searchResult.value = handlerSearchResult(filterMenu, reg);
6262
activeIndex.value = 0;
@@ -66,7 +66,7 @@ export function useMenuSearch(refs: Ref<HTMLElement[]>, scrollWrap: Ref, emit: A
6666
const ret: SearchResult[] = [];
6767
filterMenu.forEach((item) => {
6868
const { name, path, icon, children, hideMenu, meta } = item;
69-
if (!hideMenu && reg.test(name) && (!children?.length || meta?.hideChildrenInMenu)) {
69+
if (!hideMenu && reg.test(name?.toLowerCase()) && (!children?.length || meta?.hideChildrenInMenu)) {
7070
ret.push({
7171
name: parent?.name ? `${parent.name} > ${name}` : name,
7272
path,

dice-admin/src/components/Form/src/BasicForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
if (!autoSubmitOnEnter) return;
286286
if (e.key === 'Enter' && e.target && e.target instanceof HTMLElement) {
287287
const target: HTMLElement = e.target as HTMLElement;
288-
if (target && target.tagName && target.tagName.toUpperCase() == 'INPUT') {
288+
if (target && target.tagName && target.tagName.toUpperCase() === 'INPUT') {
289289
handleSubmit();
290290
}
291291
}

dice-admin/src/components/Form/src/components/ApiCascader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
type: Array,
4747
},
4848
api: {
49-
type: Function as PropType<(arg?: any) => Promise<Option[]>>,
49+
type: Function as PropType<(arg?: any) => Promise<Option[] | Recordable<any>>> ,
5050
default: null,
5151
},
5252
numberToString: propTypes.bool,

dice-admin/src/components/Form/src/components/ApiRadioGroup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
const props = defineProps({
4040
api: {
41-
type: Function as PropType<(arg?: any) => Promise<OptionsItem[]>>,
41+
type: Function as PropType<(arg?: any) => Promise<OptionsItem[] | Recordable<any>>>,
4242
default: null,
4343
},
4444
params: {

dice-admin/src/components/Form/src/components/ApiSelect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
value: { type: [Array, Object, String, Number] as PropType<SelectValue> },
4040
numberToString: propTypes.bool,
4141
api: {
42-
type: Function as PropType<(arg?: any) => Promise<OptionsItem[]>>,
42+
type: Function as PropType<(arg?: any) => Promise<OptionsItem[] | Recordable<any>>>,
4343
default: null,
4444
},
4545
// api params

dice-admin/src/components/Form/src/components/ApiTransfer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
const props = defineProps({
2626
value: { type: Array as PropType<Array<string>> },
2727
api: {
28-
type: Function as PropType<(arg) => Promise<TransferItem[]>>,
28+
type: Function as PropType<(arg) => Promise<TransferItem[] | Recordable<any>>> ,
2929
default: null,
3030
},
3131
params: { type: Object },

dice-admin/src/components/Form/src/hooks/useFormEvents.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function useFormEvents({
8787
const defaultValueObj = schema?.defaultValueObj;
8888
const fieldKeys = Object.keys(defaultValueObj || {});
8989
if (fieldKeys.length) {
90-
fieldKeys.map((field) => {
90+
fieldKeys.forEach((field) => {
9191
formModel[field] = defaultValueObj![field];
9292
});
9393
}
@@ -135,6 +135,9 @@ export function useFormEvents({
135135
}
136136

137137
const constructValue = tryConstructArray(key, values) || tryConstructObject(key, values);
138+
const setDateFieldValue = (v) => {
139+
return v ? (_props?.valueFormat ? v : dateUtil(v)) : null;
140+
};
138141

139142
// 0| '' is allow
140143
if (hasKey || !!constructValue) {
@@ -144,15 +147,11 @@ export function useFormEvents({
144147
if (Array.isArray(fieldValue)) {
145148
const arr: any[] = [];
146149
for (const ele of fieldValue) {
147-
arr.push(ele ? dateUtil(ele) : null);
150+
arr.push(setDateFieldValue(ele));
148151
}
149152
unref(formModel)[key] = arr;
150153
} else {
151-
unref(formModel)[key] = fieldValue
152-
? _props?.valueFormat
153-
? fieldValue
154-
: dateUtil(fieldValue)
155-
: null;
154+
unref(formModel)[key] = setDateFieldValue(fieldValue);
156155
}
157156
} else {
158157
unref(formModel)[key] = fieldValue;

dice-admin/src/components/Form/src/hooks/useFormValues.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export function useFormValues({
138138
const { defaultValue, defaultValueObj } = item;
139139
const fieldKeys = Object.keys(defaultValueObj || {});
140140
if (fieldKeys.length) {
141-
fieldKeys.map((field) => {
141+
fieldKeys.forEach((field) => {
142142
obj[field] = defaultValueObj![field];
143143
if (formModel[field] === undefined) {
144144
formModel[field] = defaultValueObj![field];

dice-admin/src/components/Menu/src/components/MenuItemContent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
const { t } = useI18n();
2020
const { prefixCls } = useDesign('basic-menu-item-content');
2121
22-
const getI18nName = computed(() => t(props.item?.name));
22+
const getI18nName = computed(() => t(props.item?.meta?.title || props.item?.name));
2323
const getIcon = computed(() => (props.item?.img ? undefined : props.item?.icon));
2424
const getImg = computed(() => props.item?.img);
2525
</script>

dice-admin/src/components/Modal/src/BasicModal.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,11 @@
151151
...unref(getMergeProps),
152152
open: unref(openRef),
153153
};
154-
attr['wrapClassName'] =
155-
`${attr?.['wrapClassName'] || ''} ${unref(getWrapClassName)}` + 'vben-basic-modal-wrap';
154+
if (attr?.['wrapClassName'] === unref(getWrapClassName)) {
155+
attr['wrapClassName'] = `${attr?.['wrapClassName'] || ''} ` + prefixCls;
156+
} else {
157+
attr['wrapClassName'] = `${unref(getWrapClassName) || ''}` + prefixCls;
158+
}
156159
if (unref(fullScreenRef)) {
157160
return omit(attr, ['height', 'title']);
158161
}

dice-admin/src/components/Modal/src/index.less

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@modal-prefix-cls: ~'@{namespace}-basic-modal';
2+
13
.fullscreen-modal {
24
overflow: hidden;
35

@@ -18,103 +20,105 @@
1820
}
1921
}
2022

21-
.ant-modal {
22-
width: 520px;
23-
padding-bottom: 0;
23+
.@{modal-prefix-cls} {
24+
.ant-modal {
25+
width: 520px;
26+
padding-bottom: 0;
2427

25-
.ant-modal-body > .scrollbar {
26-
padding: 14px;
27-
}
28+
.ant-modal-body > .scrollbar {
29+
padding: 14px;
30+
}
2831

29-
&-title {
30-
font-size: 16px;
31-
font-weight: bold;
32+
&-title {
33+
font-size: 16px;
34+
font-weight: bold;
3235

33-
.base-title {
34-
cursor: move !important;
36+
.base-title {
37+
cursor: move !important;
38+
}
3539
}
36-
}
3740

38-
.ant-modal-body {
39-
padding: 0;
41+
.ant-modal-body {
42+
padding: 0;
4043

41-
> .scrollbar > .scrollbar__bar.is-horizontal {
42-
display: none;
44+
> .scrollbar > .scrollbar__bar.is-horizontal {
45+
display: none;
46+
}
4347
}
44-
}
4548

46-
&-large {
47-
top: 60px;
49+
&-large {
50+
top: 60px;
4851

49-
&--mini {
50-
top: 16px;
52+
&--mini {
53+
top: 16px;
54+
}
5155
}
52-
}
5356

54-
&-header {
55-
padding: 16px;
56-
border-bottom: 1px solid @border-color-base;
57-
}
57+
&-header {
58+
padding: 16px;
59+
border-bottom: 1px solid @border-color-base;
60+
}
5861

59-
&-content {
60-
padding: 0 !important;
61-
box-shadow:
62-
0 4px 8px 0 rgb(0 0 0 / 20%),
63-
0 6px 20px 0 rgb(0 0 0 / 19%);
64-
}
62+
&-content {
63+
padding: 0 !important;
64+
box-shadow:
65+
0 4px 8px 0 rgb(0 0 0 / 20%),
66+
0 6px 20px 0 rgb(0 0 0 / 19%);
67+
}
6568

66-
&-footer {
67-
padding: 10px 16px;
68-
border-top: 1px solid @border-color-base;
69+
&-footer {
70+
padding: 10px 16px;
71+
border-top: 1px solid @border-color-base;
6972

70-
button + button {
71-
margin-left: 10px;
73+
button + button {
74+
margin-left: 10px;
75+
}
7276
}
73-
}
7477

75-
&-close {
76-
top: 0 !important;
77-
right: 0 !important;
78-
width: auto !important;
79-
outline: none;
80-
background: transparent !important;
81-
font-weight: normal;
82-
}
78+
&-close {
79+
top: 0 !important;
80+
right: 0 !important;
81+
width: auto !important;
82+
outline: none;
83+
background: transparent !important;
84+
font-weight: normal;
85+
}
8386

84-
&-close-x {
85-
display: inline-block;
86-
width: 96px;
87-
height: 56px;
88-
line-height: 56px !important;
89-
}
87+
&-close-x {
88+
display: inline-block;
89+
width: 96px;
90+
height: 56px;
91+
line-height: 56px !important;
92+
}
9093

91-
&-confirm-body {
92-
.ant-modal-confirm-content {
93-
> * {
94-
color: @text-color-help-dark;
94+
&-confirm-body {
95+
.ant-modal-confirm-content {
96+
> * {
97+
color: @text-color-help-dark;
98+
}
9599
}
96100
}
97-
}
98101

99-
&-confirm-confirm.error .ant-modal-confirm-body > .anticon {
100-
color: @error-color;
101-
}
102+
&-confirm-confirm.error .ant-modal-confirm-body > .anticon {
103+
color: @error-color;
104+
}
102105

103-
&-confirm-btns {
104-
.ant-btn:last-child {
105-
margin-right: 0;
106+
&-confirm-btns {
107+
.ant-btn:last-child {
108+
margin-right: 0;
109+
}
106110
}
107-
}
108111

109-
&-confirm-info {
110-
.ant-modal-confirm-body > .anticon {
111-
color: @warning-color;
112+
&-confirm-info {
113+
.ant-modal-confirm-body > .anticon {
114+
color: @warning-color;
115+
}
112116
}
113-
}
114117

115-
&-confirm-confirm.success {
116-
.ant-modal-confirm-body > .anticon {
117-
color: @success-color;
118+
&-confirm-confirm.success {
119+
.ant-modal-confirm-body > .anticon {
120+
color: @success-color;
121+
}
118122
}
119123
}
120124
}

0 commit comments

Comments
 (0)