@cccteam/ccc-lib 0.0.14 → 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.
- package/README.md +38 -13
- package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs +15 -49
- package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs +4 -4
- package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs +16 -22
- package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ccc-camel-case-to-title.mjs +33 -0
- package/fesm2022/cccteam-ccc-lib-src-ccc-camel-case-to-title.mjs.map +1 -0
- package/fesm2022/cccteam-ccc-lib-src-ccc-grid.mjs +256 -0
- package/fesm2022/cccteam-ccc-lib-src-ccc-grid.mjs.map +1 -0
- package/fesm2022/cccteam-ccc-lib-src-ccc-resource.mjs +3129 -0
- package/fesm2022/cccteam-ccc-lib-src-ccc-resource.mjs.map +1 -0
- package/fesm2022/cccteam-ccc-lib-src-forms.mjs +79 -0
- package/fesm2022/cccteam-ccc-lib-src-forms.mjs.map +1 -0
- package/fesm2022/cccteam-ccc-lib-src-internal-types.mjs +6 -0
- package/fesm2022/cccteam-ccc-lib-src-internal-types.mjs.map +1 -0
- package/fesm2022/cccteam-ccc-lib-src-types.mjs +406 -112
- package/fesm2022/cccteam-ccc-lib-src-types.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs +3 -3
- package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs +7 -7
- package/fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-idle-service.mjs +157 -0
- package/fesm2022/cccteam-ccc-lib-src-ui-idle-service.mjs.map +1 -0
- package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs +4 -4
- package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs +5 -5
- package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs +4 -4
- package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-util-request-options.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib.mjs +4434 -12
- package/fesm2022/cccteam-ccc-lib.mjs.map +1 -1
- package/package.json +44 -18
- package/{src/auth-forms/index.d.ts → types/cccteam-ccc-lib-src-auth-forms.d.ts} +1 -18
- package/{src/auth-service/index.d.ts → types/cccteam-ccc-lib-src-auth-service.d.ts} +3 -1
- package/types/cccteam-ccc-lib-src-ccc-camel-case-to-title.d.ts +10 -0
- package/types/cccteam-ccc-lib-src-ccc-grid.d.ts +35 -0
- package/types/cccteam-ccc-lib-src-ccc-resource.d.ts +674 -0
- package/types/cccteam-ccc-lib-src-forms.d.ts +27 -0
- package/types/cccteam-ccc-lib-src-internal-types.d.ts +1 -0
- package/types/cccteam-ccc-lib-src-types.d.ts +934 -0
- package/types/cccteam-ccc-lib-src-ui-idle-service.d.ts +49 -0
- package/types/cccteam-ccc-lib.d.ts +1877 -0
- package/index.d.ts +0 -12
- package/src/types/index.d.ts +0 -133
- /package/{src/auth-authentication-guard/index.d.ts → types/cccteam-ccc-lib-src-auth-authentication-guard.d.ts} +0 -0
- /package/{src/auth-authorization-guard/index.d.ts → types/cccteam-ccc-lib-src-auth-authorization-guard.d.ts} +0 -0
- /package/{src/auth-has-permission/index.d.ts → types/cccteam-ccc-lib-src-auth-has-permission.d.ts} +0 -0
- /package/{src/ui-alert/index.d.ts → types/cccteam-ccc-lib-src-ui-alert.d.ts} +0 -0
- /package/{src/ui-core-service/index.d.ts → types/cccteam-ccc-lib-src-ui-core-service.d.ts} +0 -0
- /package/{src/ui-interceptor/index.d.ts → types/cccteam-ccc-lib-src-ui-interceptor.d.ts} +0 -0
- /package/{src/ui-notification-service/index.d.ts → types/cccteam-ccc-lib-src-ui-notification-service.d.ts} +0 -0
- /package/{src/ui-sidenav/index.d.ts → types/cccteam-ccc-lib-src-ui-sidenav.d.ts} +0 -0
- /package/{src/util-request-options/index.d.ts → types/cccteam-ccc-lib-src-util-request-options.d.ts} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { FormGroup, FormArray } from '@angular/forms';
|
|
2
|
+
import { isEqual } from 'lodash-es';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Compares two objects and returns a sparse object containing only the differing key-value pairs
|
|
6
|
+
* @param data - object to compare
|
|
7
|
+
* @param compareData - object to compare against
|
|
8
|
+
* @returns Partial<T>
|
|
9
|
+
* @example sparseData<UserCreate>(this.user, initUser)
|
|
10
|
+
*/
|
|
11
|
+
function sparseData(data, compareData) {
|
|
12
|
+
const sparseData = {};
|
|
13
|
+
for (const key in data) {
|
|
14
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
15
|
+
if (!isEqual(data[key], compareData[key])) {
|
|
16
|
+
sparseData[key] = data[key];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return sparseData;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Iterates through a form group's controls and returns a sparse object with only the changed values.
|
|
24
|
+
* @param form - The form group to iterate through
|
|
25
|
+
* @param compareData - The object to compare the form's values to
|
|
26
|
+
* @returns - A sparse object with only the changed values
|
|
27
|
+
* @example sparseFormData<UserCreate>(this.userForm, initUser)
|
|
28
|
+
*/
|
|
29
|
+
function sparseFormData(form, compareData) {
|
|
30
|
+
const sparseFormData = {};
|
|
31
|
+
for (const key in form.controls) {
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(form.controls, key)) {
|
|
33
|
+
const control = form.controls[key];
|
|
34
|
+
const controlValue = control.value;
|
|
35
|
+
const compareValue = compareData[key];
|
|
36
|
+
if (controlValue !== compareValue) {
|
|
37
|
+
sparseFormData[key] = controlValue;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return sparseFormData;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Recursively cleans a FormGroup or FormArray, removing controls with empty string values.
|
|
45
|
+
* Similar to sparseFormData, but doesn't compare to an initial state
|
|
46
|
+
* @param control - The FormGroup or FormArray to clean.
|
|
47
|
+
* @returns A cleaned object with non-empty values.
|
|
48
|
+
*/
|
|
49
|
+
function cleanStringForm(control) {
|
|
50
|
+
if (control instanceof FormGroup) {
|
|
51
|
+
const cleanedGroup = {};
|
|
52
|
+
for (const key of Object.keys(control.controls)) {
|
|
53
|
+
const childControl = control.get(key);
|
|
54
|
+
if (childControl) {
|
|
55
|
+
const cleanedValue = cleanStringForm(childControl);
|
|
56
|
+
if (cleanedValue !== undefined && cleanedValue !== null && cleanedValue !== '') {
|
|
57
|
+
cleanedGroup[key] = cleanedValue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return cleanedGroup;
|
|
62
|
+
}
|
|
63
|
+
else if (control instanceof FormArray) {
|
|
64
|
+
const cleanedArray = control.controls
|
|
65
|
+
.map((childControl) => cleanStringForm(childControl))
|
|
66
|
+
.filter((item) => item !== undefined && item !== null && item !== '');
|
|
67
|
+
return cleanedArray;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return control.value !== '' ? control.value : undefined;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Generated bundle index. Do not edit.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
export { cleanStringForm, sparseData, sparseFormData };
|
|
79
|
+
//# sourceMappingURL=cccteam-ccc-lib-src-forms.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cccteam-ccc-lib-src-forms.mjs","sources":["../../../projects/ccc-lib/src/forms/index.ts","../../../projects/ccc-lib/src/forms/cccteam-ccc-lib-src-forms.ts"],"sourcesContent":["import { AbstractControl, FormArray, FormGroup } from '@angular/forms';\nimport { isEqual } from 'lodash-es';\n\n/**\n * Compares two objects and returns a sparse object containing only the differing key-value pairs\n * @param data - object to compare\n * @param compareData - object to compare against\n * @returns Partial<T>\n * @example sparseData<UserCreate>(this.user, initUser)\n */\nexport function sparseData<T extends Record<string, unknown>>(data: T, compareData: T): Partial<T> {\n const sparseData: Partial<T> = {};\n\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n if (!isEqual(data[key], compareData[key])) {\n sparseData[key] = data[key];\n }\n }\n }\n\n return sparseData;\n}\n\n/**\n * Iterates through a form group's controls and returns a sparse object with only the changed values.\n * @param form - The form group to iterate through\n * @param compareData - The object to compare the form's values to\n * @returns - A sparse object with only the changed values\n * @example sparseFormData<UserCreate>(this.userForm, initUser)\n */\nexport function sparseFormData<T>(form: FormGroup, compareData: T): T {\n const sparseFormData: T = {} as T;\n for (const key in form.controls) {\n if (Object.prototype.hasOwnProperty.call(form.controls, key)) {\n const control = form.controls[key];\n const controlValue = control.value;\n const compareValue = compareData[key as keyof T];\n if (controlValue !== compareValue) {\n sparseFormData[key as keyof T] = controlValue as T[keyof T];\n }\n }\n }\n return sparseFormData;\n}\n\n/**\n * Recursively cleans a FormGroup or FormArray, removing controls with empty string values.\n * Similar to sparseFormData, but doesn't compare to an initial state\n * @param control - The FormGroup or FormArray to clean.\n * @returns A cleaned object with non-empty values.\n */\nexport function cleanStringForm<T>(control: AbstractControl): T | undefined {\n if (control instanceof FormGroup) {\n const cleanedGroup: Record<string, unknown> = {};\n for (const key of Object.keys(control.controls)) {\n const childControl = control.get(key);\n if (childControl) {\n const cleanedValue = cleanStringForm(childControl);\n if (cleanedValue !== undefined && cleanedValue !== null && cleanedValue !== '') {\n cleanedGroup[key] = cleanedValue;\n }\n }\n }\n return cleanedGroup as T;\n } else if (control instanceof FormArray) {\n const cleanedArray = control.controls\n .map((childControl) => cleanStringForm(childControl))\n .filter((item) => item !== undefined && item !== null && item !== '');\n return cleanedArray as unknown as T;\n } else {\n return control.value !== '' ? control.value : undefined;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGA;;;;;;AAMG;AACG,SAAU,UAAU,CAAoC,IAAO,EAAE,WAAc,EAAA;IACnF,MAAM,UAAU,GAAe,EAAE;AAEjC,IAAA,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;AACtB,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;AACnD,YAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE;gBACzC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;YAC7B;QACF;IACF;AAEA,IAAA,OAAO,UAAU;AACnB;AAEA;;;;;;AAMG;AACG,SAAU,cAAc,CAAI,IAAe,EAAE,WAAc,EAAA;IAC/D,MAAM,cAAc,GAAM,EAAO;AACjC,IAAA,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE;AAC/B,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;YAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;AAClC,YAAA,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK;AAClC,YAAA,MAAM,YAAY,GAAG,WAAW,CAAC,GAAc,CAAC;AAChD,YAAA,IAAI,YAAY,KAAK,YAAY,EAAE;AACjC,gBAAA,cAAc,CAAC,GAAc,CAAC,GAAG,YAA0B;YAC7D;QACF;IACF;AACA,IAAA,OAAO,cAAc;AACvB;AAEA;;;;;AAKG;AACG,SAAU,eAAe,CAAI,OAAwB,EAAA;AACzD,IAAA,IAAI,OAAO,YAAY,SAAS,EAAE;QAChC,MAAM,YAAY,GAA4B,EAAE;AAChD,QAAA,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC/C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YACrC,IAAI,YAAY,EAAE;AAChB,gBAAA,MAAM,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC;AAClD,gBAAA,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,EAAE,EAAE;AAC9E,oBAAA,YAAY,CAAC,GAAG,CAAC,GAAG,YAAY;gBAClC;YACF;QACF;AACA,QAAA,OAAO,YAAiB;IAC1B;AAAO,SAAA,IAAI,OAAO,YAAY,SAAS,EAAE;AACvC,QAAA,MAAM,YAAY,GAAG,OAAO,CAAC;aAC1B,GAAG,CAAC,CAAC,YAAY,KAAK,eAAe,CAAC,YAAY,CAAC;AACnD,aAAA,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;AACvE,QAAA,OAAO,YAA4B;IACrC;SAAO;AACL,QAAA,OAAO,OAAO,CAAC,KAAK,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS;IACzD;AACF;;ACzEA;;AAEG;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cccteam-ccc-lib-src-internal-types.mjs","sources":["../../../projects/ccc-lib/src/internal-types/cccteam-ccc-lib-src-internal-types.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;AAEG"}
|
|
@@ -1,117 +1,361 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
(function (AuthenticationGuardAction) {
|
|
7
|
-
class SetRedirectUrl {
|
|
8
|
-
redirectUrl;
|
|
9
|
-
static type = '[AuthenticationGuard] Set Redirect Url And Navigate To Login Page';
|
|
10
|
-
constructor(redirectUrl) {
|
|
11
|
-
this.redirectUrl = redirectUrl;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
AuthenticationGuardAction.SetRedirectUrl = SetRedirectUrl;
|
|
15
|
-
class CheckUserSession {
|
|
16
|
-
static type = '[AuthenticationGuard] Check User Session';
|
|
17
|
-
}
|
|
18
|
-
AuthenticationGuardAction.CheckUserSession = CheckUserSession;
|
|
19
|
-
})(AuthenticationGuardAction || (AuthenticationGuardAction = {}));
|
|
20
|
-
var LoginAction;
|
|
21
|
-
(function (LoginAction) {
|
|
22
|
-
class Logout {
|
|
23
|
-
static type = '[Login] Auto Logout';
|
|
24
|
-
}
|
|
25
|
-
LoginAction.Logout = Logout;
|
|
26
|
-
class SetRedirectUrl {
|
|
27
|
-
redirectUrl;
|
|
28
|
-
static type = '[Login] Set Redirect Url';
|
|
29
|
-
constructor(redirectUrl) {
|
|
30
|
-
this.redirectUrl = redirectUrl;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
LoginAction.SetRedirectUrl = SetRedirectUrl;
|
|
34
|
-
class PublishError {
|
|
35
|
-
message;
|
|
36
|
-
static type = '[Login] Publish Error';
|
|
37
|
-
constructor(message) {
|
|
38
|
-
this.message = message;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
LoginAction.PublishError = PublishError;
|
|
42
|
-
})(LoginAction || (LoginAction = {}));
|
|
43
|
-
var AppAction;
|
|
44
|
-
(function (AppAction) {
|
|
45
|
-
class CheckUserSession {
|
|
46
|
-
static type = '[App] Check User Session';
|
|
47
|
-
}
|
|
48
|
-
AppAction.CheckUserSession = CheckUserSession;
|
|
49
|
-
class SetRedirectUrl {
|
|
50
|
-
redirectUrl;
|
|
51
|
-
static type = '[App] Set Redirect Url';
|
|
52
|
-
constructor(redirectUrl) {
|
|
53
|
-
this.redirectUrl = redirectUrl;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
AppAction.SetRedirectUrl = SetRedirectUrl;
|
|
57
|
-
class SetNavIdentifier {
|
|
58
|
-
identifier;
|
|
59
|
-
static type = '[App] Set Nav Identifier';
|
|
60
|
-
constructor(identifier) {
|
|
61
|
-
this.identifier = identifier;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
AppAction.SetNavIdentifier = SetNavIdentifier;
|
|
65
|
-
})(AppAction || (AppAction = {}));
|
|
3
|
+
// Shared types and constants used across the ccc-resource module
|
|
4
|
+
// This file exists to break circular dependencies between types and ccc-resource
|
|
5
|
+
const defaultEmptyFieldValue = '-';
|
|
66
6
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
7
|
+
function actionButtonConfig(config) {
|
|
8
|
+
return {
|
|
9
|
+
...actionButtonConfigDefaults,
|
|
10
|
+
...config,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const actionButtonConfigDefaults = {
|
|
14
|
+
label: '',
|
|
15
|
+
icon: '',
|
|
16
|
+
actionType: 'function',
|
|
17
|
+
color: '',
|
|
18
|
+
disabledLabel: '',
|
|
19
|
+
};
|
|
20
|
+
function singleColumnConfig(config) {
|
|
21
|
+
return {
|
|
22
|
+
...singleColumnConfigDefaults,
|
|
23
|
+
...config,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const singleColumnConfigDefaults = {
|
|
27
|
+
id: '',
|
|
28
|
+
header: '',
|
|
29
|
+
resizable: true,
|
|
30
|
+
actionType: 'function',
|
|
31
|
+
hidden: false,
|
|
32
|
+
filterable: true,
|
|
33
|
+
hideHeader: false,
|
|
34
|
+
};
|
|
35
|
+
function multiColumnConfig(config) {
|
|
36
|
+
return {
|
|
37
|
+
...multiColumnConfigDefaults,
|
|
38
|
+
...config,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const multiColumnConfigDefaults = {
|
|
42
|
+
...singleColumnConfigDefaults,
|
|
43
|
+
additionalIds: [],
|
|
44
|
+
concatFn: 'hyphen-concat',
|
|
45
|
+
};
|
|
46
|
+
function additionalResourceConfig(config) {
|
|
47
|
+
return {
|
|
48
|
+
...additionalResourceConfigDefaults,
|
|
49
|
+
...config,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const additionalResourceConfigDefaults = {
|
|
53
|
+
id: '',
|
|
54
|
+
resource: '',
|
|
55
|
+
field: '',
|
|
56
|
+
hidden: false,
|
|
57
|
+
};
|
|
58
|
+
function fieldSort(config) {
|
|
59
|
+
return {
|
|
60
|
+
...fieldSortDefaults,
|
|
61
|
+
...config,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const fieldSortDefaults = {
|
|
65
|
+
field: '',
|
|
66
|
+
direction: 'asc',
|
|
67
|
+
};
|
|
68
|
+
function enumeratedConfig(config) {
|
|
69
|
+
return {
|
|
70
|
+
...enumeratedConfigDefaults,
|
|
71
|
+
...config,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const enumeratedConfigDefaults = {
|
|
75
|
+
overrideResource: '',
|
|
76
|
+
filter: () => '',
|
|
77
|
+
disableCacheForFilterPii: false,
|
|
78
|
+
filterType: 'parentResource',
|
|
79
|
+
sorts: [],
|
|
80
|
+
listDisplay: [],
|
|
81
|
+
viewDisplay: [],
|
|
82
|
+
viewConcatFn: 'hyphen-concat',
|
|
83
|
+
listConcatFn: 'hyphen-concat',
|
|
84
|
+
viewDetails: false,
|
|
85
|
+
searchable: false,
|
|
86
|
+
};
|
|
87
|
+
function nullBooleanConfig(config) {
|
|
88
|
+
return {
|
|
89
|
+
...nullBooleanConfigDefaults,
|
|
90
|
+
...config,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const defaultBooleanDisplay = Object.freeze({
|
|
94
|
+
null: {
|
|
95
|
+
label: defaultEmptyFieldValue,
|
|
96
|
+
value: null,
|
|
97
|
+
},
|
|
98
|
+
true: {
|
|
99
|
+
label: 'Yes',
|
|
100
|
+
value: true,
|
|
101
|
+
},
|
|
102
|
+
false: {
|
|
103
|
+
label: 'No',
|
|
104
|
+
value: false,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
const nullBooleanConfigDefaults = {
|
|
108
|
+
displayValues: defaultBooleanDisplay,
|
|
109
|
+
};
|
|
110
|
+
function foreignKeyDefault(config) {
|
|
111
|
+
return {
|
|
112
|
+
...foreignKeyDefaultDefaults,
|
|
113
|
+
...config,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const foreignKeyDefaultDefaults = {
|
|
117
|
+
type: 'foreignKey',
|
|
118
|
+
parentId: '',
|
|
119
|
+
};
|
|
120
|
+
function staticDefault(config) {
|
|
121
|
+
return {
|
|
122
|
+
...staticDefaultDefaults,
|
|
123
|
+
...config,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const staticDefaultDefaults = {
|
|
127
|
+
type: 'static',
|
|
128
|
+
value: '',
|
|
129
|
+
};
|
|
130
|
+
function computedDisplayField(config) {
|
|
131
|
+
return {
|
|
132
|
+
...computedDisplayFieldElementDefaults,
|
|
133
|
+
...config,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const computedDisplayFieldElementDefaults = {
|
|
137
|
+
type: 'computedDisplayField',
|
|
138
|
+
label: '',
|
|
139
|
+
class: '',
|
|
140
|
+
cols: 6,
|
|
141
|
+
calculatedValue: () => '',
|
|
142
|
+
shouldRender: true,
|
|
143
|
+
};
|
|
144
|
+
function padding(config) {
|
|
145
|
+
return {
|
|
146
|
+
...paddingElementDefaults,
|
|
147
|
+
...config,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const paddingElementDefaults = {
|
|
151
|
+
type: 'padding',
|
|
152
|
+
cols: 12,
|
|
153
|
+
shouldRender: true,
|
|
154
|
+
};
|
|
155
|
+
function section(config) {
|
|
156
|
+
return {
|
|
157
|
+
...sectionElementDefaults,
|
|
158
|
+
...config,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const sectionElementDefaults = {
|
|
162
|
+
type: 'section',
|
|
163
|
+
label: '',
|
|
164
|
+
class: '',
|
|
165
|
+
cols: 12,
|
|
166
|
+
shouldRender: true,
|
|
167
|
+
nullAllChildrenIfConditionallyHidden: false,
|
|
168
|
+
children: [],
|
|
169
|
+
};
|
|
170
|
+
function field(config) {
|
|
171
|
+
return {
|
|
172
|
+
...fieldElementDefaults,
|
|
173
|
+
...config,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const fieldElementDefaults = {
|
|
177
|
+
type: 'field',
|
|
178
|
+
name: '',
|
|
179
|
+
label: '',
|
|
180
|
+
cols: 6,
|
|
181
|
+
class: '',
|
|
182
|
+
enumeratedConfig: { ...enumeratedConfigDefaults },
|
|
183
|
+
default: null,
|
|
184
|
+
validators: [],
|
|
185
|
+
nullBooleanConfig: { ...nullBooleanConfigDefaults },
|
|
186
|
+
readOnly: false,
|
|
187
|
+
prefixes: [],
|
|
188
|
+
suffixes: [],
|
|
189
|
+
shouldRender: true,
|
|
190
|
+
nullIfConditionallyHidden: false,
|
|
191
|
+
};
|
|
192
|
+
function rpcConfig(config) {
|
|
193
|
+
return {
|
|
194
|
+
...rpcConfigDefaults,
|
|
195
|
+
...config,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
const rpcConfigDefaults = {
|
|
199
|
+
label: '',
|
|
200
|
+
afterMethodRedirect: '',
|
|
201
|
+
conditions: [],
|
|
202
|
+
methodBodyTemplate: {},
|
|
203
|
+
successMessage: '',
|
|
204
|
+
elements: [],
|
|
205
|
+
placement: 'end',
|
|
206
|
+
method: '',
|
|
207
|
+
customComponent: {},
|
|
208
|
+
refreshResources: [],
|
|
209
|
+
defaultModalWidth: '',
|
|
210
|
+
shouldRender: () => true,
|
|
211
|
+
};
|
|
212
|
+
const rootConfigDefaults = {
|
|
213
|
+
routeData: {},
|
|
214
|
+
nav: {
|
|
215
|
+
navItem: {},
|
|
216
|
+
},
|
|
217
|
+
parentConfig: {},
|
|
218
|
+
relatedConfigs: [],
|
|
219
|
+
rpcConfigs: [],
|
|
220
|
+
};
|
|
221
|
+
function rootConfig(config) {
|
|
222
|
+
return {
|
|
223
|
+
...rootConfigDefaults,
|
|
224
|
+
...config,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function componentConfig(config) {
|
|
228
|
+
return {
|
|
229
|
+
...componentConfigDefaults,
|
|
230
|
+
...config,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const componentConfigDefaults = {
|
|
234
|
+
type: 'Component',
|
|
235
|
+
primaryResource: '',
|
|
236
|
+
component: 'SwitchResolver',
|
|
237
|
+
params: {
|
|
238
|
+
cases: [],
|
|
239
|
+
},
|
|
240
|
+
relatedConfig: [],
|
|
241
|
+
shouldRenderActions: {
|
|
242
|
+
create: () => true,
|
|
243
|
+
edit: () => true,
|
|
244
|
+
delete: () => true,
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
function switchParams(config) {
|
|
248
|
+
return {
|
|
249
|
+
...switchParamsDefaults,
|
|
250
|
+
...config,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
const switchParamsDefaults = {
|
|
254
|
+
cases: [],
|
|
255
|
+
};
|
|
256
|
+
function listViewConfig(config) {
|
|
257
|
+
return {
|
|
258
|
+
...listViewConfigDefaults,
|
|
259
|
+
...config,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
const listViewConfigDefaults = {
|
|
263
|
+
title: '',
|
|
264
|
+
primaryResource: '',
|
|
265
|
+
type: 'ListView',
|
|
266
|
+
createTitle: '',
|
|
267
|
+
createButtonLabel: 'Create',
|
|
268
|
+
loadCreatedResource: false,
|
|
269
|
+
showViewButton: true,
|
|
270
|
+
collapsible: false,
|
|
271
|
+
listColumns: [],
|
|
272
|
+
elements: [],
|
|
273
|
+
parentClass: '',
|
|
274
|
+
fieldClass: '',
|
|
275
|
+
createConfig: {},
|
|
276
|
+
createNavigation: [],
|
|
277
|
+
relatedConfigs: [],
|
|
278
|
+
parentRelation: {
|
|
279
|
+
parentKey: '',
|
|
280
|
+
childKey: '',
|
|
281
|
+
},
|
|
282
|
+
overrideResource: '',
|
|
283
|
+
searchable: false,
|
|
284
|
+
enableRowExpansion: false,
|
|
285
|
+
rowExpansionConfig: {},
|
|
286
|
+
requireSearchToDisplayResults: false,
|
|
287
|
+
showBackButton: true,
|
|
288
|
+
filter: () => '',
|
|
289
|
+
disableCacheForFilterPii: false,
|
|
290
|
+
sorts: [],
|
|
291
|
+
viewResource: '',
|
|
292
|
+
actionType: 'function',
|
|
293
|
+
rpcConfigs: [],
|
|
294
|
+
shouldRenderActions: {
|
|
295
|
+
create: () => true,
|
|
296
|
+
edit: () => true,
|
|
297
|
+
delete: () => true,
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
function viewConfig(config) {
|
|
301
|
+
return {
|
|
302
|
+
...viewConfigDefaults,
|
|
303
|
+
...config,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
const viewConfigDefaults = {
|
|
307
|
+
title: '',
|
|
308
|
+
primaryResource: '',
|
|
309
|
+
type: 'View',
|
|
310
|
+
createTitle: '',
|
|
311
|
+
createButtonLabel: 'Create',
|
|
312
|
+
parentClass: '',
|
|
313
|
+
fieldClass: '',
|
|
314
|
+
elements: [],
|
|
315
|
+
collapsible: true,
|
|
316
|
+
connectorResource: '',
|
|
317
|
+
relatedConfigs: [],
|
|
318
|
+
createConfig: {},
|
|
319
|
+
shouldRenderActions: {
|
|
320
|
+
create: () => true,
|
|
321
|
+
edit: () => true,
|
|
322
|
+
delete: () => true,
|
|
323
|
+
},
|
|
324
|
+
createNavigation: [],
|
|
325
|
+
parentRelation: {
|
|
326
|
+
parentKey: '',
|
|
327
|
+
childKey: '',
|
|
328
|
+
},
|
|
329
|
+
showBackButton: true,
|
|
330
|
+
rpcConfigs: [],
|
|
331
|
+
};
|
|
332
|
+
function arrayConfig(config) {
|
|
333
|
+
return {
|
|
334
|
+
...arrayConfigDefaults,
|
|
335
|
+
...config,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
const arrayConfigDefaults = {
|
|
339
|
+
type: 'Array',
|
|
340
|
+
iteratedConfig: {},
|
|
341
|
+
viewType: 'OneToMany',
|
|
342
|
+
collapsible: true,
|
|
343
|
+
createConfig: {},
|
|
344
|
+
connectorResource: '',
|
|
345
|
+
connectorField: '',
|
|
346
|
+
primaryResource: '',
|
|
347
|
+
listFilter: () => '',
|
|
348
|
+
disableCacheForFilterPii: false,
|
|
349
|
+
sorts: [],
|
|
350
|
+
title: '',
|
|
351
|
+
createButtonLabel: 'Create',
|
|
352
|
+
limit: Infinity,
|
|
353
|
+
shouldRenderActions: {
|
|
354
|
+
create: () => true,
|
|
355
|
+
edit: () => true,
|
|
356
|
+
delete: () => true,
|
|
357
|
+
},
|
|
358
|
+
};
|
|
115
359
|
|
|
116
360
|
var AlertLevel;
|
|
117
361
|
(function (AlertLevel) {
|
|
@@ -123,15 +367,65 @@ var AlertLevel;
|
|
|
123
367
|
const ReadPermission = 'Read';
|
|
124
368
|
const UpdatePermission = 'Update';
|
|
125
369
|
|
|
370
|
+
// Meta interfaces for resources and methods
|
|
371
|
+
// This file exists to break circular dependencies between types and ccc-resource
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* The base URL for API requests (e.g., 'https://api.example.com/').
|
|
375
|
+
*/
|
|
126
376
|
const BASE_URL = new InjectionToken('BASE_URL');
|
|
377
|
+
/**
|
|
378
|
+
* The path to the frontend login page (e.g., '/login').
|
|
379
|
+
*/
|
|
380
|
+
const FRONTEND_LOGIN_PATH = new InjectionToken('FRONTEND_LOGIN_PATH');
|
|
381
|
+
/**
|
|
382
|
+
* The path to the session endpoint (e.g., 'user/session').
|
|
383
|
+
*/
|
|
384
|
+
const SESSION_PATH = new InjectionToken('SESSION_PATH');
|
|
385
|
+
/**
|
|
386
|
+
* The base URL for API requests (e.g., '/api').
|
|
387
|
+
*/
|
|
127
388
|
const API_URL = new InjectionToken('API_URL');
|
|
128
389
|
const PERMISSION_REQUIRED = new InjectionToken('PERMISSION_REQUIRED');
|
|
129
390
|
const AVAILABLE_PERMISSIONS = new InjectionToken('AVAILABLE_PERMISSIONS');
|
|
130
391
|
const AVAILABLE_DOMAINS = new InjectionToken('AVAILABLE_DOMAINS');
|
|
392
|
+
const RESOURCE_META = new InjectionToken('RESOURCE_META');
|
|
393
|
+
const METHOD_META = new InjectionToken('METHOD_META');
|
|
394
|
+
const IDLE_SESSION_DURATION = new InjectionToken('IDLE_SESSION_DURATION');
|
|
395
|
+
const IDLE_WARNING_DURATION = new InjectionToken('IDLE_WARNING_DURATION');
|
|
396
|
+
const IDLE_KEEPALIVE_DURATION = new InjectionToken('IDLE_KEEPALIVE_DURATION');
|
|
397
|
+
|
|
398
|
+
const validatorsPresent = (control, validators, previousValidatorCount) => {
|
|
399
|
+
if (validators.length === previousValidatorCount) {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
let hasAllValidators = true;
|
|
403
|
+
for (const validator of validators) {
|
|
404
|
+
if (!control.hasValidator(validator)) {
|
|
405
|
+
hasAllValidators = false;
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return hasAllValidators;
|
|
410
|
+
};
|
|
411
|
+
const requiredIf = (predicate, validator) => {
|
|
412
|
+
return (formControl) => {
|
|
413
|
+
if (!formControl.parent) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
if (predicate()) {
|
|
417
|
+
return validator(formControl);
|
|
418
|
+
}
|
|
419
|
+
return null;
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
function createResourceValidator(validator) {
|
|
423
|
+
return validator;
|
|
424
|
+
}
|
|
131
425
|
|
|
132
426
|
/**
|
|
133
427
|
* Generated bundle index. Do not edit.
|
|
134
428
|
*/
|
|
135
429
|
|
|
136
|
-
export { API_URL, AVAILABLE_DOMAINS, AVAILABLE_PERMISSIONS, AlertLevel,
|
|
430
|
+
export { API_URL, AVAILABLE_DOMAINS, AVAILABLE_PERMISSIONS, AlertLevel, BASE_URL, FRONTEND_LOGIN_PATH, IDLE_KEEPALIVE_DURATION, IDLE_SESSION_DURATION, IDLE_WARNING_DURATION, METHOD_META, PERMISSION_REQUIRED, RESOURCE_META, ReadPermission, SESSION_PATH, UpdatePermission, actionButtonConfig, actionButtonConfigDefaults, additionalResourceConfig, additionalResourceConfigDefaults, arrayConfig, arrayConfigDefaults, componentConfig, componentConfigDefaults, computedDisplayField, computedDisplayFieldElementDefaults, createResourceValidator, defaultEmptyFieldValue, enumeratedConfig, enumeratedConfigDefaults, field, fieldElementDefaults, fieldSort, fieldSortDefaults, foreignKeyDefault, foreignKeyDefaultDefaults, listViewConfig, listViewConfigDefaults, multiColumnConfig, multiColumnConfigDefaults, nullBooleanConfig, nullBooleanConfigDefaults, padding, paddingElementDefaults, requiredIf, rootConfig, rootConfigDefaults, rpcConfig, rpcConfigDefaults, section, sectionElementDefaults, singleColumnConfig, singleColumnConfigDefaults, staticDefault, staticDefaultDefaults, switchParams, switchParamsDefaults, validatorsPresent, viewConfig, viewConfigDefaults };
|
|
137
431
|
//# sourceMappingURL=cccteam-ccc-lib-src-types.mjs.map
|