@guiexpert/table 1.1.33 → 1.1.37

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.
@@ -0,0 +1,9 @@
1
+ import { ColumnWidthsIf } from './column-widths.if';
2
+ export declare class ColumnWidths implements ColumnWidthsIf {
3
+ autoCalc: boolean;
4
+ takeHeaderLabelsIntoAccount: boolean;
5
+ charCountToWidth: (charCount: number, columnIndex: number) => number;
6
+ minWidth: number;
7
+ maxWidth: number;
8
+ constructor(autoCalc?: boolean, takeHeaderLabelsIntoAccount?: boolean, charCountToWidth?: (charCount: number, columnIndex: number) => number, minWidth?: number, maxWidth?: number);
9
+ }
@@ -0,0 +1,7 @@
1
+ export interface ColumnWidthsIf {
2
+ autoCalc: boolean;
3
+ takeHeaderLabelsIntoAccount: boolean;
4
+ charCountToWidth: (charCount: number, columnIndex: number) => number;
5
+ minWidth: number;
6
+ maxWidth: number;
7
+ }
@@ -0,0 +1,9 @@
1
+ export declare class CrudAction {
2
+ action: string;
3
+ label: string;
4
+ icon: string;
5
+ elementClass: string;
6
+ elementType: 'button' | 'link';
7
+ enabled: boolean;
8
+ constructor(action: string, label: string, icon?: string, elementClass?: string, elementType?: 'button' | 'link', enabled?: boolean);
9
+ }
@@ -0,0 +1,18 @@
1
+ import { CrudOptionsIf } from './crud-options.if';
2
+ import { UrlsIf } from './urls.if';
3
+ import { CrudAction } from './crud-action';
4
+ import { ColumnWidthsIf } from './column-widths.if';
5
+ export declare class CrudOptions implements CrudOptionsIf {
6
+ urls: UrlsIf;
7
+ singleRowActions: CrudAction[];
8
+ tableActions: CrudAction[];
9
+ autoAddActionColumn: boolean;
10
+ columnWidths: ColumnWidthsIf;
11
+ calcFixedRightColumnCount: (columnCount: number) => number;
12
+ getHeadersInit: (() => HeadersInit);
13
+ getIdByObject: <T extends Record<string, unknown>>(o: T) => any;
14
+ fetchList: <T>(crudOptions: CrudOptionsIf) => Promise<T[]>;
15
+ fetchItem: <T>(crudOptions: CrudOptionsIf, id: any) => Promise<T>;
16
+ deleteItem: (crudOptions: CrudOptionsIf, id: any) => Promise<any>;
17
+ getId: <T>(item: T) => any;
18
+ }
@@ -0,0 +1,17 @@
1
+ import { UrlsIf } from './urls.if';
2
+ import { CrudAction } from './crud-action';
3
+ export interface CrudOptionsIf {
4
+ getHeadersInit?: () => HeadersInit;
5
+ urls: UrlsIf;
6
+ singleRowActions: CrudAction[];
7
+ tableActions: CrudAction[];
8
+ fetchList: <T>(crudOptions: CrudOptionsIf) => Promise<T[]>;
9
+ fetchItem: <T>(crudOptions: CrudOptionsIf, id: any) => Promise<T>;
10
+ deleteItem: (crudOptions: CrudOptionsIf, id: any) => Promise<any>;
11
+ getIdByObject: <T extends Record<string, unknown>>(o: T) => any;
12
+ calcFixedRightColumnCount: (columnCount: number) => number;
13
+ autoAddActionColumn?: boolean;
14
+ isActionDeleteVisible?: boolean;
15
+ isActionDeleteEnabled?: boolean;
16
+ getId: <T>(item: T) => any;
17
+ }
@@ -0,0 +1,21 @@
1
+ import { CrudOptions } from './crud-options';
2
+ import { CreateTableModelPara } from '../factory/table-factory';
3
+ import { TableModelAndOptionsIf } from '../data/table-model-and-options.if';
4
+ import { ActionEventListenerIf } from '../renderer/action/action-event-listener.if';
5
+ import { ActionEventIf } from '../renderer/action/action-event.if';
6
+ import { TableModelIf } from '../data/tablemodel/table-model.if';
7
+ import { TableOptionsIf } from '../data/options/table-options.if';
8
+ import { AreaModelObjectArrayWithColumndefs } from '../data/tablemodel/areamodel/area-model-object-array-with-columndefs';
9
+ export declare class CrudTableModelFactory implements ActionEventListenerIf {
10
+ tableModel: TableModelIf | undefined;
11
+ bodyModel: AreaModelObjectArrayWithColumndefs<any> | undefined;
12
+ tableOptions: TableOptionsIf | undefined;
13
+ crudOptions: CrudOptions;
14
+ listenActionEvent: (actionEvent: ActionEventIf) => void;
15
+ createTableModel<T>(crudOptions: CrudOptions, p: Partial<CreateTableModelPara>, callback?: (tableModelAndOptions: TableModelAndOptionsIf) => void, listenActionEvent?: (actionEvent: ActionEventIf) => void): void;
16
+ onActionEvent(actionEvent: ActionEventIf): void;
17
+ private calcAutoColumnWidths;
18
+ private getValueByT;
19
+ private getPropertyValue;
20
+ private extractProperties;
21
+ }
@@ -0,0 +1,6 @@
1
+ import { UrlInfoIf } from './url-info.if';
2
+ export declare class UrlInfo implements UrlInfoIf {
3
+ method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH';
4
+ url: string;
5
+ constructor(method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH', url: string);
6
+ }
@@ -0,0 +1,4 @@
1
+ export interface UrlInfoIf {
2
+ url: string;
3
+ method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH';
4
+ }
@@ -0,0 +1,8 @@
1
+ import { UrlInfoIf } from './url-info.if';
2
+ export interface UrlsIf {
3
+ list: UrlInfoIf;
4
+ create?: UrlInfoIf;
5
+ read?: UrlInfoIf;
6
+ update?: UrlInfoIf;
7
+ delete?: UrlInfoIf;
8
+ }
@@ -1,4 +1,6 @@
1
1
  import { Size } from "./size";
2
+ export declare const px500: Size;
3
+ export declare const px400: Size;
2
4
  export declare const px300: Size;
3
5
  export declare const px290: Size;
4
6
  export declare const px280: Size;
@@ -19,6 +19,7 @@ export declare class AreaModelObjectArray<T> extends AbstractAreaModel<T> implem
19
19
  protected sorterService: SorterService;
20
20
  constructor(areaIdent: AreaIdent, rows: T[], defaultRowHeight: number, columnDefs?: ColumnDefIf[]);
21
21
  setRows(rows: T[]): void;
22
+ filterRowsByPredict(predict: (row: T) => boolean): void;
22
23
  getRowCount(): number;
23
24
  getValueAt(rowIndex: number, columnIndex: number): any;
24
25
  getFilteredRows(): T[];
@@ -9,6 +9,7 @@ import { FilterFunction } from "../common/filter-function";
9
9
  import { SortItem } from "../common/sort-item";
10
10
  import { SelectionModelIf } from "../../selection/selection-model.if";
11
11
  import { GetT } from "../common/get-t";
12
+ import { TableScope } from '../../table-scope';
12
13
  /**
13
14
  * This is a default implementation of TableModelIf.
14
15
  * Ths TableModel is on one hand a container for the header, body, and footer models
@@ -42,7 +43,7 @@ export declare class TableModel implements TableModelIf {
42
43
  protected overridingColumnWidth: number;
43
44
  protected columnCount: number;
44
45
  protected parentSize: number;
45
- readonly getSelectionModel: GetT<SelectionModelIf>;
46
+ getSelectionModel: GetT<SelectionModelIf>;
46
47
  protected rowCount: number;
47
48
  protected contentHeightInPx: number;
48
49
  protected contentWidthInPx: number;
@@ -281,4 +282,7 @@ export declare class TableModel implements TableModelIf {
281
282
  private arrayMove;
282
283
  private recalcContentWidthInPx;
283
284
  private calcXPositions;
285
+ private tableScope;
286
+ setTableScope(tableScope: TableScope): void;
287
+ getTableScope(): TableScope | undefined;
284
288
  }
@@ -5,6 +5,7 @@ import { AreaModelIf } from "./areamodel/area-model.if";
5
5
  import { FilterFunction } from "../common/filter-function";
6
6
  import { SortItem } from "../common/sort-item";
7
7
  import { SelectionModelIf } from "../../selection/selection-model.if";
8
+ import { TableScope } from '../../table-scope';
8
9
  /**
9
10
  * The TableModelIf is on one hand a container for the header, body, and footer models
10
11
  * (see : #getAreaModel, and #AreaModelIf), and on the other hand the master of
@@ -226,4 +227,6 @@ export interface TableModelIf {
226
227
  * @returns {SelectionModelIf|undefined} The selection model instance if available, or undefined if none is found.
227
228
  */
228
229
  getSelectionModel(): SelectionModelIf | undefined;
230
+ setTableScope(tableScope: TableScope): void;
231
+ getTableScope(): TableScope | undefined;
229
232
  }
@@ -4,7 +4,7 @@ import { TableModelIf } from "./data/tablemodel/table-model.if";
4
4
  import { TableOptionsIf } from "./data/options/table-options.if";
5
5
  import { GeoData } from "./data/geo-data";
6
6
  /**
7
- * Represents an store for HTML elements.
7
+ * Represents a store for HTML elements.
8
8
  * @class
9
9
  */
10
10
  export declare class EleScope {
@@ -6,6 +6,27 @@ import { TableOptionsIf } from "../data/options/table-options.if";
6
6
  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
+ export type CreateTableModelPara = {
10
+ headerAreaModel: AreaModelIf;
11
+ bodyAreaModel: AreaModelIf;
12
+ footerAreaModel: AreaModelIf;
13
+ fixedLeftColumnCount: number;
14
+ fixedRightColumnCount: number;
15
+ rowCheckboxVisible: boolean;
16
+ defaultRowHeights: DefaultRowHeightsIf;
17
+ columnDefs: ColumnDefIf[];
18
+ columnSizes: number[];
19
+ overridingColumnWidth: number;
20
+ columnCount: number;
21
+ parentSize: number;
22
+ getSelectionModel: GetT<SelectionModelIf>;
23
+ rows: any[];
24
+ properties: string[];
25
+ bodyData: any[][];
26
+ headerData: string[][];
27
+ footerData: string[][];
28
+ tableOptions: TableOptionsIf;
29
+ };
9
30
  export declare class TableFactory {
10
31
  /**
11
32
  * TableFactory
@@ -43,27 +64,7 @@ export declare class TableFactory {
43
64
  * Allows to create a table model utilizing object array data for rows, header, and footer along with the specified configurations.
44
65
  * Please consult each method's documentation for detailed explanation of their functionality.
45
66
  */
46
- static createTableModel(p: Partial<{
47
- headerAreaModel: AreaModelIf;
48
- bodyAreaModel: AreaModelIf;
49
- footerAreaModel: AreaModelIf;
50
- fixedLeftColumnCount: number;
51
- fixedRightColumnCount: number;
52
- rowCheckboxVisible: boolean;
53
- defaultRowHeights: DefaultRowHeightsIf;
54
- columnDefs: ColumnDefIf[];
55
- columnSizes: number[];
56
- overridingColumnWidth: number;
57
- columnCount: number;
58
- parentSize: number;
59
- getSelectionModel: GetT<SelectionModelIf>;
60
- rows: any[];
61
- properties: string[];
62
- bodyData: any[][];
63
- headerData: string[][];
64
- footerData: string[][];
65
- tableOptions: TableOptionsIf;
66
- }>): TableModelIf;
67
+ static createTableModel(p: Partial<CreateTableModelPara>): TableModelIf;
67
68
  /**
68
69
  * Constructs a table model (an instance of `TableModelIf`) by using provided parameters.
69
70
  *
@@ -0,0 +1,4 @@
1
+ import { ActionEventIf } from './action-event.if';
2
+ export interface ActionEventListenerIf {
3
+ onActionEvent(actionEvent: ActionEventIf): void;
4
+ }
@@ -0,0 +1,12 @@
1
+ import { AreaIdent } from '../../data/tablemodel/area-ident.type';
2
+ import { ActionEventIf } from './action-event.if';
3
+ import { AreaModelIf } from '../../data/tablemodel/areamodel/area-model.if';
4
+ export declare class ActionEvent implements ActionEventIf {
5
+ action: string;
6
+ area: AreaIdent;
7
+ areaModel: AreaModelIf;
8
+ rowIndex: number;
9
+ columnIndex: number;
10
+ id: any;
11
+ constructor(action: string, area: AreaIdent, areaModel: AreaModelIf, rowIndex: number, columnIndex: number, id: any);
12
+ }
@@ -0,0 +1,8 @@
1
+ import { AreaIdent } from '../../data/tablemodel/area-ident.type';
2
+ export interface ActionEventIf {
3
+ action: string;
4
+ area: AreaIdent;
5
+ rowIndex: number;
6
+ columnIndex: number;
7
+ id: any;
8
+ }
@@ -0,0 +1,18 @@
1
+ import { CellRendererIf } from '../cell-render.if';
2
+ import { AreaIdent } from '../../data/tablemodel/area-ident.type';
3
+ import { AreaModelIf } from '../../data/tablemodel/areamodel/area-model.if';
4
+ import { DomServiceIf } from '../../service/dom-service.if';
5
+ import { RendererCleanupFnType } from '../renderer-cleanup-fn.type';
6
+ import { ActionEventListenerIf } from './action-event-listener.if';
7
+ import { CrudAction } from '../../crud/crud-action';
8
+ export declare class ActionsCellRenderer implements CellRendererIf {
9
+ private actionEventListener;
10
+ private crudActions;
11
+ constructor(actionEventListener: ActionEventListenerIf, crudActions: CrudAction[]);
12
+ render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
13
+ private buildButtonHtml;
14
+ private buildLinkHtml;
15
+ private addClickEventListeners;
16
+ private createActionEvent;
17
+ private getCrudActions;
18
+ }
@@ -5,6 +5,7 @@ import { SelectionModel } from './selection/selection-model';
5
5
  import { ActionId } from './action/action-id.type';
6
6
  import { ShortcutActionIdMapping } from './action/shortcut-actionid-mapping.type';
7
7
  import { SelectionModelIf } from './selection/selection-model.if';
8
+ import { TableModelIf } from './data/tablemodel/table-model.if';
8
9
  /**
9
10
  * The TableApi class provides a set of methods to interact with a table's functionality.
10
11
  * It enables actions such as updating cells, scrolling, managing visibility, handling selection,
@@ -170,4 +171,8 @@ export declare class TableApi {
170
171
  * or undefined if no selection model is available.
171
172
  */
172
173
  getSelectionModel(): SelectionModelIf | undefined;
174
+ autoResizeColumns(recalcWrappers?: boolean): void;
175
+ recalcWrappers(): void;
176
+ setColumnWidth(columnIndex: number, width: number): void;
177
+ getTableModel(): TableModelIf;
173
178
  }
@@ -291,4 +291,8 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
291
291
  * @private
292
292
  */
293
293
  private autoRestoreCollapsedExpandedState;
294
+ calcAutoColumnWidths(): number[];
295
+ setColumnWidth(columnIndex: number, width: number): void;
296
+ autoResizeColumns(recalcWrappers?: boolean): void;
297
+ recalcWrappers(): void;
294
298
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.33",
3
+ "version": "1.1.37",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./index.js",