@guiexpert/table 1.1.42 → 1.1.45

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,12 @@
1
+ import { PropertyType } from './domain/property-type';
2
+ export declare class ColumnDefGenerator {
3
+ rootPropertyType: PropertyType | null;
4
+ private allowCustomRenderer;
5
+ private bufCustomRenderer;
6
+ renderColumnDefs(rootPropertyType: PropertyType, allowCustomRenderer?: boolean): string[];
7
+ private iteratePropertyItems;
8
+ private LABEL_MAPPINGS;
9
+ private transformLabel;
10
+ private getReadableColumnLabel;
11
+ private renderCumstomCellRenderer;
12
+ }
@@ -1,41 +1,62 @@
1
+ export declare const PROPERTY_TYPE_KEY_ANY = "any";
2
+ export declare const PROPERTY_TYPE_KEY_UNDEFINED = "undefined";
3
+ export declare const PROPERTY_TYPE_KEY_NULL = "null";
4
+ export declare const PROPERTY_TYPE_KEY_STRING = "string";
5
+ export declare const PROPERTY_TYPE_KEY_NUMBER = "number";
6
+ export declare const PROPERTY_TYPE_KEY_BOOLEAN = "boolean";
7
+ export declare const PROPERTY_TYPE_KEY_ARRAY = "Array";
8
+ export declare const PROPERTY_TYPE_KEY_OBJECT = "object";
9
+ export declare const UNIMPORTANT_TYPES: string[];
1
10
  export interface PropertyType {
2
11
  type: string;
3
- }
4
- export interface PropertyTypeNamable extends PropertyType {
5
- name: string;
12
+ propertyName: string;
6
13
  }
7
14
  export declare class AnyPropertyType implements PropertyType {
15
+ propertyName: string;
8
16
  type: string;
17
+ constructor(propertyName: string);
9
18
  }
10
19
  export declare class UndefinedPropertyType implements PropertyType {
20
+ propertyName: string;
11
21
  type: string;
22
+ constructor(propertyName: string);
12
23
  }
13
24
  export declare class NullPropertyType implements PropertyType {
25
+ propertyName: string;
14
26
  type: string;
27
+ constructor(propertyName: string);
15
28
  }
16
29
  export declare class StringPropertyType implements PropertyType {
30
+ propertyName: string;
17
31
  type: string;
32
+ constructor(propertyName: string);
18
33
  }
19
34
  export declare class NumberPropertyType implements PropertyType {
35
+ propertyName: string;
20
36
  type: string;
37
+ constructor(propertyName: string);
21
38
  }
22
39
  export declare class BooleanPropertyType implements PropertyType {
40
+ propertyName: string;
23
41
  type: string;
42
+ constructor(propertyName: string);
24
43
  }
25
44
  export declare class ArrayPropertyType implements PropertyType {
45
+ propertyName: string;
26
46
  items: PropertyType[];
27
47
  type: string;
28
- constructor(items?: PropertyType[]);
48
+ constructor(propertyName: string, items?: PropertyType[]);
29
49
  }
30
50
  export declare class PropertyItem {
31
- name: string;
51
+ propertyName: string;
32
52
  types: PropertyType[];
33
- constructor(name: string, types?: PropertyType[]);
53
+ constructor(propertyName: string, types?: PropertyType[]);
34
54
  toString(): string;
35
55
  }
36
- export declare class ObjectPropertyType implements PropertyTypeNamable {
37
- name: string;
56
+ export declare class ObjectPropertyType implements PropertyType {
57
+ propertyName: string;
58
+ className: string;
38
59
  properties: PropertyItem[];
39
60
  type: string;
40
- constructor(name: string, properties?: PropertyItem[]);
61
+ constructor(propertyName: string, className: string, properties?: PropertyItem[]);
41
62
  }
@@ -0,0 +1,41 @@
1
+ export declare class JsonService {
2
+ /**
3
+ *
4
+ * Fixes an invalid json like this:
5
+ * [
6
+ * {
7
+ * id: 1,
8
+ * name: 'Alice',
9
+ * description: 'Lorem ipsum dolor',
10
+ * isActive: true,
11
+ * tags: ['typescript', 'javascript'],
12
+ * scripts: [],
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
+ * scripts: [],
23
+ * profile: { age: 55, location: 'Frankfurt' },
24
+ * preferences: [{ key: 'theme', value: 'light' }]
25
+ * },
26
+ * {
27
+ * id: null,
28
+ * name: 'Bob',
29
+ * isActive: false,
30
+ * tags: null,
31
+ * scripts: [],
32
+ * profile: { age: 25, location: 'Frankfurt' },
33
+ * preferences: [{ key: 'language', value: 'de' }]
34
+ *
35
+ *
36
+ * into a valid json string by adding '}]'.
37
+ *
38
+ *
39
+ */
40
+ fixJSON(jsonString: string): string;
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,197 @@
1
+ import { PropertyType } from './domain/property-type';
2
+ import { ValueInfo } from './domain/value-info';
3
+ export declare class PropertyTypeService {
4
+ debugging: boolean;
5
+ /**
6
+ *
7
+ * Converts a json or object structure like this:
8
+ * [
9
+ * {
10
+ * id: 1,
11
+ * name: 'Alice',
12
+ * description: 'Lorem ipsum dolor',
13
+ * isActive: true,
14
+ * tags: ['typescript', 'javascript'],
15
+ * scripts: [],
16
+ * profile: { age: 30, location: 'Berlin' },
17
+ * preferences: [{ key: 'theme', value: 'dark' }]
18
+ * },
19
+ * {
20
+ * id: 2,
21
+ * name: 'Marc',
22
+ * description: 'Lorem ipsum dolor',
23
+ * isActive: false,
24
+ * tags: ['java', 'javascript'],
25
+ * scripts: [],
26
+ * profile: { age: 55, location: 'Frankfurt' },
27
+ * preferences: [{ key: 'theme', value: 'light' }]
28
+ * },
29
+ * {
30
+ * id: null,
31
+ * name: 'Bob',
32
+ * isActive: false,
33
+ * tags: null,
34
+ * scripts: [],
35
+ * profile: { age: 25, location: 'Frankfurt' },
36
+ * preferences: [{ key: 'language', value: 'de' }]
37
+ * }
38
+ * ]
39
+ *
40
+ * into a PropertyTape tree structure like this:
41
+ *
42
+ * return new ArrayPropertyType(
43
+ * [
44
+ * new ObjectPropertyType('XyzRowEntity', [
45
+ * new PropertyItem('id', [new NumberPropertyType(), new NullPropertyType()]),
46
+ * new PropertyItem('name', [new StringPropertyType()]),
47
+ * new PropertyItem('description', [new StringPropertyType(), new UndefinedPropertyType()]),
48
+ * new PropertyItem('isActive', [new BooleanPropertyType()]),
49
+ * new PropertyItem('tags', [
50
+ * new ArrayPropertyType(
51
+ * [new StringPropertyType()]
52
+ * ),
53
+ * new NullPropertyType()
54
+ * ]),
55
+ * new PropertyItem('scripts', [
56
+ * new ArrayPropertyType(
57
+ * [new AnyPropertyType()]
58
+ * ),
59
+ * ]),
60
+ * new PropertyItem('profile', [
61
+ * new ObjectPropertyType('profile', [
62
+ * new PropertyItem('age', [new NumberPropertyType()]),
63
+ * new PropertyItem('location', [new StringPropertyType()])
64
+ * ])
65
+ * ]),
66
+ * new PropertyItem('preferences', [
67
+ * new ArrayPropertyType(
68
+ * [
69
+ * new ObjectPropertyType('preference', [
70
+ * new PropertyItem('key', [new StringPropertyType()]),
71
+ * new PropertyItem('value', [new StringPropertyType()])
72
+ * ])
73
+ * ])
74
+ * ])
75
+ * ])
76
+ * ]);
77
+ *
78
+ *
79
+ * const json = JSON.stringify(demoData);
80
+ * const rootPropertyType: PropertyType = new PropertyTypeService().json2PropertyType(json, 'XyzRows');
81
+ *
82
+ * @param json
83
+ * @param rootName
84
+ */
85
+ json2PropertyType(json: string | object, rootName?: string): PropertyType;
86
+ json2Object(json: string): object;
87
+ /**
88
+ * Converts a json or object structure like this:
89
+ * [
90
+ * {
91
+ * id: 1,
92
+ * name: 'Alice',
93
+ * description: 'Lorem ipsum dolor',
94
+ * isActive: true,
95
+ * tags: ['typescript', 'javascript'],
96
+ * scripts: [],
97
+ * profile: { age: 30, location: 'Berlin' },
98
+ * preferences: [{ key: 'theme', value: 'dark' }]
99
+ * },
100
+ * {
101
+ * id: 2,
102
+ * name: 'Marc',
103
+ * description: 'Lorem ipsum dolor',
104
+ * isActive: false,
105
+ * tags: ['java', 'javascript'],
106
+ * scripts: [],
107
+ * profile: { age: 55, location: 'Frankfurt' },
108
+ * preferences: [{ key: 'theme', value: 'light' }]
109
+ * },
110
+ * {
111
+ * id: null,
112
+ * name: 'Bob',
113
+ * isActive: false,
114
+ * tags: null,
115
+ * scripts: [],
116
+ * profile: { age: 25, location: 'Frankfurt' },
117
+ * preferences: [{ key: 'language', value: 'de' }]
118
+ * }
119
+ * ];
120
+ *
121
+ * into a PropertyTape tree structure like this:
122
+ *
123
+ * return new ArrayPropertyType(
124
+ * [
125
+ * new ObjectPropertyType('XyzRowEntity', [
126
+ * new PropertyItem('id', [new NumberPropertyType(), new NullPropertyType()]),
127
+ * new PropertyItem('name', [new StringPropertyType()]),
128
+ * new PropertyItem('description', [new StringPropertyType(), new UndefinedPropertyType()]),
129
+ * new PropertyItem('isActive', [new BooleanPropertyType()]),
130
+ * new PropertyItem('tags', [
131
+ * new ArrayPropertyType(
132
+ * [new StringPropertyType()]
133
+ * ),
134
+ * new NullPropertyType()
135
+ * ]),
136
+ * new PropertyItem('scripts', [
137
+ * new ArrayPropertyType(
138
+ * [new AnyPropertyType()]
139
+ * ),
140
+ * ]),
141
+ * new PropertyItem('profile', [
142
+ * new ObjectPropertyType('profile', [
143
+ * new PropertyItem('age', [new NumberPropertyType()]),
144
+ * new PropertyItem('location', [new StringPropertyType()])
145
+ * ])
146
+ * ]),
147
+ * new PropertyItem('preferences', [
148
+ * new ArrayPropertyType(
149
+ * [
150
+ * new ObjectPropertyType('preference', [
151
+ * new PropertyItem('key', [new StringPropertyType()]),
152
+ * new PropertyItem('value', [new StringPropertyType()])
153
+ * ])
154
+ * ])
155
+ * ])
156
+ * ])
157
+ * ]);
158
+ *
159
+ * The PropertyTape tree structure can be rendered as TypeScript interface definitions with the SchemeGenerator:
160
+ *
161
+ * export interface XyzRowEntity {
162
+ * description?: string;
163
+ * id: number|null;
164
+ * isActive: boolean;
165
+ * name: string;
166
+ * preferences: PreferenceEntity[];
167
+ * profile: ProfileEntity;
168
+ * scripts: any[];
169
+ * tags: string[]|null;
170
+ * }
171
+ *
172
+ * export interface PreferenceEntity {
173
+ * key: string;
174
+ * value: string;
175
+ * }
176
+ *
177
+ * export interface ProfileEntity {
178
+ * age: number;
179
+ * location: string;
180
+ * }
181
+ *
182
+ * @param parsedObject
183
+ * @param rootName
184
+ */
185
+ object2PropertyType(parsedObject: Object, rootName?: string): PropertyType;
186
+ json2ValueInfos(json: string | object, rootName?: string): ValueInfo[];
187
+ object2ValueInfos(parsedObject: Object, rootName?: string): ValueInfo[];
188
+ getParentPath(path: string): string;
189
+ private valueInfos2PropertyType;
190
+ private logValueInfos;
191
+ private mergeValueInfos;
192
+ private countPath;
193
+ private getFirstValueInfoByPath;
194
+ private extractValueInfos;
195
+ private createPropertyItem;
196
+ private createPropertyType;
197
+ }
@@ -2,84 +2,77 @@ import { PropertyType } from './domain/property-type';
2
2
  /**
3
3
  *
4
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
- * ]
5
+ * [
6
+ * {
7
+ * id: 1,
8
+ * name: 'Alice',
9
+ * description: 'Lorem ipsum dolor',
10
+ * isActive: true,
11
+ * tags: ['typescript', 'javascript'],
12
+ * scripts: [],
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
+ * scripts: [],
23
+ * profile: { age: 55, location: 'Frankfurt' },
24
+ * preferences: [{ key: 'theme', value: 'light' }]
25
+ * },
26
+ * {
27
+ * id: null,
28
+ * name: 'Bob',
29
+ * isActive: false,
30
+ * tags: null,
31
+ * scripts: [],
32
+ * profile: { age: 25, location: 'Frankfurt' },
33
+ * preferences: [{ key: 'language', value: 'de' }]
34
+ * }
35
+ * ]
33
36
  *
34
37
  * into a TypeScript interface definitions:
35
38
  *
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
- * }
39
+ * export interface XyzRowEntity {
40
+ * description?: string;
41
+ * id: number|null;
42
+ * isActive: boolean;
43
+ * name: string;
44
+ * preferences: PreferenceEntity[];
45
+ * profile: ProfileEntity;
46
+ * scripts: any[];
47
+ * tags: string[]|null;
48
+ * }
45
49
  *
46
- * export interface PreferencesEntity {
47
- * key: string;
48
- * value: string;
49
- * }
50
+ * export interface PreferenceEntity {
51
+ * key: string;
52
+ * value: string;
53
+ * }
50
54
  *
51
- * export interface ProfileEntity {
52
- * age: number;
53
- * location: string;
54
- * }
55
+ * export interface ProfileEntity {
56
+ * age: number;
57
+ * location: string;
58
+ * }
55
59
  *
56
60
  *
57
61
  * const json = JSON.stringify(demoData);
58
- * const schemeGenerator = new SchemeGenerator(json, 'XyzRow');
59
- * console.log(schemeGenerator.renderTypeScriptInterfaces().join('\n'));
62
+ * const rootPropertyType: PropertyType = new PropertyTypeService().object2PropertyType(demoData, 'XyzRows');
63
+ * console.log(new SchemeGenerator().renderTypeScriptInterfaces(rootPropertyType).join('\n'));
60
64
  *
61
65
  */
62
66
  export declare class SchemeGenerator {
63
- rootName: string;
64
- entitySuffix: string;
67
+ orOperator: string;
65
68
  rootPropertyType: PropertyType | null;
69
+ private rootName;
66
70
  private renderTypeScriptInterfacesFifo;
67
71
  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[];
72
+ renderTypeScriptInterfaces(rootPropertyType: PropertyType): string[];
77
73
  private renderTypeScriptInterfacesFifoNext;
78
74
  private renderTypeScriptInterfacesRecursive;
79
- private getEntityName;
80
75
  private propertyItem2InterfaceDateType;
81
76
  private renderType;
82
77
  private containsUndefinedPropertyType;
83
- private firstLetterUppercase;
84
- private trimArraySuffixes;
85
78
  }
@@ -0,0 +1,22 @@
1
+ export declare const entitySuffix = "Entity";
2
+ /**
3
+ * Generates an entity name by formatting the input name and appending a predefined suffix if necessary.
4
+ *
5
+ * @param {string} name - The base name to generate the entity name from.
6
+ * @return {string} The formatted entity name with the appropriate suffix.
7
+ */
8
+ export declare function getEntityName(name: string): string;
9
+ /**
10
+ * Trims specific suffixes from the input string if present. The suffixes targeted for removal are 'Array', 'Arr', 'List', and 's'.
11
+ *
12
+ * @param {string} text - The input string to process and trim suffixes from.
13
+ * @return {string} The modified string with the suffix removed, or the original string if no suffix was found.
14
+ */
15
+ export declare function trimArraySuffixes(text: string): string;
16
+ /**
17
+ * Transforms the first letter of the given string to uppercase while leaving the rest of the string unchanged.
18
+ *
19
+ * @param {string} text - The input string to be processed.
20
+ * @return {string} The transformed string with the first letter in uppercase. Returns an empty string if the input is invalid or empty.
21
+ */
22
+ export declare function firstLetterUppercase(text: string): string;
@@ -0,0 +1,8 @@
1
+ import { AreaModelIf } from "../data/tablemodel/areamodel/area-model.if";
2
+ import { CellRendererIf } from "./cell-render.if";
3
+ import { DomServiceIf } from "../service/dom-service.if";
4
+ import { AreaIdent } from "../data/tablemodel/area-ident.type";
5
+ import { RendererCleanupFnType } from "./renderer-cleanup-fn.type";
6
+ export declare class SimpleArrayCellRenderer implements CellRendererIf {
7
+ render(cellDiv: HTMLDivElement, _rowIndex: number, _columnIndex: number, _areaIdent: AreaIdent, _areaModel: AreaModelIf, cellValue: any[], domService: DomServiceIf): RendererCleanupFnType | undefined;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.42",
3
+ "version": "1.1.45",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -1,101 +0,0 @@
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
- }