Release/test 合并上生产 #2
@@ -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: {
|
||||
|
||||
@@ -358,6 +358,10 @@ function setPage(value: number) {
|
||||
|
||||
<style scoped>
|
||||
.data-table { min-width: 0; }
|
||||
.data-table :deep(.el-table) { font-size: var(--cc-list-table-font-size); }
|
||||
.data-table :deep(.el-table th.el-table__cell) { font-size: var(--cc-list-table-font-size); font-weight: var(--cc-list-table-header-font-weight); }
|
||||
.data-table :deep(.el-table .el-button) { font-size: var(--cc-list-action-font-size); }
|
||||
.data-table :deep(.el-table__empty-text) { font-size: var(--cc-list-table-font-size); }
|
||||
.data-table__toolbar { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--cc-border); }
|
||||
.data-table__toolbar.is-compact { min-height: 56px; justify-content: flex-end; padding: 8px 14px; }
|
||||
.data-table__toolbar-start { min-width: 0; flex: 1; }
|
||||
@@ -367,13 +371,13 @@ function setPage(value: number) {
|
||||
.data-table__business-actions, .data-table__utility-actions, .data-table__toolbar-end { display: flex; min-width: 0; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
|
||||
.data-table__utility-actions { flex: 0 0 auto; }
|
||||
.data-table__toolbar-actions :deep(.el-button + .el-button) { margin-left: 0; }
|
||||
.data-table__pagination { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--cc-border); color: var(--cc-muted); font-size: 12px; }
|
||||
.data-table__pagination { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--cc-border); color: var(--cc-muted); font-size: var(--cc-list-pagination-font-size); }
|
||||
.data-table__pagination-left { display: flex; min-width: 0; flex: 1; align-items: center; gap: 8px; }
|
||||
.data-table__pagination-controls, .data-table__page-size, .data-table__page-buttons { display: flex; align-items: center; gap: 8px; }
|
||||
.data-table__pagination-controls { min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
|
||||
.data-table__page-size :deep(.el-select) { width: 82px; }
|
||||
.data-table__page-buttons { gap: 4px; }
|
||||
.data-table__page-button { width: 32px; min-width: 32px; height: 32px; padding: 0; margin-left: 0; }
|
||||
.data-table__page-button { width: 32px; min-width: 32px; height: 32px; padding: 0; margin-left: 0; font-size: var(--cc-list-page-button-font-size); }
|
||||
.data-table__page-ellipsis { display: inline-flex; width: 24px; height: 32px; align-items: center; justify-content: center; }
|
||||
|
||||
@media (min-width: 1920px) {
|
||||
|
||||
@@ -249,6 +249,7 @@ defineExpose({ search, reset })
|
||||
.query-toolbar__filters { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 12px 16px; }
|
||||
.query-toolbar__field, .query-toolbar__control { display: grid; width: var(--query-field-width, 260px); max-width: 100%; min-width: 0; gap: 6px; }
|
||||
.query-toolbar__field :deep(.el-input), .query-toolbar__field :deep(.el-select), .query-toolbar__field :deep(.el-date-editor) { width: 100%; max-width: 100%; min-width: 0; }
|
||||
.query-toolbar__field :deep(.el-input__inner), .query-toolbar__field :deep(.el-select__selected-item), .query-toolbar__field :deep(.el-date-editor), .query-toolbar__actions :deep(.el-button) { font-size: var(--cc-list-query-font-size); }
|
||||
.query-toolbar__actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
|
||||
.query-toolbar__actions :deep(.el-button + .el-button) { margin-left: 0; }
|
||||
:global(.cc-layout-preference-popper) { max-width: calc(100vw - 24px); }
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
function source(path: string) {
|
||||
return readFileSync(resolve(process.cwd(), path), 'utf8')
|
||||
}
|
||||
|
||||
describe('Admin list typography baseline', () => {
|
||||
it('freezes the UnifiedOrdersView desktop hierarchy as shared tokens', () => {
|
||||
const foundation = source('src/styles/foundation.css')
|
||||
for (const token of [
|
||||
'--cc-list-page-title-font-size: 20px',
|
||||
'--cc-list-page-description-font-size: 12px',
|
||||
'--cc-list-query-font-size: 14px',
|
||||
'--cc-list-table-font-size: 12px',
|
||||
'--cc-list-primary-font-size: 12px',
|
||||
'--cc-list-secondary-font-size: 12px',
|
||||
'--cc-list-status-font-size: 11px',
|
||||
'--cc-list-action-font-size: 12px',
|
||||
'--cc-list-pagination-font-size: 12px',
|
||||
'--cc-list-page-button-font-size: 14px',
|
||||
]) expect(foundation).toContain(token)
|
||||
})
|
||||
|
||||
it('applies the tokens through shared page, query, table, status, action, empty, and pagination styles', () => {
|
||||
const shell = source('src/styles/shell.css')
|
||||
const global = source('src/styles/index.css')
|
||||
const table = source('src/shared/components/DataTable.vue')
|
||||
const query = source('src/shared/components/QueryToolbar.vue')
|
||||
expect(shell).toContain('font-size: var(--cc-list-page-title-font-size)')
|
||||
expect(shell).toContain('font-size: var(--cc-list-page-description-font-size)')
|
||||
expect(query).toContain('font-size: var(--cc-list-query-font-size)')
|
||||
expect(table).toContain('.data-table :deep(.el-table) { font-size: var(--cc-list-table-font-size); }')
|
||||
expect(table).toContain('.data-table :deep(.el-table .el-button) { font-size: var(--cc-list-action-font-size); }')
|
||||
expect(table).toContain('.data-table :deep(.el-table__empty-text) { font-size: var(--cc-list-table-font-size); }')
|
||||
expect(table).toContain('font-size: var(--cc-list-pagination-font-size)')
|
||||
expect(global).toContain('font-size: var(--cc-list-primary-font-size)')
|
||||
expect(global).toContain('font-size: var(--cc-list-secondary-font-size)')
|
||||
expect(global).toContain('font-size: var(--cc-list-status-font-size)')
|
||||
})
|
||||
|
||||
it.each([
|
||||
'src/modules/ocean-bookings/pages/OceanBookingsView.vue',
|
||||
'src/modules/trucking/pages/TruckAppointmentsView.vue',
|
||||
'src/modules/customs/pages/CustomsCasesView.vue',
|
||||
'src/modules/outbound-dispatch/pages/OutboundDispatchesView.vue',
|
||||
'src/modules/port-schedules/pages/PortSchedulesView.vue',
|
||||
])('keeps representative formal list %s on the shared components', (path) => {
|
||||
const page = source(path)
|
||||
expect(page).toContain('<ListPageLayout')
|
||||
expect(page).toContain('<QueryToolbar')
|
||||
expect(page).toContain('<DataTable')
|
||||
})
|
||||
})
|
||||
Vendored
+12
@@ -42,6 +42,18 @@
|
||||
--cc-space-5: 20px;
|
||||
--cc-space-6: 24px;
|
||||
--cc-space-7: 32px;
|
||||
/* Admin list typography: frozen from UnifiedOrdersView at 1920×1080 / 100%. */
|
||||
--cc-list-page-title-font-size: 20px;
|
||||
--cc-list-page-description-font-size: 12px;
|
||||
--cc-list-query-font-size: 14px;
|
||||
--cc-list-table-font-size: 12px;
|
||||
--cc-list-table-header-font-weight: 600;
|
||||
--cc-list-primary-font-size: 12px;
|
||||
--cc-list-secondary-font-size: 12px;
|
||||
--cc-list-status-font-size: 11px;
|
||||
--cc-list-action-font-size: 12px;
|
||||
--cc-list-pagination-font-size: 12px;
|
||||
--cc-list-page-button-font-size: 14px;
|
||||
|
||||
--el-color-primary: var(--cc-primary);
|
||||
--el-color-primary-light-3: #84adff;
|
||||
|
||||
@@ -86,18 +86,20 @@
|
||||
.panel-heading h2 { margin: 0; font-size: 16px; }
|
||||
.panel-heading p { margin: 5px 0 0; color: var(--cc-muted); font-size: 12px; line-height: 1.5; }
|
||||
.table-panel .el-table { --el-table-border-color: #edf0f4; --el-table-header-bg-color: #f8fafc; --el-table-row-hover-bg-color: #f8fbff; }
|
||||
.table-panel .el-table th.el-table__cell { height: 44px; color: #475467; font-size: 12px; font-weight: 650; }
|
||||
.table-panel .el-table { font-size: var(--cc-list-table-font-size); }
|
||||
.table-panel .el-table th.el-table__cell { height: 44px; color: #475467; font-size: var(--cc-list-table-font-size); font-weight: var(--cc-list-table-header-font-weight); }
|
||||
.table-panel .el-table td.el-table__cell { padding: 12px 0; }
|
||||
.primary-cell, .user-cell { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
|
||||
.primary-cell strong, .user-cell strong { overflow: hidden; color: #172033; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.primary-cell span, .user-cell span { overflow: hidden; color: var(--cc-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.primary-cell strong, .user-cell strong { overflow: hidden; color: #172033; font-size: var(--cc-list-primary-font-size); text-overflow: ellipsis; white-space: nowrap; }
|
||||
.primary-cell span, .user-cell span { overflow: hidden; color: var(--cc-muted); font-size: var(--cc-list-secondary-font-size); text-overflow: ellipsis; white-space: nowrap; }
|
||||
.user-cell { flex-direction: row; align-items: center; gap: 10px; }
|
||||
.user-cell > span:first-child, .detail-identity > span { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #eaf1ff; color: var(--cc-primary); font-weight: 700; }
|
||||
.user-cell > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
|
||||
.table-actions { display: flex; align-items: center; white-space: nowrap; }
|
||||
.table-actions .el-button { font-size: var(--cc-list-action-font-size); }
|
||||
.table-actions .el-button + .el-button { margin-left: 10px; }
|
||||
.table-footer { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--cc-border); color: var(--cc-muted); font-size: 12px; }
|
||||
.status-badge { display: inline-flex; min-height: 24px; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: 11px; font-weight: 650; white-space: nowrap; }
|
||||
.table-footer { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--cc-border); color: var(--cc-muted); font-size: var(--cc-list-pagination-font-size); }
|
||||
.status-badge { display: inline-flex; min-height: 24px; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: var(--cc-list-status-font-size); font-weight: 650; white-space: nowrap; }
|
||||
.status-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
|
||||
.status-badge.is-success { background: #ecfdf3; color: #067647; }
|
||||
.status-badge.is-warning { background: #fffaeb; color: #b54708; }
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
.shell-menu-button:hover { background: rgba(255,255,255,.12); }
|
||||
.shell-menu-button:focus-visible { outline-color: rgba(255,255,255,.8); }
|
||||
.page-heading { min-width: 0; flex: 1; }
|
||||
.page-heading h1 { margin: 0; overflow: hidden; font-size: 20px; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.page-heading p { margin: 4px 0 0; overflow: hidden; color: rgba(255,255,255,.72); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.page-heading h1 { margin: 0; overflow: hidden; font-size: var(--cc-list-page-title-font-size); letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.page-heading p { margin: 4px 0 0; overflow: hidden; color: rgba(255,255,255,.72); font-size: var(--cc-list-page-description-font-size); text-overflow: ellipsis; white-space: nowrap; }
|
||||
.header-user { display: flex; min-width: 0; flex: 0 0 auto; align-items: center; gap: 10px; }
|
||||
.user-avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: #fff; color: var(--cc-primary); font-weight: 700; box-shadow: var(--cc-shadow-sm); }
|
||||
.user-copy { display: flex; flex-direction: column; }
|
||||
|
||||
Reference in New Issue
Block a user