@one-paragon/angular-utilities 2.8.3 → 2.8.4

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 (203) hide show
  1. package/karma.conf.js +43 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +15 -27
  4. package/src/action-state/action-state-spinner/action-state-spinner.component.css +16 -0
  5. package/src/action-state/action-state-spinner/action-state-spinner.component.html +7 -0
  6. package/src/action-state/action-state-spinner/action-state-spinner.component.spec.ts +25 -0
  7. package/src/action-state/action-state-spinner/action-state-spinner.component.ts +26 -0
  8. package/src/action-state/action-state-ui/action-state-ui.module.ts +13 -0
  9. package/src/action-state/index.ts +8 -0
  10. package/src/action-state/ngrx-ext/ngrx-ext.module.ts +14 -0
  11. package/src/action-state/ngrx.ts +69 -0
  12. package/src/http-request-state/RequestStateFactory.ts +56 -0
  13. package/src/http-request-state/RequestStateStore.ts +360 -0
  14. package/src/http-request-state/deprecated.ts +20 -0
  15. package/src/http-request-state/directives/HttpStateDirectiveBase.ts +29 -0
  16. package/src/http-request-state/directives/http-error-state-directive.ts +21 -0
  17. package/src/http-request-state/directives/http-inProgress-state-directive.ts +19 -0
  18. package/src/http-request-state/directives/http-notStarted-state-directive.ts +19 -0
  19. package/src/http-request-state/directives/http-success-state-directive.ts +29 -0
  20. package/src/http-request-state/directives/index.ts +5 -0
  21. package/src/http-request-state/directives/request-state-directive.spec.ts +73 -0
  22. package/src/http-request-state/directives/request-state-directive.ts +78 -0
  23. package/src/http-request-state/documentation/CREATE-REQUESTOR.md +667 -0
  24. package/src/http-request-state/documentation/README.md +191 -0
  25. package/src/http-request-state/documentation/REQUEST-STATE-STORE-CONFIG.md +648 -0
  26. package/src/http-request-state/documentation/REQUESTOR.md +616 -0
  27. package/src/http-request-state/helpers.ts +30 -0
  28. package/src/http-request-state/http-state-module.ts +23 -0
  29. package/src/http-request-state/index.ts +7 -0
  30. package/src/http-request-state/models/view-context.ts +18 -0
  31. package/src/http-request-state/observable.spec.ts +43 -0
  32. package/src/http-request-state/request-state.ts +66 -0
  33. package/src/http-request-state/rxjs/getRequestorBody.ts +10 -0
  34. package/src/http-request-state/rxjs/getRequestorState.ts +8 -0
  35. package/src/http-request-state/rxjs/index.ts +4 -0
  36. package/src/http-request-state/rxjs/tapError.ts +16 -0
  37. package/src/http-request-state/rxjs/tapSuccess.ts +16 -0
  38. package/src/http-request-state/strategies.spec.ts +42 -0
  39. package/src/http-request-state/types.ts +54 -0
  40. package/src/ngrx/actionable-selector.ts +189 -0
  41. package/src/ngrx/index.ts +1 -0
  42. package/src/public-api.ts +40 -0
  43. package/src/rxjs/defaultShareReplay.ts +8 -0
  44. package/src/rxjs/index.ts +5 -0
  45. package/src/rxjs/mapError.ts +8 -0
  46. package/src/rxjs/rxjs-operators.ts +130 -0
  47. package/src/rxjs/subjectifier.ts +17 -0
  48. package/src/rxjs/subscriber.directive.ts +57 -0
  49. package/src/specs/clickSubject.spec.ts +99 -0
  50. package/src/specs/dialog.spec.ts +101 -0
  51. package/src/specs/toggleGroupDirective.spec.ts +229 -0
  52. package/src/table-builder/classes/DefaultSettings.ts +11 -0
  53. package/src/table-builder/classes/MatTableObservableDataSource.ts +23 -0
  54. package/src/table-builder/classes/TableBuilderConfig.ts +49 -0
  55. package/src/table-builder/classes/TableBuilderDataSource.ts +64 -0
  56. package/src/table-builder/classes/TableState.ts +96 -0
  57. package/src/table-builder/classes/data-store.ts +10 -0
  58. package/src/table-builder/classes/display-col.ts +5 -0
  59. package/src/table-builder/classes/filter-info.ts +129 -0
  60. package/src/table-builder/classes/table-builder-general-settings.ts +233 -0
  61. package/src/table-builder/classes/table-builder.ts +105 -0
  62. package/src/table-builder/classes/table-store.helpers.ts +109 -0
  63. package/src/table-builder/classes/table-store.ts +540 -0
  64. package/src/table-builder/components/array-column.component.ts +34 -0
  65. package/src/table-builder/components/column-builder/column-builder.component.html +109 -0
  66. package/src/table-builder/components/column-builder/column-builder.component.scss +43 -0
  67. package/src/table-builder/components/column-builder/column-builder.component.spec.ts +49 -0
  68. package/src/table-builder/components/column-builder/column-builder.component.ts +130 -0
  69. package/src/table-builder/components/column-builder/column-helpers.ts +54 -0
  70. package/src/table-builder/components/column-header-menu/column-header-menu.component.html +128 -0
  71. package/src/table-builder/components/column-header-menu/column-header-menu.component.scss +97 -0
  72. package/src/table-builder/components/column-header-menu/column-header-menu.component.ts +113 -0
  73. package/src/table-builder/components/date-filter/date-filter.component.html +39 -0
  74. package/src/table-builder/components/date-filter/date-filter.component.ts +33 -0
  75. package/src/table-builder/components/date-time-filter/date-time-filter.component.html +25 -0
  76. package/src/table-builder/components/date-time-filter/date-time-filter.component.ts +33 -0
  77. package/src/table-builder/components/filter/filter.component.html +120 -0
  78. package/src/table-builder/components/filter/filter.component.scss +60 -0
  79. package/src/table-builder/components/filter/filter.component.spec.ts +86 -0
  80. package/src/table-builder/components/filter/filter.component.ts +73 -0
  81. package/src/table-builder/components/filter/in-list/in-list-filter.component.ts +171 -0
  82. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.html +60 -0
  83. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.scss +57 -0
  84. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.ts +44 -0
  85. package/src/table-builder/components/generic-table/generic-table.component.html +140 -0
  86. package/src/table-builder/components/generic-table/generic-table.component.scss +45 -0
  87. package/src/table-builder/components/generic-table/generic-table.component.ts +531 -0
  88. package/src/table-builder/components/generic-table/paginator.component.ts +125 -0
  89. package/src/table-builder/components/group-by-list/group-by-list.component.css +24 -0
  90. package/src/table-builder/components/group-by-list/group-by-list.component.html +21 -0
  91. package/src/table-builder/components/group-by-list/group-by-list.component.spec.ts +23 -0
  92. package/src/table-builder/components/group-by-list/group-by-list.component.ts +26 -0
  93. package/src/table-builder/components/in-filter/in-filter.component.css +22 -0
  94. package/src/table-builder/components/in-filter/in-filter.component.html +38 -0
  95. package/src/table-builder/components/in-filter/in-filter.component.ts +66 -0
  96. package/src/table-builder/components/index.ts +9 -0
  97. package/src/table-builder/components/initialization-component/initialization.component.html +78 -0
  98. package/src/table-builder/components/initialization-component/initialization.component.ts +28 -0
  99. package/src/table-builder/components/link-column.component.ts +42 -0
  100. package/src/table-builder/components/number-filter/number-filter.component.css +10 -0
  101. package/src/table-builder/components/number-filter/number-filter.component.html +32 -0
  102. package/src/table-builder/components/number-filter/number-filter.component.spec.ts +30 -0
  103. package/src/table-builder/components/number-filter/number-filter.component.ts +34 -0
  104. package/src/table-builder/components/profiles-menu/profiles-menu.component.html +77 -0
  105. package/src/table-builder/components/profiles-menu/profiles-menu.component.scss +126 -0
  106. package/src/table-builder/components/profiles-menu/profiles-menu.component.spec.ts +23 -0
  107. package/src/table-builder/components/profiles-menu/profiles-menu.component.ts +64 -0
  108. package/src/table-builder/components/reset-menu/reset-menu.component.css +3 -0
  109. package/src/table-builder/components/reset-menu/reset-menu.component.html +10 -0
  110. package/src/table-builder/components/reset-menu/reset-menu.component.ts +87 -0
  111. package/src/table-builder/components/scroll-strategy.ts +139 -0
  112. package/src/table-builder/components/sort-menu/sort-menu.component-store.ts +57 -0
  113. package/src/table-builder/components/sort-menu/sort-menu.component.html +115 -0
  114. package/src/table-builder/components/sort-menu/sort-menu.component.scss +119 -0
  115. package/src/table-builder/components/sort-menu/sort-menu.component.ts +88 -0
  116. package/src/table-builder/components/table-container/table-container.component.html +94 -0
  117. package/src/table-builder/components/table-container/table-container.component.scss +60 -0
  118. package/src/table-builder/components/table-container/table-container.component.ts +467 -0
  119. package/src/table-builder/components/table-container/table-container.helpers/data-state.helpers.ts +113 -0
  120. package/src/table-builder/components/table-container/table-container.helpers/filter-state.helpers.ts +125 -0
  121. package/src/table-builder/components/table-container/table-container.helpers/groupBy.helpers.ts +172 -0
  122. package/src/table-builder/components/table-container/table-container.helpers/meta-data.helpers.ts +19 -0
  123. package/src/table-builder/components/table-container/table-container.helpers/sort-state.helpers.ts +47 -0
  124. package/src/table-builder/components/table-container/tableProps.ts +21 -0
  125. package/src/table-builder/components/table-container/virtual-scroll-container.ts +216 -0
  126. package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.html +42 -0
  127. package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.ts +47 -0
  128. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.css +40 -0
  129. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.html +11 -0
  130. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.spec.ts +85 -0
  131. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.ts +35 -0
  132. package/src/table-builder/components/table-container-filter/table-wrapper-filter-store.ts +13 -0
  133. package/src/table-builder/components/table-header-menu/table-header-menu.component.css +21 -0
  134. package/src/table-builder/components/table-header-menu/table-header-menu.component.html +48 -0
  135. package/src/table-builder/components/table-header-menu/table-header-menu.component.ts +36 -0
  136. package/src/table-builder/directives/custom-cell-directive.ts +63 -0
  137. package/src/table-builder/directives/custom-header-directive.ts +16 -0
  138. package/src/table-builder/directives/group-row-directive.ts +91 -0
  139. package/src/table-builder/directives/index.ts +8 -0
  140. package/src/table-builder/directives/multi-sort.directive.spec.ts +124 -0
  141. package/src/table-builder/directives/multi-sort.directive.ts +58 -0
  142. package/src/table-builder/directives/resize-column.directive.ts +107 -0
  143. package/src/table-builder/directives/table-wrapper.directive.ts +13 -0
  144. package/src/table-builder/directives/tb-filter.directive.ts +376 -0
  145. package/src/table-builder/documentation/table-builder/CUSTOM-CELL.md +568 -0
  146. package/src/table-builder/documentation/table-builder/CUSTOM-GROUP-ROW.md +356 -0
  147. package/src/table-builder/documentation/table-builder/METADATA-DOCUMENTATION.md +517 -0
  148. package/src/table-builder/documentation/table-builder/STYLER-STYLE.md +228 -0
  149. package/src/table-builder/documentation/table-builder/TABLE-BUILDER-CONFIG.md +325 -0
  150. package/src/table-builder/documentation/table-builder/TABLE-BUILDER-SETTINGS.md +515 -0
  151. package/src/table-builder/documentation/table-builder/TABLE-BUILDER.md +430 -0
  152. package/src/table-builder/documentation/table-builder/TABLE-CONTAINER.md +628 -0
  153. package/src/table-builder/enums/filterTypes.ts +39 -0
  154. package/src/table-builder/functions/boolean-filter-function.ts +12 -0
  155. package/src/table-builder/functions/date-filter-function.ts +85 -0
  156. package/src/table-builder/functions/download-data.ts +11 -0
  157. package/src/table-builder/functions/null-filter-function.ts +9 -0
  158. package/src/table-builder/functions/number-filter-function.ts +47 -0
  159. package/src/table-builder/functions/sort-data-function.ts +80 -0
  160. package/src/table-builder/functions/string-filter-function.ts +59 -0
  161. package/src/table-builder/interfaces/ColumnInfo.ts +9 -0
  162. package/src/table-builder/interfaces/dictionary.ts +3 -0
  163. package/src/table-builder/interfaces/meta-data.ts +279 -0
  164. package/src/table-builder/ngrx/tableBuilderStateStore.ts +203 -0
  165. package/src/table-builder/pipes/column-total.pipe.ts +16 -0
  166. package/src/table-builder/pipes/format-filter-type.pipe.ts +12 -0
  167. package/src/table-builder/pipes/format-filter-value.pipe.ts +71 -0
  168. package/src/table-builder/pipes/key-display.ts +13 -0
  169. package/src/table-builder/services/all-values-filter-creator.service.ts +92 -0
  170. package/src/table-builder/services/export-to-csv.service.ts +117 -0
  171. package/src/table-builder/services/link-creator.service.ts +98 -0
  172. package/src/table-builder/services/table-template-service.ts +47 -0
  173. package/src/table-builder/services/transform-creator.ts +90 -0
  174. package/src/table-builder/specs/table-custom-filters.spec.ts +262 -0
  175. package/src/table-builder/styles/collapser.styles.scss +16 -0
  176. package/src/table-builder/table-builder.module.ts +42 -0
  177. package/src/table-builder/types/group-types.ts +42 -0
  178. package/src/table-builder/types/index.ts +1 -0
  179. package/src/test.ts +17 -0
  180. package/src/utilities/array-helpers.ts +13 -0
  181. package/src/utilities/directives/auto-focus.directive.ts +20 -0
  182. package/src/utilities/directives/clickEmitterDirective.ts +15 -0
  183. package/src/utilities/directives/clickSubject.ts +19 -0
  184. package/src/utilities/directives/conditional-classes.directive.ts +36 -0
  185. package/src/utilities/directives/dialog-service.ts +19 -0
  186. package/src/utilities/directives/dialog.ts +174 -0
  187. package/src/utilities/directives/mat-toggle-group-directive.ts +60 -0
  188. package/src/utilities/directives/prevent-enter.directive.ts +12 -0
  189. package/src/utilities/directives/stop-propagation.directive.ts +19 -0
  190. package/src/utilities/directives/styler.ts +45 -0
  191. package/src/utilities/directives/trim-whitespace.directive.ts +20 -0
  192. package/src/utilities/index.ts +22 -0
  193. package/src/utilities/module.ts +53 -0
  194. package/src/utilities/pipes/function.pipe.ts +21 -0
  195. package/src/utilities/pipes/phone.pipe.ts +20 -0
  196. package/src/utilities/pipes/space-case.pipes.spec.ts +47 -0
  197. package/src/utilities/pipes/space-case.pipes.ts +29 -0
  198. package/tsconfig.lib.json +20 -0
  199. package/tsconfig.lib.prod.json +10 -0
  200. package/tsconfig.spec.json +17 -0
  201. package/fesm2022/one-paragon-angular-utilities.mjs +0 -7328
  202. package/fesm2022/one-paragon-angular-utilities.mjs.map +0 -1
  203. package/types/one-paragon-angular-utilities.d.ts +0 -2197
@@ -0,0 +1,228 @@
1
+ # StylerStyle Documentation
2
+
3
+ ## Overview
4
+
5
+ `StylerStyle<T>` is a flexible type for applying dynamic inline CSS styles based on row data. It allows you to conditionally apply styles to table cells, rows, or column parts.
6
+
7
+ ## Type Definition
8
+
9
+ ```typescript
10
+ type StylerStyle<T = any> = Dictionary<
11
+ string | {
12
+ condition?: ((t: T) => boolean) | true,
13
+ value: ((t: T) => string) | string
14
+ }
15
+ >
16
+ ```
17
+
18
+ Where `Dictionary<T>` is equivalent to `{ [key: string]: T }`.
19
+
20
+ ## Usage Patterns
21
+
22
+ ### Simple Static Styles
23
+
24
+ Apply a static CSS value directly:
25
+
26
+ ```typescript
27
+ const styles: StylerStyle = {
28
+ 'color': 'red',
29
+ 'font-weight': 'bold',
30
+ 'background-color': '#f0f0f0'
31
+ };
32
+ ```
33
+
34
+ ### Dynamic Styles Based on Data
35
+
36
+ Compute style values from the row data:
37
+
38
+ ```typescript
39
+ const styles: StylerStyle<User> = {
40
+ 'color': (user) => user.isActive ? 'green' : 'gray',
41
+ 'font-size': (user) => user.isPriority ? '16px' : '14px',
42
+ 'opacity': (user) => user.status === 'archived' ? '0.5' : '1'
43
+ };
44
+ ```
45
+
46
+ ### Conditional Styles with Static Values
47
+
48
+ Apply a static style only when a condition is met:
49
+
50
+ ```typescript
51
+ const styles: StylerStyle<User> = {
52
+ 'background-color': {
53
+ condition: (user) => user.isWarning,
54
+ value: '#fff3cd'
55
+ },
56
+ 'border-left': {
57
+ condition: (user) => user.isPriority,
58
+ value: '4px solid #dc3545'
59
+ }
60
+ };
61
+ ```
62
+
63
+ ### Conditional Styles with Dynamic Values
64
+
65
+ Apply a computed style only when a condition is met:
66
+
67
+ ```typescript
68
+ const styles: StylerStyle<User> = {
69
+ 'background-color': {
70
+ condition: (user) => user.score !== null,
71
+ value: (user) => user.score > 80 ? '#d4edda' : '#f8d7da'
72
+ },
73
+ 'font-weight': {
74
+ condition: (user) => user.role === 'admin',
75
+ value: (user) => user.isActive ? 'bold' : 'normal'
76
+ }
77
+ };
78
+ ```
79
+
80
+ ### Always-Applied Conditional Styles
81
+
82
+ Use `condition: true` to always evaluate the value function:
83
+
84
+ ```typescript
85
+ const styles: StylerStyle<User> = {
86
+ 'color': {
87
+ condition: true,
88
+ value: (user) => {
89
+ if (user.status === 'error') return '#dc3545';
90
+ if (user.status === 'warning') return '#ffc107';
91
+ if (user.status === 'success') return '#28a745';
92
+ return 'inherit';
93
+ }
94
+ }
95
+ };
96
+ ```
97
+
98
+ ## Common Use Cases
99
+
100
+ ### Row-Level Styling
101
+
102
+ Apply styles to entire table rows based on row data:
103
+
104
+ ```typescript
105
+ tableSettings: {
106
+ rowStyles: {
107
+ 'background-color': (row) => row.isSelected ? '#e3f2fd' : 'transparent',
108
+ 'opacity': (row) => row.isDeleted ? '0.5' : '1',
109
+ 'cursor': 'pointer'
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### Cell-Level Styling
115
+
116
+ Apply styles to individual cells in a column:
117
+
118
+ ```typescript
119
+ {
120
+ key: 'amount',
121
+ fieldType: FieldType.Currency,
122
+ additional: {
123
+ styles: {
124
+ 'color': (row) => row.amount < 0 ? 'red' : 'green',
125
+ 'font-weight': (row) => Math.abs(row.amount) > 1000 ? 'bold' : 'normal'
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ ### Column Part Styling
132
+
133
+ Apply styles to specific parts of a column:
134
+
135
+ ```typescript
136
+ {
137
+ key: 'status',
138
+ fieldType: FieldType.String,
139
+ additional: {
140
+ columnPartStyles: {
141
+ header: {
142
+ 'background-color': '#f5f5f5',
143
+ 'font-weight': 'bold'
144
+ },
145
+ body: (row) => ({
146
+ 'color': row.status === 'active' ? 'green' : 'red',
147
+ 'text-transform': 'uppercase'
148
+ }),
149
+ footer: {
150
+ 'background-color': '#e0e0e0',
151
+ 'font-style': 'italic'
152
+ }
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ ### Complex Conditional Logic
159
+
160
+ Combine multiple conditions for sophisticated styling:
161
+
162
+ ```typescript
163
+ const styles: StylerStyle<Order> = {
164
+ 'background-color': {
165
+ condition: (order) => order.isPriority || order.isUrgent,
166
+ value: (order) => {
167
+ if (order.isUrgent) return '#ffebee';
168
+ if (order.isPriority) return '#fff9c4';
169
+ return 'transparent';
170
+ }
171
+ },
172
+ 'border-left': {
173
+ condition: (order) => order.daysOverdue > 0,
174
+ value: (order) => {
175
+ const width = Math.min(order.daysOverdue, 5);
176
+ return `${width}px solid #f44336`;
177
+ }
178
+ },
179
+ 'font-weight': {
180
+ condition: (order) => order.value > 10000,
181
+ value: 'bold'
182
+ }
183
+ };
184
+ ```
185
+
186
+ ## Style Properties
187
+
188
+ Any valid CSS property can be used as a key. Common properties include:
189
+
190
+ - **Colors**: `color`, `background-color`, `border-color`
191
+ - **Typography**: `font-size`, `font-weight`, `font-style`, `text-align`, `text-transform`
192
+ - **Spacing**: `padding`, `margin`, `padding-left`, `margin-top`
193
+ - **Borders**: `border`, `border-left`, `border-width`, `border-style`
194
+ - **Layout**: `display`, `width`, `height`, `min-width`, `max-width`
195
+ - **Visual Effects**: `opacity`, `box-shadow`, `transform`
196
+ - **Interaction**: `cursor`, `pointer-events`
197
+
198
+ **Note**: Use camelCase for multi-word CSS properties (e.g., `backgroundColor`) or string literals (e.g., `'background-color'`).
199
+
200
+ ## Performance Considerations
201
+
202
+ - **Memoization**: Style functions are evaluated on every change detection cycle. Keep them simple and avoid expensive computations.
203
+ - **Condition First**: When using the object form, the `condition` is evaluated before the `value`, allowing you to skip expensive value calculations when not needed.
204
+ - **Static Styles**: Prefer static string values when styles don't depend on data.
205
+
206
+ ## Type Safety
207
+
208
+ When using TypeScript, the generic type `T` provides type safety for your row data:
209
+
210
+ ```typescript
211
+ interface Product {
212
+ id: number;
213
+ name: string;
214
+ stock: number;
215
+ price: number;
216
+ }
217
+
218
+ const productStyles: StylerStyle<Product> = {
219
+ 'color': (product) => product.stock < 10 ? 'red' : 'black',
220
+ // TypeScript will provide autocomplete for 'product' properties
221
+ 'font-weight': (product) => product.price > 100 ? 'bold' : 'normal'
222
+ };
223
+ ```
224
+
225
+ ## Related Documentation
226
+
227
+ - [MetaData Configuration](./METADATA-DOCUMENTATION.md#styling-configuration) - How to use `StylerStyle` with column metadata
228
+ - [Table Builder Settings](./TABLE-BUILDER-SETTINGS.md#table-settings) - How to use `StylerStyle` for row-level styling
@@ -0,0 +1,325 @@
1
+ # TableBuilderConfig Documentation
2
+
3
+ ## Overview
4
+
5
+ `TableBuilderConfig` allows you to set global default settings for all Table Builder instances in your application. These defaults can be overridden at the component level when needed.
6
+
7
+ ## Usage
8
+
9
+ ### Global Configuration (Application-Wide)
10
+
11
+ Use `provideTableBuilder` in your application configuration to set defaults for all tables:
12
+
13
+ ```typescript
14
+ // In app.config.ts or main.ts
15
+ import { ApplicationConfig } from '@angular/core';
16
+ import { provideTableBuilder } from 'angular-utilities';
17
+
18
+ export const appConfig: ApplicationConfig = {
19
+ providers: [
20
+ provideTableBuilder({
21
+ defaultTableSettings: {
22
+ pageSize: 25,
23
+ headerSettings: {
24
+ showTitleWhenCollapsed: true
25
+ },
26
+ tableSettings: {
27
+ usePaginator: true,
28
+ exportSettings: {
29
+ dateFormat: 'MM/dd/yyyy',
30
+ mapEnumToString: true
31
+ }
32
+ }
33
+ },
34
+ dateFormats: {
35
+ dateFormat: 'MM/dd/yyyy',
36
+ dateTimeFormat: 'MM/dd/yyyy HH:mm:ss'
37
+ },
38
+ arrayDefaults: {
39
+ limit: 5,
40
+ arrayStyle: ArrayStyle.CommaDelimited
41
+ }
42
+ })
43
+ ]
44
+ };
45
+ ```
46
+
47
+ ### Component-Level Configuration
48
+
49
+ You can also provide `TableBuilderConfig` at the component level to set defaults for tables within that component and its children:
50
+
51
+ ```typescript
52
+ import { Component } from '@angular/core';
53
+ import { provideTableBuilder } from 'angular-utilities';
54
+
55
+ @Component({
56
+ selector: 'app-users-table',
57
+ template: `...`,
58
+ providers: [
59
+ provideTableBuilder({
60
+ defaultTableSettings: {
61
+ pageSize: 50,
62
+ tableSettings: {
63
+ includeSelectionColumn: true
64
+ }
65
+ }
66
+ })
67
+ ]
68
+ })
69
+ export class UsersTableComponent { }
70
+ ```
71
+
72
+ ---
73
+
74
+ ## TableBuilderConfig Properties
75
+
76
+ ### `defaultTableSettings`
77
+
78
+ - **Type**: `Partial<TableBuilderSettings> & { pageSize?: number }`
79
+ - **Description**: Default settings that will be applied to all tables. These can be overridden at the individual table level.
80
+ - **See**: [TableBuilderSettings Documentation](./TABLE-BUILDER-SETTINGS.md) for detailed information about all available settings.
81
+
82
+ **Example**:
83
+ ```typescript
84
+ defaultTableSettings: {
85
+ pageSize: 25,
86
+ headerSettings: {
87
+ hideExport: false,
88
+ showTitleWhenCollapsed: true
89
+ },
90
+ columnHeaderSettings: {
91
+ stickyHeaderRow: true
92
+ },
93
+ tableSettings: {
94
+ usePaginator: true,
95
+ useVirtualScroll: false,
96
+ trackBy: 'id'
97
+ }
98
+ }
99
+ ```
100
+
101
+ ### `export` ⚠️ **Deprecated**
102
+
103
+ - **Type**: `TableBuilderExport | undefined`
104
+ - **Deprecated**: Use `defaultTableSettings.tableSettings.exportSettings` instead.
105
+ - **Description**: Legacy global export settings.
106
+ - **See**: [MetaData Documentation - Export Configuration](./METADATA-DOCUMENTATION.md#export-configuration) for details on export options.
107
+
108
+ ### `dateFormats`
109
+
110
+ - **Type**: `DefaultSettings | undefined`
111
+ - **Description**: Default date and datetime formats applied to all Date and DateTime columns unless overridden at the column level.
112
+
113
+ **Interface**:
114
+ ```typescript
115
+ interface DefaultSettings {
116
+ dateFormat?: string;
117
+ dateTimeFormat?: string;
118
+ }
119
+ ```
120
+
121
+ **Properties**:
122
+ - **`dateFormat`**: Default format for `FieldType.Date` columns (e.g., `'MM/dd/yyyy'`)
123
+ - **`dateTimeFormat`**: Default format for `FieldType.DateTime` columns (e.g., `'MM/dd/yyyy HH:mm:ss'`)
124
+
125
+ **Example**:
126
+ ```typescript
127
+ dateFormats: {
128
+ dateFormat: 'dd/MM/yyyy',
129
+ dateTimeFormat: 'dd/MM/yyyy HH:mm:ss'
130
+ }
131
+ ```
132
+
133
+ ### `arrayDefaults`
134
+
135
+ - **Type**: `ArrayAdditional | undefined`
136
+ - **Description**: Default settings for how array-type columns are displayed.
137
+ - **See**: [MetaData Documentation - Array Types](./METADATA-DOCUMENTATION.md#array-types) for more details on array configuration.
138
+
139
+ **Properties**:
140
+ - **`limit`**: Maximum number of array items to display (default: `3`)
141
+ - **`arrayStyle`**: How to display array items
142
+ - `ArrayStyle.CommaDelimited` (default): Items separated by commas
143
+ - `ArrayStyle.NewLine`: Each item on a new line
144
+
145
+ **Example**:
146
+ ```typescript
147
+ arrayDefaults: {
148
+ limit: 5,
149
+ arrayStyle: ArrayStyle.NewLine
150
+ }
151
+ ```
152
+
153
+ ### `transformers`
154
+
155
+ - **Type**: `Partial<{ [key in keyof typeof FieldType]: (val: any) => any }> | undefined`
156
+ - **Description**: Global transformation functions for specific field types. These are applied to values before display, allowing you to customize how data is rendered for each field type across all tables.
157
+
158
+ **Example**:
159
+ ```typescript
160
+ transformers: {
161
+ [FieldType.Currency]: (val: number) => {
162
+ // Add custom currency symbol
163
+ return val != null ? `$${val.toFixed(2)}` : '';
164
+ },
165
+ [FieldType.PhoneNumber]: (val: string) => {
166
+ // Format phone numbers
167
+ if (!val) return '';
168
+ const cleaned = val.replace(/\D/g, '');
169
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)}-${cleaned.slice(6)}`;
170
+ },
171
+ [FieldType.Boolean]: (val: boolean) => {
172
+ return val ? 'Yes' : 'No';
173
+ }
174
+ }
175
+ ```
176
+
177
+ **Available FieldTypes**:
178
+ - `FieldType.String`
179
+ - `FieldType.Number`
180
+ - `FieldType.Boolean`
181
+ - `FieldType.Date`
182
+ - `FieldType.DateTime`
183
+ - `FieldType.Currency`
184
+ - `FieldType.PhoneNumber`
185
+ - `FieldType.Enum`
186
+ - `FieldType.Array`
187
+ - `FieldType.ImageUrl`
188
+ - And more...
189
+
190
+ ---
191
+
192
+ ## Configuration Precedence
193
+
194
+ Settings are applied in the following order (later sources override earlier ones):
195
+
196
+ 1. **Global Config** (via `provideTableBuilder` at app level)
197
+ 2. **Component Config** (via `provideTableBuilder` in component providers)
198
+ 3. **Table-Specific Settings** (passed directly to the table component)
199
+ 4. **Column-Specific Settings** (defined in MetaData for individual columns)
200
+
201
+ **Example**:
202
+ ```typescript
203
+ // 1. Global default (applies to all tables)
204
+ provideTableBuilder({
205
+ defaultTableSettings: { pageSize: 10 }
206
+ })
207
+
208
+ // 2. Component-level default (applies to tables in this component)
209
+ @Component({
210
+ providers: [
211
+ provideTableBuilder({
212
+ defaultTableSettings: { pageSize: 25 } // Overrides global
213
+ })
214
+ ]
215
+ })
216
+
217
+ // 3. Table-specific setting
218
+ const tableSettings: TableBuilderSettings = {
219
+ tableSettings: {
220
+ paginatorSettings: { pageSize: 50 } // Overrides component-level
221
+ }
222
+ };
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Default Configuration
228
+
229
+ If no configuration is provided, Table Builder uses these defaults:
230
+
231
+ ```typescript
232
+ const defaultConfig: TableBuilderConfig = {
233
+ defaultTableSettings: {
234
+ pageSize: 10
235
+ },
236
+ arrayDefaults: {
237
+ limit: 3,
238
+ arrayStyle: ArrayStyle.CommaDelimited
239
+ }
240
+ };
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Complete Example
246
+
247
+ ```typescript
248
+ import { ApplicationConfig } from '@angular/core';
249
+ import { provideTableBuilder, ArrayStyle, FieldType } from 'angular-utilities';
250
+
251
+ export const appConfig: ApplicationConfig = {
252
+ providers: [
253
+ provideTableBuilder({
254
+ // Default table settings applied to all tables
255
+ defaultTableSettings: {
256
+ pageSize: 25,
257
+
258
+ headerSettings: {
259
+ showTitleWhenCollapsed: true,
260
+ hideExport: false
261
+ },
262
+
263
+ columnHeaderSettings: {
264
+ stickyHeaderRow: true,
265
+ noFilters: false
266
+ },
267
+
268
+ tableSettings: {
269
+ usePaginator: true,
270
+ useVirtualScroll: false,
271
+ trackBy: 'id',
272
+
273
+ exportSettings: {
274
+ dateFormat: 'MM/dd/yyyy',
275
+ dateTimeFormat: 'MM/dd/yyyy HH:mm:ss',
276
+ mapEnumToString: true,
277
+ mapLink: 'as view'
278
+ },
279
+
280
+ rowClasses: {
281
+ 'hover-highlight': true
282
+ }
283
+ }
284
+ },
285
+
286
+ // Global date formats
287
+ dateFormats: {
288
+ dateFormat: 'MM/dd/yyyy',
289
+ dateTimeFormat: 'MM/dd/yyyy HH:mm:ss'
290
+ },
291
+
292
+ // Array display defaults
293
+ arrayDefaults: {
294
+ limit: 5,
295
+ arrayStyle: ArrayStyle.CommaDelimited
296
+ },
297
+
298
+ // Global transformers for field types
299
+ transformers: {
300
+ [FieldType.Currency]: (val: number) =>
301
+ val != null ? `$${val.toLocaleString('en-US', { minimumFractionDigits: 2 })}` : '',
302
+
303
+ [FieldType.PhoneNumber]: (val: string) => {
304
+ if (!val) return '';
305
+ const cleaned = val.replace(/\D/g, '');
306
+ if (cleaned.length === 10) {
307
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)}-${cleaned.slice(6)}`;
308
+ }
309
+ return val;
310
+ },
311
+
312
+ [FieldType.Boolean]: (val: boolean) => val ? '✓' : '✗'
313
+ }
314
+ })
315
+ ]
316
+ };
317
+ ```
318
+
319
+ ---
320
+
321
+ ## Related Documentation
322
+
323
+ - [TableBuilderSettings Documentation](./TABLE-BUILDER-SETTINGS.md) - Detailed documentation for all table settings
324
+ - [MetaData Documentation](./METADATA-DOCUMENTATION.md) - Column configuration options
325
+ - [StylerStyle Documentation](./STYLER-STYLE.md) - Dynamic styling patterns