tnx-shared 5.3.202 → 5.3.204

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.
Files changed (29) hide show
  1. package/bundles/tnx-shared.umd.js +104 -75
  2. package/bundles/tnx-shared.umd.js.map +1 -1
  3. package/bundles/tnx-shared.umd.min.js +1 -1
  4. package/bundles/tnx-shared.umd.min.js.map +1 -1
  5. package/classes/form-schema.d.ts +2 -2
  6. package/classes/form-schema.d.ts.map +1 -1
  7. package/components/crud/crud-form/crud-form.component.d.ts +1 -1
  8. package/components/crud/crud-form/crud-form.component.d.ts.map +1 -1
  9. package/components/datetime-picker/datetime-picker.component.d.ts.map +1 -1
  10. package/components/tn-dialog/tn-dialog.component.d.ts +1 -0
  11. package/components/tn-dialog/tn-dialog.component.d.ts.map +1 -1
  12. package/esm2015/classes/form-schema.js +2 -1
  13. package/esm2015/components/crud/crud-form/crud-form.component.js +43 -38
  14. package/esm2015/components/datetime-picker/datetime-picker.component.js +2 -2
  15. package/esm2015/components/tn-dialog/tn-dialog.component.js +4 -2
  16. package/esm2015/components/user-picker/user-picker.component.js +2 -2
  17. package/esm2015/models/notification-param.js +1 -1
  18. package/esm2015/services/announcements.service.js +3 -2
  19. package/esm2015/services/common.service.js +8 -2
  20. package/fesm2015/tnx-shared.js +57 -42
  21. package/fesm2015/tnx-shared.js.map +1 -1
  22. package/models/notification-param.d.ts +1 -0
  23. package/models/notification-param.d.ts.map +1 -1
  24. package/package.json +2 -2
  25. package/services/announcements.service.d.ts +1 -1
  26. package/services/announcements.service.d.ts.map +1 -1
  27. package/services/common.service.d.ts +1 -1
  28. package/services/common.service.d.ts.map +1 -1
  29. package/tnx-shared.metadata.json +1 -1
@@ -1349,6 +1349,7 @@ class UserPickerControlSchema extends FormControlBase {
1349
1349
  this.displayField = 'fullNameNew';
1350
1350
  this.fieldPlus = '';
1351
1351
  this.returnType = 'value';
1352
+ this.getDisplayName = false;
1352
1353
  this.fieldSearchText = [];
1353
1354
  this.operatorFieldSearchText = Operator.contain;
1354
1355
  this.usePicker = true;
@@ -3166,7 +3167,7 @@ class CommonService {
3166
3167
  // jQuery(".ql-toolbar").find(":button").attr("tabindex", "-1");
3167
3168
  }
3168
3169
  /** End disable editor tab */
3169
- processDateInput(inputValue, showTime, timeOnly = false) {
3170
+ processDateInput(inputValue, showTime, timeOnly = false, view = 'date') {
3170
3171
  if (!inputValue) {
3171
3172
  return null;
3172
3173
  }
@@ -3274,6 +3275,12 @@ class CommonService {
3274
3275
  return tryParseDate;
3275
3276
  }
3276
3277
  }
3278
+ else if (view == 'month') {
3279
+ const tryParseDate = this.tryParseExtractDate(`${inputValue}`, 'MM/YYYY');
3280
+ if (tryParseDate + '' != 'Invalid Date') {
3281
+ return tryParseDate;
3282
+ }
3283
+ }
3277
3284
  else {
3278
3285
  const tryParseDate = this.tryParseExtractDate(inputValue, 'DD/MM/YYYY');
3279
3286
  if (tryParseDate + '' != 'Invalid Date') {
@@ -12637,49 +12644,54 @@ class CrudFormComponent extends ComponentBase {
12637
12644
  // });
12638
12645
  }
12639
12646
  initControlDefaultValue(parentModel, control, parentPath) {
12640
- this.initPrivateData(parentModel, control.field);
12641
- let _parentPath = control.field;
12642
- if (parentPath != null)
12643
- _parentPath = parentPath + '.' + _parentPath;
12644
- if (control instanceof TableSchema) {
12645
- if (!parentModel[control.field] || !(parentModel[control.field] instanceof Array)) {
12646
- parentModel[control.field] = [];
12647
- }
12648
- const addMore = control.initRowCount - parentModel[control.field].length;
12649
- if (addMore > 0 && !parentModel._status[control.field].ready) {
12650
- parentModel._status[control.field].ready = true;
12651
- }
12652
- let i = 0;
12653
- for (const item of parentModel[control.field]) {
12654
- for (const subControl of control.rowTemplate) {
12655
- this.initControlDefaultValue(item, subControl, _parentPath + '[' + i + ']');
12647
+ return __awaiter(this, void 0, void 0, function* () {
12648
+ this.initPrivateData(parentModel, control.field);
12649
+ let _parentPath = control.field;
12650
+ if (parentPath != null)
12651
+ _parentPath = parentPath + '.' + _parentPath;
12652
+ if (control instanceof TableSchema) {
12653
+ if (!parentModel[control.field] || !(parentModel[control.field] instanceof Array)) {
12654
+ parentModel[control.field] = [];
12655
+ }
12656
+ const addMore = control.initRowCount - parentModel[control.field].length;
12657
+ if (addMore > 0 && !parentModel._status[control.field].ready) {
12658
+ parentModel._status[control.field].ready = true;
12659
+ }
12660
+ let i = 0;
12661
+ for (const item of parentModel[control.field]) {
12662
+ for (const subControl of control.rowTemplate) {
12663
+ this.initControlDefaultValue(item, subControl, _parentPath + '[' + i + ']');
12664
+ }
12665
+ i++;
12656
12666
  }
12657
- i++;
12658
- }
12659
- }
12660
- else if (control instanceof ContainerSchema) {
12661
- if (parentModel[control.field] == null || !isLiteralObject(parentModel[control.field])) {
12662
- parentModel[control.field] = {};
12663
- }
12664
- for (const subControl of control.controls) {
12665
- this.initControlDefaultValue(parentModel[control.field], subControl, _parentPath);
12666
12667
  }
12667
- }
12668
- else {
12669
- if (!parentModel.hasOwnProperty(control.field) && control.field != null) {
12670
- if (control.defaultValue !== null && control.defaultValue !== undefined) {
12671
- parentModel[control.field] = control.defaultValue;
12668
+ else if (control instanceof ContainerSchema) {
12669
+ if (parentModel[control.field] == null || !isLiteralObject(parentModel[control.field])) {
12670
+ parentModel[control.field] = {};
12671
+ }
12672
+ for (const subControl of control.controls) {
12673
+ this.initControlDefaultValue(parentModel[control.field], subControl, _parentPath);
12672
12674
  }
12673
- else if (control instanceof DropdownControlSchema) {
12674
- if (control.autoDisplayFirst
12675
- && control._component
12676
- && control._component._hasLoadedDatasource
12677
- && control._component.dataSourceInternal.length > 0) {
12678
- parentModel[control.field] = control._component.dataSourceInternal[0].value[control.valueField];
12675
+ }
12676
+ else {
12677
+ if (control.funcSetDefaultValue) {
12678
+ control.defaultValue = yield control.funcSetDefaultValue();
12679
+ }
12680
+ if (!parentModel.hasOwnProperty(control.field) && control.field != null) {
12681
+ if (control.defaultValue !== null && control.defaultValue !== undefined) {
12682
+ parentModel[control.field] = control.defaultValue;
12683
+ }
12684
+ else if (control instanceof DropdownControlSchema) {
12685
+ if (control.autoDisplayFirst
12686
+ && control._component
12687
+ && control._component._hasLoadedDatasource
12688
+ && control._component.dataSourceInternal.length > 0) {
12689
+ parentModel[control.field] = control._component.dataSourceInternal[0].value[control.valueField];
12690
+ }
12679
12691
  }
12680
12692
  }
12681
12693
  }
12682
- }
12694
+ });
12683
12695
  }
12684
12696
  initPrivateData(parentModel, field) {
12685
12697
  if (!parentModel._source)
@@ -34458,7 +34470,7 @@ class AnnouncementsService extends BaseService {
34458
34470
  }
34459
34471
  this.openThongBao(notificationParams);
34460
34472
  }
34461
- redirectToNotificationPage(orgIds = [], userIds = [], title, link, templateTextCode, objTemplate, isSendEmail = true, isChangeUser = true) {
34473
+ redirectToNotificationPage(orgIds = [], userIds = [], title, link, templateTextCode, objTemplate, isSendEmail = true, isChangeUser = true, emails = []) {
34462
34474
  return __awaiter(this, void 0, void 0, function* () {
34463
34475
  orgIds = this._commonService.distinctArray(orgIds);
34464
34476
  userIds = this._commonService.distinctArray(userIds);
@@ -34474,6 +34486,7 @@ class AnnouncementsService extends BaseService {
34474
34486
  }
34475
34487
  notificationParams.orgIds = orgIds.join(',');
34476
34488
  notificationParams.userIds = userIds.join(',');
34489
+ notificationParams.emails = emails.join(',');
34477
34490
  notificationParams.title = title;
34478
34491
  notificationParams.link = link ? encodeURIComponent(link) : '';
34479
34492
  notificationParams.templateTextCode = templateTextCode;
@@ -39673,7 +39686,7 @@ class DatetimePickerComponent {
39673
39686
  autoCorectDateTime(input) {
39674
39687
  if (input != '') {
39675
39688
  const dateValue = this.control.timeOnly ? `01/01/0001 ${input}` : input;
39676
- const result = this._commonService.processDateInput(dateValue, this.control.showTime, this.control.timeOnly);
39689
+ const result = this._commonService.processDateInput(dateValue, this.control.showTime, this.control.timeOnly, this.control.view);
39677
39690
  if (isValidDate(result)) {
39678
39691
  if (this.control.minDate || this.control.maxDate) {
39679
39692
  if (this.control.maxDate) {
@@ -44306,6 +44319,7 @@ class TnDialogComponent {
44306
44319
  this.showFooter = true;
44307
44320
  this.hiddenSave = true;
44308
44321
  this.maximizable = true;
44322
+ this.showHeader = true;
44309
44323
  this.onSave = new EventEmitter();
44310
44324
  this.onCancel = new EventEmitter();
44311
44325
  this.onShow = new EventEmitter();
@@ -44388,7 +44402,7 @@ class TnDialogComponent {
44388
44402
  TnDialogComponent.decorators = [
44389
44403
  { type: Component, args: [{
44390
44404
  selector: 'tn-dialog',
44391
- 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\"\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>",
44405
+ 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>",
44392
44406
  styles: [""]
44393
44407
  },] }
44394
44408
  ];
@@ -44417,6 +44431,7 @@ TnDialogComponent.propDecorators = {
44417
44431
  minY: [{ type: Input }],
44418
44432
  hiddenSave: [{ type: Input }],
44419
44433
  maximizable: [{ type: Input }],
44434
+ showHeader: [{ type: Input }],
44420
44435
  onSave: [{ type: Output }],
44421
44436
  onCancel: [{ type: Output }],
44422
44437
  onShow: [{ type: Output }],
@@ -45310,7 +45325,7 @@ class UserPickerComponent extends ComponentBase {
45310
45325
  ngOnInit() {
45311
45326
  this.control._component = this;
45312
45327
  const commonFieldPlus = 'maChucVu,lstTenDonVi';
45313
- this.controlPicker = new EntityPickerControlSchema(Object.assign(Object.assign({}, this.control), { field: 'arrIdNguoiDung', label: 'Người dùng', title: 'Chọn người dùng', baseService: this._userV5Service, required: true, displayField: this.control.getDisplayName ? 'displayName' : 'fullNameNew', fieldPlus: this.control.fieldPlus ? `${this.control.fieldPlus},${commonFieldPlus}` : commonFieldPlus, valueField: this.control.valueField, defaultFilters: this.control.defaultFilters, multiple: this.control.multiple, funcGetLabel: (item) => {
45328
+ this.controlPicker = new EntityPickerControlSchema(Object.assign(Object.assign({}, this.control), { field: 'arrIdNguoiDung', label: 'Người dùng', title: 'Chọn người dùng', baseService: this._userV5Service, required: true, displayField: this.control.getDisplayName ? 'displayName' : this.control.displayField, fieldPlus: this.control.fieldPlus ? `${this.control.fieldPlus},${commonFieldPlus}` : commonFieldPlus, valueField: this.control.valueField, defaultFilters: this.control.defaultFilters, multiple: this.control.multiple, funcGetLabel: (item) => {
45314
45329
  var _a;
45315
45330
  if (this.control.funcGetLabel)
45316
45331
  return this.control.funcGetLabel(item);