@guiexpert/demo-table-models 1.1.93 → 1.1.96

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,10 @@
1
+ import { TableModelAndOptionsIf } from '@guiexpert/table';
2
+
3
+ /**
4
+ * Aggregation demo (since 1.1.94): flat sales orders with three total rows in the footer (sum, average, maximum) and a range
5
+ * selection model – `tableApi.getSelectionAggregates()` gives the numbers for a status bar.
6
+ * The totals follow `externalFilterFunction` (set it on the returned options before the table is created).
7
+ *
8
+ * @param count - number of orders (default 50,000)
9
+ */
10
+ export declare function createAggregationModelAndOptions(count?: number): TableModelAndOptionsIf;
@@ -0,0 +1,32 @@
1
+ import { ColumnDefIf, TableModelAndOptionsIf } from '@guiexpert/table';
2
+
3
+ /** One line of an invoice – the data has no net, VAT or gross: formulas compute them. */
4
+ export interface InvoiceLineIf {
5
+ id: number;
6
+ country: string;
7
+ product: string;
8
+ quantity: number;
9
+ price: number;
10
+ /** discount in percent (0, 5, 10, 15) */
11
+ discount: number;
12
+ }
13
+ /** Invoice lines with a fixed seed: the sales orders of the row grouping demo plus a discount. */
14
+ export declare function generateInvoiceLines(count: number, seed?: number): InvoiceLineIf[];
15
+ /** The formulas of the demo (also shown on the website). */
16
+ export declare const INVOICE_FORMULAS: {
17
+ readonly net: "ROUND([quantity] * [price] * (1 - [discount] / 100), 2)";
18
+ readonly vat: "ROUND([net] * 0.19, 2)";
19
+ readonly gross: "[net] + [vat]";
20
+ readonly custom: "IF([discount] > 0, ROUND([gross] / [quantity], 2), \"–\")";
21
+ };
22
+ /** The columns: data (price and discount editable), formulas for net, VAT, gross, a share, a rank and a custom formula. */
23
+ export declare function createInvoiceColumnDefs(customFormula?: string): ColumnDefIf[];
24
+ /**
25
+ * Formula demo (since 1.1.95): invoice lines whose net, VAT and gross are formula columns (`ColumnDef.create({ formula })`),
26
+ * a share of the net total and a rank („Show values as“), a custom formula (change it with
27
+ * `tableApi.setColumnFormula("custom", text)`) and a total row (`footerAggregates` over the calculated columns).
28
+ * Price, quantity and discount are editable – the formulas follow.
29
+ *
30
+ * @param count - number of invoice lines (default 2,000)
31
+ */
32
+ export declare function createFormulaModelAndOptions(count?: number): TableModelAndOptionsIf;
@@ -1,15 +1,26 @@
1
1
  import { AreaModel, CellRendererIf, TableModelAndOptionsIf } from '@guiexpert/table';
2
2
 
3
- export declare function createLargeModelAndOptions(rowcount?: number): TableModelAndOptionsIf;
3
+ /**
4
+ * Two million rows (or `rowcount`) without row objects: an own body model computes the cells.
5
+ *
6
+ * @param rowcount - number of rows
7
+ * @param rowNumbersVisible - since 1.1.93: a fixed row number column in front ("#", 1 … 2,000,000)
8
+ */
9
+ export declare function createLargeModelAndOptions(rowcount?: number, rowNumbersVisible?: boolean): TableModelAndOptionsIf;
4
10
  export declare class LargeBodyModel extends AreaModel {
5
11
  private rowcount;
12
+ private readonly columnOffset;
6
13
  private readonly nf;
7
14
  private barRenderer;
8
- constructor(rowcount?: number);
15
+ /**
16
+ * @param rowcount - number of rows
17
+ * @param columnOffset - columns in front of the data columns (1 for a RowNumberColumnDef)
18
+ */
19
+ constructor(rowcount?: number, columnOffset?: number);
9
20
  getRowCount(): number;
10
21
  getRowHeight(_rowIndex: number): number;
11
22
  getConstantRowHeight(): number | undefined;
12
- getValueAt(rowIndex: number, columnIndex: number): number | string;
23
+ getValueAt(rowIndex: number, col: number): number | string;
13
24
  getCellRenderer(_rowIndex: number, columnIndex: number): CellRendererIf | undefined;
14
25
  getYPosByRowIndex(rowIndex: number): number;
15
26
  }
@@ -0,0 +1,24 @@
1
+ import { RowGroupField, TableModelAndOptionsIf } from '@guiexpert/table';
2
+ import { PivotOrderIf } from '../model/pivot-order.if.js';
3
+
4
+ /**
5
+ * Deterministic orders for pivot demos: {@link generateSalesOrders} plus an order date between 2024-01-01 and 2026-12-31.
6
+ *
7
+ * @param count - number of orders
8
+ * @param seed - the same seed gives the same orders
9
+ */
10
+ export declare function generatePivotOrders(count: number, seed?: number): PivotOrderIf[];
11
+ /** The year of an order (pivot field). */
12
+ export declare const pivotYear: RowGroupField<PivotOrderIf>;
13
+ /** The quarter of an order as 1 … 4, shown as "Q1" … "Q4" (pivot field). */
14
+ export declare const pivotQuarter: RowGroupField<PivotOrderIf>;
15
+ /**
16
+ * Pivot demo (since 1.1.94): orders by country › city (rows) × year › quarter (columns), revenue (sum of total) and
17
+ * number of orders, year totals (collapsible years), total column and total row. Pivot again at runtime with
18
+ * `tableApi.setPivotConfig({ columnFields: [pivotYear] })`.
19
+ *
20
+ * @param count - number of orders (default 50,000)
21
+ * @param columnFields - the column fields (default year › quarter)
22
+ * @param expanded - open row levels (default 0: countries closed)
23
+ */
24
+ export declare function createPivotModelAndOptions(count?: number, columnFields?: RowGroupField<PivotOrderIf>[], expanded?: number): TableModelAndOptionsIf;
@@ -0,0 +1,20 @@
1
+ import { TableModelAndOptionsIf, BatchEditOptionsIf, FillHandleOptionsIf } from '@guiexpert/table';
2
+ import { PriceItemIf } from '../model/price-item.if.js';
3
+
4
+ /**
5
+ * A fixed price list for fill handle and batch edit demos (since 1.1.96): `count` articles with SKU, product, category,
6
+ * valid-from date, price, discount and stock. The same count gives the same articles.
7
+ *
8
+ * @param count - number of articles (default 16)
9
+ */
10
+ export declare function generatePriceItems(count?: number): PriceItemIf[];
11
+ /**
12
+ * Fill handle and batch edit demo (since 1.1.96): a price list with range selection and the fill handle; price, discount,
13
+ * valid-from and stock are editable (and checked), "Net" is calculated (not filled). With `batchEdit` changes are
14
+ * collected until `tableApi.commitBatchEdit()` ("Save") or `cancelBatchEdit()` ("Discard").
15
+ *
16
+ * @param items - the rows (default: {@link generatePriceItems})
17
+ * @param batchEdit - collect changes (`tableOptions.batchEdit`), default `true`
18
+ * @param fillHandle - fill handle options, default `true`
19
+ */
20
+ export declare function createPriceListModelAndOptions(items?: PriceItemIf[], batchEdit?: boolean | Partial<BatchEditOptionsIf>, fillHandle?: boolean | Partial<FillHandleOptionsIf>): TableModelAndOptionsIf;
@@ -0,0 +1,19 @@
1
+ import { TableModelAndOptionsIf, RowDragOptionsIf } from '@guiexpert/table';
2
+ import { TaskIf } from '../model/task.if.js';
3
+
4
+ /**
5
+ * A fixed priority list for row drag demos (since 1.1.95): `count` tasks (title, owner, status, estimate in hours).
6
+ * The same count gives the same tasks; the first task is `locked` (no drag handle) when `withLocked` is true.
7
+ *
8
+ * @param count - number of tasks (default 20; titles repeat with a number above 20)
9
+ * @param withLocked - mark the first task as locked
10
+ */
11
+ export declare function generateTasks(count?: number, withLocked?: boolean): TaskIf[];
12
+ /**
13
+ * Row drag demo (since 1.1.95): a priority list with row numbers ("#" = the position), a drag handle in the title column
14
+ * (not for locked tasks), multi-row selection and focus. Drag a grip – or press Ctrl+Alt+↑/↓.
15
+ *
16
+ * @param tasks - the rows (default: {@link generateTasks}) – reordered in place by the table (managed)
17
+ * @param rowDragOptions - e.g. `{ managed: false }` for events only
18
+ */
19
+ export declare function createRowDragModelAndOptions(tasks?: TaskIf[], rowDragOptions?: Partial<RowDragOptionsIf>): TableModelAndOptionsIf;
@@ -0,0 +1,21 @@
1
+ import { ColumnDefIf, RowGroupField, TableModelAndOptionsIf } from '@guiexpert/table';
2
+ import { SalesOrderIf } from '../model/sales-order.if.js';
3
+
4
+ /**
5
+ * Deterministic sales orders for row grouping demos (country, city, product, category, quantity, price, total).
6
+ *
7
+ * @param count - number of orders
8
+ * @param seed - the same seed gives the same orders
9
+ */
10
+ export declare function generateSalesOrders(count: number, seed?: number): SalesOrderIf[];
11
+ /** The columns of {@link generateSalesOrders}. */
12
+ export declare function createSalesOrderColumnDefs(): ColumnDefIf[];
13
+ /**
14
+ * Row grouping demo (since 1.1.94): orders grouped by country › city (default), with the sum of quantity and total, the
15
+ * average price and a total row. Regroup at runtime with `tableApi.setRowGroupBy(["category", "product"])`.
16
+ *
17
+ * @param count - number of orders (default 50,000)
18
+ * @param groupBy - the levels (default country › city)
19
+ * @param expanded - open levels (default 1: countries open, cities closed)
20
+ */
21
+ export declare function createRowGroupModelAndOptions(count?: number, groupBy?: RowGroupField<SalesOrderIf>[], expanded?: number): TableModelAndOptionsIf;
@@ -55,5 +55,8 @@ export declare const tableOptions: {
55
55
  ariaDescribedBy?: string | undefined;
56
56
  ariaTexts?: Partial<import('@guiexpert/table').AriaTextsIf> | undefined;
57
57
  overlayOptions?: Partial<import('@guiexpert/table').OverlayOptionsIf> | undefined;
58
+ rowDragOptions?: Partial<import('@guiexpert/table').RowDragOptionsIf> | undefined;
59
+ fillHandle?: boolean | Partial<import('@guiexpert/table').FillHandleOptionsIf> | undefined;
60
+ batchEdit?: boolean | Partial<import('@guiexpert/table').BatchEditOptionsIf> | undefined;
58
61
  };
59
62
  export declare function createTimeTableModel(): TableModelIf;
@@ -55,6 +55,9 @@ export declare function createTreePeopleTableOptions(addDemoSelection?: boolean)
55
55
  ariaDescribedBy?: string | undefined;
56
56
  ariaTexts?: Partial<import('@guiexpert/table').AriaTextsIf> | undefined;
57
57
  overlayOptions?: Partial<import('@guiexpert/table').OverlayOptionsIf> | undefined;
58
+ rowDragOptions?: Partial<import('@guiexpert/table').RowDragOptionsIf> | undefined;
59
+ fillHandle?: boolean | Partial<import('@guiexpert/table').FillHandleOptionsIf> | undefined;
60
+ batchEdit?: boolean | Partial<import('@guiexpert/table').BatchEditOptionsIf> | undefined;
58
61
  };
59
62
  export declare function createTreePeopleColumnDefs(): ColumnDefIf[];
60
63
  export declare function createTreePeopleModelAndOptions(addDemoSelection?: boolean): TableModelAndOptionsIf;
@@ -0,0 +1,6 @@
1
+ import { SalesOrderIf } from './sales-order.if.js';
2
+
3
+ /** An order of the pivot demo ({@link generatePivotOrders}): a sales order with an order date (ISO, `YYYY-MM-DD`). */
4
+ export interface PivotOrderIf extends SalesOrderIf {
5
+ date: string;
6
+ }
@@ -0,0 +1,13 @@
1
+ /** An article of the price list demo (fill handle and batch edit, since 1.1.96). */
2
+ export interface PriceItemIf {
3
+ id: number;
4
+ sku: string;
5
+ product: string;
6
+ category: string;
7
+ /** ISO date `YYYY-MM-DD` */
8
+ validFrom: string;
9
+ price: number;
10
+ /** percent, 0 … 50 */
11
+ discount: number;
12
+ stock: number;
13
+ }
@@ -0,0 +1,11 @@
1
+ /** An order of the row grouping demo ({@link generateSalesOrders}). */
2
+ export interface SalesOrderIf {
3
+ id: number;
4
+ country: string;
5
+ city: string;
6
+ product: string;
7
+ category: string;
8
+ quantity: number;
9
+ price: number;
10
+ total: number;
11
+ }
@@ -0,0 +1,9 @@
1
+ /** A task of the priority list demo (row drag, since 1.1.95). */
2
+ export interface TaskIf {
3
+ id: number;
4
+ title: string;
5
+ owner: string;
6
+ status: "todo" | "doing" | "done";
7
+ estimate: number;
8
+ locked?: boolean;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/demo-table-models",
3
- "version": "1.1.93",
3
+ "version": "1.1.96",
4
4
  "license": "MIT",
5
5
  "author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "tslib": "^2.3.0",
34
- "@guiexpert/table": "^1.1.93"
34
+ "@guiexpert/table": "^1.1.96"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^20.11.17",