@sd-angular/core 1.0.69 → 1.0.70

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.
@@ -4202,8 +4202,10 @@
4202
4202
  var SdSelectionVisiblePipe = /** @class */ (function () {
4203
4203
  function SdSelectionVisiblePipe() {
4204
4204
  this.transform = function (rowData, selection) {
4205
- var e_1, _a, e_2, _b;
4205
+ var e_1, _c, e_2, _d;
4206
+ var _a, _b;
4206
4207
  var actions = selection.actions;
4208
+ var groupedActions = [];
4207
4209
  rowData.actions = rowData.actions || [];
4208
4210
  if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
4209
4211
  rowData.selectable = true;
@@ -4214,44 +4216,63 @@
4214
4216
  var action = actions_1_1.value;
4215
4217
  if ('children' in action) {
4216
4218
  var flag = false;
4219
+ var hasGroup = false;
4217
4220
  try {
4218
- for (var _c = (e_2 = void 0, __values(action.children)), _d = _c.next(); !_d.done; _d = _c.next()) {
4219
- var childAction = _d.value;
4220
- var hidden = childAction.hidden;
4221
+ for (var _e = (e_2 = void 0, __values(action.children)), _f = _e.next(); !_f.done; _f = _e.next()) {
4222
+ var childAction = _f.value;
4223
+ var hidden = childAction.hidden, isGrouped = childAction.isGrouped;
4221
4224
  var key = hash__default['default'](childAction);
4225
+ if (isGrouped) {
4226
+ hasGroup = true;
4227
+ }
4222
4228
  if (typeof (hidden) === 'function') {
4223
4229
  if (!hidden(rowData)) {
4224
- rowData.actions.push(key);
4225
4230
  flag = true;
4231
+ rowData.actions.push(key);
4232
+ if (isGrouped) {
4233
+ groupedActions.push(key);
4234
+ }
4226
4235
  }
4227
4236
  }
4228
4237
  else if (!hidden) {
4229
- rowData.actions.push(key);
4230
4238
  flag = true;
4239
+ rowData.actions.push(key);
4240
+ if (isGrouped) {
4241
+ groupedActions.push(key);
4242
+ }
4231
4243
  }
4232
4244
  }
4233
4245
  }
4234
4246
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
4235
4247
  finally {
4236
4248
  try {
4237
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
4249
+ if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
4238
4250
  }
4239
4251
  finally { if (e_2) throw e_2.error; }
4240
4252
  }
4241
4253
  if (flag) {
4242
4254
  rowData.actions.push(hash__default['default'](action));
4255
+ if (hasGroup) {
4256
+ groupedActions.push(hash__default['default'](action));
4257
+ }
4243
4258
  }
4244
4259
  }
4245
4260
  else {
4246
- var hidden = action.hidden;
4261
+ var hidden = action.hidden, isGrouped = action.isGrouped;
4247
4262
  var key = hash__default['default'](action);
4248
4263
  if (typeof (hidden) === 'function') {
4249
4264
  if (!hidden(rowData)) {
4250
4265
  rowData.actions.push(key);
4266
+ if (isGrouped) {
4267
+ groupedActions.push(key);
4268
+ }
4251
4269
  }
4252
4270
  }
4253
4271
  else if (!hidden) {
4254
4272
  rowData.actions.push(key);
4273
+ if (isGrouped) {
4274
+ groupedActions.push(key);
4275
+ }
4255
4276
  }
4256
4277
  }
4257
4278
  }
@@ -4259,12 +4280,16 @@
4259
4280
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
4260
4281
  finally {
4261
4282
  try {
4262
- if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);
4283
+ if (actions_1_1 && !actions_1_1.done && (_c = actions_1.return)) _c.call(actions_1);
4263
4284
  }
4264
4285
  finally { if (e_1) throw e_1.error; }
4265
4286
  }
4266
4287
  rowData.selectable = !!rowData.actions.length;
4267
- return rowData.selectable;
4288
+ if (!rowData.selectable || !groupedActions.length || ((_b = (_a = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.length)) {
4289
+ return rowData.selectable;
4290
+ }
4291
+ // Đối với trường hợp grouped, tuy selectable là true nhưng vẫn ẩn đi checkbox nếu các action đều thuộc groupedActions và rowData ko phải là dòng group
4292
+ return rowData.actions.some(function (action) { return !groupedActions.includes(action); });
4268
4293
  };
4269
4294
  }
4270
4295
  return SdSelectionVisiblePipe;