ngx-wapp-components 3.4.2 → 3.4.3-alpha.2
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/fesm2022/ngx-wapp-components-home-preview.mjs +1041 -0
- package/fesm2022/ngx-wapp-components-home-preview.mjs.map +1 -0
- package/fesm2022/ngx-wapp-components-schema-form.mjs +1018 -0
- package/fesm2022/ngx-wapp-components-schema-form.mjs.map +1 -0
- package/fesm2022/ngx-wapp-components.mjs +825 -576
- package/fesm2022/ngx-wapp-components.mjs.map +1 -1
- package/home-preview/README.md +53 -0
- package/package.json +25 -2
- package/schema-form/README.md +151 -0
- package/types/ngx-wapp-components-home-preview.d.ts +572 -0
- package/types/ngx-wapp-components-schema-form.d.ts +253 -0
- package/types/ngx-wapp-components.d.ts +402 -338
- package/types/ngx-wapp-components.d.ts.map +0 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { HttpHeaders } from '@angular/common/http';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { OnChanges, OnDestroy, EventEmitter } from '@angular/core';
|
|
4
|
+
import { FormGroup, AbstractControl } from '@angular/forms';
|
|
5
|
+
import { FormlyFieldConfig } from '@ngx-formly/core';
|
|
6
|
+
|
|
7
|
+
/** JSON Schema dialects accepted by `w-schema-form`. */
|
|
8
|
+
type WSchemaFormDialect = 'draft-07' | '2020-12';
|
|
9
|
+
/** Single types accepted by `w-schema-form`. Arrays only as `uniqueItems` + `items` enum or const options. */
|
|
10
|
+
type WJsonSchemaType = 'object' | 'string' | 'number' | 'integer' | 'boolean' | 'array';
|
|
11
|
+
/**
|
|
12
|
+
* `x-wapping-secret` annotation (central design of connectors-management).
|
|
13
|
+
* The browser ignores its content; it only marks the field as a secret.
|
|
14
|
+
*/
|
|
15
|
+
interface WJsonSchemaSecretAnnotation {
|
|
16
|
+
vaultProfile?: string;
|
|
17
|
+
nameTemplate?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Presentation groups of `x-wapping-group` (SFP-001), listed in their visual order. The annotation is only
|
|
21
|
+
* accepted on direct properties of the root; it never changes the model, the JSON Pointers or the validation.
|
|
22
|
+
*/
|
|
23
|
+
declare const W_SCHEMA_FORM_GROUPS: readonly ["connector", "connection", "capabilities", "mapping"];
|
|
24
|
+
type WSchemaFormGroup = typeof W_SCHEMA_FORM_GROUPS[number];
|
|
25
|
+
/**
|
|
26
|
+
* Group declared at the root with `x-wapping-groups` (SFP-007). When the schema declares groups,
|
|
27
|
+
* `x-wapping-group` must use one of their keys and the groups are shown in the declared order.
|
|
28
|
+
*/
|
|
29
|
+
interface WSchemaFormDeclaredGroup {
|
|
30
|
+
key: string;
|
|
31
|
+
title: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Option of `oneOf`/`anyOf` (SFP-004): shown by `title`, stored by `const`. Accepted on scalar fields and on the
|
|
36
|
+
* `items` of `uniqueItems` arrays; any other use of `oneOf`/`anyOf` is a configuration error.
|
|
37
|
+
*/
|
|
38
|
+
interface WJsonSchemaOption {
|
|
39
|
+
const: unknown;
|
|
40
|
+
title?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* JSON Schema accepted as input. Only the keywords listed in the design are supported;
|
|
45
|
+
* any other keyword is reported as a configuration error at runtime.
|
|
46
|
+
*/
|
|
47
|
+
interface WJsonSchema {
|
|
48
|
+
$schema?: string;
|
|
49
|
+
$id?: string;
|
|
50
|
+
$comment?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
type?: WJsonSchemaType;
|
|
54
|
+
properties?: Record<string, WJsonSchema>;
|
|
55
|
+
required?: string[];
|
|
56
|
+
additionalProperties?: false;
|
|
57
|
+
enum?: unknown[];
|
|
58
|
+
const?: unknown;
|
|
59
|
+
default?: unknown;
|
|
60
|
+
minimum?: number;
|
|
61
|
+
maximum?: number;
|
|
62
|
+
minLength?: number;
|
|
63
|
+
maxLength?: number;
|
|
64
|
+
pattern?: string;
|
|
65
|
+
items?: WJsonSchema;
|
|
66
|
+
uniqueItems?: boolean;
|
|
67
|
+
$ref?: string;
|
|
68
|
+
$defs?: Record<string, WJsonSchema>;
|
|
69
|
+
definitions?: Record<string, WJsonSchema>;
|
|
70
|
+
readOnly?: boolean;
|
|
71
|
+
writeOnly?: boolean;
|
|
72
|
+
'x-wapping-secret'?: WJsonSchemaSecretAnnotation;
|
|
73
|
+
/** Rendering annotation for supported custom fields and consumer-provided reference selectors. */
|
|
74
|
+
'x-wapping-widget'?: 'color' | 'image' | 'menu-item' | 'service-program' | 'product-list' | 'store';
|
|
75
|
+
/** Group of a direct property of the root: a fixed group (SFP-001) or a declared key (SFP-007). */
|
|
76
|
+
'x-wapping-group'?: WSchemaFormGroup | string;
|
|
77
|
+
/** Groups declared at the root (SFP-007). */
|
|
78
|
+
'x-wapping-groups'?: WSchemaFormDeclaredGroup[];
|
|
79
|
+
/** Unsupported keywords are accepted by the type and rejected explicitly at runtime. */
|
|
80
|
+
[keyword: string]: unknown;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Server state of a secret field. `path` is a JSON Pointer of the schema property. */
|
|
84
|
+
interface WSchemaFormSecretState {
|
|
85
|
+
path: string;
|
|
86
|
+
hasValue: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Diagnostic without values: JSON Pointer of the instance, keyword and validator message. */
|
|
90
|
+
interface WSchemaFormError {
|
|
91
|
+
instancePath: string;
|
|
92
|
+
keyword: string;
|
|
93
|
+
message?: string;
|
|
94
|
+
}
|
|
95
|
+
/** Secret field status. Never contains the secret value. */
|
|
96
|
+
interface WSchemaFormSecretStatus {
|
|
97
|
+
path: string;
|
|
98
|
+
hasValue: boolean;
|
|
99
|
+
replacementPending: boolean;
|
|
100
|
+
}
|
|
101
|
+
type WSchemaFormStatus = 'valid' | 'invalid' | 'error';
|
|
102
|
+
interface WSchemaFormState {
|
|
103
|
+
status: WSchemaFormStatus;
|
|
104
|
+
errors: ReadonlyArray<WSchemaFormError>;
|
|
105
|
+
secrets: ReadonlyArray<WSchemaFormSecretStatus>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Replacement of a secret value. `path` is a JSON Pointer of the schema property. */
|
|
109
|
+
interface WSchemaFormSecretReplacement {
|
|
110
|
+
path: string;
|
|
111
|
+
value: string;
|
|
112
|
+
}
|
|
113
|
+
/** Valid submission: public configuration without secret paths and non-empty secret replacements. */
|
|
114
|
+
interface WSchemaFormSubmit {
|
|
115
|
+
configuration: Record<string, unknown>;
|
|
116
|
+
secrets: ReadonlyArray<WSchemaFormSecretReplacement>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Label and help text override for a field identified by JSON Pointer (SFC-D07). */
|
|
120
|
+
interface WSchemaFormFieldTranslation {
|
|
121
|
+
label?: string;
|
|
122
|
+
description?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Display labels of `enum` options (single select and `uniqueItems` enum arrays), keyed by the technical value.
|
|
125
|
+
* Only the shown text changes: the model and the emitted configuration keep the technical value. A value
|
|
126
|
+
* without label (or with an empty one) is shown as the technical value (CM-012).
|
|
127
|
+
*/
|
|
128
|
+
options?: Readonly<Record<string, string>>;
|
|
129
|
+
}
|
|
130
|
+
interface WSchemaFormTranslations {
|
|
131
|
+
configurationError: string;
|
|
132
|
+
invalidValues: string;
|
|
133
|
+
secretConfigured: string;
|
|
134
|
+
secretPending: string;
|
|
135
|
+
secretReplaceHint: string;
|
|
136
|
+
showSecret: string;
|
|
137
|
+
hideSecret: string;
|
|
138
|
+
/** Visible label of the select-all checkbox used by enum array fields. */
|
|
139
|
+
selectAll?: string;
|
|
140
|
+
/** Optional overrides of schema `title`/`description`, keyed by JSON Pointer (e.g. `/account/clientId`). */
|
|
141
|
+
fields?: Readonly<Record<string, WSchemaFormFieldTranslation>>;
|
|
142
|
+
/**
|
|
143
|
+
* Optional headings of the groups, keyed by group: the fixed `x-wapping-group` groups (missing ones keep the
|
|
144
|
+
* Spanish defaults, SFP-001) or the keys declared with `x-wapping-groups` (missing ones keep the schema title,
|
|
145
|
+
* SFP-007).
|
|
146
|
+
*/
|
|
147
|
+
groups?: Readonly<Record<string, string>>;
|
|
148
|
+
}
|
|
149
|
+
/** Default Spanish texts. Frozen: consumers must pass their own object instead of mutating this one. */
|
|
150
|
+
declare const W_SCHEMA_FORM_DEFAULT_TRANSLATIONS: Readonly<WSchemaFormTranslations>;
|
|
151
|
+
|
|
152
|
+
/** Public subset of the image uploader configuration required by the Formly field. */
|
|
153
|
+
interface WSchemaFormImageUploadConfig {
|
|
154
|
+
imagePropertyNames: unknown[];
|
|
155
|
+
acceptImageTypes: string;
|
|
156
|
+
maxImageSize: number;
|
|
157
|
+
allowAuto: boolean;
|
|
158
|
+
uploadButtonLabel?: string;
|
|
159
|
+
chooseButtonLabel?: string;
|
|
160
|
+
cancelButtonLabel?: string;
|
|
161
|
+
contentHeaderLabel?: string;
|
|
162
|
+
contentSubheaderLabel?: string;
|
|
163
|
+
viewModecontentLabel?: string;
|
|
164
|
+
deleteImageButtonLabel?: string;
|
|
165
|
+
singleModeImageDefault?: string;
|
|
166
|
+
singleModeImageWidth?: string;
|
|
167
|
+
singleModeImageHeight?: string;
|
|
168
|
+
croppedDialogTranslations: unknown;
|
|
169
|
+
croppedImageConfiguration: {
|
|
170
|
+
roundedCropper: boolean;
|
|
171
|
+
configuredAspectRatio: number;
|
|
172
|
+
viewPortWidthPx: number;
|
|
173
|
+
viewPortHeihtPx: number;
|
|
174
|
+
};
|
|
175
|
+
confirmDeleteMessageLabel?: string;
|
|
176
|
+
confirmDeleteButtonLabel?: string;
|
|
177
|
+
invalidFileSizeMessageSummary: string;
|
|
178
|
+
invalidFileSizeMessageDetail: string;
|
|
179
|
+
invalidFileTypeMessageSummary: string;
|
|
180
|
+
invalidFileTypeMessageDetail: string;
|
|
181
|
+
}
|
|
182
|
+
/** Consumer-owned upload settings for `x-wapping-widget: "image"` fields. */
|
|
183
|
+
interface WSchemaFormImageUpload {
|
|
184
|
+
uploadUrl: string;
|
|
185
|
+
headers: HttpHeaders;
|
|
186
|
+
imageUploadConfig: WSchemaFormImageUploadConfig;
|
|
187
|
+
uploadErrorMessage?: string;
|
|
188
|
+
}
|
|
189
|
+
/** Expected response from the consumer's authenticated image upload endpoint. */
|
|
190
|
+
interface WSchemaFormImageUploadResponse {
|
|
191
|
+
url: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Formly type registered by a consumer that provides image upload integration. */
|
|
195
|
+
declare const W_SCHEMA_FORM_IMAGE_FIELD_TYPE = "w-schema-form-image";
|
|
196
|
+
interface WSchemaFormReferenceOption {
|
|
197
|
+
value: number;
|
|
198
|
+
label: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* JSON Schema form (CM-007). Emits the public configuration and the secret replacements separately and
|
|
202
|
+
* never preloads, stores or reports secret values (SF-001..SF-009).
|
|
203
|
+
*/
|
|
204
|
+
declare class WSchemaFormComponent implements OnChanges, OnDestroy {
|
|
205
|
+
schema: WJsonSchema | null;
|
|
206
|
+
values: Record<string, unknown> | null;
|
|
207
|
+
dialect?: WSchemaFormDialect;
|
|
208
|
+
secretStates: ReadonlyArray<WSchemaFormSecretState> | null;
|
|
209
|
+
translations: Readonly<WSchemaFormTranslations> | null;
|
|
210
|
+
imageUpload: WSchemaFormImageUpload | null;
|
|
211
|
+
/** Options are supplied by the consuming application and scoped to the current business. */
|
|
212
|
+
referenceOptions: Readonly<Record<string, ReadonlyArray<WSchemaFormReferenceOption>>>;
|
|
213
|
+
stateChange: EventEmitter<WSchemaFormState>;
|
|
214
|
+
validSubmit: EventEmitter<WSchemaFormSubmit>;
|
|
215
|
+
/** Copy of the public configuration after each user edit (HP-001); never secrets or materialized defaults. */
|
|
216
|
+
valueChange: EventEmitter<Record<string, unknown>>;
|
|
217
|
+
protected form: FormGroup<Record<string, AbstractControl<unknown, unknown, any>>>;
|
|
218
|
+
protected fields: FormlyFieldConfig[];
|
|
219
|
+
protected model: Record<string, unknown>;
|
|
220
|
+
protected state: WSchemaFormState;
|
|
221
|
+
/** Consumer translations merged over the defaults (a null or partial input never breaks the template). */
|
|
222
|
+
protected texts: Readonly<WSchemaFormTranslations>;
|
|
223
|
+
private readonly formlyJsonschema;
|
|
224
|
+
private validator?;
|
|
225
|
+
private secrets;
|
|
226
|
+
private secretSubscriptions;
|
|
227
|
+
private lastEmittedPublicValues;
|
|
228
|
+
ngOnChanges(): void;
|
|
229
|
+
ngOnDestroy(): void;
|
|
230
|
+
protected onModelChange(model: Record<string, unknown>): void;
|
|
231
|
+
submit(): void;
|
|
232
|
+
private validate;
|
|
233
|
+
private emitPublicValues;
|
|
234
|
+
private fail;
|
|
235
|
+
/** Discards controls, validators and typed secret values (SF-003, SF-008). */
|
|
236
|
+
private reset;
|
|
237
|
+
/** SF-006/SF-007: secret states must target declared secrets and values must not carry secrets. */
|
|
238
|
+
private assertSecretInputs;
|
|
239
|
+
private mapField;
|
|
240
|
+
/**
|
|
241
|
+
* SFP-001: ungrouped root fields first, then one keyless group per non-empty `x-wapping-group` in the fixed
|
|
242
|
+
* order. SFP-007: with `x-wapping-groups` the groups, their order and their headings are the declared ones
|
|
243
|
+
* (translation of the key, else the schema title) and the description is shown under the heading. Without
|
|
244
|
+
* annotations the structure is unchanged.
|
|
245
|
+
*/
|
|
246
|
+
private groupFields;
|
|
247
|
+
private mapSecretField;
|
|
248
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WSchemaFormComponent, never>;
|
|
249
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WSchemaFormComponent, "w-schema-form", never, { "schema": { "alias": "schema"; "required": true; }; "values": { "alias": "values"; "required": true; }; "dialect": { "alias": "dialect"; "required": false; }; "secretStates": { "alias": "secretStates"; "required": false; }; "translations": { "alias": "translations"; "required": false; }; "imageUpload": { "alias": "imageUpload"; "required": false; }; "referenceOptions": { "alias": "referenceOptions"; "required": false; }; }, { "stateChange": "stateChange"; "validSubmit": "validSubmit"; "valueChange": "valueChange"; }, never, never, true, never>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export { WSchemaFormComponent, W_SCHEMA_FORM_DEFAULT_TRANSLATIONS, W_SCHEMA_FORM_GROUPS, W_SCHEMA_FORM_IMAGE_FIELD_TYPE };
|
|
253
|
+
export type { WJsonSchema, WJsonSchemaOption, WJsonSchemaSecretAnnotation, WJsonSchemaType, WSchemaFormDeclaredGroup, WSchemaFormDialect, WSchemaFormError, WSchemaFormFieldTranslation, WSchemaFormGroup, WSchemaFormImageUpload, WSchemaFormImageUploadConfig, WSchemaFormImageUploadResponse, WSchemaFormReferenceOption, WSchemaFormSecretReplacement, WSchemaFormSecretState, WSchemaFormSecretStatus, WSchemaFormState, WSchemaFormStatus, WSchemaFormSubmit, WSchemaFormTranslations };
|