@syncfusion/ej2-navigations 26.1.39 → 26.1.41

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.
@@ -1760,7 +1760,8 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1760
1760
  else if (isOpen && isNullOrUndefined(ulIndex) && _this.navIdx.length) {
1761
1761
  _this.closeMenu(null, e);
1762
1762
  }
1763
- else if (isOpen && !_this.isMenu && !ulIndex && _this.navIdx.length === 0 && !_this.isMenusClosed && !_this.isCmenuHover) {
1763
+ else if (isOpen && !_this.isMenu && !ulIndex && _this.navIdx.length === 0 &&
1764
+ !_this.isMenusClosed && !_this.isCmenuHover) {
1764
1765
  _this.isMenusClosed = true;
1765
1766
  _this.closeMenu(0, e);
1766
1767
  }
@@ -3726,8 +3727,10 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
3726
3727
  this.unwireKeyboardEvent();
3727
3728
  window.removeEventListener('resize', this.resizeContext);
3728
3729
  window.removeEventListener('orientationchange', this.orientationChangeContext);
3729
- EventHandler.remove(document, 'scroll', this.docEvent);
3730
- EventHandler.remove(document, 'click', this.docEvent);
3730
+ document.removeEventListener('scroll', this.clickEvent);
3731
+ document.removeEventListener('click', this.scrollEvent);
3732
+ this.scrollEvent = null;
3733
+ this.clickEvent = null;
3731
3734
  };
3732
3735
  Toolbar.prototype.clearProperty = function () {
3733
3736
  this.tbarEle = [];
@@ -4126,6 +4129,8 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
4126
4129
  this.initialize();
4127
4130
  this.renderControl();
4128
4131
  this.wireEvents();
4132
+ this.clickEvent = this.docEvent.bind(this);
4133
+ this.scrollEvent = this.docEvent.bind(this);
4129
4134
  this.renderComplete();
4130
4135
  if (this.isReact && this.portals && this.portals.length > 0) {
4131
4136
  this.renderReactTemplates(function () {
@@ -4511,8 +4516,8 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
4511
4516
  popup.offsetX = 0;
4512
4517
  }
4513
4518
  popup.appendTo(ele);
4514
- EventHandler.add(document, 'scroll', this.docEvent.bind(this));
4515
- EventHandler.add(document, 'click ', this.docEvent.bind(this));
4519
+ document.addEventListener('scroll', this.clickEvent);
4520
+ document.addEventListener('click', this.scrollEvent);
4516
4521
  if (this.overflowMode !== 'Extended') {
4517
4522
  popup.element.style.maxHeight = popup.element.offsetHeight + 'px';
4518
4523
  }
@@ -10137,7 +10142,7 @@ var DISABLE = 'e-disable';
10137
10142
  var DROPCOUNT = 'e-drop-count';
10138
10143
  var CHECK = 'e-check';
10139
10144
  var INDETERMINATE = 'e-stop';
10140
- var CHECKBOXWRAP = 'e-checkbox-wrapper';
10145
+ var CHECKBOXWRAP = 'e-treeview-checkbox';
10141
10146
  var CHECKBOXFRAME = 'e-frame';
10142
10147
  var CHECKBOXRIPPLE = 'e-ripple-container';
10143
10148
  var RIPPLE = 'e-ripple';
@@ -10285,6 +10290,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
10285
10290
  _this.isRightClick = false;
10286
10291
  _this.mouseDownStatus = false;
10287
10292
  _this.isDropIn = false;
10293
+ _this.OldCheckedData = [];
10288
10294
  return _this;
10289
10295
  }
10290
10296
  TreeView_1 = TreeView;
@@ -10358,6 +10364,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
10358
10364
  this.expandChildren = [];
10359
10365
  this.index = 0;
10360
10366
  this.setTouchClass();
10367
+ this.DDTTreeData = JSON.parse(JSON.stringify(this.fields.dataSource));
10361
10368
  if (isNullOrUndefined(this.selectedNodes)) {
10362
10369
  this.setProperties({ selectedNodes: [] }, true);
10363
10370
  }
@@ -10736,23 +10743,38 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
10736
10743
  TreeView.prototype.updateParentCheckState = function () {
10737
10744
  var indeterminate = selectAll('.' + INDETERMINATE, this.element);
10738
10745
  var childCheckedElement;
10746
+ var data = this.treeData;
10747
+ if (this.element.classList.contains('e-filtering')) {
10748
+ data = this.DDTTreeData;
10749
+ }
10739
10750
  for (var i = 0; i < indeterminate.length; i++) {
10740
10751
  var node = closest(indeterminate[parseInt(i.toString(), 10)], '.' + LISTITEM);
10741
10752
  var nodeId = node.getAttribute('data-uid').toString();
10753
+ var OldCheckedNodes = void 0;
10754
+ if (this.element.classList.contains('e-filtering')) {
10755
+ OldCheckedNodes = new DataManager(this.OldCheckedData).executeLocal(new Query().where('parentID', 'equal', nodeId, true));
10756
+ }
10742
10757
  if (this.dataType === 1) {
10743
- childCheckedElement = new DataManager(this.treeData).
10758
+ childCheckedElement = new DataManager(data).
10744
10759
  executeLocal(new Query().where(this.fields.parentID, 'equal', nodeId, true));
10745
10760
  }
10746
10761
  else {
10747
- childCheckedElement = this.getChildNodes(this.treeData, nodeId);
10762
+ childCheckedElement = this.getChildNodes(data, nodeId);
10748
10763
  }
10749
10764
  var count = 0;
10750
10765
  if (childCheckedElement) {
10751
- for (var j = 0; j < childCheckedElement.length; j++) {
10752
- var childId = childCheckedElement[parseInt(j.toString(), 10)][this.fields.id].toString();
10753
- if (this.checkedNodes.indexOf(childId) !== -1) {
10766
+ var _loop_1 = function (j) {
10767
+ var childId = childCheckedElement[parseInt(j.toString(), 10)][this_1.fields.id].toString();
10768
+ if (this_1.checkedNodes.indexOf(childId) !== -1) {
10754
10769
  count++;
10755
10770
  }
10771
+ else if (this_1.element.classList.contains('e-filtering') && OldCheckedNodes.findIndex(function (e) { return e['id'] === childId; }) !== -1) {
10772
+ count++;
10773
+ }
10774
+ };
10775
+ var this_1 = this;
10776
+ for (var j = 0; j < childCheckedElement.length; j++) {
10777
+ _loop_1(j);
10756
10778
  }
10757
10779
  if (count === childCheckedElement.length) {
10758
10780
  var nodeCheck = node.getAttribute('data-uid');
@@ -10845,6 +10867,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
10845
10867
  TreeView.prototype.beforeNodeCreate = function (e) {
10846
10868
  if (this.showCheckBox) {
10847
10869
  var checkboxEle = createCheckBox(this.createElement, true, { cssClass: this.touchClass });
10870
+ checkboxEle.classList.add(CHECKBOXWRAP);
10848
10871
  var icon = select('div.' + ICON, e.item);
10849
10872
  var id = e.item.getAttribute('data-uid');
10850
10873
  e.item.childNodes[0].insertBefore(checkboxEle, e.item.childNodes[0].childNodes[isNullOrUndefined(icon) ? 0 : 1]);
@@ -11031,13 +11054,28 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11031
11054
  var indeterminateNodes = selectAll('.' + INDETERMINATE, ulElement);
11032
11055
  var nodes = selectAll('.' + LISTITEM, ulElement);
11033
11056
  var checkBoxEle = element.getElementsByClassName(CHECKBOXWRAP)[0];
11034
- if (nodes.length === checkedNodes.length) {
11057
+ var count = nodes.length;
11058
+ var checkedCount = checkedNodes.length;
11059
+ var dataUid = element.getAttribute('data-uid');
11060
+ if (this.element.classList.contains('e-filtering')) {
11061
+ var oldCheckedNodes = new DataManager(this.OldCheckedData).executeLocal(new Query().where('parentID', 'equal', dataUid, true));
11062
+ checkedCount = oldCheckedNodes.length;
11063
+ var childItems = [];
11064
+ if (this.dataType === 1) {
11065
+ childItems = new DataManager(this.DDTTreeData).executeLocal(new Query().where(this.fields.parentID, 'equal', dataUid, true));
11066
+ }
11067
+ else {
11068
+ childItems = this.getChildNodes(this.DDTTreeData, dataUid);
11069
+ }
11070
+ count = childItems.length;
11071
+ }
11072
+ if (count === checkedCount) {
11035
11073
  this.changeState(checkBoxEle, 'check', null, true, true);
11036
11074
  }
11037
- else if (checkedNodes.length > 0 || indeterminateNodes.length > 0) {
11075
+ else if (checkedCount > 0 || indeterminateNodes.length > 0) {
11038
11076
  this.changeState(checkBoxEle, 'indeterminate', null, true, true);
11039
11077
  }
11040
- else if (checkedNodes.length === 0) {
11078
+ else if (checkedCount === 0) {
11041
11079
  this.changeState(checkBoxEle, 'uncheck', null, true, true);
11042
11080
  }
11043
11081
  var parentUL = closest(element, '.' + PARENTITEM);
@@ -11673,6 +11711,25 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11673
11711
  eventArgs.data = eventArgs.data.splice(0, eventArgs.data.length - 1);
11674
11712
  this.trigger('nodeChecked', eventArgs);
11675
11713
  };
11714
+ TreeView.prototype.updateOldCheckedData = function (data) {
11715
+ var dataManager = new DataManager(data);
11716
+ var childItems = dataManager.executeLocal(new Query().where('isChecked', 'equal', 'true', true));
11717
+ var uncheckedItems = dataManager.executeLocal(new Query().where('isChecked', 'equal', 'false', true));
11718
+ if (uncheckedItems.length > 0) {
11719
+ var index = this.OldCheckedData.findIndex(function (e) { return e['id'] === uncheckedItems[0]['id']; });
11720
+ if (index !== -1) {
11721
+ this.OldCheckedData.splice(index, 1);
11722
+ return;
11723
+ }
11724
+ }
11725
+ if (childItems.length > 0) {
11726
+ var index = this.OldCheckedData.findIndex(function (e) { return e['id'] === childItems[0]['id']; });
11727
+ if (index === -1) {
11728
+ this.OldCheckedData.push(childItems[0]);
11729
+ return;
11730
+ }
11731
+ }
11732
+ };
11676
11733
  TreeView.prototype.triggerClickEvent = function (e, li) {
11677
11734
  var eventArgs = {
11678
11735
  event: e,
@@ -12526,6 +12583,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12526
12583
  this.changeState(checkWrap, isCheck ? 'uncheck' : 'check', e, true);
12527
12584
  if (this.autoCheck) {
12528
12585
  this.ensureChildCheckState(li);
12586
+ this.updateOldCheckedData([this.getNodeData(li)]);
12529
12587
  this.ensureParentCheckState(closest(closest(li, '.' + PARENTITEM), '.' + LISTITEM));
12530
12588
  var doCheck = void 0;
12531
12589
  if (eventArgs.action === 'check') {
@@ -14898,6 +14956,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
14898
14956
  this.initialRender = true;
14899
14957
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14900
14958
  if (!this.isReact || this.isReact && !(this.fields.dataSource instanceof DataManager)) {
14959
+ if (!this.element.classList.contains('e-filtering')) {
14960
+ this.DDTTreeData = JSON.parse(JSON.stringify(this.fields.dataSource));
14961
+ }
14901
14962
  this.reRenderNodes();
14902
14963
  }
14903
14964
  this.initialRender = false;
@@ -19100,9 +19161,19 @@ var Stepper = /** @__PURE__ @class */ (function (_super) {
19100
19161
  if (_this.stepperItemList && _this.progressbar && _this.element.classList.contains(HORIZSTEP)) {
19101
19162
  _this.setProgressPosition(_this.element, true);
19102
19163
  }
19164
+ _this.navigateToStep(_this.activeStep, null, null, false);
19103
19165
  }, this);
19104
19166
  EventHandler.add(window, 'click', function () { _this.updateStepFocus(); }, this);
19105
19167
  };
19168
+ Stepper.prototype.unWireEvents = function () {
19169
+ var _this = this;
19170
+ EventHandler.remove(window, 'resize', function () {
19171
+ if (_this.stepperItemList && _this.progressbar && _this.element.classList.contains(HORIZSTEP)) {
19172
+ _this.setProgressPosition(_this.element, true);
19173
+ }
19174
+ });
19175
+ EventHandler.remove(window, 'click', function () { _this.updateStepFocus(); });
19176
+ };
19106
19177
  Stepper.prototype.updateStepFocus = function () {
19107
19178
  if (this.isKeyNavFocus) {
19108
19179
  this.isKeyNavFocus = false;
@@ -19766,16 +19837,31 @@ var Stepper = /** @__PURE__ @class */ (function (_super) {
19766
19837
  }
19767
19838
  this.stepperItemElements = [];
19768
19839
  };
19840
+ /**
19841
+ * Move to next step from current step in Stepper.
19842
+ *
19843
+ * @returns {void}
19844
+ */
19769
19845
  Stepper.prototype.nextStep = function () {
19770
19846
  if (this.activeStep !== this.steps.length - 1) {
19771
19847
  this.navigateToStep(this.activeStep + 1, null, null, false);
19772
19848
  }
19773
19849
  };
19850
+ /**
19851
+ * Move to previous step from current step in Stepper.
19852
+ *
19853
+ * @returns {void}
19854
+ */
19774
19855
  Stepper.prototype.previousStep = function () {
19775
19856
  if (this.activeStep > 0) {
19776
19857
  this.navigateToStep(this.activeStep - 1, null, null, false);
19777
19858
  }
19778
19859
  };
19860
+ /**
19861
+ * Reset the state of the Stepper and move to the first step.
19862
+ *
19863
+ * @returns {void}
19864
+ */
19779
19865
  Stepper.prototype.reset = function () {
19780
19866
  if (this.activeStep === 0) {
19781
19867
  this.updateStepInteractions();
@@ -19785,18 +19871,30 @@ var Stepper = /** @__PURE__ @class */ (function (_super) {
19785
19871
  this.navigateToStep(isDisabled ? -1 : 0, null, null, false);
19786
19872
  }
19787
19873
  };
19874
+ /**
19875
+ * Refreshes the position of the progress bar programmatically when the dimensions of the parent container are changed.
19876
+ *
19877
+ * @returns {void}
19878
+ */
19879
+ Stepper.prototype.refreshProgressbar = function () {
19880
+ if (this.stepperItemList && this.progressbar) {
19881
+ this.setProgressPosition(this.element);
19882
+ }
19883
+ this.navigateToStep(this.activeStep, null, null, false);
19884
+ };
19788
19885
  Stepper.prototype.updateElementClassArray = function () {
19789
19886
  var classArray = [RTL$3, READONLY, 'e-steps-focus', LABELAFTER, LABELBEFORE, 'e-label-top',
19790
19887
  'e-label-bottom', 'e-label-start', 'e-label-end', STEPINDICATOR, LABELINDICATOR, VERTICALSTEP, HORIZSTEP, LINEARSTEP];
19791
19888
  removeClass([this.element], classArray);
19792
19889
  };
19890
+ /**
19891
+ * Destroy the stepper control.
19892
+ *
19893
+ * @returns {void}
19894
+ */
19793
19895
  Stepper.prototype.destroy = function () {
19794
- var _this = this;
19795
19896
  _super.prototype.destroy.call(this);
19796
- EventHandler.remove(window, 'resize', function () { if (_this.stepperItemList && _this.progressbar) {
19797
- _this.setProgressPosition(_this.element, true);
19798
- } });
19799
- EventHandler.remove(window, 'click', function () { _this.updateStepFocus(); });
19897
+ this.unWireEvents();
19800
19898
  // unwires the events and detach the li elements
19801
19899
  this.removeItemElements();
19802
19900
  this.clearTemplate();