@refinitiv-ui/efx-grid 6.0.147 → 6.0.148
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/lib/core/dist/core.js +497 -273
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +1 -1
- package/lib/core/es6/data/DataTable.js +64 -59
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +5 -6
- package/lib/core/es6/data/Segment.d.ts +15 -1
- package/lib/core/es6/data/Segment.js +336 -169
- package/lib/core/es6/data/SegmentCollection.d.ts +1 -1
- package/lib/core/es6/data/SegmentCollection.js +91 -38
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/grid/index.js +1 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +1 -1
- package/lib/types/es6/Core/data/DataView.d.ts +1 -1
- package/lib/types/es6/Core/data/Segment.d.ts +15 -1
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -1
- package/package.json +1 -1
| @@ -82,7 +82,7 @@ declare class DataTable extends DataCache { | |
| 82 82 |  | 
| 83 83 | 
             
                public setSegmentSeparators(rids: (string)[]|null, enabled?: boolean|null): boolean;
         | 
| 84 84 |  | 
| 85 | 
            -
                public setSegmentSeparator(rid: string,  | 
| 85 | 
            +
                public setSegmentSeparator(rid: string, options?: any): boolean;
         | 
| 86 86 |  | 
| 87 87 | 
             
                public unsetAllSegmentSeparators(): boolean;
         | 
| 88 88 |  | 
| @@ -1016,64 +1016,65 @@ DataTable.prototype._initSegmentCollection = function() { | |
| 1016 1016 | 
             
            		this._segments.addEventListener("subSegmentChanged", this._onSubSegmentChanged);
         | 
| 1017 1017 | 
             
            	}
         | 
| 1018 1018 | 
             
            };
         | 
| 1019 | 
            -
            /**
         | 
| 1019 | 
            +
            /** Add or remove all segments from the given row ids
         | 
| 1020 1020 | 
             
            * @public
         | 
| 1021 1021 | 
             
            * @param {Array.<string>} rids
         | 
| 1022 1022 | 
             
            * @param {boolean=} enabled
         | 
| 1023 1023 | 
             
            * @return {boolean} Return true if there is any change
         | 
| 1024 1024 | 
             
            */
         | 
| 1025 1025 | 
             
            DataTable.prototype.setSegmentSeparators = function(rids, enabled) {
         | 
| 1026 | 
            -
            	 | 
| 1027 | 
            -
             | 
| 1028 | 
            -
             | 
| 1029 | 
            -
             | 
| 1030 | 
            -
             | 
| 1031 | 
            -
             | 
| 1032 | 
            -
             | 
| 1033 | 
            -
             | 
| 1034 | 
            -
             | 
| 1035 | 
            -
             | 
| 1036 | 
            -
             | 
| 1037 | 
            -
             | 
| 1038 | 
            -
             | 
| 1026 | 
            +
            	if (!rids) {
         | 
| 1027 | 
            +
            		return false;
         | 
| 1028 | 
            +
            	}
         | 
| 1029 | 
            +
            	let adding = (enabled !== false);
         | 
| 1030 | 
            +
            	let segmentAdded = 0;
         | 
| 1031 | 
            +
            	let segmentRemoved = 0;
         | 
| 1032 | 
            +
             | 
| 1033 | 
            +
            	let len = rids.length;
         | 
| 1034 | 
            +
            	for (let i = 0; i < len; i++) {
         | 
| 1035 | 
            +
            		let rid = rids[i];
         | 
| 1036 | 
            +
            		if(adding) {
         | 
| 1037 | 
            +
            			this._initSegmentCollection();
         | 
| 1038 | 
            +
            			if(this._autoSegmentFilling) {
         | 
| 1039 | 
            +
            				let parentId = this._segments.getParentRowId(rid);
         | 
| 1040 | 
            +
            				if(parentId) {
         | 
| 1041 | 
            +
            					this._segments.removeSegmentChild(parentId, rid);
         | 
| 1039 1042 | 
             
            				}
         | 
| 1040 | 
            -
             | 
| 1041 | 
            -
            			 | 
| 1042 | 
            -
             | 
| 1043 | 
            -
             | 
| 1044 | 
            -
             | 
| 1045 | 
            -
             | 
| 1046 | 
            -
             | 
| 1047 | 
            -
             | 
| 1048 | 
            -
            						 | 
| 1043 | 
            +
            			}
         | 
| 1044 | 
            +
            			segmentAdded |= this._segments.addSegment(rid);
         | 
| 1045 | 
            +
            		} else if (this._segments) { // Removing
         | 
| 1046 | 
            +
            			let segment = this._segments.getSegment(rid);
         | 
| 1047 | 
            +
            			if(segment) {
         | 
| 1048 | 
            +
            				if(this._segments.removeSegment(rid)) {
         | 
| 1049 | 
            +
            					segmentRemoved = 1;
         | 
| 1050 | 
            +
            					if(!this._segments.getSegmentCount()) {
         | 
| 1051 | 
            +
            						this._segments = null;
         | 
| 1049 1052 | 
             
            					}
         | 
| 1050 1053 | 
             
            				}
         | 
| 1051 1054 | 
             
            			}
         | 
| 1052 | 
            -
             | 
| 1053 | 
            -
            		}
         | 
| 1054 | 
            -
            		if (enabled !== false && segmentChanged) {
         | 
| 1055 | 
            -
            			this._segments.calcSegmentOrder(this._rids);
         | 
| 1056 | 
            -
            			change = true;
         | 
| 1057 | 
            -
            		}
         | 
| 1058 | 
            -
            		if(change) {
         | 
| 1059 | 
            -
            			this.dispatchGlobalChange();
         | 
| 1060 1055 | 
             
            		}
         | 
| 1061 1056 | 
             
            	}
         | 
| 1062 | 
            -
            	 | 
| 1063 | 
            -
             | 
| 1057 | 
            +
            	if (segmentAdded) {
         | 
| 1058 | 
            +
            		this._segments.calcSegmentOrder(this._rids);
         | 
| 1059 | 
            +
            	}
         | 
| 1060 | 
            +
            	let changed = segmentAdded || segmentRemoved;
         | 
| 1061 | 
            +
            	if(changed && this._needFiring()) {
         | 
| 1062 | 
            +
            		this.dispatchGlobalChange();
         | 
| 1063 | 
            +
            	}
         | 
| 1064 | 
            +
            	return changed ? true : false;
         | 
| 1064 1065 | 
             
            };
         | 
| 1065 1066 |  | 
| 1066 1067 | 
             
            /**
         | 
| 1067 1068 | 
             
            * @public
         | 
| 1068 1069 | 
             
            * @param {string} rid
         | 
| 1069 | 
            -
            * @param { | 
| 1070 | 
            +
            * @param {*=} options=null Segment options. If the value is false, segment separator will be stripped off from the given rid
         | 
| 1070 1071 | 
             
            * @return {boolean} Return true if there is any change
         | 
| 1071 1072 | 
             
            */
         | 
| 1072 | 
            -
            DataTable.prototype.setSegmentSeparator = function(rid,  | 
| 1073 | 
            +
            DataTable.prototype.setSegmentSeparator = function(rid, options) {
         | 
| 1073 1074 | 
             
            	let change = false;
         | 
| 1074 1075 | 
             
            	let memberCount = 0;
         | 
| 1075 1076 | 
             
            	if(rid && typeof rid === "string") {
         | 
| 1076 | 
            -
            		if( | 
| 1077 | 
            +
            		if(options !== false) {
         | 
| 1077 1078 | 
             
            			this._initSegmentCollection();
         | 
| 1078 1079 | 
             
            			if(this._autoSegmentFilling) {
         | 
| 1079 1080 | 
             
            				let parentId = this._segments.getParentRowId(rid);
         | 
| @@ -1081,11 +1082,12 @@ DataTable.prototype.setSegmentSeparator = function(rid, enabled) { | |
| 1081 1082 | 
             
            					this._segments.removeSegmentChild(parentId, rid);
         | 
| 1082 1083 | 
             
            				}
         | 
| 1083 1084 | 
             
            			}
         | 
| 1084 | 
            -
            			 | 
| 1085 | 
            +
            			let children = (options && options["children"]) ? options["children"] : null;
         | 
| 1086 | 
            +
            			if(this._segments.addSegment(rid, children)) {
         | 
| 1085 1087 | 
             
            				this._segments.calcSegmentOrder(this._rids);
         | 
| 1086 1088 | 
             
            				change = true;
         | 
| 1087 1089 | 
             
            			}
         | 
| 1088 | 
            -
            		} else if(this._segments) { //  | 
| 1090 | 
            +
            		} else if(this._segments) { // Remove the separator
         | 
| 1089 1091 | 
             
            			let segment = this._segments.getSegment(rid);
         | 
| 1090 1092 | 
             
            			if(segment) {
         | 
| 1091 1093 | 
             
            				memberCount = segment.getChildCount();
         | 
| @@ -1280,6 +1282,20 @@ DataTable.prototype.fillSegments = function() { | |
| 1280 1282 | 
             
            	}
         | 
| 1281 1283 | 
             
            	return false;
         | 
| 1282 1284 | 
             
            };
         | 
| 1285 | 
            +
            /** @private
         | 
| 1286 | 
            +
            * @param {boolean=} adding This indicates that segment is changed by adding a new child
         | 
| 1287 | 
            +
            */
         | 
| 1288 | 
            +
            DataTable.prototype._onSegmentChildChanged = function(adding) {
         | 
| 1289 | 
            +
            	if(this._segments) {
         | 
| 1290 | 
            +
            		this._segments.calcSegmentOrder(this._rids, true);
         | 
| 1291 | 
            +
            	}
         | 
| 1292 | 
            +
            	if(adding !== false) {
         | 
| 1293 | 
            +
            		this._sort(null);
         | 
| 1294 | 
            +
            	}
         | 
| 1295 | 
            +
            	this._dispatchPositionChange(); // Force rerendering, even if there is no position change
         | 
| 1296 | 
            +
             | 
| 1297 | 
            +
            	this.requestClassifying();
         | 
| 1298 | 
            +
            };
         | 
| 1283 1299 | 
             
            /** @public
         | 
| 1284 1300 | 
             
            * @param {string} segmentId Row id
         | 
| 1285 1301 | 
             
            * @param {string} rid Row id
         | 
| @@ -1290,10 +1306,7 @@ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) { | |
| 1290 1306 | 
             
            	if(this._segments) {
         | 
| 1291 1307 | 
             
            		let dirty = this._segments.addSegmentChild(segmentId, rid, dataId);
         | 
| 1292 1308 | 
             
            		if(dirty) {
         | 
| 1293 | 
            -
            			this. | 
| 1294 | 
            -
            			this._dispatchPositionChange(); // Force rerendering, even if there is no position change
         | 
| 1295 | 
            -
             | 
| 1296 | 
            -
            			this.requestClassifying();
         | 
| 1309 | 
            +
            			this._onSegmentChildChanged();
         | 
| 1297 1310 | 
             
            			return true;
         | 
| 1298 1311 | 
             
            		}
         | 
| 1299 1312 | 
             
            	}
         | 
| @@ -1309,17 +1322,15 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) { | |
| 1309 1322 | 
             
            	if(this._segments) {
         | 
| 1310 1323 | 
             
            		let dirty = this._segments.addSegmentChildren(segmentId, rids, dataIds);
         | 
| 1311 1324 | 
             
            		if(dirty) {
         | 
| 1312 | 
            -
            			this. | 
| 1313 | 
            -
            			this._dispatchPositionChange(); // Force rerendering, even if there is no position change
         | 
| 1314 | 
            -
             | 
| 1315 | 
            -
            			this.requestClassifying();
         | 
| 1325 | 
            +
            			this._onSegmentChildChanged();
         | 
| 1316 1326 | 
             
            			return true;
         | 
| 1317 1327 | 
             
            		}
         | 
| 1318 1328 | 
             
            	}
         | 
| 1319 1329 | 
             
            	return false;
         | 
| 1320 1330 | 
             
            };
         | 
| 1321 1331 |  | 
| 1322 | 
            -
            /**  | 
| 1332 | 
            +
            /** Deprecated. Remove all existing children and add new children according to the give array
         | 
| 1333 | 
            +
            * @public
         | 
| 1323 1334 | 
             
            * @param {Array.<Object>} segmentArr Segment array that contain "segmentId", "rowIds" to set segment children
         | 
| 1324 1335 | 
             
            * @return {boolean} Return true if there is any change
         | 
| 1325 1336 | 
             
            */
         | 
| @@ -1327,20 +1338,16 @@ DataTable.prototype.setSegmentChildren = function(segmentArr) { | |
| 1327 1338 | 
             
            	if(!this._segments) {
         | 
| 1328 1339 | 
             
            		return false;
         | 
| 1329 1340 | 
             
            	}
         | 
| 1330 | 
            -
            	this.removeAllSegmentChildren();
         | 
| 1341 | 
            +
            	let dirty = this._segments.removeAllSegmentChildren();
         | 
| 1331 1342 | 
             
            	let len = segmentArr.length;
         | 
| 1332 | 
            -
            	let dirty;
         | 
| 1333 1343 | 
             
            	for (let i = 0; i < len; i++) {
         | 
| 1334 1344 | 
             
            		let obj = segmentArr[i];
         | 
| 1335 | 
            -
            		if(this._segments.addSegmentChildren(obj | 
| 1345 | 
            +
            		if(this._segments.addSegmentChildren(obj["segmentId"], obj["rowIds"])) {
         | 
| 1336 1346 | 
             
            			dirty = true;
         | 
| 1337 1347 | 
             
            		}
         | 
| 1338 1348 | 
             
            	}
         | 
| 1339 1349 | 
             
            	if(dirty) {
         | 
| 1340 | 
            -
            		this. | 
| 1341 | 
            -
            		this._dispatchPositionChange(); // Force rerendering, even if there is no position change
         | 
| 1342 | 
            -
             | 
| 1343 | 
            -
            		this.requestClassifying();
         | 
| 1350 | 
            +
            		this._onSegmentChildChanged();
         | 
| 1344 1351 | 
             
            		return true;
         | 
| 1345 1352 | 
             
            	}
         | 
| 1346 1353 |  | 
| @@ -1355,8 +1362,7 @@ DataTable.prototype.removeSegmentChild = function(segmentId, rid) { | |
| 1355 1362 | 
             
            	if(this._segments) {
         | 
| 1356 1363 | 
             
            		let dirty = this._segments.removeSegmentChild(segmentId, rid);
         | 
| 1357 1364 | 
             
            		if(dirty) {
         | 
| 1358 | 
            -
            			this. | 
| 1359 | 
            -
            			this.requestClassifying();
         | 
| 1365 | 
            +
            			this._onSegmentChildChanged(false);
         | 
| 1360 1366 | 
             
            		}
         | 
| 1361 1367 | 
             
            		return dirty;
         | 
| 1362 1368 | 
             
            	}
         | 
| @@ -1371,8 +1377,7 @@ DataTable.prototype.removeSegmentChildren = function(segmentId, rids) { | |
| 1371 1377 | 
             
            	if(this._segments) {
         | 
| 1372 1378 | 
             
            		let dirty = this._segments.removeSegmentChildren(segmentId, rids);
         | 
| 1373 1379 | 
             
            		if(dirty) {
         | 
| 1374 | 
            -
            			this. | 
| 1375 | 
            -
            			this.requestClassifying();
         | 
| 1380 | 
            +
            			this._onSegmentChildChanged(false);
         | 
| 1376 1381 | 
             
            		}
         | 
| 1377 1382 | 
             
            		return dirty;
         | 
| 1378 1383 | 
             
            	}
         | 
| @@ -1385,7 +1390,7 @@ DataTable.prototype.removeAllSegmentChildren = function() { | |
| 1385 1390 | 
             
            	if(this._segments) {
         | 
| 1386 1391 | 
             
            		let dirty = this._segments.removeAllSegmentChildren(); // This immediately remove all sub segments
         | 
| 1387 1392 | 
             
            		if (dirty) {
         | 
| 1388 | 
            -
            			this. | 
| 1393 | 
            +
            			this._onSegmentChildChanged(false);
         | 
| 1389 1394 | 
             
            		}
         | 
| 1390 1395 | 
             
            		return dirty;
         | 
| 1391 1396 | 
             
            	}
         | 
| @@ -248,7 +248,7 @@ declare class DataView extends EventDispatcher { | |
| 248 248 |  | 
| 249 249 | 
             
                public setSegmentSeparators(rowIds: (string)[]|null, enabled?: boolean|null): boolean;
         | 
| 250 250 |  | 
| 251 | 
            -
                public setSegmentSeparator(rowRef: string|number|null,  | 
| 251 | 
            +
                public setSegmentSeparator(rowRef: string|number|null, options?: any): boolean;
         | 
| 252 252 |  | 
| 253 253 | 
             
                public unsetAllSegmentSeparators(): boolean;
         | 
| 254 254 |  | 
| @@ -2445,13 +2445,13 @@ DataView.prototype.setSegmentSeparators = function(rowIds, enabled) { | |
| 2445 2445 | 
             
            	}
         | 
| 2446 2446 | 
             
            	return false;
         | 
| 2447 2447 | 
             
            };
         | 
| 2448 | 
            -
            /** Set visible row as segment separator (hidden or filtered rows cannot be a segment separator)
         | 
| 2448 | 
            +
            /** Set visible row as a segment separator (hidden or filtered rows cannot be a segment separator)
         | 
| 2449 2449 | 
             
            * @public
         | 
| 2450 2450 | 
             
            * @param {string|number} rowRef Row id or row index
         | 
| 2451 | 
            -
            * @param { | 
| 2451 | 
            +
            * @param {*=} options=null Segment options. If the value is false, segment separator will be stripped off from the given rid
         | 
| 2452 2452 | 
             
            * @return {boolean} Return true if there is any change
         | 
| 2453 2453 | 
             
            */
         | 
| 2454 | 
            -
            DataView.prototype.setSegmentSeparator = function(rowRef,  | 
| 2454 | 
            +
            DataView.prototype.setSegmentSeparator = function(rowRef, options) {
         | 
| 2455 2455 | 
             
            	let rowId = "";
         | 
| 2456 2456 | 
             
            	if(typeof rowRef === "number") {
         | 
| 2457 2457 | 
             
            		rowId = this.getRowId(rowRef);
         | 
| @@ -2460,12 +2460,11 @@ DataView.prototype.setSegmentSeparator = function(rowRef, enabled) { | |
| 2460 2460 | 
             
            	}
         | 
| 2461 2461 |  | 
| 2462 2462 | 
             
            	if(rowId) {
         | 
| 2463 | 
            -
            		 | 
| 2464 | 
            -
            		if(enabled) {
         | 
| 2463 | 
            +
            		if(options !== false) { // undefined, null, object, or true value
         | 
| 2465 2464 | 
             
            			this.synchronizeRowOrder();
         | 
| 2466 2465 | 
             
            		}
         | 
| 2467 2466 | 
             
            		// TODO: Force expanding of segment before unsetting segment separator
         | 
| 2468 | 
            -
            		return this._dt.setSegmentSeparator(rowId,  | 
| 2467 | 
            +
            		return this._dt.setSegmentSeparator(rowId, options);
         | 
| 2469 2468 | 
             
            	}
         | 
| 2470 2469 | 
             
            	return false;
         | 
| 2471 2470 | 
             
            };
         | 
| @@ -11,6 +11,8 @@ declare class Segment extends EventDispatcher { | |
| 11 11 |  | 
| 12 12 | 
             
                public getParentId(): string;
         | 
| 13 13 |  | 
| 14 | 
            +
                public getParent(): Segment|null;
         | 
| 15 | 
            +
             | 
| 14 16 | 
             
                public getSubSegmentIds(out_ary?: (string)[]|null): (string)[]|null;
         | 
| 15 17 |  | 
| 16 18 | 
             
                public addChild(rid: string, dataId?: string|null): boolean;
         | 
| @@ -19,6 +21,8 @@ declare class Segment extends EventDispatcher { | |
| 19 21 |  | 
| 20 22 | 
             
                public containsChild(rid: string): boolean;
         | 
| 21 23 |  | 
| 24 | 
            +
                public getChildIndex(rid: string): number;
         | 
| 25 | 
            +
             | 
| 22 26 | 
             
                public removeChild(rid: string): boolean;
         | 
| 23 27 |  | 
| 24 28 | 
             
                public removeChildren(rids: (string)[]|null): boolean;
         | 
| @@ -31,6 +35,8 @@ declare class Segment extends EventDispatcher { | |
| 31 35 |  | 
| 32 36 | 
             
                public getChildCount(): number;
         | 
| 33 37 |  | 
| 38 | 
            +
                public markCollapsingStateDirty(): void;
         | 
| 39 | 
            +
             | 
| 34 40 | 
             
                public getClassification(): (string)[]|null;
         | 
| 35 41 |  | 
| 36 42 | 
             
                public setClassification(fields: string|(string)[]|null): boolean;
         | 
| @@ -41,10 +47,16 @@ declare class Segment extends EventDispatcher { | |
| 41 47 |  | 
| 42 48 | 
             
                public isSubSegment(): boolean;
         | 
| 43 49 |  | 
| 50 | 
            +
                public isRootSegment(): boolean;
         | 
| 51 | 
            +
             | 
| 44 52 | 
             
                public getFirstAncestor(): Segment|null;
         | 
| 45 53 |  | 
| 46 54 | 
             
                public getAllSubSegments(out_ary?: (Segment)[]|null): (Segment)[]|null;
         | 
| 47 55 |  | 
| 56 | 
            +
                public updateTreeStructure(counter: number): number;
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                public calcSubSegmentOrder(counter: number): number;
         | 
| 59 | 
            +
             | 
| 48 60 | 
             
                public getSegmentLevel(): number;
         | 
| 49 61 |  | 
| 50 62 | 
             
                public setRowData(rows?: any, clsSource?: any): void;
         | 
| @@ -65,7 +77,9 @@ declare class Segment extends EventDispatcher { | |
| 65 77 |  | 
| 66 78 | 
             
                public setOrder(val: number): void;
         | 
| 67 79 |  | 
| 68 | 
            -
                public  | 
| 80 | 
            +
                public setLastOrder(val: number): number;
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                public log(lines?: (string)[]|null, tabLevel?: number|null): (string)[];
         | 
| 69 83 |  | 
| 70 84 | 
             
            }
         | 
| 71 85 |  |