@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.
- package/dist/custom-elements.json +4247 -5382
- package/dist/dts/react.d.ts +44 -44
- package/dist/react.cjs +65 -65
- package/dist/react.mjs +57 -57
- package/package.json +22 -23
- package/.env +0 -3
- package/api-extractor.json +0 -4
- package/dist/dts/new/main/edit-config/col-filters/col-filters-grid.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/col-filters/col-filters-grid.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/row-filters/row-filters.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/row-filters/row-filters.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/shared/datasource-data-base-component.test.d.ts +0 -5
- package/dist/dts/new/main/edit-config/shared/datasource-data-base-component.test.d.ts.map +0 -1
- package/dist/dts/new/utils/alias-generator.test.d.ts +0 -2
- package/dist/dts/new/utils/alias-generator.test.d.ts.map +0 -1
- package/dist/dts/new/utils/endpoint.test.d.ts +0 -2
- package/dist/dts/new/utils/endpoint.test.d.ts.map +0 -1
- package/dist/dts/new/utils/transformers.test.d.ts +0 -2
- package/dist/dts/new/utils/transformers.test.d.ts.map +0 -1
- package/dist/dts/new/utils/validators.test.d.ts +0 -2
- package/dist/dts/new/utils/validators.test.d.ts.map +0 -1
- package/dist/dts/old/main/main.test.d.ts +0 -2
- package/dist/dts/old/main/main.test.d.ts.map +0 -1
- package/dist/dts/old/utils/filterObjectArray.test.d.ts +0 -2
- package/dist/dts/old/utils/filterObjectArray.test.d.ts.map +0 -1
- package/dist/esm/new/main/edit-config/col-filters/col-filters-grid.helpers.test.js +0 -200
- package/dist/esm/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.js +0 -152
- package/dist/esm/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.js +0 -629
- package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.js +0 -268
- package/dist/esm/new/main/edit-config/row-filters/row-filters.helpers.test.js +0 -1
- package/dist/esm/new/main/edit-config/shared/datasource-data-base-component.test.js +0 -426
- package/dist/esm/new/utils/alias-generator.test.js +0 -36
- package/dist/esm/new/utils/endpoint.test.js +0 -162
- package/dist/esm/new/utils/transformers.test.js +0 -469
- package/dist/esm/new/utils/validators.test.js +0 -139
- package/dist/esm/old/main/main.test.js +0 -5
- package/dist/esm/old/utils/filterObjectArray.test.js +0 -46
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/globals.d.ts +0 -7
- package/src/index.federated.ts +0 -1
- package/src/index.ts +0 -8
- package/src/new/components/clone-report-config-modal/clone-report-config-modal.styles.ts +0 -47
- package/src/new/components/clone-report-config-modal/clone-report-config-modal.template.ts +0 -55
- package/src/new/components/clone-report-config-modal/clone-report-config-modal.ts +0 -173
- package/src/new/components/components.ts +0 -118
- package/src/new/components/renderers/data-transform-renderer.ts +0 -111
- package/src/new/components/reporting-configurations/reporting-configurations.styles.ts +0 -42
- package/src/new/components/reporting-configurations/reporting-configurations.template.ts +0 -59
- package/src/new/components/reporting-configurations/reporting-configurations.ts +0 -366
- package/src/new/components/shared/file-template-picker.template.ts +0 -45
- package/src/new/lib/redux-store/README.md +0 -55
- package/src/new/lib/redux-store/index.ts +0 -2
- package/src/new/lib/redux-store/state-utils.ts +0 -1
- package/src/new/lib/redux-store/store.ts +0 -135
- package/src/new/main/edit-config/base-config/base-config.styles.ts +0 -26
- package/src/new/main/edit-config/base-config/base-config.template.ts +0 -71
- package/src/new/main/edit-config/base-config/base-config.ts +0 -116
- package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.test.ts +0 -232
- package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.ts +0 -35
- package/src/new/main/edit-config/col-filters/col-filters-grid.styles.ts +0 -22
- package/src/new/main/edit-config/col-filters/col-filters-grid.ts +0 -150
- package/src/new/main/edit-config/col-filters/col-filters-grid.types.ts +0 -7
- package/src/new/main/edit-config/col-filters/col-filters-tutorial.ts +0 -25
- package/src/new/main/edit-config/col-filters/col-fitlers-grid.template.ts +0 -15
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.ts +0 -187
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.ts +0 -89
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.styles.ts +0 -22
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.template.ts +0 -14
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.ts +0 -119
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.types.ts +0 -10
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-tutorial.ts +0 -33
- package/src/new/main/edit-config/config-journey-orchestrator.styles.ts +0 -120
- package/src/new/main/edit-config/config-journey-orchestrator.template.ts +0 -149
- package/src/new/main/edit-config/config-journey-orchestrator.ts +0 -92
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms-tutorial.ts +0 -127
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.ts +0 -799
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.ts +0 -371
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.styles.ts +0 -22
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.template.ts +0 -21
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.ts +0 -162
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.types.ts +0 -211
- package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.styles.ts +0 -79
- package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.template.ts +0 -217
- package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.ts +0 -280
- package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/index.ts +0 -1
- package/src/new/main/edit-config/data-transforms-derived-fields/format-warning.ts +0 -43
- package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/index.ts +0 -1
- package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.styles.ts +0 -68
- package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.template.ts +0 -93
- package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.ts +0 -152
- package/src/new/main/edit-config/datasource-config/datasource-config-container.styles.ts +0 -22
- package/src/new/main/edit-config/datasource-config/datasource-config-item.styles.ts +0 -76
- package/src/new/main/edit-config/datasource-config/datasource-config-item.template.ts +0 -141
- package/src/new/main/edit-config/datasource-config/datasource-config-item.ts +0 -212
- package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.ts +0 -341
- package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.ts +0 -99
- package/src/new/main/edit-config/datasource-config/datasources-config-container.template.ts +0 -68
- package/src/new/main/edit-config/datasource-config/datasources-config-container.ts +0 -55
- package/src/new/main/edit-config/datasource-config/types.ts +0 -6
- package/src/new/main/edit-config/outputs-config/outputs-config.style.ts +0 -11
- package/src/new/main/edit-config/outputs-config/outputs-config.template.ts +0 -66
- package/src/new/main/edit-config/outputs-config/outputs-config.ts +0 -66
- package/src/new/main/edit-config/row-filters/row-filters-tutorial.styles.ts +0 -16
- package/src/new/main/edit-config/row-filters/row-filters-tutorial.template.ts +0 -229
- package/src/new/main/edit-config/row-filters/row-filters-tutorial.ts +0 -15
- package/src/new/main/edit-config/row-filters/row-filters.helpers.test.ts +0 -2
- package/src/new/main/edit-config/row-filters/row-filters.helpers.ts +0 -53
- package/src/new/main/edit-config/row-filters/row-filters.styles.ts +0 -23
- package/src/new/main/edit-config/row-filters/row-filters.template.ts +0 -15
- package/src/new/main/edit-config/row-filters/row-filters.ts +0 -58
- package/src/new/main/edit-config/row-filters/row-filters.types.ts +0 -14
- package/src/new/main/edit-config/scheduling/scheduling.styles.ts +0 -59
- package/src/new/main/edit-config/scheduling/scheduling.template.ts +0 -80
- package/src/new/main/edit-config/scheduling/scheduling.ts +0 -101
- package/src/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.ts +0 -250
- package/src/new/main/edit-config/shared/datasource-data-base-component.test.ts +0 -568
- package/src/new/main/edit-config/shared/datasource-data-base-component.ts +0 -65
- package/src/new/main/edit-config/shared/datasource-data-base-component.types.ts +0 -55
- package/src/new/main/edit-config/shared/index.ts +0 -3
- package/src/new/main/edit-config/tabbed-datasource-container/index.ts +0 -2
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.styles.ts +0 -12
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.template.ts +0 -29
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.ts +0 -69
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.types.ts +0 -7
- package/src/new/main/generated-reports/generated-reports.styles.ts +0 -15
- package/src/new/main/generated-reports/generated-reports.template.ts +0 -29
- package/src/new/main/generated-reports/generated-reports.ts +0 -270
- package/src/new/main/index.ts +0 -3
- package/src/new/main/main.styles.ts +0 -31
- package/src/new/main/main.template.ts +0 -92
- package/src/new/main/main.ts +0 -117
- package/src/new/main/report-destinations/report-destinations.template.ts +0 -39
- package/src/new/main/report-destinations/report-destinations.ts +0 -63
- package/src/new/store/index.ts +0 -3
- package/src/new/store/slices/base-config.ts +0 -50
- package/src/new/store/slices/datasources-config.ts +0 -297
- package/src/new/store/slices/index.ts +0 -3
- package/src/new/store/slices/types.ts +0 -90
- package/src/new/store/store.ts +0 -36
- package/src/new/store/types.ts +0 -10
- package/src/new/styles/constraints.styles.ts +0 -32
- package/src/new/styles/forms.styles.ts +0 -38
- package/src/new/styles/index.ts +0 -3
- package/src/new/styles/misc.styles.ts +0 -25
- package/src/new/types/display.ts +0 -4
- package/src/new/types/index.ts +0 -4
- package/src/new/types/misc.ts +0 -73
- package/src/new/types/redux.ts +0 -73
- package/src/new/types/rights.ts +0 -28
- package/src/new/utils/alias-generator.test.ts +0 -44
- package/src/new/utils/alias-generator.ts +0 -18
- package/src/new/utils/date-filter-params.ts +0 -28
- package/src/new/utils/endpoint.test.ts +0 -193
- package/src/new/utils/endpoint.ts +0 -62
- package/src/new/utils/event-map.ts +0 -11
- package/src/new/utils/format-utils.ts +0 -22
- package/src/new/utils/formatters.ts +0 -36
- package/src/new/utils/index.ts +0 -10
- package/src/new/utils/notifications.ts +0 -9
- package/src/new/utils/renderer.ts +0 -38
- package/src/new/utils/rights.ts +0 -66
- package/src/new/utils/sorter.ts +0 -19
- package/src/new/utils/tooltip.ts +0 -94
- package/src/new/utils/transformers.test.ts +0 -549
- package/src/new/utils/transformers.ts +0 -174
- package/src/new/utils/validators.test.ts +0 -165
- package/src/new/utils/validators.ts +0 -81
- package/src/old/assets/images/index.ts +0 -69
- package/src/old/components/create-edit/create-edit.styles.ts +0 -16
- package/src/old/components/create-edit/create-edit.template.ts +0 -15
- package/src/old/components/create-edit/create-edit.ts +0 -70
- package/src/old/components/create-edit/index.ts +0 -3
- package/src/old/components/list/columns.ts +0 -175
- package/src/old/components/list/index.ts +0 -3
- package/src/old/components/list/list.styles.ts +0 -9
- package/src/old/components/list/list.template.ts +0 -40
- package/src/old/components/list/list.ts +0 -109
- package/src/old/components/preview/columns.ts +0 -58
- package/src/old/components/preview/index.ts +0 -3
- package/src/old/components/preview/preview.styles.ts +0 -22
- package/src/old/components/preview/preview.template.ts +0 -33
- package/src/old/components/preview/preview.ts +0 -143
- package/src/old/components/rapid-components.ts +0 -64
- package/src/old/components/renderers/custom-header-component.ts +0 -92
- package/src/old/components/renderers/filter-value-renderer.ts +0 -237
- package/src/old/components/renderers/row-select.renderer.ts +0 -148
- package/src/old/components/select-fields/columns.ts +0 -83
- package/src/old/components/select-fields/data.ts +0 -218
- package/src/old/components/select-fields/index.ts +0 -3
- package/src/old/components/select-fields/select-fields.styles.ts +0 -22
- package/src/old/components/select-fields/select-fields.template.ts +0 -58
- package/src/old/components/select-fields/select-fields.ts +0 -218
- package/src/old/components/select-filters/columns.ts +0 -78
- package/src/old/components/select-filters/index.ts +0 -3
- package/src/old/components/select-filters/select-filters.styles.ts +0 -21
- package/src/old/components/select-filters/select-filters.template.ts +0 -58
- package/src/old/components/select-filters/select-filters.ts +0 -255
- package/src/old/components/wizard/debug.ts +0 -35
- package/src/old/components/wizard/index.ts +0 -2
- package/src/old/components/wizard/steps/filters.ts +0 -13
- package/src/old/components/wizard/steps/index.ts +0 -4
- package/src/old/components/wizard/steps/name.ts +0 -72
- package/src/old/components/wizard/steps/run.ts +0 -14
- package/src/old/components/wizard/steps/select.ts +0 -14
- package/src/old/components/wizard/wizard.styles.ts +0 -198
- package/src/old/components/wizard/wizard.template.ts +0 -147
- package/src/old/components/wizard/wizard.ts +0 -398
- package/src/old/components/wizard/wizard.types.ts +0 -43
- package/src/old/components/zero-components.ts +0 -61
- package/src/old/config/config.ts +0 -59
- package/src/old/config/configure.ts +0 -66
- package/src/old/config/index.ts +0 -2
- package/src/old/config/templates.ts +0 -59
- package/src/old/constants/grid-config.ts +0 -19
- package/src/old/layouts/default.ts +0 -30
- package/src/old/layouts/index.ts +0 -2
- package/src/old/layouts/two-pane-horizontal.ts +0 -81
- package/src/old/main/index.ts +0 -3
- package/src/old/main/main.styles.ts +0 -69
- package/src/old/main/main.template.ts +0 -127
- package/src/old/main/main.test.ts +0 -7
- package/src/old/main/main.ts +0 -250
- package/src/old/main/types.ts +0 -29
- package/src/old/styles/colors.ts +0 -16
- package/src/old/styles/helpers.ts +0 -181
- package/src/old/styles/index.ts +0 -4
- package/src/old/styles/normalize.ts +0 -14
- package/src/old/styles/styles.ts +0 -24
- package/src/old/tags/index.ts +0 -1
- package/src/old/tags/tags.ts +0 -79
- package/src/old/tsconfig.json +0 -10
- package/src/old/utils/filterObjectArray.test.ts +0 -110
- package/src/old/utils/filterObjectArray.ts +0 -23
- package/src/old/utils/getFiltersByType.ts +0 -92
- package/src/old/utils/getSelectedFields.ts +0 -16
- package/src/old/utils/index.ts +0 -4
- package/src/old/utils/logger.ts +0 -3
- package/src/sandbox.ts +0 -51
- package/src/tsconfig.base.json +0 -24
- package/src/typings.d.ts +0 -1
- package/tsconfig.json +0 -9
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import { ColDef } from '@ag-grid-community/core';
|
|
2
|
-
import { Connect } from '@genesislcap/foundation-comms';
|
|
3
|
-
import { EventEmitter } from '@genesislcap/foundation-events';
|
|
4
|
-
import { getCriteriaBuilder, INPUT_MIN_LENGTH, SelectedOption } from '@genesislcap/foundation-ui';
|
|
5
|
-
import { User } from '@genesislcap/foundation-user';
|
|
6
|
-
import { logger } from '@genesislcap/foundation-utils';
|
|
7
|
-
import {
|
|
8
|
-
getActionsMenuDef,
|
|
9
|
-
GridOptionsConfig,
|
|
10
|
-
GridProGenesisDatasource,
|
|
11
|
-
GridProRendererTypes,
|
|
12
|
-
} from '@genesislcap/rapid-grid-pro';
|
|
13
|
-
import { customElement, GenesisElement, html, observable } from '@genesislcap/web-core';
|
|
14
|
-
import { writeReduxState, reduxBlankState, StorageKey } from '../../store';
|
|
15
|
-
import { Genesis, Permissions } from '../../types';
|
|
16
|
-
import {
|
|
17
|
-
formatDate,
|
|
18
|
-
getDatasourceSchema,
|
|
19
|
-
getFormattedDateTime,
|
|
20
|
-
permissionGuard,
|
|
21
|
-
showNotificationToast,
|
|
22
|
-
transformFromServerPayload,
|
|
23
|
-
transformToServerPayload,
|
|
24
|
-
} from '../../utils';
|
|
25
|
-
import { getFilterParams } from '../../utils/date-filter-params';
|
|
26
|
-
import { ReportingEventDetailMap, ReportingEvents } from '../../utils/event-map';
|
|
27
|
-
import { CloneReportConfigModal } from '../clone-report-config-modal/clone-report-config-modal';
|
|
28
|
-
import { ReportingConfigurationStyles as styles } from './reporting-configurations.styles';
|
|
29
|
-
import { ReportingConfigurationsTemplate as template } from './reporting-configurations.template';
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Report configuration grid and toolbar actions.
|
|
33
|
-
* @public
|
|
34
|
-
*
|
|
35
|
-
* @fires set-report-config-disp-mode - Fired to switch the report configuration display mode. detail: `'edit' | 'list'`
|
|
36
|
-
* @fires highlight-grid-row
|
|
37
|
-
*/
|
|
38
|
-
@customElement({
|
|
39
|
-
name: 'reporting-configurations',
|
|
40
|
-
template,
|
|
41
|
-
styles,
|
|
42
|
-
})
|
|
43
|
-
export class ReportingConfigurations extends EventEmitter<ReportingEventDetailMap>(GenesisElement) {
|
|
44
|
-
@Connect connect: Connect;
|
|
45
|
-
reportConfigurationsDatasource: GridProGenesisDatasource;
|
|
46
|
-
@observable gridCriteria: string = '';
|
|
47
|
-
@observable cloneConfigModal: CloneReportConfigModal;
|
|
48
|
-
importFileInput: HTMLInputElement;
|
|
49
|
-
@User user!: User;
|
|
50
|
-
|
|
51
|
-
public searchBarConfig = [
|
|
52
|
-
{
|
|
53
|
-
field: 'NAME',
|
|
54
|
-
label: (searchTerm) => `${searchTerm} as NAME`,
|
|
55
|
-
createCriteria: getCriteriaBuilder,
|
|
56
|
-
isEnabled: (searchTerm, selectedOption) => {
|
|
57
|
-
return (
|
|
58
|
-
searchTerm.length >= INPUT_MIN_LENGTH && !selectedOption.some((e) => e.field === 'NAME')
|
|
59
|
-
);
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
createNewReportHandler() {
|
|
65
|
-
localStorage.removeItem(StorageKey.ReportingConfig);
|
|
66
|
-
writeReduxState(reduxBlankState);
|
|
67
|
-
this.$emit(ReportingEvents.setReportConfigDisplayMode, 'edit');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async editReportConfigHandler({ NAME, ID }: { NAME: string; ID: string }) {
|
|
71
|
-
try {
|
|
72
|
-
const response = await this.connect.request('REPORT_CONFIG_DETAILS', { REQUEST: { ID } });
|
|
73
|
-
const data = response.REPLY?.[0];
|
|
74
|
-
if (!data) throw new Error(`No data returned for edit report with ID ${ID}`);
|
|
75
|
-
|
|
76
|
-
const getSchema = getDatasourceSchema(this.connect);
|
|
77
|
-
const transformed = await transformFromServerPayload(data, getSchema);
|
|
78
|
-
console.log({ transformed });
|
|
79
|
-
writeReduxState(transformed);
|
|
80
|
-
this.$emit(ReportingEvents.setReportConfigDisplayMode, 'edit');
|
|
81
|
-
} catch (e: unknown) {
|
|
82
|
-
showNotificationToast({
|
|
83
|
-
title: 'Edit Report Config',
|
|
84
|
-
body: `'${NAME}' was not able to be loaded for editing.`,
|
|
85
|
-
toast: { type: 'critical' as any },
|
|
86
|
-
});
|
|
87
|
-
logger.error(e);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
getColumnDefs() {
|
|
92
|
-
const actionsMenu = getActionsMenuDef(
|
|
93
|
-
[
|
|
94
|
-
{
|
|
95
|
-
name: permissionGuard(this, Permissions.ReportConfigurationUpdate) ? 'Edit' : 'View',
|
|
96
|
-
callback: (rowData) => this.editReportConfigHandler(rowData),
|
|
97
|
-
},
|
|
98
|
-
permissionGuard(this, Permissions.ReportConfigurationUpdate)
|
|
99
|
-
? {
|
|
100
|
-
name: 'Clone',
|
|
101
|
-
callback: (rowData) => this.openCloneReportConfigModal(rowData),
|
|
102
|
-
}
|
|
103
|
-
: null,
|
|
104
|
-
permissionGuard(this, Permissions.ReportConfigurationUpdate)
|
|
105
|
-
? {
|
|
106
|
-
name: 'Export',
|
|
107
|
-
callback: (rowData) => this.exportConfig(rowData),
|
|
108
|
-
}
|
|
109
|
-
: null,
|
|
110
|
-
permissionGuard(this, Permissions.ReportRun)
|
|
111
|
-
? {
|
|
112
|
-
name: 'Run',
|
|
113
|
-
callback: (rowData) => this.runReport(rowData.ID, rowData.NAME),
|
|
114
|
-
}
|
|
115
|
-
: null,
|
|
116
|
-
permissionGuard(this, Permissions.ReportConfigurationDelete)
|
|
117
|
-
? {
|
|
118
|
-
name: 'Delete',
|
|
119
|
-
callback: (rowData) => this.deleteReportConfig(rowData.ID, rowData.NAME),
|
|
120
|
-
color: 'var(--error-color)',
|
|
121
|
-
}
|
|
122
|
-
: null,
|
|
123
|
-
].filter(Boolean),
|
|
124
|
-
{
|
|
125
|
-
headerName: '',
|
|
126
|
-
minWidth: 60,
|
|
127
|
-
maxWidth: 60,
|
|
128
|
-
pinned: 'right',
|
|
129
|
-
filter: false,
|
|
130
|
-
},
|
|
131
|
-
'⋮',
|
|
132
|
-
false,
|
|
133
|
-
'stealth',
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
const columnDefs: ColDef[] = [
|
|
137
|
-
{
|
|
138
|
-
field: 'NAME',
|
|
139
|
-
headerName: 'Name',
|
|
140
|
-
minWidth: 200,
|
|
141
|
-
flex: 1,
|
|
142
|
-
cellStyle: { display: 'flex' },
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
field: 'DESCRIPTION',
|
|
146
|
-
headerName: 'Description',
|
|
147
|
-
minWidth: 400,
|
|
148
|
-
flex: 2,
|
|
149
|
-
filter: true,
|
|
150
|
-
cellStyle: { display: 'flex' },
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
field: 'CREATED_ON',
|
|
154
|
-
headerName: 'Created Date',
|
|
155
|
-
minWidth: 150,
|
|
156
|
-
flex: 1,
|
|
157
|
-
filter: 'agDateColumnFilter',
|
|
158
|
-
filterParams: getFilterParams(),
|
|
159
|
-
cellStyle: { display: 'flex' },
|
|
160
|
-
valueFormatter: (rowData) => formatDate(rowData.data.CREATED_ON),
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
field: 'LAST_UPDATED_AT',
|
|
164
|
-
headerName: 'Date Last updated',
|
|
165
|
-
minWidth: 180,
|
|
166
|
-
flex: 1,
|
|
167
|
-
sortable: true,
|
|
168
|
-
sort: 'desc',
|
|
169
|
-
filter: 'agDateColumnFilter',
|
|
170
|
-
filterParams: getFilterParams(),
|
|
171
|
-
cellStyle: { display: 'flex' },
|
|
172
|
-
valueFormatter: (rowData) => getFormattedDateTime(rowData.data.LAST_UPDATED_AT),
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
field: 'LAST_UPDATED_BY',
|
|
176
|
-
headerName: 'Last Updated By',
|
|
177
|
-
minWidth: 150,
|
|
178
|
-
flex: 1,
|
|
179
|
-
cellStyle: { display: 'flex' },
|
|
180
|
-
},
|
|
181
|
-
permissionGuard(this, Permissions.ReportRun)
|
|
182
|
-
? {
|
|
183
|
-
headerName: 'Actions',
|
|
184
|
-
minWidth: 110,
|
|
185
|
-
maxWidth: 110,
|
|
186
|
-
flex: 1,
|
|
187
|
-
filter: false,
|
|
188
|
-
cellStyle: { display: 'flex', alignItems: 'center' },
|
|
189
|
-
pinned: 'right',
|
|
190
|
-
cellRenderer: GridProRendererTypes.action,
|
|
191
|
-
cellRendererParams: {
|
|
192
|
-
actionClick: (rowData) => this.runReport(rowData.ID, rowData.NAME),
|
|
193
|
-
contentTemplate: html`
|
|
194
|
-
<rapid-icon
|
|
195
|
-
slot="start"
|
|
196
|
-
size="md"
|
|
197
|
-
name="play"
|
|
198
|
-
style="color: var(--neutral-foreground-hint);"
|
|
199
|
-
></rapid-icon>
|
|
200
|
-
Run
|
|
201
|
-
`,
|
|
202
|
-
appearance: 'neutral-outline',
|
|
203
|
-
actionName: 'Run',
|
|
204
|
-
},
|
|
205
|
-
}
|
|
206
|
-
: null,
|
|
207
|
-
actionsMenu,
|
|
208
|
-
].filter(Boolean) as ColDef<any>[];
|
|
209
|
-
return columnDefs;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
getGridOptions() {
|
|
213
|
-
const gridOptions: GridOptionsConfig = {
|
|
214
|
-
defaultColDef: {
|
|
215
|
-
filter: true,
|
|
216
|
-
floatingFilter: false,
|
|
217
|
-
sortable: true,
|
|
218
|
-
suppressMenu: false,
|
|
219
|
-
},
|
|
220
|
-
suppressRowClickSelection: true,
|
|
221
|
-
columnDefs: this.getColumnDefs(),
|
|
222
|
-
headerHeight: 30,
|
|
223
|
-
rowHeight: 32,
|
|
224
|
-
tooltipShowDelay: 0,
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
return gridOptions;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
private async deleteReportConfig(reportConfigId, reportName) {
|
|
231
|
-
try {
|
|
232
|
-
const deleteResponse = await this.connect.commitEvent('EVENT_REPORT_CONFIG_DELETE', {
|
|
233
|
-
DETAILS: {
|
|
234
|
-
ID: reportConfigId,
|
|
235
|
-
},
|
|
236
|
-
IGNORE_WARNINGS: true,
|
|
237
|
-
VALIDATE: false,
|
|
238
|
-
});
|
|
239
|
-
if (deleteResponse.MESSAGE_TYPE === 'EVENT_ACK') {
|
|
240
|
-
this.reportConfigurationsDatasource.deferredGridOptions = this.getGridOptions();
|
|
241
|
-
this.reportConfigurationsDatasource.restart();
|
|
242
|
-
showNotificationToast({
|
|
243
|
-
title: 'Delete Report Config',
|
|
244
|
-
body: `'${reportName}' was deleted successfully`,
|
|
245
|
-
toast: { type: 'success' as any },
|
|
246
|
-
});
|
|
247
|
-
} else {
|
|
248
|
-
const error = deleteResponse?.ERROR?.length ? deleteResponse.ERROR[0].TEXT : '';
|
|
249
|
-
showNotificationToast({
|
|
250
|
-
title: 'Delete Report Config',
|
|
251
|
-
body: `'${reportName}' was not deleted due to following error "${error}"`,
|
|
252
|
-
toast: { type: 'critical' as any },
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
} catch (err) {
|
|
256
|
-
logger.error(err);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
private async runReport(reportConfigId, reportName) {
|
|
261
|
-
try {
|
|
262
|
-
const response: any = await this.connect.commitEvent('EVENT_GENERATE_REPORT', {
|
|
263
|
-
DETAILS: {
|
|
264
|
-
ID: reportConfigId,
|
|
265
|
-
},
|
|
266
|
-
IGNORE_WARNINGS: true,
|
|
267
|
-
VALIDATE: false,
|
|
268
|
-
});
|
|
269
|
-
if (response.MESSAGE_TYPE === 'EVENT_ACK') {
|
|
270
|
-
showNotificationToast({
|
|
271
|
-
title: 'Generate Report',
|
|
272
|
-
body: `'${reportName}' was created successfully`,
|
|
273
|
-
toast: { type: 'success' as any },
|
|
274
|
-
});
|
|
275
|
-
this.$emit(ReportingEvents.highlightGridRow, response.GENERATED[0].GENERATED_REPORT_ID);
|
|
276
|
-
} else {
|
|
277
|
-
const error = response?.ERROR?.length ? response.ERROR[0].TEXT : '';
|
|
278
|
-
showNotificationToast({
|
|
279
|
-
title: 'Generate Report',
|
|
280
|
-
body: `'${reportName}' was not created due to following error "${error}"`,
|
|
281
|
-
toast: { type: 'critical' as any },
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
} catch (err) {
|
|
285
|
-
logger.error(err);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
searchChanged(event: CustomEvent<Array<SelectedOption>>) {
|
|
290
|
-
const options = event.detail;
|
|
291
|
-
const criteriaBuilder = options
|
|
292
|
-
.map((option) => {
|
|
293
|
-
const { field, term, createCriteria } = option;
|
|
294
|
-
if (createCriteria) {
|
|
295
|
-
return createCriteria(field, term);
|
|
296
|
-
} else {
|
|
297
|
-
logger.debug('Cannot convert search option into criteria', option);
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
})
|
|
301
|
-
.filter((x) => x)
|
|
302
|
-
.join(' && ');
|
|
303
|
-
this.gridCriteria = criteriaBuilder;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
async openCloneReportConfigModal(e) {
|
|
307
|
-
this.cloneConfigModal.showReportConfigModal(e.ID);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
importConfigHandler() {
|
|
311
|
-
this.importFileInput.value = '';
|
|
312
|
-
this.importFileInput.click();
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
async handleFileImport(event: Event) {
|
|
316
|
-
const file = (event.target as HTMLInputElement).files?.[0];
|
|
317
|
-
if (!file) return;
|
|
318
|
-
try {
|
|
319
|
-
const text = await file.text();
|
|
320
|
-
const config = JSON.parse(text) as Genesis.ServerReportConfig;
|
|
321
|
-
this.cloneConfigModal.showImportModal(config);
|
|
322
|
-
} catch (e: unknown) {
|
|
323
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
324
|
-
showNotificationToast({
|
|
325
|
-
title: 'Import Report Config',
|
|
326
|
-
body: `Failed to read config file: ${errorMessage}`,
|
|
327
|
-
toast: { type: 'critical' as any },
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
async exportConfig({ NAME, ID }: { NAME: string; ID: string }) {
|
|
333
|
-
try {
|
|
334
|
-
const response = await this.connect.request('REPORT_CONFIG_DETAILS', { REQUEST: { ID } });
|
|
335
|
-
const data = response.REPLY?.[0];
|
|
336
|
-
if (!data) throw new Error(`No data returned for export report with ID ${ID}`);
|
|
337
|
-
|
|
338
|
-
// Quick and dirty way of removing the BIGINTs from the server response which cannot be serialized
|
|
339
|
-
// in JSON
|
|
340
|
-
const getSchema = getDatasourceSchema(this.connect);
|
|
341
|
-
const transformed = await transformFromServerPayload(data, getSchema);
|
|
342
|
-
const cleanPayload = transformToServerPayload(transformed);
|
|
343
|
-
|
|
344
|
-
const json = JSON.stringify(cleanPayload, null, 2);
|
|
345
|
-
const blob = new Blob([json], { type: 'application/json' });
|
|
346
|
-
const url = URL.createObjectURL(blob);
|
|
347
|
-
|
|
348
|
-
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
349
|
-
const filename = `${NAME.replace(/ /g, '-')}_${timestamp}.json`;
|
|
350
|
-
|
|
351
|
-
const anchor = document.createElement('a');
|
|
352
|
-
anchor.href = url;
|
|
353
|
-
anchor.download = filename;
|
|
354
|
-
anchor.click();
|
|
355
|
-
URL.revokeObjectURL(url);
|
|
356
|
-
} catch (e: unknown) {
|
|
357
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
358
|
-
showNotificationToast({
|
|
359
|
-
title: 'Export Report Config',
|
|
360
|
-
body: `'${NAME}' was not able to be exported: ${errorMessage}`,
|
|
361
|
-
toast: { type: 'critical' as any },
|
|
362
|
-
});
|
|
363
|
-
logger.error(e);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { html, repeat, when } from '@genesislcap/web-core';
|
|
2
|
-
import type { BaseConfig } from '../../main/edit-config/base-config/base-config';
|
|
3
|
-
import type { ReportOutputTypes } from '../../store';
|
|
4
|
-
import { Genesis } from '../../types';
|
|
5
|
-
import { TOOLTIP, tooltip } from '../../utils';
|
|
6
|
-
import type { CloneReportConfigModal } from '../clone-report-config-modal/clone-report-config-modal';
|
|
7
|
-
|
|
8
|
-
export const NULL_TEMPLATE = 'Select a template';
|
|
9
|
-
|
|
10
|
-
export const allowedTemplateFiletypes: Record<ReportOutputTypes, string[]> = {
|
|
11
|
-
CSV: ['csv', 'txt'],
|
|
12
|
-
PDF: ['html', 'xhtml'],
|
|
13
|
-
XLSX: ['xls', 'xlsx'],
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const fileTemplatePicker = html<BaseConfig | CloneReportConfigModal>`
|
|
17
|
-
<label class="label">File template${tooltip(TOOLTIP.SETUP_FILE_TEMPLATE)}</label>
|
|
18
|
-
${repeat(
|
|
19
|
-
(x) => (x.allowedTemplates?.length > 0 ? [x] : []),
|
|
20
|
-
html<BaseConfig | CloneReportConfigModal>`
|
|
21
|
-
<rapid-select
|
|
22
|
-
data-test-id="config-document-template"
|
|
23
|
-
:value=${(x) => x.selectedTemplateId || NULL_TEMPLATE}
|
|
24
|
-
@change=${(x, ctx) => x.handleTemplateSelectChange(ctx.event.target as HTMLSelectElement)}
|
|
25
|
-
>
|
|
26
|
-
<rapid-option value=${() => NULL_TEMPLATE}>${NULL_TEMPLATE}</rapid-option>
|
|
27
|
-
${repeat(
|
|
28
|
-
(x) => x.allowedTemplates,
|
|
29
|
-
html<Genesis.FileStorageDataRow>`
|
|
30
|
-
<rapid-option value="${(x) => x[Genesis.FileStorageFields.FILE_STORAGE_ID]}">
|
|
31
|
-
${(x) => x[Genesis.FileStorageFields.FILE_NAME]}
|
|
32
|
-
</rapid-option>
|
|
33
|
-
`,
|
|
34
|
-
)}
|
|
35
|
-
</rapid-select>
|
|
36
|
-
`,
|
|
37
|
-
{ recycle: false },
|
|
38
|
-
)}
|
|
39
|
-
${when(
|
|
40
|
-
(x) => !x.allowedTemplates || x.allowedTemplates.length === 0,
|
|
41
|
-
html`
|
|
42
|
-
No valid templates available for this output format.
|
|
43
|
-
`,
|
|
44
|
-
)}
|
|
45
|
-
`;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Redux store for FAST projects (WIP)
|
|
2
|
-
|
|
3
|
-
Currently this is a POC for internal use in Create. Once we test it more, it could be published as separate module (e.g. in FUI) as an alternative to the foundation-store.
|
|
4
|
-
|
|
5
|
-
## Why migrate away from foundation-store?
|
|
6
|
-
|
|
7
|
-
foundation-store was created as an implementation of Redux pattern within FAST context. There're a few issues with it compared to using Redux itself:
|
|
8
|
-
|
|
9
|
-
* boilerplate
|
|
10
|
-
* not benefitting fully from vast Redux docs and ecosystem - there is a lot of documentation on the official Redux site covering various complex cases. You _can_ adapt them to foundation-store, but it's a lot more work compared to being able to copy/paste
|
|
11
|
-
* e.g. https://redux-toolkit.js.org/api/createEntityAdapter for auto-generating typical CRUD-style actions and selectors
|
|
12
|
-
* need to implement things from scratch (e.g. serialisation and hydration from local storage)
|
|
13
|
-
|
|
14
|
-
Rather than re-implenting Redux pattern, this package provides bindings to the Redux itself.
|
|
15
|
-
Bindings themselves are pretty small so they can be adapated for other libraries (e.g. https://mobx.js.org/README.html, https://github.com/pmndrs/zustand, https://pinia.vuejs.org/)
|
|
16
|
-
|
|
17
|
-
### Boilerplate example
|
|
18
|
-
|
|
19
|
-
Foundation store leaves immutability handling to the developer (so you need to do a lot of object and array spreading) and it also uses native custom events, so your components need to extend event emitter clases, you need to set up event maps etc. This results in quite a lot of boilerplate:
|
|
20
|
-
|
|
21
|
-
Foundation store:
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
this.createListener<DeleteViewDerivedFieldPayload>(
|
|
25
|
-
StoreEvents.DeleteViewDerivedField,
|
|
26
|
-
({ view, field }) => {
|
|
27
|
-
const { [field]: fieldToDelete, ...rest } =
|
|
28
|
-
this.commit.genesisCreateConfig.views.views[view]?.derivedFields || {};
|
|
29
|
-
if (fieldToDelete) {
|
|
30
|
-
this.commit.genesisCreateConfig = {
|
|
31
|
-
...this.genesisCreateConfig,
|
|
32
|
-
views: {
|
|
33
|
-
views: {
|
|
34
|
-
...this.genesisCreateConfig.views.views,
|
|
35
|
-
[view]: {
|
|
36
|
-
...this.genesisCreateConfig.views.views[view],
|
|
37
|
-
derivedFields: {
|
|
38
|
-
...rest,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Redux toolkit:
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
deleteDerivedField(state, { payload: { view, field } }) {
|
|
53
|
-
delete state[view].derivedFields[field];
|
|
54
|
-
}
|
|
55
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { find, get, set, findIndex } from 'lodash';
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { isDev } from '@genesislcap/foundation-utils';
|
|
2
|
-
import { Observable } from '@genesislcap/web-core';
|
|
3
|
-
import { configureStore, ReducersMapObject, EnhancedStore, Action } from '@reduxjs/toolkit';
|
|
4
|
-
import {
|
|
5
|
-
ActionsFromSlices,
|
|
6
|
-
StoreReturn,
|
|
7
|
-
RootStateFromSlices,
|
|
8
|
-
SelectorsFromSlices,
|
|
9
|
-
SliceArray,
|
|
10
|
-
} from '../../types';
|
|
11
|
-
|
|
12
|
-
export { createSlice } from '@reduxjs/toolkit';
|
|
13
|
-
|
|
14
|
-
class ObservableStore<S extends SliceArray> {
|
|
15
|
-
private _store: EnhancedStore<RootStateFromSlices<S>>;
|
|
16
|
-
private _slices: S;
|
|
17
|
-
private _rootReducer: ReducersMapObject<RootStateFromSlices<S>>;
|
|
18
|
-
|
|
19
|
-
constructor(slices: S, preloadedState: RootStateFromSlices<S>) {
|
|
20
|
-
this._slices = slices;
|
|
21
|
-
this._rootReducer = slices.reduce(
|
|
22
|
-
(acc, slice) => {
|
|
23
|
-
acc[slice.name] = slice.reducer;
|
|
24
|
-
return acc;
|
|
25
|
-
},
|
|
26
|
-
{} as ReducersMapObject<RootStateFromSlices<S>>,
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
this._store = configureStore({
|
|
30
|
-
reducer: this._rootReducer,
|
|
31
|
-
devTools: isDev(),
|
|
32
|
-
preloadedState,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getReduxStore = () => this._store;
|
|
37
|
-
|
|
38
|
-
dispatch = (action: Action) => this._store.dispatch(action);
|
|
39
|
-
|
|
40
|
-
notify = (sliceName: keyof RootStateFromSlices<S>) =>
|
|
41
|
-
Observable.notify(this, sliceName as string);
|
|
42
|
-
|
|
43
|
-
getRootReducer = () => this._rootReducer;
|
|
44
|
-
|
|
45
|
-
subscribe = (cb: (state: RootStateFromSlices<S>) => void) =>
|
|
46
|
-
this._store.subscribe(() => {
|
|
47
|
-
cb(this._store.getState());
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
subscribeKey = (
|
|
51
|
-
checkerFn: (s: RootStateFromSlices<S>) => string,
|
|
52
|
-
callbackFn: (s: RootStateFromSlices<S>) => void,
|
|
53
|
-
): void => {
|
|
54
|
-
let cache = checkerFn(this._store.getState());
|
|
55
|
-
this.subscribe(() => {
|
|
56
|
-
const newState = checkerFn(this._store.getState());
|
|
57
|
-
if (cache === newState) return;
|
|
58
|
-
cache = newState;
|
|
59
|
-
callbackFn(this._store.getState());
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
getSlice = (name: keyof RootStateFromSlices<S>) => {
|
|
64
|
-
Observable.track(this, name);
|
|
65
|
-
return this._store.getState()[name];
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
getActions = () =>
|
|
69
|
-
this._slices.reduce((acc, slice) => {
|
|
70
|
-
Object.keys(slice.actions).forEach((key) => {
|
|
71
|
-
if (acc[key]) {
|
|
72
|
-
throw new Error(`Action name not unique: ${key}`);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
acc[slice.name] = {
|
|
76
|
-
...acc[slice.name],
|
|
77
|
-
[key]: (payload: any) => {
|
|
78
|
-
this.dispatch(slice.actions[key](payload));
|
|
79
|
-
this.notify(slice.name as keyof RootStateFromSlices<S>);
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
return acc;
|
|
84
|
-
}, {}) as ActionsFromSlices<S>;
|
|
85
|
-
|
|
86
|
-
getSelectors = () =>
|
|
87
|
-
this._slices.reduce((acc, slice) => {
|
|
88
|
-
Object.keys(slice.selectors).forEach((key) => {
|
|
89
|
-
if (acc[slice.name]?.[key]) {
|
|
90
|
-
throw new Error(`Selector name not unique: ${key}`);
|
|
91
|
-
}
|
|
92
|
-
if (!acc[slice.name]) {
|
|
93
|
-
acc[slice.name] = {};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
acc[slice.name] = {
|
|
97
|
-
...acc[slice.name],
|
|
98
|
-
[key]: (...params: any[]) => {
|
|
99
|
-
const sliceState = this.getSlice(slice.name as keyof RootStateFromSlices<S>);
|
|
100
|
-
const fullState = {
|
|
101
|
-
...this._store.getState(),
|
|
102
|
-
[slice.name]: sliceState,
|
|
103
|
-
};
|
|
104
|
-
return slice.selectors[key](fullState, ...params);
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
return acc;
|
|
109
|
-
}, {} as SelectorsFromSlices<S>);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export const createStore = <S extends SliceArray>(
|
|
113
|
-
slices: S,
|
|
114
|
-
preloadedState: RootStateFromSlices<S>,
|
|
115
|
-
): StoreReturn<S> => {
|
|
116
|
-
const observableStore = new ObservableStore(slices, preloadedState);
|
|
117
|
-
const actions = observableStore.getActions();
|
|
118
|
-
const storeProxy = new Proxy({} as RootStateFromSlices<S>, {
|
|
119
|
-
get(target, propertyName) {
|
|
120
|
-
return observableStore.getSlice(propertyName as keyof RootStateFromSlices<S>);
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
store: storeProxy,
|
|
126
|
-
actions,
|
|
127
|
-
selectors: observableStore.getSelectors(),
|
|
128
|
-
rootReducer: observableStore.getRootReducer(),
|
|
129
|
-
dispatch: observableStore.dispatch,
|
|
130
|
-
notify: observableStore.notify,
|
|
131
|
-
subscribe: observableStore.subscribe,
|
|
132
|
-
getState: () => observableStore.getReduxStore().getState(),
|
|
133
|
-
subscribeKey: observableStore.subscribeKey,
|
|
134
|
-
};
|
|
135
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { css } from '@genesislcap/web-core';
|
|
2
|
-
import { formLabel } from '../../../styles';
|
|
3
|
-
|
|
4
|
-
export const styles = css`
|
|
5
|
-
${formLabel}
|
|
6
|
-
|
|
7
|
-
:host {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
gap: calc(var(--design-unit) * 2px);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
rapid-select {
|
|
14
|
-
width: 100%;
|
|
15
|
-
margin-bottom: calc(var(--design-unit) * 2px);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
rapid-text-area {
|
|
19
|
-
height: 115px;
|
|
20
|
-
padding-bottom: calc(var(--design-unit) * 2px);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
rapid-text-field {
|
|
24
|
-
margin-bottom: calc(var(--design-unit) * 2px);
|
|
25
|
-
}
|
|
26
|
-
`;
|