jquery.dgtable 0.6.18 → 2.0.0
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/README.md +38 -70
- package/dist/lib.cjs.js +3935 -0
- package/dist/lib.cjs.js.map +1 -0
- package/dist/lib.cjs.min.js +3 -0
- package/dist/lib.cjs.min.js.map +1 -0
- package/dist/lib.es6.js +3933 -0
- package/dist/lib.es6.js.map +1 -0
- package/dist/lib.es6.min.js +3 -0
- package/dist/lib.es6.min.js.map +1 -0
- package/dist/lib.umd.js +1984 -0
- package/dist/lib.umd.js.map +1 -0
- package/dist/lib.umd.min.js +7 -0
- package/dist/lib.umd.min.js.map +1 -0
- package/index.js +27 -0
- package/package.json +47 -57
- package/scripts/build.js +162 -0
- package/LICENSE +0 -21
- package/dist/jquery.dgtable.cjs.js +0 -6389
- package/dist/jquery.dgtable.cjs.js.map +0 -1
- package/dist/jquery.dgtable.cjs.min.js +0 -7
- package/dist/jquery.dgtable.cjs.min.js.map +0 -1
- package/dist/jquery.dgtable.es6.js +0 -6387
- package/dist/jquery.dgtable.es6.js.map +0 -1
- package/dist/jquery.dgtable.es6.min.js +0 -7
- package/dist/jquery.dgtable.es6.min.js.map +0 -1
- package/dist/jquery.dgtable.umd.js +0 -4466
- package/dist/jquery.dgtable.umd.js.map +0 -1
- package/dist/jquery.dgtable.umd.min.js +0 -7
- package/dist/jquery.dgtable.umd.min.js.map +0 -1
- package/eslint.config.mjs +0 -133
- package/src/SelectionHelper.js +0 -65
- package/src/by_column_filter.js +0 -25
- package/src/column_collection.js +0 -153
- package/src/index.js +0 -4034
- package/src/row_collection.js +0 -183
- package/src/util.js +0 -23
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
DGTable.js (please migrate to @danielgindi/dgtable.js)
|
|
2
|
+
======================================================
|
|
3
3
|
|
|
4
|
-
This is a table View for
|
|
4
|
+
This is a table View for vanilla JS, which is meant to be high-performance, and allow simple user interactions with the UI, such as:
|
|
5
5
|
* Sorting
|
|
6
6
|
* Sorting by more than one column
|
|
7
7
|
* Moving columns
|
|
@@ -17,7 +17,16 @@ Other features implemented are:
|
|
|
17
17
|
* Option to set a fixed width for the table so resizing (relative) columns will still make sure the table will not be less (and/or more) than the specified width.
|
|
18
18
|
* Option to have both scrollbars inside the table. (set `width: DGTable.Width.SCROLL`)
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
`jquery.dgtable` users:
|
|
21
|
+
* Older `jquery.dgtable` can either keep using `jquery.dgtable`, or migrate to this new version which is more lightweight.
|
|
22
|
+
* The new version's API is the same as the old one, except that:
|
|
23
|
+
* No `$el` property
|
|
24
|
+
* No auto-clear of jQuery data.
|
|
25
|
+
* There is now an `emit` method instead of `trigger`.
|
|
26
|
+
* Event arguments are now always a single value/object.
|
|
27
|
+
* Props on DOM elements are now: `'columnName'` on a cell, `'index'/'vIndex'` on a row, `'columnName'/rowIndex'/'rowVIndex'` on a cellPreview
|
|
28
|
+
|
|
29
|
+
My TODO list:
|
|
21
30
|
* TODO: Have a simple and accurate API documentation here in the readme
|
|
22
31
|
|
|
23
32
|
## Dev environment
|
|
@@ -109,67 +118,26 @@ To create a new table, just use `var myTable = new DGTable(INIT_OPTIONS)`.
|
|
|
109
118
|
|
|
110
119
|
* `renderskeleton`: The table is re-drawing it's base elements, including headers. Will always be followed by a `render` event.
|
|
111
120
|
* `render`: The table has finished rendering (after adding rows etc.).
|
|
112
|
-
* `cellpreview`: We are about to show a cell preview
|
|
113
|
-
* 1st argument: Preview's DOM element
|
|
114
|
-
* 2nd argument: Row's index - or null for header
|
|
115
|
-
* 3rd argument: Column's name
|
|
116
|
-
* 4th argument: Row's data - if applicable
|
|
117
|
-
* 5th argument: Cell's DOM element
|
|
121
|
+
* `cellpreview`: We are about to show a cell preview - `{ el: Element, rowIndex: number|null, name: string, rowData: Object|null, cell: Element, cellEl: Element }`
|
|
118
122
|
* At this stage you can prevent showing the preview, by calling `table.hideCellPreview`
|
|
119
|
-
* `cellpreviewdestroy`: Cell preview element is about to be destroyed after hiding
|
|
120
|
-
* 1st argument: Preview's DOM element
|
|
121
|
-
* 2nd argument: Row's index
|
|
122
|
-
* 3rd argument: Column's name
|
|
123
|
-
* 4th argument: Cell's DOM element
|
|
123
|
+
* `cellpreviewdestroy`: Cell preview element is about to be destroyed after hiding - `{ el: Element, name: string, filteredRowIndex: number|null, rowIndex: Object|null, cell: Element, cellEl: Element }`
|
|
124
124
|
* You can use this event to release any resources that you may have used in `cellPreview` event.
|
|
125
|
-
* `headerrowcreate`: The header row has just been created
|
|
126
|
-
|
|
127
|
-
* `
|
|
128
|
-
|
|
129
|
-
* `
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
* `
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
* 4th argument: Row's DOM element
|
|
139
|
-
* 5th argument: Row's data
|
|
140
|
-
* `rowdestroy`: Called just before removing a physical row element from the table
|
|
141
|
-
* 1st argument: Row's DOM element
|
|
142
|
-
* `addrows`: Data rows have been added to the table
|
|
143
|
-
* 1st argument: How many rows
|
|
144
|
-
* 2nd argument: Is this a replace? In other word, were the old rows removed?
|
|
145
|
-
* `addcolumn`: A column was added
|
|
146
|
-
* 1st argument: The column's name
|
|
147
|
-
* `removecolumn`: A column was removed
|
|
148
|
-
* 1st argument: The column's name
|
|
149
|
-
* `movecolumn`: A column was moved
|
|
150
|
-
* 1st argument: The column's name
|
|
151
|
-
* 2nd argument: From index
|
|
152
|
-
* 3nd argument: To index
|
|
153
|
-
* `showcolumn`: A column was shown
|
|
154
|
-
* 1st argument: The column's name
|
|
155
|
-
* `hidecolumn`: A column was hidden
|
|
156
|
-
* 1st argument: The column's name
|
|
157
|
-
* `columnwidth`: A column was resized
|
|
158
|
-
* 1st argument: The column's name
|
|
159
|
-
* 2nd argument: Old width
|
|
160
|
-
* 3nd argument: New width
|
|
161
|
-
* `filter`: A filter was applied
|
|
162
|
-
* 1st argument: The options passed to the filter method
|
|
125
|
+
* `headerrowcreate`: The header row has just been created - `Element`
|
|
126
|
+
* `headerrowdestroy`: Called just before removing the header row DOM element from the table - `Element`
|
|
127
|
+
* `rowcreate`: A row has just been created - `{ filteredRowIndex: number, rowIndex: number, rowEl: Element, rowData: Object }`
|
|
128
|
+
* `rowclick`: A row has just been created - `{ event: MouseEvent, rowIndex: number, rowIndex: number, rowEl: Element, rowData: Object }`
|
|
129
|
+
* `rowdestroy`: Called just before removing a row DOM element from the table - `Element`
|
|
130
|
+
* `addrows`: Data rows have been added to the table - `({ count: number, clear: boolean })`
|
|
131
|
+
* `addcolumn`: A column was added - `string` (the column's name)
|
|
132
|
+
* `removecolumn`: A column was removed - `string` (the column's name)
|
|
133
|
+
* `movecolumn`: A column was moved - `({ name: string, src: number, dest: number })`
|
|
134
|
+
* `showcolumn`: A column was shown - `string` (the column's name)
|
|
135
|
+
* `hidecolumn`: A column was hidden - `string` (the column's name)
|
|
136
|
+
* `columnwidth`: A column was resized - `({ name: string, width: number|string, oldWidth: number|string })`
|
|
137
|
+
* `filter`: A filter was applied - `any` - the arguments passed to the filter method
|
|
163
138
|
* `filterclear`: A filter was cleared
|
|
164
|
-
* `sort`: The data was sorted
|
|
165
|
-
|
|
166
|
-
* 2nd argument: `boolean` that determines whether this is a primary sort or a resort (sort()/header click, vs resort(), addRows(), etc.). If `true`, this is a resort.
|
|
167
|
-
* 3rd argument: `Function` - the comparator that was used to sort.
|
|
168
|
-
* `headercontextmenu`: A context menu should be shown for a header cell
|
|
169
|
-
* 1st argument: The column's name
|
|
170
|
-
* 2nd argument: pageX of the pointer event
|
|
171
|
-
* 3rd argument: pageY of the pointer event
|
|
172
|
-
* 4th argument: the bounds of the header cell on the page `{"left": offset().left, "top": offset().top, "width": outerWidth(), "height": outerHeight()}`
|
|
139
|
+
* `sort`: The data was sorted - `{ sorts: { "column": "column's name", "descending": true|false }[], resort: true|undefined, comparator: Function }`
|
|
140
|
+
* `headercontextmenu`: A context menu should be shown for a header cell - `({ name: string, pageX: number, pageY: number, bounds: { left: number, top: number, width: number, height: number } })`
|
|
173
141
|
|
|
174
142
|
- Member functions:
|
|
175
143
|
* `on(eventName, {Function?} callback)`: Adds an event listener
|
|
@@ -259,8 +227,8 @@ To create a new table, just use `var myTable = new DGTable(INIT_OPTIONS)`.
|
|
|
259
227
|
* **rowData**: Actual row data
|
|
260
228
|
* **columnName**: Name of column
|
|
261
229
|
* *returns* string for the specified cell
|
|
262
|
-
* `getDataForRow(
|
|
263
|
-
* *returns* row data
|
|
230
|
+
* `getDataForRow(rowIndex: number): Object`: Gets the row data for a specific row
|
|
231
|
+
* *returns* row data at the specified index, out of all rows (not filtered)
|
|
264
232
|
* `getRowCount(): number`: Gets the number of rows
|
|
265
233
|
* *returns* the number of rows
|
|
266
234
|
* `getIndexForRow(row: Object): number`: Finds the index of the specified row
|
|
@@ -270,14 +238,14 @@ To create a new table, just use `var myTable = new DGTable(INIT_OPTIONS)`.
|
|
|
270
238
|
* `getIndexForFilteredRow(row: Object): number`: Finds the index of the specified row within the filtered results
|
|
271
239
|
* *returns* the index of the specified row
|
|
272
240
|
* `getDataForFilteredRow(row: number): Object`: *Undocumented yet*
|
|
273
|
-
* `getRowElement(
|
|
274
|
-
* `getRowYPos(
|
|
241
|
+
* `getRowElement(rowIndex: number): Element`: Returns the element of the specified row (unfiltered index)
|
|
242
|
+
* `getRowYPos(rowIndex: number): number?`: Returns the Y pos of the specified row (unfiltered index)
|
|
275
243
|
* `tableWidthChanged() {DGTable}`: *Undocumented yet*
|
|
276
244
|
* `tableHeightChanged() {DGTable}`: *Undocumented yet*
|
|
277
245
|
* `addRows({Object[]} data, {number} at = -1, {boolean} resort = false, {boolean} render = true) {DGTable}`: Adds the specified rows at the specified position, and optionally resorts the data
|
|
278
|
-
* `removeRow({number}
|
|
279
|
-
* `removeRows({number}
|
|
280
|
-
* `refreshRow({number}
|
|
246
|
+
* `removeRow({number} rowIndex, {boolean} render = true) {DGTable}`: Removes one row at the specified position
|
|
247
|
+
* `removeRows({number} rowIndex, {number} count, {boolean} render = true) {DGTable}`: Removes rows at the specified position
|
|
248
|
+
* `refreshRow({number} rowIndex) {DGTable}`: Refreshes the row specified
|
|
281
249
|
* *returns* Self
|
|
282
250
|
* `refreshAllVirtualRows() {DGTable}`: Refreshes all virtual rows
|
|
283
251
|
* *returns* Self
|
|
@@ -290,7 +258,7 @@ To create a new table, just use `var myTable = new DGTable(INIT_OPTIONS)`.
|
|
|
290
258
|
* `createWebWorker({string} url) {Worker?}`: *Undocumented yet*
|
|
291
259
|
* `unbindWebWorker({Worker} worker) {DGTable}`: *Undocumented yet*
|
|
292
260
|
* `hideCellPreview() {DGTable}`: Hide any cell preview showing currently, or prevent showing a cell preview from within the `cellpreview` event.
|
|
293
|
-
* `
|
|
261
|
+
* `destroy()`: Destroy the table and free all of its memory.
|
|
294
262
|
|
|
295
263
|
## License
|
|
296
264
|
|