@ng-formworks/core 19.6.3 → 20.6.4
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 +2 -1
- package/fesm2022/ng-formworks-core.mjs +209 -209
- package/fesm2022/ng-formworks-core.mjs.map +1 -1
- package/index.d.ts +2772 -3
- package/package.json +11 -6
- package/lib/framework-library/framework-library.service.d.ts +0 -53
- package/lib/framework-library/framework.d.ts +0 -13
- package/lib/framework-library/no-framework.component.d.ts +0 -8
- package/lib/framework-library/no-framework.module.d.ts +0 -9
- package/lib/framework-library/no.framework.d.ts +0 -10
- package/lib/json-schema-form.component.d.ts +0 -225
- package/lib/json-schema-form.module.d.ts +0 -11
- package/lib/json-schema-form.service.d.ts +0 -150
- package/lib/locale/de-validation-messages.d.ts +0 -1
- package/lib/locale/en-validation-messages.d.ts +0 -1
- package/lib/locale/es-validation-messages.d.ts +0 -1
- package/lib/locale/fr-validation-messages.d.ts +0 -1
- package/lib/locale/index.d.ts +0 -7
- package/lib/locale/it-validation-messages.d.ts +0 -1
- package/lib/locale/pt-validation-messages.d.ts +0 -1
- package/lib/locale/zh-validation-messages.d.ts +0 -1
- package/lib/shared/convert-schema-to-draft6.function.d.ts +0 -21
- package/lib/shared/form-group.functions.d.ts +0 -128
- package/lib/shared/format-regex.constants.d.ts +0 -20
- package/lib/shared/index.d.ts +0 -9
- package/lib/shared/json-schema.functions.d.ts +0 -214
- package/lib/shared/json.validators.d.ts +0 -441
- package/lib/shared/jsonpointer.functions.d.ts +0 -416
- package/lib/shared/layout.functions.d.ts +0 -83
- package/lib/shared/merge-schemas.function.d.ts +0 -19
- package/lib/shared/utility.functions.d.ts +0 -180
- package/lib/shared/validator.functions.d.ts +0 -364
- package/lib/widget-library/add-reference.component.d.ts +0 -18
- package/lib/widget-library/button.component.d.ts +0 -20
- package/lib/widget-library/checkbox.component.d.ts +0 -23
- package/lib/widget-library/checkboxes.component.d.ts +0 -24
- package/lib/widget-library/element-attribute.directive.d.ts +0 -13
- package/lib/widget-library/file.component.d.ts +0 -20
- package/lib/widget-library/hidden.component.d.ts +0 -18
- package/lib/widget-library/index.d.ts +0 -29
- package/lib/widget-library/input.component.d.ts +0 -22
- package/lib/widget-library/message.component.d.ts +0 -13
- package/lib/widget-library/none.component.d.ts +0 -8
- package/lib/widget-library/number.component.d.ts +0 -27
- package/lib/widget-library/one-of.component.d.ts +0 -21
- package/lib/widget-library/orderable.directive.d.ts +0 -41
- package/lib/widget-library/radios.component.d.ts +0 -22
- package/lib/widget-library/root.component.d.ts +0 -23
- package/lib/widget-library/section.component.d.ts +0 -17
- package/lib/widget-library/select-framework.component.d.ts +0 -15
- package/lib/widget-library/select-widget.component.d.ts +0 -15
- package/lib/widget-library/select.component.d.ts +0 -25
- package/lib/widget-library/selectcheckbox.component.d.ts +0 -55
- package/lib/widget-library/submit.component.d.ts +0 -22
- package/lib/widget-library/tab.component.d.ts +0 -12
- package/lib/widget-library/tabs.component.d.ts +0 -18
- package/lib/widget-library/template.component.d.ts +0 -15
- package/lib/widget-library/textarea.component.d.ts +0 -20
- package/lib/widget-library/widget-library.module.d.ts +0 -34
- package/lib/widget-library/widget-library.service.d.ts +0 -22
- package/public_api.d.ts +0 -9
package/index.d.ts
CHANGED
|
@@ -1,5 +1,2774 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnDestroy, Signal, OnChanges, OnInit, SimpleChanges, ElementRef, ComponentRef, ViewContainerRef, Renderer2 } from '@angular/core';
|
|
3
|
+
import * as i27 from '@angular/forms';
|
|
4
|
+
import { AbstractControl, UntypedFormArray, UntypedFormGroup, ControlValueAccessor, ValidationErrors, ValidatorFn } from '@angular/forms';
|
|
5
|
+
import * as rxjs from 'rxjs';
|
|
6
|
+
import { Subject, Subscription, Observable } from 'rxjs';
|
|
7
|
+
import Ajv2019, { Options, ErrorObject, ValidateFunction } from 'ajv/dist/2019';
|
|
8
|
+
import * as i2 from '@angular/common';
|
|
9
|
+
import * as i28 from 'nxt-sortablejs';
|
|
10
|
+
|
|
11
|
+
type WidgetContext = {
|
|
12
|
+
formControl?: AbstractControl;
|
|
13
|
+
layoutNode?: Signal<any>;
|
|
14
|
+
layoutIndex?: Signal<number[]>;
|
|
15
|
+
dataIndex?: Signal<number[]>;
|
|
16
|
+
options?: any;
|
|
17
|
+
controlValue?: any;
|
|
18
|
+
boundControl?: boolean;
|
|
19
|
+
controlName?: string;
|
|
20
|
+
controlDisabled?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type AJVRegistryItem = {
|
|
23
|
+
[name: string]: {
|
|
24
|
+
name: string;
|
|
25
|
+
ajvInstance: Ajv2019;
|
|
26
|
+
ajvValidator: ValidateFunction;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
interface TitleMapItem {
|
|
30
|
+
name?: string;
|
|
31
|
+
value?: any;
|
|
32
|
+
checked?: boolean;
|
|
33
|
+
group?: string;
|
|
34
|
+
items?: TitleMapItem[];
|
|
35
|
+
}
|
|
36
|
+
interface ErrorMessages {
|
|
37
|
+
[control_name: string]: {
|
|
38
|
+
message: string | Function | Object;
|
|
39
|
+
code: string;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
declare class JsonSchemaFormService implements OnDestroy {
|
|
43
|
+
JsonFormCompatibility: boolean;
|
|
44
|
+
ReactJsonSchemaFormCompatibility: boolean;
|
|
45
|
+
AngularSchemaFormCompatibility: boolean;
|
|
46
|
+
tpldata: any;
|
|
47
|
+
ajvOptions: Options;
|
|
48
|
+
ajv: any;
|
|
49
|
+
validateFormData: any;
|
|
50
|
+
formValues: any;
|
|
51
|
+
data: any;
|
|
52
|
+
schema: any;
|
|
53
|
+
layout: any[];
|
|
54
|
+
formGroupTemplate: any;
|
|
55
|
+
formGroup: any;
|
|
56
|
+
framework: any;
|
|
57
|
+
formOptions: any;
|
|
58
|
+
validData: any;
|
|
59
|
+
isValid: boolean;
|
|
60
|
+
ajvErrors: ErrorObject[];
|
|
61
|
+
validationErrors: any;
|
|
62
|
+
dataErrors: any;
|
|
63
|
+
formValueSubscription: any;
|
|
64
|
+
dataChanges: Subject<any>;
|
|
65
|
+
isValidChanges: Subject<any>;
|
|
66
|
+
validationErrorChanges: Subject<any>;
|
|
67
|
+
arrayMap: Map<string, number>;
|
|
68
|
+
dataMap: Map<string, any>;
|
|
69
|
+
dataRecursiveRefMap: Map<string, string>;
|
|
70
|
+
schemaRecursiveRefMap: Map<string, string>;
|
|
71
|
+
schemaRefLibrary: any;
|
|
72
|
+
layoutRefLibrary: any;
|
|
73
|
+
templateRefLibrary: any;
|
|
74
|
+
hasRootReference: boolean;
|
|
75
|
+
language: string;
|
|
76
|
+
defaultFormOptions: any;
|
|
77
|
+
fcValueChangesSubs: Subscription;
|
|
78
|
+
fcStatusChangesSubs: Subscription;
|
|
79
|
+
private draggableStateSubject;
|
|
80
|
+
draggableState$: rxjs.Observable<boolean>;
|
|
81
|
+
setDraggableState(value: boolean): void;
|
|
82
|
+
private sortableOptionsSubject;
|
|
83
|
+
sortableOptions$: rxjs.Observable<any>;
|
|
84
|
+
setSortableOptions(value: any): void;
|
|
85
|
+
createAjvInstance(ajvOptions: any): Ajv2019;
|
|
86
|
+
createAndRegisterAjvInstance(ajvOptions: any, name?: string): {
|
|
87
|
+
name: string;
|
|
88
|
+
ajvInstance: Ajv2019;
|
|
89
|
+
ajvValidator: ValidateFunction;
|
|
90
|
+
};
|
|
91
|
+
ajvRegistry: AJVRegistryItem;
|
|
92
|
+
getAjvInstance(name?: string): Ajv2019;
|
|
93
|
+
getAjvValidator(name?: string): ValidateFunction<unknown>;
|
|
94
|
+
constructor();
|
|
95
|
+
ngOnDestroy(): void;
|
|
96
|
+
setLanguage(language?: string): void;
|
|
97
|
+
getData(): any;
|
|
98
|
+
getSchema(): any;
|
|
99
|
+
getLayout(): any[];
|
|
100
|
+
resetAllValues(): void;
|
|
101
|
+
/**
|
|
102
|
+
* 'buildRemoteError' function
|
|
103
|
+
*
|
|
104
|
+
* Example errors:
|
|
105
|
+
* {
|
|
106
|
+
* last_name: [ {
|
|
107
|
+
* message: 'Last name must by start with capital letter.',
|
|
108
|
+
* code: 'capital_letter'
|
|
109
|
+
* } ],
|
|
110
|
+
* email: [ {
|
|
111
|
+
* message: 'Email must be from example.com domain.',
|
|
112
|
+
* code: 'special_domain'
|
|
113
|
+
* }, {
|
|
114
|
+
* message: 'Email must contain an @ symbol.',
|
|
115
|
+
* code: 'at_symbol'
|
|
116
|
+
* } ]
|
|
117
|
+
* }
|
|
118
|
+
* //{ErrorMessages} errors
|
|
119
|
+
*/
|
|
120
|
+
buildRemoteError(errors: ErrorMessages): void;
|
|
121
|
+
validateData(newValue: any, updateSubscriptions?: boolean, ajvInstanceName?: string): void;
|
|
122
|
+
buildFormGroupTemplate(formValues?: any, setValues?: boolean): void;
|
|
123
|
+
buildFormGroup(ajvInstanceName?: string): void;
|
|
124
|
+
buildLayout(widgetLibrary: any): void;
|
|
125
|
+
setOptions(newOptions: any): void;
|
|
126
|
+
compileAjvSchema(ajvInstanceName?: string): void;
|
|
127
|
+
buildSchemaFromData(data?: any, requireAllFields?: boolean): any;
|
|
128
|
+
buildSchemaFromLayout(layout?: any): any;
|
|
129
|
+
setTpldata(newTpldata?: any): void;
|
|
130
|
+
parseText(text?: string, value?: any, values?: any, key?: number | string): string;
|
|
131
|
+
parseExpression(expression?: string, value?: any, values?: any, key?: number | string, tpldata?: any): any;
|
|
132
|
+
setArrayItemTitle(parentCtx?: any, childNode?: any, index?: number): string;
|
|
133
|
+
setItemTitle(ctx: WidgetContext): string;
|
|
134
|
+
evaluateCondition(layoutNode: any, dataIndex: number[]): boolean;
|
|
135
|
+
initializeControl(ctx: WidgetContext, bind?: boolean): boolean;
|
|
136
|
+
formatErrors(errors: any, validationMessages?: any): string;
|
|
137
|
+
updateValue(ctx: WidgetContext, value: any): void;
|
|
138
|
+
updateArrayCheckboxList(ctx: WidgetContext, checkboxList: TitleMapItem[]): void;
|
|
139
|
+
updateArrayMultiSelectList(ctx: WidgetContext, selectList: TitleMapItem[]): void;
|
|
140
|
+
getFormControl(ctx: WidgetContext): AbstractControl;
|
|
141
|
+
setFormControl(ctx: WidgetContext, control: AbstractControl): AbstractControl;
|
|
142
|
+
getFormControlValue(ctx: WidgetContext): AbstractControl;
|
|
143
|
+
getFormControlGroup(ctx: WidgetContext): UntypedFormArray | UntypedFormGroup;
|
|
144
|
+
getFormControlName(ctx: WidgetContext): string;
|
|
145
|
+
getLayoutArray(ctx: WidgetContext): any[];
|
|
146
|
+
getParentNode(ctx: WidgetContext): any;
|
|
147
|
+
getDataPointer(ctx: WidgetContext): string;
|
|
148
|
+
getLayoutPointer(ctx: WidgetContext): string;
|
|
149
|
+
isControlBound(ctx: WidgetContext): boolean;
|
|
150
|
+
addItem(ctx: WidgetContext, name?: string): boolean;
|
|
151
|
+
moveArrayItem(ctx: WidgetContext, oldIndex: number, newIndex: number, moveLayout?: boolean): boolean;
|
|
152
|
+
removeItem(ctx: WidgetContext): boolean;
|
|
153
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<JsonSchemaFormService, never>;
|
|
154
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<JsonSchemaFormService>;
|
|
155
|
+
}
|
|
156
|
+
|
|
1
157
|
/**
|
|
2
|
-
*
|
|
158
|
+
* @module 'JsonSchemaFormComponent' - Angular JSON Schema Form
|
|
159
|
+
*
|
|
160
|
+
* Root module of the Angular JSON Schema Form client-side library,
|
|
161
|
+
* an Angular library which generates an HTML form from a JSON schema
|
|
162
|
+
* structured data model and/or a JSON Schema Form layout description.
|
|
163
|
+
*
|
|
164
|
+
* This library also validates input data by the user, using both validators on
|
|
165
|
+
* individual controls to provide real-time feedback while the user is filling
|
|
166
|
+
* out the form, and then validating the entire input against the schema when
|
|
167
|
+
* the form is submitted to make sure the returned JSON data object is valid.
|
|
168
|
+
*
|
|
169
|
+
* This library is similar to, and mostly API compatible with:
|
|
170
|
+
*
|
|
171
|
+
* - JSON Schema Form's Angular Schema Form library for AngularJs
|
|
172
|
+
* http://schemaform.io
|
|
173
|
+
* http://schemaform.io/examples/bootstrap-example.html (examples)
|
|
174
|
+
*
|
|
175
|
+
* - Mozilla's react-jsonschema-form library for React
|
|
176
|
+
* https://github.com/mozilla-services/react-jsonschema-form
|
|
177
|
+
* https://mozilla-services.github.io/react-jsonschema-form (examples)
|
|
178
|
+
*
|
|
179
|
+
* - Joshfire's JSON Form library for jQuery
|
|
180
|
+
* https://github.com/joshfire/jsonform
|
|
181
|
+
* http://ulion.github.io/jsonform/playground (examples)
|
|
182
|
+
*
|
|
183
|
+
* This library depends on:
|
|
184
|
+
* - Angular (obviously) https://angular.io
|
|
185
|
+
* - lodash, JavaScript utility library https://github.com/lodash/lodash
|
|
186
|
+
* - ajv, Another JSON Schema validator https://github.com/epoberezkin/ajv
|
|
187
|
+
*
|
|
188
|
+
* In addition, the Example Playground also depends on:
|
|
189
|
+
* - brace, Browserified Ace editor http://thlorenz.github.io/brace
|
|
3
190
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
191
|
+
declare class JsonSchemaFormComponent implements ControlValueAccessor, OnChanges, OnInit, OnDestroy {
|
|
192
|
+
private changeDetector;
|
|
193
|
+
private frameworkLibrary;
|
|
194
|
+
private widgetLibrary;
|
|
195
|
+
jsf: JsonSchemaFormService;
|
|
196
|
+
private unsubscribeOnActivateForm$;
|
|
197
|
+
debugOutput: any;
|
|
198
|
+
formValueSubscription: any;
|
|
199
|
+
formInitialized: boolean;
|
|
200
|
+
objectWrap: boolean;
|
|
201
|
+
formValuesInput: string;
|
|
202
|
+
previousInputs: {
|
|
203
|
+
schema: any;
|
|
204
|
+
layout: any[];
|
|
205
|
+
data: any;
|
|
206
|
+
options: any;
|
|
207
|
+
framework: any | string;
|
|
208
|
+
widgets: any;
|
|
209
|
+
form: any;
|
|
210
|
+
model: any;
|
|
211
|
+
JSONSchema: any;
|
|
212
|
+
UISchema: any;
|
|
213
|
+
formData: any;
|
|
214
|
+
loadExternalAssets: boolean;
|
|
215
|
+
debug: boolean;
|
|
216
|
+
ajvOptions: any;
|
|
217
|
+
};
|
|
218
|
+
readonly schema: _angular_core.InputSignal<any>;
|
|
219
|
+
readonly layout: _angular_core.InputSignal<any[]>;
|
|
220
|
+
readonly data: _angular_core.InputSignal<any>;
|
|
221
|
+
readonly options: _angular_core.InputSignal<any>;
|
|
222
|
+
readonly framework: _angular_core.InputSignal<any>;
|
|
223
|
+
readonly widgets: _angular_core.InputSignal<any>;
|
|
224
|
+
readonly form: _angular_core.InputSignal<any>;
|
|
225
|
+
readonly model: _angular_core.InputSignal<any>;
|
|
226
|
+
readonly JSONSchema: _angular_core.InputSignal<any>;
|
|
227
|
+
readonly UISchema: _angular_core.InputSignal<any>;
|
|
228
|
+
readonly formData: _angular_core.InputSignal<any>;
|
|
229
|
+
readonly ngModel: _angular_core.InputSignal<any>;
|
|
230
|
+
readonly language: _angular_core.InputSignal<string>;
|
|
231
|
+
readonly loadExternalAssets: _angular_core.InputSignal<boolean>;
|
|
232
|
+
readonly debug: _angular_core.InputSignal<boolean>;
|
|
233
|
+
readonly theme: _angular_core.InputSignal<string>;
|
|
234
|
+
readonly ajvOptions: _angular_core.InputSignal<any>;
|
|
235
|
+
private ajvInstanceName;
|
|
236
|
+
get value(): any;
|
|
237
|
+
set value(value: any);
|
|
238
|
+
readonly onChanges: _angular_core.OutputEmitterRef<any>;
|
|
239
|
+
readonly onSubmit: _angular_core.OutputEmitterRef<any>;
|
|
240
|
+
readonly isValid: _angular_core.OutputEmitterRef<boolean>;
|
|
241
|
+
readonly validationErrors: _angular_core.OutputEmitterRef<any>;
|
|
242
|
+
readonly formSchema: _angular_core.OutputEmitterRef<any>;
|
|
243
|
+
readonly formLayout: _angular_core.OutputEmitterRef<any>;
|
|
244
|
+
readonly dataChange: _angular_core.OutputEmitterRef<any>;
|
|
245
|
+
readonly modelChange: _angular_core.OutputEmitterRef<any>;
|
|
246
|
+
readonly formDataChange: _angular_core.OutputEmitterRef<any>;
|
|
247
|
+
readonly ngModelChange: _angular_core.OutputEmitterRef<any>;
|
|
248
|
+
onChange: Function;
|
|
249
|
+
onTouched: Function;
|
|
250
|
+
dataChangesSubs: Subscription;
|
|
251
|
+
statusChangesSubs: Subscription;
|
|
252
|
+
isValidChangesSubs: Subscription;
|
|
253
|
+
validationErrorChangesSubs: Subscription;
|
|
254
|
+
ngOnDestroy(): void;
|
|
255
|
+
private getInputValue;
|
|
256
|
+
private resetScriptsAndStyleSheets;
|
|
257
|
+
private loadScripts;
|
|
258
|
+
private loadStyleSheets;
|
|
259
|
+
private loadAssets;
|
|
260
|
+
ngOnInit(): void;
|
|
261
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
262
|
+
writeValue(value: any): void;
|
|
263
|
+
registerOnChange(fn: Function): void;
|
|
264
|
+
registerOnTouched(fn: Function): void;
|
|
265
|
+
setDisabledState(isDisabled: boolean): void;
|
|
266
|
+
updateForm(): void;
|
|
267
|
+
setFormValues(formValues: any, resetFirst?: boolean): void;
|
|
268
|
+
submitForm(): void;
|
|
269
|
+
/**
|
|
270
|
+
* 'initializeForm' function
|
|
271
|
+
*
|
|
272
|
+
* - Update 'schema', 'layout', and 'formValues', from inputs.
|
|
273
|
+
*
|
|
274
|
+
* - Create 'schemaRefLibrary' and 'schemaRecursiveRefMap'
|
|
275
|
+
* to resolve schema $ref links, including recursive $ref links.
|
|
276
|
+
*
|
|
277
|
+
* - Create 'dataRecursiveRefMap' to resolve recursive links in data
|
|
278
|
+
* and corectly set output formats for recursively nested values.
|
|
279
|
+
*
|
|
280
|
+
* - Create 'layoutRefLibrary' and 'templateRefLibrary' to store
|
|
281
|
+
* new layout nodes and formGroup elements to use when dynamically
|
|
282
|
+
* adding form components to arrays and recursive $ref points.
|
|
283
|
+
*
|
|
284
|
+
* - Create 'dataMap' to map the data to the schema and template.
|
|
285
|
+
*
|
|
286
|
+
* - Create the master 'formGroupTemplate' then from it 'formGroup'
|
|
287
|
+
* the Angular formGroup used to control the reactive form.
|
|
288
|
+
*/
|
|
289
|
+
initializeForm(initialData?: any): void;
|
|
290
|
+
/**
|
|
291
|
+
* 'initializeAjv' function
|
|
292
|
+
*
|
|
293
|
+
* Initialize ajv from 'ajvOptions'
|
|
294
|
+
*/
|
|
295
|
+
private initializeAjv;
|
|
296
|
+
/**
|
|
297
|
+
* 'initializeOptions' function
|
|
298
|
+
*
|
|
299
|
+
* Initialize 'options' (global form options) and set framework
|
|
300
|
+
* Combine available inputs:
|
|
301
|
+
* 1. options - recommended
|
|
302
|
+
* 2. form.options - Single input style
|
|
303
|
+
*/
|
|
304
|
+
private initializeOptions;
|
|
305
|
+
/**
|
|
306
|
+
* 'initializeSchema' function
|
|
307
|
+
*
|
|
308
|
+
* Initialize 'schema'
|
|
309
|
+
* Use first available input:
|
|
310
|
+
* 1. schema - recommended / Angular Schema Form style
|
|
311
|
+
* 2. form.schema - Single input / JSON Form style
|
|
312
|
+
* 3. JSONSchema - React JSON Schema Form style
|
|
313
|
+
* 4. form.JSONSchema - For testing single input React JSON Schema Forms
|
|
314
|
+
* 5. form - For testing single schema-only inputs
|
|
315
|
+
*
|
|
316
|
+
* ... if no schema input found, the 'activateForm' function, below,
|
|
317
|
+
* will make two additional attempts to build a schema
|
|
318
|
+
* 6. If layout input - build schema from layout
|
|
319
|
+
* 7. If data input - build schema from data
|
|
320
|
+
*/
|
|
321
|
+
private initializeSchema;
|
|
322
|
+
/**
|
|
323
|
+
* 'initializeData' function
|
|
324
|
+
*
|
|
325
|
+
* Initialize 'formValues'
|
|
326
|
+
* defulat or previously submitted values used to populate form
|
|
327
|
+
* Use first available input:
|
|
328
|
+
* 1. data - recommended
|
|
329
|
+
* 2. model - Angular Schema Form style
|
|
330
|
+
* 3. form.value - JSON Form style
|
|
331
|
+
* 4. form.data - Single input style
|
|
332
|
+
* 5. formData - React JSON Schema Form style
|
|
333
|
+
* 6. form.formData - For easier testing of React JSON Schema Forms
|
|
334
|
+
* 7. (none) no data - initialize data from schema and layout defaults only
|
|
335
|
+
*/
|
|
336
|
+
private initializeData;
|
|
337
|
+
/**
|
|
338
|
+
* 'initializeLayout' function
|
|
339
|
+
*
|
|
340
|
+
* Initialize 'layout'
|
|
341
|
+
* Use first available array input:
|
|
342
|
+
* 1. layout - recommended
|
|
343
|
+
* 2. form - Angular Schema Form style
|
|
344
|
+
* 3. form.form - JSON Form style
|
|
345
|
+
* 4. form.layout - Single input style
|
|
346
|
+
* 5. (none) no layout - set default layout instead
|
|
347
|
+
* (full layout will be built later from the schema)
|
|
348
|
+
*
|
|
349
|
+
* Also, if alternate layout formats are available,
|
|
350
|
+
* import from 'UISchema' or 'customFormItems'
|
|
351
|
+
* used for React JSON Schema Form and JSON Form API compatibility
|
|
352
|
+
* Use first available input:
|
|
353
|
+
* 1. UISchema - React JSON Schema Form style
|
|
354
|
+
* 2. form.UISchema - For testing single input React JSON Schema Forms
|
|
355
|
+
* 2. form.customFormItems - JSON Form style
|
|
356
|
+
* 3. (none) no input - don't import
|
|
357
|
+
*/
|
|
358
|
+
private initializeLayout;
|
|
359
|
+
/**
|
|
360
|
+
* 'activateForm' function
|
|
361
|
+
*
|
|
362
|
+
* ...continued from 'initializeSchema' function, above
|
|
363
|
+
* If 'schema' has not been initialized (i.e. no schema input found)
|
|
364
|
+
* 6. If layout input - build schema from layout input
|
|
365
|
+
* 7. If data input - build schema from data input
|
|
366
|
+
*
|
|
367
|
+
* Create final layout,
|
|
368
|
+
* build the FormGroup template and the Angular FormGroup,
|
|
369
|
+
* subscribe to changes,
|
|
370
|
+
* and activate the form.
|
|
371
|
+
*/
|
|
372
|
+
private activateForm;
|
|
373
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<JsonSchemaFormComponent, never>;
|
|
374
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<JsonSchemaFormComponent, "json-schema-form", never, { "schema": { "alias": "schema"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "framework": { "alias": "framework"; "required": false; "isSignal": true; }; "widgets": { "alias": "widgets"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; "JSONSchema": { "alias": "JSONSchema"; "required": false; "isSignal": true; }; "UISchema": { "alias": "UISchema"; "required": false; "isSignal": true; }; "formData": { "alias": "formData"; "required": false; "isSignal": true; }; "ngModel": { "alias": "ngModel"; "required": false; "isSignal": true; }; "language": { "alias": "language"; "required": false; "isSignal": true; }; "loadExternalAssets": { "alias": "loadExternalAssets"; "required": false; "isSignal": true; }; "debug": { "alias": "debug"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "ajvOptions": { "alias": "ajvOptions"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; }; }, { "onChanges": "onChanges"; "onSubmit": "onSubmit"; "isValid": "isValid"; "validationErrors": "validationErrors"; "formSchema": "formSchema"; "formLayout": "formLayout"; "dataChange": "dataChange"; "modelChange": "modelChange"; "formDataChange": "formDataChange"; "ngModelChange": "ngModelChange"; }, never, never, false, never>;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
declare class AddReferenceComponent implements OnInit {
|
|
378
|
+
private jsf;
|
|
379
|
+
options: any;
|
|
380
|
+
itemCount: number;
|
|
381
|
+
previousLayoutIndex: number[];
|
|
382
|
+
previousDataIndex: number[];
|
|
383
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
384
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
385
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
386
|
+
ngOnInit(): void;
|
|
387
|
+
get showAddButton(): boolean;
|
|
388
|
+
addItem(event: any): void;
|
|
389
|
+
get buttonText(): string;
|
|
390
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AddReferenceComponent, never>;
|
|
391
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AddReferenceComponent, "add-reference-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
declare class OneOfComponent implements OnInit, OnDestroy {
|
|
395
|
+
private jsf;
|
|
396
|
+
formControl: AbstractControl;
|
|
397
|
+
controlName: string;
|
|
398
|
+
controlValue: any;
|
|
399
|
+
controlDisabled: boolean;
|
|
400
|
+
boundControl: boolean;
|
|
401
|
+
options: any;
|
|
402
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
403
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
404
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
405
|
+
ngOnInit(): void;
|
|
406
|
+
findSelectedTab(): number;
|
|
407
|
+
updateValue(event: any): void;
|
|
408
|
+
ngOnDestroy(): void;
|
|
409
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<OneOfComponent, never>;
|
|
410
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<OneOfComponent, "one-of-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
declare class ButtonComponent implements OnInit, OnDestroy {
|
|
414
|
+
private jsf;
|
|
415
|
+
formControl: AbstractControl;
|
|
416
|
+
controlName: string;
|
|
417
|
+
controlValue: any;
|
|
418
|
+
controlDisabled: boolean;
|
|
419
|
+
boundControl: boolean;
|
|
420
|
+
options: any;
|
|
421
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
422
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
423
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
424
|
+
ngOnInit(): void;
|
|
425
|
+
updateValue(event: any): void;
|
|
426
|
+
ngOnDestroy(): void;
|
|
427
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ButtonComponent, never>;
|
|
428
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ButtonComponent, "button-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
declare class CheckboxComponent implements OnInit, OnDestroy {
|
|
432
|
+
private jsf;
|
|
433
|
+
formControl: AbstractControl;
|
|
434
|
+
controlName: string;
|
|
435
|
+
controlValue: any;
|
|
436
|
+
controlDisabled: boolean;
|
|
437
|
+
boundControl: boolean;
|
|
438
|
+
options: any;
|
|
439
|
+
trueValue: any;
|
|
440
|
+
falseValue: any;
|
|
441
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
442
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
443
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
444
|
+
ngOnInit(): void;
|
|
445
|
+
updateValue(event: any): void;
|
|
446
|
+
get isChecked(): boolean;
|
|
447
|
+
ngOnDestroy(): void;
|
|
448
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CheckboxComponent, never>;
|
|
449
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckboxComponent, "checkbox-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare class CheckboxesComponent implements OnInit, OnDestroy {
|
|
453
|
+
private jsf;
|
|
454
|
+
formControl: AbstractControl;
|
|
455
|
+
controlName: string;
|
|
456
|
+
controlValue: any;
|
|
457
|
+
controlDisabled: boolean;
|
|
458
|
+
boundControl: boolean;
|
|
459
|
+
options: any;
|
|
460
|
+
layoutOrientation: string;
|
|
461
|
+
formArray: AbstractControl;
|
|
462
|
+
checkboxList: TitleMapItem[];
|
|
463
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
464
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
465
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
466
|
+
ngOnInit(): void;
|
|
467
|
+
updateValue(event: any): void;
|
|
468
|
+
ngOnDestroy(): void;
|
|
469
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CheckboxesComponent, never>;
|
|
470
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckboxesComponent, "checkboxes-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
declare class FileComponent implements OnInit, OnDestroy {
|
|
474
|
+
private jsf;
|
|
475
|
+
formControl: AbstractControl;
|
|
476
|
+
controlName: string;
|
|
477
|
+
controlValue: any;
|
|
478
|
+
controlDisabled: boolean;
|
|
479
|
+
boundControl: boolean;
|
|
480
|
+
options: any;
|
|
481
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
482
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
483
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
484
|
+
ngOnInit(): void;
|
|
485
|
+
updateValue(event: any): void;
|
|
486
|
+
ngOnDestroy(): void;
|
|
487
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FileComponent, never>;
|
|
488
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FileComponent, "file-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
declare class HiddenComponent implements OnInit, OnDestroy {
|
|
492
|
+
private jsf;
|
|
493
|
+
formControl: AbstractControl;
|
|
494
|
+
controlName: string;
|
|
495
|
+
controlValue: any;
|
|
496
|
+
controlDisabled: boolean;
|
|
497
|
+
boundControl: boolean;
|
|
498
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
499
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
500
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
501
|
+
ngOnInit(): void;
|
|
502
|
+
ngOnDestroy(): void;
|
|
503
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HiddenComponent, never>;
|
|
504
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HiddenComponent, "hidden-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
declare class InputComponent implements OnInit, OnDestroy {
|
|
508
|
+
private jsf;
|
|
509
|
+
formControl: AbstractControl;
|
|
510
|
+
controlName: string;
|
|
511
|
+
controlValue: string;
|
|
512
|
+
controlDisabled: boolean;
|
|
513
|
+
boundControl: boolean;
|
|
514
|
+
options: any;
|
|
515
|
+
autoCompleteList: string[];
|
|
516
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
517
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
518
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
519
|
+
get inputAttributes(): any;
|
|
520
|
+
ngOnInit(): void;
|
|
521
|
+
updateValue(event: any): void;
|
|
522
|
+
ngOnDestroy(): void;
|
|
523
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<InputComponent, never>;
|
|
524
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<InputComponent, "input-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare class MessageComponent implements OnInit {
|
|
528
|
+
private jsf;
|
|
529
|
+
options: any;
|
|
530
|
+
message: string;
|
|
531
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
532
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
533
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
534
|
+
ngOnInit(): void;
|
|
535
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MessageComponent, never>;
|
|
536
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MessageComponent, "message-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
declare class NoneComponent {
|
|
540
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
541
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
542
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
543
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NoneComponent, never>;
|
|
544
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NoneComponent, "none-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
declare class NumberComponent implements OnInit, OnDestroy {
|
|
548
|
+
private jsf;
|
|
549
|
+
formControl: AbstractControl;
|
|
550
|
+
controlName: string;
|
|
551
|
+
controlValue: any;
|
|
552
|
+
controlDisabled: boolean;
|
|
553
|
+
boundControl: boolean;
|
|
554
|
+
options: any;
|
|
555
|
+
allowNegative: boolean;
|
|
556
|
+
allowDecimal: boolean;
|
|
557
|
+
allowExponents: boolean;
|
|
558
|
+
lastValidNumber: string;
|
|
559
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
560
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
561
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
562
|
+
get inputAttributes(): any;
|
|
563
|
+
inputControl: ElementRef;
|
|
564
|
+
div: ElementRef;
|
|
565
|
+
ngOnInit(): void;
|
|
566
|
+
updateValue(event: any): void;
|
|
567
|
+
ngOnDestroy(): void;
|
|
568
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NumberComponent, never>;
|
|
569
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NumberComponent, "number-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
declare class RadiosComponent implements OnInit, OnDestroy {
|
|
573
|
+
private jsf;
|
|
574
|
+
formControl: AbstractControl;
|
|
575
|
+
controlName: string;
|
|
576
|
+
controlValue: any;
|
|
577
|
+
controlDisabled: boolean;
|
|
578
|
+
boundControl: boolean;
|
|
579
|
+
options: any;
|
|
580
|
+
layoutOrientation: string;
|
|
581
|
+
radiosList: any[];
|
|
582
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
583
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
584
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
585
|
+
ngOnInit(): void;
|
|
586
|
+
updateValue(event: any): void;
|
|
587
|
+
ngOnDestroy(): void;
|
|
588
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RadiosComponent, never>;
|
|
589
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RadiosComponent, "radios-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
declare class RootComponent implements OnInit, OnDestroy {
|
|
593
|
+
private jsf;
|
|
594
|
+
options: any;
|
|
595
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
596
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
597
|
+
readonly layout: _angular_core.InputSignal<any[]>;
|
|
598
|
+
readonly isOrderable: _angular_core.InputSignal<boolean>;
|
|
599
|
+
readonly isFlexItem: _angular_core.InputSignal<boolean>;
|
|
600
|
+
sortableObj: any;
|
|
601
|
+
sortableConfig: any;
|
|
602
|
+
private sortableOptionsSubscription;
|
|
603
|
+
sortableInit(sortable: any): void;
|
|
604
|
+
isDraggable(node: any): boolean;
|
|
605
|
+
isFixed(node: any): boolean;
|
|
606
|
+
getFlexAttribute(node: any, attribute: string): any;
|
|
607
|
+
showWidget(layoutNode: any): boolean;
|
|
608
|
+
ngOnInit(): void;
|
|
609
|
+
ngOnDestroy(): void;
|
|
610
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RootComponent, never>;
|
|
611
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RootComponent, "root-widget", never, { "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "isOrderable": { "alias": "isOrderable"; "required": false; "isSignal": true; }; "isFlexItem": { "alias": "isFlexItem"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
declare class SectionComponent implements OnInit {
|
|
615
|
+
private jsf;
|
|
616
|
+
options: any;
|
|
617
|
+
expanded: boolean;
|
|
618
|
+
containerType: string;
|
|
619
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
620
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
621
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
622
|
+
get sectionTitle(): string;
|
|
623
|
+
ngOnInit(): void;
|
|
624
|
+
toggleExpanded(): void;
|
|
625
|
+
getFlexAttribute(attribute: string): any;
|
|
626
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SectionComponent, never>;
|
|
627
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SectionComponent, "section-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Validator utility function library:
|
|
632
|
+
*
|
|
633
|
+
* Validator and error utilities:
|
|
634
|
+
* _executeValidators, _executeAsyncValidators, _mergeObjects, _mergeErrors
|
|
635
|
+
*
|
|
636
|
+
* Individual value checking:
|
|
637
|
+
* isDefined, hasValue, isEmpty
|
|
638
|
+
*
|
|
639
|
+
* Individual type checking:
|
|
640
|
+
* isString, isNumber, isInteger, isBoolean, isFunction, isObject, isArray,
|
|
641
|
+
* isMap, isSet, isPromise, isObservable
|
|
642
|
+
*
|
|
643
|
+
* Multiple type checking and fixing:
|
|
644
|
+
* getType, isType, isPrimitive, toJavaScriptType, toSchemaType,
|
|
645
|
+
* _toPromise, toObservable
|
|
646
|
+
*
|
|
647
|
+
* Utility functions:
|
|
648
|
+
* inArray, xor
|
|
649
|
+
*
|
|
650
|
+
* Typescript types and interfaces:
|
|
651
|
+
* SchemaPrimitiveType, SchemaType, JavaScriptPrimitiveType, JavaScriptType,
|
|
652
|
+
* PrimitiveValue, PlainObject, IValidatorFn, AsyncIValidatorFn
|
|
653
|
+
*
|
|
654
|
+
* Note: 'IValidatorFn' is short for 'invertable validator function',
|
|
655
|
+
* which is a validator functions that accepts an optional second
|
|
656
|
+
* argument which, if set to TRUE, causes the validator to perform
|
|
657
|
+
* the opposite of its original function.
|
|
658
|
+
*/
|
|
659
|
+
type SchemaPrimitiveType = 'string' | 'number' | 'integer' | 'boolean' | 'null';
|
|
660
|
+
type SchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'object' | 'array';
|
|
661
|
+
type JavaScriptPrimitiveType = 'string' | 'number' | 'boolean' | 'null' | 'undefined';
|
|
662
|
+
type JavaScriptType = 'string' | 'number' | 'boolean' | 'null' | 'undefined' | 'object' | 'array' | 'map' | 'set' | 'arguments' | 'date' | 'error' | 'function' | 'json' | 'math' | 'regexp';
|
|
663
|
+
type PrimitiveValue = string | number | boolean | null | undefined;
|
|
664
|
+
interface PlainObject {
|
|
665
|
+
[k: string]: any;
|
|
666
|
+
}
|
|
667
|
+
type IValidatorFn = (c: AbstractControl, i?: boolean) => PlainObject;
|
|
668
|
+
type AsyncIValidatorFn = (c: AbstractControl, i?: boolean) => any;
|
|
669
|
+
/**
|
|
670
|
+
* '_executeValidators' utility function
|
|
671
|
+
*
|
|
672
|
+
* Validates a control against an array of validators, and returns
|
|
673
|
+
* an array of the same length containing a combination of error messages
|
|
674
|
+
* (from invalid validators) and null values (from valid validators)
|
|
675
|
+
*
|
|
676
|
+
* // { AbstractControl } control - control to validate
|
|
677
|
+
* // { IValidatorFn[] } validators - array of validators
|
|
678
|
+
* // { boolean } invert - invert?
|
|
679
|
+
* // { PlainObject[] } - array of nulls and error message
|
|
680
|
+
*/
|
|
681
|
+
declare function _executeValidators(control: any, validators: any, invert?: boolean): any;
|
|
682
|
+
/**
|
|
683
|
+
* '_executeAsyncValidators' utility function
|
|
684
|
+
*
|
|
685
|
+
* Validates a control against an array of async validators, and returns
|
|
686
|
+
* an array of observabe results of the same length containing a combination of
|
|
687
|
+
* error messages (from invalid validators) and null values (from valid ones)
|
|
688
|
+
*
|
|
689
|
+
* // { AbstractControl } control - control to validate
|
|
690
|
+
* // { AsyncIValidatorFn[] } validators - array of async validators
|
|
691
|
+
* // { boolean } invert - invert?
|
|
692
|
+
* // - array of observable nulls and error message
|
|
693
|
+
*/
|
|
694
|
+
declare function _executeAsyncValidators(control: any, validators: any, invert?: boolean): any;
|
|
695
|
+
/**
|
|
696
|
+
* '_mergeObjects' utility function
|
|
697
|
+
*
|
|
698
|
+
* Recursively Merges one or more objects into a single object with combined keys.
|
|
699
|
+
* Automatically detects and ignores null and undefined inputs.
|
|
700
|
+
* Also detects duplicated boolean 'not' keys and XORs their values.
|
|
701
|
+
*
|
|
702
|
+
* // { PlainObject[] } objects - one or more objects to merge
|
|
703
|
+
* // { PlainObject } - merged object
|
|
704
|
+
*/
|
|
705
|
+
declare function _mergeObjects(...objects: any[]): PlainObject;
|
|
706
|
+
/**
|
|
707
|
+
* '_mergeErrors' utility function
|
|
708
|
+
*
|
|
709
|
+
* Merges an array of objects.
|
|
710
|
+
* Used for combining the validator errors returned from 'executeValidators'
|
|
711
|
+
*
|
|
712
|
+
* // { PlainObject[] } arrayOfErrors - array of objects
|
|
713
|
+
* // { PlainObject } - merged object, or null if no usable input objectcs
|
|
714
|
+
*/
|
|
715
|
+
declare function _mergeErrors(arrayOfErrors: any): PlainObject;
|
|
716
|
+
/**
|
|
717
|
+
* 'isDefined' utility function
|
|
718
|
+
*
|
|
719
|
+
* Checks if a variable contains a value of any type.
|
|
720
|
+
* Returns true even for otherwise 'falsey' values of 0, '', and false.
|
|
721
|
+
*
|
|
722
|
+
* // value - the value to check
|
|
723
|
+
* // { boolean } - false if undefined or null, otherwise true
|
|
724
|
+
*/
|
|
725
|
+
declare function isDefined(value: any): boolean;
|
|
726
|
+
/**
|
|
727
|
+
* 'hasValue' utility function
|
|
728
|
+
*
|
|
729
|
+
* Checks if a variable contains a value.
|
|
730
|
+
* Returs false for null, undefined, or a zero-length strng, '',
|
|
731
|
+
* otherwise returns true.
|
|
732
|
+
* (Stricter than 'isDefined' because it also returns false for '',
|
|
733
|
+
* though it stil returns true for otherwise 'falsey' values 0 and false.)
|
|
734
|
+
*
|
|
735
|
+
* // value - the value to check
|
|
736
|
+
* // { boolean } - false if undefined, null, or '', otherwise true
|
|
737
|
+
*/
|
|
738
|
+
declare function hasValue(value: any): boolean;
|
|
739
|
+
/**
|
|
740
|
+
* 'isEmpty' utility function
|
|
741
|
+
*
|
|
742
|
+
* Similar to !hasValue, but also returns true for empty arrays and objects.
|
|
743
|
+
*
|
|
744
|
+
* // value - the value to check
|
|
745
|
+
* // { boolean } - false if undefined, null, or '', otherwise true
|
|
746
|
+
*/
|
|
747
|
+
declare function isEmpty(value: any): boolean;
|
|
748
|
+
/**
|
|
749
|
+
* 'isString' utility function
|
|
750
|
+
*
|
|
751
|
+
* Checks if a value is a string.
|
|
752
|
+
*
|
|
753
|
+
* // value - the value to check
|
|
754
|
+
* // { boolean } - true if string, false if not
|
|
755
|
+
*/
|
|
756
|
+
declare function isString(value: any): value is string;
|
|
757
|
+
/**
|
|
758
|
+
* 'isNumber' utility function
|
|
759
|
+
*
|
|
760
|
+
* Checks if a value is a regular number, numeric string, or JavaScript Date.
|
|
761
|
+
*
|
|
762
|
+
* // value - the value to check
|
|
763
|
+
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
764
|
+
* // { boolean } - true if number, false if not
|
|
765
|
+
*/
|
|
766
|
+
declare function isNumber(value: any, strict?: any): boolean;
|
|
767
|
+
/**
|
|
768
|
+
* 'isInteger' utility function
|
|
769
|
+
*
|
|
770
|
+
* Checks if a value is an integer.
|
|
771
|
+
*
|
|
772
|
+
* // value - the value to check
|
|
773
|
+
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
774
|
+
* // {boolean } - true if number, false if not
|
|
775
|
+
*/
|
|
776
|
+
declare function isInteger(value: any, strict?: any): boolean;
|
|
777
|
+
/**
|
|
778
|
+
* 'isBoolean' utility function
|
|
779
|
+
*
|
|
780
|
+
* Checks if a value is a boolean.
|
|
781
|
+
*
|
|
782
|
+
* // value - the value to check
|
|
783
|
+
* // { any = null } option - if 'strict', also checks JavaScript type
|
|
784
|
+
* if TRUE or FALSE, checks only for that value
|
|
785
|
+
* // { boolean } - true if boolean, false if not
|
|
786
|
+
*/
|
|
787
|
+
declare function isBoolean(value: any, option?: any): boolean;
|
|
788
|
+
declare function isFunction(item: any): boolean;
|
|
789
|
+
declare function isObject(item: any): boolean;
|
|
790
|
+
declare function isArray(item: any): boolean;
|
|
791
|
+
declare function isDate(item: any): boolean;
|
|
792
|
+
declare function isMap(item: any): boolean;
|
|
793
|
+
declare function isSet(item: any): boolean;
|
|
794
|
+
/**
|
|
795
|
+
* 'getType' function
|
|
796
|
+
*
|
|
797
|
+
* Detects the JSON Schema Type of a value.
|
|
798
|
+
* By default, detects numbers and integers even if formatted as strings.
|
|
799
|
+
* (So all integers are also numbers, and any number may also be a string.)
|
|
800
|
+
* However, it only detects true boolean values (to detect boolean values
|
|
801
|
+
* in non-boolean formats, use isBoolean() instead).
|
|
802
|
+
*
|
|
803
|
+
* If passed a second optional parameter of 'strict', it will only detect
|
|
804
|
+
* numbers and integers if they are formatted as JavaScript numbers.
|
|
805
|
+
*
|
|
806
|
+
* Examples:
|
|
807
|
+
* getType('10.5') = 'number'
|
|
808
|
+
* getType(10.5) = 'number'
|
|
809
|
+
* getType('10') = 'integer'
|
|
810
|
+
* getType(10) = 'integer'
|
|
811
|
+
* getType('true') = 'string'
|
|
812
|
+
* getType(true) = 'boolean'
|
|
813
|
+
* getType(null) = 'null'
|
|
814
|
+
* getType({ }) = 'object'
|
|
815
|
+
* getType([]) = 'array'
|
|
816
|
+
*
|
|
817
|
+
* getType('10.5', 'strict') = 'string'
|
|
818
|
+
* getType(10.5, 'strict') = 'number'
|
|
819
|
+
* getType('10', 'strict') = 'string'
|
|
820
|
+
* getType(10, 'strict') = 'integer'
|
|
821
|
+
* getType('true', 'strict') = 'string'
|
|
822
|
+
* getType(true, 'strict') = 'boolean'
|
|
823
|
+
*
|
|
824
|
+
* // value - value to check
|
|
825
|
+
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
826
|
+
* // { SchemaType }
|
|
827
|
+
*/
|
|
828
|
+
declare function getType(value: any, strict?: any): "string" | "number" | "integer" | "boolean" | "null" | "object" | "array";
|
|
829
|
+
/**
|
|
830
|
+
* 'isType' function
|
|
831
|
+
*
|
|
832
|
+
* Checks wether an input (probably string) value contains data of
|
|
833
|
+
* a specified JSON Schema type
|
|
834
|
+
*
|
|
835
|
+
* // { PrimitiveValue } value - value to check
|
|
836
|
+
* // { SchemaPrimitiveType } type - type to check
|
|
837
|
+
* // { boolean }
|
|
838
|
+
*/
|
|
839
|
+
declare function isType(value: any, type: any): boolean;
|
|
840
|
+
/**
|
|
841
|
+
* 'isPrimitive' function
|
|
842
|
+
*
|
|
843
|
+
* Checks wether an input value is a JavaScript primitive type:
|
|
844
|
+
* string, number, boolean, or null.
|
|
845
|
+
*
|
|
846
|
+
* // value - value to check
|
|
847
|
+
* // { boolean }
|
|
848
|
+
*/
|
|
849
|
+
declare function isPrimitive(value: any): boolean;
|
|
850
|
+
/**
|
|
851
|
+
* 'toJavaScriptType' function
|
|
852
|
+
*
|
|
853
|
+
* Converts an input (probably string) value to a JavaScript primitive type -
|
|
854
|
+
* 'string', 'number', 'boolean', or 'null' - before storing in a JSON object.
|
|
855
|
+
*
|
|
856
|
+
* Does not coerce values (other than null), and only converts the types
|
|
857
|
+
* of values that would otherwise be valid.
|
|
858
|
+
*
|
|
859
|
+
* If the optional third parameter 'strictIntegers' is TRUE, and the
|
|
860
|
+
* JSON Schema type 'integer' is specified, it also verifies the input value
|
|
861
|
+
* is an integer and, if it is, returns it as a JaveScript number.
|
|
862
|
+
* If 'strictIntegers' is FALSE (or not set) the type 'integer' is treated
|
|
863
|
+
* exactly the same as 'number', and allows decimals.
|
|
864
|
+
*
|
|
865
|
+
* Valid Examples:
|
|
866
|
+
* toJavaScriptType('10', 'number' ) = 10 // '10' is a number
|
|
867
|
+
* toJavaScriptType('10', 'integer') = 10 // '10' is also an integer
|
|
868
|
+
* toJavaScriptType( 10, 'integer') = 10 // 10 is still an integer
|
|
869
|
+
* toJavaScriptType( 10, 'string' ) = '10' // 10 can be made into a string
|
|
870
|
+
* toJavaScriptType('10.5', 'number' ) = 10.5 // '10.5' is a number
|
|
871
|
+
*
|
|
872
|
+
* Invalid Examples:
|
|
873
|
+
* toJavaScriptType('10.5', 'integer') = null // '10.5' is not an integer
|
|
874
|
+
* toJavaScriptType( 10.5, 'integer') = null // 10.5 is still not an integer
|
|
875
|
+
*
|
|
876
|
+
* // { PrimitiveValue } value - value to convert
|
|
877
|
+
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - types to convert to
|
|
878
|
+
* // { boolean = false } strictIntegers - if FALSE, treat integers as numbers
|
|
879
|
+
* // { PrimitiveValue }
|
|
880
|
+
*/
|
|
881
|
+
declare function toJavaScriptType(value: any, types: any, strictIntegers?: boolean): any;
|
|
882
|
+
/**
|
|
883
|
+
* 'toSchemaType' function
|
|
884
|
+
*
|
|
885
|
+
* Converts an input (probably string) value to the "best" JavaScript
|
|
886
|
+
* equivalent available from an allowed list of JSON Schema types, which may
|
|
887
|
+
* contain 'string', 'number', 'integer', 'boolean', and/or 'null'.
|
|
888
|
+
* If necssary, it does progressively agressive type coersion.
|
|
889
|
+
* It will not return null unless null is in the list of allowed types.
|
|
890
|
+
*
|
|
891
|
+
* Number conversion examples:
|
|
892
|
+
* toSchemaType('10', ['number','integer','string']) = 10 // integer
|
|
893
|
+
* toSchemaType('10', ['number','string']) = 10 // number
|
|
894
|
+
* toSchemaType('10', ['string']) = '10' // string
|
|
895
|
+
* toSchemaType('10.5', ['number','integer','string']) = 10.5 // number
|
|
896
|
+
* toSchemaType('10.5', ['integer','string']) = '10.5' // string
|
|
897
|
+
* toSchemaType('10.5', ['integer']) = 10 // integer
|
|
898
|
+
* toSchemaType(10.5, ['null','boolean','string']) = '10.5' // string
|
|
899
|
+
* toSchemaType(10.5, ['null','boolean']) = true // boolean
|
|
900
|
+
*
|
|
901
|
+
* String conversion examples:
|
|
902
|
+
* toSchemaType('1.5x', ['boolean','number','integer','string']) = '1.5x' // string
|
|
903
|
+
* toSchemaType('1.5x', ['boolean','number','integer']) = '1.5' // number
|
|
904
|
+
* toSchemaType('1.5x', ['boolean','integer']) = '1' // integer
|
|
905
|
+
* toSchemaType('1.5x', ['boolean']) = true // boolean
|
|
906
|
+
* toSchemaType('xyz', ['number','integer','boolean','null']) = true // boolean
|
|
907
|
+
* toSchemaType('xyz', ['number','integer','null']) = null // null
|
|
908
|
+
* toSchemaType('xyz', ['number','integer']) = 0 // number
|
|
909
|
+
*
|
|
910
|
+
* Boolean conversion examples:
|
|
911
|
+
* toSchemaType('1', ['integer','number','string','boolean']) = 1 // integer
|
|
912
|
+
* toSchemaType('1', ['number','string','boolean']) = 1 // number
|
|
913
|
+
* toSchemaType('1', ['string','boolean']) = '1' // string
|
|
914
|
+
* toSchemaType('1', ['boolean']) = true // boolean
|
|
915
|
+
* toSchemaType('true', ['number','string','boolean']) = 'true' // string
|
|
916
|
+
* toSchemaType('true', ['boolean']) = true // boolean
|
|
917
|
+
* toSchemaType('true', ['number']) = 0 // number
|
|
918
|
+
* toSchemaType(true, ['number','string','boolean']) = true // boolean
|
|
919
|
+
* toSchemaType(true, ['number','string']) = 'true' // string
|
|
920
|
+
* toSchemaType(true, ['number']) = 1 // number
|
|
921
|
+
*
|
|
922
|
+
* // { PrimitiveValue } value - value to convert
|
|
923
|
+
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - allowed types to convert to
|
|
924
|
+
* // { PrimitiveValue }
|
|
925
|
+
*/
|
|
926
|
+
declare function toSchemaType(value: any, types: any): any;
|
|
927
|
+
/**
|
|
928
|
+
* 'isPromise' function
|
|
929
|
+
*
|
|
930
|
+
* // object
|
|
931
|
+
* // { boolean }
|
|
932
|
+
*/
|
|
933
|
+
declare function isPromise(object: any): object is Promise<any>;
|
|
934
|
+
/**
|
|
935
|
+
* 'isObservable' function
|
|
936
|
+
*
|
|
937
|
+
* // object
|
|
938
|
+
* // { boolean }
|
|
939
|
+
*/
|
|
940
|
+
declare function isObservable(object: any): object is Observable<any>;
|
|
941
|
+
/**
|
|
942
|
+
* '_toPromise' function
|
|
943
|
+
*
|
|
944
|
+
* // { object } object
|
|
945
|
+
* // { Promise<any> }
|
|
946
|
+
*/
|
|
947
|
+
declare function _toPromise(object: any): Promise<any>;
|
|
948
|
+
/**
|
|
949
|
+
* 'toObservable' function
|
|
950
|
+
*
|
|
951
|
+
* // { object } object
|
|
952
|
+
* // { Observable<any> }
|
|
953
|
+
*/
|
|
954
|
+
declare function toObservable(object: any): Observable<any>;
|
|
955
|
+
/**
|
|
956
|
+
* 'inArray' function
|
|
957
|
+
*
|
|
958
|
+
* Searches an array for an item, or one of a list of items, and returns true
|
|
959
|
+
* as soon as a match is found, or false if no match.
|
|
960
|
+
*
|
|
961
|
+
* If the optional third parameter allIn is set to TRUE, and the item to find
|
|
962
|
+
* is an array, then the function returns true only if all elements from item
|
|
963
|
+
* are found in the array list, and false if any element is not found. If the
|
|
964
|
+
* item to find is not an array, setting allIn to TRUE has no effect.
|
|
965
|
+
*
|
|
966
|
+
* // { any|any[] } item - the item to search for
|
|
967
|
+
* // array - the array to search
|
|
968
|
+
* // { boolean = false } allIn - if TRUE, all items must be in array
|
|
969
|
+
* // { boolean } - true if item(s) in array, false otherwise
|
|
970
|
+
*/
|
|
971
|
+
declare function inArray(item: any, array: any, allIn?: boolean): any;
|
|
972
|
+
/**
|
|
973
|
+
* 'xor' utility function - exclusive or
|
|
974
|
+
*
|
|
975
|
+
* Returns true if exactly one of two values is truthy.
|
|
976
|
+
*
|
|
977
|
+
* // value1 - first value to check
|
|
978
|
+
* // value2 - second value to check
|
|
979
|
+
* // { boolean } - true if exactly one input value is truthy, false if not
|
|
980
|
+
*/
|
|
981
|
+
declare function xor(value1: any, value2: any): boolean;
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Utility function library:
|
|
985
|
+
*
|
|
986
|
+
* addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject,
|
|
987
|
+
* uniqueItems, commonItems, fixTitle, toTitleCase
|
|
988
|
+
*/
|
|
989
|
+
/**
|
|
990
|
+
* 'addClasses' function
|
|
991
|
+
*
|
|
992
|
+
* Merges two space-delimited lists of CSS classes and removes duplicates.
|
|
993
|
+
*
|
|
994
|
+
* // {string | string[] | Set<string>} oldClasses
|
|
995
|
+
* // {string | string[] | Set<string>} newClasses
|
|
996
|
+
* // {string | string[] | Set<string>} - Combined classes
|
|
997
|
+
*/
|
|
998
|
+
declare function addClasses(oldClasses: string | string[] | Set<string>, newClasses: string | string[] | Set<string>): string | string[] | Set<string>;
|
|
999
|
+
/**
|
|
1000
|
+
* 'copy' function
|
|
1001
|
+
*
|
|
1002
|
+
* Makes a shallow copy of a JavaScript object, array, Map, or Set.
|
|
1003
|
+
* If passed a JavaScript primitive value (string, number, boolean, or null),
|
|
1004
|
+
* it returns the value.
|
|
1005
|
+
*
|
|
1006
|
+
* // {Object|Array|string|number|boolean|null} object - The object to copy
|
|
1007
|
+
* // {boolean = false} errors - Show errors?
|
|
1008
|
+
* // {Object|Array|string|number|boolean|null} - The copied object
|
|
1009
|
+
*/
|
|
1010
|
+
declare function copy(object: any, errors?: boolean): any;
|
|
1011
|
+
/**
|
|
1012
|
+
* 'forEach' function
|
|
1013
|
+
*
|
|
1014
|
+
* Iterates over all items in the first level of an object or array
|
|
1015
|
+
* and calls an iterator funciton on each item.
|
|
1016
|
+
*
|
|
1017
|
+
* The iterator function is called with four values:
|
|
1018
|
+
* 1. The current item's value
|
|
1019
|
+
* 2. The current item's key
|
|
1020
|
+
* 3. The parent object, which contains the current item
|
|
1021
|
+
* 4. The root object
|
|
1022
|
+
*
|
|
1023
|
+
* Setting the optional third parameter to 'top-down' or 'bottom-up' will cause
|
|
1024
|
+
* it to also recursively iterate over items in sub-objects or sub-arrays in the
|
|
1025
|
+
* specified direction.
|
|
1026
|
+
*
|
|
1027
|
+
* // {Object|Array} object - The object or array to iterate over
|
|
1028
|
+
* // {function} fn - the iterator funciton to call on each item
|
|
1029
|
+
* // {boolean = false} errors - Show errors?
|
|
1030
|
+
* // {void}
|
|
1031
|
+
*/
|
|
1032
|
+
declare function forEach(object: any, fn: (v: any, k?: string | number, c?: any, rc?: any) => any, recurse?: boolean | string, rootObject?: any, errors?: boolean): void;
|
|
1033
|
+
/**
|
|
1034
|
+
* 'forEachCopy' function
|
|
1035
|
+
*
|
|
1036
|
+
* Iterates over all items in the first level of an object or array
|
|
1037
|
+
* and calls an iterator function on each item. Returns a new object or array
|
|
1038
|
+
* with the same keys or indexes as the original, and values set to the results
|
|
1039
|
+
* of the iterator function.
|
|
1040
|
+
*
|
|
1041
|
+
* Does NOT recursively iterate over items in sub-objects or sub-arrays.
|
|
1042
|
+
*
|
|
1043
|
+
* // {Object | Array} object - The object or array to iterate over
|
|
1044
|
+
* // {function} fn - The iterator funciton to call on each item
|
|
1045
|
+
* // {boolean = false} errors - Show errors?
|
|
1046
|
+
* // {Object | Array} - The resulting object or array
|
|
1047
|
+
*/
|
|
1048
|
+
declare function forEachCopy(object: any, fn: (v: any, k?: string | number, o?: any, p?: string) => any, errors?: boolean): any;
|
|
1049
|
+
/**
|
|
1050
|
+
* 'hasOwn' utility function
|
|
1051
|
+
*
|
|
1052
|
+
* Checks whether an object or array has a particular property.
|
|
1053
|
+
*
|
|
1054
|
+
* // {any} object - the object to check
|
|
1055
|
+
* // {string} property - the property to look for
|
|
1056
|
+
* // {boolean} - true if object has property, false if not
|
|
1057
|
+
*/
|
|
1058
|
+
declare function hasOwn(object: any, property: string): boolean;
|
|
1059
|
+
/**
|
|
1060
|
+
* 'mergeFilteredObject' utility function
|
|
1061
|
+
*
|
|
1062
|
+
* Shallowly merges two objects, setting key and values from source object
|
|
1063
|
+
* in target object, excluding specified keys.
|
|
1064
|
+
*
|
|
1065
|
+
* Optionally, it can also use functions to transform the key names and/or
|
|
1066
|
+
* the values of the merging object.
|
|
1067
|
+
*
|
|
1068
|
+
* // {PlainObject} targetObject - Target object to add keys and values to
|
|
1069
|
+
* // {PlainObject} sourceObject - Source object to copy keys and values from
|
|
1070
|
+
* // {string[]} excludeKeys - Array of keys to exclude
|
|
1071
|
+
* // {(string: string) => string = (k) => k} keyFn - Function to apply to keys
|
|
1072
|
+
* // {(any: any) => any = (v) => v} valueFn - Function to apply to values
|
|
1073
|
+
* // {PlainObject} - Returns targetObject
|
|
1074
|
+
*/
|
|
1075
|
+
declare function mergeFilteredObject(targetObject: PlainObject, sourceObject: PlainObject, excludeKeys?: string[], keyFn?: (key: string) => string, valFn?: (val: any) => any): PlainObject;
|
|
1076
|
+
/**
|
|
1077
|
+
* 'uniqueItems' function
|
|
1078
|
+
*
|
|
1079
|
+
* Accepts any number of string value inputs,
|
|
1080
|
+
* and returns an array of all input vaues, excluding duplicates.
|
|
1081
|
+
*
|
|
1082
|
+
* // {...string} ...items -
|
|
1083
|
+
* // {string[]} -
|
|
1084
|
+
*/
|
|
1085
|
+
declare function uniqueItems(...items: any[]): string[];
|
|
1086
|
+
/**
|
|
1087
|
+
* 'commonItems' function
|
|
1088
|
+
*
|
|
1089
|
+
* Accepts any number of strings or arrays of string values,
|
|
1090
|
+
* and returns a single array containing only values present in all inputs.
|
|
1091
|
+
*
|
|
1092
|
+
* // {...string|string[]} ...arrays -
|
|
1093
|
+
* // {string[]} -
|
|
1094
|
+
*/
|
|
1095
|
+
declare function commonItems(...arrays: any[]): string[];
|
|
1096
|
+
/**
|
|
1097
|
+
* 'fixTitle' function
|
|
1098
|
+
*
|
|
1099
|
+
*
|
|
1100
|
+
* // {string} input -
|
|
1101
|
+
* // {string} -
|
|
1102
|
+
*/
|
|
1103
|
+
declare function fixTitle(name: string): string;
|
|
1104
|
+
/**
|
|
1105
|
+
* 'toTitleCase' function
|
|
1106
|
+
*
|
|
1107
|
+
* Intelligently converts an input string to Title Case.
|
|
1108
|
+
*
|
|
1109
|
+
* Accepts an optional second parameter with a list of additional
|
|
1110
|
+
* words and abbreviations to force into a particular case.
|
|
1111
|
+
*
|
|
1112
|
+
* This function is built on prior work by John Gruber and David Gouch:
|
|
1113
|
+
* http://daringfireball.net/2008/08/title_case_update
|
|
1114
|
+
* https://github.com/gouch/to-title-case
|
|
1115
|
+
*
|
|
1116
|
+
* // {string} input -
|
|
1117
|
+
* // {string|string[]} forceWords? -
|
|
1118
|
+
* // {string} -
|
|
1119
|
+
*/
|
|
1120
|
+
declare function toTitleCase(input: string, forceWords?: string | string[]): string;
|
|
1121
|
+
/**
|
|
1122
|
+
* Recursively checks if at least one property of the given object (including nested objects)
|
|
1123
|
+
* has a non-null and non-undefined value.
|
|
1124
|
+
*
|
|
1125
|
+
* @param obj - The object to check.
|
|
1126
|
+
* @returns `true` if at least one property has a non-null and non-undefined value, otherwise `false`.
|
|
1127
|
+
*
|
|
1128
|
+
* @example
|
|
1129
|
+
* const testObj = { a: null, b: { b1: null, b2: undefined } };
|
|
1130
|
+
* console.log(hasNonNullValue(testObj)); // Output: false
|
|
1131
|
+
*
|
|
1132
|
+
* const testObj2 = { a: 1, b: { b1: null, b2: undefined } };
|
|
1133
|
+
* console.log(hasNonNullValue(testObj2)); // Output: true
|
|
1134
|
+
*/
|
|
1135
|
+
declare function hasNonNullValue(obj: Record<string, any>): boolean;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* 'JsonPointer' class
|
|
1139
|
+
*
|
|
1140
|
+
* Some utilities for using JSON Pointers with JSON objects
|
|
1141
|
+
* https://tools.ietf.org/html/rfc6901
|
|
1142
|
+
*
|
|
1143
|
+
* get, getCopy, getFirst, set, setCopy, insert, insertCopy, remove, has, dict,
|
|
1144
|
+
* forEachDeep, forEachDeepCopy, escape, unescape, parse, compile, toKey,
|
|
1145
|
+
* isJsonPointer, isSubPointer, toIndexedPointer, toGenericPointer,
|
|
1146
|
+
* toControlPointer, toSchemaPointer, toDataPointer, parseObjectPath
|
|
1147
|
+
*
|
|
1148
|
+
* Some functions based on manuelstofer's json-pointer utilities
|
|
1149
|
+
* https://github.com/manuelstofer/json-pointer
|
|
1150
|
+
*/
|
|
1151
|
+
type Pointer = string | string[];
|
|
1152
|
+
declare class JsonPointer {
|
|
1153
|
+
/**
|
|
1154
|
+
* 'get' function
|
|
1155
|
+
*
|
|
1156
|
+
* Uses a JSON Pointer to retrieve a value from an object.
|
|
1157
|
+
*
|
|
1158
|
+
* // { object } object - Object to get value from
|
|
1159
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1160
|
+
* // { number = 0 } startSlice - Zero-based index of first Pointer key to use
|
|
1161
|
+
* // { number } endSlice - Zero-based index of last Pointer key to use
|
|
1162
|
+
* // { boolean = false } getBoolean - Return only true or false?
|
|
1163
|
+
* // { boolean = false } errors - Show error if not found?
|
|
1164
|
+
* // { object } - Located value (or true or false if getBoolean = true)
|
|
1165
|
+
*/
|
|
1166
|
+
static get(object: any, pointer: any, startSlice?: number, endSlice?: number, getBoolean?: boolean, errors?: boolean): any;
|
|
1167
|
+
private static logErrors;
|
|
1168
|
+
/**
|
|
1169
|
+
* Evaluates conditional expression in form of `model.<property>==<value>` or
|
|
1170
|
+
* `model.<property>!=<value>` where the first one means that the value must match to be
|
|
1171
|
+
* shown in a form, while the former shows the property only when the property value is not
|
|
1172
|
+
* set, or does not equal the given value.
|
|
1173
|
+
*
|
|
1174
|
+
* // { subObject } subObject - an object containing the data values of properties
|
|
1175
|
+
* // { key } key - the key from the for loop in a form of `<property>==<value>`
|
|
1176
|
+
*
|
|
1177
|
+
* Returns the object with two properties. The property passed informs whether
|
|
1178
|
+
* the expression evaluated successfully and the property key returns either the same
|
|
1179
|
+
* key if it is not contained inside the subObject or the key of the property if it is contained.
|
|
1180
|
+
*/
|
|
1181
|
+
static evaluateExpression(subObject: Object, key: any): any;
|
|
1182
|
+
/**
|
|
1183
|
+
* Performs the actual evaluation on the given expression with given values and keys.
|
|
1184
|
+
* // { cleanedValue } cleanedValue - the given valued cleaned of quotes if it had any
|
|
1185
|
+
* // { subObject } subObject - the object with properties values
|
|
1186
|
+
* // { keysAndExpression } keysAndExpression - an object holding the expressions with
|
|
1187
|
+
*/
|
|
1188
|
+
private static performExpressionOnValue;
|
|
1189
|
+
private static doComparisonByExpressionType;
|
|
1190
|
+
/**
|
|
1191
|
+
* Does the checks when the parsed key is actually no a property inside subObject.
|
|
1192
|
+
* That would mean that the equal comparison makes no sense and thus the negative result
|
|
1193
|
+
* is returned, and the not equal comparison is not necessary because it doesn't equal
|
|
1194
|
+
* obviously. Returns null when the given key is a real property inside the subObject.
|
|
1195
|
+
* // { subObject } subObject - the object with properties values
|
|
1196
|
+
* // { keysAndExpression } keysAndExpression - an object holding the expressions with
|
|
1197
|
+
* the associated keys.
|
|
1198
|
+
*/
|
|
1199
|
+
private static doOwnCheckResult;
|
|
1200
|
+
/**
|
|
1201
|
+
* Does the basic checks and tries to parse an expression and a pair
|
|
1202
|
+
* of key and value.
|
|
1203
|
+
* // { key } key - the original for loop created value containing key and value in one string
|
|
1204
|
+
* // { subObject } subObject - the object with properties values
|
|
1205
|
+
*/
|
|
1206
|
+
private static parseKeysAndExpression;
|
|
1207
|
+
private static keyOrSubObjEmpty;
|
|
1208
|
+
/**
|
|
1209
|
+
* 'getCopy' function
|
|
1210
|
+
*
|
|
1211
|
+
* Uses a JSON Pointer to deeply clone a value from an object.
|
|
1212
|
+
*
|
|
1213
|
+
* // { object } object - Object to get value from
|
|
1214
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1215
|
+
* // { number = 0 } startSlice - Zero-based index of first Pointer key to use
|
|
1216
|
+
* // { number } endSlice - Zero-based index of last Pointer key to use
|
|
1217
|
+
* // { boolean = false } getBoolean - Return only true or false?
|
|
1218
|
+
* // { boolean = false } errors - Show error if not found?
|
|
1219
|
+
* // { object } - Located value (or true or false if getBoolean = true)
|
|
1220
|
+
*/
|
|
1221
|
+
static getCopy(object: any, pointer: any, startSlice?: number, endSlice?: number, getBoolean?: boolean, errors?: boolean): any;
|
|
1222
|
+
/**
|
|
1223
|
+
* 'getFirst' function
|
|
1224
|
+
*
|
|
1225
|
+
* Takes an array of JSON Pointers and objects,
|
|
1226
|
+
* checks each object for a value specified by the pointer,
|
|
1227
|
+
* and returns the first value found.
|
|
1228
|
+
*
|
|
1229
|
+
* // { [object, pointer][] } items - Array of objects and pointers to check
|
|
1230
|
+
* // { any = null } defaultValue - Value to return if nothing found
|
|
1231
|
+
* // { boolean = false } getCopy - Return a copy instead?
|
|
1232
|
+
* // - First value found
|
|
1233
|
+
*/
|
|
1234
|
+
static getFirst(items: any, defaultValue?: any, getCopy?: boolean): any;
|
|
1235
|
+
/**
|
|
1236
|
+
* 'getFirstCopy' function
|
|
1237
|
+
*
|
|
1238
|
+
* Similar to getFirst, but always returns a copy.
|
|
1239
|
+
*
|
|
1240
|
+
* // { [object, pointer][] } items - Array of objects and pointers to check
|
|
1241
|
+
* // { any = null } defaultValue - Value to return if nothing found
|
|
1242
|
+
* // - Copy of first value found
|
|
1243
|
+
*/
|
|
1244
|
+
static getFirstCopy(items: any, defaultValue?: any): any;
|
|
1245
|
+
/**
|
|
1246
|
+
* 'set' function
|
|
1247
|
+
*
|
|
1248
|
+
* Uses a JSON Pointer to set a value on an object.
|
|
1249
|
+
* Also creates any missing sub objects or arrays to contain that value.
|
|
1250
|
+
*
|
|
1251
|
+
* If the optional fourth parameter is TRUE and the inner-most container
|
|
1252
|
+
* is an array, the function will insert the value as a new item at the
|
|
1253
|
+
* specified location in the array, rather than overwriting the existing
|
|
1254
|
+
* value (if any) at that location.
|
|
1255
|
+
*
|
|
1256
|
+
* So set([1, 2, 3], '/1', 4) => [1, 4, 3]
|
|
1257
|
+
* and
|
|
1258
|
+
* So set([1, 2, 3], '/1', 4, true) => [1, 4, 2, 3]
|
|
1259
|
+
*
|
|
1260
|
+
* // { object } object - The object to set value in
|
|
1261
|
+
* // { Pointer } pointer - The JSON Pointer (string or array)
|
|
1262
|
+
* // value - The new value to set
|
|
1263
|
+
* // { boolean } insert - insert value?
|
|
1264
|
+
* // { object } - The original object, modified with the set value
|
|
1265
|
+
*/
|
|
1266
|
+
static set(object: any, pointer: any, value: any, insert?: boolean): any;
|
|
1267
|
+
/**
|
|
1268
|
+
* 'setCopy' function
|
|
1269
|
+
*
|
|
1270
|
+
* Copies an object and uses a JSON Pointer to set a value on the copy.
|
|
1271
|
+
* Also creates any missing sub objects or arrays to contain that value.
|
|
1272
|
+
*
|
|
1273
|
+
* If the optional fourth parameter is TRUE and the inner-most container
|
|
1274
|
+
* is an array, the function will insert the value as a new item at the
|
|
1275
|
+
* specified location in the array, rather than overwriting the existing value.
|
|
1276
|
+
*
|
|
1277
|
+
* // { object } object - The object to copy and set value in
|
|
1278
|
+
* // { Pointer } pointer - The JSON Pointer (string or array)
|
|
1279
|
+
* // value - The value to set
|
|
1280
|
+
* // { boolean } insert - insert value?
|
|
1281
|
+
* // { object } - The new object with the set value
|
|
1282
|
+
*/
|
|
1283
|
+
static setCopy(object: any, pointer: any, value: any, insert?: boolean): any;
|
|
1284
|
+
/**
|
|
1285
|
+
* 'insert' function
|
|
1286
|
+
*
|
|
1287
|
+
* Calls 'set' with insert = TRUE
|
|
1288
|
+
*
|
|
1289
|
+
* // { object } object - object to insert value in
|
|
1290
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1291
|
+
* // value - value to insert
|
|
1292
|
+
* // { object }
|
|
1293
|
+
*/
|
|
1294
|
+
static insert(object: any, pointer: any, value: any): any;
|
|
1295
|
+
/**
|
|
1296
|
+
* 'insertCopy' function
|
|
1297
|
+
*
|
|
1298
|
+
* Calls 'setCopy' with insert = TRUE
|
|
1299
|
+
*
|
|
1300
|
+
* // { object } object - object to insert value in
|
|
1301
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1302
|
+
* // value - value to insert
|
|
1303
|
+
* // { object }
|
|
1304
|
+
*/
|
|
1305
|
+
static insertCopy(object: any, pointer: any, value: any): any;
|
|
1306
|
+
/**
|
|
1307
|
+
* 'remove' function
|
|
1308
|
+
*
|
|
1309
|
+
* Uses a JSON Pointer to remove a key and its attribute from an object
|
|
1310
|
+
*
|
|
1311
|
+
* // { object } object - object to delete attribute from
|
|
1312
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1313
|
+
* // { object }
|
|
1314
|
+
*/
|
|
1315
|
+
static remove(object: any, pointer: any): any;
|
|
1316
|
+
/**
|
|
1317
|
+
* 'has' function
|
|
1318
|
+
*
|
|
1319
|
+
* Tests if an object has a value at the location specified by a JSON Pointer
|
|
1320
|
+
*
|
|
1321
|
+
* // { object } object - object to chek for value
|
|
1322
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1323
|
+
* // { boolean }
|
|
1324
|
+
*/
|
|
1325
|
+
static has(object: any, pointer: any): any;
|
|
1326
|
+
/**
|
|
1327
|
+
* 'dict' function
|
|
1328
|
+
*
|
|
1329
|
+
* Returns a (pointer -> value) dictionary for an object
|
|
1330
|
+
*
|
|
1331
|
+
* // { object } object - The object to create a dictionary from
|
|
1332
|
+
* // { object } - The resulting dictionary object
|
|
1333
|
+
*/
|
|
1334
|
+
static dict(object: any): any;
|
|
1335
|
+
/**
|
|
1336
|
+
* 'forEachDeep' function
|
|
1337
|
+
*
|
|
1338
|
+
* Iterates over own enumerable properties of an object or items in an array
|
|
1339
|
+
* and invokes an iteratee function for each key/value or index/value pair.
|
|
1340
|
+
* By default, iterates over items within objects and arrays after calling
|
|
1341
|
+
* the iteratee function on the containing object or array itself.
|
|
1342
|
+
*
|
|
1343
|
+
* The iteratee is invoked with three arguments: (value, pointer, rootObject),
|
|
1344
|
+
* where pointer is a JSON pointer indicating the location of the current
|
|
1345
|
+
* value within the root object, and rootObject is the root object initially
|
|
1346
|
+
* submitted to th function.
|
|
1347
|
+
*
|
|
1348
|
+
* If a third optional parameter 'bottomUp' is set to TRUE, the iterator
|
|
1349
|
+
* function will be called on sub-objects and arrays after being
|
|
1350
|
+
* called on their contents, rather than before, which is the default.
|
|
1351
|
+
*
|
|
1352
|
+
* This function can also optionally be called directly on a sub-object by
|
|
1353
|
+
* including optional 4th and 5th parameterss to specify the initial
|
|
1354
|
+
* root object and pointer.
|
|
1355
|
+
*
|
|
1356
|
+
* // { object } object - the initial object or array
|
|
1357
|
+
* // { (v: any, p?: string, o?: any) => any } function - iteratee function
|
|
1358
|
+
* // { boolean = false } bottomUp - optional, set to TRUE to reverse direction
|
|
1359
|
+
* // { object = object } rootObject - optional, root object or array
|
|
1360
|
+
* // { string = '' } pointer - optional, JSON Pointer to object within rootObject
|
|
1361
|
+
* // { object } - The modified object
|
|
1362
|
+
*/
|
|
1363
|
+
static forEachDeep(object: any, fn?: (v: any, p?: string, o?: any) => any, bottomUp?: boolean, pointer?: string, rootObject?: any): void;
|
|
1364
|
+
/**
|
|
1365
|
+
* 'forEachDeepCopy' function
|
|
1366
|
+
*
|
|
1367
|
+
* Similar to forEachDeep, but returns a copy of the original object, with
|
|
1368
|
+
* the same keys and indexes, but with values replaced with the result of
|
|
1369
|
+
* the iteratee function.
|
|
1370
|
+
*
|
|
1371
|
+
* // { object } object - the initial object or array
|
|
1372
|
+
* // { (v: any, k?: string, o?: any, p?: any) => any } function - iteratee function
|
|
1373
|
+
* // { boolean = false } bottomUp - optional, set to TRUE to reverse direction
|
|
1374
|
+
* // { object = object } rootObject - optional, root object or array
|
|
1375
|
+
* // { string = '' } pointer - optional, JSON Pointer to object within rootObject
|
|
1376
|
+
* // { object } - The copied object
|
|
1377
|
+
*/
|
|
1378
|
+
static forEachDeepCopy(object: any, fn?: (v: any, p?: string, o?: any) => any, bottomUp?: boolean, pointer?: string, rootObject?: any): any;
|
|
1379
|
+
/**
|
|
1380
|
+
* 'escape' function
|
|
1381
|
+
*
|
|
1382
|
+
* Escapes a string reference key
|
|
1383
|
+
*
|
|
1384
|
+
* // { string } key - string key to escape
|
|
1385
|
+
* // { string } - escaped key
|
|
1386
|
+
*/
|
|
1387
|
+
static escape(key: any): any;
|
|
1388
|
+
/**
|
|
1389
|
+
* 'unescape' function
|
|
1390
|
+
*
|
|
1391
|
+
* Unescapes a string reference key
|
|
1392
|
+
*
|
|
1393
|
+
* // { string } key - string key to unescape
|
|
1394
|
+
* // { string } - unescaped key
|
|
1395
|
+
*/
|
|
1396
|
+
static unescape(key: any): any;
|
|
1397
|
+
/**
|
|
1398
|
+
* 'parse' function
|
|
1399
|
+
*
|
|
1400
|
+
* Converts a string JSON Pointer into a array of keys
|
|
1401
|
+
* (if input is already an an array of keys, it is returned unchanged)
|
|
1402
|
+
*
|
|
1403
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1404
|
+
* // { boolean = false } errors - Show error if invalid pointer?
|
|
1405
|
+
* // { string[] } - JSON Pointer array of keys
|
|
1406
|
+
*/
|
|
1407
|
+
static parse(pointer: any, errors?: boolean): any[];
|
|
1408
|
+
/**
|
|
1409
|
+
* 'compile' function
|
|
1410
|
+
*
|
|
1411
|
+
* Converts an array of keys into a JSON Pointer string
|
|
1412
|
+
* (if input is already a string, it is normalized and returned)
|
|
1413
|
+
*
|
|
1414
|
+
* The optional second parameter is a default which will replace any empty keys.
|
|
1415
|
+
*
|
|
1416
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1417
|
+
* // { string | number = '' } defaultValue - Default value
|
|
1418
|
+
* // { boolean = false } errors - Show error if invalid pointer?
|
|
1419
|
+
* // { string } - JSON Pointer string
|
|
1420
|
+
*/
|
|
1421
|
+
static compile(pointer: any, defaultValue?: string, errors?: boolean): any;
|
|
1422
|
+
/**
|
|
1423
|
+
* 'toKey' function
|
|
1424
|
+
*
|
|
1425
|
+
* Extracts name of the final key from a JSON Pointer.
|
|
1426
|
+
*
|
|
1427
|
+
* // { Pointer } pointer - JSON Pointer (string or array)
|
|
1428
|
+
* // { boolean = false } errors - Show error if invalid pointer?
|
|
1429
|
+
* // { string } - the extracted key
|
|
1430
|
+
*/
|
|
1431
|
+
static toKey(pointer: any, errors?: boolean): any;
|
|
1432
|
+
/**
|
|
1433
|
+
* 'isJsonPointer' function
|
|
1434
|
+
*
|
|
1435
|
+
* Checks a string or array value to determine if it is a valid JSON Pointer.
|
|
1436
|
+
* Returns true if a string is empty, or starts with '/' or '#/'.
|
|
1437
|
+
* Returns true if an array contains only string values.
|
|
1438
|
+
*
|
|
1439
|
+
* // value - value to check
|
|
1440
|
+
* // { boolean } - true if value is a valid JSON Pointer, otherwise false
|
|
1441
|
+
*/
|
|
1442
|
+
static isJsonPointer(value: any): any;
|
|
1443
|
+
/**
|
|
1444
|
+
* 'isSubPointer' function
|
|
1445
|
+
*
|
|
1446
|
+
* Checks whether one JSON Pointer is a subset of another.
|
|
1447
|
+
*
|
|
1448
|
+
* // { Pointer } shortPointer - potential subset JSON Pointer
|
|
1449
|
+
* // { Pointer } longPointer - potential superset JSON Pointer
|
|
1450
|
+
* // { boolean = false } trueIfMatching - return true if pointers match?
|
|
1451
|
+
* // { boolean = false } errors - Show error if invalid pointer?
|
|
1452
|
+
* // { boolean } - true if shortPointer is a subset of longPointer, false if not
|
|
1453
|
+
*/
|
|
1454
|
+
static isSubPointer(shortPointer: any, longPointer: any, trueIfMatching?: boolean, errors?: boolean): boolean;
|
|
1455
|
+
/**
|
|
1456
|
+
* 'toIndexedPointer' function
|
|
1457
|
+
*
|
|
1458
|
+
* Merges an array of numeric indexes and a generic pointer to create an
|
|
1459
|
+
* indexed pointer for a specific item.
|
|
1460
|
+
*
|
|
1461
|
+
* For example, merging the generic pointer '/foo/-/bar/-/baz' and
|
|
1462
|
+
* the array [4, 2] would result in the indexed pointer '/foo/4/bar/2/baz'
|
|
1463
|
+
*
|
|
1464
|
+
*
|
|
1465
|
+
* // { Pointer } genericPointer - The generic pointer
|
|
1466
|
+
* // { number[] } indexArray - The array of numeric indexes
|
|
1467
|
+
* // { Map<string, number> } arrayMap - An optional array map
|
|
1468
|
+
* // { string } - The merged pointer with indexes
|
|
1469
|
+
*/
|
|
1470
|
+
static toIndexedPointer(genericPointer: any, indexArray: any, arrayMap?: Map<string, number>): any;
|
|
1471
|
+
/**
|
|
1472
|
+
* 'toGenericPointer' function
|
|
1473
|
+
*
|
|
1474
|
+
* Compares an indexed pointer to an array map and removes list array
|
|
1475
|
+
* indexes (but leaves tuple arrray indexes and all object keys, including
|
|
1476
|
+
* numeric keys) to create a generic pointer.
|
|
1477
|
+
*
|
|
1478
|
+
* For example, using the indexed pointer '/foo/1/bar/2/baz/3' and
|
|
1479
|
+
* the arrayMap [['/foo', 0], ['/foo/-/bar', 3], ['/foo/-/bar/-/baz', 0]]
|
|
1480
|
+
* would result in the generic pointer '/foo/-/bar/2/baz/-'
|
|
1481
|
+
* Using the indexed pointer '/foo/1/bar/4/baz/3' and the same arrayMap
|
|
1482
|
+
* would result in the generic pointer '/foo/-/bar/-/baz/-'
|
|
1483
|
+
* (the bar array has 3 tuple items, so index 2 is retained, but 4 is removed)
|
|
1484
|
+
*
|
|
1485
|
+
* The structure of the arrayMap is: [['path to array', number of tuple items]...]
|
|
1486
|
+
*
|
|
1487
|
+
*
|
|
1488
|
+
* // { Pointer } indexedPointer - The indexed pointer (array or string)
|
|
1489
|
+
* // { Map<string, number> } arrayMap - The optional array map (for preserving tuple indexes)
|
|
1490
|
+
* // { string } - The generic pointer with indexes removed
|
|
1491
|
+
*/
|
|
1492
|
+
static toGenericPointer(indexedPointer: any, arrayMap?: Map<string, number>): any;
|
|
1493
|
+
/**
|
|
1494
|
+
* 'toControlPointer' function
|
|
1495
|
+
*
|
|
1496
|
+
* Accepts a JSON Pointer for a data object and returns a JSON Pointer for the
|
|
1497
|
+
* matching control in an Angular FormGroup.
|
|
1498
|
+
*
|
|
1499
|
+
* // { Pointer } dataPointer - JSON Pointer (string or array) to a data object
|
|
1500
|
+
* // { FormGroup } formGroup - Angular FormGroup to get value from
|
|
1501
|
+
* // { boolean = false } controlMustExist - Only return if control exists?
|
|
1502
|
+
* // { Pointer } - JSON Pointer (string) to the formGroup object
|
|
1503
|
+
*/
|
|
1504
|
+
static toControlPointer(dataPointer: any, formGroup: any, controlMustExist?: boolean): any;
|
|
1505
|
+
/**
|
|
1506
|
+
* 'toSchemaPointer' function
|
|
1507
|
+
*
|
|
1508
|
+
* Accepts a JSON Pointer to a value inside a data object and a JSON schema
|
|
1509
|
+
* for that object.
|
|
1510
|
+
*
|
|
1511
|
+
* Returns a Pointer to the sub-schema for the value inside the object's schema.
|
|
1512
|
+
*
|
|
1513
|
+
* // { Pointer } dataPointer - JSON Pointer (string or array) to an object
|
|
1514
|
+
* // schema - JSON schema for the object
|
|
1515
|
+
* // { Pointer } - JSON Pointer (string) to the object's schema
|
|
1516
|
+
*/
|
|
1517
|
+
static toSchemaPointer(dataPointer: any, schema: any): any;
|
|
1518
|
+
/**
|
|
1519
|
+
* 'toDataPointer' function
|
|
1520
|
+
*
|
|
1521
|
+
* Accepts a JSON Pointer to a sub-schema inside a JSON schema and the schema.
|
|
1522
|
+
*
|
|
1523
|
+
* If possible, returns a generic Pointer to the corresponding value inside
|
|
1524
|
+
* the data object described by the JSON schema.
|
|
1525
|
+
*
|
|
1526
|
+
* Returns null if the sub-schema is in an ambiguous location (such as
|
|
1527
|
+
* definitions or additionalProperties) where the corresponding value
|
|
1528
|
+
* location cannot be determined.
|
|
1529
|
+
*
|
|
1530
|
+
* // { Pointer } schemaPointer - JSON Pointer (string or array) to a JSON schema
|
|
1531
|
+
* // schema - the JSON schema
|
|
1532
|
+
* // { boolean = false } errors - Show errors?
|
|
1533
|
+
* // { Pointer } - JSON Pointer (string) to the value in the data object
|
|
1534
|
+
*/
|
|
1535
|
+
static toDataPointer(schemaPointer: any, schema: any, errors?: boolean): any;
|
|
1536
|
+
/**
|
|
1537
|
+
* 'parseObjectPath' function
|
|
1538
|
+
*
|
|
1539
|
+
* Parses a JavaScript object path into an array of keys, which
|
|
1540
|
+
* can then be passed to compile() to convert into a string JSON Pointer.
|
|
1541
|
+
*
|
|
1542
|
+
* Based on mike-marcacci's excellent objectpath parse function:
|
|
1543
|
+
* https://github.com/mike-marcacci/objectpath
|
|
1544
|
+
*
|
|
1545
|
+
* // { Pointer } path - The object path to parse
|
|
1546
|
+
* // { string[] } - The resulting array of keys
|
|
1547
|
+
*/
|
|
1548
|
+
static parseObjectPath(path: any): any[];
|
|
1549
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<JsonPointer, never>;
|
|
1550
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<JsonPointer>;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
type JsonSchemaFormatNames = 'date' | 'time' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'uri-template' | 'url' | 'uuid' | 'color' | 'json-pointer' | 'relative-json-pointer' | 'duration' | 'regex';
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* 'JsonValidators' class
|
|
1557
|
+
*
|
|
1558
|
+
* Provides an extended set of validators to be used by form controls,
|
|
1559
|
+
* compatible with standard JSON Schema validation options.
|
|
1560
|
+
* http://json-schema.org/latest/json-schema-validation.html
|
|
1561
|
+
*
|
|
1562
|
+
* Note: This library is designed as a drop-in replacement for the Angular
|
|
1563
|
+
* Validators library, and except for one small breaking change to the 'pattern'
|
|
1564
|
+
* validator (described below) it can even be imported as a substitute, like so:
|
|
1565
|
+
*
|
|
1566
|
+
* import { JsonValidators as Validators } from 'json-validators';
|
|
1567
|
+
*
|
|
1568
|
+
* and it should work with existing code as a complete replacement.
|
|
1569
|
+
*
|
|
1570
|
+
* The one exception is the 'pattern' validator, which has been changed to
|
|
1571
|
+
* matche partial values by default (the standard 'pattern' validator wrapped
|
|
1572
|
+
* all patterns in '^' and '$', forcing them to always match an entire value).
|
|
1573
|
+
* However, the old behavior can be restored by simply adding '^' and '$'
|
|
1574
|
+
* around your patterns, or by passing an optional second parameter of TRUE.
|
|
1575
|
+
* This change is to make the 'pattern' validator match the behavior of a
|
|
1576
|
+
* JSON Schema pattern, which allows partial matches, rather than the behavior
|
|
1577
|
+
* of an HTML input control pattern, which does not.
|
|
1578
|
+
*
|
|
1579
|
+
* This library replaces Angular's validators and combination functions
|
|
1580
|
+
* with the following validators and transformation functions:
|
|
1581
|
+
*
|
|
1582
|
+
* Validators:
|
|
1583
|
+
* For all formControls: required (*), type, enum, const
|
|
1584
|
+
* For text formControls: minLength (*), maxLength (*), pattern (*), format
|
|
1585
|
+
* For numeric formControls: maximum, exclusiveMaximum,
|
|
1586
|
+
* minimum, exclusiveMinimum, multipleOf
|
|
1587
|
+
* For formGroup objects: minProperties, maxProperties, dependencies
|
|
1588
|
+
* For formArray arrays: minItems, maxItems, uniqueItems, contains
|
|
1589
|
+
* Not used by JSON Schema: min (*), max (*), requiredTrue (*), email (*)
|
|
1590
|
+
* (Validators originally included with Angular are maked with (*).)
|
|
1591
|
+
*
|
|
1592
|
+
* NOTE / TODO: The dependencies validator is not complete.
|
|
1593
|
+
* NOTE / TODO: The contains validator is not complete.
|
|
1594
|
+
*
|
|
1595
|
+
* Validators not used by JSON Schema (but included for compatibility)
|
|
1596
|
+
* and their JSON Schema equivalents:
|
|
1597
|
+
*
|
|
1598
|
+
* Angular validator | JSON Schema equivalent
|
|
1599
|
+
* ------------------|-----------------------
|
|
1600
|
+
* min(number) | minimum(number)
|
|
1601
|
+
* max(number) | maximum(number)
|
|
1602
|
+
* requiredTrue() | const(true)
|
|
1603
|
+
* email() | format('email')
|
|
1604
|
+
*
|
|
1605
|
+
* Validator transformation functions:
|
|
1606
|
+
* composeAnyOf, composeOneOf, composeAllOf, composeNot
|
|
1607
|
+
* (Angular's original combination funciton, 'compose', is also included for
|
|
1608
|
+
* backward compatibility, though it is functionally equivalent to composeAllOf,
|
|
1609
|
+
* asside from its more generic error message.)
|
|
1610
|
+
*
|
|
1611
|
+
* All validators have also been extended to accept an optional second argument
|
|
1612
|
+
* which, if passed a TRUE value, causes the validator to perform the opposite
|
|
1613
|
+
* of its original finction. (This is used internally to enable 'not' and
|
|
1614
|
+
* 'composeOneOf' to function and return useful error messages.)
|
|
1615
|
+
*
|
|
1616
|
+
* The 'required' validator has also been overloaded so that if called with
|
|
1617
|
+
* a boolean parameter (or no parameters) it returns the original validator
|
|
1618
|
+
* function (rather than executing it). However, if it is called with an
|
|
1619
|
+
* AbstractControl parameter (as was previously required), it behaves
|
|
1620
|
+
* exactly as before.
|
|
1621
|
+
*
|
|
1622
|
+
* This enables all validators (including 'required') to be constructed in
|
|
1623
|
+
* exactly the same way, so they can be automatically applied using the
|
|
1624
|
+
* equivalent key names and values taken directly from a JSON Schema.
|
|
1625
|
+
*
|
|
1626
|
+
* This source code is partially derived from Angular,
|
|
1627
|
+
* which is Copyright (c) 2014-2017 Google, Inc.
|
|
1628
|
+
* Use of this source code is therefore governed by the same MIT-style license
|
|
1629
|
+
* that can be found in the LICENSE file at https://angular.io/license
|
|
1630
|
+
*
|
|
1631
|
+
* Original Angular Validators:
|
|
1632
|
+
* https://github.com/angular/angular/blob/master/packages/forms/src/validators.ts
|
|
1633
|
+
*/
|
|
1634
|
+
declare class JsonValidators {
|
|
1635
|
+
/**
|
|
1636
|
+
* Validator functions:
|
|
1637
|
+
*
|
|
1638
|
+
* For all formControls: required, type, enum, const
|
|
1639
|
+
* For text formControls: minLength, maxLength, pattern, format
|
|
1640
|
+
* For numeric formControls: maximum, exclusiveMaximum,
|
|
1641
|
+
* minimum, exclusiveMinimum, multipleOf
|
|
1642
|
+
* For formGroup objects: minProperties, maxProperties, dependencies
|
|
1643
|
+
* For formArray arrays: minItems, maxItems, uniqueItems, contains
|
|
1644
|
+
*
|
|
1645
|
+
* TODO: finish dependencies validator
|
|
1646
|
+
*/
|
|
1647
|
+
/**
|
|
1648
|
+
* 'required' validator
|
|
1649
|
+
*
|
|
1650
|
+
* This validator is overloaded, compared to the default required validator.
|
|
1651
|
+
* If called with no parameters, or TRUE, this validator returns the
|
|
1652
|
+
* 'required' validator function (rather than executing it). This matches
|
|
1653
|
+
* the behavior of all other validators in this library.
|
|
1654
|
+
*
|
|
1655
|
+
* If this validator is called with an AbstractControl parameter
|
|
1656
|
+
* (as was previously required) it behaves the same as Angular's default
|
|
1657
|
+
* required validator, and returns an error if the control is empty.
|
|
1658
|
+
*
|
|
1659
|
+
* Old behavior: (if input type = AbstractControl)
|
|
1660
|
+
* // {AbstractControl} control - required control
|
|
1661
|
+
* // {{[key: string]: boolean}} - returns error message if no input
|
|
1662
|
+
*
|
|
1663
|
+
* New behavior: (if no input, or input type = boolean)
|
|
1664
|
+
* // {boolean = true} required? - true to validate, false to disable
|
|
1665
|
+
* // {IValidatorFn} - returns the 'required' validator function itself
|
|
1666
|
+
*/
|
|
1667
|
+
static required(input: AbstractControl): ValidationErrors | null;
|
|
1668
|
+
static required(input?: boolean): IValidatorFn;
|
|
1669
|
+
/**
|
|
1670
|
+
* 'type' validator
|
|
1671
|
+
*
|
|
1672
|
+
* Requires a control to only accept values of a specified type,
|
|
1673
|
+
* or one of an array of types.
|
|
1674
|
+
*
|
|
1675
|
+
* Note: SchemaPrimitiveType = 'string'|'number'|'integer'|'boolean'|'null'
|
|
1676
|
+
*
|
|
1677
|
+
* // {SchemaPrimitiveType|SchemaPrimitiveType[]} type - type(s) to accept
|
|
1678
|
+
* // {IValidatorFn}
|
|
1679
|
+
*/
|
|
1680
|
+
static type(requiredType: SchemaPrimitiveType | SchemaPrimitiveType[]): IValidatorFn;
|
|
1681
|
+
/**
|
|
1682
|
+
* 'enum' validator
|
|
1683
|
+
*
|
|
1684
|
+
* Requires a control to have a value from an enumerated list of values.
|
|
1685
|
+
*
|
|
1686
|
+
* Converts types as needed to allow string inputs to still correctly
|
|
1687
|
+
* match number, boolean, and null enum values.
|
|
1688
|
+
*
|
|
1689
|
+
* // {any[]} allowedValues - array of acceptable values
|
|
1690
|
+
* // {IValidatorFn}
|
|
1691
|
+
*/
|
|
1692
|
+
static enum(allowedValues: any[]): IValidatorFn;
|
|
1693
|
+
/**
|
|
1694
|
+
* 'const' validator
|
|
1695
|
+
*
|
|
1696
|
+
* Requires a control to have a specific value.
|
|
1697
|
+
*
|
|
1698
|
+
* Converts types as needed to allow string inputs to still correctly
|
|
1699
|
+
* match number, boolean, and null values.
|
|
1700
|
+
*
|
|
1701
|
+
* TODO: modify to work with objects
|
|
1702
|
+
*
|
|
1703
|
+
* // {any[]} requiredValue - required value
|
|
1704
|
+
* // {IValidatorFn}
|
|
1705
|
+
*/
|
|
1706
|
+
static const(requiredValue: any): IValidatorFn;
|
|
1707
|
+
/**
|
|
1708
|
+
* 'minLength' validator
|
|
1709
|
+
*
|
|
1710
|
+
* Requires a control's text value to be greater than a specified length.
|
|
1711
|
+
*
|
|
1712
|
+
* // {number} minimumLength - minimum allowed string length
|
|
1713
|
+
* // {boolean = false} invert - instead return error object only if valid
|
|
1714
|
+
* // {IValidatorFn}
|
|
1715
|
+
*/
|
|
1716
|
+
static minLength(minimumLength: number): IValidatorFn;
|
|
1717
|
+
/**
|
|
1718
|
+
* 'maxLength' validator
|
|
1719
|
+
*
|
|
1720
|
+
* Requires a control's text value to be less than a specified length.
|
|
1721
|
+
*
|
|
1722
|
+
* // {number} maximumLength - maximum allowed string length
|
|
1723
|
+
* // {boolean = false} invert - instead return error object only if valid
|
|
1724
|
+
* // {IValidatorFn}
|
|
1725
|
+
*/
|
|
1726
|
+
static maxLength(maximumLength: number): IValidatorFn;
|
|
1727
|
+
/**
|
|
1728
|
+
* 'pattern' validator
|
|
1729
|
+
*
|
|
1730
|
+
* Note: NOT the same as Angular's default pattern validator.
|
|
1731
|
+
*
|
|
1732
|
+
* Requires a control's value to match a specified regular expression pattern.
|
|
1733
|
+
*
|
|
1734
|
+
* This validator changes the behavior of default pattern validator
|
|
1735
|
+
* by replacing RegExp(`^${pattern}$`) with RegExp(`${pattern}`),
|
|
1736
|
+
* which allows for partial matches.
|
|
1737
|
+
*
|
|
1738
|
+
* To return to the default funcitonality, and match the entire string,
|
|
1739
|
+
* pass TRUE as the optional second parameter.
|
|
1740
|
+
*
|
|
1741
|
+
* // {string} pattern - regular expression pattern
|
|
1742
|
+
* // {boolean = false} wholeString - match whole value string?
|
|
1743
|
+
* // {IValidatorFn}
|
|
1744
|
+
*/
|
|
1745
|
+
static pattern(pattern: string | RegExp, wholeString?: boolean): IValidatorFn;
|
|
1746
|
+
/**
|
|
1747
|
+
* 'format' validator
|
|
1748
|
+
*
|
|
1749
|
+
* Requires a control to have a value of a certain format.
|
|
1750
|
+
*
|
|
1751
|
+
* This validator currently checks the following formsts:
|
|
1752
|
+
* date, time, date-time, email, hostname, ipv4, ipv6,
|
|
1753
|
+
* uri, uri-reference, uri-template, url, uuid, color,
|
|
1754
|
+
* json-pointer, relative-json-pointer,duration, regex
|
|
1755
|
+
*
|
|
1756
|
+
* Fast format regular expressions copied from AJV:
|
|
1757
|
+
* https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js
|
|
1758
|
+
*
|
|
1759
|
+
* // {JsonSchemaFormatNames} requiredFormat - format to check
|
|
1760
|
+
* // {IValidatorFn}
|
|
1761
|
+
*/
|
|
1762
|
+
static format(requiredFormat: JsonSchemaFormatNames): IValidatorFn;
|
|
1763
|
+
/**
|
|
1764
|
+
* 'minimum' validator
|
|
1765
|
+
*
|
|
1766
|
+
* Requires a control's numeric value to be greater than or equal to
|
|
1767
|
+
* a minimum amount.
|
|
1768
|
+
*
|
|
1769
|
+
* Any non-numeric value is also valid (according to the HTML forms spec,
|
|
1770
|
+
* a non-numeric value doesn't have a minimum).
|
|
1771
|
+
* https://www.w3.org/TR/html5/forms.html#attr-input-max
|
|
1772
|
+
*
|
|
1773
|
+
* // {number} minimum - minimum allowed value
|
|
1774
|
+
* // {IValidatorFn}
|
|
1775
|
+
*/
|
|
1776
|
+
static minimum(minimumValue: number): IValidatorFn;
|
|
1777
|
+
/**
|
|
1778
|
+
* 'exclusiveMinimum' validator
|
|
1779
|
+
*
|
|
1780
|
+
* Requires a control's numeric value to be less than a maximum amount.
|
|
1781
|
+
*
|
|
1782
|
+
* Any non-numeric value is also valid (according to the HTML forms spec,
|
|
1783
|
+
* a non-numeric value doesn't have a maximum).
|
|
1784
|
+
* https://www.w3.org/TR/html5/forms.html#attr-input-max
|
|
1785
|
+
*
|
|
1786
|
+
* // {number} exclusiveMinimumValue - maximum allowed value
|
|
1787
|
+
* // {IValidatorFn}
|
|
1788
|
+
*/
|
|
1789
|
+
static exclusiveMinimum(exclusiveMinimumValue: number): IValidatorFn;
|
|
1790
|
+
/**
|
|
1791
|
+
* 'maximum' validator
|
|
1792
|
+
*
|
|
1793
|
+
* Requires a control's numeric value to be less than or equal to
|
|
1794
|
+
* a maximum amount.
|
|
1795
|
+
*
|
|
1796
|
+
* Any non-numeric value is also valid (according to the HTML forms spec,
|
|
1797
|
+
* a non-numeric value doesn't have a maximum).
|
|
1798
|
+
* https://www.w3.org/TR/html5/forms.html#attr-input-max
|
|
1799
|
+
*
|
|
1800
|
+
* // {number} maximumValue - maximum allowed value
|
|
1801
|
+
* // {IValidatorFn}
|
|
1802
|
+
*/
|
|
1803
|
+
static maximum(maximumValue: number): IValidatorFn;
|
|
1804
|
+
/**
|
|
1805
|
+
* 'exclusiveMaximum' validator
|
|
1806
|
+
*
|
|
1807
|
+
* Requires a control's numeric value to be less than a maximum amount.
|
|
1808
|
+
*
|
|
1809
|
+
* Any non-numeric value is also valid (according to the HTML forms spec,
|
|
1810
|
+
* a non-numeric value doesn't have a maximum).
|
|
1811
|
+
* https://www.w3.org/TR/html5/forms.html#attr-input-max
|
|
1812
|
+
*
|
|
1813
|
+
* // {number} exclusiveMaximumValue - maximum allowed value
|
|
1814
|
+
* // {IValidatorFn}
|
|
1815
|
+
*/
|
|
1816
|
+
static exclusiveMaximum(exclusiveMaximumValue: number): IValidatorFn;
|
|
1817
|
+
/**
|
|
1818
|
+
* 'multipleOf' validator
|
|
1819
|
+
*
|
|
1820
|
+
* Requires a control to have a numeric value that is a multiple
|
|
1821
|
+
* of a specified number.
|
|
1822
|
+
*
|
|
1823
|
+
* // {number} multipleOfValue - number value must be a multiple of
|
|
1824
|
+
* // {IValidatorFn}
|
|
1825
|
+
*/
|
|
1826
|
+
static multipleOf(multipleOfValue: number): IValidatorFn;
|
|
1827
|
+
/**
|
|
1828
|
+
* 'minProperties' validator
|
|
1829
|
+
*
|
|
1830
|
+
* Requires a form group to have a minimum number of properties (i.e. have
|
|
1831
|
+
* values entered in a minimum number of controls within the group).
|
|
1832
|
+
*
|
|
1833
|
+
* // {number} minimumProperties - minimum number of properties allowed
|
|
1834
|
+
* // {IValidatorFn}
|
|
1835
|
+
*/
|
|
1836
|
+
static minProperties(minimumProperties: number): IValidatorFn;
|
|
1837
|
+
/**
|
|
1838
|
+
* 'maxProperties' validator
|
|
1839
|
+
*
|
|
1840
|
+
* Requires a form group to have a maximum number of properties (i.e. have
|
|
1841
|
+
* values entered in a maximum number of controls within the group).
|
|
1842
|
+
*
|
|
1843
|
+
* Note: Has no effect if the form group does not contain more than the
|
|
1844
|
+
* maximum number of controls.
|
|
1845
|
+
*
|
|
1846
|
+
* // {number} maximumProperties - maximum number of properties allowed
|
|
1847
|
+
* // {IValidatorFn}
|
|
1848
|
+
*/
|
|
1849
|
+
static maxProperties(maximumProperties: number): IValidatorFn;
|
|
1850
|
+
/**
|
|
1851
|
+
* 'dependencies' validator
|
|
1852
|
+
*
|
|
1853
|
+
* Requires the controls in a form group to meet additional validation
|
|
1854
|
+
* criteria, depending on the values of other controls in the group.
|
|
1855
|
+
*
|
|
1856
|
+
* Examples:
|
|
1857
|
+
* https://spacetelescope.github.io/understanding-json-schema/reference/object.html#dependencies
|
|
1858
|
+
*
|
|
1859
|
+
* // {any} dependencies - required dependencies
|
|
1860
|
+
* // {IValidatorFn}
|
|
1861
|
+
*/
|
|
1862
|
+
static dependencies(dependencies: any): IValidatorFn;
|
|
1863
|
+
/**
|
|
1864
|
+
* 'minItems' validator
|
|
1865
|
+
*
|
|
1866
|
+
* Requires a form array to have a minimum number of values.
|
|
1867
|
+
*
|
|
1868
|
+
* // {number} minimumItems - minimum number of items allowed
|
|
1869
|
+
* // {IValidatorFn}
|
|
1870
|
+
*/
|
|
1871
|
+
static minItems(minimumItems: number): IValidatorFn;
|
|
1872
|
+
/**
|
|
1873
|
+
* 'maxItems' validator
|
|
1874
|
+
*
|
|
1875
|
+
* Requires a form array to have a maximum number of values.
|
|
1876
|
+
*
|
|
1877
|
+
* // {number} maximumItems - maximum number of items allowed
|
|
1878
|
+
* // {IValidatorFn}
|
|
1879
|
+
*/
|
|
1880
|
+
static maxItems(maximumItems: number): IValidatorFn;
|
|
1881
|
+
/**
|
|
1882
|
+
* 'uniqueItems' validator
|
|
1883
|
+
*
|
|
1884
|
+
* Requires values in a form array to be unique.
|
|
1885
|
+
*
|
|
1886
|
+
* // {boolean = true} unique? - true to validate, false to disable
|
|
1887
|
+
* // {IValidatorFn}
|
|
1888
|
+
*/
|
|
1889
|
+
static uniqueItems(unique?: boolean): IValidatorFn;
|
|
1890
|
+
/**
|
|
1891
|
+
* 'contains' validator
|
|
1892
|
+
*
|
|
1893
|
+
* TODO: Complete this validator
|
|
1894
|
+
*
|
|
1895
|
+
* Requires values in a form array to be unique.
|
|
1896
|
+
*
|
|
1897
|
+
* // {boolean = true} unique? - true to validate, false to disable
|
|
1898
|
+
* // {IValidatorFn}
|
|
1899
|
+
*/
|
|
1900
|
+
static contains(requiredItem?: boolean): IValidatorFn;
|
|
1901
|
+
/**
|
|
1902
|
+
* No-op validator. Included for backward compatibility.
|
|
1903
|
+
*/
|
|
1904
|
+
static nullValidator(control: AbstractControl): ValidationErrors | null;
|
|
1905
|
+
/**
|
|
1906
|
+
* Validator transformation functions:
|
|
1907
|
+
* composeAnyOf, composeOneOf, composeAllOf, composeNot,
|
|
1908
|
+
* compose, composeAsync
|
|
1909
|
+
*
|
|
1910
|
+
* TODO: Add composeAnyOfAsync, composeOneOfAsync,
|
|
1911
|
+
* composeAllOfAsync, composeNotAsync
|
|
1912
|
+
*/
|
|
1913
|
+
/**
|
|
1914
|
+
* 'composeAnyOf' validator combination function
|
|
1915
|
+
*
|
|
1916
|
+
* Accepts an array of validators and returns a single validator that
|
|
1917
|
+
* evaluates to valid if any one or more of the submitted validators are
|
|
1918
|
+
* valid. If every validator is invalid, it returns combined errors from
|
|
1919
|
+
* all validators.
|
|
1920
|
+
*
|
|
1921
|
+
* // {IValidatorFn[]} validators - array of validators to combine
|
|
1922
|
+
* // {IValidatorFn} - single combined validator function
|
|
1923
|
+
*/
|
|
1924
|
+
static composeAnyOf(validators: IValidatorFn[]): IValidatorFn;
|
|
1925
|
+
/**
|
|
1926
|
+
* 'composeOneOf' validator combination function
|
|
1927
|
+
*
|
|
1928
|
+
* Accepts an array of validators and returns a single validator that
|
|
1929
|
+
* evaluates to valid only if exactly one of the submitted validators
|
|
1930
|
+
* is valid. Otherwise returns combined information from all validators,
|
|
1931
|
+
* both valid and invalid.
|
|
1932
|
+
*
|
|
1933
|
+
* // {IValidatorFn[]} validators - array of validators to combine
|
|
1934
|
+
* // {IValidatorFn} - single combined validator function
|
|
1935
|
+
*/
|
|
1936
|
+
static composeOneOf(validators: IValidatorFn[]): IValidatorFn;
|
|
1937
|
+
/**
|
|
1938
|
+
* 'composeAllOf' validator combination function
|
|
1939
|
+
*
|
|
1940
|
+
* Accepts an array of validators and returns a single validator that
|
|
1941
|
+
* evaluates to valid only if all the submitted validators are individually
|
|
1942
|
+
* valid. Otherwise it returns combined errors from all invalid validators.
|
|
1943
|
+
*
|
|
1944
|
+
* // {IValidatorFn[]} validators - array of validators to combine
|
|
1945
|
+
* // {IValidatorFn} - single combined validator function
|
|
1946
|
+
*/
|
|
1947
|
+
static composeAllOf(validators: IValidatorFn[]): IValidatorFn;
|
|
1948
|
+
/**
|
|
1949
|
+
* 'composeNot' validator inversion function
|
|
1950
|
+
*
|
|
1951
|
+
* Accepts a single validator function and inverts its result.
|
|
1952
|
+
* Returns valid if the submitted validator is invalid, and
|
|
1953
|
+
* returns invalid if the submitted validator is valid.
|
|
1954
|
+
* (Note: this function can itself be inverted
|
|
1955
|
+
* - e.g. composeNot(composeNot(validator)) -
|
|
1956
|
+
* but this can be confusing and is therefore not recommended.)
|
|
1957
|
+
*
|
|
1958
|
+
* // {IValidatorFn[]} validators - validator(s) to invert
|
|
1959
|
+
* // {IValidatorFn} - new validator function that returns opposite result
|
|
1960
|
+
*/
|
|
1961
|
+
static composeNot(validator: IValidatorFn): IValidatorFn;
|
|
1962
|
+
/**
|
|
1963
|
+
* 'compose' validator combination function
|
|
1964
|
+
*
|
|
1965
|
+
* // {IValidatorFn[]} validators - array of validators to combine
|
|
1966
|
+
* // {IValidatorFn} - single combined validator function
|
|
1967
|
+
*/
|
|
1968
|
+
static compose(validators: IValidatorFn[]): IValidatorFn;
|
|
1969
|
+
/**
|
|
1970
|
+
* 'composeAsync' async validator combination function
|
|
1971
|
+
*
|
|
1972
|
+
* // {AsyncIValidatorFn[]} async validators - array of async validators
|
|
1973
|
+
* // {AsyncIValidatorFn} - single combined async validator function
|
|
1974
|
+
*/
|
|
1975
|
+
static composeAsync(validators: AsyncIValidatorFn[]): AsyncIValidatorFn;
|
|
1976
|
+
/**
|
|
1977
|
+
* Validator that requires controls to have a value greater than a number.
|
|
1978
|
+
*/
|
|
1979
|
+
static min(min: number): ValidatorFn;
|
|
1980
|
+
/**
|
|
1981
|
+
* Validator that requires controls to have a value less than a number.
|
|
1982
|
+
*/
|
|
1983
|
+
static max(max: number): ValidatorFn;
|
|
1984
|
+
/**
|
|
1985
|
+
* Validator that requires control value to be true.
|
|
1986
|
+
*/
|
|
1987
|
+
static requiredTrue(control: AbstractControl): ValidationErrors | null;
|
|
1988
|
+
/**
|
|
1989
|
+
* Validator that performs email validation.
|
|
1990
|
+
*/
|
|
1991
|
+
static email(control: AbstractControl): ValidationErrors | null;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* JSON Schema function library:
|
|
1996
|
+
*
|
|
1997
|
+
* buildSchemaFromLayout: TODO: Write this function
|
|
1998
|
+
*
|
|
1999
|
+
* buildSchemaFromData:
|
|
2000
|
+
*
|
|
2001
|
+
* getFromSchema:
|
|
2002
|
+
*
|
|
2003
|
+
* removeRecursiveReferences:
|
|
2004
|
+
*
|
|
2005
|
+
* getInputType:
|
|
2006
|
+
*
|
|
2007
|
+
* checkInlineType:
|
|
2008
|
+
*
|
|
2009
|
+
* isInputRequired:
|
|
2010
|
+
*
|
|
2011
|
+
* updateInputOptions:
|
|
2012
|
+
*
|
|
2013
|
+
* getTitleMapFromOneOf:
|
|
2014
|
+
*
|
|
2015
|
+
* getControlValidators:
|
|
2016
|
+
*
|
|
2017
|
+
* resolveSchemaReferences:
|
|
2018
|
+
*
|
|
2019
|
+
* getSubSchema:
|
|
2020
|
+
*
|
|
2021
|
+
* combineAllOf:
|
|
2022
|
+
*
|
|
2023
|
+
* fixRequiredArrayProperties:
|
|
2024
|
+
*/
|
|
2025
|
+
/**
|
|
2026
|
+
* 'buildSchemaFromLayout' function
|
|
2027
|
+
*
|
|
2028
|
+
* TODO: Build a JSON Schema from a JSON Form layout
|
|
2029
|
+
*
|
|
2030
|
+
* // layout - The JSON Form layout
|
|
2031
|
+
* // - The new JSON Schema
|
|
2032
|
+
*/
|
|
2033
|
+
declare function buildSchemaFromLayout(layout: any): void;
|
|
2034
|
+
/**
|
|
2035
|
+
* 'buildSchemaFromData' function
|
|
2036
|
+
*
|
|
2037
|
+
* Build a JSON Schema from a data object
|
|
2038
|
+
*
|
|
2039
|
+
* // data - The data object
|
|
2040
|
+
* // { boolean = false } requireAllFields - Require all fields?
|
|
2041
|
+
* // { boolean = true } isRoot - is root
|
|
2042
|
+
* // - The new JSON Schema
|
|
2043
|
+
*/
|
|
2044
|
+
declare function buildSchemaFromData(data: any, requireAllFields?: boolean, isRoot?: boolean): any;
|
|
2045
|
+
/**
|
|
2046
|
+
* 'getFromSchema' function
|
|
2047
|
+
*
|
|
2048
|
+
* Uses a JSON Pointer for a value within a data object to retrieve
|
|
2049
|
+
* the schema for that value within schema for the data object.
|
|
2050
|
+
*
|
|
2051
|
+
* The optional third parameter can also be set to return something else:
|
|
2052
|
+
* 'schema' (default): the schema for the value indicated by the data pointer
|
|
2053
|
+
* 'parentSchema': the schema for the value's parent object or array
|
|
2054
|
+
* 'schemaPointer': a pointer to the value's schema within the object's schema
|
|
2055
|
+
* 'parentSchemaPointer': a pointer to the schema for the value's parent object or array
|
|
2056
|
+
*
|
|
2057
|
+
* // schema - The schema to get the sub-schema from
|
|
2058
|
+
* // { Pointer } dataPointer - JSON Pointer (string or array)
|
|
2059
|
+
* // { string = 'schema' } returnType - what to return?
|
|
2060
|
+
* // - The located sub-schema
|
|
2061
|
+
*/
|
|
2062
|
+
declare function getFromSchema(schema: any, dataPointer: any, returnType?: string): any;
|
|
2063
|
+
/**
|
|
2064
|
+
* 'removeRecursiveReferences' function
|
|
2065
|
+
*
|
|
2066
|
+
* Checks a JSON Pointer against a map of recursive references and returns
|
|
2067
|
+
* a JSON Pointer to the shallowest equivalent location in the same object.
|
|
2068
|
+
*
|
|
2069
|
+
* Using this functions enables an object to be constructed with unlimited
|
|
2070
|
+
* recursion, while maintaing a fixed set of metadata, such as field data types.
|
|
2071
|
+
* The object can grow as large as it wants, and deeply recursed nodes can
|
|
2072
|
+
* just refer to the metadata for their shallow equivalents, instead of having
|
|
2073
|
+
* to add additional redundant metadata for each recursively added node.
|
|
2074
|
+
*
|
|
2075
|
+
* Example:
|
|
2076
|
+
*
|
|
2077
|
+
* pointer: '/stuff/and/more/and/more/and/more/and/more/stuff'
|
|
2078
|
+
* recursiveRefMap: [['/stuff/and/more/and/more', '/stuff/and/more/']]
|
|
2079
|
+
* returned: '/stuff/and/more/stuff'
|
|
2080
|
+
*
|
|
2081
|
+
* // { Pointer } pointer -
|
|
2082
|
+
* // { Map<string, string> } recursiveRefMap -
|
|
2083
|
+
* // { Map<string, number> = new Map() } arrayMap - optional
|
|
2084
|
+
* // { string } -
|
|
2085
|
+
*/
|
|
2086
|
+
declare function removeRecursiveReferences(pointer: any, recursiveRefMap: any, arrayMap?: Map<any, any>): any;
|
|
2087
|
+
/**
|
|
2088
|
+
* 'getInputType' function
|
|
2089
|
+
*
|
|
2090
|
+
* // schema
|
|
2091
|
+
* // { any = null } layoutNode
|
|
2092
|
+
* // { string }
|
|
2093
|
+
*/
|
|
2094
|
+
declare function getInputType(schema: any, layoutNode?: any): any;
|
|
2095
|
+
/**
|
|
2096
|
+
* 'checkInlineType' function
|
|
2097
|
+
*
|
|
2098
|
+
* Checks layout and schema nodes for 'inline: true', and converts
|
|
2099
|
+
* 'radios' or 'checkboxes' to 'radios-inline' or 'checkboxes-inline'
|
|
2100
|
+
*
|
|
2101
|
+
* // { string } controlType -
|
|
2102
|
+
* // schema -
|
|
2103
|
+
* // { any = null } layoutNode -
|
|
2104
|
+
* // { string }
|
|
2105
|
+
*/
|
|
2106
|
+
declare function checkInlineType(controlType: any, schema: any, layoutNode?: any): any;
|
|
2107
|
+
/**
|
|
2108
|
+
* 'isInputRequired' function
|
|
2109
|
+
*
|
|
2110
|
+
* Checks a JSON Schema to see if an item is required
|
|
2111
|
+
*
|
|
2112
|
+
* // schema - the schema to check
|
|
2113
|
+
* // { string } schemaPointer - the pointer to the item to check
|
|
2114
|
+
* // { boolean } - true if the item is required, false if not
|
|
2115
|
+
*/
|
|
2116
|
+
declare function isInputRequired(schema: any, schemaPointer: any): any;
|
|
2117
|
+
/**
|
|
2118
|
+
* 'updateInputOptions' function
|
|
2119
|
+
*
|
|
2120
|
+
* // layoutNode
|
|
2121
|
+
* // schema
|
|
2122
|
+
* // jsf
|
|
2123
|
+
* // { void }
|
|
2124
|
+
*/
|
|
2125
|
+
declare function updateInputOptions(layoutNode: any, schema: any, jsf: any): void;
|
|
2126
|
+
/**
|
|
2127
|
+
* 'getTitleMapFromOneOf' function
|
|
2128
|
+
*
|
|
2129
|
+
* // { schema } schema
|
|
2130
|
+
* // { boolean = null } flatList
|
|
2131
|
+
* // { boolean = false } validateOnly
|
|
2132
|
+
* // { validators }
|
|
2133
|
+
*/
|
|
2134
|
+
declare function getTitleMapFromOneOf(schema?: any, flatList?: boolean, validateOnly?: boolean): any;
|
|
2135
|
+
/**
|
|
2136
|
+
* 'getControlValidators' function
|
|
2137
|
+
*
|
|
2138
|
+
* // schema
|
|
2139
|
+
* // { validators }
|
|
2140
|
+
*/
|
|
2141
|
+
declare function getControlValidators(schema: any): any;
|
|
2142
|
+
/**
|
|
2143
|
+
* 'resolveSchemaReferences' function
|
|
2144
|
+
*
|
|
2145
|
+
* Find all $ref links in schema and save links and referenced schemas in
|
|
2146
|
+
* schemaRefLibrary, schemaRecursiveRefMap, and dataRecursiveRefMap
|
|
2147
|
+
*
|
|
2148
|
+
* // schema
|
|
2149
|
+
* // schemaRefLibrary
|
|
2150
|
+
* // { Map<string, string> } schemaRecursiveRefMap
|
|
2151
|
+
* // { Map<string, string> } dataRecursiveRefMap
|
|
2152
|
+
* // { Map<string, number> } arrayMap
|
|
2153
|
+
* //
|
|
2154
|
+
*/
|
|
2155
|
+
declare function resolveSchemaReferences(schema: any, schemaRefLibrary: any, schemaRecursiveRefMap: any, dataRecursiveRefMap: any, arrayMap: any): any;
|
|
2156
|
+
/**
|
|
2157
|
+
* 'getSubSchema' function
|
|
2158
|
+
*
|
|
2159
|
+
* // schema
|
|
2160
|
+
* // { Pointer } pointer
|
|
2161
|
+
* // { object } schemaRefLibrary
|
|
2162
|
+
* // { Map<string, string> } schemaRecursiveRefMap
|
|
2163
|
+
* // { string[] = [] } usedPointers
|
|
2164
|
+
* //
|
|
2165
|
+
*/
|
|
2166
|
+
declare function getSubSchema(schema: any, pointer: any, schemaRefLibrary?: any, schemaRecursiveRefMap?: Map<string, string>, usedPointers?: string[]): any;
|
|
2167
|
+
/**
|
|
2168
|
+
* 'combineAllOf' function
|
|
2169
|
+
*
|
|
2170
|
+
* Attempt to convert an allOf schema object into
|
|
2171
|
+
* a non-allOf schema object with equivalent rules.
|
|
2172
|
+
*
|
|
2173
|
+
* // schema - allOf schema object
|
|
2174
|
+
* // - converted schema object
|
|
2175
|
+
*/
|
|
2176
|
+
declare function combineAllOf(schema: any): any;
|
|
2177
|
+
/**
|
|
2178
|
+
* 'fixRequiredArrayProperties' function
|
|
2179
|
+
*
|
|
2180
|
+
* Fixes an incorrectly placed required list inside an array schema, by moving
|
|
2181
|
+
* it into items.properties or additionalItems.properties, where it belongs.
|
|
2182
|
+
*
|
|
2183
|
+
* // schema - allOf schema object
|
|
2184
|
+
* // - converted schema object
|
|
2185
|
+
*/
|
|
2186
|
+
declare function fixRequiredArrayProperties(schema: any): any;
|
|
2187
|
+
|
|
2188
|
+
/**
|
|
2189
|
+
* 'convertSchemaToDraft6' function
|
|
2190
|
+
*
|
|
2191
|
+
* Converts a JSON Schema from draft 1 through 4 format to draft 6 format
|
|
2192
|
+
*
|
|
2193
|
+
* Inspired by on geraintluff's JSON Schema 3 to 4 compatibility function:
|
|
2194
|
+
* https://github.com/geraintluff/json-schema-compatibility
|
|
2195
|
+
* Also uses suggestions from AJV's JSON Schema 4 to 6 migration guide:
|
|
2196
|
+
* https://github.com/epoberezkin/ajv/releases/tag/5.0.0
|
|
2197
|
+
* And additional details from the official JSON Schema documentation:
|
|
2198
|
+
* http://json-schema.org
|
|
2199
|
+
*
|
|
2200
|
+
* // { object } originalSchema - JSON schema (draft 1, 2, 3, 4, or 6)
|
|
2201
|
+
* // { OptionObject = {} } options - options: parent schema changed?, schema draft number?
|
|
2202
|
+
* // { object } - JSON schema (draft 6)
|
|
2203
|
+
*/
|
|
2204
|
+
interface OptionObject {
|
|
2205
|
+
changed?: boolean;
|
|
2206
|
+
draft?: number;
|
|
2207
|
+
}
|
|
2208
|
+
declare function convertSchemaToDraft6(schema: any, options?: OptionObject): any;
|
|
2209
|
+
|
|
2210
|
+
/**
|
|
2211
|
+
* 'mergeSchemas' function
|
|
2212
|
+
*
|
|
2213
|
+
* Merges multiple JSON schemas into a single schema with combined rules.
|
|
2214
|
+
*
|
|
2215
|
+
* If able to logically merge properties from all schemas,
|
|
2216
|
+
* returns a single schema object containing all merged properties.
|
|
2217
|
+
*
|
|
2218
|
+
* Example: ({ a: b, max: 1 }, { c: d, max: 2 }) => { a: b, c: d, max: 1 }
|
|
2219
|
+
*
|
|
2220
|
+
* If unable to logically merge, returns an allOf schema object containing
|
|
2221
|
+
* an array of the original schemas;
|
|
2222
|
+
*
|
|
2223
|
+
* Example: ({ a: b }, { a: d }) => { allOf: [ { a: b }, { a: d } ] }
|
|
2224
|
+
*
|
|
2225
|
+
* // schemas - one or more input schemas
|
|
2226
|
+
* // - merged schema
|
|
2227
|
+
*/
|
|
2228
|
+
declare function mergeSchemas(...schemas: any[]): any;
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* path2ControlKey takes a datapointer path like /some/pointer/path
|
|
2232
|
+
* and returns something like $some$pointer$path
|
|
2233
|
+
* used mainly to convert paths so it can be used as keys in FormGroups
|
|
2234
|
+
* fot ITE scenarios
|
|
2235
|
+
* @param path
|
|
2236
|
+
* @returns string
|
|
2237
|
+
*/
|
|
2238
|
+
declare function path2ControlKey(path: string): string;
|
|
2239
|
+
/**
|
|
2240
|
+
* FormGroup function library:
|
|
2241
|
+
*
|
|
2242
|
+
* buildFormGroupTemplate: Builds a FormGroupTemplate from schema
|
|
2243
|
+
*
|
|
2244
|
+
* buildFormGroup: Builds an Angular FormGroup from a FormGroupTemplate
|
|
2245
|
+
*
|
|
2246
|
+
* mergeValues:
|
|
2247
|
+
*
|
|
2248
|
+
* setRequiredFields:
|
|
2249
|
+
*
|
|
2250
|
+
* formatFormData:
|
|
2251
|
+
*
|
|
2252
|
+
* getControl:
|
|
2253
|
+
*
|
|
2254
|
+
* ---- TODO: ----
|
|
2255
|
+
* TODO: add buildFormGroupTemplateFromLayout function
|
|
2256
|
+
* buildFormGroupTemplateFromLayout: Builds a FormGroupTemplate from a form layout
|
|
2257
|
+
*/
|
|
2258
|
+
/**
|
|
2259
|
+
* 'buildFormGroupTemplate' function
|
|
2260
|
+
*
|
|
2261
|
+
* Builds a template for an Angular FormGroup from a JSON Schema.
|
|
2262
|
+
*
|
|
2263
|
+
* TODO: add support for pattern properties
|
|
2264
|
+
* https://spacetelescope.github.io/understanding-json-schema/reference/object.html
|
|
2265
|
+
*
|
|
2266
|
+
* // {any} jsf -
|
|
2267
|
+
* // {any = null} nodeValue -
|
|
2268
|
+
* // {boolean = true} mapArrays -
|
|
2269
|
+
* // {string = ''} schemaPointer -
|
|
2270
|
+
* // {string = ''} dataPointer -
|
|
2271
|
+
* // {any = ''} templatePointer -
|
|
2272
|
+
* // {any} -
|
|
2273
|
+
*/
|
|
2274
|
+
declare function buildFormGroupTemplate(jsf: any, nodeValue?: any, setValues?: boolean, schemaPointer?: string, dataPointer?: string, templatePointer?: string): {
|
|
2275
|
+
controlType: string;
|
|
2276
|
+
controls: any;
|
|
2277
|
+
validators: any;
|
|
2278
|
+
schemaPointer: string;
|
|
2279
|
+
value?: undefined;
|
|
2280
|
+
} | {
|
|
2281
|
+
controlType: string;
|
|
2282
|
+
value: {
|
|
2283
|
+
value: any;
|
|
2284
|
+
disabled: any;
|
|
2285
|
+
};
|
|
2286
|
+
validators: any;
|
|
2287
|
+
schemaPointer: string;
|
|
2288
|
+
controls?: undefined;
|
|
2289
|
+
};
|
|
2290
|
+
/**
|
|
2291
|
+
* 'buildFormGroup' function
|
|
2292
|
+
*
|
|
2293
|
+
* // {any} template -
|
|
2294
|
+
* // {AbstractControl}
|
|
2295
|
+
*/
|
|
2296
|
+
declare function buildFormGroup(template: any): AbstractControl;
|
|
2297
|
+
/**
|
|
2298
|
+
* 'setRequiredFields' function
|
|
2299
|
+
*
|
|
2300
|
+
* // {schema} schema - JSON Schema
|
|
2301
|
+
* // {object} formControlTemplate - Form Control Template object
|
|
2302
|
+
* // {boolean} - true if any fields have been set to required, false if not
|
|
2303
|
+
*/
|
|
2304
|
+
declare function setRequiredFields(schema: any, formControlTemplate: any): boolean;
|
|
2305
|
+
/**
|
|
2306
|
+
* 'formatFormData' function
|
|
2307
|
+
*
|
|
2308
|
+
* // {any} formData - Angular FormGroup data object
|
|
2309
|
+
* // {Map<string, any>} dataMap -
|
|
2310
|
+
* // {Map<string, string>} recursiveRefMap -
|
|
2311
|
+
* // {Map<string, number>} arrayMap -
|
|
2312
|
+
* // {boolean = false} fixErrors - if TRUE, tries to fix data
|
|
2313
|
+
* // {any} - formatted data object
|
|
2314
|
+
*/
|
|
2315
|
+
declare function formatFormData(formData: any, dataMap: Map<string, any>, recursiveRefMap: Map<string, string>, arrayMap: Map<string, number>, returnEmptyFields?: boolean, fixErrors?: boolean): any;
|
|
2316
|
+
/**
|
|
2317
|
+
* 'getControl' function
|
|
2318
|
+
*
|
|
2319
|
+
* Uses a JSON Pointer for a data object to retrieve a control from
|
|
2320
|
+
* an Angular formGroup or formGroup template. (Note: though a formGroup
|
|
2321
|
+
* template is much simpler, its basic structure is idential to a formGroup).
|
|
2322
|
+
*
|
|
2323
|
+
* If the optional third parameter 'returnGroup' is set to TRUE, the group
|
|
2324
|
+
* containing the control is returned, rather than the control itself.
|
|
2325
|
+
*
|
|
2326
|
+
* // {FormGroup} formGroup - Angular FormGroup to get value from
|
|
2327
|
+
* // {Pointer} dataPointer - JSON Pointer (string or array)
|
|
2328
|
+
* // {boolean = false} returnGroup - If true, return group containing control
|
|
2329
|
+
* // {group} - Located value (or null, if no control found)
|
|
2330
|
+
* // {string} schemaPointer - string used for conditional controls coming from schema if/then/else
|
|
2331
|
+
*/
|
|
2332
|
+
declare function getControl(formGroup: any, dataPointer: Pointer, returnGroup?: boolean, schemaPointer?: string): any;
|
|
2333
|
+
/**
|
|
2334
|
+
* 'setControl' function
|
|
2335
|
+
*
|
|
2336
|
+
* Uses a JSON Pointer for a data object to retrieve a control from
|
|
2337
|
+
* an Angular formGroup or formGroup template. (Note: though a formGroup
|
|
2338
|
+
* template is much simpler, its basic structure is idential to a formGroup).
|
|
2339
|
+
*
|
|
2340
|
+
* If the optional third parameter 'returnGroup' is set to TRUE, the group
|
|
2341
|
+
* containing the control is returned, rather than the control itself.
|
|
2342
|
+
*
|
|
2343
|
+
* // {FormGroup} formGroup - Angular FormGroup to get value from
|
|
2344
|
+
* // {Pointer} dataPointer - JSON Pointer (string or array)
|
|
2345
|
+
* // {AbstractControl} control - control used to replace existing or add
|
|
2346
|
+
* // {targetKey} - optional string used as the new key-not implemented as yet
|
|
2347
|
+
*/
|
|
2348
|
+
declare function setControl(formGroup: any, dataPointer: Pointer, control: AbstractControl, targetKey?: string): any;
|
|
2349
|
+
|
|
2350
|
+
declare function buildLayout(jsf: any, widgetLibrary: any): any[];
|
|
2351
|
+
/**
|
|
2352
|
+
* 'buildLayoutFromSchema' function
|
|
2353
|
+
*
|
|
2354
|
+
* // jsf -
|
|
2355
|
+
* // widgetLibrary -
|
|
2356
|
+
* // nodeValue -
|
|
2357
|
+
* // { string = '' } schemaPointer -
|
|
2358
|
+
* // { string = '' } dataPointer -
|
|
2359
|
+
* // { boolean = false } arrayItem -
|
|
2360
|
+
* // { string = null } arrayItemType -
|
|
2361
|
+
* // { boolean = null } removable -
|
|
2362
|
+
* // { boolean = false } forRefLibrary -
|
|
2363
|
+
* // { string = '' } dataPointerPrefix -
|
|
2364
|
+
* //
|
|
2365
|
+
*/
|
|
2366
|
+
declare function buildLayoutFromSchema(jsf: any, widgetLibrary: any, nodeValue?: any, schemaPointer?: string, dataPointer?: string, arrayItem?: boolean, arrayItemType?: string, removable?: boolean, forRefLibrary?: boolean, dataPointerPrefix?: string, jsonSchema?: any): any;
|
|
2367
|
+
/**
|
|
2368
|
+
* 'mapLayout' function
|
|
2369
|
+
*
|
|
2370
|
+
* Creates a new layout by running each element in an existing layout through
|
|
2371
|
+
* an iteratee. Recursively maps within array elements 'items' and 'tabs'.
|
|
2372
|
+
* The iteratee is invoked with four arguments: (value, index, layout, path)
|
|
2373
|
+
*
|
|
2374
|
+
* The returned layout may be longer (or shorter) then the source layout.
|
|
2375
|
+
*
|
|
2376
|
+
* If an item from the source layout returns multiple items (as '*' usually will),
|
|
2377
|
+
* this function will keep all returned items in-line with the surrounding items.
|
|
2378
|
+
*
|
|
2379
|
+
* If an item from the source layout causes an error and returns null, it is
|
|
2380
|
+
* skipped without error, and the function will still return all non-null items.
|
|
2381
|
+
*
|
|
2382
|
+
* // layout - the layout to map
|
|
2383
|
+
* // { (v: any, i?: number, l?: any, p?: string) => any }
|
|
2384
|
+
* function - the funciton to invoke on each element
|
|
2385
|
+
* // { string|string[] = '' } layoutPointer - the layoutPointer to layout, inside rootLayout
|
|
2386
|
+
* // { any[] = layout } rootLayout - the root layout, which conatins layout
|
|
2387
|
+
* //
|
|
2388
|
+
*/
|
|
2389
|
+
declare function mapLayout(layout: any, fn: any, layoutPointer?: string, rootLayout?: any): any[];
|
|
2390
|
+
/**
|
|
2391
|
+
* 'getLayoutNode' function
|
|
2392
|
+
* Copy a new layoutNode from layoutRefLibrary
|
|
2393
|
+
*
|
|
2394
|
+
* // refNode -
|
|
2395
|
+
* // layoutRefLibrary -
|
|
2396
|
+
* // { any = null } widgetLibrary -
|
|
2397
|
+
* // { any = null } nodeValue -
|
|
2398
|
+
* // copied layoutNode
|
|
2399
|
+
*/
|
|
2400
|
+
declare function getLayoutNode(refNode: any, jsf: any, widgetLibrary?: any, nodeValue?: any): any;
|
|
2401
|
+
/**
|
|
2402
|
+
* 'buildTitleMap' function
|
|
2403
|
+
*
|
|
2404
|
+
* // titleMap -
|
|
2405
|
+
* // enumList -
|
|
2406
|
+
* // { boolean = true } fieldRequired -
|
|
2407
|
+
* // { boolean = true } flatList -
|
|
2408
|
+
* // { TitleMapItem[] }
|
|
2409
|
+
*/
|
|
2410
|
+
declare function buildTitleMap(titleMap: any, enumList: any, fieldRequired?: boolean, flatList?: boolean): TitleMapItem[];
|
|
2411
|
+
|
|
2412
|
+
declare class SelectComponent implements OnInit, OnDestroy {
|
|
2413
|
+
private jsf;
|
|
2414
|
+
formControl: AbstractControl;
|
|
2415
|
+
controlName: string;
|
|
2416
|
+
controlValue: any;
|
|
2417
|
+
controlDisabled: boolean;
|
|
2418
|
+
boundControl: boolean;
|
|
2419
|
+
options: any;
|
|
2420
|
+
selectList: any[];
|
|
2421
|
+
selectListFlatGroup: any[];
|
|
2422
|
+
isArray: typeof isArray;
|
|
2423
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2424
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2425
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2426
|
+
ngOnInit(): void;
|
|
2427
|
+
deselectAll(): void;
|
|
2428
|
+
updateValue(event: any): void;
|
|
2429
|
+
ngOnDestroy(): void;
|
|
2430
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectComponent, never>;
|
|
2431
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectComponent, "select-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
declare class SelectFrameworkComponent implements OnChanges, OnInit {
|
|
2435
|
+
private jsf;
|
|
2436
|
+
newComponent: ComponentRef<any>;
|
|
2437
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2438
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2439
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2440
|
+
readonly widgetContainer: _angular_core.Signal<ViewContainerRef>;
|
|
2441
|
+
ngOnInit(): void;
|
|
2442
|
+
ngOnChanges(): void;
|
|
2443
|
+
updateComponent(): void;
|
|
2444
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectFrameworkComponent, never>;
|
|
2445
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectFrameworkComponent, "select-framework-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
declare class SelectWidgetComponent implements OnChanges, OnInit {
|
|
2449
|
+
private jsf;
|
|
2450
|
+
newComponent: ComponentRef<any>;
|
|
2451
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2452
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2453
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2454
|
+
readonly widgetContainer: _angular_core.Signal<ViewContainerRef>;
|
|
2455
|
+
ngOnInit(): void;
|
|
2456
|
+
ngOnChanges(): void;
|
|
2457
|
+
updateComponent(): void;
|
|
2458
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectWidgetComponent, never>;
|
|
2459
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectWidgetComponent, "select-widget-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
declare class SubmitComponent implements OnInit, OnDestroy {
|
|
2463
|
+
private jsf;
|
|
2464
|
+
formControl: AbstractControl;
|
|
2465
|
+
controlName: string;
|
|
2466
|
+
controlValue: any;
|
|
2467
|
+
controlDisabled: boolean;
|
|
2468
|
+
boundControl: boolean;
|
|
2469
|
+
options: any;
|
|
2470
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2471
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2472
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2473
|
+
isValidChangesSubs: Subscription;
|
|
2474
|
+
ngOnDestroy(): void;
|
|
2475
|
+
ngOnInit(): void;
|
|
2476
|
+
updateValue(event: any): void;
|
|
2477
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SubmitComponent, never>;
|
|
2478
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SubmitComponent, "submit-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
declare class TabComponent implements OnInit {
|
|
2482
|
+
private jsf;
|
|
2483
|
+
options: any;
|
|
2484
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2485
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2486
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2487
|
+
ngOnInit(): void;
|
|
2488
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TabComponent, never>;
|
|
2489
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TabComponent, "tab-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
declare class TabsComponent implements OnInit {
|
|
2493
|
+
private jsf;
|
|
2494
|
+
options: any;
|
|
2495
|
+
itemCount: number;
|
|
2496
|
+
selectedItem: number;
|
|
2497
|
+
showAddTab: boolean;
|
|
2498
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2499
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2500
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2501
|
+
ngOnInit(): void;
|
|
2502
|
+
select(index: any): void;
|
|
2503
|
+
updateControl(): void;
|
|
2504
|
+
setTabTitle(item: any, index: number): string;
|
|
2505
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TabsComponent, never>;
|
|
2506
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TabsComponent, "tabs-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
declare class TemplateComponent implements OnInit, OnChanges {
|
|
2510
|
+
private jsf;
|
|
2511
|
+
newComponent: ComponentRef<any>;
|
|
2512
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2513
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2514
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2515
|
+
readonly widgetContainer: _angular_core.Signal<ViewContainerRef>;
|
|
2516
|
+
ngOnInit(): void;
|
|
2517
|
+
ngOnChanges(): void;
|
|
2518
|
+
updateComponent(): void;
|
|
2519
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TemplateComponent, never>;
|
|
2520
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TemplateComponent, "template-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
declare class TextareaComponent implements OnInit, OnDestroy {
|
|
2524
|
+
private jsf;
|
|
2525
|
+
formControl: AbstractControl;
|
|
2526
|
+
controlName: string;
|
|
2527
|
+
controlValue: any;
|
|
2528
|
+
controlDisabled: boolean;
|
|
2529
|
+
boundControl: boolean;
|
|
2530
|
+
options: any;
|
|
2531
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2532
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2533
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2534
|
+
ngOnInit(): void;
|
|
2535
|
+
updateValue(event: any): void;
|
|
2536
|
+
ngOnDestroy(): void;
|
|
2537
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TextareaComponent, never>;
|
|
2538
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TextareaComponent, "textarea-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
declare class SelectCheckboxComponent implements OnInit, OnDestroy {
|
|
2542
|
+
private jsf;
|
|
2543
|
+
private jsfFLService;
|
|
2544
|
+
formControl: AbstractControl;
|
|
2545
|
+
controlName: string;
|
|
2546
|
+
controlValue: any;
|
|
2547
|
+
controlDisabled: boolean;
|
|
2548
|
+
boundControl: boolean;
|
|
2549
|
+
options: any;
|
|
2550
|
+
selectList: any[];
|
|
2551
|
+
selectListFlatGroup: any[];
|
|
2552
|
+
selectValue: any;
|
|
2553
|
+
isArray: typeof isArray;
|
|
2554
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2555
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2556
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2557
|
+
frameworkStyles: {
|
|
2558
|
+
daisyui: {
|
|
2559
|
+
selectClass: string;
|
|
2560
|
+
optionClass: string;
|
|
2561
|
+
optionChecked: string;
|
|
2562
|
+
optionUnchecked: string;
|
|
2563
|
+
};
|
|
2564
|
+
"bootstrap-3": {
|
|
2565
|
+
selectClass: string;
|
|
2566
|
+
optionClass: string;
|
|
2567
|
+
optionChecked: string;
|
|
2568
|
+
optionUnchecked: string;
|
|
2569
|
+
};
|
|
2570
|
+
"bootstrap-4": {
|
|
2571
|
+
selectClass: string;
|
|
2572
|
+
optionClass: string;
|
|
2573
|
+
optionChecked: string;
|
|
2574
|
+
optionUnchecked: string;
|
|
2575
|
+
};
|
|
2576
|
+
"bootstrap-5": {
|
|
2577
|
+
selectClass: string;
|
|
2578
|
+
optionClass: string;
|
|
2579
|
+
optionChecked: string;
|
|
2580
|
+
optionUnchecked: string;
|
|
2581
|
+
};
|
|
2582
|
+
};
|
|
2583
|
+
activeFramework: string;
|
|
2584
|
+
ngOnInit(): void;
|
|
2585
|
+
deselectAll(): void;
|
|
2586
|
+
updateValue(event: any): void;
|
|
2587
|
+
onSelectClicked($event: any): void;
|
|
2588
|
+
ngOnDestroy(): void;
|
|
2589
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectCheckboxComponent, never>;
|
|
2590
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectCheckboxComponent, "selectcheckbox-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/**
|
|
2594
|
+
* OrderableDirective
|
|
2595
|
+
*
|
|
2596
|
+
* Enables array elements to be reordered by dragging and dropping.
|
|
2597
|
+
*
|
|
2598
|
+
* Only works for arrays that have at least two elements.
|
|
2599
|
+
*
|
|
2600
|
+
* Also detects arrays-within-arrays, and correctly moves either
|
|
2601
|
+
* the child array element or the parent array element,
|
|
2602
|
+
* depending on the drop targert.
|
|
2603
|
+
*
|
|
2604
|
+
* Listeners for movable element being dragged:
|
|
2605
|
+
* - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
|
|
2606
|
+
* - dragover: set dropEffect = 'move'
|
|
2607
|
+
* - dragend: remove 'dragging' class from element
|
|
2608
|
+
*
|
|
2609
|
+
* Listeners for stationary items being dragged over:
|
|
2610
|
+
* - dragenter: add 'drag-target-...' classes to element
|
|
2611
|
+
* - dragleave: remove 'drag-target-...' classes from element
|
|
2612
|
+
* - drop: remove 'drag-target-...' classes from element, move dropped array item
|
|
2613
|
+
*/
|
|
2614
|
+
declare class OrderableDirective implements OnInit, OnDestroy {
|
|
2615
|
+
private elementRef;
|
|
2616
|
+
private jsf;
|
|
2617
|
+
private ngZone;
|
|
2618
|
+
arrayLayoutIndex: string;
|
|
2619
|
+
element: any;
|
|
2620
|
+
overParentElement: boolean;
|
|
2621
|
+
overChildElement: boolean;
|
|
2622
|
+
readonly orderable: _angular_core.InputSignal<boolean>;
|
|
2623
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2624
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2625
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2626
|
+
private draggableStateSubscription;
|
|
2627
|
+
ngOnInit(): void;
|
|
2628
|
+
ngOnDestroy(): void;
|
|
2629
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<OrderableDirective, never>;
|
|
2630
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<OrderableDirective, "[orderable]", never, { "orderable": { "alias": "orderable"; "required": false; "isSignal": true; }; "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
declare class ElementAttributeDirective {
|
|
2634
|
+
private renderer;
|
|
2635
|
+
private elementRef;
|
|
2636
|
+
attributes: {
|
|
2637
|
+
[key: string]: any;
|
|
2638
|
+
};
|
|
2639
|
+
constructor(renderer: Renderer2, elementRef: ElementRef);
|
|
2640
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
2641
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ElementAttributeDirective, never>;
|
|
2642
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ElementAttributeDirective, "[attributes]", never, { "attributes": { "alias": "attributes"; "required": false; }; }, {}, never, never, false, never>;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
declare class WidgetLibraryModule {
|
|
2646
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetLibraryModule, never>;
|
|
2647
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<WidgetLibraryModule, [typeof AddReferenceComponent, typeof OneOfComponent, typeof ButtonComponent, typeof CheckboxComponent, typeof CheckboxesComponent, typeof FileComponent, typeof HiddenComponent, typeof InputComponent, typeof MessageComponent, typeof NoneComponent, typeof NumberComponent, typeof RadiosComponent, typeof RootComponent, typeof SectionComponent, typeof SelectComponent, typeof SelectFrameworkComponent, typeof SelectWidgetComponent, typeof SubmitComponent, typeof TabComponent, typeof TabsComponent, typeof TemplateComponent, typeof TextareaComponent, typeof SelectCheckboxComponent, typeof OrderableDirective, typeof ElementAttributeDirective], [typeof i2.CommonModule, typeof i27.FormsModule, typeof i27.ReactiveFormsModule, typeof i28.SortablejsModule], [typeof AddReferenceComponent, typeof OneOfComponent, typeof ButtonComponent, typeof CheckboxComponent, typeof CheckboxesComponent, typeof FileComponent, typeof HiddenComponent, typeof InputComponent, typeof MessageComponent, typeof NoneComponent, typeof NumberComponent, typeof RadiosComponent, typeof RootComponent, typeof SectionComponent, typeof SelectComponent, typeof SelectFrameworkComponent, typeof SelectWidgetComponent, typeof SubmitComponent, typeof TabComponent, typeof TabsComponent, typeof TemplateComponent, typeof TextareaComponent, typeof SelectCheckboxComponent, typeof OrderableDirective, typeof ElementAttributeDirective]>;
|
|
2648
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<WidgetLibraryModule>;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
declare class NoFrameworkComponent {
|
|
2652
|
+
readonly layoutNode: _angular_core.InputSignal<any>;
|
|
2653
|
+
readonly layoutIndex: _angular_core.InputSignal<number[]>;
|
|
2654
|
+
readonly dataIndex: _angular_core.InputSignal<number[]>;
|
|
2655
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NoFrameworkComponent, never>;
|
|
2656
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NoFrameworkComponent, "no-framework", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
declare class NoFrameworkModule {
|
|
2660
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NoFrameworkModule, never>;
|
|
2661
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<NoFrameworkModule, [typeof NoFrameworkComponent], [typeof i2.CommonModule, typeof WidgetLibraryModule], [typeof NoFrameworkComponent]>;
|
|
2662
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<NoFrameworkModule>;
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
declare class JsonSchemaFormModule {
|
|
2666
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<JsonSchemaFormModule, never>;
|
|
2667
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<JsonSchemaFormModule, [typeof JsonSchemaFormComponent], [typeof i2.CommonModule, typeof i27.FormsModule, typeof i27.ReactiveFormsModule, typeof WidgetLibraryModule, typeof NoFrameworkModule], [typeof JsonSchemaFormComponent, typeof WidgetLibraryModule]>;
|
|
2668
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<JsonSchemaFormModule>;
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
declare class Framework {
|
|
2672
|
+
name: string;
|
|
2673
|
+
text: string;
|
|
2674
|
+
framework: any;
|
|
2675
|
+
widgets?: {
|
|
2676
|
+
[key: string]: any;
|
|
2677
|
+
};
|
|
2678
|
+
stylesheets?: string[];
|
|
2679
|
+
scripts?: string[];
|
|
2680
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<Framework, never>;
|
|
2681
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<Framework>;
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
declare class FrameworkLibraryService {
|
|
2685
|
+
private frameworks;
|
|
2686
|
+
private widgetLibrary;
|
|
2687
|
+
private http;
|
|
2688
|
+
activeFramework: Framework;
|
|
2689
|
+
stylesheets: (HTMLStyleElement | HTMLLinkElement)[];
|
|
2690
|
+
scripts: HTMLScriptElement[];
|
|
2691
|
+
loadExternalAssets: boolean;
|
|
2692
|
+
defaultFramework: string;
|
|
2693
|
+
frameworkLibrary: {
|
|
2694
|
+
[name: string]: Framework;
|
|
2695
|
+
};
|
|
2696
|
+
activeFrameworkName$: Observable<string>;
|
|
2697
|
+
private activeFrameworkNameSubject;
|
|
2698
|
+
private activeFrameworkName;
|
|
2699
|
+
constructor(frameworks: any[]);
|
|
2700
|
+
setLoadExternalAssets(loadExternalAssets?: boolean): void;
|
|
2701
|
+
setFramework(framework?: string | Framework, loadExternalAssets?: boolean): boolean;
|
|
2702
|
+
registerFrameworkWidgets(framework: Framework): boolean;
|
|
2703
|
+
hasFramework(type: string): boolean;
|
|
2704
|
+
getFramework(): any;
|
|
2705
|
+
getFrameworkList(): {
|
|
2706
|
+
name: string;
|
|
2707
|
+
text: string;
|
|
2708
|
+
}[];
|
|
2709
|
+
getFrameworkWidgets(): any;
|
|
2710
|
+
getFrameworkStylesheets(load?: boolean): string[];
|
|
2711
|
+
getFrameworkScripts(load?: boolean): string[];
|
|
2712
|
+
getFrameworkConfig(existingFramework?: any): any;
|
|
2713
|
+
getFrameworkAssetConfig(existingFramework?: any, useAssetRelPath?: boolean): Promise<{
|
|
2714
|
+
stylesheets: string[];
|
|
2715
|
+
scripts: string[];
|
|
2716
|
+
}>;
|
|
2717
|
+
getFrameworkThemes(): {
|
|
2718
|
+
name: string;
|
|
2719
|
+
text: string;
|
|
2720
|
+
}[];
|
|
2721
|
+
requestThemeChange(name: string, validateThemeExists?: boolean, existingFramework?: any): boolean;
|
|
2722
|
+
getActiveTheme(existingFramework?: any): {
|
|
2723
|
+
name: string;
|
|
2724
|
+
text: string;
|
|
2725
|
+
};
|
|
2726
|
+
registerTheme(newTheme: {
|
|
2727
|
+
name: string;
|
|
2728
|
+
text: string;
|
|
2729
|
+
}, existingFramework?: any): boolean;
|
|
2730
|
+
unregisterTheme(name: string, existingFramework?: any): boolean;
|
|
2731
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FrameworkLibraryService, never>;
|
|
2732
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FrameworkLibraryService>;
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
declare const deValidationMessages: any;
|
|
2736
|
+
|
|
2737
|
+
declare const enValidationMessages: any;
|
|
2738
|
+
|
|
2739
|
+
declare const esValidationMessages: any;
|
|
2740
|
+
|
|
2741
|
+
declare const frValidationMessages: any;
|
|
2742
|
+
|
|
2743
|
+
declare const itValidationMessages: any;
|
|
2744
|
+
|
|
2745
|
+
declare const ptValidationMessages: any;
|
|
2746
|
+
|
|
2747
|
+
declare const zhValidationMessages: any;
|
|
2748
|
+
|
|
2749
|
+
declare class WidgetLibraryService {
|
|
2750
|
+
defaultWidget: string;
|
|
2751
|
+
widgetLibrary: any;
|
|
2752
|
+
registeredWidgets: any;
|
|
2753
|
+
frameworkWidgets: any;
|
|
2754
|
+
activeWidgets: any;
|
|
2755
|
+
constructor();
|
|
2756
|
+
setActiveWidgets(): boolean;
|
|
2757
|
+
setDefaultWidget(type: string): boolean;
|
|
2758
|
+
hasWidget(type: string, widgetSet?: string): boolean;
|
|
2759
|
+
hasDefaultWidget(type: string): boolean;
|
|
2760
|
+
registerWidget(type: string, widget: any): boolean;
|
|
2761
|
+
unRegisterWidget(type: string): boolean;
|
|
2762
|
+
unRegisterAllWidgets(unRegisterFrameworkWidgets?: boolean): boolean;
|
|
2763
|
+
registerFrameworkWidgets(widgets: any): boolean;
|
|
2764
|
+
unRegisterFrameworkWidgets(): boolean;
|
|
2765
|
+
getWidget(type?: string, widgetSet?: string): any;
|
|
2766
|
+
getAllWidgets(): any;
|
|
2767
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetLibraryService, never>;
|
|
2768
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<WidgetLibraryService>;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
declare const BASIC_WIDGETS: (typeof NoneComponent | typeof RootComponent)[];
|
|
2772
|
+
|
|
2773
|
+
export { AddReferenceComponent, BASIC_WIDGETS, ButtonComponent, CheckboxComponent, CheckboxesComponent, ElementAttributeDirective, FileComponent, Framework, FrameworkLibraryService, HiddenComponent, InputComponent, JsonPointer, JsonSchemaFormComponent, JsonSchemaFormModule, JsonSchemaFormService, JsonValidators, MessageComponent, NoneComponent, NumberComponent, OneOfComponent, OrderableDirective, RadiosComponent, RootComponent, SectionComponent, SelectCheckboxComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, WidgetLibraryModule, WidgetLibraryService, _executeAsyncValidators, _executeValidators, _mergeErrors, _mergeObjects, _toPromise, addClasses, buildFormGroup, buildFormGroupTemplate, buildLayout, buildLayoutFromSchema, buildSchemaFromData, buildSchemaFromLayout, buildTitleMap, checkInlineType, combineAllOf, commonItems, convertSchemaToDraft6, copy, deValidationMessages, enValidationMessages, esValidationMessages, fixRequiredArrayProperties, fixTitle, forEach, forEachCopy, formatFormData, frValidationMessages, getControl, getControlValidators, getFromSchema, getInputType, getLayoutNode, getSubSchema, getTitleMapFromOneOf, getType, hasNonNullValue, hasOwn, hasValue, inArray, isArray, isBoolean, isDate, isDefined, isEmpty, isFunction, isInputRequired, isInteger, isMap, isNumber, isObject, isObservable, isPrimitive, isPromise, isSet, isString, isType, itValidationMessages, mapLayout, mergeFilteredObject, mergeSchemas, path2ControlKey, ptValidationMessages, removeRecursiveReferences, resolveSchemaReferences, setControl, setRequiredFields, toJavaScriptType, toObservable, toSchemaType, toTitleCase, uniqueItems, updateInputOptions, xor, zhValidationMessages };
|
|
2774
|
+
export type { AsyncIValidatorFn, ErrorMessages, IValidatorFn, JavaScriptPrimitiveType, JavaScriptType, PlainObject, Pointer, PrimitiveValue, SchemaPrimitiveType, SchemaType, TitleMapItem };
|