From db946abef36df25419bdf1459986834819d8c1cd Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Fri, 4 Nov 2022 17:12:36 +0000 Subject: [PATCH] 6311707142236e2c1c5cb6fea9602a763da11d07 Sync to source repo @6311707142236e2c1c5cb6fea9602a763da11d07 --- datatables.json | 5 +- js/colReorder.bulma.min.js | 3 + js/colReorder.bulma.min.mjs | 3 + types/types.d.ts | 159 +++++++++++++++++++++++++++++++++++- 4 files changed, 164 insertions(+), 6 deletions(-) diff --git a/datatables.json b/datatables.json index 4223541..daa4526 100644 --- a/datatables.json +++ b/datatables.json @@ -14,5 +14,6 @@ "types/types.d.ts" ], "src-repo": "http://github.com/DataTables/ColReorder", - "last-tag": "1.5.6" -} + "last-tag": "1.5.6", + "last-sync": "6311707142236e2c1c5cb6fea9602a763da11d07" +} \ No newline at end of file diff --git a/js/colReorder.bulma.min.js b/js/colReorder.bulma.min.js index 87dd9fe..8db6b03 100644 --- a/js/colReorder.bulma.min.js +++ b/js/colReorder.bulma.min.js @@ -1 +1,4 @@ +/*! Bulma styling wrapper for ColReorder + * © SpryMedia Ltd - datatables.net/license + */ !function(n){"function"==typeof define&&define.amd?define(["jquery","datatables.net-bm","datatables.net-colreorder"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,(t=t||("undefined"!=typeof window?require("jquery"):require("jquery")(e))).fn.dataTable||require("datatables.net-bm")(e,t),t.fn.dataTable||require("datatables.net-colreorder")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,r){"use strict";return e.fn.dataTable}); \ No newline at end of file diff --git a/js/colReorder.bulma.min.mjs b/js/colReorder.bulma.min.mjs index 41fe06a..33b898a 100644 --- a/js/colReorder.bulma.min.mjs +++ b/js/colReorder.bulma.min.mjs @@ -1 +1,4 @@ +/*! Bulma styling wrapper for ColReorder + * © SpryMedia Ltd - datatables.net/license + */ import $ from"jquery";import DataTable from"datatables.net-bm";import DataTable from"datatables.net-colreorder";export default DataTable; \ No newline at end of file diff --git a/types/types.d.ts b/types/types.d.ts index 2c4ad96..e5dc283 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -1,7 +1,158 @@ +// Type definitions for DataTables ColReorder +// +// Project: https://datatables.net/extensions/colreorder/, https://datatables.net +// Definitions by: +// SpryMedia +// Andy Ma -// Dist-DataTables-ColReorder-Bulma integration with Bulma exports the DataTables API having -// set default values to complete the ingeration. -import Api from "datatables.net"; +/// -export default Api; +import DataTables, {Api} from 'datatables.net'; +export default DataTables; + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables' types integration + */ +declare module 'datatables.net' { + interface Config { + /** + * ColReorder extension options + */ + colReorder?: boolean | ConfigColReorder; + } + + interface Api { + /** + * ColReorder methods container + * + * @returns Api for chaining with the additional ColReorder methods + */ + colReorder: ApiColReorderMethods; + } + + interface ApiStatic { + /** + * ColReorder class + */ + ColReorder: { + /** + * Create a new ColReorder instance for the target DataTable + */ + new (dt: Api, settings: boolean | ConfigColReorder); + + /** + * ColReorder version + */ + version: string; + + /** + * Default configuration values + */ + defaults: ConfigColReorder; + } + } +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Options + */ + +interface ConfigColReorder { + /** + * Initial enablement state of ColReorder - Since 1.5.0 + */ + enable?: boolean; + + /** + * Number of columns (counting from the left) to disallow reordering of, '0' in default + */ + fixedColumnsLeft?: number; + + /** + * Number of columns (counting from the right) to disallow reordering of, '0' in default + */ + fixedColumnsRight?: number; + + /** + * Set a default order for the columns in the table + */ + order?: number[]; + + /** + * Enable / disable live reordering of columns during a drag, 'true' in default + */ + realtime?: boolean; + + /** + * Callback after reorder + */ + reorderCallback?: () => void; +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * API + */ + +interface ApiColReorderMethods extends Omit, 'order'> { + /** + * Disable end user ability to reorder columns. + * + * @returns DataTables Api instance. + */ + disable(): Api; + + /** + * Enable and disable user ability to reorder columns in a table. + * + * @param flag if true enable colReorder, if false disable. + * @returns DataTables Api instance + */ + enable(flag?: boolean): Api; + + /** + * Programmatically reorder columns + * + * @param from Column index to move. + * @param to New index to move the column to. + * @param drop Indicate that this is the final move. Set this to false if you are performing multiple moves + * @param invalidate Invalidate the row data. As with drop it can be useful to set this to false if performing multiple moves. Otherwise allow it to default which will ensure that the table's data is fully insync with the column order. + * @returns Unmodified API instance. + */ + move(from: number, to: number, drop: boolean, invalidate: boolean): Api; + + /** + * Get the current column order. + * + * @returns Returns an array of column indexes. The column index given is the original column index, with its new position defined by the location in the returned array. + */ + order(): Array; + + /** + * Set column order + * + * @param newOrder Array of column indexes that define where the columns should be placed after the reorder. + * @param originalIndexes Set to be true to indicate that the indexes passed in are the original indexes. false or undefined (default) will treat them as the current indexes. + * @returns DataTables Api instance for chaining + */ + order(newOrder: number[], originalIndexes?: boolean): Api; + + /** + * Restore the loaded column order + * + * @returns DataTables Api instance. + */ + reset(): Api; + + /** + * Convert one or more column indexes to and from current and original indexes + * + * @param idx The index, or array of indexes to transpose. + * @param direction Set what transposition is required. + * @returns The transpose values + */ + transpose(idx: number | number[], direction?: "toCurrent" | "toOriginal" | "fromOriginal" | "fromCurrent"): Array; +}