@sd-angular/core 1.0.68 → 1.0.71

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 (26) hide show
  1. package/bundles/sd-angular-core-grid-material.umd.js +53 -17
  2. package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
  3. package/bundles/sd-angular-core-grid-material.umd.min.js +1 -1
  4. package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
  5. package/bundles/sd-angular-core-popover.umd.js +17 -1
  6. package/bundles/sd-angular-core-popover.umd.js.map +1 -1
  7. package/bundles/sd-angular-core-popover.umd.min.js +2 -2
  8. package/bundles/sd-angular-core-popover.umd.min.js.map +1 -1
  9. package/esm2015/grid-material/src/lib/grid-material.component.js +16 -8
  10. package/esm2015/grid-material/src/lib/models/grid-action.model.js +1 -1
  11. package/esm2015/grid-material/src/lib/models/grid.model.js +1 -1
  12. package/esm2015/grid-material/src/lib/pipes/selection-visible-select-all.pipe.js +4 -1
  13. package/esm2015/grid-material/src/lib/pipes/selection-visible.pipe.js +31 -6
  14. package/esm2015/popover/src/lib/popover/popover.component.js +19 -3
  15. package/fesm2015/sd-angular-core-grid-material.js +48 -12
  16. package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
  17. package/fesm2015/sd-angular-core-popover.js +17 -1
  18. package/fesm2015/sd-angular-core-popover.js.map +1 -1
  19. package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
  20. package/grid-material/src/lib/grid-material.component.d.ts +1 -1
  21. package/grid-material/src/lib/models/grid-action.model.d.ts +2 -0
  22. package/grid-material/src/lib/models/grid.model.d.ts +4 -3
  23. package/package.json +1 -1
  24. package/popover/sd-angular-core-popover.metadata.json +1 -1
  25. package/popover/src/lib/popover/popover.component.d.ts +4 -2
  26. package/{sd-angular-core-1.0.68.tgz → sd-angular-core-1.0.71.tgz} +0 -0
@@ -2468,15 +2468,23 @@
2468
2468
  });
2469
2469
  }); };
2470
2470
  this.onSelect = function (rowData) {
2471
- var _a, _b, _c;
2472
- if ((_a = _this.gridOption.selection) === null || _a === void 0 ? void 0 : _a.single) {
2473
- _this.items.filter(function (e) { return e !== rowData; }).forEach(function (e) { return e.isSelected = false; });
2471
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2472
+ if ((_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) {
2473
+ (_c = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _c === void 0 ? void 0 : _c.items.forEach(function (e) { return e.isSelected = rowData.isSelected; });
2474
+ (_e = (_d = _this.gridOption.selection) === null || _d === void 0 ? void 0 : _d.onSelect) === null || _e === void 0 ? void 0 : _e.call(_d, rowData, _this.items.filter(function (e) { return e.isSelected; }));
2475
+ _this.isSelectAll = _this.items.every(function (e) { return e.isSelected; });
2476
+ __classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
2477
+ }
2478
+ else {
2479
+ if ((_f = _this.gridOption.selection) === null || _f === void 0 ? void 0 : _f.single) {
2480
+ _this.items.filter(function (e) { return e !== rowData; }).forEach(function (e) { return e.isSelected = false; });
2481
+ __classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
2482
+ return;
2483
+ }
2484
+ (_h = (_g = _this.gridOption.selection) === null || _g === void 0 ? void 0 : _g.onSelect) === null || _h === void 0 ? void 0 : _h.call(_g, rowData, _this.items.filter(function (e) { return e.isSelected; }));
2485
+ _this.isSelectAll = _this.items.every(function (e) { return e.isSelected; });
2474
2486
  __classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
2475
- return;
2476
2487
  }
2477
- (_c = (_b = _this.gridOption.selection) === null || _b === void 0 ? void 0 : _b.onSelect) === null || _c === void 0 ? void 0 : _c.call(_b, rowData, _this.items.filter(function (e) { return e.isSelected; }));
2478
- _this.isSelectAll = _this.items.every(function (e) { return e.isSelected; });
2479
- __classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
2480
2488
  };
2481
2489
  this.onSelectAll = function () {
2482
2490
  var _a, _b, _c;
@@ -3714,6 +3722,9 @@
3714
3722
  if (!items.length) {
3715
3723
  return [2 /*return*/, false];
3716
3724
  }
3725
+ if (actions.some(function (e) { return ('children' in e && e.children.some(function (e1) { return e1.isGrouped; })) || e.isGrouped; })) {
3726
+ return [2 /*return*/, false];
3727
+ }
3717
3728
  return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 500); })];
3718
3729
  case 1:
3719
3730
  _d.sent();
@@ -4194,8 +4205,10 @@
4194
4205
  var SdSelectionVisiblePipe = /** @class */ (function () {
4195
4206
  function SdSelectionVisiblePipe() {
4196
4207
  this.transform = function (rowData, selection) {
4197
- var e_1, _a, e_2, _b;
4208
+ var e_1, _c, e_2, _d;
4209
+ var _a, _b;
4198
4210
  var actions = selection.actions;
4211
+ var groupedActions = [];
4199
4212
  rowData.actions = rowData.actions || [];
4200
4213
  if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
4201
4214
  rowData.selectable = true;
@@ -4206,44 +4219,63 @@
4206
4219
  var action = actions_1_1.value;
4207
4220
  if ('children' in action) {
4208
4221
  var flag = false;
4222
+ var hasGroup = false;
4209
4223
  try {
4210
- for (var _c = (e_2 = void 0, __values(action.children)), _d = _c.next(); !_d.done; _d = _c.next()) {
4211
- var childAction = _d.value;
4212
- var hidden = childAction.hidden;
4224
+ for (var _e = (e_2 = void 0, __values(action.children)), _f = _e.next(); !_f.done; _f = _e.next()) {
4225
+ var childAction = _f.value;
4226
+ var hidden = childAction.hidden, isGrouped = childAction.isGrouped;
4213
4227
  var key = hash__default['default'](childAction);
4228
+ if (isGrouped) {
4229
+ hasGroup = true;
4230
+ }
4214
4231
  if (typeof (hidden) === 'function') {
4215
4232
  if (!hidden(rowData)) {
4216
- rowData.actions.push(key);
4217
4233
  flag = true;
4234
+ rowData.actions.push(key);
4235
+ if (isGrouped) {
4236
+ groupedActions.push(key);
4237
+ }
4218
4238
  }
4219
4239
  }
4220
4240
  else if (!hidden) {
4221
- rowData.actions.push(key);
4222
4241
  flag = true;
4242
+ rowData.actions.push(key);
4243
+ if (isGrouped) {
4244
+ groupedActions.push(key);
4245
+ }
4223
4246
  }
4224
4247
  }
4225
4248
  }
4226
4249
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
4227
4250
  finally {
4228
4251
  try {
4229
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
4252
+ if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
4230
4253
  }
4231
4254
  finally { if (e_2) throw e_2.error; }
4232
4255
  }
4233
4256
  if (flag) {
4234
4257
  rowData.actions.push(hash__default['default'](action));
4258
+ if (hasGroup) {
4259
+ groupedActions.push(hash__default['default'](action));
4260
+ }
4235
4261
  }
4236
4262
  }
4237
4263
  else {
4238
- var hidden = action.hidden;
4264
+ var hidden = action.hidden, isGrouped = action.isGrouped;
4239
4265
  var key = hash__default['default'](action);
4240
4266
  if (typeof (hidden) === 'function') {
4241
4267
  if (!hidden(rowData)) {
4242
4268
  rowData.actions.push(key);
4269
+ if (isGrouped) {
4270
+ groupedActions.push(key);
4271
+ }
4243
4272
  }
4244
4273
  }
4245
4274
  else if (!hidden) {
4246
4275
  rowData.actions.push(key);
4276
+ if (isGrouped) {
4277
+ groupedActions.push(key);
4278
+ }
4247
4279
  }
4248
4280
  }
4249
4281
  }
@@ -4251,12 +4283,16 @@
4251
4283
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
4252
4284
  finally {
4253
4285
  try {
4254
- if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);
4286
+ if (actions_1_1 && !actions_1_1.done && (_c = actions_1.return)) _c.call(actions_1);
4255
4287
  }
4256
4288
  finally { if (e_1) throw e_1.error; }
4257
4289
  }
4258
4290
  rowData.selectable = !!rowData.actions.length;
4259
- return rowData.selectable;
4291
+ 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)) {
4292
+ return rowData.selectable;
4293
+ }
4294
+ // Đố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
4295
+ return rowData.actions.some(function (action) { return !groupedActions.includes(action); });
4260
4296
  };
4261
4297
  }
4262
4298
  return SdSelectionVisiblePipe;