@sap-ux/fe-fpm-writer 0.6.2 → 0.9.0
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/dist/common/defaults.d.ts +2 -1
- package/dist/common/defaults.d.ts.map +1 -1
- package/dist/common/defaults.js +3 -2
- package/dist/common/defaults.js.map +1 -1
- package/dist/common/types.d.ts +45 -1
- package/dist/common/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/page/common.d.ts +36 -0
- package/dist/page/common.d.ts.map +1 -0
- package/dist/page/common.js +123 -0
- package/dist/page/common.js.map +1 -0
- package/dist/page/custom.d.ts +28 -0
- package/dist/page/custom.d.ts.map +1 -0
- package/dist/page/custom.js +82 -0
- package/dist/page/custom.js.map +1 -0
- package/dist/page/index.d.ts +6 -27
- package/dist/page/index.d.ts.map +1 -1
- package/dist/page/index.js +9 -139
- package/dist/page/index.js.map +1 -1
- package/dist/page/list.d.ts +12 -0
- package/dist/page/list.d.ts.map +1 -0
- package/dist/page/list.js +57 -0
- package/dist/page/list.js.map +1 -0
- package/dist/page/object.d.ts +12 -0
- package/dist/page/object.d.ts.map +1 -0
- package/dist/page/object.js +48 -0
- package/dist/page/object.js.map +1 -0
- package/dist/page/types.d.ts +82 -19
- package/dist/page/types.d.ts.map +1 -1
- package/dist/view/index.d.ts +12 -0
- package/dist/view/index.d.ts.map +1 -0
- package/dist/view/index.js +81 -0
- package/dist/view/index.js.map +1 -0
- package/dist/view/types.d.ts +31 -0
- package/dist/view/types.d.ts.map +1 -0
- package/dist/view/types.js +3 -0
- package/dist/view/types.js.map +1 -0
- package/package.json +3 -3
- package/templates/page/{1.84 → custom/1.84}/ext/Controller.js +0 -0
- package/templates/page/{1.84 → custom/1.84}/ext/View.xml +0 -0
- package/templates/page/{1.84 → custom/1.84}/manifest.json +0 -0
- package/templates/page/{1.94 → custom/1.94}/ext/Controller.js +0 -0
- package/templates/page/{1.94 → custom/1.94}/ext/View.xml +0 -0
- package/templates/page/{1.94 → custom/1.94}/manifest.json +0 -0
- package/templates/page/list/manifest.json +17 -0
- package/templates/page/object/manifest.json +30 -0
- package/templates/view/ext/CustomViewWithTable.xml +3 -0
- package/templates/view/manifest.json +42 -0
- package/dist/page/defaults.d.ts +0 -12
- package/dist/page/defaults.d.ts.map +0 -1
- package/dist/page/defaults.js +0 -38
- package/dist/page/defaults.js.map +0 -1
|
@@ -16,7 +16,8 @@ export declare function setCommonDefaults<T extends CustomElement & Partial<Inte
|
|
|
16
16
|
* @param {string} [eventHandler] - event handler path
|
|
17
17
|
* if value is passed then "Button" control with 'press' event would be generated
|
|
18
18
|
* if value is not passed then "Text" control would be generated
|
|
19
|
+
* @param {boolean} isController - controls if `controller` should be added to handler path
|
|
19
20
|
* @returns default content for fragment
|
|
20
21
|
*/
|
|
21
|
-
export declare function getDefaultFragmentContent(text: string, eventHandler?: string): string;
|
|
22
|
+
export declare function getDefaultFragmentContent(text: string, eventHandler?: string, isController?: boolean): string;
|
|
22
23
|
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/common/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG9E,eAAO,MAAM,UAAU,yBAAyB,CAAC;AACjD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC,EACtF,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,QAAQ,GACnB,qBAAqB,GAAG,CAAC,CAa3B;AAED
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/common/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG9E,eAAO,MAAM,UAAU,yBAAyB,CAAC;AACjD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC,EACtF,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,QAAQ,GACnB,qBAAqB,GAAG,CAAC,CAa3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,MAAM,CAW3G"}
|
package/dist/common/defaults.js
CHANGED
|
@@ -30,14 +30,15 @@ exports.setCommonDefaults = setCommonDefaults;
|
|
|
30
30
|
* @param {string} [eventHandler] - event handler path
|
|
31
31
|
* if value is passed then "Button" control with 'press' event would be generated
|
|
32
32
|
* if value is not passed then "Text" control would be generated
|
|
33
|
+
* @param {boolean} isController - controls if `controller` should be added to handler path
|
|
33
34
|
* @returns default content for fragment
|
|
34
35
|
*/
|
|
35
|
-
function getDefaultFragmentContent(text, eventHandler) {
|
|
36
|
+
function getDefaultFragmentContent(text, eventHandler, isController = false) {
|
|
36
37
|
let content;
|
|
37
38
|
if (eventHandler) {
|
|
38
39
|
const parts = eventHandler.split('.');
|
|
39
40
|
const method = parts.pop();
|
|
40
|
-
const handler = parts.join('/')
|
|
41
|
+
const handler = `${parts.join('/')}${isController ? '.controller' : ''}`;
|
|
41
42
|
content = `<Button core:require="{ handler: '${handler}'}" text="${text}" press="handler.${method}" />`;
|
|
42
43
|
}
|
|
43
44
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/common/defaults.ts"],"names":[],"mappings":";;;AACA,+BAAqC;AAExB,QAAA,UAAU,GAAG,sBAAsB,CAAC;A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C,MAAM,IAAI,OAAO,SAAS,CAAC,iBAAiB,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnG,uDAAuD;IACvD,MAAM,CAAC,EAAE,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC;IACjF,MAAM,CAAC,IAAI,GAAG,WAAI,CAAC,cAAO,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,MAAmC,CAAC;AAC/C,CAAC;AAjBD,8CAiBC;AAED;;;;;;;;;GASG;AACH,SAAgB,yBAAyB,CAAC,IAAY,EAAE,YAAqB,EAAE,YAAY,GAAG,KAAK;IAC/F,IAAI,OAAe,CAAC;IACpB,IAAI,YAAY,EAAE;QACd,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACzE,OAAO,GAAG,qCAAqC,OAAO,aAAa,IAAI,oBAAoB,MAAM,MAAM,CAAC;KAC3G;SAAM;QACH,OAAO,GAAG,eAAe,IAAI,MAAM,CAAC;KACvC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAXD,8DAWC"}
|
package/dist/common/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface CustomElement {
|
|
|
11
11
|
*/
|
|
12
12
|
name: string;
|
|
13
13
|
/**
|
|
14
|
-
* Target folder relative to the manifest that is used to generate the custom extension content (e.g. view, fragment,
|
|
14
|
+
* Target folder relative to the manifest that is used to generate the custom extension content (e.g. view, fragment, controller).
|
|
15
15
|
* If undefined then `ext/${id}` is used.
|
|
16
16
|
*/
|
|
17
17
|
folder?: string;
|
|
@@ -50,4 +50,48 @@ export declare type Position = {
|
|
|
50
50
|
export interface Ui5RoutingTarget<T> extends ManifestNamespace.Target {
|
|
51
51
|
options?: T;
|
|
52
52
|
}
|
|
53
|
+
export interface ViewVariant {
|
|
54
|
+
/**
|
|
55
|
+
* The key entry is used for initializing the corresponding IconTabBar item.
|
|
56
|
+
*/
|
|
57
|
+
key: string;
|
|
58
|
+
/**
|
|
59
|
+
* The annotationPath of a specific variant.
|
|
60
|
+
*/
|
|
61
|
+
annotationPath: string;
|
|
62
|
+
/**
|
|
63
|
+
* View title, is shown in the tab item.
|
|
64
|
+
*/
|
|
65
|
+
label?: string;
|
|
66
|
+
/**
|
|
67
|
+
* If you switch from an app with only a single table to an app with multiple tables, you can keep the previously defined variant on one tab.
|
|
68
|
+
*/
|
|
69
|
+
keepPreviousPersonalization?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The template being used for the custom view.
|
|
72
|
+
*/
|
|
73
|
+
template?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface Views {
|
|
76
|
+
/**
|
|
77
|
+
* The paths section contains a set of entries that point to the variants defined in the annotations.
|
|
78
|
+
*/
|
|
79
|
+
paths?: Array<ViewVariant>;
|
|
80
|
+
/**
|
|
81
|
+
* Determines whether the count is displayed in the tabs (default setting: false).
|
|
82
|
+
*/
|
|
83
|
+
showCounts?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface Ui5TargetSettings {
|
|
86
|
+
settings?: {
|
|
87
|
+
/**
|
|
88
|
+
* Represents the entity set that defines either the aggregation or the root object of the component.
|
|
89
|
+
*/
|
|
90
|
+
entitySet?: string;
|
|
91
|
+
/**
|
|
92
|
+
* By default, the list report displays only one table. You can define multiple views of a table, and add a chart, if required.
|
|
93
|
+
*/
|
|
94
|
+
views?: Views;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
53
97
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,oBAAY,QAAQ,GAAG,iBAAiB,CAAC,0CAA0C,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAEjH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,oBAAY,SAAS;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACd;AAED;;GAEG;AACH,oBAAY,QAAQ,GAAG;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,iBAAiB,CAAC,MAAM;IACjE,OAAO,CAAC,EAAE,CAAC,CAAC;CACf"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,oBAAY,QAAQ,GAAG,iBAAiB,CAAC,0CAA0C,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAEjH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG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
2
|
-
export { generateCustomPage } from './page';
|
|
1
|
+
export { CustomPage, ObjectPage, ListReport } from './page/types';
|
|
2
|
+
export { generateCustomPage, generateObjectPage, generateListReport } from './page';
|
|
3
3
|
export { CustomAction, TargetControl } from './action/types';
|
|
4
4
|
export { generateCustomAction } from './action';
|
|
5
5
|
export { CustomTableColumn } from './column/types';
|
|
6
6
|
export { generateCustomColumn } from './column';
|
|
7
7
|
export { CustomSection } from './section/types';
|
|
8
8
|
export { generateCustomSection } from './section';
|
|
9
|
+
export { CustomView } from './view/types';
|
|
10
|
+
export { generateCustomView } from './view';
|
|
9
11
|
export { enableFPM, FPMConfig } from './app';
|
|
10
12
|
export { validateBasePath, validateVersion } from './common/validate';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateVersion = exports.validateBasePath = exports.enableFPM = exports.generateCustomSection = exports.generateCustomColumn = exports.generateCustomAction = exports.TargetControl = exports.generateCustomPage = void 0;
|
|
3
|
+
exports.validateVersion = exports.validateBasePath = exports.enableFPM = exports.generateCustomView = exports.generateCustomSection = exports.generateCustomColumn = exports.generateCustomAction = exports.TargetControl = exports.generateListReport = exports.generateObjectPage = exports.generateCustomPage = void 0;
|
|
4
4
|
var page_1 = require("./page");
|
|
5
5
|
Object.defineProperty(exports, "generateCustomPage", { enumerable: true, get: function () { return page_1.generateCustomPage; } });
|
|
6
|
+
Object.defineProperty(exports, "generateObjectPage", { enumerable: true, get: function () { return page_1.generateObjectPage; } });
|
|
7
|
+
Object.defineProperty(exports, "generateListReport", { enumerable: true, get: function () { return page_1.generateListReport; } });
|
|
6
8
|
var types_1 = require("./action/types");
|
|
7
9
|
Object.defineProperty(exports, "TargetControl", { enumerable: true, get: function () { return types_1.TargetControl; } });
|
|
8
10
|
var action_1 = require("./action");
|
|
@@ -11,6 +13,8 @@ var column_1 = require("./column");
|
|
|
11
13
|
Object.defineProperty(exports, "generateCustomColumn", { enumerable: true, get: function () { return column_1.generateCustomColumn; } });
|
|
12
14
|
var section_1 = require("./section");
|
|
13
15
|
Object.defineProperty(exports, "generateCustomSection", { enumerable: true, get: function () { return section_1.generateCustomSection; } });
|
|
16
|
+
var view_1 = require("./view");
|
|
17
|
+
Object.defineProperty(exports, "generateCustomView", { enumerable: true, get: function () { return view_1.generateCustomView; } });
|
|
14
18
|
var app_1 = require("./app");
|
|
15
19
|
Object.defineProperty(exports, "enableFPM", { enumerable: true, get: function () { return app_1.enableFPM; } });
|
|
16
20
|
var validate_1 = require("./common/validate");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,+BAAoF;AAA3E,0GAAA,kBAAkB,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAEnE,wCAA6D;AAAtC,sGAAA,aAAa,OAAA;AACpC,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA;AAG7B,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA;AAG7B,qCAAkD;AAAzC,gHAAA,qBAAqB,OAAA;AAG9B,+BAA4C;AAAnC,0GAAA,kBAAkB,OAAA;AAE3B,6BAA6C;AAApC,gGAAA,SAAS,OAAA;AAElB,8CAAsE;AAA7D,4GAAA,gBAAgB,OAAA;AAAE,2GAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Editor } from 'mem-fs-editor';
|
|
2
|
+
import type { ManifestNamespace } from '@sap-ux/ui5-config';
|
|
3
|
+
import type { CustomPage, FCL, InternalCustomPage, InternalObjectPage, ObjectPage, Navigation, InternalListReport } from './types';
|
|
4
|
+
import type { Manifest } from '../common/types';
|
|
5
|
+
/**
|
|
6
|
+
* Add a new route to the provided route array, and update existing routes if necessary (e.g. if targets are defined as arrays for FCL).
|
|
7
|
+
*
|
|
8
|
+
* @param routes existing application routes (from the manifest)
|
|
9
|
+
* @param config configuration object
|
|
10
|
+
*/
|
|
11
|
+
export declare function updateRoutes(routes: ManifestNamespace.Route[], config: InternalCustomPage | InternalObjectPage | InternalListReport): void;
|
|
12
|
+
/**
|
|
13
|
+
* Create a function that can be used as JsonReplace when calling extendJson.
|
|
14
|
+
*
|
|
15
|
+
* @param config page configuration
|
|
16
|
+
* @returns a JsonReplacer function for the usage in ejs
|
|
17
|
+
*/
|
|
18
|
+
export declare function getManifestJsonExtensionHelper(config: InternalCustomPage | InternalObjectPage | InternalListReport): (key: string, value: any) => any;
|
|
19
|
+
/**
|
|
20
|
+
* Get the configuration parameters for the flexible column layout based on the given manifest and navigation config.
|
|
21
|
+
*
|
|
22
|
+
* @param manifest existing manifest
|
|
23
|
+
* @param navigation navigation configuration that is to be added
|
|
24
|
+
* @returns fcl configuration
|
|
25
|
+
*/
|
|
26
|
+
export declare function getFclConfig(manifest: Manifest, navigation?: Navigation): FCL;
|
|
27
|
+
/**
|
|
28
|
+
* Validate the input parameters for the generation of a custom or an object page.
|
|
29
|
+
*
|
|
30
|
+
* @param basePath - the base path
|
|
31
|
+
* @param config - the custom page configuration
|
|
32
|
+
* @param fs - the memfs editor instance
|
|
33
|
+
* @returns the updated memfs editor instance
|
|
34
|
+
*/
|
|
35
|
+
export declare function validatePageConfig(basePath: string, config: CustomPage | ObjectPage, fs: Editor): Editor;
|
|
36
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/page/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EACR,UAAU,EACV,GAAG,EACH,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,kBAAkB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,MAAM,EAAE,iBAAiB,CAAC,KAAK,EAAE,EACjC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,kBAAkB,QAwBvE;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC1C,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,kBAAkB,GACrE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,CAclC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,GAAG,CAe7E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CA6BxG"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePageConfig = exports.getFclConfig = exports.getManifestJsonExtensionHelper = exports.updateRoutes = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const validate_1 = require("../common/validate");
|
|
6
|
+
const defaults_1 = require("../common/defaults");
|
|
7
|
+
/**
|
|
8
|
+
* Add a new route to the provided route array, and update existing routes if necessary (e.g. if targets are defined as arrays for FCL).
|
|
9
|
+
*
|
|
10
|
+
* @param routes existing application routes (from the manifest)
|
|
11
|
+
* @param config configuration object
|
|
12
|
+
*/
|
|
13
|
+
function updateRoutes(routes, config) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const newRoute = {
|
|
16
|
+
name: `${config.entity}${config.name}`
|
|
17
|
+
};
|
|
18
|
+
if (config.navigation) {
|
|
19
|
+
const sourceRoute = routes.find((route) => { var _a; return route.name === ((_a = config.navigation) === null || _a === void 0 ? void 0 : _a.sourcePage); });
|
|
20
|
+
const pattern = {
|
|
21
|
+
base: (_a = sourceRoute === null || sourceRoute === void 0 ? void 0 : sourceRoute.pattern) === null || _a === void 0 ? void 0 : _a.replace(':?query:', ''),
|
|
22
|
+
navEntity: config.navigation.navEntity,
|
|
23
|
+
navKey: config.navigation.navKey ? `({${config.navigation.navEntity}Key})` : ''
|
|
24
|
+
};
|
|
25
|
+
newRoute.pattern = `${pattern.base}/${pattern.navEntity}${pattern.navKey}:?query:`;
|
|
26
|
+
// FCL only supports 3 columns, therefore, show the page in fullscreen if it is the 4th level of navigation
|
|
27
|
+
if (((_b = sourceRoute === null || sourceRoute === void 0 ? void 0 : sourceRoute.target) === null || _b === void 0 ? void 0 : _b.constructor) === Array && sourceRoute.target.length < 3) {
|
|
28
|
+
newRoute.target = [...sourceRoute.target, newRoute.name];
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
newRoute.target = config.fcl ? [newRoute.name] : newRoute.name;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
newRoute.pattern = routes.length > 0 ? `${config.entity}:?query:` : ':?query:';
|
|
36
|
+
newRoute.target = config.fcl ? [newRoute.name] : newRoute.name;
|
|
37
|
+
}
|
|
38
|
+
routes.push(newRoute);
|
|
39
|
+
}
|
|
40
|
+
exports.updateRoutes = updateRoutes;
|
|
41
|
+
/**
|
|
42
|
+
* Create a function that can be used as JsonReplace when calling extendJson.
|
|
43
|
+
*
|
|
44
|
+
* @param config page configuration
|
|
45
|
+
* @returns a JsonReplacer function for the usage in ejs
|
|
46
|
+
*/
|
|
47
|
+
function getManifestJsonExtensionHelper(config) {
|
|
48
|
+
return (key, value) => {
|
|
49
|
+
var _a;
|
|
50
|
+
switch (key) {
|
|
51
|
+
case 'routing':
|
|
52
|
+
value.routes = (_a = value.routes) !== null && _a !== void 0 ? _a : [];
|
|
53
|
+
break;
|
|
54
|
+
case 'routes':
|
|
55
|
+
updateRoutes(value, config);
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return value;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.getManifestJsonExtensionHelper = getManifestJsonExtensionHelper;
|
|
64
|
+
/**
|
|
65
|
+
* Get the configuration parameters for the flexible column layout based on the given manifest and navigation config.
|
|
66
|
+
*
|
|
67
|
+
* @param manifest existing manifest
|
|
68
|
+
* @param navigation navigation configuration that is to be added
|
|
69
|
+
* @returns fcl configuration
|
|
70
|
+
*/
|
|
71
|
+
function getFclConfig(manifest, navigation) {
|
|
72
|
+
var _a, _b, _c, _d, _e, _f;
|
|
73
|
+
const config = {};
|
|
74
|
+
if (((_c = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.routing) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.routerClass) === defaults_1.FCL_ROUTER) {
|
|
75
|
+
config.fcl = true;
|
|
76
|
+
if (navigation) {
|
|
77
|
+
const sourceRoute = (((_e = (_d = manifest['sap.ui5']) === null || _d === void 0 ? void 0 : _d.routing) === null || _e === void 0 ? void 0 : _e.routes) || []).find((route) => route.name === (navigation === null || navigation === void 0 ? void 0 : navigation.sourcePage));
|
|
78
|
+
config.controlAggregation =
|
|
79
|
+
((_f = sourceRoute === null || sourceRoute === void 0 ? void 0 : sourceRoute.target) !== null && _f !== void 0 ? _f : []).length > 1 ? 'endColumnPages' : 'midColumnPages';
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
config.controlAggregation = 'beginColumnPages';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return config;
|
|
86
|
+
}
|
|
87
|
+
exports.getFclConfig = getFclConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Validate the input parameters for the generation of a custom or an object page.
|
|
90
|
+
*
|
|
91
|
+
* @param basePath - the base path
|
|
92
|
+
* @param config - the custom page configuration
|
|
93
|
+
* @param fs - the memfs editor instance
|
|
94
|
+
* @returns the updated memfs editor instance
|
|
95
|
+
*/
|
|
96
|
+
function validatePageConfig(basePath, config, fs) {
|
|
97
|
+
// common validators
|
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
99
|
+
validate_1.validateBasePath(basePath, fs);
|
|
100
|
+
// validate config against the manifest
|
|
101
|
+
const manifest = fs.readJSON(path_1.join(basePath, 'webapp/manifest.json'));
|
|
102
|
+
if (config.navigation) {
|
|
103
|
+
if (!((_c = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.routing) === null || _b === void 0 ? void 0 : _b.targets) === null || _c === void 0 ? void 0 : _c[config.navigation.sourcePage])) {
|
|
104
|
+
throw new Error(`Could not find navigation source ${config.navigation.sourcePage}!`);
|
|
105
|
+
}
|
|
106
|
+
const routes = {};
|
|
107
|
+
if (((_f = (_e = (_d = manifest['sap.ui5']) === null || _d === void 0 ? void 0 : _d.routing) === null || _e === void 0 ? void 0 : _e.routes) === null || _f === void 0 ? void 0 : _f.constructor) === Array) {
|
|
108
|
+
manifest['sap.ui5'].routing.routes.forEach((routeWithName) => {
|
|
109
|
+
routes[routeWithName.name] = routeWithName;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
Object.assign(routes, (_j = (_h = (_g = manifest['sap.ui5']) === null || _g === void 0 ? void 0 : _g.routing) === null || _h === void 0 ? void 0 : _h.routes) !== null && _j !== void 0 ? _j : {});
|
|
114
|
+
}
|
|
115
|
+
const route = routes[(_k = config.navigation) === null || _k === void 0 ? void 0 : _k.sourcePage];
|
|
116
|
+
if (!route || !route.pattern || !route.target) {
|
|
117
|
+
throw new Error(`Missing or invalid routing configuration for navigation source ${config.navigation.sourcePage}!`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return fs;
|
|
121
|
+
}
|
|
122
|
+
exports.validatePageConfig = validatePageConfig;
|
|
123
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/page/common.ts"],"names":[],"mappings":";;;AACA,+BAA4B;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aAAM;YACH,MAAM,CAAC,MAAM,CAAC,MAAM,oBAAE,QAAQ,CAAC,SAAS,CAAC,0CAAE,OAAO,0CAAE,MAAM,mCAAI,EAAE,CAAC,CAAC;SACrE;QAED,MAAM,KAAK,GAAG,MAAM,OAAC,MAAM,CAAC,UAAU,0CAAE,UAAU,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC3C,MAAM,IAAI,KAAK,CACX,kEAAkE,MAAM,CAAC,UAAU,CAAC,UAAU,GAAG,CACpG,CAAC;SACL;KACJ;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AA7BD,gDA6BC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Editor } from 'mem-fs-editor';
|
|
2
|
+
import type { CustomPage, InternalCustomPage } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Enhances the provided custom page configuration with default data.
|
|
5
|
+
*
|
|
6
|
+
* @param data - a custom page configuration object
|
|
7
|
+
* @param manifestPath - path to the application manifest
|
|
8
|
+
* @param fs - mem-fs reference to be used for file access
|
|
9
|
+
* @returns enhanced configuration
|
|
10
|
+
*/
|
|
11
|
+
export declare function enhanceData(data: CustomPage, manifestPath: string, fs: Editor): InternalCustomPage;
|
|
12
|
+
/**
|
|
13
|
+
* Validate the UI5 version and if valid return the root folder for the templates to be used.
|
|
14
|
+
*
|
|
15
|
+
* @param ui5Version - optional minimum required UI5 version
|
|
16
|
+
* @returns root folder containg the templates if the version is supported otherwise throws an error
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTemplateRoot(ui5Version?: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Add a custom page to an existing UI5 application.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} basePath - the base path
|
|
23
|
+
* @param {CustomPage} data - the custom page configuration
|
|
24
|
+
* @param {Editor} [fs] - the memfs editor instance
|
|
25
|
+
* @returns {Promise<Editor>} the updated memfs editor instance
|
|
26
|
+
*/
|
|
27
|
+
export declare function generate(basePath: string, data: CustomPage, fs?: Editor): Editor;
|
|
28
|
+
//# sourceMappingURL=custom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/page/custom.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAM9D;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,kBAAkB,CAiBlG;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAgChF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = exports.getTemplateRoot = exports.enhanceData = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const mem_fs_1 = require("mem-fs");
|
|
6
|
+
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
7
|
+
const ejs_1 = require("ejs");
|
|
8
|
+
const common_1 = require("./common");
|
|
9
|
+
const defaults_1 = require("../common/defaults");
|
|
10
|
+
const validate_1 = require("../common/validate");
|
|
11
|
+
/**
|
|
12
|
+
* Enhances the provided custom page configuration with default data.
|
|
13
|
+
*
|
|
14
|
+
* @param data - a custom page configuration object
|
|
15
|
+
* @param manifestPath - path to the application manifest
|
|
16
|
+
* @param fs - mem-fs reference to be used for file access
|
|
17
|
+
* @returns enhanced configuration
|
|
18
|
+
*/
|
|
19
|
+
function enhanceData(data, manifestPath, fs) {
|
|
20
|
+
const manifest = fs.readJSON(manifestPath);
|
|
21
|
+
// set common defaults
|
|
22
|
+
const config = defaults_1.setCommonDefaults(data, manifestPath, manifest);
|
|
23
|
+
// set FCL configuration
|
|
24
|
+
const fclConfig = common_1.getFclConfig(manifest, config.navigation);
|
|
25
|
+
config.fcl = fclConfig.fcl;
|
|
26
|
+
config.controlAggregation = fclConfig.controlAggregation;
|
|
27
|
+
if (config.view === undefined) {
|
|
28
|
+
config.view = {
|
|
29
|
+
title: config.name
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
exports.enhanceData = enhanceData;
|
|
35
|
+
/**
|
|
36
|
+
* Validate the UI5 version and if valid return the root folder for the templates to be used.
|
|
37
|
+
*
|
|
38
|
+
* @param ui5Version - optional minimum required UI5 version
|
|
39
|
+
* @returns root folder containg the templates if the version is supported otherwise throws an error
|
|
40
|
+
*/
|
|
41
|
+
function getTemplateRoot(ui5Version) {
|
|
42
|
+
if (ui5Version === undefined || ui5Version >= 1.94) {
|
|
43
|
+
return path_1.join(__dirname, '../../templates/page/custom/1.94');
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return path_1.join(__dirname, '../../templates/page/custom/1.84');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.getTemplateRoot = getTemplateRoot;
|
|
50
|
+
/**
|
|
51
|
+
* Add a custom page to an existing UI5 application.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} basePath - the base path
|
|
54
|
+
* @param {CustomPage} data - the custom page configuration
|
|
55
|
+
* @param {Editor} [fs] - the memfs editor instance
|
|
56
|
+
* @returns {Promise<Editor>} the updated memfs editor instance
|
|
57
|
+
*/
|
|
58
|
+
function generate(basePath, data, fs) {
|
|
59
|
+
if (!fs) {
|
|
60
|
+
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
61
|
+
}
|
|
62
|
+
validate_1.validateVersion(data.ui5Version);
|
|
63
|
+
common_1.validatePageConfig(basePath, data, fs);
|
|
64
|
+
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
65
|
+
const config = enhanceData(data, manifestPath, fs);
|
|
66
|
+
// merge content into existing files
|
|
67
|
+
const root = getTemplateRoot(data.ui5Version);
|
|
68
|
+
// enhance manifest.json
|
|
69
|
+
fs.extendJSON(manifestPath, JSON.parse(ejs_1.render(fs.read(path_1.join(root, `manifest.json`)), config)), common_1.getManifestJsonExtensionHelper(config));
|
|
70
|
+
// add extension content
|
|
71
|
+
const viewPath = path_1.join(config.path, `${config.name}.view.xml`);
|
|
72
|
+
if (!fs.exists(viewPath)) {
|
|
73
|
+
fs.copyTpl(path_1.join(root, 'ext/View.xml'), viewPath, config);
|
|
74
|
+
}
|
|
75
|
+
const controllerPath = path_1.join(config.path, `${config.name}.controller.js`);
|
|
76
|
+
if (!fs.exists(controllerPath)) {
|
|
77
|
+
fs.copyTpl(path_1.join(root, 'ext/Controller.js'), controllerPath, config);
|
|
78
|
+
}
|
|
79
|
+
return fs;
|
|
80
|
+
}
|
|
81
|
+
exports.generate = generate;
|
|
82
|
+
//# sourceMappingURL=custom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/page/custom.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,mCAAiD;AAEjD,iDAAuC;AACvC,6BAA6B;AAE7B,qCAA4F;AAC5F,iDAAuD;AAEvD,iDAAqD;AAErD;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,IAAgB,EAAE,YAAoB,EAAE,EAAU;IAC1E,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAa,CAAC;IAEvD,sBAAsB;IACtB,MAAM,MAAM,GAAG,4BAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAuB,CA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,CAAC,KAAK,CAAC,YAAM,CAAC,EAAE,CAAC,IAAI,CAAC,WAAI,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAChE,uCAA8B,CAAC,MAAM,CAAC,CACzC,CAAC;IAEF,wBAAwB;IACxB,MAAM,QAAQ,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,WAAW,CAAC,CAAC;IAC9D,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QACtB,EAAE,CAAC,OAAO,CAAC,WAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC5D;IACD,MAAM,cAAc,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,gBAAgB,CAAC,CAAC;IACzE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;QAC5B,EAAE,CAAC,OAAO,CAAC,WAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;KACvE;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAhCD,4BAgCC"}
|
package/dist/page/index.d.ts
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @returns root folder containg the templates if the version is supported otherwise throws an error
|
|
8
|
-
*/
|
|
9
|
-
export declare function getTemplateRoot(ui5Version?: number): string;
|
|
10
|
-
/**
|
|
11
|
-
* Validate the input parameters for the execution of generateCustomAction.
|
|
12
|
-
*
|
|
13
|
-
* @param {string} basePath - the base path
|
|
14
|
-
* @param {CustomPage} config - the custom page configuration
|
|
15
|
-
* @param {Editor} [fs] - the memfs editor instance
|
|
16
|
-
* @returns {Promise<Editor>} the updated memfs editor instance
|
|
17
|
-
*/
|
|
18
|
-
export declare function validateCustomPageConfig(basePath: string, config: CustomPage, fs?: Editor): Editor;
|
|
19
|
-
/**
|
|
20
|
-
* Add a custom page to an existing UI5 application.
|
|
21
|
-
*
|
|
22
|
-
* @param {string} basePath - the base path
|
|
23
|
-
* @param {CustomPage} data - the custom page configuration
|
|
24
|
-
* @param {Editor} [fs] - the memfs editor instance
|
|
25
|
-
* @returns {Promise<Editor>} the updated memfs editor instance
|
|
26
|
-
*/
|
|
27
|
-
export declare function generateCustomPage(basePath: string, data: CustomPage, fs?: Editor): Editor;
|
|
1
|
+
import type { CustomPage, ObjectPage, ListReport, Navigation } from './types';
|
|
2
|
+
import { validatePageConfig } from './common';
|
|
3
|
+
import { generate as generateCustomPage } from './custom';
|
|
4
|
+
import { generate as generateObjectPage } from './object';
|
|
5
|
+
import { generate as generateListReport } from './list';
|
|
6
|
+
export { validatePageConfig, generateCustomPage, generateObjectPage, generateListReport, CustomPage, ObjectPage, ListReport, Navigation };
|
|
28
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/page/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAExD,OAAO,EACH,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACb,CAAC"}
|