diff --git a/.changeset/shaggy-rats-battle.md b/.changeset/shaggy-rats-battle.md new file mode 100644 index 0000000..aa60c7a --- /dev/null +++ b/.changeset/shaggy-rats-battle.md @@ -0,0 +1,5 @@ +--- +"@zazuko/yasr": patch +--- + +Use the right type for DataTables configuration diff --git a/packages/yasr/src/plugins/table/index.ts b/packages/yasr/src/plugins/table/index.ts index d41d275..5ebb404 100644 --- a/packages/yasr/src/plugins/table/index.ts +++ b/packages/yasr/src/plugins/table/index.ts @@ -15,14 +15,14 @@ import * as faTableIcon from "@fortawesome/free-solid-svg-icons/faTable"; import { DeepReadonly } from "ts-essentials"; import { cloneDeep } from "lodash-es"; import sanitize from "../../helpers/sanitize"; -import type { Api, ConfigColumns, CellMetaSettings, InternalSettings } from "datatables.net"; +import type { Api, ConfigColumns, CellMetaSettings, Config } from "datatables.net"; const ColumnResizer = require("column-resizer"); const DEFAULT_PAGE_SIZE = 50; export interface PluginConfig { openIriInNewWindow: boolean; - tableConfig: InternalSettings; + tableConfig: Config; } export interface PersistentConfig { @@ -203,8 +203,8 @@ export default class Table implements Plugin { } this.yasr.resultsEl.appendChild(this.tableEl); // reset some default config properties as they couldn't be initialized beforehand - const dtConfig: InternalSettings = { - ...(cloneDeep(this.config.tableConfig) as unknown as InternalSettings), + const dtConfig: Config = { + ...(cloneDeep(this.config.tableConfig) as unknown as Config), pageLength: persistentConfig?.pageSize ? persistentConfig.pageSize : DEFAULT_PAGE_SIZE, data: rows, columns: columns,