@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,49 +0,0 @@
1
- import { FormatType } from '@cccteam/ccc-lib/src/types';
2
- import { format, isValid, parseISO } from 'date-fns';
3
-
4
- export type FormatterFn = (value: string) => string;
5
-
6
- export const simpleSlashDateFormatter = (value: string): string => {
7
- if (!value) return '';
8
- const parsedDate = parseISO(value.toString());
9
-
10
- if (isValid(parsedDate)) {
11
- return format(parsedDate, 'M/d/yyyy');
12
- }
13
-
14
- console.error('Applying simpleSlashDateFormatter to invalid date value:', value);
15
- return value.toString();
16
- };
17
-
18
- export const ValueFormatters: Record<FormatType, FormatterFn> = {
19
- ['simpleSlashDateFormat']: simpleSlashDateFormatter,
20
- };
21
-
22
- export function applyFormatting(formatString: string, value: string): string {
23
- if (!value) return '';
24
- if (formatString in ValueFormatters) {
25
- return ValueFormatters[formatString as FormatType](value);
26
- }
27
-
28
- //default to formatting as a date with provided format string
29
- const parsedDate = parseISO(value.toString());
30
-
31
- if (isValid(parsedDate)) {
32
- return format(parsedDate, formatString);
33
- }
34
-
35
- return value.toString();
36
- }
37
-
38
- export function formatDateString(formatString: string, value: string): string {
39
- if (!value) return '';
40
-
41
- //default to formatting as a date with provided format string
42
- const parsedDate = parseISO(value.toString());
43
-
44
- if (isValid(parsedDate)) {
45
- return format(parsedDate, formatString);
46
- }
47
-
48
- return value.toString();
49
- }
@@ -1,88 +0,0 @@
1
- import { AbstractControl, ValidationErrors, Validators } from '@angular/forms';
2
- import { ConfigElement, ResourceValidatorFn } from '@cccteam/ccc-lib/src/types';
3
- import { isDate } from 'date-fns';
4
- import { formatInTimeZone } from 'date-fns-tz';
5
- import { isNumber } from 'lodash-es';
6
- import { createResourceValidator } from './utils/validator-utils';
7
-
8
- export const maxConfigElementRecursionDepth = 240;
9
- export const maxLayoutNestingDepth = 48;
10
-
11
- /** Returns a flat array of nested elements by recursively traversing
12
- * through the elements graph */
13
- export const flattenElements: (elements: ConfigElement[], depth?: number) => ConfigElement[] = (
14
- elements: ConfigElement[],
15
- depth = 0,
16
- ) => {
17
- depth++;
18
- if (!elements || elements.length === 0 || depth > maxConfigElementRecursionDepth) {
19
- return [];
20
- }
21
- return elements.reduce((acc, element) => {
22
- if (element.type === 'section') {
23
- return acc.concat(element, flattenElements(element.children, depth));
24
- }
25
- return acc.concat(element);
26
- }, [] as ConfigElement[]);
27
- };
28
-
29
- export const civildateCoercion = (value: string): Date => {
30
- if (value === undefined || value === '') {
31
- return new Date(value);
32
- }
33
- return new Date(formatInTimeZone(new Date(value), 'UTC', 'yyyy-MM-dd HH:mm:ss'));
34
- };
35
-
36
- const currentOrFutureDateValidator = (control: AbstractControl): ValidationErrors | null => {
37
- if (!control.value) {
38
- return null; // Let "REQUIRED" validator handle empty values
39
- }
40
-
41
- if (!isDate(control.value)) {
42
- return { errorMsg: 'Value must be a valid date' };
43
- }
44
-
45
- const selectedDate = new Date(control.value);
46
- const today = new Date();
47
- today.setHours(0, 0, 0, 0);
48
-
49
- if (selectedDate >= today) {
50
- return null;
51
- }
52
-
53
- return { errorMsg: 'Date must be greater than or equal to the current date' };
54
- };
55
-
56
- const positiveNumberValidator = (control: AbstractControl): ValidationErrors | null => {
57
- if (!control.value && control.value !== 0) {
58
- return null; // Let "REQUIRED" validator handle "empty" values
59
- }
60
-
61
- if (isNumber(control.value) && control.value > 0) {
62
- return null;
63
- }
64
-
65
- return { errorMsg: 'Value must be a positive number' };
66
- };
67
-
68
- /**
69
- * This object stores every possible validator used across the application
70
- * Add all validators that are used in configs to this object
71
- *
72
- * Available validators that may be added: min, max, required, requiredTrue,
73
- * email, minLength, maxLength, pattern, nullValidator
74
- */
75
- export const resourceValidators = Object.freeze({
76
- REQUIRED: createResourceValidator(Validators.required),
77
- EMAIL: createResourceValidator(Validators.email),
78
- CURRENT_OR_FUTURE_DATE: createResourceValidator(currentOrFutureDateValidator),
79
- POSITIVE_NUMBER: createResourceValidator(positiveNumberValidator),
80
-
81
- // Add any additional validators here. They may be defined in
82
- // a different file if they are too large. E.g.:
83
- // MIN_LENGTH_3: createResourceValidator(Validators.minLength(3)),
84
- });
85
-
86
- export const validatorsPresent = (control: AbstractControl, validatorResources: ResourceValidatorFn[]): boolean => {
87
- return validatorResources.every((validator) => control.hasValidator(validator));
88
- };
@@ -1,23 +0,0 @@
1
- export * from './can-deactivate.guard';
2
- export * from './compound-resource/compound-resource.component';
3
- export * from './concat-fns';
4
- export * from './empty-readonly-field/empty-readonly-field.component';
5
- export * from './form-state.service';
6
- export * from './format-fns';
7
- export * from './gui-constants';
8
- export * from './leave-page-confirmation-modal/leave-page-confirmation-modal.component';
9
- export * from './padding-element/padding-element.component';
10
- export * from './resource-array-view/resource-array-view.component';
11
- export * from './resource-base/resource-base.component';
12
- export * from './resource-cache.service';
13
- export * from './resource-create/resource-create.component';
14
- export * from './resource-field/base-field.directive';
15
- export * from './resource-field/resource-field.component';
16
- export * from './resource-layout/resource-layout.component';
17
- export * from './resource-list-create/resource-list-create.component';
18
- export * from './resource-list/resource-list.component';
19
- export * from './resource-resolver/resource-resolver.component';
20
- export * from './resource-store.service';
21
- export * from './resource-view/resource-view.component';
22
- export * from './resources-helpers';
23
-
@@ -1,8 +0,0 @@
1
- <div mat-dialog-title>You have unsaved changes, are you sure you want to leave?</div>
2
- <mat-dialog-content>
3
- <p>Any unsaved changes will be lost.</p>
4
- </mat-dialog-content>
5
- <mat-dialog-actions align="end">
6
- <button mat-raised-button color="warn" [mat-dialog-close]="false">Cancel</button>
7
- <button mat-raised-button color="accent" [mat-dialog-close]="true">Confirm</button>
8
- </mat-dialog-actions>
@@ -1,22 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { LeavePageConfirmationModalComponent } from './leave-page-confirmation-modal.component';
4
-
5
- describe('LeavePageConfirmationModalComponent', () => {
6
- let component: LeavePageConfirmationModalComponent;
7
- let fixture: ComponentFixture<LeavePageConfirmationModalComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [LeavePageConfirmationModalComponent],
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(LeavePageConfirmationModalComponent);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
@@ -1,12 +0,0 @@
1
- import { Component } from '@angular/core';
2
- import { MatButtonModule } from '@angular/material/button';
3
- import { MatDialogActions, MatDialogModule } from '@angular/material/dialog';
4
- import { MatFormFieldModule } from '@angular/material/form-field';
5
-
6
- @Component({
7
- selector: 'ccc-leave-page-confirmation-modal',
8
- imports: [MatDialogModule, MatFormFieldModule, MatDialogActions, MatButtonModule],
9
- templateUrl: './leave-page-confirmation-modal.component.html',
10
- styleUrls: ['./leave-page-confirmation-modal.component.scss'],
11
- })
12
- export class LeavePageConfirmationModalComponent {}
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
3
- "lib": {
4
- "entryFile": "./index.ts"
5
- }
6
- }
@@ -1,19 +0,0 @@
1
- export type PatchOperation = 'add' | 'patch' | 'remove';
2
-
3
- export interface Operation {
4
- op: PatchOperation;
5
- value?: Record<string, unknown>;
6
- path: string;
7
- }
8
-
9
- export interface CreateOperation extends Operation {
10
- op: 'add';
11
- }
12
-
13
- export interface UpdateOperation extends Operation {
14
- op: 'patch';
15
- }
16
-
17
- export interface DeleteOperation extends Operation {
18
- op: 'remove';
19
- }
@@ -1 +0,0 @@
1
- <div class="padding-container"></div>
@@ -1,3 +0,0 @@
1
- .padding-container {
2
- height: 52px;
3
- }
@@ -1,22 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { PaddingElementComponent } from './padding-element.component';
4
-
5
- describe('PaddingElementComponent', () => {
6
- let component: PaddingElementComponent;
7
- let fixture: ComponentFixture<PaddingElementComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [PaddingElementComponent],
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(PaddingElementComponent);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
@@ -1,20 +0,0 @@
1
- import { Component, HostBinding, input, OnInit } from '@angular/core';
2
- import { PaddingElement } from '@cccteam/ccc-lib/src/types';
3
-
4
- @Component({
5
- selector: 'ccc-padding-element',
6
- imports: [],
7
- templateUrl: './padding-element.component.html',
8
- styleUrls: ['./padding-element.component.scss'],
9
- })
10
- export class PaddingElementComponent implements OnInit {
11
- paddingElement = input.required<PaddingElement>();
12
-
13
- @HostBinding('class') class = 'col-6';
14
-
15
- ngOnInit(): void {
16
- if (this.paddingElement().cols) {
17
- this.class = 'col-' + this.paddingElement()?.cols;
18
- }
19
- }
20
- }
@@ -1,81 +0,0 @@
1
- @if (resourceConfig().title !== '') {
2
- <div class="resource-array-view">
3
- <mat-expansion-panel
4
- #expPanel
5
- [@.disabled]="true"
6
- [disabled]="!resourceConfig().collapsible"
7
- [expanded]="!resourceConfig().collapsible">
8
- <mat-expansion-panel-header>
9
- @if (resourceConfig().title) {
10
- <mat-panel-title>
11
- <h1 class="title">
12
- {{ resourceConfig().title }}
13
- </h1>
14
- </mat-panel-title>
15
- }
16
- @if (showCreateButton()) {
17
- <button
18
- mat-icon-button
19
- class="exp-panel-add-element-btn"
20
- color="accent"
21
- (click)="createResource($event)"
22
- [matTooltip]="resourceConfig().createButtonLabel"
23
- matTooltipPosition="above">
24
- <mat-icon color="accent">add_circle</mat-icon>
25
- </button>
26
- }
27
- </mat-expansion-panel-header>
28
-
29
- @if (!resourceConfig().collapsible && !resourceConfig().title) {
30
- <div class="no-title-exp-panel-padding"></div>
31
- }
32
-
33
- @if (createMode()) {
34
- <ccc-resource-create
35
- [resourceConfig]="createConfig()"
36
- [parentData]="parentData()"
37
- (complete)="onCreateCompleted()">
38
- </ccc-resource-create>
39
- }
40
- @for (resource of store.listData(); track resource['id']; let i = $index) {
41
- @let resourceId = (resource[resourceConfig().connectorField] || resource['id']) + '';
42
-
43
- @if (parentData() && resourceConfig().iteratedConfig && resourceId && i + 1 <= resourceConfig().limit) {
44
- <ng-container *ngComponentOutlet="compoundResourceComponent().componentType;
45
- inputs: {
46
- uuid: resourceId,
47
- parentData: parentData(),
48
- isArrayChild: true,
49
- resourceConfig: resourceConfig().iteratedConfig
50
- }">
51
- </ng-container>
52
- }
53
- }
54
-
55
- @if (store.listData().length === 0) {
56
- <div>No records found</div>
57
- }
58
- </mat-expansion-panel>
59
- </div>
60
- } @else {
61
- @if (createMode()) {
62
- <ccc-resource-create [resourceConfig]="createConfig()" [parentData]="parentData()" (complete)="onCreateCompleted()">
63
- </ccc-resource-create>
64
- }
65
- @for (resource of store.listData(); track resource['id']; let i = $index) {
66
- @if (parentData() && resourceConfig().iteratedConfig && resource['id'] && i + 1 <= resourceConfig().limit) {
67
- <ng-container *ngComponentOutlet="compoundResourceComponent().componentType;
68
- inputs: {
69
- uuid: resource['id'] + '',
70
- parentData: parentData(),
71
- isArrayChild: true,
72
- resourceConfig: resourceConfig().iteratedConfig
73
- }">
74
- </ng-container>
75
- }
76
- }
77
-
78
- @if (store.listData().length === 0) {
79
- <div>No records found</div>
80
- }
81
- }
@@ -1,21 +0,0 @@
1
- .resource-array-view {
2
- display: flex;
3
- flex-direction: column;
4
- min-height: 36px;
5
- padding: 10px 0 0 0;
6
- }
7
-
8
- .title {
9
- display: flex;
10
- align-items: center;
11
- flex-shrink: 0;
12
- }
13
-
14
- .exp-panel-add-element-btn {
15
- margin-right: 10px;
16
- transform: scale(1.2);
17
- }
18
-
19
- .no-title-exp-panel-padding {
20
- padding: 10px;
21
- }
@@ -1,22 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ResourceArrayViewComponent } from './resource-array-view.component';
4
-
5
- xdescribe('ResourceArrayViewComponent', () => {
6
- let component: ResourceArrayViewComponent;
7
- let fixture: ComponentFixture<ResourceArrayViewComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [ResourceArrayViewComponent],
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(ResourceArrayViewComponent);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
@@ -1,143 +0,0 @@
1
- import { NgComponentOutlet } from '@angular/common';
2
- import {
3
- Component,
4
- ComponentRef,
5
- computed,
6
- effect,
7
- inject,
8
- Injector,
9
- input,
10
- OnInit,
11
- output,
12
- signal,
13
- viewChild
14
- } from '@angular/core';
15
- import { MatButtonModule } from '@angular/material/button';
16
- import { MatExpansionModule, MatExpansionPanel } from '@angular/material/expansion';
17
- import { MatIconModule } from '@angular/material/icon';
18
- import { MatTooltipModule } from '@angular/material/tooltip';
19
- import { ArrayConfig, ColumnConfig, RecordData, RESOURCE_META, ViewConfig } from '@cccteam/ccc-lib/src/types';
20
- import { ResourceCacheService } from '../resource-cache.service';
21
- import { ResourceCreateComponent } from '../resource-create/resource-create.component';
22
- import { ResourceStore } from '../resource-store.service';
23
-
24
- @Component({
25
- selector: 'ccc-resource-array-view',
26
- templateUrl: './resource-array-view.component.html',
27
- styleUrl: './resource-array-view.component.scss',
28
- imports: [
29
- MatButtonModule,
30
- MatExpansionModule,
31
- MatIconModule,
32
- MatTooltipModule,
33
- ResourceCreateComponent,
34
- NgComponentOutlet,
35
- ],
36
- providers: [ResourceStore],
37
- })
38
- export class ResourceArrayViewComponent implements OnInit {
39
- store = inject(ResourceStore);
40
- cache = inject(ResourceCacheService);
41
- injector = inject(Injector);
42
- resourceMeta = inject(RESOURCE_META);
43
-
44
- resourceConfig = input.required<ArrayConfig>();
45
- parentData = input<RecordData>({});
46
- expPanel = viewChild<MatExpansionPanel, MatExpansionPanel>('expPanel', { read: MatExpansionPanel });
47
-
48
- emptyOneToOne = output<boolean>();
49
-
50
- createMode = signal(false);
51
- compoundResourceComponent = input.required<ComponentRef<any>>();
52
-
53
- showCreateButton = computed(() => {
54
- const list = this.store.listData();
55
- const resourceConfig = this.resourceConfig();
56
- const iteratedConfig = resourceConfig.iteratedConfig;
57
- if (list && resourceConfig?.viewType === 'OneToOne') {
58
- this.emptyOneToOne.emit(list.length === 0);
59
- return list.length === 0;
60
- }
61
- if ('createTitle' in iteratedConfig && iteratedConfig.createTitle !== '') {
62
- return true;
63
- }
64
- return false;
65
- });
66
-
67
- createConfig = computed(() => {
68
- const config = this.resourceConfig();
69
- if (config.createConfig && Object.keys(config.createConfig).length !== 0) {
70
- return config.createConfig as ViewConfig;
71
- }
72
- if (config.iteratedConfig && Object.keys(config.iteratedConfig).length !== 0) {
73
- return config.iteratedConfig as ViewConfig;
74
- }
75
- return config;
76
- });
77
-
78
- resourceListRoute = computed(() => {
79
- const config = this.resourceConfig();
80
- const meta = this.resourceMeta(config.connectorResource || config.primaryResource);
81
- return meta.route;
82
- });
83
-
84
- setCreateMode(value: boolean): void {
85
- this.createMode.set(value);
86
- if (value && this.expPanel && this.expPanel()?.closed) {
87
- this.expPanel()?.open();
88
- }
89
- }
90
-
91
- ngOnInit(): void {
92
- this.store.resourceName.set(this.resourceConfig().primaryResource);
93
- const meta = this.resourceMeta(this.resourceConfig().primaryResource);
94
- this.store.resourceMeta.set(meta);
95
- this.store.overrideRoute.set(this.resourceListRoute());
96
- const columnArray = [];
97
- if (this.resourceConfig().connectorField !== '') {
98
- columnArray.push({ id: this.resourceConfig().connectorField });
99
- } else {
100
- columnArray.push({ id: 'id' } as ColumnConfig);
101
- }
102
- this.store.listColumns.set(columnArray);
103
- this.store.sorts.set(this.resourceConfig().sorts);
104
- }
105
-
106
- constructor() {
107
- effect(() => {
108
- const parentData = this.parentData();
109
- const resourceConfig = this.resourceConfig();
110
-
111
- if (resourceConfig && 'listFilter' in resourceConfig && parentData) {
112
- const filter = resourceConfig.listFilter(parentData);
113
-
114
- this.store.filter.set(filter);
115
- this.store.resetResourceList();
116
- }
117
- });
118
- }
119
-
120
- createResource(event: MouseEvent): void {
121
- event.stopPropagation();
122
- const expPanel = this.expPanel();
123
-
124
- if (!expPanel) {
125
- this.setCreateMode(true);
126
- return;
127
- }
128
- this.setCreateMode(true);
129
- if (expPanel.closed) {
130
- expPanel.open();
131
- }
132
- }
133
-
134
- onResourceDeleted(): void {
135
- this.setCreateMode(false);
136
- }
137
-
138
- onCreateCompleted(): void {
139
- this.cache.updateResourceInCache(this.store.resourceName(), 'list');
140
-
141
- this.setCreateMode(false);
142
- }
143
- }
@@ -1,22 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ResourceBaseComponent } from './resource-base.component';
4
-
5
- xdescribe('ResourceBaseComponent', () => {
6
- let component: ResourceBaseComponent;
7
- let fixture: ComponentFixture<ResourceBaseComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [ResourceBaseComponent],
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(ResourceBaseComponent);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
@@ -1,11 +0,0 @@
1
- import { Component } from '@angular/core';
2
- import { RouterModule } from '@angular/router';
3
- import { ResourceCacheService } from '../resource-cache.service';
4
-
5
- @Component({
6
- selector: 'ccc-resource-base',
7
- imports: [RouterModule],
8
- providers: [ResourceCacheService],
9
- template: '<router-outlet></router-outlet>',
10
- })
11
- export class ResourceBaseComponent {}