@genesislcap/foundation-entity-management 14.70.4-es2021.1 → 14.70.4-test.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.
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  import { FoundationRouter } from '@genesislcap/foundation-ui';
2
3
  import { zeroGridComponents } from '@genesislcap/foundation-zero-grid-pro';
3
4
  import { allComponents, provideFASTDesignSystem } from '@microsoft/fast-components';
@@ -22,25 +23,29 @@ function loadZeroFallback() {
22
23
  /**
23
24
  * Granular
24
25
  */
25
- async function loadZeroDesignSystem() {
26
- let type = ResourceType.REMOTE;
27
- try {
28
- // @ts-ignore
29
- return await import('foundationZero/ZeroDesignSystem');
30
- }
31
- catch (e) {
32
- type = ResourceType.LOCAL;
33
- return await loadZeroFallback();
34
- }
35
- finally {
36
- logger.debug(`Using '${type}' version of foundationZero/ZeroDesignSystem`);
37
- }
26
+ function loadZeroDesignSystem() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ let type = ResourceType.REMOTE;
29
+ try {
30
+ // @ts-ignore
31
+ return yield import('foundationZero/ZeroDesignSystem');
32
+ }
33
+ catch (e) {
34
+ type = ResourceType.LOCAL;
35
+ return yield loadZeroFallback();
36
+ }
37
+ finally {
38
+ logger.debug(`Using '${type}' version of foundationZero/ZeroDesignSystem`);
39
+ }
40
+ });
38
41
  }
39
- export async function loadRemotes() {
40
- const { provideDesignSystem, baseComponents } = await loadZeroDesignSystem();
41
- return {
42
- ZeroDesignSystem: provideDesignSystem().register(baseComponents, zeroGridComponents),
43
- };
42
+ export function loadRemotes() {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const { provideDesignSystem, baseComponents } = yield loadZeroDesignSystem();
45
+ return {
46
+ ZeroDesignSystem: provideDesignSystem().register(baseComponents, zeroGridComponents),
47
+ };
48
+ });
44
49
  }
45
50
  /**
46
51
  * Ensure tree shaking doesn't remove these
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __awaiter, __decorate, __rest } from "tslib";
2
2
  import { Connect } from '@genesislcap/foundation-comms';
3
3
  import { ErrorBoundaryEvent, getErrorBuilder, getErrorDialogBuilder, getNotificationBuilder, getSnackbarBuilder, } from '@genesislcap/foundation-errors';
4
4
  import { showDialog } from '@genesislcap/foundation-errors';
@@ -78,16 +78,21 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
78
78
  * Set up the web component
79
79
  * @internal
80
80
  */
81
- async connectedCallback() {
82
- super.connectedCallback();
83
- this.addEventListener('rowSelected', this.selectEntity);
84
- if (this.deleteEvent) {
85
- this.addEventListener('delete-entity', this.deleteEntity);
86
- }
87
- this.addEventListener('create-entity', this.createEntity);
88
- this.addEventListener('edit-entity', this.editEntity);
89
- this.addEventListener('read-entity', this.readEntity);
90
- this.addEventListener('criteria-changed', this.criteriaChanged);
81
+ connectedCallback() {
82
+ const _super = Object.create(null, {
83
+ connectedCallback: { get: () => super.connectedCallback }
84
+ });
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ _super.connectedCallback.call(this);
87
+ this.addEventListener('rowSelected', this.selectEntity);
88
+ if (this.deleteEvent) {
89
+ this.addEventListener('delete-entity', this.deleteEntity);
90
+ }
91
+ this.addEventListener('create-entity', this.createEntity);
92
+ this.addEventListener('edit-entity', this.editEntity);
93
+ this.addEventListener('read-entity', this.readEntity);
94
+ this.addEventListener('criteria-changed', this.criteriaChanged);
95
+ });
91
96
  }
92
97
  /**
93
98
  * Override the deepClone method to ensure that observable attributes are cloned
@@ -104,7 +109,7 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
104
109
  copy.updateFormUiSchema = structuredClone(this.updateFormUiSchema);
105
110
  copy.defaultEntityValues = structuredClone(this.defaultEntityValues);
106
111
  // this.columns[number] might contain a function, so can't use structuredClone
107
- copy.columns = this.columns ? [...this.columns].map((x) => ({ ...x })) : this.columns;
112
+ copy.columns = this.columns ? [...this.columns].map((x) => (Object.assign({}, x))) : this.columns;
108
113
  return copy;
109
114
  }
110
115
  /**
@@ -115,8 +120,10 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
115
120
  * Emits an event upon error
116
121
  * @public
117
122
  */
118
- async submitEntityChanges(e) {
119
- this.closeModal();
123
+ submitEntityChanges(e) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ this.closeModal();
126
+ });
120
127
  }
121
128
  /**
122
129
  * Show the entity create form
@@ -127,7 +134,7 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
127
134
  this.editDialogTitle = `Add ${this.entityLabel}`;
128
135
  this.formUiSchema = this.createFormUiSchema;
129
136
  this.formResourceName = this.createEvent;
130
- this.editedEntity = { ...this.defaultEntityValues };
137
+ this.editedEntity = Object.assign({}, this.defaultEntityValues);
131
138
  this.editModalVisible = true;
132
139
  }
133
140
  /**
@@ -136,34 +143,30 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
136
143
  * @param e - CustomEvent where `e.detail` is the entity to edit.
137
144
  * @internal
138
145
  */
139
- async editEntity({ detail }) {
140
- this.editDialogTitle = `Edit ${this.entityLabel}`;
141
- this.formUiSchema = this.updateFormUiSchema;
142
- this.formResourceName = this.updateEvent;
143
- if (detail) {
144
- const { ROW_REF, ...formData } = detail;
145
- this.editedEntity = formData;
146
- if (this.readEventFn) {
147
- const readEntityReq = await this.readEventFn(formData);
148
- this.editedEntity = {
149
- ...this.editedEntity,
150
- ...readEntityReq,
151
- };
146
+ editEntity({ detail }) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ this.editDialogTitle = `Edit ${this.entityLabel}`;
149
+ this.formUiSchema = this.updateFormUiSchema;
150
+ this.formResourceName = this.updateEvent;
151
+ if (detail) {
152
+ const { ROW_REF } = detail, formData = __rest(detail, ["ROW_REF"]);
153
+ this.editedEntity = formData;
154
+ if (this.readEventFn) {
155
+ const readEntityReq = yield this.readEventFn(formData);
156
+ this.editedEntity = Object.assign(Object.assign({}, this.editedEntity), readEntityReq);
157
+ }
158
+ else if (this.readEvent) {
159
+ const readEventReq = yield this.connect.request(this.readEvent, {
160
+ REQUEST: formData,
161
+ });
162
+ this.editedEntity = Object.assign(Object.assign({}, this.editedEntity), readEventReq.REPLY[0]);
163
+ }
152
164
  }
153
- else if (this.readEvent) {
154
- const readEventReq = await this.connect.request(this.readEvent, {
155
- REQUEST: formData,
156
- });
157
- this.editedEntity = {
158
- ...this.editedEntity,
159
- ...readEventReq.REPLY[0],
160
- };
165
+ else {
166
+ this.editedEntity = Object.assign({}, this.defaultEntityValues);
161
167
  }
162
- }
163
- else {
164
- this.editedEntity = { ...this.defaultEntityValues };
165
- }
166
- this.editModalVisible = true;
168
+ this.editModalVisible = true;
169
+ });
167
170
  }
168
171
  readEntity(e) {
169
172
  this.readonly = true;
@@ -175,7 +178,7 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
175
178
  this.editModalVisible = false;
176
179
  }
177
180
  criteriaChanged(e) {
178
- this.datasourceConfig = { ...this.datasourceConfig, criteria: e.detail };
181
+ this.datasourceConfig = Object.assign(Object.assign({}, this.datasourceConfig), { criteria: e.detail });
179
182
  }
180
183
  /**
181
184
  * Handler for deleting the entity. Added as an event listener on the class when receiving the `delete-entity` event.
@@ -183,28 +186,32 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
183
186
  * @param e - CustomEvent where `e.detail` contains data to update the selectedEntity reference with the entity to delete.
184
187
  * @internal
185
188
  */
186
- async deleteEntity(e) {
187
- this.selectedEntity = e.detail;
188
- this.showDeleteConfirmation();
189
+ deleteEntity(e) {
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ this.selectedEntity = e.detail;
192
+ this.showDeleteConfirmation();
193
+ });
189
194
  }
190
- async confirmDelete() {
191
- const schema = await this.connect.getJSONSchema(this.deleteEvent);
192
- const DETAILS = {};
193
- if (typeof schema.INBOUND.properties.DETAILS !== 'boolean') {
194
- const requiredFields = Object.keys(schema.INBOUND.properties.DETAILS.properties);
195
- if (requiredFields) {
196
- requiredFields.forEach((property) => {
197
- DETAILS[property] = this.selectedEntity[property];
198
- });
199
- const deleteReq = await this.connect.commitEvent(this.deleteEvent, {
200
- DETAILS,
201
- });
202
- this.errorNotify(deleteReq);
203
- }
204
- else {
205
- logger.error('No required fields found for delete event', this.deleteEvent);
195
+ confirmDelete() {
196
+ return __awaiter(this, void 0, void 0, function* () {
197
+ const schema = yield this.connect.getJSONSchema(this.deleteEvent);
198
+ const DETAILS = {};
199
+ if (typeof schema.INBOUND.properties.DETAILS !== 'boolean') {
200
+ const requiredFields = Object.keys(schema.INBOUND.properties.DETAILS.properties);
201
+ if (requiredFields) {
202
+ requiredFields.forEach((property) => {
203
+ DETAILS[property] = this.selectedEntity[property];
204
+ });
205
+ const deleteReq = yield this.connect.commitEvent(this.deleteEvent, {
206
+ DETAILS,
207
+ });
208
+ this.errorNotify(deleteReq);
209
+ }
210
+ else {
211
+ logger.error('No required fields found for delete event', this.deleteEvent);
212
+ }
206
213
  }
207
- }
214
+ });
208
215
  }
209
216
  showDeleteConfirmation() {
210
217
  showDialog(getErrorBuilder()
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __awaiter, __decorate } from "tslib";
2
2
  import { Events } from '@ag-grid-community/core';
3
3
  import { attr, customElement, FASTElement, observable } from '@microsoft/fast-element';
4
4
  import { buttonCellRenderer } from '../utils';
@@ -46,19 +46,23 @@ let List = class List extends FASTElement {
46
46
  }
47
47
  }
48
48
  handleFilterChanged(e) {
49
- const fieldName = e?.detail?.fieldName;
50
- const filter = e?.detail?.filter;
49
+ var _a, _b;
50
+ const fieldName = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.fieldName;
51
+ const filter = (_b = e === null || e === void 0 ? void 0 : e.detail) === null || _b === void 0 ? void 0 : _b.filter;
51
52
  fieldName && filter && this.datasource.setFilter(fieldName, filter);
52
53
  }
53
54
  handleFilterCleared(e) {
54
- const fieldName = e?.detail?.fieldName;
55
+ var _a;
56
+ const fieldName = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.fieldName;
55
57
  this.datasource.removeFilter(fieldName);
56
58
  }
57
59
  select(e) {
58
60
  this.$emit('rowSelected', e);
59
61
  }
60
- async delete(e) {
61
- this.$emit('delete-entity', e);
62
+ delete(e) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ this.$emit('delete-entity', e);
65
+ });
62
66
  }
63
67
  };
64
68
  __decorate([
@@ -4,8 +4,8 @@ export const listTemplate = html `
4
4
  ${when((x) => x.enableFilterBar, html `
5
5
  <zero-filter-bar
6
6
  resource=${(x) => x.resourceName}
7
- only=${(x) => x.columns?.map((colDef) => colDef.field).filter((field) => !!field)}
8
- labels=${(x) => x.columns?.map((colDef) => colDef.headerName || '')}
7
+ only=${(x) => { var _a; return (_a = x.columns) === null || _a === void 0 ? void 0 : _a.map((colDef) => colDef.field).filter((field) => !!field); }}
8
+ labels=${(x) => { var _a; return (_a = x.columns) === null || _a === void 0 ? void 0 : _a.map((colDef) => colDef.headerName || ''); }}
9
9
  target="datasource"
10
10
  ></zero-filter-bar>
11
11
  `)}
@@ -25,13 +25,13 @@ export const listTemplate = html `
25
25
  ${ref('datasource')}
26
26
  :deferredGridOptions=${(x) => x.gridOptions}
27
27
  resource-name=${(x) => x.resourceName}
28
- criteria=${(x) => x.datasourceConfig?.criteria}
29
- fields=${(x) => x.datasourceConfig?.fields}
30
- is-snapshot=${(x) => x.datasourceConfig?.isSnapshot}
31
- max-rows=${(x) => x.datasourceConfig?.maxRows}
32
- max-view=${(x) => x.datasourceConfig?.maxView}
33
- order-by=${(x) => x.datasourceConfig?.orderBy}
34
- reverse=${(x) => x.datasourceConfig?.reverse}
28
+ criteria=${(x) => { var _a; return (_a = x.datasourceConfig) === null || _a === void 0 ? void 0 : _a.criteria; }}
29
+ fields=${(x) => { var _a; return (_a = x.datasourceConfig) === null || _a === void 0 ? void 0 : _a.fields; }}
30
+ is-snapshot=${(x) => { var _a; return (_a = x.datasourceConfig) === null || _a === void 0 ? void 0 : _a.isSnapshot; }}
31
+ max-rows=${(x) => { var _a; return (_a = x.datasourceConfig) === null || _a === void 0 ? void 0 : _a.maxRows; }}
32
+ max-view=${(x) => { var _a; return (_a = x.datasourceConfig) === null || _a === void 0 ? void 0 : _a.maxView; }}
33
+ order-by=${(x) => { var _a; return (_a = x.datasourceConfig) === null || _a === void 0 ? void 0 : _a.orderBy; }}
34
+ reverse=${(x) => { var _a; return (_a = x.datasourceConfig) === null || _a === void 0 ? void 0 : _a.reverse; }}
35
35
  ></grid-pro-genesis-datasource>
36
36
  ${repeat((x) => x.columns, html `
37
37
  <grid-pro-column :definition=${(x) => x}></grid-pro-column>
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __awaiter, __decorate } from "tslib";
2
2
  import { Connect, ConnectConfig, defaultConnectConfig, Session, SocketReconnectStrategy, } from '@genesislcap/foundation-comms';
3
3
  import { baseLayerLuminance, StandardLuminance } from '@microsoft/fast-components';
4
4
  import { FASTElement, customElement, observable } from '@microsoft/fast-element';
@@ -28,9 +28,11 @@ let MainApplication = class MainApplication extends FASTElement {
28
28
  ? StandardLuminance.LightMode
29
29
  : StandardLuminance.DarkMode);
30
30
  }
31
- async loadRemotes() {
32
- await Components.loadRemotes();
33
- this.ready = true;
31
+ loadRemotes() {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ yield Components.loadRemotes();
34
+ this.ready = true;
35
+ });
34
36
  }
35
37
  selectTemplate() {
36
38
  return this.ready ? MainTemplate : LoadingTemplate;
@@ -49,18 +51,7 @@ let MainApplication = class MainApplication extends FASTElement {
49
51
  * },
50
52
  * }),
51
53
  */
52
- Registration.instance(ConnectConfig, {
53
- ...defaultConnectConfig,
54
- connect: {
55
- ...defaultConnectConfig.connect,
56
- heartbeatInterval: 15000,
57
- },
58
- reconnect: {
59
- ...defaultConnectConfig.reconnect,
60
- reconnectAttempts: 15,
61
- reconnectStrategy: SocketReconnectStrategy.Exponential,
62
- },
63
- }));
54
+ Registration.instance(ConnectConfig, Object.assign(Object.assign({}, defaultConnectConfig), { connect: Object.assign(Object.assign({}, defaultConnectConfig.connect), { heartbeatInterval: 15000 }), reconnect: Object.assign(Object.assign({}, defaultConnectConfig.reconnect), { reconnectAttempts: 15, reconnectStrategy: SocketReconnectStrategy.Exponential }) })));
64
55
  }
65
56
  };
66
57
  __decorate([
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __awaiter, __decorate } from "tslib";
2
2
  import { Auth } from '@genesislcap/foundation-comms';
3
3
  import { customElement } from '@microsoft/fast-element';
4
4
  import { EntityManagement, styles, template } from '../entities';
@@ -45,30 +45,34 @@ let Profiles = class Profiles extends EntityManagement {
45
45
  this.title = 'Profile Management';
46
46
  this.entityLabel = 'Profile';
47
47
  }
48
- async readProfileData(profile) {
49
- const selectedRightsReq = await this.connect.request('PROFILE_RIGHT', {
50
- REQUEST: {
51
- PROFILE_NAME: profile.PROFILE_NAME,
52
- RIGHT_CODE: '*',
53
- },
48
+ readProfileData(profile) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const selectedRightsReq = yield this.connect.request('PROFILE_RIGHT', {
51
+ REQUEST: {
52
+ PROFILE_NAME: profile.PROFILE_NAME,
53
+ RIGHT_CODE: '*',
54
+ },
55
+ });
56
+ const selectedUsersReq = yield this.connect.request('PROFILE_USER', {
57
+ REQUEST: {
58
+ PROFILE_NAME: profile.PROFILE_NAME,
59
+ USER_NAME: '*',
60
+ },
61
+ });
62
+ return {
63
+ RIGHT_CODES: selectedRightsReq.REPLY.map((v) => v.RIGHT_CODE),
64
+ USER_NAMES: Array.from(new Set(selectedUsersReq.REPLY.map((v) => v.USER_NAME))),
65
+ NAME: profile.PROFILE_NAME,
66
+ };
54
67
  });
55
- const selectedUsersReq = await this.connect.request('PROFILE_USER', {
56
- REQUEST: {
57
- PROFILE_NAME: profile.PROFILE_NAME,
58
- USER_NAME: '*',
59
- },
60
- });
61
- return {
62
- RIGHT_CODES: selectedRightsReq.REPLY.map((v) => v.RIGHT_CODE),
63
- USER_NAMES: Array.from(new Set(selectedUsersReq.REPLY.map((v) => v.USER_NAME))),
64
- NAME: profile.PROFILE_NAME,
65
- };
66
68
  }
67
- async confirmDelete() {
68
- const deleteReq = await this.connect.commitEvent(this.deleteEvent, {
69
- DETAILS: { NAME: this.selectedEntity.PROFILE_NAME },
69
+ confirmDelete() {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const deleteReq = yield this.connect.commitEvent(this.deleteEvent, {
72
+ DETAILS: { NAME: this.selectedEntity.PROFILE_NAME },
73
+ });
74
+ this.errorNotify(deleteReq);
70
75
  });
71
- this.errorNotify(deleteReq);
72
76
  }
73
77
  };
74
78
  __decorate([
@@ -1,4 +1,4 @@
1
- import { __decorate, __param } from "tslib";
1
+ import { __awaiter, __decorate, __param } from "tslib";
2
2
  import { Auth, Session, FoundationAnalytics, FoundationAnalyticsEventType, } from '@genesislcap/foundation-comms';
3
3
  import { Container } from '@microsoft/fast-foundation';
4
4
  import { RouterConfiguration, Route } from '@microsoft/fast-router';
@@ -28,8 +28,8 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
28
28
  path: '',
29
29
  name: 'auth',
30
30
  title: 'Login',
31
- element: async () => {
32
- const { configure, define } = await import(
31
+ element: () => __awaiter(this, void 0, void 0, function* () {
32
+ const { configure, define } = yield import(
33
33
  /* webpackChunkName: "foundation-login" */
34
34
  '@genesislcap/foundation-login');
35
35
  configure(this.container, {
@@ -44,13 +44,13 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
44
44
  return define({
45
45
  name: `entity-management-login`,
46
46
  });
47
- },
47
+ }),
48
48
  layout: loginLayout,
49
49
  settings: { public: true },
50
50
  childRouters: true,
51
51
  }, {
52
52
  path: 'entity-management-demo',
53
- element: async () => (await import('./demo/entity-management')).EntityManagementDemo,
53
+ element: () => __awaiter(this, void 0, void 0, function* () { return (yield import('./demo/entity-management')).EntityManagementDemo; }),
54
54
  title: 'Entity Management Demo',
55
55
  name: 'entity-management-demo',
56
56
  settings: { autoAuth: true },
@@ -67,7 +67,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
67
67
  * Example of a NavigationContributor
68
68
  */
69
69
  this.contributors.push({
70
- navigate: async (phase) => {
70
+ navigate: (phase) => __awaiter(this, void 0, void 0, function* () {
71
71
  const settings = phase.route.settings;
72
72
  /**
73
73
  * TODO: Centralise
@@ -91,7 +91,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
91
91
  /**
92
92
  * If autoAuth and session is valid try to connect+auto-login
93
93
  */
94
- if (settings && settings.autoAuth && (await auth.reAuthFromSession())) {
94
+ if (settings && settings.autoAuth && (yield auth.reAuthFromSession())) {
95
95
  return;
96
96
  }
97
97
  /**
@@ -101,7 +101,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
101
101
  session.captureReturnUrl();
102
102
  Route.name.replace(phase.router, 'auth');
103
103
  });
104
- },
104
+ }),
105
105
  });
106
106
  }
107
107
  construct(Type) {
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __awaiter, __decorate } from "tslib";
2
2
  import { Auth, Connect } from '@genesislcap/foundation-comms';
3
3
  import { ErrorBoundaryEvent, getErrorBuilder, getNotificationBuilder, } from '@genesislcap/foundation-errors';
4
4
  import { LifecycleMixin } from '@genesislcap/foundation-utils';
@@ -21,31 +21,11 @@ const defaultColumnConfig = {
21
21
  * @public
22
22
  */
23
23
  export const UsersColumnConfig = [
24
- {
25
- ...defaultColumnConfig,
26
- field: 'USER_NAME',
27
- headerName: 'Username',
28
- },
29
- {
30
- ...defaultColumnConfig,
31
- field: 'FIRST_NAME',
32
- headerName: 'First Name',
33
- },
34
- {
35
- ...defaultColumnConfig,
36
- field: 'LAST_NAME',
37
- headerName: 'Last Name',
38
- },
39
- {
40
- ...defaultColumnConfig,
41
- field: 'EMAIL_ADDRESS',
42
- headerName: 'Email',
43
- },
44
- {
45
- ...defaultColumnConfig,
46
- field: 'LAST_LOGIN',
47
- headerName: 'Last Login',
48
- valueFormatter: ({ value }) => value
24
+ Object.assign(Object.assign({}, defaultColumnConfig), { field: 'USER_NAME', headerName: 'Username' }),
25
+ Object.assign(Object.assign({}, defaultColumnConfig), { field: 'FIRST_NAME', headerName: 'First Name' }),
26
+ Object.assign(Object.assign({}, defaultColumnConfig), { field: 'LAST_NAME', headerName: 'Last Name' }),
27
+ Object.assign(Object.assign({}, defaultColumnConfig), { field: 'EMAIL_ADDRESS', headerName: 'Email' }),
28
+ Object.assign(Object.assign({}, defaultColumnConfig), { field: 'LAST_LOGIN', headerName: 'Last Login', valueFormatter: ({ value }) => value
49
29
  ? new Intl.DateTimeFormat('default', {
50
30
  year: 'numeric',
51
31
  month: 'numeric',
@@ -53,8 +33,7 @@ export const UsersColumnConfig = [
53
33
  hour: 'numeric',
54
34
  minute: 'numeric',
55
35
  }).format(value)
56
- : '',
57
- },
36
+ : '' }),
58
37
  ];
59
38
  /**
60
39
  * Main class which defines the user management functionality
@@ -101,15 +80,7 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
101
80
  * @internal
102
81
  */
103
82
  statusColumn() {
104
- return {
105
- ...defaultColumnConfig,
106
- headerName: 'Status',
107
- field: 'STATUS',
108
- minWidth: 135,
109
- width: 135,
110
- suppressSizeToFit: true,
111
- cellRendererSelector: this.statusRendererSelector.bind(this),
112
- };
83
+ return Object.assign(Object.assign({}, defaultColumnConfig), { headerName: 'Status', field: 'STATUS', minWidth: 135, width: 135, suppressSizeToFit: true, cellRendererSelector: this.statusRendererSelector.bind(this) });
113
84
  }
114
85
  /**
115
86
  * Returns the config for an entity column if the entityID attribute is defined
@@ -120,11 +91,7 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
120
91
  entityColumn() {
121
92
  return this.entityID
122
93
  ? [
123
- {
124
- ...defaultColumnConfig,
125
- headerName: this.entityLabel,
126
- field: this.entityID,
127
- },
94
+ Object.assign(Object.assign({}, defaultColumnConfig), { headerName: this.entityLabel, field: this.entityID }),
128
95
  ]
129
96
  : [];
130
97
  }
@@ -183,16 +150,21 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
183
150
  : '';
184
151
  this.updateEvent = this.auth.currentUser.hasPermission('AMEND_USER') ? 'EVENT_AMEND_USER' : '';
185
152
  }
186
- async connectedCallback() {
187
- super.connectedCallback();
188
- // retrieving access type of currently logged-in user
189
- const userReq = await this.connect.snapshot('ALL_USERS', {
190
- CRITERIA_MATCH: `USER_NAME == '${this.auth.currentUser.username}'`,
153
+ connectedCallback() {
154
+ const _super = Object.create(null, {
155
+ connectedCallback: { get: () => super.connectedCallback }
156
+ });
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ _super.connectedCallback.call(this);
159
+ // retrieving access type of currently logged-in user
160
+ const userReq = yield this.connect.snapshot('ALL_USERS', {
161
+ CRITERIA_MATCH: `USER_NAME == '${this.auth.currentUser.username}'`,
162
+ });
163
+ if (userReq.ROW[0]) {
164
+ this.allAccessType = userReq.ROW[0].ACCESS_TYPE === 'ALL';
165
+ this.entityIdValue = userReq.ROW[0][this.entityID];
166
+ }
191
167
  });
192
- if (userReq.ROW[0]) {
193
- this.allAccessType = userReq.ROW[0].ACCESS_TYPE === 'ALL';
194
- this.entityIdValue = userReq.ROW[0][this.entityID];
195
- }
196
168
  }
197
169
  deepClone() {
198
170
  const copy = super.deepClone();
@@ -204,7 +176,7 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
204
176
  copy.deleteEvent = structuredClone(this.deleteEvent);
205
177
  copy.updateEvent = structuredClone(this.updateEvent);
206
178
  // this.columns[number] might contain a function, so can't use structuredClone
207
- copy.columns = this.columns ? [...this.columns].map((x) => ({ ...x })) : this.columns;
179
+ copy.columns = this.columns ? [...this.columns].map((x) => (Object.assign({}, x))) : this.columns;
208
180
  return copy;
209
181
  }
210
182
  /**
@@ -230,57 +202,55 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
230
202
  *
231
203
  * @internal
232
204
  */
233
- async changeStatus(params) {
234
- const isEnabled = params.data.STATUS === 'ENABLED';
235
- // optimistically set value and store previous value
236
- const previousValue = params.data.STATUS;
237
- params.setValue(isEnabled ? 'DISABLED' : 'ENABLED');
238
- const changeStatusRequest = await this.connect.commitEvent(isEnabled ? 'EVENT_DISABLE_USER' : 'EVENT_ENABLE_USER', {
239
- DETAILS: {
240
- USER_NAME: params.data.USER_NAME,
241
- },
242
- });
243
- if (changeStatusRequest.ERROR) {
244
- logger.error(changeStatusRequest.ERROR);
245
- const notificationCloseTimeout = 5000;
246
- changeStatusRequest.ERROR.forEach((err) => {
247
- this.$emit(ErrorBoundaryEvent.ERROR_BOUNDARY_EVENT, getErrorBuilder()
248
- .withTitle(err.CODE)
249
- .withErrorDetails(getErrorFormat(err))
250
- .withNotification(getNotificationBuilder()
251
- .withType('warning')
252
- .withAutoClose(true)
253
- .withCloseTimeout(notificationCloseTimeout)
254
- .build())
255
- .build());
205
+ changeStatus(params) {
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ const isEnabled = params.data.STATUS === 'ENABLED';
208
+ // optimistically set value and store previous value
209
+ const previousValue = params.data.STATUS;
210
+ params.setValue(isEnabled ? 'DISABLED' : 'ENABLED');
211
+ const changeStatusRequest = yield this.connect.commitEvent(isEnabled ? 'EVENT_DISABLE_USER' : 'EVENT_ENABLE_USER', {
212
+ DETAILS: {
213
+ USER_NAME: params.data.USER_NAME,
214
+ },
256
215
  });
257
- // bring back original value
258
- params.setValue(previousValue);
259
- }
216
+ if (changeStatusRequest.ERROR) {
217
+ logger.error(changeStatusRequest.ERROR);
218
+ const notificationCloseTimeout = 5000;
219
+ changeStatusRequest.ERROR.forEach((err) => {
220
+ this.$emit(ErrorBoundaryEvent.ERROR_BOUNDARY_EVENT, getErrorBuilder()
221
+ .withTitle(err.CODE)
222
+ .withErrorDetails(getErrorFormat(err))
223
+ .withNotification(getNotificationBuilder()
224
+ .withType('warning')
225
+ .withAutoClose(true)
226
+ .withCloseTimeout(notificationCloseTimeout)
227
+ .build())
228
+ .build());
229
+ });
230
+ // bring back original value
231
+ params.setValue(previousValue);
232
+ }
233
+ });
260
234
  }
261
235
  /**
262
236
  * @internal
263
237
  */
264
- async readUserData(user) {
265
- const userProfiles = await this.connect.request('PROFILE_USER', {
266
- REQUEST: {
267
- USER_NAME: user.USER_NAME,
268
- },
238
+ readUserData(user) {
239
+ var _a;
240
+ return __awaiter(this, void 0, void 0, function* () {
241
+ const userProfiles = yield this.connect.request('PROFILE_USER', {
242
+ REQUEST: {
243
+ USER_NAME: user.USER_NAME,
244
+ },
245
+ });
246
+ const defaultValues = !this.allAccessType && ((_a = this.entityIdValue) === null || _a === void 0 ? void 0 : _a.length)
247
+ ? {
248
+ ACCESS_TYPE: 'ENTITY',
249
+ [this.entityID]: this.entityIdValue,
250
+ }
251
+ : {};
252
+ return Object.assign(Object.assign({}, defaultValues), { USER_PROFILES: (userProfiles.REPLY || []).map((profile) => profile.PROFILE_NAME), ADDRESS_LINE_1: user.ADDRESS_LINE1, ADDRESS_LINE_2: user.ADDRESS_LINE2, ADDRESS_LINE_3: user.ADDRESS_LINE3, ADDRESS_LINE_4: user.ADDRESS_LINE4 });
269
253
  });
270
- const defaultValues = !this.allAccessType && this.entityIdValue?.length
271
- ? {
272
- ACCESS_TYPE: 'ENTITY',
273
- [this.entityID]: this.entityIdValue,
274
- }
275
- : {};
276
- return {
277
- ...defaultValues,
278
- USER_PROFILES: (userProfiles.REPLY || []).map((profile) => profile.PROFILE_NAME),
279
- ADDRESS_LINE_1: user.ADDRESS_LINE1,
280
- ADDRESS_LINE_2: user.ADDRESS_LINE2,
281
- ADDRESS_LINE_3: user.ADDRESS_LINE3,
282
- ADDRESS_LINE_4: user.ADDRESS_LINE4,
283
- };
284
254
  }
285
255
  };
286
256
  __decorate([
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-entity-management",
3
3
  "description": "Genesis Foundation Entity Management",
4
- "version": "14.70.4-es2021.1",
4
+ "version": "14.70.4-test.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -41,21 +41,21 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@genesislcap/foundation-login": "^14.40.0",
44
- "@genesislcap/foundation-testing": "14.70.4-es2021.1",
45
- "@genesislcap/genx": "14.70.4-es2021.1",
44
+ "@genesislcap/foundation-testing": "14.70.4-test.1",
45
+ "@genesislcap/genx": "14.70.4-test.1",
46
46
  "rimraf": "^3.0.2"
47
47
  },
48
48
  "dependencies": {
49
49
  "@ag-grid-community/core": "29.2.0",
50
- "@genesislcap/foundation-comms": "14.70.4-es2021.1",
51
- "@genesislcap/foundation-errors": "14.70.4-es2021.1",
52
- "@genesislcap/foundation-forms": "14.70.4-es2021.1",
53
- "@genesislcap/foundation-login": "14.70.4-es2021.1",
54
- "@genesislcap/foundation-ui": "14.70.4-es2021.1",
55
- "@genesislcap/foundation-utils": "14.70.4-es2021.1",
56
- "@genesislcap/foundation-zero": "14.70.4-es2021.1",
57
- "@genesislcap/foundation-zero-grid-pro": "14.70.4-es2021.1",
58
- "@genesislcap/grid-pro": "14.70.4-es2021.1",
50
+ "@genesislcap/foundation-comms": "14.70.4-test.1",
51
+ "@genesislcap/foundation-errors": "14.70.4-test.1",
52
+ "@genesislcap/foundation-forms": "14.70.4-test.1",
53
+ "@genesislcap/foundation-login": "14.70.4-test.1",
54
+ "@genesislcap/foundation-ui": "14.70.4-test.1",
55
+ "@genesislcap/foundation-utils": "14.70.4-test.1",
56
+ "@genesislcap/foundation-zero": "14.70.4-test.1",
57
+ "@genesislcap/foundation-zero-grid-pro": "14.70.4-test.1",
58
+ "@genesislcap/grid-pro": "14.70.4-test.1",
59
59
  "@microsoft/fast-components": "^2.21.3",
60
60
  "@microsoft/fast-element": "^1.7.0",
61
61
  "@microsoft/fast-foundation": "^2.33.2",
@@ -71,5 +71,5 @@
71
71
  "access": "public"
72
72
  },
73
73
  "customElements": "dist/custom-elements.json",
74
- "gitHead": "5d0d8ee36cfd068cfc6211033b326d0a978cfc05"
74
+ "gitHead": "2414c66a7a84c61343d756e240cb4140d82f1311"
75
75
  }