@den4ik92/ng2-smart-table 19.1.0 → 19.1.1

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.
@@ -2202,17 +2202,23 @@ class TbodyEditDeleteComponent {
2202
2202
  this.delete = output();
2203
2203
  this.isActionEdit = false;
2204
2204
  this.isActionDelete = false;
2205
+ this.isExternalMode = false;
2205
2206
  this.editRowButtonContent = "Edit";
2206
2207
  this.deleteRowButtonContent = "Delete";
2207
2208
  effect(() => {
2208
2209
  const settings = this.grid().settings();
2209
2210
  const actions = settings.actions;
2210
- if (!actions)
2211
- return;
2212
- this.isActionDelete = !!actions.delete;
2213
- this.isActionEdit = !!actions.edit;
2214
- this.editRowButtonContent = settings.edit ? settings.edit.editButtonContent || "Edit" : "Edit";
2215
- this.deleteRowButtonContent = settings.delete ? settings.delete.deleteButtonContent || "Delete" : "Delete";
2211
+ if (actions) {
2212
+ this.isActionDelete = !!actions.delete;
2213
+ this.isActionEdit = !!actions.edit;
2214
+ }
2215
+ this.isExternalMode = settings.mode === 'external';
2216
+ this.editRowButtonContent = settings.edit
2217
+ ? settings.edit.editButtonContent || "Edit"
2218
+ : "Edit";
2219
+ this.deleteRowButtonContent = settings.delete
2220
+ ? settings.delete.deleteButtonContent || "Delete"
2221
+ : "Delete";
2216
2222
  this.cdr.detectChanges();
2217
2223
  });
2218
2224
  }
@@ -2223,12 +2229,22 @@ class TbodyEditDeleteComponent {
2223
2229
  data: this.row().getData(),
2224
2230
  source: this.source,
2225
2231
  });
2226
- this.grid().edit(this.row());
2232
+ if (!this.isExternalMode) {
2233
+ this.grid().edit(this.row());
2234
+ }
2227
2235
  }
2228
2236
  onDelete(event) {
2229
2237
  event.preventDefault();
2230
2238
  event.stopPropagation();
2231
- this.grid().delete(this.row(), this.deleteConfirm());
2239
+ if (this.isExternalMode) {
2240
+ this.delete.emit({
2241
+ data: this.row().getData(),
2242
+ source: this.source(),
2243
+ });
2244
+ }
2245
+ else {
2246
+ this.grid().delete(this.row(), this.deleteConfirm());
2247
+ }
2232
2248
  }
2233
2249
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyEditDeleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2234
2250
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TbodyEditDeleteComponent, isStandalone: true, selector: "ng2-st-tbody-edit-delete", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, deleteConfirm: { classPropertyName: "deleteConfirm", publicName: "deleteConfirm", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { edit: "edit", delete: "delete" }, ngImport: i0, template: `
@@ -2844,6 +2860,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2844
2860
  class AddButtonComponent {
2845
2861
  constructor() {
2846
2862
  this.grid = input.required();
2863
+ this.source = input.required();
2847
2864
  this.create = output();
2848
2865
  this.isActionAdd = computed(() => {
2849
2866
  const actions = this.grid().settings().actions;
@@ -2863,16 +2880,17 @@ class AddButtonComponent {
2863
2880
  onAdd(event) {
2864
2881
  event.preventDefault();
2865
2882
  event.stopPropagation();
2866
- // if (this.grid.getSetting("mode") === "external") {
2867
- // this.create.emit({
2868
- // source: this.source,
2869
- // });
2870
- // } else {
2871
- this.grid().createFormShown = true;
2872
- // }
2883
+ if (this.grid().getSetting("mode") === "external") {
2884
+ this.create.emit({
2885
+ source: this.source(),
2886
+ });
2887
+ }
2888
+ else {
2889
+ this.grid().createFormShown = true;
2890
+ }
2873
2891
  }
2874
2892
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2875
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AddButtonComponent, isStandalone: true, selector: "[ng2-st-add-button]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create" }, host: { classAttribute: "ng2-smart-actions-title ng2-smart-actions-title-add" }, ngImport: i0, template: `
2893
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AddButtonComponent, isStandalone: true, selector: "[ng2-st-add-button]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create" }, host: { classAttribute: "ng2-smart-actions-title ng2-smart-actions-title-add" }, ngImport: i0, template: `
2876
2894
  @if (isActionAdd()) {
2877
2895
  <a
2878
2896
  href="#"
@@ -2926,7 +2944,12 @@ class TheadFiltersRowComponent {
2926
2944
  @if (grid().isMultiSelectVisible()) {
2927
2945
  <th></th>
2928
2946
  } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2929
- <th ng2-st-add-button [grid]="grid()" (create)="create.emit($event)"></th>
2947
+ <th
2948
+ ng2-st-add-button
2949
+ [source]="source()"
2950
+ [grid]="grid()"
2951
+ (create)="create.emit($event)"
2952
+ ></th>
2930
2953
  } @for (column of getVisibleColumns(); track column.id) {
2931
2954
  <th class="ng2-smart-th {{ column.id }}">
2932
2955
  <ng2-smart-table-filter
@@ -2941,10 +2964,11 @@ class TheadFiltersRowComponent {
2941
2964
  <th
2942
2965
  ng2-st-add-button
2943
2966
  [grid]="grid()"
2967
+ [source]="source()"
2944
2968
  (create)="create.emit($event)"
2945
2969
  ></th>
2946
2970
  }
2947
- `, isInline: true, dependencies: [{ kind: "component", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: ["grid"], outputs: ["create"] }, { kind: "component", type: FilterComponent, selector: "ng2-smart-table-filter" }] }); }
2971
+ `, isInline: true, dependencies: [{ kind: "component", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: ["grid", "source"], outputs: ["create"] }, { kind: "component", type: FilterComponent, selector: "ng2-smart-table-filter" }] }); }
2948
2972
  }
2949
2973
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, decorators: [{
2950
2974
  type: Component,
@@ -2954,7 +2978,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2954
2978
  @if (grid().isMultiSelectVisible()) {
2955
2979
  <th></th>
2956
2980
  } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2957
- <th ng2-st-add-button [grid]="grid()" (create)="create.emit($event)"></th>
2981
+ <th
2982
+ ng2-st-add-button
2983
+ [source]="source()"
2984
+ [grid]="grid()"
2985
+ (create)="create.emit($event)"
2986
+ ></th>
2958
2987
  } @for (column of getVisibleColumns(); track column.id) {
2959
2988
  <th class="ng2-smart-th {{ column.id }}">
2960
2989
  <ng2-smart-table-filter
@@ -2969,6 +2998,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2969
2998
  <th
2970
2999
  ng2-st-add-button
2971
3000
  [grid]="grid()"
3001
+ [source]="source()"
2972
3002
  (create)="create.emit($event)"
2973
3003
  ></th>
2974
3004
  }