@syncfusion/ej2-navigations 34.2.4 → 34.2.5

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,12 +1,3 @@
1
- /*!
2
- * filename: index.d.ts
3
- * version : 34.2.4
4
- * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
- * Use of this code is subject to the terms of our license.
6
- * A copy of the current license can be obtained at any time by e-mailing
7
- * licensing@syncfusion.com. Any infringement will be prosecuted under
8
- * applicable laws.
9
- */
10
1
  import * as _navigations from '@syncfusion/ej2-navigations';
11
2
 
12
3
  export declare namespace ej {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-navigations",
3
- "version": "34.2.4",
3
+ "version": "34.2.5",
4
4
  "description": "A package of Essential JS 2 navigation components such as Tree-view, Tab, Toolbar, Context-menu, and Accordion which is used to navigate from one page to another",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,7 +8,7 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-navigations.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~34.2.4",
11
+ "@syncfusion/ej2-base": "~34.2.5",
12
12
  "@syncfusion/ej2-buttons": "~34.2.2",
13
13
  "@syncfusion/ej2-data": "~34.2.2",
14
14
  "@syncfusion/ej2-inputs": "~34.2.2",
@@ -270,6 +270,8 @@ export declare class Toolbar extends Component<HTMLElement> implements INotifyPr
270
270
  private scrollEvent;
271
271
  private resizeContext;
272
272
  private orientationChangeContext;
273
+ private resizeObserver;
274
+ private lastObservedWidth;
273
275
  /**
274
276
  * Contains the keyboard configuration of the Toolbar.
275
277
  */
@@ -155,6 +155,7 @@ var Toolbar = /** @class */ (function (_super) {
155
155
  var _this = _super.call(this, options, element) || this;
156
156
  _this.resizeContext = _this.resize.bind(_this);
157
157
  _this.orientationChangeContext = _this.orientationChange.bind(_this);
158
+ _this.lastObservedWidth = 0;
158
159
  /**
159
160
  * Contains the keyboard configuration of the Toolbar.
160
161
  */
@@ -188,6 +189,10 @@ var Toolbar = /** @class */ (function (_super) {
188
189
  }
189
190
  });
190
191
  this.unwireEvents();
192
+ this.lastObservedWidth = 0;
193
+ if (this.resizeObserver && this.element.closest('.e-splitter')) {
194
+ this.resizeObserver.disconnect();
195
+ }
191
196
  this.tempId.forEach(function (ele) {
192
197
  if (!isNOU(_this.element.querySelector(ele))) {
193
198
  document.body.appendChild(_this.element.querySelector(ele)).style.display = 'none';
@@ -772,6 +777,17 @@ var Toolbar = /** @class */ (function (_super) {
772
777
  this.scrollEvent = this.docEvent.bind(this);
773
778
  this.renderControl();
774
779
  this.wireEvents();
780
+ if (this.element.closest('.e-splitter')) {
781
+ this.lastObservedWidth = this.element.offsetWidth;
782
+ this.resizeObserver = new window.ResizeObserver(function () {
783
+ if (_this.element.offsetWidth === _this.lastObservedWidth) {
784
+ return;
785
+ }
786
+ _this.lastObservedWidth = _this.element.offsetWidth;
787
+ _this.refreshOverflow();
788
+ });
789
+ this.resizeObserver.observe(this.element);
790
+ }
775
791
  this.renderComplete();
776
792
  if (this.isReact && this.portals && this.portals.length > 0) {
777
793
  this.renderReactTemplates(function () {
@@ -572,6 +572,8 @@ export declare class TreeView extends Component<HTMLElement> implements INotifyP
572
572
  private virtualTreeDirty;
573
573
  private virtualFocusedId;
574
574
  private virtualSkipNextScrollRender;
575
+ private filterCheckedNodes;
576
+ private filterIndeterminateNodes;
575
577
  /**
576
578
  * Indicates whether the TreeView allows drag and drop of nodes. To drag and drop a node in
577
579
  * desktop, hold the mouse on the node, drag it to the target node and drop the node by releasing
@@ -1079,6 +1081,7 @@ export declare class TreeView extends Component<HTMLElement> implements INotifyP
1079
1081
  private getType;
1080
1082
  private setRootData;
1081
1083
  private isChildObject;
1084
+ private isRemoteDataLoadOnDemand;
1082
1085
  private renderItems;
1083
1086
  /**
1084
1087
  * Update the checkedNodes from datasource at initial rendering
@@ -248,6 +248,8 @@ var TreeView = /** @class */ (function (_super) {
248
248
  _this.virtualTreeDirty = false;
249
249
  _this.virtualFocusedId = null;
250
250
  _this.virtualSkipNextScrollRender = false;
251
+ _this.filterCheckedNodes = [];
252
+ _this.filterIndeterminateNodes = [];
251
253
  return _this;
252
254
  }
253
255
  TreeView_1 = TreeView;
@@ -548,6 +550,11 @@ var TreeView = /** @class */ (function (_super) {
548
550
  return false;
549
551
  }
550
552
  };
553
+ TreeView.prototype.isRemoteDataLoadOnDemand = function () {
554
+ var remoteDataSource = (this.fields.dataSource instanceof DataManager) ||
555
+ (this.fields.child && this.fields.child.dataSource instanceof DataManager ? true : false);
556
+ return !remoteDataSource && !this.loadOnDemand;
557
+ };
551
558
  TreeView.prototype.renderItems = function (isSorted) {
552
559
  if (this.enableVirtualization && !isNOU(this.height)) {
553
560
  this.ulElement = this.createElement('ul', {
@@ -736,7 +743,9 @@ var TreeView = /** @class */ (function (_super) {
736
743
  if (this_1.checkedNodes.indexOf(childId) !== -1) {
737
744
  count++;
738
745
  }
739
- else if (this_1.element.classList.contains('e-filtering') && OldCheckedNodes.findIndex(function (e) { return e['id'] === childId; }) !== -1) {
746
+ else if (this_1.element.classList.contains('e-filtering') && (this_1.isRemoteDataLoadOnDemand() ?
747
+ this_1.filterCheckedNodes.findIndex(function (id) { return id === childId; }) !== -1 :
748
+ OldCheckedNodes.findIndex(function (e) { return e['id'] === childId; }) !== -1)) {
740
749
  count++;
741
750
  }
742
751
  };
@@ -1055,6 +1064,23 @@ var TreeView = /** @class */ (function (_super) {
1055
1064
  }
1056
1065
  });
1057
1066
  var parentNodeChecked = false;
1067
+ if (this.isRemoteDataLoadOnDemand() && this.element.classList.contains('e-filtering') && this.autoCheck) {
1068
+ if (this.filterCheckedNodes.indexOf(dataUid_1) !== -1) {
1069
+ this.changeState(checkBoxEle, 'check', null, true, true);
1070
+ }
1071
+ else if (this.filterIndeterminateNodes.indexOf(dataUid_1) !== -1) {
1072
+ this.changeState(checkBoxEle, 'indeterminate', null, true, true);
1073
+ }
1074
+ else {
1075
+ this.changeState(checkBoxEle, 'uncheck', null, true, true);
1076
+ }
1077
+ var parentUL_1 = closest(element, '.' + PARENTITEM);
1078
+ if (!isNOU(parentUL_1)) {
1079
+ var currentParent = closest(parentUL_1, '.' + LISTITEM);
1080
+ this.ensureParentCheckState(currentParent);
1081
+ }
1082
+ return;
1083
+ }
1058
1084
  if (this.element.classList.contains('e-filtering')) {
1059
1085
  var oldCheckedNodes = new DataManager(this.OldCheckedData).executeLocal(new Query().where('parentID', 'equal', dataUid_1, true));
1060
1086
  checkedCount = oldCheckedNodes.length;
@@ -1162,7 +1188,7 @@ var TreeView = /** @class */ (function (_super) {
1162
1188
  }
1163
1189
  });
1164
1190
  };
1165
- TreeView.prototype.getAllChildNodes = function (data, parentId) {
1191
+ TreeView.prototype.getAllChildNodes = function (data, parentId, includeAllDescendants) {
1166
1192
  if (isNOU(data) || isNOU(parentId)) {
1167
1193
  return [];
1168
1194
  }
@@ -1179,17 +1205,55 @@ var TreeView = /** @class */ (function (_super) {
1179
1205
  }
1180
1206
  if (this.dataType === 2) {
1181
1207
  var parentFieldId_1 = this.fields.id;
1182
- var childField = this.fields.child.toString();
1183
- var target_2 = parentId.toString();
1184
- var node = data.find(function (n) {
1185
- var idVal = getValue(parentFieldId_1, n);
1186
- return !isNOU(idVal) && idVal.toString() === target_2;
1187
- });
1208
+ var childField_1 = this.fields.child.toString();
1209
+ var target = parentId.toString();
1210
+ var findNodeInTree_1 = function (nodes, id) {
1211
+ if (!Array.isArray(nodes)) {
1212
+ return undefined;
1213
+ }
1214
+ for (var i = 0; i < nodes.length; i++) {
1215
+ var n = nodes[parseInt(i.toString(), 10)];
1216
+ var idVal = getValue(parentFieldId_1, n);
1217
+ if (!isNOU(idVal) && idVal.toString() === id) {
1218
+ return n;
1219
+ }
1220
+ var subs = getValue(childField_1, n);
1221
+ var found = findNodeInTree_1(subs, id);
1222
+ if (found) {
1223
+ return found;
1224
+ }
1225
+ }
1226
+ return undefined;
1227
+ };
1228
+ var node = findNodeInTree_1(data, target);
1188
1229
  if (!node) {
1189
1230
  return [];
1190
1231
  }
1191
- var children = getValue(childField, node);
1192
- return Array.isArray(children) ? children : [];
1232
+ var children = getValue(childField_1, node);
1233
+ if (!Array.isArray(children)) {
1234
+ return [];
1235
+ }
1236
+ if (!includeAllDescendants) {
1237
+ return children;
1238
+ }
1239
+ var result_1 = children.slice();
1240
+ var collectNested_1 = function (nodes) {
1241
+ if (!Array.isArray(nodes)) {
1242
+ return;
1243
+ }
1244
+ for (var i = 0; i < nodes.length; i++) {
1245
+ var n = nodes[parseInt(i.toString(), 10)];
1246
+ var grandChildren = getValue(childField_1, n);
1247
+ if (Array.isArray(grandChildren) && grandChildren.length) {
1248
+ for (var j = 0; j < grandChildren.length; j++) {
1249
+ result_1.push(grandChildren[parseInt(j.toString(), 10)]);
1250
+ }
1251
+ collectNested_1(grandChildren);
1252
+ }
1253
+ }
1254
+ };
1255
+ collectNested_1(children);
1256
+ return result_1;
1193
1257
  }
1194
1258
  return [];
1195
1259
  };
@@ -2934,6 +2998,83 @@ var TreeView = /** @class */ (function (_super) {
2934
2998
  }
2935
2999
  }
2936
3000
  }
3001
+ if (this.isRemoteDataLoadOnDemand() && this.element.classList.contains('e-filtering') && this.autoCheck) {
3002
+ var nodeUid = li.getAttribute('data-uid');
3003
+ if (isNOU(nodeUid)) {
3004
+ return;
3005
+ }
3006
+ var checkedIndex = this.filterCheckedNodes.indexOf(nodeUid);
3007
+ var indeterminateIndex = this.filterIndeterminateNodes.indexOf(nodeUid);
3008
+ var shouldCheck = !isCheck;
3009
+ if (shouldCheck) {
3010
+ if (checkedIndex === -1) {
3011
+ this.filterCheckedNodes.push(nodeUid);
3012
+ }
3013
+ if (indeterminateIndex !== -1) {
3014
+ this.filterIndeterminateNodes.splice(indeterminateIndex, 1);
3015
+ }
3016
+ }
3017
+ else {
3018
+ if (checkedIndex !== -1) {
3019
+ this.filterCheckedNodes.splice(checkedIndex, 1);
3020
+ }
3021
+ }
3022
+ var parentLi = closest(closest(li, '.' + PARENTITEM), '.' + LISTITEM);
3023
+ while (!isNOU(parentLi)) {
3024
+ var parentUid = parentLi.getAttribute('data-uid');
3025
+ if (!isNOU(parentUid)) {
3026
+ var parentChildren = this.getAllChildNodes(this.DDTTreeData, parentUid, true);
3027
+ if (parentChildren && parentChildren.length > 0) {
3028
+ var firstChildState = void 0;
3029
+ var mismatchFound = false;
3030
+ for (var i = 0; i < parentChildren.length; i++) {
3031
+ var childData = parentChildren[parseInt(i.toString(), 10)];
3032
+ var childId = childData && childData[this.fields.id]
3033
+ ? childData[this.fields.id].toString()
3034
+ : null;
3035
+ if (isNOU(childId)) {
3036
+ continue;
3037
+ }
3038
+ var childCheckedState = this.filterIndeterminateNodes.indexOf(childId) !== -1
3039
+ ? null
3040
+ : this.filterCheckedNodes.indexOf(childId) !== -1;
3041
+ if (firstChildState === void 0) {
3042
+ firstChildState = childCheckedState;
3043
+ }
3044
+ else if (childCheckedState !== firstChildState) {
3045
+ mismatchFound = true;
3046
+ break;
3047
+ }
3048
+ }
3049
+ if (mismatchFound || firstChildState === null) {
3050
+ if (this.filterIndeterminateNodes.indexOf(parentUid) === -1) {
3051
+ this.filterIndeterminateNodes.push(parentUid);
3052
+ }
3053
+ var parentCheckedIndex = this.filterCheckedNodes.indexOf(parentUid);
3054
+ if (parentCheckedIndex !== -1) {
3055
+ this.filterCheckedNodes.splice(parentCheckedIndex, 1);
3056
+ }
3057
+ }
3058
+ else {
3059
+ var parentIndeterminateIndex = this.filterIndeterminateNodes.indexOf(parentUid);
3060
+ if (parentIndeterminateIndex !== -1) {
3061
+ this.filterIndeterminateNodes.splice(parentIndeterminateIndex, 1);
3062
+ }
3063
+ var parentCheckedIndex = this.filterCheckedNodes.indexOf(parentUid);
3064
+ if (firstChildState === true) {
3065
+ if (parentCheckedIndex === -1) {
3066
+ this.filterCheckedNodes.push(parentUid);
3067
+ }
3068
+ }
3069
+ else if (parentCheckedIndex !== -1) {
3070
+ this.filterCheckedNodes.splice(parentCheckedIndex, 1);
3071
+ }
3072
+ }
3073
+ }
3074
+ }
3075
+ parentLi = closest(closest(parentLi, '.' + PARENTITEM), '.' + LISTITEM);
3076
+ }
3077
+ }
2937
3078
  this.changeState(checkWrap, isCheck ? 'uncheck' : 'check', e, true);
2938
3079
  this.updateActiveClass(li, isCheck);
2939
3080
  if (this.autoCheck) {