@guiexpert/table 1.1.33 → 1.1.36

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
+ 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,15 @@
1
+ import { CrudOptionsIf } from './crud-options.if';
2
+ import { UrlsIf } from './urls.if';
3
+ import { CrudAction } from './crud-action';
4
+ export declare class CrudOptions implements CrudOptionsIf {
5
+ urls: UrlsIf;
6
+ singleRowActions: CrudAction[];
7
+ tableActions: CrudAction[];
8
+ autoAddActionColumn: boolean;
9
+ getHeadersInit: (() => HeadersInit);
10
+ getIdByObject: <T extends Record<string, unknown>>(o: T) => any;
11
+ fetchList: <T>(crudOptions: CrudOptionsIf) => Promise<T[]>;
12
+ fetchItem: <T>(crudOptions: CrudOptionsIf, id: any) => Promise<T>;
13
+ deleteItem: (crudOptions: CrudOptionsIf, id: any) => Promise<any>;
14
+ getId: <T>(item: T) => any;
15
+ }
@@ -0,0 +1,16 @@
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
+ autoAddActionColumn?: boolean;
13
+ isActionDeleteVisible?: boolean;
14
+ isActionDeleteEnabled?: boolean;
15
+ getId: <T>(item: T) => any;
16
+ }
@@ -0,0 +1,16 @@
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 | undefined;
14
+ createTableModel<T>(crudOptions: CrudOptions, p: Partial<CreateTableModelPara>, callback?: (tableModelAndOptions: TableModelAndOptionsIf) => void): void;
15
+ onActionEvent(actionEvent: ActionEventIf): void;
16
+ }
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.33",
3
+ "version": "1.1.36",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./index.js",