fix: improve the layout of tables offline on the mobile (#4573)
parent
d37e2f599c
commit
47d162e6e4
|
@ -30,12 +30,12 @@ const submitButtonOptions = computed(() => {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const isQueryForm = computed(() => {
|
// const isQueryForm = computed(() => {
|
||||||
return !!unref(rootProps).showCollapseButton;
|
// return !!unref(rootProps).showCollapseButton;
|
||||||
});
|
// });
|
||||||
|
|
||||||
const queryFormStyle = computed(() => {
|
const queryFormStyle = computed(() => {
|
||||||
if (isQueryForm.value) {
|
if (!unref(rootProps).actionWrapperClass) {
|
||||||
return {
|
return {
|
||||||
'grid-column': `-2 / -1`,
|
'grid-column': `-2 / -1`,
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
|
|
|
@ -76,3 +76,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vxe-pager--wrapper {
|
||||||
|
@apply justify-center md:justify-end;
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import {
|
||||||
import { usePriorityValues } from '@vben/hooks';
|
import { usePriorityValues } from '@vben/hooks';
|
||||||
import { EmptyIcon } from '@vben/icons';
|
import { EmptyIcon } from '@vben/icons';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
import { usePreferences } from '@vben/preferences';
|
||||||
import { cloneDeep, cn, mergeWithArrayOverride } from '@vben/utils';
|
import { cloneDeep, cn, mergeWithArrayOverride } from '@vben/utils';
|
||||||
import { VbenLoading } from '@vben-core/shadcn-ui';
|
import { VbenLoading } from '@vben-core/shadcn-ui';
|
||||||
|
|
||||||
|
@ -48,6 +49,8 @@ const {
|
||||||
formOptions,
|
formOptions,
|
||||||
} = usePriorityValues(props, state);
|
} = usePriorityValues(props, state);
|
||||||
|
|
||||||
|
const { isMobile } = usePreferences();
|
||||||
|
|
||||||
const slots = useSlots();
|
const slots = useSlots();
|
||||||
|
|
||||||
const [Form, formApi] = useTableForm({});
|
const [Form, formApi] = useTableForm({});
|
||||||
|
@ -91,6 +94,20 @@ const options = computed(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mergedOptions.pagerConfig) {
|
if (mergedOptions.pagerConfig) {
|
||||||
|
const mobileLayouts = [
|
||||||
|
'PrevJump',
|
||||||
|
'PrevPage',
|
||||||
|
'Number',
|
||||||
|
'NextPage',
|
||||||
|
'NextJump',
|
||||||
|
] as any;
|
||||||
|
const layouts = [
|
||||||
|
'Total',
|
||||||
|
'Sizes',
|
||||||
|
'Home',
|
||||||
|
...mobileLayouts,
|
||||||
|
'End',
|
||||||
|
] as readonly string[];
|
||||||
mergedOptions.pagerConfig = mergeWithArrayOverride(
|
mergedOptions.pagerConfig = mergeWithArrayOverride(
|
||||||
{},
|
{},
|
||||||
mergedOptions.pagerConfig,
|
mergedOptions.pagerConfig,
|
||||||
|
@ -99,18 +116,7 @@ const options = computed(() => {
|
||||||
background: true,
|
background: true,
|
||||||
pageSizes: [10, 20, 30, 50, 100, 200],
|
pageSizes: [10, 20, 30, 50, 100, 200],
|
||||||
className: 'mt-2 w-full',
|
className: 'mt-2 w-full',
|
||||||
layouts: [
|
layouts: isMobile.value ? mobileLayouts : layouts,
|
||||||
'Total',
|
|
||||||
'Sizes',
|
|
||||||
'Home',
|
|
||||||
'PrevJump',
|
|
||||||
'PrevPage',
|
|
||||||
'Number',
|
|
||||||
'NextPage',
|
|
||||||
'NextJump',
|
|
||||||
'End',
|
|
||||||
// 'FullJump',
|
|
||||||
] as any[],
|
|
||||||
size: 'mini' as const,
|
size: 'mini' as const,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -138,7 +144,6 @@ const vbenFormOptions = computed(() => {
|
||||||
const formValues = formApi.form.values;
|
const formValues = formApi.form.values;
|
||||||
props.api.reload(formValues);
|
props.api.reload(formValues);
|
||||||
},
|
},
|
||||||
collapseTriggerResize: true,
|
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
|
@ -150,8 +155,15 @@ const vbenFormOptions = computed(() => {
|
||||||
},
|
},
|
||||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
||||||
};
|
};
|
||||||
|
const finalFormOptions: VbenFormProps = mergeWithArrayOverride(
|
||||||
|
{},
|
||||||
|
formOptions.value,
|
||||||
|
defaultFormProps,
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...mergeWithArrayOverride({}, formOptions.value, defaultFormProps),
|
...finalFormOptions,
|
||||||
|
collapseTriggerResize: !!finalFormOptions.showCollapseButton,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -244,7 +256,7 @@ onMounted(() => {
|
||||||
</Form>
|
</Form>
|
||||||
</slot>
|
</slot>
|
||||||
<div
|
<div
|
||||||
class="bg-background-deep z-100 absolute -left-2 bottom-2 h-4 w-[calc(100%+1rem)] overflow-hidden"
|
class="bg-background-deep z-100 absolute -left-2 bottom-1 h-2 w-[calc(100%+1rem)] overflow-hidden md:bottom-2 md:h-3"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
"editCell": "单元格编辑",
|
"editCell": "单元格编辑",
|
||||||
"editRow": "行编辑",
|
"editRow": "行编辑",
|
||||||
"custom-cell": "自定义单元格",
|
"custom-cell": "自定义单元格",
|
||||||
"form": "开启搜索表单"
|
"form": "搜索表单"
|
||||||
},
|
},
|
||||||
"captcha": {
|
"captcha": {
|
||||||
"title": "验证码",
|
"title": "验证码",
|
||||||
|
|
Loading…
Reference in New Issue