@guiexpert/demo-table-models 1.1.94 → 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,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;
@@ -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;
@@ -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,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,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.94",
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.94"
34
+ "@guiexpert/table": "^1.1.96"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^20.11.17",