@genesislcap/grid-pro 14.200.1-alpha-eb310c6.0 → 14.201.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.
Files changed (44) hide show
  1. package/README.md +111 -117
  2. package/dist/custom-elements.json +841 -2743
  3. package/dist/dts/datasource/base.datasource.d.ts +6 -22
  4. package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
  5. package/dist/dts/datasource/server-side.datasource.d.ts +83 -27
  6. package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
  7. package/dist/dts/datasource/server-side.grid-definitions.d.ts.map +1 -1
  8. package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts +13 -13
  9. package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
  10. package/dist/dts/grid-pro.d.ts +2 -16
  11. package/dist/dts/grid-pro.d.ts.map +1 -1
  12. package/dist/esm/datasource/base.datasource.js +9 -79
  13. package/dist/esm/datasource/client-side.grid-definitions.js +1 -1
  14. package/dist/esm/datasource/server-side.datasource.js +396 -220
  15. package/dist/esm/datasource/server-side.grid-definitions.js +7 -42
  16. package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +61 -55
  17. package/dist/esm/grid-pro.js +4 -7
  18. package/dist/grid-pro.api.json +142 -21
  19. package/dist/grid-pro.d.ts +112 -77
  20. package/docs/api/grid-pro.gridpro.addeventlistener.md +2 -2
  21. package/docs/api/grid-pro.gridpro.md +1 -1
  22. package/docs/api/{grid-pro.gridprogenesisdatasource.destroy.md → grid-pro.gridprogenesisdatasource.auth.md} +3 -9
  23. package/docs/api/grid-pro.gridprogenesisdatasource.datasource.md +11 -0
  24. package/docs/api/grid-pro.gridprogenesisdatasource.deinit.md +0 -5
  25. package/docs/api/grid-pro.gridprogenesisdatasource.disablepolling.md +11 -0
  26. package/docs/api/grid-pro.gridprogenesisdatasource.handleerrors.md +2 -2
  27. package/docs/api/grid-pro.gridprogenesisdatasource.md +6 -2
  28. package/docs/api/grid-pro.gridprogenesisdatasource.pollinginterval.md +11 -0
  29. package/docs/api/grid-pro.gridprogenesisdatasource.request.md +11 -0
  30. package/docs/api/grid-pro.gridprogenesisdatasource.reset.md +1 -1
  31. package/docs/api-report.md +68 -19
  32. package/package.json +13 -13
  33. package/dist/dts/datasource/base.types.d.ts +0 -22
  34. package/dist/dts/datasource/base.types.d.ts.map +0 -1
  35. package/dist/dts/datasource/server-side.resource-base.d.ts +0 -55
  36. package/dist/dts/datasource/server-side.resource-base.d.ts.map +0 -1
  37. package/dist/dts/datasource/server-side.resource-dataserver.d.ts +0 -20
  38. package/dist/dts/datasource/server-side.resource-dataserver.d.ts.map +0 -1
  39. package/dist/dts/datasource/server-side.resource-reqrep.d.ts +0 -17
  40. package/dist/dts/datasource/server-side.resource-reqrep.d.ts.map +0 -1
  41. package/dist/esm/datasource/base.types.js +0 -1
  42. package/dist/esm/datasource/server-side.resource-base.js +0 -285
  43. package/dist/esm/datasource/server-side.resource-dataserver.js +0 -132
  44. package/dist/esm/datasource/server-side.resource-reqrep.js +0 -131
@@ -1,132 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { logger, MessageType, dataServerResultFilter, } from '@genesislcap/foundation-comms';
3
- import { DOM } from '@microsoft/fast-element';
4
- import { BaseServerSideDatasource } from './server-side.resource-base';
5
- /**
6
- * The DATASERVER IServerSideDatasource implementation, used for SSRM (Server-Side Row Model) in the grid.
7
- * @alpha
8
- */
9
- export class DataserverServerSideDatasource extends BaseServerSideDatasource {
10
- constructor(options) {
11
- super(options);
12
- this.createDataserverStreamFunc = options.createDataserverStreamFunc;
13
- }
14
- refreshDatasource(params) {
15
- const _super = Object.create(null, {
16
- refreshDatasource: { get: () => super.refreshDatasource }
17
- });
18
- return __awaiter(this, void 0, void 0, function* () {
19
- this.dataserverStreamSubscription.unsubscribe();
20
- this.dataserverStreamSubscription = undefined;
21
- yield _super.refreshDatasource.call(this, params);
22
- });
23
- }
24
- getRows(params) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- yield this.setupFilteringAndSorting(params);
27
- if (this.pagination && !this.isNewPageSize && this.currentSequenceId > 0) {
28
- params.success(this.lastSuccessRowData);
29
- return;
30
- }
31
- if (!this.dataserverStream) {
32
- this.dataserverStream = yield this.createDataserverStreamFunc(this.resourceParams);
33
- }
34
- if (this.currentSequenceId >= 1 &&
35
- (this.moreRows ||
36
- params.request.startRow >= Number(this.maxRows) ||
37
- params.request.startRow === 0)) {
38
- if (this.pagination) {
39
- this.resourceParams.VIEW_NUMBER = this.getPageNumber(params.request.startRow, this.maxRows, this.maxView, this.zeroBasedViewNumber);
40
- // if (this.resourceParams.VIEW_NUMBER === 1) {
41
- // await this.refreshDatasource(params);
42
- // return;
43
- // }
44
- }
45
- this.connect.getMoreRows(this.sourceRef, this.resourceParams.VIEW_NUMBER);
46
- }
47
- let applyResult = true;
48
- this.dataserverStreamSubscription = this.dataserverStream.subscribe((dataserverResult) => {
49
- if (applyResult) {
50
- DOM.queueUpdate(() => __awaiter(this, void 0, void 0, function* () {
51
- if (this.resourceParams.CRITERIA_MATCH) {
52
- const updatedInfo = yield this.connect.snapshot(this.resourceName, {
53
- MAX_ROWS: this.maxView,
54
- MAX_VIEW: this.maxView,
55
- CRITERIA_MATCH: this.resourceParams.CRITERIA_MATCH,
56
- });
57
- if (!updatedInfo.ROW && !updatedInfo.ROWS_COUNT) {
58
- logger.warn('No data returned when criteria is applied.');
59
- this.serverRowsCount = 0;
60
- this.clientRowsCount = 0;
61
- }
62
- else {
63
- this.serverRowsCount = this.resourceParams.CRITERIA_MATCH
64
- ? updatedInfo.ROW.length
65
- : updatedInfo.ROWS_COUNT;
66
- }
67
- }
68
- this.applyServerSideData(params, dataserverResult);
69
- applyResult = false;
70
- }));
71
- }
72
- });
73
- });
74
- }
75
- applyServerSideData(params, result) {
76
- var _a;
77
- const messageType = result.MESSAGE_TYPE;
78
- if (messageType &&
79
- (messageType === MessageType.LOGOFF_ACK || messageType === MessageType.MSG_NACK)) {
80
- params.fail();
81
- return;
82
- }
83
- this.moreRows = result.MORE_ROWS;
84
- if (result.ROW) {
85
- const nextMessage = dataServerResultFilter(result);
86
- this.handleCurrentStreamLoad(nextMessage);
87
- }
88
- else {
89
- this.rowData = new Map();
90
- const successRowData = { rowData: [] };
91
- successRowData.rowCount = 0;
92
- params.success(successRowData);
93
- return;
94
- }
95
- this.currentSequenceId = result.SEQUENCE_ID;
96
- if (this.currentSequenceId === 1) {
97
- this.sourceRef = result.SOURCE_REF;
98
- if (this.serverRowsCount === 0) {
99
- this.serverRowsCount = (_a = result.ROWS_COUNT) !== null && _a !== void 0 ? _a : this.rowData.size;
100
- }
101
- }
102
- const successRowData = {
103
- rowData: Array.from(this.rowData.values()),
104
- };
105
- successRowData.rowCount = this.getCorrectRowCount(params);
106
- this.lastSuccessRowData = successRowData;
107
- params.success(successRowData);
108
- }
109
- destroy() {
110
- const _super = Object.create(null, {
111
- destroy: { get: () => super.destroy }
112
- });
113
- var _a;
114
- return __awaiter(this, void 0, void 0, function* () {
115
- this.dataserverStream = undefined;
116
- (_a = this.dataserverStreamSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
117
- this.dataserverStreamSubscription = undefined;
118
- yield _super.destroy.call(this);
119
- });
120
- }
121
- handleCurrentStreamLoad(result) {
122
- var _a, _b;
123
- if (!result)
124
- return;
125
- const rows = new Map();
126
- (_a = result.inserts) === null || _a === void 0 ? void 0 : _a.forEach((insertData) => {
127
- rows.set(insertData[this.rowId], insertData);
128
- });
129
- this.clientRowsCount += (_b = result.inserts.length) !== null && _b !== void 0 ? _b : 0;
130
- this.rowData = rows;
131
- }
132
- }
@@ -1,131 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { MessageType, } from '@genesislcap/foundation-comms';
3
- import { logger } from '../utils';
4
- import { BaseServerSideDatasource } from './server-side.resource-base';
5
- /**
6
- * The REQUEST_SERVER IServerSideDatasource implementation, used for SSRM (Server-Side Row Model) in the grid.
7
- * @alpha
8
- */
9
- export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
10
- constructor(options) {
11
- var _a;
12
- super(options);
13
- this.createReqRepRequestFunc = options.createReqRepRequestFunc;
14
- if (!((_a = options.resourceParams) === null || _a === void 0 ? void 0 : _a.VIEW_NUMBER)) {
15
- this.resourceParams.VIEW_NUMBER = this.zeroBasedViewNumber ? 0 : 1;
16
- }
17
- }
18
- getRows(params) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- yield this.setupFilteringAndSorting(params);
21
- if (this.pagination && !this.isNewPageSize && this.currentSequenceId > 0) {
22
- params.success(this.lastSuccessRowData);
23
- return;
24
- }
25
- if (this.currentSequenceId !== null && this.currentSequenceId >= 0 && this.moreRows) {
26
- if (this.pagination) {
27
- this.resourceParams.VIEW_NUMBER = this.getPageNumber(params.request.startRow, this.maxRows, this.maxView);
28
- }
29
- else {
30
- this.resourceParams.VIEW_NUMBER += 1;
31
- }
32
- }
33
- const requestParams = {
34
- DETAILS: {
35
- CRITERIA_MATCH: this.resourceParams.CRITERIA_MATCH,
36
- MAX_ROWS: this.resourceParams.MAX_ROWS,
37
- VIEW_NUMBER: this.resourceParams.VIEW_NUMBER,
38
- },
39
- };
40
- const requestResult = yield this.createReqRepRequestFunc(requestParams);
41
- // TODO: massive limitation on the GSF. It should return -1 if it's already the last view (but it doesn't, next will have 0 rows then the NEXT_VIEW=-1).
42
- let isLastView = false;
43
- if (requestResult.NEXT_VIEW !== -1) {
44
- const preCheckRequestParams = Object.assign(Object.assign({}, requestParams), { DETAILS: Object.assign(Object.assign({}, requestParams.DETAILS), { VIEW_NUMBER: requestResult.NEXT_VIEW }) });
45
- const moreRowsPreCheck = yield this.createReqRepRequestFunc(preCheckRequestParams);
46
- isLastView = moreRowsPreCheck.NEXT_VIEW === -1;
47
- }
48
- let applyResult = true;
49
- if (applyResult) {
50
- this.applyServerSideData(params, requestResult, isLastView);
51
- applyResult = false;
52
- }
53
- });
54
- }
55
- applyServerSideData(params, result, isLastView) {
56
- var _a;
57
- const messageType = result.MESSAGE_TYPE;
58
- if (messageType &&
59
- (messageType === MessageType.LOGOFF_ACK || messageType === MessageType.MSG_NACK)) {
60
- params.fail();
61
- return;
62
- }
63
- this.moreRows =
64
- !isLastView && result.NEXT_VIEW !== -1 && result.NEXT_VIEW > this.resourceParams.VIEW_NUMBER;
65
- if (result.REPLY) {
66
- this.handleCurrentStreamLoad(result.REPLY);
67
- }
68
- else {
69
- this.rowData = new Map();
70
- const successRowData = { rowData: [] };
71
- successRowData.rowCount = 0;
72
- params.success(successRowData);
73
- return;
74
- }
75
- this.currentSequenceId = this.resourceParams.VIEW_NUMBER; // result.NEXT_VIEW > 0 ? result.NEXT_VIEW - 1 : 0;
76
- this.sourceRef = result.SOURCE_REF;
77
- this.serverRowsCount += (_a = result.ROWS_COUNT) !== null && _a !== void 0 ? _a : this.rowData.size;
78
- const successRowData = {
79
- rowData: Array.from(this.rowData.values()),
80
- };
81
- successRowData.rowCount = this.getCorrectRowCount(params);
82
- this.lastSuccessRowData = successRowData;
83
- params.success(successRowData);
84
- }
85
- getCorrectRowCount(params) {
86
- const lastRow = this.moreRows ? -1 : params.request.startRow + this.serverRowsCount;
87
- const currentLastRowNumber = params.request.endRow;
88
- this.calculatedRowsCount = this.serverRowsCount || currentLastRowNumber;
89
- const defaultCount = Math.min(lastRow, this.maxView);
90
- let rowCount;
91
- if (this.pagination) {
92
- rowCount = !this.resourceParams.CRITERIA_MATCH ? Math.min(lastRow, this.maxView) : undefined;
93
- if (this.resourceParams.CRITERIA_MATCH) {
94
- rowCount = defaultCount;
95
- }
96
- if (!this.moreRows && lastRow > this.calculatedRowsCount) {
97
- rowCount = this.calculatedRowsCount;
98
- }
99
- return rowCount;
100
- }
101
- if (currentLastRowNumber === lastRow) {
102
- rowCount = lastRow;
103
- }
104
- else if (currentLastRowNumber > this.maxView ||
105
- currentLastRowNumber > this.calculatedRowsCount) {
106
- rowCount = Math.min(defaultCount, this.calculatedRowsCount);
107
- }
108
- else if (!this.moreRows && lastRow > this.calculatedRowsCount) {
109
- rowCount = this.calculatedRowsCount;
110
- }
111
- return rowCount;
112
- }
113
- handleCurrentStreamLoad(reply) {
114
- if (!reply || reply.length == 0)
115
- return;
116
- const rows = new Map();
117
- reply.forEach((insertData) => {
118
- const insertDataRowId = insertData[this.rowId];
119
- if (insertDataRowId) {
120
- rows.set(insertDataRowId, insertData);
121
- return;
122
- }
123
- const noRowIdMessage = `The specified rowId (${this.rowId}) is not present in the data. Since this is a snapshot (isSnapshot=true), an auto-generated UUID will be used. For custom identifiers, use the 'row-id' attribute.`;
124
- logger.error(noRowIdMessage);
125
- const tempId = this.uuid.createId();
126
- insertData[this.rowId] = tempId;
127
- rows.set(tempId, insertData);
128
- });
129
- this.rowData = rows;
130
- }
131
- }