canvas-datagrid 0.3.25 → 0.4.3

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/types.d.ts CHANGED
@@ -74,6 +74,8 @@
74
74
  * @param [args.blanksText = (Blanks)] - The text that appears on the context menu for filtering blank values (i.e. `undefined`, `null`, `''`).
75
75
  * @param [args.ellipsisText = ...] - The text used as ellipsis text on truncated values.
76
76
  * @param [args.allowSorting = true] - Allow user to sort rows by clicking on column headers.
77
+ * @param [args.allowGroupingColumns = true] - Allow user to group columns by clicking on column headers.
78
+ * @param [args.allowGroupingRows = true] - Allow user to group rows by clicking on rows headers.
77
79
  * @param [args.showFilter = true] - When true, filter will be an option in the context menu.
78
80
  * @param [args.pageUpDownOverlap = 1] - Amount of rows to overlap when pageup/pagedown is used.
79
81
  * @param [args.persistantSelectionMode = false] - When true, selections will behave as if the command/control key is held down at all times. Conflicts with singleSelectionMode.
@@ -101,6 +103,18 @@
101
103
  * @param [args.clearSettingsOptionText = 'Clear saved settings'] - Text that appears on the clear settings option.
102
104
  * @param [args.showOrderByOptionTextDesc = 'Order by %s ascending'] - Text that appears on the order by descending option.
103
105
  * @param [args.showOrderByOptionTextAsc = 'Order by %s desc'] - Text that appears on the order by ascending option.
106
+ * @param [args.showGroupColumns = 'Group columns %s'] - Text that appears on the group columns option.
107
+ * @param [args.showGroupRows = 'Group row %s'] - Text that appears on the group rows option.
108
+ * @param [args.showRemoveGroupColumns = 'Remove group %s'] - Text that appears on the remove columns group option.
109
+ * @param [args.showRemoveGroupRows = 'Remove group %s'] - Text that appears on the remove rows group option.
110
+ * @param [args.showRemoveAllGroupColumns = 'Remove all column groups'] - Text that appears on the remove all column groups option.
111
+ * @param [args.showRemoveAllGroupRows = 'Remove all row groups'] - Text that appears on the remove all row groups option.
112
+ * @param [args.showExpandAllGroupColumns = 'Expand all column groups'] - Text that appears on the expand all column groups option.
113
+ * @param [args.showExpandAllGroupRows = 'Expand all row groups'] - Text that appears on the expand all row groups option.
114
+ * @param [args.showCollapseAllGroupColumns = 'Collapse all column groups'] - Text that appears on the collapsed all column groups option.
115
+ * @param [args.showCollapseAllGroupRows = 'Collapse all row groups'] - Text that appears on the collapsed all row groups option.
116
+ * @param [args.columnGroupIndicatorPosition = 'right'] - The position of the column group inidcator(icon), available values: 'left' and 'right'.
117
+ * @param [args.rowGroupIndicatorPosition = 'bottom'] - Ths position of the row group indicator(icon), available values: 'top' and 'bottom'.
104
118
  * @param [args.showOrderByOption = true] - Show an option on the context menu sort rows.
105
119
  * @param [args.showPaste = false] - Show the paste option in the context menu when applicable.
106
120
  * @param [args.schema = []] - Sets the schema. See {@link canvasDatagrid.schema}.
@@ -163,6 +177,8 @@ declare class canvasDatagrid {
163
177
  blanksText?: string;
164
178
  ellipsisText?: string;
165
179
  allowSorting?: boolean;
180
+ allowGroupingColumns?: boolean;
181
+ allowGroupingRows?: boolean;
166
182
  showFilter?: boolean;
167
183
  pageUpDownOverlap?: number;
168
184
  persistantSelectionMode?: boolean;
@@ -190,6 +206,18 @@ declare class canvasDatagrid {
190
206
  clearSettingsOptionText?: string;
191
207
  showOrderByOptionTextDesc?: string;
192
208
  showOrderByOptionTextAsc?: string;
209
+ showGroupColumns?: string;
210
+ showGroupRows?: string;
211
+ showRemoveGroupColumns?: string;
212
+ showRemoveGroupRows?: string;
213
+ showRemoveAllGroupColumns?: string;
214
+ showRemoveAllGroupRows?: string;
215
+ showExpandAllGroupColumns?: string;
216
+ showExpandAllGroupRows?: string;
217
+ showCollapseAllGroupColumns?: string;
218
+ showCollapseAllGroupRows?: string;
219
+ columnGroupIndicatorPosition?: string;
220
+ rowGroupIndicatorPosition?: string;
193
221
  showOrderByOption?: boolean;
194
222
  showPaste?: boolean;
195
223
  schema?: any[];
@@ -401,6 +429,16 @@ declare class canvasDatagrid {
401
429
  * @param imgSrc - icon path to add into button.
402
430
  */
403
431
  static addButton(columnIndex: number, rowIndex: number, offset: any, items: any, imgSrc: string): void;
432
+ /**
433
+ * Expand/Collapse CellTree.
434
+ * @param treeData - The array of cellTree to expand or collapse.
435
+ */
436
+ static toggleCellCollapseTree(treeData: any[]): void;
437
+ /**
438
+ * Expand/Collapse CellTree.
439
+ * @param treeData - The array of cellTree to expand or collapse.
440
+ */
441
+ static expandCollapseCellTree(treeData: any[]): void;
404
442
  /**
405
443
  * Scrolls the cell at cell x, row y into view if it is not already.
406
444
  * @param x - The column index of the cell to scroll into view.
@@ -478,6 +516,18 @@ declare class canvasDatagrid {
478
516
  * @returns header with the selected name, or undefined.
479
517
  */
480
518
  static getHeaderByName(name: string): header;
519
+ /**
520
+ * Hide column/columns
521
+ */
522
+ static hideColumns: any;
523
+ /**
524
+ * Hide rows
525
+ */
526
+ static hideRows: any;
527
+ /**
528
+ * Unhide rows
529
+ */
530
+ static unhideRows: any;
481
531
  /**
482
532
  * Resizes a column to fit the longest value in the column. Call without a value to resize all columns.
483
533
  * Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).
@@ -499,6 +549,42 @@ declare class canvasDatagrid {
499
549
  * @param [dontSetStorageData] - Don't store this setting for future use.
500
550
  */
501
551
  static order(columnName: number, direction: string, sortFunction?: (...params: any[]) => any, dontSetStorageData?: boolean): void;
552
+ /**
553
+ * Grouping columns
554
+ * @param firstColumnName - Name of the first column to be grouped.
555
+ * @param lastColumnName - Name of the last column to be grouped.
556
+ */
557
+ static groupColumns(firstColumnName: number | string, lastColumnName: number | string): void;
558
+ /**
559
+ * Grouping columns
560
+ * @param rowIndexFrom - The row index which is the beginning of the group
561
+ * @param rowIndexTo - The row index which is the end of the group
562
+ */
563
+ static groupRows(rowIndexFrom: number, rowIndexTo: number): void;
564
+ /**
565
+ * Remove grouping columns
566
+ * @param firstColumnName - Name of the first column to be grouped.
567
+ * @param lastColumnName - Name of the last column to be grouped.
568
+ */
569
+ static removeGroupColumns(firstColumnName: number | string, lastColumnName: number | string): void;
570
+ /**
571
+ * Remove grouping columns
572
+ * @param rowIndexFrom - The row index which is the beginning of the group
573
+ * @param rowIndexTo - The row index which is the end of the group
574
+ */
575
+ static removeGroupRows(rowIndexFrom: number, rowIndexTo: number): void;
576
+ /**
577
+ * Toggle(expand/collapsed) grouping columns
578
+ * @param firstColumnName - Name of the first column to be grouped.
579
+ * @param lastColumnName - Name of the last column to be grouped.
580
+ */
581
+ static toggleGroupColumns(firstColumnName: number | string, lastColumnName: number | string): void;
582
+ /**
583
+ * Toggle(expand/collapsed) grouping rows
584
+ * @param rowIndexFrom - The row index which is the beginning of the group
585
+ * @param rowIndexTo - The row index which is the end of the group
586
+ */
587
+ static toggleGroupRows(rowIndexFrom: number, rowIndexTo: number): void;
502
588
  /**
503
589
  * Moves the current selection relative to the its current position. Note: this method does not move the selected data, just the selection itself.
504
590
  * @param offsetX - The number of columns to offset the selection.
@@ -517,6 +603,16 @@ declare class canvasDatagrid {
517
603
  * @param y - The row index to start inserting the selection at.
518
604
  */
519
605
  static moveTo(sel: any[], x: number, y: number): void;
606
+ /**
607
+ * Get the column group info given column belongs to
608
+ * @param columnIndex - Column index.
609
+ */
610
+ static getGroupsColumnBelongsTo(columnIndex: number): { from: number; to: number; collapsed: boolean; }[];
611
+ /**
612
+ * Get the row group info given row belongs to
613
+ * @param rowIndex - Row index.
614
+ */
615
+ static getGroupsRowBelongsTo(rowIndex: number): { from: number; to: number; collapsed: boolean; }[];
520
616
  /**
521
617
  * Checks if a given column is visible.
522
618
  * @param columnIndex - Column index.
@@ -536,6 +632,24 @@ declare class canvasDatagrid {
536
632
  * @returns cell at the selected location.
537
633
  */
538
634
  static getVisibleCellByIndex(x: number, y: number): cell;
635
+ /**
636
+ * Get an unhide indicator at grid pixel coordinate x and y.
637
+ * @param x - Number of pixels from the left.
638
+ * @param y - Number of pixels from the top.
639
+ */
640
+ static getUnhideIndicator(x: number, y: number): void;
641
+ /**
642
+ * Get a column group at grid pixel coordinate x and y.
643
+ * @param x - Number of pixels from the left.
644
+ * @param y - Number of pixels from the top.
645
+ */
646
+ static getColumnGroupAt(x: number, y: number): void;
647
+ /**
648
+ * Get a row group at grid pixel coordinate x and y.
649
+ * @param x - Number of pixels from the left.
650
+ * @param y - Number of pixels from the top.
651
+ */
652
+ static getRowGroupAt(x: number, y: number): void;
539
653
  /**
540
654
  * Gets the cell at grid pixel coordinate x and y. Author's note. This function ties drawing and events together. This is a very complex function and is core to the component.
541
655
  * @param x - Number of pixels from the left.
@@ -1108,6 +1222,7 @@ declare namespace canvasDatagrid {
1108
1222
  * @property [childContextMenuMarginTop = 0] - Style of childContextMenuMarginTop.
1109
1223
  * @property [childContextMenuArrowHTML = ►] - Style of childContextMenuArrowHTML.
1110
1224
  * @property [childContextMenuArrowColor = rgba(43, 48, 43, 1)] - Style of childContextMenuArrowColor.
1225
+ * @property [columnGroupRowHeight = 25] - Style of columnGroupRowHeight.
1111
1226
  * @property [contextMenuChildArrowFontSize = 12px] - Style of contextMenuChildArrowFontSize.
1112
1227
  * @property [cellWidth = 250] - Style of cellWidth.
1113
1228
  * @property [contextMenuBackground = rgba(240, 240, 240, 1)] - Style of contextMenuBackground.
@@ -1162,6 +1277,8 @@ declare namespace canvasDatagrid {
1162
1277
  * @property [gridBackgroundColor = rgba(240, 240, 240, 1)] - Style of gridBackgroundColor.
1163
1278
  * @property [gridBorderColor = rgba(202, 202, 202, 1)] - Style of gridBorderColor.
1164
1279
  * @property [gridBorderWidth = 1] - Style of gridBorderWidth.
1280
+ * @property [groupIndicatorColor = rgba(155, 155, 155, 1)'] - Foreground color of the group indicator(icon).
1281
+ * @property [groupIndicatorBackgroundColor = rgba(255, 255, 255, 1)'] - Background color of the group indicator(icon).
1165
1282
  * @property [columnHeaderCellCapBackgroundColor = rgba(240, 240, 240, 1)] - Style of columnHeaderCellBackgroundColor.
1166
1283
  * @property [columnHeaderCellCapBorderColor = rgba(172, 172, 172, 1)] - Style of columnHeaderCellBackgroundColor.
1167
1284
  * @property [columnHeaderCellCapBorderWidth = 1] - Style of columnHeaderCellBackgroundColor.
@@ -1196,6 +1313,7 @@ declare namespace canvasDatagrid {
1196
1313
  * @property [reorderMarkerBorderWidth = 1.25] - Style of reorderMarkerBorderWidth.
1197
1314
  * @property [reorderMarkerIndexBorderColor = rgba(66, 133, 244, 1)] - Style of reorderMarkerIndexBorderColor.
1198
1315
  * @property [reorderMarkerIndexBorderWidth = 2.75] - Style of reorderMarkerIndexBorderWidth.
1316
+ * @property [rowGroupColumnWidth = 25] - Style of rowGroupColumnWidth.
1199
1317
  * @property [rowHeaderCellBackgroundColor = rgba(240, 240, 240, 1)] - Style of rowHeaderCellBackgroundColor.
1200
1318
  * @property [rowHeaderCellBorderColor = rgba(152, 152, 152, 1)] - Style of rowHeaderCellBorderColor.
1201
1319
  * @property [rowHeaderCellBorderWidth = 0.25] - Style of rowHeaderCellBorderWidth.
@@ -1466,6 +1584,10 @@ declare namespace canvasDatagrid {
1466
1584
  * Style of childContextMenuArrowColor.
1467
1585
  */
1468
1586
  childContextMenuArrowColor?: string;
1587
+ /**
1588
+ * Style of columnGroupRowHeight.
1589
+ */
1590
+ columnGroupRowHeight?: number;
1469
1591
  /**
1470
1592
  * Style of contextMenuChildArrowFontSize.
1471
1593
  */
@@ -1682,6 +1804,14 @@ declare namespace canvasDatagrid {
1682
1804
  * Style of gridBorderWidth.
1683
1805
  */
1684
1806
  gridBorderWidth?: number;
1807
+ /**
1808
+ * Foreground color of the group indicator(icon).
1809
+ */
1810
+ groupIndicatorColor?: string;
1811
+ /**
1812
+ * Background color of the group indicator(icon).
1813
+ */
1814
+ groupIndicatorBackgroundColor?: string;
1685
1815
  /**
1686
1816
  * Style of columnHeaderCellBackgroundColor.
1687
1817
  */
@@ -1818,6 +1948,10 @@ declare namespace canvasDatagrid {
1818
1948
  * Style of reorderMarkerIndexBorderWidth.
1819
1949
  */
1820
1950
  reorderMarkerIndexBorderWidth?: number;
1951
+ /**
1952
+ * Style of rowGroupColumnWidth.
1953
+ */
1954
+ rowGroupColumnWidth?: number;
1821
1955
  /**
1822
1956
  * Style of rowHeaderCellBackgroundColor.
1823
1957
  */
@@ -2070,3 +2204,10 @@ declare namespace canvasDatagrid {
2070
2204
  }
2071
2205
  }
2072
2206
 
2207
+ /**
2208
+ * Merge a new hidden row range into existed ranges array
2209
+ * @param hiddenRowRanges - tuples: Array<[bgeinRowIndex, endRowIndex]>
2210
+ * @param newRange - tuple: [beginRowIndex, endRowIndex]
2211
+ */
2212
+ declare function mergeHiddenRowRanges(hiddenRowRanges: any[], newRange: number[]): boolean;
2213
+