@abp/ng.components 7.4.2 → 8.0.0-rc.2

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 (95) hide show
  1. package/esm2022/chart.js/chart.component.mjs +5 -5
  2. package/esm2022/chart.js/chart.module.mjs +5 -5
  3. package/esm2022/extensible/abp-ng.components-extensible.mjs +5 -0
  4. package/esm2022/extensible/lib/components/abstract-actions/abstract-actions.component.mjs +25 -0
  5. package/esm2022/extensible/lib/components/date-time-picker/extensible-date-time-picker.component.mjs +111 -0
  6. package/esm2022/extensible/lib/components/extensible-form/extensible-form-prop.component.mjs +164 -0
  7. package/esm2022/extensible/lib/components/extensible-form/extensible-form.component.mjs +67 -0
  8. package/esm2022/extensible/lib/components/extensible-table/extensible-table.component.mjs +145 -0
  9. package/esm2022/extensible/lib/components/grid-actions/grid-actions.component.mjs +41 -0
  10. package/esm2022/extensible/lib/components/index.mjs +8 -0
  11. package/esm2022/extensible/lib/components/page-toolbar/page-toolbar.component.mjs +39 -0
  12. package/esm2022/extensible/lib/constants/extra-properties.mjs +2 -0
  13. package/esm2022/extensible/lib/directives/prop-data.directive.mjs +42 -0
  14. package/esm2022/extensible/lib/enums/components.mjs +2 -0
  15. package/esm2022/extensible/lib/enums/props.enum.mjs +2 -0
  16. package/esm2022/extensible/lib/extensible.module.mjs +80 -0
  17. package/esm2022/extensible/lib/models/actions.mjs +48 -0
  18. package/esm2022/extensible/lib/models/entity-actions.mjs +31 -0
  19. package/esm2022/extensible/lib/models/entity-props.mjs +45 -0
  20. package/esm2022/extensible/lib/models/form-props.mjs +76 -0
  21. package/esm2022/extensible/lib/models/internal/object-extensions.mjs +2 -0
  22. package/esm2022/extensible/lib/models/object-extensions.mjs +3 -0
  23. package/esm2022/extensible/lib/models/props.mjs +54 -0
  24. package/esm2022/extensible/lib/models/toolbar-actions.mjs +44 -0
  25. package/esm2022/extensible/lib/pipes/create-injector.pipe.mjs +37 -0
  26. package/esm2022/extensible/lib/services/extensible-form-prop.service.mjs +77 -0
  27. package/esm2022/extensible/lib/services/extensions.service.mjs +24 -0
  28. package/esm2022/extensible/lib/tokens/extensible-form-view-provider.token.mjs +3 -0
  29. package/esm2022/extensible/lib/tokens/extensions.token.mjs +12 -0
  30. package/esm2022/extensible/lib/utils/actions.util.mjs +9 -0
  31. package/esm2022/extensible/lib/utils/enum.util.mjs +42 -0
  32. package/esm2022/extensible/lib/utils/factory.util.mjs +4 -0
  33. package/esm2022/extensible/lib/utils/form-props.util.mjs +49 -0
  34. package/esm2022/extensible/lib/utils/localization.util.mjs +13 -0
  35. package/esm2022/extensible/lib/utils/props.util.mjs +14 -0
  36. package/esm2022/extensible/lib/utils/state.util.mjs +126 -0
  37. package/esm2022/extensible/lib/utils/typeahead.util.mjs +53 -0
  38. package/esm2022/extensible/lib/utils/validation.util.mjs +11 -0
  39. package/esm2022/extensible/public-api.mjs +27 -0
  40. package/esm2022/page/page-part.directive.mjs +6 -6
  41. package/esm2022/page/page-parts.component.mjs +10 -10
  42. package/esm2022/page/page.component.mjs +6 -6
  43. package/esm2022/page/page.module.mjs +10 -11
  44. package/esm2022/tree/lib/components/tree.component.mjs +6 -6
  45. package/esm2022/tree/lib/templates/expanded-icon-template.directive.mjs +5 -5
  46. package/esm2022/tree/lib/templates/tree-node-template.directive.mjs +5 -5
  47. package/esm2022/tree/lib/tree.module.mjs +5 -5
  48. package/extensible/README.md +3 -0
  49. package/extensible/index.d.ts +5 -0
  50. package/extensible/lib/components/abstract-actions/abstract-actions.component.d.ts +12 -0
  51. package/extensible/lib/components/date-time-picker/extensible-date-time-picker.component.d.ts +16 -0
  52. package/extensible/lib/components/extensible-form/extensible-form-prop.component.d.ts +44 -0
  53. package/extensible/lib/components/extensible-form/extensible-form.component.d.ts +23 -0
  54. package/extensible/lib/components/extensible-table/extensible-table.component.d.ts +52 -0
  55. package/extensible/lib/components/grid-actions/grid-actions.component.d.ts +13 -0
  56. package/extensible/lib/components/index.d.ts +7 -0
  57. package/extensible/lib/components/page-toolbar/page-toolbar.component.d.ts +20 -0
  58. package/extensible/lib/constants/extra-properties.d.ts +1 -0
  59. package/extensible/lib/directives/prop-data.directive.d.ts +19 -0
  60. package/extensible/lib/enums/components.d.ts +3 -0
  61. package/extensible/lib/enums/props.enum.d.ts +16 -0
  62. package/extensible/lib/extensible.module.d.ts +18 -0
  63. package/extensible/lib/models/actions.d.ts +38 -0
  64. package/extensible/lib/models/entity-actions.d.ts +24 -0
  65. package/extensible/lib/models/entity-props.d.ts +33 -0
  66. package/extensible/lib/models/form-props.d.ts +59 -0
  67. package/extensible/lib/models/internal/object-extensions.d.ts +86 -0
  68. package/extensible/lib/models/object-extensions.d.ts +2 -0
  69. package/extensible/lib/models/props.d.ts +45 -0
  70. package/extensible/lib/models/toolbar-actions.d.ts +38 -0
  71. package/extensible/lib/pipes/create-injector.pipe.d.ts +8 -0
  72. package/extensible/lib/services/extensible-form-prop.service.d.ts +13 -0
  73. package/extensible/lib/services/extensions.service.d.ts +14 -0
  74. package/extensible/lib/tokens/extensible-form-view-provider.token.d.ts +5 -0
  75. package/extensible/lib/tokens/extensions.token.d.ts +20 -0
  76. package/extensible/lib/utils/actions.util.d.ts +7 -0
  77. package/extensible/lib/utils/enum.util.d.ts +7 -0
  78. package/extensible/lib/utils/factory.util.d.ts +1 -0
  79. package/extensible/lib/utils/form-props.util.d.ts +3 -0
  80. package/extensible/lib/utils/localization.util.d.ts +3 -0
  81. package/extensible/lib/utils/props.util.d.ts +9 -0
  82. package/extensible/lib/utils/state.util.d.ts +5 -0
  83. package/extensible/lib/utils/typeahead.util.d.ts +11 -0
  84. package/extensible/lib/utils/validation.util.d.ts +3 -0
  85. package/extensible/public-api.d.ts +26 -0
  86. package/fesm2022/abp-ng.components-chart.js.mjs +8 -8
  87. package/fesm2022/abp-ng.components-chart.js.mjs.map +1 -1
  88. package/fesm2022/abp-ng.components-extensible.mjs +1371 -0
  89. package/fesm2022/abp-ng.components-extensible.mjs.map +1 -0
  90. package/fesm2022/abp-ng.components-page.mjs +29 -30
  91. package/fesm2022/abp-ng.components-page.mjs.map +1 -1
  92. package/fesm2022/abp-ng.components-tree.mjs +17 -17
  93. package/fesm2022/abp-ng.components-tree.mjs.map +1 -1
  94. package/package.json +10 -4
  95. package/page/page.module.d.ts +4 -5
@@ -0,0 +1,1371 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Optional, SkipSelf, Component, ChangeDetectionStrategy, Input, ViewChild, InjectionToken, inject, Injectable, Pipe, ChangeDetectorRef, Injector, Directive, ViewChildren, EventEmitter, LOCALE_ID, Output, NgModule } from '@angular/core';
3
+ import * as i2 from '@angular/forms';
4
+ import { ReactiveFormsModule, ControlContainer, Validators, FormGroupDirective, UntypedFormGroup, UntypedFormControl } from '@angular/forms';
5
+ import * as i3 from '@ng-bootstrap/ng-bootstrap';
6
+ import { NgbInputDatepicker, NgbTimepicker, NgbDatepickerModule, NgbTimepickerModule, NgbDateAdapter, NgbTimeAdapter, NgbTypeaheadModule, NgbDropdownModule, NgbTooltip, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
7
+ import { LinkedList } from '@abp/utils';
8
+ import { DateTimeAdapter, DisabledDirective, DateAdapter, TimeAdapter, PasswordComponent, EllipsisDirective, AbpVisibleDirective, NgxDatatableDefaultDirective, NgxDatatableListDirective, ThemeSharedModule } from '@abp/ng.theme.shared';
9
+ import * as i1 from '@angular/common';
10
+ import { CommonModule, formatDate } from '@angular/common';
11
+ import * as i2$1 from '@abp/ng.core';
12
+ import { RestService, ConfigStateService, AbpValidators, TrackByService, CoreModule, escapeHtmlChars, PermissionService, getShortDateShortTimeFormat, getShortTimeFormat, getShortDateFormat, LocalizationService, createLocalizationPipeKeyGenerator } from '@abp/ng.core';
13
+ import { of, merge, zip, pipe } from 'rxjs';
14
+ import { map, debounceTime, distinctUntilChanged, switchMap, filter, take } from 'rxjs/operators';
15
+ import * as i5 from '@ngx-validate/core';
16
+ import { NgxValidateCoreModule } from '@ngx-validate/core';
17
+ import * as i3$1 from '@swimlane/ngx-datatable';
18
+ import { NgxDatatableModule } from '@swimlane/ngx-datatable';
19
+
20
+ class PropList extends LinkedList {
21
+ }
22
+ class PropData {
23
+ get data() {
24
+ return {
25
+ getInjected: this.getInjected,
26
+ index: this.index,
27
+ record: this.record,
28
+ };
29
+ }
30
+ }
31
+ class Prop {
32
+ constructor(type, name, displayName, permission, visible = _ => true, isExtra = false, template, className, formText, displayTextResolver) {
33
+ this.type = type;
34
+ this.name = name;
35
+ this.displayName = displayName;
36
+ this.permission = permission;
37
+ this.visible = visible;
38
+ this.isExtra = isExtra;
39
+ this.template = template;
40
+ this.className = className;
41
+ this.formText = formText;
42
+ this.displayTextResolver = displayTextResolver;
43
+ this.displayName = this.displayName || this.name;
44
+ }
45
+ }
46
+ class PropsFactory {
47
+ constructor() {
48
+ this.contributorCallbacks = {};
49
+ }
50
+ get(name) {
51
+ this.contributorCallbacks[name] = this.contributorCallbacks[name] || [];
52
+ return new this._ctor(this.contributorCallbacks[name]);
53
+ }
54
+ }
55
+ class Props {
56
+ get props() {
57
+ const propList = new this._ctor();
58
+ this.callbackList.forEach(callback => callback(propList));
59
+ return propList;
60
+ }
61
+ constructor(callbackList) {
62
+ this.callbackList = callbackList;
63
+ }
64
+ addContributor(contributeCallback) {
65
+ this.callbackList.push(contributeCallback);
66
+ }
67
+ clearContributors() {
68
+ while (this.callbackList.length)
69
+ this.callbackList.pop();
70
+ }
71
+ }
72
+
73
+ class FormPropList extends PropList {
74
+ }
75
+ class FormProps extends Props {
76
+ constructor() {
77
+ super(...arguments);
78
+ this._ctor = FormPropList;
79
+ }
80
+ }
81
+ class GroupedFormPropList {
82
+ constructor() {
83
+ this.items = [];
84
+ }
85
+ addItem(item) {
86
+ const groupName = item.group?.name;
87
+ let group = this.items.find(i => i.group?.name === groupName);
88
+ if (group) {
89
+ group.formPropList.addTail(item);
90
+ }
91
+ else {
92
+ group = {
93
+ formPropList: new FormPropList(),
94
+ group: item.group,
95
+ };
96
+ group.formPropList.addHead(item);
97
+ this.items.push(group);
98
+ }
99
+ }
100
+ }
101
+ class CreateFormPropsFactory extends PropsFactory {
102
+ constructor() {
103
+ super(...arguments);
104
+ this._ctor = FormProps;
105
+ }
106
+ }
107
+ class EditFormPropsFactory extends PropsFactory {
108
+ constructor() {
109
+ super(...arguments);
110
+ this._ctor = FormProps;
111
+ }
112
+ }
113
+ class FormProp extends Prop {
114
+ constructor(options) {
115
+ super(options.type, options.name, options.displayName || '', options.permission || '', options.visible, options.isExtra, options.template, options.className, options.formText);
116
+ this.group = options.group;
117
+ this.className = options.className;
118
+ this.formText = options.formText;
119
+ this.asyncValidators = options.asyncValidators || (_ => []);
120
+ this.validators = options.validators || (_ => []);
121
+ this.disabled = options.disabled || (_ => false);
122
+ this.readonly = options.readonly || (_ => false);
123
+ this.autocomplete = options.autocomplete || 'off';
124
+ this.options = options.options;
125
+ this.id = options.id || options.name;
126
+ const defaultValue = options.defaultValue;
127
+ this.defaultValue = isFalsyValue(defaultValue) ? defaultValue : defaultValue || '';
128
+ this.displayTextResolver = options.displayTextResolver;
129
+ }
130
+ static create(options) {
131
+ return new FormProp(options);
132
+ }
133
+ static createMany(arrayOfOptions) {
134
+ return arrayOfOptions.map(FormProp.create);
135
+ }
136
+ }
137
+ class FormPropData extends PropData {
138
+ constructor(injector, record) {
139
+ super();
140
+ this.record = record;
141
+ this.getInjected = injector.get.bind(injector);
142
+ }
143
+ }
144
+ function isFalsyValue(defaultValue) {
145
+ return [0, '', false].indexOf(defaultValue) > -1;
146
+ }
147
+
148
+ function selfFactory(dependency) {
149
+ return dependency;
150
+ }
151
+
152
+ class ExtensibleDateTimePickerComponent {
153
+ constructor(cdRef) {
154
+ this.cdRef = cdRef;
155
+ this.meridian = false;
156
+ }
157
+ setDate(dateStr) {
158
+ this.date.writeValue(dateStr);
159
+ }
160
+ setTime(dateStr) {
161
+ this.time.writeValue(dateStr);
162
+ }
163
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleDateTimePickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
164
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: ExtensibleDateTimePickerComponent, isStandalone: true, selector: "abp-extensible-date-time-picker", inputs: { prop: "prop", meridian: "meridian" }, viewQueries: [{ propertyName: "date", first: true, predicate: NgbInputDatepicker, descendants: true }, { propertyName: "time", first: true, predicate: NgbTimepicker, descendants: true }], exportAs: ["abpExtensibleDateTimePicker"], ngImport: i0, template: `
165
+ <input
166
+ [id]="prop.id"
167
+ [formControlName]="prop.name"
168
+ (ngModelChange)="setTime($event)"
169
+ (click)="datepicker.open()"
170
+ (keyup.space)="datepicker.open()"
171
+ ngbDatepicker
172
+ #datepicker="ngbDatepicker"
173
+ type="text"
174
+ class="form-control"
175
+ />
176
+ <ngb-timepicker
177
+ #timepicker
178
+ [formControlName]="prop.name"
179
+ (ngModelChange)="setDate($event)"
180
+ [meridian]="meridian"
181
+ ></ngb-timepicker>
182
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: NgbDatepickerModule }, { kind: "directive", type: i3.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: NgbTimepickerModule }, { kind: "component", type: i3.NgbTimepicker, selector: "ngb-timepicker", inputs: ["meridian", "spinners", "seconds", "hourStep", "minuteStep", "secondStep", "readonlyInputs", "size"], exportAs: ["ngbTimepicker"] }], viewProviders: [
183
+ {
184
+ provide: ControlContainer,
185
+ useFactory: selfFactory,
186
+ deps: [[new Optional(), new SkipSelf(), ControlContainer]],
187
+ },
188
+ {
189
+ provide: NgbDateAdapter,
190
+ useClass: DateTimeAdapter,
191
+ },
192
+ {
193
+ provide: NgbTimeAdapter,
194
+ useClass: DateTimeAdapter,
195
+ },
196
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
197
+ }
198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleDateTimePickerComponent, decorators: [{
199
+ type: Component,
200
+ args: [{
201
+ exportAs: 'abpExtensibleDateTimePicker',
202
+ standalone: true,
203
+ imports: [CommonModule, NgbDatepickerModule, ReactiveFormsModule, NgbTimepickerModule],
204
+ selector: 'abp-extensible-date-time-picker',
205
+ template: `
206
+ <input
207
+ [id]="prop.id"
208
+ [formControlName]="prop.name"
209
+ (ngModelChange)="setTime($event)"
210
+ (click)="datepicker.open()"
211
+ (keyup.space)="datepicker.open()"
212
+ ngbDatepicker
213
+ #datepicker="ngbDatepicker"
214
+ type="text"
215
+ class="form-control"
216
+ />
217
+ <ngb-timepicker
218
+ #timepicker
219
+ [formControlName]="prop.name"
220
+ (ngModelChange)="setDate($event)"
221
+ [meridian]="meridian"
222
+ ></ngb-timepicker>
223
+ `,
224
+ changeDetection: ChangeDetectionStrategy.OnPush,
225
+ viewProviders: [
226
+ {
227
+ provide: ControlContainer,
228
+ useFactory: selfFactory,
229
+ deps: [[new Optional(), new SkipSelf(), ControlContainer]],
230
+ },
231
+ {
232
+ provide: NgbDateAdapter,
233
+ useClass: DateTimeAdapter,
234
+ },
235
+ {
236
+ provide: NgbTimeAdapter,
237
+ useClass: DateTimeAdapter,
238
+ },
239
+ ],
240
+ }]
241
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { prop: [{
242
+ type: Input
243
+ }], meridian: [{
244
+ type: Input
245
+ }], date: [{
246
+ type: ViewChild,
247
+ args: [NgbInputDatepicker]
248
+ }], time: [{
249
+ type: ViewChild,
250
+ args: [NgbTimepicker]
251
+ }] } });
252
+
253
+ const EXTENSIONS_IDENTIFIER = new InjectionToken('EXTENSIONS_IDENTIFIER');
254
+ const EXTENSIONS_ACTION_TYPE = new InjectionToken('EXTENSIONS_ACTION_TYPE');
255
+ const EXTENSIONS_ACTION_DATA = new InjectionToken('EXTENSIONS_ACTION_DATA');
256
+ const EXTENSIONS_ACTION_CALLBACK = new InjectionToken('EXTENSIONS_ACTION_DATA');
257
+ const PROP_DATA_STREAM = new InjectionToken('PROP_DATA_STREAM');
258
+ const ENTITY_PROP_TYPE_CLASSES = new InjectionToken('ENTITY_PROP_TYPE_CLASSES', {
259
+ factory: () => ({}),
260
+ });
261
+ const EXTENSIONS_FORM_PROP = new InjectionToken('EXTENSIONS_FORM_PROP');
262
+ const EXTENSIONS_FORM_PROP_DATA = new InjectionToken('EXTENSIONS_FORM_PROP_DATA');
263
+
264
+ const EXTRA_PROPERTIES_KEY = 'extraProperties';
265
+
266
+ const TYPEAHEAD_TEXT_SUFFIX = '_Text';
267
+ const TYPEAHEAD_TEXT_SUFFIX_REGEX = /_Text$/;
268
+ function createTypeaheadOptions(lookup) {
269
+ return (data, searchText) => searchText && data
270
+ ? data
271
+ .getInjected(RestService)
272
+ .request({
273
+ method: 'GET',
274
+ url: lookup.url || '',
275
+ params: {
276
+ [lookup.filterParamName || '']: searchText,
277
+ },
278
+ }, { apiName: 'Default' })
279
+ .pipe(map((response) => {
280
+ const list = response[lookup.resultListPropertyName || ''];
281
+ const mapToOption = (item) => ({
282
+ key: item[lookup.displayPropertyName || ''],
283
+ value: item[lookup.valuePropertyName || ''],
284
+ });
285
+ return list.map(mapToOption);
286
+ }))
287
+ : of([]);
288
+ }
289
+ function getTypeaheadType(lookup, name) {
290
+ if (!!lookup.url) {
291
+ return "typeahead" /* ePropType.Typeahead */;
292
+ }
293
+ else {
294
+ return name.endsWith(TYPEAHEAD_TEXT_SUFFIX) ? "hidden" /* ePropType.Hidden */ : undefined;
295
+ }
296
+ }
297
+ function createTypeaheadDisplayNameGenerator(displayNameGeneratorFn, properties) {
298
+ return (displayName, fallback) => {
299
+ const name = removeTypeaheadTextSuffix(fallback.name || '');
300
+ return displayNameGeneratorFn(displayName || properties[name].displayName, {
301
+ name,
302
+ resource: fallback.resource,
303
+ });
304
+ };
305
+ }
306
+ function addTypeaheadTextSuffix(name) {
307
+ return name + TYPEAHEAD_TEXT_SUFFIX;
308
+ }
309
+ function hasTypeaheadTextSuffix(name) {
310
+ return TYPEAHEAD_TEXT_SUFFIX_REGEX.test(name);
311
+ }
312
+ function removeTypeaheadTextSuffix(name) {
313
+ return name.replace(TYPEAHEAD_TEXT_SUFFIX_REGEX, '');
314
+ }
315
+
316
+ class ExtensibleFormPropService {
317
+ constructor() {
318
+ this.#configStateService = inject(ConfigStateService);
319
+ this.meridian$ = this.#configStateService
320
+ .getDeep$('localization.currentCulture.dateTimeFormat.shortTimePattern')
321
+ .pipe(map((shortTimePattern) => (shortTimePattern || '').includes('tt')));
322
+ }
323
+ #configStateService;
324
+ isRequired(validator) {
325
+ return (validator === Validators.required ||
326
+ validator === AbpValidators.required ||
327
+ validator.name === 'required');
328
+ }
329
+ getComponent(prop) {
330
+ if (prop.template) {
331
+ return 'template';
332
+ }
333
+ switch (prop.type) {
334
+ case "boolean" /* ePropType.Boolean */:
335
+ return 'checkbox';
336
+ case "date" /* ePropType.Date */:
337
+ return 'date';
338
+ case "datetime" /* ePropType.DateTime */:
339
+ return 'dateTime';
340
+ case "hidden" /* ePropType.Hidden */:
341
+ return 'hidden';
342
+ case "multiselect" /* ePropType.MultiSelect */:
343
+ return 'multiselect';
344
+ case "text" /* ePropType.Text */:
345
+ return 'textarea';
346
+ case "time" /* ePropType.Time */:
347
+ return 'time';
348
+ case "typeahead" /* ePropType.Typeahead */:
349
+ return 'typeahead';
350
+ case "passwordinputgroup" /* ePropType.PasswordInputGroup */:
351
+ return 'passwordinputgroup';
352
+ default:
353
+ return prop.options ? 'select' : 'input';
354
+ }
355
+ }
356
+ getType(prop) {
357
+ switch (prop.type) {
358
+ case "date" /* ePropType.Date */:
359
+ case "string" /* ePropType.String */:
360
+ return 'text';
361
+ case "boolean" /* ePropType.Boolean */:
362
+ return 'checkbox';
363
+ case "number" /* ePropType.Number */:
364
+ return 'number';
365
+ case "email" /* ePropType.Email */:
366
+ return 'email';
367
+ case "password" /* ePropType.Password */:
368
+ return 'password';
369
+ case "passwordinputgroup" /* ePropType.PasswordInputGroup */:
370
+ return 'passwordinputgroup';
371
+ default:
372
+ return 'hidden';
373
+ }
374
+ }
375
+ calcAsterisks(validators) {
376
+ if (!validators)
377
+ return '';
378
+ const required = validators.find(v => this.isRequired(v));
379
+ return required ? '*' : '';
380
+ }
381
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleFormPropService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
382
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleFormPropService }); }
383
+ }
384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleFormPropService, decorators: [{
385
+ type: Injectable
386
+ }] });
387
+
388
+ class CreateInjectorPipe {
389
+ transform(_, action, context) {
390
+ const get = (token, notFoundValue, options) => {
391
+ const componentData = context.getData();
392
+ const componentDataCallback = (data) => {
393
+ data = data ?? context.getData();
394
+ return action.action(data);
395
+ };
396
+ let extensionData;
397
+ switch (token) {
398
+ case EXTENSIONS_ACTION_DATA:
399
+ extensionData = componentData;
400
+ break;
401
+ case EXTENSIONS_ACTION_CALLBACK:
402
+ extensionData = componentDataCallback;
403
+ break;
404
+ default:
405
+ extensionData = context.getInjected.call(context.injector, token, notFoundValue, options);
406
+ }
407
+ return extensionData;
408
+ };
409
+ return { get };
410
+ }
411
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: CreateInjectorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
412
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.4", ngImport: i0, type: CreateInjectorPipe, isStandalone: true, name: "createInjector" }); }
413
+ }
414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: CreateInjectorPipe, decorators: [{
415
+ type: Pipe,
416
+ args: [{
417
+ name: 'createInjector',
418
+ standalone: true,
419
+ }]
420
+ }] });
421
+
422
+ class ExtensibleFormPropComponent {
423
+ constructor() {
424
+ this.service = inject(ExtensibleFormPropService);
425
+ this.cdRef = inject(ChangeDetectorRef);
426
+ this.track = inject(TrackByService);
427
+ this.#groupDirective = inject(FormGroupDirective);
428
+ this.injector = inject(Injector);
429
+ this.form = this.#groupDirective.form;
430
+ this.asterisk = '';
431
+ this.containerClassName = 'mb-2';
432
+ this.options$ = of([]);
433
+ this.validators = [];
434
+ this.passwordKey = "ThemeShared.Extensions.PasswordComponent" /* eThemeSharedComponents.PasswordComponent */;
435
+ this.disabledFn = (data) => false;
436
+ this.search = (text$) => text$
437
+ ? text$.pipe(debounceTime(300), distinctUntilChanged(), switchMap(text => this.prop?.options?.(this.data, text) || of([])))
438
+ : of([]);
439
+ this.typeaheadFormatter = (option) => option.key;
440
+ this.meridian$ = this.service.meridian$;
441
+ }
442
+ #groupDirective;
443
+ get disabled() {
444
+ return this.disabledFn(this.data);
445
+ }
446
+ setTypeaheadValue(selectedOption) {
447
+ this.typeaheadModel = selectedOption || { key: null, value: null };
448
+ const { key, value } = this.typeaheadModel;
449
+ const [keyControl, valueControl] = this.getTypeaheadControls();
450
+ if (valueControl?.value && !value)
451
+ valueControl.markAsDirty();
452
+ keyControl?.setValue(key);
453
+ valueControl?.setValue(value);
454
+ }
455
+ get isInvalid() {
456
+ const control = this.form.get(this.prop.name);
457
+ return control?.touched && control.invalid;
458
+ }
459
+ getTypeaheadControls() {
460
+ const { name } = this.prop;
461
+ const extraPropName = `${EXTRA_PROPERTIES_KEY}.${name}`;
462
+ const keyControl = this.form.get(addTypeaheadTextSuffix(extraPropName)) ||
463
+ this.form.get(addTypeaheadTextSuffix(name));
464
+ const valueControl = this.form.get(extraPropName) || this.form.get(name);
465
+ return [keyControl, valueControl];
466
+ }
467
+ setAsterisk() {
468
+ this.asterisk = this.service.calcAsterisks(this.validators);
469
+ }
470
+ ngAfterViewInit() {
471
+ if (this.first && this.fieldRef) {
472
+ this.fieldRef.nativeElement.focus();
473
+ this.cdRef.detectChanges();
474
+ }
475
+ }
476
+ getComponent(prop) {
477
+ return this.service.getComponent(prop);
478
+ }
479
+ getType(prop) {
480
+ return this.service.getType(prop);
481
+ }
482
+ ngOnChanges({ prop, data }) {
483
+ const currentProp = prop?.currentValue;
484
+ const { options, readonly, disabled, validators, className, template } = currentProp || {};
485
+ if (template) {
486
+ this.injectorForCustomComponent = Injector.create({
487
+ providers: [
488
+ {
489
+ provide: EXTENSIONS_FORM_PROP,
490
+ useValue: currentProp,
491
+ },
492
+ {
493
+ provide: EXTENSIONS_FORM_PROP_DATA,
494
+ useValue: data?.currentValue?.record,
495
+ },
496
+ { provide: ControlContainer, useExisting: FormGroupDirective },
497
+ ],
498
+ parent: this.injector,
499
+ });
500
+ }
501
+ if (options)
502
+ this.options$ = options(this.data);
503
+ if (readonly)
504
+ this.readonly = readonly(this.data);
505
+ if (disabled) {
506
+ this.disabledFn = disabled;
507
+ }
508
+ if (validators) {
509
+ this.validators = validators(this.data);
510
+ this.setAsterisk();
511
+ }
512
+ if (className !== undefined) {
513
+ this.containerClassName = className;
514
+ }
515
+ const [keyControl, valueControl] = this.getTypeaheadControls();
516
+ if (keyControl && valueControl)
517
+ this.typeaheadModel = { key: keyControl.value, value: valueControl.value };
518
+ }
519
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleFormPropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
520
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: ExtensibleFormPropComponent, isStandalone: true, selector: "abp-extensible-form-prop", inputs: { data: "data", prop: "prop", first: "first" }, providers: [ExtensibleFormPropService], viewQueries: [{ propertyName: "fieldRef", first: true, predicate: ["field"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container\r\n [ngSwitch]=\"getComponent(prop)\"\r\n *abpPermission=\"prop.permission; runChangeDetection: false\"\r\n>\r\n <ng-template ngSwitchCase=\"template\">\r\n <ng-container *ngComponentOutlet=\"prop.template; injector: injectorForCustomComponent\">\r\n </ng-container>\r\n </ng-template>\r\n\r\n <div [ngClass]=\"containerClassName\" class=\"mb-2\">\r\n <ng-template ngSwitchCase=\"input\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [autocomplete]=\"prop.autocomplete\"\r\n [type]=\"getType(prop)\"\r\n [abpDisabled]=\"disabled\"\r\n [readonly]=\"readonly\"\r\n class=\"form-control\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"hidden\">\r\n <input [formControlName]=\"prop.name\" type=\"hidden\" />\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"checkbox\">\r\n <div class=\"form-check\" validationTarget>\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n type=\"checkbox\"\r\n class=\"form-check-input\"\r\n />\r\n <ng-template\r\n [ngTemplateOutlet]=\"label\"\r\n [ngTemplateOutletContext]=\"{ $implicit: 'form-check-label' }\"\r\n ></ng-template>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"select\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <select\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n class=\"form-select form-control\"\r\n >\r\n <option\r\n *ngFor=\"let option of options$ | async; trackBy: track.by('value')\"\r\n [ngValue]=\"option.value\"\r\n >\r\n {{ option.key }}\r\n </option>\r\n </select>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"multiselect\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <select\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n multiple=\"multiple\"\r\n class=\"form-select form-control\"\r\n >\r\n <option\r\n *ngFor=\"let option of options$ | async; trackBy: track.by('value')\"\r\n [ngValue]=\"option.value\"\r\n >\r\n {{ option.key }}\r\n </option>\r\n </select>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"typeahead\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <div #typeahead class=\"position-relative\" validationStyle validationTarget>\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [autocomplete]=\"prop.autocomplete\"\r\n [abpDisabled]=\"disabled\"\r\n [ngbTypeahead]=\"search\"\r\n [editable]=\"false\"\r\n [inputFormatter]=\"typeaheadFormatter\"\r\n [resultFormatter]=\"typeaheadFormatter\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n [(ngModel)]=\"typeaheadModel\"\r\n (selectItem)=\"setTypeaheadValue($event.item)\"\r\n (blur)=\"setTypeaheadValue(typeaheadModel)\"\r\n [class.is-invalid]=\"typeahead.classList.contains('is-invalid')\"\r\n class=\"form-control\"\r\n />\r\n <input [formControlName]=\"prop.name\" type=\"hidden\" />\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"date\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <input\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n (click)=\"datepicker.open()\"\r\n (keyup.space)=\"datepicker.open()\"\r\n ngbDatepicker\r\n #datepicker=\"ngbDatepicker\"\r\n type=\"text\"\r\n class=\"form-control\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"time\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <ngb-timepicker [formControlName]=\"prop.name\"></ngb-timepicker>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"dateTime\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <abp-extensible-date-time-picker [prop]=\"prop\" [meridian]=\"meridian$ | async\" />\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"textarea\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <textarea\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n [readonly]=\"readonly\"\r\n class=\"form-control\"\r\n ></textarea>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"passwordinputgroup\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <div class=\"input-group form-group\" validationTarget>\r\n <input\r\n class=\"form-control\"\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpShowPassword]=\"showPassword\"\r\n />\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"showPassword = !showPassword\">\r\n <i\r\n class=\"fa\"\r\n aria-hidden=\"true\"\r\n [ngClass]=\"{\r\n 'fa-eye-slash': !showPassword,\r\n 'fa-eye': showPassword\r\n }\"\r\n ></i>\r\n </button>\r\n </div>\r\n </ng-template>\r\n\r\n <small *ngIf=\"prop.formText\" class=\"text-muted d-block\">{{\r\n prop.formText | abpLocalization\r\n }}</small>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-template #label let-classes>\r\n <label [htmlFor]=\"prop.id\" [ngClass]=\"classes || 'form-label'\">\r\n <ng-container *ngIf=\"prop.displayTextResolver; else displayNameTemplate\">\r\n {{ prop.displayTextResolver(data) | abpLocalization }}\r\n </ng-container>\r\n <ng-template #displayNameTemplate> {{ prop.displayName | abpLocalization }}</ng-template>\r\n {{ asterisk }}\r\n </label>\r\n</ng-template>\r\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.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: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: i2$1.LocalizationPipe, name: "abpLocalization" }, { kind: "directive", type: i2$1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission", "abpPermissionRunChangeDetection"] }, { kind: "component", type: ExtensibleDateTimePickerComponent, selector: "abp-extensible-date-time-picker", inputs: ["prop", "meridian"], exportAs: ["abpExtensibleDateTimePicker"] }, { kind: "ngmodule", type: NgbDatepickerModule }, { kind: "directive", type: i3.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: NgbTimepickerModule }, { kind: "component", type: i3.NgbTimepicker, selector: "ngb-timepicker", inputs: ["meridian", "spinners", "seconds", "hourStep", "minuteStep", "secondStep", "readonlyInputs", "size"], exportAs: ["ngbTimepicker"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: DisabledDirective, selector: "[abpDisabled]", inputs: ["abpDisabled"] }, { kind: "ngmodule", type: NgxValidateCoreModule }, { kind: "directive", type: i5.ValidationStyleDirective, selector: "[validationStyle]", exportAs: ["validationStyle"] }, { kind: "directive", type: i5.ValidationTargetDirective, selector: "[validationTarget]", exportAs: ["validationTarget"] }, { kind: "directive", type: i5.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "ngmodule", type: NgbTypeaheadModule }, { kind: "directive", type: i3.NgbTypeahead, selector: "input[ngbTypeahead]", inputs: ["autocomplete", "container", "editable", "focusFirst", "inputFormatter", "ngbTypeahead", "resultFormatter", "resultTemplate", "selectOnExact", "showHint", "placement", "popperOptions", "popupClass"], outputs: ["selectItem"], exportAs: ["ngbTypeahead"] }], viewProviders: [
521
+ {
522
+ provide: ControlContainer,
523
+ useFactory: selfFactory,
524
+ deps: [[new Optional(), new SkipSelf(), ControlContainer]],
525
+ },
526
+ { provide: NgbDateAdapter, useClass: DateAdapter },
527
+ { provide: NgbTimeAdapter, useClass: TimeAdapter },
528
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
529
+ }
530
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleFormPropComponent, decorators: [{
531
+ type: Component,
532
+ args: [{ selector: 'abp-extensible-form-prop', standalone: true, imports: [
533
+ CoreModule,
534
+ ExtensibleDateTimePickerComponent,
535
+ NgbDatepickerModule,
536
+ NgbTimepickerModule,
537
+ ReactiveFormsModule,
538
+ DisabledDirective,
539
+ NgxValidateCoreModule,
540
+ NgbTypeaheadModule,
541
+ PasswordComponent,
542
+ CreateInjectorPipe
543
+ ], changeDetection: ChangeDetectionStrategy.OnPush, providers: [ExtensibleFormPropService], viewProviders: [
544
+ {
545
+ provide: ControlContainer,
546
+ useFactory: selfFactory,
547
+ deps: [[new Optional(), new SkipSelf(), ControlContainer]],
548
+ },
549
+ { provide: NgbDateAdapter, useClass: DateAdapter },
550
+ { provide: NgbTimeAdapter, useClass: TimeAdapter },
551
+ ], template: "<ng-container\r\n [ngSwitch]=\"getComponent(prop)\"\r\n *abpPermission=\"prop.permission; runChangeDetection: false\"\r\n>\r\n <ng-template ngSwitchCase=\"template\">\r\n <ng-container *ngComponentOutlet=\"prop.template; injector: injectorForCustomComponent\">\r\n </ng-container>\r\n </ng-template>\r\n\r\n <div [ngClass]=\"containerClassName\" class=\"mb-2\">\r\n <ng-template ngSwitchCase=\"input\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [autocomplete]=\"prop.autocomplete\"\r\n [type]=\"getType(prop)\"\r\n [abpDisabled]=\"disabled\"\r\n [readonly]=\"readonly\"\r\n class=\"form-control\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"hidden\">\r\n <input [formControlName]=\"prop.name\" type=\"hidden\" />\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"checkbox\">\r\n <div class=\"form-check\" validationTarget>\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n type=\"checkbox\"\r\n class=\"form-check-input\"\r\n />\r\n <ng-template\r\n [ngTemplateOutlet]=\"label\"\r\n [ngTemplateOutletContext]=\"{ $implicit: 'form-check-label' }\"\r\n ></ng-template>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"select\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <select\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n class=\"form-select form-control\"\r\n >\r\n <option\r\n *ngFor=\"let option of options$ | async; trackBy: track.by('value')\"\r\n [ngValue]=\"option.value\"\r\n >\r\n {{ option.key }}\r\n </option>\r\n </select>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"multiselect\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <select\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n multiple=\"multiple\"\r\n class=\"form-select form-control\"\r\n >\r\n <option\r\n *ngFor=\"let option of options$ | async; trackBy: track.by('value')\"\r\n [ngValue]=\"option.value\"\r\n >\r\n {{ option.key }}\r\n </option>\r\n </select>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"typeahead\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <div #typeahead class=\"position-relative\" validationStyle validationTarget>\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [autocomplete]=\"prop.autocomplete\"\r\n [abpDisabled]=\"disabled\"\r\n [ngbTypeahead]=\"search\"\r\n [editable]=\"false\"\r\n [inputFormatter]=\"typeaheadFormatter\"\r\n [resultFormatter]=\"typeaheadFormatter\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n [(ngModel)]=\"typeaheadModel\"\r\n (selectItem)=\"setTypeaheadValue($event.item)\"\r\n (blur)=\"setTypeaheadValue(typeaheadModel)\"\r\n [class.is-invalid]=\"typeahead.classList.contains('is-invalid')\"\r\n class=\"form-control\"\r\n />\r\n <input [formControlName]=\"prop.name\" type=\"hidden\" />\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"date\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <input\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n (click)=\"datepicker.open()\"\r\n (keyup.space)=\"datepicker.open()\"\r\n ngbDatepicker\r\n #datepicker=\"ngbDatepicker\"\r\n type=\"text\"\r\n class=\"form-control\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"time\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <ngb-timepicker [formControlName]=\"prop.name\"></ngb-timepicker>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"dateTime\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <abp-extensible-date-time-picker [prop]=\"prop\" [meridian]=\"meridian$ | async\" />\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"textarea\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <textarea\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n [readonly]=\"readonly\"\r\n class=\"form-control\"\r\n ></textarea>\r\n </ng-template>\r\n\r\n <ng-template ngSwitchCase=\"passwordinputgroup\">\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <div class=\"input-group form-group\" validationTarget>\r\n <input\r\n class=\"form-control\"\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpShowPassword]=\"showPassword\"\r\n />\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"showPassword = !showPassword\">\r\n <i\r\n class=\"fa\"\r\n aria-hidden=\"true\"\r\n [ngClass]=\"{\r\n 'fa-eye-slash': !showPassword,\r\n 'fa-eye': showPassword\r\n }\"\r\n ></i>\r\n </button>\r\n </div>\r\n </ng-template>\r\n\r\n <small *ngIf=\"prop.formText\" class=\"text-muted d-block\">{{\r\n prop.formText | abpLocalization\r\n }}</small>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-template #label let-classes>\r\n <label [htmlFor]=\"prop.id\" [ngClass]=\"classes || 'form-label'\">\r\n <ng-container *ngIf=\"prop.displayTextResolver; else displayNameTemplate\">\r\n {{ prop.displayTextResolver(data) | abpLocalization }}\r\n </ng-container>\r\n <ng-template #displayNameTemplate> {{ prop.displayName | abpLocalization }}</ng-template>\r\n {{ asterisk }}\r\n </label>\r\n</ng-template>\r\n" }]
552
+ }], propDecorators: { data: [{
553
+ type: Input
554
+ }], prop: [{
555
+ type: Input
556
+ }], first: [{
557
+ type: Input
558
+ }], fieldRef: [{
559
+ type: ViewChild,
560
+ args: ['field']
561
+ }] } });
562
+
563
+ class ActionList extends LinkedList {
564
+ }
565
+ class ActionData {
566
+ get data() {
567
+ return {
568
+ getInjected: this.getInjected,
569
+ index: this.index,
570
+ record: this.record,
571
+ };
572
+ }
573
+ }
574
+ class Action {
575
+ constructor(permission, visible = () => true, action = () => { }, btnClass, btnStyle) {
576
+ this.permission = permission;
577
+ this.visible = visible;
578
+ this.action = action;
579
+ this.btnClass = btnClass;
580
+ this.btnStyle = btnStyle;
581
+ }
582
+ }
583
+ class ActionsFactory {
584
+ constructor() {
585
+ this.contributorCallbacks = {};
586
+ }
587
+ get(name) {
588
+ this.contributorCallbacks[name] = this.contributorCallbacks[name] || [];
589
+ return new this._ctor(this.contributorCallbacks[name]);
590
+ }
591
+ }
592
+ class Actions {
593
+ get actions() {
594
+ const actionList = new this._ctor();
595
+ this.callbackList.forEach(callback => callback(actionList));
596
+ return actionList;
597
+ }
598
+ constructor(callbackList) {
599
+ this.callbackList = callbackList;
600
+ }
601
+ addContributor(contributeCallback) {
602
+ this.callbackList.push(contributeCallback);
603
+ }
604
+ clearContributors() {
605
+ while (this.callbackList.length)
606
+ this.callbackList.pop();
607
+ }
608
+ }
609
+
610
+ class EntityActionList extends ActionList {
611
+ }
612
+ class EntityActions extends Actions {
613
+ constructor() {
614
+ super(...arguments);
615
+ this._ctor = EntityActionList;
616
+ }
617
+ }
618
+ class EntityActionsFactory extends ActionsFactory {
619
+ constructor() {
620
+ super(...arguments);
621
+ this._ctor = EntityActions;
622
+ }
623
+ }
624
+ class EntityAction extends Action {
625
+ constructor(options) {
626
+ super(options.permission || '', options.visible, options.action);
627
+ this.text = options.text;
628
+ this.icon = options.icon || '';
629
+ this.btnClass = options.btnClass || 'btn btn-primary text-center';
630
+ this.btnStyle = options.btnStyle;
631
+ }
632
+ static create(options) {
633
+ return new EntityAction(options);
634
+ }
635
+ static createMany(arrayOfOptions) {
636
+ return arrayOfOptions.map(EntityAction.create);
637
+ }
638
+ }
639
+
640
+ class EntityPropList extends PropList {
641
+ }
642
+ class EntityProps extends Props {
643
+ constructor() {
644
+ super(...arguments);
645
+ this._ctor = EntityPropList;
646
+ }
647
+ }
648
+ class EntityPropsFactory extends PropsFactory {
649
+ constructor() {
650
+ super(...arguments);
651
+ this._ctor = EntityProps;
652
+ }
653
+ }
654
+ class EntityProp extends Prop {
655
+ constructor(options) {
656
+ super(options.type, options.name, options.displayName || '', options.permission || '', options.visible, options.isExtra);
657
+ this.columnVisible = options.columnVisible || (() => true);
658
+ this.columnWidth = options.columnWidth;
659
+ this.sortable = options.sortable || false;
660
+ this.valueResolver =
661
+ options.valueResolver ||
662
+ (data => of(escapeHtmlChars(data.record[this.name])));
663
+ if (options.action) {
664
+ this.action = options.action;
665
+ }
666
+ if (options.component) {
667
+ this.component = options.component;
668
+ }
669
+ if (options.enumList) {
670
+ this.enumList = options.enumList;
671
+ }
672
+ this.tooltip = options.tooltip;
673
+ }
674
+ static create(options) {
675
+ return new EntityProp(options);
676
+ }
677
+ static createMany(arrayOfOptions) {
678
+ return arrayOfOptions.map(EntityProp.create);
679
+ }
680
+ }
681
+
682
+ class ToolbarActionList extends ActionList {
683
+ }
684
+ class ToolbarActions extends Actions {
685
+ constructor() {
686
+ super(...arguments);
687
+ this._ctor = ToolbarActionList;
688
+ }
689
+ }
690
+ class ToolbarActionsFactory extends ActionsFactory {
691
+ constructor() {
692
+ super(...arguments);
693
+ this._ctor = ToolbarActions;
694
+ }
695
+ }
696
+ class ToolbarAction extends Action {
697
+ constructor(options) {
698
+ super(options.permission || '', options.visible, options.action);
699
+ this.text = options.text;
700
+ this.icon = options.icon || '';
701
+ if (options.btnClass) {
702
+ this.btnClass = options.btnClass;
703
+ }
704
+ }
705
+ static create(options) {
706
+ return new ToolbarAction(options);
707
+ }
708
+ static createMany(arrayOfOptions) {
709
+ return arrayOfOptions.map(ToolbarAction.create);
710
+ }
711
+ }
712
+ class ToolbarComponent extends Action {
713
+ constructor(options) {
714
+ super(options.permission || '', options.visible, options.action);
715
+ this.component = options.component;
716
+ }
717
+ static create(options) {
718
+ return new ToolbarComponent(options);
719
+ }
720
+ static createMany(arrayOfOptions) {
721
+ return arrayOfOptions.map(ToolbarComponent.create);
722
+ }
723
+ }
724
+
725
+ class ExtensionsService {
726
+ constructor() {
727
+ this.entityActions = new EntityActionsFactory();
728
+ this.toolbarActions = new ToolbarActionsFactory();
729
+ this.entityProps = new EntityPropsFactory();
730
+ this.createFormProps = new CreateFormPropsFactory();
731
+ this.editFormProps = new EditFormPropsFactory();
732
+ }
733
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
734
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensionsService, providedIn: 'root' }); }
735
+ }
736
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensionsService, decorators: [{
737
+ type: Injectable,
738
+ args: [{
739
+ providedIn: 'root',
740
+ }]
741
+ }] });
742
+
743
+ /* eslint-disable @angular-eslint/no-input-rename */
744
+ class PropDataDirective extends PropData {
745
+ constructor(tempRef, vcRef, injector) {
746
+ super();
747
+ this.tempRef = tempRef;
748
+ this.vcRef = vcRef;
749
+ this.getInjected = injector.get.bind(injector);
750
+ }
751
+ ngOnChanges() {
752
+ this.vcRef.clear();
753
+ this.vcRef.createEmbeddedView(this.tempRef, {
754
+ $implicit: this.data,
755
+ index: 0,
756
+ });
757
+ }
758
+ ngOnDestroy() {
759
+ this.vcRef.clear();
760
+ }
761
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: PropDataDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive }); }
762
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.4", type: PropDataDirective, isStandalone: true, selector: "[abpPropData]", inputs: { propList: ["abpPropDataFromList", "propList"], record: ["abpPropDataWithRecord", "record"], index: ["abpPropDataAtIndex", "index"] }, exportAs: ["abpPropData"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
763
+ }
764
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: PropDataDirective, decorators: [{
765
+ type: Directive,
766
+ args: [{
767
+ exportAs: 'abpPropData',
768
+ selector: '[abpPropData]',
769
+ standalone: true,
770
+ }]
771
+ }], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i0.Injector }], propDecorators: { propList: [{
772
+ type: Input,
773
+ args: ['abpPropDataFromList']
774
+ }], record: [{
775
+ type: Input,
776
+ args: ['abpPropDataWithRecord']
777
+ }], index: [{
778
+ type: Input,
779
+ args: ['abpPropDataAtIndex']
780
+ }] } });
781
+
782
+ class ExtensibleFormComponent {
783
+ constructor() {
784
+ this.extraPropertiesKey = EXTRA_PROPERTIES_KEY;
785
+ this.cdRef = inject(ChangeDetectorRef);
786
+ this.track = inject(TrackByService);
787
+ this.container = inject(ControlContainer);
788
+ this.extensions = inject(ExtensionsService);
789
+ this.identifier = inject(EXTENSIONS_IDENTIFIER);
790
+ }
791
+ set selectedRecord(record) {
792
+ const type = !record || JSON.stringify(record) === '{}' ? 'create' : 'edit';
793
+ const propList = this.extensions[`${type}FormProps`].get(this.identifier).props;
794
+ this.groupedPropList = this.createGroupedList(propList);
795
+ this.record = record;
796
+ }
797
+ createGroupedList(propList) {
798
+ const groupedFormPropList = new GroupedFormPropList();
799
+ propList.forEach(item => {
800
+ groupedFormPropList.addItem(item.value);
801
+ });
802
+ return groupedFormPropList;
803
+ }
804
+ get form() {
805
+ return (this.container ? this.container.control : { controls: {} });
806
+ }
807
+ get extraProperties() {
808
+ return (this.form.controls.extraProperties || { controls: {} });
809
+ }
810
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
811
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: ExtensibleFormComponent, isStandalone: true, selector: "abp-extensible-form", inputs: { selectedRecord: "selectedRecord" }, viewQueries: [{ propertyName: "formProps", predicate: ExtensibleFormPropComponent, descendants: true }], exportAs: ["abpExtensibleForm"], ngImport: i0, template: "<ng-container *ngIf=\"form\">\r\n\r\n <ng-container *ngFor=\"let groupedProp of groupedPropList.items\">\r\n <ng-container *abpPropData=\"let data; fromList: groupedProp.formPropList; withRecord: record\">\r\n\r\n <div *ngIf=\"groupedProp.group?.className; else withoutClassName\"\r\n [class]=\"groupedProp.group?.className\" [attr.data-name]=\"groupedProp.group?.className\">\r\n <ng-container [ngTemplateOutlet]=\"propListTemplate\" [ngTemplateOutletContext]=\"{groupedProp:groupedProp,data:data}\">\r\n </ng-container>\r\n </div>\r\n\r\n <ng-template #withoutClassName>\r\n <ng-container [ngTemplateOutlet]=\"propListTemplate\" [ngTemplateOutletContext]=\"{groupedProp:groupedProp,data:data}\">\r\n </ng-container>\r\n </ng-template>\r\n </ng-container>\r\n\r\n </ng-container>\r\n</ng-container>\r\n\r\n\r\n<ng-template let-groupedProp=\"groupedProp\" let-data=\"data\" #propListTemplate>\r\n <ng-container *ngFor=\"let prop of groupedProp.formPropList; let first = first; trackBy: track.by('name')\">\r\n <ng-container *ngIf=\"prop.visible(data)\">\r\n <ng-container\r\n [formGroupName]=\"extraPropertiesKey\"\r\n *ngIf=\"extraProperties.controls[prop.name]; else tempDefault\"\r\n >\r\n <abp-extensible-form-prop [prop]=\"prop\" [data]=\"data\"\r\n [class]=\"prop.className\">\r\n </abp-extensible-form-prop>\r\n </ng-container>\r\n\r\n <ng-template #tempDefault>\r\n <abp-extensible-form-prop\r\n [class]=\"prop.className\"\r\n *ngIf=\"form.get(prop.name)\"\r\n [prop]=\"prop\"\r\n [data]=\"data\"\r\n [first]=\"first\"\r\n ></abp-extensible-form-prop>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n</ng-template>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: PropDataDirective, selector: "[abpPropData]", inputs: ["abpPropDataFromList", "abpPropDataWithRecord", "abpPropDataAtIndex"], exportAs: ["abpPropData"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "component", type: ExtensibleFormPropComponent, selector: "abp-extensible-form-prop", inputs: ["data", "prop", "first"] }], viewProviders: [
812
+ {
813
+ provide: ControlContainer,
814
+ useFactory: selfFactory,
815
+ deps: [[new Optional(), new SkipSelf(), ControlContainer]],
816
+ },
817
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
818
+ }
819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleFormComponent, decorators: [{
820
+ type: Component,
821
+ args: [{ exportAs: 'abpExtensibleForm', selector: 'abp-extensible-form', standalone: true, imports: [CommonModule, PropDataDirective, ReactiveFormsModule, ExtensibleFormPropComponent], changeDetection: ChangeDetectionStrategy.OnPush, viewProviders: [
822
+ {
823
+ provide: ControlContainer,
824
+ useFactory: selfFactory,
825
+ deps: [[new Optional(), new SkipSelf(), ControlContainer]],
826
+ },
827
+ ], template: "<ng-container *ngIf=\"form\">\r\n\r\n <ng-container *ngFor=\"let groupedProp of groupedPropList.items\">\r\n <ng-container *abpPropData=\"let data; fromList: groupedProp.formPropList; withRecord: record\">\r\n\r\n <div *ngIf=\"groupedProp.group?.className; else withoutClassName\"\r\n [class]=\"groupedProp.group?.className\" [attr.data-name]=\"groupedProp.group?.className\">\r\n <ng-container [ngTemplateOutlet]=\"propListTemplate\" [ngTemplateOutletContext]=\"{groupedProp:groupedProp,data:data}\">\r\n </ng-container>\r\n </div>\r\n\r\n <ng-template #withoutClassName>\r\n <ng-container [ngTemplateOutlet]=\"propListTemplate\" [ngTemplateOutletContext]=\"{groupedProp:groupedProp,data:data}\">\r\n </ng-container>\r\n </ng-template>\r\n </ng-container>\r\n\r\n </ng-container>\r\n</ng-container>\r\n\r\n\r\n<ng-template let-groupedProp=\"groupedProp\" let-data=\"data\" #propListTemplate>\r\n <ng-container *ngFor=\"let prop of groupedProp.formPropList; let first = first; trackBy: track.by('name')\">\r\n <ng-container *ngIf=\"prop.visible(data)\">\r\n <ng-container\r\n [formGroupName]=\"extraPropertiesKey\"\r\n *ngIf=\"extraProperties.controls[prop.name]; else tempDefault\"\r\n >\r\n <abp-extensible-form-prop [prop]=\"prop\" [data]=\"data\"\r\n [class]=\"prop.className\">\r\n </abp-extensible-form-prop>\r\n </ng-container>\r\n\r\n <ng-template #tempDefault>\r\n <abp-extensible-form-prop\r\n [class]=\"prop.className\"\r\n *ngIf=\"form.get(prop.name)\"\r\n [prop]=\"prop\"\r\n [data]=\"data\"\r\n [first]=\"first\"\r\n ></abp-extensible-form-prop>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n</ng-template>\r\n" }]
828
+ }], propDecorators: { formProps: [{
829
+ type: ViewChildren,
830
+ args: [ExtensibleFormPropComponent]
831
+ }], selectedRecord: [{
832
+ type: Input
833
+ }] } });
834
+
835
+ // Fix for https://github.com/angular/angular/issues/23904
836
+ // @dynamic
837
+ class AbstractActionsComponent extends ActionData {
838
+ constructor(injector) {
839
+ super();
840
+ this.getInjected = injector.get.bind(injector);
841
+ const extensions = injector.get(ExtensionsService);
842
+ const name = injector.get(EXTENSIONS_IDENTIFIER);
843
+ const type = injector.get(EXTENSIONS_ACTION_TYPE);
844
+ this.actionList = extensions[type].get(name).actions;
845
+ }
846
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: AbstractActionsComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive }); }
847
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.4", type: AbstractActionsComponent, inputs: { record: "record" }, usesInheritance: true, ngImport: i0 }); }
848
+ }
849
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: AbstractActionsComponent, decorators: [{
850
+ type: Directive
851
+ }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { record: [{
852
+ type: Input
853
+ }] } });
854
+
855
+ class GridActionsComponent extends AbstractActionsComponent {
856
+ constructor(injector) {
857
+ super(injector);
858
+ this.icon = 'fa fa-cog';
859
+ this.text = '';
860
+ this.trackByFn = (_, item) => item.text;
861
+ }
862
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: GridActionsComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
863
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: GridActionsComponent, isStandalone: true, selector: "abp-grid-actions", inputs: { icon: "icon", index: "index", text: "text" }, providers: [
864
+ {
865
+ provide: EXTENSIONS_ACTION_TYPE,
866
+ useValue: 'entityActions',
867
+ },
868
+ ], exportAs: ["abpGridActions"], usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"actionList.length > 1\" ngbDropdown container=\"body\" class=\"d-inline-block\">\r\n <button\r\n class=\"btn btn-primary btn-sm dropdown-toggle\"\r\n data-toggle=\"dropdown\"\r\n aria-haspopup=\"true\"\r\n ngbDropdownToggle\r\n >\r\n <i [ngClass]=\"icon\" [class.me-1]=\"icon\"></i>{{ text | abpLocalization }}\r\n </button>\r\n <div ngbDropdownMenu>\r\n <ng-container\r\n *ngFor=\"let action of actionList; trackBy: trackByFn\"\r\n [ngTemplateOutlet]=\"dropDownBtnItemTmp\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n >\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<ng-container\r\n *ngIf=\"actionList.length === 1\"\r\n [ngTemplateOutlet]=\"btnTmp\"\r\n [ngTemplateOutletContext]=\"{ $implicit: actionList.get(0).value }\"\r\n></ng-container>\r\n\r\n<ng-template #dropDownBtnItemTmp let-action>\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <button\r\n ngbDropdownItem\r\n *abpPermission=\"action.permission; runChangeDetection: false\"\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"buttonContentTmp; context: { $implicit: action }\"\r\n ></ng-container>\r\n </button>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #buttonContentTmp let-action>\r\n <i [ngClass]=\"action.icon\" [class.me-1]=\"action.icon\"></i>\r\n <span *ngIf=\"action.icon; else ellipsis\">{{ action.text | abpLocalization }}</span>\r\n <ng-template #ellipsis>\r\n <div abpEllipsis>{{ action.text | abpLocalization }}</div>\r\n </ng-template>\r\n</ng-template>\r\n\r\n<ng-template #btnTmp let-action>\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <button\r\n *abpPermission=\"action.permission; runChangeDetection: false\"\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n [class]=\"action.btnClass\"\r\n [style]=\"action.btnStyle\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"buttonContentTmp; context: { $implicit: action }\"\r\n ></ng-container>\r\n </button>\r\n </ng-container>\r\n</ng-template>\r\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2$1.LocalizationPipe, name: "abpLocalization" }, { kind: "directive", type: i2$1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission", "abpPermissionRunChangeDetection"] }, { kind: "ngmodule", type: NgbDropdownModule }, { kind: "directive", type: i3.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i3.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i3.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i3.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["tabindex", "disabled"] }, { kind: "directive", type: i3.NgbDropdownButtonItem, selector: "button[ngbDropdownItem]" }, { kind: "directive", type: EllipsisDirective, selector: "[abpEllipsis]", inputs: ["abpEllipsis", "title", "abpEllipsisEnabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
869
+ }
870
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: GridActionsComponent, decorators: [{
871
+ type: Component,
872
+ args: [{ exportAs: 'abpGridActions', standalone: true, imports: [CoreModule, NgbDropdownModule, EllipsisDirective], selector: 'abp-grid-actions', providers: [
873
+ {
874
+ provide: EXTENSIONS_ACTION_TYPE,
875
+ useValue: 'entityActions',
876
+ },
877
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"actionList.length > 1\" ngbDropdown container=\"body\" class=\"d-inline-block\">\r\n <button\r\n class=\"btn btn-primary btn-sm dropdown-toggle\"\r\n data-toggle=\"dropdown\"\r\n aria-haspopup=\"true\"\r\n ngbDropdownToggle\r\n >\r\n <i [ngClass]=\"icon\" [class.me-1]=\"icon\"></i>{{ text | abpLocalization }}\r\n </button>\r\n <div ngbDropdownMenu>\r\n <ng-container\r\n *ngFor=\"let action of actionList; trackBy: trackByFn\"\r\n [ngTemplateOutlet]=\"dropDownBtnItemTmp\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n >\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<ng-container\r\n *ngIf=\"actionList.length === 1\"\r\n [ngTemplateOutlet]=\"btnTmp\"\r\n [ngTemplateOutletContext]=\"{ $implicit: actionList.get(0).value }\"\r\n></ng-container>\r\n\r\n<ng-template #dropDownBtnItemTmp let-action>\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <button\r\n ngbDropdownItem\r\n *abpPermission=\"action.permission; runChangeDetection: false\"\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"buttonContentTmp; context: { $implicit: action }\"\r\n ></ng-container>\r\n </button>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #buttonContentTmp let-action>\r\n <i [ngClass]=\"action.icon\" [class.me-1]=\"action.icon\"></i>\r\n <span *ngIf=\"action.icon; else ellipsis\">{{ action.text | abpLocalization }}</span>\r\n <ng-template #ellipsis>\r\n <div abpEllipsis>{{ action.text | abpLocalization }}</div>\r\n </ng-template>\r\n</ng-template>\r\n\r\n<ng-template #btnTmp let-action>\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <button\r\n *abpPermission=\"action.permission; runChangeDetection: false\"\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n [class]=\"action.btnClass\"\r\n [style]=\"action.btnStyle\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"buttonContentTmp; context: { $implicit: action }\"\r\n ></ng-container>\r\n </button>\r\n </ng-container>\r\n</ng-template>\r\n" }]
878
+ }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { icon: [{
879
+ type: Input
880
+ }], index: [{
881
+ type: Input
882
+ }], text: [{
883
+ type: Input
884
+ }] } });
885
+
886
+ const DEFAULT_ACTIONS_COLUMN_WIDTH = 150;
887
+ class ExtensibleTableComponent {
888
+ set actionsText(value) {
889
+ this._actionsText = value;
890
+ }
891
+ get actionsText() {
892
+ return this._actionsText ?? (this.actionList.length > 1 ? 'AbpUi::Actions' : '');
893
+ }
894
+ set actionsColumnWidth(width) {
895
+ this.setColumnWidths(width ? Number(width) : undefined);
896
+ }
897
+ #injector;
898
+ constructor() {
899
+ this.tableActivate = new EventEmitter();
900
+ this.trackByFn = (_, item) => item.name;
901
+ this.locale = inject(LOCALE_ID);
902
+ this.config = inject(ConfigStateService);
903
+ this.entityPropTypeClasses = inject(ENTITY_PROP_TYPE_CLASSES);
904
+ this.#injector = inject(Injector);
905
+ this.getInjected = this.#injector.get.bind(this.#injector);
906
+ const extensions = this.#injector.get(ExtensionsService);
907
+ const name = this.#injector.get(EXTENSIONS_IDENTIFIER);
908
+ this.propList = extensions.entityProps.get(name).props;
909
+ this.actionList = extensions['entityActions'].get(name)
910
+ .actions;
911
+ const permissionService = this.#injector.get(PermissionService);
912
+ this.hasAtLeastOnePermittedAction =
913
+ permissionService.filterItemsByPolicy(this.actionList.toArray().map(action => ({ requiredPolicy: action.permission }))).length > 0;
914
+ this.setColumnWidths(DEFAULT_ACTIONS_COLUMN_WIDTH);
915
+ }
916
+ setColumnWidths(actionsColumn) {
917
+ const widths = [actionsColumn];
918
+ this.propList.forEach(({ value: prop }) => {
919
+ widths.push(prop.columnWidth);
920
+ });
921
+ this.columnWidths = widths;
922
+ }
923
+ getDate(value, format) {
924
+ return value && format ? formatDate(value, format, this.locale) : '';
925
+ }
926
+ getIcon(value) {
927
+ return value
928
+ ? '<div class="text-success"><i class="fa fa-check" aria-hidden="true"></i></div>'
929
+ : '<div class="text-danger"><i class="fa fa-times" aria-hidden="true"></i></div>';
930
+ }
931
+ getEnum(rowValue, list) {
932
+ if (!list || list.length < 1)
933
+ return rowValue;
934
+ const { key } = list.find(({ value }) => value === rowValue) || {};
935
+ return key;
936
+ }
937
+ getContent(prop, data) {
938
+ return prop.valueResolver(data).pipe(map(value => {
939
+ switch (prop.type) {
940
+ case "boolean" /* ePropType.Boolean */:
941
+ return this.getIcon(value);
942
+ case "date" /* ePropType.Date */:
943
+ return this.getDate(value, getShortDateFormat(this.config));
944
+ case "time" /* ePropType.Time */:
945
+ return this.getDate(value, getShortTimeFormat(this.config));
946
+ case "datetime" /* ePropType.DateTime */:
947
+ return this.getDate(value, getShortDateShortTimeFormat(this.config));
948
+ case "enum" /* ePropType.Enum */:
949
+ return this.getEnum(value, prop.enumList || []);
950
+ default:
951
+ return value;
952
+ // More types can be handled in the future
953
+ }
954
+ }));
955
+ }
956
+ ngOnChanges({ data }) {
957
+ if (!data?.currentValue)
958
+ return;
959
+ if (data.currentValue.length < 1) {
960
+ this.list.totalCount = this.recordsTotal;
961
+ }
962
+ this.data = data.currentValue.map((record, index) => {
963
+ this.propList.forEach(prop => {
964
+ const propData = { getInjected: this.getInjected, record, index };
965
+ const value = this.getContent(prop.value, propData);
966
+ const propKey = `_${prop.value.name}`;
967
+ record[propKey] = {
968
+ visible: prop.value.visible(propData),
969
+ value,
970
+ };
971
+ if (prop.value.component) {
972
+ record[propKey].injector = Injector.create({
973
+ providers: [
974
+ {
975
+ provide: PROP_DATA_STREAM,
976
+ useValue: value,
977
+ },
978
+ ],
979
+ parent: this.#injector,
980
+ });
981
+ record[propKey].component = prop.value.component;
982
+ }
983
+ });
984
+ return record;
985
+ });
986
+ }
987
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
988
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: ExtensibleTableComponent, isStandalone: true, selector: "abp-extensible-table", inputs: { actionsText: "actionsText", data: "data", list: "list", recordsTotal: "recordsTotal", actionsColumnWidth: "actionsColumnWidth", actionsTemplate: "actionsTemplate" }, outputs: { tableActivate: "tableActivate" }, exportAs: ["abpExtensibleTable"], usesOnChanges: true, ngImport: i0, template: "<ngx-datatable\r\n default\r\n [rows]=\"data\"\r\n [count]=\"recordsTotal\"\r\n [list]=\"list\"\r\n (activate)=\"tableActivate.emit($event)\"\r\n>\r\n <ngx-datatable-column\r\n *ngIf=\"actionsTemplate || (actionList.length && hasAtLeastOnePermittedAction)\"\r\n [name]=\"actionsText | abpLocalization\"\r\n [maxWidth]=\"columnWidths[0]\"\r\n [width]=\"columnWidths[0]\"\r\n [sortable]=\"false\"\r\n >\r\n <ng-template let-row=\"row\" let-i=\"rowIndex\" ngx-datatable-cell-template>\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate || gridActions; context: { $implicit: row, index: i }\"\r\n ></ng-container>\r\n <ng-template #gridActions>\r\n <abp-grid-actions [index]=\"i\" [record]=\"row\" text=\"AbpUi::Actions\"></abp-grid-actions>\r\n </ng-template>\r\n </ng-template>\r\n </ngx-datatable-column>\r\n\r\n <ng-container *ngFor=\"let prop of propList; let i = index; trackBy: trackByFn\">\r\n <ngx-datatable-column\r\n *abpVisible=\"prop.columnVisible(getInjected)\"\r\n [width]=\"columnWidths[i + 1] || 200\"\r\n [name]=\"prop.displayName | abpLocalization\"\r\n [prop]=\"prop.name\"\r\n [sortable]=\"prop.sortable\"\r\n >\r\n <ng-template ngx-datatable-header-template let-column=\"column\">\r\n <span\r\n *ngIf=\"prop.tooltip; else elseBlock\"\r\n [ngbTooltip]=\"prop.tooltip | abpLocalization\"\r\n container=\"body\"\r\n >\r\n {{ column.name }} <i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i>\r\n </span>\r\n <ng-template #elseBlock>\r\n {{ column.name }}\r\n </ng-template>\r\n </ng-template>\r\n <ng-template let-row=\"row\" let-i=\"index\" ngx-datatable-cell-template>\r\n <ng-container *abpPermission=\"prop.permission; runChangeDetection: false\">\r\n <ng-container *abpVisible=\"row['_' + prop.name]?.visible\">\r\n <div\r\n *ngIf=\"!row['_' + prop.name].component; else component\"\r\n [innerHTML]=\"row['_' + prop.name]?.value | async\"\r\n (click)=\"\r\n prop.action && prop.action({ getInjected: getInjected, record: row, index: i })\r\n \"\r\n [ngClass]=\"entityPropTypeClasses[prop.type]\"\r\n [class.pointer]=\"prop.action\"\r\n ></div>\r\n </ng-container>\r\n <ng-template #component>\r\n <ng-container\r\n *ngComponentOutlet=\"\r\n row['_' + prop.name].component;\r\n injector: row['_' + prop.name].injector\r\n \"\r\n ></ng-container>\r\n </ng-template>\r\n </ng-container>\r\n </ng-template>\r\n </ngx-datatable-column>\r\n </ng-container>\r\n</ngx-datatable>\r\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.LocalizationPipe, name: "abpLocalization" }, { kind: "directive", type: i2$1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission", "abpPermissionRunChangeDetection"] }, { kind: "directive", type: AbpVisibleDirective, selector: "[abpVisible]", inputs: ["abpVisible"] }, { kind: "ngmodule", type: NgxDatatableModule }, { kind: "component", type: i3$1.DatatableComponent, selector: "ngx-datatable", inputs: ["targetMarkerTemplate", "rows", "groupRowsBy", "groupedRows", "columns", "selected", "scrollbarV", "scrollbarH", "rowHeight", "columnMode", "headerHeight", "footerHeight", "externalPaging", "externalSorting", "limit", "count", "offset", "loadingIndicator", "selectionType", "reorderable", "swapColumns", "sortType", "sorts", "cssClasses", "messages", "rowClass", "selectCheck", "displayCheck", "groupExpansionDefault", "trackByProp", "selectAllRowsOnPage", "virtualization", "treeFromRelation", "treeToRelation", "summaryRow", "summaryHeight", "summaryPosition", "rowIdentity"], outputs: ["scroll", "activate", "select", "sort", "page", "reorder", "resize", "tableContextmenu", "treeAction"] }, { kind: "directive", type: i3$1.DataTableColumnDirective, selector: "ngx-datatable-column", inputs: ["name", "prop", "frozenLeft", "frozenRight", "flexGrow", "resizeable", "comparator", "pipe", "sortable", "draggable", "canAutoResize", "minWidth", "width", "maxWidth", "checkboxable", "headerCheckboxable", "headerClass", "cellClass", "isTreeColumn", "treeLevelIndent", "summaryFunc", "summaryTemplate", "cellTemplate", "headerTemplate", "treeToggleTemplate"] }, { kind: "directive", type: i3$1.DataTableColumnHeaderDirective, selector: "[ngx-datatable-header-template]" }, { kind: "directive", type: i3$1.DataTableColumnCellDirective, selector: "[ngx-datatable-cell-template]" }, { kind: "component", type: GridActionsComponent, selector: "abp-grid-actions", inputs: ["icon", "index", "text"], exportAs: ["abpGridActions"] }, { kind: "directive", type: NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "tooltipContext", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }, { kind: "directive", type: NgxDatatableDefaultDirective, selector: "ngx-datatable[default]", inputs: ["class"], exportAs: ["ngxDatatableDefault"] }, { kind: "directive", type: NgxDatatableListDirective, selector: "ngx-datatable[list]", inputs: ["list"], exportAs: ["ngxDatatableList"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
989
+ }
990
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleTableComponent, decorators: [{
991
+ type: Component,
992
+ args: [{ exportAs: 'abpExtensibleTable', selector: 'abp-extensible-table', standalone: true, imports: [
993
+ CoreModule,
994
+ AbpVisibleDirective,
995
+ NgxDatatableModule,
996
+ GridActionsComponent,
997
+ NgbTooltip,
998
+ NgxDatatableDefaultDirective,
999
+ NgxDatatableListDirective,
1000
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ngx-datatable\r\n default\r\n [rows]=\"data\"\r\n [count]=\"recordsTotal\"\r\n [list]=\"list\"\r\n (activate)=\"tableActivate.emit($event)\"\r\n>\r\n <ngx-datatable-column\r\n *ngIf=\"actionsTemplate || (actionList.length && hasAtLeastOnePermittedAction)\"\r\n [name]=\"actionsText | abpLocalization\"\r\n [maxWidth]=\"columnWidths[0]\"\r\n [width]=\"columnWidths[0]\"\r\n [sortable]=\"false\"\r\n >\r\n <ng-template let-row=\"row\" let-i=\"rowIndex\" ngx-datatable-cell-template>\r\n <ng-container\r\n *ngTemplateOutlet=\"actionsTemplate || gridActions; context: { $implicit: row, index: i }\"\r\n ></ng-container>\r\n <ng-template #gridActions>\r\n <abp-grid-actions [index]=\"i\" [record]=\"row\" text=\"AbpUi::Actions\"></abp-grid-actions>\r\n </ng-template>\r\n </ng-template>\r\n </ngx-datatable-column>\r\n\r\n <ng-container *ngFor=\"let prop of propList; let i = index; trackBy: trackByFn\">\r\n <ngx-datatable-column\r\n *abpVisible=\"prop.columnVisible(getInjected)\"\r\n [width]=\"columnWidths[i + 1] || 200\"\r\n [name]=\"prop.displayName | abpLocalization\"\r\n [prop]=\"prop.name\"\r\n [sortable]=\"prop.sortable\"\r\n >\r\n <ng-template ngx-datatable-header-template let-column=\"column\">\r\n <span\r\n *ngIf=\"prop.tooltip; else elseBlock\"\r\n [ngbTooltip]=\"prop.tooltip | abpLocalization\"\r\n container=\"body\"\r\n >\r\n {{ column.name }} <i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i>\r\n </span>\r\n <ng-template #elseBlock>\r\n {{ column.name }}\r\n </ng-template>\r\n </ng-template>\r\n <ng-template let-row=\"row\" let-i=\"index\" ngx-datatable-cell-template>\r\n <ng-container *abpPermission=\"prop.permission; runChangeDetection: false\">\r\n <ng-container *abpVisible=\"row['_' + prop.name]?.visible\">\r\n <div\r\n *ngIf=\"!row['_' + prop.name].component; else component\"\r\n [innerHTML]=\"row['_' + prop.name]?.value | async\"\r\n (click)=\"\r\n prop.action && prop.action({ getInjected: getInjected, record: row, index: i })\r\n \"\r\n [ngClass]=\"entityPropTypeClasses[prop.type]\"\r\n [class.pointer]=\"prop.action\"\r\n ></div>\r\n </ng-container>\r\n <ng-template #component>\r\n <ng-container\r\n *ngComponentOutlet=\"\r\n row['_' + prop.name].component;\r\n injector: row['_' + prop.name].injector\r\n \"\r\n ></ng-container>\r\n </ng-template>\r\n </ng-container>\r\n </ng-template>\r\n </ngx-datatable-column>\r\n </ng-container>\r\n</ngx-datatable>\r\n" }]
1001
+ }], ctorParameters: () => [], propDecorators: { actionsText: [{
1002
+ type: Input
1003
+ }], data: [{
1004
+ type: Input
1005
+ }], list: [{
1006
+ type: Input
1007
+ }], recordsTotal: [{
1008
+ type: Input
1009
+ }], actionsColumnWidth: [{
1010
+ type: Input
1011
+ }], actionsTemplate: [{
1012
+ type: Input
1013
+ }], tableActivate: [{
1014
+ type: Output
1015
+ }] } });
1016
+
1017
+ class PageToolbarComponent extends AbstractActionsComponent {
1018
+ constructor(injector) {
1019
+ super(injector);
1020
+ this.injector = injector;
1021
+ this.defaultBtnClass = 'btn btn-sm btn-primary';
1022
+ this.getData = () => this.data;
1023
+ this.trackByFn = (_, item) => item.action || item.component;
1024
+ }
1025
+ asToolbarAction(value) {
1026
+ return {
1027
+ value: value,
1028
+ };
1029
+ }
1030
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: PageToolbarComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
1031
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: PageToolbarComponent, isStandalone: true, selector: "abp-page-toolbar", providers: [
1032
+ {
1033
+ provide: EXTENSIONS_ACTION_TYPE,
1034
+ useValue: 'toolbarActions',
1035
+ },
1036
+ ], exportAs: ["abpPageToolbar"], usesInheritance: true, ngImport: i0, template: "<div class=\"row justify-content-end mx-0 gap-2\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-0 pt-0 \"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission;runChangeDetection: false\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: record | createInjector: action:this\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <ng-container *ngIf=\"asToolbarAction(action).value as toolbarAction\">\r\n <button\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n [ngClass]=\"toolbarAction.btnClass ? toolbarAction.btnClass : defaultBtnClass\"\r\n class=\"d-inline-flex align-items-center gap-1\"\r\n >\r\n <i [ngClass]=\"toolbarAction.icon\" [class.me-1]=\"toolbarAction.icon\"></i>\r\n {{ toolbarAction.text | abpLocalization }}\r\n </button>\r\n </ng-container>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2$1.LocalizationPipe, name: "abpLocalization" }, { kind: "directive", type: i2$1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission", "abpPermissionRunChangeDetection"] }, { kind: "pipe", type: CreateInjectorPipe, name: "createInjector" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1037
+ }
1038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: PageToolbarComponent, decorators: [{
1039
+ type: Component,
1040
+ args: [{ exportAs: 'abpPageToolbar', selector: 'abp-page-toolbar', standalone: true, imports: [CoreModule, CreateInjectorPipe], providers: [
1041
+ {
1042
+ provide: EXTENSIONS_ACTION_TYPE,
1043
+ useValue: 'toolbarActions',
1044
+ },
1045
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"row justify-content-end mx-0 gap-2\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-0 pt-0 \"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission;runChangeDetection: false\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: record | createInjector: action:this\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <ng-container *ngIf=\"asToolbarAction(action).value as toolbarAction\">\r\n <button\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n [ngClass]=\"toolbarAction.btnClass ? toolbarAction.btnClass : defaultBtnClass\"\r\n class=\"d-inline-flex align-items-center gap-1\"\r\n >\r\n <i [ngClass]=\"toolbarAction.icon\" [class.me-1]=\"toolbarAction.icon\"></i>\r\n {{ toolbarAction.text | abpLocalization }}\r\n </button>\r\n </ng-container>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n" }]
1046
+ }], ctorParameters: () => [{ type: i0.Injector }] });
1047
+
1048
+ var objectExtensions = /*#__PURE__*/Object.freeze({
1049
+ __proto__: null
1050
+ });
1051
+
1052
+ const EXTENSIBLE_FORM_VIEW_PROVIDER = { provide: ControlContainer, useExisting: FormGroupDirective };
1053
+
1054
+ function mergeWithDefaultActions(extension, defaultActions, ...contributors) {
1055
+ Object.keys(defaultActions).forEach((name) => {
1056
+ const actions = extension.get(name);
1057
+ actions.clearContributors();
1058
+ actions.addContributor((actionList) => actionList.addManyTail(defaultActions[name]));
1059
+ contributors.forEach(contributor => (contributor[name] || []).forEach((callback) => actions.addContributor(callback)));
1060
+ });
1061
+ }
1062
+
1063
+ function generateFormFromProps(data) {
1064
+ const extensions = data.getInjected((ExtensionsService));
1065
+ const identifier = data.getInjected(EXTENSIONS_IDENTIFIER);
1066
+ const form = new UntypedFormGroup({});
1067
+ const extraForm = new UntypedFormGroup({});
1068
+ form.addControl(EXTRA_PROPERTIES_KEY, extraForm);
1069
+ const record = data.record || {};
1070
+ const type = JSON.stringify(record) === '{}' ? 'create' : 'edit';
1071
+ const props = extensions[`${type}FormProps`].get(identifier).props;
1072
+ const extraProperties = record[EXTRA_PROPERTIES_KEY] || {};
1073
+ props.forEach(({ value: prop }) => {
1074
+ const name = prop.name;
1075
+ const isExtraProperty = prop.isExtra || name in extraProperties;
1076
+ let value = isExtraProperty ? extraProperties[name] : name in record ? record[name] : undefined;
1077
+ if (typeof value === 'undefined')
1078
+ value = prop.defaultValue;
1079
+ if (value) {
1080
+ let adapter;
1081
+ switch (prop.type) {
1082
+ case "date" /* ePropType.Date */:
1083
+ adapter = new DateAdapter();
1084
+ value = adapter.toModel(adapter.fromModel(value));
1085
+ break;
1086
+ case "time" /* ePropType.Time */:
1087
+ adapter = new TimeAdapter();
1088
+ value = adapter.toModel(adapter.fromModel(value));
1089
+ break;
1090
+ case "datetime" /* ePropType.DateTime */:
1091
+ adapter = new DateTimeAdapter();
1092
+ value = adapter.toModel(adapter.fromModel(value));
1093
+ break;
1094
+ default:
1095
+ break;
1096
+ }
1097
+ }
1098
+ const formControl = new UntypedFormControl(value, {
1099
+ asyncValidators: prop.asyncValidators(data),
1100
+ validators: prop.validators(data),
1101
+ });
1102
+ (isExtraProperty ? extraForm : form).addControl(name, formControl);
1103
+ });
1104
+ return form;
1105
+ }
1106
+
1107
+ function createExtraPropertyValueResolver(name) {
1108
+ return (data) => of(data.record[EXTRA_PROPERTIES_KEY][name]);
1109
+ }
1110
+ function mergeWithDefaultProps(extension, defaultProps, ...contributors) {
1111
+ Object.keys(defaultProps).forEach((name) => {
1112
+ const props = extension.get(name);
1113
+ props.clearContributors();
1114
+ props.addContributor((propList) => propList.addManyTail(defaultProps[name]));
1115
+ contributors.forEach(contributor => (contributor[name] || []).forEach((callback) => props.addContributor(callback)));
1116
+ });
1117
+ }
1118
+
1119
+ function createEnum(members) {
1120
+ const enumObject = {};
1121
+ members.forEach(({ name = '', value }) => {
1122
+ enumObject[(enumObject[name] = value)] = name;
1123
+ });
1124
+ return enumObject;
1125
+ }
1126
+ function createEnumValueResolver(enumType, lookupEnum, propName) {
1127
+ return data => {
1128
+ const value = data.record[EXTRA_PROPERTIES_KEY][propName];
1129
+ const key = lookupEnum.transformed[value];
1130
+ const l10n = data.getInjected(LocalizationService);
1131
+ const localizeEnum = createEnumLocalizer(l10n, enumType, lookupEnum);
1132
+ return createLocalizationStream(l10n, localizeEnum(key));
1133
+ };
1134
+ }
1135
+ function createEnumOptions(enumType, lookupEnum) {
1136
+ return data => {
1137
+ const l10n = data.getInjected(LocalizationService);
1138
+ const localizeEnum = createEnumLocalizer(l10n, enumType, lookupEnum);
1139
+ return createLocalizationStream(l10n, lookupEnum.fields.map(({ name = '', value }) => ({
1140
+ key: localizeEnum(name),
1141
+ value,
1142
+ })));
1143
+ };
1144
+ }
1145
+ function createLocalizationStream(l10n, mapTarget) {
1146
+ return merge(of(null), l10n.languageChange$).pipe(map(() => mapTarget));
1147
+ }
1148
+ function createEnumLocalizer(l10n, enumType, lookupEnum) {
1149
+ const resource = lookupEnum.localizationResource;
1150
+ const shortType = getShortEnumType(enumType);
1151
+ return key => l10n.localizeWithFallbackSync([resource || ''], ['Enum:' + shortType + '.' + key, shortType + '.' + key, key], key);
1152
+ }
1153
+ function getShortEnumType(enumType) {
1154
+ return enumType.split('.').pop();
1155
+ }
1156
+
1157
+ function createDisplayNameLocalizationPipeKeyGenerator(localization) {
1158
+ const generateLocalizationPipeKey = createLocalizationPipeKeyGenerator(localization);
1159
+ return (displayName, fallback) => {
1160
+ if (displayName && displayName.name)
1161
+ return generateLocalizationPipeKey([displayName.resource || ''], [displayName.name], displayName.name);
1162
+ const key = generateLocalizationPipeKey([fallback.resource || ''], ['DisplayName:' + fallback.name], undefined);
1163
+ if (key)
1164
+ return key;
1165
+ return generateLocalizationPipeKey([fallback.resource || ''], [fallback.name || ''], fallback.name);
1166
+ };
1167
+ }
1168
+
1169
+ function getValidatorsFromProperty(property) {
1170
+ const validators = [];
1171
+ property.attributes.forEach(attr => {
1172
+ if (attr.typeSimple && attr.typeSimple in AbpValidators) {
1173
+ validators.push(AbpValidators[attr.typeSimple](attr.config));
1174
+ }
1175
+ });
1176
+ return validators;
1177
+ }
1178
+
1179
+ function selectObjectExtensions(configState) {
1180
+ return configState.getOne$('objectExtensions');
1181
+ }
1182
+ function selectLocalization(configState) {
1183
+ return configState.getOne$('localization');
1184
+ }
1185
+ function selectEnums(configState) {
1186
+ return selectObjectExtensions(configState).pipe(map((extensions) => Object.keys(extensions.enums).reduce((acc, key) => {
1187
+ const { fields, localizationResource } = extensions.enums[key];
1188
+ acc[key] = {
1189
+ fields,
1190
+ localizationResource,
1191
+ transformed: createEnum(fields),
1192
+ };
1193
+ return acc;
1194
+ }, {})));
1195
+ }
1196
+ function getObjectExtensionEntitiesFromStore(configState, moduleKey) {
1197
+ return selectObjectExtensions(configState).pipe(map(extensions => {
1198
+ if (!extensions)
1199
+ return null;
1200
+ return (extensions.modules[moduleKey] || {})
1201
+ .entities;
1202
+ }), map(entities => (isUndefined(entities) ? {} : entities)), filter(Boolean), take(1));
1203
+ }
1204
+ function mapEntitiesToContributors(configState, resource) {
1205
+ return pipe(switchMap((entities) => zip(selectLocalization(configState), selectEnums(configState)).pipe(map(([localization, enums]) => {
1206
+ const generateDisplayName = createDisplayNameLocalizationPipeKeyGenerator(localization);
1207
+ return Object.keys(entities).reduce((acc, key) => {
1208
+ acc.prop[key] = [];
1209
+ acc.createForm[key] = [];
1210
+ acc.editForm[key] = [];
1211
+ const entity = entities[key];
1212
+ if (!entity)
1213
+ return acc;
1214
+ const properties = entity.properties;
1215
+ if (!properties)
1216
+ return acc;
1217
+ const mapPropertiesToContributors = createPropertiesToContributorsMapper(generateDisplayName, resource, enums);
1218
+ return mapPropertiesToContributors(properties, acc, key);
1219
+ }, {
1220
+ prop: {},
1221
+ createForm: {},
1222
+ editForm: {},
1223
+ });
1224
+ }))), take(1));
1225
+ }
1226
+ function createPropertiesToContributorsMapper(generateDisplayName, resource, enums) {
1227
+ return (properties, contributors, key) => {
1228
+ const isExtra = true;
1229
+ const generateTypeaheadDisplayName = createTypeaheadDisplayNameGenerator(generateDisplayName, properties);
1230
+ Object.keys(properties).forEach((name) => {
1231
+ const property = properties[name];
1232
+ const propName = name;
1233
+ const lookup = property.ui.lookup || {};
1234
+ const type = getTypeaheadType(lookup, name) || getTypeFromProperty(property);
1235
+ const generateDN = hasTypeaheadTextSuffix(name)
1236
+ ? generateTypeaheadDisplayName
1237
+ : generateDisplayName;
1238
+ const displayName = generateDN(property.displayName, { name, resource });
1239
+ if (property.ui.onTable.isVisible) {
1240
+ const sortable = Boolean(property.ui.onTable.isSortable);
1241
+ const columnWidth = type === "boolean" /* ePropType.Boolean */ ? 150 : 250;
1242
+ const valueResolver = type === "enum" /* ePropType.Enum */ &&
1243
+ property.type
1244
+ ? createEnumValueResolver(property.type, enums[property.type], propName)
1245
+ : createExtraPropertyValueResolver(propName);
1246
+ const entityProp = new EntityProp({
1247
+ type,
1248
+ name: propName,
1249
+ displayName,
1250
+ sortable,
1251
+ columnWidth,
1252
+ valueResolver,
1253
+ isExtra,
1254
+ });
1255
+ const contributor = (propList) => propList.addTail(entityProp);
1256
+ contributors.prop[key].push(contributor);
1257
+ }
1258
+ const isOnCreateForm = property.ui.onCreateForm.isVisible;
1259
+ const isOnEditForm = property.ui.onEditForm.isVisible;
1260
+ if (isOnCreateForm || isOnEditForm) {
1261
+ const defaultValue = property.defaultValue;
1262
+ const formText = property.formText;
1263
+ const validators = () => getValidatorsFromProperty(property);
1264
+ let options;
1265
+ if (type === "enum" /* ePropType.Enum */)
1266
+ options = createEnumOptions(propName, enums[property.type || '']);
1267
+ else if (type === "typeahead" /* ePropType.Typeahead */)
1268
+ options = createTypeaheadOptions(lookup);
1269
+ const formProp = new FormProp({
1270
+ type,
1271
+ name: propName,
1272
+ displayName,
1273
+ options,
1274
+ defaultValue,
1275
+ validators,
1276
+ isExtra,
1277
+ formText,
1278
+ });
1279
+ const formContributor = (propList) => propList.addTail(formProp);
1280
+ if (isOnCreateForm)
1281
+ contributors.createForm[key].push(formContributor);
1282
+ if (isOnEditForm)
1283
+ contributors.editForm[key].push(formContributor);
1284
+ }
1285
+ });
1286
+ return contributors;
1287
+ };
1288
+ }
1289
+ function getTypeFromProperty(property) {
1290
+ return property?.typeSimple?.replace(/\?$/, '');
1291
+ }
1292
+ function isUndefined(obj) {
1293
+ return typeof obj === 'undefined';
1294
+ }
1295
+
1296
+ const importWithExport = [
1297
+ DisabledDirective,
1298
+ ExtensibleDateTimePickerComponent,
1299
+ ExtensibleFormPropComponent,
1300
+ GridActionsComponent,
1301
+ PropDataDirective,
1302
+ PageToolbarComponent,
1303
+ CreateInjectorPipe,
1304
+ ExtensibleFormComponent,
1305
+ ExtensibleTableComponent,
1306
+ ];
1307
+ class ExtensibleModule {
1308
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1309
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleModule, imports: [CoreModule,
1310
+ ThemeSharedModule,
1311
+ NgxValidateCoreModule,
1312
+ NgbDatepickerModule,
1313
+ NgbDropdownModule,
1314
+ NgbTimepickerModule,
1315
+ NgbTypeaheadModule,
1316
+ NgbTooltipModule, DisabledDirective,
1317
+ ExtensibleDateTimePickerComponent,
1318
+ ExtensibleFormPropComponent,
1319
+ GridActionsComponent,
1320
+ PropDataDirective,
1321
+ PageToolbarComponent,
1322
+ CreateInjectorPipe,
1323
+ ExtensibleFormComponent,
1324
+ ExtensibleTableComponent], exports: [DisabledDirective,
1325
+ ExtensibleDateTimePickerComponent,
1326
+ ExtensibleFormPropComponent,
1327
+ GridActionsComponent,
1328
+ PropDataDirective,
1329
+ PageToolbarComponent,
1330
+ CreateInjectorPipe,
1331
+ ExtensibleFormComponent,
1332
+ ExtensibleTableComponent] }); }
1333
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleModule, imports: [CoreModule,
1334
+ ThemeSharedModule,
1335
+ NgxValidateCoreModule,
1336
+ NgbDatepickerModule,
1337
+ NgbDropdownModule,
1338
+ NgbTimepickerModule,
1339
+ NgbTypeaheadModule,
1340
+ NgbTooltipModule, ExtensibleDateTimePickerComponent,
1341
+ ExtensibleFormPropComponent,
1342
+ GridActionsComponent,
1343
+ PageToolbarComponent,
1344
+ ExtensibleFormComponent,
1345
+ ExtensibleTableComponent] }); }
1346
+ }
1347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ExtensibleModule, decorators: [{
1348
+ type: NgModule,
1349
+ args: [{
1350
+ declarations: [],
1351
+ imports: [
1352
+ CoreModule,
1353
+ ThemeSharedModule,
1354
+ NgxValidateCoreModule,
1355
+ NgbDatepickerModule,
1356
+ NgbDropdownModule,
1357
+ NgbTimepickerModule,
1358
+ NgbTypeaheadModule,
1359
+ NgbTooltipModule,
1360
+ ...importWithExport,
1361
+ ],
1362
+ exports: [...importWithExport],
1363
+ }]
1364
+ }] });
1365
+
1366
+ /**
1367
+ * Generated bundle index. Do not edit.
1368
+ */
1369
+
1370
+ export { ActionList, CreateFormPropsFactory, CreateInjectorPipe, ENTITY_PROP_TYPE_CLASSES, EXTENSIBLE_FORM_VIEW_PROVIDER, EXTENSIONS_ACTION_CALLBACK, EXTENSIONS_ACTION_DATA, EXTENSIONS_ACTION_TYPE, EXTENSIONS_FORM_PROP, EXTENSIONS_FORM_PROP_DATA, EXTENSIONS_IDENTIFIER, EXTRA_PROPERTIES_KEY, EditFormPropsFactory, EntityAction, EntityActionList, EntityActions, EntityActionsFactory, EntityProp, EntityPropList, EntityProps, EntityPropsFactory, ExtensibleDateTimePickerComponent, ExtensibleFormComponent, ExtensibleFormPropComponent, ExtensibleModule, ExtensibleTableComponent, ExtensionsService, FormProp, FormPropData, FormPropList, FormProps, GridActionsComponent, objectExtensions as ObjectExtensions, PROP_DATA_STREAM, PageToolbarComponent, PropDataDirective, PropList, ToolbarAction, ToolbarActionList, ToolbarActions, ToolbarActionsFactory, ToolbarComponent, createExtraPropertyValueResolver, generateFormFromProps, getObjectExtensionEntitiesFromStore, mapEntitiesToContributors, mergeWithDefaultActions, mergeWithDefaultProps };
1371
+ //# sourceMappingURL=abp-ng.components-extensible.mjs.map