@alauda-fe/crd-form 0.0.1
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/esm2022/alauda-fe-crd-form.mjs +5 -0
- package/esm2022/lib/abstract/base-array.mjs +117 -0
- package/esm2022/lib/crd-form/component.mjs +334 -0
- package/esm2022/lib/crd-form/helper.mjs +32 -0
- package/esm2022/lib/crd-form.module.mjs +117 -0
- package/esm2022/lib/field-controls/expressions/expression-core.mjs +2 -0
- package/esm2022/lib/field-controls/expressions/props-expression.mjs +58 -0
- package/esm2022/lib/field-controls/form-item.component.mjs +121 -0
- package/esm2022/lib/field-controls/index.mjs +8 -0
- package/esm2022/lib/field-controls/module.mjs +141 -0
- package/esm2022/lib/field-controls/operand-advanced-field-group.component.mjs +80 -0
- package/esm2022/lib/field-controls/operand-array-field-group.component.mjs +112 -0
- package/esm2022/lib/field-controls/operand-field-group.component.mjs +98 -0
- package/esm2022/lib/field-controls/operand-field.component.mjs +870 -0
- package/esm2022/lib/field-controls/widgets/array-table/component.mjs +109 -0
- package/esm2022/lib/field-controls/widgets/basic-auth-secret/component.mjs +116 -0
- package/esm2022/lib/field-controls/widgets/basic-auth-secret/create/component.mjs +211 -0
- package/esm2022/lib/field-controls/widgets/basic-auth-secret/type.mjs +2 -0
- package/esm2022/lib/field-controls/widgets/index.mjs +8 -0
- package/esm2022/lib/field-controls/widgets/k8s-resource-prefix/component.mjs +169 -0
- package/esm2022/lib/field-controls/widgets/k8s-resource-prefix/util.mjs +40 -0
- package/esm2022/lib/field-controls/widgets/link/component.mjs +68 -0
- package/esm2022/lib/field-controls/widgets/resource-requirements/resource-requirements.component.mjs +524 -0
- package/esm2022/lib/field-controls/widgets/utils.mjs +73 -0
- package/esm2022/lib/field-controls/widgets/yaml-editor/yaml-editor.component.mjs +94 -0
- package/esm2022/lib/field-widgets/htpasswd/component.mjs +35 -0
- package/esm2022/lib/field-widgets/htpasswd/form.mjs +171 -0
- package/esm2022/lib/field-widgets/htpasswd/index.mjs +4 -0
- package/esm2022/lib/field-widgets/htpasswd/module.mjs +54 -0
- package/esm2022/lib/field-widgets/index.mjs +2 -0
- package/esm2022/lib/remote-widgets/constants.mjs +4 -0
- package/esm2022/lib/remote-widgets/index.mjs +4 -0
- package/esm2022/lib/remote-widgets/remote-widget.service.mjs +42 -0
- package/esm2022/lib/remote-widgets/token.mjs +7 -0
- package/esm2022/lib/spec-descriptors/capability/capability.component.mjs +139 -0
- package/esm2022/lib/spec-descriptors/capability-list/capability-list.component.mjs +189 -0
- package/esm2022/lib/spec-descriptors/index.mjs +4 -0
- package/esm2022/lib/spec-descriptors/util.mjs +13 -0
- package/esm2022/lib/types/index.mjs +73 -0
- package/esm2022/lib/utils/capability.mjs +295 -0
- package/esm2022/lib/utils/constant.mjs +22 -0
- package/esm2022/lib/utils/directives.mjs +19 -0
- package/esm2022/lib/utils/helper.mjs +201 -0
- package/esm2022/lib/utils/index.mjs +7 -0
- package/esm2022/lib/utils/service-model.mjs +12 -0
- package/esm2022/lib/utils/util.mjs +310 -0
- package/esm2022/public-api.mjs +13 -0
- package/index.d.ts +5 -0
- package/lib/abstract/base-array.d.ts +31 -0
- package/lib/crd-form/component.d.ts +61 -0
- package/lib/crd-form/helper.d.ts +7 -0
- package/lib/crd-form.module.d.ts +16 -0
- package/lib/field-controls/expressions/expression-core.d.ts +6 -0
- package/lib/field-controls/expressions/props-expression.d.ts +36 -0
- package/lib/field-controls/form-item.component.d.ts +11 -0
- package/lib/field-controls/index.d.ts +7 -0
- package/lib/field-controls/module.d.ts +23 -0
- package/lib/field-controls/operand-advanced-field-group.component.d.ts +16 -0
- package/lib/field-controls/operand-array-field-group.component.d.ts +8 -0
- package/lib/field-controls/operand-field-group.component.d.ts +24 -0
- package/lib/field-controls/operand-field.component.d.ts +110 -0
- package/lib/field-controls/widgets/array-table/component.d.ts +8 -0
- package/lib/field-controls/widgets/basic-auth-secret/component.d.ts +26 -0
- package/lib/field-controls/widgets/basic-auth-secret/create/component.d.ts +45 -0
- package/lib/field-controls/widgets/basic-auth-secret/type.d.ts +11 -0
- package/lib/field-controls/widgets/index.d.ts +7 -0
- package/lib/field-controls/widgets/k8s-resource-prefix/component.d.ts +35 -0
- package/lib/field-controls/widgets/k8s-resource-prefix/util.d.ts +3 -0
- package/lib/field-controls/widgets/link/component.d.ts +20 -0
- package/lib/field-controls/widgets/resource-requirements/resource-requirements.component.d.ts +88 -0
- package/lib/field-controls/widgets/utils.d.ts +17 -0
- package/lib/field-controls/widgets/yaml-editor/yaml-editor.component.d.ts +36 -0
- package/lib/field-widgets/htpasswd/component.d.ts +9 -0
- package/lib/field-widgets/htpasswd/form.d.ts +32 -0
- package/lib/field-widgets/htpasswd/index.d.ts +3 -0
- package/lib/field-widgets/htpasswd/module.d.ts +13 -0
- package/lib/field-widgets/index.d.ts +1 -0
- package/lib/remote-widgets/constants.d.ts +3 -0
- package/lib/remote-widgets/index.d.ts +3 -0
- package/lib/remote-widgets/remote-widget.service.d.ts +28 -0
- package/lib/remote-widgets/token.d.ts +3 -0
- package/lib/spec-descriptors/capability/capability.component.d.ts +20 -0
- package/lib/spec-descriptors/capability-list/capability-list.component.d.ts +34 -0
- package/lib/spec-descriptors/index.d.ts +3 -0
- package/lib/spec-descriptors/util.d.ts +4 -0
- package/lib/types/index.d.ts +122 -0
- package/lib/utils/capability.d.ts +54 -0
- package/lib/utils/constant.d.ts +12 -0
- package/lib/utils/directives.d.ts +9 -0
- package/lib/utils/helper.d.ts +61 -0
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/service-model.d.ts +44 -0
- package/lib/utils/util.d.ts +48 -0
- package/package.json +30 -0
- package/public-api.d.ts +9 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OpenAPIV3SchemaObject } from '@alauda-fe/common';
|
|
2
|
+
import { Descriptor, OperandArrayFieldGroup, OperandField, OperandFieldGroup } from '../../types';
|
|
3
|
+
import { createCapabilityField } from '../../utils';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class SpecCapabilityListComponent {
|
|
6
|
+
descriptors: Descriptor[];
|
|
7
|
+
debug: boolean;
|
|
8
|
+
data: unknown;
|
|
9
|
+
openApiSchema: OpenAPIV3SchemaObject;
|
|
10
|
+
openApiSchemaPath: string | string[];
|
|
11
|
+
createCapabilityField: typeof createCapabilityField;
|
|
12
|
+
excludes: (fields: OperandField[]) => OperandField[];
|
|
13
|
+
debugLog: (fields: {
|
|
14
|
+
normalFields: OperandField[];
|
|
15
|
+
fieldGroups: OperandFieldGroup[];
|
|
16
|
+
arrayFieldGroups: OperandArrayFieldGroup[];
|
|
17
|
+
advancedFields: OperandField[];
|
|
18
|
+
descriptorFields: OperandField[];
|
|
19
|
+
openApiFields: OperandField[];
|
|
20
|
+
basicFields: OperandField[];
|
|
21
|
+
treeFields: OperandField[];
|
|
22
|
+
}) => {
|
|
23
|
+
normalFields: OperandField[];
|
|
24
|
+
fieldGroups: OperandFieldGroup[];
|
|
25
|
+
arrayFieldGroups: OperandArrayFieldGroup[];
|
|
26
|
+
advancedFields: OperandField[];
|
|
27
|
+
descriptorFields: OperandField[];
|
|
28
|
+
openApiFields: OperandField[];
|
|
29
|
+
basicFields: OperandField[];
|
|
30
|
+
treeFields: OperandField[];
|
|
31
|
+
};
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpecCapabilityListComponent, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SpecCapabilityListComponent, "acl-spec-descriptor-capability-list", never, { "descriptors": { "alias": "descriptors"; "required": false; }; "debug": { "alias": "debug"; "required": false; }; "data": { "alias": "data"; "required": false; }; "openApiSchema": { "alias": "openApiSchema"; "required": false; }; "openApiSchemaPath": { "alias": "openApiSchemaPath"; "required": false; }; }, {}, never, never, false, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { JSONSchema6TypeName, LocaleDisplay } from '@alauda-fe/common';
|
|
2
|
+
import { ValidationErrors } from '@angular/forms';
|
|
3
|
+
import { Map } from 'immutable';
|
|
4
|
+
export declare enum Validations {
|
|
5
|
+
maximum = "maximum",
|
|
6
|
+
minimum = "minimum",
|
|
7
|
+
maxLength = "maxLength",
|
|
8
|
+
minLength = "minLength",
|
|
9
|
+
pattern = "pattern",
|
|
10
|
+
required = "required"
|
|
11
|
+
}
|
|
12
|
+
export declare const SpecCapabilityUIPrefix = "urn:alm:descriptor:com.tectonic.ui";
|
|
13
|
+
export declare const SpecCapabilityWidgetsPrefix = "urn:alm:descriptor:widgets";
|
|
14
|
+
export declare enum SpecCapability {
|
|
15
|
+
podCount = "urn:alm:descriptor:com.tectonic.ui:podCount",
|
|
16
|
+
resourceRequirements = "urn:alm:descriptor:com.tectonic.ui:resourceRequirements",
|
|
17
|
+
booleanSwitch = "urn:alm:descriptor:com.tectonic.ui:booleanSwitch",
|
|
18
|
+
text = "urn:alm:descriptor:com.tectonic.ui:text",
|
|
19
|
+
textarea = "urn:alm:descriptor:com.tectonic.ui:textarea",
|
|
20
|
+
password = "urn:alm:descriptor:com.tectonic.ui:password",
|
|
21
|
+
confirmPassword = "urn:alm:descriptor:com.tectonic.ui:password:confirm",
|
|
22
|
+
externalPassword = "urn:alm:descriptor:com.tectonic.ui:externalPassword",
|
|
23
|
+
number = "urn:alm:descriptor:com.tectonic.ui:number",
|
|
24
|
+
tagsInput = "urn:alm:descriptor:com.tectonic.ui:tagsInput",
|
|
25
|
+
fieldGroup = "urn:alm:descriptor:com.tectonic.ui:fieldGroup:",
|
|
26
|
+
arrayFieldGroup = "urn:alm:descriptor:com.tectonic.ui:arrayFieldGroup:",
|
|
27
|
+
select = "urn:alm:descriptor:com.tectonic.ui:select:",
|
|
28
|
+
advanced = "urn:alm:descriptor:com.tectonic.ui:advanced",
|
|
29
|
+
fieldDependency = "urn:alm:descriptor:com.tectonic.ui:fieldDependency:",
|
|
30
|
+
defaultValue = "urn:alm:descriptor:com.tectonic.default:",
|
|
31
|
+
hidden = "urn:alm:descriptor:com.tectonic.ui:hidden",
|
|
32
|
+
k8sResourcePrefix = "urn:alm:descriptor:io.kubernetes:",
|
|
33
|
+
labelEn = "urn:alm:descriptor:label:en:",
|
|
34
|
+
labelZh = "urn:alm:descriptor:label:zh:",
|
|
35
|
+
descriptionEn = "urn:alm:descriptor:description:en:",
|
|
36
|
+
descriptionZh = "urn:alm:descriptor:description:zh:",
|
|
37
|
+
placeholder = "urn:alm:descriptor:placeholder:",
|
|
38
|
+
fieldGroupName = "urn:alm:descriptor:fieldGroupName:",
|
|
39
|
+
tooltip = "urn:alm:descriptor:tooltip:",
|
|
40
|
+
/** Using String Expressions */
|
|
41
|
+
expression = "urn:alm:descriptor:expression:",
|
|
42
|
+
/** 自定义 Urn */
|
|
43
|
+
yaml = "urn:alm:descriptor:com.tectonic.ui:yaml",
|
|
44
|
+
yamlActionsDisabled = "urn:alm:descriptor:yaml:actions:disabled:",
|
|
45
|
+
yamlResult = "urn:alm:descriptor:yaml:result:",
|
|
46
|
+
oneOf = "urn:alm:descriptor:oneOf:",
|
|
47
|
+
object = "urn:alm:descriptor:com.tectonic.ui:object",
|
|
48
|
+
array = "urn:alm:descriptor:com.tectonic.ui:array",
|
|
49
|
+
folded = "urn:alm:descriptor:com.tectonic.ui:folded",
|
|
50
|
+
emptyArray = "urn:alm:descriptor:com.tectonic.ui:emptyArray",
|
|
51
|
+
validation = "urn:alm:descriptor:com.tectonic.ui:validation:",
|
|
52
|
+
multiple = "urn:alm:descriptor:com.tectonic.ui:multiple",
|
|
53
|
+
allowCreate = "urn:alm:descriptor:com.tectonic.ui:allowCreate",
|
|
54
|
+
creatable = "urn:alm:descriptor:com.tectonic.ui:creatable",
|
|
55
|
+
clearable = "urn:alm:descriptor:com.tectonic.ui:clearable",
|
|
56
|
+
disabled = "urn:alm:descriptor:com.tectonic.ui:disabled",
|
|
57
|
+
radio = "urn:alm:descriptor:com.tectonic.ui:radio:",
|
|
58
|
+
customDescriptionZh = "urn:alm:descriptor:custom:description:zh:",
|
|
59
|
+
customDescriptionEn = "urn:alm:descriptor:custom:description:en:",
|
|
60
|
+
customDescriptionLink = "urn:alm:descriptor:custom:description:link:",
|
|
61
|
+
custom = "urn:alm:descriptor:widgets:",
|
|
62
|
+
basicAuthSecret = "urn:alm:descriptor:com.tectonic.ui:basicAuthSecret",
|
|
63
|
+
remote = "urn:alm:descriptor:remote:",
|
|
64
|
+
pathTag = "urn:alm:descriptor:com.tectonic.ui:path.tag:"
|
|
65
|
+
}
|
|
66
|
+
export interface Descriptor {
|
|
67
|
+
path: string;
|
|
68
|
+
displayName: string;
|
|
69
|
+
description: string;
|
|
70
|
+
'x-descriptors': SpecCapability[];
|
|
71
|
+
value?: any;
|
|
72
|
+
}
|
|
73
|
+
export interface DescriptorProps {
|
|
74
|
+
descriptor: Descriptor;
|
|
75
|
+
value: any;
|
|
76
|
+
namespace?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface OperandFieldValidation {
|
|
79
|
+
[Validations.maximum]?: number;
|
|
80
|
+
[Validations.minimum]?: number;
|
|
81
|
+
[Validations.maxLength]?: number;
|
|
82
|
+
[Validations.minLength]?: number;
|
|
83
|
+
[Validations.pattern]?: string;
|
|
84
|
+
[Validations.required]?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface OperandField {
|
|
87
|
+
path?: string;
|
|
88
|
+
type?: JSONSchema6TypeName;
|
|
89
|
+
capabilities?: SpecCapability[];
|
|
90
|
+
required?: boolean;
|
|
91
|
+
displayName?: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
validations?: OperandFieldValidation;
|
|
94
|
+
value?: unknown;
|
|
95
|
+
descriptor?: Descriptor;
|
|
96
|
+
_dirty?: boolean;
|
|
97
|
+
parent?: string;
|
|
98
|
+
inParentIndex?: number;
|
|
99
|
+
disabled?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface OperandFieldGroup extends OperandField {
|
|
102
|
+
groupName: string;
|
|
103
|
+
groupDisplay: LocaleDisplay;
|
|
104
|
+
fieldList: OperandField[];
|
|
105
|
+
}
|
|
106
|
+
export interface OperandArrayFieldGroup extends OperandField {
|
|
107
|
+
groupName: string;
|
|
108
|
+
fieldLists: OperandField[][];
|
|
109
|
+
}
|
|
110
|
+
export type FormDataState = Map<string, any>;
|
|
111
|
+
export interface FieldValueChangeEvent {
|
|
112
|
+
field: OperandField;
|
|
113
|
+
data: unknown;
|
|
114
|
+
errors: unknown;
|
|
115
|
+
}
|
|
116
|
+
export interface FormErrors {
|
|
117
|
+
[key: string]: ValidationErrors;
|
|
118
|
+
}
|
|
119
|
+
export interface FormState {
|
|
120
|
+
data: unknown;
|
|
121
|
+
errors: FormErrors;
|
|
122
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Dictionary, JSONSchema6TypeName, StringMap } from '@alauda-fe/common';
|
|
2
|
+
import { Descriptor, OperandArrayFieldGroup, OperandField, OperandFieldGroup, OperandFieldValidation, SpecCapability } from '../types';
|
|
3
|
+
export declare function getBasicAuthSecretConfig(field: OperandField): unknown;
|
|
4
|
+
export declare function getRadioOptions(capabilities: SpecCapability[]): {
|
|
5
|
+
value: string;
|
|
6
|
+
display: {
|
|
7
|
+
zh: string;
|
|
8
|
+
en: string;
|
|
9
|
+
};
|
|
10
|
+
}[];
|
|
11
|
+
export declare function setRadiosDefaultValue(descriptors: Descriptor[]): {
|
|
12
|
+
spec: {};
|
|
13
|
+
};
|
|
14
|
+
export declare const getBooleanSwitchOptions: (capabilities: SpecCapability[]) => {
|
|
15
|
+
value: string;
|
|
16
|
+
display: string | {
|
|
17
|
+
zh: string;
|
|
18
|
+
en: string;
|
|
19
|
+
};
|
|
20
|
+
}[];
|
|
21
|
+
export declare const convertBooleanSwitchValue: (value: boolean, capabilities: SpecCapability[]) => string | {
|
|
22
|
+
zh: string;
|
|
23
|
+
en: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function convertValue(value: string, type: JSONSchema6TypeName): any;
|
|
26
|
+
export declare function getDefaultValue(field: OperandField): any;
|
|
27
|
+
export declare function getFieldType(field: OperandField): SpecCapability;
|
|
28
|
+
export declare function getBasicCapabilityType(capabilities: string[]): "string" | "number" | "boolean" | "object" | "array";
|
|
29
|
+
export declare function getFieldDisplayName(field: OperandField | OperandArrayFieldGroup | OperandFieldGroup): {
|
|
30
|
+
en: string;
|
|
31
|
+
zh: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function getDisplayByCapability(capabilities: SpecCapability[], name: string, fallback?: string): {
|
|
34
|
+
en: string;
|
|
35
|
+
zh: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function getFieldDescription(field: OperandField): {
|
|
38
|
+
en: string;
|
|
39
|
+
zh: string;
|
|
40
|
+
};
|
|
41
|
+
export declare function getK8sResourcePrefixOptions(field: OperandField): {
|
|
42
|
+
namespaced: boolean;
|
|
43
|
+
labelSelector: string;
|
|
44
|
+
isGlobal: boolean;
|
|
45
|
+
groupVersionKind: string;
|
|
46
|
+
type: string;
|
|
47
|
+
multiple: boolean;
|
|
48
|
+
validations: OperandFieldValidation;
|
|
49
|
+
};
|
|
50
|
+
export declare function resolveKVParams(str: string): StringMap;
|
|
51
|
+
export declare function getCapabilityDisabled(capabilities: SpecCapability[]): boolean;
|
|
52
|
+
export declare function getCapabilityValidations(capabilities: SpecCapability[]): OperandFieldValidation;
|
|
53
|
+
export declare function getOneOfMap(field: OperandField): Dictionary<string[]>;
|
|
54
|
+
export declare function fieldShouldReveal(field: OperandField): SpecCapability;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const MAX_DEPTH = 1;
|
|
2
|
+
export declare const SCHEMA_PATH: string[];
|
|
3
|
+
export declare const DESCRIPTOR_DEFINITION_KEY = "x-descriptors";
|
|
4
|
+
export declare const NamespacedResourceKind: string[];
|
|
5
|
+
export declare const GROUP_PATTERN: RegExp;
|
|
6
|
+
export declare const DEFAULT_VALUE_PATTERN: RegExp;
|
|
7
|
+
export declare const REGEXP_K8S_RESOURCE_CAPABILITY: string;
|
|
8
|
+
export declare const REGEXP_CAPABILITY_VALIDATION: string;
|
|
9
|
+
export declare const REGEXP_FIELD_DEPENDENCY_CAPABILITY: string;
|
|
10
|
+
export declare const REGEXP_SELECT_CAPABILITY: string;
|
|
11
|
+
export declare const REGEXP_K8S_RESOURCE_SUFFIX: RegExp;
|
|
12
|
+
export declare const REGEXP_VALIDATION_SUFFIX: RegExp;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class CrdFormCustomDescriptionDirective {
|
|
4
|
+
templateRef: TemplateRef<any>;
|
|
5
|
+
aclCrdFormCustomDescription: string;
|
|
6
|
+
constructor(templateRef: TemplateRef<any>);
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CrdFormCustomDescriptionDirective, never>;
|
|
8
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CrdFormCustomDescriptionDirective, "ng-template[aclCrdFormCustomDescription]", ["aclCrdFormCustomDescription"], { "aclCrdFormCustomDescription": { "alias": "aclCrdFormCustomDescription"; "required": false; }; }, {}, never, never, false, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { QueryList } from '@angular/core';
|
|
2
|
+
import { OperandArrayFieldGroup, OperandField, OperandFieldGroup, SpecCapability } from '../types';
|
|
3
|
+
import { CrdFormCustomDescriptionDirective } from './directives';
|
|
4
|
+
export declare const isRequired: (field: OperandField) => boolean;
|
|
5
|
+
export declare const filterMapByKey: <T>(map: Map<string, T>, predicate: (input: string) => boolean) => Map<any, any>;
|
|
6
|
+
export declare const getMatchArrayIndex: (arrPath: string) => number;
|
|
7
|
+
export declare const isGroupField: (field: OperandField) => field is OperandFieldGroup;
|
|
8
|
+
export declare const isArrayField: (field: OperandField) => field is OperandArrayFieldGroup;
|
|
9
|
+
export declare const isRemoteField: (field: OperandField) => field is OperandArrayFieldGroup;
|
|
10
|
+
export declare const isArrayFieldTable: (field: OperandField) => field is OperandArrayFieldGroup;
|
|
11
|
+
export declare const isCreatable: (field: OperandField) => boolean;
|
|
12
|
+
export declare const isMultiple: (field: OperandField) => boolean;
|
|
13
|
+
export declare const isAllowCreate: (field: OperandField) => boolean;
|
|
14
|
+
export declare const isClearable: (field: OperandField) => boolean;
|
|
15
|
+
export declare const isFolded: (field: OperandField) => boolean;
|
|
16
|
+
export declare const isEmptyArray: (field: OperandField) => boolean;
|
|
17
|
+
export declare function hasDescriptor(field: OperandField, prefix: string, suffix?: string): boolean;
|
|
18
|
+
export declare function parseArrayPath(path: string): {
|
|
19
|
+
index?: number;
|
|
20
|
+
match?: string;
|
|
21
|
+
pathBeforeIndex?: string;
|
|
22
|
+
pathAfterIndex?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function getArrayGroupName(field: OperandField): string;
|
|
25
|
+
export declare function getGroupName(field: OperandField): string;
|
|
26
|
+
/**
|
|
27
|
+
* 递归修复树形结构中 数组类型的索引
|
|
28
|
+
*
|
|
29
|
+
* @export
|
|
30
|
+
* @param {OperandField} field
|
|
31
|
+
* @param {string} fromPath
|
|
32
|
+
* @param {string} toPath
|
|
33
|
+
* @returns
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export declare const repairFieldChildPathByCorrectIndex: (field: OperandField, fromPath: string, toPath: string) => {
|
|
37
|
+
path: string;
|
|
38
|
+
type?: import("@alauda-fe/common").JSONSchema6TypeName;
|
|
39
|
+
capabilities?: SpecCapability[];
|
|
40
|
+
required?: boolean;
|
|
41
|
+
displayName?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
validations?: import("../types").OperandFieldValidation;
|
|
44
|
+
value?: unknown;
|
|
45
|
+
descriptor?: import("../types").Descriptor;
|
|
46
|
+
_dirty?: boolean;
|
|
47
|
+
parent?: string;
|
|
48
|
+
inParentIndex?: number;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
};
|
|
51
|
+
export declare const getRelatedFields: (normalFields: OperandField[]) => OperandField[];
|
|
52
|
+
export declare const getTreeFields: (rootFields: OperandField[], basicFields: OperandField[]) => any[];
|
|
53
|
+
export declare const getMatchedCapabilityValue: (capabilities: SpecCapability[], descriptor: string) => string;
|
|
54
|
+
export declare function evalInContext(stringExpression: string, context: any): any;
|
|
55
|
+
export declare function coerceBoolean(val: any): boolean;
|
|
56
|
+
export declare function coerceNumber(val: any, fallbackValue?: number): number;
|
|
57
|
+
export declare function _isNumberValue(value: any): boolean;
|
|
58
|
+
export declare function getCustomDescription(customDescriptions: QueryList<CrdFormCustomDescriptionDirective>, field: OperandField): CrdFormCustomDescriptionDirective;
|
|
59
|
+
export declare function getOperandPath(field: OperandField): string;
|
|
60
|
+
export declare function getPathFromTagPath(pathWithTag: string): string;
|
|
61
|
+
export declare const getFieldsByPath: (path: string, fields: OperandField[]) => OperandField[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type K8sVerb = 'create' | 'get' | 'list' | 'update' | 'patch' | 'delete' | 'deletecollection' | 'watch';
|
|
2
|
+
export interface MatchExpressionWithValues {
|
|
3
|
+
key: string;
|
|
4
|
+
operator: 'In' | 'NotIn' | 'Exists' | 'DoesNotExist';
|
|
5
|
+
values: string[];
|
|
6
|
+
}
|
|
7
|
+
export type MatchExpression = {
|
|
8
|
+
key: string;
|
|
9
|
+
operator: 'Exists' | 'DoesNotExist';
|
|
10
|
+
} | MatchExpressionWithValues;
|
|
11
|
+
export interface MatchLabels {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Selector {
|
|
15
|
+
matchLabels?: MatchLabels;
|
|
16
|
+
matchExpressions?: MatchExpression[];
|
|
17
|
+
}
|
|
18
|
+
export interface K8sKind {
|
|
19
|
+
abbr: string;
|
|
20
|
+
kind: string;
|
|
21
|
+
label: string;
|
|
22
|
+
labelKey?: string;
|
|
23
|
+
labelPlural: string;
|
|
24
|
+
labelPluralKey?: string;
|
|
25
|
+
plural: string;
|
|
26
|
+
propagationPolicy?: 'Foreground' | 'Background';
|
|
27
|
+
id?: string;
|
|
28
|
+
crd?: boolean;
|
|
29
|
+
apiVersion: string;
|
|
30
|
+
apiGroup?: string;
|
|
31
|
+
namespaced?: boolean;
|
|
32
|
+
selector?: Selector;
|
|
33
|
+
labels?: {
|
|
34
|
+
[key: string]: string;
|
|
35
|
+
};
|
|
36
|
+
annotations?: {
|
|
37
|
+
[key: string]: string;
|
|
38
|
+
};
|
|
39
|
+
verbs?: K8sVerb[];
|
|
40
|
+
shortNames?: string[];
|
|
41
|
+
color?: string;
|
|
42
|
+
legacyPluralURL?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare const NodeModel: K8sKind;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { OpenAPIV3SchemaObject } from '@alauda-fe/common';
|
|
2
|
+
import { Descriptor, FormDataState, OperandField, SpecCapability } from '../types';
|
|
3
|
+
export interface FlattenNestedPropertiesAccumulator {
|
|
4
|
+
currentCapabilities?: SpecCapability[];
|
|
5
|
+
currentPath?: string[];
|
|
6
|
+
fields?: OperandField[];
|
|
7
|
+
required: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function getPropertyDepth(property: OpenAPIV3SchemaObject, depth?: number): number;
|
|
10
|
+
export declare function getFieldsFromDescriptor({ path, description, displayName, 'x-descriptors': capabilities, }: Descriptor, data: any, openApi: OpenAPIV3SchemaObject, _originDescriptors?: Descriptor[]): OperandField[];
|
|
11
|
+
export declare function getOpenApiPropertyByPath(descriptorPath: string, openApi: OpenAPIV3SchemaObject): OpenAPIV3SchemaObject;
|
|
12
|
+
export declare function getFieldsFromOpenApiSchema(openApi: OpenAPIV3SchemaObject, descriptors: Descriptor[], data: unknown, openApiSchemaPath?: string | string[], maxDepth?: number): OperandField[];
|
|
13
|
+
export declare function flattenNestedProperties(propertyName: string, property: OpenAPIV3SchemaObject, descriptors: Descriptor[], data: any, { currentCapabilities, currentPath, required, }: FlattenNestedPropertiesAccumulator): OperandField[];
|
|
14
|
+
export declare function getCapabilitiesForOpenApiProperty(property: OpenAPIV3SchemaObject, capabilities?: string[]): SpecCapability[];
|
|
15
|
+
export declare function modifyArrayFieldPathIndex(path: string, operation: (index?: number) => string | number): string;
|
|
16
|
+
export declare function pathToArray(path: string): Array<string | number>;
|
|
17
|
+
export declare function parseGroupDescriptor(field: OperandField): {
|
|
18
|
+
groupName?: string;
|
|
19
|
+
groupType?: string;
|
|
20
|
+
match?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function normalizePath(path: string): string;
|
|
23
|
+
export declare function getFormData(formData: FormDataState, path: string, enableConvert?: boolean): FormDataState;
|
|
24
|
+
export declare function createCapabilityField(descriptors: Descriptor[], openApiSchema: OpenAPIV3SchemaObject, data: unknown, openApiSchemaPath: string | string[]): {
|
|
25
|
+
normalFields: OperandField[];
|
|
26
|
+
fieldGroups: {
|
|
27
|
+
groupName: string;
|
|
28
|
+
displayName: string;
|
|
29
|
+
groupDisplay: {
|
|
30
|
+
en: string;
|
|
31
|
+
zh: string;
|
|
32
|
+
};
|
|
33
|
+
capabilities: SpecCapability[];
|
|
34
|
+
fieldList: OperandField[];
|
|
35
|
+
}[];
|
|
36
|
+
arrayFieldGroups: {
|
|
37
|
+
groupName: string;
|
|
38
|
+
displayName: string;
|
|
39
|
+
capabilities: SpecCapability[];
|
|
40
|
+
fieldLists: OperandField[][];
|
|
41
|
+
_dirty: boolean;
|
|
42
|
+
}[];
|
|
43
|
+
advancedFields: OperandField[];
|
|
44
|
+
descriptorFields: OperandField[];
|
|
45
|
+
openApiFields: OperandField[];
|
|
46
|
+
basicFields: OperandField[];
|
|
47
|
+
treeFields: OperandField[];
|
|
48
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alauda-fe/crd-form",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@alauda-fe/i18n": "1.0.3",
|
|
6
|
+
"@angular/common": "^13.2.0",
|
|
7
|
+
"@angular/core": "^13.2.0"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.4.0"
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"private": false,
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"module": "esm2022/alauda-fe-crd-form.mjs",
|
|
18
|
+
"typings": "index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
"./package.json": {
|
|
21
|
+
"default": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./index.d.ts",
|
|
25
|
+
"esm2022": "./esm2022/alauda-fe-crd-form.mjs",
|
|
26
|
+
"esm": "./esm2022/alauda-fe-crd-form.mjs",
|
|
27
|
+
"default": "./esm2022/alauda-fe-crd-form.mjs"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './lib/abstract/base-array';
|
|
2
|
+
export * from './lib/crd-form.module';
|
|
3
|
+
export * from './lib/crd-form/component';
|
|
4
|
+
export * from './lib/field-controls';
|
|
5
|
+
export * from './lib/field-widgets';
|
|
6
|
+
export * from './lib/remote-widgets';
|
|
7
|
+
export * from './lib/spec-descriptors';
|
|
8
|
+
export * from './lib/types';
|
|
9
|
+
export * from './lib/utils';
|