@ng-formworks/core 15.2.7

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 (67) hide show
  1. package/karma.conf.js +46 -0
  2. package/ng-package.json +11 -0
  3. package/package.json +54 -0
  4. package/src/lib/framework-library/framework-library.service.ts +195 -0
  5. package/src/lib/framework-library/framework.ts +11 -0
  6. package/src/lib/framework-library/no-framework.component.html +2 -0
  7. package/src/lib/framework-library/no-framework.component.ts +11 -0
  8. package/src/lib/framework-library/no-framework.module.ts +18 -0
  9. package/src/lib/framework-library/no.framework.ts +11 -0
  10. package/src/lib/json-schema-form.component.html +7 -0
  11. package/src/lib/json-schema-form.component.ts +809 -0
  12. package/src/lib/json-schema-form.module.ts +17 -0
  13. package/src/lib/json-schema-form.service.ts +907 -0
  14. package/src/lib/locale/de-validation-messages.ts +58 -0
  15. package/src/lib/locale/en-validation-messages.ts +58 -0
  16. package/src/lib/locale/es-validation-messages.ts +55 -0
  17. package/src/lib/locale/fr-validation-messages.ts +58 -0
  18. package/src/lib/locale/index.ts +7 -0
  19. package/src/lib/locale/it-validation-messages.ts +58 -0
  20. package/src/lib/locale/pt-validation-messages.ts +58 -0
  21. package/src/lib/locale/zh-validation-messages.ts +58 -0
  22. package/src/lib/locale-dates/en-US.ts +5 -0
  23. package/src/lib/shared/convert-schema-to-draft6.function.ts +321 -0
  24. package/src/lib/shared/form-group.functions.ts +522 -0
  25. package/src/lib/shared/format-regex.constants.ts +73 -0
  26. package/src/lib/shared/index.ts +40 -0
  27. package/src/lib/shared/json-schema.functions.ts +788 -0
  28. package/src/lib/shared/json.validators.ts +878 -0
  29. package/src/lib/shared/jsonpointer.functions.ts +1012 -0
  30. package/src/lib/shared/jspointer.functions.json.spec.ts +103 -0
  31. package/src/lib/shared/layout.functions.ts +1233 -0
  32. package/src/lib/shared/merge-schemas.function.ts +329 -0
  33. package/src/lib/shared/utility.functions.ts +373 -0
  34. package/src/lib/shared/validator.functions.spec.ts +55 -0
  35. package/src/lib/shared/validator.functions.ts +601 -0
  36. package/src/lib/widget-library/add-reference.component.ts +59 -0
  37. package/src/lib/widget-library/button.component.ts +54 -0
  38. package/src/lib/widget-library/checkbox.component.ts +74 -0
  39. package/src/lib/widget-library/checkboxes.component.ts +104 -0
  40. package/src/lib/widget-library/file.component.ts +36 -0
  41. package/src/lib/widget-library/hidden.component.ts +39 -0
  42. package/src/lib/widget-library/index.ts +56 -0
  43. package/src/lib/widget-library/input.component.ts +76 -0
  44. package/src/lib/widget-library/message.component.ts +29 -0
  45. package/src/lib/widget-library/none.component.ts +12 -0
  46. package/src/lib/widget-library/number.component.ts +79 -0
  47. package/src/lib/widget-library/one-of.component.ts +36 -0
  48. package/src/lib/widget-library/orderable.directive.ts +130 -0
  49. package/src/lib/widget-library/radios.component.ts +101 -0
  50. package/src/lib/widget-library/root.component.ts +78 -0
  51. package/src/lib/widget-library/section.component.ts +133 -0
  52. package/src/lib/widget-library/select-framework.component.ts +50 -0
  53. package/src/lib/widget-library/select-widget.component.ts +46 -0
  54. package/src/lib/widget-library/select.component.ts +96 -0
  55. package/src/lib/widget-library/submit.component.ts +68 -0
  56. package/src/lib/widget-library/tab.component.ts +29 -0
  57. package/src/lib/widget-library/tabs.component.ts +83 -0
  58. package/src/lib/widget-library/template.component.ts +52 -0
  59. package/src/lib/widget-library/textarea.component.ts +68 -0
  60. package/src/lib/widget-library/widget-library.module.ts +13 -0
  61. package/src/lib/widget-library/widget-library.service.ts +234 -0
  62. package/src/public_api.ts +21 -0
  63. package/src/test.ts +18 -0
  64. package/tsconfig.lib.json +25 -0
  65. package/tsconfig.lib.prod.json +9 -0
  66. package/tsconfig.spec.json +17 -0
  67. package/tslint.json +11 -0
@@ -0,0 +1,103 @@
1
+ import {JsonPointer} from './jsonpointer.functions';
2
+
3
+ const subObjectWithEvaluatedProperty = {name: 'abc', other_property: false};
4
+
5
+ describe('JsonPointer.evaluateExpression', () => {
6
+
7
+ it('should return true when subObject and corresponding key is given', () => {
8
+ const result = JsonPointer.evaluateExpression({name: 'abc', other_property: false}, 'name==\'abc\'');
9
+
10
+ expect(result.passed).toEqual(true);
11
+ });
12
+
13
+ it('should not fail when subObject is null', () => {
14
+ const result = JsonPointer.evaluateExpression(null, 'name==\'abc\'');
15
+
16
+ expect(result).toBeDefined();
17
+ });
18
+
19
+ it('should not fail when subObject is undefined', () => {
20
+ const result = JsonPointer.evaluateExpression(undefined, 'name==\'abc\'');
21
+
22
+ expect(result).toBeDefined();
23
+ });
24
+
25
+ it('should return false when key is undefined', () => {
26
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, undefined);
27
+
28
+ expect(result.passed).toBeFalsy();
29
+ });
30
+
31
+ it('should return false when key is null', () => {
32
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, null);
33
+
34
+ expect(result.passed).toBeFalsy();
35
+ });
36
+
37
+ it('should return false when key corrupted', () => {
38
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'name=\'abc\'');
39
+
40
+ expect(result.passed).toBeFalsy();
41
+ });
42
+
43
+ it('should return the same key when key corrupted', () => {
44
+ const key = 'name=\'abc\'';
45
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, key);
46
+
47
+ expect(result.key).toEqual(key);
48
+ });
49
+
50
+ it('should return the first part of key when key contains equals', () => {
51
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'name==\'abc\'');
52
+
53
+ expect(result.key).toEqual('name');
54
+ });
55
+
56
+ it('should not return the first part of key when key contains not equals', () => {
57
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'name!=\'abc\'');
58
+
59
+ expect(result.key).not.toEqual('name');
60
+ });
61
+
62
+ it('should return false when key equals does not correspond to the subObject property', () => {
63
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'somethingElse==\'abc\'');
64
+
65
+ expect(result.passed).toBeFalsy();
66
+ });
67
+
68
+ it('should return true when key not equals does not correspond to the subObject property', () => {
69
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'somethingElse!=\'abc\'');
70
+
71
+ expect(result.passed).toBeTruthy();
72
+ });
73
+
74
+ it('should return the first part of key when key does not equal to the property value', () => {
75
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'name!=\'cba\'');
76
+
77
+ expect(result.key).toEqual('name');
78
+ });
79
+
80
+ it('should return the first part of key when key does equal to the property value', () => {
81
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'name==\'abc\'');
82
+
83
+ expect(result.key).toEqual('name');
84
+ });
85
+
86
+ it('should return false when key is different', () => {
87
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'eman==\'abc\'');
88
+
89
+ expect(result.passed).toBeFalsy();
90
+ });
91
+
92
+ it('should return true when key is without quotes', () => {
93
+ const result = JsonPointer.evaluateExpression({name: 'abc', other_property: false}, 'name==abc');
94
+
95
+ expect(result.passed).toEqual(true);
96
+ });
97
+
98
+ it('should return false when key has different value', () => {
99
+ const result = JsonPointer.evaluateExpression(subObjectWithEvaluatedProperty, 'name==\'cba\'');
100
+
101
+ expect(result.passed).toBeFalsy();
102
+ });
103
+ });