ngx-t-forms-types 0.0.19 → 0.0.21
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/dist/index.d.ts +13 -9
- package/dist/index.js +13 -9
- package/dist/interfaces/DeepProperty/DeepProperty.d.ts +25 -0
- package/dist/interfaces/DeepProperty/DeepProperty.js +1 -0
- package/dist/interfaces/DeepProperty/index.d.ts +1 -0
- package/dist/interfaces/DeepProperty/index.js +1 -0
- package/dist/interfaces/Encryption/EncryptedData.d.ts +19 -0
- package/dist/interfaces/Encryption/EncryptedData.js +1 -0
- package/dist/interfaces/Encryption/index.d.ts +1 -0
- package/dist/interfaces/Encryption/index.js +1 -0
- package/dist/interfaces/Form/ArrayFunctions.d.ts +43 -1
- package/dist/interfaces/Form/ArrayFunctions.js +28 -0
- package/dist/interfaces/Form/FormInClassUtils.d.ts +9 -7
- package/dist/interfaces/Form/IFormsInitStateInterface.d.ts +1 -1
- package/dist/interfaces/Form/formInterface.d.ts +8 -3
- package/dist/interfaces/Form/formSubmissionHandleInterface.d.ts +2 -2
- package/dist/interfaces/Form/index.d.ts +13 -12
- package/dist/interfaces/Form/index.js +5 -1
- package/dist/interfaces/FormBuilder/DefaultEelement.d.ts +1 -1
- package/dist/interfaces/FormBuilder/DefaultEelement.js +9 -9
- package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.d.ts +36 -25
- package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.js +1 -1
- package/dist/interfaces/FormBuilder/FormBuilderCallBackFunctions.d.ts +11 -3
- package/dist/interfaces/FormBuilder/elementEditor.d.ts +8 -7
- package/dist/interfaces/FormBuilder/elementEditor.js +1 -0
- package/dist/interfaces/FormBuilder/index.d.ts +11 -10
- package/dist/interfaces/FormBuilder/index.js +6 -6
- package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.d.ts +1 -1
- package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.js +14 -13
- package/dist/interfaces/FormBuilder/inputConfig/getInputValueFromElement.js +3 -3
- package/dist/interfaces/FormBuilder/workflowSelectionConfig.d.ts +2 -2
- package/dist/interfaces/FormSlide/accessTree.d.ts +1 -1
- package/dist/interfaces/FormSlide/formSlideInterface.d.ts +1 -1
- package/dist/interfaces/FormSlide/index.d.ts +3 -3
- package/dist/interfaces/FormSlide/index.js +1 -1
- package/dist/interfaces/Import/ImportProgress.d.ts +29 -0
- package/dist/interfaces/Import/ImportProgress.js +1 -0
- package/dist/interfaces/Import/ImportRowState.d.ts +66 -0
- package/dist/interfaces/Import/ImportRowState.js +1 -0
- package/dist/interfaces/Import/index.d.ts +2 -0
- package/dist/interfaces/Import/index.js +1 -0
- package/dist/interfaces/Tour/IFormTour.d.ts +14 -0
- package/dist/interfaces/Tour/IFormTour.js +1 -0
- package/dist/interfaces/Tour/index.d.ts +1 -0
- package/dist/interfaces/Tour/index.js +1 -0
- package/dist/interfaces/Tower/ITowerFormSteps.d.ts +3 -3
- package/dist/interfaces/Tower/ITowerFormSteps.js +1 -1
- package/dist/interfaces/Tower/index.d.ts +1 -1
- package/dist/interfaces/environment/IStoreFunctions.d.ts +8 -7
- package/dist/interfaces/environment/IStoreFunctions.js +1 -1
- package/dist/interfaces/environment/environment.d.ts +1 -1
- package/dist/interfaces/environment/index.d.ts +2 -2
- package/dist/interfaces/formInput/APIDataFetchingConfigurationInterface.d.ts +3 -3
- package/dist/interfaces/formInput/BasicFormInputInterface.d.ts +9 -9
- package/dist/interfaces/formInput/DateRangePickerInput.d.ts +1 -1
- package/dist/interfaces/formInput/FileUploadInputInterface.d.ts +7 -2
- package/dist/interfaces/formInput/FormControlCustomValidatorsInterface.d.ts +38 -4
- package/dist/interfaces/formInput/FormValidationOverride.d.ts +48 -0
- package/dist/interfaces/formInput/FormValidationOverride.js +1 -0
- package/dist/interfaces/formInput/IMscoaAccount.d.ts +25 -9
- package/dist/interfaces/formInput/ISelectInputInterface.d.ts +3 -3
- package/dist/interfaces/formInput/ISelectInputInterface.js +1 -1
- package/dist/interfaces/formInput/MatDataOptionsInterface.d.ts +2 -2
- package/dist/interfaces/formInput/MatrixInputInterface.d.ts +2 -2
- package/dist/interfaces/formInput/MinimumInputRequiredInterface.d.ts +1 -1
- package/dist/interfaces/formInput/MscoaInput.d.ts +2 -2
- package/dist/interfaces/formInput/MscoaInput.js +1 -1
- package/dist/interfaces/formInput/MultipleInterface.d.ts +2 -2
- package/dist/interfaces/formInput/RichTextEditorInput.d.ts +16 -2
- package/dist/interfaces/formInput/RichTextEditorInput.js +11 -1
- package/dist/interfaces/formInput/TableConfigurationsInterface.d.ts +1 -1
- package/dist/interfaces/formInput/TextAreaInput.d.ts +1 -1
- package/dist/interfaces/formInput/ToggleInputInterface.d.ts +1 -1
- package/dist/interfaces/formInput/WorkflowAdjudication.d.ts +16 -4
- package/dist/interfaces/formInput/WorkflowDocumentPicker.d.ts +4 -4
- package/dist/interfaces/formInput/WorkflowDocumentPicker.js +1 -1
- package/dist/interfaces/formInput/calculatedFieldRules.d.ts +1 -1
- package/dist/interfaces/formInput/calculationVariableInterface.d.ts +3 -1
- package/dist/interfaces/formInput/calculationVariableInterface.js +2 -0
- package/dist/interfaces/formInput/index.d.ts +28 -26
- package/dist/interfaces/formInput/index.js +15 -9
- package/dist/interfaces/formInput/schema.d.ts +11 -2
- package/dist/interfaces/pipeline-builder/index.d.ts +1 -1
- package/dist/interfaces/pipeline-builder/index.js +1 -1
- package/dist/interfaces/upgradeFunctions/interfaces/init-form.d.ts +14 -1
- package/dist/interfaces/workflow/WorkflowFunctionTypes.d.ts +26 -0
- package/dist/interfaces/workflow/WorkflowFunctionTypes.js +27 -0
- package/dist/interfaces/workflow/index.d.ts +3 -2
- package/dist/interfaces/workflow/index.js +3 -2
- package/dist/schemas/CalculatedFieldRulesSchema.d.ts +1 -1
- package/dist/schemas/CalculatedFieldRulesSchema.js +1 -1
- package/dist/schemas/DocmentPickerInputSchema.js +2 -2
- package/dist/schemas/FormInputSchema.d.ts +2 -2
- package/dist/schemas/FormInputSchema.js +18 -18
- package/dist/schemas/FormSchema.d.ts +2 -2
- package/dist/schemas/FormSchema.js +3 -3
- package/dist/schemas/MatOptionsSchema.js +2 -2
- package/dist/schemas/MscoaConfigSchema.js +1 -1
- package/dist/schemas/customValidationSchema.d.ts +1 -1
- package/dist/schemas/customValidationSchema.js +6 -2
- package/dist/schemas/index.d.ts +3 -3
- package/dist/schemas/index.js +3 -3
- package/dist/schemas/tests/CustomValidationSchema.spec.d.ts +1 -0
- package/dist/schemas/tests/CustomValidationSchema.spec.js +92 -0
- package/dist/schemas/tests/FormInputValidator.spec.js +3 -8
- package/package.json +83 -63
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { CalculationFunctions } from '../../interfaces/formInput/calculationVariableInterface.js';
|
|
2
|
+
import { formControlCustomValidatorSchema, inputsObservedForChangesSchema, } from '../customValidationSchema.js';
|
|
3
|
+
// ng test ngx-t-forms --include='projects/ngx-t-forms/src/lib/schemas/tests/CustomValidationSchema.spec.ts'
|
|
4
|
+
/**
|
|
5
|
+
* Behavioural coverage for the custom-validation Joi schemas.
|
|
6
|
+
*
|
|
7
|
+
* These tests describe what a valid custom validator looks like and what the
|
|
8
|
+
* schema must reject, so that future schema changes that alter validation
|
|
9
|
+
* behaviour fail loudly.
|
|
10
|
+
*/
|
|
11
|
+
describe('formControlCustomValidatorSchema', () => {
|
|
12
|
+
/** A minimal, fully-valid custom validator. */
|
|
13
|
+
const validValidator = () => ({
|
|
14
|
+
id: 'validator-1',
|
|
15
|
+
message: 'Value must be greater than the minimum',
|
|
16
|
+
expression: 'amount > minimum',
|
|
17
|
+
canOverride: false,
|
|
18
|
+
inputsObservedForChanges: [
|
|
19
|
+
{ inputId: 'amount-input', variable: 'amount' },
|
|
20
|
+
{ inputId: 'minimum-input', variable: 'minimum' },
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
it('accepts a fully-specified custom validator', () => {
|
|
24
|
+
const result = formControlCustomValidatorSchema.validate(validValidator());
|
|
25
|
+
expect(result.error).toBeUndefined();
|
|
26
|
+
});
|
|
27
|
+
it('accepts an empty list of observed inputs (a constant expression)', () => {
|
|
28
|
+
const validator = { ...validValidator(), inputsObservedForChanges: [] };
|
|
29
|
+
const result = formControlCustomValidatorSchema.validate(validator);
|
|
30
|
+
expect(result.error).toBeUndefined();
|
|
31
|
+
});
|
|
32
|
+
['id', 'message', 'expression', 'canOverride', 'inputsObservedForChanges'].forEach((field) => {
|
|
33
|
+
it(`rejects a validator missing the required "${field}" field`, () => {
|
|
34
|
+
const validator = validValidator();
|
|
35
|
+
delete validator[field];
|
|
36
|
+
const result = formControlCustomValidatorSchema.validate(validator);
|
|
37
|
+
expect(result.error).toBeDefined();
|
|
38
|
+
expect(result.error?.details[0].path).toContain(field);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
it('rejects a non-boolean canOverride', () => {
|
|
42
|
+
const validator = { ...validValidator(), canOverride: 'yes' };
|
|
43
|
+
const result = formControlCustomValidatorSchema.validate(validator);
|
|
44
|
+
expect(result.error).toBeDefined();
|
|
45
|
+
});
|
|
46
|
+
it('rejects an observed input that is missing or malformed', () => {
|
|
47
|
+
const validator = {
|
|
48
|
+
...validValidator(),
|
|
49
|
+
inputsObservedForChanges: [{ inputId: 123, variable: 'amount' }],
|
|
50
|
+
};
|
|
51
|
+
const result = formControlCustomValidatorSchema.validate(validator);
|
|
52
|
+
expect(result.error).toBeDefined();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe('inputsObservedForChangesSchema', () => {
|
|
56
|
+
it('accepts a scalar binding (inputId + variable only)', () => {
|
|
57
|
+
const result = inputsObservedForChangesSchema.validate({
|
|
58
|
+
inputId: 'amount-input',
|
|
59
|
+
variable: 'amount',
|
|
60
|
+
});
|
|
61
|
+
expect(result.error).toBeUndefined();
|
|
62
|
+
});
|
|
63
|
+
it('accepts a list binding with parentInputId and an aggregate function', () => {
|
|
64
|
+
const result = inputsObservedForChangesSchema.validate({
|
|
65
|
+
inputId: 'line-amount',
|
|
66
|
+
variable: 'lineTotal',
|
|
67
|
+
parentInputId: 'line-items',
|
|
68
|
+
function: CalculationFunctions.Sum,
|
|
69
|
+
});
|
|
70
|
+
expect(result.error).toBeUndefined();
|
|
71
|
+
});
|
|
72
|
+
it('accepts every supported aggregate function', () => {
|
|
73
|
+
Object.values(CalculationFunctions).forEach((fn) => {
|
|
74
|
+
const result = inputsObservedForChangesSchema.validate({
|
|
75
|
+
inputId: 'line-amount',
|
|
76
|
+
variable: 'lineTotal',
|
|
77
|
+
parentInputId: 'line-items',
|
|
78
|
+
function: fn,
|
|
79
|
+
});
|
|
80
|
+
expect(result.error).withContext(`function "${fn}"`).toBeUndefined();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
it('rejects an unknown aggregate function', () => {
|
|
84
|
+
const result = inputsObservedForChangesSchema.validate({
|
|
85
|
+
inputId: 'line-amount',
|
|
86
|
+
variable: 'lineTotal',
|
|
87
|
+
parentInputId: 'line-items',
|
|
88
|
+
function: 'median',
|
|
89
|
+
});
|
|
90
|
+
expect(result.error).toBeDefined();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { formColumnInputsSchema } from '../FormInputSchema';
|
|
1
|
+
import { AllFormInputPrimaryKeys, } from '../../interfaces/FormBuilder/index.js';
|
|
2
|
+
import { ElementTypes, InputDataTypes, InputPipeTypes, InputTypes } from '../../interfaces/formInput/index.js';
|
|
3
|
+
import { formColumnInputsSchema } from '../FormInputSchema.js';
|
|
5
4
|
//ng test ngx-t-forms --include='projects/ngx-t-forms/src/lib/schemas/tests/FormInputValidator.spec.ts'
|
|
6
5
|
describe('FormInputValidator', () => {
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
TestBed.configureTestingModule({});
|
|
9
|
-
});
|
|
10
6
|
it('should validate a valid form input configuration', () => {
|
|
11
7
|
const validInput = {
|
|
12
8
|
[AllFormInputPrimaryKeys.Element]: ElementTypes.Input,
|
|
@@ -48,7 +44,6 @@ describe('FormInputValidator', () => {
|
|
|
48
44
|
}
|
|
49
45
|
};
|
|
50
46
|
const result = formColumnInputsSchema.validate(inputWithOptionals);
|
|
51
|
-
console.warn(result, "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy");
|
|
52
47
|
expect(result.error).toBeUndefined();
|
|
53
48
|
});
|
|
54
49
|
it('should fail validation for invalid enum values', () => {
|
package/package.json
CHANGED
|
@@ -1,63 +1,83 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ngx-t-forms-types",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Typings and interfaces for the ngx-t-forms library for dynamic forms.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"typings",
|
|
7
|
-
"typescript"
|
|
8
|
-
],
|
|
9
|
-
"homepage": "https://github.com/mashegoTerrence/ngx-t-forms-typings#readme",
|
|
10
|
-
"bugs": {
|
|
11
|
-
"url": "https://github.com/mashegoTerrence/ngx-t-forms-typings/issues"
|
|
12
|
-
},
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/mashegoTerrence/ngx-t-forms-typings.git"
|
|
19
|
-
},
|
|
20
|
-
"license": "ISC",
|
|
21
|
-
"author": "mashegoterrence@gmail.com",
|
|
22
|
-
"type": "
|
|
23
|
-
"main": "dist/index.js",
|
|
24
|
-
"types": "dist/index.d.ts",
|
|
25
|
-
"files": [
|
|
26
|
-
"dist"
|
|
27
|
-
],
|
|
28
|
-
"scripts": {
|
|
29
|
-
"test": "karma start",
|
|
30
|
-
"clean": "rimraf dist",
|
|
31
|
-
"typecheck": "tsc --noEmit",
|
|
32
|
-
"build": "npm run clean && tsc",
|
|
33
|
-
"build:prod": "npm run
|
|
34
|
-
"prepublishOnly": "npm run build",
|
|
35
|
-
"dev": "npm run build --watch"
|
|
36
|
-
},
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"@angular/
|
|
42
|
-
"@angular/
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "ngx-t-forms-types",
|
|
3
|
+
"version": "0.0.21",
|
|
4
|
+
"description": "Typings and interfaces for the ngx-t-forms library for dynamic forms.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typings",
|
|
7
|
+
"typescript"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/mashegoTerrence/ngx-t-forms-typings#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/mashegoTerrence/ngx-t-forms-typings/issues"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/mashegoTerrence/ngx-t-forms-typings.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"author": "mashegoterrence@gmail.com",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "karma start karma.conf.cjs",
|
|
30
|
+
"clean": "rimraf dist",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"build": "npm run clean && tsc && node scripts/add-js-extensions.mjs",
|
|
33
|
+
"build:prod": "npm run clean && tsc -p tsconfig.prod.json",
|
|
34
|
+
"prepublishOnly": "npm run build",
|
|
35
|
+
"dev": "npm run build --watch"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"joi": "^18.2.1"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@angular/cdk": "^21.0.0",
|
|
42
|
+
"@angular/common": "^21.0.0",
|
|
43
|
+
"@angular/core": "^21.0.0",
|
|
44
|
+
"@angular/forms": "^21.0.0",
|
|
45
|
+
"@angular/material": "^21.0.0",
|
|
46
|
+
"@angular/router": "^21.0.0",
|
|
47
|
+
"mongoose": "^8.23.0",
|
|
48
|
+
"moment": "^2.30.1",
|
|
49
|
+
"ngx-ui-tour-md-menu": "^16.0.0",
|
|
50
|
+
"rxjs": "~7.8.0",
|
|
51
|
+
"signature_pad": "^5.1.3"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"mongoose": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@angular/cdk": "^21.2.12",
|
|
60
|
+
"@angular/common": "^21.2.12",
|
|
61
|
+
"@angular/core": "^21.2.12",
|
|
62
|
+
"@angular/forms": "^21.2.12",
|
|
63
|
+
"@angular/material": "^21.2.12",
|
|
64
|
+
"@angular/router": "^21.2.12",
|
|
65
|
+
"@types/jasmine": "^5.1.7",
|
|
66
|
+
"@types/node": "^22.13.9",
|
|
67
|
+
"jasmine-core": "^5.6.0",
|
|
68
|
+
"karma": "^6.4.4",
|
|
69
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
70
|
+
"karma-jasmine": "^5.1.0",
|
|
71
|
+
"karma-webpack": "^5.0.1",
|
|
72
|
+
"moment": "^2.30.1",
|
|
73
|
+
"mongoose": "^8.23.0",
|
|
74
|
+
"ngx-ui-tour-md-menu": "^16.0.0",
|
|
75
|
+
"rimraf": "^6.0.1",
|
|
76
|
+
"rxjs": "~7.8.0",
|
|
77
|
+
"signature_pad": "^5.1.3",
|
|
78
|
+
"ts-loader": "^9.5.2",
|
|
79
|
+
"typescript": "~5.9.2",
|
|
80
|
+
"webpack": "^5.98.0",
|
|
81
|
+
"webpack-dev-server": "^5.2.0"
|
|
82
|
+
}
|
|
83
|
+
}
|