@sd-angular/core 1.0.67 → 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.
Files changed (31) hide show
  1. package/bundles/sd-angular-core-grid-material.umd.js +50 -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/bundles/sd-angular-core-setting.umd.js +30 -8
  10. package/bundles/sd-angular-core-setting.umd.js.map +1 -1
  11. package/bundles/sd-angular-core-setting.umd.min.js +1 -1
  12. package/bundles/sd-angular-core-setting.umd.min.js.map +1 -1
  13. package/esm2015/grid-material/src/lib/grid-material.component.js +16 -8
  14. package/esm2015/grid-material/src/lib/models/grid-action.model.js +1 -1
  15. package/esm2015/grid-material/src/lib/models/grid.model.js +1 -1
  16. package/esm2015/grid-material/src/lib/pipes/selection-visible.pipe.js +31 -6
  17. package/esm2015/popover/src/lib/popover/popover.component.js +19 -3
  18. package/esm2015/setting/src/lib/setting.service.js +31 -9
  19. package/fesm2015/sd-angular-core-grid-material.js +45 -12
  20. package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
  21. package/fesm2015/sd-angular-core-popover.js +17 -1
  22. package/fesm2015/sd-angular-core-popover.js.map +1 -1
  23. package/fesm2015/sd-angular-core-setting.js +30 -8
  24. package/fesm2015/sd-angular-core-setting.js.map +1 -1
  25. package/grid-material/src/lib/grid-material.component.d.ts +1 -1
  26. package/grid-material/src/lib/models/grid-action.model.d.ts +2 -0
  27. package/grid-material/src/lib/models/grid.model.d.ts +4 -3
  28. package/package.json +1 -1
  29. package/popover/sd-angular-core-popover.metadata.json +1 -1
  30. package/popover/src/lib/popover/popover.component.d.ts +4 -2
  31. package/{sd-angular-core-1.0.67.tgz → sd-angular-core-1.0.70.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;
@@ -4194,8 +4202,10 @@
4194
4202
  var SdSelectionVisiblePipe = /** @class */ (function () {
4195
4203
  function SdSelectionVisiblePipe() {
4196
4204
  this.transform = function (rowData, selection) {
4197
- var e_1, _a, e_2, _b;
4205
+ var e_1, _c, e_2, _d;
4206
+ var _a, _b;
4198
4207
  var actions = selection.actions;
4208
+ var groupedActions = [];
4199
4209
  rowData.actions = rowData.actions || [];
4200
4210
  if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
4201
4211
  rowData.selectable = true;
@@ -4206,44 +4216,63 @@
4206
4216
  var action = actions_1_1.value;
4207
4217
  if ('children' in action) {
4208
4218
  var flag = false;
4219
+ var hasGroup = false;
4209
4220
  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;
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;
4213
4224
  var key = hash__default['default'](childAction);
4225
+ if (isGrouped) {
4226
+ hasGroup = true;
4227
+ }
4214
4228
  if (typeof (hidden) === 'function') {
4215
4229
  if (!hidden(rowData)) {
4216
- rowData.actions.push(key);
4217
4230
  flag = true;
4231
+ rowData.actions.push(key);
4232
+ if (isGrouped) {
4233
+ groupedActions.push(key);
4234
+ }
4218
4235
  }
4219
4236
  }
4220
4237
  else if (!hidden) {
4221
- rowData.actions.push(key);
4222
4238
  flag = true;
4239
+ rowData.actions.push(key);
4240
+ if (isGrouped) {
4241
+ groupedActions.push(key);
4242
+ }
4223
4243
  }
4224
4244
  }
4225
4245
  }
4226
4246
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
4227
4247
  finally {
4228
4248
  try {
4229
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
4249
+ if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
4230
4250
  }
4231
4251
  finally { if (e_2) throw e_2.error; }
4232
4252
  }
4233
4253
  if (flag) {
4234
4254
  rowData.actions.push(hash__default['default'](action));
4255
+ if (hasGroup) {
4256
+ groupedActions.push(hash__default['default'](action));
4257
+ }
4235
4258
  }
4236
4259
  }
4237
4260
  else {
4238
- var hidden = action.hidden;
4261
+ var hidden = action.hidden, isGrouped = action.isGrouped;
4239
4262
  var key = hash__default['default'](action);
4240
4263
  if (typeof (hidden) === 'function') {
4241
4264
  if (!hidden(rowData)) {
4242
4265
  rowData.actions.push(key);
4266
+ if (isGrouped) {
4267
+ groupedActions.push(key);
4268
+ }
4243
4269
  }
4244
4270
  }
4245
4271
  else if (!hidden) {
4246
4272
  rowData.actions.push(key);
4273
+ if (isGrouped) {
4274
+ groupedActions.push(key);
4275
+ }
4247
4276
  }
4248
4277
  }
4249
4278
  }
@@ -4251,12 +4280,16 @@
4251
4280
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
4252
4281
  finally {
4253
4282
  try {
4254
- 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);
4255
4284
  }
4256
4285
  finally { if (e_1) throw e_1.error; }
4257
4286
  }
4258
4287
  rowData.selectable = !!rowData.actions.length;
4259
- 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); });
4260
4293
  };
4261
4294
  }
4262
4295
  return SdSelectionVisiblePipe;