@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,22 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TableButtonComponent } from './table-button.component';
4
-
5
- xdescribe('TableButtonComponent', () => {
6
- let component: TableButtonComponent<null>;
7
- let fixture: ComponentFixture<TableButtonComponent<null>>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [TableButtonComponent],
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(TableButtonComponent<null>);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
@@ -1,49 +0,0 @@
1
- import { Component, computed, input, signal } from '@angular/core';
2
- import { MatButtonModule } from '@angular/material/button';
3
- import { MatIconModule } from '@angular/material/icon';
4
- import { MatTooltipModule, TooltipPosition } from '@angular/material/tooltip';
5
- import { RouterModule } from '@angular/router';
6
- import { ActionButtonConfig } from '@cccteam/ccc-lib/src/types';
7
-
8
- @Component({
9
- selector: 'ccc-table-button',
10
- standalone: true,
11
- imports: [MatButtonModule, MatIconModule, MatTooltipModule, RouterModule],
12
- templateUrl: './table-button.component.html',
13
- styleUrl: './table-button.component.scss',
14
- })
15
- export class TableButtonComponent<T> {
16
- config = input.required<ActionButtonConfig>();
17
-
18
- rowData = input.required<T>();
19
- tooltipPosition = input<TooltipPosition>('above' as TooltipPosition);
20
- color = input<string>('');
21
- disabled = signal<boolean>(false);
22
- viewRoute = input<string>('');
23
- id = input<string>('');
24
-
25
- link = computed(() => {
26
- const viewRoute = this.viewRoute();
27
- const id = this.id();
28
-
29
- if (!viewRoute || !id) {
30
- return '';
31
- }
32
-
33
- if (!viewRoute.startsWith('/')) {
34
- return `${viewRoute}/${id}`;
35
- }
36
-
37
- return `${viewRoute}/${id}`;
38
- });
39
-
40
- callAction(): void {
41
- const rowData = this.rowData();
42
- const action = this.config().action;
43
- if (rowData && action !== undefined) {
44
- const id = 'id' as keyof T;
45
- const idVal = rowData[id] as string;
46
- action({ id: idVal });
47
- }
48
- }
49
- }
@@ -1,41 +0,0 @@
1
- import { inject } from '@angular/core';
2
- import { MatDialog } from '@angular/material/dialog';
3
- import { CanDeactivateFn, UrlTree } from '@angular/router';
4
- import { firstValueFrom, Observable, tap } from 'rxjs';
5
- import { FormStateService } from './form-state.service';
6
- import { LeavePageConfirmationModalComponent } from './leave-page-confirmation-modal/leave-page-confirmation-modal.component';
7
-
8
- export type CanDeactivateType = Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
9
-
10
- export interface CanComponentDeactivate {
11
- canDeactivate: () => CanDeactivateType;
12
- }
13
-
14
- export const dirtyFormDeactivateGuard: CanDeactivateFn<CanComponentDeactivate> = async (_, __, ___, nextState) => {
15
- const dialog = inject(MatDialog);
16
- const formStateService = inject(FormStateService);
17
-
18
- if (nextState?.url === '/login') {
19
- return true;
20
- }
21
-
22
- if (!formStateService.isDirty()) {
23
- return true;
24
- }
25
-
26
- const existingDialog = dialog.openDialogs.find(
27
- (d) => d.componentInstance instanceof LeavePageConfirmationModalComponent,
28
- );
29
-
30
- const dialogRef = existingDialog ?? dialog.open(LeavePageConfirmationModalComponent, { delayFocusTrap: false });
31
-
32
- const result = dialogRef.afterClosed().pipe(
33
- tap((value) => {
34
- if (value === true) {
35
- formStateService.resetDirtyForms();
36
- }
37
- }),
38
- );
39
-
40
- return firstValueFrom(result);
41
- };
@@ -1,57 +0,0 @@
1
- <div class="page-container">
2
- <div class="header-container">
3
- <div class="title" [class.title-without-back]="title()">
4
- @if (title() !== '') {
5
- <h1>{{ title() }}</h1>
6
- }
7
- </div>
8
- </div>
9
-
10
- @if (hasElements() || configs().length > 0) {
11
- <div class="resource-container" [class.empty-elements]="!hasElements()">
12
- @let primaryConfigRef = primaryConfig();
13
- @if (primaryConfigRef.type === 'View' || primaryConfigRef.type === 'ListView') {
14
- <ccc-resource-view
15
- [uuid]="uuid()"
16
- [config]="primaryConfigRef"
17
- [relatedData]="resolvedData()"
18
- [compoundResourceView]="true">
19
- </ccc-resource-view>
20
- }
21
-
22
- @for (config of configs(); track config) {
23
- @let hasrelatedConfigs = 'relatedConfigs' in config && config.relatedConfigs.length > 0;
24
- @if (hasrelatedConfigs) {
25
- <ccc-compound-resource
26
- [uuid]="primaryConfigParentId()"
27
- [parentData]="resolvedData()"
28
- [resourceConfig]="config">
29
- </ccc-compound-resource>
30
- } @else if (config.type === 'ListView') {
31
- <ccc-resource-list-create
32
- [resourceConfig]="config"
33
- [parentData]="resolvedData()"
34
- [isRootList]="false"
35
- [parentId]="primaryConfigParentId()">
36
- </ccc-resource-list-create>
37
- } @else if (config.type === 'Array') {
38
- <ccc-resource-array-view
39
- [resourceConfig]="config"
40
- [parentData]="store.viewData()"
41
- [compoundResourceComponent]="componentRef">
42
- </ccc-resource-array-view>
43
- } @else if (config.type === 'View') {
44
- <ccc-resource-view
45
- [uuid]="primaryConfigParentId()"
46
- [config]="config"
47
- [relatedData]="resolvedData()"></ccc-resource-view>
48
- } @else if (config.type === 'Component') {
49
- <ccc-resource-resolver
50
- [parentData]="resolvedData()"
51
- [resourceConfig]="config"
52
- [compoundResourceComponent]="componentRef"> </ccc-resource-resolver>
53
- }
54
- }
55
- </div>
56
- }
57
- </div>
@@ -1,86 +0,0 @@
1
- .page-container {
2
- position: relative;
3
- }
4
-
5
- .header-container {
6
- display: flex;
7
- flex-direction: row;
8
- position: absolute;
9
- top: 0;
10
- z-index: 11;
11
- background: transparent;
12
- }
13
-
14
- .title {
15
- display: flex;
16
- align-items: center;
17
- flex-shrink: 0;
18
- }
19
-
20
- .title-without-back {
21
- margin-left: 48px;
22
- height: 48px;
23
- }
24
-
25
- .message {
26
- margin-top: auto;
27
- margin-bottom: auto;
28
- }
29
-
30
- .state-buttons {
31
- display: flex;
32
- flex-direction: row;
33
- margin-bottom: auto;
34
- justify-content: right;
35
- flex-grow: 1;
36
- gap: 20px;
37
- margin-right: 32px;
38
- }
39
-
40
- .mode-text {
41
- margin-top: auto;
42
- margin-bottom: auto;
43
- }
44
-
45
- .resource {
46
- margin: 10px;
47
- }
48
-
49
- .mat-input-element:disabled[readonly] {
50
- color: currentColor;
51
- }
52
-
53
- .unsaved {
54
- color: #f44336;
55
- }
56
-
57
- .edit-button {
58
- margin-top: auto;
59
- margin-bottom: auto;
60
- padding-left: 10px;
61
- }
62
-
63
- .button-text {
64
- display: flex;
65
- flex-direction: row;
66
- align-items: center;
67
-
68
- .edit {
69
- color: #003b49;
70
- }
71
-
72
- .mat-icon {
73
- margin-right: 8px;
74
- }
75
- }
76
-
77
- .empty-elements {
78
- padding-top: 30px;
79
- }
80
-
81
- .rpc-buttons-container {
82
- display: flex;
83
- flex-direction: row;
84
- justify-content: flex-end;
85
- padding-bottom: 10px;
86
- }
@@ -1,22 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { CompoundResourceComponent } from './compound-resource.component';
4
-
5
- xdescribe('CompoundResourceComponent', () => {
6
- let component: CompoundResourceComponent;
7
- let fixture: ComponentFixture<CompoundResourceComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [CompoundResourceComponent],
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(CompoundResourceComponent);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
@@ -1,158 +0,0 @@
1
- import { CommonModule, Location } from '@angular/common';
2
- import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- ComponentRef,
6
- computed,
7
- effect,
8
- inject,
9
- Injector,
10
- input,
11
- OnInit,
12
- signal
13
- } from '@angular/core';
14
- import { MatButtonModule } from '@angular/material/button';
15
- import { MatIconModule } from '@angular/material/icon';
16
- import { ActivatedRoute, RouterModule } from '@angular/router';
17
- import { ChildResourceConfig, ParentResourceConfig, RecordData, Resource, RESOURCE_META, RootConfig } from '@cccteam/ccc-lib/src/types';
18
- import { ResourceArrayViewComponent } from '../resource-array-view/resource-array-view.component';
19
- import { ResourceListCreateComponent } from '../resource-list-create/resource-list-create.component';
20
- import { ResourceResolverComponent } from '../resource-resolver/resource-resolver.component';
21
- import { ResourceStore } from '../resource-store.service';
22
- import { ResourceViewComponent } from '../resource-view/resource-view.component';
23
-
24
- @Component({
25
- selector: 'ccc-compound-resource',
26
- templateUrl: './compound-resource.component.html',
27
- styleUrl: './compound-resource.component.scss',
28
- changeDetection: ChangeDetectionStrategy.OnPush,
29
- standalone: true,
30
- imports: [
31
- MatIconModule,
32
- RouterModule,
33
- MatButtonModule,
34
- ResourceViewComponent,
35
- ResourceListCreateComponent,
36
- ResourceArrayViewComponent,
37
- ResourceResolverComponent,
38
- CommonModule,
39
- RouterModule,
40
- ],
41
- providers: [ResourceStore],
42
- })
43
- export class CompoundResourceComponent implements OnInit {
44
- location = inject(Location);
45
- route = inject(ActivatedRoute);
46
- store = inject(ResourceStore);
47
- injector = inject(Injector);
48
- componentRef = this.injector.get(ComponentRef<CompoundResourceComponent>);
49
- resourceMeta = inject(RESOURCE_META);
50
-
51
- resourceConfig = input<ParentResourceConfig | ChildResourceConfig>();
52
- isArrayChild = input<boolean>(false);
53
- uuid = input.required<string>();
54
- parentData = input<RecordData>();
55
-
56
- rootConfig = computed(() => this.route.snapshot.data['config'] as RootConfig);
57
-
58
- emptyOneToOne = signal(false);
59
-
60
- hasElements = computed(() => {
61
- const config = this.primaryConfig();
62
- return config && (config.type === 'ListView' || config.type === 'View') && config.elements.length > 0;
63
- });
64
-
65
- primaryConfigParentId = computed(() => {
66
- const config = this.primaryConfig();
67
- const data = this.resolvedData();
68
- if (config.type === 'View' || config.type === 'ListView') {
69
- const parentKey = config.parentRelation?.parentKey;
70
- if (parentKey !== '') {
71
- return String(data[parentKey]);
72
- }
73
- }
74
- return this.uuid();
75
- });
76
-
77
- primaryConfig = computed(() => {
78
- const config = this.resourceConfig();
79
- if (config) {
80
- return config;
81
- }
82
- return this.rootConfig().parentConfig;
83
- });
84
-
85
- title = computed(() => {
86
- if (this.isArrayChild()) {
87
- return '';
88
- }
89
- const config = this.primaryConfig();
90
- if (config.type !== 'Component') {
91
- return config.title;
92
- }
93
- return '';
94
- });
95
-
96
- isRootConfig = computed(() => {
97
- return this.resourceConfig() === undefined;
98
- });
99
-
100
- configs = computed(() => {
101
- if (this.hasElements() && this.emptyOneToOne()) {
102
- return [];
103
- }
104
-
105
- if (this.isRootConfig()) {
106
- return this.rootConfig().relatedConfigs;
107
- }
108
-
109
- const config = this.primaryConfig();
110
- if (config.type === 'ListView' || config.type === 'View') {
111
- return config.relatedConfigs;
112
- }
113
- return [];
114
- });
115
-
116
- rpcConfigs = computed(() => (this.isRootConfig() ? this.rootConfig().rpcConfigs : undefined));
117
- hasRpcConfigs = computed(() => !!this.rpcConfigs() && this.rpcConfigs()!.length > 0);
118
-
119
- resolvedData = computed(() => {
120
- if (this.store.viewData()) {
121
- return this.store.viewData() as RecordData;
122
- }
123
-
124
- return this.parentData() || ({} as RecordData);
125
- });
126
-
127
- ngOnInit(): void {
128
- const resource = this.primaryConfig().primaryResource as Resource;
129
- const meta = this.resourceMeta(resource);
130
-
131
- if (meta) {
132
- this.store.resourceName.set(resource);
133
- this.store.resourceMeta.set(meta);
134
- }
135
- }
136
-
137
- constructor() {
138
- effect(() => {
139
- this.store.uuid.set(this.primaryConfigParentId());
140
-
141
- const c = this.primaryConfig();
142
- if (c.type === 'View') {
143
- this.store.resetResourceView();
144
- } else if (c.type === 'ListView') {
145
- this.store.resetResourceList();
146
- this.store.resetResourceView();
147
- }
148
- });
149
- }
150
-
151
- handleEmptyOneToOne(value: boolean): void {
152
- this.emptyOneToOne.set(value);
153
- }
154
-
155
- goBack(): void {
156
- this.location.back();
157
- }
158
- }
@@ -1,162 +0,0 @@
1
- export const concatFunctions = {
2
- 'space-concat': spaceConcat,
3
- 'hyphen-concat': hyphenConcat,
4
- 'space-hyphen-concat': spaceHyphenConcat,
5
- 'hyphen-space-concat': hyphenSpaceConcat,
6
- };
7
-
8
- /**
9
- * Concatenates the strings corresponding to the given keys in the resource,
10
- * using a space separator.
11
- * @param resource A record mapping keys to string values.
12
- * @param args Keys of the resource to concatenate.
13
- * @returns Concatenated string.
14
- * @example
15
- * const resource = { foo: 'foo', bar: 'bar', baz: 'baz' };
16
- * spaceConcat(resource, 'foo', 'bar', 'baz'); // returns 'foo bar baz'
17
- */
18
- export function spaceConcat(resource: Record<string, string>, ...args: string[]): string {
19
- if (args.length === 0) return '';
20
- if (args.length === 1) return resource[args[0] ?? ''] ?? '';
21
- return args.map((arg) => resource[arg] ?? '').join(' ');
22
- }
23
-
24
- /**
25
- * Concatenates the strings corresponding to the given keys in the resource,
26
- * using a hyphen separator.
27
- * @param resource A record mapping keys to string values.
28
- * @param args Keys of the resource to concatenate.
29
- * @returns Concatenated string.
30
- * @example
31
- * const resource = { foo: 'foo', bar: 'bar', baz: 'baz' };
32
- * hyphenConcat(resource, 'foo', 'bar', 'baz'); // returns 'foo - bar - baz'
33
- */
34
- export function hyphenConcat(resource: Record<string, string>, ...args: string[]): string {
35
- if (args.length === 0) return '';
36
- if (args.length === 1) return resource[args[0] ?? ''] ?? '';
37
- return args.map((arg) => resource[arg] ?? '').join(' - ');
38
- }
39
-
40
- /**
41
- * Concatenates the given strings so that all but the last are joined with a space,
42
- * and the last string is appended with a " - " separator.
43
- * @param resource A mapping of keys to string values.
44
- * @param args Keys of strings to concatenate.
45
- * @returns Concatenated string.
46
- * @example spaceHyphenConcat(resource, 'foo', 'bar', 'baz') => 'foo bar - baz'
47
- */
48
- export function spaceHyphenConcat(resource: Record<string, string>, ...args: string[]): string {
49
- if (args.length === 0) return '';
50
- if (args.length === 1) return resource[args[0] || ''] || '';
51
-
52
- const initialPart = args
53
- .slice(0, -1)
54
- .map((arg) => resource[arg] || '')
55
- .join(' ');
56
-
57
- const lastPart = resource[args[args.length - 1] || ''] || '';
58
-
59
- return `${initialPart} - ${lastPart}`;
60
- }
61
-
62
- /**
63
- * Concatenates the given strings so that all but the first are joined with a space,
64
- * and the first string is appended with a " - " separator.
65
- * @param resource A mapping of keys to string values.
66
- * @param args Keys of strings to concatenate.
67
- * @returns Concatenated string.
68
- * @example spaceHyphenConcat(resource, 'foo', 'bar', 'baz') => 'foo - bar baz'
69
- */
70
- export function hyphenSpaceConcat(resource: Record<string, string>, ...args: string[]): string {
71
- if (args.length === 0) return '';
72
- if (args.length === 1) return resource[args[0] || ''] || '';
73
-
74
- const initialPart = args[0] !== undefined ? resource[args[0]] || '' : '';
75
-
76
- const lastPart = args
77
- .slice(1, args.length)
78
- .map((arg) => resource[arg] || '')
79
- .join(' ');
80
-
81
- return `${initialPart} - ${lastPart}`;
82
- }
83
-
84
- /**
85
- * Concatenates the strings using a space separator.
86
- * @param args Strings to concatenate.
87
- * @returns Concatenated string.
88
- * @example
89
- * spaceConcatWithoutResource(['foo', 'bar', 'baz']); // returns 'foo bar baz'
90
- */
91
- export function spaceConcatWithoutResource(args: string[]): string {
92
- if (args.length === 0) return '';
93
- if (args.length === 1) return args[0] ?? '';
94
- return args.map((arg) => arg ?? '').join(' ');
95
- }
96
-
97
- /**
98
- * Concatenates the strings using a hyphen separator.
99
- * @param args Strings to concatenate.
100
- * @returns Concatenated string.
101
- * @example
102
- * hyphenConcatWithoutResource(['foo', 'bar', 'baz']); // returns 'foo - bar - baz'
103
- */
104
- export function hyphenConcatWithoutResource(args: string[]): string {
105
- if (args.length === 0) return '';
106
- if (args.length === 1) return args[0] || '';
107
- return args.join(' - ');
108
- }
109
-
110
- /**
111
- * Concatenates the given strings so that all but the last are joined with a space,
112
- * and the last string is appended with a " - " separator.
113
- * @param args Strings to concatenate.
114
- * @returns Concatenated string.
115
- * @example spaceHyphenConcatWithoutResource(['foo', 'bar', 'baz']) => 'foo bar - baz'
116
- */
117
- export function spaceHyphenConcatWithoutResource(args: string[]): string {
118
- if (args.length === 0) return '';
119
- if (args.length === 1) return args[0] || '';
120
-
121
- const initialPart = args
122
- .slice(0, -1)
123
- .map((arg) => arg || '')
124
- .join(' ');
125
-
126
- const lastPart = args[args.length - 1] || '';
127
-
128
- return `${initialPart} - ${lastPart}`;
129
- }
130
-
131
- /**
132
- * Concatenates the given strings so that all but the first are joined with a space,
133
- * and the first string is appended with a " - " separator.
134
- * @param args Strings to concatenate.
135
- * @returns Concatenated string.
136
- * @example hyphenSpaceConcatWithoutResource(['foo', 'bar', 'baz']) => 'foo - bar baz'
137
- */
138
- export function hyphenSpaceConcatWithoutResource(args: string[]): string {
139
- if (args.length === 0) return '';
140
- if (args.length === 1) return args[0] || '';
141
-
142
- const initialPart = args[0] || '';
143
-
144
- const lastPart = args
145
- .slice(1, args.length)
146
- .map((arg) => arg || '')
147
- .join(' ');
148
-
149
- return `${initialPart} - ${lastPart}`;
150
- }
151
-
152
- /**
153
- * Concatenates the given strings without any space,
154
- * @param args Strings to concatenate.
155
- * @returns Concatenated string.
156
- * @example noSpaceConcatWithoutResource(['foo', 'bar', 'baz']) => 'foobarbaz'
157
- */
158
- export function noSpaceConcatWithoutResource(args: string[]): string {
159
- if (args.length === 0) return '';
160
- if (args.length === 1) return args[0] || '';
161
- return args.join('');
162
- }
@@ -1,12 +0,0 @@
1
- <div class="readonly-field">
2
- <mat-form-field class="field" [subscriptSizing]="'dynamic'">
3
- <mat-label>{{ label() }}</mat-label>
4
- <input
5
- matInput
6
- (keydown.enter)="$event.preventDefault()"
7
- [readonly]="true"
8
- type="text"
9
- [value]="displayValue"
10
- id="{{ label() }}-readonly-input-text" />
11
- </mat-form-field>
12
- </div>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { EmptyReadonlyFieldComponent } from './empty-readonly-field.component';
4
-
5
- describe('EmptyReadonlyFieldComponent', () => {
6
- let component: EmptyReadonlyFieldComponent;
7
- let fixture: ComponentFixture<EmptyReadonlyFieldComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [EmptyReadonlyFieldComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(EmptyReadonlyFieldComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,17 +0,0 @@
1
- import { Component, input } from '@angular/core';
2
- import { MatButtonModule } from '@angular/material/button';
3
- import { MatFormFieldModule } from '@angular/material/form-field';
4
- import { MatInputModule } from '@angular/material/input';
5
- import { defaultEmptyFieldValue } from '@cccteam/ccc-lib/src/types';
6
-
7
- @Component({
8
- selector: 'ccc-empty-readonly-field',
9
- imports: [MatFormFieldModule, MatButtonModule, MatInputModule],
10
- templateUrl: './empty-readonly-field.component.html',
11
- styleUrl: './empty-readonly-field.component.scss',
12
- })
13
- export class EmptyReadonlyFieldComponent {
14
- label = input.required<string>();
15
-
16
- displayValue = defaultEmptyFieldValue;
17
- }
@@ -1,24 +0,0 @@
1
- import { computed, Injectable, signal } from '@angular/core';
2
-
3
- @Injectable({
4
- providedIn: 'root',
5
- })
6
- export class FormStateService {
7
- dirtyForms = signal(0);
8
-
9
- incrementDirtyForms(): void {
10
- this.dirtyForms.set(this.dirtyForms() + 1);
11
- }
12
-
13
- decrementDirtyForms(): void {
14
- this.dirtyForms.set(this.dirtyForms() - 1);
15
- }
16
-
17
- resetDirtyForms(): void {
18
- this.dirtyForms.set(0);
19
- }
20
-
21
- isDirty = computed(() => {
22
- return this.dirtyForms() > 0;
23
- });
24
- }