@genesislcap/grid-pro 14.290.0 → 14.291.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +93 -620
- package/dist/dts/datasource/base.datasource.d.ts +11 -44
- package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/base.types.d.ts +0 -21
- package/dist/dts/datasource/base.types.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts +3 -5
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro.d.ts +4 -9
- package/dist/dts/grid-pro.d.ts.map +1 -1
- package/dist/dts/grid-pro.styles.d.ts.map +1 -1
- package/dist/dts/grid-pro.template.d.ts +1 -1
- package/dist/dts/grid-pro.template.d.ts.map +1 -1
- package/dist/esm/datasource/base.datasource.js +1 -172
- package/dist/esm/datasource/base.types.js +1 -8
- package/dist/esm/datasource/server-side.datasource.js +2 -9
- package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +48 -11
- package/dist/esm/grid-pro.js +3 -20
- package/dist/esm/grid-pro.styles.js +22 -2
- package/dist/esm/grid-pro.template.js +33 -3
- package/dist/grid-pro.api.json +79 -369
- package/dist/grid-pro.d.ts +18 -67
- package/docs/api/grid-pro.genesisgriddatasourceelement.md +0 -3
- package/docs/api/grid-pro.gridprobasedatasource.md +0 -7
- package/docs/api/grid-pro.gridprogenesisdatasource.handleerrors.md +22 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.md +2 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.restartonreconnection.md +11 -0
- package/docs/api/grid-pro.gridprotemplate.md +1 -1
- package/docs/api-report.md +4 -19
- package/package.json +13 -13
- package/dist/dts/datasource/error-handler.dialog.d.ts +0 -3
- package/dist/dts/datasource/error-handler.dialog.d.ts.map +0 -1
- package/dist/esm/datasource/error-handler.dialog.js +0 -114
- package/docs/api/grid-pro.genesisgriddatasourceelement.clearerrors.md +0 -17
- package/docs/api/grid-pro.genesisgriddatasourceelement.handleerrors.md +0 -25
- package/docs/api/grid-pro.genesisgriddatasourceelement.restartonreconnection.md +0 -18
- package/docs/api/grid-pro.gridprobasedatasource.connectedcallback.md +0 -15
- package/docs/api/grid-pro.gridprobasedatasource.connectionsub.md +0 -11
- package/docs/api/grid-pro.gridprobasedatasource.disconnectedcallback.md +0 -15
- package/docs/api/grid-pro.gridprobasedatasource.isdisconnected.md +0 -17
- package/docs/api/grid-pro.gridprobasedatasource.setdisconnected.md +0 -24
- package/docs/api/grid-pro.gridprobasedatasource.subscribetoconnection.md +0 -15
- package/docs/api/grid-pro.gridprobasedatasource.unsubscribefromconnection.md +0 -15
|
@@ -24,6 +24,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
24
24
|
this.applyAsyncFuncName = 'applyTransactionAsync';
|
|
25
25
|
// Cache for rowData array to avoid repeated Array.from() calls
|
|
26
26
|
this.cachedRowArray = [];
|
|
27
|
+
this.restartOnReconnection = true;
|
|
27
28
|
this.keepColDefsOnClearRowData = false;
|
|
28
29
|
this.requiresFullRowDataAndColDefs = true;
|
|
29
30
|
this._lastMoreRows = false;
|
|
@@ -57,6 +58,18 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
57
58
|
return;
|
|
58
59
|
this.init();
|
|
59
60
|
});
|
|
61
|
+
this.connectionSub = this.connect.isConnected$.subscribe((isConnected) => {
|
|
62
|
+
var _a;
|
|
63
|
+
if (isConnected && ((_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.attributes['ds-disconnected'])) {
|
|
64
|
+
this.agGrid.removeAttribute('ds-disconnected');
|
|
65
|
+
if (this.restartOnReconnection) {
|
|
66
|
+
this.reloadResourceData();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (!isConnected) {
|
|
70
|
+
this.agGrid.setAttribute('ds-disconnected', 'ds-disconnected');
|
|
71
|
+
}
|
|
72
|
+
});
|
|
60
73
|
}
|
|
61
74
|
disconnectedCallback() {
|
|
62
75
|
super.disconnectedCallback();
|
|
@@ -129,7 +142,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
129
142
|
});
|
|
130
143
|
return;
|
|
131
144
|
}
|
|
132
|
-
this.handleErrors('Application not connected or invalid resource name, datasource will not work.
|
|
145
|
+
this.handleErrors('Application not connected or invalid resource name, datasource will not work. Falling back to local columnDefs/rowData.');
|
|
133
146
|
});
|
|
134
147
|
}
|
|
135
148
|
/**
|
|
@@ -160,7 +173,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
160
173
|
this.criteriaFromFilters = new Map();
|
|
161
174
|
(_a = this.update) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
162
175
|
this.update = new BehaviorSubject(new Map());
|
|
163
|
-
this.
|
|
176
|
+
this.agGrid.removeAttribute('ds-disconnected');
|
|
164
177
|
// TODO: There may need to be a full destroy path. Datasources need some love!
|
|
165
178
|
this.datasource.destroy();
|
|
166
179
|
}
|
|
@@ -288,7 +301,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
288
301
|
yield ((_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.cacheFilterConfig());
|
|
289
302
|
this.clearRowData(withoutColumnDefs);
|
|
290
303
|
(_c = (_b = this.agGrid) === null || _b === void 0 ? void 0 : _b.gridApi) === null || _c === void 0 ? void 0 : _c.showLoadingOverlay();
|
|
291
|
-
this.
|
|
304
|
+
this.agGrid.removeAttribute('ds-disconnected');
|
|
292
305
|
yield this.loadResourceData(withoutFullInit);
|
|
293
306
|
});
|
|
294
307
|
}
|
|
@@ -304,8 +317,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
304
317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
305
318
|
const requiresMetadataFetch = withFullInit || !this.datasource.initialized;
|
|
306
319
|
try {
|
|
307
|
-
|
|
308
|
-
const initOK = yield this.initializeDatasource(this.datasourceOptions(), requiresMetadataFetch, false);
|
|
320
|
+
const initOK = yield this.datasource.init(this.datasourceOptions(), requiresMetadataFetch, false);
|
|
309
321
|
if (!initOK) {
|
|
310
322
|
logger.debug(`Genesis Datasource init failed for ${this.resourceName}`);
|
|
311
323
|
this.clearRowData();
|
|
@@ -325,8 +337,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
325
337
|
this.dataSub = this.datasource.stream
|
|
326
338
|
.pipe(catchError((err) => {
|
|
327
339
|
var _a;
|
|
328
|
-
|
|
329
|
-
this.handleErrors(((_a = err === null || err === void 0 ? void 0 : err.receivedMessage) === null || _a === void 0 ? void 0 : _a.ERROR) || (err === null || err === void 0 ? void 0 : err.message) || err, 'stream');
|
|
340
|
+
this.handleErrors((_a = err === null || err === void 0 ? void 0 : err.receivedMessage) === null || _a === void 0 ? void 0 : _a.ERROR);
|
|
330
341
|
return EMPTY;
|
|
331
342
|
}))
|
|
332
343
|
.subscribe((result) => {
|
|
@@ -335,11 +346,11 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
335
346
|
const hasRowsCountInResult = 'ROWS_COUNT' in result;
|
|
336
347
|
this._isMoreRowsResult = hasMoreRowsInResult && !hasRowsCountInResult;
|
|
337
348
|
if (result === null || result === void 0 ? void 0 : result.ERROR) {
|
|
338
|
-
this.handleErrors(result.ERROR
|
|
349
|
+
this.handleErrors(result.ERROR);
|
|
339
350
|
}
|
|
340
351
|
const messageType = result.MESSAGE_TYPE;
|
|
341
352
|
if (messageType && messageType === MessageType.LOGOFF_ACK) {
|
|
342
|
-
this.handleErrors(`Genesis datasource for ${this.resourceName} disconnected
|
|
353
|
+
this.handleErrors(`Genesis datasource for ${this.resourceName} disconnected.`);
|
|
343
354
|
this.dataSubWasLoggedOff = true;
|
|
344
355
|
return;
|
|
345
356
|
}
|
|
@@ -370,8 +381,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
370
381
|
message = error.receivedMessage.ERROR;
|
|
371
382
|
}
|
|
372
383
|
logger.error(message);
|
|
373
|
-
|
|
374
|
-
this.handleErrors(message, 'unknown');
|
|
384
|
+
this.handleErrors(message);
|
|
375
385
|
}
|
|
376
386
|
});
|
|
377
387
|
}
|
|
@@ -386,6 +396,30 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
386
396
|
}
|
|
387
397
|
return result.inserts;
|
|
388
398
|
}
|
|
399
|
+
handleErrors(errors) {
|
|
400
|
+
let message;
|
|
401
|
+
if (Array.isArray(errors)) {
|
|
402
|
+
const stringArray = errors.map((item) => {
|
|
403
|
+
if (typeof item === 'string') {
|
|
404
|
+
return item;
|
|
405
|
+
}
|
|
406
|
+
else if (typeof item === 'object' && item !== null && 'TEXT' in item) {
|
|
407
|
+
return item.TEXT;
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
throw new Error('Array contains invalid elements');
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
message = stringArray.join(', ');
|
|
414
|
+
}
|
|
415
|
+
if (this.agGrid) {
|
|
416
|
+
this.agGrid.setAttribute('ds-disconnected', 'ds-disconnected');
|
|
417
|
+
}
|
|
418
|
+
if (message) {
|
|
419
|
+
logger.error(message);
|
|
420
|
+
this.$emit(gridProGenesisDatasourceEventNames.error, { message });
|
|
421
|
+
}
|
|
422
|
+
}
|
|
389
423
|
handleStreamResult(result) {
|
|
390
424
|
if (!result)
|
|
391
425
|
return;
|
|
@@ -540,6 +574,9 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
540
574
|
this.connect.getMoreRows(this._sourceRef);
|
|
541
575
|
}
|
|
542
576
|
};
|
|
577
|
+
__decorate([
|
|
578
|
+
attr({ mode: 'boolean', attribute: 'restart-on-reconnection' })
|
|
579
|
+
], GridProGenesisDatasource.prototype, "restartOnReconnection", void 0);
|
|
543
580
|
__decorate([
|
|
544
581
|
attr({ mode: 'boolean', attribute: 'keep-col-defs-on-clear-row-data' })
|
|
545
582
|
], GridProGenesisDatasource.prototype, "keepColDefsOnClearRowData", void 0);
|
package/dist/esm/grid-pro.js
CHANGED
|
@@ -14,7 +14,6 @@ import { DateEditor, MultiselectEditor, NumberEditor, SelectEditor, StringEditor
|
|
|
14
14
|
import { ActionRenderer, ActionsMenuRenderer, BooleanRenderer, EditableRenderer, StatusPillRenderer, SelectRenderer, } from './cell-renderers';
|
|
15
15
|
import { GridProColumn } from './column';
|
|
16
16
|
import { GridProClientSideDatasource, GridProServerSideDatasource } from './datasource';
|
|
17
|
-
import { baseDatasourceEventNames } from './datasource/base.types';
|
|
18
17
|
import { agThemeFontFaceMap, defaultAgGridFontFace } from './external';
|
|
19
18
|
import { GridProGenesisDatasource, gridProGenesisDatasourceEventNames, } from './grid-pro-genesis-datasource';
|
|
20
19
|
import { DEBOUNCED_RESIZE_TIME, gridProErrorNames, gridProEventNames, } from './grid-pro.definitions';
|
|
@@ -163,14 +162,9 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
163
162
|
return map;
|
|
164
163
|
}, {});
|
|
165
164
|
const hideDataSourceError = this.hideDatasourceError.bind(this);
|
|
166
|
-
this.rootEventsListeners.push({ key: gridProGenesisDatasourceEventNames.dataInit, action: hideDataSourceError }, { key: gridProEventNames.datasourceErrorClose, action: hideDataSourceError },
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
key: baseDatasourceEventNames.error,
|
|
170
|
-
action: this.handleBaseDatasourceError.bind(this),
|
|
171
|
-
}, {
|
|
172
|
-
key: baseDatasourceEventNames.connected,
|
|
173
|
-
action: hideDataSourceError,
|
|
165
|
+
this.rootEventsListeners.push({ key: gridProGenesisDatasourceEventNames.dataInit, action: hideDataSourceError }, { key: gridProEventNames.datasourceErrorClose, action: hideDataSourceError }, {
|
|
166
|
+
key: gridProGenesisDatasourceEventNames.error,
|
|
167
|
+
action: this.handleError.bind(this, gridProErrorNames.datasource),
|
|
174
168
|
});
|
|
175
169
|
}
|
|
176
170
|
/**
|
|
@@ -200,17 +194,6 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
200
194
|
handleError(type, event) {
|
|
201
195
|
this.gridErrorItems = [...this.gridErrorItems, { detail: event.detail, type }];
|
|
202
196
|
}
|
|
203
|
-
handleBaseDatasourceError(event) {
|
|
204
|
-
// Map base datasource errors to grid-pro error format
|
|
205
|
-
const gridProError = {
|
|
206
|
-
detail: { message: event.detail.message },
|
|
207
|
-
type: gridProErrorNames.datasource,
|
|
208
|
-
};
|
|
209
|
-
this.gridErrorItems = [
|
|
210
|
-
...this.gridErrorItems,
|
|
211
|
-
{ detail: gridProError.detail, type: gridProError.type },
|
|
212
|
-
];
|
|
213
|
-
}
|
|
214
197
|
hideDatasourceError() {
|
|
215
198
|
this.gridErrorItems = this.gridErrorItems.filter((item) => item.type !== gridProErrorNames.datasource);
|
|
216
199
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
|
-
import { errorHandlerDialogStyles } from './datasource/error-handler.dialog';
|
|
3
2
|
import { agExternalStockStyles } from './external';
|
|
4
3
|
/**
|
|
5
4
|
* The Grid Pro styles.
|
|
@@ -8,7 +7,6 @@ import { agExternalStockStyles } from './external';
|
|
|
8
7
|
*/
|
|
9
8
|
export const foundationGridProStyles = css `
|
|
10
9
|
${agExternalStockStyles}
|
|
11
|
-
${errorHandlerDialogStyles}
|
|
12
10
|
:host {
|
|
13
11
|
--datasource-error-background-color: var(--neutral-layer-4);
|
|
14
12
|
--datasource-error-background-opacity: 0.5;
|
|
@@ -45,6 +43,28 @@ export const foundationGridProStyles = css `
|
|
|
45
43
|
display: none;
|
|
46
44
|
}
|
|
47
45
|
|
|
46
|
+
.grid-datasource-error-dialog::part(dialog) {
|
|
47
|
+
position: absolute;
|
|
48
|
+
z-index: 2;
|
|
49
|
+
max-width: var(--datasource-error-dialog-max-width);
|
|
50
|
+
|
|
51
|
+
--dialog-min-width: var(--datasource-error-dialog-min-width);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.grid-datasource-error-dialog::before {
|
|
55
|
+
content: '';
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 50%;
|
|
58
|
+
transform: translateY(-50%);
|
|
59
|
+
left: 0;
|
|
60
|
+
height: 100%;
|
|
61
|
+
width: 100%;
|
|
62
|
+
border-radius: 2px;
|
|
63
|
+
background-color: var(--datasource-error-background-color);
|
|
64
|
+
opacity: var(--datasource-error-background-opacity);
|
|
65
|
+
z-index: 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
48
68
|
.error {
|
|
49
69
|
border-color: var(--error-color) !important;
|
|
50
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html, ref } from '@microsoft/fast-element';
|
|
2
|
-
import {
|
|
2
|
+
import { gridProErrorNames } from './grid-pro.definitions';
|
|
3
3
|
/**
|
|
4
4
|
* Get a Design System prefixed The Grid Pro template.
|
|
5
5
|
* @param prefix - The design system prefix to use. Defaults to 'foundation'.
|
|
@@ -12,13 +12,43 @@ export const getGridProTemplate = (prefix = 'foundation') => html `
|
|
|
12
12
|
<slot name="grid" ${ref('gridSlot')}></slot>
|
|
13
13
|
<slot></slot>
|
|
14
14
|
</span>
|
|
15
|
-
|
|
15
|
+
<slot
|
|
16
|
+
name="grid-datasource-error"
|
|
17
|
+
part="grid-datasource-error"
|
|
18
|
+
class="${(x) => (x.gridErrorItems.filter(({ type }) => type === gridProErrorNames.datasource).length > 0 ? '' : 'hidden')}"
|
|
19
|
+
>
|
|
20
|
+
<${prefix}-dialog
|
|
21
|
+
class="grid-datasource-error-dialog"
|
|
22
|
+
type="error"
|
|
23
|
+
show-close-icon="false"
|
|
24
|
+
open
|
|
25
|
+
>
|
|
26
|
+
<h2 slot="top" class="title">Component unavailable</h2>
|
|
27
|
+
<p>
|
|
28
|
+
Please refresh to reconnect.
|
|
29
|
+
It is recommended that you save your data before refreshing.
|
|
30
|
+
Data is not current and may be incomplete.
|
|
31
|
+
</p>
|
|
32
|
+
<div slot="bottom">
|
|
33
|
+
<${prefix}-button
|
|
34
|
+
appearance="lightweight"
|
|
35
|
+
@click=${(x) => {
|
|
36
|
+
var _a;
|
|
37
|
+
x.hideDatasourceError();
|
|
38
|
+
(_a = x.gridProDatasource) === null || _a === void 0 ? void 0 : _a.restart();
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
Refresh
|
|
42
|
+
</${prefix}-button>
|
|
43
|
+
</div>
|
|
44
|
+
</${prefix}-dialog>
|
|
45
|
+
</slot>
|
|
16
46
|
</template>
|
|
17
47
|
`;
|
|
18
48
|
/**
|
|
19
49
|
*
|
|
20
50
|
* @public
|
|
21
51
|
* @remarks
|
|
22
|
-
* HTML Element:
|
|
52
|
+
* HTML Element: \<foundation-grid-pro\>
|
|
23
53
|
*/
|
|
24
54
|
export const gridProTemplate = getGridProTemplate();
|