@genesislcap/pbc-reporting-ui 14.396.3 → 14.397.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.
Files changed (73) hide show
  1. package/dist/dts/new/main/edit-config/col-filters/col-filters-grid.helpers.d.ts.map +1 -1
  2. package/dist/dts/new/main/edit-config/datasource-config/datasource-config-item.d.ts +6 -2
  3. package/dist/dts/new/main/edit-config/datasource-config/datasource-config-item.d.ts.map +1 -1
  4. package/dist/dts/new/main/edit-config/datasource-config/datasource-config-item.styles.d.ts.map +1 -1
  5. package/dist/dts/new/main/edit-config/datasource-config/datasource-config-item.template.d.ts.map +1 -1
  6. package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.helpers.d.ts.map +1 -1
  7. package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.template.d.ts.map +1 -1
  8. package/dist/dts/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.d.ts.map +1 -1
  9. package/dist/dts/new/store/slices/datasources-config.d.ts +20 -6
  10. package/dist/dts/new/store/slices/datasources-config.d.ts.map +1 -1
  11. package/dist/dts/new/store/slices/types.d.ts +19 -2
  12. package/dist/dts/new/store/slices/types.d.ts.map +1 -1
  13. package/dist/dts/new/store/store.d.ts +133 -35
  14. package/dist/dts/new/store/store.d.ts.map +1 -1
  15. package/dist/dts/new/types/misc.d.ts +4 -2
  16. package/dist/dts/new/types/misc.d.ts.map +1 -1
  17. package/dist/dts/new/utils/alias-generator.d.ts +8 -0
  18. package/dist/dts/new/utils/alias-generator.d.ts.map +1 -0
  19. package/dist/dts/new/utils/alias-generator.test.d.ts +2 -0
  20. package/dist/dts/new/utils/alias-generator.test.d.ts.map +1 -0
  21. package/dist/dts/new/utils/index.d.ts +1 -0
  22. package/dist/dts/new/utils/index.d.ts.map +1 -1
  23. package/dist/dts/new/utils/tooltip.d.ts +3 -0
  24. package/dist/dts/new/utils/tooltip.d.ts.map +1 -1
  25. package/dist/dts/new/utils/transformers.d.ts +1 -1
  26. package/dist/dts/new/utils/transformers.d.ts.map +1 -1
  27. package/dist/esm/new/main/edit-config/col-filters/col-filters-grid.helpers.js +3 -1
  28. package/dist/esm/new/main/edit-config/col-filters/col-filters-grid.helpers.test.js +71 -6
  29. package/dist/esm/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.js +32 -4
  30. package/dist/esm/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.js +10 -2
  31. package/dist/esm/new/main/edit-config/datasource-config/datasource-config-item.js +100 -10
  32. package/dist/esm/new/main/edit-config/datasource-config/datasource-config-item.styles.js +6 -0
  33. package/dist/esm/new/main/edit-config/datasource-config/datasource-config-item.template.js +38 -3
  34. package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.helpers.js +11 -7
  35. package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.js +29 -22
  36. package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.template.js +3 -0
  37. package/dist/esm/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.js +16 -8
  38. package/dist/esm/new/main/edit-config/shared/datasource-data-base-component.test.js +13 -2
  39. package/dist/esm/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.template.js +1 -1
  40. package/dist/esm/new/store/slices/datasources-config.js +50 -11
  41. package/dist/esm/new/store/slices/types.js +1 -0
  42. package/dist/esm/new/utils/alias-generator.js +16 -0
  43. package/dist/esm/new/utils/alias-generator.test.js +36 -0
  44. package/dist/esm/new/utils/index.js +1 -0
  45. package/dist/esm/new/utils/tooltip.js +16 -0
  46. package/dist/esm/new/utils/transformers.js +20 -6
  47. package/dist/esm/new/utils/transformers.test.js +61 -11
  48. package/dist/esm/new/utils/validators.test.js +35 -21
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +22 -22
  51. package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.test.ts +76 -6
  52. package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.ts +4 -1
  53. package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.ts +32 -4
  54. package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.ts +10 -2
  55. package/src/new/main/edit-config/datasource-config/datasource-config-item.styles.ts +6 -0
  56. package/src/new/main/edit-config/datasource-config/datasource-config-item.template.ts +62 -3
  57. package/src/new/main/edit-config/datasource-config/datasource-config-item.ts +107 -8
  58. package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.ts +32 -23
  59. package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.ts +18 -10
  60. package/src/new/main/edit-config/datasource-config/datasources-config-container.template.ts +6 -0
  61. package/src/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.ts +21 -11
  62. package/src/new/main/edit-config/shared/datasource-data-base-component.test.ts +14 -2
  63. package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.template.ts +1 -1
  64. package/src/new/store/slices/datasources-config.ts +71 -16
  65. package/src/new/store/slices/types.ts +22 -4
  66. package/src/new/types/misc.ts +9 -2
  67. package/src/new/utils/alias-generator.test.ts +44 -0
  68. package/src/new/utils/alias-generator.ts +18 -0
  69. package/src/new/utils/index.ts +1 -0
  70. package/src/new/utils/tooltip.ts +19 -0
  71. package/src/new/utils/transformers.test.ts +73 -11
  72. package/src/new/utils/transformers.ts +30 -6
  73. package/src/new/utils/validators.test.ts +35 -21
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../../src/new/types/misc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvF,yBAAiB,OAAO,CAAC;IAChB,MAAM,iBAAiB,qIAapB,CAAC;IAEX,KAAY,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IAEnE,KAAY,WAAW,GAAG,aAAa,GAAG;QACxC,UAAU,CAAC,EACP;YACE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG;gBAAE,WAAW,EAAE,iBAAiB,CAAA;aAAE,CAAC;SACnE,GACD,SAAS,CAAC;KACf,CAAC;IAEF,KAAY,kBAAkB,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG;QAC9D,YAAY,EAAE,gBAAgB,CAAC,cAAc,CAAC,EAAE,CAAC;QACjD,SAAS,EAAE,QAAQ,EAAE,CAAC;KACvB,CAAC;IAEK,MAAM,iBAAiB;;;;;;;;;;KAUpB,CAAC;IAEX,KAAY,YAAY;QACtB,eAAe,kBAAkB;QACjC,mBAAmB,sBAAsB;QACzC,gBAAgB,mBAAmB;KACpC;IAED,KAAY,kBAAkB,GAAG;QAC/B,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;QAC5C,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;QAC5C,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QACtC,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QACtC,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QACxC,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QACxC,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QACvC,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QACvC,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC;KAC7C,CAAC;CACH;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI;IAAE,CAAC,EAAE,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../../src/new/types/misc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,yBAAiB,OAAO,CAAC;IAChB,MAAM,iBAAiB,qIAapB,CAAC;IAEX,KAAY,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IAEnE,KAAY,WAAW,GAAG,aAAa,GAAG;QACxC,UAAU,CAAC,EACP;YACE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG;gBAAE,WAAW,EAAE,iBAAiB,CAAA;aAAE,CAAC;SACnE,GACD,SAAS,CAAC;KACf,CAAC;IAEF,KAAY,kBAAkB,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG;QAC9D,YAAY,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,mBAAmB,GAAG,WAAW,CAAC,GACtF,CAAC,OAAO,CAAC,kBAAkB,EAAE;YAAE,iBAAiB,EAAE,MAAM,CAAA;SAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;QACvE,SAAS,EAAE,QAAQ,EAAE,CAAC;KACvB,CAAC;IAEK,MAAM,iBAAiB;;;;;;;;;;KAUpB,CAAC;IAEX,KAAY,YAAY;QACtB,eAAe,kBAAkB;QACjC,mBAAmB,sBAAsB;QACzC,gBAAgB,mBAAmB;KACpC;IAED,KAAY,kBAAkB,GAAG;QAC/B,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;QAC5C,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;QAC5C,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QACtC,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QACtC,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QACxC,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QACxC,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QACvC,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QACvC,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC;KAC7C,CAAC;CACH;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI;IAAE,CAAC,EAAE,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generates a unique alias by appending a counter if the base alias already exists in the set.
3
+ * @param baseAlias The desired alias name (usually the resource name).
4
+ * @param existingAliases A Set of currently used aliases to check against.
5
+ * @returns A unique alias string.
6
+ */
7
+ export declare function generateUniqueAlias(baseAlias: string, existingAliases: Set<string>): string;
8
+ //# sourceMappingURL=alias-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alias-generator.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/alias-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAW3F"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alias-generator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alias-generator.test.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/alias-generator.test.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+ export * from './alias-generator';
1
2
  export * from './endpoint';
2
3
  export * from './formatters';
3
4
  export * from './notifications';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
@@ -7,8 +7,11 @@ export declare namespace TOOLTIP {
7
7
  const SETUP_DESCRIPTION = "\n <h3>Description</h3>\n <p>Here you may optionally include a more detailed description describing this report configuration.</p>\n";
8
8
  const SETUP_FILE_TYPE = "\n <h3>File type</h3>\n <p>Select the type of file to use when generating the report. You can choose between CSV, XLSX, and PDF</p>\n <ul>\n <li><strong>CSV</strong>: Generates a CSV report. Selecting a template is optional</li>\n <li><strong>XLSX</strong>: Generates an Excel workbook. Selecting a template is optional</li>\n <li><strong>PDF</strong>: Generates a PDF file. Selecting a template is mandatory</li>\n </ul>\n";
9
9
  const SETUP_FILE_TEMPLATE = "\n <h3>File template</h3>\n <p>The template file to use when generating the report. This will only display relevant template files that are available in the Document Manager for the file type configured.</p>\n <ul>\n <li>Where File type is set to <strong>CSV</strong> you may optionally select a <code>.csv</code> or <code>.txt</code> template. To use multiple datasources with <strong>CSV</strong> you must select a template.</li>\n <li>Where File type is set to <strong>XLSX</strong> you may optionally select a <code>.xls</code> or <code>.xlsx</code> template. Where no template file is selected, the workbook will be generated with a tab for each of the data sources configured in the \"Add Datasources\" step.</li>\n <li>Where File type is set to <strong>PDF</strong> you must select a <code>.html</code> or <code>.xhtml</code> template that you've uploaded to the document manager PBC</li>\n </ul>\n ";
10
+ const DATASOURCES_DATASOURCE = "\n <h3>Datasource</h3>\n <p>This is the name of the server resource that data will be pulled from to generate the report.</p>\n";
10
11
  const DATASOURCES_NAME = "\n <h3>Datasource name</h3>\n <p>Allows you to set a name for the datasource which must correspond with your template data references where the report is configured to use a template file.</p>\n <p>Where File Type is XLSX and no template is selected, this will be the name of the tab containing this data source's data in the resulting workbook.</p>\n";
11
12
  const DATASOURCES_TYPE = "\n <h3>Datasource type</h3>\n <p>Configures the method by which the server constructs the report configuration. Currently only TABLE is supported, which means the entire datasource is loaded into memory when generating the report using this report configuration.</p>\n";
13
+ const DATASOURCES_GROUPING_STRATEGY = "\n <h3>Grouping Strategy</h3>\n <p>Select \"None\" to disable grouping strategies, or select the strategy you'd like to use.</p>\n <ul>\n <li><strong>Multi-sheet</strong>: Group data for <code>JXLS</code> template Multi-sheet functionality, to split different groups across multiple excel worksheets.</li>\n <li><strong>Lookup-table</strong>: Create a lookup table of key value pairs in the template data, where the group key field is the map key.</li>\n </ul>\n";
14
+ const DATASOURCES_GROUPING_KEY = "\n <h3>Grouping Key</h3>\n <p>Select the field for this datasource you want to operate the grouping strategy on.</p>\n";
12
15
  const DELIVERY_TIMEZONE = "\n <h3>Timezone</h3>\n <p>Select the timezone to be used for this schedule.</p>\n";
13
16
  const DELIVERY_OUTPUTS = "\n <h3>Outputs</h3>\n <p>Optionally select the destinations to distribute the report to.</p>\n";
14
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/tooltip.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,6DAElD,CAAC;AAMF,eAAO,MAAM,eAAe,0DAA0C,CAAC;AAEvE,yBAAiB,OAAO,CAAC;IAChB,MAAM,UAAU,uJAGxB,CAAC;IAEO,MAAM,cAAc,+KAI5B,CAAC;IAEO,MAAM,eAAe,8IAG7B,CAAC;IAEO,MAAM,iBAAiB,2IAG/B,CAAC;IAEO,MAAM,eAAe,ybAQ7B,CAAC;IAEO,MAAM,mBAAmB,65BAQ/B,CAAC;IAEK,MAAM,gBAAgB,uWAI9B,CAAC;IAEO,MAAM,gBAAgB,mRAG9B,CAAC;IAEO,MAAM,iBAAiB,wFAG/B,CAAC;IAEO,MAAM,gBAAgB,qGAG9B,CAAC;CACD"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/tooltip.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,6DAElD,CAAC;AAMF,eAAO,MAAM,eAAe,0DAA0C,CAAC;AAEvE,yBAAiB,OAAO,CAAC;IAChB,MAAM,UAAU,uJAGxB,CAAC;IAEO,MAAM,cAAc,+KAI5B,CAAC;IAEO,MAAM,eAAe,8IAG7B,CAAC;IAEO,MAAM,iBAAiB,2IAG/B,CAAC;IAEO,MAAM,eAAe,ybAQ7B,CAAC;IAEO,MAAM,mBAAmB,65BAQ/B,CAAC;IAEK,MAAM,sBAAsB,sIAGpC,CAAC;IAEO,MAAM,gBAAgB,uWAI9B,CAAC;IAEO,MAAM,gBAAgB,mRAG9B,CAAC;IAEO,MAAM,6BAA6B,6dAO3C,CAAC;IAEO,MAAM,wBAAwB,6HAGtC,CAAC;IAEO,MAAM,iBAAiB,wFAG/B,CAAC;IAEO,MAAM,gBAAgB,qGAG9B,CAAC;CACD"}
@@ -5,5 +5,5 @@ export declare function transformToServerPayload(state: ReportingConfig): Genesi
5
5
  export declare function transformFromServerPayload(payload: Genesis.ServerReportConfig, getSchema: (name: string) => Promise<JSONSchema7>): Promise<ReportingConfig>;
6
6
  export declare function datasourceInputForDisplay(input: DatasourceInputTypes): Display.DatasourceInputTypes;
7
7
  export declare function datasourceInputFromDisplay(display: Display.DatasourceInputTypes): DatasourceInputTypes;
8
- export declare function buildDatasourceName(key: string, type: DatasourceInputTypes): DatasourceName;
8
+ export declare function buildDatasourceName(alias: string, resourceName: string, type: DatasourceInputTypes): DatasourceName;
9
9
  //# sourceMappingURL=transformers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/transformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAc,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAElG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAiB3F;AAiCD,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,CAAC,kBAAkB,EACnC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,GAChD,OAAO,CAAC,eAAe,CAAC,CAuE1B;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAI9B;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,CAAC,oBAAoB,GACpC,oBAAoB,CAItB;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,cAAc,CAE3F"}
1
+ {"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/transformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAc,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAElG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAwB3F;AAiCD,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,CAAC,kBAAkB,EACnC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,GAChD,OAAO,CAAC,eAAe,CAAC,CAoF1B;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAI9B;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,CAAC,oBAAoB,GACpC,oBAAoB,CAItB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,oBAAoB,GACzB,cAAc,CAEhB"}
@@ -1,4 +1,4 @@
1
- import { actions } from '../../../store';
1
+ import { actions, selectors } from '../../../store';
2
2
  import { GridColumnNames, datasourceNameFromDisplay, lookupColumnIsIncluded, shouldDisableColumn, } from '../shared';
3
3
  /**
4
4
  * Handler for row selection changes in the grid
@@ -14,11 +14,13 @@ export function rowSelectionChangedHandler(event) {
14
14
  return;
15
15
  if (shouldDisableColumn(event.data))
16
16
  return;
17
+ const setDefaultFormat = selectors.baseConfig.getConfig().OUTPUT_FORMAT !== 'XLSX';
17
18
  actions.datasourceConfig.setColumnIncluded({
18
19
  key: datasourceNameFromDisplay(event.data[GridColumnNames.Datasource]),
19
20
  column: event.data[GridColumnNames.ColumnName],
20
21
  included: (_b = event.node.isSelected()) !== null && _b !== void 0 ? _b : true,
21
22
  type: event.data[GridColumnNames.Type],
23
+ setDefaultFormat,
22
24
  });
23
25
  event.api.redrawRows();
24
26
  }
@@ -7,6 +7,7 @@ import { rowSelectionChangedHandler } from './col-filters-grid.helpers';
7
7
  const RowSelectionChangedHandler = suite('rowSelectionChangedHandler');
8
8
  RowSelectionChangedHandler.before.each(() => {
9
9
  sinon.restore();
10
+ sinon.stub(selectors.baseConfig, 'getConfig').returns({ OUTPUT_FORMAT: 'CSV' });
10
11
  });
11
12
  RowSelectionChangedHandler('should return early if event.data is undefined', () => {
12
13
  const event = { data: undefined };
@@ -37,6 +38,8 @@ RowSelectionChangedHandler('should return early if filtered state matches select
37
38
  TRANSFORMER_CONFIGURATION: {
38
39
  COLUMN_FILTERS: ['testColumn'],
39
40
  },
41
+ GROUPING_STRATEGY: 'NONE',
42
+ GROUP_KEY: null,
40
43
  });
41
44
  rowSelectionChangedHandler(mockEvent);
42
45
  assert.equal(lookupStub.called, true);
@@ -65,6 +68,8 @@ RowSelectionChangedHandler('should return early if type is invalid', () => {
65
68
  TRANSFORMER_CONFIGURATION: {
66
69
  COLUMN_FILTERS: [],
67
70
  },
71
+ GROUPING_STRATEGY: 'NONE',
72
+ GROUP_KEY: null,
68
73
  });
69
74
  rowSelectionChangedHandler(mockEvent);
70
75
  assert.equal(lookupStub.called, true);
@@ -72,7 +77,7 @@ RowSelectionChangedHandler('should return early if type is invalid', () => {
72
77
  });
73
78
  RowSelectionChangedHandler('should update include and redraw when selection changes', () => {
74
79
  const mockData = {
75
- [GridColumnNames.Datasource]: 'TEST (Snapshot)',
80
+ [GridColumnNames.Datasource]: 'testAlias (Snapshot)',
76
81
  [GridColumnNames.ColumnName]: 'testColumn',
77
82
  [GridColumnNames.Type]: 'INT',
78
83
  };
@@ -87,22 +92,37 @@ RowSelectionChangedHandler('should update include and redraw when selection chan
87
92
  };
88
93
  const setColumnIncludedStub = sinon.stub(actions.datasourceConfig, 'setColumnIncluded');
89
94
  sinon.stub(selectors.datasourceConfig, 'getDatasource').returns({
90
- KEY: 'test',
91
- NAME: 'Test Datasource',
95
+ KEY: 'testSource',
96
+ NAME: 'testAlias',
92
97
  INPUT_TYPE: 'REQ_REP',
93
98
  OUTPUT_TYPE: 'TABLE',
94
99
  TRANSFORMER_CONFIGURATION: {
95
100
  INCLUDE_COLUMNS: ['testColumn'],
96
101
  },
102
+ GROUPING_STRATEGY: 'NONE',
103
+ GROUP_KEY: null,
104
+ });
105
+ sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
106
+ REQ_REP_testSource_testAlias: {
107
+ KEY: 'testAlias',
108
+ NAME: 'testSource',
109
+ INPUT_TYPE: 'REQ_REP',
110
+ OUTPUT_TYPE: 'TABLE',
111
+ TRANSFORMER_CONFIGURATION: {},
112
+ GROUPING_STRATEGY: 'NONE',
113
+ GROUP_KEY: null,
114
+ },
97
115
  });
98
116
  rowSelectionChangedHandler(mockEvent);
99
117
  assert.equal(setColumnIncludedStub.calledOnce, true);
100
- assert.equal(setColumnIncludedStub.getCall(0).args[0].key, 'REQ_REP_TEST');
118
+ assert.equal(setColumnIncludedStub.getCall(0).args[0].key, 'REQ_REP_testSource_testAlias');
101
119
  assert.equal(setColumnIncludedStub.getCall(0).args[0].column, 'testColumn');
102
120
  assert.equal(setColumnIncludedStub.getCall(0).args[0].included, false);
121
+ assert.equal(setColumnIncludedStub.getCall(0).args[0].setDefaultFormat, true);
103
122
  assert.equal(mockEvent.api.redrawRows.calledOnce, true);
104
123
  });
105
- RowSelectionChangedHandler('should handle undefined selection state', () => {
124
+ RowSelectionChangedHandler('should not set default format if output format is XLSX', () => {
125
+ selectors.baseConfig.getConfig.returns({ OUTPUT_FORMAT: 'XLSX' });
106
126
  const mockData = {
107
127
  [GridColumnNames.Datasource]: 'TEST (Snapshot)',
108
128
  [GridColumnNames.ColumnName]: 'testColumn',
@@ -111,7 +131,7 @@ RowSelectionChangedHandler('should handle undefined selection state', () => {
111
131
  const mockEvent = {
112
132
  data: mockData,
113
133
  node: {
114
- isSelected: sinon.stub().returns(undefined),
134
+ isSelected: sinon.stub().returns(false),
115
135
  },
116
136
  api: {
117
137
  redrawRows: sinon.stub(),
@@ -123,13 +143,58 @@ RowSelectionChangedHandler('should handle undefined selection state', () => {
123
143
  NAME: 'Test Datasource',
124
144
  INPUT_TYPE: 'REQ_REP',
125
145
  OUTPUT_TYPE: 'TABLE',
146
+ TRANSFORMER_CONFIGURATION: {
147
+ INCLUDE_COLUMNS: ['testColumn'],
148
+ },
149
+ GROUPING_STRATEGY: 'NONE',
150
+ GROUP_KEY: null,
151
+ });
152
+ rowSelectionChangedHandler(mockEvent);
153
+ assert.equal(setColumnIncludedStub.calledOnce, true);
154
+ assert.equal(setColumnIncludedStub.getCall(0).args[0].setDefaultFormat, false);
155
+ });
156
+ RowSelectionChangedHandler('should handle undefined selection state', () => {
157
+ const mockData = {
158
+ [GridColumnNames.Datasource]: 'testAlias (Snapshot)',
159
+ [GridColumnNames.ColumnName]: 'testColumn',
160
+ [GridColumnNames.Type]: 'INT',
161
+ };
162
+ const mockEvent = {
163
+ data: mockData,
164
+ node: {
165
+ isSelected: sinon.stub().returns(undefined),
166
+ },
167
+ api: {
168
+ redrawRows: sinon.stub(),
169
+ },
170
+ };
171
+ const setColumnIncludedStub = sinon.stub(actions.datasourceConfig, 'setColumnIncluded');
172
+ sinon.stub(selectors.datasourceConfig, 'getDatasource').returns({
173
+ KEY: 'testSource',
174
+ NAME: 'testAlias',
175
+ INPUT_TYPE: 'REQ_REP',
176
+ OUTPUT_TYPE: 'TABLE',
126
177
  TRANSFORMER_CONFIGURATION: {
127
178
  COLUMN_FILTERS: ['testColumn'],
128
179
  },
180
+ GROUPING_STRATEGY: 'NONE',
181
+ GROUP_KEY: null,
182
+ });
183
+ sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
184
+ REQ_REP_testSource_testAlias: {
185
+ KEY: 'testAlias',
186
+ NAME: 'testSource',
187
+ INPUT_TYPE: 'REQ_REP',
188
+ OUTPUT_TYPE: 'TABLE',
189
+ TRANSFORMER_CONFIGURATION: {},
190
+ GROUPING_STRATEGY: 'NONE',
191
+ GROUP_KEY: null,
192
+ },
129
193
  });
130
194
  rowSelectionChangedHandler(mockEvent);
131
195
  assert.equal(setColumnIncludedStub.calledOnce, true);
132
196
  assert.equal(setColumnIncludedStub.getCall(0).args[0].included, true);
197
+ assert.equal(setColumnIncludedStub.getCall(0).args[0].setDefaultFormat, true);
133
198
  assert.equal(mockEvent.api.redrawRows.calledOnce, true);
134
199
  });
135
200
  RowSelectionChangedHandler.run();
@@ -21,6 +21,8 @@ LookupColumnRename('should return original data when no rename is found', () =>
21
21
  INPUT_TYPE: 'REQ_REP',
22
22
  OUTPUT_TYPE: 'TABLE',
23
23
  TRANSFORMER_CONFIGURATION: { COLUMN_RENAMES: {} },
24
+ GROUPING_STRATEGY: 'NONE',
25
+ GROUP_KEY: null,
24
26
  });
25
27
  const result = lookupColumnRename(mockData);
26
28
  assert.equal(result, mockData);
@@ -45,6 +47,8 @@ LookupColumnRename('should return data with renamed display name when rename exi
45
47
  [originalColumn]: newDisplayName,
46
48
  },
47
49
  },
50
+ GROUPING_STRATEGY: 'NONE',
51
+ GROUP_KEY: null,
48
52
  });
49
53
  const result = lookupColumnRename(mockData);
50
54
  assert.equal(result[GridColumnNames.DisplayName], newDisplayName);
@@ -66,6 +70,8 @@ LookupColumnRename('should handle undefined COLUMN_RENAMES', () => {
66
70
  INPUT_TYPE: 'REQ_REP',
67
71
  OUTPUT_TYPE: 'TABLE',
68
72
  TRANSFORMER_CONFIGURATION: {},
73
+ GROUPING_STRATEGY: 'NONE',
74
+ GROUP_KEY: null,
69
75
  });
70
76
  const result = lookupColumnRename(mockData);
71
77
  assert.equal(result, mockData);
@@ -80,17 +86,28 @@ DisplayNameOnChangeHandler('calls setColumnRename with correct parameters when v
80
86
  const callback = sinon.spy();
81
87
  const handler = displayNameOnChangeHandler(callback);
82
88
  const mockData = {
83
- [GridColumnNames.Datasource]: 'testSource (Snapshot)',
89
+ [GridColumnNames.Datasource]: 'testAlias (Snapshot)',
84
90
  [GridColumnNames.ColumnName]: 'originalColumn',
85
91
  [GridColumnNames.DisplayName]: 'Original Display',
86
92
  [GridColumnNames.Type]: 'STRING',
87
93
  };
88
94
  const setColumnRenameStub = sinon.stub(actions.datasourceConfig, 'setColumnRename');
95
+ sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
96
+ REQ_REP_testSource_testAlias: {
97
+ KEY: 'testAlias',
98
+ NAME: 'testSource',
99
+ INPUT_TYPE: 'REQ_REP',
100
+ OUTPUT_TYPE: 'TABLE',
101
+ TRANSFORMER_CONFIGURATION: {},
102
+ GROUPING_STRATEGY: 'NONE',
103
+ GROUP_KEY: null,
104
+ },
105
+ });
89
106
  handler('newColumn', { data: mockData });
90
107
  assert.equal(setColumnRenameStub.calledOnce, true);
91
108
  // Check each property individually instead of using deepEqual
92
109
  const firstCallArg = setColumnRenameStub.firstCall.args[0];
93
- assert.equal(firstCallArg.key, 'REQ_REP_testSource');
110
+ assert.equal(firstCallArg.key, 'REQ_REP_testSource_testAlias');
94
111
  assert.equal(firstCallArg.columnFrom, 'originalColumn');
95
112
  assert.equal(firstCallArg.columnTo, 'newColumn');
96
113
  assert.equal(callback.called, false);
@@ -99,17 +116,28 @@ DisplayNameOnChangeHandler('removes prohibited characters and calls callback', (
99
116
  const callback = sinon.spy();
100
117
  const handler = displayNameOnChangeHandler(callback);
101
118
  const mockData = {
102
- [GridColumnNames.Datasource]: 'testSource (Snapshot)',
119
+ [GridColumnNames.Datasource]: 'testAlias (Snapshot)',
103
120
  [GridColumnNames.ColumnName]: 'originalColumn',
104
121
  [GridColumnNames.DisplayName]: 'Original Display',
105
122
  [GridColumnNames.Type]: 'STRING',
106
123
  };
107
124
  const setColumnRenameStub = sinon.stub(actions.datasourceConfig, 'setColumnRename');
125
+ sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
126
+ REQ_REP_testSource_testAlias: {
127
+ KEY: 'testAlias',
128
+ NAME: 'testSource',
129
+ INPUT_TYPE: 'REQ_REP',
130
+ OUTPUT_TYPE: 'TABLE',
131
+ TRANSFORMER_CONFIGURATION: {},
132
+ GROUPING_STRATEGY: 'NONE',
133
+ GROUP_KEY: null,
134
+ },
135
+ });
108
136
  handler('new@Column-=+test', { data: mockData });
109
137
  assert.equal(setColumnRenameStub.calledOnce, true);
110
138
  // Check each property individually instead of using deepEqual
111
139
  const firstCallArg = setColumnRenameStub.firstCall.args[0];
112
- assert.equal(firstCallArg.key, 'REQ_REP_testSource');
140
+ assert.equal(firstCallArg.key, 'REQ_REP_testSource_testAlias');
113
141
  assert.equal(firstCallArg.columnFrom, 'originalColumn');
114
142
  assert.equal(firstCallArg.columnTo, 'newColumntest');
115
143
  assert.equal(callback.calledOnce, true);
@@ -20,6 +20,8 @@ LookupColumnFormat('should return empty string when no format is found', () => {
20
20
  INPUT_TYPE: 'REQ_REP',
21
21
  OUTPUT_TYPE: 'TABLE',
22
22
  TRANSFORMER_CONFIGURATION: { COLUMN_FORMATS: {} },
23
+ GROUPING_STRATEGY: 'NONE',
24
+ GROUP_KEY: null,
23
25
  });
24
26
  const result = lookupColumnFormat(mockData);
25
27
  assert.equal(result[GridColumnNames.Format], ''); // No format found, returns empty string
@@ -44,6 +46,8 @@ LookupColumnFormat('should return data with format when format exists', () => {
44
46
  [originalColumn]: newFormat,
45
47
  },
46
48
  },
49
+ GROUPING_STRATEGY: 'NONE',
50
+ GROUP_KEY: null,
47
51
  });
48
52
  const result = lookupColumnFormat(mockData);
49
53
  assert.equal(result[GridColumnNames.Format], newFormat);
@@ -65,6 +69,8 @@ LookupColumnFormat('should handle undefined COLUMN_FORMATS', () => {
65
69
  INPUT_TYPE: 'REQ_REP',
66
70
  OUTPUT_TYPE: 'TABLE',
67
71
  TRANSFORMER_CONFIGURATION: {},
72
+ GROUPING_STRATEGY: 'NONE',
73
+ GROUP_KEY: null,
68
74
  });
69
75
  const result = lookupColumnFormat(mockData);
70
76
  assert.equal(result[GridColumnNames.Format], ''); // No format found, returns empty string
@@ -87,6 +93,8 @@ LookupColumnFormat('should return existing format when format exists', () => {
87
93
  numericColumn: '#.##',
88
94
  },
89
95
  },
96
+ GROUPING_STRATEGY: 'NONE',
97
+ GROUP_KEY: null,
90
98
  });
91
99
  const result = lookupColumnFormat(mockData);
92
100
  assert.equal(result[GridColumnNames.Format], '#.##'); // Existing format is returned
@@ -363,7 +371,7 @@ ValueExprCellRendereronChange.before.each(() => {
363
371
  sinon.restore();
364
372
  });
365
373
  ValueExprCellRendereronChange('should call setColumnTransform when model exists', () => {
366
- const datasourceKey = 'REQ_REP_Test';
374
+ const datasourceKey = 'REQ_REP_RESOURCE_ALIAS';
367
375
  const columnName = 'testColumn';
368
376
  // Using type assertions to match the expected type
369
377
  const mockExpression = {
@@ -403,7 +411,7 @@ ValueExprCellRendereronChange('should call setColumnTransform when model exists'
403
411
  assert.equal(deleteColumnTransformStub.called, false);
404
412
  });
405
413
  ValueExprCellRendereronChange('should call deleteColumnTransform when model is null', () => {
406
- const datasourceKey = 'REQ_REP_Test';
414
+ const datasourceKey = 'REQ_REP_RESOURCE_ALIAS';
407
415
  const columnName = 'testColumn';
408
416
  const mockParams = {
409
417
  data: {
@@ -1,8 +1,8 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
2
  import { Connect } from '@genesislcap/foundation-comms';
3
3
  import { attr, customElement, GenesisElement, observable } from '@genesislcap/web-core';
4
- import { actions, } from '../../../store';
5
- import { buildDatasourceName, datasourceInputFromDisplay, getDatasourceSchema, showNotificationToast, } from '../../../utils';
4
+ import { actions, selectors, } from '../../../store';
5
+ import { buildDatasourceName, datasourceInputFromDisplay, generateUniqueAlias, getDatasourceSchema, showNotificationToast, } from '../../../utils';
6
6
  import { setDefaultFormatsForDatasource } from '../data-transforms-derived-fields/data-transforms.helpers';
7
7
  import { styles } from './datasource-config-item.styles';
8
8
  import { template } from './datasource-config-item.template';
@@ -12,10 +12,27 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
12
12
  this.getSchema = getDatasourceSchema(this.connect);
13
13
  this.datasourceName = null;
14
14
  this.datasourceChoices = null;
15
+ this.groupingByFieldsNames = null;
15
16
  this.canRemove = false;
16
17
  this.position = 'below';
17
18
  this.error = 'none';
18
19
  }
20
+ connectedCallback() {
21
+ const _super = Object.create(null, {
22
+ connectedCallback: { get: () => super.connectedCallback }
23
+ });
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ _super.connectedCallback.call(this);
26
+ try {
27
+ const datasource = selectors.datasourceConfig.getDatasource(this.datasourceName);
28
+ const schema = yield this.getSchema(datasource.NAME);
29
+ this.groupingByFieldsNames = Object.keys(schema.properties);
30
+ }
31
+ catch (e) {
32
+ console.error(e);
33
+ }
34
+ });
35
+ }
19
36
  deleteDatasourceHandler() {
20
37
  if (!this.canRemove)
21
38
  throw new Error('Trying to remove final datasource!');
@@ -25,13 +42,28 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
25
42
  key: this.datasourceName,
26
43
  });
27
44
  }
28
- updateKeyHandler(newKey) {
45
+ updateKeyHandler(newName, event) {
29
46
  if (!this.datasourceName) {
30
47
  throw new Error('updateKeyHandler - datasourceName unset');
31
48
  }
32
- actions.datasourceConfig.updateDatasourceKey({
49
+ const allDatasources = selectors.datasourceConfig.getAllConfigSet();
50
+ const nameExists = Object.entries(allDatasources)
51
+ .filter(([key]) => key !== this.datasourceName)
52
+ .some(([, ds]) => ds.KEY.toLowerCase() === newName.toLowerCase());
53
+ if (nameExists) {
54
+ showNotificationToast({
55
+ title: 'Reporting Config',
56
+ body: `Name '${newName}' is already in use by another datasource.`,
57
+ toast: { type: 'error' },
58
+ });
59
+ if (event) {
60
+ event.target.value = allDatasources[this.datasourceName].KEY;
61
+ }
62
+ return;
63
+ }
64
+ actions.datasourceConfig.renameDatasource({
33
65
  key: this.datasourceName,
34
- newKey,
66
+ newName,
35
67
  });
36
68
  }
37
69
  updateOutputTypeHandler(newType) {
@@ -43,6 +75,45 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
43
75
  newType,
44
76
  });
45
77
  }
78
+ updateGroupingStrategyHandler(value) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ try {
81
+ if (value === 'NONE') {
82
+ actions.datasourceConfig.deleteGrouping({ key: this.datasourceName });
83
+ return;
84
+ }
85
+ const dsResource = selectors.datasourceConfig.getDatasource(this.datasourceName).NAME;
86
+ const schema = yield this.getSchema(dsResource);
87
+ if (!schema.properties)
88
+ throw new Error(`schema properties for ${dsResource} undefined`);
89
+ const fields = Object.keys(schema.properties);
90
+ actions.datasourceConfig.setGrouping({
91
+ key: this.datasourceName,
92
+ grouping: { GROUPING_STRATEGY: value, GROUP_KEY: fields[0] },
93
+ });
94
+ this.groupingByFieldsNames = Object.keys(schema.properties);
95
+ }
96
+ catch (e) {
97
+ const errorMsg = e instanceof Error ? `\n\n${e.message}` : '';
98
+ showNotificationToast({
99
+ title: 'Reporting Config',
100
+ body: `Error fetching field data for datasource ${this.datasourceName}.${errorMsg}`,
101
+ toast: { type: 'critical' },
102
+ });
103
+ this.error = 'unknown';
104
+ console.error(e);
105
+ }
106
+ });
107
+ }
108
+ updateGroupingByHandler(value) {
109
+ const datasource = selectors.datasourceConfig.getDatasource(this.datasourceName);
110
+ if (datasource.GROUPING_STRATEGY === 'NONE')
111
+ throw new Error('Cannot set group by field when GROUPING_STRATEGY is NONE');
112
+ actions.datasourceConfig.setGrouping({
113
+ key: this.datasourceName,
114
+ grouping: { GROUPING_STRATEGY: datasource.GROUPING_STRATEGY, GROUP_KEY: value },
115
+ });
116
+ }
46
117
  updateDatasourceSourceHandler(selectedOption) {
47
118
  return __awaiter(this, void 0, void 0, function* () {
48
119
  var _a;
@@ -54,7 +125,7 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
54
125
  return;
55
126
  }
56
127
  const option = selectedOption.selectedOptions[0];
57
- const KEY = option.value;
128
+ const RESOURCE_NAME = option.value;
58
129
  const dataAttr = (option.getAttribute('data-bubble-content'));
59
130
  if (!dataAttr)
60
131
  throw new Error(`Unable to read datasource from attribute ${dataAttr}`);
@@ -62,21 +133,37 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
62
133
  if (!this.datasourceName || !INPUT_TYPE) {
63
134
  throw new Error('updateKeyHandler - datasourceName or INPUT_TYPE null');
64
135
  }
65
- const schema = yield this.getSchema(KEY);
136
+ const schema = yield this.getSchema(RESOURCE_NAME);
66
137
  if (!schema.properties)
67
- throw new Error(`schema properties for ${KEY} undefined`);
138
+ throw new Error(`schema properties for ${RESOURCE_NAME} undefined`);
68
139
  const fields = Object.keys(schema.properties);
140
+ // Check for duplicate aliases
141
+ const allDatasources = selectors.datasourceConfig.getAllConfigSet();
142
+ const existingAliases = new Set(Object.entries(allDatasources)
143
+ .filter(([key]) => key !== this.datasourceName)
144
+ .map(([, ds]) => ds.KEY));
145
+ const uniqueAlias = generateUniqueAlias(RESOURCE_NAME, existingAliases);
146
+ // Preserve index
147
+ const originalIndex = Object.keys(allDatasources).indexOf(this.datasourceName);
69
148
  actions.datasourceConfig.deleteDatasource({ key: this.datasourceName });
70
149
  actions.datasourceConfig.initDatasourceConfiguration({
71
150
  base: {
72
- KEY,
151
+ KEY: uniqueAlias,
152
+ NAME: RESOURCE_NAME,
73
153
  INPUT_TYPE: INPUT_TYPE,
74
154
  },
75
155
  fields,
76
156
  });
77
- const datasourceName = buildDatasourceName(KEY, INPUT_TYPE);
157
+ const datasourceName = buildDatasourceName(uniqueAlias, RESOURCE_NAME, INPUT_TYPE);
158
+ if (originalIndex !== -1) {
159
+ actions.datasourceConfig.reorderDatasource({
160
+ key: datasourceName,
161
+ newIndex: originalIndex,
162
+ });
163
+ }
78
164
  setDefaultFormatsForDatasource(datasourceName, schema);
79
165
  this.error = 'none';
166
+ this.groupingByFieldsNames = Object.keys(schema.properties);
80
167
  }
81
168
  catch (e) {
82
169
  const errorMsg = e instanceof Error ? `\n\n${e.message}` : '';
@@ -100,6 +187,9 @@ __decorate([
100
187
  __decorate([
101
188
  observable
102
189
  ], DatasourceConfigItem.prototype, "datasourceChoices", void 0);
190
+ __decorate([
191
+ observable
192
+ ], DatasourceConfigItem.prototype, "groupingByFieldsNames", void 0);
103
193
  __decorate([
104
194
  attr({ mode: 'boolean', attribute: 'can-remove' })
105
195
  ], DatasourceConfigItem.prototype, "canRemove", void 0);
@@ -8,6 +8,12 @@ export const styles = css `
8
8
  gap: calc(var(--design-unit) * 2px);
9
9
  }
10
10
 
11
+ div.split {
12
+ display: grid;
13
+ grid-template-columns: 1fr 1fr;
14
+ gap: calc(var(--design-unit) * 2px);
15
+ }
16
+
11
17
  rapid-combobox.datasource {
12
18
  margin-bottom: calc(var(--design-unit) * 2px);
13
19
  }
@@ -1,15 +1,42 @@
1
1
  import { classNames, html, repeat, when, whenElse } from '@genesislcap/web-core';
2
- import { datasourceOutputs, selectors } from '../../../store';
2
+ import { datasourceGroupingStrategies, datasourceOutputs, selectors, } from '../../../store';
3
3
  import { datasourceInputForDisplay, TOOLTIP, tooltip } from '../../../utils';
4
4
  const datasourceAlias = html `
5
5
  <div>
6
6
  <p class="label">Name${tooltip(TOOLTIP.DATASOURCES_NAME)}</p>
7
7
  <rapid-text-field
8
8
  value=${(x) => selectors.datasourceConfig.getDatasource(x.datasourceName).KEY}
9
- @change=${(x, ctx) => x.updateKeyHandler(ctx.event.target.value)}
9
+ @change=${(x, ctx) => x.updateKeyHandler(ctx.event.target.value, ctx.event)}
10
10
  ></rapid-text-field>
11
11
  </div>
12
12
  `;
13
+ const groupingType = html `
14
+ <div class="split">
15
+ <div>
16
+ <p class="label">Grouping Strategy${tooltip(TOOLTIP.DATASOURCES_GROUPING_STRATEGY)}</p>
17
+ <rapid-select
18
+ :value=${(x) => selectors.datasourceConfig.getDatasource(x.datasourceName).GROUPING_STRATEGY}
19
+ @change=${(x, ctx) => x.updateGroupingStrategyHandler(ctx.event.target.value)}
20
+ >
21
+ ${repeat(() => datasourceGroupingStrategies, html `
22
+ <rapid-option>${(x) => x}</rapid-option>
23
+ `)}
24
+ </rapid-select>
25
+ </div>
26
+ <div>
27
+ <p class="label">Grouping Key${tooltip(TOOLTIP.DATASOURCES_GROUPING_KEY)}</p>
28
+ <rapid-select
29
+ :value=${(x) => selectors.datasourceConfig.getDatasource(x.datasourceName).GROUP_KEY}
30
+ @change=${(x, ctx) => x.updateGroupingByHandler(ctx.event.target.value)}
31
+ ?disabled=${(x) => selectors.datasourceConfig.getDatasource(x.datasourceName).GROUPING_STRATEGY === 'NONE'}
32
+ >
33
+ ${repeat((x) => { var _a; return (_a = x.groupingByFieldsNames) !== null && _a !== void 0 ? _a : []; }, html `
34
+ <rapid-option>${(x) => x}</rapid-option>
35
+ `)}
36
+ </rapid-select>
37
+ </div>
38
+ </div>
39
+ `;
13
40
  const processType = html `
14
41
  <div>
15
42
  <p class="label">Type${tooltip(TOOLTIP.DATASOURCES_TYPE)}</p>
@@ -33,6 +60,9 @@ const closeButton = html `
33
60
  const component = html `
34
61
  ${when((x) => x.canRemove, closeButton)}
35
62
  <div class="container">
63
+ <div class="${() => classNames(['split', Boolean(selectors.baseConfig.getConfig().DOCUMENT_TEMPLATE_ID)])}">
64
+ <div>
65
+ <p class="label">Datasource${tooltip(TOOLTIP.DATASOURCES_DATASOURCE)}</p>
36
66
  <rapid-combobox
37
67
  class="datasource ${(x) => classNames(['error', x.error !== 'none'])}"
38
68
  autocomplete="both"
@@ -50,7 +80,12 @@ const component = html `
50
80
  </rapid-option>
51
81
  `)}
52
82
  </rapid-combobox>
53
- ${when((_) => Boolean(selectors.baseConfig.getConfig().DOCUMENT_TEMPLATE_ID), datasourceAlias)}
83
+ </div>
84
+ ${when((_) => Boolean(selectors.baseConfig.getConfig().DOCUMENT_TEMPLATE_ID) ||
85
+ selectors.baseConfig.getConfig().OUTPUT_FORMAT !== 'CSV', datasourceAlias)}
86
+ </div>
87
+ </div>
88
+ ${when((_) => Boolean(selectors.baseConfig.getConfig().DOCUMENT_TEMPLATE_ID), groupingType)}
54
89
  <!-- ${when((_) => selectors.baseConfig.getConfig().OUTPUT_FORMAT === 'CSV', processType)} -->
55
90
  </div>
56
91
  `;