ps-toolkit-ui 1.22.35 → 1.22.37

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.
@@ -3142,7 +3142,7 @@ class TableClass {
3142
3142
  const cv = get(row.Data, col.name);
3143
3143
  if (row.Data.isSum) {
3144
3144
  if (idx === 0) {
3145
- return this.l('SumCountCol', this.count);
3145
+ return this.l('SumCountCol', this.data().length === 0 ? this.count : this.data().length);
3146
3146
  }
3147
3147
  else if (col.sumFun != null) {
3148
3148
  return col.sumFun(this.sumRow);
@@ -3272,8 +3272,8 @@ class TableClass {
3272
3272
  }
3273
3273
  setSumRow() {
3274
3274
  if (this.sumRowBase != null) {
3275
- const checks = this.rows.filter(x => x.checked === true);
3276
- if (checks.length == 0) {
3275
+ const checks = this.data();
3276
+ if (checks.length === 0) {
3277
3277
  this.sumRow = HelperClass.clone(this.sumRowBase);
3278
3278
  this.sumRow.isSum = true;
3279
3279
  return;
@@ -3914,7 +3914,7 @@ class TableComponent {
3914
3914
  this.table.rows.forEach(x => x.checked = true);
3915
3915
  }
3916
3916
  if (this.table.onChangeCheck) {
3917
- this.table.onChangeCheck(this.table.rows.filter(x => x.checked === true));
3917
+ this.table.onChangeCheck(this.table.data());
3918
3918
  }
3919
3919
  this.table.setSumRow();
3920
3920
  }
@@ -6435,6 +6435,30 @@ class FormTableComponent {
6435
6435
  this.inp.onChange(e);
6436
6436
  }
6437
6437
  }
6438
+ onCopy(event) {
6439
+ if (this.inp.table.data().length) {
6440
+ event.preventDefault();
6441
+ const data = JSON.stringify({
6442
+ table: this.inp.table.name,
6443
+ rows: this.inp.table.data()
6444
+ });
6445
+ navigator.clipboard.writeText(data).then(() => { });
6446
+ }
6447
+ }
6448
+ onPaste(event) {
6449
+ var _a;
6450
+ const text = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text');
6451
+ const data = JSON.parse(text);
6452
+ if (data.table === this.inp.table.name) {
6453
+ this.inp.table.rows.push(...data.rows.map(row => {
6454
+ row.Id = parseInt(HelperClass.random(5, false, false), 10);
6455
+ return {
6456
+ Data: row,
6457
+ Options: this.inp.table.permissions.Accesses.filter(a => a.AccessType === PermissionAccessTypeEnum.Update || a.AccessType === PermissionAccessTypeEnum.Delete)
6458
+ };
6459
+ }));
6460
+ }
6461
+ }
6438
6462
  }
6439
6463
  FormTableComponent.decorators = [
6440
6464
  { type: Component, args: [{
@@ -6446,7 +6470,9 @@ FormTableComponent.decorators = [
6446
6470
  FormTableComponent.ctorParameters = () => [];
6447
6471
  FormTableComponent.propDecorators = {
6448
6472
  inp: [{ type: Input }],
6449
- changeIndex: [{ type: Output }]
6473
+ changeIndex: [{ type: Output }],
6474
+ onCopy: [{ type: HostListener, args: ['document:copy', ['$event'],] }],
6475
+ onPaste: [{ type: HostListener, args: ['document:paste', ['$event'],] }]
6450
6476
  };
6451
6477
 
6452
6478
  class FormTextareaComponent {