tnx-shared 5.3.335 → 5.3.336

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.
@@ -4679,6 +4679,7 @@ var EnumProperties;
4679
4679
  EnumProperties["NG_REFLECT_TEXT"] = "ng-reflect-text";
4680
4680
  EnumProperties["NG_REFLECT_LABEL"] = "ng-reflect-label";
4681
4681
  EnumProperties["CRUD_LIST"] = "crud-list";
4682
+ EnumProperties["TREE_LIST"] = "tn-tree-table";
4682
4683
  EnumProperties["LABEL"] = "label";
4683
4684
  EnumProperties["TAG_NAME"] = "tagName";
4684
4685
  EnumProperties["TOOLTIP"] = "ptooltip";
@@ -10388,6 +10389,14 @@ class UserService extends BaseService {
10388
10389
  const url = `${this.serviceUri}/ValidatePassword/?password=${password}`;
10389
10390
  return this.defaultGet(url);
10390
10391
  }
10392
+ getUserCache(cacheKey) {
10393
+ const url = `${this.serviceUri}/GetUserCache/${cacheKey}`;
10394
+ return this.defaultGet(url);
10395
+ }
10396
+ setUserCache(data) {
10397
+ const url = `${this.serviceUri}/SetUserCache`;
10398
+ return this.defaultPost(url, data);
10399
+ }
10391
10400
  }
10392
10401
  UserService.ɵprov = i0.ɵɵdefineInjectable({ factory: function UserService_Factory() { return new UserService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService), i0.ɵɵinject(AuthenService), i0.ɵɵinject(i4.OAuthService), i0.ɵɵinject(SignalRService), i0.ɵɵinject(ExceptionHandlerService), i0.ɵɵinject(ApplicationContextService)); }, token: UserService, providedIn: "root" });
10393
10402
  UserService.decorators = [
@@ -19450,7 +19459,6 @@ class ListComponentBase extends ComponentBase {
19450
19459
  }
19451
19460
  }
19452
19461
  initColumnSchema(cols) {
19453
- var _a, _b, _c, _d, _e;
19454
19462
  if (!cols || !cols.length)
19455
19463
  return;
19456
19464
  let colFunction = null, colGroup = null, colHasToggleIcon = null;
@@ -19473,7 +19481,7 @@ class ListComponentBase extends ComponentBase {
19473
19481
  colHasToggleIcon = this.setting.cols[0];
19474
19482
  }
19475
19483
  colHasToggleIcon.colHasToggleIcon = true;
19476
- this.componentKey = `${location.pathname}/${((_e = (_d = (_c = (_b = (_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.closest('crud-list')) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.tagName) === null || _e === void 0 ? void 0 : _e.toLowerCase()) || ''}${this.setting.settingKey ? '/' + this.setting.settingKey : ''}`;
19484
+ this.getComponentKey();
19477
19485
  this.getColorSetting();
19478
19486
  this.getColumnSetting(colGroup);
19479
19487
  this.getPageSetting();
@@ -19482,6 +19490,12 @@ class ListComponentBase extends ComponentBase {
19482
19490
  this.applyColumnSetting();
19483
19491
  this.buildFilterColumn(this.setting.cols);
19484
19492
  }
19493
+ getComponentKey() {
19494
+ var _a, _b, _c, _d, _e;
19495
+ const parentClass = this.isTreeTable ? EnumProperties.TREE_LIST : EnumProperties.CRUD_LIST;
19496
+ const componentName = ((_e = (_d = (_c = (_b = (_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.closest(parentClass)) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.tagName) === null || _e === void 0 ? void 0 : _e.toLowerCase()) || '';
19497
+ this.componentKey = `${location.pathname}${componentName ? '/' + componentName : ''}${this.setting.settingKey ? '/' + this.setting.settingKey : ''}`;
19498
+ }
19485
19499
  extendColumns(cols, appendCol = true) {
19486
19500
  this.setting.fieldNeedGetRef = [];
19487
19501
  if (!cols) {
@@ -23870,11 +23884,12 @@ class ListBase extends ComponentBaseWithButton {
23870
23884
  // #region crud
23871
23885
  loadItemFromQueryParam() {
23872
23886
  if (this.loadDetailFromQueryParam === undefined || this.loadDetailFromQueryParam === true) {
23873
- let idInQueryString = null;
23887
+ let idInQueryString = null, isView = false;
23874
23888
  let pid = null; // permission Id được người khác share
23875
23889
  if (this._activatedRoute.snapshot
23876
23890
  && this._activatedRoute.snapshot.queryParams) {
23877
23891
  idInQueryString = this._activatedRoute.snapshot.queryParams.id || this._activatedRoute.snapshot.queryParams.entityKey;
23892
+ isView = !!this._activatedRoute.snapshot.queryParams.isView;
23878
23893
  pid = this._activatedRoute.snapshot.queryParams.pid;
23879
23894
  }
23880
23895
  if (pid) {
@@ -23882,22 +23897,36 @@ class ListBase extends ComponentBaseWithButton {
23882
23897
  }
23883
23898
  else if (idInQueryString) {
23884
23899
  // get detail data
23885
- this.setting.baseService.getDetailWithPermission(idInQueryString)
23886
- .then(res => {
23887
- if (!res.data) {
23900
+ if (isView) {
23901
+ this.setting.baseService.getDetail(idInQueryString)
23902
+ .then(res => {
23903
+ if (!res.data) {
23904
+ this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
23905
+ }
23906
+ this._viewOnly(res.data);
23907
+ }).catch(err => {
23908
+ this._loggerService.logError('error on get detail from querystring', err);
23888
23909
  this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
23889
- }
23890
- if ((res.data.basePermission & PermissionBase.EDIT) == PermissionBase.EDIT
23891
- || (res.data.basePermission & PermissionBase.READ) == PermissionBase.READ) {
23892
- this._edit(res.data);
23893
- }
23894
- else {
23895
- this._notifierService.showWarning('Bạn không quyền xem bản ghi');
23896
- }
23897
- }).catch(err => {
23898
- this._loggerService.logError('error on get detail from querystring', err);
23899
- this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
23900
- });
23910
+ });
23911
+ }
23912
+ else {
23913
+ this.setting.baseService.getDetailWithPermission(idInQueryString)
23914
+ .then(res => {
23915
+ if (!res.data) {
23916
+ this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
23917
+ }
23918
+ if ((res.data.basePermission & PermissionBase.EDIT) == PermissionBase.EDIT
23919
+ || (res.data.basePermission & PermissionBase.READ) == PermissionBase.READ) {
23920
+ this._edit(res.data);
23921
+ }
23922
+ else {
23923
+ this._notifierService.showWarning('Bạn không có quyền xem bản ghi');
23924
+ }
23925
+ }).catch(err => {
23926
+ this._loggerService.logError('error on get detail from querystring', err);
23927
+ this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
23928
+ });
23929
+ }
23901
23930
  }
23902
23931
  }
23903
23932
  }
@@ -46480,7 +46509,7 @@ class TnDialogComponent {
46480
46509
  TnDialogComponent.decorators = [
46481
46510
  { type: Component, args: [{
46482
46511
  selector: 'tn-dialog',
46483
- template: "<p-dialog #dialog [closeOnEscape]=\"closeOnEscape\" [appendTo]=\"'body'\" [focusOnShow]=\"false\" [focusTrap]=\"false\"\n [header]=\"header | translate\" [(visible)]=\"visible\" [modal]=\"modal\" [responsive]=\"true\" [maximizable]=\"maximizable\"\n [autoZIndex]=\"true\" [styleClass]=\"styleClass\" [maskStyleClass]=\"maskClass\" [showHeader]=\"showHeader\"\n [style]=\"{'width': popupSize.width + 'px', 'min-width': popupSize.width + 'px', 'height': popupSize.height + 'px', 'min-height': popupSize.height + 'px'}\"\n (onShow)=\"handleShowDialog($event)\" (onHide)=\"handleHideDialog($event)\">\n <tn-custom-scrollbar #scrollbar [useDefaultScrollBar]=\"useDefaultScrollBar\" [class]=\"scrollBarStyleClass\"\n [config]=\"scrollConfig\" [style]=\"scrollStyle\" class=\"tn-dialog-scrollbar\">\n <ng-content></ng-content>\n </tn-custom-scrollbar>\n <p-footer *ngIf=\"showFooter\">\n <p-footer *ngIf=\"formBase && formBase.buttonTemplate\" style=\"display: flex;float: right\">\n <ng-container *ngTemplateOutlet=\"formBase.buttonTemplate\">\n </ng-container>\n </p-footer>\n <ng-container *ngIf=\"!formBase || !formBase.buttonTemplate\">\n <p-footer *ngIf=\"footer\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"buttonTemplateInput\">\n <ng-container *ngTemplateOutlet=\"buttonTemplateInput\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"!footer && !buttonTemplateInput\">\n <button pButton preventTab type=\"button\" icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\n [label]=\"'FORM.CANCEL' | translate\" (click)=\"handleHideDialog($event)\"></button>\n </p-footer>\n </ng-container>\n </p-footer>\n</p-dialog>",
46512
+ template: "<p-dialog #dialog [closeOnEscape]=\"closeOnEscape\" [appendTo]=\"'body'\" [focusOnShow]=\"false\" [focusTrap]=\"false\"\n [(visible)]=\"visible\" [modal]=\"modal\" [responsive]=\"true\" [maximizable]=\"maximizable\" [autoZIndex]=\"true\"\n [styleClass]=\"styleClass\" [maskStyleClass]=\"maskClass\" [showHeader]=\"showHeader\"\n [style]=\"{'width': popupSize.width + 'px', 'min-width': popupSize.width + 'px', 'height': popupSize.height + 'px', 'min-height': popupSize.height + 'px'}\"\n (onShow)=\"handleShowDialog($event)\" (onHide)=\"handleHideDialog($event)\">\n <tn-custom-scrollbar #scrollbar [useDefaultScrollBar]=\"useDefaultScrollBar\" [class]=\"scrollBarStyleClass\"\n [config]=\"scrollConfig\" [style]=\"scrollStyle\" class=\"tn-dialog-scrollbar\">\n <ng-content></ng-content>\n </tn-custom-scrollbar>\n <p-header *ngIf=\"showHeader\">\n <ng-container *ngIf=\"header && !headerTemplate\">\n <div>{{header | translate}}</div>\n </ng-container>\n <ng-container *ngIf=\"headerTemplate\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-container>\n </p-header>\n <p-footer *ngIf=\"showFooter\">\n <p-footer *ngIf=\"formBase && formBase.buttonTemplate\" style=\"display: flex;float: right\">\n <ng-container *ngTemplateOutlet=\"formBase.buttonTemplate\">\n </ng-container>\n </p-footer>\n <ng-container *ngIf=\"!formBase || !formBase.buttonTemplate\">\n <p-footer *ngIf=\"footer\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"buttonTemplateInput\">\n <ng-container *ngTemplateOutlet=\"buttonTemplateInput\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"!footer && !buttonTemplateInput\">\n <button pButton preventTab type=\"button\" icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\n [label]=\"'FORM.CANCEL' | translate\" (click)=\"handleHideDialog($event)\"></button>\n </p-footer>\n </ng-container>\n </p-footer>\n</p-dialog>",
46484
46513
  styles: [""]
46485
46514
  },] }
46486
46515
  ];
@@ -46493,6 +46522,7 @@ TnDialogComponent.propDecorators = {
46493
46522
  scrollbar: [{ type: ViewChild, args: ['scrollbar', { static: true },] }],
46494
46523
  formBase: [{ type: ContentChild, args: ['formBase', { static: false },] }],
46495
46524
  footer: [{ type: ContentChild, args: ['footer', { static: true },] }],
46525
+ headerTemplate: [{ type: ContentChild, args: ['headerTemplate', { static: true },] }],
46496
46526
  children: [{ type: ContentChildren, args: [TemplateRef, { descendants: true },] }],
46497
46527
  maskClass: [{ type: Input }],
46498
46528
  styleClass: [{ type: Input }],