tnx-shared 5.3.290 → 5.3.292

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 (34) hide show
  1. package/bundles/tnx-shared.umd.js +180 -136
  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/base/list-base.d.ts +4 -3
  6. package/classes/base/list-base.d.ts.map +1 -1
  7. package/classes/base/list-component-base.d.ts.map +1 -1
  8. package/classes/form-schema.d.ts +1 -0
  9. package/classes/form-schema.d.ts.map +1 -1
  10. package/components/autocomplete-picker/autocomplete-picker.component.d.ts.map +1 -1
  11. package/components/common-search-form/common-search-form.component.d.ts.map +1 -1
  12. package/components/dropdown/dropdown.component.d.ts +2 -0
  13. package/components/dropdown/dropdown.component.d.ts.map +1 -1
  14. package/components/entity-picker/entity-picker-dialog/components/entity-picker-data/entity-picker-data.component.d.ts.map +1 -1
  15. package/components/entity-picker/entity-picker-dialog/components/entity-picker-selected/entity-picker-selected.component.d.ts.map +1 -1
  16. package/esm2015/classes/base/list-base.js +56 -39
  17. package/esm2015/classes/base/list-component-base.js +3 -3
  18. package/esm2015/classes/form-schema.js +2 -1
  19. package/esm2015/components/autocomplete-picker/autocomplete-picker.component.js +7 -5
  20. package/esm2015/components/common-search-form/common-search-form.component.js +5 -2
  21. package/esm2015/components/dropdown/dropdown.component.js +19 -23
  22. package/esm2015/components/entity-picker/entity-picker-dialog/components/entity-picker-data/entity-picker-data.component.js +2 -1
  23. package/esm2015/components/entity-picker/entity-picker-dialog/components/entity-picker-selected/entity-picker-selected.component.js +2 -1
  24. package/esm2015/services/base.service.js +5 -3
  25. package/esm2015/services/canbo-hoso.service.js +7 -3
  26. package/esm2015/services/dm-chucvu.service.js +1 -2
  27. package/fesm2015/tnx-shared.js +95 -70
  28. package/fesm2015/tnx-shared.js.map +1 -1
  29. package/package.json +2 -2
  30. package/services/base.service.d.ts +0 -2
  31. package/services/base.service.d.ts.map +1 -1
  32. package/services/canbo-hoso.service.d.ts.map +1 -1
  33. package/services/dm-chucvu.service.d.ts.map +1 -1
  34. package/tnx-shared.metadata.json +1 -1
@@ -1481,6 +1481,7 @@ class DropdownControlSchema extends DataSourceControlSchema {
1481
1481
  this.insertPlusUrl = '';
1482
1482
  this.loadInFirstDisplay = true;
1483
1483
  this.autoGetData = true;
1484
+ this.isAllowDisabled = true;
1484
1485
  this.valueField = 'id';
1485
1486
  this.displayField = 'ten';
1486
1487
  this.autoDisplayFirst = false;
@@ -6661,6 +6662,7 @@ const EXCEL_TYPE$1 = 'application/vnd.openxmlformats-officedocument.spreadsheetm
6661
6662
  const EXCEL_EXTENSION$1 = '.xlsx';
6662
6663
  class BaseService {
6663
6664
  constructor(http, injector, serviceUri) {
6665
+ var _a, _b;
6664
6666
  this.serviceUri = '';
6665
6667
  this.endPoint = '';
6666
6668
  this.serviceCode = '';
@@ -6670,8 +6672,6 @@ class BaseService {
6670
6672
  this.apiGetData = 'GetData';
6671
6673
  this.apiGetAll = 'GetAllByFilter';
6672
6674
  this.apiGetDetailByFilter = 'GetByFilter';
6673
- this.fieldSort = '';
6674
- this.fieldSuDung = '';
6675
6675
  this.disableFieldNotUse = false;
6676
6676
  this.RETRY_COUNT = 0;
6677
6677
  this.REPLAY_COUNT = 1;
@@ -6681,6 +6681,8 @@ class BaseService {
6681
6681
  this.serviceUri = serviceUri;
6682
6682
  this._commonService = injector.get(CommonService);
6683
6683
  this._signalrServicePrivate = injector.get(SignalRService);
6684
+ const environment = this._injector.get(ModuleConfigService).getConfig().environment;
6685
+ this.disableFieldNotUse = (_b = (_a = environment === null || environment === void 0 ? void 0 : environment.cauHinhNghiepVu) === null || _a === void 0 ? void 0 : _a.disableFieldNotUse) !== null && _b !== void 0 ? _b : false;
6684
6686
  }
6685
6687
  setCurrentServiceUri(key) {
6686
6688
  }
@@ -17132,6 +17134,8 @@ class CanBoHoSoService extends BaseService {
17132
17134
  }),
17133
17135
  new ColumnSchemaBase({
17134
17136
  field: 'email',
17137
+ operator: Operator.equal,
17138
+ isOverrideFilter: true,
17135
17139
  width: '180px'
17136
17140
  }),
17137
17141
  new ColumnSchemaBase({
@@ -17582,7 +17586,8 @@ class CanBoHoSoService extends BaseService {
17582
17586
  new EntityPickerColumn({
17583
17587
  label: 'Email',
17584
17588
  code: 'email',
17585
- fullTextSearch: true,
17589
+ operator: Operator.equal,
17590
+ isOverrideFilter: true,
17586
17591
  width: '170px',
17587
17592
  }),
17588
17593
  new EntityPickerColumn({
@@ -17652,7 +17657,8 @@ class CanBoHoSoService extends BaseService {
17652
17657
  new EntityPickerColumn({
17653
17658
  label: 'Email',
17654
17659
  code: 'email',
17655
- fullTextSearch: true,
17660
+ operator: Operator.equal,
17661
+ isOverrideFilter: true,
17656
17662
  width: '170px',
17657
17663
  })
17658
17664
  ];
@@ -20777,7 +20783,7 @@ class ListComponentBase extends ComponentBase {
20777
20783
  isArrayField: col.isArrayField ? true : false
20778
20784
  });
20779
20785
  templateFilter.push(filter);
20780
- this.filterSchema.dropdown[col.field] = new DropdownControlSchema(Object.assign(Object.assign({}, col), { appendTo: 'body', placeholder: `Chọn ${col.label}`, multiple: filterMuliple.includes(filter.operator), loadOnInit: true, isServerLoad: col.isServerLoad }));
20786
+ this.filterSchema.dropdown[col.field] = new DropdownControlSchema(Object.assign(Object.assign({}, col), { appendTo: 'body', placeholder: `Chọn ${col.label}`, multiple: filterMuliple.includes(filter.operator), loadOnInit: true, isServerLoad: col.isServerLoad, isAllowDisabled: false }));
20781
20787
  }
20782
20788
  else {
20783
20789
  this._notifierService.showWarning(`Chưa cấu hình baseService hoặc dataSource cho cột ${col.field}: ${col.label}`);
@@ -21136,7 +21142,7 @@ class ListComponentBase extends ComponentBase {
21136
21142
  }
21137
21143
  else {
21138
21144
  if (col.baseService || (col.dataSource && col.dataSource.length > 0)) {
21139
- searchInfo.fieldDropdown[col.field] = new DropdownControlSchema(Object.assign(Object.assign({}, col), { label: col.label, operator: col.multiple ? Operator.in : Operator.equal, mdWidth: col.mdWidth ? col.mdWidth : 10, loadOnInit: true }));
21145
+ searchInfo.fieldDropdown[col.field] = new DropdownControlSchema(Object.assign(Object.assign({}, col), { label: col.label, operator: col.multiple ? Operator.in : Operator.equal, mdWidth: col.mdWidth ? col.mdWidth : 10, loadOnInit: true, isAllowDisabled: false }));
21140
21146
  searchInfo.schema.push(searchInfo.fieldDropdown[col.field]);
21141
21147
  }
21142
21148
  else if (col.dataType == 'int') {
@@ -22111,6 +22117,9 @@ class CommonSearchFormComponent extends DataFormBase {
22111
22117
  this.handleSearch(null, evt.control.field);
22112
22118
  };
22113
22119
  }
22120
+ if (column instanceof DropdownControlSchema) {
22121
+ column.isAllowDisabled = false;
22122
+ }
22114
22123
  if (column instanceof NumberRangeControlSchema) {
22115
22124
  this.lstNumberRangeControl.push(column.field);
22116
22125
  }
@@ -22156,7 +22165,7 @@ class CommonSearchFormComponent extends DataFormBase {
22156
22165
  if (isLazyLoad) {
22157
22166
  this.lstControlLazyLoad.push(column.field);
22158
22167
  }
22159
- result.push(new DropdownControlSchema(Object.assign(Object.assign({}, column), { placeholder: (_a = column.placeholder) !== null && _a !== void 0 ? _a : `Chọn ${column.label}`, multiple: !column.single, dataSource: dataSource, mdWidth: this.mdWidth, isLazyLoad: isLazyLoad, showLabel: false, showClear: true, onChanged: (evt) => {
22168
+ result.push(new DropdownControlSchema(Object.assign(Object.assign({}, column), { placeholder: (_a = column.placeholder) !== null && _a !== void 0 ? _a : `Chọn ${column.label}`, isAllowDisabled: false, multiple: !column.single, dataSource: dataSource, mdWidth: this.mdWidth, isLazyLoad: isLazyLoad, showLabel: false, showClear: true, onChanged: (evt) => {
22160
22169
  var _a;
22161
22170
  if (column.dataType == DataType.boolean) {
22162
22171
  evt.parentModel[column.field] = column.single ? (_a = evt.value.id) !== null && _a !== void 0 ? _a : evt.value : evt.value.map(p => p.id);
@@ -23649,7 +23658,7 @@ class ListBase extends ComponentBaseWithButton {
23649
23658
  }
23650
23659
  _edit(rowData, scopeDataEdit = {}) {
23651
23660
  return __awaiter(this, void 0, void 0, function* () {
23652
- const resultValidate = yield this.validateEdit();
23661
+ const resultValidate = yield this.validateEdit(rowData);
23653
23662
  if (!resultValidate) {
23654
23663
  return;
23655
23664
  }
@@ -23666,7 +23675,7 @@ class ListBase extends ComponentBaseWithButton {
23666
23675
  this.showDetailForm = true;
23667
23676
  });
23668
23677
  }
23669
- validateEdit() {
23678
+ validateEdit(rowData) {
23670
23679
  return __awaiter(this, void 0, void 0, function* () {
23671
23680
  return true;
23672
23681
  });
@@ -23690,34 +23699,45 @@ class ListBase extends ComponentBaseWithButton {
23690
23699
  getPromiseDeleteItem(rowData) {
23691
23700
  return this.setting.baseService.delete(rowData.id, this.deletePlusUrl);
23692
23701
  }
23702
+ validateDelete(items) {
23703
+ return __awaiter(this, void 0, void 0, function* () {
23704
+ return true;
23705
+ });
23706
+ }
23693
23707
  _delete(rowData) {
23694
- if (rowData.__disableDelete) {
23695
- return;
23696
- }
23697
- this._notifierService.showDeleteConfirm().then(rs => {
23698
- if (!rs) {
23708
+ return __awaiter(this, void 0, void 0, function* () {
23709
+ if (rowData.__disableDelete) {
23699
23710
  return;
23700
23711
  }
23701
- if (this.setting.baseService) {
23702
- this.getPromiseDeleteItem(rowData)
23703
- .then(response => {
23704
- if (response.success) {
23705
- this.beforeReloadAfterDelete([rowData.id]);
23706
- if (this.setting.showVersionButton) {
23707
- this.context.fireEvent(ComCtxConstants.COMMON.RELOAD_DATA_VERSION, {}, true);
23712
+ const resultValidate = yield this.validateDelete([rowData]);
23713
+ if (!resultValidate) {
23714
+ return;
23715
+ }
23716
+ this._notifierService.showDeleteConfirm().then(rs => {
23717
+ if (!rs) {
23718
+ return;
23719
+ }
23720
+ if (this.setting.baseService) {
23721
+ this.getPromiseDeleteItem(rowData)
23722
+ .then(response => {
23723
+ if (response.success) {
23724
+ this.beforeReloadAfterDelete([rowData.id]);
23725
+ if (this.setting.showVersionButton) {
23726
+ this.context.fireEvent(ComCtxConstants.COMMON.RELOAD_DATA_VERSION, {}, true);
23727
+ }
23728
+ else {
23729
+ this._triggerProcessData();
23730
+ }
23731
+ this._notifierService.showDeleteDataSuccess();
23708
23732
  }
23709
23733
  else {
23710
- this._triggerProcessData();
23734
+ this._notifierService.showWarningByResponse(response);
23711
23735
  }
23712
- this._notifierService.showDeleteDataSuccess();
23713
- }
23714
- else {
23715
- this._notifierService.showWarningByResponse(response);
23716
- }
23717
- }, error => {
23718
- this._notifierService.showDeleteDataError();
23719
- });
23720
- }
23736
+ }, error => {
23737
+ this._notifierService.showDeleteDataError();
23738
+ });
23739
+ }
23740
+ });
23721
23741
  });
23722
23742
  }
23723
23743
  getPromiseDeleteItems(items) {
@@ -23725,22 +23745,28 @@ class ListBase extends ComponentBaseWithButton {
23725
23745
  return this.setting.baseService.deleteMany(ids, this.deleteManyPlusUrl);
23726
23746
  }
23727
23747
  _deleteMultiple(items) {
23728
- this._notifierService.showDeleteConfirm('Bạn chắc chắn muốn xóa bản ghi đã chọn (Và các bản ghi con tương ứng)?').then(rs => {
23729
- if (!rs) {
23748
+ return __awaiter(this, void 0, void 0, function* () {
23749
+ const resultValidate = yield this.validateDelete(items);
23750
+ if (!resultValidate) {
23730
23751
  return;
23731
23752
  }
23732
- if (this.setting.baseService) {
23733
- this.getPromiseDeleteItems(items).then(response => {
23734
- if (response.success) {
23735
- this.beforeReloadAfterDelete(items.map(q => q.id));
23736
- this._triggerProcessData();
23737
- this._notifierService.showDeleteDataSuccess();
23738
- }
23739
- else {
23740
- this._notifierService.showWarningByResponse(response);
23741
- }
23742
- });
23743
- }
23753
+ this._notifierService.showDeleteConfirm('Bạn có chắc chắn muốn xóa bản ghi đã chọn (Và các bản ghi con tương ứng)?').then(rs => {
23754
+ if (!rs) {
23755
+ return;
23756
+ }
23757
+ if (this.setting.baseService) {
23758
+ this.getPromiseDeleteItems(items).then(response => {
23759
+ if (response.success) {
23760
+ this.beforeReloadAfterDelete(items.map(q => q.id));
23761
+ this._triggerProcessData();
23762
+ this._notifierService.showDeleteDataSuccess();
23763
+ }
23764
+ else {
23765
+ this._notifierService.showWarningByResponse(response);
23766
+ }
23767
+ });
23768
+ }
23769
+ });
23744
23770
  });
23745
23771
  }
23746
23772
  beforeReloadAfterDelete(ids) {
@@ -28117,6 +28143,8 @@ class DropdownComponent extends ComponentBase {
28117
28143
  this.loading = false;
28118
28144
  this.page = 1;
28119
28145
  this.totalPage = 2;
28146
+ this.fieldSuDung = 'suDung';
28147
+ this.disableFieldNotUse = false;
28120
28148
  this.modifyOptionWhenFilter = (options) => {
28121
28149
  this.dropdownOptions = this.dropdown._options;
28122
28150
  this._modifyOptionWhenFilter(options);
@@ -28216,13 +28244,14 @@ class DropdownComponent extends ComponentBase {
28216
28244
  if (this.control.loadOnInit && !this.control.isLazyLoad) {
28217
28245
  this._getData();
28218
28246
  }
28247
+ if (this.control.baseService instanceof MasterDataService) {
28248
+ this.control.maxItemDisplay = 9999;
28249
+ }
28250
+ this.disableFieldNotUse = this.control.baseService['disableFieldNotUse'];
28219
28251
  }
28220
28252
  if (!this._deviceDetectorService.isDesktop()) {
28221
28253
  this.hideTransitionOptions = this.showTransitionOptions = '';
28222
28254
  }
28223
- if (this.control.baseService instanceof MasterDataService) {
28224
- this.control.maxItemDisplay = 9999;
28225
- }
28226
28255
  if (this.control.onInit) {
28227
28256
  this.control.onInit(this);
28228
28257
  }
@@ -28411,9 +28440,9 @@ class DropdownComponent extends ComponentBase {
28411
28440
  this._hasLoadedDatasource = true;
28412
28441
  }
28413
28442
  }
28414
- if (this.control.baseService && this.control.baseService['disableFieldNotUse']) {
28415
- const fieldSuDung = this.control.baseService['fieldSuDung'];
28416
- this.dataSourceInternal.forEach(item => item.inactive = !item.value[fieldSuDung]);
28443
+ if (this.disableFieldNotUse && this.control.isAllowDisabled
28444
+ && this.dataSourceInternal.some(p => p.value.hasOwnProperty(this.fieldSuDung))) {
28445
+ this.dataSourceInternal.forEach(item => item.inactive = !item.value[this.fieldSuDung]);
28417
28446
  }
28418
28447
  }
28419
28448
  appendDataSource(destSource, dataSource, direction = 1) {
@@ -28662,17 +28691,6 @@ class DropdownComponent extends ComponentBase {
28662
28691
  return __awaiter(this, void 0, void 0, function* () {
28663
28692
  let dataSource = null;
28664
28693
  let totalPage = 1;
28665
- if (this.control.baseService['fieldSort']) {
28666
- this.control.sorts = [this.newSort(this.control.baseService['fieldSort'])];
28667
- }
28668
- const fieldSuDung = this.control.baseService['fieldSuDung'];
28669
- if (fieldSuDung) {
28670
- this.control.sorts.splice(0, 0, this.newSort(fieldSuDung, -1));
28671
- this.control.fieldPlus += `,${fieldSuDung}`;
28672
- this.control.funcGetLabel = (item) => {
28673
- return item[fieldSuDung] ? item[this.control.displayField] : `${item[this.control.displayField]} (Không sử dụng)`;
28674
- };
28675
- }
28676
28694
  const dropdownOptions = this._crudService.createDropdownOptions(this.control);
28677
28695
  dropdownOptions.page = page;
28678
28696
  if (pageSize) {
@@ -28776,14 +28794,18 @@ class DropdownComponent extends ComponentBase {
28776
28794
  onChangeSelected(event) {
28777
28795
  if (this.control.multiple) {
28778
28796
  if (!event.itemValue) {
28779
- // Trường hợp select all
28780
- if (event.value.length) {
28781
- this._value = this.dataSourceInternal.map(q => q.value);
28782
- }
28783
28797
  // Trường hợp unselect all
28784
- else {
28798
+ if (!event.value.length || event.value.every(p => p.hasOwnProperty(this.fieldSuDung) && !p[this.fieldSuDung])) {
28785
28799
  this._value = [];
28786
28800
  }
28801
+ // Trường hợp select all
28802
+ else {
28803
+ let tmpDataSource = [...this.dataSourceInternal];
28804
+ if (this.dataSourceInternal.some(p => p.hasOwnProperty('inactive'))) {
28805
+ tmpDataSource = tmpDataSource.filter(p => !p.inactive);
28806
+ }
28807
+ this._value = tmpDataSource.map(q => q.value);
28808
+ }
28787
28809
  }
28788
28810
  else if (this.control.selectDescendant) {
28789
28811
  const parentIds = [event.itemValue[this.control.valueField]];
@@ -35113,7 +35135,6 @@ class DmChucVuService extends BaseService {
35113
35135
  this.entityName = 'DM_ChucVu';
35114
35136
  this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.canboEndpoint;
35115
35137
  this._moduleConfig = _moduleConfigService.getConfig();
35116
- this.fieldSuDung = 'trangThai';
35117
35138
  }
35118
35139
  }
35119
35140
  DmChucVuService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DmChucVuService_Factory() { return new DmChucVuService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: DmChucVuService, providedIn: "root" });
@@ -38138,6 +38159,7 @@ class EntityPickerDataComponent extends DataListBase {
38138
38159
  funcSetValueRow: column.funcSetValueRow,
38139
38160
  dataSource: column.dataSource,
38140
38161
  groupCode: column.groupCode,
38162
+ isOverrideFilter: column.isOverrideFilter,
38141
38163
  order: column.order
38142
38164
  });
38143
38165
  if (column.dataType == 'custom') {
@@ -38348,6 +38370,7 @@ class EntityPickerSelectedComponent extends DataListBase {
38348
38370
  funcSetValueRow: column.funcSetValueRow,
38349
38371
  dataSource: column.dataSource,
38350
38372
  groupCode: column.groupCode,
38373
+ isOverrideFilter: column.isOverrideFilter,
38351
38374
  order: column.order
38352
38375
  });
38353
38376
  if (column.dataType == 'custom') {
@@ -38737,8 +38760,10 @@ class AutoCompletePickerComponent extends ComponentBase {
38737
38760
  }
38738
38761
  }
38739
38762
  buildFilterKeyword() {
38763
+ var _a;
38764
+ const operator = (_a = this.control.operatorFieldSearchText) !== null && _a !== void 0 ? _a : Operator.contain;
38740
38765
  if (this.fieldSearchText.length == 1) {
38741
- this.getFilterOnSearch = value => this.newFilter(this.control.displayField, Operator.contain, value);
38766
+ this.getFilterOnSearch = value => this.newFilter(this.control.displayField, operator, value);
38742
38767
  }
38743
38768
  else {
38744
38769
  this.getFilterOnSearch = value => {
@@ -38747,7 +38772,7 @@ class AutoCompletePickerComponent extends ComponentBase {
38747
38772
  filters: []
38748
38773
  });
38749
38774
  for (const fieldSearch of this.fieldSearchText) {
38750
- result.filters.push(this.newFilter(fieldSearch, Operator.contain, value));
38775
+ result.filters.push(this.newFilter(fieldSearch, operator, value));
38751
38776
  }
38752
38777
  return result;
38753
38778
  };