tnx-shared 5.0.59 → 5.0.60

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.
@@ -11180,25 +11180,37 @@
11180
11180
  });
11181
11181
  });
11182
11182
  };
11183
+ DataListBase.prototype.validateEdit = function (rowData) {
11184
+ return __awaiter(this, void 0, void 0, function () {
11185
+ return __generator(this, function (_a) {
11186
+ return [2 /*return*/, true];
11187
+ });
11188
+ });
11189
+ };
11183
11190
  DataListBase.prototype._edit = function (rowData, scopeDataEdit) {
11184
11191
  if (scopeDataEdit === void 0) { scopeDataEdit = {}; }
11185
11192
  return __awaiter(this, void 0, void 0, function () {
11186
- var flashShow;
11193
+ var resultValidate, flashShow;
11187
11194
  return __generator(this, function (_a) {
11188
11195
  switch (_a.label) {
11189
- case 0:
11196
+ case 0: return [4 /*yield*/, this.validateEdit(rowData)];
11197
+ case 1:
11198
+ resultValidate = _a.sent();
11199
+ if (!resultValidate) {
11200
+ return [2 /*return*/];
11201
+ }
11190
11202
  flashShow = rowData[KeyFlashShow];
11191
11203
  delete rowData[KeyFlashShow];
11192
11204
  this.formModel.formState = exports.FormState.EDIT;
11193
11205
  return [4 /*yield*/, this.beforeEdit()];
11194
- case 1:
11206
+ case 2:
11195
11207
  _a.sent();
11196
11208
  this.setting.popupHeader = "C\u1EADp nh\u1EADt " + this.setting.objectName;
11197
11209
  this.setting.maskClass = flashShow ? 'hide' : null;
11198
11210
  this.scopeDataEdit = scopeDataEdit;
11199
11211
  this.formModel.data = this.cloneData(rowData);
11200
11212
  return [4 /*yield*/, this.modifyEditModel(rowData)];
11201
- case 2:
11213
+ case 3:
11202
11214
  _a.sent();
11203
11215
  this.formModel.data[KeyFlashShow] = flashShow;
11204
11216
  this.showDetailForm = true;
@@ -11229,34 +11241,56 @@
11229
11241
  DataListBase.prototype.getPromiseDeleteItem = function (rowData) {
11230
11242
  return this.setting.baseService.delete(rowData.id);
11231
11243
  };
11244
+ DataListBase.prototype.validateDelete = function (rowData) {
11245
+ return __awaiter(this, void 0, void 0, function () {
11246
+ return __generator(this, function (_a) {
11247
+ return [2 /*return*/, true];
11248
+ });
11249
+ });
11250
+ };
11232
11251
  DataListBase.prototype._delete = function (rowData) {
11233
- var _this = this;
11234
- if (rowData.__disableDelete) {
11235
- return;
11236
- }
11237
- this._notifierService.showDeleteConfirm().then(function (rs) {
11238
- if (!rs) {
11239
- return;
11240
- }
11241
- if (_this.setting.baseService) {
11242
- _this.getPromiseDeleteItem(rowData)
11243
- .then(function (response) {
11244
- if (response.success) {
11245
- if (_this.setting.showVersionButton) {
11246
- _this.context.fireEvent(ComCtxConstants.COMMON.RELOAD_DATA_VERSION, {}, true);
11252
+ return __awaiter(this, void 0, void 0, function () {
11253
+ var resultValidate;
11254
+ var _this = this;
11255
+ return __generator(this, function (_a) {
11256
+ switch (_a.label) {
11257
+ case 0:
11258
+ if (rowData.__disableDelete) {
11259
+ return [2 /*return*/];
11247
11260
  }
11248
- else {
11249
- _this._triggerProcessData();
11261
+ return [4 /*yield*/, this.validateDelete(rowData)];
11262
+ case 1:
11263
+ resultValidate = _a.sent();
11264
+ if (!resultValidate) {
11265
+ return [2 /*return*/];
11250
11266
  }
11251
- _this._notifierService.showDeleteDataSuccess();
11252
- }
11253
- else {
11254
- _this._notifierService.showWarningByReponse(response);
11255
- }
11256
- }, function (error) {
11257
- _this._notifierService.showDeleteDataError();
11258
- });
11259
- }
11267
+ this._notifierService.showDeleteConfirm().then(function (rs) {
11268
+ if (!rs) {
11269
+ return;
11270
+ }
11271
+ if (_this.setting.baseService) {
11272
+ _this.getPromiseDeleteItem(rowData)
11273
+ .then(function (response) {
11274
+ if (response.success) {
11275
+ if (_this.setting.showVersionButton) {
11276
+ _this.context.fireEvent(ComCtxConstants.COMMON.RELOAD_DATA_VERSION, {}, true);
11277
+ }
11278
+ else {
11279
+ _this._triggerProcessData();
11280
+ }
11281
+ _this._notifierService.showDeleteDataSuccess();
11282
+ }
11283
+ else {
11284
+ _this._notifierService.showWarningByReponse(response);
11285
+ }
11286
+ }, function (error) {
11287
+ _this._notifierService.showDeleteDataError();
11288
+ });
11289
+ }
11290
+ });
11291
+ return [2 /*return*/];
11292
+ }
11293
+ });
11260
11294
  });
11261
11295
  };
11262
11296
  DataListBase.prototype.getPromiseDeleteItems = function (items) {
@@ -28208,7 +28242,7 @@
28208
28242
  var e_5, _b;
28209
28243
  var _loop_4 = function (item) {
28210
28244
  this_2.transform(col.pipe, col.asyncPipe, item[col.field]).then(function (rs) {
28211
- item["pipe__" + col.field + " "] = rs;
28245
+ item["pipe__" + col.field] = rs;
28212
28246
  });
28213
28247
  };
28214
28248
  try {
@@ -45314,8 +45348,10 @@
45314
45348
  },] }
45315
45349
  ];
45316
45350
 
45351
+ var moment$1 = moment___namespace;
45317
45352
  var TnDatePipe = /** @class */ (function () {
45318
- function TnDatePipe() {
45353
+ function TnDatePipe(format) {
45354
+ this.format = format;
45319
45355
  }
45320
45356
  TnDatePipe.prototype.addZero = function (value) {
45321
45357
  if (value < 10)
@@ -45325,6 +45361,8 @@
45325
45361
  TnDatePipe.prototype.transform = function (value, args) {
45326
45362
  if (value == null)
45327
45363
  return '';
45364
+ if (this.format)
45365
+ return moment$1(value).format(this.format);
45328
45366
  var date = new Date(value);
45329
45367
  return this.addZero(date.getHours()) + ":" + this.addZero(date.getMinutes()) + ":" + this.addZero(date.getSeconds()) + ", Ng\u00E0y " + this.addZero(date.getDate()) + "/" + this.addZero(date.getMonth() + 1) + "/" + date.getFullYear();
45330
45368
  };
@@ -45334,7 +45372,10 @@
45334
45372
  { type: i0.Pipe, args: [{
45335
45373
  name: 'tnDate'
45336
45374
  },] }
45337
- ];
45375
+ ];
45376
+ TnDatePipe.ctorParameters = function () { return [
45377
+ { type: undefined, decorators: [{ type: i0.Inject, args: [i0.LOCALE_ID,] }] }
45378
+ ]; };
45338
45379
 
45339
45380
  var UserFormatPipe = /** @class */ (function () {
45340
45381
  function UserFormatPipe(_userService) {