ng-prime-tools 1.0.34 → 1.0.35

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.
@@ -3802,7 +3802,7 @@ const DIALOG_STYLES = {
3802
3802
  * Default config:
3803
3803
  * - content is now empty string (no default message).
3804
3804
  */
3805
- const DEFAULT_DIALOG_CONFIG = {
3805
+ const DEFAULT_DIALOG_CONFIG$1 = {
3806
3806
  header: { text: 'Confirmation' },
3807
3807
  visible: false,
3808
3808
  width: '720px',
@@ -3822,14 +3822,15 @@ class PTConfirmDialogComponent {
3822
3822
  this.messageService = messageService;
3823
3823
  this.renderer = renderer;
3824
3824
  this.el = el;
3825
- this.dialogConfig = { ...DEFAULT_DIALOG_CONFIG };
3825
+ this.dialogConfig = { ...DEFAULT_DIALOG_CONFIG$1 };
3826
3826
  this.confirm = new EventEmitter();
3827
3827
  this.cancel = new EventEmitter();
3828
3828
  this.SeverityEnum = SeverityEnum;
3829
3829
  }
3830
3830
  ngOnChanges(changes) {
3831
3831
  if (changes['dialogConfig']) {
3832
- const current = changes['dialogConfig'].currentValue;
3832
+ const current = changes['dialogConfig']
3833
+ .currentValue;
3833
3834
  if (changes['dialogConfig'].previousValue?.dialogStyle !==
3834
3835
  current?.dialogStyle) {
3835
3836
  this.applyDialogStyle();
@@ -3852,18 +3853,18 @@ class PTConfirmDialogComponent {
3852
3853
  ? current.header
3853
3854
  : styleConfig.header !== undefined
3854
3855
  ? styleConfig.header
3855
- : DEFAULT_DIALOG_CONFIG.header;
3856
+ : DEFAULT_DIALOG_CONFIG$1.header;
3856
3857
  this.dialogConfig = {
3857
- ...DEFAULT_DIALOG_CONFIG,
3858
+ ...DEFAULT_DIALOG_CONFIG$1,
3858
3859
  ...current,
3859
3860
  ...styleConfig,
3860
3861
  header: mergedHeader,
3861
3862
  confirmButtonConfig: {
3862
- ...DEFAULT_DIALOG_CONFIG.confirmButtonConfig,
3863
+ ...DEFAULT_DIALOG_CONFIG$1.confirmButtonConfig,
3863
3864
  ...current.confirmButtonConfig,
3864
3865
  },
3865
3866
  cancelButtonConfig: {
3866
- ...DEFAULT_DIALOG_CONFIG.cancelButtonConfig,
3867
+ ...DEFAULT_DIALOG_CONFIG$1.cancelButtonConfig,
3867
3868
  ...current.cancelButtonConfig,
3868
3869
  },
3869
3870
  visible: current.visible,
@@ -4110,107 +4111,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
4110
4111
  }]
4111
4112
  }] });
4112
4113
 
4114
+ const DEFAULT_DIALOG_CONFIG = {
4115
+ modal: true,
4116
+ closable: true,
4117
+ draggable: true,
4118
+ resizable: true,
4119
+ maximizable: false,
4120
+ dismissableMask: false,
4121
+ closeOnEscape: true,
4122
+ blockScroll: true,
4123
+ bodyScrollable: true,
4124
+ showFooter: true,
4125
+ position: 'center',
4126
+ };
4113
4127
  class PTDialogComponent {
4114
4128
  constructor() {
4115
- /** Enable scroll when body exceeds given height/width */
4116
- this.bodyScrollable = true;
4117
- /** Control footer visibility (default: true) */
4118
- this.showFooter = true;
4119
- this.modal = true;
4120
- this.closable = true;
4121
- this.draggable = true;
4122
- this.resizable = true;
4123
- this.maximizable = false;
4124
- this.dismissableMask = false;
4125
- this.closeOnEscape = true;
4126
- this.blockScroll = true;
4127
- this.position = 'center';
4128
- /** internal visible flag used by p-dialog */
4129
- this._visible = false;
4129
+ /** Single configuration object */
4130
+ this._config = { ...DEFAULT_DIALOG_CONFIG };
4131
+ // ---- Internal visible state (PUBLIC so template can read it) ----
4132
+ this._internalVisible = false;
4130
4133
  this.visibleChange = new EventEmitter();
4131
4134
  }
4135
+ set config(value) {
4136
+ this._config = { ...DEFAULT_DIALOG_CONFIG, ...(value || {}) };
4137
+ }
4138
+ get config() {
4139
+ return this._config;
4140
+ }
4141
+ /** Input visible from parent */
4132
4142
  get visible() {
4133
- return this._visible;
4143
+ return this._internalVisible;
4134
4144
  }
4135
4145
  set visible(v) {
4136
- this._visible = v;
4146
+ this._internalVisible = v;
4137
4147
  }
4138
- /** Final class applied to p-dialog */
4139
4148
  get dialogStyleClass() {
4140
4149
  return [
4141
4150
  'border-round-3xl',
4142
4151
  'shadow-6',
4143
4152
  'overflow-hidden',
4144
- 'pt-dialog-header-blue', // for header/footer colors
4145
- this.styleClass,
4153
+ 'pt-dialog-header-blue',
4154
+ this.config.styleClass,
4146
4155
  ]
4147
4156
  .filter(Boolean)
4148
4157
  .join(' ');
4149
4158
  }
4150
- /** Style applied to the body wrapper */
4159
+ get primePosition() {
4160
+ return (this.config.position ?? 'center');
4161
+ }
4151
4162
  get bodyStyle() {
4152
4163
  const style = {};
4153
- if (this.bodyWidth) {
4154
- style['max-width'] = this.bodyWidth;
4164
+ if (this.config.bodyWidth) {
4165
+ style['max-width'] = this.config.bodyWidth;
4155
4166
  }
4156
- if (this.bodyHeight) {
4157
- style['max-height'] = this.bodyHeight;
4158
- if (this.bodyScrollable) {
4167
+ if (this.config.bodyHeight) {
4168
+ style['max-height'] = this.config.bodyHeight;
4169
+ if (this.config.bodyScrollable !== false) {
4159
4170
  style['overflow-y'] = 'auto';
4160
4171
  style['overflow-x'] = 'auto';
4161
4172
  }
4162
4173
  }
4163
4174
  return style;
4164
4175
  }
4165
- onShow() {
4166
- this.visibleChange.emit(true);
4167
- }
4168
- onHide() {
4169
- this.visibleChange.emit(false);
4176
+ /** Sync <p-dialog> → parent */
4177
+ onInternalVisibleChange(v) {
4178
+ this._internalVisible = v;
4179
+ this.visibleChange.emit(v);
4170
4180
  }
4171
4181
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4172
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTDialogComponent, selector: "pt-dialog", inputs: { header: "header", style: "style", styleClass: "styleClass", headerIconClass: "headerIconClass", bodyWidth: "bodyWidth", bodyHeight: "bodyHeight", bodyScrollable: "bodyScrollable", showFooter: "showFooter", modal: "modal", closable: "closable", draggable: "draggable", resizable: "resizable", maximizable: "maximizable", dismissableMask: "dismissableMask", closeOnEscape: "closeOnEscape", blockScroll: "blockScroll", breakpoints: "breakpoints", position: "position", contentStyle: "contentStyle", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, ngImport: i0, template: "<p-dialog\n [(visible)]=\"_visible\"\n [header]=\"header\"\n [modal]=\"modal\"\n [style]=\"style\"\n [breakpoints]=\"breakpoints\"\n [closable]=\"closable\"\n [draggable]=\"draggable\"\n [resizable]=\"resizable\"\n [maximizable]=\"maximizable\"\n [dismissableMask]=\"dismissableMask\"\n [closeOnEscape]=\"closeOnEscape\"\n [blockScroll]=\"blockScroll\"\n [position]=\"position\"\n [contentStyle]=\"contentStyle\"\n [styleClass]=\"dialogStyleClass\"\n (onShow)=\"onShow()\"\n (onHide)=\"onHide()\"\n>\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <div\n class=\"flex align-items-center justify-content-between w-full px-4 pt-3 pb-2\"\n >\n <div class=\"flex align-items-center gap-2\">\n <!-- optional icon -->\n <i *ngIf=\"headerIconClass\" [ngClass]=\"headerIconClass\"></i>\n\n <!-- projected custom header -->\n <ng-content select=\"[ptDialogHeader]\"></ng-content>\n\n <!-- fallback header text -->\n <span *ngIf=\"header\" class=\"font-bold text-lg\">\n {{ header }}\n </span>\n </div>\n <!-- close icon from PrimeNG (X) is rendered automatically -->\n </div>\n </ng-template>\n\n <!-- BODY -->\n <div\n class=\"surface-50 px-4 py-4 flex flex-column gap-3\"\n [ngStyle]=\"bodyStyle\"\n >\n <ng-content select=\"[ptDialogContent]\"></ng-content>\n <ng-content></ng-content>\n </div>\n\n <!-- FOOTER (optional) -->\n <ng-template pTemplate=\"footer\" *ngIf=\"showFooter\">\n <div class=\"surface-100 px-4 py-2 flex justify-content-end gap-2\">\n <ng-content select=\"[ptDialogFooter]\"></ng-content>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [":host ::ng-deep .pt-dialog-header-blue .p-dialog-header{background-color:#e0f2ff;border-bottom:0}:host ::ng-deep .pt-dialog-header-blue .p-dialog-footer{background-color:#f5f6f8!important;border-top:0!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2$3.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i1$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }] }); }
4182
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTDialogComponent, selector: "pt-dialog", inputs: { config: "config", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, ngImport: i0, template: "<p-dialog\n [visible]=\"_internalVisible\"\n (visibleChange)=\"onInternalVisibleChange($event)\"\n [header]=\"config.header\"\n [modal]=\"config.modal\"\n [style]=\"config.style\"\n [breakpoints]=\"config.breakpoints\"\n [closable]=\"config.closable\"\n [draggable]=\"config.draggable\"\n [resizable]=\"config.resizable\"\n [maximizable]=\"config.maximizable\"\n [dismissableMask]=\"config.dismissableMask\"\n [closeOnEscape]=\"config.closeOnEscape\"\n [blockScroll]=\"config.blockScroll\"\n [position]=\"primePosition\"\n [contentStyle]=\"config.contentStyle\"\n [styleClass]=\"dialogStyleClass\"\n>\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <div\n class=\"flex align-items-center justify-content-between w-full px-4 pt-3 pb-2\"\n >\n <div class=\"flex align-items-center gap-2\">\n <i\n *ngIf=\"config.headerIconClass\"\n [ngClass]=\"config.headerIconClass\"\n ></i>\n <ng-content select=\"[ptDialogHeader]\"></ng-content>\n <span *ngIf=\"config.header\" class=\"font-bold text-lg\">\n {{ config.header }}\n </span>\n </div>\n </div>\n </ng-template>\n\n <!-- BODY -->\n <div\n class=\"surface-50 px-4 py-4 flex flex-column gap-3\"\n [ngStyle]=\"bodyStyle\"\n >\n <ng-content select=\"[ptDialogContent]\"></ng-content>\n <ng-content></ng-content>\n </div>\n\n <!-- FOOTER -->\n <ng-template pTemplate=\"footer\" *ngIf=\"config.showFooter !== false\">\n <div class=\"surface-100 px-4 py-2 flex justify-content-end gap-2\">\n <ng-content select=\"[ptDialogFooter]\"></ng-content>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [":host ::ng-deep .pt-dialog-header-blue .p-dialog-header{background-color:#e0f2ff;border-bottom:0}:host ::ng-deep .pt-dialog-header-blue .p-dialog-footer{background-color:#f5f6f8!important;border-top:0!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2$3.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i1$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }] }); }
4173
4183
  }
4174
4184
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDialogComponent, decorators: [{
4175
4185
  type: Component,
4176
- args: [{ selector: 'pt-dialog', template: "<p-dialog\n [(visible)]=\"_visible\"\n [header]=\"header\"\n [modal]=\"modal\"\n [style]=\"style\"\n [breakpoints]=\"breakpoints\"\n [closable]=\"closable\"\n [draggable]=\"draggable\"\n [resizable]=\"resizable\"\n [maximizable]=\"maximizable\"\n [dismissableMask]=\"dismissableMask\"\n [closeOnEscape]=\"closeOnEscape\"\n [blockScroll]=\"blockScroll\"\n [position]=\"position\"\n [contentStyle]=\"contentStyle\"\n [styleClass]=\"dialogStyleClass\"\n (onShow)=\"onShow()\"\n (onHide)=\"onHide()\"\n>\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <div\n class=\"flex align-items-center justify-content-between w-full px-4 pt-3 pb-2\"\n >\n <div class=\"flex align-items-center gap-2\">\n <!-- optional icon -->\n <i *ngIf=\"headerIconClass\" [ngClass]=\"headerIconClass\"></i>\n\n <!-- projected custom header -->\n <ng-content select=\"[ptDialogHeader]\"></ng-content>\n\n <!-- fallback header text -->\n <span *ngIf=\"header\" class=\"font-bold text-lg\">\n {{ header }}\n </span>\n </div>\n <!-- close icon from PrimeNG (X) is rendered automatically -->\n </div>\n </ng-template>\n\n <!-- BODY -->\n <div\n class=\"surface-50 px-4 py-4 flex flex-column gap-3\"\n [ngStyle]=\"bodyStyle\"\n >\n <ng-content select=\"[ptDialogContent]\"></ng-content>\n <ng-content></ng-content>\n </div>\n\n <!-- FOOTER (optional) -->\n <ng-template pTemplate=\"footer\" *ngIf=\"showFooter\">\n <div class=\"surface-100 px-4 py-2 flex justify-content-end gap-2\">\n <ng-content select=\"[ptDialogFooter]\"></ng-content>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [":host ::ng-deep .pt-dialog-header-blue .p-dialog-header{background-color:#e0f2ff;border-bottom:0}:host ::ng-deep .pt-dialog-header-blue .p-dialog-footer{background-color:#f5f6f8!important;border-top:0!important}\n"] }]
4177
- }], propDecorators: { header: [{
4178
- type: Input
4179
- }], style: [{
4180
- type: Input
4181
- }], styleClass: [{
4182
- type: Input
4183
- }], headerIconClass: [{
4184
- type: Input
4185
- }], bodyWidth: [{
4186
- type: Input
4187
- }], bodyHeight: [{
4188
- type: Input
4189
- }], bodyScrollable: [{
4190
- type: Input
4191
- }], showFooter: [{
4192
- type: Input
4193
- }], modal: [{
4194
- type: Input
4195
- }], closable: [{
4196
- type: Input
4197
- }], draggable: [{
4198
- type: Input
4199
- }], resizable: [{
4200
- type: Input
4201
- }], maximizable: [{
4202
- type: Input
4203
- }], dismissableMask: [{
4204
- type: Input
4205
- }], closeOnEscape: [{
4206
- type: Input
4207
- }], blockScroll: [{
4208
- type: Input
4209
- }], breakpoints: [{
4210
- type: Input
4211
- }], position: [{
4212
- type: Input
4213
- }], contentStyle: [{
4186
+ args: [{ selector: 'pt-dialog', template: "<p-dialog\n [visible]=\"_internalVisible\"\n (visibleChange)=\"onInternalVisibleChange($event)\"\n [header]=\"config.header\"\n [modal]=\"config.modal\"\n [style]=\"config.style\"\n [breakpoints]=\"config.breakpoints\"\n [closable]=\"config.closable\"\n [draggable]=\"config.draggable\"\n [resizable]=\"config.resizable\"\n [maximizable]=\"config.maximizable\"\n [dismissableMask]=\"config.dismissableMask\"\n [closeOnEscape]=\"config.closeOnEscape\"\n [blockScroll]=\"config.blockScroll\"\n [position]=\"primePosition\"\n [contentStyle]=\"config.contentStyle\"\n [styleClass]=\"dialogStyleClass\"\n>\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <div\n class=\"flex align-items-center justify-content-between w-full px-4 pt-3 pb-2\"\n >\n <div class=\"flex align-items-center gap-2\">\n <i\n *ngIf=\"config.headerIconClass\"\n [ngClass]=\"config.headerIconClass\"\n ></i>\n <ng-content select=\"[ptDialogHeader]\"></ng-content>\n <span *ngIf=\"config.header\" class=\"font-bold text-lg\">\n {{ config.header }}\n </span>\n </div>\n </div>\n </ng-template>\n\n <!-- BODY -->\n <div\n class=\"surface-50 px-4 py-4 flex flex-column gap-3\"\n [ngStyle]=\"bodyStyle\"\n >\n <ng-content select=\"[ptDialogContent]\"></ng-content>\n <ng-content></ng-content>\n </div>\n\n <!-- FOOTER -->\n <ng-template pTemplate=\"footer\" *ngIf=\"config.showFooter !== false\">\n <div class=\"surface-100 px-4 py-2 flex justify-content-end gap-2\">\n <ng-content select=\"[ptDialogFooter]\"></ng-content>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [":host ::ng-deep .pt-dialog-header-blue .p-dialog-header{background-color:#e0f2ff;border-bottom:0}:host ::ng-deep .pt-dialog-header-blue .p-dialog-footer{background-color:#f5f6f8!important;border-top:0!important}\n"] }]
4187
+ }], propDecorators: { config: [{
4214
4188
  type: Input
4215
4189
  }], visible: [{
4216
4190
  type: Input
@@ -4859,6 +4833,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
4859
4833
  }]
4860
4834
  }] });
4861
4835
 
4836
+ // src/lib/models/pt-dialog-config.model.ts
4837
+
4862
4838
  // Advanced table
4863
4839
 
4864
4840
  class PTGroupComponent {