@webilix/ngx-helper-m3 0.0.1 → 0.0.3

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.
@@ -1,282 +1,326 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Component, Injectable, InjectionToken, Injector, Pipe } from '@angular/core';
3
- import { NgClass, NgComponentOutlet } from '@angular/common';
4
- import * as i1 from '@angular/material/button';
2
+ import { InjectionToken, makeEnvironmentProviders, Injectable, EventEmitter, Injector, Component, Optional, Inject, HostBinding, Input, Output, inject, Directive, Pipe } from '@angular/core';
3
+ import { NgComponentOutlet, NgClass } from '@angular/common';
4
+ import * as i3 from '@angular/material/icon';
5
+ import { MatIcon, MatIconModule } from '@angular/material/icon';
6
+ import { Helper } from '@webilix/helper-library';
7
+ import * as i1 from '@angular/router';
8
+ import { JalaliDateTime } from '@webilix/jalali-date-time';
9
+ import * as i1$1 from '@angular/platform-browser';
10
+ import * as i1$2 from '@angular/material/button';
5
11
  import { MatButtonModule, MatIconButton } from '@angular/material/button';
6
12
  import * as i2 from '@angular/material/dialog';
7
13
  import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
8
- import * as i3 from '@angular/material/icon';
9
- import { MatIconModule, MatIcon } from '@angular/material/icon';
10
- import * as i1$1 from '@angular/material/bottom-sheet';
14
+ import * as i1$3 from '@angular/material/bottom-sheet';
11
15
  import { MAT_BOTTOM_SHEET_DATA } from '@angular/material/bottom-sheet';
12
- import { Helper } from '@webilix/helper-library';
13
- import { JalaliDateTime } from '@webilix/jalali-date-time';
14
- import * as i1$2 from '@angular/platform-browser';
15
-
16
- class ConfirmDialogComponent {
17
- confirm = inject(MAT_DIALOG_DATA);
18
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ConfirmDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
19
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ConfirmDialogComponent, isStandalone: true, selector: "ng-component", host: { attributes: { "selector": "confirm-dialog" } }, ngImport: i0, template: "<mat-dialog-content>\n <content>\n <!-- ICON -->\n @if (confirm.icon) {\n <div class=\"icon\">\n <mat-icon>{{ confirm.icon }}</mat-icon>\n </div>\n }\n\n <!-- CONTENT -->\n <div class=\"content\">\n <div class=\"question\">{{ confirm.question }}</div>\n <!-- DESCRIPTION -->\n @if (confirm.description) {\n <div class=\"description\">{{ confirm.description }}</div>\n }\n <!-- DATA -->\n @if (confirm.data) {\n <div class=\"data\">\n <div class=\"title\">{{ confirm.data.title }}:</div>\n <div class=\"value\">{{ confirm.data.value }}</div>\n </div>\n }\n </div>\n </content>\n</mat-dialog-content>\n<mat-dialog-actions [align]=\"'end'\">\n <button mat-button type=\"button\" mat-dialog-close [ngClass]=\"confirm.denyClass\">\u062E\u06CC\u0631</button>\n <button mat-button type=\"button\" [mat-dialog-close]=\"true\" [ngClass]=\"confirm.confirmClass\">\u0628\u0644\u06CC</button>\n</mat-dialog-actions>\n", styles: ["content{display:flex;align-items:flex-start;column-gap:1rem;padding-top:1rem}content .content{flex:1}content .content .question{text-align:justify}content .content .description{font-size:90%;margin-top:.5rem;text-align:justify}content .content .data{display:flex;align-items:center;column-gap:.5rem;font-size:90%;margin-top:1rem}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
20
- }
21
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
22
- type: Component,
23
- args: [{ host: { selector: 'confirm-dialog' }, imports: [NgClass, MatButtonModule, MatDialogModule, MatIconModule], template: "<mat-dialog-content>\n <content>\n <!-- ICON -->\n @if (confirm.icon) {\n <div class=\"icon\">\n <mat-icon>{{ confirm.icon }}</mat-icon>\n </div>\n }\n\n <!-- CONTENT -->\n <div class=\"content\">\n <div class=\"question\">{{ confirm.question }}</div>\n <!-- DESCRIPTION -->\n @if (confirm.description) {\n <div class=\"description\">{{ confirm.description }}</div>\n }\n <!-- DATA -->\n @if (confirm.data) {\n <div class=\"data\">\n <div class=\"title\">{{ confirm.data.title }}:</div>\n <div class=\"value\">{{ confirm.data.value }}</div>\n </div>\n }\n </div>\n </content>\n</mat-dialog-content>\n<mat-dialog-actions [align]=\"'end'\">\n <button mat-button type=\"button\" mat-dialog-close [ngClass]=\"confirm.denyClass\">\u062E\u06CC\u0631</button>\n <button mat-button type=\"button\" [mat-dialog-close]=\"true\" [ngClass]=\"confirm.confirmClass\">\u0628\u0644\u06CC</button>\n</mat-dialog-actions>\n", styles: ["content{display:flex;align-items:flex-start;column-gap:1rem;padding-top:1rem}content .content{flex:1}content .content .question{text-align:justify}content .content .description{font-size:90%;margin-top:.5rem;text-align:justify}content .content .data{display:flex;align-items:center;column-gap:.5rem;font-size:90%;margin-top:1rem}\n"] }]
24
- }] });
25
16
 
26
- class ConfirmBottomSheetComponent {
27
- matBottomSheetRef;
28
- confirm = inject(MAT_BOTTOM_SHEET_DATA);
29
- constructor(matBottomSheetRef) {
30
- this.matBottomSheetRef = matBottomSheetRef;
31
- }
32
- close(confirmed) {
33
- this.matBottomSheetRef.dismiss(confirmed);
34
- }
35
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ConfirmBottomSheetComponent, deps: [{ token: i1$1.MatBottomSheetRef }], target: i0.ɵɵFactoryTarget.Component });
36
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ConfirmBottomSheetComponent, isStandalone: true, selector: "ng-component", host: { attributes: { "selector": "confirm-bottom-sheet" } }, ngImport: i0, template: "<content>\n <!-- ICON -->\n @if (confirm.icon) {\n <div class=\"icon\">\n <mat-icon>{{ confirm.icon }}</mat-icon>\n </div>\n }\n\n <!-- CONTENT -->\n <div class=\"content\">\n <div class=\"question\">{{ confirm.question }}</div>\n <!-- DESCRIPTION -->\n @if (confirm.description) {\n <div class=\"description\">{{ confirm.description }}</div>\n }\n <!-- DATA -->\n @if (confirm.data) {\n <div class=\"data\">\n <div class=\"title\">{{ confirm.data.title }}:</div>\n <div class=\"value\">{{ confirm.data.value }}</div>\n </div>\n }\n </div>\n</content>\n\n<div class=\"buttons\">\n <button mat-button type=\"button\" (click)=\"close()\" [ngClass]=\"confirm.denyClass\">\u062E\u06CC\u0631</button>\n <button mat-button type=\"button\" (click)=\"close(true)\" [ngClass]=\"confirm.confirmClass\">\u0628\u0644\u06CC</button>\n</div>\n", styles: ["content{display:flex;align-items:flex-start;column-gap:1rem;padding-top:1rem}content .content{flex:1}content .content .question{text-align:justify}content .content .description{font-size:90%;margin-top:.5rem;text-align:justify}content .content .data{display:flex;align-items:center;column-gap:.5rem;font-size:90%;margin-top:1rem}.buttons{display:flex;align-items:center;justify-content:flex-end;column-gap:1rem;margin:1rem 0 .5rem}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
37
- }
38
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ConfirmBottomSheetComponent, decorators: [{
39
- type: Component,
40
- args: [{ host: { selector: 'confirm-bottom-sheet' }, imports: [NgClass, MatButtonModule, MatIconModule], template: "<content>\n <!-- ICON -->\n @if (confirm.icon) {\n <div class=\"icon\">\n <mat-icon>{{ confirm.icon }}</mat-icon>\n </div>\n }\n\n <!-- CONTENT -->\n <div class=\"content\">\n <div class=\"question\">{{ confirm.question }}</div>\n <!-- DESCRIPTION -->\n @if (confirm.description) {\n <div class=\"description\">{{ confirm.description }}</div>\n }\n <!-- DATA -->\n @if (confirm.data) {\n <div class=\"data\">\n <div class=\"title\">{{ confirm.data.title }}:</div>\n <div class=\"value\">{{ confirm.data.value }}</div>\n </div>\n }\n </div>\n</content>\n\n<div class=\"buttons\">\n <button mat-button type=\"button\" (click)=\"close()\" [ngClass]=\"confirm.denyClass\">\u062E\u06CC\u0631</button>\n <button mat-button type=\"button\" (click)=\"close(true)\" [ngClass]=\"confirm.confirmClass\">\u0628\u0644\u06CC</button>\n</div>\n", styles: ["content{display:flex;align-items:flex-start;column-gap:1rem;padding-top:1rem}content .content{flex:1}content .content .question{text-align:justify}content .content .description{font-size:90%;margin-top:.5rem;text-align:justify}content .content .data{display:flex;align-items:center;column-gap:.5rem;font-size:90%;margin-top:1rem}.buttons{display:flex;align-items:center;justify-content:flex-end;column-gap:1rem;margin:1rem 0 .5rem}\n"] }]
41
- }], ctorParameters: () => [{ type: i1$1.MatBottomSheetRef }] });
17
+ const NGX_HELPER_CONFIG = new InjectionToken('NGX-HELPER-CONFIG');
18
+ const provideNgxHelperConfig = (config) => {
19
+ const providers = [{ provide: NGX_HELPER_CONFIG, useValue: config }];
20
+ return makeEnvironmentProviders(providers);
21
+ };
42
22
 
43
- class NgxHelperConfirmCalss {
44
- matBottomSheet;
45
- matDialog;
46
- confirm;
47
- constructor(matBottomSheet, matDialog, confirm) {
48
- this.matBottomSheet = matBottomSheet;
49
- this.matDialog = matDialog;
50
- this.confirm = confirm;
51
- }
52
- dialog(onConfirmed, arg1, arg2) {
53
- const onDenied = typeof arg1 === 'function' ? arg1 : undefined;
54
- const config = arg2 || (typeof arg1 !== 'function' ? arg1 : {});
55
- this.matDialog
56
- .open(ConfirmDialogComponent, {
57
- // DEFAULT CONFIG
58
- width: 'calc(100vw - 4rem)',
59
- direction: 'rtl',
60
- enterAnimationDuration: '100ms',
61
- exitAnimationDuration: '100ms',
62
- // OVERWRITE CONFIG
63
- ...config,
64
- maxHeight: '80vh',
65
- // DATA
66
- data: this.confirm,
67
- })
68
- .afterClosed()
69
- .subscribe({ next: (confirmed) => (!!confirmed ? onConfirmed() : onDenied ? onDenied() : undefined) });
70
- }
71
- bottomSheet(onConfirmed, arg1, arg2) {
72
- const onDenied = typeof arg1 === 'function' ? arg1 : undefined;
73
- const config = arg2 || (typeof arg1 !== 'function' ? arg1 : {});
74
- this.matBottomSheet
75
- .open(ConfirmBottomSheetComponent, {
76
- // DEFAULT CONFIG
77
- direction: 'rtl',
78
- // OVERWRITE CONFIG
79
- ...config,
80
- maxHeight: '80vh',
81
- // DATA
82
- data: this.confirm,
83
- })
84
- .afterDismissed()
85
- .subscribe({ next: (confirmed) => (!!confirmed ? onConfirmed() : onDenied ? onDenied() : undefined) });
86
- }
87
- }
88
- class NgxHelperConfirmService {
89
- matBottomSheet;
90
- matDialog;
91
- constructor(matBottomSheet, matDialog) {
92
- this.matBottomSheet = matBottomSheet;
93
- this.matDialog = matDialog;
94
- }
95
- verify(confirm) {
96
- return new NgxHelperConfirmCalss(this.matBottomSheet, this.matDialog, confirm);
97
- }
98
- active(data, config) {
99
- return this.verify({
100
- question: `آیا می‌خواهید ${data.title} انتخاب شده را فعال کنید؟`,
101
- description: config?.description,
102
- data: data.value ? { title: data.title, value: data.value } : undefined,
103
- icon: 'check_box',
104
- confirmClass: config?.confirmClass,
105
- denyClass: config?.denyClass,
106
- });
107
- }
108
- deactive(data, config) {
109
- return this.verify({
110
- question: `آیا می‌خواهید ${data.title} انتخاب شده را غیرفعال کنید؟`,
111
- description: config?.description,
112
- data: data.value ? { title: data.title, value: data.value } : undefined,
113
- icon: 'disabled_by_default',
114
- confirmClass: config?.confirmClass || 'error',
115
- denyClass: config?.denyClass,
116
- });
117
- }
118
- delete(data, config) {
119
- return this.verify({
120
- question: `آیا می‌خواهید ${data.title} انتخاب شده را حذف کنید؟`,
121
- description: config?.description,
122
- data: data.value ? { title: data.title, value: data.value } : undefined,
123
- icon: 'delete',
124
- confirmClass: config?.confirmClass || 'error',
125
- denyClass: config?.denyClass,
126
- });
23
+ class ComponentService {
24
+ getComponentConfig(config) {
25
+ const getStickyView = (config) => {
26
+ return {
27
+ desktopView: typeof config === 'string' ? config : config.desktopView,
28
+ mobileView: typeof config === 'string' ? config : config.mobileView,
29
+ };
30
+ };
31
+ return {
32
+ border: config?.colors?.border || 'var(--outline-variant)',
33
+ background: config?.colors?.background || 'var(--background)',
34
+ highlightText: config?.colors?.highlightText || 'var(--secondary)',
35
+ highlightBackground: config?.colors?.highlightBackground || 'var(--secondary-container)',
36
+ stickyView: config?.stickyView
37
+ ? {
38
+ top: config.stickyView.top ? getStickyView(config.stickyView.top) : undefined,
39
+ bottom: config.stickyView.bottom ? getStickyView(config.stickyView.bottom) : undefined,
40
+ }
41
+ : undefined,
42
+ };
127
43
  }
128
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperConfirmService, deps: [{ token: i1$1.MatBottomSheet }, { token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
129
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperConfirmService, providedIn: 'root' });
44
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
45
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ComponentService });
130
46
  }
131
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperConfirmService, decorators: [{
132
- type: Injectable,
133
- args: [{ providedIn: 'root' }]
134
- }], ctorParameters: () => [{ type: i1$1.MatBottomSheet }, { type: i2.MatDialog }] });
47
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ComponentService, decorators: [{
48
+ type: Injectable
49
+ }] });
135
50
 
136
- const NGX_HELPER_CONTAINER_TYPE = new InjectionToken('NGX-HELPER-CONTAINER-TYPE');
137
- const NGX_HELPER_CONTAINER_DATA = new InjectionToken('NGX-HELPER-CONTAINER-DATA');
138
- const NGX_HELPER_CONTAINER_CLOSE = new InjectionToken('NGX-HELPER-CONTAINER-CLOSE');
51
+ const NGX_HELPER_PAGE_GROUP_DATA = new InjectionToken('NGX-HELPER-PAGE-GROUP-DATA');
52
+ const NGX_HELPER_PAGE_GROUP_INDEX = new InjectionToken('NGX-HELPER-PAGE-GROUP-INDEX');
53
+ const NGX_HELPER_PAGE_GROUP_TITLE = new InjectionToken('NGX-HELPER-PAGE-GROUP-TITLE');
139
54
 
140
- class ContainerDialogComponent {
141
- matDialogRef;
142
- container = inject(MAT_DIALOG_DATA);
55
+ class NgxHelperPageGroupComponent {
56
+ activatedRoute;
57
+ router;
58
+ componentService;
59
+ config;
60
+ display = 'none';
61
+ toolbarHeight = '32px';
62
+ pageGroup;
63
+ pageIndex = 0;
64
+ data;
65
+ pageIndexChanged = new EventEmitter();
66
+ isMobile = false;
143
67
  injector;
144
- constructor(matDialogRef) {
145
- this.matDialogRef = matDialogRef;
68
+ sidebarWidth;
69
+ componentConfig;
70
+ swipeStart;
71
+ swipeLeft = 0;
72
+ constructor(activatedRoute, router, componentService, config) {
73
+ this.activatedRoute = activatedRoute;
74
+ this.router = router;
75
+ this.componentService = componentService;
76
+ this.config = config;
146
77
  }
147
78
  ngOnInit() {
79
+ this.display = this.pageGroup.pages.length === 0 ? 'none' : 'block';
80
+ this.sidebarWidth = this.pageGroup.sidebarWidth || this.config?.sidebarWidth || '200px';
81
+ this.componentConfig = this.componentService.getComponentConfig(this.config);
82
+ if (this.pageIndex < 0)
83
+ this.pageIndex = 0;
84
+ else if (this.pageIndex > this.pageGroup.pages.length - 1)
85
+ this.pageIndex = this.pageGroup.pages.length - 1;
86
+ const queryParams = { ...this.activatedRoute.snapshot.queryParams };
87
+ if (!!this.pageGroup.route && Helper.IS.number(+queryParams['ngx-helper-page-group'])) {
88
+ const index = +queryParams['ngx-helper-page-group'];
89
+ if (index >= 0 && index <= this.pageGroup.pages.length - 1) {
90
+ this.pageIndex = index;
91
+ this.pageIndexChanged.next(this.pageIndex);
92
+ }
93
+ }
94
+ this.onResize();
95
+ this.setInjector();
96
+ }
97
+ ngOnChanges(changes) {
98
+ this.setInjector();
99
+ }
100
+ onResize() {
101
+ const mobileWidth = this.config?.mobileWidth || 600;
102
+ this.isMobile = this.pageGroup.mobileView || window.innerWidth <= mobileWidth;
103
+ }
104
+ setInjector() {
148
105
  this.injector = Injector.create({
149
106
  providers: [
150
- { provide: NGX_HELPER_CONTAINER_TYPE, useValue: 'DIALOG' },
151
- { provide: NGX_HELPER_CONTAINER_DATA, useValue: this.container.config.data },
152
- {
153
- provide: NGX_HELPER_CONTAINER_CLOSE,
154
- useFactory: () => (response) => this.matDialogRef.close(response),
155
- },
107
+ { provide: NGX_HELPER_PAGE_GROUP_DATA, useValue: this.data },
108
+ { provide: NGX_HELPER_PAGE_GROUP_INDEX, useValue: this.pageIndex },
109
+ { provide: NGX_HELPER_PAGE_GROUP_TITLE, useValue: this.pageGroup.pages[this.pageIndex].title },
156
110
  ],
157
111
  });
158
112
  }
159
- close() {
160
- this.matDialogRef.close();
113
+ setPage(index) {
114
+ if (this.pageIndex === index || index < 0 || index > this.pageGroup.pages.length - 1)
115
+ return;
116
+ this.pageIndex = index;
117
+ this.pageIndexChanged.next(this.pageIndex);
118
+ this.setInjector();
119
+ if (this.pageGroup.route) {
120
+ const queryParams = { ...this.activatedRoute.snapshot.queryParams };
121
+ queryParams['ngx-helper-page-group'] = this.pageIndex.toString();
122
+ this.router.navigate(this.pageGroup.route, { queryParams });
123
+ }
161
124
  }
162
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ContainerDialogComponent, deps: [{ token: i2.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
163
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ContainerDialogComponent, isStandalone: true, selector: "ng-component", host: { attributes: { "selector": "container-dialog" } }, ngImport: i0, template: "<header>\n <div class=\"title\">{{ container.title }}</div>\n @if (!container.config.hideClose) {\n <button mat-icon-button type=\"button\" (click)=\"close()\"><mat-icon>close</mat-icon></button>\n }\n</header>\n<content [style.padding]=\"container.config.padding || '1rem'\">\n <span *ngComponentOutlet=\"container.component; injector: injector\"></span>\n</content>\n", styles: ["header{display:flex;align-items:center;height:50px;line-height:50px;font-size:110%;padding:0 .5rem;border-bottom:1px solid var(--outline-variant)}header .title{flex:1;padding-right:.5rem}content{display:block;max-height:calc(80vh - 50px);overflow:auto}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
125
+ swipe(event, action, header, container) {
126
+ if (header.offsetWidth > container.offsetWidth)
127
+ return;
128
+ const clientX = event instanceof MouseEvent ? event.clientX : event.changedTouches[0].clientX;
129
+ switch (action) {
130
+ case 'START':
131
+ this.swipeStart = clientX - this.swipeLeft;
132
+ break;
133
+ case 'END':
134
+ this.swipeStart = undefined;
135
+ break;
136
+ case 'MOVE':
137
+ if (!this.swipeStart)
138
+ return;
139
+ let left = clientX - this.swipeStart;
140
+ if (left <= 0)
141
+ left = 0;
142
+ else if (left > container.offsetWidth - header.offsetWidth)
143
+ left = container.offsetWidth - header.offsetWidth;
144
+ this.swipeLeft = left;
145
+ container.style.left = `${left}px`;
146
+ break;
147
+ }
148
+ }
149
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperPageGroupComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1.Router }, { token: ComponentService }, { token: NGX_HELPER_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component });
150
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: NgxHelperPageGroupComponent, isStandalone: true, selector: "ngx-helper-page-group", inputs: { pageGroup: "pageGroup", pageIndex: "pageIndex", data: "data" }, outputs: { pageIndexChanged: "pageIndexChanged" }, host: { listeners: { "window:resize": "onResize($event)" }, properties: { "style.display": "this.display", "style.--mobile-toolbar-height": "this.toolbarHeight" } }, providers: [ComponentService], usesOnChanges: true, ngImport: i0, template: "<content [class.mobile]=\"isMobile\">\n <!-- DESKTOP VIEW -->\n @if (!isMobile) {\n <section\n class=\"desktop-pages\"\n [style.width]=\"sidebarWidth\"\n [style.position]=\"componentConfig.stickyView?.top ? 'sticky' : 'static'\"\n [style.top]=\"componentConfig.stickyView?.top?.desktopView || undefined\"\n >\n @for (item of pageGroup.pages; track $index) {\n <div\n class=\"page\"\n [style.color]=\"pageIndex === $index ? componentConfig.highlightText : ''\"\n [style.border-color]=\"pageIndex === $index ? componentConfig.highlightText : componentConfig.border\"\n [style.background-color]=\"pageIndex === $index ? componentConfig.highlightBackground : ''\"\n [style.cursor]=\"pageIndex === $index ? 'default' : 'pointer'\"\n (click)=\"setPage($index)\"\n >\n <!-- ICON -->\n @if (item.icon) { <mat-icon>{{ item.icon }}</mat-icon> }\n <div class=\"title\">{{ item.title }}</div>\n <!-- CURRENT PAGE -->\n @if (pageIndex === $index) { <mat-icon>keyboard_double_arrow_left</mat-icon> }\n </div>\n }\n </section>\n }\n\n <!-- MOBILE VIEW -->\n @if (isMobile) {\n <div\n class=\"mobile-pages\"\n [style.background-color]=\"componentConfig.background\"\n [style.position]=\"componentConfig.stickyView?.top ? 'sticky' : 'static'\"\n [style.top]=\"componentConfig.stickyView?.top?.mobileView || undefined\"\n (mousedown)=\"swipe($event, 'START', header, container)\"\n (mousemove)=\"swipe($event, 'MOVE', header, container)\"\n (mouseup)=\"swipe($event, 'END', header, container)\"\n (touchstart)=\"swipe($event, 'START', header, container)\"\n (touchmove)=\"swipe($event, 'MOVE', header, container)\"\n (touchend)=\"swipe($event, 'END', header, container)\"\n #header\n >\n <div class=\"pages\" #container>\n @for (item of pageGroup.pages; track $index) {\n <div\n class=\"page\"\n [style.color]=\"pageIndex === $index ? componentConfig.highlightText : ''\"\n [style.border-color]=\"pageIndex === $index ? componentConfig.highlightText : componentConfig.border\"\n [style.background-color]=\"pageIndex === $index ? componentConfig.highlightBackground : ''\"\n [style.cursor]=\"pageIndex === $index ? 'default' : 'pointer'\"\n (click)=\"setPage($index)\"\n >\n <!-- ICON -->\n @if (item.icon) { <mat-icon>{{ item.icon }}</mat-icon> }\n <div class=\"title\">{{ item.title }}</div>\n </div>\n }\n </div>\n </div>\n\n <div\n class=\"seperator\"\n [style.background-color]=\"componentConfig.background\"\n [style.position]=\"componentConfig.stickyView?.top ? 'sticky' : 'static'\"\n [style.top]=\"\n 'calc(' + (componentConfig.stickyView?.top?.mobileView || undefined) + ' + var(--mobile-toolbar-height) + 2px)'\n \"\n ></div>\n }\n\n <section class=\"content\">\n <!-- HEADER -->\n @if (pageGroup.header) {\n <div\n [style.background-color]=\"componentConfig.background\"\n [style.position]=\"componentConfig.stickyView?.top ? 'sticky' : 'static'\"\n [style.top]=\"\n (isMobile\n ? 'calc(' +\n (componentConfig.stickyView?.top?.mobileView || undefined) +\n ' + var(--mobile-toolbar-height) + 2px + 1rem)'\n : componentConfig.stickyView?.top?.desktopView) || undefined\n \"\n >\n <span *ngComponentOutlet=\"pageGroup.header; injector: injector\"></span>\n <div class=\"seperator\"></div>\n </div>\n }\n <span *ngComponentOutlet=\"pageGroup.pages[pageIndex].component; injector: injector\"></span>\n </section>\n</content>\n", styles: ["content{direction:rtl;display:flex;align-items:flex-start;column-gap:1rem}content .desktop-pages{display:flex;flex-direction:column;row-gap:.5rem}content .desktop-pages .page{display:flex;align-items:center;column-gap:.5rem;border-radius:8px;padding:.5rem .75rem;border:1px solid var(--outline)}content .desktop-pages .page .title{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}content .desktop-pages .page mat-icon{font-size:120%}content .seperator{z-index:2;height:1rem;width:100%}content .content{flex:1;display:block}content.mobile{flex-direction:column;column-gap:0}content.mobile .mobile-pages{z-index:2;height:calc(var(--mobile-toolbar-height) + 2px);overflow-x:hidden;width:100%}content.mobile .mobile-pages .pages{display:inline-flex;align-items:center;column-gap:.5rem;position:relative;left:0}content.mobile .mobile-pages .pages .page{display:flex;align-items:center;column-gap:.25rem;font-size:80%;white-space:nowrap;padding:0 .5rem;border-radius:8px;border:1px solid transparent;height:var(--mobile-toolbar-height)}content.mobile .mobile-pages .pages .page mat-icon{font-size:120%}content.mobile .content{flex:none;width:100%}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
164
151
  }
165
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ContainerDialogComponent, decorators: [{
152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperPageGroupComponent, decorators: [{
166
153
  type: Component,
167
- args: [{ host: { selector: 'container-dialog' }, imports: [NgComponentOutlet, MatIconButton, MatIcon], template: "<header>\n <div class=\"title\">{{ container.title }}</div>\n @if (!container.config.hideClose) {\n <button mat-icon-button type=\"button\" (click)=\"close()\"><mat-icon>close</mat-icon></button>\n }\n</header>\n<content [style.padding]=\"container.config.padding || '1rem'\">\n <span *ngComponentOutlet=\"container.component; injector: injector\"></span>\n</content>\n", styles: ["header{display:flex;align-items:center;height:50px;line-height:50px;font-size:110%;padding:0 .5rem;border-bottom:1px solid var(--outline-variant)}header .title{flex:1;padding-right:.5rem}content{display:block;max-height:calc(80vh - 50px);overflow:auto}\n"] }]
168
- }], ctorParameters: () => [{ type: i2.MatDialogRef }] });
154
+ args: [{ selector: 'ngx-helper-page-group', host: { '(window:resize)': 'onResize($event)' }, imports: [NgComponentOutlet, MatIcon], providers: [ComponentService], template: "<content [class.mobile]=\"isMobile\">\n <!-- DESKTOP VIEW -->\n @if (!isMobile) {\n <section\n class=\"desktop-pages\"\n [style.width]=\"sidebarWidth\"\n [style.position]=\"componentConfig.stickyView?.top ? 'sticky' : 'static'\"\n [style.top]=\"componentConfig.stickyView?.top?.desktopView || undefined\"\n >\n @for (item of pageGroup.pages; track $index) {\n <div\n class=\"page\"\n [style.color]=\"pageIndex === $index ? componentConfig.highlightText : ''\"\n [style.border-color]=\"pageIndex === $index ? componentConfig.highlightText : componentConfig.border\"\n [style.background-color]=\"pageIndex === $index ? componentConfig.highlightBackground : ''\"\n [style.cursor]=\"pageIndex === $index ? 'default' : 'pointer'\"\n (click)=\"setPage($index)\"\n >\n <!-- ICON -->\n @if (item.icon) { <mat-icon>{{ item.icon }}</mat-icon> }\n <div class=\"title\">{{ item.title }}</div>\n <!-- CURRENT PAGE -->\n @if (pageIndex === $index) { <mat-icon>keyboard_double_arrow_left</mat-icon> }\n </div>\n }\n </section>\n }\n\n <!-- MOBILE VIEW -->\n @if (isMobile) {\n <div\n class=\"mobile-pages\"\n [style.background-color]=\"componentConfig.background\"\n [style.position]=\"componentConfig.stickyView?.top ? 'sticky' : 'static'\"\n [style.top]=\"componentConfig.stickyView?.top?.mobileView || undefined\"\n (mousedown)=\"swipe($event, 'START', header, container)\"\n (mousemove)=\"swipe($event, 'MOVE', header, container)\"\n (mouseup)=\"swipe($event, 'END', header, container)\"\n (touchstart)=\"swipe($event, 'START', header, container)\"\n (touchmove)=\"swipe($event, 'MOVE', header, container)\"\n (touchend)=\"swipe($event, 'END', header, container)\"\n #header\n >\n <div class=\"pages\" #container>\n @for (item of pageGroup.pages; track $index) {\n <div\n class=\"page\"\n [style.color]=\"pageIndex === $index ? componentConfig.highlightText : ''\"\n [style.border-color]=\"pageIndex === $index ? componentConfig.highlightText : componentConfig.border\"\n [style.background-color]=\"pageIndex === $index ? componentConfig.highlightBackground : ''\"\n [style.cursor]=\"pageIndex === $index ? 'default' : 'pointer'\"\n (click)=\"setPage($index)\"\n >\n <!-- ICON -->\n @if (item.icon) { <mat-icon>{{ item.icon }}</mat-icon> }\n <div class=\"title\">{{ item.title }}</div>\n </div>\n }\n </div>\n </div>\n\n <div\n class=\"seperator\"\n [style.background-color]=\"componentConfig.background\"\n [style.position]=\"componentConfig.stickyView?.top ? 'sticky' : 'static'\"\n [style.top]=\"\n 'calc(' + (componentConfig.stickyView?.top?.mobileView || undefined) + ' + var(--mobile-toolbar-height) + 2px)'\n \"\n ></div>\n }\n\n <section class=\"content\">\n <!-- HEADER -->\n @if (pageGroup.header) {\n <div\n [style.background-color]=\"componentConfig.background\"\n [style.position]=\"componentConfig.stickyView?.top ? 'sticky' : 'static'\"\n [style.top]=\"\n (isMobile\n ? 'calc(' +\n (componentConfig.stickyView?.top?.mobileView || undefined) +\n ' + var(--mobile-toolbar-height) + 2px + 1rem)'\n : componentConfig.stickyView?.top?.desktopView) || undefined\n \"\n >\n <span *ngComponentOutlet=\"pageGroup.header; injector: injector\"></span>\n <div class=\"seperator\"></div>\n </div>\n }\n <span *ngComponentOutlet=\"pageGroup.pages[pageIndex].component; injector: injector\"></span>\n </section>\n</content>\n", styles: ["content{direction:rtl;display:flex;align-items:flex-start;column-gap:1rem}content .desktop-pages{display:flex;flex-direction:column;row-gap:.5rem}content .desktop-pages .page{display:flex;align-items:center;column-gap:.5rem;border-radius:8px;padding:.5rem .75rem;border:1px solid var(--outline)}content .desktop-pages .page .title{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}content .desktop-pages .page mat-icon{font-size:120%}content .seperator{z-index:2;height:1rem;width:100%}content .content{flex:1;display:block}content.mobile{flex-direction:column;column-gap:0}content.mobile .mobile-pages{z-index:2;height:calc(var(--mobile-toolbar-height) + 2px);overflow-x:hidden;width:100%}content.mobile .mobile-pages .pages{display:inline-flex;align-items:center;column-gap:.5rem;position:relative;left:0}content.mobile .mobile-pages .pages .page{display:flex;align-items:center;column-gap:.25rem;font-size:80%;white-space:nowrap;padding:0 .5rem;border-radius:8px;border:1px solid transparent;height:var(--mobile-toolbar-height)}content.mobile .mobile-pages .pages .page mat-icon{font-size:120%}content.mobile .content{flex:none;width:100%}\n"] }]
155
+ }], ctorParameters: () => [{ type: i1.ActivatedRoute }, { type: i1.Router }, { type: ComponentService }, { type: undefined, decorators: [{
156
+ type: Optional
157
+ }, {
158
+ type: Inject,
159
+ args: [NGX_HELPER_CONFIG]
160
+ }] }], propDecorators: { display: [{
161
+ type: HostBinding,
162
+ args: ['style.display']
163
+ }], toolbarHeight: [{
164
+ type: HostBinding,
165
+ args: ['style.--mobile-toolbar-height']
166
+ }], pageGroup: [{
167
+ type: Input,
168
+ args: [{ required: true }]
169
+ }], pageIndex: [{
170
+ type: Input,
171
+ args: [{ required: false }]
172
+ }], data: [{
173
+ type: Input,
174
+ args: [{ required: false }]
175
+ }], pageIndexChanged: [{
176
+ type: Output
177
+ }] } });
169
178
 
170
- class ContainerBottomSheetComponent {
171
- matBottomSheetRef;
172
- container = inject(MAT_BOTTOM_SHEET_DATA);
173
- injector;
174
- constructor(matBottomSheetRef) {
175
- this.matBottomSheetRef = matBottomSheetRef;
179
+ class NgxHelperSectionStickyDirective {
180
+ elementRef;
181
+ config;
182
+ ngxHelperSectionSticky;
183
+ ngxHelperSectionZIndex;
184
+ componentService = inject(ComponentService);
185
+ isMobile = false;
186
+ constructor(elementRef, config) {
187
+ this.elementRef = elementRef;
188
+ this.config = config;
176
189
  }
177
190
  ngOnInit() {
178
- this.injector = Injector.create({
179
- providers: [
180
- { provide: NGX_HELPER_CONTAINER_TYPE, useValue: 'BOTTOMSHEET' },
181
- { provide: NGX_HELPER_CONTAINER_DATA, useValue: this.container.config.data },
182
- {
183
- provide: NGX_HELPER_CONTAINER_CLOSE,
184
- useFactory: () => (response) => this.matBottomSheetRef.dismiss(response),
185
- },
186
- ],
187
- });
188
- }
189
- close() {
190
- this.matBottomSheetRef.dismiss();
191
+ this.onResize();
192
+ }
193
+ onResize() {
194
+ const mobileWidth = this.config?.mobileWidth || 600;
195
+ this.isMobile = window.innerWidth <= mobileWidth;
196
+ this.setPosition();
197
+ }
198
+ setPosition() {
199
+ const element = this.elementRef.nativeElement;
200
+ if (!element)
201
+ return;
202
+ const config = this.componentService.getComponentConfig(this.config);
203
+ switch (this.ngxHelperSectionSticky) {
204
+ case 'TOP':
205
+ const top = config.stickyView?.top;
206
+ if (!top)
207
+ return;
208
+ element.style.position = 'sticky';
209
+ element.style.zIndex = this.ngxHelperSectionZIndex ? this.ngxHelperSectionZIndex.toString() : '1';
210
+ element.style.top = this.isMobile ? top.mobileView : top.desktopView;
211
+ break;
212
+ case 'BOTTOM':
213
+ const bottom = config.stickyView?.bottom;
214
+ if (!bottom)
215
+ return;
216
+ element.style.position = 'sticky';
217
+ element.style.zIndex = this.ngxHelperSectionZIndex ? this.ngxHelperSectionZIndex.toString() : '1';
218
+ element.style.bottom = this.isMobile ? bottom.mobileView : bottom.desktopView;
219
+ break;
220
+ }
191
221
  }
192
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ContainerBottomSheetComponent, deps: [{ token: i1$1.MatBottomSheetRef }], target: i0.ɵɵFactoryTarget.Component });
193
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ContainerBottomSheetComponent, isStandalone: true, selector: "ng-component", host: { attributes: { "selector": "container-bottom-sheet" } }, ngImport: i0, template: "<header>\n <div class=\"title\">{{ container.title }}</div>\n @if (!container.config.hideClose) {\n <button mat-icon-button type=\"button\" (click)=\"close()\"><mat-icon>close</mat-icon></button>\n }\n</header>\n<content>\n <div [style.padding]=\"container.config.padding || '1rem'\">\n <span *ngComponentOutlet=\"container.component; injector: injector\"></span>\n </div>\n</content>\n", styles: ["header{display:flex;align-items:center;height:50px;line-height:50px;font-size:110%;padding:0 .5rem;border-bottom:1px solid var(--outline-variant)}header .title{flex:1;padding-right:.5rem}content{display:block;max-height:calc(80vh - 51px);overflow:auto}::ng-deep .ngx-helper-bottom-sheet .mat-bottom-sheet-container{padding:0}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
222
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSectionStickyDirective, deps: [{ token: i0.ElementRef }, { token: NGX_HELPER_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
223
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.3", type: NgxHelperSectionStickyDirective, isStandalone: true, selector: "[ngxHelperSectionSticky]", inputs: { ngxHelperSectionSticky: "ngxHelperSectionSticky", ngxHelperSectionZIndex: "ngxHelperSectionZIndex" }, host: { listeners: { "window:resize": "onResize($event)" } }, ngImport: i0 });
194
224
  }
195
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ContainerBottomSheetComponent, decorators: [{
196
- type: Component,
197
- args: [{ host: { selector: 'container-bottom-sheet' }, imports: [NgComponentOutlet, MatIconButton, MatIcon], template: "<header>\n <div class=\"title\">{{ container.title }}</div>\n @if (!container.config.hideClose) {\n <button mat-icon-button type=\"button\" (click)=\"close()\"><mat-icon>close</mat-icon></button>\n }\n</header>\n<content>\n <div [style.padding]=\"container.config.padding || '1rem'\">\n <span *ngComponentOutlet=\"container.component; injector: injector\"></span>\n </div>\n</content>\n", styles: ["header{display:flex;align-items:center;height:50px;line-height:50px;font-size:110%;padding:0 .5rem;border-bottom:1px solid var(--outline-variant)}header .title{flex:1;padding-right:.5rem}content{display:block;max-height:calc(80vh - 51px);overflow:auto}::ng-deep .ngx-helper-bottom-sheet .mat-bottom-sheet-container{padding:0}\n"] }]
198
- }], ctorParameters: () => [{ type: i1$1.MatBottomSheetRef }] });
225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSectionStickyDirective, decorators: [{
226
+ type: Directive,
227
+ args: [{
228
+ selector: '[ngxHelperSectionSticky]',
229
+ host: { '(window:resize)': 'onResize($event)' },
230
+ }]
231
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
232
+ type: Optional
233
+ }, {
234
+ type: Inject,
235
+ args: [NGX_HELPER_CONFIG]
236
+ }] }], propDecorators: { ngxHelperSectionSticky: [{
237
+ type: Input,
238
+ args: [{ required: true }]
239
+ }], ngxHelperSectionZIndex: [{
240
+ type: Input,
241
+ args: [{ required: false }]
242
+ }] } });
199
243
 
200
- class NgxHelperContainerCalss {
201
- matBottomSheet;
202
- matDialog;
203
- container;
204
- constructor(matBottomSheet, matDialog, container) {
205
- this.matBottomSheet = matBottomSheet;
206
- this.matDialog = matDialog;
207
- this.container = container;
244
+ class NgxHelperSectionComponent {
245
+ componentService;
246
+ config;
247
+ gap;
248
+ backgroundColor;
249
+ gapSize;
250
+ mobileView;
251
+ isMobile = false;
252
+ componentConfig;
253
+ constructor(componentService, config) {
254
+ this.componentService = componentService;
255
+ this.config = config;
208
256
  }
209
- dialog(arg1, arg2, arg3) {
210
- const onResponse = typeof arg1 === 'function' ? arg1 : undefined;
211
- const onDismiss = typeof arg2 === 'function' ? arg2 : undefined;
212
- const config = arg3 || (typeof arg2 !== 'function' ? arg2 : {});
213
- this.matDialog
214
- .open(ContainerDialogComponent, {
215
- // DEFAULT CONFIG
216
- width: 'calc(100vw - 4rem)',
217
- direction: 'rtl',
218
- enterAnimationDuration: '100ms',
219
- exitAnimationDuration: '100ms',
220
- // OVERWRITE CONFIG
221
- ...config,
222
- maxHeight: '80vh',
223
- // DATA
224
- data: this.container,
225
- })
226
- .afterClosed()
227
- .subscribe({
228
- next: (response) => {
229
- if (onResponse && !!response)
230
- onResponse(response);
231
- if (onDismiss && !response)
232
- onDismiss();
233
- },
234
- });
257
+ ngOnInit() {
258
+ this.componentConfig = this.componentService.getComponentConfig(this.config);
259
+ this.gap = this.gapSize || '1rem';
260
+ this.backgroundColor = this.componentConfig.background;
261
+ this.onResize();
235
262
  }
236
- bottomSheet(arg1, arg2, arg3) {
237
- const onResponse = typeof arg1 === 'function' ? arg1 : undefined;
238
- const onDismiss = typeof arg2 === 'function' ? arg2 : undefined;
239
- const config = arg3 || (typeof arg2 !== 'function' ? arg2 : {});
240
- this.matBottomSheet
241
- .open(ContainerBottomSheetComponent, {
242
- // DEFAULT CONFIG
243
- direction: 'rtl',
244
- panelClass: 'ngx-helper-bottom-sheet',
245
- // OVERWRITE CONFIG
246
- ...config,
247
- maxHeight: '80vh',
248
- // DATA
249
- data: this.container,
250
- })
251
- .afterDismissed()
252
- .subscribe({
253
- next: (response) => {
254
- if (onResponse && !!response)
255
- onResponse(response);
256
- if (onDismiss && !response)
257
- onDismiss();
258
- },
259
- });
263
+ onResize() {
264
+ const mobileWidth = this.config?.mobileWidth || 600;
265
+ this.isMobile = this.mobileView || window.innerWidth <= mobileWidth;
260
266
  }
267
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSectionComponent, deps: [{ token: ComponentService }, { token: NGX_HELPER_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component });
268
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: NgxHelperSectionComponent, isStandalone: true, selector: "ngx-helper-section", inputs: { gapSize: "gapSize", mobileView: "mobileView" }, host: { listeners: { "window:resize": "onResize($event)" }, properties: { "style.--section-gap": "this.gap", "style.--section-background-color": "this.backgroundColor" } }, providers: [ComponentService], ngImport: i0, template: "<div class=\"columns\" [class.mobile]=\"isMobile\">\n <ng-content></ng-content>\n</div>\n", styles: [":host{display:block;direction:rtl}:host .columns{display:flex;align-items:flex-start;column-gap:var(--section-gap)}:host ::ng-deep ngx-helper-section-column{flex:1;display:flex;flex-direction:column;row-gap:var(--section-gap);background-color:var(--section-background-color)}:host .mobile{flex-direction:column;column-gap:0;row-gap:var(--section-gap)}:host .mobile ::ng-deep ngx-helper-section-column{width:100%!important}\n"] });
261
269
  }
262
- class NgxHelperContainerService {
263
- matBottomSheet;
264
- matDialog;
265
- constructor(matBottomSheet, matDialog) {
266
- this.matBottomSheet = matBottomSheet;
267
- this.matDialog = matDialog;
268
- }
269
- init(component, title, arg1) {
270
- const config = arg1 || {};
271
- return new NgxHelperContainerCalss(this.matBottomSheet, this.matDialog, { component, title, config });
272
- }
273
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperContainerService, deps: [{ token: i1$1.MatBottomSheet }, { token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
274
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperContainerService, providedIn: 'root' });
270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSectionComponent, decorators: [{
271
+ type: Component,
272
+ args: [{ selector: 'ngx-helper-section', host: { '(window:resize)': 'onResize($event)' }, imports: [], providers: [ComponentService], template: "<div class=\"columns\" [class.mobile]=\"isMobile\">\n <ng-content></ng-content>\n</div>\n", styles: [":host{display:block;direction:rtl}:host .columns{display:flex;align-items:flex-start;column-gap:var(--section-gap)}:host ::ng-deep ngx-helper-section-column{flex:1;display:flex;flex-direction:column;row-gap:var(--section-gap);background-color:var(--section-background-color)}:host .mobile{flex-direction:column;column-gap:0;row-gap:var(--section-gap)}:host .mobile ::ng-deep ngx-helper-section-column{width:100%!important}\n"] }]
273
+ }], ctorParameters: () => [{ type: ComponentService }, { type: undefined, decorators: [{
274
+ type: Optional
275
+ }, {
276
+ type: Inject,
277
+ args: [NGX_HELPER_CONFIG]
278
+ }] }], propDecorators: { gap: [{
279
+ type: HostBinding,
280
+ args: ['style.--section-gap']
281
+ }], backgroundColor: [{
282
+ type: HostBinding,
283
+ args: ['style.--section-background-color']
284
+ }], gapSize: [{
285
+ type: Input,
286
+ args: [{ required: false }]
287
+ }], mobileView: [{
288
+ type: Input,
289
+ args: [{ required: false }]
290
+ }] } });
291
+
292
+ class NgxHelperSectionColumnComponent {
293
+ flexStyle = '1';
294
+ widthStyle = '*';
295
+ flex;
296
+ width;
297
+ sticky;
298
+ ngOnChanges(changes) {
299
+ this.flexStyle = this.width ? 'unset' : this.flex?.toString() || '1';
300
+ this.widthStyle = this.width || '*';
301
+ }
302
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSectionColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
303
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: NgxHelperSectionColumnComponent, isStandalone: true, selector: "ngx-helper-section-column", inputs: { flex: "flex", width: "width", sticky: "sticky" }, host: { properties: { "style.flex": "this.flexStyle", "style.width": "this.widthStyle" } }, usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""] });
275
304
  }
276
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperContainerService, decorators: [{
277
- type: Injectable,
278
- args: [{ providedIn: 'root' }]
279
- }], ctorParameters: () => [{ type: i1$1.MatBottomSheet }, { type: i2.MatDialog }] });
305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSectionColumnComponent, decorators: [{
306
+ type: Component,
307
+ args: [{ selector: 'ngx-helper-section-column', imports: [], template: "<ng-content></ng-content>\n" }]
308
+ }], propDecorators: { flexStyle: [{
309
+ type: HostBinding,
310
+ args: ['style.flex']
311
+ }], widthStyle: [{
312
+ type: HostBinding,
313
+ args: ['style.width']
314
+ }], flex: [{
315
+ type: Input,
316
+ args: [{ required: false }]
317
+ }], width: [{
318
+ type: Input,
319
+ args: [{ required: false }]
320
+ }], sticky: [{
321
+ type: Input,
322
+ args: [{ required: false }]
323
+ }] } });
280
324
 
281
325
  class NgxHelperBankCardPipe {
282
326
  transform(value, options) {
@@ -418,13 +462,13 @@ class NgxHelperMultiLinePipe {
418
462
  ? this.sanitizer.bypassSecurityTrustHtml(value.replace(/(?:\r\n|\r|\n)/g, '<br />'))
419
463
  : Helper.STRING.escapeHTML(value).replace(/(?:\r\n|\r|\n)/g, '<br />');
420
464
  }
421
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperMultiLinePipe, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
465
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperMultiLinePipe, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
422
466
  static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperMultiLinePipe, isStandalone: true, name: "ngxHelperMultiLine" });
423
467
  }
424
468
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperMultiLinePipe, decorators: [{
425
469
  type: Pipe,
426
470
  args: [{ name: 'ngxHelperMultiLine' }]
427
- }], ctorParameters: () => [{ type: i1$2.DomSanitizer }] });
471
+ }], ctorParameters: () => [{ type: i1$1.DomSanitizer }] });
428
472
 
429
473
  class NgxHelperNumberPipe {
430
474
  transform(value, options) {
@@ -505,13 +549,13 @@ class NgxHelperSafePipe {
505
549
  return this.domSanitizer.bypassSecurityTrustHtml(value);
506
550
  }
507
551
  }
508
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSafePipe, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
552
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSafePipe, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
509
553
  static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSafePipe, isStandalone: true, name: "ngxHelperSafe" });
510
554
  }
511
555
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperSafePipe, decorators: [{
512
556
  type: Pipe,
513
557
  args: [{ name: 'ngxHelperSafe' }]
514
- }], ctorParameters: () => [{ type: i1$2.DomSanitizer }] });
558
+ }], ctorParameters: () => [{ type: i1$1.DomSanitizer }] });
515
559
 
516
560
  class NgxHelperVolumePipe {
517
561
  transform(value, options) {
@@ -569,6 +613,274 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
569
613
  args: [{ name: 'ngxHelperWeight' }]
570
614
  }] });
571
615
 
616
+ class ConfirmDialogComponent {
617
+ confirm = inject(MAT_DIALOG_DATA);
618
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ConfirmDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
619
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ConfirmDialogComponent, isStandalone: true, selector: "ng-component", host: { attributes: { "selector": "confirm-dialog" } }, ngImport: i0, template: "<mat-dialog-content>\n <content>\n <!-- ICON -->\n @if (confirm.icon) {\n <div class=\"icon\">\n <mat-icon>{{ confirm.icon }}</mat-icon>\n </div>\n }\n\n <!-- CONTENT -->\n <div class=\"content\">\n <div class=\"question\">{{ confirm.question }}</div>\n <!-- DESCRIPTION -->\n @if (confirm.description) {\n <div class=\"description\">{{ confirm.description }}</div>\n }\n <!-- DATA -->\n @if (confirm.data) {\n <div class=\"data\">\n <div class=\"title\">{{ confirm.data.title }}:</div>\n <div class=\"value\">{{ confirm.data.value }}</div>\n </div>\n }\n </div>\n </content>\n</mat-dialog-content>\n<mat-dialog-actions [align]=\"'end'\">\n <button mat-button type=\"button\" mat-dialog-close [ngClass]=\"confirm.denyClass\">\u062E\u06CC\u0631</button>\n <button mat-button type=\"button\" [mat-dialog-close]=\"true\" [ngClass]=\"confirm.confirmClass\">\u0628\u0644\u06CC</button>\n</mat-dialog-actions>\n", styles: ["content{display:flex;align-items:flex-start;column-gap:1rem;padding-top:1rem}content .icon mat-icon{font-size:200%}content .content{flex:1}content .content .question{text-align:justify}content .content .description{font-size:90%;margin-top:.5rem;text-align:justify}content .content .data{display:flex;align-items:center;column-gap:.5rem;font-size:90%;margin-top:1rem}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
620
+ }
621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
622
+ type: Component,
623
+ args: [{ host: { selector: 'confirm-dialog' }, imports: [NgClass, MatButtonModule, MatDialogModule, MatIconModule], template: "<mat-dialog-content>\n <content>\n <!-- ICON -->\n @if (confirm.icon) {\n <div class=\"icon\">\n <mat-icon>{{ confirm.icon }}</mat-icon>\n </div>\n }\n\n <!-- CONTENT -->\n <div class=\"content\">\n <div class=\"question\">{{ confirm.question }}</div>\n <!-- DESCRIPTION -->\n @if (confirm.description) {\n <div class=\"description\">{{ confirm.description }}</div>\n }\n <!-- DATA -->\n @if (confirm.data) {\n <div class=\"data\">\n <div class=\"title\">{{ confirm.data.title }}:</div>\n <div class=\"value\">{{ confirm.data.value }}</div>\n </div>\n }\n </div>\n </content>\n</mat-dialog-content>\n<mat-dialog-actions [align]=\"'end'\">\n <button mat-button type=\"button\" mat-dialog-close [ngClass]=\"confirm.denyClass\">\u062E\u06CC\u0631</button>\n <button mat-button type=\"button\" [mat-dialog-close]=\"true\" [ngClass]=\"confirm.confirmClass\">\u0628\u0644\u06CC</button>\n</mat-dialog-actions>\n", styles: ["content{display:flex;align-items:flex-start;column-gap:1rem;padding-top:1rem}content .icon mat-icon{font-size:200%}content .content{flex:1}content .content .question{text-align:justify}content .content .description{font-size:90%;margin-top:.5rem;text-align:justify}content .content .data{display:flex;align-items:center;column-gap:.5rem;font-size:90%;margin-top:1rem}\n"] }]
624
+ }] });
625
+
626
+ class ConfirmBottomSheetComponent {
627
+ matBottomSheetRef;
628
+ confirm = inject(MAT_BOTTOM_SHEET_DATA);
629
+ constructor(matBottomSheetRef) {
630
+ this.matBottomSheetRef = matBottomSheetRef;
631
+ }
632
+ close(confirmed) {
633
+ this.matBottomSheetRef.dismiss(confirmed);
634
+ }
635
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ConfirmBottomSheetComponent, deps: [{ token: i1$3.MatBottomSheetRef }], target: i0.ɵɵFactoryTarget.Component });
636
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ConfirmBottomSheetComponent, isStandalone: true, selector: "ng-component", host: { attributes: { "selector": "confirm-bottom-sheet" } }, ngImport: i0, template: "<content>\n <!-- ICON -->\n @if (confirm.icon) {\n <div class=\"icon\">\n <mat-icon>{{ confirm.icon }}</mat-icon>\n </div>\n }\n\n <!-- CONTENT -->\n <div class=\"content\">\n <div class=\"question\">{{ confirm.question }}</div>\n <!-- DESCRIPTION -->\n @if (confirm.description) {\n <div class=\"description\">{{ confirm.description }}</div>\n }\n <!-- DATA -->\n @if (confirm.data) {\n <div class=\"data\">\n <div class=\"title\">{{ confirm.data.title }}:</div>\n <div class=\"value\">{{ confirm.data.value }}</div>\n </div>\n }\n </div>\n</content>\n\n<div class=\"buttons\">\n <button mat-button type=\"button\" (click)=\"close()\" [ngClass]=\"confirm.denyClass\">\u062E\u06CC\u0631</button>\n <button mat-button type=\"button\" (click)=\"close(true)\" [ngClass]=\"confirm.confirmClass\">\u0628\u0644\u06CC</button>\n</div>\n", styles: ["content{display:flex;align-items:flex-start;column-gap:1rem;padding-top:1rem}content .icon mat-icon{font-size:200%}content .content{flex:1}content .content .question{text-align:justify}content .content .description{font-size:90%;margin-top:.5rem;text-align:justify}content .content .data{display:flex;align-items:center;column-gap:.5rem;font-size:90%;margin-top:1rem}.buttons{display:flex;align-items:center;justify-content:flex-end;column-gap:1rem;margin:1rem 0 .5rem}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
637
+ }
638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ConfirmBottomSheetComponent, decorators: [{
639
+ type: Component,
640
+ args: [{ host: { selector: 'confirm-bottom-sheet' }, imports: [NgClass, MatButtonModule, MatIconModule], template: "<content>\n <!-- ICON -->\n @if (confirm.icon) {\n <div class=\"icon\">\n <mat-icon>{{ confirm.icon }}</mat-icon>\n </div>\n }\n\n <!-- CONTENT -->\n <div class=\"content\">\n <div class=\"question\">{{ confirm.question }}</div>\n <!-- DESCRIPTION -->\n @if (confirm.description) {\n <div class=\"description\">{{ confirm.description }}</div>\n }\n <!-- DATA -->\n @if (confirm.data) {\n <div class=\"data\">\n <div class=\"title\">{{ confirm.data.title }}:</div>\n <div class=\"value\">{{ confirm.data.value }}</div>\n </div>\n }\n </div>\n</content>\n\n<div class=\"buttons\">\n <button mat-button type=\"button\" (click)=\"close()\" [ngClass]=\"confirm.denyClass\">\u062E\u06CC\u0631</button>\n <button mat-button type=\"button\" (click)=\"close(true)\" [ngClass]=\"confirm.confirmClass\">\u0628\u0644\u06CC</button>\n</div>\n", styles: ["content{display:flex;align-items:flex-start;column-gap:1rem;padding-top:1rem}content .icon mat-icon{font-size:200%}content .content{flex:1}content .content .question{text-align:justify}content .content .description{font-size:90%;margin-top:.5rem;text-align:justify}content .content .data{display:flex;align-items:center;column-gap:.5rem;font-size:90%;margin-top:1rem}.buttons{display:flex;align-items:center;justify-content:flex-end;column-gap:1rem;margin:1rem 0 .5rem}\n"] }]
641
+ }], ctorParameters: () => [{ type: i1$3.MatBottomSheetRef }] });
642
+
643
+ class NgxHelperConfirmCalss {
644
+ matBottomSheet;
645
+ matDialog;
646
+ confirm;
647
+ constructor(matBottomSheet, matDialog, confirm) {
648
+ this.matBottomSheet = matBottomSheet;
649
+ this.matDialog = matDialog;
650
+ this.confirm = confirm;
651
+ }
652
+ dialog(onConfirmed, arg1, arg2) {
653
+ const onDenied = typeof arg1 === 'function' ? arg1 : undefined;
654
+ const config = arg2 || (typeof arg1 !== 'function' ? arg1 : {});
655
+ this.matDialog
656
+ .open(ConfirmDialogComponent, {
657
+ // DEFAULT CONFIG
658
+ width: 'calc(100vw - 4rem)',
659
+ direction: 'rtl',
660
+ enterAnimationDuration: '100ms',
661
+ exitAnimationDuration: '100ms',
662
+ // OVERWRITE CONFIG
663
+ ...config,
664
+ maxHeight: '80vh',
665
+ // DATA
666
+ data: this.confirm,
667
+ })
668
+ .afterClosed()
669
+ .subscribe({ next: (confirmed) => (!!confirmed ? onConfirmed() : onDenied ? onDenied() : undefined) });
670
+ }
671
+ bottomSheet(onConfirmed, arg1, arg2) {
672
+ const onDenied = typeof arg1 === 'function' ? arg1 : undefined;
673
+ const config = arg2 || (typeof arg1 !== 'function' ? arg1 : {});
674
+ this.matBottomSheet
675
+ .open(ConfirmBottomSheetComponent, {
676
+ // DEFAULT CONFIG
677
+ direction: 'rtl',
678
+ // OVERWRITE CONFIG
679
+ ...config,
680
+ maxHeight: '80vh',
681
+ // DATA
682
+ data: this.confirm,
683
+ })
684
+ .afterDismissed()
685
+ .subscribe({ next: (confirmed) => (!!confirmed ? onConfirmed() : onDenied ? onDenied() : undefined) });
686
+ }
687
+ }
688
+ class NgxHelperConfirmService {
689
+ matBottomSheet;
690
+ matDialog;
691
+ constructor(matBottomSheet, matDialog) {
692
+ this.matBottomSheet = matBottomSheet;
693
+ this.matDialog = matDialog;
694
+ }
695
+ verify(confirm) {
696
+ return new NgxHelperConfirmCalss(this.matBottomSheet, this.matDialog, confirm);
697
+ }
698
+ active(data, config) {
699
+ return this.verify({
700
+ question: `آیا می‌خواهید ${data.title} انتخاب شده را فعال کنید؟`,
701
+ description: config?.description,
702
+ data: data.value ? { title: data.title, value: data.value } : undefined,
703
+ icon: 'check_box',
704
+ confirmClass: config?.confirmClass,
705
+ denyClass: config?.denyClass,
706
+ });
707
+ }
708
+ deactive(data, config) {
709
+ return this.verify({
710
+ question: `آیا می‌خواهید ${data.title} انتخاب شده را غیرفعال کنید؟`,
711
+ description: config?.description,
712
+ data: data.value ? { title: data.title, value: data.value } : undefined,
713
+ icon: 'disabled_by_default',
714
+ confirmClass: config?.confirmClass || 'error',
715
+ denyClass: config?.denyClass,
716
+ });
717
+ }
718
+ status(active, data, config) {
719
+ return active ? this.active(data, config || {}) : this.deactive(data, config || {});
720
+ }
721
+ delete(data, config) {
722
+ return this.verify({
723
+ question: `آیا می‌خواهید ${data.title} انتخاب شده را حذف کنید؟`,
724
+ description: config?.description,
725
+ data: data.value ? { title: data.title, value: data.value } : undefined,
726
+ icon: 'delete',
727
+ confirmClass: config?.confirmClass || 'error',
728
+ denyClass: config?.denyClass,
729
+ });
730
+ }
731
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperConfirmService, deps: [{ token: i1$3.MatBottomSheet }, { token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
732
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperConfirmService, providedIn: 'root' });
733
+ }
734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperConfirmService, decorators: [{
735
+ type: Injectable,
736
+ args: [{ providedIn: 'root' }]
737
+ }], ctorParameters: () => [{ type: i1$3.MatBottomSheet }, { type: i2.MatDialog }] });
738
+
739
+ const NGX_HELPER_CONTAINER_TYPE = new InjectionToken('NGX-HELPER-CONTAINER-TYPE');
740
+ const NGX_HELPER_CONTAINER_DATA = new InjectionToken('NGX-HELPER-CONTAINER-DATA');
741
+ const NGX_HELPER_CONTAINER_CLOSE = new InjectionToken('NGX-HELPER-CONTAINER-CLOSE');
742
+
743
+ class ContainerDialogComponent {
744
+ matDialogRef;
745
+ container = inject(MAT_DIALOG_DATA);
746
+ injector;
747
+ constructor(matDialogRef) {
748
+ this.matDialogRef = matDialogRef;
749
+ }
750
+ ngOnInit() {
751
+ this.injector = Injector.create({
752
+ providers: [
753
+ { provide: NGX_HELPER_CONTAINER_TYPE, useValue: 'DIALOG' },
754
+ { provide: NGX_HELPER_CONTAINER_DATA, useValue: this.container.config.data },
755
+ {
756
+ provide: NGX_HELPER_CONTAINER_CLOSE,
757
+ useFactory: () => (response) => this.matDialogRef.close(response),
758
+ },
759
+ ],
760
+ });
761
+ }
762
+ close() {
763
+ this.matDialogRef.close();
764
+ }
765
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ContainerDialogComponent, deps: [{ token: i2.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
766
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ContainerDialogComponent, isStandalone: true, selector: "ng-component", host: { attributes: { "selector": "container-dialog" } }, ngImport: i0, template: "<header>\n <div class=\"title\">{{ container.title }}</div>\n @if (!container.config.hideClose) {\n <button mat-icon-button type=\"button\" (click)=\"close()\"><mat-icon>close</mat-icon></button>\n }\n</header>\n<content [style.padding]=\"container.config.padding || '1rem'\">\n <span *ngComponentOutlet=\"container.component; injector: injector\"></span>\n</content>\n", styles: ["header{display:flex;align-items:center;height:50px;line-height:50px;font-size:110%;padding:0 .5rem;border-bottom:1px solid var(--outline-variant)}header .title{flex:1;padding-right:.5rem}content{display:block;max-height:calc(80vh - 50px);overflow:auto}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
767
+ }
768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ContainerDialogComponent, decorators: [{
769
+ type: Component,
770
+ args: [{ host: { selector: 'container-dialog' }, imports: [NgComponentOutlet, MatIconButton, MatIcon], template: "<header>\n <div class=\"title\">{{ container.title }}</div>\n @if (!container.config.hideClose) {\n <button mat-icon-button type=\"button\" (click)=\"close()\"><mat-icon>close</mat-icon></button>\n }\n</header>\n<content [style.padding]=\"container.config.padding || '1rem'\">\n <span *ngComponentOutlet=\"container.component; injector: injector\"></span>\n</content>\n", styles: ["header{display:flex;align-items:center;height:50px;line-height:50px;font-size:110%;padding:0 .5rem;border-bottom:1px solid var(--outline-variant)}header .title{flex:1;padding-right:.5rem}content{display:block;max-height:calc(80vh - 50px);overflow:auto}\n"] }]
771
+ }], ctorParameters: () => [{ type: i2.MatDialogRef }] });
772
+
773
+ class ContainerBottomSheetComponent {
774
+ matBottomSheetRef;
775
+ container = inject(MAT_BOTTOM_SHEET_DATA);
776
+ injector;
777
+ constructor(matBottomSheetRef) {
778
+ this.matBottomSheetRef = matBottomSheetRef;
779
+ }
780
+ ngOnInit() {
781
+ this.injector = Injector.create({
782
+ providers: [
783
+ { provide: NGX_HELPER_CONTAINER_TYPE, useValue: 'BOTTOMSHEET' },
784
+ { provide: NGX_HELPER_CONTAINER_DATA, useValue: this.container.config.data },
785
+ {
786
+ provide: NGX_HELPER_CONTAINER_CLOSE,
787
+ useFactory: () => (response) => this.matBottomSheetRef.dismiss(response),
788
+ },
789
+ ],
790
+ });
791
+ }
792
+ close() {
793
+ this.matBottomSheetRef.dismiss();
794
+ }
795
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ContainerBottomSheetComponent, deps: [{ token: i1$3.MatBottomSheetRef }], target: i0.ɵɵFactoryTarget.Component });
796
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ContainerBottomSheetComponent, isStandalone: true, selector: "ng-component", host: { attributes: { "selector": "container-bottom-sheet" } }, ngImport: i0, template: "<header>\n <div class=\"title\">{{ container.title }}</div>\n @if (!container.config.hideClose) {\n <button mat-icon-button type=\"button\" (click)=\"close()\"><mat-icon>close</mat-icon></button>\n }\n</header>\n<content>\n <div [style.padding]=\"container.config.padding || '1rem'\">\n <span *ngComponentOutlet=\"container.component; injector: injector\"></span>\n </div>\n</content>\n", styles: ["header{display:flex;align-items:center;height:50px;line-height:50px;font-size:110%;padding:0 .5rem;border-bottom:1px solid var(--outline-variant)}header .title{flex:1;padding-right:.5rem}content{display:block;max-height:calc(80vh - 51px);overflow:auto}::ng-deep .ngx-helper-bottom-sheet .mat-bottom-sheet-container{padding:0}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
797
+ }
798
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ContainerBottomSheetComponent, decorators: [{
799
+ type: Component,
800
+ args: [{ host: { selector: 'container-bottom-sheet' }, imports: [NgComponentOutlet, MatIconButton, MatIcon], template: "<header>\n <div class=\"title\">{{ container.title }}</div>\n @if (!container.config.hideClose) {\n <button mat-icon-button type=\"button\" (click)=\"close()\"><mat-icon>close</mat-icon></button>\n }\n</header>\n<content>\n <div [style.padding]=\"container.config.padding || '1rem'\">\n <span *ngComponentOutlet=\"container.component; injector: injector\"></span>\n </div>\n</content>\n", styles: ["header{display:flex;align-items:center;height:50px;line-height:50px;font-size:110%;padding:0 .5rem;border-bottom:1px solid var(--outline-variant)}header .title{flex:1;padding-right:.5rem}content{display:block;max-height:calc(80vh - 51px);overflow:auto}::ng-deep .ngx-helper-bottom-sheet .mat-bottom-sheet-container{padding:0}\n"] }]
801
+ }], ctorParameters: () => [{ type: i1$3.MatBottomSheetRef }] });
802
+
803
+ class NgxHelperContainerCalss {
804
+ matBottomSheet;
805
+ matDialog;
806
+ container;
807
+ constructor(matBottomSheet, matDialog, container) {
808
+ this.matBottomSheet = matBottomSheet;
809
+ this.matDialog = matDialog;
810
+ this.container = container;
811
+ }
812
+ dialog(arg1, arg2, arg3) {
813
+ const onResponse = typeof arg1 === 'function' ? arg1 : undefined;
814
+ const onDismiss = typeof arg2 === 'function' ? arg2 : undefined;
815
+ const config = arg3 || (typeof arg2 !== 'function' ? arg2 : {});
816
+ this.matDialog
817
+ .open(ContainerDialogComponent, {
818
+ // DEFAULT CONFIG
819
+ width: 'calc(100vw - 4rem)',
820
+ direction: 'rtl',
821
+ enterAnimationDuration: '100ms',
822
+ exitAnimationDuration: '100ms',
823
+ // OVERWRITE CONFIG
824
+ ...config,
825
+ maxHeight: '80vh',
826
+ // DATA
827
+ data: this.container,
828
+ })
829
+ .afterClosed()
830
+ .subscribe({
831
+ next: (response) => {
832
+ if (onResponse && !!response)
833
+ onResponse(response);
834
+ if (onDismiss && !response)
835
+ onDismiss();
836
+ },
837
+ });
838
+ }
839
+ bottomSheet(arg1, arg2, arg3) {
840
+ const onResponse = typeof arg1 === 'function' ? arg1 : undefined;
841
+ const onDismiss = typeof arg2 === 'function' ? arg2 : undefined;
842
+ const config = arg3 || (typeof arg2 !== 'function' ? arg2 : {});
843
+ this.matBottomSheet
844
+ .open(ContainerBottomSheetComponent, {
845
+ // DEFAULT CONFIG
846
+ direction: 'rtl',
847
+ panelClass: 'ngx-helper-bottom-sheet',
848
+ // OVERWRITE CONFIG
849
+ ...config,
850
+ maxHeight: '80vh',
851
+ // DATA
852
+ data: this.container,
853
+ })
854
+ .afterDismissed()
855
+ .subscribe({
856
+ next: (response) => {
857
+ if (onResponse && !!response)
858
+ onResponse(response);
859
+ if (onDismiss && !response)
860
+ onDismiss();
861
+ },
862
+ });
863
+ }
864
+ }
865
+ class NgxHelperContainerService {
866
+ matBottomSheet;
867
+ matDialog;
868
+ constructor(matBottomSheet, matDialog) {
869
+ this.matBottomSheet = matBottomSheet;
870
+ this.matDialog = matDialog;
871
+ }
872
+ init(component, title, arg1) {
873
+ const config = arg1 || {};
874
+ return new NgxHelperContainerCalss(this.matBottomSheet, this.matDialog, { component, title, config });
875
+ }
876
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperContainerService, deps: [{ token: i1$3.MatBottomSheet }, { token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
877
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperContainerService, providedIn: 'root' });
878
+ }
879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgxHelperContainerService, decorators: [{
880
+ type: Injectable,
881
+ args: [{ providedIn: 'root' }]
882
+ }], ctorParameters: () => [{ type: i1$3.MatBottomSheet }, { type: i2.MatDialog }] });
883
+
572
884
  /*
573
885
  * Public API Surface of ngx-helper-m3
574
886
  */
@@ -577,5 +889,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
577
889
  * Generated bundle index. Do not edit.
578
890
  */
579
891
 
580
- export { NGX_HELPER_CONTAINER_CLOSE, NGX_HELPER_CONTAINER_DATA, NGX_HELPER_CONTAINER_TYPE, NgxHelperBankCardPipe, NgxHelperConfirmService, NgxHelperContainerService, NgxHelperDatePipe, NgxHelperDurationPipe, NgxHelperFileSizePipe, NgxHelperMobilePipe, NgxHelperMultiLinePipe, NgxHelperNumberPipe, NgxHelperPeriodPipe, NgxHelperPricePipe, NgxHelperSafePipe, NgxHelperVolumePipe, NgxHelperWeightPipe };
892
+ export { NGX_HELPER_CONFIG, NGX_HELPER_CONTAINER_CLOSE, NGX_HELPER_CONTAINER_DATA, NGX_HELPER_CONTAINER_TYPE, NGX_HELPER_PAGE_GROUP_DATA, NGX_HELPER_PAGE_GROUP_INDEX, NGX_HELPER_PAGE_GROUP_TITLE, NgxHelperBankCardPipe, NgxHelperConfirmService, NgxHelperContainerService, NgxHelperDatePipe, NgxHelperDurationPipe, NgxHelperFileSizePipe, NgxHelperMobilePipe, NgxHelperMultiLinePipe, NgxHelperNumberPipe, NgxHelperPageGroupComponent, NgxHelperPeriodPipe, NgxHelperPricePipe, NgxHelperSafePipe, NgxHelperSectionColumnComponent, NgxHelperSectionComponent, NgxHelperSectionStickyDirective, NgxHelperVolumePipe, NgxHelperWeightPipe, provideNgxHelperConfig };
581
893
  //# sourceMappingURL=webilix-ngx-helper-m3.mjs.map