tnx-shared 5.3.370 → 5.3.372

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.
@@ -14485,6 +14485,25 @@ class CrudFormComponent extends ComponentBase {
14485
14485
  }
14486
14486
  }));
14487
14487
  }
14488
+ genDicComponent(root) {
14489
+ const result = {};
14490
+ const stack = []; // Khởi tạo stack
14491
+ stack.push(root); // Đẩy node gốc vào stack
14492
+ while (stack.length > 0) {
14493
+ // Lấy node hiện tại ra khỏi stack
14494
+ const currentNode = stack.pop();
14495
+ if (currentNode.component) {
14496
+ result[currentNode.modelPath] = currentNode.component;
14497
+ }
14498
+ // Đẩy các node con vào stack (theo chiều ngược lại để đảm bảo thứ tự duyệt)
14499
+ if (currentNode.childNodes) {
14500
+ for (let i = currentNode.childNodes.length - 1; i >= 0; i--) {
14501
+ stack.push(currentNode.childNodes[i]);
14502
+ }
14503
+ }
14504
+ }
14505
+ return result;
14506
+ }
14488
14507
  addNewRow(control, tablePath, eventType, disableOpenDialog = false, initData = {}, fireEventFinish = true) {
14489
14508
  return __awaiter(this, void 0, void 0, function* () {
14490
14509
  if (control.showEdit && !disableOpenDialog) {
@@ -14527,8 +14546,10 @@ class CrudFormComponent extends ComponentBase {
14527
14546
  }
14528
14547
  }
14529
14548
  if (toAdd !== false) {
14549
+ const dicComponent = this.genDicComponent(this._rootNode);
14530
14550
  tableNode.model.push(data);
14531
14551
  tableNode.reinitChildNodes(fireEventFinish);
14552
+ this.setOldComponentWhenInitNode(tableNode, dicComponent);
14532
14553
  if (eventType != this.eventType.INIT) {
14533
14554
  this.fireModelChanged();
14534
14555
  }
@@ -14572,6 +14593,26 @@ class CrudFormComponent extends ComponentBase {
14572
14593
  }
14573
14594
  });
14574
14595
  }
14596
+ setOldComponentWhenInitNode(root, dicComponent) {
14597
+ const stack = []; // Khởi tạo stack
14598
+ stack.push(root); // Đẩy node gốc vào stack
14599
+ while (stack.length > 0) {
14600
+ // Lấy node hiện tại ra khỏi stack
14601
+ const currentNode = stack.pop();
14602
+ if (currentNode.modelPath) {
14603
+ const component = dicComponent[currentNode.modelPath];
14604
+ if (component) {
14605
+ currentNode.component = component;
14606
+ }
14607
+ }
14608
+ // Đẩy các node con vào stack (theo chiều ngược lại để đảm bảo thứ tự duyệt)
14609
+ if (currentNode.childNodes) {
14610
+ for (let i = currentNode.childNodes.length - 1; i >= 0; i--) {
14611
+ stack.push(currentNode.childNodes[i]);
14612
+ }
14613
+ }
14614
+ }
14615
+ }
14575
14616
  addMultiRow(control, length, tablePath, eventType) {
14576
14617
  for (let i = 0; i < length; i++) {
14577
14618
  this.addNewRow(control, tablePath, eventType, true);
@@ -34478,7 +34519,7 @@ class CommonLibComponent {
34478
34519
  CommonLibComponent.decorators = [
34479
34520
  { type: Component, args: [{
34480
34521
  selector: 'common-lib',
34481
- template: "<div #commonapp></div>\n<p-toast [position]=\"'top-right'\" [autoZIndex]=\"true\"></p-toast>\n<p-confirmDialog #cd [closable]=\"false\">\n <p-footer>\n <button *ngIf=\"cd.acceptVisible\" #okButton type=\"button\" pButton icon=\"pi pi-check\"\n class=\"p-button-rounded p-button-text\" [label]=\"cd.acceptButtonLabel\"\n (keydown.shift.tab)=\"focusTrap($event, false)\" (click)=\"cd.accept()\"></button>\n <button *ngIf=\"cd.rejectVisible\" #cancelButton type=\"button\" pButton\n class=\"p-button-rounded p-button-text p-button-secondary\" icon=\"pi pi-times\" [label]=\"cd.rejectButtonLabel\"\n (keydown.tab)=\"focusTrap($event, true)\" (click)=\"cd.reject()\"></button>\n </p-footer>\n</p-confirmDialog>",
34522
+ template: "<div #commonapp></div>\n<p-toast [position]=\"'top-right'\" [autoZIndex]=\"true\"></p-toast>\n<p-confirmDialog #cd [closable]=\"false\">\n <p-footer>\n <button *ngIf=\"cd.confirmationOptions && cd.confirmationOptions.acceptVisible\" #okButton type=\"button\" pButton\n icon=\"pi pi-check\" class=\"p-button-rounded p-button-text\" [label]=\"cd.acceptButtonLabel\"\n (keydown.shift.tab)=\"focusTrap($event, false)\" (click)=\"cd.accept()\"></button>\n <button *ngIf=\"cd.confirmationOptions && cd.confirmationOptions.rejectVisible\" #cancelButton type=\"button\"\n pButton class=\"p-button-rounded p-button-text p-button-secondary\" icon=\"pi pi-times\"\n [label]=\"cd.rejectButtonLabel\" (keydown.tab)=\"focusTrap($event, true)\" (click)=\"cd.reject()\"></button>\n </p-footer>\n</p-confirmDialog>",
34482
34523
  providers: [ComponentContextService],
34483
34524
  styles: [""]
34484
34525
  },] }