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.
Files changed (106) hide show
  1. package/dist/index.d.ts +13 -9
  2. package/dist/index.js +13 -9
  3. package/dist/interfaces/DeepProperty/DeepProperty.d.ts +25 -0
  4. package/dist/interfaces/DeepProperty/DeepProperty.js +1 -0
  5. package/dist/interfaces/DeepProperty/index.d.ts +1 -0
  6. package/dist/interfaces/DeepProperty/index.js +1 -0
  7. package/dist/interfaces/Encryption/EncryptedData.d.ts +19 -0
  8. package/dist/interfaces/Encryption/EncryptedData.js +1 -0
  9. package/dist/interfaces/Encryption/index.d.ts +1 -0
  10. package/dist/interfaces/Encryption/index.js +1 -0
  11. package/dist/interfaces/Form/ArrayFunctions.d.ts +43 -1
  12. package/dist/interfaces/Form/ArrayFunctions.js +28 -0
  13. package/dist/interfaces/Form/FormInClassUtils.d.ts +9 -7
  14. package/dist/interfaces/Form/IFormsInitStateInterface.d.ts +1 -1
  15. package/dist/interfaces/Form/formInterface.d.ts +8 -3
  16. package/dist/interfaces/Form/formSubmissionHandleInterface.d.ts +2 -2
  17. package/dist/interfaces/Form/index.d.ts +13 -12
  18. package/dist/interfaces/Form/index.js +5 -1
  19. package/dist/interfaces/FormBuilder/DefaultEelement.d.ts +1 -1
  20. package/dist/interfaces/FormBuilder/DefaultEelement.js +9 -9
  21. package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.d.ts +36 -25
  22. package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.js +1 -1
  23. package/dist/interfaces/FormBuilder/FormBuilderCallBackFunctions.d.ts +11 -3
  24. package/dist/interfaces/FormBuilder/elementEditor.d.ts +8 -7
  25. package/dist/interfaces/FormBuilder/elementEditor.js +1 -0
  26. package/dist/interfaces/FormBuilder/index.d.ts +11 -10
  27. package/dist/interfaces/FormBuilder/index.js +6 -6
  28. package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.d.ts +1 -1
  29. package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.js +14 -13
  30. package/dist/interfaces/FormBuilder/inputConfig/getInputValueFromElement.js +3 -3
  31. package/dist/interfaces/FormBuilder/workflowSelectionConfig.d.ts +2 -2
  32. package/dist/interfaces/FormSlide/accessTree.d.ts +1 -1
  33. package/dist/interfaces/FormSlide/formSlideInterface.d.ts +1 -1
  34. package/dist/interfaces/FormSlide/index.d.ts +3 -3
  35. package/dist/interfaces/FormSlide/index.js +1 -1
  36. package/dist/interfaces/Import/ImportProgress.d.ts +29 -0
  37. package/dist/interfaces/Import/ImportProgress.js +1 -0
  38. package/dist/interfaces/Import/ImportRowState.d.ts +66 -0
  39. package/dist/interfaces/Import/ImportRowState.js +1 -0
  40. package/dist/interfaces/Import/index.d.ts +2 -0
  41. package/dist/interfaces/Import/index.js +1 -0
  42. package/dist/interfaces/Tour/IFormTour.d.ts +14 -0
  43. package/dist/interfaces/Tour/IFormTour.js +1 -0
  44. package/dist/interfaces/Tour/index.d.ts +1 -0
  45. package/dist/interfaces/Tour/index.js +1 -0
  46. package/dist/interfaces/Tower/ITowerFormSteps.d.ts +3 -3
  47. package/dist/interfaces/Tower/ITowerFormSteps.js +1 -1
  48. package/dist/interfaces/Tower/index.d.ts +1 -1
  49. package/dist/interfaces/environment/IStoreFunctions.d.ts +8 -7
  50. package/dist/interfaces/environment/IStoreFunctions.js +1 -1
  51. package/dist/interfaces/environment/environment.d.ts +1 -1
  52. package/dist/interfaces/environment/index.d.ts +2 -2
  53. package/dist/interfaces/formInput/APIDataFetchingConfigurationInterface.d.ts +3 -3
  54. package/dist/interfaces/formInput/BasicFormInputInterface.d.ts +9 -9
  55. package/dist/interfaces/formInput/DateRangePickerInput.d.ts +1 -1
  56. package/dist/interfaces/formInput/FileUploadInputInterface.d.ts +7 -2
  57. package/dist/interfaces/formInput/FormControlCustomValidatorsInterface.d.ts +38 -4
  58. package/dist/interfaces/formInput/FormValidationOverride.d.ts +48 -0
  59. package/dist/interfaces/formInput/FormValidationOverride.js +1 -0
  60. package/dist/interfaces/formInput/IMscoaAccount.d.ts +25 -9
  61. package/dist/interfaces/formInput/ISelectInputInterface.d.ts +3 -3
  62. package/dist/interfaces/formInput/ISelectInputInterface.js +1 -1
  63. package/dist/interfaces/formInput/MatDataOptionsInterface.d.ts +2 -2
  64. package/dist/interfaces/formInput/MatrixInputInterface.d.ts +2 -2
  65. package/dist/interfaces/formInput/MinimumInputRequiredInterface.d.ts +1 -1
  66. package/dist/interfaces/formInput/MscoaInput.d.ts +2 -2
  67. package/dist/interfaces/formInput/MscoaInput.js +1 -1
  68. package/dist/interfaces/formInput/MultipleInterface.d.ts +2 -2
  69. package/dist/interfaces/formInput/RichTextEditorInput.d.ts +16 -2
  70. package/dist/interfaces/formInput/RichTextEditorInput.js +11 -1
  71. package/dist/interfaces/formInput/TableConfigurationsInterface.d.ts +1 -1
  72. package/dist/interfaces/formInput/TextAreaInput.d.ts +1 -1
  73. package/dist/interfaces/formInput/ToggleInputInterface.d.ts +1 -1
  74. package/dist/interfaces/formInput/WorkflowAdjudication.d.ts +16 -4
  75. package/dist/interfaces/formInput/WorkflowDocumentPicker.d.ts +4 -4
  76. package/dist/interfaces/formInput/WorkflowDocumentPicker.js +1 -1
  77. package/dist/interfaces/formInput/calculatedFieldRules.d.ts +1 -1
  78. package/dist/interfaces/formInput/calculationVariableInterface.d.ts +3 -1
  79. package/dist/interfaces/formInput/calculationVariableInterface.js +2 -0
  80. package/dist/interfaces/formInput/index.d.ts +28 -26
  81. package/dist/interfaces/formInput/index.js +15 -9
  82. package/dist/interfaces/formInput/schema.d.ts +11 -2
  83. package/dist/interfaces/pipeline-builder/index.d.ts +1 -1
  84. package/dist/interfaces/pipeline-builder/index.js +1 -1
  85. package/dist/interfaces/upgradeFunctions/interfaces/init-form.d.ts +14 -1
  86. package/dist/interfaces/workflow/WorkflowFunctionTypes.d.ts +26 -0
  87. package/dist/interfaces/workflow/WorkflowFunctionTypes.js +27 -0
  88. package/dist/interfaces/workflow/index.d.ts +3 -2
  89. package/dist/interfaces/workflow/index.js +3 -2
  90. package/dist/schemas/CalculatedFieldRulesSchema.d.ts +1 -1
  91. package/dist/schemas/CalculatedFieldRulesSchema.js +1 -1
  92. package/dist/schemas/DocmentPickerInputSchema.js +2 -2
  93. package/dist/schemas/FormInputSchema.d.ts +2 -2
  94. package/dist/schemas/FormInputSchema.js +18 -18
  95. package/dist/schemas/FormSchema.d.ts +2 -2
  96. package/dist/schemas/FormSchema.js +3 -3
  97. package/dist/schemas/MatOptionsSchema.js +2 -2
  98. package/dist/schemas/MscoaConfigSchema.js +1 -1
  99. package/dist/schemas/customValidationSchema.d.ts +1 -1
  100. package/dist/schemas/customValidationSchema.js +6 -2
  101. package/dist/schemas/index.d.ts +3 -3
  102. package/dist/schemas/index.js +3 -3
  103. package/dist/schemas/tests/CustomValidationSchema.spec.d.ts +1 -0
  104. package/dist/schemas/tests/CustomValidationSchema.spec.js +92 -0
  105. package/dist/schemas/tests/FormInputValidator.spec.js +3 -8
  106. 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 { TestBed } from '@angular/core/testing';
2
- import { AllFormInputPrimaryKeys, } from '../../interfaces/FormBuilder';
3
- import { ElementTypes, InputDataTypes, InputPipeTypes, InputTypes } from '../../interfaces/formInput';
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.19",
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": "commonjs",
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 build --mode production",
34
- "prepublishOnly": "npm run build",
35
- "dev": "npm run build --watch"
36
- },
37
- "devDependencies": {
38
- "@angular/cdk": "^19.2.2",
39
- "@angular/common": "^19.2.1",
40
- "@angular/core": "^19.2.1",
41
- "@angular/material": "^19.2.2",
42
- "@angular/router": "^19.2.1",
43
- "@types/jasmine": "^5.1.7",
44
- "@types/joi": "^17.2.2",
45
- "@types/node": "^22.13.9",
46
- "jasmine-core": "^5.6.0",
47
- "karma": "^6.4.4",
48
- "karma-chrome-launcher": "^3.2.0",
49
- "karma-jasmine": "^5.1.0",
50
- "karma-webpack": "^5.0.1",
51
- "mongoose": "^8.12.1",
52
- "rimraf": "^6.0.1",
53
- "rxjs": "^7.8.2",
54
- "signature_pad": "^5.0.4",
55
- "ts-loader": "^9.5.2",
56
- "typescript": "^5.8.2",
57
- "webpack": "^5.98.0",
58
- "webpack-dev-server": "^5.2.0"
59
- },
60
- "dependencies": {
61
- "moment": "^2.30.1"
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
+ }