@guiexpert/demo-table-models 1.1.94 → 1.1.97
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.
- package/index.cjs +8 -8
- package/index.d.ts +7 -0
- package/index.js +742 -350
- package/lib/createFormulaModel.d.ts +32 -0
- package/lib/createMasterDetailModel.d.ts +24 -0
- package/lib/createPriceListModel.d.ts +20 -0
- package/lib/createRowDragModel.d.ts +19 -0
- package/lib/createTimeTableModel.d.ts +4 -0
- package/lib/treepeople/generateTreePeopleModel.d.ts +5 -0
- package/model/master-order.if.d.ts +19 -0
- package/model/price-item.if.d.ts +13 -0
- package/model/task.if.d.ts +9 -0
- package/package.json +2 -2
|
@@ -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,24 @@
|
|
|
1
|
+
import { TableModelAndOptionsIf, TableModelIf, MasterDetailOptionsIf } from '@guiexpert/table';
|
|
2
|
+
import { MasterOrderIf } from '../model/master-order.if.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `count` orders with 1 … 8 items each for master/detail demos (since 1.1.97). Fixed seed: the same count gives the
|
|
6
|
+
* same orders.
|
|
7
|
+
*
|
|
8
|
+
* @param count - number of orders (default 1000)
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateMasterOrders(count?: number): MasterOrderIf[];
|
|
11
|
+
/**
|
|
12
|
+
* The table model of the items of one order – the nested table of a detail row.
|
|
13
|
+
*
|
|
14
|
+
* @param order - the master row
|
|
15
|
+
*/
|
|
16
|
+
export declare function createOrderItemsModel(order: MasterOrderIf): TableModelIf;
|
|
17
|
+
/**
|
|
18
|
+
* Master/detail demo (since 1.1.97): orders (the order number fixed on the left) – expand an order with the arrow
|
|
19
|
+
* (or Enter) and its items appear below as a second GuiExpert table over the full width.
|
|
20
|
+
*
|
|
21
|
+
* @param orders - the rows (default: 100.000 orders of {@link generateMasterOrders})
|
|
22
|
+
* @param masterDetail - overrides of the master/detail options (default: nested item table, 6 rows high)
|
|
23
|
+
*/
|
|
24
|
+
export declare function createMasterDetailModelAndOptions(orders?: MasterOrderIf[], masterDetail?: Partial<MasterDetailOptionsIf<MasterOrderIf>>): 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,9 @@ 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
|
+
masterDetail?: Partial<import('@guiexpert/table').MasterDetailOptionsIf<any>> | undefined;
|
|
61
|
+
batchEdit?: boolean | Partial<import('@guiexpert/table').BatchEditOptionsIf> | undefined;
|
|
58
62
|
};
|
|
59
63
|
export declare function createTimeTableModel(): TableModelIf;
|
|
@@ -18,6 +18,7 @@ export declare function createTreePeopleTableOptions(addDemoSelection?: boolean)
|
|
|
18
18
|
autoRestoreColumnLayout: boolean;
|
|
19
19
|
autoRestoreHeaderGroupState: boolean;
|
|
20
20
|
autoRestoreCustomState: boolean;
|
|
21
|
+
autoRestoreDetailState: boolean;
|
|
21
22
|
isSame: (r1: PersonIf, r2: PersonIf, options: import('@guiexpert/table').AutoRestoreOptionsIf<PersonIf>) => boolean;
|
|
22
23
|
getRowId: (row: PersonIf) => string | number;
|
|
23
24
|
};
|
|
@@ -55,6 +56,10 @@ export declare function createTreePeopleTableOptions(addDemoSelection?: boolean)
|
|
|
55
56
|
ariaDescribedBy?: string | undefined;
|
|
56
57
|
ariaTexts?: Partial<import('@guiexpert/table').AriaTextsIf> | undefined;
|
|
57
58
|
overlayOptions?: Partial<import('@guiexpert/table').OverlayOptionsIf> | undefined;
|
|
59
|
+
rowDragOptions?: Partial<import('@guiexpert/table').RowDragOptionsIf> | undefined;
|
|
60
|
+
fillHandle?: boolean | Partial<import('@guiexpert/table').FillHandleOptionsIf> | undefined;
|
|
61
|
+
masterDetail?: Partial<import('@guiexpert/table').MasterDetailOptionsIf<any>> | undefined;
|
|
62
|
+
batchEdit?: boolean | Partial<import('@guiexpert/table').BatchEditOptionsIf> | undefined;
|
|
58
63
|
};
|
|
59
64
|
export declare function createTreePeopleColumnDefs(): ColumnDefIf[];
|
|
60
65
|
export declare function createTreePeopleModelAndOptions(addDemoSelection?: boolean): TableModelAndOptionsIf;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** One item of an order of the master/detail demo (since 1.1.97). */
|
|
2
|
+
export interface MasterOrderItemIf {
|
|
3
|
+
sku: string;
|
|
4
|
+
product: string;
|
|
5
|
+
quantity: number;
|
|
6
|
+
unitPrice: number;
|
|
7
|
+
}
|
|
8
|
+
/** An order of the master/detail demo (since 1.1.97): the master row; its items are the detail. */
|
|
9
|
+
export interface MasterOrderIf {
|
|
10
|
+
id: number;
|
|
11
|
+
orderNo: string;
|
|
12
|
+
customer: string;
|
|
13
|
+
city: string;
|
|
14
|
+
/** ISO date `YYYY-MM-DD` */
|
|
15
|
+
date: string;
|
|
16
|
+
status: string;
|
|
17
|
+
total: number;
|
|
18
|
+
items: MasterOrderItemIf[];
|
|
19
|
+
}
|
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/demo-table-models",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.97",
|
|
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.
|
|
34
|
+
"@guiexpert/table": "^1.1.97"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.11.17",
|