@cccteam/ccc-lib 0.0.15 → 0.0.16

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 (221) hide show
  1. package/README.md +38 -13
  2. package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs +36 -0
  3. package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs.map +1 -0
  4. package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs +25 -0
  5. package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs.map +1 -0
  6. package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs +83 -0
  7. package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs.map +1 -0
  8. package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs +44 -0
  9. package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs.map +1 -0
  10. package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs +82 -0
  11. package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs.map +1 -0
  12. package/fesm2022/cccteam-ccc-lib-src-ccc-camel-case-to-title.mjs +33 -0
  13. package/fesm2022/cccteam-ccc-lib-src-ccc-camel-case-to-title.mjs.map +1 -0
  14. package/fesm2022/cccteam-ccc-lib-src-ccc-grid.mjs +256 -0
  15. package/fesm2022/cccteam-ccc-lib-src-ccc-grid.mjs.map +1 -0
  16. package/fesm2022/cccteam-ccc-lib-src-ccc-resource.mjs +3129 -0
  17. package/fesm2022/cccteam-ccc-lib-src-ccc-resource.mjs.map +1 -0
  18. package/fesm2022/cccteam-ccc-lib-src-forms.mjs +79 -0
  19. package/fesm2022/cccteam-ccc-lib-src-forms.mjs.map +1 -0
  20. package/fesm2022/cccteam-ccc-lib-src-internal-types.mjs +6 -0
  21. package/fesm2022/cccteam-ccc-lib-src-internal-types.mjs.map +1 -0
  22. package/fesm2022/cccteam-ccc-lib-src-types.mjs +431 -0
  23. package/fesm2022/cccteam-ccc-lib-src-types.mjs.map +1 -0
  24. package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs +48 -0
  25. package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs.map +1 -0
  26. package/fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs +41 -0
  27. package/fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs.map +1 -0
  28. package/fesm2022/cccteam-ccc-lib-src-ui-idle-service.mjs +157 -0
  29. package/fesm2022/cccteam-ccc-lib-src-ui-idle-service.mjs.map +1 -0
  30. package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs +50 -0
  31. package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs.map +1 -0
  32. package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs +63 -0
  33. package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs.map +1 -0
  34. package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs +60 -0
  35. package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs.map +1 -0
  36. package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs +19 -0
  37. package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs.map +1 -0
  38. package/fesm2022/cccteam-ccc-lib.mjs +4444 -0
  39. package/fesm2022/cccteam-ccc-lib.mjs.map +1 -0
  40. package/package.json +88 -5
  41. package/types/cccteam-ccc-lib-src-auth-authentication-guard.d.ts +6 -0
  42. package/types/cccteam-ccc-lib-src-auth-authorization-guard.d.ts +6 -0
  43. package/types/cccteam-ccc-lib-src-auth-forms.d.ts +28 -0
  44. package/types/cccteam-ccc-lib-src-auth-has-permission.d.ts +15 -0
  45. package/types/cccteam-ccc-lib-src-auth-service.d.ts +38 -0
  46. package/types/cccteam-ccc-lib-src-ccc-camel-case-to-title.d.ts +10 -0
  47. package/types/cccteam-ccc-lib-src-ccc-grid.d.ts +35 -0
  48. package/types/cccteam-ccc-lib-src-ccc-resource.d.ts +674 -0
  49. package/types/cccteam-ccc-lib-src-forms.d.ts +27 -0
  50. package/types/cccteam-ccc-lib-src-types.d.ts +934 -0
  51. package/types/cccteam-ccc-lib-src-ui-alert.d.ts +16 -0
  52. package/types/cccteam-ccc-lib-src-ui-core-service.d.ts +20 -0
  53. package/types/cccteam-ccc-lib-src-ui-idle-service.d.ts +49 -0
  54. package/types/cccteam-ccc-lib-src-ui-interceptor.d.ts +16 -0
  55. package/types/cccteam-ccc-lib-src-ui-notification-service.d.ts +33 -0
  56. package/types/cccteam-ccc-lib-src-ui-sidenav.d.ts +33 -0
  57. package/types/cccteam-ccc-lib-src-util-request-options.d.ts +12 -0
  58. package/types/cccteam-ccc-lib.d.ts +1877 -0
  59. package/eslint.config.js +0 -32
  60. package/ng-package.json +0 -11
  61. package/src/auth-authentication-guard/authentication.guard.ts +0 -40
  62. package/src/auth-authentication-guard/index.ts +0 -1
  63. package/src/auth-authentication-guard/ng-package.json +0 -6
  64. package/src/auth-authorization-guard/authorization.guard.ts +0 -17
  65. package/src/auth-authorization-guard/index.ts +0 -1
  66. package/src/auth-authorization-guard/ng-package.json +0 -6
  67. package/src/auth-forms/ccc-field/ccc-field.component.html +0 -1
  68. package/src/auth-forms/ccc-field/ccc-field.component.scss +0 -0
  69. package/src/auth-forms/ccc-field/ccc-field.component.spec.ts +0 -22
  70. package/src/auth-forms/ccc-field/ccc-field.component.ts +0 -74
  71. package/src/auth-forms/form-helpers.ts +0 -39
  72. package/src/auth-forms/index.ts +0 -3
  73. package/src/auth-forms/ng-package.json +0 -6
  74. package/src/auth-has-permission/has-permission.directive.ts +0 -34
  75. package/src/auth-has-permission/index.ts +0 -1
  76. package/src/auth-has-permission/ng-package.json +0 -6
  77. package/src/auth-service/auth.service.ts +0 -92
  78. package/src/auth-service/index.ts +0 -1
  79. package/src/auth-service/ng-package.json +0 -6
  80. package/src/ccc-camel-case-to-title/camel-case-to-title.pipe.ts +0 -23
  81. package/src/ccc-camel-case-to-title/index.ts +0 -1
  82. package/src/ccc-camel-case-to-title/ng-package.json +0 -6
  83. package/src/ccc-grid/ccc-grid.component.ts +0 -155
  84. package/src/ccc-grid/index.ts +0 -3
  85. package/src/ccc-grid/ng-package.json +0 -6
  86. package/src/ccc-grid/table-button/table-button.component.html +0 -16
  87. package/src/ccc-grid/table-button/table-button.component.scss +0 -5
  88. package/src/ccc-grid/table-button/table-button.component.spec.ts +0 -22
  89. package/src/ccc-grid/table-button/table-button.component.ts +0 -49
  90. package/src/ccc-resource/can-deactivate.guard.ts +0 -41
  91. package/src/ccc-resource/compound-resource/compound-resource.component.html +0 -57
  92. package/src/ccc-resource/compound-resource/compound-resource.component.scss +0 -86
  93. package/src/ccc-resource/compound-resource/compound-resource.component.spec.ts +0 -22
  94. package/src/ccc-resource/compound-resource/compound-resource.component.ts +0 -158
  95. package/src/ccc-resource/concat-fns.ts +0 -162
  96. package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.html +0 -12
  97. package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.scss +0 -0
  98. package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.spec.ts +0 -23
  99. package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.ts +0 -17
  100. package/src/ccc-resource/form-state.service.ts +0 -24
  101. package/src/ccc-resource/format-fns.ts +0 -49
  102. package/src/ccc-resource/gui-constants.ts +0 -88
  103. package/src/ccc-resource/index.ts +0 -23
  104. package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.html +0 -8
  105. package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.scss +0 -0
  106. package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.spec.ts +0 -22
  107. package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.ts +0 -12
  108. package/src/ccc-resource/ng-package.json +0 -6
  109. package/src/ccc-resource/operation-types.ts +0 -19
  110. package/src/ccc-resource/padding-element/padding-element.component.html +0 -1
  111. package/src/ccc-resource/padding-element/padding-element.component.scss +0 -3
  112. package/src/ccc-resource/padding-element/padding-element.component.spec.ts +0 -22
  113. package/src/ccc-resource/padding-element/padding-element.component.ts +0 -20
  114. package/src/ccc-resource/resource-array-view/resource-array-view.component.html +0 -81
  115. package/src/ccc-resource/resource-array-view/resource-array-view.component.scss +0 -21
  116. package/src/ccc-resource/resource-array-view/resource-array-view.component.spec.ts +0 -22
  117. package/src/ccc-resource/resource-array-view/resource-array-view.component.ts +0 -143
  118. package/src/ccc-resource/resource-base/resource-base.component.spec.ts +0 -22
  119. package/src/ccc-resource/resource-base/resource-base.component.ts +0 -11
  120. package/src/ccc-resource/resource-cache.service.ts +0 -232
  121. package/src/ccc-resource/resource-create/resource-create.component.html +0 -31
  122. package/src/ccc-resource/resource-create/resource-create.component.scss +0 -130
  123. package/src/ccc-resource/resource-create/resource-create.component.spec.ts +0 -22
  124. package/src/ccc-resource/resource-create/resource-create.component.ts +0 -303
  125. package/src/ccc-resource/resource-field/base-field.directive.ts +0 -102
  126. package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.html +0 -16
  127. package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.scss +0 -0
  128. package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.spec.ts +0 -22
  129. package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.ts +0 -15
  130. package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.html +0 -13
  131. package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.scss +0 -0
  132. package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.spec.ts +0 -23
  133. package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.ts +0 -50
  134. package/src/ccc-resource/resource-field/fields/date-field/date-field.component.html +0 -22
  135. package/src/ccc-resource/resource-field/fields/date-field/date-field.component.scss +0 -0
  136. package/src/ccc-resource/resource-field/fields/date-field/date-field.component.spec.ts +0 -22
  137. package/src/ccc-resource/resource-field/fields/date-field/date-field.component.ts +0 -14
  138. package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.html +0 -71
  139. package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.scss +0 -9
  140. package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.spec.ts +0 -22
  141. package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.ts +0 -207
  142. package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.html +0 -38
  143. package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.scss +0 -3
  144. package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.spec.ts +0 -22
  145. package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.ts +0 -87
  146. package/src/ccc-resource/resource-field/fields/number-field/number-field.component.html +0 -23
  147. package/src/ccc-resource/resource-field/fields/number-field/number-field.component.scss +0 -6
  148. package/src/ccc-resource/resource-field/fields/number-field/number-field.component.spec.ts +0 -22
  149. package/src/ccc-resource/resource-field/fields/number-field/number-field.component.ts +0 -14
  150. package/src/ccc-resource/resource-field/fields/text-field/text-field.component.html +0 -29
  151. package/src/ccc-resource/resource-field/fields/text-field/text-field.component.scss +0 -6
  152. package/src/ccc-resource/resource-field/fields/text-field/text-field.component.spec.ts +0 -22
  153. package/src/ccc-resource/resource-field/fields/text-field/text-field.component.ts +0 -23
  154. package/src/ccc-resource/resource-field/resource-field.component.html +0 -112
  155. package/src/ccc-resource/resource-field/resource-field.component.scss +0 -7
  156. package/src/ccc-resource/resource-field/resource-field.component.spec.ts +0 -22
  157. package/src/ccc-resource/resource-field/resource-field.component.ts +0 -214
  158. package/src/ccc-resource/resource-layout/resource-layout.component.html +0 -73
  159. package/src/ccc-resource/resource-layout/resource-layout.component.scss +0 -26
  160. package/src/ccc-resource/resource-layout/resource-layout.component.spec.ts +0 -22
  161. package/src/ccc-resource/resource-layout/resource-layout.component.ts +0 -176
  162. package/src/ccc-resource/resource-list/ resource-list.component.spec.ts +0 -22
  163. package/src/ccc-resource/resource-list/resource-list.component.html +0 -27
  164. package/src/ccc-resource/resource-list/resource-list.component.scss +0 -67
  165. package/src/ccc-resource/resource-list/resource-list.component.ts +0 -376
  166. package/src/ccc-resource/resource-list-create/resource-list-create.component.html +0 -71
  167. package/src/ccc-resource/resource-list-create/resource-list-create.component.scss +0 -9
  168. package/src/ccc-resource/resource-list-create/resource-list-create.component.spec.ts +0 -22
  169. package/src/ccc-resource/resource-list-create/resource-list-create.component.ts +0 -103
  170. package/src/ccc-resource/resource-resolver/resource-resolver.component.html +0 -1
  171. package/src/ccc-resource/resource-resolver/resource-resolver.component.scss +0 -0
  172. package/src/ccc-resource/resource-resolver/resource-resolver.component.spec.ts +0 -22
  173. package/src/ccc-resource/resource-resolver/resource-resolver.component.ts +0 -69
  174. package/src/ccc-resource/resource-store.service.ts +0 -93
  175. package/src/ccc-resource/resource-view/resource-view.component.html +0 -133
  176. package/src/ccc-resource/resource-view/resource-view.component.scss +0 -150
  177. package/src/ccc-resource/resource-view/resource-view.component.spec.ts +0 -22
  178. package/src/ccc-resource/resource-view/resource-view.component.ts +0 -354
  179. package/src/ccc-resource/resources-helpers.ts +0 -262
  180. package/src/ccc-resource/utils/validator-utils.ts +0 -6
  181. package/src/index.ts +0 -44
  182. package/src/internal-types/ng-package.json +0 -6
  183. package/src/types/auth.actions.ts +0 -46
  184. package/src/types/configs.ts +0 -952
  185. package/src/types/constants.ts +0 -1
  186. package/src/types/core.actions.ts +0 -33
  187. package/src/types/index.ts +0 -9
  188. package/src/types/ng-package.json +0 -6
  189. package/src/types/notification-message.ts +0 -20
  190. package/src/types/permissions.ts +0 -17
  191. package/src/types/session-info.ts +0 -10
  192. package/src/types/tokens.ts +0 -20
  193. package/src/ui-alert/alert.component.html +0 -13
  194. package/src/ui-alert/alert.component.scss +0 -48
  195. package/src/ui-alert/alert.component.spec.ts +0 -22
  196. package/src/ui-alert/alert.component.ts +0 -35
  197. package/src/ui-alert/index.ts +0 -1
  198. package/src/ui-alert/ng-package.json +0 -6
  199. package/src/ui-core-service/index.ts +0 -1
  200. package/src/ui-core-service/ng-package.json +0 -6
  201. package/src/ui-core-service/ui-core.service.ts +0 -34
  202. package/src/ui-interceptor/api.interceptor.spec.ts +0 -16
  203. package/src/ui-interceptor/api.interceptor.ts +0 -45
  204. package/src/ui-interceptor/index.ts +0 -1
  205. package/src/ui-interceptor/ng-package.json +0 -6
  206. package/src/ui-notification-service/index.ts +0 -1
  207. package/src/ui-notification-service/ng-package.json +0 -6
  208. package/src/ui-notification-service/notification.service.ts +0 -59
  209. package/src/ui-sidenav/index.ts +0 -1
  210. package/src/ui-sidenav/ng-package.json +0 -6
  211. package/src/ui-sidenav/sidenav.component.html +0 -60
  212. package/src/ui-sidenav/sidenav.component.scss +0 -99
  213. package/src/ui-sidenav/sidenav.component.spec.ts +0 -22
  214. package/src/ui-sidenav/sidenav.component.ts +0 -64
  215. package/src/util-request-options/index.ts +0 -1
  216. package/src/util-request-options/ng-package.json +0 -6
  217. package/src/util-request-options/request-options.ts +0 -17
  218. package/tsconfig.lib.json +0 -13
  219. package/tsconfig.lib.prod.json +0 -11
  220. package/tsconfig.spec.json +0 -15
  221. /package/{src/internal-types/index.ts → types/cccteam-ccc-lib-src-internal-types.d.ts} +0 -0
@@ -1,952 +0,0 @@
1
- import { ValidatorFn } from '@angular/forms';
2
- import { TooltipPosition } from '@angular/material/tooltip';
3
- import { defaultEmptyFieldValue } from './constants';
4
- import { FieldName, Method, Resource } from './permissions';
5
- export type ConcatFn = 'space-concat' | 'hyphen-concat' | 'space-hyphen-concat' | 'hyphen-space-concat';
6
-
7
- declare const __singletonValidatorBrand: unique symbol;
8
- export type ResourceValidatorFn = ValidatorFn & {
9
- readonly [__singletonValidatorBrand]: true;
10
- };
11
-
12
- export interface MenuItem {
13
- label: string;
14
- route?: string[];
15
- children?: MenuItem[];
16
- }
17
-
18
- export type NullBoolean = null | true | false;
19
- export type ValidDisplayTypes =
20
- | 'boolean'
21
- | 'nullboolean'
22
- | 'number'
23
- | 'string'
24
- | 'date'
25
- | 'enumerated'
26
- | 'link'
27
- | 'uuid'
28
- | 'civildate';
29
- export type ValidRPCTypes = ValidDisplayTypes | `${ValidDisplayTypes}[]`;
30
-
31
- export type PristineData = Record<string, DataType | null>;
32
-
33
- export interface FieldMeta {
34
- fieldName: string;
35
- /** Indicates whether the field is required and only applies during resource creation.
36
- * Use the validators config parameter in all other contexts
37
- */
38
- required: boolean;
39
- primaryKey?: { ordinalPosition: number };
40
- displayType: ValidDisplayTypes;
41
- enumeratedResource?: Resource;
42
- isIndex: boolean;
43
- }
44
-
45
- export interface RPCFieldMeta {
46
- fieldName: string;
47
- displayType: ValidRPCTypes;
48
- enumeratedResource?: Resource;
49
- }
50
-
51
- export interface MethodMeta {
52
- route: string;
53
- fields?: RPCFieldMeta[];
54
- }
55
-
56
- export interface ResourceMeta {
57
- route: string;
58
- consolidatedRoute?: string;
59
- listDisabled?: boolean;
60
- readDisabled?: boolean;
61
- createDisabled?: boolean;
62
- updateDisabled?: boolean;
63
- deleteDisabled?: boolean;
64
- substringSearchParameter?: string;
65
- fields: FieldMeta[];
66
- }
67
-
68
- export type Meta = MethodMeta | ResourceMeta;
69
-
70
- export interface Link {
71
- id: string;
72
- resource: Resource;
73
- text: string;
74
- }
75
-
76
- export type ResourceMap = Record<Resource, ResourceMeta>;
77
-
78
- export interface RouteResourceData {
79
- config: RootConfig;
80
- }
81
-
82
- export type DataType = string | number | number[] | string[] | boolean | undefined | Date;
83
- export type RecordData = Record<string, DataType | null>;
84
-
85
- export type RPCDataType = string | number | string[] | number[] | boolean | Date;
86
- export type RPCRecordData = Record<string, RPCDataType>;
87
-
88
- export type ParentResourceConfig = ListViewConfig | ViewConfig | ArrayConfig;
89
- export type ChildResourceConfig = ListViewConfig | ViewConfig | ComponentConfig | ArrayConfig;
90
-
91
- export type ActionType = 'function' | 'link';
92
-
93
- export type ListConcatFn =
94
- | 'space-concat'
95
- | 'hyphen-concat'
96
- | 'space-hyphen-concat'
97
- | 'hyphen-space-concat'
98
- | 'no-space-concat';
99
- export type ConfigType = ChildResourceConfig;
100
- export type FormatType = 'simpleSlashDateFormat';
101
- export type RPCPlacement = 'inline' | 'end';
102
-
103
- export type ColumnConfig = SingleColumnConfig | MultiColumnConfig;
104
-
105
- export interface ActionButtonConfig {
106
- label: string;
107
- icon: string;
108
- action?: (resource: { id: string }) => void;
109
- viewRoute?: string;
110
- actionType?: ActionType;
111
- color?: string;
112
- disabledLabel?: string;
113
- }
114
- export interface ActionButtonConfigOptions {
115
- label: string;
116
- icon: string;
117
- action?: (resource: { id: string }) => void;
118
- viewRoute?: string;
119
- actionType?: ActionType;
120
- color?: string;
121
- disabledLabel?: string;
122
- }
123
-
124
- export function actionButtonConfig(config: ActionButtonConfigOptions): ActionButtonConfig {
125
- return {
126
- ...actionButtonConfigDefaults,
127
- ...config,
128
- } satisfies ActionButtonConfig;
129
- }
130
-
131
- export const actionButtonConfigDefaults = {
132
- label: '',
133
- icon: '',
134
- actionType: 'function' as ActionType,
135
- color: '',
136
- disabledLabel: '',
137
- } satisfies ActionButtonConfig;
138
-
139
- export interface SingleColumnConfig {
140
- id: FieldName;
141
- header?: string;
142
- width?: number;
143
- resizable?: boolean;
144
- /* eslint-disable @typescript-eslint/no-explicit-any */
145
- valueGetter?: (data: any) => string;
146
- valueFormatter?: (data: any) => string;
147
- tooltipPosition?: TooltipPosition;
148
- viewRoute?: Resource;
149
- buttonConfig?: ActionButtonConfig;
150
- actionType?: ActionType;
151
- formatType?: FormatType | string;
152
- hidden?: boolean;
153
- emptyDataValue?: DataType;
154
- filterable?: boolean;
155
- hideHeader?: boolean;
156
- }
157
- export interface SingleColumnConfigOptions {
158
- id: FieldName;
159
- header?: string;
160
- width?: number;
161
- resizable?: boolean;
162
- /* eslint-disable @typescript-eslint/no-explicit-any */
163
- valueGetter?: (data: any) => string;
164
- valueFormatter?: (data: any) => string;
165
- tooltipPosition?: TooltipPosition;
166
- viewRoute?: Resource;
167
- buttonConfig?: ActionButtonConfig;
168
- actionType?: ActionType;
169
- formatType?: FormatType | string;
170
- hidden?: boolean;
171
- emptyDataValue?: DataType;
172
- filterable?: boolean;
173
- hideHeader?: boolean;
174
- }
175
-
176
- export function singleColumnConfig(config: SingleColumnConfigOptions): SingleColumnConfig {
177
- return {
178
- ...singleColumnConfigDefaults,
179
- ...config,
180
- } satisfies SingleColumnConfig;
181
- }
182
-
183
- export const singleColumnConfigDefaults = {
184
- id: '' as FieldName,
185
- header: '',
186
- resizable: true,
187
- actionType: 'function' as ActionType,
188
- hidden: false,
189
- filterable: true,
190
- hideHeader: false,
191
- } satisfies SingleColumnConfig;
192
-
193
- export interface MultiColumnConfig extends SingleColumnConfig {
194
- // todo: additionalIds name is not clear. the id provided is fetched from a different resource, such as a typeId
195
- additionalIds: AdditionalResourceConfig[];
196
- concatFn: ListConcatFn;
197
- }
198
- export interface MultiColumnConfigOptions extends SingleColumnConfigOptions {
199
- additionalIds: AdditionalResourceConfig[];
200
- concatFn: ListConcatFn;
201
- }
202
-
203
- export function multiColumnConfig(config: MultiColumnConfigOptions): MultiColumnConfig {
204
- return {
205
- ...multiColumnConfigDefaults,
206
- ...config,
207
- } satisfies MultiColumnConfig;
208
- }
209
-
210
- export const multiColumnConfigDefaults = {
211
- ...singleColumnConfigDefaults,
212
- additionalIds: [] as AdditionalResourceConfig[],
213
- concatFn: 'hyphen-concat' as ListConcatFn,
214
- } satisfies MultiColumnConfig;
215
-
216
- export interface AdditionalResourceConfig {
217
- resource?: Resource;
218
- id: FieldName;
219
- field?: FieldName;
220
- hidden?: boolean;
221
- }
222
- export interface AdditionalResourceConfigOptions {
223
- id: FieldName;
224
- resource?: Resource;
225
- field?: FieldName;
226
- hidden?: boolean;
227
- }
228
-
229
- export function additionalResourceConfig(config: AdditionalResourceConfigOptions): AdditionalResourceConfig {
230
- return {
231
- ...additionalResourceConfigDefaults,
232
- ...config,
233
- } satisfies AdditionalResourceConfig;
234
- }
235
-
236
- export const additionalResourceConfigDefaults = {
237
- id: '' as FieldName,
238
- resource: '' as Resource,
239
- field: '' as FieldName,
240
- hidden: false,
241
- } satisfies AdditionalResourceConfig;
242
-
243
- export interface FieldSort {
244
- field: FieldName;
245
- direction: 'asc' | 'desc';
246
- }
247
- export interface FieldSortOptions {
248
- field: FieldName;
249
- direction?: 'asc' | 'desc';
250
- }
251
-
252
- export function fieldSort(config: FieldSortOptions): FieldSort {
253
- return {
254
- ...fieldSortDefaults,
255
- ...config,
256
- } satisfies FieldSort;
257
- }
258
-
259
- export const fieldSortDefaults = {
260
- field: '' as FieldName,
261
- direction: 'asc' as 'asc' | 'desc',
262
- } satisfies FieldSort;
263
-
264
- export interface EnumeratedConfigOptions {
265
- // primaryResource comes from the metadata
266
- overrideResource?: Resource;
267
- /* eslint-disable @typescript-eslint/no-explicit-any */
268
- filter?: (parentResource: any) => string;
269
- sorts?: FieldSort[];
270
- listDisplay?: FieldName[];
271
- viewDisplay: FieldName[];
272
- viewConcatFn?: ConcatFn;
273
- listConcatFn?: ConcatFn;
274
- viewDetails?: boolean;
275
- searchable?: boolean;
276
- }
277
- export interface EnumeratedConfig {
278
- overrideResource: Resource;
279
- filter: (parentResource: any) => string;
280
- sorts: FieldSort[];
281
- listDisplay: FieldName[];
282
- viewDisplay: FieldName[];
283
- viewConcatFn: ConcatFn;
284
- listConcatFn: ConcatFn;
285
- viewDetails: boolean;
286
- searchable: boolean;
287
- }
288
- export function enumeratedConfig(config: EnumeratedConfigOptions): EnumeratedConfig {
289
- return {
290
- ...enumeratedConfigDefaults,
291
- ...config,
292
- } satisfies EnumeratedConfig;
293
- }
294
- export const enumeratedConfigDefaults = {
295
- overrideResource: '' as Resource,
296
- filter: (): string => '',
297
- sorts: [] as FieldSort[],
298
- listDisplay: [] as FieldName[],
299
- viewDisplay: [] as FieldName[],
300
- viewConcatFn: 'hyphen-concat' as ConcatFn,
301
- listConcatFn: 'hyphen-concat' as ConcatFn,
302
- viewDetails: false,
303
- searchable: false,
304
- };
305
-
306
- export type FieldDefault = ForeignKeyDefault | StaticDefault | null;
307
-
308
- export interface NullBooleanConfigOptions {
309
- displayValues?: Record<'null' | 'true' | 'false', { label: string; value: NullBoolean }>;
310
- }
311
- export interface NullBooleanConfig {
312
- /** This property maps the three possible values for this
313
- * nullboolean field with the display values users will see
314
- * on the screen for each
315
- */
316
- displayValues: Record<'null' | 'true' | 'false', { label: string; value: NullBoolean }>;
317
-
318
- /** TODO: In FUTURE PHASES once field change history is implemented
319
- * When this field is first displayed on screen, set the
320
- * value to null based on the value present in it.
321
- * Useful if the database doesn't have support nulling but you want
322
- * users to make a conscious selection, but the database
323
- * will either contain a true or false. Will need to check the
324
- * 'last edited' on the field to ensure that we don't repeatedly spam
325
- * users with this though
326
- */
327
- // nullOnEdit: {
328
- // nullIfTrue: boolean;
329
- // nullIfFalse: boolean;
330
- // };
331
- }
332
- export function nullBooleanConfig(config: NullBooleanConfigOptions): NullBooleanConfig {
333
- return {
334
- ...nullBooleanConfigDefaults,
335
- ...config,
336
- } satisfies NullBooleanConfig;
337
- }
338
- const defaultBooleanDisplay = Object.freeze({
339
- null: {
340
- label: defaultEmptyFieldValue,
341
- value: null,
342
- },
343
- true: {
344
- label: 'Yes',
345
- value: true,
346
- },
347
- false: {
348
- label: 'No',
349
- value: false,
350
- },
351
- });
352
-
353
- export const nullBooleanConfigDefaults = {
354
- displayValues: defaultBooleanDisplay,
355
- };
356
-
357
- export interface ForeignKeyDefaultOptions {
358
- parentId: FieldName;
359
- }
360
- export interface ForeignKeyDefault {
361
- type: 'foreignKey';
362
- parentId: FieldName;
363
- }
364
- export function foreignKeyDefault(config: ForeignKeyDefaultOptions): ForeignKeyDefault {
365
- return {
366
- ...foreignKeyDefaultDefaults,
367
- ...config,
368
- } satisfies ForeignKeyDefault;
369
- }
370
- export const foreignKeyDefaultDefaults = {
371
- type: 'foreignKey',
372
- parentId: '' as FieldName,
373
- } satisfies ForeignKeyDefault;
374
-
375
- export interface StaticDefault {
376
- type: 'static';
377
- value: string | boolean;
378
- }
379
- export interface staticDefaultOptions {
380
- value: string | boolean;
381
- }
382
- export function staticDefault(config: staticDefaultOptions): StaticDefault {
383
- return {
384
- ...staticDefaultDefaults,
385
- ...config,
386
- } satisfies StaticDefault;
387
- }
388
- export const staticDefaultDefaults = {
389
- type: 'static',
390
- value: '',
391
- } satisfies StaticDefault;
392
-
393
- export type Affix = string | remoteData | parentData;
394
-
395
- interface remoteData {
396
- resource: Resource;
397
- id: FieldName;
398
- field: FieldName;
399
- }
400
-
401
- interface parentData {
402
- field: FieldName;
403
- }
404
-
405
- export type ConfigElement = FieldElement | SectionElement | ComputedDisplayFieldElement | PaddingElement;
406
-
407
- export type ColSize = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
408
-
409
- export interface ComputedDisplayFieldElementOptions {
410
- label?: string;
411
- class?: string;
412
- cols?: ColSize;
413
- calculatedValue?: (data: any) => string;
414
- shouldRender?: ((data: any) => boolean) | boolean;
415
- }
416
- export interface ComputedDisplayFieldElement {
417
- type: 'computedDisplayField';
418
- label: string;
419
- class: string;
420
- cols: ColSize;
421
- calculatedValue: (data: any) => string;
422
- shouldRender: ((data: any) => boolean) | boolean;
423
- }
424
- export function computedDisplayField(config: ComputedDisplayFieldElementOptions): ComputedDisplayFieldElement {
425
- return {
426
- ...computedDisplayFieldElementDefaults,
427
- ...config,
428
- } satisfies ComputedDisplayFieldElement;
429
- }
430
- export const computedDisplayFieldElementDefaults = {
431
- type: 'computedDisplayField',
432
- label: '',
433
- class: '',
434
- cols: 6,
435
- calculatedValue: (): string => '',
436
- shouldRender: true,
437
- } satisfies ComputedDisplayFieldElement;
438
-
439
- export interface PaddingElementOptions {
440
- cols?: ColSize;
441
- shouldRender?: ((data: any) => boolean) | boolean;
442
- }
443
- export interface PaddingElement {
444
- type: 'padding';
445
- cols: ColSize;
446
- /** Determines whether the padding is shown
447
- */
448
- shouldRender: ((data: any) => boolean) | boolean;
449
- }
450
- export function padding(config?: PaddingElementOptions): PaddingElement {
451
- return {
452
- ...paddingElementDefaults,
453
- ...config,
454
- } satisfies PaddingElement;
455
- }
456
- export const paddingElementDefaults = {
457
- type: 'padding',
458
- cols: 12,
459
- shouldRender: true,
460
- } satisfies PaddingElement;
461
-
462
- export interface SectionElementOptions {
463
- label?: string;
464
- class?: string;
465
- cols?: ColSize;
466
- shouldRender?: ((data: any) => boolean) | boolean;
467
- nullAllChildrenIfConditionallyHidden?: boolean;
468
- children?: ConfigElement[];
469
- }
470
- export interface SectionElement {
471
- type: 'section';
472
- label: string;
473
- class: string;
474
- cols: ColSize;
475
- /**
476
- * shouldRender is used to determine if the section should be
477
- * displayed to users.
478
- * When assigning shouldRender a function, the first argument
479
- * is the current state of the resource being displayed
480
- * Hides the layout AND all of its children
481
- */
482
- shouldRender: ((data: any) => boolean) | boolean;
483
- /** If shouldRender is NOT a function, this property does nothing
484
- * If shouldRender is a function, this property
485
- * sets children's values to null if shouldRender hides it (returns false)
486
- * within the resource-layout.component
487
- */
488
- nullAllChildrenIfConditionallyHidden: boolean;
489
- children: ConfigElement[];
490
- }
491
- export function section(config: SectionElementOptions): SectionElement {
492
- return {
493
- ...sectionElementDefaults,
494
- ...config,
495
- } satisfies SectionElement;
496
- }
497
- export const sectionElementDefaults = {
498
- type: 'section',
499
- label: '',
500
- class: '',
501
- cols: 12,
502
- shouldRender: true,
503
- nullAllChildrenIfConditionallyHidden: false,
504
- children: [],
505
- } satisfies SectionElement;
506
-
507
- export interface FieldElementOptions {
508
- name: FieldName;
509
- label?: string;
510
- cols?: ColSize;
511
- class?: string;
512
- enumeratedConfig?: EnumeratedConfig;
513
- default?: FieldDefault;
514
- nullBooleanConfig?: NullBooleanConfig;
515
- validators?: ((data: any) => ResourceValidatorFn[]) | ResourceValidatorFn[];
516
- readOnly?: boolean;
517
- prefixes?: Affix[];
518
- suffixes?: Affix[];
519
- shouldRender?: ((data: any) => boolean) | boolean;
520
- nullIfConditionallyHidden?: boolean;
521
- }
522
- export interface FieldElement {
523
- type: 'field';
524
- name: string;
525
- label: string;
526
- cols: ColSize;
527
- class: string;
528
- enumeratedConfig: EnumeratedConfig;
529
- default: FieldDefault;
530
- nullBooleanConfig: NullBooleanConfig;
531
- /**
532
- * A list of validators that must pass to allow a field to be submitted.
533
- * Utilize existing validators in the resourceValidators object, and
534
- * add any new or custom validators to it
535
- */
536
- validators: ((data: any) => ResourceValidatorFn[]) | ResourceValidatorFn[];
537
- readOnly: boolean;
538
- prefixes: Affix[];
539
- suffixes: Affix[];
540
- /**
541
- * shouldRender is used to determine if the element should be
542
- * displayed to users.
543
- * When assigning shouldRender a function, the first argument
544
- * is the current state of the resource being displayed
545
- */
546
- shouldRender: ((data: any) => boolean) | boolean;
547
- /** If shouldRender is NOT a function, this property does nothing
548
- * If shouldRender is a function, this property
549
- * determines whether the form control associated
550
- * with this config element should have its value
551
- * set to null if shouldRender hides it (returns false)
552
- */
553
- nullIfConditionallyHidden: boolean;
554
- }
555
-
556
- export function field(config: FieldElementOptions): FieldElement {
557
- return {
558
- ...fieldElementDefaults,
559
- ...config,
560
- } satisfies FieldElement;
561
- }
562
- export const fieldElementDefaults = {
563
- type: 'field',
564
- name: '',
565
- label: '',
566
- cols: 6,
567
- class: '',
568
- enumeratedConfig: { ...enumeratedConfigDefaults },
569
- default: null,
570
- validators: [],
571
- nullBooleanConfig: { ...nullBooleanConfigDefaults },
572
- readOnly: false,
573
- prefixes: [],
574
- suffixes: [],
575
- shouldRender: true,
576
- nullIfConditionallyHidden: false,
577
- } satisfies FieldElement;
578
-
579
- /**
580
- * RouteData is used to define the route for a config
581
- * route: the route for the config
582
- * hasViewRoute: when true, a route will be created for route/:uuid
583
- */
584
- export interface RootRouteData {
585
- route?: string;
586
- hasViewRoute?: boolean;
587
- }
588
-
589
- export interface RPCConfigOptions {
590
- label: string;
591
- afterMethodRedirect?: string;
592
- conditions: {
593
- field: FieldName;
594
- matchValues: string[];
595
- }[];
596
- methodBodyTemplate?: unknown;
597
- successMessage?: string;
598
- elements?: ConfigElement[];
599
- placement?: RPCPlacement;
600
- method: Method;
601
- customComponent?: ComponentConfig;
602
- refreshResources?: Resource[];
603
- defaultModalWidth?: string;
604
- }
605
- export interface RPCConfig {
606
- label: string;
607
- afterMethodRedirect: string | string[];
608
- conditions: {
609
- field: FieldName;
610
- matchValues: string[];
611
- }[];
612
- methodBodyTemplate: unknown;
613
- method: Method;
614
- successMessage: string;
615
- elements: ConfigElement[];
616
- placement: RPCPlacement;
617
- customComponent: ComponentConfig;
618
- refreshResources: Resource[];
619
- defaultModalWidth: string;
620
- }
621
- export function rpcConfig(config: RPCConfigOptions): RPCConfig {
622
- return {
623
- ...rpcConfigDefaults,
624
- ...config,
625
- } satisfies RPCConfig;
626
- }
627
- export const rpcConfigDefaults = {
628
- label: '',
629
- afterMethodRedirect: '',
630
- conditions: [] as {
631
- field: FieldName;
632
- matchValues: string[];
633
- }[],
634
- methodBodyTemplate: {} as unknown,
635
- successMessage: '',
636
- elements: [] as ConfigElement[],
637
- placement: 'end' as RPCPlacement,
638
- method: '' as Method,
639
- customComponent: {} as ComponentConfig,
640
- refreshResources: [] as Resource[],
641
- defaultModalWidth: '',
642
- } satisfies RPCConfig;
643
-
644
- export interface RPCBaseFormData {
645
- elements: FieldElement[];
646
- label: string;
647
- method: Method;
648
- }
649
-
650
- // Config is the base type that all configurations should start with
651
- export interface RootConfigOptions {
652
- routeData?: RootRouteData;
653
- nav?: {
654
- navItem: MenuItem;
655
- group?: string;
656
- };
657
- parentConfig: ParentResourceConfig;
658
- relatedConfigs?: ChildResourceConfig[];
659
- rpcConfigs?: RPCConfig[];
660
- }
661
- export interface RootConfig {
662
- routeData: RootRouteData;
663
- nav: {
664
- navItem: MenuItem;
665
- group?: string;
666
- };
667
- parentConfig: ParentResourceConfig;
668
- relatedConfigs: ChildResourceConfig[];
669
- rpcConfigs?: RPCConfig[];
670
- }
671
- export const rootConfigDefaults = {
672
- routeData: {} as RootRouteData,
673
- nav: {
674
- navItem: {} as MenuItem,
675
- },
676
- parentConfig: {} as ParentResourceConfig,
677
- relatedConfigs: [] as ChildResourceConfig[],
678
- rpcConfigs: [] as RPCConfig[],
679
- } satisfies RootConfig;
680
-
681
- export function rootConfig(config: RootConfigOptions): RootConfig {
682
- return {
683
- ...rootConfigDefaults,
684
- ...config,
685
- } satisfies RootConfig;
686
- }
687
-
688
- // Base type config is the base type for all resource configurations
689
- export interface BaseConfigOptions {
690
- title?: string;
691
- createTitle?: string;
692
- createButtonLabel?: string;
693
- primaryResource: Resource;
694
- parentClass?: string;
695
- fieldClass?: string;
696
- elements: ConfigElement[];
697
- ignoreFields?: FieldName[];
698
- createConfig?: ConfigType;
699
- parentRelation?: {
700
- parentKey: FieldName;
701
- childKey: FieldName;
702
- };
703
- showBackButton?: boolean;
704
- createNavigation?: string[];
705
- }
706
- export interface BaseConfig {
707
- title: string;
708
- createTitle: string;
709
- createButtonLabel: string;
710
- primaryResource: Resource;
711
- parentClass: string;
712
- fieldClass: string;
713
- elements: ConfigElement[];
714
- ignoreFields: FieldName[];
715
- createConfig: ConfigType;
716
- parentRelation: {
717
- parentKey: FieldName;
718
- childKey: FieldName;
719
- };
720
- showBackButton: boolean;
721
- createNavigation: string[];
722
- }
723
-
724
- // Available components for a component config
725
- export type AvailableComponents = 'SwitchResolver' | 'SsnChange' | 'ReassignClaim';
726
-
727
- // Available param types for a component config
728
- export type ConfigParam = SwitchConfigParam;
729
-
730
- // Custom component config renders a custom component and supplies params to it
731
- export interface ComponentConfigOptions {
732
- // todo: it's weird that we have a primary resource here. Would be nice to remove but this adds a null check to all other configs
733
- primaryResource: Resource;
734
- component: AvailableComponents;
735
- params?: ConfigParam;
736
- relatedConfig?: ParentResourceConfig[];
737
- }
738
- export interface ComponentConfig {
739
- type: 'Component';
740
- primaryResource: Resource;
741
- component: AvailableComponents;
742
- params: ConfigParam;
743
- relatedConfig: ParentResourceConfig[];
744
- }
745
- export function componentConfig(config: ComponentConfigOptions): ComponentConfig {
746
- return {
747
- ...componentConfigDefaults,
748
- ...config,
749
- } satisfies ComponentConfig;
750
- }
751
- export const componentConfigDefaults = {
752
- type: 'Component',
753
- primaryResource: '' as Resource,
754
- component: 'SwitchResolver' as AvailableComponents,
755
- params: {
756
- cases: [],
757
- } satisfies ConfigParam,
758
- relatedConfig: [] as ParentResourceConfig[],
759
- } satisfies ComponentConfig;
760
-
761
- // A switch is a component type that allows for conditional rendering of child components based on the value of a parent field
762
- // When parentData[c.parentField] equals c.caseId render the caseConfig with parentData[c.childId] as the uuid
763
- export interface switchCase {
764
- caseId: string;
765
- parentField: string;
766
- childId: string;
767
- config: ChildResourceConfig;
768
- }
769
- export interface SwitchConfigParamOptions {
770
- cases: switchCase[];
771
- }
772
- export interface SwitchConfigParam {
773
- cases: switchCase[];
774
- }
775
- export function switchParams(config: SwitchConfigParamOptions): SwitchConfigParam {
776
- return {
777
- ...switchParamsDefaults,
778
- ...config,
779
- } satisfies SwitchConfigParam;
780
- }
781
- export const switchParamsDefaults = {
782
- cases: [] as switchCase[],
783
- } satisfies SwitchConfigParam;
784
-
785
- export interface ListViewConfigOptions extends BaseConfigOptions {
786
- showViewButton?: boolean;
787
- createType?: 'inline' | 'link';
788
- collapsible?: boolean;
789
- overrideResource?: Resource;
790
- searchable?: boolean;
791
- requireSearchToDisplayResults?: boolean;
792
- listColumns: ColumnConfig[];
793
- relatedConfigs?: ChildResourceConfig[];
794
- viewResource?: Resource | string;
795
- actionType?: ActionType;
796
- /* eslint-disable @typescript-eslint/no-explicit-any */
797
- filter?: (parentResource: any) => string;
798
- rpcConfigs?: RPCConfig[];
799
- sorts?: FieldSort[];
800
- }
801
- export interface ListViewConfig extends BaseConfig {
802
- type: 'ListView';
803
- showViewButton: boolean;
804
- createType: 'inline' | 'link';
805
- collapsible: boolean;
806
- overrideResource: Resource;
807
- searchable: boolean;
808
- requireSearchToDisplayResults: boolean;
809
- listColumns: ColumnConfig[];
810
- relatedConfigs: ChildResourceConfig[];
811
- viewResource: Resource | string;
812
- actionType: ActionType;
813
- /* eslint-disable @typescript-eslint/no-explicit-any */
814
- filter: (parentResource: any) => string;
815
- rpcConfigs?: RPCConfig[];
816
- sorts: FieldSort[];
817
- }
818
-
819
- export function listViewConfig(config: ListViewConfigOptions): ListViewConfig {
820
- return {
821
- ...listViewConfigDefaults,
822
- ...config,
823
- } satisfies ListViewConfig;
824
- }
825
- export const listViewConfigDefaults = {
826
- title: '',
827
- primaryResource: '' as Resource,
828
- type: 'ListView',
829
- createTitle: '',
830
- createButtonLabel: 'Create',
831
- createType: 'inline',
832
- showViewButton: true,
833
- collapsible: false,
834
- listColumns: [],
835
- elements: [],
836
- ignoreFields: [],
837
- parentClass: '',
838
- fieldClass: '',
839
- createConfig: {} as ListViewConfig,
840
- createNavigation: [],
841
- relatedConfigs: [],
842
- parentRelation: {
843
- parentKey: '' as FieldName,
844
- childKey: '' as FieldName,
845
- },
846
- overrideResource: '' as Resource,
847
- searchable: false,
848
- requireSearchToDisplayResults: false,
849
- showBackButton: true,
850
- filter: (): string => '',
851
- sorts: [] as FieldSort[],
852
- viewResource: '' as Resource,
853
- actionType: 'function' as ActionType,
854
- rpcConfigs: [],
855
- } satisfies ListViewConfig;
856
-
857
- export type ViewType = 'OneToOne' | 'OneToMany';
858
-
859
- export interface ViewConfigOptions extends BaseConfigOptions {
860
- collapsible?: boolean;
861
- connectorResource?: Resource;
862
- relatedConfigs?: ChildResourceConfig[];
863
- rpcConfigs?: RPCConfig[];
864
- }
865
- export interface ViewConfig extends BaseConfig {
866
- type: 'View';
867
- collapsible: boolean;
868
- // todo: remove this comment once full documentation has been added. Populate this value when a database view resource is used to connect the ViewConfig's parent resource to its primary resource
869
- connectorResource: Resource;
870
- relatedConfigs: ChildResourceConfig[];
871
- rpcConfigs?: RPCConfig[];
872
- }
873
-
874
- export function viewConfig(config: ViewConfigOptions): ViewConfig {
875
- return {
876
- ...viewConfigDefaults,
877
- ...config,
878
- } satisfies ViewConfig;
879
- }
880
- export const viewConfigDefaults = {
881
- title: '',
882
- primaryResource: '' as Resource,
883
- type: 'View',
884
- createTitle: '',
885
- createButtonLabel: 'Create',
886
- parentClass: '',
887
- fieldClass: '',
888
- elements: [],
889
- ignoreFields: [],
890
- collapsible: true,
891
- connectorResource: '' as Resource,
892
- relatedConfigs: [],
893
- createConfig: {} as ViewConfig,
894
- createNavigation: [],
895
- parentRelation: {
896
- parentKey: '' as FieldName,
897
- childKey: '' as FieldName,
898
- },
899
- showBackButton: true,
900
- rpcConfigs: [],
901
- } satisfies ViewConfig;
902
-
903
- export interface arrayConfigOptions {
904
- iteratedConfig: ChildResourceConfig;
905
- viewType?: ViewType;
906
- collapsible?: boolean;
907
- createConfig?: ConfigType;
908
- connectorResource?: Resource;
909
- connectorField?: FieldName;
910
- primaryResource: Resource;
911
- listFilter: (parentResource: any) => string;
912
- sorts?: FieldSort[];
913
- title?: string;
914
- createButtonLabel?: string;
915
- limit?: number;
916
- }
917
- export interface ArrayConfig {
918
- type: 'Array';
919
- iteratedConfig: ChildResourceConfig;
920
- viewType: ViewType;
921
- collapsible: boolean;
922
- createConfig: ConfigType;
923
- connectorResource: Resource;
924
- connectorField: FieldName;
925
- primaryResource: Resource;
926
- listFilter: (parentResource: any) => string;
927
- sorts: FieldSort[];
928
- title: string;
929
- createButtonLabel: string;
930
- limit: number;
931
- }
932
- export function arrayConfig(config: arrayConfigOptions): ArrayConfig {
933
- return {
934
- ...arrayConfigDefaults,
935
- ...config,
936
- } satisfies ArrayConfig;
937
- }
938
- export const arrayConfigDefaults = {
939
- type: 'Array',
940
- iteratedConfig: {} as ChildResourceConfig,
941
- viewType: 'OneToMany' as ViewType,
942
- collapsible: true,
943
- createConfig: {} as ViewConfig,
944
- connectorResource: '' as Resource,
945
- connectorField: '' as FieldName,
946
- primaryResource: '' as Resource,
947
- listFilter: (): string => '',
948
- sorts: [] as FieldSort[],
949
- title: '',
950
- createButtonLabel: 'Create',
951
- limit: Infinity,
952
- } satisfies ArrayConfig;