@one-paragon/angular-utilities 2.8.4 → 2.8.6

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/fesm2022/one-paragon-angular-utilities.mjs +7350 -0
  2. package/fesm2022/one-paragon-angular-utilities.mjs.map +1 -0
  3. package/package.json +27 -15
  4. package/types/one-paragon-angular-utilities.d.ts +2211 -0
  5. package/karma.conf.js +0 -43
  6. package/ng-package.json +0 -7
  7. package/src/action-state/action-state-spinner/action-state-spinner.component.css +0 -16
  8. package/src/action-state/action-state-spinner/action-state-spinner.component.html +0 -7
  9. package/src/action-state/action-state-spinner/action-state-spinner.component.spec.ts +0 -25
  10. package/src/action-state/action-state-spinner/action-state-spinner.component.ts +0 -26
  11. package/src/action-state/action-state-ui/action-state-ui.module.ts +0 -13
  12. package/src/action-state/index.ts +0 -8
  13. package/src/action-state/ngrx-ext/ngrx-ext.module.ts +0 -14
  14. package/src/action-state/ngrx.ts +0 -69
  15. package/src/http-request-state/RequestStateFactory.ts +0 -56
  16. package/src/http-request-state/RequestStateStore.ts +0 -360
  17. package/src/http-request-state/deprecated.ts +0 -20
  18. package/src/http-request-state/directives/HttpStateDirectiveBase.ts +0 -29
  19. package/src/http-request-state/directives/http-error-state-directive.ts +0 -21
  20. package/src/http-request-state/directives/http-inProgress-state-directive.ts +0 -19
  21. package/src/http-request-state/directives/http-notStarted-state-directive.ts +0 -19
  22. package/src/http-request-state/directives/http-success-state-directive.ts +0 -29
  23. package/src/http-request-state/directives/index.ts +0 -5
  24. package/src/http-request-state/directives/request-state-directive.spec.ts +0 -73
  25. package/src/http-request-state/directives/request-state-directive.ts +0 -78
  26. package/src/http-request-state/documentation/CREATE-REQUESTOR.md +0 -667
  27. package/src/http-request-state/documentation/README.md +0 -191
  28. package/src/http-request-state/documentation/REQUEST-STATE-STORE-CONFIG.md +0 -648
  29. package/src/http-request-state/documentation/REQUESTOR.md +0 -616
  30. package/src/http-request-state/helpers.ts +0 -30
  31. package/src/http-request-state/http-state-module.ts +0 -23
  32. package/src/http-request-state/index.ts +0 -7
  33. package/src/http-request-state/models/view-context.ts +0 -18
  34. package/src/http-request-state/observable.spec.ts +0 -43
  35. package/src/http-request-state/request-state.ts +0 -66
  36. package/src/http-request-state/rxjs/getRequestorBody.ts +0 -10
  37. package/src/http-request-state/rxjs/getRequestorState.ts +0 -8
  38. package/src/http-request-state/rxjs/index.ts +0 -4
  39. package/src/http-request-state/rxjs/tapError.ts +0 -16
  40. package/src/http-request-state/rxjs/tapSuccess.ts +0 -16
  41. package/src/http-request-state/strategies.spec.ts +0 -42
  42. package/src/http-request-state/types.ts +0 -54
  43. package/src/ngrx/actionable-selector.ts +0 -189
  44. package/src/ngrx/index.ts +0 -1
  45. package/src/public-api.ts +0 -40
  46. package/src/rxjs/defaultShareReplay.ts +0 -8
  47. package/src/rxjs/index.ts +0 -5
  48. package/src/rxjs/mapError.ts +0 -8
  49. package/src/rxjs/rxjs-operators.ts +0 -130
  50. package/src/rxjs/subjectifier.ts +0 -17
  51. package/src/rxjs/subscriber.directive.ts +0 -57
  52. package/src/specs/clickSubject.spec.ts +0 -99
  53. package/src/specs/dialog.spec.ts +0 -101
  54. package/src/specs/toggleGroupDirective.spec.ts +0 -229
  55. package/src/table-builder/classes/DefaultSettings.ts +0 -11
  56. package/src/table-builder/classes/MatTableObservableDataSource.ts +0 -23
  57. package/src/table-builder/classes/TableBuilderConfig.ts +0 -49
  58. package/src/table-builder/classes/TableBuilderDataSource.ts +0 -64
  59. package/src/table-builder/classes/TableState.ts +0 -96
  60. package/src/table-builder/classes/data-store.ts +0 -10
  61. package/src/table-builder/classes/display-col.ts +0 -5
  62. package/src/table-builder/classes/filter-info.ts +0 -129
  63. package/src/table-builder/classes/table-builder-general-settings.ts +0 -233
  64. package/src/table-builder/classes/table-builder.ts +0 -105
  65. package/src/table-builder/classes/table-store.helpers.ts +0 -109
  66. package/src/table-builder/classes/table-store.ts +0 -540
  67. package/src/table-builder/components/array-column.component.ts +0 -34
  68. package/src/table-builder/components/column-builder/column-builder.component.html +0 -109
  69. package/src/table-builder/components/column-builder/column-builder.component.scss +0 -43
  70. package/src/table-builder/components/column-builder/column-builder.component.spec.ts +0 -49
  71. package/src/table-builder/components/column-builder/column-builder.component.ts +0 -130
  72. package/src/table-builder/components/column-builder/column-helpers.ts +0 -54
  73. package/src/table-builder/components/column-header-menu/column-header-menu.component.html +0 -128
  74. package/src/table-builder/components/column-header-menu/column-header-menu.component.scss +0 -97
  75. package/src/table-builder/components/column-header-menu/column-header-menu.component.ts +0 -113
  76. package/src/table-builder/components/date-filter/date-filter.component.html +0 -39
  77. package/src/table-builder/components/date-filter/date-filter.component.ts +0 -33
  78. package/src/table-builder/components/date-time-filter/date-time-filter.component.html +0 -25
  79. package/src/table-builder/components/date-time-filter/date-time-filter.component.ts +0 -33
  80. package/src/table-builder/components/filter/filter.component.html +0 -120
  81. package/src/table-builder/components/filter/filter.component.scss +0 -60
  82. package/src/table-builder/components/filter/filter.component.spec.ts +0 -86
  83. package/src/table-builder/components/filter/filter.component.ts +0 -73
  84. package/src/table-builder/components/filter/in-list/in-list-filter.component.ts +0 -171
  85. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.html +0 -60
  86. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.scss +0 -57
  87. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.ts +0 -44
  88. package/src/table-builder/components/generic-table/generic-table.component.html +0 -140
  89. package/src/table-builder/components/generic-table/generic-table.component.scss +0 -45
  90. package/src/table-builder/components/generic-table/generic-table.component.ts +0 -531
  91. package/src/table-builder/components/generic-table/paginator.component.ts +0 -125
  92. package/src/table-builder/components/group-by-list/group-by-list.component.css +0 -24
  93. package/src/table-builder/components/group-by-list/group-by-list.component.html +0 -21
  94. package/src/table-builder/components/group-by-list/group-by-list.component.spec.ts +0 -23
  95. package/src/table-builder/components/group-by-list/group-by-list.component.ts +0 -26
  96. package/src/table-builder/components/in-filter/in-filter.component.css +0 -22
  97. package/src/table-builder/components/in-filter/in-filter.component.html +0 -38
  98. package/src/table-builder/components/in-filter/in-filter.component.ts +0 -66
  99. package/src/table-builder/components/index.ts +0 -9
  100. package/src/table-builder/components/initialization-component/initialization.component.html +0 -78
  101. package/src/table-builder/components/initialization-component/initialization.component.ts +0 -28
  102. package/src/table-builder/components/link-column.component.ts +0 -42
  103. package/src/table-builder/components/number-filter/number-filter.component.css +0 -10
  104. package/src/table-builder/components/number-filter/number-filter.component.html +0 -32
  105. package/src/table-builder/components/number-filter/number-filter.component.spec.ts +0 -30
  106. package/src/table-builder/components/number-filter/number-filter.component.ts +0 -34
  107. package/src/table-builder/components/profiles-menu/profiles-menu.component.html +0 -77
  108. package/src/table-builder/components/profiles-menu/profiles-menu.component.scss +0 -126
  109. package/src/table-builder/components/profiles-menu/profiles-menu.component.spec.ts +0 -23
  110. package/src/table-builder/components/profiles-menu/profiles-menu.component.ts +0 -64
  111. package/src/table-builder/components/reset-menu/reset-menu.component.css +0 -3
  112. package/src/table-builder/components/reset-menu/reset-menu.component.html +0 -10
  113. package/src/table-builder/components/reset-menu/reset-menu.component.ts +0 -87
  114. package/src/table-builder/components/scroll-strategy.ts +0 -139
  115. package/src/table-builder/components/sort-menu/sort-menu.component-store.ts +0 -57
  116. package/src/table-builder/components/sort-menu/sort-menu.component.html +0 -115
  117. package/src/table-builder/components/sort-menu/sort-menu.component.scss +0 -119
  118. package/src/table-builder/components/sort-menu/sort-menu.component.ts +0 -88
  119. package/src/table-builder/components/table-container/table-container.component.html +0 -94
  120. package/src/table-builder/components/table-container/table-container.component.scss +0 -60
  121. package/src/table-builder/components/table-container/table-container.component.ts +0 -467
  122. package/src/table-builder/components/table-container/table-container.helpers/data-state.helpers.ts +0 -113
  123. package/src/table-builder/components/table-container/table-container.helpers/filter-state.helpers.ts +0 -125
  124. package/src/table-builder/components/table-container/table-container.helpers/groupBy.helpers.ts +0 -172
  125. package/src/table-builder/components/table-container/table-container.helpers/meta-data.helpers.ts +0 -19
  126. package/src/table-builder/components/table-container/table-container.helpers/sort-state.helpers.ts +0 -47
  127. package/src/table-builder/components/table-container/tableProps.ts +0 -21
  128. package/src/table-builder/components/table-container/virtual-scroll-container.ts +0 -216
  129. package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.html +0 -42
  130. package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.ts +0 -47
  131. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.css +0 -40
  132. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.html +0 -11
  133. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.spec.ts +0 -85
  134. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.ts +0 -35
  135. package/src/table-builder/components/table-container-filter/table-wrapper-filter-store.ts +0 -13
  136. package/src/table-builder/components/table-header-menu/table-header-menu.component.css +0 -21
  137. package/src/table-builder/components/table-header-menu/table-header-menu.component.html +0 -48
  138. package/src/table-builder/components/table-header-menu/table-header-menu.component.ts +0 -36
  139. package/src/table-builder/directives/custom-cell-directive.ts +0 -63
  140. package/src/table-builder/directives/custom-header-directive.ts +0 -16
  141. package/src/table-builder/directives/group-row-directive.ts +0 -91
  142. package/src/table-builder/directives/index.ts +0 -8
  143. package/src/table-builder/directives/multi-sort.directive.spec.ts +0 -124
  144. package/src/table-builder/directives/multi-sort.directive.ts +0 -58
  145. package/src/table-builder/directives/resize-column.directive.ts +0 -107
  146. package/src/table-builder/directives/table-wrapper.directive.ts +0 -13
  147. package/src/table-builder/directives/tb-filter.directive.ts +0 -376
  148. package/src/table-builder/documentation/table-builder/CUSTOM-CELL.md +0 -568
  149. package/src/table-builder/documentation/table-builder/CUSTOM-GROUP-ROW.md +0 -356
  150. package/src/table-builder/documentation/table-builder/METADATA-DOCUMENTATION.md +0 -517
  151. package/src/table-builder/documentation/table-builder/STYLER-STYLE.md +0 -228
  152. package/src/table-builder/documentation/table-builder/TABLE-BUILDER-CONFIG.md +0 -325
  153. package/src/table-builder/documentation/table-builder/TABLE-BUILDER-SETTINGS.md +0 -515
  154. package/src/table-builder/documentation/table-builder/TABLE-BUILDER.md +0 -430
  155. package/src/table-builder/documentation/table-builder/TABLE-CONTAINER.md +0 -628
  156. package/src/table-builder/enums/filterTypes.ts +0 -39
  157. package/src/table-builder/functions/boolean-filter-function.ts +0 -12
  158. package/src/table-builder/functions/date-filter-function.ts +0 -85
  159. package/src/table-builder/functions/download-data.ts +0 -11
  160. package/src/table-builder/functions/null-filter-function.ts +0 -9
  161. package/src/table-builder/functions/number-filter-function.ts +0 -47
  162. package/src/table-builder/functions/sort-data-function.ts +0 -80
  163. package/src/table-builder/functions/string-filter-function.ts +0 -59
  164. package/src/table-builder/interfaces/ColumnInfo.ts +0 -9
  165. package/src/table-builder/interfaces/dictionary.ts +0 -3
  166. package/src/table-builder/interfaces/meta-data.ts +0 -279
  167. package/src/table-builder/ngrx/tableBuilderStateStore.ts +0 -203
  168. package/src/table-builder/pipes/column-total.pipe.ts +0 -16
  169. package/src/table-builder/pipes/format-filter-type.pipe.ts +0 -12
  170. package/src/table-builder/pipes/format-filter-value.pipe.ts +0 -71
  171. package/src/table-builder/pipes/key-display.ts +0 -13
  172. package/src/table-builder/services/all-values-filter-creator.service.ts +0 -92
  173. package/src/table-builder/services/export-to-csv.service.ts +0 -117
  174. package/src/table-builder/services/link-creator.service.ts +0 -98
  175. package/src/table-builder/services/table-template-service.ts +0 -47
  176. package/src/table-builder/services/transform-creator.ts +0 -90
  177. package/src/table-builder/specs/table-custom-filters.spec.ts +0 -262
  178. package/src/table-builder/styles/collapser.styles.scss +0 -16
  179. package/src/table-builder/table-builder.module.ts +0 -42
  180. package/src/table-builder/types/group-types.ts +0 -42
  181. package/src/table-builder/types/index.ts +0 -1
  182. package/src/test.ts +0 -17
  183. package/src/utilities/array-helpers.ts +0 -13
  184. package/src/utilities/directives/auto-focus.directive.ts +0 -20
  185. package/src/utilities/directives/clickEmitterDirective.ts +0 -15
  186. package/src/utilities/directives/clickSubject.ts +0 -19
  187. package/src/utilities/directives/conditional-classes.directive.ts +0 -36
  188. package/src/utilities/directives/dialog-service.ts +0 -19
  189. package/src/utilities/directives/dialog.ts +0 -174
  190. package/src/utilities/directives/mat-toggle-group-directive.ts +0 -60
  191. package/src/utilities/directives/prevent-enter.directive.ts +0 -12
  192. package/src/utilities/directives/stop-propagation.directive.ts +0 -19
  193. package/src/utilities/directives/styler.ts +0 -45
  194. package/src/utilities/directives/trim-whitespace.directive.ts +0 -20
  195. package/src/utilities/index.ts +0 -22
  196. package/src/utilities/module.ts +0 -53
  197. package/src/utilities/pipes/function.pipe.ts +0 -21
  198. package/src/utilities/pipes/phone.pipe.ts +0 -20
  199. package/src/utilities/pipes/space-case.pipes.spec.ts +0 -47
  200. package/src/utilities/pipes/space-case.pipes.ts +0 -29
  201. package/tsconfig.lib.json +0 -20
  202. package/tsconfig.lib.prod.json +0 -10
  203. package/tsconfig.spec.json +0 -17
@@ -1,228 +0,0 @@
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
@@ -1,325 +0,0 @@
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