@ng-formworks/core 16.3.0 → 17.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/framework-library/framework-library.service.mjs +174 -174
- package/esm2022/lib/framework-library/framework.mjs +14 -14
- package/esm2022/lib/framework-library/no-framework.component.mjs +17 -17
- package/esm2022/lib/framework-library/no-framework.module.mjs +26 -26
- package/esm2022/lib/framework-library/no.framework.mjs +18 -18
- package/esm2022/lib/json-schema-form.component.mjs +765 -765
- package/esm2022/lib/json-schema-form.module.mjs +25 -25
- package/esm2022/lib/json-schema-form.service.mjs +675 -675
- package/esm2022/lib/locale/de-validation-messages.mjs +59 -59
- package/esm2022/lib/locale/en-validation-messages.mjs +59 -59
- package/esm2022/lib/locale/es-validation-messages.mjs +56 -56
- package/esm2022/lib/locale/fr-validation-messages.mjs +59 -59
- package/esm2022/lib/locale/index.mjs +7 -7
- package/esm2022/lib/locale/it-validation-messages.mjs +59 -59
- package/esm2022/lib/locale/pt-validation-messages.mjs +59 -59
- package/esm2022/lib/locale/zh-validation-messages.mjs +59 -59
- package/esm2022/lib/shared/convert-schema-to-draft6.function.mjs +299 -299
- package/esm2022/lib/shared/form-group.functions.mjs +441 -441
- package/esm2022/lib/shared/format-regex.constants.mjs +53 -53
- package/esm2022/lib/shared/index.mjs +11 -11
- package/esm2022/lib/shared/json-schema.functions.mjs +783 -783
- package/esm2022/lib/shared/json.validators.mjs +883 -883
- package/esm2022/lib/shared/jsonpointer.functions.mjs +1025 -1025
- package/esm2022/lib/shared/layout.functions.mjs +1153 -1153
- package/esm2022/lib/shared/merge-schemas.function.mjs +344 -344
- package/esm2022/lib/shared/utility.functions.mjs +379 -379
- package/esm2022/lib/shared/validator.functions.mjs +583 -583
- package/esm2022/lib/widget-library/add-reference.component.mjs +48 -48
- package/esm2022/lib/widget-library/button.component.mjs +41 -41
- package/esm2022/lib/widget-library/checkbox.component.mjs +46 -46
- package/esm2022/lib/widget-library/checkboxes.component.mjs +52 -52
- package/esm2022/lib/widget-library/file.component.mjs +35 -35
- package/esm2022/lib/widget-library/hidden.component.mjs +33 -33
- package/esm2022/lib/widget-library/index.mjs +54 -54
- package/esm2022/lib/widget-library/input.component.mjs +38 -38
- package/esm2022/lib/widget-library/message.component.mjs +33 -33
- package/esm2022/lib/widget-library/none.component.mjs +20 -20
- package/esm2022/lib/widget-library/number.component.mjs +44 -44
- package/esm2022/lib/widget-library/one-of.component.mjs +35 -35
- package/esm2022/lib/widget-library/orderable.directive.mjs +123 -123
- package/esm2022/lib/widget-library/radios.component.mjs +44 -44
- package/esm2022/lib/widget-library/root.component.mjs +44 -44
- package/esm2022/lib/widget-library/section.component.mjs +78 -78
- package/esm2022/lib/widget-library/select-framework.component.mjs +51 -51
- package/esm2022/lib/widget-library/select-widget.component.mjs +46 -46
- package/esm2022/lib/widget-library/select.component.mjs +41 -41
- package/esm2022/lib/widget-library/submit.component.mjs +55 -55
- package/esm2022/lib/widget-library/tab.component.mjs +30 -30
- package/esm2022/lib/widget-library/tabs.component.mjs +53 -53
- package/esm2022/lib/widget-library/template.component.mjs +46 -46
- package/esm2022/lib/widget-library/textarea.component.mjs +37 -37
- package/esm2022/lib/widget-library/widget-library.module.mjs +41 -41
- package/esm2022/lib/widget-library/widget-library.service.mjs +225 -225
- package/esm2022/ng-formworks-core.mjs +4 -4
- package/esm2022/public_api.mjs +12 -12
- package/fesm2022/ng-formworks-core.mjs +9103 -9103
- package/fesm2022/ng-formworks-core.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/lib/framework-library/framework-library.service.d.ts +55 -55
- package/lib/framework-library/framework.d.ts +13 -13
- package/lib/framework-library/no-framework.component.d.ts +8 -8
- package/lib/framework-library/no-framework.module.d.ts +9 -9
- package/lib/framework-library/no.framework.d.ts +10 -10
- package/lib/json-schema-form.component.d.ts +218 -218
- package/lib/json-schema-form.module.d.ts +11 -11
- package/lib/json-schema-form.service.d.ts +115 -115
- package/lib/locale/de-validation-messages.d.ts +1 -1
- package/lib/locale/en-validation-messages.d.ts +1 -1
- package/lib/locale/es-validation-messages.d.ts +1 -1
- package/lib/locale/fr-validation-messages.d.ts +1 -1
- package/lib/locale/index.d.ts +7 -7
- package/lib/locale/it-validation-messages.d.ts +1 -1
- package/lib/locale/pt-validation-messages.d.ts +1 -1
- package/lib/locale/zh-validation-messages.d.ts +1 -1
- package/lib/shared/convert-schema-to-draft6.function.d.ts +21 -21
- package/lib/shared/form-group.functions.d.ts +100 -100
- package/lib/shared/format-regex.constants.d.ts +19 -19
- package/lib/shared/index.d.ts +9 -9
- package/lib/shared/json-schema.functions.d.ts +193 -193
- package/lib/shared/json.validators.d.ts +441 -441
- package/lib/shared/jsonpointer.functions.d.ts +416 -416
- package/lib/shared/layout.functions.d.ts +83 -83
- package/lib/shared/merge-schemas.function.d.ts +19 -19
- package/lib/shared/utility.functions.d.ts +165 -165
- package/lib/shared/validator.functions.d.ts +364 -364
- package/lib/widget-library/add-reference.component.d.ts +20 -20
- package/lib/widget-library/button.component.d.ts +21 -21
- package/lib/widget-library/checkbox.component.d.ts +24 -24
- package/lib/widget-library/checkboxes.component.d.ts +24 -24
- package/lib/widget-library/file.component.d.ts +21 -21
- package/lib/widget-library/hidden.component.d.ts +19 -19
- package/lib/widget-library/index.d.ts +47 -47
- package/lib/widget-library/input.component.d.ts +22 -22
- package/lib/widget-library/message.component.d.ts +15 -15
- package/lib/widget-library/none.component.d.ts +8 -8
- package/lib/widget-library/number.component.d.ts +25 -25
- package/lib/widget-library/one-of.component.d.ts +21 -21
- package/lib/widget-library/orderable.directive.d.ts +41 -41
- package/lib/widget-library/radios.component.d.ts +23 -23
- package/lib/widget-library/root.component.d.ts +17 -17
- package/lib/widget-library/section.component.d.ts +19 -19
- package/lib/widget-library/select-framework.component.d.ts +18 -18
- package/lib/widget-library/select-widget.component.d.ts +18 -18
- package/lib/widget-library/select.component.d.ts +24 -24
- package/lib/widget-library/submit.component.d.ts +24 -24
- package/lib/widget-library/tab.component.d.ts +14 -14
- package/lib/widget-library/tabs.component.d.ts +20 -20
- package/lib/widget-library/template.component.d.ts +18 -18
- package/lib/widget-library/textarea.component.d.ts +21 -21
- package/lib/widget-library/widget-library.module.d.ts +31 -31
- package/lib/widget-library/widget-library.service.d.ts +22 -22
- package/package.json +5 -5
- package/public_api.d.ts +9 -9
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { TitleMapItem } from '../json-schema-form.service';
|
|
2
|
-
/**
|
|
3
|
-
* Layout function library:
|
|
4
|
-
*
|
|
5
|
-
* buildLayout: Builds a complete layout from an input layout and schema
|
|
6
|
-
*
|
|
7
|
-
* buildLayoutFromSchema: Builds a complete layout entirely from an input schema
|
|
8
|
-
*
|
|
9
|
-
* mapLayout:
|
|
10
|
-
*
|
|
11
|
-
* getLayoutNode:
|
|
12
|
-
*
|
|
13
|
-
* buildTitleMap:
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* 'buildLayout' function
|
|
17
|
-
*
|
|
18
|
-
* // jsf
|
|
19
|
-
* // widgetLibrary
|
|
20
|
-
* //
|
|
21
|
-
*/
|
|
22
|
-
export declare function buildLayout_original(jsf: any, widgetLibrary: any): any[];
|
|
23
|
-
export declare function buildLayout(jsf: any, widgetLibrary: any): any[];
|
|
24
|
-
/**
|
|
25
|
-
* 'buildLayoutFromSchema' function
|
|
26
|
-
*
|
|
27
|
-
* // jsf -
|
|
28
|
-
* // widgetLibrary -
|
|
29
|
-
* // nodeValue -
|
|
30
|
-
* // { string = '' } schemaPointer -
|
|
31
|
-
* // { string = '' } dataPointer -
|
|
32
|
-
* // { boolean = false } arrayItem -
|
|
33
|
-
* // { string = null } arrayItemType -
|
|
34
|
-
* // { boolean = null } removable -
|
|
35
|
-
* // { boolean = false } forRefLibrary -
|
|
36
|
-
* // { string = '' } dataPointerPrefix -
|
|
37
|
-
* //
|
|
38
|
-
*/
|
|
39
|
-
export declare function buildLayoutFromSchema(jsf: any, widgetLibrary: any, nodeValue?: any, schemaPointer?: string, dataPointer?: string, arrayItem?: boolean, arrayItemType?: string, removable?: boolean, forRefLibrary?: boolean, dataPointerPrefix?: string): any;
|
|
40
|
-
/**
|
|
41
|
-
* 'mapLayout' function
|
|
42
|
-
*
|
|
43
|
-
* Creates a new layout by running each element in an existing layout through
|
|
44
|
-
* an iteratee. Recursively maps within array elements 'items' and 'tabs'.
|
|
45
|
-
* The iteratee is invoked with four arguments: (value, index, layout, path)
|
|
46
|
-
*
|
|
47
|
-
* The returned layout may be longer (or shorter) then the source layout.
|
|
48
|
-
*
|
|
49
|
-
* If an item from the source layout returns multiple items (as '*' usually will),
|
|
50
|
-
* this function will keep all returned items in-line with the surrounding items.
|
|
51
|
-
*
|
|
52
|
-
* If an item from the source layout causes an error and returns null, it is
|
|
53
|
-
* skipped without error, and the function will still return all non-null items.
|
|
54
|
-
*
|
|
55
|
-
* // layout - the layout to map
|
|
56
|
-
* // { (v: any, i?: number, l?: any, p?: string) => any }
|
|
57
|
-
* function - the funciton to invoke on each element
|
|
58
|
-
* // { string|string[] = '' } layoutPointer - the layoutPointer to layout, inside rootLayout
|
|
59
|
-
* // { any[] = layout } rootLayout - the root layout, which conatins layout
|
|
60
|
-
* //
|
|
61
|
-
*/
|
|
62
|
-
export declare function mapLayout(layout: any, fn: any, layoutPointer?: string, rootLayout?: any): any[];
|
|
63
|
-
/**
|
|
64
|
-
* 'getLayoutNode' function
|
|
65
|
-
* Copy a new layoutNode from layoutRefLibrary
|
|
66
|
-
*
|
|
67
|
-
* // refNode -
|
|
68
|
-
* // layoutRefLibrary -
|
|
69
|
-
* // { any = null } widgetLibrary -
|
|
70
|
-
* // { any = null } nodeValue -
|
|
71
|
-
* // copied layoutNode
|
|
72
|
-
*/
|
|
73
|
-
export declare function getLayoutNode(refNode: any, jsf: any, widgetLibrary?: any, nodeValue?: any): any;
|
|
74
|
-
/**
|
|
75
|
-
* 'buildTitleMap' function
|
|
76
|
-
*
|
|
77
|
-
* // titleMap -
|
|
78
|
-
* // enumList -
|
|
79
|
-
* // { boolean = true } fieldRequired -
|
|
80
|
-
* // { boolean = true } flatList -
|
|
81
|
-
* // { TitleMapItem[] }
|
|
82
|
-
*/
|
|
83
|
-
export declare function buildTitleMap(titleMap: any, enumList: any, fieldRequired?: boolean, flatList?: boolean): TitleMapItem[];
|
|
1
|
+
import { TitleMapItem } from '../json-schema-form.service';
|
|
2
|
+
/**
|
|
3
|
+
* Layout function library:
|
|
4
|
+
*
|
|
5
|
+
* buildLayout: Builds a complete layout from an input layout and schema
|
|
6
|
+
*
|
|
7
|
+
* buildLayoutFromSchema: Builds a complete layout entirely from an input schema
|
|
8
|
+
*
|
|
9
|
+
* mapLayout:
|
|
10
|
+
*
|
|
11
|
+
* getLayoutNode:
|
|
12
|
+
*
|
|
13
|
+
* buildTitleMap:
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* 'buildLayout' function
|
|
17
|
+
*
|
|
18
|
+
* // jsf
|
|
19
|
+
* // widgetLibrary
|
|
20
|
+
* //
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildLayout_original(jsf: any, widgetLibrary: any): any[];
|
|
23
|
+
export declare function buildLayout(jsf: any, widgetLibrary: any): any[];
|
|
24
|
+
/**
|
|
25
|
+
* 'buildLayoutFromSchema' function
|
|
26
|
+
*
|
|
27
|
+
* // jsf -
|
|
28
|
+
* // widgetLibrary -
|
|
29
|
+
* // nodeValue -
|
|
30
|
+
* // { string = '' } schemaPointer -
|
|
31
|
+
* // { string = '' } dataPointer -
|
|
32
|
+
* // { boolean = false } arrayItem -
|
|
33
|
+
* // { string = null } arrayItemType -
|
|
34
|
+
* // { boolean = null } removable -
|
|
35
|
+
* // { boolean = false } forRefLibrary -
|
|
36
|
+
* // { string = '' } dataPointerPrefix -
|
|
37
|
+
* //
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildLayoutFromSchema(jsf: any, widgetLibrary: any, nodeValue?: any, schemaPointer?: string, dataPointer?: string, arrayItem?: boolean, arrayItemType?: string, removable?: boolean, forRefLibrary?: boolean, dataPointerPrefix?: string): any;
|
|
40
|
+
/**
|
|
41
|
+
* 'mapLayout' function
|
|
42
|
+
*
|
|
43
|
+
* Creates a new layout by running each element in an existing layout through
|
|
44
|
+
* an iteratee. Recursively maps within array elements 'items' and 'tabs'.
|
|
45
|
+
* The iteratee is invoked with four arguments: (value, index, layout, path)
|
|
46
|
+
*
|
|
47
|
+
* The returned layout may be longer (or shorter) then the source layout.
|
|
48
|
+
*
|
|
49
|
+
* If an item from the source layout returns multiple items (as '*' usually will),
|
|
50
|
+
* this function will keep all returned items in-line with the surrounding items.
|
|
51
|
+
*
|
|
52
|
+
* If an item from the source layout causes an error and returns null, it is
|
|
53
|
+
* skipped without error, and the function will still return all non-null items.
|
|
54
|
+
*
|
|
55
|
+
* // layout - the layout to map
|
|
56
|
+
* // { (v: any, i?: number, l?: any, p?: string) => any }
|
|
57
|
+
* function - the funciton to invoke on each element
|
|
58
|
+
* // { string|string[] = '' } layoutPointer - the layoutPointer to layout, inside rootLayout
|
|
59
|
+
* // { any[] = layout } rootLayout - the root layout, which conatins layout
|
|
60
|
+
* //
|
|
61
|
+
*/
|
|
62
|
+
export declare function mapLayout(layout: any, fn: any, layoutPointer?: string, rootLayout?: any): any[];
|
|
63
|
+
/**
|
|
64
|
+
* 'getLayoutNode' function
|
|
65
|
+
* Copy a new layoutNode from layoutRefLibrary
|
|
66
|
+
*
|
|
67
|
+
* // refNode -
|
|
68
|
+
* // layoutRefLibrary -
|
|
69
|
+
* // { any = null } widgetLibrary -
|
|
70
|
+
* // { any = null } nodeValue -
|
|
71
|
+
* // copied layoutNode
|
|
72
|
+
*/
|
|
73
|
+
export declare function getLayoutNode(refNode: any, jsf: any, widgetLibrary?: any, nodeValue?: any): any;
|
|
74
|
+
/**
|
|
75
|
+
* 'buildTitleMap' function
|
|
76
|
+
*
|
|
77
|
+
* // titleMap -
|
|
78
|
+
* // enumList -
|
|
79
|
+
* // { boolean = true } fieldRequired -
|
|
80
|
+
* // { boolean = true } flatList -
|
|
81
|
+
* // { TitleMapItem[] }
|
|
82
|
+
*/
|
|
83
|
+
export declare function buildTitleMap(titleMap: any, enumList: any, fieldRequired?: boolean, flatList?: boolean): TitleMapItem[];
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 'mergeSchemas' function
|
|
3
|
-
*
|
|
4
|
-
* Merges multiple JSON schemas into a single schema with combined rules.
|
|
5
|
-
*
|
|
6
|
-
* If able to logically merge properties from all schemas,
|
|
7
|
-
* returns a single schema object containing all merged properties.
|
|
8
|
-
*
|
|
9
|
-
* Example: ({ a: b, max: 1 }, { c: d, max: 2 }) => { a: b, c: d, max: 1 }
|
|
10
|
-
*
|
|
11
|
-
* If unable to logically merge, returns an allOf schema object containing
|
|
12
|
-
* an array of the original schemas;
|
|
13
|
-
*
|
|
14
|
-
* Example: ({ a: b }, { a: d }) => { allOf: [ { a: b }, { a: d } ] }
|
|
15
|
-
*
|
|
16
|
-
* // schemas - one or more input schemas
|
|
17
|
-
* // - merged schema
|
|
18
|
-
*/
|
|
19
|
-
export declare function mergeSchemas(...schemas: any[]): any;
|
|
1
|
+
/**
|
|
2
|
+
* 'mergeSchemas' function
|
|
3
|
+
*
|
|
4
|
+
* Merges multiple JSON schemas into a single schema with combined rules.
|
|
5
|
+
*
|
|
6
|
+
* If able to logically merge properties from all schemas,
|
|
7
|
+
* returns a single schema object containing all merged properties.
|
|
8
|
+
*
|
|
9
|
+
* Example: ({ a: b, max: 1 }, { c: d, max: 2 }) => { a: b, c: d, max: 1 }
|
|
10
|
+
*
|
|
11
|
+
* If unable to logically merge, returns an allOf schema object containing
|
|
12
|
+
* an array of the original schemas;
|
|
13
|
+
*
|
|
14
|
+
* Example: ({ a: b }, { a: d }) => { allOf: [ { a: b }, { a: d } ] }
|
|
15
|
+
*
|
|
16
|
+
* // schemas - one or more input schemas
|
|
17
|
+
* // - merged schema
|
|
18
|
+
*/
|
|
19
|
+
export declare function mergeSchemas(...schemas: any[]): any;
|
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
import { PlainObject } from './validator.functions';
|
|
2
|
-
/**
|
|
3
|
-
* Utility function library:
|
|
4
|
-
*
|
|
5
|
-
* addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject,
|
|
6
|
-
* uniqueItems, commonItems, fixTitle, toTitleCase
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* 'addClasses' function
|
|
10
|
-
*
|
|
11
|
-
* Merges two space-delimited lists of CSS classes and removes duplicates.
|
|
12
|
-
*
|
|
13
|
-
* // {string | string[] | Set<string>} oldClasses
|
|
14
|
-
* // {string | string[] | Set<string>} newClasses
|
|
15
|
-
* // {string | string[] | Set<string>} - Combined classes
|
|
16
|
-
*/
|
|
17
|
-
export declare function addClasses(oldClasses: string | string[] | Set<string>, newClasses: string | string[] | Set<string>): string | string[] | Set<string>;
|
|
18
|
-
/**
|
|
19
|
-
* 'copy' function
|
|
20
|
-
*
|
|
21
|
-
* Makes a shallow copy of a JavaScript object, array, Map, or Set.
|
|
22
|
-
* If passed a JavaScript primitive value (string, number, boolean, or null),
|
|
23
|
-
* it returns the value.
|
|
24
|
-
*
|
|
25
|
-
* // {Object|Array|string|number|boolean|null} object - The object to copy
|
|
26
|
-
* // {boolean = false} errors - Show errors?
|
|
27
|
-
* // {Object|Array|string|number|boolean|null} - The copied object
|
|
28
|
-
*/
|
|
29
|
-
export declare function copy(object: any, errors?: boolean): any;
|
|
30
|
-
/**
|
|
31
|
-
* 'forEach' function
|
|
32
|
-
*
|
|
33
|
-
* Iterates over all items in the first level of an object or array
|
|
34
|
-
* and calls an iterator funciton on each item.
|
|
35
|
-
*
|
|
36
|
-
* The iterator function is called with four values:
|
|
37
|
-
* 1. The current item's value
|
|
38
|
-
* 2. The current item's key
|
|
39
|
-
* 3. The parent object, which contains the current item
|
|
40
|
-
* 4. The root object
|
|
41
|
-
*
|
|
42
|
-
* Setting the optional third parameter to 'top-down' or 'bottom-up' will cause
|
|
43
|
-
* it to also recursively iterate over items in sub-objects or sub-arrays in the
|
|
44
|
-
* specified direction.
|
|
45
|
-
*
|
|
46
|
-
* // {Object|Array} object - The object or array to iterate over
|
|
47
|
-
* // {function} fn - the iterator funciton to call on each item
|
|
48
|
-
* // {boolean = false} errors - Show errors?
|
|
49
|
-
* // {void}
|
|
50
|
-
*/
|
|
51
|
-
export declare function forEach(object: any, fn: (v: any, k?: string | number, c?: any, rc?: any) => any, recurse?: boolean | string, rootObject?: any, errors?: boolean): void;
|
|
52
|
-
/**
|
|
53
|
-
* 'forEachCopy' function
|
|
54
|
-
*
|
|
55
|
-
* Iterates over all items in the first level of an object or array
|
|
56
|
-
* and calls an iterator function on each item. Returns a new object or array
|
|
57
|
-
* with the same keys or indexes as the original, and values set to the results
|
|
58
|
-
* of the iterator function.
|
|
59
|
-
*
|
|
60
|
-
* Does NOT recursively iterate over items in sub-objects or sub-arrays.
|
|
61
|
-
*
|
|
62
|
-
* // {Object | Array} object - The object or array to iterate over
|
|
63
|
-
* // {function} fn - The iterator funciton to call on each item
|
|
64
|
-
* // {boolean = false} errors - Show errors?
|
|
65
|
-
* // {Object | Array} - The resulting object or array
|
|
66
|
-
*/
|
|
67
|
-
export declare function forEachCopy(object: any, fn: (v: any, k?: string | number, o?: any, p?: string) => any, errors?: boolean): any;
|
|
68
|
-
/**
|
|
69
|
-
* 'hasOwn' utility function
|
|
70
|
-
*
|
|
71
|
-
* Checks whether an object or array has a particular property.
|
|
72
|
-
*
|
|
73
|
-
* // {any} object - the object to check
|
|
74
|
-
* // {string} property - the property to look for
|
|
75
|
-
* // {boolean} - true if object has property, false if not
|
|
76
|
-
*/
|
|
77
|
-
export declare function hasOwn(object: any, property: string): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Types of possible expressions which the app is able to evaluate.
|
|
80
|
-
*/
|
|
81
|
-
export declare enum ExpressionType {
|
|
82
|
-
EQUALS = 0,
|
|
83
|
-
NOT_EQUALS = 1,
|
|
84
|
-
NOT_AN_EXPRESSION = 2
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Detects the type of expression from the given candidate. `==` for equals,
|
|
88
|
-
* `!=` for not equals. If none of these are contained in the candidate, the candidate
|
|
89
|
-
* is not considered to be an expression at all and thus `NOT_AN_EXPRESSION` is returned.
|
|
90
|
-
* // {expressionCandidate} expressionCandidate - potential expression
|
|
91
|
-
*/
|
|
92
|
-
export declare function getExpressionType(expressionCandidate: string): ExpressionType;
|
|
93
|
-
export declare function isEqual(expressionType: any): boolean;
|
|
94
|
-
export declare function isNotEqual(expressionType: any): boolean;
|
|
95
|
-
export declare function isNotExpression(expressionType: any): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Splits the expression key by the expressionType on a pair of values
|
|
98
|
-
* before and after the equals or nor equals sign.
|
|
99
|
-
* // {expressionType} enum of an expression type
|
|
100
|
-
* // {key} the given key from a for loop iver all conditions
|
|
101
|
-
*/
|
|
102
|
-
export declare function getKeyAndValueByExpressionType(expressionType: ExpressionType, key: string): string[];
|
|
103
|
-
export declare function cleanValueOfQuotes(keyAndValue: any): String;
|
|
104
|
-
/**
|
|
105
|
-
* 'mergeFilteredObject' utility function
|
|
106
|
-
*
|
|
107
|
-
* Shallowly merges two objects, setting key and values from source object
|
|
108
|
-
* in target object, excluding specified keys.
|
|
109
|
-
*
|
|
110
|
-
* Optionally, it can also use functions to transform the key names and/or
|
|
111
|
-
* the values of the merging object.
|
|
112
|
-
*
|
|
113
|
-
* // {PlainObject} targetObject - Target object to add keys and values to
|
|
114
|
-
* // {PlainObject} sourceObject - Source object to copy keys and values from
|
|
115
|
-
* // {string[]} excludeKeys - Array of keys to exclude
|
|
116
|
-
* // {(string: string) => string = (k) => k} keyFn - Function to apply to keys
|
|
117
|
-
* // {(any: any) => any = (v) => v} valueFn - Function to apply to values
|
|
118
|
-
* // {PlainObject} - Returns targetObject
|
|
119
|
-
*/
|
|
120
|
-
export declare function mergeFilteredObject(targetObject: PlainObject, sourceObject: PlainObject, excludeKeys?: string[], keyFn?: (key: string) => string, valFn?: (val: any) => any): PlainObject;
|
|
121
|
-
/**
|
|
122
|
-
* 'uniqueItems' function
|
|
123
|
-
*
|
|
124
|
-
* Accepts any number of string value inputs,
|
|
125
|
-
* and returns an array of all input vaues, excluding duplicates.
|
|
126
|
-
*
|
|
127
|
-
* // {...string} ...items -
|
|
128
|
-
* // {string[]} -
|
|
129
|
-
*/
|
|
130
|
-
export declare function uniqueItems(...items: any[]): string[];
|
|
131
|
-
/**
|
|
132
|
-
* 'commonItems' function
|
|
133
|
-
*
|
|
134
|
-
* Accepts any number of strings or arrays of string values,
|
|
135
|
-
* and returns a single array containing only values present in all inputs.
|
|
136
|
-
*
|
|
137
|
-
* // {...string|string[]} ...arrays -
|
|
138
|
-
* // {string[]} -
|
|
139
|
-
*/
|
|
140
|
-
export declare function commonItems(...arrays: any[]): string[];
|
|
141
|
-
/**
|
|
142
|
-
* 'fixTitle' function
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* // {string} input -
|
|
146
|
-
* // {string} -
|
|
147
|
-
*/
|
|
148
|
-
export declare function fixTitle(name: string): string;
|
|
149
|
-
/**
|
|
150
|
-
* 'toTitleCase' function
|
|
151
|
-
*
|
|
152
|
-
* Intelligently converts an input string to Title Case.
|
|
153
|
-
*
|
|
154
|
-
* Accepts an optional second parameter with a list of additional
|
|
155
|
-
* words and abbreviations to force into a particular case.
|
|
156
|
-
*
|
|
157
|
-
* This function is built on prior work by John Gruber and David Gouch:
|
|
158
|
-
* http://daringfireball.net/2008/08/title_case_update
|
|
159
|
-
* https://github.com/gouch/to-title-case
|
|
160
|
-
*
|
|
161
|
-
* // {string} input -
|
|
162
|
-
* // {string|string[]} forceWords? -
|
|
163
|
-
* // {string} -
|
|
164
|
-
*/
|
|
165
|
-
export declare function toTitleCase(input: string, forceWords?: string | string[]): string;
|
|
1
|
+
import { PlainObject } from './validator.functions';
|
|
2
|
+
/**
|
|
3
|
+
* Utility function library:
|
|
4
|
+
*
|
|
5
|
+
* addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject,
|
|
6
|
+
* uniqueItems, commonItems, fixTitle, toTitleCase
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 'addClasses' function
|
|
10
|
+
*
|
|
11
|
+
* Merges two space-delimited lists of CSS classes and removes duplicates.
|
|
12
|
+
*
|
|
13
|
+
* // {string | string[] | Set<string>} oldClasses
|
|
14
|
+
* // {string | string[] | Set<string>} newClasses
|
|
15
|
+
* // {string | string[] | Set<string>} - Combined classes
|
|
16
|
+
*/
|
|
17
|
+
export declare function addClasses(oldClasses: string | string[] | Set<string>, newClasses: string | string[] | Set<string>): string | string[] | Set<string>;
|
|
18
|
+
/**
|
|
19
|
+
* 'copy' function
|
|
20
|
+
*
|
|
21
|
+
* Makes a shallow copy of a JavaScript object, array, Map, or Set.
|
|
22
|
+
* If passed a JavaScript primitive value (string, number, boolean, or null),
|
|
23
|
+
* it returns the value.
|
|
24
|
+
*
|
|
25
|
+
* // {Object|Array|string|number|boolean|null} object - The object to copy
|
|
26
|
+
* // {boolean = false} errors - Show errors?
|
|
27
|
+
* // {Object|Array|string|number|boolean|null} - The copied object
|
|
28
|
+
*/
|
|
29
|
+
export declare function copy(object: any, errors?: boolean): any;
|
|
30
|
+
/**
|
|
31
|
+
* 'forEach' function
|
|
32
|
+
*
|
|
33
|
+
* Iterates over all items in the first level of an object or array
|
|
34
|
+
* and calls an iterator funciton on each item.
|
|
35
|
+
*
|
|
36
|
+
* The iterator function is called with four values:
|
|
37
|
+
* 1. The current item's value
|
|
38
|
+
* 2. The current item's key
|
|
39
|
+
* 3. The parent object, which contains the current item
|
|
40
|
+
* 4. The root object
|
|
41
|
+
*
|
|
42
|
+
* Setting the optional third parameter to 'top-down' or 'bottom-up' will cause
|
|
43
|
+
* it to also recursively iterate over items in sub-objects or sub-arrays in the
|
|
44
|
+
* specified direction.
|
|
45
|
+
*
|
|
46
|
+
* // {Object|Array} object - The object or array to iterate over
|
|
47
|
+
* // {function} fn - the iterator funciton to call on each item
|
|
48
|
+
* // {boolean = false} errors - Show errors?
|
|
49
|
+
* // {void}
|
|
50
|
+
*/
|
|
51
|
+
export declare function forEach(object: any, fn: (v: any, k?: string | number, c?: any, rc?: any) => any, recurse?: boolean | string, rootObject?: any, errors?: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* 'forEachCopy' function
|
|
54
|
+
*
|
|
55
|
+
* Iterates over all items in the first level of an object or array
|
|
56
|
+
* and calls an iterator function on each item. Returns a new object or array
|
|
57
|
+
* with the same keys or indexes as the original, and values set to the results
|
|
58
|
+
* of the iterator function.
|
|
59
|
+
*
|
|
60
|
+
* Does NOT recursively iterate over items in sub-objects or sub-arrays.
|
|
61
|
+
*
|
|
62
|
+
* // {Object | Array} object - The object or array to iterate over
|
|
63
|
+
* // {function} fn - The iterator funciton to call on each item
|
|
64
|
+
* // {boolean = false} errors - Show errors?
|
|
65
|
+
* // {Object | Array} - The resulting object or array
|
|
66
|
+
*/
|
|
67
|
+
export declare function forEachCopy(object: any, fn: (v: any, k?: string | number, o?: any, p?: string) => any, errors?: boolean): any;
|
|
68
|
+
/**
|
|
69
|
+
* 'hasOwn' utility function
|
|
70
|
+
*
|
|
71
|
+
* Checks whether an object or array has a particular property.
|
|
72
|
+
*
|
|
73
|
+
* // {any} object - the object to check
|
|
74
|
+
* // {string} property - the property to look for
|
|
75
|
+
* // {boolean} - true if object has property, false if not
|
|
76
|
+
*/
|
|
77
|
+
export declare function hasOwn(object: any, property: string): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Types of possible expressions which the app is able to evaluate.
|
|
80
|
+
*/
|
|
81
|
+
export declare enum ExpressionType {
|
|
82
|
+
EQUALS = 0,
|
|
83
|
+
NOT_EQUALS = 1,
|
|
84
|
+
NOT_AN_EXPRESSION = 2
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Detects the type of expression from the given candidate. `==` for equals,
|
|
88
|
+
* `!=` for not equals. If none of these are contained in the candidate, the candidate
|
|
89
|
+
* is not considered to be an expression at all and thus `NOT_AN_EXPRESSION` is returned.
|
|
90
|
+
* // {expressionCandidate} expressionCandidate - potential expression
|
|
91
|
+
*/
|
|
92
|
+
export declare function getExpressionType(expressionCandidate: string): ExpressionType;
|
|
93
|
+
export declare function isEqual(expressionType: any): boolean;
|
|
94
|
+
export declare function isNotEqual(expressionType: any): boolean;
|
|
95
|
+
export declare function isNotExpression(expressionType: any): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Splits the expression key by the expressionType on a pair of values
|
|
98
|
+
* before and after the equals or nor equals sign.
|
|
99
|
+
* // {expressionType} enum of an expression type
|
|
100
|
+
* // {key} the given key from a for loop iver all conditions
|
|
101
|
+
*/
|
|
102
|
+
export declare function getKeyAndValueByExpressionType(expressionType: ExpressionType, key: string): string[];
|
|
103
|
+
export declare function cleanValueOfQuotes(keyAndValue: any): String;
|
|
104
|
+
/**
|
|
105
|
+
* 'mergeFilteredObject' utility function
|
|
106
|
+
*
|
|
107
|
+
* Shallowly merges two objects, setting key and values from source object
|
|
108
|
+
* in target object, excluding specified keys.
|
|
109
|
+
*
|
|
110
|
+
* Optionally, it can also use functions to transform the key names and/or
|
|
111
|
+
* the values of the merging object.
|
|
112
|
+
*
|
|
113
|
+
* // {PlainObject} targetObject - Target object to add keys and values to
|
|
114
|
+
* // {PlainObject} sourceObject - Source object to copy keys and values from
|
|
115
|
+
* // {string[]} excludeKeys - Array of keys to exclude
|
|
116
|
+
* // {(string: string) => string = (k) => k} keyFn - Function to apply to keys
|
|
117
|
+
* // {(any: any) => any = (v) => v} valueFn - Function to apply to values
|
|
118
|
+
* // {PlainObject} - Returns targetObject
|
|
119
|
+
*/
|
|
120
|
+
export declare function mergeFilteredObject(targetObject: PlainObject, sourceObject: PlainObject, excludeKeys?: string[], keyFn?: (key: string) => string, valFn?: (val: any) => any): PlainObject;
|
|
121
|
+
/**
|
|
122
|
+
* 'uniqueItems' function
|
|
123
|
+
*
|
|
124
|
+
* Accepts any number of string value inputs,
|
|
125
|
+
* and returns an array of all input vaues, excluding duplicates.
|
|
126
|
+
*
|
|
127
|
+
* // {...string} ...items -
|
|
128
|
+
* // {string[]} -
|
|
129
|
+
*/
|
|
130
|
+
export declare function uniqueItems(...items: any[]): string[];
|
|
131
|
+
/**
|
|
132
|
+
* 'commonItems' function
|
|
133
|
+
*
|
|
134
|
+
* Accepts any number of strings or arrays of string values,
|
|
135
|
+
* and returns a single array containing only values present in all inputs.
|
|
136
|
+
*
|
|
137
|
+
* // {...string|string[]} ...arrays -
|
|
138
|
+
* // {string[]} -
|
|
139
|
+
*/
|
|
140
|
+
export declare function commonItems(...arrays: any[]): string[];
|
|
141
|
+
/**
|
|
142
|
+
* 'fixTitle' function
|
|
143
|
+
*
|
|
144
|
+
*
|
|
145
|
+
* // {string} input -
|
|
146
|
+
* // {string} -
|
|
147
|
+
*/
|
|
148
|
+
export declare function fixTitle(name: string): string;
|
|
149
|
+
/**
|
|
150
|
+
* 'toTitleCase' function
|
|
151
|
+
*
|
|
152
|
+
* Intelligently converts an input string to Title Case.
|
|
153
|
+
*
|
|
154
|
+
* Accepts an optional second parameter with a list of additional
|
|
155
|
+
* words and abbreviations to force into a particular case.
|
|
156
|
+
*
|
|
157
|
+
* This function is built on prior work by John Gruber and David Gouch:
|
|
158
|
+
* http://daringfireball.net/2008/08/title_case_update
|
|
159
|
+
* https://github.com/gouch/to-title-case
|
|
160
|
+
*
|
|
161
|
+
* // {string} input -
|
|
162
|
+
* // {string|string[]} forceWords? -
|
|
163
|
+
* // {string} -
|
|
164
|
+
*/
|
|
165
|
+
export declare function toTitleCase(input: string, forceWords?: string | string[]): string;
|