diff --git a/components/_util/getScrollBarSize.js b/components/_util/getScrollBarSize.ts similarity index 53% rename from components/_util/getScrollBarSize.js rename to components/_util/getScrollBarSize.ts index a98df563d3..12a142f3fc 100644 --- a/components/_util/getScrollBarSize.js +++ b/components/_util/getScrollBarSize.ts @@ -1,6 +1,12 @@ -let cached; +/* eslint-disable no-param-reassign */ + +let cached: number; + +export default function getScrollBarSize(fresh?: boolean) { + if (typeof document === 'undefined') { + return 0; + } -export default function getScrollBarSize(fresh) { if (fresh || cached === undefined) { const inner = document.createElement('div'); inner.style.width = '100%'; @@ -10,8 +16,8 @@ export default function getScrollBarSize(fresh) { const outerStyle = outer.style; outerStyle.position = 'absolute'; - outerStyle.top = 0; - outerStyle.left = 0; + outerStyle.top = '0'; + outerStyle.left = '0'; outerStyle.pointerEvents = 'none'; outerStyle.visibility = 'hidden'; outerStyle.width = '200px'; @@ -36,3 +42,21 @@ export default function getScrollBarSize(fresh) { } return cached; } + +function ensureSize(str: string) { + const match = str.match(/^(.*)px$/); + const value = Number(match?.[1]); + return Number.isNaN(value) ? getScrollBarSize() : value; +} + +export function getTargetScrollBarSize(target: HTMLElement) { + if (typeof document === 'undefined' || !target || !(target instanceof Element)) { + return { width: 0, height: 0 }; + } + + const { width, height } = getComputedStyle(target, '::-webkit-scrollbar'); + return { + width: ensureSize(width), + height: ensureSize(height), + }; +} diff --git a/components/_util/props-util/index.js b/components/_util/props-util/index.js index 440f3a9d2c..8a76d49bcd 100644 --- a/components/_util/props-util/index.js +++ b/components/_util/props-util/index.js @@ -29,6 +29,7 @@ const parseStyleText = (cssText = '', camel) => { const res = {}; const listDelimiter = /;(?![^(]*\))/g; const propertyDelimiter = /:(.+)/; + if (typeof cssText === 'object') return cssText; cssText.split(listDelimiter).forEach(function (item) { if (item) { const tmp = item.split(propertyDelimiter); diff --git a/components/_util/reactivePick.ts b/components/_util/reactivePick.ts new file mode 100644 index 0000000000..4911106cc1 --- /dev/null +++ b/components/_util/reactivePick.ts @@ -0,0 +1,14 @@ +import type { UnwrapRef } from 'vue'; +import { reactive, toRef } from 'vue'; + +/** + * Reactively pick fields from a reactive object + * + * @see https://vueuse.js.org/reactivePick + */ +export function reactivePick( + obj: T, + ...keys: K[] +): { [S in K]: UnwrapRef } { + return reactive(Object.fromEntries(keys.map(k => [k, toRef(obj, k)]))) as any; +} diff --git a/components/_util/toReactive.ts b/components/_util/toReactive.ts new file mode 100644 index 0000000000..0fa7f3277c --- /dev/null +++ b/components/_util/toReactive.ts @@ -0,0 +1,42 @@ +import { isRef, reactive } from 'vue'; +import type { Ref } from 'vue'; +type MaybeRef = T | Ref; +/** + * Converts ref to reactive. + * + * @see https://vueuse.org/toReactive + * @param objectRef A ref of object + */ +export function toReactive(objectRef: MaybeRef): T { + if (!isRef(objectRef)) return reactive(objectRef) as T; + + const proxy = new Proxy( + {}, + { + get(_, p, receiver) { + return Reflect.get(objectRef.value, p, receiver); + }, + set(_, p, value) { + (objectRef.value as any)[p] = value; + return true; + }, + deleteProperty(_, p) { + return Reflect.deleteProperty(objectRef.value, p); + }, + has(_, p) { + return Reflect.has(objectRef.value, p); + }, + ownKeys() { + return Object.keys(objectRef.value); + }, + getOwnPropertyDescriptor() { + return { + enumerable: true, + configurable: true, + }; + }, + }, + ); + + return reactive(proxy) as T; +} diff --git a/components/_util/util.js b/components/_util/util.js index 409bc85e7f..d1b647dbd5 100644 --- a/components/_util/util.js +++ b/components/_util/util.js @@ -62,4 +62,9 @@ export function getDataAndAriaProps(props) { }, {}); } +export function toPx(val) { + if (typeof val === 'number') return `${val}px`; + return val; +} + export { isOn, cacheStringFunction, camelize, hyphenate, capitalize, resolvePropValue }; diff --git a/components/checkbox/Checkbox.tsx b/components/checkbox/Checkbox.tsx index 6ae6f8de2d..4b61b5d286 100644 --- a/components/checkbox/Checkbox.tsx +++ b/components/checkbox/Checkbox.tsx @@ -1,3 +1,4 @@ +import type { ExtractPropTypes } from 'vue'; import { defineComponent, inject, nextTick } from 'vue'; import PropTypes from '../_util/vue-types'; import classNames from '../_util/classNames'; @@ -9,11 +10,8 @@ import type { RadioChangeEvent } from '../radio/interface'; import type { EventHandler } from '../_util/EventInterface'; function noop() {} -export default defineComponent({ - name: 'ACheckbox', - inheritAttrs: false, - __ANT_CHECKBOX: true, - props: { +export const checkboxProps = () => { + return { prefixCls: PropTypes.string, defaultChecked: PropTypes.looseBool, checked: PropTypes.looseBool, @@ -27,7 +25,17 @@ export default defineComponent({ autofocus: PropTypes.looseBool, onChange: PropTypes.func, 'onUpdate:checked': PropTypes.func, - }, + skipGroup: PropTypes.looseBool, + }; +}; + +export type CheckboxProps = Partial>>; + +export default defineComponent({ + name: 'ACheckbox', + inheritAttrs: false, + __ANT_CHECKBOX: true, + props: checkboxProps(), emits: ['change', 'update:checked'], setup() { return { @@ -38,6 +46,9 @@ export default defineComponent({ watch: { value(value, prevValue) { + if (this.skipGroup) { + return; + } nextTick(() => { const { checkboxGroupContext: checkboxGroup = {} } = this; if (checkboxGroup.registerValue && checkboxGroup.cancelValue) { @@ -85,7 +96,7 @@ export default defineComponent({ const props = getOptionProps(this); const { checkboxGroupContext: checkboxGroup, $attrs } = this; const children = getSlot(this); - const { indeterminate, prefixCls: customizePrefixCls, ...restProps } = props; + const { indeterminate, prefixCls: customizePrefixCls, skipGroup, ...restProps } = props; const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('checkbox', customizePrefixCls); const { @@ -101,7 +112,7 @@ export default defineComponent({ prefixCls, ...restAttrs, }; - if (checkboxGroup) { + if (checkboxGroup && !skipGroup) { checkboxProps.onChange = (...args) => { this.$emit('change', ...args); checkboxGroup.toggleOption({ label: children, value: props.value }); diff --git a/components/checkbox/index.ts b/components/checkbox/index.ts index d28493db35..8fcf4b3b26 100644 --- a/components/checkbox/index.ts +++ b/components/checkbox/index.ts @@ -1,6 +1,7 @@ import type { App, Plugin } from 'vue'; -import Checkbox from './Checkbox'; +import Checkbox, { checkboxProps } from './Checkbox'; import CheckboxGroup from './Group'; +export type { CheckboxProps } from './Checkbox'; Checkbox.Group = CheckboxGroup; @@ -10,7 +11,7 @@ Checkbox.install = function (app: App) { app.component(CheckboxGroup.name, CheckboxGroup); return app; }; -export { CheckboxGroup }; +export { CheckboxGroup, checkboxProps }; export default Checkbox as typeof Checkbox & Plugin & { readonly Group: typeof CheckboxGroup; diff --git a/components/components.ts b/components/components.ts index 93986f35e8..eb8b75c61a 100644 --- a/components/components.ts +++ b/components/components.ts @@ -164,7 +164,22 @@ export { default as Steps, Step } from './steps'; export type { SwitchProps } from './switch'; export { default as Switch } from './switch'; -export { default as Table, TableColumn, TableColumnGroup } from './table'; +export type { + TableProps, + TablePaginationConfig, + ColumnGroupType as TableColumnGroupType, + ColumnType as TableColumnType, + ColumnProps as TableColumnProps, + ColumnsType as TableColumnsType, +} from './table'; +export { + default as Table, + TableColumn, + TableColumnGroup, + TableSummary, + TableSummaryRow, + TableSummaryCell, +} from './table'; export type { TransferProps } from './transfer'; export { default as Transfer } from './transfer'; diff --git a/components/empty/__tests__/__snapshots__/demo.test.js.snap b/components/empty/__tests__/__snapshots__/demo.test.js.snap index 68ebaeb983..725ab4afdb 100644 --- a/components/empty/__tests__/__snapshots__/demo.test.js.snap +++ b/components/empty/__tests__/__snapshots__/demo.test.js.snap @@ -113,32 +113,47 @@ exports[`renders ./components/empty/demo/config-provider.vue correctly 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - + + + + + + + + + + +
Name -
- -
Age -
+
+ Name + + Age +
+ No data +
+
+
- - - - -
-
+
+
+
+

List

+
+ + +
+ +
+
@@ -153,39 +168,11 @@ exports[`renders ./components/empty/demo/config-provider.vue correctly 1`] = `
-
-
-
-
-

List

-
- - -
-
-
-
-
- - - - - - - -
-

No Data

- -
-
-
+
- - -
`; diff --git a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap index f3964f4b4a..7373b3ef99 100644 --- a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap @@ -505,54 +505,44 @@ exports[`Locale Provider should display the text as ar 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

لا توجد بيانات

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -1061,54 +1051,44 @@ exports[`Locale Provider should display the text as bg 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Няма данни

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -1617,54 +1597,44 @@ exports[`Locale Provider should display the text as ca 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Sense dades

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -2173,54 +2143,44 @@ exports[`Locale Provider should display the text as cs 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Žádná data

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -2729,54 +2689,44 @@ exports[`Locale Provider should display the text as da 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Ingen data

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -3285,54 +3235,44 @@ exports[`Locale Provider should display the text as de 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Keine Daten

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -3841,54 +3781,44 @@ exports[`Locale Provider should display the text as el 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Δεν υπάρχουν δεδομένα

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -4397,54 +4327,44 @@ exports[`Locale Provider should display the text as en 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

No Data

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -4953,54 +4873,44 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

No data

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -5509,54 +5419,44 @@ exports[`Locale Provider should display the text as es 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

No hay datos

- + + +
Name + +
+ + + Age + + + + + + + + Sin datos + + + + + +
+
-
-
- - - + + `; @@ -6065,54 +5965,44 @@ exports[`Locale Provider should display the text as et 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Andmed puuduvad

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -6621,54 +6511,44 @@ exports[`Locale Provider should display the text as fa 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

داده‌ای موجود نیست

- + + +
Name + +
+ + + Age + + + + + + + + بدون داده + + + + + +
+
-
-
- - - + + `; @@ -7177,54 +7057,44 @@ exports[`Locale Provider should display the text as fi 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Ei kohteita

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -7733,54 +7603,44 @@ exports[`Locale Provider should display the text as fr 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Aucune donnée

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -8289,54 +8149,44 @@ exports[`Locale Provider should display the text as fr 2`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Aucune donnée

- + + +
Name + +
+ + + Age + + + + + + + + Aucune donnée + + + + + +
+
-
-
- - - + + `; @@ -8845,54 +8695,44 @@ exports[`Locale Provider should display the text as he 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

אין מידע

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -9401,54 +9241,44 @@ exports[`Locale Provider should display the text as hi 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

कोई आकड़ा उपलब्ध नहीं है

- + + +
Name + +
+ + + Age + + + + + + + + कोई जानकारी नहीं + + + + + +
+
-
-
- - - + + `; @@ -9957,54 +9787,44 @@ exports[`Locale Provider should display the text as hr 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Nema podataka

- + + +
Name + +
+ + + Age + + + + + + + + Nema podataka + + + + + +
+
-
-
- - - + + `; @@ -10513,54 +10333,44 @@ exports[`Locale Provider should display the text as hu 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Nincs adat

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -11069,54 +10879,44 @@ exports[`Locale Provider should display the text as hy-am 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Տվյալներ չկան

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -11625,54 +11425,44 @@ exports[`Locale Provider should display the text as id 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Tidak ada data

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -12181,54 +11971,44 @@ exports[`Locale Provider should display the text as is 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Engin gögn

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -12737,54 +12517,44 @@ exports[`Locale Provider should display the text as it 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Nessun dato

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -13293,54 +13063,44 @@ exports[`Locale Provider should display the text as ja 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

データがありません

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -13849,54 +13609,44 @@ exports[`Locale Provider should display the text as kn 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

No Data

- + + +
Name + +
+ + + Age + + + + + + + + ಮಾಹಿತಿ ಇಲ್ಲ + + + + + +
+
-
-
- - - + + `; @@ -14405,54 +14155,44 @@ exports[`Locale Provider should display the text as ko 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
+ + +
Name + +
+ + + Age + + + + + + + + 데이터 없음 + + + + + +
+
+
-
-
-
- - - - - - - -
-

데이터 없음

- -
-
-
- - - - + + `; @@ -14961,54 +14701,44 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Agahî tune

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -15517,54 +15247,44 @@ exports[`Locale Provider should display the text as lv 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Nav datu

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -16073,54 +15793,44 @@ exports[`Locale Provider should display the text as mk 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Нема податоци

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -16629,54 +16339,44 @@ exports[`Locale Provider should display the text as mn-mn 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Мэдээлэл байхгүй байна

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -17185,54 +16885,44 @@ exports[`Locale Provider should display the text as ms-my 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Tiada data

- + + +
Name + +
+ + + Age + + + + + + + + Tiada data + + + + + +
+
-
-
- - - + + `; @@ -17741,54 +17431,44 @@ exports[`Locale Provider should display the text as nb 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Ingen data

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -18297,54 +17977,44 @@ exports[`Locale Provider should display the text as ne-np 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

डाटा छैन

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -18853,54 +18523,44 @@ exports[`Locale Provider should display the text as nl 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Geen gegevens

- + + +
Name + +
+ + + Age + + + + + + + + Geen data + + + + + +
+
-
-
- - - + + `; @@ -19409,54 +19069,44 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Geen gegevens

- + + +
Name + +
+ + + Age + + + + + + + + Geen data + + + + + +
+
-
-
- - - + + `; @@ -19965,54 +19615,44 @@ exports[`Locale Provider should display the text as pl 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Brak danych

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -20521,54 +20161,44 @@ exports[`Locale Provider should display the text as pt 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Sem resultados

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -21077,54 +20707,44 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Não há dados

- + + +
Name + +
+ + + Age + + + + + + + + Sem conteúdo + + + + + +
+
-
-
- - - + + `; @@ -21633,54 +21253,44 @@ exports[`Locale Provider should display the text as ro 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Fără date

- + + +
Name + +
+ + + Age + + + + + + + + Nu există date + + + + + +
+
-
-
- - - + + `; @@ -22189,54 +21799,44 @@ exports[`Locale Provider should display the text as ru 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Нет данных

- + + +
Name + +
+ + + Age + + + + + + + + Нет данных + + + + + +
+
-
-
- - - + + `; @@ -22745,54 +22345,44 @@ exports[`Locale Provider should display the text as sk 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Žiadne dáta

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -23301,54 +22891,44 @@ exports[`Locale Provider should display the text as sl 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Ni podatkov

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -23857,54 +23437,44 @@ exports[`Locale Provider should display the text as sr 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Nema podataka

- + + +
Name + +
+ + + Age + + + + + + + + Nema podataka + + + + + +
+
-
-
- - - + + `; @@ -24413,54 +23983,44 @@ exports[`Locale Provider should display the text as sv 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Ingen data

- + + +
Name + +
+ + + Age + + + + + + + + Ingen data + + + + + +
+
-
-
- - - + + `; @@ -24969,54 +24529,44 @@ exports[`Locale Provider should display the text as ta 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

தகவல் இல்லை

- + + +
Name + +
+ + + Age + + + + + + + + தகவல் இல்லை + + + + + +
+
-
-
- - - + + `; @@ -25525,54 +25075,44 @@ exports[`Locale Provider should display the text as th 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

ไม่มีข้อมูล

- + + +
Name + +
+ + + Age + + + + + + + + ไม่มีข้อมูล + + + + + +
+
-
-
- - - + + `; @@ -26081,54 +25621,44 @@ exports[`Locale Provider should display the text as tr 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Veri Yok

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -26637,54 +26167,44 @@ exports[`Locale Provider should display the text as uk 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Даних немає

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -27193,54 +26713,44 @@ exports[`Locale Provider should display the text as vi 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

Trống

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -27749,54 +27259,44 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

暂无数据

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; @@ -28305,53 +27805,43 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
-
+
-
- -
- - - - - +
+
+
+ - - - - - -
Name -
- -
Age -
- -
-
-
-
-
- - - - - - - -
-

無此資料

- + + +
Name + +
+ + + Age + + + + + + + + No data + + + + + +
+
-
-
- - - + + `; diff --git a/components/locale-provider/index.tsx b/components/locale-provider/index.tsx index 8d1573a48c..ef57a0dd44 100644 --- a/components/locale-provider/index.tsx +++ b/components/locale-provider/index.tsx @@ -9,6 +9,7 @@ import type { ValidateMessages } from '../form/interface'; import type { TransferLocale } from '../transfer'; import type { PickerLocale as DatePickerLocale } from '../date-picker/generatePicker'; import type { PaginationLocale } from '../pagination/Pagination'; +import type { TableLocale } from '../table/interface'; interface TransferLocaleForEmpty { description: string; @@ -16,7 +17,7 @@ interface TransferLocaleForEmpty { export interface Locale { locale: string; Pagination?: PaginationLocale; - Table?: Record; + Table?: TableLocale; Popconfirm?: Record; Upload?: Record; Form?: { diff --git a/components/select/index.en-US.md b/components/select/index.en-US.md index 2688aae146..463acbba84 100644 --- a/components/select/index.en-US.md +++ b/components/select/index.en-US.md @@ -24,43 +24,43 @@ Select component to select value from options. | Property | Description | Type | Default | Version | | --- | --- | --- | --- | --- | -| allowClear | Show clear button. | boolean | false | | -| autoClearSearchValue | Whether the current search will be cleared on selecting an item. Only applies when `mode` is set to `multiple` or `tags`. | boolean | true | | -| autofocus | Get focus by default | boolean | false | | -| bordered | Whether has border style | boolean | true | | -| defaultActiveFirstOption | Whether active first option by default | boolean | true | | -| disabled | Whether disabled select | boolean | false | | -| dropdownClassName | className of dropdown menu | string | - | | -| dropdownMatchSelectWidth | Whether dropdown's width is same with select. | boolean | true | | -| dropdownRender | Customize dropdown content | ({menuNode: VNode, props}) => VNode \| v-slot | - | | -| dropdownStyle | style of dropdown menu | object | - | | -| dropdownMenuStyle | additional style applied to dropdown menu | object | - | | -| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded. | boolean or function(inputValue, option) | true | | -| firstActiveValue | Value of action option by default | string\|string\[] | - | | -| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative. | function(triggerNode) | () => document.body | | -| labelInValue | whether to embed label in value, turn the format of value from `string` to `{key: string, label: vNodes}` | boolean | false | | -| maxTagCount | Max tag count to show | number | - | | -| maxTagPlaceholder | Placeholder for not showing tags | slot/function(omittedValues) | - | | -| maxTagTextLength | Max text length to show | number | - | | -| mode | Set mode of Select | 'multiple' \| 'tags' | - | | -| notFoundContent | Specify content to show when no result matches.. | string\|slot | 'Not Found' | | -| optionFilterProp | Which prop value of option will be used for filter if filterOption is true | string | value | | -| optionLabelProp | Which prop value of option will render as content of select. | string | `value` for `combobox`, `children` for other modes | | -| placeholder | Placeholder of select | string\|slot | - | | -| showSearch | Whether show search input in single mode. | boolean | false | | -| showArrow | Whether to show the drop-down arrow | boolean | true | | -| size | Size of Select input. `default` `large` `small` | string | default | | -| suffixIcon | The custom suffix icon | VNode \| slot | - | | -| removeIcon | The custom remove icon | VNode \| slot | - | | -| clearIcon | The custom clear icon | VNode \| slot | - | | -| menuItemSelectedIcon | The custom menuItemSelected icon | VNode \| slot | - | | -| tokenSeparators | Separator used to tokenize on tag/multiple mode | string\[] | | | -| value(v-model) | Current selected option. | string\|number\|string\[]\|number\[] | - | | -| options | Data of the selectOption, manual construction work is no longer needed if this property has been set | array<{value, label, [disabled, key, title]}> | \[] | | +| allowClear | Show clear button. | boolean | false | | +| autoClearSearchValue | Whether the current search will be cleared on selecting an item. Only applies when `mode` is set to `multiple` or `tags`. | boolean | true | | +| autofocus | Get focus by default | boolean | false | | +| bordered | Whether has border style | boolean | true | | +| defaultActiveFirstOption | Whether active first option by default | boolean | true | | +| disabled | Whether disabled select | boolean | false | | +| dropdownClassName | className of dropdown menu | string | - | | +| dropdownMatchSelectWidth | Whether dropdown's width is same with select. | boolean | true | | +| dropdownRender | Customize dropdown content | ({menuNode: VNode, props}) => VNode \| v-slot | - | | +| dropdownStyle | style of dropdown menu | object | - | | +| dropdownMenuStyle | additional style applied to dropdown menu | object | - | | +| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded. | boolean or function(inputValue, option) | true | | +| firstActiveValue | Value of action option by default | string\|string\[] | - | | +| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative. | function(triggerNode) | () => document.body | | +| labelInValue | whether to embed label in value, turn the format of value from `string` to `{key: string, label: vNodes}` | boolean | false | | +| maxTagCount | Max tag count to show | number | - | | +| maxTagPlaceholder | Placeholder for not showing tags | slot/function(omittedValues) | - | | +| maxTagTextLength | Max text length to show | number | - | | +| mode | Set mode of Select | 'multiple' \| 'tags' | - | | +| notFoundContent | Specify content to show when no result matches.. | string\|slot | 'Not Found' | | +| optionFilterProp | Which prop value of option will be used for filter if filterOption is true | string | value | | +| optionLabelProp | Which prop value of option will render as content of select. | string | `value` for `combobox`, `children` for other modes | | +| placeholder | Placeholder of select | string\|slot | - | | +| showSearch | Whether show search input in single mode. | boolean | false | | +| showArrow | Whether to show the drop-down arrow | boolean | true | | +| size | Size of Select input. `default` `large` `small` | string | default | | +| suffixIcon | The custom suffix icon | VNode \| slot | - | | +| removeIcon | The custom remove icon | VNode \| slot | - | | +| clearIcon | The custom clear icon | VNode \| slot | - | | +| menuItemSelectedIcon | The custom menuItemSelected icon | VNode \| slot | - | | +| tokenSeparators | Separator used to tokenize on tag/multiple mode | string\[] | | | +| value(v-model) | Current selected option. | string\|number\|string\[]\|number\[] | - | | +| options | Data of the selectOption, manual construction work is no longer needed if this property has been set | array<{value, label, [disabled, key, title]}> | \[] | | | option | custom render option by slot | v-slot:option="{value, label, [disabled, key, title]}" | - | 2.2.5 | -| defaultOpen | Initial open state of dropdown | boolean | - | | -| open | Controlled open state of dropdown | boolean | - | | -| loading | indicate loading state | Boolean | false | | +| defaultOpen | Initial open state of dropdown | boolean | - | | +| open | Controlled open state of dropdown | boolean | - | | +| loading | indicate loading state | Boolean | false | | > Note, if you find that the drop-down menu scrolls with the page, or you need to trigger Select in other popup layers, please try to use `getPopupContainer={triggerNode => triggerNode.parentElement}` to fix the drop-down popup rendering node in the parent element of the trigger . @@ -109,3 +109,11 @@ Select component to select value from options. ### The dropdown is closed when click `dropdownRender` area? See the [dropdownRender example](/components/select/#components-select-demo-custom-dropdown). + +### Why is `placeholder` not displayed? + +`placeholder` will only be displayed when `value = undefined`, and other values such as null, 0,'', etc. are meaningful values for the JS language. + +You can check [JS Language Specification](https://262.ecma-international.org/5.1/#sec-4.3.9) for further details. + +You can also check [antd issue](https://github.com/ant-design/ant-design/issues/2367) to view the discussion. diff --git a/components/select/index.zh-CN.md b/components/select/index.zh-CN.md index 1dde17db94..a6ba8de0e9 100644 --- a/components/select/index.zh-CN.md +++ b/components/select/index.zh-CN.md @@ -25,42 +25,42 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_0XzgOis7/Select.svg | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | -| allowClear | 支持清除 | boolean | false | | -| autoClearSearchValue | 是否在选中项后清空搜索框,只在 `mode` 为 `multiple` 或 `tags` 时有效。 | boolean | true | | -| autofocus | 默认获取焦点 | boolean | false | | -| bordered | 是否有边框 | boolean | true | | -| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true | | -| disabled | 是否禁用 | boolean | false | | -| dropdownClassName | 下拉菜单的 className 属性 | string | - | | -| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true | 」 -| dropdownRender | 自定义下拉框内容 | ({menuNode: VNode, props}) => VNode \| v-slot | - | | -| dropdownStyle | 下拉菜单的 style 属性 | object | - | | -| dropdownMenuStyle | dropdown 菜单自定义样式 | object | - | | -| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true | | -| firstActiveValue | 默认高亮的选项 | string\|string\[] | - | | -| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。 | Function(triggerNode) | () => document.body | | -| labelInValue | 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 `string` 变为 `{key: string, label: vNodes}` 的格式 | boolean | false | | -| maxTagCount | 最多显示多少个 tag | number | - | | -| maxTagPlaceholder | 隐藏 tag 时显示的内容 | slot/function(omittedValues) | - | | -| maxTagTextLength | 最大显示的 tag 文本长度 | number | - | | -| mode | 设置 Select 的模式为多选或标签 | 'multiple' \| 'tags' \| 'combobox' | - | | -| notFoundContent | 当下拉列表为空时显示的内容 | string\|slot | 'Not Found' | | -| optionFilterProp | 搜索时过滤对应的 option 属性,不支持 children | string | value | | -| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) | | -| placeholder | 选择框默认文字 | string\|slot | - | | -| showSearch | 使单选模式可搜索 | boolean | false | | -| showArrow | 是否显示下拉小箭头 | boolean | true | | -| size | 选择框大小,可选 `large` `small` | string | default | | -| suffixIcon | 自定义的选择框后缀图标 | VNode \| slot | - | | -| removeIcon | 自定义的多选框清除图标 | VNode \| slot | - | | -| clearIcon | 自定义的多选框清空图标 | VNode \| slot | - | | -| menuItemSelectedIcon | 自定义当前选中的条目图标 | VNode \| slot | - | | -| tokenSeparators | 在 tags 和 multiple 模式下自动分词的分隔符 | string\[] | | | -| value(v-model) | 指定当前选中的条目 | string\|string\[]\|number\|number\[] | - | | -| options | options 数据,如果设置则不需要手动构造 selectOption 节点 | array<{value, label, [disabled, key, title]}> | \[] | | +| allowClear | 支持清除 | boolean | false | | +| autoClearSearchValue | 是否在选中项后清空搜索框,只在 `mode` 为 `multiple` 或 `tags` 时有效。 | boolean | true | | +| autofocus | 默认获取焦点 | boolean | false | | +| bordered | 是否有边框 | boolean | true | | +| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true | | +| disabled | 是否禁用 | boolean | false | | +| dropdownClassName | 下拉菜单的 className 属性 | string | - | | +| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true | 」 | +| dropdownRender | 自定义下拉框内容 | ({menuNode: VNode, props}) => VNode \| v-slot | - | | +| dropdownStyle | 下拉菜单的 style 属性 | object | - | | +| dropdownMenuStyle | dropdown 菜单自定义样式 | object | - | | +| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true | | +| firstActiveValue | 默认高亮的选项 | string\|string\[] | - | | +| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。 | Function(triggerNode) | () => document.body | | +| labelInValue | 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 `string` 变为 `{key: string, label: vNodes}` 的格式 | boolean | false | | +| maxTagCount | 最多显示多少个 tag | number | - | | +| maxTagPlaceholder | 隐藏 tag 时显示的内容 | slot/function(omittedValues) | - | | +| maxTagTextLength | 最大显示的 tag 文本长度 | number | - | | +| mode | 设置 Select 的模式为多选或标签 | 'multiple' \| 'tags' \| 'combobox' | - | | +| notFoundContent | 当下拉列表为空时显示的内容 | string\|slot | 'Not Found' | | +| optionFilterProp | 搜索时过滤对应的 option 属性,不支持 children | string | value | | +| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) | | +| placeholder | 选择框默认文字 | string\|slot | - | | +| showSearch | 使单选模式可搜索 | boolean | false | | +| showArrow | 是否显示下拉小箭头 | boolean | true | | +| size | 选择框大小,可选 `large` `small` | string | default | | +| suffixIcon | 自定义的选择框后缀图标 | VNode \| slot | - | | +| removeIcon | 自定义的多选框清除图标 | VNode \| slot | - | | +| clearIcon | 自定义的多选框清空图标 | VNode \| slot | - | | +| menuItemSelectedIcon | 自定义当前选中的条目图标 | VNode \| slot | - | | +| tokenSeparators | 在 tags 和 multiple 模式下自动分词的分隔符 | string\[] | | | +| value(v-model) | 指定当前选中的条目 | string\|string\[]\|number\|number\[] | - | | +| options | options 数据,如果设置则不需要手动构造 selectOption 节点 | array<{value, label, [disabled, key, title]}> | \[] | | | option | 通过 option 插槽,自定义节点 | v-slot:option="{value, label, [disabled, key, title]}" | - | 2.2.5 | -| defaultOpen | 是否默认展开下拉菜单 | boolean | - | | -| open | 是否展开下拉菜单 | boolean | - | | +| defaultOpen | 是否默认展开下拉菜单 | boolean | - | | +| open | 是否展开下拉菜单 | boolean | - | | > 注意,如果发现下拉菜单跟随页面滚动,或者需要在其他弹层中触发 Select,请尝试使用 `getPopupContainer={triggerNode => triggerNode.parentNode}` 将下拉弹层渲染节点固定在触发器的父元素中。 @@ -109,3 +109,11 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_0XzgOis7/Select.svg ### 点击 `dropdownRender` 里的内容浮层关闭怎么办? 看下 [dropdownRender 例子](/components/select-cn/#components-select-demo-custom-dropdown) 里的说明。 + +### 为什么 `placeholder` 不显示 ? + +`placeholder` 只有在 value = undefined 才会显示,对于其它的 null、0、'' 等等对于 JS 语言都是有意义的值。 + +你可以查看 [JS 语言规范](https://262.ecma-international.org/5.1/#sec-4.3.9) 进一步了解详情。 + +也可以查看 [antd issue](https://github.com/ant-design/ant-design/issues/2367) 查看讨论情况。 diff --git a/components/style/themes/default.less b/components/style/themes/default.less index bc42cfe4a5..41d2c49322 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -556,8 +556,8 @@ @table-header-bg: @background-color-light; @table-header-color: @heading-color; @table-header-sort-bg: @background-color-base; -@table-body-sort-bg: rgba(0, 0, 0, 0.01); -@table-row-hover-bg: @primary-1; +@table-body-sort-bg: #fafafa; +@table-row-hover-bg: @background-color-light; @table-selected-row-color: inherit; @table-selected-row-bg: @primary-1; @table-body-selected-sort-bg: @table-selected-row-bg; @@ -565,15 +565,31 @@ @table-expanded-row-bg: #fbfbfb; @table-padding-vertical: 16px; @table-padding-horizontal: 16px; +@table-padding-vertical-md: (@table-padding-vertical * 3 / 4); +@table-padding-horizontal-md: (@table-padding-horizontal / 2); +@table-padding-vertical-sm: (@table-padding-vertical / 2); +@table-padding-horizontal-sm: (@table-padding-horizontal / 2); +@table-border-color: @border-color-split; @table-border-radius-base: @border-radius-base; @table-footer-bg: @background-color-light; @table-footer-color: @heading-color; -@table-header-bg-sm: transparent; +@table-header-bg-sm: @table-header-bg; +@table-font-size: @font-size-base; +@table-font-size-md: @table-font-size; +@table-font-size-sm: @table-font-size; +@table-header-cell-split-color: rgba(0, 0, 0, 0.06); // Sorter // Legacy: `table-header-sort-active-bg` is used for hover not real active -@table-header-sort-active-bg: darken(@table-header-bg, 3%); +@table-header-sort-active-bg: rgba(0, 0, 0, 0.04); // Filter -@table-header-filter-active-bg: darken(@table-header-sort-active-bg, 5%); +@table-header-filter-active-bg: rgba(0, 0, 0, 0.04); +@table-filter-btns-bg: inherit; +@table-filter-dropdown-bg: @component-background; +@table-expand-icon-bg: @component-background; +@table-selection-column-width: 32px; +// Sticky +@table-sticky-scroll-bar-bg: fade(#000, 35%); +@table-sticky-scroll-bar-radius: 4px; // Tag // -- diff --git a/components/table/Column.tsx b/components/table/Column.tsx index a54fc2fcce..588cddedf8 100644 --- a/components/table/Column.tsx +++ b/components/table/Column.tsx @@ -1,9 +1,10 @@ import { defineComponent } from 'vue'; -import { columnProps } from './interface'; +import type { ColumnType } from './interface'; -export default defineComponent({ +export type ColumnProps = ColumnType; +export default defineComponent({ name: 'ATableColumn', - props: columnProps, + slots: ['title', 'filterIcon'], render() { return null; }, diff --git a/components/table/ColumnGroup.tsx b/components/table/ColumnGroup.tsx index 484d86aea5..b1d03ae0a2 100644 --- a/components/table/ColumnGroup.tsx +++ b/components/table/ColumnGroup.tsx @@ -1,15 +1,9 @@ import { defineComponent } from 'vue'; -import PropTypes, { withUndefined } from '../_util/vue-types'; -import { tuple } from '../_util/type'; +import type { ColumnGroupProps } from '../vc-table/sugar/ColumnGroup'; -export default defineComponent({ +export default defineComponent>({ name: 'ATableColumnGroup', - props: { - fixed: withUndefined( - PropTypes.oneOfType([PropTypes.looseBool, PropTypes.oneOf(tuple('left', 'right'))]), - ), - title: PropTypes.any, - }, + slots: ['title'], __ANT_TABLE_COLUMN_GROUP: true, render() { return null; diff --git a/components/table/ExpandIcon.tsx b/components/table/ExpandIcon.tsx new file mode 100644 index 0000000000..6f877473f7 --- /dev/null +++ b/components/table/ExpandIcon.tsx @@ -0,0 +1,40 @@ +import classNames from '../_util/classNames'; +import type { TableLocale } from './interface'; + +interface DefaultExpandIconProps { + prefixCls: string; + onExpand: (record: RecordType, e: MouseEvent) => void; + record: RecordType; + expanded: boolean; + expandable: boolean; +} + +function renderExpandIcon(locale: TableLocale) { + return function expandIcon({ + prefixCls, + onExpand, + record, + expanded, + expandable, + }: DefaultExpandIconProps) { + const iconPrefix = `${prefixCls}-row-expand-icon`; + + return ( + +
  • 1
  • +
  • 2
  • +
  • + + -
      - -
    • -
    • 1
    • -
    • 2
    • -
    • - -
    - `; diff --git a/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap b/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap index da05c6a3a9..e08d77e8e2 100644 --- a/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap @@ -5,108 +5,117 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
    -
    +
    -
    -
    - -
    - - - - - - - -
    +
    +
    + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - Jerry - - - -
    + +
    -
    - - -
    Name -
    - -
    - - - - - Jack -
    - - - - - Lucy -
    - - - - - Tom -
    - - - + + + + Name +
    + + + Jack +
    + + + Lucy +
    + + + Tom +
    + + + Jerry +
    +
    +
    +
    +
    - - +
      + +
    • +
    • 1
    • +
    • + +
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    - - `; exports[`Table.rowSelection render with default selection correctly 1`] = `
    - `; diff --git a/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap b/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap index 5ac4cad160..944649f859 100644 --- a/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap @@ -3,8 +3,9 @@ exports[`Table.sorter renders sorter icon correctly 1`] = ` -
    Name
    + +
    Name
    diff --git a/components/table/__tests__/__snapshots__/Table.test.js.snap b/components/table/__tests__/__snapshots__/Table.test.js.snap index 9e80ed0857..3eae048afe 100644 --- a/components/table/__tests__/__snapshots__/Table.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.test.js.snap @@ -5,67 +5,60 @@ exports[`Table align column should not override cell style 1`] = `
    -
    +
    -
    - -
    - - - - - +
    +
    +
    + - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - -
    Name -
    - -
    Age -
    - -
    - - - - - - 32 -
    - + + Name + + Age +
    + + + + 32 +
    + + + + 42 +
    - - 42 -
    + +
    +
    +
    - - +
      + +
    • +
    • 1
    • +
    • + +
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    -
    `; @@ -74,76 +67,64 @@ exports[`Table renders JSX correctly 1`] = `
    -
    +
    -
    - -
    - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Age -
    +
    + Name + + Age +
    + First Name + + Last Name +
    + John + + Brown + + 32 +
    + Jim + + Green + + 42 +
    +
    +
    - - - -
    First Name -
    - - -
    Last Name -
    - - - - - - - - - John - - - - Brown - - - - 32 - - - - - - Jim - - - - Green - - - - 42 - - - - +
    +
    - - -
    - - - `; diff --git a/components/table/__tests__/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap index 8240bb9925..79479c11ac 100644 --- a/components/table/__tests__/__snapshots__/demo.test.js.snap +++ b/components/table/__tests__/__snapshots__/demo.test.js.snap @@ -5,126 +5,103 @@ exports[`renders ./components/table/demo/basic.vue correctly 1`] = `
    -
    +
    -
    - -
    - - - - - - - - +
    +
    +
    + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Age -
    - -
    Address -
    - -
    Tags -
    - -
    Action -
    - -
    - - John Brown - - - 32 - - - New York No. 1 Lake Park - - - NICEDEVELOPER - - - Invite 一 John BrownDelete More actions -
    - - Jim Green - - - 42 - - - London No. 1 Lake Park - - - LOSER - - - Invite 一 Jim GreenDelete More actions -
    - - Joe Black - - - 32 - + + Name + + Age + + Address + + Tags + + Action +
    + John Brown + + John Brown + + John Brown + + NICEDEVELOPER + + Invite 一 John BrownDelete More actions +
    + Jim Green + + Jim Green + + Jim Green + + LOSER + + Invite 一 Jim GreenDelete More actions +
    + Joe Black + + Joe Black + + Joe Black + + COOLTEACHER + + Invite 一 Joe BlackDelete More actions +
    +
    +
    - Sidney No. 1 Lake Park - - +
    +
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    - - + + + `; @@ -133,93 +110,80 @@ exports[`renders ./components/table/demo/bordered.vue correctly 1`] = `
    -
    +
    Header
    -
    - -
    - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Cash Assets -
    +
    + Name + + Cash Assets + + Address +
    + John Brown + + ¥300,000.00 + + New York No. 1 Lake Park +
    + Jim Green + + ¥1,256,000.00 + + London No. 1 Lake Park +
    + Joe Black + + ¥120,000.00 + + Sidney No. 1 Lake Park +
    +
    +
    + +
    +
      - -
      Address -
      - - - - - - - - - John Brown - - - - ¥300,000.00 - - - - New York No. 1 Lake Park - - - - - - Jim Green - - - - ¥1,256,000.00 - - - - London No. 1 Lake Park - - - - - - Joe Black - - - - ¥120,000.00 - - - - Sidney No. 1 Lake Park - - - - +
    • +
    • 1
    • +
    • + +
    - -
    -
      - -
    • -
    • 1
    • -
    • - -
    - - - `; exports[`renders ./components/table/demo/colspan-rowspan.vue correctly 1`] = ` @@ -227,152 +191,127 @@ exports[`renders ./components/table/demo/colspan-rowspan.vue correctly 1`] = `
    -
    +
    -
    - -
    - - - - - - - - +
    +
    +
    + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Age -
    - -
    Home phone -
    - -
    Address -
    - -
    - - John Brown - - - 32 - - - 0571-22098909 - - - 18889898989 - - - New York No. 1 Lake Park -
    - - Jim Green - - - 42 - - - 0571-22098333 - - - 18889898888 - - - London No. 1 Lake Park -
    - - Joe Black - - - 32 - - - 0575-22098909 - - - 18900010002 - - - Sidney No. 1 Lake Park -
    - - Jim Red - - - 18 - - - 18900010002 - - - London No. 2 Lake Park -
    - - Jake White - + Name + + Age + + Home phone + + Address +
    + John Brown + + 32 + + 0571-22098909 + + 18889898989 + + New York No. 1 Lake Park +
    + Jim Green + + 42 + + 0571-22098333 + + 18889898888 + + London No. 1 Lake Park +
    + Joe Black + + 32 + + 0575-22098909 + + 18900010002 + + Sidney No. 1 Lake Park +
    + Jim Red + + 18 + + 18900010002 + + London No. 2 Lake Park +
    + Jake White +
    +
    +
    +
    +
      +
    • +
    • 1
    • +
    • - - - +
    +
    - - -
    - -
      - -
    • -
    • 1
    • -
    • - -
    - - `; @@ -381,107 +320,98 @@ exports[`renders ./components/table/demo/custom-filter-panel.vue correctly 1`] =
    -
    +
    -
    - -
    - - - - - - +
    +
    +
    + - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Name -
    - -
    Age -
    - -
    Address -
    - -
    - - John Brown - - - 32 - - - New York No. 1 Lake Park -
    - - Joe Black - - - 42 - - - London No. 1 Lake Park -
    - - Jim Green - - - 32 - - - Sidney No. 1 Lake Park -
    - - Jim Red - - - 32 - - - London No. 2 Lake Park -
    + + +
    Name + +
    + + + Age + + + +
    Address + +
    + + + + + + + + John Brown + + + 32 + + + New York No. 1 Lake Park + + + + + + Joe Black + + + 42 + + + London No. 1 Lake Park + + + + + + Jim Green + + + 32 + + + Sidney No. 1 Lake Park + + + + + + Jim Red + + + 32 + + + London No. 2 Lake Park + + + + + + +
    +
    + +
    +
      + +
    • +
    • 1
    • +
    • + +
    - -
    -
      - -
    • -
    • 1
    • -
    • - -
    - - - `; exports[`renders ./components/table/demo/edit-cell.vue correctly 1`] = ` @@ -492,99 +422,86 @@ exports[`renders ./components/table/demo/edit-cell.vue correctly 1`] = `
    -
    +
    -
    - -
    - +
    +
    +
    - - - - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
    name -
    - -
    age -
    - -
    address -
    - -
    operation -
    - -
    - - -
    -
    Edward King 0
    -
    -
    - - 32 - - - London, Park Lane no. 0 - - - - Delete -
    - - -
    -
    Edward King 1
    +
    + name + + age + + address + + operation +
    + +
    +
    Edward King 0
    +
    +
    + 32 + + London, Park Lane no. 0 + + + Delete +
    + +
    +
    Edward King 1
    +
    +
    + 32 + + London, Park Lane no. 1 + + + Delete +
    - - - - 32 - - - - London, Park Lane no. 1 - - - - - Delete - - - - +
    + +
    +
      + +
    • +
    • 1
    • +
    • + +
    +
    - - -
    - -
      - -
    • -
    • 1
    • -
    • - -
    - - `; @@ -593,293 +510,258 @@ exports[`renders ./components/table/demo/edit-row.vue correctly 1`] = `
    -
    +
    -
    - -
    - +
    +
    +
    - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    name -
    - -
    age -
    - -
    address -
    - -
    operation -
    - -
    - - -
    Edrward 0
    -
    - - -
    32
    -
    - - -
    London Park no. 0
    -
    - - - -
    - - -
    Edrward 1
    -
    - - -
    32
    -
    - - -
    London Park no. 1
    -
    - - - -
    - - -
    Edrward 2
    -
    - - -
    32
    -
    - - -
    London Park no. 2
    -
    - - - -
    - - -
    Edrward 3
    -
    - - -
    32
    -
    - - -
    London Park no. 3
    -
    - - - -
    - - -
    Edrward 4
    -
    - - -
    32
    -
    - - -
    London Park no. 4
    -
    - - - -
    - - -
    Edrward 5
    -
    - - -
    32
    -
    - - -
    London Park no. 5
    -
    - - - -
    - - -
    Edrward 6
    -
    - - -
    32
    -
    - - -
    London Park no. 6
    -
    - - - -
    - - -
    Edrward 7
    -
    - - -
    32
    -
    - - -
    London Park no. 7
    -
    - - - -
    - - -
    Edrward 8
    -
    - - -
    32
    -
    - - -
    London Park no. 8
    -
    - - - -
    - - -
    Edrward 9
    -
    - - -
    32
    -
    - - -
    London Park no. 9
    -
    - - - -
    -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • 2
    • -
    • 3
    • -
    • 4
    • -
    • 5
    • -
    • -
      •••
      -
    • -
    • 10
    • -
    • -
    • -
      - - -
      10 / page + + name + + + age + + + address + + + operation + + + + + + + + +
      Edrward 0
      + + + +
      32
      + + + +
      London Park no. 0
      + + + + + + + + + + +
      Edrward 1
      + + + +
      32
      + + + +
      London Park no. 1
      + + + + + + + + + + +
      Edrward 2
      + + + +
      32
      + + + +
      London Park no. 2
      + + + + + + + + + + +
      Edrward 3
      + + + +
      32
      + + + +
      London Park no. 3
      + + + + + + + + + + +
      Edrward 4
      + + + +
      32
      + + + +
      London Park no. 4
      + + + + + + + + + + +
      Edrward 5
      + + + +
      32
      + + + +
      London Park no. 5
      + + + + + + + + + + +
      Edrward 6
      + + + +
      32
      + + + +
      London Park no. 6
      + + + + + + + + + + +
      Edrward 7
      + + + +
      32
      + + + +
      London Park no. 7
      + + + + + + + + + + +
      Edrward 8
      + + + +
      32
      + + + +
      London Park no. 8
      + + + + + + + + + + +
      Edrward 9
      + + + +
      32
      + + + +
      London Park no. 9
      + + + + + + + + + + +
      +
      -
    - +
    +
    - - - - - + `; @@ -888,143 +770,118 @@ exports[`renders ./components/table/demo/ellipsis.vue correctly 1`] = `
    -
    +
    -
    - -
    - +
    +
    +
    - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Age -
    +
    + Name + + Age + + Address + + Long Column Long Column Long Column + + Long Column Long Column + + Long Column +
    + John Brown + + 32 + + New York No. 1 Lake Park, New York No. 1 Lake Park + + New York No. 1 Lake Park, New York No. 1 Lake Park + + New York No. 1 Lake Park, New York No. 1 Lake Park + + New York No. 1 Lake Park, New York No. 1 Lake Park +
    + Jim Green + + 42 + + London No. 2 Lake Park, London No. 2 Lake Park + + London No. 2 Lake Park, London No. 2 Lake Park + + London No. 2 Lake Park, London No. 2 Lake Park + + London No. 2 Lake Park, London No. 2 Lake Park +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park, Sidney No. 1 Lake Park + + Sidney No. 1 Lake Park, Sidney No. 1 Lake Park + + Sidney No. 1 Lake Park, Sidney No. 1 Lake Park + + Sidney No. 1 Lake Park, Sidney No. 1 Lake Park +
    +
    +
    - -
    Address -
    - - -
    Long Column Long Column Long Column -
    - - -
    Long Column Long Column -
    - - -
    Long Column -
    - - - - - - - - - John Brown - - - - 32 - - - - New York No. 1 Lake Park, New York No. 1 Lake Park - - - - New York No. 1 Lake Park, New York No. 1 Lake Park - - - - New York No. 1 Lake Park, New York No. 1 Lake Park - - - - New York No. 1 Lake Park, New York No. 1 Lake Park - - - - - - Jim Green - - - - 42 - - - - London No. 2 Lake Park, London No. 2 Lake Park - - - - London No. 2 Lake Park, London No. 2 Lake Park - - - - London No. 2 Lake Park, London No. 2 Lake Park - - - - London No. 2 Lake Park, London No. 2 Lake Park - - - - - - Joe Black - - - - 32 - - - - Sidney No. 1 Lake Park, Sidney No. 1 Lake Park - - - - Sidney No. 1 Lake Park, Sidney No. 1 Lake Park - - - - Sidney No. 1 Lake Park, Sidney No. 1 Lake Park - - - - Sidney No. 1 Lake Park, Sidney No. 1 Lake Park - - - - -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    - + +
      + +
    • +
    • 1
    • +
    • + +
    + + `; @@ -1033,234 +890,201 @@ exports[`renders ./components/table/demo/expand.vue correctly 1`] = `
    -
    +
    -
    - -
    - +
    +
    +
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    Name -
    - -
    Age -
    - -
    Address -
    - -
    Action -
    - -
    -
    - -
    -
    - - John Brown - - - 32 - - - New York No. 1 Lake Park - - - Delete -
    -
    - -
    -
    - - Jim Green - - - 42 - - - London No. 1 Lake Park - - - Delete -
    -
    - +
    + Name + + Age + + Address + + Action +
    + + + John Brown + + 32 + + New York No. 1 Lake Park + + Delete +
    + + + Jim Green + + 42 + + London No. 1 Lake Park + + Delete +
    + + + Joe Black + + 32 + + Sidney No. 1 Lake Park + + Delete +
    - - - - Joe Black - - - - 32 - - - - Sidney No. 1 Lake Park - - - - Delete - - - - - +
    + +
    +
      + +
    • +
    • 1
    • +
    • + +
    +
    - - -
    - -
      - -
    • -
    • 1
    • -
    • - -
    - - `; exports[`renders ./components/table/demo/expand-children.vue correctly 1`] = ` +
    +
    CheckStrictly:
    + +
    + +
    -
    +
    -
    - -
    - +
    +
    +
    - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +
    +
    - - - -
    Name -
    - -
    Age -
    - -
    Address -
    - -
    - - - -
    - -
    John Brown sr. -
    - - 60 - - - New York No. 1 Lake Park -
    +
    + +
    + +
    + Name + + Age + + Address +
    + + John Brown sr. + 60 + + New York No. 1 Lake Park +
    + + Joe Black + 32 + + Sidney No. 1 Lake Park +
    +
    +
    - - - Joe Black - +
    +
      - 32 - - +
    • +
    • 1
    • +
    • - Sidney No. 1 Lake Park - - - - -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    - + + + `; @@ -1269,180 +1093,193 @@ exports[`renders ./components/table/demo/fixed-columns.vue correctly 1`] = `
    -
    +
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Full Name -
    - -
    Age -
    +
    +
    + + + + + + + + + + + + + + + + + + +
    + Full Name + + Age + + Column 1 + + Column 2 + + Column 3 + + Column 4 + + Column 5 + + Column 6 + + Column 7 + + Column 8 + + Action +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + John Brown + + 32 + + New York Park + + New York Park + + New York Park + + New York Park + + New York Park + + New York Park + + New York Park + + New York Park + + action +
    + Jim Green + + 40 + + London Park + + London Park + + London Park + + London Park + + London Park + + London Park + + London Park + + London Park + + action +
    +
    -
    Column 1 -
    + + -
    Column 2 -
    - -
    Column 3 -
    - -
    Column 4 -
    - -
    Column 5 -
    - -
    Column 6
    - -
    Column 7
    - -
    Column 8
    - -
    Action
    - -
    - - John Brown - - - 32 - - - New York Park - - - New York Park - - - New York Park - - - New York Park - - - New York Park - - - New York Park - - - New York Park - - - New York Park - - - action -
    - - Jim Green - - - 40 - - - London Park - - - London Park - - - London Park - - - London Park - - - London Park - - - London Park - - - London Park - - - London Park - - - action -
    -
    - - -
    -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    -
    +
    +
      + +
    • +
    • 1
    • +
    • + +
    + + `; @@ -1451,584 +1288,499 @@ exports[`renders ./components/table/demo/fixed-columns-header.vue correctly 1`]
    -
    +
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Full Name -
    - -
    Age -
    - -
    Column 1 -
    - -
    Column 2 -
    - -
    Column 3 -
    - -
    Column 4 -
    - -
    Column 5 -
    - -
    Column 6
    - -
    Column 7
    - -
    Column 8
    - -
    Action
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - Edrward 0 - - - 32 - - - London Park no. 0 - - - London Park no. 0 - - - London Park no. 0 - - - London Park no. 0 - - - London Park no. 0 - - - London Park no. 0 - - - London Park no. 0 - - - London Park no. 0 - - - action -
    - - Edrward 1 - - - 32 - - - London Park no. 1 - - - London Park no. 1 - - - London Park no. 1 - - - London Park no. 1 - - - London Park no. 1 - - - London Park no. 1 - - - London Park no. 1 - - - London Park no. 1 - - - action -
    - - Edrward 2 - - - 32 - - - London Park no. 2 - - - London Park no. 2 - - - London Park no. 2 - - - London Park no. 2 - - - London Park no. 2 - - - London Park no. 2 - - - London Park no. 2 - - - London Park no. 2 - - - action -
    - - Edrward 3 - - - 32 - - - London Park no. 3 - - - London Park no. 3 - - - London Park no. 3 - - - London Park no. 3 - - - London Park no. 3 - - - London Park no. 3 - - - London Park no. 3 - - - London Park no. 3 - - - action -
    - - Edrward 4 - - - 32 - - - London Park no. 4 - - - London Park no. 4 - - - London Park no. 4 - - - London Park no. 4 - - - London Park no. 4 - - - London Park no. 4 - - - London Park no. 4 - - - London Park no. 4 - - - action -
    - - Edrward 5 - - - 32 - - - London Park no. 5 - - - London Park no. 5 - - - London Park no. 5 - - - London Park no. 5 - - - London Park no. 5 - - - London Park no. 5 - - - London Park no. 5 - - - London Park no. 5 - - - action -
    - - Edrward 6 - - - 32 - - - London Park no. 6 - - - London Park no. 6 - - - London Park no. 6 - - - London Park no. 6 - - - London Park no. 6 - - - London Park no. 6 - - - London Park no. 6 - - - London Park no. 6 - - - action -
    - - Edrward 7 - - - 32 - - - London Park no. 7 - - - London Park no. 7 - - - London Park no. 7 - - - London Park no. 7 - - - London Park no. 7 - - - London Park no. 7 - - - London Park no. 7 - - - London Park no. 7 - - - action -
    - - Edrward 8 - - - 32 - - - London Park no. 8 - - - London Park no. 8 - - - London Park no. 8 - - - London Park no. 8 - - - London Park no. 8 - - - London Park no. 8 - - - London Park no. 8 - - - London Park no. 8 - - - action -
    - - Edrward 9 - - - 32 - - - London Park no. 9 - - - London Park no. 9 - - - London Park no. 9 - - - London Park no. 9 - - - London Park no. 9 - - - London Park no. 9 - - - London Park no. 9 - +
    +
    + + + + + + + + + + + + + + + + + + +
    + Full Name + + Age + + Column 1 + + Column 2 + + Column 3 + + Column 4 + + Column 5 + + Column 6 + + Column 7 + + Column 8 + + Action +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Edrward 0 + + 32 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + action +
    + Edrward 1 + + 32 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + action +
    + Edrward 2 + + 32 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + action +
    + Edrward 3 + + 32 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + action +
    + Edrward 4 + + 32 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + action +
    + Edrward 5 + + 32 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + action +
    + Edrward 6 + + 32 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + action +
    + Edrward 7 + + 32 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + action +
    + Edrward 8 + + 32 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + action +
    + Edrward 9 + + 32 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + action +
    +
    - London Park no. 9 -
    - action -
    -
    - - -
    -
    -
    -
    +
    - - - -
    - + `; @@ -2037,1353 +1789,1298 @@ exports[`renders ./components/table/demo/fixed-header.vue correctly 1`] = `
    -
    +
    -
    -
    -
    - - - - - - - - - - - - - + + -
    Name -
    - -
    Age -
    +
    +
    + + + + + + + + + + +
    + Name + + Age + + Address +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Edward King 0 + + 32 + + London, Park Lane no. 0 +
    + Edward King 1 + + 32 + + London, Park Lane no. 1 +
    + Edward King 2 + + 32 + + London, Park Lane no. 2 +
    + Edward King 3 + + 32 + + London, Park Lane no. 3 +
    + Edward King 4 + + 32 + + London, Park Lane no. 4 +
    + Edward King 5 + + 32 + + London, Park Lane no. 5 +
    + Edward King 6 + + 32 + + London, Park Lane no. 6 +
    + Edward King 7 + + 32 + + London, Park Lane no. 7 +
    + Edward King 8 + + 32 + + London, Park Lane no. 8 +
    + Edward King 9 + + 32 + + London, Park Lane no. 9 +
    + Edward King 10 + + 32 + + London, Park Lane no. 10 +
    + Edward King 11 + + 32 + + London, Park Lane no. 11 +
    + Edward King 12 + + 32 + + London, Park Lane no. 12 +
    + Edward King 13 + + 32 + + London, Park Lane no. 13 +
    + Edward King 14 + + 32 + + London, Park Lane no. 14 +
    + Edward King 15 + + 32 + + London, Park Lane no. 15 +
    + Edward King 16 + + 32 + + London, Park Lane no. 16 +
    + Edward King 17 + + 32 + + London, Park Lane no. 17 +
    + Edward King 18 + + 32 + + London, Park Lane no. 18 +
    + Edward King 19 + + 32 + + London, Park Lane no. 19 +
    + Edward King 20 + + 32 + + London, Park Lane no. 20 +
    + Edward King 21 + + 32 + + London, Park Lane no. 21 +
    + Edward King 22 + + 32 + + London, Park Lane no. 22 +
    + Edward King 23 + + 32 + + London, Park Lane no. 23 +
    + Edward King 24 + + 32 + + London, Park Lane no. 24 +
    + Edward King 25 + + 32 + + London, Park Lane no. 25 +
    + Edward King 26 + + 32 + + London, Park Lane no. 26 +
    + Edward King 27 + + 32 + + London, Park Lane no. 27 +
    + Edward King 28 + + 32 + + London, Park Lane no. 28 +
    + Edward King 29 + + 32 + + London, Park Lane no. 29 +
    + Edward King 30 + + 32 + + London, Park Lane no. 30 +
    + Edward King 31 + + 32 + + London, Park Lane no. 31 +
    + Edward King 32 + + 32 + + London, Park Lane no. 32 +
    + Edward King 33 + + 32 + + London, Park Lane no. 33 +
    + Edward King 34 + + 32 + + London, Park Lane no. 34 +
    + Edward King 35 + + 32 + + London, Park Lane no. 35 +
    + Edward King 36 + + 32 + + London, Park Lane no. 36 +
    + Edward King 37 + + 32 + + London, Park Lane no. 37 +
    + Edward King 38 + + 32 + + London, Park Lane no. 38 +
    + Edward King 39 + + 32 + + London, Park Lane no. 39 +
    + Edward King 40 + + 32 + + London, Park Lane no. 40 +
    + Edward King 41 + + 32 + + London, Park Lane no. 41 +
    + Edward King 42 + + 32 + + London, Park Lane no. 42 +
    + Edward King 43 + + 32 + + London, Park Lane no. 43 +
    + Edward King 44 + + 32 + + London, Park Lane no. 44 +
    + Edward King 45 + + 32 + + London, Park Lane no. 45 +
    + Edward King 46 + + 32 + + London, Park Lane no. 46 +
    + Edward King 47 + + 32 + + London, Park Lane no. 47 +
    + Edward King 48 + + 32 + + London, Park Lane no. 48 +
    + Edward King 49 + + 32 + + London, Park Lane no. 49 +
    +
    -
    Address -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - Edward King 0 - - - 32 - - - London, Park Lane no. 0 -
    - - Edward King 1 - - - 32 - - - London, Park Lane no. 1 -
    - - Edward King 2 - - - 32 - - - London, Park Lane no. 2 -
    - - Edward King 3 - - - 32 - - - London, Park Lane no. 3 -
    - - Edward King 4 - - - 32 - - - London, Park Lane no. 4 -
    - - Edward King 5 - - - 32 - - - London, Park Lane no. 5 -
    - - Edward King 6 - - - 32 - - - London, Park Lane no. 6 -
    - - Edward King 7 - - - 32 - - - London, Park Lane no. 7 -
    - - Edward King 8 - - - 32 - - - London, Park Lane no. 8 -
    - - Edward King 9 - - - 32 - - - London, Park Lane no. 9 -
    - - Edward King 10 - - - 32 - - - London, Park Lane no. 10 -
    - - Edward King 11 - - - 32 - - - London, Park Lane no. 11 -
    - - Edward King 12 - - - 32 - - - London, Park Lane no. 12 -
    - - Edward King 13 - - - 32 - - - London, Park Lane no. 13 -
    - - Edward King 14 - - - 32 - - - London, Park Lane no. 14 -
    - - Edward King 15 - - - 32 - - - London, Park Lane no. 15 -
    - - Edward King 16 - - - 32 - - - London, Park Lane no. 16 -
    - - Edward King 17 - - - 32 - - - London, Park Lane no. 17 -
    - - Edward King 18 - - - 32 - - - London, Park Lane no. 18 -
    - - Edward King 19 - - - 32 - - - London, Park Lane no. 19 -
    - - Edward King 20 - - - 32 - - - London, Park Lane no. 20 -
    - - Edward King 21 - - - 32 - - - London, Park Lane no. 21 -
    - - Edward King 22 - - - 32 - - - London, Park Lane no. 22 -
    - - Edward King 23 - - - 32 - - - London, Park Lane no. 23 -
    - - Edward King 24 - - - 32 - - - London, Park Lane no. 24 -
    - - Edward King 25 - - - 32 - - - London, Park Lane no. 25 -
    - - Edward King 26 - - - 32 - - - London, Park Lane no. 26 -
    - - Edward King 27 - - - 32 - - - London, Park Lane no. 27 -
    - - Edward King 28 - - - 32 - - - London, Park Lane no. 28 -
    - - Edward King 29 - - - 32 - - - London, Park Lane no. 29 -
    - - Edward King 30 - - - 32 - - - London, Park Lane no. 30 -
    - - Edward King 31 - - - 32 - - - London, Park Lane no. 31 -
    - - Edward King 32 - - - 32 - - - London, Park Lane no. 32 -
    - - Edward King 33 - - - 32 - - - London, Park Lane no. 33 -
    - - Edward King 34 - - - 32 - - - London, Park Lane no. 34 -
    - - Edward King 35 - - - 32 - - - London, Park Lane no. 35 -
    - - Edward King 36 - - - 32 - - - London, Park Lane no. 36 -
    - - Edward King 37 - - - 32 - - - London, Park Lane no. 37 -
    - - Edward King 38 - - - 32 - - - London, Park Lane no. 38 -
    - - Edward King 39 - - - 32 - - - London, Park Lane no. 39 -
    - - Edward King 40 - - - 32 - - - London, Park Lane no. 40 -
    - - Edward King 41 - - - 32 - - - London, Park Lane no. 41 -
    - - Edward King 42 - - - 32 - - - London, Park Lane no. 42 -
    - - Edward King 43 - - - 32 - - - London, Park Lane no. 43 -
    - - Edward King 44 - - - 32 - - - London, Park Lane no. 44 -
    - - Edward King 45 - - - 32 - - - London, Park Lane no. 45 -
    - - Edward King 46 - - - 32 - - - London, Park Lane no. 46 -
    - - Edward King 47 - - - 32 - - - London, Park Lane no. 47 -
    - - Edward King 48 - - - 32 - - - London, Park Lane no. 48 -
    - - Edward King 49 - - - 32 - - - London, Park Lane no. 49 -
    +
      + +
    • +
    • 1
    • +
    • 2
    • +
    • +
    • +
      + + +
      50 / page + +
      + +
      + +
    • +
    +
    +
    +
    +`; + +exports[`renders ./components/table/demo/grouping-columns.vue correctly 1`] = ` +
    +
    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    Name + +
    +
    + Other + + Company + + Gender +
    + +
    Age
    +
    + Address + + Company Address + + Company Name +
    + Street + + Block +
    + Building + + Door No. +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + John Brown + + 1 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 2 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 3 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 4 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 5 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 6 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 7 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 8 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 9 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    + John Brown + + 10 + + Lake Park + + C + + 2035 + + Lake Street 42 + + SoftLake Co + + M +
    +
    + + +
    +
    - - +
    -
      - -
    • -
    • 1
    • -
    • 2
    • -
    • -
    • -
      - - -
      50 / page - -
      - -
      - -
    • -
    -
    -
    -
    `; -exports[`renders ./components/table/demo/grouping-columns.vue correctly 1`] = ` +exports[`renders ./components/table/demo/head.vue correctly 1`] = `
    -
    +
    -
    -
    -
    - - - - - - - - - - - - - - -
    Name -
    - -
    Other -
    - +
    +
    + + + + + - + - - - - - - - - - - - - - - - - - - -
    + +
    Name
    + +
    Company -
    - +
    + +
    Age
    +
    + +
    Address
    + +
    Gender -
    - -
    Age
    -
    -
    - -
    Address -
    - -
    Company Address
    - -
    Company Name
    - -
    Street
    - -
    Block
    - -
    Building
    - -
    Door No.
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - C - - + + + + - 2035 - - + + + + - Lake Street 42 - - + + + + - SoftLake Co - - + + + + - M - - - -
    - - John Brown - - - 1 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 2 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 3 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 4 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 5 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 6 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 7 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 8 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 9 - - - Lake Park - - - C - - - 2035 - - - Lake Street 42 - - - SoftLake Co - - - M -
    - - John Brown - - - 10 - - - Lake Park - +
    +
    + Jim Green + + 42 + + London No. 1 Lake Park +
    +
    + John Brown + + 32 + + New York No. 1 Lake Park +
    +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    +
    + Jim Red + + 32 + + London No. 2 Lake Park +
    -
    - - -
    - - -
    +
    - - +
    +
      + +
    • +
    • 1
    • +
    • + +
    `; -exports[`renders ./components/table/demo/head.vue correctly 1`] = ` +exports[`renders ./components/table/demo/multiple-sorter.vue correctly 1`] = `
    -
    +
    -
    - -
    - - - - - - +
    +
    +
    + - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Name
    -
    -
    - -
    Age
    -
    -
    - -
    Address
    -
    -
    - -
    - - Jim Green - - - 42 - - - London No. 1 Lake Park -
    - - John Brown - - - 32 - - - New York No. 1 Lake Park -
    - - Joe Black - - - 32 - - - Sidney No. 1 Lake Park -
    - - Jim Red - - - 32 - - - London No. 2 Lake Park -
    -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    -
    + + Name + + + +
    Chinese Score
    + + + +
    Math Score
    + + + +
    English Score
    + + + + + + + + John Brown + + + 98 + + + 60 + + + 70 + + + + + + Jim Green + + + 98 + + + 66 + + + 89 + + + + + + Joe Black + + + 98 + + + 90 + + + 70 + + + + + + Jim Red + + + 88 + + + 99 + + + 89 + + + + + + +
    +
    + +
    +
      + +
    • +
    • 1
    • +
    • + +
    +
    +
    `; @@ -3392,181 +3089,141 @@ exports[`renders ./components/table/demo/nested-table.vue correctly 1`] = `
    -
    +
    -
    - -
    - +
    +
    +
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    Name -
    - -
    Platform -
    - -
    Version -
    - -
    Upgraded -
    - -
    Creator -
    - -
    Date -
    - -
    Action
    - -
    -
    - -
    -
    - - Screem - - - iOS - - - 10.3.4.5654 - - - 500 - - - Jack - - - 2014-12-24 23:12:00 - - - Publish -
    -
    - -
    -
    - - Screem - - - iOS - - - 10.3.4.5654 - - - 500 - - - Jack - - - 2014-12-24 23:12:00 - - - Publish -
    -
    +
    + Name + + Platform + + Version + + Upgraded + + Creator + + Date + + Action +
    + + + Screem 1 + + iOS + + 10.3.4.5654 + + 500 + + Jack + + 2014-12-24 23:12:00 + + Publish +
    + + + Screem 2 + + iOS + + 10.3.4.5654 + + 500 + + Jack + + 2014-12-24 23:12:00 + + Publish +
    + + + Screem 3 + + iOS + + 10.3.4.5654 + + 500 + + Jack + + 2014-12-24 23:12:00 + + Publish +
    +
    +
    - - - - Screem - - - - iOS - - - - 10.3.4.5654 - - - - 500 - - - - Jack - - - - 2014-12-24 23:12:00 - - - - Publish - - - - - -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    - - +
      + +
    • +
    • 1
    • +
    • + +
    + + `; @@ -3583,108 +3240,97 @@ exports[`renders ./components/table/demo/reset-filter.vue correctly 1`] = `
    -
    +
    -
    - -
    - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name
    -
    -
    - -
    Age
    -
    -
    +
    + +
    Name
    + +
    +
    + +
    Age
    +
    + +
    Address
    + +
    +
    + John Brown + + 32 + + New York No. 1 Lake Park +
    + Jim Green + + 42 + + London No. 1 Lake Park +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    + Jim Red + + 32 + + London No. 2 Lake Park +
    +
    +
    - -
    Address
    -
    -
    - - - - - - - - - John Brown - - - - 32 - - - - New York No. 1 Lake Park - - - - - - Jim Green - - - - 42 - - - - London No. 1 Lake Park - - - - - - Joe Black - - - - 32 - - - - Sidney No. 1 Lake Park - - - - - - Jim Red - - - - 32 - - - - London No. 2 Lake Park - - - - -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    + +
      + +
    • +
    • 1
    • +
    • + +
    + @@ -3695,134 +3341,121 @@ exports[`renders ./components/table/demo/row-selection.vue correctly 1`] = `
    -
    +
    -
    - -
    - +
    +
    +
    - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    - - - -
    Name -
    - -
    Age -
    - -
    Address -
    - -
    - - - - - John Brown - - - 32 - - - New York No. 1 Lake Park -
    - - - - - Jim Green - - - 42 - - - London No. 1 Lake Park -
    - - - - - Joe Black - - - 32 - - - Sidney No. 1 Lake Park -
    - - - +
    + +
    + +
    + Name + + Age + + Address +
    + + + John Brown + + 32 + + New York No. 1 Lake Park +
    + + + Jim Green + + 42 + + London No. 1 Lake Park +
    + + + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    + + + Disabled User + + 99 + + Sidney No. 1 Lake Park +
    +
    +
    - Disabled User - - +
    +
      - 99 - - +
    • +
    • 1
    • +
    • - Sidney No. 1 Lake Park - - - - -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    - - + + + `; @@ -3835,253 +3468,228 @@ exports[`renders ./components/table/demo/row-selection-and-operation.vue correct
    -
    +
    -
    - -
    - +
    +
    +
    - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    - - - -
    Name -
    - -
    Age -
    - -
    Address -
    - -
    - - - - - Edward King 0 - - - 32 - - - London, Park Lane no. 0 -
    - - - - - Edward King 1 - - - 32 - - - London, Park Lane no. 1 -
    - - - - - Edward King 2 - - - 32 - - - London, Park Lane no. 2 -
    - - - - - Edward King 3 - - - 32 - - - London, Park Lane no. 3 -
    - - - - - Edward King 4 - - - 32 - - - London, Park Lane no. 4 -
    - - - - - Edward King 5 - - - 32 - - - London, Park Lane no. 5 -
    - - - - - Edward King 6 - - - 32 - - - London, Park Lane no. 6 -
    - - - - - Edward King 7 - - - 32 - - - London, Park Lane no. 7 -
    - - - - - Edward King 8 - - - 32 - - - London, Park Lane no. 8 -
    - - - +
    + +
    + +
    + Name + + Age + + Address +
    + + + Edward King 0 + + 32 + + London, Park Lane no. 0 +
    + + + Edward King 1 + + 32 + + London, Park Lane no. 1 +
    + + + Edward King 2 + + 32 + + London, Park Lane no. 2 +
    + + + Edward King 3 + + 32 + + London, Park Lane no. 3 +
    + + + Edward King 4 + + 32 + + London, Park Lane no. 4 +
    + + + Edward King 5 + + 32 + + London, Park Lane no. 5 +
    + + + Edward King 6 + + 32 + + London, Park Lane no. 6 +
    + + + Edward King 7 + + 32 + + London, Park Lane no. 7 +
    + + + Edward King 8 + + 32 + + London, Park Lane no. 8 +
    + + + Edward King 9 + + 32 + + London, Park Lane no. 9 +
    +
    +
    - Edward King 9 - - +
    +
      - 32 - - +
    • +
    • 1
    • +
    • 2
    • +
    • 3
    • +
    • 4
    • +
    • 5
    • +
    • - London, Park Lane no. 9 - - - - +
    +
    +
    - - - - -
      - -
    • -
    • 1
    • -
    • 2
    • -
    • 3
    • -
    • 4
    • -
    • 5
    • -
    • - -
    - - - `; @@ -4090,253 +3698,229 @@ exports[`renders ./components/table/demo/row-selection-custom.vue correctly 1`]
    -
    +
    -
    - -
    - +
    +
    +
    - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    -
    - - - -
    Name -
    - -
    Age -
    - -
    Address -
    - -
    - - - - - Edward King 0 - - - 32 - - - London, Park Lane no. 0 -
    - - - - - Edward King 1 - - - 32 - - - London, Park Lane no. 1 -
    - - - - - Edward King 2 - - - 32 - - - London, Park Lane no. 2 -
    - - - - - Edward King 3 - - - 32 - - - London, Park Lane no. 3 -
    - - - - - Edward King 4 - - - 32 - - - London, Park Lane no. 4 -
    - - - - - Edward King 5 - - - 32 - - - London, Park Lane no. 5 -
    - - - - - Edward King 6 - - - 32 - - - London, Park Lane no. 6 -
    - - - - - Edward King 7 - - - 32 - - - London, Park Lane no. 7 -
    - - - - - Edward King 8 - - - 32 - - - London, Park Lane no. 8 -
    - - - +
    +
    + +
    +
    + +
    + Name + + Age + + Address +
    + + + Edward King 0 + + 32 + + London, Park Lane no. 0 +
    + + + Edward King 1 + + 32 + + London, Park Lane no. 1 +
    + + + Edward King 2 + + 32 + + London, Park Lane no. 2 +
    + + + Edward King 3 + + 32 + + London, Park Lane no. 3 +
    + + + Edward King 4 + + 32 + + London, Park Lane no. 4 +
    + + + Edward King 5 + + 32 + + London, Park Lane no. 5 +
    + + + Edward King 6 + + 32 + + London, Park Lane no. 6 +
    + + + Edward King 7 + + 32 + + London, Park Lane no. 7 +
    + + + Edward King 8 + + 32 + + London, Park Lane no. 8 +
    + + + Edward King 9 + + 32 + + London, Park Lane no. 9 +
    +
    +
    - Edward King 9 - - +
    +
      - 32 - - +
    • +
    • 1
    • +
    • 2
    • +
    • 3
    • +
    • 4
    • +
    • 5
    • +
    • - London, Park Lane no. 9 - - - - -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • 2
    • -
    • 3
    • -
    • 4
    • -
    • 5
    • -
    • - -
    - - + + + `; @@ -4347,399 +3931,692 @@ exports[`renders ./components/table/demo/size.vue correctly 1`] = `
    -
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Name + + Age + + Address +
    + John Brown + + 32 + + New York No. 1 Lake Park +
    + Jim Green + + 42 + + London No. 1 Lake Park +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    +
    +
    + +
    +
      + +
    • +
    • 1
    • +
    • + +
    +
    +
    +
    +

    Small size table

    +
    +
    + +
    +
    -
    - -
    - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Age -
    +
    + Name + + Age + + Address +
    + John Brown + + 32 + + New York No. 1 Lake Park +
    + Jim Green + + 42 + + London No. 1 Lake Park +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    +
    +
    - -
    Address -
    +
    +
      + +
    • +
    • 1
    • +
    • + +
    +
    +
    +
    + +`; + +exports[`renders ./components/table/demo/stripe.vue correctly 1`] = ` +
    +
    + +
    +
    - - - - - - - - John Brown - - - - 32 - - - - New York No. 1 Lake Park - - - - - - Jim Green - - - - 42 - - - - London No. 1 Lake Park - - - - - - Joe Black - - - - 32 - - +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Sidney No. 1 Lake Park - - - -
    + Name + + Age + + Address +
    + John Brown + + 32 + + New York No. 1 Lake Park +
    + Jim Green + + 42 + + London No. 1 Lake Park +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    + Ben Kang + + 15 + + Sidney No. 1 Lake Park +
    + +
    +
    +
    - - +
      + +
    • +
    • 1
    • +
    • + +
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    - -

    Small size table

    -
    +
    -
    +
    -
    - -
    - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Age -
    +
    + Name + + Age + + Address +
    + John Brown + + 32 + + New York No. 1 Lake Park +
    + Jim Green + + 42 + + London No. 1 Lake Park +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    + Ben Kang + + 15 + + Sidney No. 1 Lake Park +
    +
    +
    - -
    Address -
    - - - - - - - - - John Brown - - - - 32 - - - - New York No. 1 Lake Park - - - - - - Jim Green - - - - 42 - - - - London No. 1 Lake Park - - - - - - Joe Black - - - - 32 - - - - Sidney No. 1 Lake Park - - - - +
    +
      + +
    • +
    • 1
    • +
    • + +
    - -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    -
    - - `; -exports[`renders ./components/table/demo/stripe.vue correctly 1`] = ` -
    +exports[`renders ./components/table/demo/summary.vue correctly 1`] = ` +
    -
    +
    -
    - -
    - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Age -
    +
    + Name + + Borrow + + Repayment +
    + John Brown + + 10 + + 33 +
    + Jim Green + + 100 + + 0 +
    + Joe Black + + 10 + + 10 +
    + Jim Red + + 75 + + 45 +
    + Total + + 195 + + 88 +
    + Balance + + 107 +
    +
    +
    - -
    Address -
    - - - - - - - - - John Brown - - - - 32 - - - - New York No. 1 Lake Park - - - - - - Jim Green - - - - 42 - - - - London No. 1 Lake Park - - - - - - Joe Black - - - - 32 - - - - Sidney No. 1 Lake Park - - - - - - Ben Kang - - - - 15 - - - - Sidney No. 1 Lake Park - - - - +
    - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    -
    - -
    +

    +
    -
    +
    -
    - -
    - +
    +
    +
    + + + + + + + + +
    + Name + + Description +
    +
    +
    + - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Light + + Everything that has a beginning, has an end. +
    + Bamboo + + Everything that has a beginning, has an end. +
    + Little + + Everything that has a beginning, has an end. +
    + Light + + Everything that has a beginning, has an end. +
    + Bamboo + + Everything that has a beginning, has an end. +
    + Little + + Everything that has a beginning, has an end. +
    + Light + + Everything that has a beginning, has an end. +
    + Bamboo + + Everything that has a beginning, has an end. +
    + Little + + Everything that has a beginning, has an end. +
    + Light + + Everything that has a beginning, has an end. +
    + Bamboo + + Everything that has a beginning, has an end. +
    + Little + + Everything that has a beginning, has an end. +
    + Light + + Everything that has a beginning, has an end. +
    + Bamboo + + Everything that has a beginning, has an end. +
    + Little + + Everything that has a beginning, has an end. +
    + Light + + Everything that has a beginning, has an end. +
    + Bamboo + + Everything that has a beginning, has an end. +
    + Little + + Everything that has a beginning, has an end. +
    + Light + + Everything that has a beginning, has an end. +
    + Bamboo + + Everything that has a beginning, has an end. +
    +
    +
    + + + - + + + +
    Name -
    +
    + Summary + + This is a summary content +
    +
    - -
    Age -
    +
    - -
    Address -
    - - - - - - - - - John Brown - - - - 32 - - - - New York No. 1 Lake Park - - - - - - Jim Green - - - - 42 - - - - London No. 1 Lake Park - - - - - - Joe Black - - - - 32 - - - - Sidney No. 1 Lake Park - - - - - - Ben Kang - - - - 15 - - - - Sidney No. 1 Lake Park - - - - +
    - -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    - - `; exports[`renders ./components/table/demo/template.vue correctly 1`] = ` @@ -4747,147 +4624,119 @@ exports[`renders ./components/table/demo/template.vue correctly 1`] = `
    -
    +
    -
    - -
    - - - - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name -
    - -
    Age -
    +
    + Name + + Age + + Address + + Tags + + Action +
    + First Name + + Last Name +
    + John + + Brown + + 32 + + New York No. 1 Lake Park + + nicedeveloper + + Action 一 JohnDelete +
    + Jim + + Green + + 42 + + London No. 1 Lake Park + + loser + + Action 一 JimDelete +
    + Joe + + Black + + 32 + + Sidney No. 1 Lake Park + + coolteacher + + Action 一 JoeDelete +
    +
    +
    - -
    Address -
    - - -
    Tags -
    - - -
    Action -
    - - - - -
    First Name -
    - - -
    Last Name
    - - - - - - - - - John - - - - Brown - - - - 32 - - - - New York No. 1 Lake Park - - - - nicedeveloper - - - - Action 一 JohnDelete - - - - - - Jim - - - - Green - - - - 42 - - - - London No. 1 Lake Park - - - - loser - - - - Action 一 JimDelete - - - - - - Joe - - - - Black - - - - 32 - - - - Sidney No. 1 Lake Park - - - - coolteacher - - - - Action 一 JoeDelete - - - - -
    - - -
    -
    -
      - -
    • -
    • 1
    • -
    • - -
    -
    - + +
      + +
    • +
    • 1
    • +
    • + +
    + + `; diff --git a/components/table/__tests__/__snapshots__/empty.test.js.snap b/components/table/__tests__/__snapshots__/empty.test.js.snap index 639c4a0ea0..851d08f9e4 100644 --- a/components/table/__tests__/__snapshots__/empty.test.js.snap +++ b/components/table/__tests__/__snapshots__/empty.test.js.snap @@ -5,80 +5,57 @@ exports[`Table renders empty table 1`] = `
    -
    +
    -
    - -
    - - - - - - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + +
    Column 1 -
    - -
    Column 2 -
    +
    + Column 1 + + Column 2 + + Column 3 + + Column 4 + + Column 5 + + Column 6 + + Column 7 + + Column 8 +
    + No data +
    +
    +
    - -
    Column 3 -
    - - -
    Column 4 -
    - - -
    Column 5 -
    - - -
    Column 6 -
    - - -
    Column 7
    - - -
    Column 8
    - - - - - - -
    -
    -
    -
    - - - - - - - -
    -

    No Data

    - +
    +
    - -
    - - - - `; exports[`Table renders empty table with custom emptyText 1`] = ` @@ -86,65 +63,56 @@ exports[`Table renders empty table with custom emptyText 1`] = `
    -
    +
    -
    - -
    - - - - - - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + +
    Column 1 -
    - -
    Column 2 -
    +
    + Column 1 + + Column 2 + + Column 3 + + Column 4 + + Column 5 + + Column 6 + + Column 7 + + Column 8 +
    + custom empty text +
    +
    +
    - -
    Column 3 -
    - - -
    Column 4 -
    - - -
    Column 5 -
    - - -
    Column 6 -
    - - -
    Column 7
    - - -
    Column 8
    - - - - - - -
    -
    custom empty text
    - -
    -
    -
    - + + + `; @@ -153,178 +121,138 @@ exports[`Table renders empty table with fixed columns 1`] = `
    -
    +
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Full Name -
    - -
    Age -
    - -
    Column 1 -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Full Name + + Age + + Column 1 + + Column 2 + + Column 3 + + Column 4 + + Column 5 + + Column 6 + + Column 7 + + Column 8 + + Action +
    + No data +
    +
    +
    -
    Column 2 -
    - -
    Column 3 -
    - -
    Column 4 -
    - -
    Column 5 -
    - -
    Column 6
    - -
    Column 7
    - -
    Column 8
    - -
    Action
    - -
    -
    -
    -
    -
    - - - - - - - -
    -

    No Data

    - +
    +
    - -
    -
    -
    -
    - - `; exports[`Table renders empty table without emptyText when loading 1`] = `
    -
    +
    -
    +
    -
    - -
    - - - - - - - - - - - +
    +
    +
    + - - + + + + + + + + + + + + + + + + +
    Column 1 -
    - -
    Column 2 -
    +
    + Column 1 + + Column 2 + + Column 3 + + Column 4 + + Column 5 + + Column 6 + + Column 7 + + Column 8 +
    + No data +
    +
    +
    - -
    Column 3 -
    - - -
    Column 4 -
    - - -
    Column 5 -
    - - -
    Column 6 -
    - - -
    Column 7
    - - -
    Column 8
    - - - - - - -
    -
    -
    -
    - - - - - - - -
    -

    No Data

    - +
    +
    - -
    -
    -
    - - `; diff --git a/components/table/context.ts b/components/table/context.ts new file mode 100644 index 0000000000..e9d1528a4b --- /dev/null +++ b/components/table/context.ts @@ -0,0 +1,29 @@ +import type { ComputedRef, InjectionKey } from 'vue'; +import { computed } from 'vue'; +import { inject, provide } from 'vue'; + +export type ContextSlots = { + emptyText?: (...args: any[]) => void; + expandIcon?: (...args: any[]) => void; + title?: (...args: any[]) => void; + footer?: (...args: any[]) => void; + summary?: (...args: any[]) => void; + bodyCell?: (...args: any[]) => void; + headerCell?: (...args: any[]) => void; + customFilterIcon?: (...args: any[]) => void; + customFilterDropdown?: (...args: any[]) => void; + // 兼容 2.x 的 columns slots 配置 + [key: string]: (...args: any[]) => void; +}; + +export type ContextProps = ComputedRef; + +export const ContextKey: InjectionKey = Symbol('ContextProps'); + +export const useProvideSlots = (props: ContextProps) => { + provide(ContextKey, props); +}; + +export const useInjectSlots = () => { + return inject(ContextKey, computed(() => ({})) as ContextProps); +}; diff --git a/components/table/createBodyRow.tsx b/components/table/createBodyRow.tsx deleted file mode 100644 index cbd80eb9e4..0000000000 --- a/components/table/createBodyRow.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import PropTypes from '../_util/vue-types'; -import { computed, defineComponent } from 'vue'; -import { getSlot } from '../_util/props-util'; -import omit from 'omit.js'; - -const BodyRowProps = { - store: PropTypes.object, - rowKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - prefixCls: PropTypes.string, -}; - -export default function createBodyRow(Component = 'tr') { - const BodyRow = defineComponent({ - name: 'BodyRow', - inheritAttrs: false, - props: BodyRowProps, - setup(props) { - return { - selected: computed(() => props.store?.selectedRowKeys.indexOf(props.rowKey) >= 0), - }; - }, - render() { - const rowProps = omit({ ...this.$props, ...this.$attrs }, [ - 'prefixCls', - 'rowKey', - 'store', - 'class', - ]); - const className = { - [`${this.prefixCls}-row-selected`]: this.selected, - [this.$attrs.class as string]: !!this.$attrs.class, - }; - - return ( - - {getSlot(this)} - - ); - }, - }); - - return BodyRow; -} diff --git a/components/table/demo/ajax.vue b/components/table/demo/ajax.vue index fa8df71dca..5cc3b39c19 100644 --- a/components/table/demo/ajax.vue +++ b/components/table/demo/ajax.vue @@ -28,20 +28,23 @@ This example shows how to fetch and present data from a remote server, and how t :loading="loading" @change="handleTableChange" > - + diff --git a/components/table/demo/multiple-sorter.vue b/components/table/demo/multiple-sorter.vue new file mode 100644 index 0000000000..1dcec9f0d4 --- /dev/null +++ b/components/table/demo/multiple-sorter.vue @@ -0,0 +1,99 @@ + +--- +order: 7 +title: + en-US: Multiple sorter + zh-CN: 多列排序 +--- + +## zh-CN + +`column.sorter` 支持 `multiple` 字段以配置多列排序优先级。通过 `sorter.compare` 配置排序逻辑,你可以通过不设置该函数只启动多列排序的交互形式。 + +## en-US + +`column.sorter` support `multiple` to config the priority of sort columns. Though `sorter.compare` to customize compare function. You can also leave it empty to use the interactive only. + + + + + + diff --git a/components/table/demo/nested-table.vue b/components/table/demo/nested-table.vue index b993255909..5c716de373 100644 --- a/components/table/demo/nested-table.vue +++ b/components/table/demo/nested-table.vue @@ -19,34 +19,40 @@ Showing more detailed info of every row.