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