@genesislcap/pbc-reporting-ui 1.0.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 (210) hide show
  1. package/README.md +47 -0
  2. package/dist/dts/assets/images/index.d.ts +11 -0
  3. package/dist/dts/assets/images/index.d.ts.map +1 -0
  4. package/dist/dts/components/components.d.ts +5 -0
  5. package/dist/dts/components/components.d.ts.map +1 -0
  6. package/dist/dts/components/create-edit/create-edit.d.ts +17 -0
  7. package/dist/dts/components/create-edit/create-edit.d.ts.map +1 -0
  8. package/dist/dts/components/create-edit/create-edit.styles.d.ts +2 -0
  9. package/dist/dts/components/create-edit/create-edit.styles.d.ts.map +1 -0
  10. package/dist/dts/components/create-edit/create-edit.template.d.ts +3 -0
  11. package/dist/dts/components/create-edit/create-edit.template.d.ts.map +1 -0
  12. package/dist/dts/components/create-edit/index.d.ts +4 -0
  13. package/dist/dts/components/create-edit/index.d.ts.map +1 -0
  14. package/dist/dts/components/index.d.ts +2 -0
  15. package/dist/dts/components/index.d.ts.map +1 -0
  16. package/dist/dts/components/list/columns.d.ts +14 -0
  17. package/dist/dts/components/list/columns.d.ts.map +1 -0
  18. package/dist/dts/components/list/index.d.ts +4 -0
  19. package/dist/dts/components/list/index.d.ts.map +1 -0
  20. package/dist/dts/components/list/list.d.ts +19 -0
  21. package/dist/dts/components/list/list.d.ts.map +1 -0
  22. package/dist/dts/components/list/list.styles.d.ts +2 -0
  23. package/dist/dts/components/list/list.styles.d.ts.map +1 -0
  24. package/dist/dts/components/list/list.template.d.ts +3 -0
  25. package/dist/dts/components/list/list.template.d.ts.map +1 -0
  26. package/dist/dts/components/preview/columns.d.ts +15 -0
  27. package/dist/dts/components/preview/columns.d.ts.map +1 -0
  28. package/dist/dts/components/preview/index.d.ts +4 -0
  29. package/dist/dts/components/preview/index.d.ts.map +1 -0
  30. package/dist/dts/components/preview/preview.d.ts +28 -0
  31. package/dist/dts/components/preview/preview.d.ts.map +1 -0
  32. package/dist/dts/components/preview/preview.styles.d.ts +2 -0
  33. package/dist/dts/components/preview/preview.styles.d.ts.map +1 -0
  34. package/dist/dts/components/preview/preview.template.d.ts +3 -0
  35. package/dist/dts/components/preview/preview.template.d.ts.map +1 -0
  36. package/dist/dts/components/select-fields/columns.d.ts +65 -0
  37. package/dist/dts/components/select-fields/columns.d.ts.map +1 -0
  38. package/dist/dts/components/select-fields/data.d.ts +49 -0
  39. package/dist/dts/components/select-fields/data.d.ts.map +1 -0
  40. package/dist/dts/components/select-fields/index.d.ts +3 -0
  41. package/dist/dts/components/select-fields/index.d.ts.map +1 -0
  42. package/dist/dts/components/select-fields/select-fields.d.ts +57 -0
  43. package/dist/dts/components/select-fields/select-fields.d.ts.map +1 -0
  44. package/dist/dts/components/select-fields/select-fields.styles.d.ts +2 -0
  45. package/dist/dts/components/select-fields/select-fields.styles.d.ts.map +1 -0
  46. package/dist/dts/components/select-fields/select-fields.template.d.ts +4 -0
  47. package/dist/dts/components/select-fields/select-fields.template.d.ts.map +1 -0
  48. package/dist/dts/components/select-filters/columns.d.ts +88 -0
  49. package/dist/dts/components/select-filters/columns.d.ts.map +1 -0
  50. package/dist/dts/components/select-filters/index.d.ts +4 -0
  51. package/dist/dts/components/select-filters/index.d.ts.map +1 -0
  52. package/dist/dts/components/select-filters/select-filters.d.ts +46 -0
  53. package/dist/dts/components/select-filters/select-filters.d.ts.map +1 -0
  54. package/dist/dts/components/select-filters/select-filters.styles.d.ts +2 -0
  55. package/dist/dts/components/select-filters/select-filters.styles.d.ts.map +1 -0
  56. package/dist/dts/components/select-filters/select-filters.template.d.ts +4 -0
  57. package/dist/dts/components/select-filters/select-filters.template.d.ts.map +1 -0
  58. package/dist/dts/components/wizard/debug.d.ts +3 -0
  59. package/dist/dts/components/wizard/debug.d.ts.map +1 -0
  60. package/dist/dts/components/wizard/index.d.ts +3 -0
  61. package/dist/dts/components/wizard/index.d.ts.map +1 -0
  62. package/dist/dts/components/wizard/steps/filters.d.ts +3 -0
  63. package/dist/dts/components/wizard/steps/filters.d.ts.map +1 -0
  64. package/dist/dts/components/wizard/steps/index.d.ts +5 -0
  65. package/dist/dts/components/wizard/steps/index.d.ts.map +1 -0
  66. package/dist/dts/components/wizard/steps/name.d.ts +4 -0
  67. package/dist/dts/components/wizard/steps/name.d.ts.map +1 -0
  68. package/dist/dts/components/wizard/steps/run.d.ts +3 -0
  69. package/dist/dts/components/wizard/steps/run.d.ts.map +1 -0
  70. package/dist/dts/components/wizard/steps/select.d.ts +3 -0
  71. package/dist/dts/components/wizard/steps/select.d.ts.map +1 -0
  72. package/dist/dts/components/wizard/wizard.d.ts +83 -0
  73. package/dist/dts/components/wizard/wizard.d.ts.map +1 -0
  74. package/dist/dts/components/wizard/wizard.styles.d.ts +2 -0
  75. package/dist/dts/components/wizard/wizard.styles.d.ts.map +1 -0
  76. package/dist/dts/components/wizard/wizard.template.d.ts +4 -0
  77. package/dist/dts/components/wizard/wizard.template.d.ts.map +1 -0
  78. package/dist/dts/components/wizard/wizard.types.d.ts +41 -0
  79. package/dist/dts/components/wizard/wizard.types.d.ts.map +1 -0
  80. package/dist/dts/constants/grid-config.d.ts +17 -0
  81. package/dist/dts/constants/grid-config.d.ts.map +1 -0
  82. package/dist/dts/index.d.ts +3 -0
  83. package/dist/dts/index.d.ts.map +1 -0
  84. package/dist/dts/index.federated.d.ts +1 -0
  85. package/dist/dts/index.federated.d.ts.map +1 -0
  86. package/dist/dts/layouts/default.d.ts +3 -0
  87. package/dist/dts/layouts/default.d.ts.map +1 -0
  88. package/dist/dts/layouts/index.d.ts +3 -0
  89. package/dist/dts/layouts/index.d.ts.map +1 -0
  90. package/dist/dts/layouts/two-pane-horizontal.d.ts +6 -0
  91. package/dist/dts/layouts/two-pane-horizontal.d.ts.map +1 -0
  92. package/dist/dts/main/index.d.ts +3 -0
  93. package/dist/dts/main/index.d.ts.map +1 -0
  94. package/dist/dts/main/main.d.ts +18 -0
  95. package/dist/dts/main/main.d.ts.map +1 -0
  96. package/dist/dts/main/main.styles.d.ts +2 -0
  97. package/dist/dts/main/main.styles.d.ts.map +1 -0
  98. package/dist/dts/main/main.template.d.ts +6 -0
  99. package/dist/dts/main/main.template.d.ts.map +1 -0
  100. package/dist/dts/routes/config.d.ts +25 -0
  101. package/dist/dts/routes/config.d.ts.map +1 -0
  102. package/dist/dts/routes/index.d.ts +2 -0
  103. package/dist/dts/routes/index.d.ts.map +1 -0
  104. package/dist/dts/routes/not-found/not-found.d.ts +4 -0
  105. package/dist/dts/routes/not-found/not-found.d.ts.map +1 -0
  106. package/dist/dts/routes/protected/protected.d.ts +8 -0
  107. package/dist/dts/routes/protected/protected.d.ts.map +1 -0
  108. package/dist/dts/routes/protected/protected.styles.d.ts +2 -0
  109. package/dist/dts/routes/protected/protected.styles.d.ts.map +1 -0
  110. package/dist/dts/routes/protected/protected.template.d.ts +3 -0
  111. package/dist/dts/routes/protected/protected.template.d.ts.map +1 -0
  112. package/dist/dts/routes/reporting-home/reporting-home-styles.d.ts +2 -0
  113. package/dist/dts/routes/reporting-home/reporting-home-styles.d.ts.map +1 -0
  114. package/dist/dts/routes/reporting-home/reporting-home-template.d.ts +4 -0
  115. package/dist/dts/routes/reporting-home/reporting-home-template.d.ts.map +1 -0
  116. package/dist/dts/routes/reporting-home/reporting-home.d.ts +26 -0
  117. package/dist/dts/routes/reporting-home/reporting-home.d.ts.map +1 -0
  118. package/dist/dts/routes/reporting-home/types.d.ts +13 -0
  119. package/dist/dts/routes/reporting-home/types.d.ts.map +1 -0
  120. package/dist/dts/styles/colors.d.ts +17 -0
  121. package/dist/dts/styles/colors.d.ts.map +1 -0
  122. package/dist/dts/styles/helpers.d.ts +5 -0
  123. package/dist/dts/styles/helpers.d.ts.map +1 -0
  124. package/dist/dts/styles/index.d.ts +5 -0
  125. package/dist/dts/styles/index.d.ts.map +1 -0
  126. package/dist/dts/styles/normalize.d.ts +5 -0
  127. package/dist/dts/styles/normalize.d.ts.map +1 -0
  128. package/dist/dts/styles/styles.d.ts +4 -0
  129. package/dist/dts/styles/styles.d.ts.map +1 -0
  130. package/dist/dts/utils/filterObjectArray.d.ts +12 -0
  131. package/dist/dts/utils/filterObjectArray.d.ts.map +1 -0
  132. package/dist/dts/utils/getFiltersByType.d.ts +12 -0
  133. package/dist/dts/utils/getFiltersByType.d.ts.map +1 -0
  134. package/dist/dts/utils/getSelectedFields.d.ts +5 -0
  135. package/dist/dts/utils/getSelectedFields.d.ts.map +1 -0
  136. package/dist/dts/utils/index.d.ts +5 -0
  137. package/dist/dts/utils/index.d.ts.map +1 -0
  138. package/dist/dts/utils/logger.d.ts +2 -0
  139. package/dist/dts/utils/logger.d.ts.map +1 -0
  140. package/dist/esm/assets/images/index.js +60 -0
  141. package/dist/esm/components/components.js +51 -0
  142. package/dist/esm/components/create-edit/create-edit.js +70 -0
  143. package/dist/esm/components/create-edit/create-edit.styles.js +18 -0
  144. package/dist/esm/components/create-edit/create-edit.template.js +13 -0
  145. package/dist/esm/components/create-edit/index.js +3 -0
  146. package/dist/esm/components/index.js +1 -0
  147. package/dist/esm/components/list/columns.js +105 -0
  148. package/dist/esm/components/list/index.js +3 -0
  149. package/dist/esm/components/list/list.js +127 -0
  150. package/dist/esm/components/list/list.styles.js +28 -0
  151. package/dist/esm/components/list/list.template.js +25 -0
  152. package/dist/esm/components/preview/columns.js +21 -0
  153. package/dist/esm/components/preview/index.js +3 -0
  154. package/dist/esm/components/preview/preview.js +111 -0
  155. package/dist/esm/components/preview/preview.styles.js +21 -0
  156. package/dist/esm/components/preview/preview.template.js +30 -0
  157. package/dist/esm/components/select-fields/columns.js +51 -0
  158. package/dist/esm/components/select-fields/data.js +218 -0
  159. package/dist/esm/components/select-fields/index.js +3 -0
  160. package/dist/esm/components/select-fields/select-fields.js +197 -0
  161. package/dist/esm/components/select-fields/select-fields.styles.js +21 -0
  162. package/dist/esm/components/select-fields/select-fields.template.js +49 -0
  163. package/dist/esm/components/select-filters/columns.js +43 -0
  164. package/dist/esm/components/select-filters/index.js +3 -0
  165. package/dist/esm/components/select-filters/select-filters.js +192 -0
  166. package/dist/esm/components/select-filters/select-filters.styles.js +20 -0
  167. package/dist/esm/components/select-filters/select-filters.template.js +51 -0
  168. package/dist/esm/components/wizard/debug.js +34 -0
  169. package/dist/esm/components/wizard/index.js +2 -0
  170. package/dist/esm/components/wizard/steps/filters.js +9 -0
  171. package/dist/esm/components/wizard/steps/index.js +4 -0
  172. package/dist/esm/components/wizard/steps/name.js +58 -0
  173. package/dist/esm/components/wizard/steps/run.js +11 -0
  174. package/dist/esm/components/wizard/steps/select.js +11 -0
  175. package/dist/esm/components/wizard/wizard.js +363 -0
  176. package/dist/esm/components/wizard/wizard.styles.js +193 -0
  177. package/dist/esm/components/wizard/wizard.template.js +113 -0
  178. package/dist/esm/components/wizard/wizard.types.js +7 -0
  179. package/dist/esm/constants/grid-config.js +19 -0
  180. package/dist/esm/index.federated.js +1 -0
  181. package/dist/esm/index.js +2 -0
  182. package/dist/esm/layouts/default.js +27 -0
  183. package/dist/esm/layouts/index.js +2 -0
  184. package/dist/esm/layouts/two-pane-horizontal.js +86 -0
  185. package/dist/esm/main/index.js +2 -0
  186. package/dist/esm/main/main.js +80 -0
  187. package/dist/esm/main/main.styles.js +15 -0
  188. package/dist/esm/main/main.template.js +12 -0
  189. package/dist/esm/routes/config.js +84 -0
  190. package/dist/esm/routes/index.js +1 -0
  191. package/dist/esm/routes/not-found/not-found.js +29 -0
  192. package/dist/esm/routes/protected/protected.js +32 -0
  193. package/dist/esm/routes/protected/protected.styles.js +18 -0
  194. package/dist/esm/routes/protected/protected.template.js +7 -0
  195. package/dist/esm/routes/reporting-home/reporting-home-styles.js +74 -0
  196. package/dist/esm/routes/reporting-home/reporting-home-template.js +85 -0
  197. package/dist/esm/routes/reporting-home/reporting-home.js +103 -0
  198. package/dist/esm/routes/reporting-home/types.js +7 -0
  199. package/dist/esm/styles/colors.js +17 -0
  200. package/dist/esm/styles/helpers.js +179 -0
  201. package/dist/esm/styles/index.js +4 -0
  202. package/dist/esm/styles/normalize.js +13 -0
  203. package/dist/esm/styles/styles.js +22 -0
  204. package/dist/esm/utils/filterObjectArray.js +13 -0
  205. package/dist/esm/utils/getFiltersByType.js +62 -0
  206. package/dist/esm/utils/getSelectedFields.js +13 -0
  207. package/dist/esm/utils/index.js +4 -0
  208. package/dist/esm/utils/logger.js +2 -0
  209. package/index.html +26 -0
  210. package/package.json +79 -0
@@ -0,0 +1,363 @@
1
+ import { __awaiter, __decorate, __rest } from "tslib";
2
+ import { Connect } from '@genesislcap/foundation-comms';
3
+ import { customElement, FASTElement, observable, volatile } from '@microsoft/fast-element';
4
+ import { ReportingEventListeners } from '../../routes/reporting-home/types';
5
+ import { FiltersStep, NameStep, RunStep, SelectStep } from './steps';
6
+ import { WizardStyles as styles } from './wizard.styles';
7
+ import { WizardTemplate as template } from './wizard.template';
8
+ import { WizardStep, } from './wizard.types';
9
+ const name = 'reporting-wizard';
10
+ let Wizard = class Wizard extends FASTElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.debug = false;
14
+ this.activeTab = 0;
15
+ this.datasourceOptions = [];
16
+ this.datasourceFieldOptions = [];
17
+ this.isEdit = false;
18
+ this.fieldData = [];
19
+ this.content = [
20
+ {
21
+ title: 'Set up & Datasource',
22
+ description: "Please give your new report a name, brief description and select it's datasource to get started.",
23
+ },
24
+ {
25
+ title: 'Set fields',
26
+ description: '',
27
+ },
28
+ {
29
+ title: 'Apply filters',
30
+ description: '(Optional)',
31
+ },
32
+ {
33
+ title: 'Run report',
34
+ description: '',
35
+ },
36
+ ];
37
+ // Set name and datasource step
38
+ this.reportName = '';
39
+ this.reportDescription = '';
40
+ this.selectedDatasource = null;
41
+ // Set fields step
42
+ this.selectedFields = [];
43
+ // Set filters step
44
+ this.selectedFilters = [];
45
+ // Run / preview report step
46
+ this.previewData = [];
47
+ this.previewGridColumns = [];
48
+ /**
49
+ * Get a simplified / normalized version of the fields
50
+ * e.g. ['REPORT_ID', 'REPORT_NAME']
51
+ * @returns Array of string
52
+ */
53
+ this.getNormalizedSelectedFields = () => { var _a; return ((_a = this.selectedFields) === null || _a === void 0 ? void 0 : _a.map((field) => field.displayName)) || []; };
54
+ /**
55
+ * Get normalized selected filters context
56
+ * @returns Array of strings
57
+ */
58
+ this.getNormalizedSelectedFilters = () => { var _a; return ((_a = this.selectedFilters) === null || _a === void 0 ? void 0 : _a.map(({ displayName }) => displayName)) || []; };
59
+ /**
60
+ * On datasource radio group change event handler
61
+ * @param selection Number
62
+ */
63
+ this.onDatasourceChange = (selection) => {
64
+ this.selectedDatasource = selection;
65
+ };
66
+ /**
67
+ * Get report context data
68
+ * @returns Object
69
+ */
70
+ this.getData = () => {
71
+ return {
72
+ REPORT_NAME: this.reportName,
73
+ REPORT_DESCRIPTION: this.reportDescription,
74
+ REPORT_COLUMNS: this.selectedFields,
75
+ REPORT_DATA_SOURCE: this.selectedDatasource,
76
+ };
77
+ };
78
+ /**
79
+ * Set the current active tab
80
+ * @param tab Number
81
+ */
82
+ this.setActiveTab = (tabIndex) => {
83
+ if (this.content[tabIndex]) {
84
+ this.activeTab = tabIndex;
85
+ }
86
+ };
87
+ }
88
+ get isFormValid() {
89
+ // Note: This is a very basic form validation. Would be nice to know if there are any existing form validation tools that we've used in the past and implement it here.
90
+ switch (this.activeTab) {
91
+ // Set up & Datasource Step
92
+ case WizardStep.Zero:
93
+ return this.reportName !== '' && this.selectedDatasource !== null ? false : true;
94
+ // Set columns Step
95
+ case WizardStep.One:
96
+ return !this.selectedFields.length;
97
+ // Set filters Step
98
+ case WizardStep.Two:
99
+ return false;
100
+ // Run report Step
101
+ case WizardStep.Three:
102
+ return false;
103
+ default:
104
+ return false;
105
+ }
106
+ }
107
+ get viewTemplate() {
108
+ switch (this.activeTab) {
109
+ case WizardStep.Zero:
110
+ return NameStep;
111
+ case WizardStep.One:
112
+ return SelectStep;
113
+ case WizardStep.Two:
114
+ return FiltersStep;
115
+ case WizardStep.Three:
116
+ return RunStep;
117
+ default:
118
+ throw new Error(`Cannot get template for state ${this.activeTab}`);
119
+ }
120
+ }
121
+ /**
122
+ * When report variable changes handle
123
+ */
124
+ reportChanged(old, newValue) {
125
+ var _a;
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ this.fieldData = (_a = this.fieldData) === null || _a === void 0 ? void 0 : _a.map((_a) => {
128
+ var { filter } = _a, fields = __rest(_a, ["filter"]);
129
+ return fields;
130
+ });
131
+ if (Object.keys(newValue).length) {
132
+ const { REPORT_NAME, REPORT_DESCRIPTION, REPORT_DATASOURCE, REPORT_DATA_SOURCE, REPORT_COLUMNS, } = newValue;
133
+ this.isEdit = true;
134
+ this.selectedFields = REPORT_COLUMNS;
135
+ this.reportName = REPORT_NAME;
136
+ this.reportDescription = REPORT_DESCRIPTION;
137
+ this.selectedDatasource = REPORT_DATASOURCE || REPORT_DATA_SOURCE;
138
+ }
139
+ else {
140
+ this.isEdit = false;
141
+ this.reportName = '';
142
+ this.reportDescription = '';
143
+ this.selectedDatasource = null;
144
+ this.selectedFields = [];
145
+ this.selectedFilters = [];
146
+ }
147
+ this.setActiveTab(0);
148
+ });
149
+ }
150
+ /**
151
+ * Set selected fields
152
+ * @param fields array
153
+ */
154
+ setFields(fields) {
155
+ this.selectedFields = fields;
156
+ }
157
+ /**
158
+ * When report variable changes handle
159
+ */
160
+ selectedDatasourceChanged(old, newValue) {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ // Reset
163
+ this.selectedFields = [];
164
+ this.selectedFilters = [];
165
+ this.fieldData = [];
166
+ // Prepare field data structure from field metadata response
167
+ const fieldMetadata = yield this.fetchFieldsFromDatasource();
168
+ if (this.isEdit && Object.keys(this.report).length) {
169
+ this.selectedFields = this.report['REPORT_COLUMNS'];
170
+ const reportDatasource = this.report['REPORT_DATASOURCE'] || this.report['REPORT_DATA_SOURCE'];
171
+ if (reportDatasource === newValue) {
172
+ this.fieldData = fieldMetadata.map(({ FIELD_NAME, TYPE }) => this.selectedFields.find((field) => field.name === FIELD_NAME) || {
173
+ name: FIELD_NAME,
174
+ type: TYPE,
175
+ displayName: FIELD_NAME,
176
+ selected: false,
177
+ });
178
+ }
179
+ }
180
+ else {
181
+ fieldMetadata === null || fieldMetadata === void 0 ? void 0 : fieldMetadata.forEach(({ FIELD_NAME, TYPE }) => {
182
+ this.fieldData = [
183
+ ...this.fieldData,
184
+ {
185
+ name: FIELD_NAME,
186
+ type: TYPE,
187
+ displayName: FIELD_NAME,
188
+ selected: false,
189
+ },
190
+ ];
191
+ });
192
+ }
193
+ });
194
+ }
195
+ /**
196
+ * Make sure to update selected fields when field data changes
197
+ */
198
+ fieldDataChanged() {
199
+ var _a, _b;
200
+ this.selectedFields =
201
+ ((_a = this.selectedFields) === null || _a === void 0 ? void 0 : _a.map((f) => {
202
+ var _a;
203
+ const matchingField = (_a = this.fieldData) === null || _a === void 0 ? void 0 : _a.find((field) => (field === null || field === void 0 ? void 0 : field.name) === (f === null || f === void 0 ? void 0 : f.name));
204
+ return Object.assign(Object.assign({}, matchingField), { displayName: (matchingField === null || matchingField === void 0 ? void 0 : matchingField.displayName) || (f === null || f === void 0 ? void 0 : f.name), selected: matchingField ? true : false });
205
+ })) || [];
206
+ this.selectedFilters = ((_b = this.fieldData) === null || _b === void 0 ? void 0 : _b.filter((field) => field.filter && field.selected)) || [];
207
+ }
208
+ connectedCallback() {
209
+ super.connectedCallback();
210
+ this.getDatasources();
211
+ this.addEventListener('setSelectedFields', (e) => {
212
+ var _a, _b;
213
+ this.selectedFields = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.fields;
214
+ this.fieldData = (_b = this.fieldData) === null || _b === void 0 ? void 0 : _b.map((field) => {
215
+ const matchingField = this.selectedFields.find((f) => (f === null || f === void 0 ? void 0 : f.name) === (field === null || field === void 0 ? void 0 : field.name));
216
+ return Object.assign(Object.assign(Object.assign({}, field), matchingField), { displayName: (matchingField === null || matchingField === void 0 ? void 0 : matchingField.displayName) || (field === null || field === void 0 ? void 0 : field.name), selected: matchingField ? true : false });
217
+ });
218
+ });
219
+ this.addEventListener('setSelectedFilters', (e) => {
220
+ var _a;
221
+ this.fieldData = (_a = this.fieldData) === null || _a === void 0 ? void 0 : _a.map((field) => {
222
+ var _a, _b;
223
+ const matchingField = (_b = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.find((f) => (f === null || f === void 0 ? void 0 : f.name) === (field === null || field === void 0 ? void 0 : field.name));
224
+ if (matchingField) {
225
+ matchingField.filter = Object.assign({}, matchingField.filter);
226
+ }
227
+ else {
228
+ field === null || field === void 0 ? true : delete field.filter;
229
+ }
230
+ return Object.assign(Object.assign({}, field), matchingField);
231
+ });
232
+ });
233
+ }
234
+ /**
235
+ * Fetch a list of datasources
236
+ */
237
+ getDatasources() {
238
+ return __awaiter(this, void 0, void 0, function* () {
239
+ yield this.connect
240
+ .request('ALL_REPORT_DATASOURCES', {
241
+ REQUEST: {},
242
+ })
243
+ .then((response) => {
244
+ var _a;
245
+ (_a = response === null || response === void 0 ? void 0 : response.REPLY) === null || _a === void 0 ? void 0 : _a.forEach(({ DATASOURCE_NAME, RECORD_ID }) => {
246
+ this.datasourceOptions = [
247
+ ...this.datasourceOptions,
248
+ {
249
+ id: RECORD_ID,
250
+ name: DATASOURCE_NAME,
251
+ },
252
+ ];
253
+ });
254
+ })
255
+ .catch((err) => {
256
+ this.$emit(ReportingEventListeners.notify, {
257
+ type: 'warning',
258
+ title: 'Error:',
259
+ message: `There was an error fetching data sources:
260
+ ${(err === null || err === void 0 ? void 0 : err.ERROR) ? err.ERROR : JSON.stringify(err)}
261
+ `,
262
+ });
263
+ });
264
+ });
265
+ }
266
+ /**
267
+ * Fetch data from the provided datasource
268
+ */
269
+ fetchFieldsFromDatasource() {
270
+ return (this.selectedDatasource &&
271
+ this.connect
272
+ .getMetadata(this.selectedDatasource)
273
+ .then((response) => {
274
+ if (response.ERROR) {
275
+ this.$emit(ReportingEventListeners.notify, {
276
+ type: 'warning',
277
+ title: 'Error:',
278
+ message: `The application encountered an error while trying to fetch fields
279
+ ${this.selectedDatasource && `for data source "${this.selectedDatasource}"`}:
280
+ ${response.ERROR}
281
+ `,
282
+ });
283
+ }
284
+ const fields = (response === null || response === void 0 ? void 0 : response.FIELD) || (response === null || response === void 0 ? void 0 : response.REPLY_FIELD);
285
+ return fields === null || fields === void 0 ? void 0 : fields.map(({ NAME, TYPE }) => ({ FIELD_NAME: NAME, TYPE }));
286
+ })
287
+ .catch((err) => {
288
+ this.$emit(ReportingEventListeners.notify, {
289
+ type: 'warning',
290
+ title: 'Error:',
291
+ message: (err === null || err === void 0 ? void 0 : err.ERROR) ? err.ERROR : JSON.stringify(err),
292
+ });
293
+ }));
294
+ }
295
+ };
296
+ __decorate([
297
+ Connect
298
+ ], Wizard.prototype, "connect", void 0);
299
+ __decorate([
300
+ observable
301
+ ], Wizard.prototype, "debug", void 0);
302
+ __decorate([
303
+ observable
304
+ ], Wizard.prototype, "activeTab", void 0);
305
+ __decorate([
306
+ observable
307
+ ], Wizard.prototype, "datasourceOptions", void 0);
308
+ __decorate([
309
+ observable
310
+ ], Wizard.prototype, "datasourceFieldOptions", void 0);
311
+ __decorate([
312
+ observable
313
+ ], Wizard.prototype, "isEdit", void 0);
314
+ __decorate([
315
+ observable
316
+ ], Wizard.prototype, "fieldData", void 0);
317
+ __decorate([
318
+ observable
319
+ ], Wizard.prototype, "report", void 0);
320
+ __decorate([
321
+ observable
322
+ ], Wizard.prototype, "saveReport", void 0);
323
+ __decorate([
324
+ observable
325
+ ], Wizard.prototype, "content", void 0);
326
+ __decorate([
327
+ observable
328
+ ], Wizard.prototype, "datasourceSettings", void 0);
329
+ __decorate([
330
+ observable
331
+ ], Wizard.prototype, "reportName", void 0);
332
+ __decorate([
333
+ observable
334
+ ], Wizard.prototype, "reportDescription", void 0);
335
+ __decorate([
336
+ observable
337
+ ], Wizard.prototype, "selectedDatasource", void 0);
338
+ __decorate([
339
+ observable
340
+ ], Wizard.prototype, "selectedFields", void 0);
341
+ __decorate([
342
+ observable
343
+ ], Wizard.prototype, "selectedFilters", void 0);
344
+ __decorate([
345
+ observable
346
+ ], Wizard.prototype, "previewData", void 0);
347
+ __decorate([
348
+ observable
349
+ ], Wizard.prototype, "previewGridColumns", void 0);
350
+ __decorate([
351
+ volatile
352
+ ], Wizard.prototype, "isFormValid", null);
353
+ __decorate([
354
+ volatile
355
+ ], Wizard.prototype, "viewTemplate", null);
356
+ Wizard = __decorate([
357
+ customElement({
358
+ name,
359
+ template,
360
+ styles,
361
+ })
362
+ ], Wizard);
363
+ export { Wizard };
@@ -0,0 +1,193 @@
1
+ import { neutralFillStealthHover, neutralFillStealthRest, neutralForegroundHint, neutralForegroundRest, neutralLayer1, neutralLayer2, neutralLayer4, } from '@microsoft/fast-components';
2
+ import { css } from '@microsoft/fast-element';
3
+ import { helperStyles, normalizeStyles } from '../../styles';
4
+ import { ColorHEX } from '../../styles';
5
+ const { cyan, darkGreen, lightGreen, lightBlue1 } = ColorHEX;
6
+ export const WizardStyles = css `
7
+ ${normalizeStyles}
8
+ ${helperStyles}
9
+ :host {
10
+ width: 100%;
11
+ }
12
+
13
+ .grid-container {
14
+ display: grid;
15
+ gap: 1rem;
16
+ grid-template-columns: minmax(250px, 10%) 1fr;
17
+ grid-auto-rows: 1fr;
18
+ margin-top: 1rem;
19
+ margin-bottom: 1rem;
20
+ height: 95%;
21
+ }
22
+
23
+ .nav {
24
+ max-width: 248px;
25
+ background-color: ${neutralLayer2};
26
+ }
27
+
28
+ .nav-item h5 {
29
+ position: relative;
30
+ padding: 7px 15px;
31
+ margin-left: -15px;
32
+ margin-right: -15px;
33
+ margin-bottom: 0;
34
+ vertical-align: middle;
35
+ color: ${neutralForegroundHint};
36
+ }
37
+
38
+ .nav-item.active h5,
39
+ .nav-item h5:hover {
40
+ color: ${neutralForegroundRest};
41
+ background-color: ${neutralFillStealthRest};
42
+ }
43
+
44
+ .nav-item.active h5::after {
45
+ content: ' ';
46
+ width: 5px;
47
+ height: 100%;
48
+ position: absolute;
49
+ top: 0;
50
+ left: 0;
51
+ bottom: 0;
52
+
53
+ --primary-gradient-angle: -172.6004deg;
54
+
55
+ background-image: linear-gradient(
56
+ var(--primary-gradient-angle),
57
+ ${lightBlue1} 0%,
58
+ rgb(101 77 249 / 97%) 100%
59
+ );
60
+ box-sizing: border-box;
61
+ }
62
+
63
+ .nav-item .step-number {
64
+ display: inline-block;
65
+ width: 18px;
66
+ height: 18px;
67
+ vertical-align: middle;
68
+ text-align: center;
69
+ font-family: ArialMT, Arial, sans-serif;
70
+ font-size: 11px;
71
+ line-height: 16px;
72
+ color: ${neutralFillStealthHover};
73
+ border-radius: 50%;
74
+ border: 1px solid ${cyan};
75
+ }
76
+
77
+ .nav-item.active .step-number,
78
+ .nav-item h5:hover .step-number {
79
+ color: ${neutralForegroundHint};
80
+ border-color: ${neutralForegroundHint};
81
+ }
82
+
83
+ .nav-item .step-number.completed {
84
+ border-color: ${lightGreen};
85
+ background-color: ${lightGreen};
86
+ color: ${darkGreen};
87
+ }
88
+
89
+ .body {
90
+ background-color: ${neutralLayer4};
91
+ padding-left: 0;
92
+ padding-top: 0;
93
+ }
94
+
95
+ .description {
96
+ color: ${neutralForegroundHint};
97
+ font-size: 10px;
98
+ font-weight: 700;
99
+ line-height: normal;
100
+ margin-left: 30px;
101
+ }
102
+
103
+ .divider {
104
+ margin: 25px 0 20px;
105
+ border: 1px solid ${cyan};
106
+ }
107
+
108
+ .nav-line.completed {
109
+ margin: 3px 0 3px 9px;
110
+ border-left: 2px solid ${lightGreen};
111
+ }
112
+
113
+ .context-container {
114
+ gap: 0.75rem;
115
+ }
116
+
117
+ .completed .context-container {
118
+ padding: 10px 0 20px;
119
+ }
120
+
121
+ .context {
122
+ color: ${neutralForegroundHint};
123
+ font-size: 10px;
124
+ font-weight: 700;
125
+ line-height: 12px;
126
+ max-height: 100px;
127
+ margin: 0 0 0 20px;
128
+ overflow: auto;
129
+ }
130
+
131
+ .context b {
132
+ color: ${neutralForegroundRest};
133
+ }
134
+
135
+ .label {
136
+ font-size: 13px;
137
+ color: ${neutralForegroundHint};
138
+ margin-bottom: 5px;
139
+ }
140
+
141
+ zero-radio-group::part(positioning-region) {
142
+ display: flex;
143
+ flex-direction: column;
144
+ gap: 7px;
145
+ width: 100%;
146
+ }
147
+
148
+ @media screen and (min-width: 1200px) {
149
+ zero-radio-group::part(positioning-region) {
150
+ display: grid;
151
+ grid-template-columns: repeat(2, minmax(0, 1fr));
152
+ }
153
+ }
154
+
155
+ .radio-button {
156
+ background-color: ${neutralLayer2};
157
+ border-radius: 2px;
158
+ cursor: pointer;
159
+ height: 42px;
160
+ margin: 0;
161
+ padding: 0 10px;
162
+ }
163
+
164
+ .radio-button::part(label) {
165
+ display: inline-block;
166
+ overflow: hidden;
167
+ text-overflow: ellipsis;
168
+ white-space: nowrap;
169
+ }
170
+
171
+ .radio-button.active,
172
+ .radio-button:hover {
173
+ background-color: ${neutralLayer1};
174
+ }
175
+
176
+ zero-radio:hover::part(control) {
177
+ border: 1px solid #fff;
178
+ }
179
+
180
+ .arrow {
181
+ align-self: center;
182
+ justify-self: center;
183
+ }
184
+
185
+ zero-text-area::part(control) {
186
+ min-height: 170px;
187
+ }
188
+
189
+ .report-details,
190
+ .data-sources {
191
+ height: 100%;
192
+ }
193
+ `;
@@ -0,0 +1,113 @@
1
+ import { html, repeat, when } from '@microsoft/fast-element';
2
+ import { tickIcon } from '../../assets/images';
3
+ import { Debug } from './debug';
4
+ import { WizardStep } from './wizard.types';
5
+ const buttonLabel = (activeTab, content, isEdit) => {
6
+ if (activeTab === content.length - 1) {
7
+ return isEdit ? 'Update' : 'Save';
8
+ }
9
+ else {
10
+ return 'Next';
11
+ }
12
+ };
13
+ const TitleTemplate = html `
14
+ <h5 class="step-title" data-test-id="step-title">
15
+ <span
16
+ class="step-number${(x, c) => c.parent.activeTab > c.index || c.parent.activeTab === WizardStep.Three
17
+ ? ' completed'
18
+ : ''}"
19
+ data-test-id="step-number"
20
+ >
21
+ ${(x, c) => c.parent.activeTab > c.index
22
+ ? html `
23
+ ${tickIcon()}
24
+ `
25
+ : c.index + 1}
26
+ </span>
27
+ &nbsp;&nbsp;&nbsp;${(x) => x.title}
28
+ </h5>
29
+ `;
30
+ const TabOneContextTemplate = html `
31
+ <div
32
+ class="nav-line${(x, c) => c.parent.activeTab > c.index ? ' completed' : ''}"
33
+ data-test-id="nav-line"
34
+ >
35
+ <div class="flex flex-column context-container">
36
+ ${when((x, c) => c.parent.activeTab >= 1 && c.index === 0, html `
37
+ <p class="context" data-test-id="report-name">
38
+ Report Name:
39
+ <br />
40
+ <b>${(x, c) => c.parent.reportName}</b>
41
+ </p>
42
+ <p class="context" data-test-id="data-source">
43
+ Data Source:
44
+ <br />
45
+ <b>${(x, c) => c.parent.selectedDatasource}</b>
46
+ </p>
47
+ `)}
48
+ ${when((x, c) => c.parent.activeTab >= 2 && c.index === 1, html `
49
+ <p class="context" data-test-id="selected-fields">
50
+ Selected fields:
51
+ <br />
52
+ <b>${(x, c) => c.parent.getNormalizedSelectedFields().join(`, `)}</b>
53
+ </p>
54
+ `)}
55
+ ${when((x, c) => c.parent.activeTab >= WizardStep.Three && c.index === 2, html `
56
+ <p class="context" data-test-id="applied-filters">
57
+ Applied filters:
58
+ <br />
59
+ <b>${(x, c) => c.parent.getNormalizedSelectedFilters().join(`, `)}</b>
60
+ </p>
61
+ `)}
62
+ </div>
63
+ </div>
64
+ `;
65
+ const WizardNavigation = html `
66
+ <div class="nav-actions text-right" data-test-id="wizard-navigation">
67
+ ${when((x) => x.activeTab > 0, html `
68
+ <zero-button @click=${(x) => x.setActiveTab(x.activeTab - 1)} data-test-id="back-button">
69
+ <zero-icon class="mr-5px" name="arrow-left"></zero-icon>
70
+ Back
71
+ </zero-button>
72
+ `)}
73
+ <zero-button
74
+ appearance="primary-gradient"
75
+ ?disabled=${(x) => x.isFormValid}
76
+ @click=${(x) => x.activeTab === x.content.length - 1
77
+ ? x.saveReport(x.isEdit, x.getData())
78
+ : x.setActiveTab(x.activeTab + 1)}
79
+ data-test-id="next-button"
80
+ >
81
+ ${(x) => buttonLabel(x.activeTab, x.content, x.isEdit)}
82
+ <zero-icon class="ml-5px" name="arrow-right"></zero-icon>
83
+ </zero-button>
84
+ </div>
85
+ `;
86
+ const WizardContent = html `
87
+ <zero-card class="card body" design-unit="5" data-test-id="wizard-content">
88
+ ${(x) => x.viewTemplate}
89
+ </zero-card>
90
+ `;
91
+ export const WizardTemplate = html `
92
+ <div class="wizard grid-container">
93
+ <zero-card class="card nav flex flex-column" data-test-id="wizard-navigation-card">
94
+ <h3 class="section-title light-grey">${(x) => (x.isEdit ? 'Edit' : 'Create')} Report</h3>
95
+ ${repeat((x) => x.content, html `
96
+ <div
97
+ class="nav-item${(x, c) => c.index === c.parent.activeTab ? ' active' : ''}"
98
+ data-test-id="wizard-navigation-item"
99
+ >
100
+ ${TitleTemplate}
101
+ ${when((x, c) => x.description && c.index === c.parent.activeTab, html `
102
+ <p class="description" data-test-id="wizard-navigation-item-description">
103
+ ${(x) => x.description}
104
+ </p>
105
+ `)}
106
+ ${TabOneContextTemplate}
107
+ </div>
108
+ `, { positioning: true, recycle: false })}
109
+ ${WizardNavigation} ${(x) => (x.debug ? Debug : null)}
110
+ </zero-card>
111
+ ${WizardContent}
112
+ </div>
113
+ `;
@@ -0,0 +1,7 @@
1
+ export var WizardStep;
2
+ (function (WizardStep) {
3
+ WizardStep[WizardStep["Zero"] = 0] = "Zero";
4
+ WizardStep[WizardStep["One"] = 1] = "One";
5
+ WizardStep[WizardStep["Two"] = 2] = "Two";
6
+ WizardStep[WizardStep["Three"] = 3] = "Three";
7
+ })(WizardStep || (WizardStep = {}));
@@ -0,0 +1,19 @@
1
+ // TODO: styling shoould be applied with classes
2
+ export const defaultRowConfig = {
3
+ rowHeight: 52,
4
+ rowStyle: {
5
+ // TODO: use var for colors; allow styling through design system
6
+ backgroundColor: 'RGB(34, 39, 44)',
7
+ border: 'none',
8
+ borderRadius: '6px',
9
+ maxHeight: '42px',
10
+ },
11
+ suppressRowClickSelection: true,
12
+ };
13
+ // TODO: styling shoould be applied with classes
14
+ export const defaultCellConfig = {
15
+ cellStyle: {
16
+ display: 'flex',
17
+ alignItems: 'center',
18
+ },
19
+ };
@@ -0,0 +1 @@
1
+ import('./index');
@@ -0,0 +1,2 @@
1
+ export * from './main/index';
2
+ export * from './routes/config';