fixa-admin 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +24 -0
  2. package/esm2022/lib/class/index.api.mjs +2 -0
  3. package/esm2022/lib/class/popover.mjs +28 -0
  4. package/esm2022/lib/components/captcha/captcha.component.mjs +56 -0
  5. package/esm2022/lib/components/grid/filter/date-filter.component.mjs +122 -0
  6. package/esm2022/lib/components/grid/filter/index.api.mjs +2 -0
  7. package/esm2022/lib/components/grid/grid.component.mjs +491 -0
  8. package/esm2022/lib/components/grid/render/action-button.component.mjs +26 -0
  9. package/esm2022/lib/components/index.api.mjs +6 -0
  10. package/esm2022/lib/components/map/map.component.mjs +134 -0
  11. package/esm2022/lib/components/spinner/spinner.component.mjs +14 -0
  12. package/esm2022/lib/directive/char-input.directive.mjs +37 -0
  13. package/esm2022/lib/directive/index.api.mjs +4 -0
  14. package/esm2022/lib/directive/mask.directive.mjs +58 -0
  15. package/esm2022/lib/directive/mask.mjs +78 -0
  16. package/esm2022/lib/directive/numeric-input.directive.mjs +44 -0
  17. package/esm2022/lib/guard/auth.guard.mjs +25 -0
  18. package/esm2022/lib/guard/index.api.mjs +2 -0
  19. package/esm2022/lib/layouts/blank/blank.layout.mjs +14 -0
  20. package/esm2022/lib/layouts/index.api.mjs +3 -0
  21. package/esm2022/lib/layouts/master/master.layout.mjs +53 -0
  22. package/esm2022/lib/models/index.api.mjs +2 -0
  23. package/esm2022/lib/models/shared.model.mjs +28 -0
  24. package/esm2022/lib/pipes/date.pipe.mjs +25 -0
  25. package/esm2022/lib/pipes/index.api.mjs +3 -0
  26. package/esm2022/lib/pipes/timer.pipe.mjs +30 -0
  27. package/esm2022/lib/services/confirm.service.mjs +39 -0
  28. package/esm2022/lib/services/dialog.service.mjs +65 -0
  29. package/esm2022/lib/services/form.service.mjs +22 -0
  30. package/esm2022/lib/services/index.api.mjs +6 -0
  31. package/esm2022/lib/services/shared.service.mjs +15 -0
  32. package/esm2022/lib/services/toast.service.mjs +21 -0
  33. package/esm2022/lib/shared.module.mjs +196 -0
  34. package/esm2022/public-api.mjs +14 -0
  35. package/esm2022/shared.mjs +5 -0
  36. package/fesm2022/shared.mjs +1558 -0
  37. package/fesm2022/shared.mjs.map +1 -0
  38. package/index.d.ts +5 -0
  39. package/lib/class/index.api.d.ts +1 -0
  40. package/lib/class/popover.d.ts +14 -0
  41. package/lib/components/captcha/captcha.component.d.ts +13 -0
  42. package/lib/components/grid/filter/date-filter.component.d.ts +24 -0
  43. package/lib/components/grid/filter/index.api.d.ts +1 -0
  44. package/lib/components/grid/grid.component.d.ts +64 -0
  45. package/lib/components/grid/render/action-button.component.d.ts +13 -0
  46. package/lib/components/index.api.d.ts +5 -0
  47. package/lib/components/map/map.component.d.ts +26 -0
  48. package/lib/components/spinner/spinner.component.d.ts +8 -0
  49. package/lib/directive/char-input.directive.d.ts +12 -0
  50. package/lib/directive/index.api.d.ts +3 -0
  51. package/lib/directive/mask.d.ts +19 -0
  52. package/lib/directive/mask.directive.d.ts +15 -0
  53. package/lib/directive/numeric-input.directive.d.ts +12 -0
  54. package/lib/guard/auth.guard.d.ts +10 -0
  55. package/lib/guard/index.api.d.ts +1 -0
  56. package/lib/layouts/blank/blank.layout.d.ts +8 -0
  57. package/lib/layouts/index.api.d.ts +2 -0
  58. package/lib/layouts/master/master.layout.d.ts +20 -0
  59. package/lib/models/index.api.d.ts +1 -0
  60. package/lib/models/shared.model.d.ts +120 -0
  61. package/lib/pipes/date.pipe.d.ts +7 -0
  62. package/lib/pipes/index.api.d.ts +2 -0
  63. package/lib/pipes/timer.pipe.d.ts +7 -0
  64. package/lib/services/confirm.service.d.ts +9 -0
  65. package/lib/services/dialog.service.d.ts +11 -0
  66. package/lib/services/form.service.d.ts +8 -0
  67. package/lib/services/index.api.d.ts +5 -0
  68. package/lib/services/shared.service.d.ts +8 -0
  69. package/lib/services/toast.service.d.ts +9 -0
  70. package/lib/shared.module.d.ts +41 -0
  71. package/package.json +43 -0
  72. package/public-api.d.ts +10 -0
  73. package/src/style.scss +9 -0
@@ -0,0 +1,1558 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Pipe, Directive as Directive$1, Input, Component, ViewChild, EventEmitter, Output, ViewContainerRef, HostListener, APP_INITIALIZER, NgModule, CUSTOM_ELEMENTS_SCHEMA, inject, Injector } from '@angular/core';
3
+ import * as i1 from 'ng-zorro-antd/modal';
4
+ import { NzModalModule, NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';
5
+ import * as i1$1 from 'ng-zorro-antd/message';
6
+ import { NzMessageModule } from 'ng-zorro-antd/message';
7
+ import * as i3$1 from '@ag-grid-community/angular';
8
+ import { AgGridModule } from '@ag-grid-community/angular';
9
+ import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
10
+ import { ModuleRegistry } from '@ag-grid-community/core';
11
+ import { AdvancedFilterModule } from '@ag-grid-enterprise/advanced-filter';
12
+ import { LicenseManager } from '@ag-grid-enterprise/core';
13
+ import { MasterDetailModule } from '@ag-grid-enterprise/master-detail';
14
+ import { MultiFilterModule } from '@ag-grid-enterprise/multi-filter';
15
+ import { RowGroupingModule } from '@ag-grid-enterprise/row-grouping';
16
+ import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-model';
17
+ import { SetFilterModule } from '@ag-grid-enterprise/set-filter';
18
+ import { CdkMenuModule } from '@angular/cdk/menu';
19
+ import * as i2$1 from '@angular/common';
20
+ import { CommonModule } from '@angular/common';
21
+ import { HttpClientModule, HttpClient } from '@angular/common/http';
22
+ import * as i1$6 from '@angular/router';
23
+ import { RouterModule } from '@angular/router';
24
+ import * as i1$4 from '@ngx-translate/core';
25
+ import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
26
+ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
27
+ import * as i1$2 from 'ng-zorro-antd/button';
28
+ import { NzButtonModule } from 'ng-zorro-antd/button';
29
+ import * as i4 from 'ng-zorro-antd/icon';
30
+ import { NzIconModule } from 'ng-zorro-antd/icon';
31
+ import * as i4$1 from 'ng-zorro-antd/layout';
32
+ import { NzLayoutModule } from 'ng-zorro-antd/layout';
33
+ import * as i5$1 from 'ng-zorro-antd/menu';
34
+ import { NzMenuModule } from 'ng-zorro-antd/menu';
35
+ import * as i1$5 from 'ng-zorro-antd/spin';
36
+ import { NzSpinModule } from 'ng-zorro-antd/spin';
37
+ import { NzTabsModule } from 'ng-zorro-antd/tabs';
38
+ import * as i2$2 from 'ng-zorro-antd/tooltip';
39
+ import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
40
+ import { NzTreeViewModule } from 'ng-zorro-antd/tree-view';
41
+ import * as moment from 'jalali-moment';
42
+ import moment__default from 'jalali-moment';
43
+ import * as i2 from 'ng-zorro-antd/core/transition-patch';
44
+ import * as i3 from 'ng-zorro-antd/core/wave';
45
+ import * as i1$3 from '@angular/forms';
46
+ import { NgControl, FormsModule } from '@angular/forms';
47
+ import * as i5 from 'ng-zorro-antd/input';
48
+ import { NzInputModule } from 'ng-zorro-antd/input';
49
+ import * as i6 from 'ng-zorro-antd/grid';
50
+ import * as i7 from 'ng-zorro-antd/form';
51
+ import { NzFormModule } from 'ng-zorro-antd/form';
52
+
53
+ class SharedService {
54
+ constructor() { }
55
+ menuItems = [];
56
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
57
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedService, providedIn: 'root' });
58
+ }
59
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedService, decorators: [{
60
+ type: Injectable,
61
+ args: [{
62
+ providedIn: 'root'
63
+ }]
64
+ }], ctorParameters: () => [] });
65
+
66
+ class DialogService {
67
+ _modal;
68
+ constructor(_modal) {
69
+ this._modal = _modal;
70
+ }
71
+ open(component, body) {
72
+ let size = '520px';
73
+ let height = 'auto';
74
+ let className = null;
75
+ switch (body.size) {
76
+ case 'md':
77
+ size = '640px';
78
+ break;
79
+ case 'lg':
80
+ size = '780px';
81
+ break;
82
+ case 'xl':
83
+ size = '1024px';
84
+ break;
85
+ case 'full':
86
+ size = '100%';
87
+ height = '100%';
88
+ className = 'full-screen';
89
+ break;
90
+ default:
91
+ size = '520px';
92
+ break;
93
+ }
94
+ const modal = this._modal.create({
95
+ nzTitle: body.title,
96
+ nzWidth: size,
97
+ nzClassName: className,
98
+ nzStyle: body.size == 'full' ? {
99
+ height: height,
100
+ top: '20px'
101
+ } : null,
102
+ nzData: {
103
+ ...body.data
104
+ },
105
+ nzOnOk: () => {
106
+ const instance = modal.getContentComponent();
107
+ return instance.onOk();
108
+ },
109
+ nzOnCancel: () => {
110
+ const instance = modal.getContentComponent();
111
+ return instance.onCancel();
112
+ },
113
+ nzFooter: body.disableFooter ? null : undefined,
114
+ nzContent: component,
115
+ });
116
+ return modal;
117
+ }
118
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DialogService, deps: [{ token: i1.NzModalService }], target: i0.ɵɵFactoryTarget.Injectable });
119
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DialogService, providedIn: 'root' });
120
+ }
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DialogService, decorators: [{
122
+ type: Injectable,
123
+ args: [{
124
+ providedIn: 'root'
125
+ }]
126
+ }], ctorParameters: () => [{ type: i1.NzModalService }] });
127
+
128
+ class ToastService {
129
+ _message;
130
+ constructor(_message) {
131
+ this._message = _message;
132
+ }
133
+ show(message, type) {
134
+ this._message.create(type, message);
135
+ }
136
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ToastService, deps: [{ token: i1$1.NzMessageService }], target: i0.ɵɵFactoryTarget.Injectable });
137
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ToastService, providedIn: 'root' });
138
+ }
139
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ToastService, decorators: [{
140
+ type: Injectable,
141
+ args: [{
142
+ providedIn: 'root'
143
+ }]
144
+ }], ctorParameters: () => [{ type: i1$1.NzMessageService }] });
145
+
146
+ class FormService {
147
+ constructor() { }
148
+ validateForm(form) {
149
+ Object.values(form.controls).forEach(control => {
150
+ if (control.invalid) {
151
+ control.markAsDirty();
152
+ control.updateValueAndValidity({ onlySelf: true });
153
+ }
154
+ });
155
+ }
156
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
157
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormService, providedIn: 'root' });
158
+ }
159
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormService, decorators: [{
160
+ type: Injectable,
161
+ args: [{
162
+ providedIn: 'root'
163
+ }]
164
+ }], ctorParameters: () => [] });
165
+
166
+ class ConfirmService {
167
+ _modal;
168
+ constructor(_modal) {
169
+ this._modal = _modal;
170
+ }
171
+ confirm(action, title = 'آیا از انجام این عملیات اطمینان دارید؟') {
172
+ return new Promise((resolve, reject) => {
173
+ const modalRef = this._modal.confirm({
174
+ nzTitle: title,
175
+ nzOkText: 'تائید',
176
+ nzOkType: 'primary',
177
+ nzOkDanger: true,
178
+ nzOnOk: () => {
179
+ return action()
180
+ .then(() => {
181
+ resolve();
182
+ })
183
+ .catch((error) => {
184
+ reject(error);
185
+ });
186
+ },
187
+ nzCancelText: 'لغو',
188
+ nzOnCancel: () => { }
189
+ });
190
+ });
191
+ }
192
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ConfirmService, deps: [{ token: i1.NzModalService }], target: i0.ɵɵFactoryTarget.Injectable });
193
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ConfirmService, providedIn: 'root' });
194
+ }
195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ConfirmService, decorators: [{
196
+ type: Injectable,
197
+ args: [{
198
+ providedIn: 'root'
199
+ }]
200
+ }], ctorParameters: () => [{ type: i1.NzModalService }] });
201
+
202
+ var FilterOperator;
203
+ (function (FilterOperator) {
204
+ FilterOperator["equals"] = "EQ";
205
+ FilterOperator["notEqual"] = "NEQ";
206
+ FilterOperator["lessThan"] = "LT";
207
+ FilterOperator["lessThanOrEqual"] = "LTE";
208
+ FilterOperator["greaterThan"] = "GT";
209
+ FilterOperator["greaterThanOrEqual"] = "GTE";
210
+ FilterOperator["startsWith"] = "STARTSWITH";
211
+ FilterOperator["endsWith"] = "ENDSWITH";
212
+ FilterOperator["inRange"] = "IN";
213
+ FilterOperator["contains"] = "LIKE";
214
+ FilterOperator["notContains"] = "NOTLIKE";
215
+ FilterOperator["truncEqual"] = "TRUNC_EQ";
216
+ FilterOperator["truncNotEqual"] = "TRUNC_NEQ";
217
+ FilterOperator["truncGreaterThanEqual"] = "TRUNC_GTE";
218
+ FilterOperator["truncGreaterThan"] = "TRUNC_GT";
219
+ FilterOperator["truncLessThanOr"] = "TRUNC_LT";
220
+ FilterOperator["truncLessThanOrEqual"] = "TRUNC_LTE";
221
+ })(FilterOperator || (FilterOperator = {}));
222
+ class SelectModel {
223
+ items = [];
224
+ loading = false;
225
+ page = null;
226
+ pageSize = null;
227
+ totalCount = null;
228
+ }
229
+
230
+ class JDatePipe {
231
+ transform(value, time = false) {
232
+ if (value != null) {
233
+ if (!time) {
234
+ return moment.from(value, 'YYYY/MM/DD').locale('fa').format('YYYY/MM/DD');
235
+ }
236
+ else {
237
+ return moment.from(value, 'YYYY/MM/DD').locale('fa').format('HH:mm');
238
+ }
239
+ }
240
+ else {
241
+ return value;
242
+ }
243
+ }
244
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: JDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
245
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: JDatePipe, name: "jdate" });
246
+ }
247
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: JDatePipe, decorators: [{
248
+ type: Pipe,
249
+ args: [{ name: 'jdate' }]
250
+ }] });
251
+
252
+ const _formatToRegExp = {
253
+ '0': /[0-9]/, 'a': /[a-z]/, 'A': /[A-Z]/, 'B': /[a-zA-Z]/,
254
+ };
255
+ const _allFormatsStr = '(' +
256
+ Object.keys(_formatToRegExp)
257
+ .map(key => _formatToRegExp[key].toString())
258
+ .map(regexStr => regexStr.substr(1, regexStr.length - 2))
259
+ .join('|')
260
+ + ')';
261
+ const _allFormatsGlobal = getAllFormatRegexp('g');
262
+ /**
263
+ * Apply format to a value string
264
+ *
265
+ * Format can be constructed from next symbols:
266
+ * - '0': /[0-9]/,
267
+ * - 'a': /[a-z]/,
268
+ * - 'A': /[A-Z]/,
269
+ * - 'B': /[a-zA-Z]/
270
+ *
271
+ * Example: 'AAA-00BB-aaaa'
272
+ * will accept 'COD-12Rt-efww'
273
+ *
274
+ * @param value Current value
275
+ * @param format Format
276
+ * @param goingBack Indicates if change was done by BackSpace
277
+ * @param prevValue Pass to precisely detect formatter chars
278
+ */
279
+ function valueToFormat(value, format, goingBack = false, prevValue) {
280
+ let maskedValue = '';
281
+ const unmaskedValue = unmaskValue(value);
282
+ const isLastCharFormatter = !getAllFormatRegexp().test(value[value.length - 1]);
283
+ const isPrevLastCharFormatter = prevValue && !getAllFormatRegexp().test(prevValue[prevValue.length - 1]);
284
+ let formatOffset = 0;
285
+ for (let i = 0, maxI = Math.min(unmaskedValue.length, format.length); i < maxI; ++i) {
286
+ const valueChar = unmaskedValue[i];
287
+ let formatChar = format[formatOffset + i];
288
+ let formatRegex = getFormatRegexp(formatChar);
289
+ if (formatChar && !formatRegex) {
290
+ maskedValue += formatChar;
291
+ formatChar = format[++formatOffset + i];
292
+ formatRegex = getFormatRegexp(formatChar);
293
+ }
294
+ if (valueChar && formatRegex) {
295
+ if (formatRegex.test(valueChar)) {
296
+ maskedValue += valueChar;
297
+ }
298
+ else {
299
+ break;
300
+ }
301
+ }
302
+ const nextFormatChar = format[formatOffset + i + 1];
303
+ const nextFormatRegex = getFormatRegexp(nextFormatChar);
304
+ const isLastIteration = i === maxI - 1;
305
+ if (isLastIteration && nextFormatChar && !nextFormatRegex) {
306
+ if (!isLastCharFormatter && goingBack) {
307
+ if (prevValue && !isPrevLastCharFormatter) {
308
+ continue;
309
+ }
310
+ maskedValue = maskedValue.substr(0, formatOffset + i);
311
+ }
312
+ else {
313
+ maskedValue += nextFormatChar;
314
+ }
315
+ }
316
+ }
317
+ return maskedValue;
318
+ }
319
+ function unmaskValue(value) {
320
+ const unmaskedMathes = value.match(_allFormatsGlobal);
321
+ return unmaskedMathes ? unmaskedMathes.join('') : '';
322
+ }
323
+ function getAllFormatRegexp(flags) {
324
+ return new RegExp(_allFormatsStr, flags);
325
+ }
326
+ function getFormatRegexp(formatChar) {
327
+ return formatChar && _formatToRegExp[formatChar] ? _formatToRegExp[formatChar] : null;
328
+ }
329
+
330
+ class MaskDirective {
331
+ injector;
332
+ appMask;
333
+ control;
334
+ _lastMaskedValue = '';
335
+ constructor(injector) {
336
+ this.injector = injector;
337
+ }
338
+ ngOnInit() {
339
+ this.control = this.injector.get(NgControl);
340
+ if (!this.control || !this.control.valueAccessor) {
341
+ return;
342
+ }
343
+ const originalWriteVal = this.control.valueAccessor.writeValue.bind(this.control.valueAccessor);
344
+ this.control.valueAccessor.writeValue = (val) => originalWriteVal(this._maskValue(val));
345
+ const originalChange = this.control.valueAccessor['onChange'].bind(this.control.valueAccessor);
346
+ this.control.valueAccessor.registerOnChange((val) => originalChange(this._unmaskValue(val)));
347
+ this._setVal(this._maskValue(this.control.value));
348
+ }
349
+ _maskValue(val) {
350
+ if (!this.appMask || val === this._lastMaskedValue) {
351
+ return val;
352
+ }
353
+ if (val == null)
354
+ val = "";
355
+ const maskedVal = this._lastMaskedValue =
356
+ valueToFormat(val, this.appMask, this._lastMaskedValue.length > val.length, this._lastMaskedValue);
357
+ return maskedVal;
358
+ }
359
+ _unmaskValue(val) {
360
+ const maskedVal = this._maskValue(val);
361
+ const unmaskedVal = unmaskValue(maskedVal);
362
+ if (maskedVal !== val) {
363
+ this._setVal(maskedVal);
364
+ }
365
+ return maskedVal ? unmaskedVal : '';
366
+ }
367
+ _setVal(val) {
368
+ if (this.control.control) {
369
+ this.control.control.setValue(val, { emitEvent: false });
370
+ }
371
+ }
372
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MaskDirective, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
373
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MaskDirective, selector: "[appMask]", inputs: { appMask: "appMask" }, ngImport: i0 });
374
+ }
375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MaskDirective, decorators: [{
376
+ type: Directive$1,
377
+ args: [{
378
+ selector: '[appMask]',
379
+ }]
380
+ }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { appMask: [{
381
+ type: Input
382
+ }] } });
383
+
384
+ class DateFilter {
385
+ eFilterText;
386
+ params;
387
+ dateFrom = "";
388
+ dateTo = "";
389
+ agInit(params) {
390
+ this.params = params;
391
+ }
392
+ isFilterActive() {
393
+ return this.dateFrom != null && this.dateFrom !== '';
394
+ }
395
+ doesFilterPass(params) {
396
+ let passed = true;
397
+ const { node } = params;
398
+ this.dateFrom
399
+ .toLowerCase()
400
+ .split(' ')
401
+ .forEach((filterWord) => {
402
+ const value = this.params.getValue(node);
403
+ if (value.toString().toLowerCase().indexOf(filterWord) < 0) {
404
+ passed = false;
405
+ }
406
+ });
407
+ return passed;
408
+ }
409
+ getModel() {
410
+ if (!this.isFilterActive()) {
411
+ return null;
412
+ }
413
+ let dateFrom = "";
414
+ let dateTo = "";
415
+ if (this.dateFrom != null && this.dateFrom) {
416
+ dateFrom = `${this.dateFrom.slice(0, 4)}/${this.dateFrom.slice(4, 6)}/${this.dateFrom.slice(6, 8)}`;
417
+ dateFrom = moment__default.from(dateFrom, 'fa', 'YYYY/MM/DD').format('YYYY/MM/DD');
418
+ }
419
+ if (this.dateTo != null && this.dateTo) {
420
+ dateTo = `${this.dateTo.slice(0, 4)}/${this.dateTo.slice(4, 6)}/${this.dateTo.slice(6, 8)}`;
421
+ dateTo = moment__default.from(dateTo, 'fa', 'YYYY/MM/DD').format('YYYY/MM/DD');
422
+ }
423
+ return { dateFrom, dateTo, filterType: 'custom-date' };
424
+ }
425
+ setModel(model) {
426
+ this.dateFrom = model.dateFrom == null ? null : model.dateFrom;
427
+ this.dateTo = model.dateTo == null ? null : model.dateTo;
428
+ }
429
+ filter() {
430
+ this.params.filterChangedCallback();
431
+ }
432
+ clear() {
433
+ this.dateFrom = this.dateTo = "";
434
+ this.filter();
435
+ }
436
+ afterGuiAttached(params) {
437
+ if (!params?.suppressFocus) {
438
+ // focus the input element for keyboard navigation
439
+ this.eFilterText.nativeElement.focus();
440
+ }
441
+ }
442
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DateFilter, deps: [], target: i0.ɵɵFactoryTarget.Component });
443
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DateFilter, selector: "ng-component", viewQueries: [{ propertyName: "eFilterText", first: true, predicate: ["eFilterText"], descendants: true }], ngImport: i0, template: `
444
+ <div class="p-4">
445
+ <nz-form-item>
446
+ <nz-form-label>از تاریخ</nz-form-label>
447
+ <nz-form-control>
448
+ <input nz-input appMask="0000-00-00" placeholder="1403-01-01" autocomplete="off" class="w-[250px]" dir="ltr" [(ngModel)]="dateFrom" #eFilterText/>
449
+ </nz-form-control>
450
+ </nz-form-item>
451
+ <nz-form-item>
452
+ <nz-form-label>تا تاریخ</nz-form-label>
453
+ <nz-form-control>
454
+ <input nz-input appMask="0000-00-00" placeholder="1403-12-30" autocomplete="off" class="w-[250px]" dir="ltr" [(ngModel)]="dateTo"/>
455
+ </nz-form-control>
456
+ </nz-form-item>
457
+ <hr/>
458
+ <div class="flex gap-2">
459
+ <button nz-button nzType="primary" class="mt-4" (click)="filter()">فیلتر</button>
460
+ <button nz-button nzType="default" class="mt-4" (click)="clear()">پاکسازی</button>
461
+ </div>
462
+ </div>
463
+ `, isInline: true, dependencies: [{ kind: "component", type: i1$2.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i2.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i3.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzSize", "nzStepperless", "nzStatus", "disabled"], exportAs: ["nzInput"] }, { kind: "directive", type: i6.NzColDirective, selector: "[nz-col],nz-col,nz-form-control,nz-form-label", inputs: ["nzFlex", "nzSpan", "nzOrder", "nzOffset", "nzPush", "nzPull", "nzXs", "nzSm", "nzMd", "nzLg", "nzXl", "nzXXl"], exportAs: ["nzCol"] }, { kind: "directive", type: i6.NzRowDirective, selector: "[nz-row],nz-row,nz-form-item", inputs: ["nzAlign", "nzJustify", "nzGutter"], exportAs: ["nzRow"] }, { kind: "component", type: i7.NzFormItemComponent, selector: "nz-form-item", exportAs: ["nzFormItem"] }, { kind: "component", type: i7.NzFormLabelComponent, selector: "nz-form-label", inputs: ["nzFor", "nzRequired", "nzNoColon", "nzTooltipTitle", "nzTooltipIcon", "nzLabelAlign", "nzLabelWrap"], exportAs: ["nzFormLabel"] }, { kind: "component", type: i7.NzFormControlComponent, selector: "nz-form-control", inputs: ["nzSuccessTip", "nzWarningTip", "nzErrorTip", "nzValidatingTip", "nzExtra", "nzAutoTips", "nzDisableAutoTips", "nzHasFeedback", "nzValidateStatus"], exportAs: ["nzFormControl"] }, { kind: "directive", type: MaskDirective, selector: "[appMask]", inputs: ["appMask"] }] });
464
+ }
465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DateFilter, decorators: [{
466
+ type: Component,
467
+ args: [{
468
+ template: `
469
+ <div class="p-4">
470
+ <nz-form-item>
471
+ <nz-form-label>از تاریخ</nz-form-label>
472
+ <nz-form-control>
473
+ <input nz-input appMask="0000-00-00" placeholder="1403-01-01" autocomplete="off" class="w-[250px]" dir="ltr" [(ngModel)]="dateFrom" #eFilterText/>
474
+ </nz-form-control>
475
+ </nz-form-item>
476
+ <nz-form-item>
477
+ <nz-form-label>تا تاریخ</nz-form-label>
478
+ <nz-form-control>
479
+ <input nz-input appMask="0000-00-00" placeholder="1403-12-30" autocomplete="off" class="w-[250px]" dir="ltr" [(ngModel)]="dateTo"/>
480
+ </nz-form-control>
481
+ </nz-form-item>
482
+ <hr/>
483
+ <div class="flex gap-2">
484
+ <button nz-button nzType="primary" class="mt-4" (click)="filter()">فیلتر</button>
485
+ <button nz-button nzType="default" class="mt-4" (click)="clear()">پاکسازی</button>
486
+ </div>
487
+ </div>
488
+ `,
489
+ }]
490
+ }], propDecorators: { eFilterText: [{
491
+ type: ViewChild,
492
+ args: ['eFilterText']
493
+ }] } });
494
+
495
+ class GridComponent {
496
+ _translate;
497
+ constructor(_translate) {
498
+ this._translate = _translate;
499
+ this.datasource = this.createServerSideDatasource();
500
+ }
501
+ gridApi;
502
+ isServerSideGroup;
503
+ getServerSideGroupKey = null;
504
+ groupDefaultExpanded = -1;
505
+ _treeGroupColumn = null;
506
+ datasource;
507
+ themeClass = "ag-theme-quartz";
508
+ columnDefs = [];
509
+ _column = [];
510
+ autoGroupColumnDef = {
511
+ headerName: "",
512
+ minWidth: 250,
513
+ sortable: false,
514
+ cellRendererParams: {
515
+ suppressCount: true,
516
+ },
517
+ };
518
+ defaultColDef = {
519
+ flex: 1,
520
+ minWidth: 150,
521
+ filter: 'agTextColumnFilter',
522
+ suppressHeaderMenuButton: true,
523
+ suppressHeaderContextMenu: true
524
+ };
525
+ onAction = new EventEmitter();
526
+ onToolbar = new EventEmitter();
527
+ onClicked = new EventEmitter();
528
+ label = null;
529
+ rowModelType = 'serverSide';
530
+ isToolbar = true;
531
+ rtl = true;
532
+ paginationPageSize = 15;
533
+ paginationPageSizeSelector = [10, 15, 25];
534
+ enableAdvancedFilter = false;
535
+ treeModel = false;
536
+ isLeaf = false;
537
+ showAdvancedButton = true;
538
+ actionItems = [
539
+ {
540
+ code: 'edit',
541
+ icon: 'fa-light fa-pen',
542
+ alt: 'ویرایش'
543
+ },
544
+ {
545
+ code: 'delete',
546
+ icon: 'fa-light fa-trash',
547
+ alt: 'حذف'
548
+ }
549
+ ];
550
+ toolbarItems = [
551
+ {
552
+ code: 'insert',
553
+ icon: 'plus',
554
+ text: 'ایجاد جدید',
555
+ type: 'primary'
556
+ },
557
+ // {
558
+ // code: 'refresh',
559
+ // icon: 'sync',
560
+ // text: 'بروزرسانی',
561
+ // type: 'default'
562
+ // }
563
+ ];
564
+ get treeGroupColumn() {
565
+ return this.treeGroupColumn;
566
+ }
567
+ set treeGroupColumn(v) {
568
+ if (v) {
569
+ this._treeGroupColumn = v;
570
+ this.isServerSideGroup = dataItem => {
571
+ if (this.isLeaf) {
572
+ if (!dataItem.lastNode)
573
+ return dataItem[v];
574
+ else
575
+ return false;
576
+ }
577
+ else {
578
+ return dataItem[v];
579
+ }
580
+ };
581
+ this.getServerSideGroupKey = dataItem => {
582
+ return dataItem[v];
583
+ };
584
+ // this.autoGroupColumnDef.headerName = v;
585
+ }
586
+ }
587
+ fetchData;
588
+ get column() {
589
+ return this.column;
590
+ }
591
+ set column(v) {
592
+ if (v != null) {
593
+ this._column = v;
594
+ v.forEach((el) => {
595
+ var filter = 'agTextColumnFilter';
596
+ var sortable = true;
597
+ var filterParams = {
598
+ maxNumConditions: 1
599
+ };
600
+ switch (el.type) {
601
+ case 'boolean':
602
+ filter = 'agNumberColumnFilter';
603
+ filterParams.filterOptions = [
604
+ "empty",
605
+ {
606
+ displayKey: 'true',
607
+ displayName: this._translate.instant('YES'),
608
+ predicate: () => true,
609
+ numberOfInputs: 0
610
+ },
611
+ {
612
+ displayKey: 'false',
613
+ displayName: this._translate.instant('NO'),
614
+ predicate: () => true,
615
+ numberOfInputs: 0
616
+ }
617
+ ];
618
+ break;
619
+ case 'enum':
620
+ filter = 'agNumberColumnFilter';
621
+ const items = [];
622
+ for (const property in el.filterItems) {
623
+ items.push({
624
+ displayKey: el.filterItems[property],
625
+ displayName: this._translate.instant(el.filterItems[property]),
626
+ predicate: true,
627
+ numberOfInputs: 0
628
+ });
629
+ }
630
+ filterParams.filterOptions = [
631
+ "empty",
632
+ ...items
633
+ ];
634
+ break;
635
+ case 'number':
636
+ filter = 'agNumberColumnFilter';
637
+ break;
638
+ case 'select':
639
+ filter = 'agSetColumnFilter';
640
+ break;
641
+ case 'string':
642
+ filter = 'agTextColumnFilter';
643
+ break;
644
+ case 'date':
645
+ filter = 'agDateColumnFilter';
646
+ break;
647
+ default:
648
+ filter = 'agTextColumnFilter';
649
+ break;
650
+ }
651
+ if (el.filter != undefined && !el.filter) {
652
+ filter = false;
653
+ }
654
+ if (el.sortable != undefined && !el.sortable) {
655
+ sortable = false;
656
+ }
657
+ if (el.field != this._treeGroupColumn) {
658
+ if (el.type && el.type == 'boolean') {
659
+ this.columnDefs.push({
660
+ field: el.field,
661
+ headerName: el.label,
662
+ filter: filter,
663
+ sortable,
664
+ editable: el.editable,
665
+ minWidth: el.minWidth ? el.minWidth : null,
666
+ filterParams,
667
+ cellClass: 'ag-boolean-cell',
668
+ cellRenderer: params => {
669
+ if (params.value != null) {
670
+ return params.value ? '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" stroke="green" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><path d="M20 6L9 17L4 12"/></svg>' : '<svg xmlns="http://www.w3.org/2000/svg" stroke="red" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>';
671
+ }
672
+ else {
673
+ return '';
674
+ }
675
+ }
676
+ });
677
+ }
678
+ else if (el.type && el.type == 'enum') {
679
+ this.columnDefs.push({
680
+ field: el.field,
681
+ headerName: el.label,
682
+ filter: filter,
683
+ sortable,
684
+ editable: el.editable,
685
+ minWidth: el.minWidth ? el.minWidth : null,
686
+ filterParams,
687
+ cellRenderer: params => {
688
+ if (params.value) {
689
+ return this._translate.instant(params.value);
690
+ }
691
+ else {
692
+ return '';
693
+ }
694
+ }
695
+ });
696
+ }
697
+ else if (el.type && el.type == 'date') {
698
+ this.columnDefs.push({
699
+ field: el.field,
700
+ headerName: el.label,
701
+ filter: DateFilter,
702
+ sortable,
703
+ editable: el.editable,
704
+ minWidth: el.minWidth ? el.minWidth : null,
705
+ filterParams,
706
+ cellRenderer: params => {
707
+ if (params.value) {
708
+ return new JDatePipe().transform(params.value);
709
+ }
710
+ else {
711
+ return '';
712
+ }
713
+ }
714
+ });
715
+ }
716
+ else if (el.type && el.type == 'price') {
717
+ this.columnDefs.push({
718
+ field: el.field,
719
+ headerName: el.label,
720
+ filter: filter,
721
+ sortable,
722
+ editable: el.editable,
723
+ minWidth: el.minWidth ? el.minWidth : null,
724
+ filterParams,
725
+ cellRenderer: params => {
726
+ if (params.value) {
727
+ return params.value.toLocaleString();
728
+ }
729
+ else {
730
+ return '';
731
+ }
732
+ }
733
+ });
734
+ }
735
+ else if (el.type && el.type == 'image') {
736
+ this.columnDefs.push({
737
+ field: el.field,
738
+ headerName: el.label,
739
+ minWidth: 80,
740
+ width: 80,
741
+ filter: false,
742
+ sortable: false,
743
+ editable: false,
744
+ filterParams,
745
+ cellRenderer: params => {
746
+ if (params.value) {
747
+ return `<img class="rounded-full mt-1" width="32" height="32" src="${params.value}"/>`;
748
+ }
749
+ else {
750
+ return '';
751
+ }
752
+ }
753
+ });
754
+ }
755
+ else {
756
+ this.columnDefs.push({
757
+ field: el.field,
758
+ headerName: el.label,
759
+ filter,
760
+ sortable,
761
+ editable: el.editable,
762
+ filterParams,
763
+ minWidth: el.minWidth ? el.minWidth : null
764
+ });
765
+ }
766
+ }
767
+ else {
768
+ this.autoGroupColumnDef.field = el.field;
769
+ }
770
+ });
771
+ if (this.actionItems.length > 0) {
772
+ this.columnDefs.push({
773
+ filter: false,
774
+ headerName: '',
775
+ minWidth: 100,
776
+ resizable: true,
777
+ pinned: true,
778
+ sortable: false,
779
+ field: 'actions',
780
+ cellRenderer: ActionsCellRenderer,
781
+ cellRendererParams: {
782
+ onClick: (params) => {
783
+ this.onAction.emit(params);
784
+ }
785
+ }
786
+ });
787
+ }
788
+ }
789
+ }
790
+ cellDoubleClicked(e) {
791
+ this.onClicked.emit(e.data);
792
+ }
793
+ handleClick(item) {
794
+ this.onToolbar.emit(item);
795
+ }
796
+ refresh() {
797
+ this.gridApi.refreshServerSide({ purge: true });
798
+ }
799
+ onGridReady(params) {
800
+ this.gridApi = params.api;
801
+ }
802
+ advancedFilter() {
803
+ this.enableAdvancedFilter = !this.enableAdvancedFilter;
804
+ setTimeout(() => {
805
+ this.gridApi.showAdvancedFilterBuilder();
806
+ setTimeout(() => {
807
+ document.getElementsByClassName('ag-icon-maximize')[0].click();
808
+ });
809
+ }, 10);
810
+ }
811
+ getRouteToNode(rowNode) {
812
+ if (!rowNode.parent) {
813
+ return [];
814
+ }
815
+ return [
816
+ ...this.getRouteToNode(rowNode.parent),
817
+ rowNode.key ? rowNode.key : rowNode.data.employeeName,
818
+ ];
819
+ }
820
+ refreshNode(id) {
821
+ const selectedRows = this.gridApi.getRowNode(id);
822
+ const route = this.getRouteToNode(selectedRows);
823
+ this.gridApi.refreshServerSide({
824
+ purge: true,
825
+ route: route
826
+ });
827
+ }
828
+ refreshParentNode(id) {
829
+ const selectedRows = this.gridApi.getRowNode(id);
830
+ const route = this.getRouteToNode(selectedRows.parent);
831
+ this.gridApi.refreshServerSide({
832
+ purge: true,
833
+ route: route
834
+ });
835
+ }
836
+ createServerSideDatasource() {
837
+ return {
838
+ getRows: (params) => {
839
+ debugger;
840
+ let filter = null;
841
+ if (Object.keys(params.request.filterModel).length > 0) {
842
+ filter = {
843
+ disable: false,
844
+ field: null,
845
+ logic: 'AND',
846
+ filters: [],
847
+ ignoreCase: null,
848
+ operator: null,
849
+ truncateDate: null,
850
+ value: null,
851
+ };
852
+ for (const key in params.request.filterModel) {
853
+ if (params.request.filterModel[key].filterType == 'custom-date') {
854
+ filter.filters.push({
855
+ disable: false,
856
+ field: key == 'ag-Grid-AutoColumn' ? this._treeGroupColumn : key,
857
+ logic: 'AND',
858
+ filters: null,
859
+ ignoreCase: false,
860
+ operator: FilterOperator.truncGreaterThanEqual,
861
+ truncateDate: true,
862
+ value: new Date(params.request.filterModel[key].dateFrom).toISOString()
863
+ });
864
+ if (params.request.filterModel[key].dateTo != "") {
865
+ filter.filters.push({
866
+ disable: false,
867
+ field: key == 'ag-Grid-AutoColumn' ? this._treeGroupColumn : key,
868
+ logic: 'AND',
869
+ filters: null,
870
+ ignoreCase: false,
871
+ operator: FilterOperator.truncLessThanOrEqual,
872
+ truncateDate: true,
873
+ value: new Date(params.request.filterModel[key].dateTo).toISOString()
874
+ });
875
+ }
876
+ }
877
+ else {
878
+ const operation = FilterOperator[params.request.filterModel[key].type];
879
+ let ignoreCase = true;
880
+ const findEl = this._column.find((el) => el.field == key);
881
+ let field = null;
882
+ if (key == 'ag-Grid-AutoColumn') {
883
+ field = this._treeGroupColumn;
884
+ }
885
+ else {
886
+ field = key;
887
+ if (findEl.searchField != null) {
888
+ field = findEl.searchField;
889
+ }
890
+ }
891
+ if (findEl && findEl.type == 'enum') {
892
+ ignoreCase = false;
893
+ }
894
+ filter.filters.push({
895
+ disable: false,
896
+ field,
897
+ logic: 'AND',
898
+ filters: null,
899
+ ignoreCase,
900
+ operator: operation ? operation : FilterOperator.equals,
901
+ truncateDate: true,
902
+ value: params.request.filterModel[key].filter ? params.request.filterModel[key].filter : params.request.filterModel[key].type
903
+ });
904
+ }
905
+ }
906
+ }
907
+ const gridFilter = {
908
+ take: params.api.paginationGetPageSize(),
909
+ data: null,
910
+ filter,
911
+ skip: params.api.paginationGetCurrentPage() * params.api.paginationGetPageSize(),
912
+ sorts: params.request.sortModel.length > 0 ? [{ dir: params.request.sortModel[0].sort, field: params.request.sortModel[0].colId }] : []
913
+ };
914
+ const requestParams = {
915
+ parentNode: params.parentNode.data
916
+ };
917
+ this.fetchData(gridFilter, requestParams).then(data => {
918
+ params.success({
919
+ rowData: data.items,
920
+ rowCount: data.totalCount
921
+ });
922
+ }).catch(() => {
923
+ params.fail();
924
+ });
925
+ }
926
+ };
927
+ }
928
+ ngOnInit() { }
929
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: GridComponent, deps: [{ token: i1$4.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
930
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: GridComponent, selector: "app-grid", inputs: { label: "label", rowModelType: "rowModelType", isToolbar: "isToolbar", rtl: "rtl", paginationPageSize: "paginationPageSize", paginationPageSizeSelector: "paginationPageSizeSelector", enableAdvancedFilter: "enableAdvancedFilter", treeModel: "treeModel", isLeaf: "isLeaf", showAdvancedButton: "showAdvancedButton", actionItems: "actionItems", toolbarItems: "toolbarItems", treeGroupColumn: "treeGroupColumn", fetchData: "fetchData", column: "column" }, outputs: { onAction: "onAction", onToolbar: "onToolbar", onClicked: "onClicked" }, ngImport: i0, template: "<!-- <button (click)=\"enableAdvancedFilter=!enableAdvancedFilter\">advanced</button> -->\n<div class=\"flex justify-between items-center mb-4 pb-4 border-b border-b-slate-200\" *ngIf=\"isToolbar\">\n <div>\n <h4 class=\"font-semibold text-2xl\">{{label}}</h4>\n </div>\n <div class=\"flex gap-3\">\n <button nz-button *ngFor=\"let item of toolbarItems\" (click)=\"handleClick(item)\" [nzType]=\"item.type\">\n <span nz-icon [nzType]=\"item.icon\"></span>\n {{item.text}}\n </button>\n <button nz-button (click)=\"refresh()\" nzType=\"default\">\n <span nz-icon nzType=\"sync\"></span>\n \u0628\u0631\u0648\u0632\u0631\u0633\u0627\u0646\u06CC\n </button>\n <!-- <button nz-button (click)=\"advancedFilter()\" *ngIf=\"showAdvancedButton\" nzType=\"default\">\n <span nz-icon nzType=\"filter\"></span>\n \u062C\u0633\u062A\u062C\u0648\u06CC \u067E\u06CC\u0634\u0631\u0641\u062A\u0647\n </button> -->\n </div>\n</div>\n<ag-grid-angular style=\"width: 100%;\" [style]=\"(isToolbar) ? 'height: calc(100% - 1rem - 48px);':'height: 100%;'\" [columnDefs]=\"columnDefs\" [pagination]=\"true\"\n [paginationPageSize]=\"paginationPageSize\" [paginationPageSizeSelector]=\"paginationPageSizeSelector\"\n [class]=\"themeClass\" [defaultColDef]=\"defaultColDef\" [enableAdvancedFilter]=\"enableAdvancedFilter\" [enableRtl]=\"rtl\"\n [treeData]=\"treeModel\" [autoGroupColumnDef]=\"autoGroupColumnDef\" [isServerSideGroup]=\"isServerSideGroup\"\n [getServerSideGroupKey]=\"getServerSideGroupKey\" [rowModelType]=\"rowModelType\" [serverSideDatasource]=\"datasource\"\n (gridReady)=\"onGridReady($event)\" [cacheBlockSize]=\"paginationPageSize\" [maxBlocksInCache]=\"2\"\n [context]=\"{actionItems: actionItems}\" (cellDoubleClicked)=\"cellDoubleClicked($event)\" #grid />", dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.AgGridAngular, selector: "ag-grid-angular", inputs: ["gridOptions", "modules", "statusBar", "sideBar", "suppressContextMenu", "preventDefaultOnContextMenu", "allowContextMenuWithControlKey", "columnMenu", "suppressMenuHide", "enableBrowserTooltips", "tooltipTrigger", "tooltipShowDelay", "tooltipHideDelay", "tooltipMouseTrack", "tooltipShowMode", "tooltipInteraction", "popupParent", "copyHeadersToClipboard", "copyGroupHeadersToClipboard", "clipboardDelimiter", "suppressCopyRowsToClipboard", "suppressCopySingleCellRanges", "suppressLastEmptyLineOnPaste", "suppressClipboardPaste", "suppressClipboardApi", "suppressCutToClipboard", "columnDefs", "defaultColDef", "defaultColGroupDef", "columnTypes", "dataTypeDefinitions", "maintainColumnOrder", "enableStrictPivotColumnOrder", "suppressFieldDotNotation", "headerHeight", "groupHeaderHeight", "floatingFiltersHeight", "pivotHeaderHeight", "pivotGroupHeaderHeight", "allowDragFromColumnsToolPanel", "suppressMovableColumns", "suppressColumnMoveAnimation", "suppressMoveWhenColumnDragging", "suppressDragLeaveHidesColumns", "suppressRowGroupHidesColumns", "colResizeDefault", "suppressAutoSize", "autoSizePadding", "skipHeaderOnAutoSize", "autoSizeStrategy", "components", "editType", "singleClickEdit", "suppressClickEdit", "readOnlyEdit", "stopEditingWhenCellsLoseFocus", "enterNavigatesVertically", "enterNavigatesVerticallyAfterEdit", "enableCellEditingOnBackspace", "undoRedoCellEditing", "undoRedoCellEditingLimit", "defaultCsvExportParams", "suppressCsvExport", "defaultExcelExportParams", "suppressExcelExport", "excelStyles", "quickFilterText", "cacheQuickFilter", "includeHiddenColumnsInQuickFilter", "quickFilterParser", "quickFilterMatcher", "applyQuickFilterBeforePivotOrAgg", "excludeChildrenWhenTreeDataFiltering", "enableAdvancedFilter", "advancedFilterModel", "includeHiddenColumnsInAdvancedFilter", "advancedFilterParent", "advancedFilterBuilderParams", "suppressAdvancedFilterEval", "suppressSetFilterByDefault", "enableCharts", "chartThemes", "customChartThemes", "chartThemeOverrides", "chartToolPanelsDef", "chartMenuItems", "loadingCellRenderer", "loadingCellRendererParams", "loadingCellRendererSelector", "localeText", "masterDetail", "keepDetailRows", "keepDetailRowsCount", "detailCellRenderer", "detailCellRendererParams", "detailRowHeight", "detailRowAutoHeight", "context", "dragAndDropImageComponent", "dragAndDropImageComponentParams", "alignedGrids", "tabIndex", "rowBuffer", "valueCache", "valueCacheNeverExpires", "enableCellExpressions", "suppressTouch", "suppressFocusAfterRefresh", "suppressAsyncEvents", "suppressBrowserResizeObserver", "suppressPropertyNamesCheck", "suppressChangeDetection", "debug", "loading", "overlayLoadingTemplate", "loadingOverlayComponent", "loadingOverlayComponentParams", "suppressLoadingOverlay", "overlayNoRowsTemplate", "noRowsOverlayComponent", "noRowsOverlayComponentParams", "suppressNoRowsOverlay", "pagination", "paginationPageSize", "paginationPageSizeSelector", "paginationAutoPageSize", "paginateChildRows", "suppressPaginationPanel", "pivotMode", "pivotPanelShow", "pivotMaxGeneratedColumns", "pivotDefaultExpanded", "pivotColumnGroupTotals", "pivotRowTotals", "pivotSuppressAutoColumn", "suppressExpandablePivotGroups", "functionsReadOnly", "aggFuncs", "suppressAggFuncInHeader", "alwaysAggregateAtRootLevel", "aggregateOnlyChangedColumns", "suppressAggFilteredOnly", "removePivotHeaderRowWhenSingleValueColumn", "animateRows", "enableCellChangeFlash", "cellFlashDuration", "cellFlashDelay", "cellFadeDuration", "cellFadeDelay", "allowShowChangeAfterFilter", "domLayout", "ensureDomOrder", "enableRtl", "suppressColumnVirtualisation", "suppressMaxRenderedRowRestriction", "suppressRowVirtualisation", "rowDragManaged", "suppressRowDrag", "suppressMoveWhenRowDragging", "rowDragEntireRow", "rowDragMultiRow", "rowDragText", "fullWidthCellRenderer", "fullWidthCellRendererParams", "embedFullWidthRows", "suppressGroupMaintainValueType", "groupDisplayType", "groupDefaultExpanded", "autoGroupColumnDef", "groupMaintainOrder", "groupSelectsChildren", "groupLockGroupColumns", "groupAggFiltering", "groupIncludeFooter", "groupIncludeTotalFooter", "groupTotalRow", "grandTotalRow", "suppressStickyTotalRow", "groupSuppressBlankHeader", "groupSelectsFiltered", "showOpenedGroup", "groupRemoveSingleChildren", "groupRemoveLowestSingleChildren", "groupHideOpenParents", "groupAllowUnbalanced", "rowGroupPanelShow", "groupRowRenderer", "groupRowRendererParams", "suppressMakeColumnVisibleAfterUnGroup", "treeData", "rowGroupPanelSuppressSort", "suppressGroupRowsSticky", "pinnedTopRowData", "pinnedBottomRowData", "rowModelType", "rowData", "asyncTransactionWaitMillis", "suppressModelUpdateAfterUpdateTransaction", "datasource", "cacheOverflowSize", "infiniteInitialRowCount", "serverSideInitialRowCount", "suppressServerSideInfiniteScroll", "suppressServerSideFullWidthLoadingRow", "cacheBlockSize", "maxBlocksInCache", "maxConcurrentDatasourceRequests", "blockLoadDebounceMillis", "purgeClosedRowNodes", "serverSideDatasource", "serverSideSortAllLevels", "serverSideEnableClientSideSort", "serverSideOnlyRefreshFilteredGroups", "serverSideSortOnServer", "serverSideFilterOnServer", "serverSidePivotResultFieldSeparator", "viewportDatasource", "viewportRowModelPageSize", "viewportRowModelBufferSize", "alwaysShowHorizontalScroll", "alwaysShowVerticalScroll", "debounceVerticalScrollbar", "suppressHorizontalScroll", "suppressScrollOnNewData", "suppressScrollWhenPopupsAreOpen", "suppressAnimationFrame", "suppressMiddleClickScrolls", "suppressPreventDefaultOnMouseWheel", "scrollbarWidth", "rowSelection", "cellSelection", "rowMultiSelectWithClick", "suppressRowDeselection", "suppressRowClickSelection", "suppressCellFocus", "suppressHeaderFocus", "selectionColumnDef", "suppressMultiRangeSelection", "enableCellTextSelection", "enableRangeSelection", "enableRangeHandle", "enableFillHandle", "fillHandleDirection", "suppressClearOnFillReduction", "sortingOrder", "accentedSort", "unSortIcon", "suppressMultiSort", "alwaysMultiSort", "multiSortKey", "suppressMaintainUnsortedOrder", "icons", "rowHeight", "rowStyle", "rowClass", "rowClassRules", "suppressRowHoverHighlight", "suppressRowTransform", "columnHoverHighlight", "gridId", "deltaSort", "treeDataDisplayType", "enableGroupEdit", "initialState", "theme", "loadThemeGoogleFonts", "getContextMenuItems", "getMainMenuItems", "postProcessPopup", "processUnpinnedColumns", "processCellForClipboard", "processHeaderForClipboard", "processGroupHeaderForClipboard", "processCellFromClipboard", "sendToClipboard", "processDataFromClipboard", "isExternalFilterPresent", "doesExternalFilterPass", "getChartToolbarItems", "createChartContainer", "focusGridInnerElement", "navigateToNextHeader", "tabToNextHeader", "navigateToNextCell", "tabToNextCell", "getLocaleText", "getDocument", "paginationNumberFormatter", "getGroupRowAgg", "isGroupOpenByDefault", "initialGroupOrderComparator", "processPivotResultColDef", "processPivotResultColGroupDef", "getDataPath", "getChildCount", "getServerSideGroupLevelParams", "isServerSideGroupOpenByDefault", "isApplyServerSideTransaction", "isServerSideGroup", "getServerSideGroupKey", "getBusinessKeyForNode", "getRowId", "resetRowDataOnUpdate", "processRowPostCreate", "isRowSelectable", "isRowMaster", "fillOperation", "postSortRows", "getRowStyle", "getRowClass", "getRowHeight", "isFullWidthRow"], outputs: ["toolPanelVisibleChanged", "toolPanelSizeChanged", "columnMenuVisibleChanged", "contextMenuVisibleChanged", "cutStart", "cutEnd", "pasteStart", "pasteEnd", "columnVisible", "columnPinned", "columnResized", "columnMoved", "columnValueChanged", "columnPivotModeChanged", "columnPivotChanged", "columnGroupOpened", "newColumnsLoaded", "gridColumnsChanged", "displayedColumnsChanged", "virtualColumnsChanged", "columnEverythingChanged", "columnHeaderMouseOver", "columnHeaderMouseLeave", "columnHeaderClicked", "columnHeaderContextMenu", "componentStateChanged", "cellValueChanged", "cellEditRequest", "rowValueChanged", "cellEditingStarted", "cellEditingStopped", "rowEditingStarted", "rowEditingStopped", "undoStarted", "undoEnded", "redoStarted", "redoEnded", "cellSelectionDeleteStart", "cellSelectionDeleteEnd", "rangeDeleteStart", "rangeDeleteEnd", "fillStart", "fillEnd", "filterOpened", "filterChanged", "filterModified", "advancedFilterBuilderVisibleChanged", "chartCreated", "chartRangeSelectionChanged", "chartOptionsChanged", "chartDestroyed", "cellKeyDown", "gridReady", "firstDataRendered", "gridSizeChanged", "modelUpdated", "virtualRowRemoved", "viewportChanged", "bodyScroll", "bodyScrollEnd", "dragStarted", "dragStopped", "dragCancelled", "stateUpdated", "paginationChanged", "rowDragEnter", "rowDragMove", "rowDragLeave", "rowDragEnd", "rowDragCancel", "columnRowGroupChanged", "rowGroupOpened", "expandOrCollapseAll", "pivotMaxColumnsExceeded", "pinnedRowDataChanged", "rowDataUpdated", "asyncTransactionsFlushed", "storeRefreshed", "headerFocused", "cellClicked", "cellDoubleClicked", "cellFocused", "cellMouseOver", "cellMouseOut", "cellMouseDown", "rowClicked", "rowDoubleClicked", "rowSelected", "selectionChanged", "cellContextMenu", "rangeSelectionChanged", "cellSelectionChanged", "tooltipShow", "tooltipHide", "sortChanged"] }, { kind: "directive", type: i4.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "component", type: i1$2.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i2.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i3.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }] });
931
+ }
932
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: GridComponent, decorators: [{
933
+ type: Component,
934
+ args: [{ selector: 'app-grid', template: "<!-- <button (click)=\"enableAdvancedFilter=!enableAdvancedFilter\">advanced</button> -->\n<div class=\"flex justify-between items-center mb-4 pb-4 border-b border-b-slate-200\" *ngIf=\"isToolbar\">\n <div>\n <h4 class=\"font-semibold text-2xl\">{{label}}</h4>\n </div>\n <div class=\"flex gap-3\">\n <button nz-button *ngFor=\"let item of toolbarItems\" (click)=\"handleClick(item)\" [nzType]=\"item.type\">\n <span nz-icon [nzType]=\"item.icon\"></span>\n {{item.text}}\n </button>\n <button nz-button (click)=\"refresh()\" nzType=\"default\">\n <span nz-icon nzType=\"sync\"></span>\n \u0628\u0631\u0648\u0632\u0631\u0633\u0627\u0646\u06CC\n </button>\n <!-- <button nz-button (click)=\"advancedFilter()\" *ngIf=\"showAdvancedButton\" nzType=\"default\">\n <span nz-icon nzType=\"filter\"></span>\n \u062C\u0633\u062A\u062C\u0648\u06CC \u067E\u06CC\u0634\u0631\u0641\u062A\u0647\n </button> -->\n </div>\n</div>\n<ag-grid-angular style=\"width: 100%;\" [style]=\"(isToolbar) ? 'height: calc(100% - 1rem - 48px);':'height: 100%;'\" [columnDefs]=\"columnDefs\" [pagination]=\"true\"\n [paginationPageSize]=\"paginationPageSize\" [paginationPageSizeSelector]=\"paginationPageSizeSelector\"\n [class]=\"themeClass\" [defaultColDef]=\"defaultColDef\" [enableAdvancedFilter]=\"enableAdvancedFilter\" [enableRtl]=\"rtl\"\n [treeData]=\"treeModel\" [autoGroupColumnDef]=\"autoGroupColumnDef\" [isServerSideGroup]=\"isServerSideGroup\"\n [getServerSideGroupKey]=\"getServerSideGroupKey\" [rowModelType]=\"rowModelType\" [serverSideDatasource]=\"datasource\"\n (gridReady)=\"onGridReady($event)\" [cacheBlockSize]=\"paginationPageSize\" [maxBlocksInCache]=\"2\"\n [context]=\"{actionItems: actionItems}\" (cellDoubleClicked)=\"cellDoubleClicked($event)\" #grid />" }]
935
+ }], ctorParameters: () => [{ type: i1$4.TranslateService }], propDecorators: { onAction: [{
936
+ type: Output
937
+ }], onToolbar: [{
938
+ type: Output
939
+ }], onClicked: [{
940
+ type: Output
941
+ }], label: [{
942
+ type: Input
943
+ }], rowModelType: [{
944
+ type: Input
945
+ }], isToolbar: [{
946
+ type: Input
947
+ }], rtl: [{
948
+ type: Input
949
+ }], paginationPageSize: [{
950
+ type: Input
951
+ }], paginationPageSizeSelector: [{
952
+ type: Input
953
+ }], enableAdvancedFilter: [{
954
+ type: Input
955
+ }], treeModel: [{
956
+ type: Input
957
+ }], isLeaf: [{
958
+ type: Input
959
+ }], showAdvancedButton: [{
960
+ type: Input
961
+ }], actionItems: [{
962
+ type: Input
963
+ }], toolbarItems: [{
964
+ type: Input
965
+ }], treeGroupColumn: [{
966
+ type: Input
967
+ }], fetchData: [{
968
+ type: Input
969
+ }], column: [{
970
+ type: Input
971
+ }] } });
972
+
973
+ class ActionsCellRenderer {
974
+ params;
975
+ items = [];
976
+ agInit(params) {
977
+ this.params = params;
978
+ this.items = params.context.actionItems;
979
+ }
980
+ refresh(params) {
981
+ this.params = params;
982
+ return true;
983
+ }
984
+ handleClick(item) {
985
+ this.params.onClick({ data: this.params.data, event: item.code, id: this.params.node.id });
986
+ }
987
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ActionsCellRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
988
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ActionsCellRenderer, selector: "app-button-renderer", ngImport: i0, template: "<div class=\"h-full flex gap-2 items-center\">\n <button mat-button class=\"min-w-[30px] min-h-[30px] h-[30px]\" *ngFor=\"let item of items\" nz-tooltip [nzTooltipTitle]=\"item.alt\" nzTooltipPlacement=\"bottom\" (click)=\"handleClick(item)\">\n <div class=\"flex justify-center items-center\">\n <i [class]=\"item.icon\"></i>\n </div>\n </button>\n \n</div>", dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$2.NzTooltipDirective, selector: "[nz-tooltip]", inputs: ["nzTooltipTitle", "nzTooltipTitleContext", "nz-tooltip", "nzTooltipTrigger", "nzTooltipPlacement", "nzTooltipOrigin", "nzTooltipVisible", "nzTooltipMouseEnterDelay", "nzTooltipMouseLeaveDelay", "nzTooltipOverlayClassName", "nzTooltipOverlayStyle", "nzTooltipArrowPointAtCenter", "cdkConnectedOverlayPush", "nzTooltipColor"], outputs: ["nzTooltipVisibleChange"], exportAs: ["nzTooltip"] }] });
989
+ }
990
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ActionsCellRenderer, decorators: [{
991
+ type: Component,
992
+ args: [{ selector: 'app-button-renderer', template: "<div class=\"h-full flex gap-2 items-center\">\n <button mat-button class=\"min-w-[30px] min-h-[30px] h-[30px]\" *ngFor=\"let item of items\" nz-tooltip [nzTooltipTitle]=\"item.alt\" nzTooltipPlacement=\"bottom\" (click)=\"handleClick(item)\">\n <div class=\"flex justify-center items-center\">\n <i [class]=\"item.icon\"></i>\n </div>\n </button>\n \n</div>" }]
993
+ }] });
994
+
995
+ class CaptchaComponent {
996
+ constructor() { }
997
+ captchaCanvas;
998
+ value = '';
999
+ valueChange = new EventEmitter();
1000
+ generateCode() {
1001
+ this.value = Math.round((Math.random() * 1000000)).toString();
1002
+ this.drawCaptcha();
1003
+ this.valueChange.emit(this.value);
1004
+ }
1005
+ drawCaptcha() {
1006
+ const canvas = this.captchaCanvas.nativeElement;
1007
+ const ctx = canvas.getContext('2d');
1008
+ if (ctx) {
1009
+ // تنظیمات اولیه Canvas
1010
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
1011
+ ctx.font = '30px Arial';
1012
+ ctx.fillStyle = '#000';
1013
+ ctx.textAlign = 'center';
1014
+ // وسط‌چین کردن عمودی: تعیین y براساس ارتفاع فونت
1015
+ const textX = canvas.width / 2;
1016
+ const textY = (canvas.height / 2) + 10;
1017
+ // رندر کردن متن کپچا
1018
+ ctx.fillText(this.value, textX, textY);
1019
+ // اضافه کردن نویز و خطوط برای پیچیده‌تر کردن کپچا
1020
+ for (let i = 0; i < 10; i++) {
1021
+ ctx.beginPath();
1022
+ ctx.moveTo(Math.random() * canvas.width, Math.random() * canvas.height);
1023
+ ctx.lineTo(Math.random() * canvas.width, Math.random() * canvas.height);
1024
+ ctx.strokeStyle = '#ccc';
1025
+ ctx.stroke();
1026
+ }
1027
+ }
1028
+ }
1029
+ ngOnInit() {
1030
+ this.generateCode();
1031
+ }
1032
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CaptchaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1033
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: CaptchaComponent, selector: "app-captcha", outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "captchaCanvas", first: true, predicate: ["canvas"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"rounded-xl border border-slate-200 relative\">\n <canvas #canvas class=\"w-full h-[80px] blur-[1px]\"></canvas>\n <div class=\"absolute left-2 top-0 bottom-0 m-auto z-10 flex justify-center items-center\">\n <button nz-button nzShape=\"circle\" type=\"button\" (click)=\"generateCode()\">\n <span nz-icon nzType=\"undo\" nzTheme=\"outline\"></span>\n </button>\n </div>\n</div>", dependencies: [{ kind: "directive", type: i4.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "component", type: i1$2.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i2.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i3.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }] });
1034
+ }
1035
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CaptchaComponent, decorators: [{
1036
+ type: Component,
1037
+ args: [{ selector: 'app-captcha', template: "<div class=\"rounded-xl border border-slate-200 relative\">\n <canvas #canvas class=\"w-full h-[80px] blur-[1px]\"></canvas>\n <div class=\"absolute left-2 top-0 bottom-0 m-auto z-10 flex justify-center items-center\">\n <button nz-button nzShape=\"circle\" type=\"button\" (click)=\"generateCode()\">\n <span nz-icon nzType=\"undo\" nzTheme=\"outline\"></span>\n </button>\n </div>\n</div>" }]
1038
+ }], ctorParameters: () => [], propDecorators: { captchaCanvas: [{
1039
+ type: ViewChild,
1040
+ args: ['canvas', { static: true }]
1041
+ }], valueChange: [{
1042
+ type: Output
1043
+ }] } });
1044
+
1045
+ class MapComponent {
1046
+ constructor() { }
1047
+ map;
1048
+ drawnItems = new L.FeatureGroup();
1049
+ editable = false;
1050
+ polygons = [];
1051
+ drawPolygon = false;
1052
+ drawCircle = false;
1053
+ drawPolyline = false;
1054
+ drawRectangle = false;
1055
+ drawMarker = false;
1056
+ zoom = 13;
1057
+ center = [35.6961, 51.4231];
1058
+ onCreatePolygon = new EventEmitter();
1059
+ onEditPolygon = new EventEmitter();
1060
+ initMap() {
1061
+ if (L && L.map && L.Control && L.Control.Draw) {
1062
+ if (this.center.length == 0) {
1063
+ this.center = [35.6961, 51.4231];
1064
+ }
1065
+ this.map = L.map('map').setView(this.center, this.zoom);
1066
+ L.tileLayer('https://raster.snappmaps.ir/styles/snapp-style/{z}/{x}/{y}@2x.webp', {
1067
+ maxZoom: 18,
1068
+ }).addTo(this.map);
1069
+ this.map.addLayer(this.drawnItems);
1070
+ const drawControl = new L.Control.Draw({
1071
+ edit: this.editable ? {
1072
+ featureGroup: this.drawnItems
1073
+ } : null,
1074
+ draw: {
1075
+ polygon: this.drawPolygon,
1076
+ polyline: this.drawPolyline,
1077
+ circle: this.drawCircle,
1078
+ rectangle: this.drawRectangle,
1079
+ marker: this.drawMarker,
1080
+ circlemarker: false,
1081
+ }
1082
+ });
1083
+ this.map.addControl(drawControl);
1084
+ if (L.Draw && L.Draw.Event && L.Draw.Event.CREATED) {
1085
+ this.map.on(L.Draw.Event.CREATED, (event) => {
1086
+ this.onCreatePolygon.emit(event.layer._latlngs[0]);
1087
+ const layer = event.layer;
1088
+ this.drawnItems.addLayer(layer);
1089
+ });
1090
+ this.map.on(L.Draw.Event.EDITED, (event) => {
1091
+ const polygon = [];
1092
+ event.layers.eachLayer((layer) => {
1093
+ layer._latlngs[0].forEach(element => {
1094
+ polygon.push({
1095
+ lat: element.lat,
1096
+ lng: element.lng
1097
+ });
1098
+ });
1099
+ });
1100
+ this.onEditPolygon.emit(polygon);
1101
+ });
1102
+ }
1103
+ else {
1104
+ console.error('Leaflet Draw Event is not available.');
1105
+ }
1106
+ }
1107
+ else {
1108
+ console.error('Leaflet or Leaflet Draw is not correctly loaded.');
1109
+ }
1110
+ }
1111
+ addPolygonsToMap() {
1112
+ this.polygons.forEach(polygon => {
1113
+ // polygon.coordinates.forEach((el) => {
1114
+ // el.reverse();
1115
+ // });
1116
+ const layer = L.polygon(polygon.coordinates, { color: polygon.color }).addTo(this.map);
1117
+ // اضافه کردن لیبل به پالیگان
1118
+ layer.bindTooltip(polygon.name, { permanent: true, direction: 'center', className: 'font-[yekanBakh]' }).openTooltip();
1119
+ if (polygon.editable) {
1120
+ // اضافه کردن پالیگان به drawnItems برای ویرایش
1121
+ this.drawnItems.addLayer(layer);
1122
+ }
1123
+ });
1124
+ }
1125
+ clearMap() {
1126
+ this.map.eachLayer((layer) => {
1127
+ if (!(layer instanceof L.TileLayer)) {
1128
+ this.map.removeLayer(layer);
1129
+ }
1130
+ });
1131
+ }
1132
+ ngOnChanges(changes) {
1133
+ if (changes['polygons']) {
1134
+ this.clearMap();
1135
+ this.addPolygonsToMap();
1136
+ }
1137
+ if (changes['center'] || changes['zoom']) {
1138
+ if (this.map) {
1139
+ this.map.setView(this.center, this.zoom);
1140
+ }
1141
+ }
1142
+ }
1143
+ ngAfterViewInit() {
1144
+ this.initMap();
1145
+ this.addPolygonsToMap();
1146
+ }
1147
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1148
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: MapComponent, selector: "app-map", inputs: { editable: "editable", polygons: "polygons", drawPolygon: "drawPolygon", drawCircle: "drawCircle", drawPolyline: "drawPolyline", drawRectangle: "drawRectangle", drawMarker: "drawMarker", zoom: "zoom", center: "center" }, outputs: { onCreatePolygon: "onCreatePolygon", onEditPolygon: "onEditPolygon" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"map-container\">\n <div class=\"map-frame\">\n <div id=\"map\" #mapElement></div>\n <!-- <button mat-flat-button (click)=\"currentLocation()\" *ngIf=\"allowCurrentLocation\">\n <i class=\"fa-solid fa-location-crosshairs\"></i>\n </button> -->\n </div>\n</div>", styles: [".map-container{height:100%!important}.map-frame{height:100%!important;position:relative}.map-frame button{position:absolute;bottom:8px;right:8px;z-index:1000;min-width:40px;height:40px;border-radius:50px;padding:0;box-shadow:var(--box-shadow);border:2px solid rgba(0,0,0,.2)}#map{height:100%!important}\n"] });
1149
+ }
1150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MapComponent, decorators: [{
1151
+ type: Component,
1152
+ args: [{ selector: 'app-map', template: "<div class=\"map-container\">\n <div class=\"map-frame\">\n <div id=\"map\" #mapElement></div>\n <!-- <button mat-flat-button (click)=\"currentLocation()\" *ngIf=\"allowCurrentLocation\">\n <i class=\"fa-solid fa-location-crosshairs\"></i>\n </button> -->\n </div>\n</div>", styles: [".map-container{height:100%!important}.map-frame{height:100%!important;position:relative}.map-frame button{position:absolute;bottom:8px;right:8px;z-index:1000;min-width:40px;height:40px;border-radius:50px;padding:0;box-shadow:var(--box-shadow);border:2px solid rgba(0,0,0,.2)}#map{height:100%!important}\n"] }]
1153
+ }], ctorParameters: () => [], propDecorators: { editable: [{
1154
+ type: Input
1155
+ }], polygons: [{
1156
+ type: Input
1157
+ }], drawPolygon: [{
1158
+ type: Input
1159
+ }], drawCircle: [{
1160
+ type: Input
1161
+ }], drawPolyline: [{
1162
+ type: Input
1163
+ }], drawRectangle: [{
1164
+ type: Input
1165
+ }], drawMarker: [{
1166
+ type: Input
1167
+ }], zoom: [{
1168
+ type: Input
1169
+ }], center: [{
1170
+ type: Input
1171
+ }], onCreatePolygon: [{
1172
+ type: Output
1173
+ }], onEditPolygon: [{
1174
+ type: Output
1175
+ }] } });
1176
+
1177
+ class SpinnerComponent {
1178
+ constructor() { }
1179
+ ngOnInit() { }
1180
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1181
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: SpinnerComponent, selector: "app-spinner", ngImport: i0, template: "<div class=\"w-full h-full absolute top-0 left-0 flex justify-center items-center bg-white\">\n <nz-spin nzSimple nzSize=\"large\" nzSimple></nz-spin>\n</div>", dependencies: [{ kind: "component", type: i1$5.NzSpinComponent, selector: "nz-spin", inputs: ["nzIndicator", "nzSize", "nzTip", "nzDelay", "nzSimple", "nzSpinning"], exportAs: ["nzSpin"] }] });
1182
+ }
1183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SpinnerComponent, decorators: [{
1184
+ type: Component,
1185
+ args: [{ selector: 'app-spinner', template: "<div class=\"w-full h-full absolute top-0 left-0 flex justify-center items-center bg-white\">\n <nz-spin nzSimple nzSize=\"large\" nzSimple></nz-spin>\n</div>" }]
1186
+ }], ctorParameters: () => [] });
1187
+
1188
+ class AuthGuard {
1189
+ _router;
1190
+ constructor(_router) {
1191
+ this._router = _router;
1192
+ }
1193
+ canActivate(route, state) {
1194
+ if (sessionStorage.getItem('userInfo')) {
1195
+ return true;
1196
+ }
1197
+ this._router.navigate(['/auth']);
1198
+ return false;
1199
+ }
1200
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthGuard, deps: [{ token: i1$6.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1201
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthGuard, providedIn: 'root' });
1202
+ }
1203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuthGuard, decorators: [{
1204
+ type: Injectable,
1205
+ args: [{
1206
+ providedIn: 'root'
1207
+ }]
1208
+ }], ctorParameters: () => [{ type: i1$6.Router }] });
1209
+
1210
+ class MasterLayout {
1211
+ _service;
1212
+ _confirm;
1213
+ componentFactoryResolver;
1214
+ constructor(_service, _confirm, componentFactoryResolver) {
1215
+ this._service = _service;
1216
+ this._confirm = _confirm;
1217
+ this.componentFactoryResolver = componentFactoryResolver;
1218
+ }
1219
+ container;
1220
+ isCollapsed = false;
1221
+ menuItems = [];
1222
+ logout() {
1223
+ this._confirm.confirm(() => {
1224
+ sessionStorage.clear();
1225
+ location.reload();
1226
+ return Promise.resolve();
1227
+ });
1228
+ }
1229
+ loadComponent(component) {
1230
+ this.container.clear();
1231
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
1232
+ this.container.createComponent(componentFactory);
1233
+ }
1234
+ ngAfterViewInit() {
1235
+ setTimeout(() => {
1236
+ // this.loadComponent(this._ac.);
1237
+ }, 500);
1238
+ }
1239
+ ngOnInit() {
1240
+ this.menuItems = this._service.menuItems;
1241
+ }
1242
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MasterLayout, deps: [{ token: SharedService }, { token: ConfirmService }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
1243
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MasterLayout, selector: "ng-component", viewQueries: [{ propertyName: "container", first: true, predicate: ["dynamicComponentContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<nz-layout class=\"app-layout\">\n <nz-sider class=\"menu-sidebar bg-white\" nzCollapsible nzWidth=\"256px\" nzBreakpoint=\"md\"\n [(nzCollapsed)]=\"isCollapsed\" [nzTrigger]=\"null\">\n <div class=\"p-4\">\n <div class=\"flex justify-center items-center border-b !border-b-slate-200 pb-4\">\n <img width=\"100\" src=\"assets/images/logo.svg\" alt=\"\">\n </div>\n </div>\n <ul nz-menu nzMode=\"inline\" [nzInlineCollapsed]=\"isCollapsed\">\n @for (item of menuItems; track item.title) {\n @if(item.children){\n <li nz-submenu [nzOpen]=\"true\" [nzTitle]=\"item.title\" [nzIcon]=\"item.icon\">\n <ul nz-menu-group>\n @for (subitem of item.children; track subitem.title) {\n <li nz-menu-item [routerLink]=\"subitem.path\">{{subitem.title}}</li>\n }\n </ul>\n </li>\n } @else{\n <li nz-menu-item [routerLink]=\"item.path\">\n <span nz-icon [nzType]=\"item.icon\"></span>\n <span>{{item.title}}</span>\n </li>\n }\n }\n </ul>\n </nz-sider>\n <nz-layout>\n <nz-header>\n <div class=\"app-header p-4 flex justify-between items-center\">\n <div>\n <button nz-button nzType=\"text\" (click)=\"isCollapsed = !isCollapsed\">\n <span class=\"text-2xl\" nz-icon nzType=\"menu\"></span>\n </button>\n </div>\n <div class=\"flex gap-2\">\n <button nz-button nzType=\"text\" nzSize=\"large\" nzShape=\"circle\"><span nz-icon\n nzType=\"global\"></span></button>\n <button nz-button nzType=\"text\" nzSize=\"large\" nzShape=\"circle\"><span nz-icon\n nzType=\"user\"></span></button>\n <button nz-button nzType=\"text\" nzSize=\"large\" nzShape=\"circle\"><span nz-icon\n nzType=\"bell\"></span></button>\n <button nz-button nzType=\"text\" nzSize=\"large\" nzShape=\"circle\" (click)=\"logout()\"><span nz-icon\n nzType=\"poweroff\"></span></button>\n </div>\n </div>\n </nz-header>\n <nz-content>\n <!-- <nz-tabset nzType=\"editable-card\">\n <nz-tab nzClosable nzTitle=\"\u062F\u0631\u062E\u062A \u0633\u0631\u0648\u06CC\u0633\">\n <div class=\"inner-content rounded-md overflow-auto\">\n <div #dynamicComponentContainer></div>\n </div>\n </nz-tab>\n </nz-tabset> -->\n <div class=\"inner-content rounded-md\">\n <router-outlet></router-outlet>\n </div>\n </nz-content>\n </nz-layout>\n</nz-layout>", styles: [":host{display:flex;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.app-layout{height:100vh}.menu-sidebar{position:relative;z-index:10;min-height:100vh;box-shadow:2px 0 6px #00152959}.header-trigger{height:64px;padding:20px 24px;font-size:20px;cursor:pointer;transition:all .3s,padding 0s}.trigger:hover{color:#1890ff}.sidebar-logo{position:relative;height:64px;padding-left:24px;overflow:hidden;line-height:64px;background:#001529;transition:all .3s}.sidebar-logo img{display:inline-block;height:32px;width:32px;vertical-align:middle}.sidebar-logo h1{display:inline-block;margin:0 0 0 20px;color:#fff;font-weight:600;font-size:14px;font-family:Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;vertical-align:middle}nz-header{padding:0;width:100%;z-index:2}.app-header{position:relative;height:64px;padding:0;background:#fff;box-shadow:0 1px 4px #00152914}nz-content{margin:24px}.inner-content{padding:24px;background:#fff;height:100%}\n"], dependencies: [{ kind: "directive", type: i1$6.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: i1$6.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i4$1.NzLayoutComponent, selector: "nz-layout", exportAs: ["nzLayout"] }, { kind: "component", type: i4$1.NzHeaderComponent, selector: "nz-header", exportAs: ["nzHeader"] }, { kind: "component", type: i4$1.NzContentComponent, selector: "nz-content", exportAs: ["nzContent"] }, { kind: "component", type: i4$1.NzSiderComponent, selector: "nz-sider", inputs: ["nzWidth", "nzTheme", "nzCollapsedWidth", "nzBreakpoint", "nzZeroTrigger", "nzTrigger", "nzReverseArrow", "nzCollapsible", "nzCollapsed"], outputs: ["nzCollapsedChange"], exportAs: ["nzSider"] }, { kind: "directive", type: i5$1.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "component", type: i5$1.NzMenuItemComponent, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "component", type: i5$1.NzSubMenuComponent, selector: "[nz-submenu]", inputs: ["nzMenuClassName", "nzPaddingLeft", "nzTitle", "nzIcon", "nzOpen", "nzDisabled", "nzPlacement"], outputs: ["nzOpenChange"], exportAs: ["nzSubmenu"] }, { kind: "component", type: i5$1.NzMenuGroupComponent, selector: "[nz-menu-group]", inputs: ["nzTitle"], exportAs: ["nzMenuGroup"] }, { kind: "directive", type: i4.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "component", type: i1$2.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i2.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }] });
1244
+ }
1245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MasterLayout, decorators: [{
1246
+ type: Component,
1247
+ args: [{ template: "<nz-layout class=\"app-layout\">\n <nz-sider class=\"menu-sidebar bg-white\" nzCollapsible nzWidth=\"256px\" nzBreakpoint=\"md\"\n [(nzCollapsed)]=\"isCollapsed\" [nzTrigger]=\"null\">\n <div class=\"p-4\">\n <div class=\"flex justify-center items-center border-b !border-b-slate-200 pb-4\">\n <img width=\"100\" src=\"assets/images/logo.svg\" alt=\"\">\n </div>\n </div>\n <ul nz-menu nzMode=\"inline\" [nzInlineCollapsed]=\"isCollapsed\">\n @for (item of menuItems; track item.title) {\n @if(item.children){\n <li nz-submenu [nzOpen]=\"true\" [nzTitle]=\"item.title\" [nzIcon]=\"item.icon\">\n <ul nz-menu-group>\n @for (subitem of item.children; track subitem.title) {\n <li nz-menu-item [routerLink]=\"subitem.path\">{{subitem.title}}</li>\n }\n </ul>\n </li>\n } @else{\n <li nz-menu-item [routerLink]=\"item.path\">\n <span nz-icon [nzType]=\"item.icon\"></span>\n <span>{{item.title}}</span>\n </li>\n }\n }\n </ul>\n </nz-sider>\n <nz-layout>\n <nz-header>\n <div class=\"app-header p-4 flex justify-between items-center\">\n <div>\n <button nz-button nzType=\"text\" (click)=\"isCollapsed = !isCollapsed\">\n <span class=\"text-2xl\" nz-icon nzType=\"menu\"></span>\n </button>\n </div>\n <div class=\"flex gap-2\">\n <button nz-button nzType=\"text\" nzSize=\"large\" nzShape=\"circle\"><span nz-icon\n nzType=\"global\"></span></button>\n <button nz-button nzType=\"text\" nzSize=\"large\" nzShape=\"circle\"><span nz-icon\n nzType=\"user\"></span></button>\n <button nz-button nzType=\"text\" nzSize=\"large\" nzShape=\"circle\"><span nz-icon\n nzType=\"bell\"></span></button>\n <button nz-button nzType=\"text\" nzSize=\"large\" nzShape=\"circle\" (click)=\"logout()\"><span nz-icon\n nzType=\"poweroff\"></span></button>\n </div>\n </div>\n </nz-header>\n <nz-content>\n <!-- <nz-tabset nzType=\"editable-card\">\n <nz-tab nzClosable nzTitle=\"\u062F\u0631\u062E\u062A \u0633\u0631\u0648\u06CC\u0633\">\n <div class=\"inner-content rounded-md overflow-auto\">\n <div #dynamicComponentContainer></div>\n </div>\n </nz-tab>\n </nz-tabset> -->\n <div class=\"inner-content rounded-md\">\n <router-outlet></router-outlet>\n </div>\n </nz-content>\n </nz-layout>\n</nz-layout>", styles: [":host{display:flex;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.app-layout{height:100vh}.menu-sidebar{position:relative;z-index:10;min-height:100vh;box-shadow:2px 0 6px #00152959}.header-trigger{height:64px;padding:20px 24px;font-size:20px;cursor:pointer;transition:all .3s,padding 0s}.trigger:hover{color:#1890ff}.sidebar-logo{position:relative;height:64px;padding-left:24px;overflow:hidden;line-height:64px;background:#001529;transition:all .3s}.sidebar-logo img{display:inline-block;height:32px;width:32px;vertical-align:middle}.sidebar-logo h1{display:inline-block;margin:0 0 0 20px;color:#fff;font-weight:600;font-size:14px;font-family:Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;vertical-align:middle}nz-header{padding:0;width:100%;z-index:2}.app-header{position:relative;height:64px;padding:0;background:#fff;box-shadow:0 1px 4px #00152914}nz-content{margin:24px}.inner-content{padding:24px;background:#fff;height:100%}\n"] }]
1248
+ }], ctorParameters: () => [{ type: SharedService }, { type: ConfirmService }, { type: i0.ComponentFactoryResolver }], propDecorators: { container: [{
1249
+ type: ViewChild,
1250
+ args: ['dynamicComponentContainer', { read: ViewContainerRef }]
1251
+ }] } });
1252
+
1253
+ class BlankLayout {
1254
+ constructor() { }
1255
+ ngOnInit() { }
1256
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: BlankLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
1257
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: BlankLayout, selector: "ng-component", ngImport: i0, template: "<div class=\"w-full h-full\">\n <router-outlet></router-outlet>\n</div>", dependencies: [{ kind: "directive", type: i1$6.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
1258
+ }
1259
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: BlankLayout, decorators: [{
1260
+ type: Component,
1261
+ args: [{ template: "<div class=\"w-full h-full\">\n <router-outlet></router-outlet>\n</div>" }]
1262
+ }], ctorParameters: () => [] });
1263
+
1264
+ class CharInputDirective {
1265
+ el;
1266
+ control;
1267
+ renderer;
1268
+ constructor(el, control, renderer) {
1269
+ this.el = el;
1270
+ this.control = control;
1271
+ this.renderer = renderer;
1272
+ }
1273
+ onEvent($event) {
1274
+ const englishPattern = /^[A-Za-z ]+$/;
1275
+ const persianPattern = /^[\u0600-\u06FF ]+$/;
1276
+ let value = this.el.nativeElement.value;
1277
+ if (!englishPattern.test(value) && !persianPattern.test(value)) {
1278
+ value = value.replaceAll($event.data, '');
1279
+ }
1280
+ this.el.nativeElement.value = value;
1281
+ this.control.control.setValue(value);
1282
+ this.renderer.setProperty(this.el.nativeElement, 'value', value);
1283
+ return value;
1284
+ }
1285
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CharInputDirective, deps: [{ token: i0.ElementRef }, { token: i1$3.NgControl }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1286
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: CharInputDirective, selector: "[charInput]", host: { listeners: { "input": "onEvent($event)" } }, ngImport: i0 });
1287
+ }
1288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CharInputDirective, decorators: [{
1289
+ type: Directive$1,
1290
+ args: [{
1291
+ selector: '[charInput]',
1292
+ }]
1293
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$3.NgControl }, { type: i0.Renderer2 }], propDecorators: { onEvent: [{
1294
+ type: HostListener,
1295
+ args: ['input', ['$event']]
1296
+ }] } });
1297
+
1298
+ class EnglishNumberInputDirective {
1299
+ el;
1300
+ control;
1301
+ renderer;
1302
+ constructor(el, control, renderer) {
1303
+ this.el = el;
1304
+ this.control = control;
1305
+ this.renderer = renderer;
1306
+ }
1307
+ onEvent($event) {
1308
+ var persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], fixNumbers = function (str) {
1309
+ if (typeof str === 'string') {
1310
+ for (var i = 0; i < 10; i++) {
1311
+ str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i);
1312
+ }
1313
+ }
1314
+ return str;
1315
+ };
1316
+ const numberPattern = /^\d+$/;
1317
+ let value = fixNumbers(this.el.nativeElement.value);
1318
+ if (!numberPattern.test(value)) {
1319
+ value = value.replaceAll($event.data, '');
1320
+ }
1321
+ this.el.nativeElement.value = value;
1322
+ this.control.control.setValue(value);
1323
+ this.renderer.setProperty(this.el.nativeElement, 'value', value);
1324
+ return value;
1325
+ }
1326
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: EnglishNumberInputDirective, deps: [{ token: i0.ElementRef }, { token: i1$3.NgControl }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1327
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: EnglishNumberInputDirective, selector: "[englishNumberInput]", host: { listeners: { "input": "onEvent($event)" } }, ngImport: i0 });
1328
+ }
1329
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: EnglishNumberInputDirective, decorators: [{
1330
+ type: Directive$1,
1331
+ args: [{
1332
+ selector: '[englishNumberInput]',
1333
+ }]
1334
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$3.NgControl }, { type: i0.Renderer2 }], propDecorators: { onEvent: [{
1335
+ type: HostListener,
1336
+ args: ['input', ['$event']]
1337
+ }] } });
1338
+
1339
+ function HttpLoaderFactory(http) {
1340
+ return new TranslateHttpLoader(http, './assets/i18n/', '.json?v=' + Date.now());
1341
+ }
1342
+ LicenseManager.prototype.isDisplayWatermark = () => {
1343
+ return false;
1344
+ };
1345
+ LicenseManager.prototype.validateLicense = () => {
1346
+ };
1347
+ ModuleRegistry.registerModules([
1348
+ ClientSideRowModelModule,
1349
+ SetFilterModule,
1350
+ MultiFilterModule,
1351
+ MasterDetailModule,
1352
+ AdvancedFilterModule,
1353
+ ServerSideRowModelModule,
1354
+ RowGroupingModule
1355
+ ]);
1356
+ function initializeApp() {
1357
+ return new Promise((resolve, reject) => {
1358
+ if (typeof window !== 'undefined') {
1359
+ resolve(true);
1360
+ }
1361
+ else {
1362
+ reject();
1363
+ }
1364
+ });
1365
+ }
1366
+ const Layouts = [
1367
+ MasterLayout,
1368
+ BlankLayout
1369
+ ];
1370
+ const Components = [
1371
+ GridComponent,
1372
+ ActionsCellRenderer,
1373
+ CaptchaComponent,
1374
+ MapComponent,
1375
+ SpinnerComponent,
1376
+ DateFilter
1377
+ ];
1378
+ const Popover = [];
1379
+ const Directive = [
1380
+ EnglishNumberInputDirective,
1381
+ CharInputDirective,
1382
+ MaskDirective
1383
+ ];
1384
+ const Pipes = [
1385
+ JDatePipe
1386
+ ];
1387
+ const Guard = [
1388
+ AuthGuard
1389
+ ];
1390
+ const Services = [
1391
+ ConfirmService
1392
+ ];
1393
+ const Modules = [
1394
+ HttpClientModule,
1395
+ CommonModule,
1396
+ AgGridModule,
1397
+ HttpClientModule,
1398
+ CdkMenuModule,
1399
+ NzLayoutModule,
1400
+ NzMenuModule,
1401
+ NzIconModule,
1402
+ NzButtonModule,
1403
+ NzModalModule,
1404
+ NzMessageModule,
1405
+ NzToolTipModule,
1406
+ NzTabsModule,
1407
+ NzTreeViewModule,
1408
+ NzSpinModule,
1409
+ FormsModule,
1410
+ NzInputModule,
1411
+ NzFormModule,
1412
+ TranslateModule.forRoot({
1413
+ defaultLanguage: 'fa',
1414
+ useDefaultLang: true,
1415
+ loader: {
1416
+ provide: TranslateLoader,
1417
+ useFactory: HttpLoaderFactory,
1418
+ deps: [HttpClient]
1419
+ }
1420
+ })
1421
+ ];
1422
+ class SharedModule {
1423
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1424
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: SharedModule, declarations: [MasterLayout,
1425
+ BlankLayout, GridComponent,
1426
+ ActionsCellRenderer,
1427
+ CaptchaComponent,
1428
+ MapComponent,
1429
+ SpinnerComponent,
1430
+ DateFilter, EnglishNumberInputDirective,
1431
+ CharInputDirective,
1432
+ MaskDirective, JDatePipe], imports: [RouterModule, HttpClientModule,
1433
+ CommonModule,
1434
+ AgGridModule,
1435
+ HttpClientModule,
1436
+ CdkMenuModule,
1437
+ NzLayoutModule,
1438
+ NzMenuModule,
1439
+ NzIconModule,
1440
+ NzButtonModule,
1441
+ NzModalModule,
1442
+ NzMessageModule,
1443
+ NzToolTipModule,
1444
+ NzTabsModule,
1445
+ NzTreeViewModule,
1446
+ NzSpinModule,
1447
+ FormsModule,
1448
+ NzInputModule,
1449
+ NzFormModule, i1$4.TranslateModule], exports: [MasterLayout,
1450
+ BlankLayout, GridComponent,
1451
+ ActionsCellRenderer,
1452
+ CaptchaComponent,
1453
+ MapComponent,
1454
+ SpinnerComponent,
1455
+ DateFilter, EnglishNumberInputDirective,
1456
+ CharInputDirective,
1457
+ MaskDirective, JDatePipe] });
1458
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedModule, providers: [
1459
+ ...Guard,
1460
+ ...Services,
1461
+ { provide: APP_INITIALIZER, useFactory: initializeApp, multi: true }
1462
+ ], imports: [RouterModule, Modules] });
1463
+ }
1464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedModule, decorators: [{
1465
+ type: NgModule,
1466
+ args: [{
1467
+ declarations: [
1468
+ ...Layouts,
1469
+ ...Components,
1470
+ ...Popover,
1471
+ ...Directive,
1472
+ ...Pipes
1473
+ ],
1474
+ imports: [
1475
+ RouterModule,
1476
+ ...Modules
1477
+ ],
1478
+ exports: [
1479
+ ...Layouts,
1480
+ ...Components,
1481
+ ...Popover,
1482
+ ...Directive,
1483
+ ...Pipes
1484
+ ],
1485
+ schemas: [
1486
+ CUSTOM_ELEMENTS_SCHEMA
1487
+ ],
1488
+ providers: [
1489
+ ...Guard,
1490
+ ...Services,
1491
+ { provide: APP_INITIALIZER, useFactory: initializeApp, multi: true }
1492
+ ]
1493
+ }]
1494
+ }] });
1495
+
1496
+ class PopoverComponent {
1497
+ data = inject(NZ_MODAL_DATA);
1498
+ dialogRef = inject(NzModalRef);
1499
+ viewContainerRef = inject(ViewContainerRef);
1500
+ injector = inject(Injector);
1501
+ spinnerRef = null;
1502
+ get loadingDialog() {
1503
+ return this.loadingDialog;
1504
+ }
1505
+ set loadingDialog(value) {
1506
+ if (value) {
1507
+ this.spinnerRef = this.viewContainerRef.createComponent(SpinnerComponent, {
1508
+ injector: this.injector,
1509
+ });
1510
+ }
1511
+ else {
1512
+ this.spinnerRef.destroy();
1513
+ this.spinnerRef = null;
1514
+ }
1515
+ }
1516
+ onClose(data) {
1517
+ this.dialogRef.close(data);
1518
+ }
1519
+ }
1520
+
1521
+ class TimerPipe {
1522
+ transform(value) {
1523
+ const hours = Math.floor(value / 3600);
1524
+ const minutes = Math.floor((value % 3600) / 60);
1525
+ const seconds = value % 60;
1526
+ if (value >= 3601) {
1527
+ return (('00' + hours).slice(-2) +
1528
+ ':' +
1529
+ ('00' + minutes).slice(-2) +
1530
+ ':' +
1531
+ ('00' + seconds).slice(-2));
1532
+ }
1533
+ else {
1534
+ return (('00' + minutes).slice(-2) +
1535
+ ':' +
1536
+ ('00' + seconds).slice(-2));
1537
+ }
1538
+ }
1539
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TimerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1540
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: TimerPipe, name: "timer" });
1541
+ }
1542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TimerPipe, decorators: [{
1543
+ type: Pipe,
1544
+ args: [{
1545
+ name: 'timer',
1546
+ }]
1547
+ }] });
1548
+
1549
+ /*
1550
+ * Public API Surface of shared
1551
+ */
1552
+
1553
+ /**
1554
+ * Generated bundle index. Do not edit.
1555
+ */
1556
+
1557
+ export { ActionsCellRenderer, AuthGuard, BlankLayout, CaptchaComponent, CharInputDirective, ConfirmService, DateFilter, DialogService, EnglishNumberInputDirective, FilterOperator, FormService, GridComponent, HttpLoaderFactory, JDatePipe, MapComponent, MaskDirective, MasterLayout, PopoverComponent, SelectModel, SharedModule, SharedService, SpinnerComponent, TimerPipe, ToastService, initializeApp };
1558
+ //# sourceMappingURL=shared.mjs.map