@guiexpert/table 1.1.39 → 1.1.42
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/css/main.css +40 -2
- package/css/table-classes.css +40 -3
- package/index.cjs +49 -35
- package/index.d.ts +5 -0
- package/index.js +1136 -652
- package/lib/common/generator/domain/property-type.d.ts +41 -0
- package/lib/common/generator/domain/value-info.d.ts +8 -0
- package/lib/common/generator/property-item-tree.service.d.ts +101 -0
- package/lib/common/generator/scheme-generator-service.d.ts +85 -0
- package/lib/common/generator/scheme-generator-service.demo.d.ts +1 -0
- package/lib/table/crud/crud-object-edit.d.ts +11 -0
- package/lib/table/crud/crud-options.d.ts +4 -1
- package/lib/table/crud/crud-options.if.d.ts +3 -1
- package/lib/table/crud/crud-table-model-factory.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface PropertyType {
|
|
2
|
+
type: string;
|
|
3
|
+
}
|
|
4
|
+
export interface PropertyTypeNamable extends PropertyType {
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class AnyPropertyType implements PropertyType {
|
|
8
|
+
type: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class UndefinedPropertyType implements PropertyType {
|
|
11
|
+
type: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class NullPropertyType implements PropertyType {
|
|
14
|
+
type: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class StringPropertyType implements PropertyType {
|
|
17
|
+
type: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class NumberPropertyType implements PropertyType {
|
|
20
|
+
type: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class BooleanPropertyType implements PropertyType {
|
|
23
|
+
type: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class ArrayPropertyType implements PropertyType {
|
|
26
|
+
items: PropertyType[];
|
|
27
|
+
type: string;
|
|
28
|
+
constructor(items?: PropertyType[]);
|
|
29
|
+
}
|
|
30
|
+
export declare class PropertyItem {
|
|
31
|
+
name: string;
|
|
32
|
+
types: PropertyType[];
|
|
33
|
+
constructor(name: string, types?: PropertyType[]);
|
|
34
|
+
toString(): string;
|
|
35
|
+
}
|
|
36
|
+
export declare class ObjectPropertyType implements PropertyTypeNamable {
|
|
37
|
+
name: string;
|
|
38
|
+
properties: PropertyItem[];
|
|
39
|
+
type: string;
|
|
40
|
+
constructor(name: string, properties?: PropertyItem[]);
|
|
41
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { PropertyType } from './domain/property-type';
|
|
2
|
+
export declare class PropertyItemTreeService {
|
|
3
|
+
entitySuffix: string;
|
|
4
|
+
/**
|
|
5
|
+
* Converts a json or object structure like this:
|
|
6
|
+
* [
|
|
7
|
+
* {
|
|
8
|
+
* id: 1,
|
|
9
|
+
* name: "Alice",
|
|
10
|
+
* description: "Lorem ipsum dolor",
|
|
11
|
+
* isActive: true,
|
|
12
|
+
* tags: ["typescript", "javascript"],
|
|
13
|
+
* profile: { age: 30, location: "Berlin" },
|
|
14
|
+
* preferences: [{ key: "theme", value: "dark" }],
|
|
15
|
+
* },
|
|
16
|
+
* {
|
|
17
|
+
* id: 2,
|
|
18
|
+
* name: "Marc",
|
|
19
|
+
* description: "Lorem ipsum dolor",
|
|
20
|
+
* isActive: false,
|
|
21
|
+
* tags: ["java", "javascript"],
|
|
22
|
+
* profile: { age: 55, location: "Frankfurt" },
|
|
23
|
+
* preferences: [{ key: "theme", value: "light" }],
|
|
24
|
+
* },
|
|
25
|
+
* {
|
|
26
|
+
* id: null,
|
|
27
|
+
* name: "Bob",
|
|
28
|
+
* isActive: false,
|
|
29
|
+
* tags: null,
|
|
30
|
+
* profile: { age: 25, location: "Frankfurt" },
|
|
31
|
+
* preferences: [{ key: "language", value: "de" }],
|
|
32
|
+
* },
|
|
33
|
+
* ]
|
|
34
|
+
*
|
|
35
|
+
* into a PropertyTape tree structure like this:
|
|
36
|
+
*
|
|
37
|
+
* return new ArrayPropertyType(
|
|
38
|
+
* [
|
|
39
|
+
* new ObjectPropertyType('XyzRowEntity', [
|
|
40
|
+
* new PropertyItem('id', [new NumberPropertyType(), new NullPropertyType()]),
|
|
41
|
+
* new PropertyItem('name', [new StringPropertyType()]),
|
|
42
|
+
* new PropertyItem('description', [new StringPropertyType(), new UndefinedPropertyType()]),
|
|
43
|
+
* new PropertyItem('isActive', [new BooleanPropertyType()]),
|
|
44
|
+
* new PropertyItem('tags', [
|
|
45
|
+
* new ArrayPropertyType(
|
|
46
|
+
* [new StringPropertyType()]
|
|
47
|
+
* ),
|
|
48
|
+
* new NullPropertyType()
|
|
49
|
+
* ]),
|
|
50
|
+
* new PropertyItem('profile', [
|
|
51
|
+
* new ObjectPropertyType('profile', [
|
|
52
|
+
* new PropertyItem('age', [new NumberPropertyType()]),
|
|
53
|
+
* new PropertyItem('location', [new StringPropertyType()])
|
|
54
|
+
* ])
|
|
55
|
+
* ]),
|
|
56
|
+
* new PropertyItem('preferences', [
|
|
57
|
+
* new ArrayPropertyType(
|
|
58
|
+
* [
|
|
59
|
+
* new ObjectPropertyType('preference', [
|
|
60
|
+
* new PropertyItem('key', [new StringPropertyType()]),
|
|
61
|
+
* new PropertyItem('value', [new StringPropertyType()])
|
|
62
|
+
* ])
|
|
63
|
+
* ])
|
|
64
|
+
* ])
|
|
65
|
+
* ])
|
|
66
|
+
* ]);
|
|
67
|
+
*
|
|
68
|
+
* The PropertyTape tree structure can be rendered as TypeScript interface definitions with the SchemeGenerator:
|
|
69
|
+
*
|
|
70
|
+
* export interface XyzRowEntity {
|
|
71
|
+
* description: string;
|
|
72
|
+
* id: (null | number);
|
|
73
|
+
* isActive: boolean;
|
|
74
|
+
* name: string;
|
|
75
|
+
* preferences: Array<(PreferenceEntity)>;
|
|
76
|
+
* profile: ProfileEntity;
|
|
77
|
+
* tags: (null | Array<()> | string);
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* export interface PreferencesEntity {
|
|
81
|
+
* key: string;
|
|
82
|
+
* value: string;
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* export interface ProfileEntity {
|
|
86
|
+
* age: number;
|
|
87
|
+
* location: string;
|
|
88
|
+
* }
|
|
89
|
+
*
|
|
90
|
+
* @param parsedObject
|
|
91
|
+
* @param rootName
|
|
92
|
+
*/
|
|
93
|
+
object2PropertyType(parsedObject: Object, rootName?: string): PropertyType;
|
|
94
|
+
private valueInfos2PropertyType;
|
|
95
|
+
getParentPath(path: string): string;
|
|
96
|
+
private logValueInfos;
|
|
97
|
+
private mergeValueInfos;
|
|
98
|
+
private extractValueInfos;
|
|
99
|
+
private createPropertyItem;
|
|
100
|
+
private createPropertyType;
|
|
101
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { PropertyType } from './domain/property-type';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Converts a json or object structure like this:
|
|
5
|
+
* [
|
|
6
|
+
* {
|
|
7
|
+
* id: 1,
|
|
8
|
+
* name: "Alice",
|
|
9
|
+
* description: "Lorem ipsum dolor",
|
|
10
|
+
* isActive: true,
|
|
11
|
+
* tags: ["typescript", "javascript"],
|
|
12
|
+
* profile: { age: 30, location: "Berlin" },
|
|
13
|
+
* preferences: [{ key: "theme", value: "dark" }],
|
|
14
|
+
* },
|
|
15
|
+
* {
|
|
16
|
+
* id: 2,
|
|
17
|
+
* name: "Marc",
|
|
18
|
+
* description: "Lorem ipsum dolor",
|
|
19
|
+
* isActive: false,
|
|
20
|
+
* tags: ["java", "javascript"],
|
|
21
|
+
* profile: { age: 55, location: "Frankfurt" },
|
|
22
|
+
* preferences: [{ key: "theme", value: "light" }],
|
|
23
|
+
* },
|
|
24
|
+
* {
|
|
25
|
+
* id: null,
|
|
26
|
+
* name: "Bob",
|
|
27
|
+
* isActive: false,
|
|
28
|
+
* tags: null,
|
|
29
|
+
* profile: { age: 25, location: "Frankfurt" },
|
|
30
|
+
* preferences: [{ key: "language", value: "de" }],
|
|
31
|
+
* },
|
|
32
|
+
* ]
|
|
33
|
+
*
|
|
34
|
+
* into a TypeScript interface definitions:
|
|
35
|
+
*
|
|
36
|
+
* export interface XyzRowEntity {
|
|
37
|
+
* description: string;
|
|
38
|
+
* id: (null | number);
|
|
39
|
+
* isActive: boolean;
|
|
40
|
+
* name: string;
|
|
41
|
+
* preferences: Array<(PreferenceEntity)>;
|
|
42
|
+
* profile: ProfileEntity;
|
|
43
|
+
* tags: (null | Array<()> | string);
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* export interface PreferencesEntity {
|
|
47
|
+
* key: string;
|
|
48
|
+
* value: string;
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* export interface ProfileEntity {
|
|
52
|
+
* age: number;
|
|
53
|
+
* location: string;
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
*
|
|
57
|
+
* const json = JSON.stringify(demoData);
|
|
58
|
+
* const schemeGenerator = new SchemeGenerator(json, 'XyzRow');
|
|
59
|
+
* console.log(schemeGenerator.renderTypeScriptInterfaces().join('\n'));
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
export declare class SchemeGenerator {
|
|
63
|
+
rootName: string;
|
|
64
|
+
entitySuffix: string;
|
|
65
|
+
rootPropertyType: PropertyType | null;
|
|
66
|
+
private renderTypeScriptInterfacesFifo;
|
|
67
|
+
private renderTypeScriptInterfacesDone;
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @param json
|
|
71
|
+
* @param rootName
|
|
72
|
+
*/
|
|
73
|
+
constructor(json: string | object, rootName?: string);
|
|
74
|
+
jon2Object(json: string): object;
|
|
75
|
+
object2PropertyType(parsedObject: Object): PropertyType;
|
|
76
|
+
renderTypeScriptInterfaces(): string[];
|
|
77
|
+
private renderTypeScriptInterfacesFifoNext;
|
|
78
|
+
private renderTypeScriptInterfacesRecursive;
|
|
79
|
+
private getEntityName;
|
|
80
|
+
private propertyItem2InterfaceDateType;
|
|
81
|
+
private renderType;
|
|
82
|
+
private containsUndefinedPropertyType;
|
|
83
|
+
private firstLetterUppercase;
|
|
84
|
+
private trimArraySuffixes;
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class CrudObjectEdit<T extends Record<string, any>> {
|
|
2
|
+
private idKey;
|
|
3
|
+
dialogTitle: string;
|
|
4
|
+
private object;
|
|
5
|
+
constructor(idKey: keyof T, obj: T, dialogTitle?: string);
|
|
6
|
+
openDialog(onSave: (updatedObject: T) => void): void;
|
|
7
|
+
private generateForm;
|
|
8
|
+
private setNestedValue;
|
|
9
|
+
private getCombinedKey;
|
|
10
|
+
private getLabel;
|
|
11
|
+
}
|
|
@@ -10,9 +10,12 @@ export declare class CrudOptions implements CrudOptionsIf {
|
|
|
10
10
|
columnWidths: ColumnWidthsIf;
|
|
11
11
|
calcFixedRightColumnCount: (columnCount: number) => number;
|
|
12
12
|
getHeadersInit: (() => HeadersInit);
|
|
13
|
+
getIdKey: () => string;
|
|
13
14
|
getIdByObject: <T extends Record<string, unknown>>(o: T) => any;
|
|
14
15
|
fetchList: <T>(crudOptions: CrudOptionsIf) => Promise<T[]>;
|
|
15
16
|
fetchItem: <T>(crudOptions: CrudOptionsIf, id: any) => Promise<T>;
|
|
17
|
+
updateItem: (crudOptions: CrudOptionsIf, id: any, item: any) => Promise<any>;
|
|
18
|
+
createItem: (crudOptions: CrudOptionsIf, item: any) => Promise<any>;
|
|
16
19
|
deleteItem: (crudOptions: CrudOptionsIf, id: any) => Promise<any>;
|
|
17
|
-
|
|
20
|
+
getEmptyItem: () => any;
|
|
18
21
|
}
|
|
@@ -7,11 +7,13 @@ export interface CrudOptionsIf {
|
|
|
7
7
|
tableActions: CrudAction[];
|
|
8
8
|
fetchList: <T>(crudOptions: CrudOptionsIf) => Promise<T[]>;
|
|
9
9
|
fetchItem: <T>(crudOptions: CrudOptionsIf, id: any) => Promise<T>;
|
|
10
|
+
updateItem: (crudOptions: CrudOptionsIf, id: any, item: any) => Promise<any>;
|
|
10
11
|
deleteItem: (crudOptions: CrudOptionsIf, id: any) => Promise<any>;
|
|
12
|
+
getIdKey: () => string;
|
|
11
13
|
getIdByObject: <T extends Record<string, unknown>>(o: T) => any;
|
|
14
|
+
getEmptyItem: () => any;
|
|
12
15
|
calcFixedRightColumnCount: (columnCount: number) => number;
|
|
13
16
|
autoAddActionColumn?: boolean;
|
|
14
17
|
isActionDeleteVisible?: boolean;
|
|
15
18
|
isActionDeleteEnabled?: boolean;
|
|
16
|
-
getId: <T>(item: T) => any;
|
|
17
19
|
}
|
|
@@ -13,6 +13,7 @@ export declare class CrudTableModelFactory implements ActionEventListenerIf {
|
|
|
13
13
|
crudOptions: CrudOptions;
|
|
14
14
|
listenActionEvent: (actionEvent: ActionEventIf) => void;
|
|
15
15
|
createTableModel<T>(crudOptions: CrudOptions, p: Partial<CreateTableModelPara>, callback?: (tableModelAndOptions: TableModelAndOptionsIf) => void, listenActionEvent?: (actionEvent: ActionEventIf) => void): void;
|
|
16
|
+
openDialogForCreate(): void;
|
|
16
17
|
onActionEvent(actionEvent: ActionEventIf): void;
|
|
17
18
|
private calcAutoColumnWidths;
|
|
18
19
|
private getValueByT;
|