@genesislcap/pbc-reporting-ui 15.19.0 → 15.19.1

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 (247) hide show
  1. package/dist/custom-elements.json +4247 -5382
  2. package/dist/dts/react.d.ts +44 -44
  3. package/dist/react.cjs +65 -65
  4. package/dist/react.mjs +57 -57
  5. package/package.json +22 -23
  6. package/.env +0 -3
  7. package/api-extractor.json +0 -4
  8. package/dist/dts/new/main/edit-config/col-filters/col-filters-grid.helpers.test.d.ts +0 -2
  9. package/dist/dts/new/main/edit-config/col-filters/col-filters-grid.helpers.test.d.ts.map +0 -1
  10. package/dist/dts/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.d.ts +0 -2
  11. package/dist/dts/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.d.ts.map +0 -1
  12. package/dist/dts/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.d.ts +0 -2
  13. package/dist/dts/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.d.ts.map +0 -1
  14. package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.d.ts +0 -2
  15. package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.d.ts.map +0 -1
  16. package/dist/dts/new/main/edit-config/row-filters/row-filters.helpers.test.d.ts +0 -2
  17. package/dist/dts/new/main/edit-config/row-filters/row-filters.helpers.test.d.ts.map +0 -1
  18. package/dist/dts/new/main/edit-config/shared/datasource-data-base-component.test.d.ts +0 -5
  19. package/dist/dts/new/main/edit-config/shared/datasource-data-base-component.test.d.ts.map +0 -1
  20. package/dist/dts/new/utils/alias-generator.test.d.ts +0 -2
  21. package/dist/dts/new/utils/alias-generator.test.d.ts.map +0 -1
  22. package/dist/dts/new/utils/endpoint.test.d.ts +0 -2
  23. package/dist/dts/new/utils/endpoint.test.d.ts.map +0 -1
  24. package/dist/dts/new/utils/transformers.test.d.ts +0 -2
  25. package/dist/dts/new/utils/transformers.test.d.ts.map +0 -1
  26. package/dist/dts/new/utils/validators.test.d.ts +0 -2
  27. package/dist/dts/new/utils/validators.test.d.ts.map +0 -1
  28. package/dist/dts/old/main/main.test.d.ts +0 -2
  29. package/dist/dts/old/main/main.test.d.ts.map +0 -1
  30. package/dist/dts/old/utils/filterObjectArray.test.d.ts +0 -2
  31. package/dist/dts/old/utils/filterObjectArray.test.d.ts.map +0 -1
  32. package/dist/esm/new/main/edit-config/col-filters/col-filters-grid.helpers.test.js +0 -200
  33. package/dist/esm/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.js +0 -152
  34. package/dist/esm/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.js +0 -629
  35. package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.js +0 -268
  36. package/dist/esm/new/main/edit-config/row-filters/row-filters.helpers.test.js +0 -1
  37. package/dist/esm/new/main/edit-config/shared/datasource-data-base-component.test.js +0 -426
  38. package/dist/esm/new/utils/alias-generator.test.js +0 -36
  39. package/dist/esm/new/utils/endpoint.test.js +0 -162
  40. package/dist/esm/new/utils/transformers.test.js +0 -469
  41. package/dist/esm/new/utils/validators.test.js +0 -139
  42. package/dist/esm/old/main/main.test.js +0 -5
  43. package/dist/esm/old/utils/filterObjectArray.test.js +0 -46
  44. package/dist/tsconfig.tsbuildinfo +0 -1
  45. package/src/globals.d.ts +0 -7
  46. package/src/index.federated.ts +0 -1
  47. package/src/index.ts +0 -8
  48. package/src/new/components/clone-report-config-modal/clone-report-config-modal.styles.ts +0 -47
  49. package/src/new/components/clone-report-config-modal/clone-report-config-modal.template.ts +0 -55
  50. package/src/new/components/clone-report-config-modal/clone-report-config-modal.ts +0 -173
  51. package/src/new/components/components.ts +0 -118
  52. package/src/new/components/renderers/data-transform-renderer.ts +0 -111
  53. package/src/new/components/reporting-configurations/reporting-configurations.styles.ts +0 -42
  54. package/src/new/components/reporting-configurations/reporting-configurations.template.ts +0 -59
  55. package/src/new/components/reporting-configurations/reporting-configurations.ts +0 -366
  56. package/src/new/components/shared/file-template-picker.template.ts +0 -45
  57. package/src/new/lib/redux-store/README.md +0 -55
  58. package/src/new/lib/redux-store/index.ts +0 -2
  59. package/src/new/lib/redux-store/state-utils.ts +0 -1
  60. package/src/new/lib/redux-store/store.ts +0 -135
  61. package/src/new/main/edit-config/base-config/base-config.styles.ts +0 -26
  62. package/src/new/main/edit-config/base-config/base-config.template.ts +0 -71
  63. package/src/new/main/edit-config/base-config/base-config.ts +0 -116
  64. package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.test.ts +0 -232
  65. package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.ts +0 -35
  66. package/src/new/main/edit-config/col-filters/col-filters-grid.styles.ts +0 -22
  67. package/src/new/main/edit-config/col-filters/col-filters-grid.ts +0 -150
  68. package/src/new/main/edit-config/col-filters/col-filters-grid.types.ts +0 -7
  69. package/src/new/main/edit-config/col-filters/col-filters-tutorial.ts +0 -25
  70. package/src/new/main/edit-config/col-filters/col-fitlers-grid.template.ts +0 -15
  71. package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.ts +0 -187
  72. package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.ts +0 -89
  73. package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.styles.ts +0 -22
  74. package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.template.ts +0 -14
  75. package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.ts +0 -119
  76. package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.types.ts +0 -10
  77. package/src/new/main/edit-config/col-rename-alias/col-rename-alias-tutorial.ts +0 -33
  78. package/src/new/main/edit-config/config-journey-orchestrator.styles.ts +0 -120
  79. package/src/new/main/edit-config/config-journey-orchestrator.template.ts +0 -149
  80. package/src/new/main/edit-config/config-journey-orchestrator.ts +0 -92
  81. package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms-tutorial.ts +0 -127
  82. package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.ts +0 -799
  83. package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.ts +0 -371
  84. package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.styles.ts +0 -22
  85. package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.template.ts +0 -21
  86. package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.ts +0 -162
  87. package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.types.ts +0 -211
  88. package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.styles.ts +0 -79
  89. package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.template.ts +0 -217
  90. package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.ts +0 -280
  91. package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/index.ts +0 -1
  92. package/src/new/main/edit-config/data-transforms-derived-fields/format-warning.ts +0 -43
  93. package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/index.ts +0 -1
  94. package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.styles.ts +0 -68
  95. package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.template.ts +0 -93
  96. package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.ts +0 -152
  97. package/src/new/main/edit-config/datasource-config/datasource-config-container.styles.ts +0 -22
  98. package/src/new/main/edit-config/datasource-config/datasource-config-item.styles.ts +0 -76
  99. package/src/new/main/edit-config/datasource-config/datasource-config-item.template.ts +0 -141
  100. package/src/new/main/edit-config/datasource-config/datasource-config-item.ts +0 -212
  101. package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.ts +0 -341
  102. package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.ts +0 -99
  103. package/src/new/main/edit-config/datasource-config/datasources-config-container.template.ts +0 -68
  104. package/src/new/main/edit-config/datasource-config/datasources-config-container.ts +0 -55
  105. package/src/new/main/edit-config/datasource-config/types.ts +0 -6
  106. package/src/new/main/edit-config/outputs-config/outputs-config.style.ts +0 -11
  107. package/src/new/main/edit-config/outputs-config/outputs-config.template.ts +0 -66
  108. package/src/new/main/edit-config/outputs-config/outputs-config.ts +0 -66
  109. package/src/new/main/edit-config/row-filters/row-filters-tutorial.styles.ts +0 -16
  110. package/src/new/main/edit-config/row-filters/row-filters-tutorial.template.ts +0 -229
  111. package/src/new/main/edit-config/row-filters/row-filters-tutorial.ts +0 -15
  112. package/src/new/main/edit-config/row-filters/row-filters.helpers.test.ts +0 -2
  113. package/src/new/main/edit-config/row-filters/row-filters.helpers.ts +0 -53
  114. package/src/new/main/edit-config/row-filters/row-filters.styles.ts +0 -23
  115. package/src/new/main/edit-config/row-filters/row-filters.template.ts +0 -15
  116. package/src/new/main/edit-config/row-filters/row-filters.ts +0 -58
  117. package/src/new/main/edit-config/row-filters/row-filters.types.ts +0 -14
  118. package/src/new/main/edit-config/scheduling/scheduling.styles.ts +0 -59
  119. package/src/new/main/edit-config/scheduling/scheduling.template.ts +0 -80
  120. package/src/new/main/edit-config/scheduling/scheduling.ts +0 -101
  121. package/src/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.ts +0 -250
  122. package/src/new/main/edit-config/shared/datasource-data-base-component.test.ts +0 -568
  123. package/src/new/main/edit-config/shared/datasource-data-base-component.ts +0 -65
  124. package/src/new/main/edit-config/shared/datasource-data-base-component.types.ts +0 -55
  125. package/src/new/main/edit-config/shared/index.ts +0 -3
  126. package/src/new/main/edit-config/tabbed-datasource-container/index.ts +0 -2
  127. package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.styles.ts +0 -12
  128. package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.template.ts +0 -29
  129. package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.ts +0 -69
  130. package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.types.ts +0 -7
  131. package/src/new/main/generated-reports/generated-reports.styles.ts +0 -15
  132. package/src/new/main/generated-reports/generated-reports.template.ts +0 -29
  133. package/src/new/main/generated-reports/generated-reports.ts +0 -270
  134. package/src/new/main/index.ts +0 -3
  135. package/src/new/main/main.styles.ts +0 -31
  136. package/src/new/main/main.template.ts +0 -92
  137. package/src/new/main/main.ts +0 -117
  138. package/src/new/main/report-destinations/report-destinations.template.ts +0 -39
  139. package/src/new/main/report-destinations/report-destinations.ts +0 -63
  140. package/src/new/store/index.ts +0 -3
  141. package/src/new/store/slices/base-config.ts +0 -50
  142. package/src/new/store/slices/datasources-config.ts +0 -297
  143. package/src/new/store/slices/index.ts +0 -3
  144. package/src/new/store/slices/types.ts +0 -90
  145. package/src/new/store/store.ts +0 -36
  146. package/src/new/store/types.ts +0 -10
  147. package/src/new/styles/constraints.styles.ts +0 -32
  148. package/src/new/styles/forms.styles.ts +0 -38
  149. package/src/new/styles/index.ts +0 -3
  150. package/src/new/styles/misc.styles.ts +0 -25
  151. package/src/new/types/display.ts +0 -4
  152. package/src/new/types/index.ts +0 -4
  153. package/src/new/types/misc.ts +0 -73
  154. package/src/new/types/redux.ts +0 -73
  155. package/src/new/types/rights.ts +0 -28
  156. package/src/new/utils/alias-generator.test.ts +0 -44
  157. package/src/new/utils/alias-generator.ts +0 -18
  158. package/src/new/utils/date-filter-params.ts +0 -28
  159. package/src/new/utils/endpoint.test.ts +0 -193
  160. package/src/new/utils/endpoint.ts +0 -62
  161. package/src/new/utils/event-map.ts +0 -11
  162. package/src/new/utils/format-utils.ts +0 -22
  163. package/src/new/utils/formatters.ts +0 -36
  164. package/src/new/utils/index.ts +0 -10
  165. package/src/new/utils/notifications.ts +0 -9
  166. package/src/new/utils/renderer.ts +0 -38
  167. package/src/new/utils/rights.ts +0 -66
  168. package/src/new/utils/sorter.ts +0 -19
  169. package/src/new/utils/tooltip.ts +0 -94
  170. package/src/new/utils/transformers.test.ts +0 -549
  171. package/src/new/utils/transformers.ts +0 -174
  172. package/src/new/utils/validators.test.ts +0 -165
  173. package/src/new/utils/validators.ts +0 -81
  174. package/src/old/assets/images/index.ts +0 -69
  175. package/src/old/components/create-edit/create-edit.styles.ts +0 -16
  176. package/src/old/components/create-edit/create-edit.template.ts +0 -15
  177. package/src/old/components/create-edit/create-edit.ts +0 -70
  178. package/src/old/components/create-edit/index.ts +0 -3
  179. package/src/old/components/list/columns.ts +0 -175
  180. package/src/old/components/list/index.ts +0 -3
  181. package/src/old/components/list/list.styles.ts +0 -9
  182. package/src/old/components/list/list.template.ts +0 -40
  183. package/src/old/components/list/list.ts +0 -109
  184. package/src/old/components/preview/columns.ts +0 -58
  185. package/src/old/components/preview/index.ts +0 -3
  186. package/src/old/components/preview/preview.styles.ts +0 -22
  187. package/src/old/components/preview/preview.template.ts +0 -33
  188. package/src/old/components/preview/preview.ts +0 -143
  189. package/src/old/components/rapid-components.ts +0 -64
  190. package/src/old/components/renderers/custom-header-component.ts +0 -92
  191. package/src/old/components/renderers/filter-value-renderer.ts +0 -237
  192. package/src/old/components/renderers/row-select.renderer.ts +0 -148
  193. package/src/old/components/select-fields/columns.ts +0 -83
  194. package/src/old/components/select-fields/data.ts +0 -218
  195. package/src/old/components/select-fields/index.ts +0 -3
  196. package/src/old/components/select-fields/select-fields.styles.ts +0 -22
  197. package/src/old/components/select-fields/select-fields.template.ts +0 -58
  198. package/src/old/components/select-fields/select-fields.ts +0 -218
  199. package/src/old/components/select-filters/columns.ts +0 -78
  200. package/src/old/components/select-filters/index.ts +0 -3
  201. package/src/old/components/select-filters/select-filters.styles.ts +0 -21
  202. package/src/old/components/select-filters/select-filters.template.ts +0 -58
  203. package/src/old/components/select-filters/select-filters.ts +0 -255
  204. package/src/old/components/wizard/debug.ts +0 -35
  205. package/src/old/components/wizard/index.ts +0 -2
  206. package/src/old/components/wizard/steps/filters.ts +0 -13
  207. package/src/old/components/wizard/steps/index.ts +0 -4
  208. package/src/old/components/wizard/steps/name.ts +0 -72
  209. package/src/old/components/wizard/steps/run.ts +0 -14
  210. package/src/old/components/wizard/steps/select.ts +0 -14
  211. package/src/old/components/wizard/wizard.styles.ts +0 -198
  212. package/src/old/components/wizard/wizard.template.ts +0 -147
  213. package/src/old/components/wizard/wizard.ts +0 -398
  214. package/src/old/components/wizard/wizard.types.ts +0 -43
  215. package/src/old/components/zero-components.ts +0 -61
  216. package/src/old/config/config.ts +0 -59
  217. package/src/old/config/configure.ts +0 -66
  218. package/src/old/config/index.ts +0 -2
  219. package/src/old/config/templates.ts +0 -59
  220. package/src/old/constants/grid-config.ts +0 -19
  221. package/src/old/layouts/default.ts +0 -30
  222. package/src/old/layouts/index.ts +0 -2
  223. package/src/old/layouts/two-pane-horizontal.ts +0 -81
  224. package/src/old/main/index.ts +0 -3
  225. package/src/old/main/main.styles.ts +0 -69
  226. package/src/old/main/main.template.ts +0 -127
  227. package/src/old/main/main.test.ts +0 -7
  228. package/src/old/main/main.ts +0 -250
  229. package/src/old/main/types.ts +0 -29
  230. package/src/old/styles/colors.ts +0 -16
  231. package/src/old/styles/helpers.ts +0 -181
  232. package/src/old/styles/index.ts +0 -4
  233. package/src/old/styles/normalize.ts +0 -14
  234. package/src/old/styles/styles.ts +0 -24
  235. package/src/old/tags/index.ts +0 -1
  236. package/src/old/tags/tags.ts +0 -79
  237. package/src/old/tsconfig.json +0 -10
  238. package/src/old/utils/filterObjectArray.test.ts +0 -110
  239. package/src/old/utils/filterObjectArray.ts +0 -23
  240. package/src/old/utils/getFiltersByType.ts +0 -92
  241. package/src/old/utils/getSelectedFields.ts +0 -16
  242. package/src/old/utils/index.ts +0 -4
  243. package/src/old/utils/logger.ts +0 -3
  244. package/src/sandbox.ts +0 -51
  245. package/src/tsconfig.base.json +0 -24
  246. package/src/typings.d.ts +0 -1
  247. package/tsconfig.json +0 -9
@@ -1,371 +0,0 @@
1
- import type { DataTransformRendererParams } from '../../../components/renderers/data-transform-renderer';
2
- import type { DatasourceName } from '../../../store';
3
- import { actions, selectors } from '../../../store';
4
- import type { Genesis } from '../../../types';
5
- import { getDefaultFormat } from '../../../utils/format-utils';
6
- import {
7
- GridColumnNames,
8
- datasourceNameFromDisplay,
9
- } from '../shared/datasource-data-base-component.helpers.ts';
10
- import {
11
- BaseFormatOptions,
12
- DataTransformData,
13
- DateLocaleFormats,
14
- DateMonthFormats,
15
- DateTimeFormats,
16
- DateTimeTokens,
17
- DisplayConfigurationRow,
18
- FormatTypes,
19
- LocaleDateOrderMap,
20
- NumericFormats,
21
- NumericCurrencies,
22
- NumericFieldTypes,
23
- } from './data-transforms.types';
24
-
25
- // Re-export getDefaultFormat for use in tests
26
- export { getDefaultFormat };
27
-
28
- // export const lookupDataTransform =
29
- // (exprBuilderFields: ExpressionBuilderTypes.Field[]) =>
30
- // (data: DataTransformData): DataTransformData => {
31
- // const key = datasourceNameFromDisplay(data[GridColumnNames.Datasource]);
32
- // const maybeExpr = selectors.datasourceConfig.getRowTransform(
33
- // key,
34
- // data[GridColumnNames.ColumnName],
35
- // );
36
- // return {
37
- // ...data,
38
- // [GridColumnNames.DataTransform]: {
39
- // fields: exprBuilderFields,
40
- // ...(maybeExpr ? { model: maybeExpr } : {}),
41
- // partialRuleValidationWarning: true,
42
- // },
43
- // };
44
- // };
45
-
46
- /**
47
- * Adds format configuration info from store to the row data
48
- */
49
- export function lookupColumnFormat(data: DataTransformData): DataTransformData {
50
- const key = datasourceNameFromDisplay(data[GridColumnNames.Datasource]);
51
- const format =
52
- selectors.datasourceConfig.getDatasource(key).TRANSFORMER_CONFIGURATION.COLUMN_FORMATS?.[
53
- data[GridColumnNames.ColumnName]
54
- ];
55
-
56
- return {
57
- ...data,
58
- [GridColumnNames.Format]: format || '',
59
- };
60
- }
61
-
62
- // getDefaultFormat moved to utils/format-utils.ts to break circular dependency
63
-
64
- /**
65
- * Sets default formats for included fields in a datasource based on their types
66
- * This should be called after datasource initialization when schema information is available
67
- */
68
- export const setDefaultFormatsForDatasource = (
69
- datasourceName: DatasourceName,
70
- schema: Genesis.JSONSchema7,
71
- ) => {
72
- if (!schema.properties) return;
73
-
74
- if (selectors.baseConfig.getConfig().OUTPUT_FORMAT === 'XLSX') {
75
- return;
76
- }
77
-
78
- const datasource = selectors.datasourceConfig.getDatasource(datasourceName);
79
- const includedColumns = datasource?.TRANSFORMER_CONFIGURATION?.INCLUDE_COLUMNS ?? [];
80
-
81
- Object.entries(schema.properties).forEach(([fieldName, fieldSchema]) => {
82
- // Only set default format if the column is included
83
- if (includedColumns.includes(fieldName)) {
84
- const genesisType = (fieldSchema as any).genesisType as Genesis.GenesisFieldTypes;
85
- if (genesisType) {
86
- const defaultFormat = getDefaultFormat(genesisType);
87
- if (defaultFormat) {
88
- actions.datasourceConfig.setColumnFormat({
89
- key: datasourceName,
90
- column: fieldName,
91
- format: defaultFormat,
92
- });
93
- }
94
- }
95
- }
96
- });
97
- };
98
-
99
- export const valueExprCellRendereronChange =
100
- (datasourceKey: DatasourceName): DataTransformRendererParams['onChange'] =>
101
- (value, params) => {
102
- const modelOrNull = value.model;
103
- if (modelOrNull) {
104
- actions.datasourceConfig.setColumnTransform({
105
- key: datasourceKey,
106
- column: params.data![GridColumnNames.ColumnName],
107
- expression: modelOrNull,
108
- });
109
- } else {
110
- actions.datasourceConfig.deleteColumnTransform({
111
- key: datasourceKey,
112
- column: params.data![GridColumnNames.ColumnName],
113
- });
114
- }
115
- };
116
-
117
- export const getDateSeparator = (data: DisplayConfigurationRow) => {
118
- // Check if this is a date/datetime type with month property
119
- if (data.type === FormatTypes.Date || data.type === FormatTypes.Datetime) {
120
- const dateData = data as { month?: DateMonthFormats };
121
- if (dateData.month === DateMonthFormats.Short || dateData.month === DateMonthFormats.Long) {
122
- return ' ';
123
- }
124
- }
125
-
126
- if (data.format === DateLocaleFormats.US) {
127
- return '-';
128
- }
129
- return '/';
130
- };
131
-
132
- export const mapToDateFormat = (data: DisplayConfigurationRow) => {
133
- const dateOrder =
134
- data.format === DateLocaleFormats.Unformatted
135
- ? LocaleDateOrderMap.Unformatted
136
- : LocaleDateOrderMap[data.format];
137
-
138
- const dateParts: string[] = [];
139
- const timeParts: string[] = [];
140
-
141
- dateOrder.forEach((part) => {
142
- const partValue = data[part as keyof BaseFormatOptions];
143
- if (partValue && DateTimeTokens[part]?.[partValue]) {
144
- dateParts.push(DateTimeTokens[part]?.[partValue]);
145
- }
146
- });
147
- if (data.type === 'DATETIME' && data.hour !== DateTimeFormats.Hide) {
148
- timeParts.push(data.format === DateLocaleFormats.UK ? DateTimeTokens.hour[data.hour] : 'hh');
149
- }
150
- ['minute', 'second'].forEach((part) => {
151
- const partValue = data[part as keyof BaseFormatOptions];
152
- if (partValue && DateTimeTokens[part]?.[partValue]) {
153
- timeParts.push(DateTimeTokens[part]?.[partValue]);
154
- }
155
- });
156
-
157
- const timeFormat =
158
- timeParts.length > 0
159
- ? `${timeParts.join(':')}${data.format === DateLocaleFormats.US ? ' a' : ''}`
160
- : '';
161
-
162
- return dateParts.join(getDateSeparator(data)) + (timeFormat.length > 0 ? ` ${timeFormat}` : '');
163
- };
164
-
165
- export const determineDateLocaleFormat = (formatString: string): DateLocaleFormats => {
166
- if (/^(M|MM|MMM|MMMM)|hh|a|-/.test(formatString)) {
167
- return DateLocaleFormats.US;
168
- }
169
- if (formatString.includes('/') || /^(d|dd)/.test(formatString)) {
170
- return DateLocaleFormats.UK;
171
- }
172
- return DateLocaleFormats.Unformatted;
173
- };
174
-
175
- export const getDateConfig = (formatString: string) => {
176
- const config: any = {};
177
- const tokens = formatString.match(/(yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|hh|mm|ss)/g) || [];
178
- for (const token of tokens) {
179
- const match = FormatToConfigTokens[token];
180
- if (match) {
181
- config[match.field] = match.value;
182
- }
183
- }
184
- return config;
185
- };
186
- const validTokensList = [
187
- 'yyyy',
188
- 'yy',
189
- 'MMMM',
190
- 'MMM',
191
- 'MM',
192
- 'M',
193
- 'd',
194
- 'dd',
195
- 'HH',
196
- 'hh',
197
- 'mm',
198
- 'ss',
199
- 'a',
200
- ];
201
- export const validateFormatString = (formatString: string) => {
202
- const allUsed = formatString.match(/[a-zA-Z]+/g) || [];
203
- return allUsed.filter((token) => !validTokensList.includes(token));
204
- };
205
-
206
- export const transformFromFormatString = (
207
- formatString: string,
208
- type: FormatTypes.Date | FormatTypes.Datetime,
209
- ) => {
210
- const dateConfig: BaseFormatOptions = {
211
- type,
212
- format: !formatString ? DateLocaleFormats.Unformatted : determineDateLocaleFormat(formatString),
213
- };
214
-
215
- if (!formatString) {
216
- return type === FormatTypes.Date
217
- ? { ...dateConfig, ...getDateConfig('dd/MM/yyyy') }
218
- : { ...dateConfig, ...getDateConfig('dd/MM/yyyy HH:mm:ss') };
219
- }
220
-
221
- const invalidTokens = validateFormatString(formatString);
222
- if (invalidTokens.length > 0) {
223
- throw new Error(`Invalid format string: Unrecognized tokens ${invalidTokens.join(', ')}`);
224
- }
225
- const config = getDateConfig(formatString);
226
-
227
- if (type === FormatTypes.Datetime) {
228
- if (!config.hour) config.hour = DateTimeFormats.Hide;
229
- if (!config.minute) config.minute = DateTimeFormats.Hide;
230
- if (!config.second) config.second = DateTimeFormats.Hide;
231
- }
232
-
233
- return { ...dateConfig, ...config };
234
- };
235
-
236
- const FormatToConfigTokens = Object.entries(DateTimeTokens).reduce(
237
- (acc, [field, values]) => {
238
- for (const [key, token] of Object.entries(values)) {
239
- if ((token === 'HH' || token === 'hh') && field === 'hour') {
240
- acc[token] = { field, value: DateTimeFormats.Show };
241
- } else {
242
- acc[token] = { field, value: key };
243
- }
244
- }
245
- return acc;
246
- },
247
- {} as Record<string, { field: string; value: string }>,
248
- );
249
-
250
- export { FormatToConfigTokens };
251
-
252
- /**
253
- * Transforms a numeric format string back to the object structure used by the number format modal
254
- * This is the inverse of mapToNumberFormat
255
- */
256
- export const transformFromNumberFormatString = (
257
- formatString: string,
258
- type: NumericFieldTypes,
259
- ): BaseFormatOptions => {
260
- if (!formatString) {
261
- return {
262
- type,
263
- format: NumericFormats.Unformatted,
264
- };
265
- }
266
-
267
- const numericConfig: BaseFormatOptions = {
268
- type,
269
- format: NumericFormats.Unformatted,
270
- };
271
-
272
- // Check for currency rounded format first (no decimal places)
273
- if (formatString.match(/^[£$€¥]#,##0$/)) {
274
- numericConfig.format = NumericFormats.CurrencyRounded;
275
- // Determine currency from symbol
276
- if (formatString.startsWith('$')) numericConfig.currency = NumericCurrencies.US;
277
- else if (formatString.startsWith('£')) numericConfig.currency = NumericCurrencies.UK;
278
- else if (formatString.startsWith('€')) numericConfig.currency = NumericCurrencies.EU;
279
- else if (formatString.startsWith('¥')) numericConfig.currency = NumericCurrencies.CN;
280
- } else if (formatString.startsWith('$')) {
281
- numericConfig.format = NumericFormats.Currency;
282
- numericConfig.currency = NumericCurrencies.US;
283
- } else if (formatString.startsWith('£')) {
284
- numericConfig.format = NumericFormats.Currency;
285
- numericConfig.currency = NumericCurrencies.UK;
286
- } else if (formatString.startsWith('€')) {
287
- numericConfig.format = NumericFormats.Currency;
288
- numericConfig.currency = NumericCurrencies.EU;
289
- } else if (formatString.startsWith('¥')) {
290
- numericConfig.format = NumericFormats.Currency;
291
- numericConfig.currency = NumericCurrencies.CN;
292
- } else if (formatString.endsWith('%')) {
293
- numericConfig.format = NumericFormats.Percent;
294
- } else if (formatString.includes('#,##0')) {
295
- numericConfig.format = NumericFormats.Financial;
296
- } else if (formatString.match(/^#(\.#+)?$/)) {
297
- numericConfig.format = NumericFormats.SimpleDecimal;
298
- } else {
299
- // Default to unformatted if we can't parse it
300
- return numericConfig;
301
- }
302
-
303
- // Extract decimal places from the format string
304
- const decimalMatch = formatString.match(/\.(#+)/);
305
- if (decimalMatch) {
306
- numericConfig.decimalPlaces = decimalMatch[1].length;
307
- }
308
-
309
- return numericConfig;
310
- };
311
-
312
- export const mapToNumberFormat = (
313
- format: NumericFormats,
314
- decimalPlaces?: number,
315
- currency?: NumericCurrencies,
316
- ): string => {
317
- switch (format) {
318
- case NumericFormats.Financial:
319
- // Financial format: #,##0.## (e.g., 1,000.12, 1,000.5, 1,000)
320
- const decimalPattern =
321
- decimalPlaces !== undefined && decimalPlaces > 0 ? '.' + '#'.repeat(decimalPlaces) : '';
322
- return `#,##0${decimalPattern}`;
323
-
324
- case NumericFormats.SimpleDecimal:
325
- // Simple decimal format: #.## (e.g., 123.45, 123.5, 123)
326
- const simpleDecimalPattern =
327
- decimalPlaces !== undefined && decimalPlaces > 0 ? '.' + '#'.repeat(decimalPlaces) : '';
328
- return `#${simpleDecimalPattern}`;
329
-
330
- case NumericFormats.Percent:
331
- // Percent format: ##.##% (e.g., 10.12%, 10.5%)
332
- const percentDecimalPattern =
333
- decimalPlaces !== undefined && decimalPlaces > 0 ? '.' + '#'.repeat(decimalPlaces) : '';
334
- return `##${percentDecimalPattern}%`;
335
-
336
- case NumericFormats.Currency:
337
- // Currency format: $#,##0.## (e.g., $1,000.12, $1,000.5)
338
- const currencyDecimalPattern =
339
- decimalPlaces !== undefined && decimalPlaces > 0 ? '.' + '#'.repeat(decimalPlaces) : '';
340
- const currencySymbol = getCurrencySymbol(currency);
341
- return `${currencySymbol}#,##0${currencyDecimalPattern}`;
342
-
343
- case NumericFormats.CurrencyRounded:
344
- // Currency rounded format: $#,##0 (e.g., $1,000)
345
- const currencySymbolRounded = getCurrencySymbol(currency);
346
- return `${currencySymbolRounded}#,##0`;
347
-
348
- case NumericFormats.Unformatted:
349
- default:
350
- // Unformatted: no pattern
351
- return '';
352
- }
353
- };
354
-
355
- /**
356
- * Gets the currency symbol based on the currency type
357
- */
358
- const getCurrencySymbol = (currency?: NumericCurrencies): string => {
359
- switch (currency) {
360
- case NumericCurrencies.US:
361
- return '$';
362
- case NumericCurrencies.UK:
363
- return '£';
364
- case NumericCurrencies.EU:
365
- return '€';
366
- case NumericCurrencies.CN:
367
- return '¥';
368
- default:
369
- return '$'; // Default to US dollar
370
- }
371
- };
@@ -1,22 +0,0 @@
1
- import { css } from '@genesislcap/web-core';
2
-
3
- export const styles = css`
4
- div.grid-container {
5
- height: calc(var(--constrained-height) - 160px);
6
- width: 100%;
7
- }
8
-
9
- div.grid-container.error {
10
- cursor: not-allowed;
11
- }
12
-
13
- div.error rapid-grid-pro {
14
- pointer-events: none;
15
- opacity: 80%;
16
- }
17
-
18
- rapid-grid-pro::part(grid) {
19
- --base-height-multiplier: 9;
20
- --ag-selected-row-background-color: transparent !important;
21
- }
22
- `;
@@ -1,21 +0,0 @@
1
- import { classNames, html, ref } from '@genesislcap/web-core';
2
- import type { DataTransformsAndDerivedFields } from './data-transforms';
3
- import { DateFormatModal } from './date-format-modal';
4
- import { NumberFormatModal } from './number-format-modal/number-format-modal';
5
-
6
- DateFormatModal;
7
- NumberFormatModal;
8
-
9
- export const template = html<DataTransformsAndDerivedFields>`
10
- <div class="grid-container ${(x) => classNames(['error', x.dataError])}">
11
- <rapid-grid-pro
12
- class="${(x) => classNames(['error', x.dataError])}"
13
- data-test-id="datasource-config-transform-data-grid"
14
- :gridOptions=${(x) => x.getGridOptions()}
15
- :rowData=${(x) => x.fieldData}
16
- grid-autosizing
17
- ></rapid-grid-pro>
18
- </div>
19
- <date-format-modal ${ref('dateFormatModal')}></date-format-modal>
20
- <number-format-modal ${ref('numberFormatModal')}></number-format-modal>
21
- `;
@@ -1,162 +0,0 @@
1
- import { ColDef } from '@ag-grid-community/core';
2
- import { GridOptionsConfig } from '@genesislcap/grid-pro';
3
- import { customElement, html } from '@genesislcap/web-core';
4
- import { actions, selectors } from '../../../store';
5
- import { ReportingEvents } from '../../../utils/event-map';
6
- import { buttonCellRenderer } from '../../../utils/renderer';
7
- import {
8
- DatasourceDataBaseComponent,
9
- GridColumnNames,
10
- lookupColumnIsIncluded,
11
- pathParameters,
12
- GridRowData,
13
- datasourceNameFromDisplay,
14
- orderRowsByIncludeColumns,
15
- } from '../shared';
16
- import {
17
- lookupColumnFormat,
18
- transformFromFormatString,
19
- transformFromNumberFormatString,
20
- } from './data-transforms.helpers';
21
- import { styles } from './data-transforms.styles';
22
- import { template } from './data-transforms.template';
23
- import {
24
- BaseFormatOptions,
25
- DataTransformData,
26
- DisplayConfigurationRow,
27
- FormatTypes,
28
- isNumericFieldType,
29
- } from './data-transforms.types';
30
- import { DateFormatModal } from './date-format-modal';
31
- import { NumberFormatModal } from './number-format-modal/number-format-modal';
32
-
33
- /**
34
- * TODO: This component doesn't yet do derived fields, but it will
35
- */
36
-
37
- @customElement({
38
- name: 'data-transforms-derived-fields',
39
- template,
40
- styles,
41
- })
42
- export class DataTransformsAndDerivedFields extends DatasourceDataBaseComponent {
43
- dateFormatModal: DateFormatModal;
44
- numberFormatModal: NumberFormatModal;
45
- /**
46
- * Update grid data with column filter information
47
- */
48
- protected async updateDataFields() {
49
- try {
50
- const rows = this.datasourceSpec
51
- .flatMap(pathParameters)
52
- .filter(lookupColumnIsIncluded)
53
- .filter(
54
- (data) =>
55
- data[GridColumnNames.Type] === 'DATETIME' ||
56
- data[GridColumnNames.Type] === 'DATE' ||
57
- isNumericFieldType(data[GridColumnNames.Type]),
58
- )
59
- .map(lookupColumnFormat) as GridRowData[];
60
- const currentDisplay = this.datasourceSpec[0]?.name;
61
- const include = currentDisplay
62
- ? selectors.datasourceConfig.getDatasource(datasourceNameFromDisplay(currentDisplay))
63
- ?.TRANSFORMER_CONFIGURATION?.INCLUDE_COLUMNS
64
- : undefined;
65
- this.fieldData = orderRowsByIncludeColumns(rows, include);
66
- this.dataError = false;
67
- } catch (e) {
68
- this.handleError(e as Error, 'There were errors when loading the datasource fields');
69
- }
70
- }
71
-
72
- connectedCallback() {
73
- super.connectedCallback();
74
- this.addEventListener(ReportingEvents.refreshColumnFormatGrid, this.updateDataFields);
75
- }
76
-
77
- disconnectedCallback() {
78
- super.disconnectedCallback();
79
- this.removeEventListener(ReportingEvents.refreshColumnFormatGrid, this.updateDataFields);
80
- }
81
-
82
- clickHandlerGridDisplay = (rowData: DisplayConfigurationRow): void => {
83
- if (isNumericFieldType(rowData[GridColumnNames.Type])) {
84
- const formatConfig: BaseFormatOptions = transformFromNumberFormatString(
85
- rowData[GridColumnNames.Format],
86
- rowData[GridColumnNames.Type],
87
- );
88
- this.numberFormatModal.showModal({ ...rowData, ...formatConfig });
89
- } else {
90
- const formatConfig: BaseFormatOptions = transformFromFormatString(
91
- rowData[GridColumnNames.Format],
92
- rowData[GridColumnNames.Type] as FormatTypes.Date | FormatTypes.Datetime,
93
- );
94
- this.dateFormatModal.showModal({ ...rowData, ...formatConfig });
95
- }
96
- };
97
-
98
- deleteFormat = (rowData: DataTransformData): void => {
99
- actions.datasourceConfig.deleteColumnFormat({
100
- key: datasourceNameFromDisplay(rowData[GridColumnNames.Datasource]),
101
- column: rowData[GridColumnNames.ColumnName],
102
- });
103
- this.updateDataFields();
104
- };
105
-
106
- getGridOptions(): GridOptionsConfig {
107
- const columnDefs: ColDef[] = [
108
- {
109
- field: GridColumnNames.ColumnName,
110
- headerTooltip: 'The name of the field as defined on the selected datasource.',
111
- },
112
- {
113
- field: GridColumnNames.Type,
114
- headerTooltip: 'The type of the field on the underlying datasource.',
115
- },
116
- {
117
- field: GridColumnNames.Format,
118
- headerTooltip: 'The format of the field on the underlying datasource.',
119
- },
120
- buttonCellRenderer(
121
- 'Add/Edit Format',
122
- (rowData) => this.clickHandlerGridDisplay(rowData),
123
- html`
124
- <rapid-icon style="opacity: 0.5" name="pen-to-square" size="lg"></rapid-icon>
125
- `,
126
- false,
127
- 'Allows user to add or edit the format(for example, a date format).',
128
- ),
129
- buttonCellRenderer(
130
- 'Delete',
131
- (rowData) => this.deleteFormat(rowData),
132
- html`
133
- <rapid-icon
134
- style="opacity: 0.5"
135
- variant="regular"
136
- name="trash-alt"
137
- size="lg"
138
- ></rapid-icon>
139
- `,
140
- false,
141
- 'Allows to delete format',
142
- ),
143
- ];
144
-
145
- return {
146
- suppressRowTransform: true,
147
- columnDefs,
148
- rowData: [],
149
- headerHeight: 30,
150
- rowHeight: 40,
151
- tooltipShowDelay: 0,
152
- rowSelection: 'multiple',
153
- onGridReady: () => {
154
- this.handleUpdatedDatasources();
155
- },
156
- context: {
157
- ariaLabelField: GridColumnNames.ColumnName,
158
- },
159
- suppressRowClickSelection: true,
160
- };
161
- }
162
- }