style(admin): align list typography with orders

This commit is contained in:
2026-08-31 15:36:02 +08:00
parent cd290b8dc6
commit afbee83b51
7 changed files with 111 additions and 13 deletions
+28 -4
View File
@@ -6,14 +6,14 @@ import LayoutPreferenceList from './LayoutPreferenceList.vue'
import { UI_PREFERENCE_SCOPE, preferenceStorageKey } from '@/shared/utils/uiLayoutPreference'
const TableStub = defineComponent({
props: { border: Boolean, stripe: Boolean, maxHeight: [String, Number] },
template: '<div class="table-stub" :data-border="String(border)" :data-stripe="String(stripe)" :data-max-height="String(maxHeight)"><slot /></div>',
props: { border: Boolean, stripe: Boolean, maxHeight: [String, Number], emptyText: String },
template: '<div class="table-stub" :data-border="String(border)" :data-stripe="String(stripe)" :data-max-height="String(maxHeight)" :data-empty-text="emptyText"><slot /></div>',
methods: { doLayout() {} },
})
const ColumnStub = defineComponent({
inheritAttrs: false,
props: { label: String, prop: String },
template: '<div class="column-stub" :data-label="label" :data-prop="prop"><slot /></div>',
props: { label: String, prop: String, fixed: [String, Boolean], showOverflowTooltip: Boolean },
template: '<div class="column-stub" :data-label="label" :data-prop="prop" :data-fixed="String(fixed || \'\')" :data-overflow-tooltip="String(showOverflowTooltip)"><slot /></div>',
})
const ButtonStub = defineComponent({ template: '<button type="button"><slot /></button>' })
const PopoverStub = defineComponent({ template: '<div><slot name="reference" /><slot /></div>' })
@@ -128,6 +128,30 @@ describe('DataTable column preferences', () => {
expect(customTable.get('.table-stub').attributes('data-max-height')).toBe('420')
})
it('keeps fixed actions, long text, empty state, and pagination in the shared list contract', () => {
const wrapper = shallowMount(DataTable, {
props: {
data: [],
columns: [
{ key: 'actions', label: '操作', fixed: 'left', slotName: 'actions' },
{ key: 'description', label: '长文本', showOverflowTooltip: true },
],
emptyText: '暂无符合条件的数据',
total: 0,
},
global: {
stubs: { ElTable: TableStub, ElTableColumn: ColumnStub, ElButton: ButtonStub, ElPopover: PopoverStub },
directives: { loading: {} },
},
})
const columns = wrapper.findAll('.column-stub')
expect(columns[0].attributes('data-fixed')).toBe('left')
expect(columns[1].attributes('data-overflow-tooltip')).toBe('true')
expect(wrapper.get('.table-stub').attributes('data-empty-text')).toBe('暂无符合条件的数据')
expect(wrapper.get('.data-table__pagination').text()).toContain('共 0 条')
})
it('uses key as the data property for ordinary columns only', () => {
const wrapper = shallowMount(DataTable, {
props: {