diff --git a/datatables.json b/datatables.json index a570104..c73e9a3 100644 --- a/datatables.json +++ b/datatables.json @@ -14,5 +14,6 @@ "types/types.d.ts" ], "src-repo": "http://github.com/DataTables/Select", - "last-tag": "1.4.0" -} + "last-tag": "1.4.0", + "last-sync": "db0816c431dce1ec8a32eecbb0ed0b8f52595f3e" +} \ No newline at end of file diff --git a/js/select.semanticui.min.js b/js/select.semanticui.min.js index 364b87c..1ca1cae 100644 --- a/js/select.semanticui.min.js +++ b/js/select.semanticui.min.js @@ -1 +1,4 @@ +/*! Semanic UI styling wrapper for Select + * © SpryMedia Ltd - datatables.net/license + */ !function(n){"function"==typeof define&&define.amd?define(["jquery","datatables.net-se","datatables.net-select"],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-se")(e,t),t.fn.dataTable||require("datatables.net-select")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,a){"use strict";return e.fn.dataTable}); \ No newline at end of file diff --git a/js/select.semanticui.min.mjs b/js/select.semanticui.min.mjs index 6a3e4a9..a3fd375 100644 --- a/js/select.semanticui.min.mjs +++ b/js/select.semanticui.min.mjs @@ -1 +1,4 @@ +/*! Semanic UI styling wrapper for Select + * © SpryMedia Ltd - datatables.net/license + */ import $ from"jquery";import DataTable from"datatables.net-se";import DataTable from"datatables.net-select";export default DataTable; \ No newline at end of file diff --git a/types/types.d.ts b/types/types.d.ts index 8b6b630..f5cb7a1 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -1,7 +1,224 @@ +// Type definitions for DataTables Select +// +// Project: https://datatables.net/extensions/select/, https://datatables.net +// Definitions by: +// SpryMedia +// Jared Szechy -// Dist-DataTables-Select-SemanticUI integration with SemanticUI exports the DataTables API having -// set default values to complete the ingeration. -import Api from "datatables.net"; +/// -export default Api; +import DataTables from 'datatables.net'; + +export default DataTables; + +type StyleType = 'api' | 'single' | 'multi' | 'os' | 'multi+shift'; + +declare module 'datatables.net' { + interface Config { + /* + * Select extension options + */ + select?: boolean | string | ConfigSelect; + } + + interface Api { + select: ApiSelect> + } + + interface ApiRowMethods { + /** + * Select a row + */ + select(): Api; + + /** + * Deselect a row + */ + deselect(): Api; + } + + interface ApiRowsMethods { + /** + * Select multiple rows + */ + select(): Api; + + /** + * Deselect a row + */ + deselect(): Api; + } + + interface ApiCellMethods { + /** + * Select cell + */ + select(): Api; + + /** + * Deselect a cell + */ + deselect(): Api; + } + + interface ApiCellsMethods { + /** + * Select multiple cells + */ + select(): Api; + + /** + * Deselect cells + */ + deselect(): Api; + } + + interface ApiStatic { + /** + * Select static methods + */ + select: { + /** + * Initialise Select (for use on tables which were not in the document + * when they were initialised). + */ + init: (api: Api) => void; + + /** + * Select version + */ + version: string; + } + } +} + +interface ConfigSelect { + /** + * Indicate if the selected items will be removed when clicking outside of the table + */ + blurable?: boolean; + + /** + * Set the class name that will be applied to selected items + */ + className?: string; + + /** + * Enable / disable the display for item selection information in the table summary + */ + info?: boolean; + + /** + * Set which table items to select (rows, columns or cells) + */ + items?: string; + + /** + * Set the element selector used for mouse event capture to select items + */ + selector?: string; + + /** + * Set the selection style for end user interaction with the table + */ + style?: StyleType; +} + +interface ApiSelect { + /** + * Initialise Select for a DataTable after the DataTable has been constructed. + * + * @returns DataTables Api instance + */ + (): Api; + + /** + * Get the blurable state for the table. + * + * @returns Current state - true if blurable, false otherwise. Note that if multiple tables are defined in the API's context, only the blurable state of the first table will be returned. + */ + blurable(): boolean; + + /** + * Set the blurable state for the table's selection options. + * + * @param flag Value to set for the blurable option - true to enable, false to disable. + * @returns DataTables Api instance for chaining + */ + blurable(flag): Api; + + /** + * Get the summary information display state for the table. + * + * @returns Current state - true if information summary shown, false otherwise. Note that if multiple tables are defined in the API's context, only the information state of the first table will be returned. + */ + info(): boolean; + + /** + * Set the information summary display state for the table's selection options. + * + * @param flag Value to set for the information summary display state - true to enable, false to disable. + * @returns DataTables API instance for chaining. + */ + info(flag): Api; + + /** + * Get the items that will be selected by user interaction (i.e. a click on the table). + * + * @returns The current item that will be selected when the user interacts with Select's event listeners - this will be the value row, column or cell. + */ + items(): string; + + /** + * Set the item type that will be selected by user interaction. + * + * @param set Items to select - this must be one of row, column or cells. + * @returns DataTables API instance for chaining. + */ + items(set: string): Api; + + /** + * Get the current item selector string applied to the table. + * + * @returns the item selector string being used for the table. + */ + selector(): string; + + /** + * Set the table's item selector string. Note that any old selectors will be automatically removed if this is used as a selector to ensure that there are no memory leaks in unattached event listeners. + * + * @param set jQuery selector that will select the cells that can trigger item selection. + */ + selector(set: string): Api; + + /** + * Get the current selection style applied to the table + * + * @returns The current selection style, this will be one of "api", "single", "multi" or "os". + */ + style(): string; + + /** + * Set the table's selection style + * + * @param s Selection style to set - this must be one of "api", "single", "multi" or "os". + * @returns DataTables API instance for chaining. + */ + style(s: StyleType): Api; + + /** + * Get the toggle state of Select for the given DataTable. + * + * @returns true if the item can be deselected when clicked on, false if it cannot be. + */ + toggleable(): boolean; + + /** + * Set the toggle state of Select for the DataTable. + * + * @param set true to allow item deselection, false to disallow. + * @returns DataTables API instance for chaining. + */ + toggleable(set): Api; +}