@guiexpert/table 1.1.29 → 1.1.32

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.
@@ -2,7 +2,28 @@ import { AreaIdent } from "../tablemodel/area-ident.type";
2
2
  import { AreaModelIf } from "../tablemodel/areamodel/area-model.if";
3
3
  import { TableScope } from "../../table-scope";
4
4
  /**
5
- * Represents data about a mouse target. It's a helper class to extract all information from the target HTMLElement.
5
+ * The MouseTargetData class is used to process and provide information about user interaction, especially mouse events, with specific areas and elements of a table built using HTML Div elements, Span elements, and Input elements.
6
+ *
7
+ * The class encapsulates different types of data related to the element on which an event was targeted.
8
+ * Data such as the targeted row and column indices, the area on the table identified (header, body, or footer),
9
+ * the model of the table area the user interacted with, attributes of the HTML Input Element
10
+ * (value and type), associated action, content row, and CSS class applied to the element.
11
+ *
12
+ * The constructor expects an `EventTarget` and `TableScope` objects as parameters -
13
+ * data encapsulated in the `EventTarget` object will be used to populate the properties of the `MouseTargetData` object.
14
+ *
15
+ * @property {number} rowIdx - The index of the targeted row on an interaction event. Default value is -1.
16
+ * @property {number} colIdx - The index of the targeted column on an interaction event. Default value is -1.
17
+ * @property {AreaIdent} [areaIdent] - The identification of the targeted area on an interaction event. Possible value can be 'header', 'body', 'footer'.
18
+ * @property {AreaModelIf} [areaModel] - The model of the table area the user interacted with.
19
+ * @property {any} [row] - The specific row the user interacted with.
20
+ * @property {any} [value] - The value(s) associated with the HTML Input Element the user interacted with.
21
+ * @property {string | null} action - The associated action with the HTML Element (retrieved through "data-ge-action" data attribute). Default is `null`.
22
+ * @property {string | null} inputType - The type of the HTML Input Element (retrieved through "data-input-type" data attribute). Default is `null`.
23
+ * @property {string} className - The CSS class name applied to the target element. Default is an empty string.
24
+ *
25
+ * @example
26
+ * const mouseTarget = new MouseTargetData(eventTarget, tableScope);
6
27
  */
7
28
  export declare class MouseTargetData {
8
29
  rowIdx: number;
@@ -1,8 +1,65 @@
1
+ /**
2
+ * `IsSameFn` is a type alias for a function used within the `AutoRestoreOptionsIf` interface. The function is designed to compare
3
+ * two instances of a generic type `T`, in conjunction with supplied options of type `AutoRestoreOptionsIf<T>`.
4
+ *
5
+ * This function is used for determining if two instances of `T` are considered the same when restoring the state of an application.
6
+ * This helps in preserving specific states of the application, like sorting or selected state, across different stages or conditions
7
+ * based on the developer's implementation. By default, this function uses strict equality check (`===`) if not provided.
8
+ *
9
+ * @typedef
10
+ * @typeparam T - The type of the objects that the function is comparing.
11
+ *
12
+ * @param {T} r1 - The first object instance of type `T`.
13
+ * @param {T} r2 - The second object instance of type `T`.
14
+ * @param {AutoRestoreOptionsIf<T>} optionsIf - The options that dictate the behavior of auto-restoring.
15
+ *
16
+ * @returns {boolean} - Returns `true` if the two instances are considered the same, `false` otherwise.
17
+ */
1
18
  export type IsSameFn<T> = (r1: T, r2: T, optionsIf: AutoRestoreOptionsIf<T>) => boolean;
19
+ /**
20
+ * GetRowIdFn is a type alias for a function that accepts an instance of type T and returns a unique identifier
21
+ * (either a string or a number) for that instance. It is used for restoring state in conjunction with the
22
+ * AutoRestoreOptionsIf interface.
23
+ * @typedef
24
+ * @typeparam T - The type of the object that the function is going to use.
25
+ */
2
26
  export type GetRowIdFn<T> = ((row: T) => string | number);
27
+ /**
28
+ * GetStorageKeyFn is a type alias for a function that returns a unique key (as a string) for storage.
29
+ * It is used for restoring state in conjunction with the AutoRestoreOptionsIf interface.
30
+ * @typedef
31
+ */
3
32
  export type GetStorageKeyFn = (() => string);
4
33
  /**
5
- * See TableOptionsIf#autoRestoreOptions()
34
+ * The AutoRestoreOptionsIf interface is utilized to encapsulate options
35
+ * for managing auto-restoring settings across different states of the application.
36
+ * This interface is generic and can be used with any type.
37
+ *
38
+ * @interface
39
+ * @typeparam T - Any type that this interface is going to use.
40
+ * @property {boolean} autoRestoreSortingState - If true, the sorting state of
41
+ * T elements will be preserved after changes in the application state.
42
+ *
43
+ * @property {boolean=} autoRestoreCollapsedExpandedState - Optional. If true,
44
+ * the expanded/collapsed state of T elements will be preserved after changes in the application state.
45
+ *
46
+ * @property {boolean=} autoRestoreScrollPosition - Optional. If true, the scroll position
47
+ * in the list of T elements will be preserved after changes in the application state.
48
+ *
49
+ * @property {boolean=} autoRestoreCheckedState - Optional. If true, the checked state of
50
+ * T elements will be preserved after changes in the application state.
51
+ *
52
+ * @property {boolean=} autoRestoreSelectedState - Optional. If true, the selected state of
53
+ * T elements will be preserved after changes in the application state.
54
+ *
55
+ * @property {(row: T) => string | number} getRowId - Function for generating a unique identifier
56
+ * for an instance of T. If not provided, each instance of T will create a new entry every time state is saved.
57
+ *
58
+ * @property {() => string} getStorageKeyFn - Function for generating a unique key used for storage.
59
+ * If not provided, a constant key 'autorestoreoptionsif' will be used.
60
+ *
61
+ * @property {(r1: T, r2: T, optionsIf: AutoRestoreOptionsIf<T>) => boolean} isSame - Function for checking
62
+ * if two instances of T are considered the same when restoring state. If not provided, strict equality check (===) will be used.
6
63
  */
7
64
  export interface AutoRestoreOptionsIf<T> {
8
65
  autoRestoreSortingState: boolean;
@@ -1,3 +1,22 @@
1
+ /**
2
+ * The `DefaultRowHeightsIf` interface provides a specification for the default row heights in the table layout.
3
+ * It includes properties for defining heights of the header, body, and footer sections of the rows.
4
+ * Each property is of type `number`, which states the height in pixels.
5
+ *
6
+ * @property `header`: It denotes the height of the table header row. Developers can set their preferred height as per the design requirements.
7
+ * @property `body`: It sets the height of the body rows present in the table. This value can be individually adjusted by developers.
8
+ * @property `footer`: This property represents the height of the table footer row. It has a mutable value that can be modified as per requirements.
9
+ *
10
+ * @example
11
+ * // declaring a variable with default row heights
12
+ * let rowHeights: DefaultRowHeightsIf = {
13
+ * header: 50,
14
+ * body: 100,
15
+ * footer: 60
16
+ * };
17
+ *
18
+ * For implementation details, refer to the `DefaultRowHeights` class.
19
+ */
1
20
  export interface DefaultRowHeightsIf {
2
21
  header: number;
3
22
  body: number;
@@ -1,4 +1,41 @@
1
1
  import { IconIf } from "./icon.if";
2
+ /**
3
+ * The `HeaderGroupOptionsIf` interface is part of the TypeScript project,
4
+ * and it's used as a type definition for the options of a header group component.
5
+ * It includes the specifications for both the expanded and collapsed states of the said header group component.
6
+ *
7
+ * This interface contains two properties:
8
+ * - `iconExpanded`: An `IconIf` interface definition for the icon shown when the header group is expanded.
9
+ * - `iconCollapsed`: An `IconIf` interface definition for the icon shown when the header group is collapsed.
10
+ *
11
+ * Each of these properties, `iconExpanded` and `iconCollapsed`, is an object that adheres to the `IconIf` interface.
12
+ * Therefore, they should include:
13
+ * - `content`: (type `string`) which represents the HTML content of the icon.
14
+ * - `style`: (type `string`) a string containing the CSS style to be applied to the icon.
15
+ * - `classes`: (type `string[]`) which is an array of CSS classes to be applied to the icon.
16
+ *
17
+ * @interface
18
+ * @see {@link IconIf}
19
+ *
20
+ * @example
21
+ *
22
+ * const HeaderGroupOptions: HeaderGroupOptionsIf = {
23
+ * iconExpanded: {
24
+ * content: "<i class='my-expanded-icon'></i>",
25
+ * style: "color: green;",
26
+ * classes: ["my-expanded-icon-class"]
27
+ * },
28
+ * iconCollapsed: {
29
+ * content: "<i class='my-collapsed-icon'></i>",
30
+ * style: "color: red;",
31
+ * classes: ["my-collapsed-icon-class"]
32
+ * }
33
+ * };
34
+ *
35
+ * This example creates an object conforming to the `HeaderGroupOptionsIf`
36
+ * interface where `iconExpanded` and `iconCollapsed` each hold the specifications
37
+ * for the expanded and collapsed states of a header group component respectively.
38
+ */
2
39
  export interface HeaderGroupOptionsIf {
3
40
  iconExpanded: IconIf;
4
41
  iconCollapsed: IconIf;
@@ -1,6 +1,24 @@
1
1
  import { IconIf } from "./icon.if";
2
2
  /**
3
- * Represents a class that defines sorted icons, which will displayed in the header (if column is sortable).
3
+ * This TypeScript interface, `SortedOptionsIf`, represents the configuration options for sorting.
4
+ *
5
+ * It contains three properties, each of type `IconIf`. This allows the consumer of this interface to specify their
6
+ * own icon for ascending sort order (`iconAsc`), descending sort order (`iconDesc`), and a placeholder icon (`iconPlaceholder`).
7
+ *
8
+ * The IconIf interface represents an icon with content, css style, and css classes.
9
+ *
10
+ * For example:
11
+ *
12
+ * ```typescript
13
+ * {
14
+ * iconAsc: {content: '>', style: 'color:green;', classes: ['sortable-icon', 'sortable-asc']},
15
+ * iconDesc: {content: '<', style: 'color:red;', classes: ['sortable-icon', 'sortable-desc']},
16
+ * iconPlaceholder: {content: '', style: '', classes: ['sortable-icon']}
17
+ * }
18
+ * ```
19
+ *
20
+ * Note that the `classes` property in `IconIf` expects an array of strings, each string indicating a CSS class that should be applied to the icon.
21
+ *
4
22
  * @interface
5
23
  */
6
24
  export interface SortedOptionsIf {
@@ -10,6 +10,9 @@ import { GetT } from "../common/get-t";
10
10
  import { FocusModelIf } from "../../focus/focus-model.if";
11
11
  import { ShortcutActionIdMapping } from "../../action/shortcut-actionid-mapping.type";
12
12
  import { HeaderGroupOptions } from './header-group-options';
13
+ /**
14
+ * TableOptions class provides configuration options for the table.
15
+ */
13
16
  export declare class TableOptions implements TableOptionsIf {
14
17
  overflowX: "auto" | "scroll";
15
18
  overflowY: "auto" | "scroll";
@@ -37,6 +40,7 @@ export declare class TableOptions implements TableOptionsIf {
37
40
  sortedOptions: SortedOptions;
38
41
  sortOrder: SortState[];
39
42
  shortcutActionIdMapping?: ShortcutActionIdMapping;
43
+ resizeEventDebounceDelay: number;
40
44
  getEditRenderer?: GetEditRenderer;
41
45
  getSelectionModel?: GetT<SelectionModelIf>;
42
46
  getFocusModel?: GetT<FocusModelIf>;
@@ -47,6 +47,12 @@ import { HeaderGroupOptionsIf } from './header-group-options.if';
47
47
  * | shortcutActionIdMapping | Represents a mapping of shortcut action IDs. |
48
48
  */
49
49
  export interface TableOptionsIf {
50
+ /**
51
+ * The delay in milliseconds used for debouncing the resize event.
52
+ *
53
+ * @type {number}
54
+ */
55
+ resizeEventDebounceDelay: number;
50
56
  /**
51
57
  * Indicates whether the header separator border is visible.
52
58
  *
@@ -1,4 +1,45 @@
1
1
  import { IconIf } from "./icon.if";
2
+ /**
3
+ * This interface `TreeOptionsIf` represents the specific configuration and properties of a tree component, usually displayed in a User Interface (UI).
4
+ * The interface includes several properties that illustrate the statuses of tree's collapsible nodes. All properties represent the Icon characteristics in their different states in the tree.
5
+ *
6
+ * Property `arrowExpandCollapseAll` is an Icon configuration when an action to expand or collapse all nodes in the tree is performed.
7
+ *
8
+ * Property `arrowExpanded` describes Icon configuration when a single tree node is expanded.
9
+ *
10
+ * Property `arrowCollapsed` holds Icon configuration when a single tree node is collapsed.
11
+ *
12
+ * Property `arrowPlaceholder` entails Icon configuration signifying an placeholder arrow, generally used when tree nodes have no children.
13
+ *
14
+ * All properties of this interface are themselves objects based on another interface `IconIf`, symbolizing an icon configuration. Each icon has `content` - a string that represents icon, `style` - a string which determines the CSS styles applied to the icon, and `classes` - an array of strings for CSS class name(s) to be added to the icon.
15
+ *
16
+ * @interface
17
+ * @see {@link IconIf}
18
+ * @example
19
+ *
20
+ * const treeOptions: TreeOptionsIf = {
21
+ * arrowExpandCollapseAll: {
22
+ * content: '>>',
23
+ * style: 'color: blue;',
24
+ * classes: ['expand-collapse-all-icon-class'],
25
+ * },
26
+ * arrowExpanded: {
27
+ * content: '>',
28
+ * style: 'color: green;',
29
+ * classes: ['expand-icon-class'],
30
+ * },
31
+ * arrowCollapsed: {
32
+ * content: '<',
33
+ * style: 'color: red;',
34
+ * classes: ['collapse-icon-class'],
35
+ * },
36
+ * arrowPlaceholder: {
37
+ * content: '-',
38
+ * style: 'color: gray;',
39
+ * classes: ['placeholder-icon-class'],
40
+ * },
41
+ * };
42
+ */
2
43
  export interface TreeOptionsIf {
3
44
  arrowExpandCollapseAll: IconIf;
4
45
  arrowExpanded: IconIf;
@@ -1,4 +1,28 @@
1
1
  /**
2
- * Represents a class that identifies a (vertical) side of the table.
2
+ * The `SideIdent` type is utilized in various parts of the application to identify the position
3
+ * of a component or an element on the horizontal axis within a layout. This can be seen in usage
4
+ * within the `TableModel` and `AreaModelIf` classes to manage layout aspects such as column positioning
5
+ * and adjustments.
6
+ *
7
+ * The `SideIdent` is a string literal type that can have the following values:
8
+ * - "west" : Represents the left side on the horizontal axis of a layout.
9
+ * - "center": Represents the center on the horizontal axis of a layout.
10
+ * - "east" : Represents the right side on the horizontal axis of a layout.
11
+ *
12
+ * It is used as an argument in numerous functions and interfaces to specify which 'side' the operation pertains to.
13
+ *
14
+ * Example:
15
+ * - In the `TableModel` class, it's used in `getSideAreaWidth` and `getSideStartAndEndColumnIndex` methods to determine
16
+ * the position and the width of different sections.
17
+ * - In the `ArgsAdjustColumnsToRowParentParams` and `ArgsRenderCellDiv` interfaces, it's used to provide classification
18
+ * of the area requested for operation.
19
+ *
20
+ * These examples show how crucial this value is for the computation and organization of layout within the application.
21
+ *
22
+ * @see ArgsAdjustColumnsToRowParentParams
23
+ * @see ArgsRenderCellDiv
24
+ * @see TableModel
25
+ * @see AreaModelIf
26
+ * @type {("west"|"center"|"east")}
3
27
  */
4
28
  export type SideIdent = "west" | "center" | "east";
@@ -7,6 +7,42 @@ import { TableModelIf } from "../data/tablemodel/table-model.if";
7
7
  import { TableModel } from "../data/tablemodel/table-model";
8
8
  import { SelectionModelIf } from "../selection/selection-model.if";
9
9
  export declare class TableFactory {
10
+ /**
11
+ * TableFactory
12
+ *
13
+ * This class is responsible for creating table models based on various
14
+ * parameters and configurations. TableFactory provides different methods
15
+ * to create these models that must comply with TableModelIf interface.
16
+ *
17
+ * Methods:
18
+ *
19
+ * createTableModel(p: Partial<{...}>): TableModelIf
20
+ * Receives a set of parameters as a Partial object with a number of properties
21
+ * and returns an instance of an object that complies to TableModelIf interface.
22
+ * Refer to the method's documentation for details.
23
+ *
24
+ * buildByTypedRowsParam(param: {rows: T[]; columnDefs: ColumnDefIf[]; tableOptions?: TableOptionsIf; fixedLeftColumnCount?: number; fixedRightColumnCount?: number}): TableModelIf
25
+ * Receives a parameter object with essential properties needed to build the table model,
26
+ * including rows (type T array), column definitions (ColumnDefIf array),
27
+ * optional table options (TableOptionsIf object), and optional fixed column counts,
28
+ * and returns an instance of TableModelIf.
29
+ *
30
+ * buildByTypedRows(rows: T[], columnDefs: ColumnDefIf[], tableOptions?: TableOptionsIf, fixedLeftColumnCount?: number, fixedRightColumnCount?: number): TableModelIf
31
+ * Similar to `buildByTypedRowsParam` but accepts separate parameters instead of a single parameter object.
32
+ *
33
+ * createByObjectArrayParam(param: {rows: T[]; header?: string[][]; footer?: string[][]; fixedLeftColumnCount?: number; fixedRightColumnCount?: number; rowCheckboxVisible?: boolean; defaultRowHeights?: DefaultRowHeightsIf; columnDefs?: ColumnDefIf[]; columnSizes?: number[]}): TableModelIf
34
+ * Similar to `createTableModel` but accepts an object parameter with properties required to create a table, including row data, header and footer multi-line data, fixed column counts, visibility of row checkbox, default row heights, column definitions, and column sizes, and returns a TableModelIf instance.
35
+ *
36
+ * createByAreaModels(headerAreaModel: AreaModelIf, bodyAreaModel: AreaModelIf, footerAreaModel: AreaModelIf, fixedLeftColumnCount: number, fixedRightColumnCount: number, rowCheckboxVisible: boolean, defaultRowHeights: DefaultRowHeightsIf): TableModelIf
37
+ * Accepts area models for header, body, and footer, along with fixed column counts, visibility of row checkbox, and default row heights, to create a table model.
38
+ *
39
+ * createByAreaModelsParam(param: {headerAreaModel?: AreaModelIf; bodyAreaModel: AreaModelIf; footerAreaModel?: AreaModelIf; fixedLeftColumnCount?: number; fixedRightColumnCount?: number; rowCheckboxVisible?: boolean; defaultRowHeights?: DefaultRowHeightsIf; columnDefs?: ColumnDefIf[]; columnSizes?: number[]; overridingColumnWidth?: number; columnCount?: number}): TableModelIf
40
+ * Similar to `createByAreaModels` but accepts an object parameter with the required and optional properties to create the table model.
41
+ *
42
+ * createByObjectArray(rows: T[], header: string[][], footer: string[][], fixedLeftColumnCount: number, fixedRightColumnCount: number, rowCheckboxVisible: boolean, defaultRowHeights: DefaultRowHeightsIf): TableModelIf
43
+ * Allows to create a table model utilizing object array data for rows, header, and footer along with the specified configurations.
44
+ * Please consult each method's documentation for detailed explanation of their functionality.
45
+ */
10
46
  static createTableModel(p: Partial<{
11
47
  headerAreaModel: AreaModelIf;
12
48
  bodyAreaModel: AreaModelIf;
@@ -28,6 +64,23 @@ export declare class TableFactory {
28
64
  footerData: string[][];
29
65
  tableOptions: TableOptionsIf;
30
66
  }>): TableModelIf;
67
+ /**
68
+ * Constructs a table model (an instance of `TableModelIf`) by using provided parameters.
69
+ *
70
+ * @template T The generic parameter that represents the datatype of rows.
71
+ *
72
+ * @param {Object} param The parameter object.
73
+ * @param {T[]} param.rows The rows data to be used in the table model.
74
+ * @param {ColumnDefIf[]} param.columnDefs The definition of columns that are to be used in the table model.
75
+ * @param {TableOptionsIf} [param.tableOptions=new TableOptions()] Optional table options that may override default table settings. Defaults to `new TableOptions()`.
76
+ * @param {number} [param.fixedLeftColumnCount=0] Optional parameter that specifies the count of fixed (non-scrollable) columns from the left. Defaults to `0`.
77
+ * @param {number} [param.fixedRightColumnCount=0] Optional parameter that specifies the count of fixed (non-scrollable) columns from the right. Defaults to `0`.
78
+ *
79
+ * @returns {TableModelIf} The newly constructed table model.
80
+ *
81
+ * @static
82
+ * @method
83
+ */
31
84
  static buildByTypedRowsParam<T>(param: {
32
85
  rows: T[];
33
86
  columnDefs: ColumnDefIf[];
@@ -35,7 +88,87 @@ export declare class TableFactory {
35
88
  fixedLeftColumnCount?: number;
36
89
  fixedRightColumnCount?: number;
37
90
  }): TableModelIf;
91
+ /**
92
+ * Static method that helps to build a table model object. It takes in tabular data and options and constructs a suitable
93
+ * model for rendering as a table. This method is capable of handling both 'Flat' and 'Tree' data structures.
94
+ *
95
+ * @typeparam T - The type of the data in the rows.
96
+ *
97
+ * @param rows - An array of the data rows. The type of these rows could be anything which is defined by the generic type parameter T.
98
+ *
99
+ * @param columnDefs - An array of objects that define the columns of the table. Each object represents one column.
100
+ *
101
+ * @param tableOptions - A configuration object that allows you to customize how the table is displayed and behaves.
102
+ * This is optional, and if not provided it defaults to a new instance of TableOptions.
103
+ *
104
+ * @param fixedLeftColumnCount - Optional parameter that specifies the number of columns that should remain fixed from the left
105
+ * side of the table while scrolling horizontally. It defaults to 0 if not provided.
106
+ *
107
+ * @param fixedRightColumnCount - Optional parameter that specifies the number of columns that should remain fixed from the right
108
+ * side of the table while scrolling horizontally. It defaults to 0 if not provided.
109
+ *
110
+ * @returns A TableModelIf object which can be used to render the table. The TableModelIf defines the structure of the table and
111
+ * contains all its data and state.
112
+ *
113
+ * @usageNotes
114
+ *
115
+ * Here is an example of using this static method to build a table model:
116
+ *
117
+ * ```typescript
118
+ * const tableModel = TableFactory.buildByTypedRows<User>(users, [{ property: 'name', headerLabel: 'Name' }, { property: 'email', headerLabel: 'Email' }]);
119
+ * ```
120
+ *
121
+ * This will build a table with two columns 'Name' and 'Email', each row representing a 'User' object from the 'users' array.
122
+ *
123
+ * **Warning:** This function assumes that the first columnDef provided represents a checkbox column if the property of the first
124
+ * columnDef is "CheckboxColumn". If the first column is not a checkbox column, ensure that the first columnDef does not have "CheckboxColumn"
125
+ * as its property.
126
+ */
38
127
  static buildByTypedRows<T>(rows: T[], columnDefs: ColumnDefIf[], tableOptions?: TableOptionsIf, fixedLeftColumnCount?: number, fixedRightColumnCount?: number): TableModelIf;
128
+ /**
129
+ * The `createByObjectArrayParam` static method is used to create a `TableFactory` object with the data contained in the `param` object.
130
+ * This method would call the `createByObjectArray` static method, which actually constructs the `TableModel` object with the provided data.
131
+ *
132
+ * @template T - Defines the type of the items contained in the rows.
133
+ *
134
+ * @param {Object} param - Method parameter as an object that carries several properties described below:
135
+ * @param {T[]} param.rows - Array of table row data that can be of any type.
136
+ * @param {string[][]} [param.header] - Optional array of arrays with the table header data.
137
+ * @param {string[][]} [param.footer] - Optional array of arrays with the table footer data.
138
+ * @param {number} [param.fixedLeftColumnCount] - Optional number detailing how many of the beginning columns are sticky to the left.
139
+ * @param {number} [param.fixedRightColumnCount] - Optional number detailing how many of the ending columns are sticky to the right.
140
+ * @param {boolean} [param.rowCheckboxVisible] - Optional flag that indicates whether checkboxes are visible in the rows.
141
+ * @param {DefaultRowHeightsIf} [param.defaultRowHeights] - Optional object defining default heights of rows in different sections of the table. Defaults to new `DefaultRowHeights()`.
142
+ * @param {ColumnDefIf[]} [param.columnDefs] - Optional array of column definitions, each is an object conforming to `ColumnDefIf` interface.
143
+ * @param {number[]} [param.columnSizes] - Optional array of numbers providing the specific sizes for columns.
144
+ *
145
+ * @returns A `TableFactory` object created by the `createByObjectArray` method.
146
+ *
147
+ * @example
148
+ * let param = {
149
+ * rows: [{name: 'John', age: 30}, {name: 'Doe', age: 40}],
150
+ * header: [['Name', 'Age']],
151
+ * footer: [['Avg', '35']],
152
+ * fixedLeftColumnCount: 1,
153
+ * fixedRightColumnCount: 0,
154
+ * rowCheckboxVisible: true,
155
+ * defaultRowHeights: new DefaultRowHeights(40, 50, 40),
156
+ * columnDefs: [
157
+ * {
158
+ * property: 'name',
159
+ * headerLabel: 'Name',
160
+ * width: 100
161
+ * },
162
+ * {
163
+ * property: 'age',
164
+ * headerLabel: 'Age',
165
+ * width: 50
166
+ * }
167
+ * ],
168
+ * columnSizes: [100, 50]
169
+ * };
170
+ * const tableModel = TableFactory.createByObjectArrayParam(param);
171
+ */
39
172
  static createByObjectArrayParam<T>(param: {
40
173
  rows: T[];
41
174
  header?: string[][];
@@ -47,7 +180,84 @@ export declare class TableFactory {
47
180
  columnDefs?: ColumnDefIf[];
48
181
  columnSizes?: number[];
49
182
  }): TableModel;
183
+ /**
184
+ * This public static factory method creates a `TableModel` instance using the provided parameters.
185
+ * Each parameter has a default value allowing for great flexibility in creating table models.
186
+ * The main parameters are the AreaModel instances for different table sections:
187
+ *
188
+ * @param headerAreaModel - This parameter of type `AreaModelIf` represents the header area of the table.
189
+ * The default value is a new instance of `AreaModelHidden`, indicating an invisible header.
190
+ *
191
+ * @param bodyAreaModel - This parameter of type `AreaModelIf` represents the body area of the table and is required.
192
+ * It needs to be passed as it contains all the row data that will be displayed in the table.
193
+ *
194
+ * @param footerAreaModel - This `AreaModelIf` type parameter represents the footer area of the table.
195
+ * Similar to `headerAreaModel`, the default value is a new instance of `AreaModelHidden`, indicating an invisible footer.
196
+ *
197
+ * Also, the method receives parameters for fixed columns, row checkbox visibility, default row heights, column definitions, column sizes, overriding column width, and column count:
198
+ *
199
+ * @param fixedLeftColumnCount - This value indicates the number of fixed columns on the left side of the table.
200
+ * The default value is `0`, no fixed column by default.
201
+ *
202
+ * @param fixedRightColumnCount - This value indicates the number of fixed columns on the right side of the table.
203
+ * Similarly to `fixedLeftColumnCount`, its default value is `0`.
204
+ *
205
+ * @param rowCheckboxVisible - This is a boolean that determines whether a checkbox will be visible for each row.
206
+ * The default value is `false`, indicating that checkboxes will not be displayed unless otherwise specified.
207
+ *
208
+ * @param defaultRowHeights - This object of type `DefaultRowHeightsIf` allows setting of the default row heights for the table sections.
209
+ * By default, it creates a new `DefaultRowHeights` instance with values of `34` for header, body and footer.
210
+ *
211
+ * @param columnDefs - Here, an array of `ColumnDefIf[]` needs to be passed to specify the column definitions.
212
+ *
213
+ * @param columnSizes - This is an array of `number[]` providing custom column sizes.
214
+ * If not defined, an empty array `[]` is used.
215
+ *
216
+ * @param overridingColumnWidth - This number sets a uniform width for all columns, overriding individual column sizes.
217
+ * Default value is `-1`, indicating that this feature is disabled by default.
218
+ *
219
+ * @param columnCount - This is the total column count.
220
+ *
221
+ * @return A new instance of `TableModel` is created using the provided parameters.
222
+ * If a parameter isn't provided, the default value is used.
223
+ */
50
224
  static createByAreaModels(headerAreaModel: AreaModelIf | undefined, bodyAreaModel: AreaModelIf, footerAreaModel: AreaModelIf | undefined, fixedLeftColumnCount: number | undefined, fixedRightColumnCount: number | undefined, rowCheckboxVisible: boolean | undefined, defaultRowHeights: DefaultRowHeightsIf | undefined, columnDefs: ColumnDefIf[], columnSizes: number[] | undefined, overridingColumnWidth: number | undefined, columnCount: number): TableModel;
225
+ /**
226
+ * `TableFactory.createByAreaModelsParam` is a static method in the `TableFactory` class that creates a table model by area models and other optional parameters.
227
+ * This method allows more flexibility and control over table building by providing the option to decide the visibility and nature of the header, body, footer, columns, and rows in the table.
228
+ *
229
+ * @param `param` is an object that holds the configuration settings for creating the table model. Below are the properties that this object can have:
230
+ * - `headerAreaModel`: Optional. An instance of `AreaModelIf` class to be used for creating the header of the table. If not provided, a new `AreaModelHidden` is created by default.
231
+ * - `bodyAreaModel`: Mandatory. An instance of `AreaModelIf` class for body of the table.
232
+ * - `footerAreaModel`: Optional. An instance of `AreaModelIf` class for table footer. If not provided, a new `AreaModelHidden` is created by default.
233
+ * - `fixedLeftColumnCount`: Optional. Number of fixed columns on the left side of the table. Default is 0.
234
+ * - `fixedRightColumnCount`: Optional. Number of fixed columns on the right side of the table. Default is 0.
235
+ * - `rowCheckboxVisible`: Optional. Boolean that decides if the row checkboxes are visible or not. Defaults to `false`.
236
+ * - `defaultRowHeights`: Optional. An instance of `DefaultRowHeightsIf` interface that specifies default row heights. No default value.
237
+ * - `columnDefs`: Optional. Array of instance(s) of `ColumnDefIf` interface to define column properties. Defaults to an empty array.
238
+ * - `columnSizes`: Optional. Array of numbers setting the sizes of the columns. Defaults to an empty array.
239
+ * - `overridingColumnWidth`: Optional. Overrides the width of all columns with this value. Defaults to `-1` which means no width override.
240
+ * - `columnCount`: Optional. Number setting the total count of columns. Defaults to 0.
241
+ *
242
+ * @returns a new instance of `TableModelIf` created by the `createByAreaModels` method of `TableFactory` using the provided parameters.
243
+ *
244
+ * Note: The area models (`headerAreaModel`, `bodyAreaModel`, `footerAreaModel`) should be initialized before being passed to this method. If not initialized, they might need to call their `init` method to ensure proper functioning.
245
+ *
246
+ * @example
247
+ * const tableModel = TableFactory.createByAreaModelsParam({
248
+ * headerAreaModel: myHeaderModel,
249
+ * bodyAreaModel: myBodyModel,
250
+ * footerAreaModel: myFooterModel,
251
+ * fixedLeftColumnCount: 2,
252
+ * fixedRightColumnCount: 1,
253
+ * rowCheckboxVisible: true,
254
+ * defaultRowHeights: myDefaultHeights,
255
+ * columnDefs: myColumnDefs,
256
+ * columnSizes: [100, 100, 200],
257
+ * overridingColumnWidth: 150,
258
+ * columnCount: 3
259
+ * });
260
+ */
51
261
  static createByAreaModelsParam(param: {
52
262
  headerAreaModel?: AreaModelIf;
53
263
  bodyAreaModel: AreaModelIf;
@@ -61,5 +271,53 @@ export declare class TableFactory {
61
271
  overridingColumnWidth?: number;
62
272
  columnCount?: number;
63
273
  }): TableModel;
274
+ /**
275
+ * Class method `createByObjectArray` of the `TableFactory` class.
276
+ *
277
+ * This public, static method is intended to create a table model by an array of objects.
278
+ * This method is particularly useful when you are aiming to build a table from a set of data rows, header and footer information.
279
+ * The table can include both fixed and flexible columns and optional checkboxes for each row.
280
+ * The table layout can further be customized using the default row heights, column definitions, and column sizes parameters.
281
+ *
282
+ * @generic `T` - The generic type parameter for data rows.
283
+ *
284
+ * @param `rows` - This parameter is an array of typed data rows (type `T`) for the table body.
285
+ *
286
+ * @param `header` - This optional parameter is a two-dimensional string array. It defines the table header data. The default value is an empty array.
287
+ *
288
+ * @param `footer` - This optional parameter is a two-dimensional string array. It defines the table footer data. The default value is an empty array.
289
+ *
290
+ * @param `fixedLeftColumnCount` - This optional parameter specifies the count of fixed (non-scrollable) columns on the left side of the table. The default value is 0.
291
+ *
292
+ * @param `fixedRightColumnCount` - This optional parameter specifies the count of fixed (non-scrollable) columns on the right side of the table. The default value is 0.
293
+ *
294
+ * @param `rowCheckboxVisible` - This optional boolean parameter tells whether to display checkboxes for each row in the table. The default value is false.
295
+ *
296
+ * @param `defaultRowHeights` - This optional parameter is an instance of `DefaultRowHeightsIf` interface. It sets the default row heights for the header, body, and footer areas of the table.
297
+ *
298
+ * @param `columnDefs` - This optional parameter is an array of column definitions (`ColumnDefIf[]`). It helps to define the settings and properties of individual columns.
299
+ *
300
+ * @param `columnSizes` - This optional parameter is a number array. It helps to define the column widths. The default value is an empty array.
301
+ *
302
+ * The method further processes the header, footer, and body data to create respective models (`AreaModelIf`), and ultimately it creates and returns a new instance of `TableModel` containing all those prepared models, options, and properties.
303
+ *
304
+ * @returns It returns an instance of `TableModel` with all the provided/processed parameters.
305
+ *
306
+ * Note: You need to import the `AreaModelArrayOfArrays` and `AreaModelHidden` classes from the respective package/module before using this method.
307
+ *
308
+ * @example
309
+ * ```typescript
310
+ * // Given the following array of objects:
311
+ * const rows = [{field1: 'data11', field2: 'data12'}, {field1: 'data21', field2: 'data22'}];
312
+ *
313
+ * // And a set of column definitions:
314
+ * const columnDefs: ColumnDefIf[] = [{headerLabel: 'Field 1', property: 'field1'}, {headerLabel: 'Field 2', property: 'field2'}];
315
+ *
316
+ * // You can create a TableModel like following:
317
+ * let tableModel = TableFactory.createByObjectArray(rows, undefined, undefined, 0, 0, false, new DefaultRowHeights(), columnDefs);
318
+ * ```
319
+ *
320
+ * Reference: For more details regarding the `DefaultRowHeightsIf`, `ColumnDefIf`, `AreaModelIf`, and `AreaModelArrayOfArrays` classes/interfaces, please refer to the respective API documents.
321
+ */
64
322
  static createByObjectArray<T>(rows: T[], header: string[][] | undefined, footer: string[][] | undefined, fixedLeftColumnCount: number | undefined, fixedRightColumnCount: number | undefined, rowCheckboxVisible: boolean | undefined, defaultRowHeights: DefaultRowHeightsIf | undefined, columnDefs: ColumnDefIf[], columnSizes?: number[]): TableModel;
65
323
  }
@@ -1,4 +1,39 @@
1
1
  import { FocusModelIf } from './focus-model.if';
2
+ /**
3
+ * `EventFocusChangedListenerIf` is an interface that defines a contract for classes that wish to listen for changes in focus in a
4
+ * tabular data structure, such as a data grid or spreadsheet.
5
+ * Listener classes should implement the `onFocusChanged` method which would be triggered whenever focus changes in the data grid.
6
+ *
7
+ * ## Overview
8
+ * This interface ensures a consistent API for classes that need to react to changes in focus in the data grid.
9
+ * The table grid or data grid components will typically iterate over an array of `EventFocusChangedListenerIf` listeners and
10
+ * call the `onFocusChanged` method on each one when the focus within the grid changes.
11
+ * This could be due to user interactions such as clicking on a different cell or programmatically changing the cell focus.
12
+ *
13
+ * ## Usage
14
+ * Implement `EventFocusChangedListenerIf` if you want to create a class that reacts to changes in focus.
15
+ *
16
+ * ```typescript
17
+ * class MyFocusChangeListener implements EventFocusChangedListenerIf {
18
+ * onFocusChanged(model: FocusModelIf): void {
19
+ * console.log('Focus changed: ', model.getFocus());
20
+ * }
21
+ * }
22
+ * ```
23
+ *
24
+ * Use the `addEventFocusChangedListener` method from `FocusModelIf` to add your listener to the queue.
25
+ *
26
+ * ```typescript
27
+ * focusModel.addEventFocusChangedListener(new MyFocusChangeListener());
28
+ * ```
29
+ *
30
+ * ## See Also
31
+ * - [FocusModelIf](./FocusModel.md) for focus management.
32
+ * - [EventAdapter](./EventAdapter.md) for a class that implements this and other listener interfaces.
33
+ *
34
+ * @interface
35
+ * @method onFocusChanged - method to be called with an instance of the `FocusModelIf` interface whenever a focus event occurs
36
+ */
2
37
  export interface EventFocusChangedListenerIf {
3
38
  onFocusChanged(model: FocusModelIf): void;
4
39
  }