@tanstack/table-core 9.0.0-beta.8 → 9.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/table/constructTable.cjs +2 -1
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.js +2 -1
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +17 -3
- package/dist/core/table/coreTablesFeature.types.d.ts +17 -3
- package/dist/helpers/metaHelper.cjs +30 -0
- package/dist/helpers/metaHelper.cjs.map +1 -0
- package/dist/helpers/metaHelper.d.cts +26 -0
- package/dist/helpers/metaHelper.d.ts +26 -0
- package/dist/helpers/metaHelper.js +29 -0
- package/dist/helpers/metaHelper.js.map +1 -0
- package/dist/helpers/tableFeatures.cjs +11 -1
- package/dist/helpers/tableFeatures.cjs.map +1 -1
- package/dist/helpers/tableFeatures.d.cts +11 -1
- package/dist/helpers/tableFeatures.d.ts +11 -1
- package/dist/helpers/tableFeatures.js +11 -1
- package/dist/helpers/tableFeatures.js.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -1
- package/dist/types/ColumnDef.d.cts +17 -3
- package/dist/types/ColumnDef.d.ts +17 -3
- package/dist/types/TableFeatures.d.cts +24 -2
- package/dist/types/TableFeatures.d.ts +24 -2
- package/dist/types/TableOptions.d.cts +1 -1
- package/dist/types/TableOptions.d.ts +1 -1
- package/package.json +1 -1
- package/src/core/table/constructTable.ts +8 -1
- package/src/core/table/coreTablesFeature.types.ts +23 -2
- package/src/helpers/metaHelper.ts +24 -0
- package/src/helpers/tableFeatures.ts +11 -1
- package/src/index.ts +1 -0
- package/src/types/ColumnDef.ts +28 -2
- package/src/types/TableFeatures.ts +24 -2
- package/src/types/TableOptions.ts +4 -1
|
@@ -23,11 +23,12 @@ function getInitialTableState(features, initialState = {}) {
|
|
|
23
23
|
*/
|
|
24
24
|
function constructTable(tableOptions) {
|
|
25
25
|
const _reactivity = tableOptions.features.coreReactivityFeature;
|
|
26
|
+
const { columnMeta: _columnMeta, tableMeta: _tableMeta, ...features } = tableOptions.features;
|
|
26
27
|
const table = {
|
|
27
28
|
_reactivity,
|
|
28
29
|
_features: {
|
|
29
30
|
...require_coreFeatures.coreFeatures,
|
|
30
|
-
...
|
|
31
|
+
...features
|
|
31
32
|
},
|
|
32
33
|
_rowModels: {},
|
|
33
34
|
_rowModelFns: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructTable.cjs","names":["cloneState","coreFeatures","atomToStore"],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState, TableState_All } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReactivityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...
|
|
1
|
+
{"version":3,"file":"constructTable.cjs","names":["cloneState","coreFeatures","atomToStore"],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState, TableState_All } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReactivityFeature!\n\n // `tableMeta`/`columnMeta` are type-only slots, not real features\n const {\n columnMeta: _columnMeta,\n tableMeta: _tableMeta,\n ...features\n } = tableOptions.features\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState_All\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtoms = table.options.atoms as\n | Partial<Record<keyof TableState_All, Atom<unknown>>>\n | undefined\n const externalAtom = externalAtoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key]!.get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures> & TableState_All\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n ;(snapshot as Record<string, unknown>)[key] = table.atoms[key]!.get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options.rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,qBACd,UACA,eAA2D,CAAC,GACrC;CACvB,OAAO,OAAO,QAAQ,CAAC,CAAC,SAAS,YAAY;;EAC3C,yCAAe,QAAQ,6GAAkB,YAAY,MAAK;CAC5D,CAAC;CACD,OAAOA,yBAAW,YAAY;AAChC;;;;;;AAOA,SAAgB,eAGd,cAAuE;CACvE,MAAM,cAAc,aAAa,SAAS;CAG1C,MAAM,EACJ,YAAY,aACZ,WAAW,YACX,GAAG,aACD,aAAa;CAEjB,MAAM,QAAQ;EACZ;EACA,WAAW;GAAE,GAAGC;GAAc,GAAG;EAAS;EAC1C,YAAY,CAAC;EACb,cAAc,CAAC;EACf,WAAW,CAAC;EACZ,OAAO,CAAC;CACV;CAEA,MAAM,eAAoC,OAAO,OAAO,MAAM,SAAS;CAMvE,MAAM,gBAAgB;EAAE,GAJD,aAAa,QAAQ,KAAK,YAAY;;GAC3D,OAAO,OAAO,OAAO,8BAAK,QAAQ,oHAAyB,KAAK,CAAC;EACnE,GAAG,CAAC,CAEoC;EAAG,GAAG;CAAa;CAE3D,IAAI,YAAY,qBAAqB,cAAc,OACjD,KAAK,MAAM,CAAC,SAAS,UAAU,OAAO,QAAQ,cAAc,KAAK,GAAG;EAClE,MAAM,OAAO;EACb,MAAM,cAAc,YAAY,mBAAmB,KAAK,IAAI,GAAG,EAC7D,WAAW,gBAAgB,UAC7B,CAAC;EACA,AAAC,cAAc,MAAc,WAAW;EAEzC,IAAI,eAAe;EACnB,MAAM,uBAAuB,KAAK,WAAW,UAAU;GACrD,IAAI,cAAc;GAClB,YAAY,IAAI,KAAK;EACvB,CAAC;EACD,MAAM,uBAAuB,YAAY,WAAW,UAAU;GAC5D,eAAe;GACf,KAAK,IAAI,KAAK;GACd,eAAe;EACjB,CAAC;EACD,YAAY,gBAAgB,oBAAoB;EAChD,YAAY,gBAAgB,oBAAoB;CAClD;CAGF,IAAI,YAAY,oBAAoB;EAElC,MAAM,eAAe,YAAY,mBAE/B,eAAe,EAAE,WAAW,qBAAqB,CAAC;EACpD,OAAO,eAAe,OAAO,WAAW;GACtC,cAAc;GACd,YAAY;GACZ,MAAM;IACJ,OAAO,MAAM,aAAc,IAAI;GACjC;GACA,IAAI,OAAO;IACT,MAAM,aAAc,UAAU,KAAK;GACrC;EACF,CAAC;CACH,OACE,MAAM,UAAU;CAGlB,MAAM,eAAe,qBACnB,MAAM,WACN,MAAM,QAAQ,YAChB;CAEA,MAAM,YAAY,OAAO,KAAK,MAAM,YAAY;CAIhD,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;EACzC,MAAM,MAAM,UAAU;EACtB,MAAM,UAAU,OAAO,YAAY,mBACjC,MAAM,aAAa,MACnB,EACE,WAAW,mBAAmB,MAChC,CACF;EAGC,AAAC,MAAM,MAAc,OAAO,YAAY,yBACjC;GACJ,MAAM,gBAAgB,MAAM,QAAQ;GAGpC,MAAM,6EAAe,cAAgB;GACrC,IAAI,cACF,OAAO,aAAa,IAAI;GAE1B,OAAO,MAAM,UAAU,IAAI,CAAE,IAAI;EACnC,GACA,EAAE,WAAW,eAAe,MAAM,CACpC;CACF;CAEA,mEAAmC,KAAK;CAExC,MAAM,QAAQC,gDACZ,YAAY,yBACJ;EACJ,MAAM,WAAW,CAAC;EAClB,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;GACzC,MAAM,MAAM,UAAU;GACrB,AAAC,SAAqC,OAAO,MAAM,MAAM,IAAI,CAAE,IAAI;EACtE;EACA,OAAO;CACT,GACA,EAAE,WAAW,cAAc,CAC7B,CACF;CAEA,IACE,QAAQ,IAAI,aAAa,kBACxB,aAAa,YAAY,aAAa,aACvC;EACA,MAAM,WAAW,OAAO,KAAK,MAAM,SAAS;EAC5C,MAAM,YAAY,OAAO,KAAK,MAAM,QAAQ,aAAa,CAAC,CAAC;EAC3D,MAAM,SAAS,OAAO,KAAK,MAAM,YAAY;EAE7C,QAAQ,IACN;;gBAEU,SAAS,KAAK,kBAAkB,EAAE;;gBAElC,UAAU,SAAS,UAAU,KAAK,kBAAkB,IAAI,SAAS;;gBAEjE,OAAO,KAAK,kBAAkB,EAAE,KAC1C,EAAE,MAAM,CACV;CACF;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;;EAC5C,4CAAa,IAAI,iGAAqB,KAAK;CAC7C;CAEA,OAAO;AACT"}
|
|
@@ -23,11 +23,12 @@ function getInitialTableState(features, initialState = {}) {
|
|
|
23
23
|
*/
|
|
24
24
|
function constructTable(tableOptions) {
|
|
25
25
|
const _reactivity = tableOptions.features.coreReactivityFeature;
|
|
26
|
+
const { columnMeta: _columnMeta, tableMeta: _tableMeta, ...features } = tableOptions.features;
|
|
26
27
|
const table = {
|
|
27
28
|
_reactivity,
|
|
28
29
|
_features: {
|
|
29
30
|
...coreFeatures,
|
|
30
|
-
...
|
|
31
|
+
...features
|
|
31
32
|
},
|
|
32
33
|
_rowModels: {},
|
|
33
34
|
_rowModelFns: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructTable.js","names":[],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState, TableState_All } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReactivityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...
|
|
1
|
+
{"version":3,"file":"constructTable.js","names":[],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState, TableState_All } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReactivityFeature!\n\n // `tableMeta`/`columnMeta` are type-only slots, not real features\n const {\n columnMeta: _columnMeta,\n tableMeta: _tableMeta,\n ...features\n } = tableOptions.features\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState_All\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtoms = table.options.atoms as\n | Partial<Record<keyof TableState_All, Atom<unknown>>>\n | undefined\n const externalAtom = externalAtoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key]!.get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures> & TableState_All\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n ;(snapshot as Record<string, unknown>)[key] = table.atoms[key]!.get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options.rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":"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"}
|
|
@@ -5,11 +5,22 @@ import { RowModelFns } from "../../types/RowModelFns.cjs";
|
|
|
5
5
|
import { CachedRowModels, CreateRowModels_All } from "../../types/RowModel.cjs";
|
|
6
6
|
import { TableState, TableState_All } from "../../types/TableState.cjs";
|
|
7
7
|
import { TableOptions } from "../../types/TableOptions.cjs";
|
|
8
|
-
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
8
|
+
import { IsAny, TableFeatures } from "../../types/TableFeatures.cjs";
|
|
9
9
|
import { Atom, ReadonlyAtom, ReadonlyStore } from "@tanstack/store";
|
|
10
10
|
|
|
11
11
|
//#region src/core/table/coreTablesFeature.types.d.ts
|
|
12
12
|
interface TableMeta<TFeatures extends TableFeatures, TData extends RowData> {}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the type of `options.meta` for a feature set.
|
|
15
|
+
*
|
|
16
|
+
* When the features object declares a `tableMeta` type-only slot
|
|
17
|
+
* (`tableFeatures({ ..., tableMeta: {} as MyTableMeta })`), that type wins.
|
|
18
|
+
* Otherwise this falls back to the global declaration-merged `TableMeta`
|
|
19
|
+
* interface.
|
|
20
|
+
*/
|
|
21
|
+
type ExtractTableMeta<TFeatures extends TableFeatures, TData extends RowData> = IsAny<TFeatures> extends true ? TableMeta<TFeatures, TData> : TFeatures extends {
|
|
22
|
+
tableMeta: infer TMeta extends object;
|
|
23
|
+
} ? TMeta : TableMeta<TFeatures, TData>;
|
|
13
24
|
/**
|
|
14
25
|
* A map of writable atoms, one per `TableState` slice. These are the internal
|
|
15
26
|
* writable atoms that the library always writes to via `makeStateUpdater`.
|
|
@@ -91,8 +102,11 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
91
102
|
readonly mergeOptions?: (defaultOptions: TableOptions<TFeatures, TData>, options: Partial<TableOptions<TFeatures, TData>>) => TableOptions<TFeatures, TData>;
|
|
92
103
|
/**
|
|
93
104
|
* You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.
|
|
105
|
+
*
|
|
106
|
+
* Declare its type per-table via the `tableMeta` type-only slot on the
|
|
107
|
+
* `features` option, or globally via declaration merging on `TableMeta`.
|
|
94
108
|
*/
|
|
95
|
-
readonly meta?:
|
|
109
|
+
readonly meta?: ExtractTableMeta<TFeatures, TData>;
|
|
96
110
|
/**
|
|
97
111
|
* Optionally provide externally managed values for individual state slices.
|
|
98
112
|
*
|
|
@@ -182,5 +196,5 @@ interface Table_Table<TFeatures extends TableFeatures, TData extends RowData> ex
|
|
|
182
196
|
setOptions: (newOptions: Updater<TableOptions<TFeatures, TData>>) => void;
|
|
183
197
|
}
|
|
184
198
|
//#endregion
|
|
185
|
-
export { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table };
|
|
199
|
+
export { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, ExtractTableMeta, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table };
|
|
186
200
|
//# sourceMappingURL=coreTablesFeature.types.d.cts.map
|
|
@@ -5,11 +5,22 @@ import { RowModelFns } from "../../types/RowModelFns.js";
|
|
|
5
5
|
import { CachedRowModels, CreateRowModels_All } from "../../types/RowModel.js";
|
|
6
6
|
import { TableState, TableState_All } from "../../types/TableState.js";
|
|
7
7
|
import { TableOptions } from "../../types/TableOptions.js";
|
|
8
|
-
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
8
|
+
import { IsAny, TableFeatures } from "../../types/TableFeatures.js";
|
|
9
9
|
import { Atom, ReadonlyAtom, ReadonlyStore } from "@tanstack/store";
|
|
10
10
|
|
|
11
11
|
//#region src/core/table/coreTablesFeature.types.d.ts
|
|
12
12
|
interface TableMeta<TFeatures extends TableFeatures, TData extends RowData> {}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the type of `options.meta` for a feature set.
|
|
15
|
+
*
|
|
16
|
+
* When the features object declares a `tableMeta` type-only slot
|
|
17
|
+
* (`tableFeatures({ ..., tableMeta: {} as MyTableMeta })`), that type wins.
|
|
18
|
+
* Otherwise this falls back to the global declaration-merged `TableMeta`
|
|
19
|
+
* interface.
|
|
20
|
+
*/
|
|
21
|
+
type ExtractTableMeta<TFeatures extends TableFeatures, TData extends RowData> = IsAny<TFeatures> extends true ? TableMeta<TFeatures, TData> : TFeatures extends {
|
|
22
|
+
tableMeta: infer TMeta extends object;
|
|
23
|
+
} ? TMeta : TableMeta<TFeatures, TData>;
|
|
13
24
|
/**
|
|
14
25
|
* A map of writable atoms, one per `TableState` slice. These are the internal
|
|
15
26
|
* writable atoms that the library always writes to via `makeStateUpdater`.
|
|
@@ -91,8 +102,11 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
91
102
|
readonly mergeOptions?: (defaultOptions: TableOptions<TFeatures, TData>, options: Partial<TableOptions<TFeatures, TData>>) => TableOptions<TFeatures, TData>;
|
|
92
103
|
/**
|
|
93
104
|
* You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.
|
|
105
|
+
*
|
|
106
|
+
* Declare its type per-table via the `tableMeta` type-only slot on the
|
|
107
|
+
* `features` option, or globally via declaration merging on `TableMeta`.
|
|
94
108
|
*/
|
|
95
|
-
readonly meta?:
|
|
109
|
+
readonly meta?: ExtractTableMeta<TFeatures, TData>;
|
|
96
110
|
/**
|
|
97
111
|
* Optionally provide externally managed values for individual state slices.
|
|
98
112
|
*
|
|
@@ -182,5 +196,5 @@ interface Table_Table<TFeatures extends TableFeatures, TData extends RowData> ex
|
|
|
182
196
|
setOptions: (newOptions: Updater<TableOptions<TFeatures, TData>>) => void;
|
|
183
197
|
}
|
|
184
198
|
//#endregion
|
|
185
|
-
export { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table };
|
|
199
|
+
export { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, ExtractTableMeta, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table };
|
|
186
200
|
//# sourceMappingURL=coreTablesFeature.types.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/helpers/metaHelper.ts
|
|
3
|
+
/**
|
|
4
|
+
* A helper for declaring the `tableMeta`/`columnMeta` type-only slots in the
|
|
5
|
+
* `features` option without a type assertion.
|
|
6
|
+
*
|
|
7
|
+
* Equivalent to `{} as TMeta`, but reads as type-only at the call site and
|
|
8
|
+
* avoids `@typescript-eslint/no-unnecessary-type-assertion` false positives
|
|
9
|
+
* when the meta type has only optional properties (where an auto-fix removing
|
|
10
|
+
* the assertion would silently degrade the inferred meta type to `{}`).
|
|
11
|
+
*
|
|
12
|
+
* The returned value is a phantom — it is ignored and stripped from the
|
|
13
|
+
* table's registered features at runtime; only its type is used.
|
|
14
|
+
* @example
|
|
15
|
+
* ```
|
|
16
|
+
* import { metaHelper, tableFeatures, rowSortingFeature } from '@tanstack/react-table'
|
|
17
|
+
* const features = tableFeatures({
|
|
18
|
+
* rowSortingFeature,
|
|
19
|
+
* tableMeta: metaHelper<MyTableMeta>(),
|
|
20
|
+
* columnMeta: metaHelper<MyColumnMeta>(),
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function metaHelper() {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.metaHelper = metaHelper;
|
|
30
|
+
//# sourceMappingURL=metaHelper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metaHelper.cjs","names":[],"sources":["../../src/helpers/metaHelper.ts"],"sourcesContent":["/**\n * A helper for declaring the `tableMeta`/`columnMeta` type-only slots in the\n * `features` option without a type assertion.\n *\n * Equivalent to `{} as TMeta`, but reads as type-only at the call site and\n * avoids `@typescript-eslint/no-unnecessary-type-assertion` false positives\n * when the meta type has only optional properties (where an auto-fix removing\n * the assertion would silently degrade the inferred meta type to `{}`).\n *\n * The returned value is a phantom — it is ignored and stripped from the\n * table's registered features at runtime; only its type is used.\n * @example\n * ```\n * import { metaHelper, tableFeatures, rowSortingFeature } from '@tanstack/react-table'\n * const features = tableFeatures({\n * rowSortingFeature,\n * tableMeta: metaHelper<MyTableMeta>(),\n * columnMeta: metaHelper<MyColumnMeta>(),\n * });\n * ```\n */\nexport function metaHelper<TMeta extends object>(): TMeta {\n return {} as TMeta\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,aAA0C;CACxD,OAAO,CAAC;AACV"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/helpers/metaHelper.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A helper for declaring the `tableMeta`/`columnMeta` type-only slots in the
|
|
4
|
+
* `features` option without a type assertion.
|
|
5
|
+
*
|
|
6
|
+
* Equivalent to `{} as TMeta`, but reads as type-only at the call site and
|
|
7
|
+
* avoids `@typescript-eslint/no-unnecessary-type-assertion` false positives
|
|
8
|
+
* when the meta type has only optional properties (where an auto-fix removing
|
|
9
|
+
* the assertion would silently degrade the inferred meta type to `{}`).
|
|
10
|
+
*
|
|
11
|
+
* The returned value is a phantom — it is ignored and stripped from the
|
|
12
|
+
* table's registered features at runtime; only its type is used.
|
|
13
|
+
* @example
|
|
14
|
+
* ```
|
|
15
|
+
* import { metaHelper, tableFeatures, rowSortingFeature } from '@tanstack/react-table'
|
|
16
|
+
* const features = tableFeatures({
|
|
17
|
+
* rowSortingFeature,
|
|
18
|
+
* tableMeta: metaHelper<MyTableMeta>(),
|
|
19
|
+
* columnMeta: metaHelper<MyColumnMeta>(),
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare function metaHelper<TMeta extends object>(): TMeta;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { metaHelper };
|
|
26
|
+
//# sourceMappingURL=metaHelper.d.cts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/helpers/metaHelper.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A helper for declaring the `tableMeta`/`columnMeta` type-only slots in the
|
|
4
|
+
* `features` option without a type assertion.
|
|
5
|
+
*
|
|
6
|
+
* Equivalent to `{} as TMeta`, but reads as type-only at the call site and
|
|
7
|
+
* avoids `@typescript-eslint/no-unnecessary-type-assertion` false positives
|
|
8
|
+
* when the meta type has only optional properties (where an auto-fix removing
|
|
9
|
+
* the assertion would silently degrade the inferred meta type to `{}`).
|
|
10
|
+
*
|
|
11
|
+
* The returned value is a phantom — it is ignored and stripped from the
|
|
12
|
+
* table's registered features at runtime; only its type is used.
|
|
13
|
+
* @example
|
|
14
|
+
* ```
|
|
15
|
+
* import { metaHelper, tableFeatures, rowSortingFeature } from '@tanstack/react-table'
|
|
16
|
+
* const features = tableFeatures({
|
|
17
|
+
* rowSortingFeature,
|
|
18
|
+
* tableMeta: metaHelper<MyTableMeta>(),
|
|
19
|
+
* columnMeta: metaHelper<MyColumnMeta>(),
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare function metaHelper<TMeta extends object>(): TMeta;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { metaHelper };
|
|
26
|
+
//# sourceMappingURL=metaHelper.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/helpers/metaHelper.ts
|
|
2
|
+
/**
|
|
3
|
+
* A helper for declaring the `tableMeta`/`columnMeta` type-only slots in the
|
|
4
|
+
* `features` option without a type assertion.
|
|
5
|
+
*
|
|
6
|
+
* Equivalent to `{} as TMeta`, but reads as type-only at the call site and
|
|
7
|
+
* avoids `@typescript-eslint/no-unnecessary-type-assertion` false positives
|
|
8
|
+
* when the meta type has only optional properties (where an auto-fix removing
|
|
9
|
+
* the assertion would silently degrade the inferred meta type to `{}`).
|
|
10
|
+
*
|
|
11
|
+
* The returned value is a phantom — it is ignored and stripped from the
|
|
12
|
+
* table's registered features at runtime; only its type is used.
|
|
13
|
+
* @example
|
|
14
|
+
* ```
|
|
15
|
+
* import { metaHelper, tableFeatures, rowSortingFeature } from '@tanstack/react-table'
|
|
16
|
+
* const features = tableFeatures({
|
|
17
|
+
* rowSortingFeature,
|
|
18
|
+
* tableMeta: metaHelper<MyTableMeta>(),
|
|
19
|
+
* columnMeta: metaHelper<MyColumnMeta>(),
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function metaHelper() {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { metaHelper };
|
|
29
|
+
//# sourceMappingURL=metaHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metaHelper.js","names":[],"sources":["../../src/helpers/metaHelper.ts"],"sourcesContent":["/**\n * A helper for declaring the `tableMeta`/`columnMeta` type-only slots in the\n * `features` option without a type assertion.\n *\n * Equivalent to `{} as TMeta`, but reads as type-only at the call site and\n * avoids `@typescript-eslint/no-unnecessary-type-assertion` false positives\n * when the meta type has only optional properties (where an auto-fix removing\n * the assertion would silently degrade the inferred meta type to `{}`).\n *\n * The returned value is a phantom — it is ignored and stripped from the\n * table's registered features at runtime; only its type is used.\n * @example\n * ```\n * import { metaHelper, tableFeatures, rowSortingFeature } from '@tanstack/react-table'\n * const features = tableFeatures({\n * rowSortingFeature,\n * tableMeta: metaHelper<MyTableMeta>(),\n * columnMeta: metaHelper<MyColumnMeta>(),\n * });\n * ```\n */\nexport function metaHelper<TMeta extends object>(): TMeta {\n return {} as TMeta\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,aAA0C;CACxD,OAAO,CAAC;AACV"}
|
|
@@ -4,10 +4,20 @@
|
|
|
4
4
|
* A helper function to help define the features that are to be imported and applied to a table instance.
|
|
5
5
|
* Use this utility to make it easier to have the correct type inference for the features that are being imported.
|
|
6
6
|
* **Note:** It is recommended to use this utility statically outside of a component.
|
|
7
|
+
*
|
|
8
|
+
* You can also declare per-table `meta` types here with the `tableMeta` and
|
|
9
|
+
* `columnMeta` type-only slots instead of using global declaration merging.
|
|
10
|
+
* The values are phantom (ignored and stripped at runtime) — only their types
|
|
11
|
+
* are used.
|
|
7
12
|
* @example
|
|
8
13
|
* ```
|
|
9
14
|
* import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'
|
|
10
|
-
* const features = tableFeatures({
|
|
15
|
+
* const features = tableFeatures({
|
|
16
|
+
* columnVisibilityFeature,
|
|
17
|
+
* rowPinningFeature,
|
|
18
|
+
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
19
|
+
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
20
|
+
* });
|
|
11
21
|
* const table = useTable({ features, rowModels: {}, columns, data });
|
|
12
22
|
* ```
|
|
13
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableFeatures.cjs","names":[],"sources":["../../src/helpers/tableFeatures.ts"],"sourcesContent":["import type { TableFeatures } from '../types/TableFeatures'\n\n/**\n * A helper function to help define the features that are to be imported and applied to a table instance.\n * Use this utility to make it easier to have the correct type inference for the features that are being imported.\n * **Note:** It is recommended to use this utility statically outside of a component.\n * @example\n * ```\n * import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'\n * const features = tableFeatures({ columnVisibilityFeature
|
|
1
|
+
{"version":3,"file":"tableFeatures.cjs","names":[],"sources":["../../src/helpers/tableFeatures.ts"],"sourcesContent":["import type { TableFeatures } from '../types/TableFeatures'\n\n/**\n * A helper function to help define the features that are to be imported and applied to a table instance.\n * Use this utility to make it easier to have the correct type inference for the features that are being imported.\n * **Note:** It is recommended to use this utility statically outside of a component.\n *\n * You can also declare per-table `meta` types here with the `tableMeta` and\n * `columnMeta` type-only slots instead of using global declaration merging.\n * The values are phantom (ignored and stripped at runtime) — only their types\n * are used.\n * @example\n * ```\n * import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'\n * const features = tableFeatures({\n * columnVisibilityFeature,\n * rowPinningFeature,\n * tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },\n * columnMeta: {} as { align?: 'left' | 'right' },\n * });\n * const table = useTable({ features, rowModels: {}, columns, data });\n * ```\n */\nexport function tableFeatures<TFeatures extends TableFeatures>(\n features: TFeatures,\n): TFeatures {\n return features\n}\n\n// test\n\n// const features = tableFeatures({\n// rowPinningFeature: {},\n// });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,cACd,UACW;CACX,OAAO;AACT"}
|
|
@@ -5,10 +5,20 @@ import { TableFeatures } from "../types/TableFeatures.cjs";
|
|
|
5
5
|
* A helper function to help define the features that are to be imported and applied to a table instance.
|
|
6
6
|
* Use this utility to make it easier to have the correct type inference for the features that are being imported.
|
|
7
7
|
* **Note:** It is recommended to use this utility statically outside of a component.
|
|
8
|
+
*
|
|
9
|
+
* You can also declare per-table `meta` types here with the `tableMeta` and
|
|
10
|
+
* `columnMeta` type-only slots instead of using global declaration merging.
|
|
11
|
+
* The values are phantom (ignored and stripped at runtime) — only their types
|
|
12
|
+
* are used.
|
|
8
13
|
* @example
|
|
9
14
|
* ```
|
|
10
15
|
* import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'
|
|
11
|
-
* const features = tableFeatures({
|
|
16
|
+
* const features = tableFeatures({
|
|
17
|
+
* columnVisibilityFeature,
|
|
18
|
+
* rowPinningFeature,
|
|
19
|
+
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
20
|
+
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
21
|
+
* });
|
|
12
22
|
* const table = useTable({ features, rowModels: {}, columns, data });
|
|
13
23
|
* ```
|
|
14
24
|
*/
|
|
@@ -5,10 +5,20 @@ import { TableFeatures } from "../types/TableFeatures.js";
|
|
|
5
5
|
* A helper function to help define the features that are to be imported and applied to a table instance.
|
|
6
6
|
* Use this utility to make it easier to have the correct type inference for the features that are being imported.
|
|
7
7
|
* **Note:** It is recommended to use this utility statically outside of a component.
|
|
8
|
+
*
|
|
9
|
+
* You can also declare per-table `meta` types here with the `tableMeta` and
|
|
10
|
+
* `columnMeta` type-only slots instead of using global declaration merging.
|
|
11
|
+
* The values are phantom (ignored and stripped at runtime) — only their types
|
|
12
|
+
* are used.
|
|
8
13
|
* @example
|
|
9
14
|
* ```
|
|
10
15
|
* import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'
|
|
11
|
-
* const features = tableFeatures({
|
|
16
|
+
* const features = tableFeatures({
|
|
17
|
+
* columnVisibilityFeature,
|
|
18
|
+
* rowPinningFeature,
|
|
19
|
+
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
20
|
+
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
21
|
+
* });
|
|
12
22
|
* const table = useTable({ features, rowModels: {}, columns, data });
|
|
13
23
|
* ```
|
|
14
24
|
*/
|
|
@@ -3,10 +3,20 @@
|
|
|
3
3
|
* A helper function to help define the features that are to be imported and applied to a table instance.
|
|
4
4
|
* Use this utility to make it easier to have the correct type inference for the features that are being imported.
|
|
5
5
|
* **Note:** It is recommended to use this utility statically outside of a component.
|
|
6
|
+
*
|
|
7
|
+
* You can also declare per-table `meta` types here with the `tableMeta` and
|
|
8
|
+
* `columnMeta` type-only slots instead of using global declaration merging.
|
|
9
|
+
* The values are phantom (ignored and stripped at runtime) — only their types
|
|
10
|
+
* are used.
|
|
6
11
|
* @example
|
|
7
12
|
* ```
|
|
8
13
|
* import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'
|
|
9
|
-
* const features = tableFeatures({
|
|
14
|
+
* const features = tableFeatures({
|
|
15
|
+
* columnVisibilityFeature,
|
|
16
|
+
* rowPinningFeature,
|
|
17
|
+
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
18
|
+
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
19
|
+
* });
|
|
10
20
|
* const table = useTable({ features, rowModels: {}, columns, data });
|
|
11
21
|
* ```
|
|
12
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableFeatures.js","names":[],"sources":["../../src/helpers/tableFeatures.ts"],"sourcesContent":["import type { TableFeatures } from '../types/TableFeatures'\n\n/**\n * A helper function to help define the features that are to be imported and applied to a table instance.\n * Use this utility to make it easier to have the correct type inference for the features that are being imported.\n * **Note:** It is recommended to use this utility statically outside of a component.\n * @example\n * ```\n * import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'\n * const features = tableFeatures({ columnVisibilityFeature
|
|
1
|
+
{"version":3,"file":"tableFeatures.js","names":[],"sources":["../../src/helpers/tableFeatures.ts"],"sourcesContent":["import type { TableFeatures } from '../types/TableFeatures'\n\n/**\n * A helper function to help define the features that are to be imported and applied to a table instance.\n * Use this utility to make it easier to have the correct type inference for the features that are being imported.\n * **Note:** It is recommended to use this utility statically outside of a component.\n *\n * You can also declare per-table `meta` types here with the `tableMeta` and\n * `columnMeta` type-only slots instead of using global declaration merging.\n * The values are phantom (ignored and stripped at runtime) — only their types\n * are used.\n * @example\n * ```\n * import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'\n * const features = tableFeatures({\n * columnVisibilityFeature,\n * rowPinningFeature,\n * tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },\n * columnMeta: {} as { align?: 'left' | 'right' },\n * });\n * const table = useTable({ features, rowModels: {}, columns, data });\n * ```\n */\nexport function tableFeatures<TFeatures extends TableFeatures>(\n features: TFeatures,\n): TFeatures {\n return features\n}\n\n// test\n\n// const features = tableFeatures({\n// rowPinningFeature: {},\n// });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,cACd,UACW;CACX,OAAO;AACT"}
|
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ const require_coreRowsFeature = require('./core/rows/coreRowsFeature.cjs');
|
|
|
14
14
|
const require_coreTablesFeature = require('./core/table/coreTablesFeature.cjs');
|
|
15
15
|
const require_coreFeatures = require('./core/coreFeatures.cjs');
|
|
16
16
|
const require_columnHelper = require('./helpers/columnHelper.cjs');
|
|
17
|
+
const require_metaHelper = require('./helpers/metaHelper.cjs');
|
|
17
18
|
const require_tableFeatures = require('./helpers/tableFeatures.cjs');
|
|
18
19
|
const require_tableOptions = require('./helpers/tableOptions.cjs');
|
|
19
20
|
const require_constructTable = require('./core/table/constructTable.cjs');
|
|
@@ -114,6 +115,7 @@ exports.globalFilteringFeature = require_globalFilteringFeature.globalFilteringF
|
|
|
114
115
|
exports.isFunction = require_utils.isFunction;
|
|
115
116
|
exports.makeStateUpdater = require_utils.makeStateUpdater;
|
|
116
117
|
exports.memo = require_utils.memo;
|
|
118
|
+
exports.metaHelper = require_metaHelper.metaHelper;
|
|
117
119
|
exports.reSplitAlphaNumeric = require_sortFns.reSplitAlphaNumeric;
|
|
118
120
|
exports.rowExpandingFeature = require_rowExpandingFeature.rowExpandingFeature;
|
|
119
121
|
exports.rowPaginationFeature = require_rowPaginationFeature.rowPaginationFeature;
|
package/dist/index.d.cts
CHANGED
|
@@ -27,12 +27,12 @@ import { RowSelectionState, Row_RowSelection, TableOptions_RowSelection, TableSt
|
|
|
27
27
|
import { Row_CoreProperties, Row_Row, TableOptions_Rows, Table_Rows } from "./core/rows/coreRowsFeature.types.cjs";
|
|
28
28
|
import { Row, Row_Core, Row_FeatureMap } from "./types/Row.cjs";
|
|
29
29
|
import { CellContext, Cell_Cell, Cell_CoreProperties, TableOptions_Cell } from "./core/cells/coreCellsFeature.types.cjs";
|
|
30
|
-
import { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader } from "./types/ColumnDef.cjs";
|
|
30
|
+
import { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, ExtractColumnMeta, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader } from "./types/ColumnDef.cjs";
|
|
31
31
|
import { RowModelFns, RowModelFns_All, RowModelFns_Core, RowModelFns_FeatureMap } from "./types/RowModelFns.cjs";
|
|
32
32
|
import { CachedRowModel_Paginated, CreateRowModel_Paginated, PaginationDefaultOptions, PaginationState, TableOptions_RowPagination, TableState_RowPagination, Table_RowModels_Paginated, Table_RowPagination } from "./features/row-pagination/rowPaginationFeature.types.cjs";
|
|
33
33
|
import { CachedRowModel_All, CachedRowModels, CachedRowModels_FeatureMap, CreateRowModels, CreateRowModels_All, CreateRowModels_FeatureMap } from "./types/RowModel.cjs";
|
|
34
34
|
import { TableState, TableState_All, TableState_FeatureMap } from "./types/TableState.cjs";
|
|
35
|
-
import { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table } from "./core/table/coreTablesFeature.types.cjs";
|
|
35
|
+
import { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, ExtractTableMeta, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table } from "./core/table/coreTablesFeature.types.cjs";
|
|
36
36
|
import { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap, TableOptions_FeatureMap_All } from "./types/TableOptions.cjs";
|
|
37
37
|
import { columnFacetingFeature } from "./features/column-faceting/columnFacetingFeature.cjs";
|
|
38
38
|
import { columnFilteringFeature } from "./features/column-filtering/columnFilteringFeature.cjs";
|
|
@@ -49,7 +49,7 @@ import { rowPinningFeature } from "./features/row-pinning/rowPinningFeature.cjs"
|
|
|
49
49
|
import { rowSelectionFeature } from "./features/row-selection/rowSelectionFeature.cjs";
|
|
50
50
|
import { rowSortingFeature } from "./features/row-sorting/rowSortingFeature.cjs";
|
|
51
51
|
import { StockFeatures, stockFeatures } from "./features/stockFeatures.cjs";
|
|
52
|
-
import { ExtractFeatureMapTypes, Plugins, TableFeature, TableFeatures } from "./types/TableFeatures.cjs";
|
|
52
|
+
import { ExtractFeatureMapTypes, IsAny, Plugins, TableFeature, TableFeatures } from "./types/TableFeatures.cjs";
|
|
53
53
|
import { CachedRowModel_Faceted, Column_ColumnFaceting, CreateRowModel_Faceted, Table_ColumnFaceting, Table_RowModels_Faceted } from "./features/column-faceting/columnFacetingFeature.types.cjs";
|
|
54
54
|
import { Table, Table_Core, Table_FeatureMap, Table_Internal } from "./types/Table.cjs";
|
|
55
55
|
import { CachedRowModel_Core, CreateRowModel_Core, RowModel, Table_RowModels, Table_RowModels_Core } from "./core/row-models/coreRowModelsFeature.types.cjs";
|
|
@@ -57,6 +57,7 @@ import { BuiltInAggregationFn, aggregationFn_count, aggregationFn_extent, aggreg
|
|
|
57
57
|
import { AggregationFn, AggregationFnOption, AggregationFns, CachedRowModel_Grouped, Cell_ColumnGrouping, ColumnDef_ColumnGrouping, ColumnDefaultOptions, Column_ColumnGrouping, CreateRowModel_Grouped, CustomAggregationFns, GroupingColumnMode, GroupingState, RowModelFns_ColumnGrouping, Row_ColumnGrouping, TableOptions_ColumnGrouping, TableState_ColumnGrouping, Table_ColumnGrouping, Table_RowModels_Grouped } from "./features/column-grouping/columnGroupingFeature.types.cjs";
|
|
58
58
|
import { Cell, Cell_Core, Cell_FeatureMap } from "./types/Cell.cjs";
|
|
59
59
|
import { ColumnHelper, createColumnHelper } from "./helpers/columnHelper.cjs";
|
|
60
|
+
import { metaHelper } from "./helpers/metaHelper.cjs";
|
|
60
61
|
import { tableFeatures } from "./helpers/tableFeatures.cjs";
|
|
61
62
|
import { tableOptions } from "./helpers/tableOptions.cjs";
|
|
62
63
|
import { API, APIObject, PrototypeAPI, PrototypeAPIObject, assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, flattenBy, functionalUpdate, getFunctionNameInfo, isFunction, makeStateUpdater, memo, tableMemo } from "./utils.cjs";
|
|
@@ -75,4 +76,4 @@ import { createGroupedRowModel } from "./features/column-grouping/createGroupedR
|
|
|
75
76
|
import { createExpandedRowModel, expandRows } from "./features/row-expanding/createExpandedRowModel.cjs";
|
|
76
77
|
import { createPaginatedRowModel } from "./features/row-pagination/createPaginatedRowModel.cjs";
|
|
77
78
|
import { createSortedRowModel } from "./features/row-sorting/createSortedRowModel.cjs";
|
|
78
|
-
export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationFn, AggregationFnOption, AggregationFns, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, Cell_Cell, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Column, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnMeta, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_Internal, Column_RowSorting, CoreFeatures, CreateRowModel_Core, CreateRowModel_Expanded, CreateRowModel_Faceted, CreateRowModel_Filtered, CreateRowModel_Grouped, CreateRowModel_Paginated, CreateRowModel_Sorted, CreateRowModels, CreateRowModels_All, CreateRowModels_FeatureMap, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractFeatureMapTypes, FilterFn, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, NoInfer, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_ColumnGrouping, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SortDirection, SortFn, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_FeatureMap_All, TableOptions_GlobalFiltering, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_Internal, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, TransformFilterValueFn, UnionToIntersection, Updater, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, isFunction, makeStateUpdater, memo, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
|
79
|
+
export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationFn, AggregationFnOption, AggregationFns, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, Cell_Cell, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Column, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnMeta, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_Internal, Column_RowSorting, CoreFeatures, CreateRowModel_Core, CreateRowModel_Expanded, CreateRowModel_Faceted, CreateRowModel_Filtered, CreateRowModel_Grouped, CreateRowModel_Paginated, CreateRowModel_Sorted, CreateRowModels, CreateRowModels_All, CreateRowModels_FeatureMap, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractColumnMeta, ExtractFeatureMapTypes, ExtractTableMeta, FilterFn, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, IsAny, NoInfer, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_ColumnGrouping, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SortDirection, SortFn, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_FeatureMap_All, TableOptions_GlobalFiltering, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_Internal, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, TransformFilterValueFn, UnionToIntersection, Updater, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, isFunction, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,12 +27,12 @@ import { RowSelectionState, Row_RowSelection, TableOptions_RowSelection, TableSt
|
|
|
27
27
|
import { Row_CoreProperties, Row_Row, TableOptions_Rows, Table_Rows } from "./core/rows/coreRowsFeature.types.js";
|
|
28
28
|
import { Row, Row_Core, Row_FeatureMap } from "./types/Row.js";
|
|
29
29
|
import { CellContext, Cell_Cell, Cell_CoreProperties, TableOptions_Cell } from "./core/cells/coreCellsFeature.types.js";
|
|
30
|
-
import { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader } from "./types/ColumnDef.js";
|
|
30
|
+
import { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, ExtractColumnMeta, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader } from "./types/ColumnDef.js";
|
|
31
31
|
import { RowModelFns, RowModelFns_All, RowModelFns_Core, RowModelFns_FeatureMap } from "./types/RowModelFns.js";
|
|
32
32
|
import { CachedRowModel_Paginated, CreateRowModel_Paginated, PaginationDefaultOptions, PaginationState, TableOptions_RowPagination, TableState_RowPagination, Table_RowModels_Paginated, Table_RowPagination } from "./features/row-pagination/rowPaginationFeature.types.js";
|
|
33
33
|
import { CachedRowModel_All, CachedRowModels, CachedRowModels_FeatureMap, CreateRowModels, CreateRowModels_All, CreateRowModels_FeatureMap } from "./types/RowModel.js";
|
|
34
34
|
import { TableState, TableState_All, TableState_FeatureMap } from "./types/TableState.js";
|
|
35
|
-
import { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table } from "./core/table/coreTablesFeature.types.js";
|
|
35
|
+
import { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, ExtractTableMeta, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table } from "./core/table/coreTablesFeature.types.js";
|
|
36
36
|
import { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap, TableOptions_FeatureMap_All } from "./types/TableOptions.js";
|
|
37
37
|
import { columnFacetingFeature } from "./features/column-faceting/columnFacetingFeature.js";
|
|
38
38
|
import { columnFilteringFeature } from "./features/column-filtering/columnFilteringFeature.js";
|
|
@@ -49,7 +49,7 @@ import { rowPinningFeature } from "./features/row-pinning/rowPinningFeature.js";
|
|
|
49
49
|
import { rowSelectionFeature } from "./features/row-selection/rowSelectionFeature.js";
|
|
50
50
|
import { rowSortingFeature } from "./features/row-sorting/rowSortingFeature.js";
|
|
51
51
|
import { StockFeatures, stockFeatures } from "./features/stockFeatures.js";
|
|
52
|
-
import { ExtractFeatureMapTypes, Plugins, TableFeature, TableFeatures } from "./types/TableFeatures.js";
|
|
52
|
+
import { ExtractFeatureMapTypes, IsAny, Plugins, TableFeature, TableFeatures } from "./types/TableFeatures.js";
|
|
53
53
|
import { CachedRowModel_Faceted, Column_ColumnFaceting, CreateRowModel_Faceted, Table_ColumnFaceting, Table_RowModels_Faceted } from "./features/column-faceting/columnFacetingFeature.types.js";
|
|
54
54
|
import { Table, Table_Core, Table_FeatureMap, Table_Internal } from "./types/Table.js";
|
|
55
55
|
import { CachedRowModel_Core, CreateRowModel_Core, RowModel, Table_RowModels, Table_RowModels_Core } from "./core/row-models/coreRowModelsFeature.types.js";
|
|
@@ -57,6 +57,7 @@ import { BuiltInAggregationFn, aggregationFn_count, aggregationFn_extent, aggreg
|
|
|
57
57
|
import { AggregationFn, AggregationFnOption, AggregationFns, CachedRowModel_Grouped, Cell_ColumnGrouping, ColumnDef_ColumnGrouping, ColumnDefaultOptions, Column_ColumnGrouping, CreateRowModel_Grouped, CustomAggregationFns, GroupingColumnMode, GroupingState, RowModelFns_ColumnGrouping, Row_ColumnGrouping, TableOptions_ColumnGrouping, TableState_ColumnGrouping, Table_ColumnGrouping, Table_RowModels_Grouped } from "./features/column-grouping/columnGroupingFeature.types.js";
|
|
58
58
|
import { Cell, Cell_Core, Cell_FeatureMap } from "./types/Cell.js";
|
|
59
59
|
import { ColumnHelper, createColumnHelper } from "./helpers/columnHelper.js";
|
|
60
|
+
import { metaHelper } from "./helpers/metaHelper.js";
|
|
60
61
|
import { tableFeatures } from "./helpers/tableFeatures.js";
|
|
61
62
|
import { tableOptions } from "./helpers/tableOptions.js";
|
|
62
63
|
import { API, APIObject, PrototypeAPI, PrototypeAPIObject, assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, flattenBy, functionalUpdate, getFunctionNameInfo, isFunction, makeStateUpdater, memo, tableMemo } from "./utils.js";
|
|
@@ -75,4 +76,4 @@ import { createGroupedRowModel } from "./features/column-grouping/createGroupedR
|
|
|
75
76
|
import { createExpandedRowModel, expandRows } from "./features/row-expanding/createExpandedRowModel.js";
|
|
76
77
|
import { createPaginatedRowModel } from "./features/row-pagination/createPaginatedRowModel.js";
|
|
77
78
|
import { createSortedRowModel } from "./features/row-sorting/createSortedRowModel.js";
|
|
78
|
-
export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationFn, AggregationFnOption, AggregationFns, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, Cell_Cell, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Column, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnMeta, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_Internal, Column_RowSorting, CoreFeatures, CreateRowModel_Core, CreateRowModel_Expanded, CreateRowModel_Faceted, CreateRowModel_Filtered, CreateRowModel_Grouped, CreateRowModel_Paginated, CreateRowModel_Sorted, CreateRowModels, CreateRowModels_All, CreateRowModels_FeatureMap, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractFeatureMapTypes, FilterFn, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, NoInfer, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_ColumnGrouping, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SortDirection, SortFn, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_FeatureMap_All, TableOptions_GlobalFiltering, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_Internal, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, TransformFilterValueFn, UnionToIntersection, Updater, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, isFunction, makeStateUpdater, memo, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
|
79
|
+
export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationFn, AggregationFnOption, AggregationFns, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, Cell_Cell, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Column, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnMeta, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_Internal, Column_RowSorting, CoreFeatures, CreateRowModel_Core, CreateRowModel_Expanded, CreateRowModel_Faceted, CreateRowModel_Filtered, CreateRowModel_Grouped, CreateRowModel_Paginated, CreateRowModel_Sorted, CreateRowModels, CreateRowModels_All, CreateRowModels_FeatureMap, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractColumnMeta, ExtractFeatureMapTypes, ExtractTableMeta, FilterFn, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, IsAny, NoInfer, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_ColumnGrouping, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SortDirection, SortFn, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_FeatureMap_All, TableOptions_GlobalFiltering, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_Internal, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, TransformFilterValueFn, UnionToIntersection, Updater, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, isFunction, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { coreRowsFeature } from "./core/rows/coreRowsFeature.js";
|
|
|
13
13
|
import { coreTablesFeature } from "./core/table/coreTablesFeature.js";
|
|
14
14
|
import { coreFeatures } from "./core/coreFeatures.js";
|
|
15
15
|
import { createColumnHelper } from "./helpers/columnHelper.js";
|
|
16
|
+
import { metaHelper } from "./helpers/metaHelper.js";
|
|
16
17
|
import { tableFeatures } from "./helpers/tableFeatures.js";
|
|
17
18
|
import { tableOptions } from "./helpers/tableOptions.js";
|
|
18
19
|
import { constructTable, getInitialTableState } from "./core/table/constructTable.js";
|
|
@@ -43,4 +44,4 @@ import { createExpandedRowModel, expandRows } from "./features/row-expanding/cre
|
|
|
43
44
|
import { createPaginatedRowModel } from "./features/row-pagination/createPaginatedRowModel.js";
|
|
44
45
|
import { createSortedRowModel } from "./features/row-sorting/createSortedRowModel.js";
|
|
45
46
|
|
|
46
|
-
export { aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, isFunction, makeStateUpdater, memo, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
|
47
|
+
export { aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, isFunction, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
|
@@ -8,11 +8,22 @@ import { ColumnDef_ColumnPinning } from "../features/column-pinning/columnPinnin
|
|
|
8
8
|
import { ColumnDef_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
|
|
9
9
|
import { ColumnDef_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
|
|
10
10
|
import { CellContext } from "../core/cells/coreCellsFeature.types.cjs";
|
|
11
|
-
import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
|
|
11
|
+
import { ExtractFeatureMapTypes, IsAny, TableFeatures } from "./TableFeatures.cjs";
|
|
12
12
|
import { ColumnDef_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
13
13
|
|
|
14
14
|
//#region src/types/ColumnDef.d.ts
|
|
15
15
|
interface ColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the type of `columnDef.meta` for a feature set.
|
|
18
|
+
*
|
|
19
|
+
* When the features object declares a `columnMeta` type-only slot
|
|
20
|
+
* (`tableFeatures({ ..., columnMeta: {} as MyColumnMeta })`), that type wins.
|
|
21
|
+
* Otherwise this falls back to the global declaration-merged `ColumnMeta`
|
|
22
|
+
* interface.
|
|
23
|
+
*/
|
|
24
|
+
type ExtractColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = IsAny<TFeatures> extends true ? ColumnMeta<TFeatures, TData, TValue> : TFeatures extends {
|
|
25
|
+
columnMeta: infer TMeta extends object;
|
|
26
|
+
} ? TMeta : ColumnMeta<TFeatures, TData, TValue>;
|
|
16
27
|
/**
|
|
17
28
|
* Reads a cell value from an original row object.
|
|
18
29
|
*
|
|
@@ -66,8 +77,11 @@ interface ColumnDefBase_Core<TFeatures extends TableFeatures, TData extends RowD
|
|
|
66
77
|
cell?: ColumnDefTemplate<CellContext<TFeatures, TData, TValue>>;
|
|
67
78
|
/**
|
|
68
79
|
* User-defined metadata available on the resolved column definition.
|
|
80
|
+
*
|
|
81
|
+
* Declare its type per-table via the `columnMeta` type-only slot on the
|
|
82
|
+
* `features` option, or globally via declaration merging on `ColumnMeta`.
|
|
69
83
|
*/
|
|
70
|
-
meta?:
|
|
84
|
+
meta?: ExtractColumnMeta<TFeatures, TData, TValue>;
|
|
71
85
|
}
|
|
72
86
|
interface ColumnDef_FeatureMap<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData> {
|
|
73
87
|
columnVisibilityFeature: ColumnDef_ColumnVisibility;
|
|
@@ -105,5 +119,5 @@ type ColumnDefResolved<TFeatures extends TableFeatures, TData extends RowData, T
|
|
|
105
119
|
accessorKey?: string;
|
|
106
120
|
};
|
|
107
121
|
//#endregion
|
|
108
|
-
export { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader };
|
|
122
|
+
export { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, ExtractColumnMeta, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader };
|
|
109
123
|
//# sourceMappingURL=ColumnDef.d.cts.map
|
|
@@ -8,11 +8,22 @@ import { ColumnDef_ColumnPinning } from "../features/column-pinning/columnPinnin
|
|
|
8
8
|
import { ColumnDef_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
|
|
9
9
|
import { ColumnDef_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
|
|
10
10
|
import { CellContext } from "../core/cells/coreCellsFeature.types.js";
|
|
11
|
-
import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
|
|
11
|
+
import { ExtractFeatureMapTypes, IsAny, TableFeatures } from "./TableFeatures.js";
|
|
12
12
|
import { ColumnDef_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
13
13
|
|
|
14
14
|
//#region src/types/ColumnDef.d.ts
|
|
15
15
|
interface ColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the type of `columnDef.meta` for a feature set.
|
|
18
|
+
*
|
|
19
|
+
* When the features object declares a `columnMeta` type-only slot
|
|
20
|
+
* (`tableFeatures({ ..., columnMeta: {} as MyColumnMeta })`), that type wins.
|
|
21
|
+
* Otherwise this falls back to the global declaration-merged `ColumnMeta`
|
|
22
|
+
* interface.
|
|
23
|
+
*/
|
|
24
|
+
type ExtractColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = IsAny<TFeatures> extends true ? ColumnMeta<TFeatures, TData, TValue> : TFeatures extends {
|
|
25
|
+
columnMeta: infer TMeta extends object;
|
|
26
|
+
} ? TMeta : ColumnMeta<TFeatures, TData, TValue>;
|
|
16
27
|
/**
|
|
17
28
|
* Reads a cell value from an original row object.
|
|
18
29
|
*
|
|
@@ -66,8 +77,11 @@ interface ColumnDefBase_Core<TFeatures extends TableFeatures, TData extends RowD
|
|
|
66
77
|
cell?: ColumnDefTemplate<CellContext<TFeatures, TData, TValue>>;
|
|
67
78
|
/**
|
|
68
79
|
* User-defined metadata available on the resolved column definition.
|
|
80
|
+
*
|
|
81
|
+
* Declare its type per-table via the `columnMeta` type-only slot on the
|
|
82
|
+
* `features` option, or globally via declaration merging on `ColumnMeta`.
|
|
69
83
|
*/
|
|
70
|
-
meta?:
|
|
84
|
+
meta?: ExtractColumnMeta<TFeatures, TData, TValue>;
|
|
71
85
|
}
|
|
72
86
|
interface ColumnDef_FeatureMap<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData> {
|
|
73
87
|
columnVisibilityFeature: ColumnDef_ColumnVisibility;
|
|
@@ -105,5 +119,5 @@ type ColumnDefResolved<TFeatures extends TableFeatures, TData extends RowData, T
|
|
|
105
119
|
accessorKey?: string;
|
|
106
120
|
};
|
|
107
121
|
//#endregion
|
|
108
|
-
export { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader };
|
|
122
|
+
export { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, ExtractColumnMeta, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader };
|
|
109
123
|
//# sourceMappingURL=ColumnDef.d.ts.map
|
|
@@ -12,7 +12,29 @@ type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
|
12
12
|
type UnionToIntersectionOrEmpty<T> = [T] extends [never] ? {} : UnionToIntersection<T> & {};
|
|
13
13
|
type ExtractFeatureMapTypes<TFeatures extends TableFeatures, TFeatureMap extends object> = IsAny<TFeatures> extends true ? UnionToIntersection<TFeatureMap[keyof TFeatureMap]> : UnionToIntersectionOrEmpty<TFeatureMap[Extract<keyof TFeatures, keyof TFeatureMap>]>;
|
|
14
14
|
interface Plugins {}
|
|
15
|
-
interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, Partial<Plugins> {
|
|
15
|
+
interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, Partial<Plugins> {
|
|
16
|
+
/**
|
|
17
|
+
* Type-only slot for declaring the type of this table's `options.meta`.
|
|
18
|
+
*
|
|
19
|
+
* Pass a phantom value: `tableMeta: {} as MyTableMeta`. The value itself is
|
|
20
|
+
* ignored and stripped from the table's registered features at runtime — only
|
|
21
|
+
* its type is used, inferred wherever `TFeatures` flows.
|
|
22
|
+
*
|
|
23
|
+
* When omitted, the global declaration-merged `TableMeta` interface applies.
|
|
24
|
+
*/
|
|
25
|
+
tableMeta?: object;
|
|
26
|
+
/**
|
|
27
|
+
* Type-only slot for declaring the type of `columnDef.meta` for all columns
|
|
28
|
+
* of this table.
|
|
29
|
+
*
|
|
30
|
+
* Pass a phantom value: `columnMeta: {} as MyColumnMeta`. The value itself is
|
|
31
|
+
* ignored and stripped from the table's registered features at runtime — only
|
|
32
|
+
* its type is used, inferred wherever `TFeatures` flows.
|
|
33
|
+
*
|
|
34
|
+
* When omitted, the global declaration-merged `ColumnMeta` interface applies.
|
|
35
|
+
*/
|
|
36
|
+
columnMeta?: object;
|
|
37
|
+
}
|
|
16
38
|
interface TableFeature {
|
|
17
39
|
/**
|
|
18
40
|
* Assigns Cell APIs to the cell prototype for memory-efficient method sharing.
|
|
@@ -49,5 +71,5 @@ interface TableFeature {
|
|
|
49
71
|
initRowInstanceData?: <TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>) => void;
|
|
50
72
|
}
|
|
51
73
|
//#endregion
|
|
52
|
-
export { ExtractFeatureMapTypes, Plugins, TableFeature, TableFeatures };
|
|
74
|
+
export { ExtractFeatureMapTypes, IsAny, Plugins, TableFeature, TableFeatures };
|
|
53
75
|
//# sourceMappingURL=TableFeatures.d.cts.map
|
|
@@ -12,7 +12,29 @@ type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
|
12
12
|
type UnionToIntersectionOrEmpty<T> = [T] extends [never] ? {} : UnionToIntersection<T> & {};
|
|
13
13
|
type ExtractFeatureMapTypes<TFeatures extends TableFeatures, TFeatureMap extends object> = IsAny<TFeatures> extends true ? UnionToIntersection<TFeatureMap[keyof TFeatureMap]> : UnionToIntersectionOrEmpty<TFeatureMap[Extract<keyof TFeatures, keyof TFeatureMap>]>;
|
|
14
14
|
interface Plugins {}
|
|
15
|
-
interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, Partial<Plugins> {
|
|
15
|
+
interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, Partial<Plugins> {
|
|
16
|
+
/**
|
|
17
|
+
* Type-only slot for declaring the type of this table's `options.meta`.
|
|
18
|
+
*
|
|
19
|
+
* Pass a phantom value: `tableMeta: {} as MyTableMeta`. The value itself is
|
|
20
|
+
* ignored and stripped from the table's registered features at runtime — only
|
|
21
|
+
* its type is used, inferred wherever `TFeatures` flows.
|
|
22
|
+
*
|
|
23
|
+
* When omitted, the global declaration-merged `TableMeta` interface applies.
|
|
24
|
+
*/
|
|
25
|
+
tableMeta?: object;
|
|
26
|
+
/**
|
|
27
|
+
* Type-only slot for declaring the type of `columnDef.meta` for all columns
|
|
28
|
+
* of this table.
|
|
29
|
+
*
|
|
30
|
+
* Pass a phantom value: `columnMeta: {} as MyColumnMeta`. The value itself is
|
|
31
|
+
* ignored and stripped from the table's registered features at runtime — only
|
|
32
|
+
* its type is used, inferred wherever `TFeatures` flows.
|
|
33
|
+
*
|
|
34
|
+
* When omitted, the global declaration-merged `ColumnMeta` interface applies.
|
|
35
|
+
*/
|
|
36
|
+
columnMeta?: object;
|
|
37
|
+
}
|
|
16
38
|
interface TableFeature {
|
|
17
39
|
/**
|
|
18
40
|
* Assigns Cell APIs to the cell prototype for memory-efficient method sharing.
|
|
@@ -49,5 +71,5 @@ interface TableFeature {
|
|
|
49
71
|
initRowInstanceData?: <TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>) => void;
|
|
50
72
|
}
|
|
51
73
|
//#endregion
|
|
52
|
-
export { ExtractFeatureMapTypes, Plugins, TableFeature, TableFeatures };
|
|
74
|
+
export { ExtractFeatureMapTypes, IsAny, Plugins, TableFeature, TableFeatures };
|
|
53
75
|
//# sourceMappingURL=TableFeatures.d.ts.map
|
|
@@ -25,7 +25,7 @@ import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnG
|
|
|
25
25
|
* options are mixed in.
|
|
26
26
|
*/
|
|
27
27
|
interface TableOptions_Core<TFeatures extends TableFeatures, TData extends RowData> extends TableOptions_Table<TFeatures, TData>, TableOptions_Cell, TableOptions_Columns<TFeatures, TData>, TableOptions_Rows<TFeatures, TData> {}
|
|
28
|
-
type DebugKeysFor<TFeatures extends TableFeatures> = { [K in keyof TFeatures & string as `debug${Capitalize<K>}`]?: boolean };
|
|
28
|
+
type DebugKeysFor<TFeatures extends TableFeatures> = { [K in Exclude<keyof TFeatures & string, 'tableMeta' | 'columnMeta'> as `debug${Capitalize<K>}`]?: boolean };
|
|
29
29
|
type DebugOptions<TFeatures extends TableFeatures> = {
|
|
30
30
|
debugAll?: boolean;
|
|
31
31
|
debugCache?: boolean;
|
|
@@ -25,7 +25,7 @@ import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnG
|
|
|
25
25
|
* options are mixed in.
|
|
26
26
|
*/
|
|
27
27
|
interface TableOptions_Core<TFeatures extends TableFeatures, TData extends RowData> extends TableOptions_Table<TFeatures, TData>, TableOptions_Cell, TableOptions_Columns<TFeatures, TData>, TableOptions_Rows<TFeatures, TData> {}
|
|
28
|
-
type DebugKeysFor<TFeatures extends TableFeatures> = { [K in keyof TFeatures & string as `debug${Capitalize<K>}`]?: boolean };
|
|
28
|
+
type DebugKeysFor<TFeatures extends TableFeatures> = { [K in Exclude<keyof TFeatures & string, 'tableMeta' | 'columnMeta'> as `debug${Capitalize<K>}`]?: boolean };
|
|
29
29
|
type DebugOptions<TFeatures extends TableFeatures> = {
|
|
30
30
|
debugAll?: boolean;
|
|
31
31
|
debugCache?: boolean;
|
package/package.json
CHANGED
|
@@ -35,9 +35,16 @@ export function constructTable<
|
|
|
35
35
|
>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {
|
|
36
36
|
const _reactivity = tableOptions.features.coreReactivityFeature!
|
|
37
37
|
|
|
38
|
+
// `tableMeta`/`columnMeta` are type-only slots, not real features
|
|
39
|
+
const {
|
|
40
|
+
columnMeta: _columnMeta,
|
|
41
|
+
tableMeta: _tableMeta,
|
|
42
|
+
...features
|
|
43
|
+
} = tableOptions.features
|
|
44
|
+
|
|
38
45
|
const table = {
|
|
39
46
|
_reactivity,
|
|
40
|
-
_features: { ...coreFeatures, ...
|
|
47
|
+
_features: { ...coreFeatures, ...features },
|
|
41
48
|
_rowModels: {},
|
|
42
49
|
_rowModelFns: {},
|
|
43
50
|
baseAtoms: {},
|
|
@@ -3,7 +3,7 @@ import type { Atom, ReadonlyAtom, ReadonlyStore } from '@tanstack/store'
|
|
|
3
3
|
import type { CoreFeatures } from '../coreFeatures'
|
|
4
4
|
import type { RowModelFns } from '../../types/RowModelFns'
|
|
5
5
|
import type { RowData, Updater } from '../../types/type-utils'
|
|
6
|
-
import type { TableFeatures } from '../../types/TableFeatures'
|
|
6
|
+
import type { IsAny, TableFeatures } from '../../types/TableFeatures'
|
|
7
7
|
import type { CachedRowModels, CreateRowModels_All } from '../../types/RowModel'
|
|
8
8
|
import type { TableOptions } from '../../types/TableOptions'
|
|
9
9
|
import type { TableState, TableState_All } from '../../types/TableState'
|
|
@@ -13,6 +13,24 @@ export interface TableMeta<
|
|
|
13
13
|
TData extends RowData,
|
|
14
14
|
> {}
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the type of `options.meta` for a feature set.
|
|
18
|
+
*
|
|
19
|
+
* When the features object declares a `tableMeta` type-only slot
|
|
20
|
+
* (`tableFeatures({ ..., tableMeta: {} as MyTableMeta })`), that type wins.
|
|
21
|
+
* Otherwise this falls back to the global declaration-merged `TableMeta`
|
|
22
|
+
* interface.
|
|
23
|
+
*/
|
|
24
|
+
export type ExtractTableMeta<
|
|
25
|
+
TFeatures extends TableFeatures,
|
|
26
|
+
TData extends RowData,
|
|
27
|
+
> =
|
|
28
|
+
IsAny<TFeatures> extends true
|
|
29
|
+
? TableMeta<TFeatures, TData>
|
|
30
|
+
: TFeatures extends { tableMeta: infer TMeta extends object }
|
|
31
|
+
? TMeta
|
|
32
|
+
: TableMeta<TFeatures, TData>
|
|
33
|
+
|
|
16
34
|
/**
|
|
17
35
|
* A map of writable atoms, one per `TableState` slice. These are the internal
|
|
18
36
|
* writable atoms that the library always writes to via `makeStateUpdater`.
|
|
@@ -116,8 +134,11 @@ export interface TableOptions_Table<
|
|
|
116
134
|
) => TableOptions<TFeatures, TData>
|
|
117
135
|
/**
|
|
118
136
|
* You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.
|
|
137
|
+
*
|
|
138
|
+
* Declare its type per-table via the `tableMeta` type-only slot on the
|
|
139
|
+
* `features` option, or globally via declaration merging on `TableMeta`.
|
|
119
140
|
*/
|
|
120
|
-
readonly meta?:
|
|
141
|
+
readonly meta?: ExtractTableMeta<TFeatures, TData>
|
|
121
142
|
/**
|
|
122
143
|
* Optionally provide externally managed values for individual state slices.
|
|
123
144
|
*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A helper for declaring the `tableMeta`/`columnMeta` type-only slots in the
|
|
3
|
+
* `features` option without a type assertion.
|
|
4
|
+
*
|
|
5
|
+
* Equivalent to `{} as TMeta`, but reads as type-only at the call site and
|
|
6
|
+
* avoids `@typescript-eslint/no-unnecessary-type-assertion` false positives
|
|
7
|
+
* when the meta type has only optional properties (where an auto-fix removing
|
|
8
|
+
* the assertion would silently degrade the inferred meta type to `{}`).
|
|
9
|
+
*
|
|
10
|
+
* The returned value is a phantom — it is ignored and stripped from the
|
|
11
|
+
* table's registered features at runtime; only its type is used.
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* import { metaHelper, tableFeatures, rowSortingFeature } from '@tanstack/react-table'
|
|
15
|
+
* const features = tableFeatures({
|
|
16
|
+
* rowSortingFeature,
|
|
17
|
+
* tableMeta: metaHelper<MyTableMeta>(),
|
|
18
|
+
* columnMeta: metaHelper<MyColumnMeta>(),
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function metaHelper<TMeta extends object>(): TMeta {
|
|
23
|
+
return {} as TMeta
|
|
24
|
+
}
|
|
@@ -4,10 +4,20 @@ import type { TableFeatures } from '../types/TableFeatures'
|
|
|
4
4
|
* A helper function to help define the features that are to be imported and applied to a table instance.
|
|
5
5
|
* Use this utility to make it easier to have the correct type inference for the features that are being imported.
|
|
6
6
|
* **Note:** It is recommended to use this utility statically outside of a component.
|
|
7
|
+
*
|
|
8
|
+
* You can also declare per-table `meta` types here with the `tableMeta` and
|
|
9
|
+
* `columnMeta` type-only slots instead of using global declaration merging.
|
|
10
|
+
* The values are phantom (ignored and stripped at runtime) — only their types
|
|
11
|
+
* are used.
|
|
7
12
|
* @example
|
|
8
13
|
* ```
|
|
9
14
|
* import { tableFeatures, columnVisibilityFeature, rowPinningFeature } from '@tanstack/react-table'
|
|
10
|
-
* const features = tableFeatures({
|
|
15
|
+
* const features = tableFeatures({
|
|
16
|
+
* columnVisibilityFeature,
|
|
17
|
+
* rowPinningFeature,
|
|
18
|
+
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
19
|
+
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
20
|
+
* });
|
|
11
21
|
* const table = useTable({ features, rowModels: {}, columns, data });
|
|
12
22
|
* ```
|
|
13
23
|
*/
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from './types/type-utils'
|
|
|
22
22
|
|
|
23
23
|
export * from './core/coreFeatures'
|
|
24
24
|
export * from './helpers/columnHelper'
|
|
25
|
+
export * from './helpers/metaHelper'
|
|
25
26
|
export * from './helpers/tableFeatures'
|
|
26
27
|
export * from './helpers/tableOptions'
|
|
27
28
|
export * from './utils'
|
package/src/types/ColumnDef.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { CellData, RowData, UnionToIntersection } from './type-utils'
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
ExtractFeatureMapTypes,
|
|
4
|
+
IsAny,
|
|
5
|
+
TableFeatures,
|
|
6
|
+
} from './TableFeatures'
|
|
3
7
|
import type { CellContext } from '../core/cells/coreCellsFeature.types'
|
|
4
8
|
import type { HeaderContext } from '../core/headers/coreHeadersFeature.types'
|
|
5
9
|
import type { ColumnDef_ColumnFiltering } from '../features/column-filtering/columnFilteringFeature.types'
|
|
@@ -17,6 +21,25 @@ export interface ColumnMeta<
|
|
|
17
21
|
TValue extends CellData = CellData,
|
|
18
22
|
> {}
|
|
19
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the type of `columnDef.meta` for a feature set.
|
|
26
|
+
*
|
|
27
|
+
* When the features object declares a `columnMeta` type-only slot
|
|
28
|
+
* (`tableFeatures({ ..., columnMeta: {} as MyColumnMeta })`), that type wins.
|
|
29
|
+
* Otherwise this falls back to the global declaration-merged `ColumnMeta`
|
|
30
|
+
* interface.
|
|
31
|
+
*/
|
|
32
|
+
export type ExtractColumnMeta<
|
|
33
|
+
TFeatures extends TableFeatures,
|
|
34
|
+
TData extends RowData,
|
|
35
|
+
TValue extends CellData = CellData,
|
|
36
|
+
> =
|
|
37
|
+
IsAny<TFeatures> extends true
|
|
38
|
+
? ColumnMeta<TFeatures, TData, TValue>
|
|
39
|
+
: TFeatures extends { columnMeta: infer TMeta extends object }
|
|
40
|
+
? TMeta
|
|
41
|
+
: ColumnMeta<TFeatures, TData, TValue>
|
|
42
|
+
|
|
20
43
|
/**
|
|
21
44
|
* Reads a cell value from an original row object.
|
|
22
45
|
*
|
|
@@ -96,8 +119,11 @@ interface ColumnDefBase_Core<
|
|
|
96
119
|
cell?: ColumnDefTemplate<CellContext<TFeatures, TData, TValue>>
|
|
97
120
|
/**
|
|
98
121
|
* User-defined metadata available on the resolved column definition.
|
|
122
|
+
*
|
|
123
|
+
* Declare its type per-table via the `columnMeta` type-only slot on the
|
|
124
|
+
* `features` option, or globally via declaration merging on `ColumnMeta`.
|
|
99
125
|
*/
|
|
100
|
-
meta?:
|
|
126
|
+
meta?: ExtractColumnMeta<TFeatures, TData, TValue>
|
|
101
127
|
}
|
|
102
128
|
|
|
103
129
|
export interface ColumnDef_FeatureMap<
|
|
@@ -7,7 +7,7 @@ import type { TableOptions_All } from './TableOptions'
|
|
|
7
7
|
import type { TableState_All } from './TableState'
|
|
8
8
|
import type { StockFeatures } from '../features/stockFeatures'
|
|
9
9
|
|
|
10
|
-
type IsAny<T> = 0 extends 1 & T ? true : false
|
|
10
|
+
export type IsAny<T> = 0 extends 1 & T ? true : false
|
|
11
11
|
type UnionToIntersectionOrEmpty<T> = [T] extends [never]
|
|
12
12
|
? {}
|
|
13
13
|
: UnionToIntersection<T> & {}
|
|
@@ -25,7 +25,29 @@ export type ExtractFeatureMapTypes<
|
|
|
25
25
|
export interface Plugins {}
|
|
26
26
|
|
|
27
27
|
export interface TableFeatures
|
|
28
|
-
extends Partial<CoreFeatures>, Partial<StockFeatures>, Partial<Plugins> {
|
|
28
|
+
extends Partial<CoreFeatures>, Partial<StockFeatures>, Partial<Plugins> {
|
|
29
|
+
/**
|
|
30
|
+
* Type-only slot for declaring the type of this table's `options.meta`.
|
|
31
|
+
*
|
|
32
|
+
* Pass a phantom value: `tableMeta: {} as MyTableMeta`. The value itself is
|
|
33
|
+
* ignored and stripped from the table's registered features at runtime — only
|
|
34
|
+
* its type is used, inferred wherever `TFeatures` flows.
|
|
35
|
+
*
|
|
36
|
+
* When omitted, the global declaration-merged `TableMeta` interface applies.
|
|
37
|
+
*/
|
|
38
|
+
tableMeta?: object
|
|
39
|
+
/**
|
|
40
|
+
* Type-only slot for declaring the type of `columnDef.meta` for all columns
|
|
41
|
+
* of this table.
|
|
42
|
+
*
|
|
43
|
+
* Pass a phantom value: `columnMeta: {} as MyColumnMeta`. The value itself is
|
|
44
|
+
* ignored and stripped from the table's registered features at runtime — only
|
|
45
|
+
* its type is used, inferred wherever `TFeatures` flows.
|
|
46
|
+
*
|
|
47
|
+
* When omitted, the global declaration-merged `ColumnMeta` interface applies.
|
|
48
|
+
*/
|
|
49
|
+
columnMeta?: object
|
|
50
|
+
}
|
|
29
51
|
|
|
30
52
|
export interface TableFeature {
|
|
31
53
|
/**
|
|
@@ -34,7 +34,10 @@ export interface TableOptions_Core<
|
|
|
34
34
|
TableOptions_Rows<TFeatures, TData> {}
|
|
35
35
|
|
|
36
36
|
type DebugKeysFor<TFeatures extends TableFeatures> = {
|
|
37
|
-
[K in
|
|
37
|
+
[K in Exclude<
|
|
38
|
+
keyof TFeatures & string,
|
|
39
|
+
'tableMeta' | 'columnMeta' // type-only slots, not real features
|
|
40
|
+
> as `debug${Capitalize<K>}`]?: boolean
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
export type DebugOptions<TFeatures extends TableFeatures> = {
|