@genesislcap/grid-pro 14.348.0 → 14.350.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 +2293 -1443
- package/dist/dts/cell-renderers/boolean.renderer.d.ts.map +1 -1
- package/dist/dts/datasource/base.datasource.d.ts +20 -15
- package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/index.d.ts +1 -0
- package/dist/dts/datasource/index.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.datasource.d.ts +9 -9
- package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro-genesis-datasource/datasource-events.types.d.ts +101 -0
- package/dist/dts/grid-pro-genesis-datasource/datasource-events.types.d.ts.map +1 -0
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts +24 -9
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro-v34.d.ts +862 -0
- package/dist/dts/grid-pro-v34.d.ts.map +1 -0
- package/dist/dts/grid-pro.d.ts +88 -1
- package/dist/dts/grid-pro.d.ts.map +1 -1
- package/dist/dts/grid-pro.definitions.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/status-bar-components/label-value.status-bar.d.ts +1 -1
- package/dist/dts/status-bar-components/label-value.status-bar.d.ts.map +1 -1
- package/dist/dts/status-bar-components/load-more.status-bar.d.ts +1 -1
- package/dist/dts/status-bar-components/load-more.status-bar.d.ts.map +1 -1
- package/dist/dts/status-bar-components/pagination.status-bar.d.ts +1 -1
- package/dist/dts/status-bar-components/pagination.status-bar.d.ts.map +1 -1
- package/dist/dts/status-bar-components/reload.status-bar.d.ts +1 -1
- package/dist/dts/status-bar-components/reload.status-bar.d.ts.map +1 -1
- package/dist/esm/cell-renderers/boolean.renderer.js +6 -7
- package/dist/esm/datasource/base.datasource.js +68 -95
- package/dist/esm/datasource/index.js +1 -0
- package/dist/esm/datasource/server-side.datasource.js +127 -149
- package/dist/esm/grid-pro-genesis-datasource/datasource-events.types.js +33 -0
- package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +83 -78
- package/dist/esm/grid-pro-v34.js +1034 -0
- package/dist/esm/grid-pro.definitions.js +1 -1
- package/dist/esm/grid-pro.js +283 -8
- package/dist/esm/grid-pro.template.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/status-bar-components/pagination.status-bar.js +18 -11
- package/dist/grid-pro.api.json +3188 -698
- package/dist/grid-pro.d.ts +1171 -118
- package/docs/api/grid-pro.errorhandlerdialogstyles.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.md +0 -21
- package/docs/api/grid-pro.geterrorhandlerdialogtemplate.md +64 -0
- package/docs/api/grid-pro.gridpro.md +17 -0
- package/docs/api/grid-pro.gridpro.thememode.md +11 -0
- package/docs/api/{grid-pro.gridprobasedatasource.applyallagtransactions.md → grid-pro.gridprobasedatasource.applyalltransactions.md} +3 -3
- package/docs/api/grid-pro.gridprobasedatasource.applytransaction.md +3 -3
- package/docs/api/grid-pro.gridprobasedatasource.getdatasourcestatusbarpanels.md +15 -1
- package/docs/api/grid-pro.gridprobasedatasource.isdisconnected.md +1 -1
- package/docs/api/{grid-pro.gridprobasedatasource.agtransaction.md → grid-pro.gridprobasedatasource.keepcoldefsonclearrowdata.md} +3 -3
- package/docs/api/grid-pro.gridprobasedatasource.md +17 -55
- package/docs/api/grid-pro.gridprobasedatasource.pagination.md +1 -1
- package/docs/api/grid-pro.gridprobasedatasource.setdisconnected.md +1 -1
- package/docs/api/{grid-pro.gridprobasedatasource.applyfuncname.md → grid-pro.gridprobasedatasource.transactiondata.md} +3 -3
- package/docs/api/grid-pro.gridprogenesisdatasource.applytransaction.md +4 -4
- package/docs/api/grid-pro.gridprogenesisdatasource.init.md +4 -20
- package/docs/api/grid-pro.gridprogenesisdatasource.md +7 -34
- package/docs/api/{grid-pro.gridprogenesisdatasource.applyfuncname.md → grid-pro.gridprogenesisdatasource.transactiondata.md} +3 -3
- package/docs/api/grid-pro.gridproserversidedatasource.applytransaction.md +4 -4
- package/docs/api/grid-pro.gridproserversidedatasource.md +1 -74
- package/docs/api/grid-pro.gridproserversidedatasource.onpaginationchanged.md +2 -2
- package/docs/api/{grid-pro.gridproserversidedatasource.rowmodel.md → grid-pro.gridprov34._constructor_.md} +5 -3
- package/docs/api/grid-pro.gridprov34.addeventlistener.md +89 -0
- package/docs/api/{grid-pro.gridproserversidedatasource.applyfuncname.md → grid-pro.gridprov34.aggrid.md} +3 -3
- package/docs/api/{grid-pro.gridproserversidedatasource.applyasyncfuncname.md → grid-pro.gridprov34.aggridoptions.md} +3 -3
- package/docs/api/grid-pro.gridprov34.autocellrendererbytype.md +14 -0
- package/docs/api/grid-pro.gridprov34.cachefilterconfig.md +18 -0
- package/docs/api/grid-pro.gridprov34.classnames.md +14 -0
- package/docs/api/grid-pro.gridprov34.clearlocalgridoptions.md +17 -0
- package/docs/api/grid-pro.gridprov34.columncomponentname.md +14 -0
- package/docs/api/grid-pro.gridprov34.combineallgridcomponents.md +53 -0
- package/docs/api/grid-pro.gridprov34.connectedcallback.md +18 -0
- package/docs/api/grid-pro.gridprov34.customerrorhandlertemplate.md +21 -0
- package/docs/api/grid-pro.gridprov34.disconnectedcallback.md +18 -0
- package/docs/api/grid-pro.gridprov34.enablecellflashing.md +21 -0
- package/docs/api/grid-pro.gridprov34.enablerowflashing.md +16 -0
- package/docs/api/grid-pro.gridprov34.eventsandcallbacks.md +14 -0
- package/docs/api/grid-pro.gridprov34.getfiltermodel.md +20 -0
- package/docs/api/grid-pro.gridprov34.getsavedcolumnstate.md +21 -0
- package/docs/api/grid-pro.gridprov34.getselectedrows.md +19 -0
- package/docs/api/{grid-pro.gridproserversidedatasource.applytransactionasync.md → grid-pro.gridprov34.globaleventlistener.md} +7 -9
- package/docs/api/grid-pro.gridprov34.gridapi.md +14 -0
- package/docs/api/grid-pro.gridprov34.gridautosizingenabled.md +16 -0
- package/docs/api/grid-pro.gridprov34.gridcomponents.md +16 -0
- package/docs/api/grid-pro.gridprov34.griderroritems.md +14 -0
- package/docs/api/grid-pro.gridprov34.gridoptions.md +14 -0
- package/docs/api/grid-pro.gridprov34.gridoptionsconfig.md +28 -0
- package/docs/api/grid-pro.gridprov34.gridparams.md +12 -0
- package/docs/api/grid-pro.gridprov34.gridprodatasource.md +18 -0
- package/docs/api/grid-pro.gridprov34.gridslot.md +14 -0
- package/docs/api/grid-pro.gridprov34.hasselectedrows.md +19 -0
- package/docs/api/grid-pro.gridprov34.headercasetype.md +18 -0
- package/docs/api/grid-pro.gridprov34.headerheight.md +14 -0
- package/docs/api/grid-pro.gridprov34.hidedatasourceerror.md +18 -0
- package/docs/api/grid-pro.gridprov34.initialised.md +14 -0
- package/docs/api/grid-pro.gridprov34.isserverside.md +12 -0
- package/docs/api/grid-pro.gridprov34.md +1008 -0
- package/docs/api/grid-pro.gridprov34.mergeallcolumndefsandstates.md +230 -0
- package/docs/api/grid-pro.gridprov34.onlytemplatecoldefs.md +14 -0
- package/docs/api/grid-pro.gridprov34.pagination.md +21 -0
- package/docs/api/grid-pro.gridprov34.paginationpagesize.md +25 -0
- package/docs/api/grid-pro.gridprov34.persistcolumnstatekey.md +16 -0
- package/docs/api/grid-pro.gridprov34.persistfiltermodelkey.md +16 -0
- package/docs/api/grid-pro.gridprov34.provider.md +14 -0
- package/docs/api/grid-pro.gridprov34.restorecachedfilterconfig.md +18 -0
- package/docs/api/grid-pro.gridprov34.rowdata.md +18 -0
- package/docs/api/grid-pro.gridprov34.rowdatachanged.md +67 -0
- package/docs/api/grid-pro.gridprov34.rowheight.md +14 -0
- package/docs/api/grid-pro.gridprov34.setfiltermodel.md +55 -0
- package/docs/api/grid-pro.gridprov34.setuppaginationandstatusbar.md +53 -0
- package/docs/api/grid-pro.gridprov34.statepersistanceenabled.md +18 -0
- package/docs/api/grid-pro.gridprov34.statepersistence.md +14 -0
- package/docs/api/grid-pro.gridprov34.statusbarconfig.md +21 -0
- package/docs/api/grid-pro.gridprov34.thememode.md +14 -0
- package/docs/api/grid-pro.gridprov34.withstatusbar.md +21 -0
- package/docs/api/grid-pro.md +29 -1
- package/docs/api-report.md.api.md +377 -41
- package/package.json +16 -14
- package/docs/api/grid-pro.genesisgriddatasourceelement.aggrid.md +0 -11
- package/docs/api/grid-pro.gridprobasedatasource.applyasyncfuncname.md +0 -11
- package/docs/api/grid-pro.gridprobasedatasource.applytransactionasync.md +0 -66
- package/docs/api/grid-pro.gridprogenesisdatasource.applyasyncfuncname.md +0 -11
- package/docs/api/grid-pro.gridprogenesisdatasource.applytransactionasync.md +0 -66
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
|
-
import { Events, } from '@ag-grid-community/core';
|
|
3
2
|
import { dataServerResultFilter, MessageType, normaliseCriteria, ResourceType, toFieldMetadata, } from '@genesislcap/foundation-comms';
|
|
4
3
|
import { LifecycleMixin, insertDocumentCSSRule } from '@genesislcap/foundation-utils';
|
|
5
4
|
import { attr, customElement, DOM, observable } from '@microsoft/fast-element';
|
|
6
5
|
import { gridProGenesisDatasourceEventNames } from '../grid-pro-genesis-datasource';
|
|
6
|
+
import { datasourceEventNames, } from '../grid-pro-genesis-datasource/datasource-events.types';
|
|
7
7
|
import { logger } from '../utils';
|
|
8
8
|
import { GridProBaseDatasource } from './base.datasource';
|
|
9
9
|
import { getServerSideFilterParamsByFieldType } from './server-side.grid-definitions';
|
|
@@ -20,15 +20,15 @@ const serverSideSortIndicatorCSS = `
|
|
|
20
20
|
opacity: 1 !important;
|
|
21
21
|
visibility: visible !important;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
.grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-container {
|
|
25
25
|
opacity: 0.4 !important;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
.grid-pro-server-side .ag-header-cell-sorted .ag-sort-indicator-container {
|
|
29
29
|
opacity: 1 !important;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
.grid-pro-server-side .ag-sort-ascending-icon::before,
|
|
33
33
|
.grid-pro-server-side .ag-sort-descending-icon::before,
|
|
34
34
|
.grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-icon::before {
|
|
@@ -36,20 +36,20 @@ const serverSideSortIndicatorCSS = `
|
|
|
36
36
|
font-size: var(--ag-icon-size, 16px) !important;
|
|
37
37
|
color: var(--ag-header-foreground-color, var(--ag-foreground-color)) !important;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
.grid-pro-server-side .ag-sort-ascending-icon::before {
|
|
41
41
|
content: "\\e90d" !important; /* AG Grid sort up icon */
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
.grid-pro-server-side .ag-sort-descending-icon::before {
|
|
45
45
|
content: "\\e90c" !important; /* AG Grid sort down icon */
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
.grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-icon::before {
|
|
49
49
|
content: "\\e90b" !important; /* AG Grid sort icon */
|
|
50
50
|
opacity: 0.6 !important;
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
/* Ensure the sort indicator is always visible for sortable columns in server-side mode */
|
|
54
54
|
.grid-pro-server-side .ag-header-cell-sortable .ag-sort-indicator-icon {
|
|
55
55
|
display: inline-block !important;
|
|
@@ -68,8 +68,6 @@ const serverSideSortIndicatorCSS = `
|
|
|
68
68
|
let GridProServerSideDatasource = class GridProServerSideDatasource extends LifecycleMixin(GridProBaseDatasource) {
|
|
69
69
|
constructor() {
|
|
70
70
|
super(...arguments);
|
|
71
|
-
this.applyFuncName = 'applyServerSideTransaction';
|
|
72
|
-
this.applyAsyncFuncName = 'applyServerSideTransactionAsync';
|
|
73
71
|
/**
|
|
74
72
|
* The starting VIEW_NUMBER of the data to be fetched.
|
|
75
73
|
* @remarks The VIEW_NUMBER isincremented by the grid as the user scrolls or changes pages.
|
|
@@ -131,20 +129,22 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
131
129
|
*/
|
|
132
130
|
reloadResourceData(params) {
|
|
133
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
var _a
|
|
132
|
+
var _a;
|
|
135
133
|
this.datasource.destroy();
|
|
136
134
|
(_a = this.liveUpdatesStream) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
137
135
|
this.liveUpdatesStream = undefined;
|
|
138
|
-
//
|
|
139
|
-
|
|
136
|
+
// Emit event to cache current filter model before clearing data
|
|
137
|
+
this.$emit(datasourceEventNames.cacheFilterConfig);
|
|
140
138
|
this.clearRowData(withoutColumnDefs);
|
|
141
139
|
this.setDisconnected(false);
|
|
142
|
-
|
|
140
|
+
// Emit event to refresh server side with purge
|
|
141
|
+
this.$emit(datasourceEventNames.refreshServerSide, { purge: true });
|
|
143
142
|
if (params) {
|
|
144
143
|
const options = Object.assign(Object.assign({}, this.datasourceOptions()), params);
|
|
145
144
|
const initOK = yield this.initializeDatasource(options, true, false);
|
|
146
145
|
if (!initOK) {
|
|
147
|
-
|
|
146
|
+
// Emit event to set server side datasource to null
|
|
147
|
+
this.$emit(datasourceEventNames.setServerSideDatasource, { datasource: null });
|
|
148
148
|
logger.error('Genesis Datasource re-init failed on filtering/sorting.');
|
|
149
149
|
}
|
|
150
150
|
}
|
|
@@ -153,8 +153,9 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
153
153
|
yield this.ssrmDatasource.destroy();
|
|
154
154
|
this.ssrmDatasource = undefined;
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
(
|
|
156
|
+
// Emit events instead of direct grid access
|
|
157
|
+
this.$emit(datasourceEventNames.setServerSideDatasource, { datasource: null });
|
|
158
|
+
this.$emit(datasourceEventNames.loadingStarted);
|
|
158
159
|
yield this.init();
|
|
159
160
|
}
|
|
160
161
|
});
|
|
@@ -164,17 +165,10 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
164
165
|
* @internal
|
|
165
166
|
*/
|
|
166
167
|
applyServerSideSortIndicatorStyling() {
|
|
167
|
-
var _a, _b;
|
|
168
168
|
// Remove existing styling if present
|
|
169
169
|
this.removeServerSideSortIndicatorStyling();
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
// Add CSS class to grid element
|
|
173
|
-
const gridElement = ((_b = this.agGrid.gridSlot) === null || _b === void 0 ? void 0 : _b.parentElement) || this.agGrid;
|
|
174
|
-
if (gridElement) {
|
|
175
|
-
gridElement.classList.add('grid-pro-server-side');
|
|
176
|
-
}
|
|
177
|
-
}
|
|
170
|
+
// Emit event to add CSS class to grid element
|
|
171
|
+
this.$emit(datasourceEventNames.addGridCssClass, { className: 'grid-pro-server-side' });
|
|
178
172
|
// Insert custom CSS rules
|
|
179
173
|
this.sortIndicatorCSSDestroy = insertDocumentCSSRule(serverSideSortIndicatorCSS, 'grid-pro-server-side-sort');
|
|
180
174
|
}
|
|
@@ -183,12 +177,8 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
183
177
|
* @internal
|
|
184
178
|
*/
|
|
185
179
|
removeServerSideSortIndicatorStyling() {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const gridElement = ((_b = (_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.gridSlot) === null || _b === void 0 ? void 0 : _b.parentElement) || this.agGrid;
|
|
189
|
-
if (gridElement) {
|
|
190
|
-
gridElement.classList.remove('grid-pro-server-side');
|
|
191
|
-
}
|
|
180
|
+
// Emit event to remove CSS class from grid element
|
|
181
|
+
this.$emit(datasourceEventNames.removeGridCssClass, { className: 'grid-pro-server-side' });
|
|
192
182
|
// Remove custom CSS rules
|
|
193
183
|
if (this.sortIndicatorCSSDestroy) {
|
|
194
184
|
this.sortIndicatorCSSDestroy();
|
|
@@ -197,93 +187,105 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
197
187
|
}
|
|
198
188
|
init() {
|
|
199
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
return String(params.data[this.rowId]);
|
|
206
|
-
}, getRowStyle(params) {
|
|
207
|
-
var _a, _b;
|
|
208
|
-
if ((_b = (_a = params.data) === null || _a === void 0 ? void 0 : _a.ROW_REF) === null || _b === void 0 ? void 0 : _b.includes('_deleted')) {
|
|
209
|
-
return { color: 'grey' };
|
|
210
|
-
}
|
|
211
|
-
}, cacheBlockSize: this.maxRows, defaultColDef: {
|
|
212
|
-
filter: true,
|
|
213
|
-
resizable: true,
|
|
214
|
-
sortable: false,
|
|
215
|
-
unSortIcon: true,
|
|
216
|
-
}, rowBuffer: 0, rowModelType: 'serverSide', suppressServerSideInfiniteScroll: false, suppressMultiSort: true, onFilterChanged: (params) => { }, onSortChanged: (params) => { }, onPaginationChanged: (event) => this.onPaginationChanged(event) }, this.agGrid['agGridOptions']), this.deferredGridOptions);
|
|
217
|
-
this.agGrid.gridOptions = gridOptions;
|
|
218
|
-
this.agGrid['initGrid']();
|
|
219
|
-
this.agGrid.addEventListener(Events.EVENT_GRID_READY, () => __awaiter(this, void 0, void 0, function* () {
|
|
220
|
-
const initOK = yield this.initializeDatasource(this.datasourceOptions(), true, false);
|
|
221
|
-
if (!initOK) {
|
|
222
|
-
logger.debug(`Genesis Datasource init failed for ${this.resourceName}`);
|
|
223
|
-
this.clearRowData();
|
|
224
|
-
this.setDisconnected(true);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
this.$emit(gridProGenesisDatasourceEventNames.dataInit);
|
|
228
|
-
this.setDisconnected(false);
|
|
229
|
-
this.indexes = this.getResourceIndexes(this.datasource.availableIndexes);
|
|
230
|
-
const fieldMetadata = toFieldMetadata(this.datasource.originalFieldDef);
|
|
231
|
-
const agColumnDefs = yield this.getAgColumnDefs(fieldMetadata);
|
|
232
|
-
this.agGrid.gridApi.setColumnDefs(agColumnDefs);
|
|
233
|
-
if (this.isRequestServer) {
|
|
234
|
-
this.ssrmDatasource = new ReqRepServerSideDatasource({
|
|
235
|
-
createReqRepRequestFunc: this.createReqRepRequest.bind(this),
|
|
236
|
-
reloadResourceDataFunc: this.reloadResourceData.bind(this),
|
|
237
|
-
errorHandlerFunc: this.handleErrors.bind(this),
|
|
238
|
-
resourceName: this.resourceName,
|
|
239
|
-
resourceParams: this.datasource.dataserverOnlyParams,
|
|
240
|
-
resourceIndexes: this.indexes,
|
|
241
|
-
resourceColDefs: this.datasource.originalFieldDef,
|
|
242
|
-
maxRows: +this.maxRows,
|
|
243
|
-
maxView: +this.maxView,
|
|
244
|
-
rowId: this.rowId,
|
|
245
|
-
pagination: this.pagination,
|
|
246
|
-
zeroBasedViewNumber: this.zeroBasedViewNumber,
|
|
247
|
-
pagingMode: this.pagingMode,
|
|
248
|
-
criteriaOnlyRequest: this.datasource.criteriaOnlyRequest,
|
|
249
|
-
});
|
|
190
|
+
// Emit event to initialize grid with server-side options
|
|
191
|
+
const gridOptions = Object.assign({ getRowId: (params) => {
|
|
192
|
+
if (!params.data) {
|
|
193
|
+
return null;
|
|
250
194
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
resourceName: this.resourceName,
|
|
257
|
-
resourceParams: this.datasource.requestOnlyParams,
|
|
258
|
-
resourceIndexes: this.indexes,
|
|
259
|
-
resourceColDefs: this.datasource.originalFieldDef,
|
|
260
|
-
maxRows: +this.maxRows,
|
|
261
|
-
maxView: +this.maxView,
|
|
262
|
-
rowId: this.rowId,
|
|
263
|
-
pagination: this.pagination,
|
|
264
|
-
zeroBasedViewNumber: this.zeroBasedViewNumber,
|
|
265
|
-
});
|
|
195
|
+
return String(params.data[this.rowId]);
|
|
196
|
+
}, getRowStyle(params) {
|
|
197
|
+
var _a, _b;
|
|
198
|
+
if ((_b = (_a = params.data) === null || _a === void 0 ? void 0 : _a.ROW_REF) === null || _b === void 0 ? void 0 : _b.includes('_deleted')) {
|
|
199
|
+
return { color: 'grey' };
|
|
266
200
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}), {
|
|
273
|
-
|
|
201
|
+
}, cacheBlockSize: this.maxRows, defaultColDef: {
|
|
202
|
+
filter: true,
|
|
203
|
+
resizable: true,
|
|
204
|
+
sortable: false,
|
|
205
|
+
unSortIcon: true,
|
|
206
|
+
}, rowBuffer: 0, rowModelType: 'serverSide', suppressServerSideInfiniteScroll: false, suppressMultiSort: true, onFilterChanged: (params) => { }, onSortChanged: (params) => { }, onPaginationChanged: (event) => this.onPaginationChanged(event) }, this.deferredGridOptions);
|
|
207
|
+
this.$emit(datasourceEventNames.initialize, {
|
|
208
|
+
options: gridOptions,
|
|
209
|
+
keepColDefsOnClearRowData: this.keepColDefsOnClearRowData,
|
|
210
|
+
});
|
|
211
|
+
// TODO: refactor this to prevent rendering datasource component until grid is ready
|
|
212
|
+
this.addEventListener(datasourceEventNames.ready, (event) => __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
const { pagination } = event.detail;
|
|
214
|
+
this.pagination = pagination;
|
|
215
|
+
const initOK = yield this.initializeDatasource(this.datasourceOptions(), true, false);
|
|
216
|
+
if (!initOK) {
|
|
217
|
+
logger.debug(`Genesis Datasource init failed for ${this.resourceName}`);
|
|
218
|
+
this.clearRowData();
|
|
219
|
+
this.setDisconnected(true);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
this.$emit(gridProGenesisDatasourceEventNames.dataInit);
|
|
223
|
+
this.setDisconnected(false);
|
|
224
|
+
this.indexes = this.getResourceIndexes(this.datasource.availableIndexes);
|
|
225
|
+
const fieldMetadata = toFieldMetadata(this.datasource.originalFieldDef);
|
|
226
|
+
const agColumnDefs = yield this.getAgColumnDefs(fieldMetadata);
|
|
227
|
+
// Emit event to set column definitions
|
|
228
|
+
this.$emit(datasourceEventNames.schemaUpdated, {
|
|
229
|
+
schema: agColumnDefs,
|
|
230
|
+
metadata: fieldMetadata,
|
|
231
|
+
});
|
|
232
|
+
if (this.isRequestServer) {
|
|
233
|
+
this.ssrmDatasource = new ReqRepServerSideDatasource({
|
|
234
|
+
createReqRepRequestFunc: this.createReqRepRequest.bind(this),
|
|
235
|
+
reloadResourceDataFunc: this.reloadResourceData.bind(this),
|
|
236
|
+
errorHandlerFunc: this.handleErrors.bind(this),
|
|
237
|
+
resourceName: this.resourceName,
|
|
238
|
+
resourceParams: this.datasource.requestOnlyParams,
|
|
239
|
+
resourceIndexes: this.indexes,
|
|
240
|
+
resourceColDefs: this.datasource.originalFieldDef,
|
|
241
|
+
maxRows: +this.maxRows,
|
|
242
|
+
maxView: +this.maxView,
|
|
243
|
+
rowId: this.rowId,
|
|
244
|
+
pagination: this.pagination,
|
|
245
|
+
zeroBasedViewNumber: this.zeroBasedViewNumber,
|
|
246
|
+
pagingMode: this.pagingMode,
|
|
247
|
+
criteriaOnlyRequest: this.datasource.criteriaOnlyRequest,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
this.ssrmDatasource = new DataserverServerSideDatasource({
|
|
252
|
+
createDataserverStreamFunc: this.createDataserverStream.bind(this),
|
|
253
|
+
reloadResourceDataFunc: this.reloadResourceData.bind(this),
|
|
254
|
+
errorHandlerFunc: this.handleErrors.bind(this),
|
|
255
|
+
resourceName: this.resourceName,
|
|
256
|
+
resourceParams: this.datasource.dataserverOnlyParams,
|
|
257
|
+
resourceIndexes: this.indexes,
|
|
258
|
+
resourceColDefs: this.datasource.originalFieldDef,
|
|
259
|
+
maxRows: +this.maxRows,
|
|
260
|
+
maxView: +this.maxView,
|
|
261
|
+
rowId: this.rowId,
|
|
262
|
+
pagination: this.pagination,
|
|
263
|
+
zeroBasedViewNumber: this.zeroBasedViewNumber,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
// Emit event to set server side datasource
|
|
267
|
+
this.$emit(datasourceEventNames.setServerSideDatasource, {
|
|
268
|
+
datasource: this.ssrmDatasource,
|
|
269
|
+
});
|
|
270
|
+
// Emit event to restore cached filter config
|
|
271
|
+
this.$emit(datasourceEventNames.filtersRestored);
|
|
272
|
+
// Apply custom sort indicator styling for server-side datasource
|
|
273
|
+
this.applyServerSideSortIndicatorStyling();
|
|
274
|
+
}), { once: true });
|
|
275
|
+
if (!this.resourceName) {
|
|
276
|
+
this.handleErrors('Application not connected or invalid resource name, datasource will not work.', 'unknown');
|
|
274
277
|
}
|
|
275
|
-
this.handleErrors('Application not connected or invalid resource name, datasource will not work.', 'unknown');
|
|
276
278
|
});
|
|
277
279
|
}
|
|
278
280
|
onPaginationChanged(event) {
|
|
279
281
|
var _a;
|
|
280
|
-
if (this.
|
|
282
|
+
if (this.ssrmDatasource) {
|
|
281
283
|
this.ssrmDatasource.isNewPageSize = (_a = event.newPage) !== null && _a !== void 0 ? _a : false;
|
|
282
284
|
}
|
|
283
285
|
}
|
|
284
286
|
destroy() {
|
|
285
287
|
return __awaiter(this, void 0, void 0, function* () {
|
|
286
|
-
var _a
|
|
288
|
+
var _a;
|
|
287
289
|
this.datasource.destroy();
|
|
288
290
|
(_a = this.liveUpdatesStream) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
289
291
|
this.liveUpdatesStream = undefined;
|
|
@@ -294,8 +296,9 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
294
296
|
}
|
|
295
297
|
// Remove custom sort indicator styling
|
|
296
298
|
this.removeServerSideSortIndicatorStyling();
|
|
297
|
-
|
|
298
|
-
(
|
|
299
|
+
// Emit events instead of direct grid access
|
|
300
|
+
this.$emit(datasourceEventNames.setServerSideDatasource, { datasource: null });
|
|
301
|
+
this.$emit(datasourceEventNames.refreshServerSide, { purge: true });
|
|
299
302
|
});
|
|
300
303
|
}
|
|
301
304
|
restart() {
|
|
@@ -305,17 +308,19 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
305
308
|
});
|
|
306
309
|
}
|
|
307
310
|
clearRowData(withColumnDefs = true) {
|
|
308
|
-
var _a, _b, _c, _d;
|
|
309
311
|
this.rowData = new Map();
|
|
310
312
|
if (withColumnDefs) {
|
|
311
|
-
|
|
313
|
+
// Emit event to clear column definitions
|
|
314
|
+
this.$emit(datasourceEventNames.dataCleared, {
|
|
315
|
+
includeSchema: true,
|
|
316
|
+
});
|
|
312
317
|
}
|
|
313
|
-
this.
|
|
314
|
-
|
|
315
|
-
|
|
318
|
+
this.transactionData = { remove: [] };
|
|
319
|
+
// Emit event to apply server side transaction for removing all data
|
|
320
|
+
this.$emit(datasourceEventNames.applyServerSideTransaction, {
|
|
321
|
+
transaction: this.transactionData,
|
|
316
322
|
});
|
|
317
|
-
|
|
318
|
-
this.agTransaction = undefined;
|
|
323
|
+
this.transactionData = undefined;
|
|
319
324
|
}
|
|
320
325
|
getResourceIndexes(avaialbleIndexes) {
|
|
321
326
|
const resourceIndexesMap = new Map();
|
|
@@ -324,9 +329,6 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
324
329
|
});
|
|
325
330
|
return resourceIndexesMap;
|
|
326
331
|
}
|
|
327
|
-
get rowModel() {
|
|
328
|
-
return this.agGrid.gridApi.getModel();
|
|
329
|
-
}
|
|
330
332
|
createReqRepRequest() {
|
|
331
333
|
return __awaiter(this, arguments, void 0, function* (existingParams = null) {
|
|
332
334
|
const reqRep = yield this.datasource.snapshot(existingParams);
|
|
@@ -344,7 +346,7 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
344
346
|
return;
|
|
345
347
|
}
|
|
346
348
|
const nextMessage = dataServerResultFilter(message);
|
|
347
|
-
this.
|
|
349
|
+
this.transactionData = { add: [], remove: [], update: [] };
|
|
348
350
|
this.handleStreamInserts(nextMessage.inserts);
|
|
349
351
|
this.handleStreamUpdates(nextMessage.updates);
|
|
350
352
|
this.handleStreamDeletes(nextMessage.deletes);
|
|
@@ -352,15 +354,10 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
352
354
|
// Calculate net row count change (inserts - deletes)
|
|
353
355
|
const netRowChange = ((_b = (_a = nextMessage.inserts) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = nextMessage.deletes) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0);
|
|
354
356
|
this.ssrmDatasource.serverRowsCount += netRowChange;
|
|
355
|
-
const loadedDeletes = (_f = (_e = nextMessage.deletes) === null || _e === void 0 ? void 0 : _e.filter((deleteData) => {
|
|
356
|
-
const rowId = deleteData[this.rowId];
|
|
357
|
-
const rowNode = this.agGrid.gridApi.getRowNode(rowId);
|
|
358
|
-
return rowNode != null;
|
|
359
|
-
})) !== null && _f !== void 0 ? _f : [];
|
|
360
357
|
// Calculate net row count change for client (inserts - loaded deletes)
|
|
361
|
-
const clientNetRowChange = ((_h = (_g = nextMessage.
|
|
358
|
+
const clientNetRowChange = ((_f = (_e = nextMessage.inserts) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) - ((_h = (_g = nextMessage.deletes) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0);
|
|
362
359
|
this.ssrmDatasource.clientRowsCount += clientNetRowChange;
|
|
363
|
-
this.
|
|
360
|
+
this.applyAllTransactions();
|
|
364
361
|
}
|
|
365
362
|
}
|
|
366
363
|
});
|
|
@@ -372,26 +369,11 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
372
369
|
this.liveUpdatesStream = this.connect
|
|
373
370
|
.stream(this.resourceName, () => { }, onError, existingParams !== null && existingParams !== void 0 ? existingParams : this.datasource.dataserverOnlyParams)
|
|
374
371
|
.subscribe((message) => streamOnMessage(message));
|
|
375
|
-
// return this.connect.stream(
|
|
376
|
-
// this.resourceName,
|
|
377
|
-
// (message) => streamOnMessage(message),
|
|
378
|
-
// onError,
|
|
379
|
-
// existingParams ?? this.params,
|
|
380
|
-
// );
|
|
381
372
|
}
|
|
382
373
|
yield this.datasource.startStream();
|
|
383
374
|
return this.datasource.stream;
|
|
384
375
|
});
|
|
385
376
|
}
|
|
386
|
-
// private handleStreamDeletesTemp(deletes: RowData[]) {
|
|
387
|
-
// if (!deletes) return;
|
|
388
|
-
// deletes.forEach((deleteData) => {
|
|
389
|
-
// const rowNode = this.agGrid.gridApi.getRowNode(deleteData.ROW_REF);
|
|
390
|
-
// if (rowNode) {
|
|
391
|
-
// rowNode.setData({ ...rowNode.data, ROW_REF: deleteData.ROW_REF + '_deleted' });
|
|
392
|
-
// }
|
|
393
|
-
// });
|
|
394
|
-
// }
|
|
395
377
|
getAgColumnDefs(fieldsMetadata) {
|
|
396
378
|
return __awaiter(this, void 0, void 0, function* () {
|
|
397
379
|
const colDefsFromGenesisData = this.generateColumnDefsFromMetadata(fieldsMetadata, getServerSideFilterParamsByFieldType);
|
|
@@ -405,15 +387,11 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
405
387
|
colDef.sortable = true;
|
|
406
388
|
});
|
|
407
389
|
}
|
|
408
|
-
|
|
409
|
-
return colDefsMergedWithTemplateDefs;
|
|
390
|
+
return colDefsFromGenesisData;
|
|
410
391
|
});
|
|
411
392
|
}
|
|
412
|
-
applyTransaction(
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
applyTransactionAsync(agTransaction, callback) {
|
|
416
|
-
this.agGrid.gridApi.applyServerSideTransactionAsync(agTransaction, callback);
|
|
393
|
+
applyTransaction(transaction) {
|
|
394
|
+
this.$emit(datasourceEventNames.applyServerSideTransaction, { transaction });
|
|
417
395
|
}
|
|
418
396
|
loadMore() {
|
|
419
397
|
throw new Error('loadMore() method is not supported for server-side datasource');
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event names for datasource-grid communication
|
|
3
|
+
* These represent datasource operations, not grid-specific actions
|
|
4
|
+
*/
|
|
5
|
+
export const datasourceEventNames = {
|
|
6
|
+
// Initialization events
|
|
7
|
+
initialize: 'datasource-initialize',
|
|
8
|
+
ready: 'datasource-ready',
|
|
9
|
+
// Data events
|
|
10
|
+
dataLoaded: 'datasource-data-loaded',
|
|
11
|
+
dataChanged: 'datasource-data-changed',
|
|
12
|
+
dataCleared: 'datasource-data-cleared',
|
|
13
|
+
// Schema events
|
|
14
|
+
schemaUpdated: 'datasource-schema-updated',
|
|
15
|
+
// Status events
|
|
16
|
+
loadingStarted: 'datasource-loading-started',
|
|
17
|
+
loadingFinished: 'datasource-loading-finished',
|
|
18
|
+
noDataAvailable: 'datasource-no-data-available',
|
|
19
|
+
moreDataAvailable: 'datasource-more-data-available',
|
|
20
|
+
// Filter events
|
|
21
|
+
filtersRestored: 'datasource-filters-restored',
|
|
22
|
+
// Error events
|
|
23
|
+
error: 'datasource-error',
|
|
24
|
+
// Size events
|
|
25
|
+
sizeChanged: 'datasource-size-changed',
|
|
26
|
+
// Server-side specific events
|
|
27
|
+
cacheFilterConfig: 'cache-filter-config',
|
|
28
|
+
refreshServerSide: 'refresh-server-side',
|
|
29
|
+
setServerSideDatasource: 'set-server-side-datasource',
|
|
30
|
+
addGridCssClass: 'add-grid-css-class',
|
|
31
|
+
removeGridCssClass: 'remove-grid-css-class',
|
|
32
|
+
applyServerSideTransaction: 'apply-server-side-transaction',
|
|
33
|
+
};
|