@cccteam/ccc-lib 0.0.13 → 0.0.15
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.
- package/eslint.config.js +32 -0
- package/ng-package.json +11 -0
- package/package.json +7 -68
- package/src/auth-authentication-guard/authentication.guard.ts +40 -0
- package/src/auth-authentication-guard/ng-package.json +6 -0
- package/src/auth-authorization-guard/authorization.guard.ts +17 -0
- package/src/auth-authorization-guard/ng-package.json +6 -0
- package/src/auth-forms/ccc-field/ccc-field.component.html +1 -0
- package/src/auth-forms/ccc-field/ccc-field.component.scss +0 -0
- package/src/auth-forms/ccc-field/ccc-field.component.spec.ts +22 -0
- package/src/auth-forms/ccc-field/ccc-field.component.ts +74 -0
- package/src/auth-forms/form-helpers.ts +39 -0
- package/src/auth-forms/{public-api.d.ts → index.ts} +1 -0
- package/src/auth-forms/ng-package.json +6 -0
- package/src/auth-has-permission/has-permission.directive.ts +34 -0
- package/src/auth-has-permission/ng-package.json +6 -0
- package/src/auth-service/auth.service.ts +92 -0
- package/src/auth-service/ng-package.json +6 -0
- package/src/ccc-camel-case-to-title/camel-case-to-title.pipe.ts +23 -0
- package/src/ccc-camel-case-to-title/index.ts +1 -0
- package/src/ccc-camel-case-to-title/ng-package.json +6 -0
- package/src/ccc-grid/ccc-grid.component.ts +155 -0
- package/src/ccc-grid/index.ts +3 -0
- package/src/ccc-grid/ng-package.json +6 -0
- package/src/ccc-grid/table-button/table-button.component.html +16 -0
- package/src/ccc-grid/table-button/table-button.component.scss +5 -0
- package/src/ccc-grid/table-button/table-button.component.spec.ts +22 -0
- package/src/ccc-grid/table-button/table-button.component.ts +49 -0
- package/src/ccc-resource/can-deactivate.guard.ts +41 -0
- package/src/ccc-resource/compound-resource/compound-resource.component.html +57 -0
- package/src/ccc-resource/compound-resource/compound-resource.component.scss +86 -0
- package/src/ccc-resource/compound-resource/compound-resource.component.spec.ts +22 -0
- package/src/ccc-resource/compound-resource/compound-resource.component.ts +158 -0
- package/src/ccc-resource/concat-fns.ts +162 -0
- package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.html +12 -0
- package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.scss +0 -0
- package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.spec.ts +23 -0
- package/src/ccc-resource/empty-readonly-field/empty-readonly-field.component.ts +17 -0
- package/src/ccc-resource/form-state.service.ts +24 -0
- package/src/ccc-resource/format-fns.ts +49 -0
- package/src/ccc-resource/gui-constants.ts +88 -0
- package/src/ccc-resource/index.ts +23 -0
- package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.html +8 -0
- package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.scss +0 -0
- package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.spec.ts +22 -0
- package/src/ccc-resource/leave-page-confirmation-modal/leave-page-confirmation-modal.component.ts +12 -0
- package/src/ccc-resource/ng-package.json +6 -0
- package/src/ccc-resource/operation-types.ts +19 -0
- package/src/ccc-resource/padding-element/padding-element.component.html +1 -0
- package/src/ccc-resource/padding-element/padding-element.component.scss +3 -0
- package/src/ccc-resource/padding-element/padding-element.component.spec.ts +22 -0
- package/src/ccc-resource/padding-element/padding-element.component.ts +20 -0
- package/src/ccc-resource/resource-array-view/resource-array-view.component.html +81 -0
- package/src/ccc-resource/resource-array-view/resource-array-view.component.scss +21 -0
- package/src/ccc-resource/resource-array-view/resource-array-view.component.spec.ts +22 -0
- package/src/ccc-resource/resource-array-view/resource-array-view.component.ts +143 -0
- package/src/ccc-resource/resource-base/resource-base.component.spec.ts +22 -0
- package/src/ccc-resource/resource-base/resource-base.component.ts +11 -0
- package/src/ccc-resource/resource-cache.service.ts +232 -0
- package/src/ccc-resource/resource-create/resource-create.component.html +31 -0
- package/src/ccc-resource/resource-create/resource-create.component.scss +130 -0
- package/src/ccc-resource/resource-create/resource-create.component.spec.ts +22 -0
- package/src/ccc-resource/resource-create/resource-create.component.ts +303 -0
- package/src/ccc-resource/resource-field/base-field.directive.ts +102 -0
- package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.html +16 -0
- package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.scss +0 -0
- package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/boolean-field/boolean-field.component.ts +15 -0
- package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.html +13 -0
- package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.scss +0 -0
- package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.spec.ts +23 -0
- package/src/ccc-resource/resource-field/fields/computed-field/computed-field.component.ts +50 -0
- package/src/ccc-resource/resource-field/fields/date-field/date-field.component.html +22 -0
- package/src/ccc-resource/resource-field/fields/date-field/date-field.component.scss +0 -0
- package/src/ccc-resource/resource-field/fields/date-field/date-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/date-field/date-field.component.ts +14 -0
- package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.html +71 -0
- package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.scss +9 -0
- package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/enumerated-field/enumerated-field.component.ts +207 -0
- package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.html +38 -0
- package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.scss +3 -0
- package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/nullboolean-field/nullboolean-field.component.ts +87 -0
- package/src/ccc-resource/resource-field/fields/number-field/number-field.component.html +23 -0
- package/src/ccc-resource/resource-field/fields/number-field/number-field.component.scss +6 -0
- package/src/ccc-resource/resource-field/fields/number-field/number-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/number-field/number-field.component.ts +14 -0
- package/src/ccc-resource/resource-field/fields/text-field/text-field.component.html +29 -0
- package/src/ccc-resource/resource-field/fields/text-field/text-field.component.scss +6 -0
- package/src/ccc-resource/resource-field/fields/text-field/text-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/fields/text-field/text-field.component.ts +23 -0
- package/src/ccc-resource/resource-field/resource-field.component.html +112 -0
- package/src/ccc-resource/resource-field/resource-field.component.scss +7 -0
- package/src/ccc-resource/resource-field/resource-field.component.spec.ts +22 -0
- package/src/ccc-resource/resource-field/resource-field.component.ts +214 -0
- package/src/ccc-resource/resource-layout/resource-layout.component.html +73 -0
- package/src/ccc-resource/resource-layout/resource-layout.component.scss +26 -0
- package/src/ccc-resource/resource-layout/resource-layout.component.spec.ts +22 -0
- package/src/ccc-resource/resource-layout/resource-layout.component.ts +176 -0
- package/src/ccc-resource/resource-list/ resource-list.component.spec.ts +22 -0
- package/src/ccc-resource/resource-list/resource-list.component.html +27 -0
- package/src/ccc-resource/resource-list/resource-list.component.scss +67 -0
- package/src/ccc-resource/resource-list/resource-list.component.ts +376 -0
- package/src/ccc-resource/resource-list-create/resource-list-create.component.html +71 -0
- package/src/ccc-resource/resource-list-create/resource-list-create.component.scss +9 -0
- package/src/ccc-resource/resource-list-create/resource-list-create.component.spec.ts +22 -0
- package/src/ccc-resource/resource-list-create/resource-list-create.component.ts +103 -0
- package/src/ccc-resource/resource-resolver/resource-resolver.component.html +1 -0
- package/src/ccc-resource/resource-resolver/resource-resolver.component.scss +0 -0
- package/src/ccc-resource/resource-resolver/resource-resolver.component.spec.ts +22 -0
- package/src/ccc-resource/resource-resolver/resource-resolver.component.ts +69 -0
- package/src/ccc-resource/resource-store.service.ts +93 -0
- package/src/ccc-resource/resource-view/resource-view.component.html +133 -0
- package/src/ccc-resource/resource-view/resource-view.component.scss +150 -0
- package/src/ccc-resource/resource-view/resource-view.component.spec.ts +22 -0
- package/src/ccc-resource/resource-view/resource-view.component.ts +354 -0
- package/src/ccc-resource/resources-helpers.ts +262 -0
- package/src/ccc-resource/utils/validator-utils.ts +6 -0
- package/{fesm2022/cccteam-ccc-lib.mjs → src/index.ts} +32 -11
- package/src/internal-types/index.ts +1 -0
- package/src/internal-types/ng-package.json +6 -0
- package/src/types/auth.actions.ts +46 -0
- package/src/types/configs.ts +952 -0
- package/src/types/constants.ts +1 -0
- package/src/types/core.actions.ts +33 -0
- package/src/types/{public-api.d.ts → index.ts} +3 -0
- package/src/types/ng-package.json +6 -0
- package/src/types/notification-message.ts +20 -0
- package/src/types/{permissions.d.ts → permissions.ts} +9 -9
- package/src/types/{session-info.d.ts → session-info.ts} +4 -3
- package/src/types/tokens.ts +20 -0
- package/src/ui-alert/alert.component.html +13 -0
- package/src/ui-alert/alert.component.scss +48 -0
- package/src/ui-alert/alert.component.spec.ts +22 -0
- package/src/ui-alert/alert.component.ts +35 -0
- package/src/ui-alert/ng-package.json +6 -0
- package/src/ui-core-service/index.ts +1 -0
- package/src/ui-core-service/ng-package.json +6 -0
- package/src/ui-core-service/ui-core.service.ts +34 -0
- package/src/ui-interceptor/api.interceptor.spec.ts +16 -0
- package/src/ui-interceptor/api.interceptor.ts +45 -0
- package/src/ui-interceptor/ng-package.json +6 -0
- package/src/ui-notification-service/ng-package.json +6 -0
- package/src/ui-notification-service/notification.service.ts +59 -0
- package/src/ui-sidenav/ng-package.json +6 -0
- package/src/ui-sidenav/sidenav.component.html +60 -0
- package/src/ui-sidenav/sidenav.component.scss +99 -0
- package/src/ui-sidenav/sidenav.component.spec.ts +22 -0
- package/src/ui-sidenav/sidenav.component.ts +64 -0
- package/src/util-request-options/ng-package.json +6 -0
- package/src/util-request-options/request-options.ts +17 -0
- package/tsconfig.lib.json +13 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/cccteam-ccc-lib-0.0.13.tgz +0 -0
- package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs +0 -44
- package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs +0 -24
- package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs +0 -118
- package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs +0 -51
- package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs +0 -56
- package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-state.mjs +0 -109
- package/fesm2022/cccteam-ccc-lib-src-auth-state.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-types.mjs +0 -137
- package/fesm2022/cccteam-ccc-lib-src-types.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs +0 -48
- package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-core-state.mjs +0 -100
- package/fesm2022/cccteam-ccc-lib-src-ui-core-state.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs +0 -48
- package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs +0 -57
- package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs +0 -70
- package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs +0 -19
- package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/public-api.d.ts +0 -13
- package/src/auth-authentication-guard/authentication.guard.d.ts +0 -3
- package/src/auth-authentication-guard/index.d.ts +0 -5
- package/src/auth-authorization-guard/authorization.guard.d.ts +0 -3
- package/src/auth-authorization-guard/index.d.ts +0 -5
- package/src/auth-forms/ccc-field/ccc-field.component.d.ts +0 -25
- package/src/auth-forms/form-helpers.d.ts +0 -16
- package/src/auth-forms/index.d.ts +0 -5
- package/src/auth-has-permission/has-permission.directive.d.ts +0 -12
- package/src/auth-has-permission/index.d.ts +0 -5
- package/src/auth-service/auth.service.d.ts +0 -24
- package/src/auth-service/index.d.ts +0 -5
- package/src/auth-state/auth.state.d.ts +0 -27
- package/src/auth-state/index.d.ts +0 -5
- package/src/auth-state/public-api.d.ts +0 -1
- package/src/types/auth.actions.d.ts +0 -41
- package/src/types/core.actions.d.ts +0 -31
- package/src/types/index.d.ts +0 -5
- package/src/types/notification-message.d.ts +0 -18
- package/src/types/tokens.d.ts +0 -13
- package/src/ui-alert/alert.component.d.ts +0 -13
- package/src/ui-alert/index.d.ts +0 -5
- package/src/ui-core-state/core.state.d.ts +0 -28
- package/src/ui-core-state/index.d.ts +0 -5
- package/src/ui-core-state/public-api.d.ts +0 -1
- package/src/ui-interceptor/api.interceptor.d.ts +0 -12
- package/src/ui-interceptor/index.d.ts +0 -5
- package/src/ui-notification-service/index.d.ts +0 -5
- package/src/ui-notification-service/notification.service.d.ts +0 -30
- package/src/ui-sidenav/index.d.ts +0 -5
- package/src/ui-sidenav/sidenav.component.d.ts +0 -31
- package/src/util-request-options/index.d.ts +0 -5
- package/src/util-request-options/request-options.d.ts +0 -8
- /package/src/auth-authentication-guard/{public-api.d.ts → index.ts} +0 -0
- /package/src/auth-authorization-guard/{public-api.d.ts → index.ts} +0 -0
- /package/src/auth-has-permission/{public-api.d.ts → index.ts} +0 -0
- /package/src/auth-service/{public-api.d.ts → index.ts} +0 -0
- /package/src/ui-alert/{public-api.d.ts → index.ts} +0 -0
- /package/src/ui-interceptor/{public-api.d.ts → index.ts} +0 -0
- /package/src/ui-notification-service/{public-api.d.ts → index.ts} +0 -0
- /package/src/ui-sidenav/{public-api.d.ts → index.ts} +0 -0
- /package/src/util-request-options/{public-api.d.ts → index.ts} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<div [class]="linkCreateType() ? 'page-container hide' : 'page-container'">
|
|
2
|
+
<div class="header-container" [class.show-background]="!config().collapsible" [class.indent]="indentTitle()">
|
|
3
|
+
<h1 class="title">{{ listTitle() }}</h1>
|
|
4
|
+
@if (showCreateButton()) {
|
|
5
|
+
<div class="create-button">
|
|
6
|
+
<button mat-raised-button color="accent" (click)="createResource($event)">
|
|
7
|
+
<div class="edit-text">
|
|
8
|
+
<mat-icon>create</mat-icon>
|
|
9
|
+
<span class="edit-button-text"> {{ createButtonLabel() }} </span>
|
|
10
|
+
</div>
|
|
11
|
+
</button>
|
|
12
|
+
</div>
|
|
13
|
+
}
|
|
14
|
+
</div>
|
|
15
|
+
<div class="resource-container">
|
|
16
|
+
@if (config().searchable) {
|
|
17
|
+
<mat-form-field class="search">
|
|
18
|
+
<input matInput #qry (keyup)="store.searchTokens.set(qry.value)" placeholder="Search" aria-label="Search" />
|
|
19
|
+
@if (searchableFields() !== '') {
|
|
20
|
+
<mat-hint>Search {{ searchableFields() }}</mat-hint>
|
|
21
|
+
}
|
|
22
|
+
<mat-icon matPrefix>search</mat-icon>
|
|
23
|
+
</mat-form-field>
|
|
24
|
+
}
|
|
25
|
+
<ccc-grid [rowData]="processedRowData()" [columnDefs]="columns()"></ccc-grid>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.page-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
margin: 10px 0 0 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.header-container {
|
|
7
|
+
margin-top: 10px;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
top: 0;
|
|
12
|
+
z-index: 10;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.title {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.create-button {
|
|
23
|
+
margin-top: auto;
|
|
24
|
+
margin-bottom: auto;
|
|
25
|
+
padding-left: 10px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.edit-text {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
align-items: center;
|
|
32
|
+
|
|
33
|
+
.edit {
|
|
34
|
+
color: #003b49;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.mat-icon {
|
|
38
|
+
margin-right: 8px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.edit-button-text {
|
|
43
|
+
margin-top: auto;
|
|
44
|
+
margin-bottom: auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.exp-panel-add-element-btn {
|
|
48
|
+
margin-right: 10px;
|
|
49
|
+
transform: scale(1.2);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.hide {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.show-background {
|
|
57
|
+
background-color: #ffffff;
|
|
58
|
+
padding-bottom: 20px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.indent {
|
|
62
|
+
padding-left: 20px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.search {
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
computed,
|
|
4
|
+
effect,
|
|
5
|
+
inject,
|
|
6
|
+
Injector,
|
|
7
|
+
input,
|
|
8
|
+
OnInit,
|
|
9
|
+
output,
|
|
10
|
+
ResourceRef,
|
|
11
|
+
runInInjectionContext,
|
|
12
|
+
signal,
|
|
13
|
+
} from '@angular/core';
|
|
14
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
15
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
16
|
+
import { MatExpansionModule } from '@angular/material/expansion';
|
|
17
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
18
|
+
import { MatInputModule } from '@angular/material/input';
|
|
19
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
20
|
+
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
21
|
+
import { AppGridComponent } from '@cccteam/ccc-lib/src/ccc-grid';
|
|
22
|
+
import { ChildResourceConfig, ColumnConfig, FieldName, ListViewConfig, RecordData, Resource, RESOURCE_META, RootConfig } from '@cccteam/ccc-lib/src/types';
|
|
23
|
+
import {
|
|
24
|
+
hyphenConcatWithoutResource,
|
|
25
|
+
hyphenSpaceConcatWithoutResource,
|
|
26
|
+
noSpaceConcatWithoutResource,
|
|
27
|
+
spaceConcatWithoutResource,
|
|
28
|
+
spaceHyphenConcatWithoutResource,
|
|
29
|
+
} from '../concat-fns';
|
|
30
|
+
import { applyFormatting, formatDateString } from '../format-fns';
|
|
31
|
+
import { ResourceCacheService } from '../resource-cache.service';
|
|
32
|
+
import { ResourceStore } from '../resource-store.service';
|
|
33
|
+
|
|
34
|
+
@Component({
|
|
35
|
+
standalone: true,
|
|
36
|
+
imports: [
|
|
37
|
+
AppGridComponent,
|
|
38
|
+
RouterModule,
|
|
39
|
+
MatIconModule,
|
|
40
|
+
MatButtonModule,
|
|
41
|
+
MatExpansionModule,
|
|
42
|
+
MatTooltipModule,
|
|
43
|
+
ReactiveFormsModule,
|
|
44
|
+
MatInputModule,
|
|
45
|
+
],
|
|
46
|
+
selector: 'ccc-resource-list',
|
|
47
|
+
templateUrl: './resource-list.component.html',
|
|
48
|
+
styleUrls: ['./resource-list.component.scss'],
|
|
49
|
+
providers: [ResourceStore],
|
|
50
|
+
})
|
|
51
|
+
export class ResourceListComponent implements OnInit {
|
|
52
|
+
router = inject(Router);
|
|
53
|
+
store = inject(ResourceStore);
|
|
54
|
+
injector = inject(Injector);
|
|
55
|
+
activatedRoute = inject(ActivatedRoute);
|
|
56
|
+
cache = inject(ResourceCacheService);
|
|
57
|
+
resourceMeta = inject(RESOURCE_META);
|
|
58
|
+
|
|
59
|
+
hideCreateButton = input<boolean>(true);
|
|
60
|
+
createMode = output<boolean>();
|
|
61
|
+
resourceConfig = input<ChildResourceConfig>();
|
|
62
|
+
viewRoute = input<string>();
|
|
63
|
+
filter = input<string>('');
|
|
64
|
+
linkCreateType = input<boolean>(false);
|
|
65
|
+
isRootList = input<boolean>(true);
|
|
66
|
+
|
|
67
|
+
showCreateButton = computed(() => {
|
|
68
|
+
const config = this.config();
|
|
69
|
+
if (config.createTitle !== '' && !config.collapsible && !this.hideCreateButton()) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
if (config.createConfig && Object.keys(config.createConfig).length !== 0) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
searchableFields = computed(() => {
|
|
79
|
+
const meta = this.meta();
|
|
80
|
+
if (!meta) return '';
|
|
81
|
+
return `over fields of ${meta.route}`;
|
|
82
|
+
// TODO: implement searchable fields based on resource meta
|
|
83
|
+
// return meta.searchableFields.join(', ') || '';
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
relatedData = input<RecordData>();
|
|
87
|
+
parentId = input<string>();
|
|
88
|
+
|
|
89
|
+
routeConfig = computed(() => {
|
|
90
|
+
return this.activatedRoute.snapshot.data['config'] as RootConfig;
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
config = computed(() => {
|
|
94
|
+
return this.resourceConfig() as ListViewConfig;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
viewRouteFallback = computed(() => {
|
|
98
|
+
if (this.viewRoute()) {
|
|
99
|
+
return this.viewRoute();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return this.resourceMeta(this.config().primaryResource).route;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
listTitle = computed(() => {
|
|
106
|
+
if (this.config()?.collapsible) return '';
|
|
107
|
+
return this.config().title || '';
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
indentTitle = computed(() => {
|
|
111
|
+
if (this.config() === undefined) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
createButtonLabel = computed(() => {
|
|
119
|
+
return this.config().createButtonLabel || 'Create';
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
meta = computed(() => {
|
|
123
|
+
const config = this.config();
|
|
124
|
+
return this.resourceMeta(config.overrideResource || config.primaryResource);
|
|
125
|
+
});
|
|
126
|
+
resourceWatchList: ResourceRef<RecordData[]>[] = [];
|
|
127
|
+
primaryKeys = computed(() => {
|
|
128
|
+
const meta = this.meta();
|
|
129
|
+
if (!meta) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
return meta.fields.filter((field) => field.primaryKey !== undefined);
|
|
133
|
+
});
|
|
134
|
+
columns = computed(() => {
|
|
135
|
+
const config = this.config();
|
|
136
|
+
const idCols = [];
|
|
137
|
+
for (const pk of this.primaryKeys()) {
|
|
138
|
+
if (pk.required) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
idCols.push({
|
|
142
|
+
id: pk.fieldName as FieldName,
|
|
143
|
+
hidden: true,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const cols = [...idCols, ...config.listColumns];
|
|
148
|
+
const columns: ColumnConfig[] = [];
|
|
149
|
+
const usedIds = new Set<string>();
|
|
150
|
+
|
|
151
|
+
// preset all resource list caches so a value is available for the valueGetter
|
|
152
|
+
for (const col of cols) {
|
|
153
|
+
if (!('additionalIds' in col)) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
col.additionalIds.forEach((id) => {
|
|
157
|
+
if (id.resource === undefined) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const resource = signal(id.resource as Resource);
|
|
161
|
+
const ref = this.cache.registerList(resource, resource);
|
|
162
|
+
if (!this.resourceWatchList.includes(ref)) this.resourceWatchList.push(ref);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
for (const col of cols) {
|
|
167
|
+
const indexId = this.getUniqueId(col.id, usedIds) as FieldName;
|
|
168
|
+
usedIds.add(indexId);
|
|
169
|
+
|
|
170
|
+
if (col.hidden) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if ('additionalIds' in col) {
|
|
175
|
+
columns.push({
|
|
176
|
+
id: indexId,
|
|
177
|
+
header: col.header,
|
|
178
|
+
width: col.width,
|
|
179
|
+
resizable: col.resizable,
|
|
180
|
+
valueGetter: (data) => {
|
|
181
|
+
const concatArray: string[] = [];
|
|
182
|
+
|
|
183
|
+
col.additionalIds.forEach((additionalCol) => {
|
|
184
|
+
if (!additionalCol.resource) {
|
|
185
|
+
concatArray.push(data[additionalCol.id]);
|
|
186
|
+
} else {
|
|
187
|
+
const resource = signal(additionalCol.resource as Resource);
|
|
188
|
+
const resourceRef = this.cache.registerList(resource, resource);
|
|
189
|
+
for (const res of resourceRef.value()) {
|
|
190
|
+
if (res[additionalCol.id] === data[col.id] && res['id'] !== undefined && additionalCol.field) {
|
|
191
|
+
const value = res[additionalCol.field];
|
|
192
|
+
if (col.formatType && typeof value === 'string') {
|
|
193
|
+
concatArray.push(formatDateString(col.formatType, value));
|
|
194
|
+
} else if (value) {
|
|
195
|
+
concatArray.push(value as string);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
if (concatArray.length === 0) {
|
|
203
|
+
return col.emptyDataValue as string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
switch (col.concatFn) {
|
|
207
|
+
case 'space-concat':
|
|
208
|
+
return spaceConcatWithoutResource(concatArray);
|
|
209
|
+
case 'space-hyphen-concat':
|
|
210
|
+
return spaceHyphenConcatWithoutResource(concatArray);
|
|
211
|
+
case 'hyphen-space-concat':
|
|
212
|
+
return hyphenSpaceConcatWithoutResource(concatArray);
|
|
213
|
+
case 'no-space-concat':
|
|
214
|
+
return noSpaceConcatWithoutResource(concatArray);
|
|
215
|
+
default: {
|
|
216
|
+
// default case is hyphen-concat
|
|
217
|
+
return hyphenConcatWithoutResource(concatArray);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
columns.push({
|
|
224
|
+
id: indexId,
|
|
225
|
+
header: col.header,
|
|
226
|
+
width: col.width,
|
|
227
|
+
resizable: col.resizable,
|
|
228
|
+
valueFormatter: (params) => {
|
|
229
|
+
if (col.formatType) {
|
|
230
|
+
const retValue = applyFormatting(col.formatType, params);
|
|
231
|
+
return retValue || col.emptyDataValue;
|
|
232
|
+
}
|
|
233
|
+
return params || col.emptyDataValue;
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (this.config().showViewButton) {
|
|
240
|
+
let route = '';
|
|
241
|
+
const isRootList = this.isRootList() === undefined;
|
|
242
|
+
|
|
243
|
+
if (this.viewRouteFallback() && isRootList) {
|
|
244
|
+
route = this.viewRouteFallback() || '';
|
|
245
|
+
} else {
|
|
246
|
+
let viewResource = this.config().viewResource;
|
|
247
|
+
if (!viewResource || viewResource === '') {
|
|
248
|
+
viewResource = this.config().primaryResource;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const meta = this.resourceMeta(viewResource as Resource);
|
|
252
|
+
if (meta !== undefined) {
|
|
253
|
+
route = meta.route;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
columns.push({
|
|
258
|
+
id: 'view' as FieldName,
|
|
259
|
+
header: 'View',
|
|
260
|
+
hideHeader: true,
|
|
261
|
+
buttonConfig: {
|
|
262
|
+
label: 'View',
|
|
263
|
+
icon: 'arrow_forward',
|
|
264
|
+
viewRoute: route,
|
|
265
|
+
actionType: 'link',
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return columns;
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
processedRowData = computed(() => {
|
|
274
|
+
for (const ref of this.resourceWatchList) {
|
|
275
|
+
ref.value();
|
|
276
|
+
}
|
|
277
|
+
const data = this.store.listData();
|
|
278
|
+
if (!data) return [];
|
|
279
|
+
const columns = this.columns();
|
|
280
|
+
|
|
281
|
+
return data.map((row) => {
|
|
282
|
+
const updatedRow = { ...row };
|
|
283
|
+
for (const col of columns) {
|
|
284
|
+
if (typeof col.valueGetter === 'function') {
|
|
285
|
+
updatedRow[col.id] = col.valueGetter(row);
|
|
286
|
+
} else {
|
|
287
|
+
updatedRow[col.id] = row[col.id];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (typeof col.valueFormatter === 'function') {
|
|
291
|
+
updatedRow[col.id] = col.valueFormatter(updatedRow[col.id]);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return updatedRow;
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
filters = computed(() => {
|
|
299
|
+
const configFilter = this.config().filter?.(this.relatedData()) || '';
|
|
300
|
+
const inputFilter = this.filter();
|
|
301
|
+
if (inputFilter && configFilter) {
|
|
302
|
+
return `(${inputFilter}),(${configFilter})`;
|
|
303
|
+
}
|
|
304
|
+
if (inputFilter) {
|
|
305
|
+
return `(${inputFilter})`;
|
|
306
|
+
}
|
|
307
|
+
return configFilter || '';
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
createResource(event: MouseEvent): void {
|
|
311
|
+
event.stopPropagation();
|
|
312
|
+
this.createMode.emit(true);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
parentKey = computed(() => {
|
|
316
|
+
if (this.relatedData() === undefined || this.childKey() === undefined) {
|
|
317
|
+
return '';
|
|
318
|
+
}
|
|
319
|
+
const parent = this.config().parentRelation?.parentKey;
|
|
320
|
+
return this.relatedData()?.[parent] || '';
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
childKey = computed(() => {
|
|
324
|
+
if (!this.config().parentRelation) {
|
|
325
|
+
return '';
|
|
326
|
+
}
|
|
327
|
+
return this.config().parentRelation?.childKey as string;
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
private getUniqueId(baseId: string, usedIds: Set<string>): string {
|
|
331
|
+
if (!usedIds.has(baseId)) {
|
|
332
|
+
return baseId;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
let counter = 1;
|
|
336
|
+
let newId = `${baseId}_${counter}`;
|
|
337
|
+
while (usedIds.has(newId)) {
|
|
338
|
+
counter++;
|
|
339
|
+
newId = `${baseId}_${counter}`;
|
|
340
|
+
}
|
|
341
|
+
return newId;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
ngOnInit(): void {
|
|
345
|
+
const primaryResource = this.config().primaryResource;
|
|
346
|
+
if (this.meta()) {
|
|
347
|
+
this.store.resourceName.set(primaryResource);
|
|
348
|
+
this.store.resourceMeta.set(this.meta());
|
|
349
|
+
this.store.listColumns.set(this.config().listColumns || []);
|
|
350
|
+
this.store.requireSearchToDisplayResults.set(this.config().requireSearchToDisplayResults || false);
|
|
351
|
+
this.store.sorts.set(this.config().sorts || []);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
runInInjectionContext(this.injector, () => {
|
|
355
|
+
this.config().listColumns.forEach((element) => {
|
|
356
|
+
if (!('additionalIds' in element)) return;
|
|
357
|
+
element.additionalIds.forEach((id) => {
|
|
358
|
+
if (id.resource === undefined) return;
|
|
359
|
+
const meta = this.resourceMeta(id.resource);
|
|
360
|
+
if (meta === undefined) return;
|
|
361
|
+
const route = signal(meta.route);
|
|
362
|
+
const resource = signal(id.resource);
|
|
363
|
+
const ref = this.cache.registerList(route, resource);
|
|
364
|
+
this.resourceWatchList.push(ref);
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
effect(() => {
|
|
369
|
+
this.filter();
|
|
370
|
+
this.relatedData();
|
|
371
|
+
this.store.filter.set(this.filters());
|
|
372
|
+
this.store.resetResourceList();
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@if (config().collapsible) {
|
|
2
|
+
<div class="page-container">
|
|
3
|
+
<mat-expansion-panel
|
|
4
|
+
#expPanel
|
|
5
|
+
[@.disabled]="true"
|
|
6
|
+
disabled="{{ !config().collapsible }}"
|
|
7
|
+
expanded="{{ !config().collapsible }}">
|
|
8
|
+
@if (config().collapsible || config().title) {
|
|
9
|
+
<mat-expansion-panel-header>
|
|
10
|
+
<mat-panel-title>
|
|
11
|
+
<h1 class="title">
|
|
12
|
+
{{ config().title }}
|
|
13
|
+
</h1>
|
|
14
|
+
</mat-panel-title>
|
|
15
|
+
@if (config().createTitle !== '') {
|
|
16
|
+
<button
|
|
17
|
+
mat-icon-button
|
|
18
|
+
class="exp-panel-add-element-btn"
|
|
19
|
+
color="accent"
|
|
20
|
+
(click)="createResource($event)"
|
|
21
|
+
matTooltip="{{ config().createButtonLabel }}"
|
|
22
|
+
matTooltipPosition="above">
|
|
23
|
+
<mat-icon color="accent">add_circle</mat-icon>
|
|
24
|
+
</button>
|
|
25
|
+
}
|
|
26
|
+
</mat-expansion-panel-header>
|
|
27
|
+
} @else {
|
|
28
|
+
<div class="no-title-exp-panel-padding"></div>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@if (create()) {
|
|
32
|
+
<ccc-resource-create
|
|
33
|
+
[resourceConfig]="createConfig()"
|
|
34
|
+
[parentData]="parentData()"
|
|
35
|
+
[loadCreatedResource]="config().createType === 'link'"
|
|
36
|
+
(complete)="makeCreatePatches()">
|
|
37
|
+
</ccc-resource-create>
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
<ccc-resource-list
|
|
41
|
+
[viewRoute]="rootConfig().routeData.route"
|
|
42
|
+
[resourceConfig]="config()"
|
|
43
|
+
[filter]="filter()"
|
|
44
|
+
[hideCreateButton]="create()"
|
|
45
|
+
[relatedData]="parentData()"
|
|
46
|
+
[parentId]="parentId()"
|
|
47
|
+
[linkCreateType]="createLinkType()"
|
|
48
|
+
[isRootList]="isRootList()"
|
|
49
|
+
(createMode)="create.set($event)"></ccc-resource-list>
|
|
50
|
+
</mat-expansion-panel>
|
|
51
|
+
</div>
|
|
52
|
+
} @else {
|
|
53
|
+
@if (create()) {
|
|
54
|
+
<ccc-resource-create
|
|
55
|
+
[resourceConfig]="createConfig()"
|
|
56
|
+
[parentData]="parentData()"
|
|
57
|
+
[loadCreatedResource]="config().createType === 'link'"
|
|
58
|
+
(complete)="makeCreatePatches()">
|
|
59
|
+
</ccc-resource-create>
|
|
60
|
+
}
|
|
61
|
+
<ccc-resource-list
|
|
62
|
+
[viewRoute]="rootConfig().routeData.route"
|
|
63
|
+
[resourceConfig]="config()"
|
|
64
|
+
[filter]="filter()"
|
|
65
|
+
[hideCreateButton]="create()"
|
|
66
|
+
[relatedData]="parentData()"
|
|
67
|
+
[parentId]="parentId()"
|
|
68
|
+
(createMode)="create.set($event)"
|
|
69
|
+
[isRootList]="isRootList()"
|
|
70
|
+
[linkCreateType]="createLinkType()"></ccc-resource-list>
|
|
71
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ResourceListCreateComponent } from './resource-list-create.component';
|
|
4
|
+
|
|
5
|
+
xdescribe('ResourceListCreateComponent', () => {
|
|
6
|
+
let component: ResourceListCreateComponent;
|
|
7
|
+
let fixture: ComponentFixture<ResourceListCreateComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ResourceListCreateComponent],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
|
|
14
|
+
fixture = TestBed.createComponent(ResourceListCreateComponent);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
fixture.detectChanges();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should create', () => {
|
|
20
|
+
expect(component).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Component, computed, inject, Injector, input, signal, viewChild } from '@angular/core';
|
|
2
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
3
|
+
import { MatExpansionModule, MatExpansionPanel } from '@angular/material/expansion';
|
|
4
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
5
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
6
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
7
|
+
import { ListViewConfig, RecordData, RootConfig } from '@cccteam/ccc-lib/src/types';
|
|
8
|
+
import { ResourceCacheService } from '../resource-cache.service';
|
|
9
|
+
import { ResourceCreateComponent } from '../resource-create/resource-create.component';
|
|
10
|
+
import { ResourceListComponent } from '../resource-list/resource-list.component';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'ccc-resource-list-create',
|
|
14
|
+
templateUrl: './resource-list-create.component.html',
|
|
15
|
+
styleUrl: './resource-list-create.component.scss',
|
|
16
|
+
imports: [
|
|
17
|
+
MatExpansionModule,
|
|
18
|
+
MatIconModule,
|
|
19
|
+
MatTooltipModule,
|
|
20
|
+
MatButtonModule,
|
|
21
|
+
ResourceCreateComponent,
|
|
22
|
+
ResourceListComponent,
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
export class ResourceListCreateComponent {
|
|
26
|
+
injector = inject(Injector);
|
|
27
|
+
cache = inject(ResourceCacheService);
|
|
28
|
+
|
|
29
|
+
route = inject(ActivatedRoute);
|
|
30
|
+
router = inject(Router);
|
|
31
|
+
create = signal<boolean>(false);
|
|
32
|
+
parentId = input<string>();
|
|
33
|
+
parentData = input<RecordData>({});
|
|
34
|
+
searchParams = input<Record<string, string>[]>([]);
|
|
35
|
+
resourceConfig = input<ListViewConfig>();
|
|
36
|
+
isRootList = input<boolean>(true);
|
|
37
|
+
|
|
38
|
+
childKey = computed(() => {
|
|
39
|
+
if (!this.config().parentRelation) {
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
return this.config().parentRelation?.childKey as string;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
filter = computed(() => {
|
|
46
|
+
const filters = [];
|
|
47
|
+
if (this.childKey() !== '' && this.parentKey() !== '') {
|
|
48
|
+
filters.push(`${this.childKey()}:eq:${this.parentKey()}`);
|
|
49
|
+
}
|
|
50
|
+
return filters.join(',');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
parentKey = computed(() => {
|
|
54
|
+
if (this.parentData() === undefined || this.childKey() === undefined) {
|
|
55
|
+
return '';
|
|
56
|
+
}
|
|
57
|
+
const parent = this.config().parentRelation?.parentKey;
|
|
58
|
+
return this.parentData()?.[parent] || '';
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
config = computed(() => {
|
|
62
|
+
const inputConfig = this.resourceConfig();
|
|
63
|
+
if (inputConfig) {
|
|
64
|
+
return inputConfig as ListViewConfig;
|
|
65
|
+
}
|
|
66
|
+
return this.rootConfig().parentConfig as ListViewConfig;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
expPanel = viewChild<MatExpansionPanel, MatExpansionPanel>('expPanel', { read: MatExpansionPanel });
|
|
70
|
+
|
|
71
|
+
rootConfig = computed(() => {
|
|
72
|
+
return this.route.snapshot.data['config'] as RootConfig;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
createLinkType = computed(() => {
|
|
76
|
+
return this.config().createType === 'link' && this.create();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
createConfig = computed(() => {
|
|
80
|
+
const config = this.config();
|
|
81
|
+
if (Object.keys(config.createConfig).length !== 0) {
|
|
82
|
+
return config.createConfig;
|
|
83
|
+
}
|
|
84
|
+
return config;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
createResource(event: MouseEvent): void {
|
|
88
|
+
event.stopPropagation();
|
|
89
|
+
this.create.set(true);
|
|
90
|
+
|
|
91
|
+
if (this.expPanel() && this.expPanel()?.closed) {
|
|
92
|
+
this.expPanel()?.open();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
makeCreatePatches(): void {
|
|
97
|
+
if (this.create()) {
|
|
98
|
+
const resource = this.config().primaryResource;
|
|
99
|
+
this.cache.updateResourceInCache(resource, 'list');
|
|
100
|
+
this.create.set(false);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-template #dynamicSlot></ng-template>
|
|
File without changes
|