@ng-formworks/core 17.2.7 → 18.0.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.
Files changed (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +834 -0
  3. package/esm2022/lib/framework-library/framework-library.service.mjs +175 -0
  4. package/esm2022/lib/framework-library/framework.mjs +15 -0
  5. package/esm2022/lib/framework-library/no-framework.component.mjs +18 -0
  6. package/esm2022/lib/framework-library/no-framework.module.mjs +27 -0
  7. package/esm2022/lib/framework-library/no.framework.mjs +19 -0
  8. package/esm2022/lib/json-schema-form.component.mjs +765 -0
  9. package/esm2022/lib/json-schema-form.module.mjs +26 -0
  10. package/esm2022/lib/json-schema-form.service.mjs +676 -0
  11. package/esm2022/lib/locale/de-validation-messages.mjs +60 -0
  12. package/esm2022/lib/locale/en-validation-messages.mjs +60 -0
  13. package/esm2022/lib/locale/es-validation-messages.mjs +57 -0
  14. package/esm2022/lib/locale/fr-validation-messages.mjs +60 -0
  15. package/esm2022/lib/locale/index.mjs +8 -0
  16. package/esm2022/lib/locale/it-validation-messages.mjs +60 -0
  17. package/esm2022/lib/locale/pt-validation-messages.mjs +60 -0
  18. package/esm2022/lib/locale/zh-validation-messages.mjs +60 -0
  19. package/esm2022/lib/shared/convert-schema-to-draft6.function.mjs +300 -0
  20. package/esm2022/lib/shared/form-group.functions.mjs +442 -0
  21. package/esm2022/lib/shared/format-regex.constants.mjs +54 -0
  22. package/esm2022/lib/shared/index.mjs +12 -0
  23. package/esm2022/lib/shared/json-schema.functions.mjs +784 -0
  24. package/esm2022/lib/shared/json.validators.mjs +884 -0
  25. package/esm2022/lib/shared/jsonpointer.functions.mjs +1026 -0
  26. package/esm2022/lib/shared/layout.functions.mjs +1158 -0
  27. package/esm2022/lib/shared/merge-schemas.function.mjs +345 -0
  28. package/esm2022/lib/shared/utility.functions.mjs +380 -0
  29. package/esm2022/lib/shared/validator.functions.mjs +584 -0
  30. package/esm2022/lib/widget-library/add-reference.component.mjs +61 -0
  31. package/esm2022/lib/widget-library/button.component.mjs +72 -0
  32. package/esm2022/lib/widget-library/checkbox.component.mjs +105 -0
  33. package/esm2022/lib/widget-library/checkboxes.component.mjs +147 -0
  34. package/esm2022/lib/widget-library/file.component.mjs +35 -0
  35. package/esm2022/lib/widget-library/hidden.component.mjs +54 -0
  36. package/esm2022/lib/widget-library/index.mjs +55 -0
  37. package/esm2022/lib/widget-library/input.component.mjs +119 -0
  38. package/esm2022/lib/widget-library/message.component.mjs +38 -0
  39. package/esm2022/lib/widget-library/none.component.mjs +21 -0
  40. package/esm2022/lib/widget-library/number.component.mjs +123 -0
  41. package/esm2022/lib/widget-library/one-of.component.mjs +35 -0
  42. package/esm2022/lib/widget-library/orderable.directive.mjs +123 -0
  43. package/esm2022/lib/widget-library/radios.component.mjs +153 -0
  44. package/esm2022/lib/widget-library/root.component.mjs +79 -0
  45. package/esm2022/lib/widget-library/section.component.mjs +199 -0
  46. package/esm2022/lib/widget-library/select-framework.component.mjs +51 -0
  47. package/esm2022/lib/widget-library/select-widget.component.mjs +46 -0
  48. package/esm2022/lib/widget-library/select.component.mjs +150 -0
  49. package/esm2022/lib/widget-library/submit.component.mjs +82 -0
  50. package/esm2022/lib/widget-library/tab.component.mjs +41 -0
  51. package/esm2022/lib/widget-library/tabs.component.mjs +108 -0
  52. package/esm2022/lib/widget-library/template.component.mjs +46 -0
  53. package/esm2022/lib/widget-library/textarea.component.mjs +104 -0
  54. package/esm2022/lib/widget-library/widget-library.module.mjs +42 -0
  55. package/esm2022/lib/widget-library/widget-library.service.mjs +226 -0
  56. package/esm2022/ng-formworks-core.mjs +5 -0
  57. package/esm2022/public_api.mjs +13 -0
  58. package/fesm2022/ng-formworks-core.mjs +10151 -0
  59. package/fesm2022/ng-formworks-core.mjs.map +1 -0
  60. package/index.d.ts +5 -0
  61. package/lib/framework-library/framework-library.service.d.ts +55 -0
  62. package/lib/framework-library/framework.d.ts +13 -0
  63. package/lib/framework-library/no-framework.component.d.ts +8 -0
  64. package/lib/framework-library/no-framework.module.d.ts +9 -0
  65. package/lib/framework-library/no.framework.d.ts +10 -0
  66. package/lib/json-schema-form.component.d.ts +218 -0
  67. package/lib/json-schema-form.module.d.ts +11 -0
  68. package/lib/json-schema-form.service.d.ts +115 -0
  69. package/lib/locale/de-validation-messages.d.ts +1 -0
  70. package/lib/locale/en-validation-messages.d.ts +1 -0
  71. package/lib/locale/es-validation-messages.d.ts +1 -0
  72. package/lib/locale/fr-validation-messages.d.ts +1 -0
  73. package/{src/lib/locale/index.ts → lib/locale/index.d.ts} +7 -7
  74. package/lib/locale/it-validation-messages.d.ts +1 -0
  75. package/lib/locale/pt-validation-messages.d.ts +1 -0
  76. package/lib/locale/zh-validation-messages.d.ts +1 -0
  77. package/lib/shared/convert-schema-to-draft6.function.d.ts +21 -0
  78. package/lib/shared/form-group.functions.d.ts +100 -0
  79. package/lib/shared/format-regex.constants.d.ts +19 -0
  80. package/lib/shared/index.d.ts +9 -0
  81. package/lib/shared/json-schema.functions.d.ts +193 -0
  82. package/lib/shared/json.validators.d.ts +441 -0
  83. package/lib/shared/jsonpointer.functions.d.ts +416 -0
  84. package/lib/shared/layout.functions.d.ts +83 -0
  85. package/lib/shared/merge-schemas.function.d.ts +19 -0
  86. package/lib/shared/utility.functions.d.ts +165 -0
  87. package/{src/lib/shared/validator.functions.ts → lib/shared/validator.functions.d.ts} +364 -601
  88. package/lib/widget-library/add-reference.component.d.ts +20 -0
  89. package/lib/widget-library/button.component.d.ts +21 -0
  90. package/lib/widget-library/checkbox.component.d.ts +24 -0
  91. package/lib/widget-library/checkboxes.component.d.ts +24 -0
  92. package/lib/widget-library/file.component.d.ts +21 -0
  93. package/lib/widget-library/hidden.component.d.ts +19 -0
  94. package/{src/lib/widget-library/index.ts → lib/widget-library/index.d.ts} +47 -56
  95. package/lib/widget-library/input.component.d.ts +22 -0
  96. package/lib/widget-library/message.component.d.ts +15 -0
  97. package/lib/widget-library/none.component.d.ts +8 -0
  98. package/lib/widget-library/number.component.d.ts +25 -0
  99. package/lib/widget-library/one-of.component.d.ts +21 -0
  100. package/lib/widget-library/orderable.directive.d.ts +41 -0
  101. package/lib/widget-library/radios.component.d.ts +23 -0
  102. package/lib/widget-library/root.component.d.ts +17 -0
  103. package/lib/widget-library/section.component.d.ts +19 -0
  104. package/lib/widget-library/select-framework.component.d.ts +18 -0
  105. package/lib/widget-library/select-widget.component.d.ts +18 -0
  106. package/lib/widget-library/select.component.d.ts +24 -0
  107. package/lib/widget-library/submit.component.d.ts +24 -0
  108. package/lib/widget-library/tab.component.d.ts +14 -0
  109. package/lib/widget-library/tabs.component.d.ts +20 -0
  110. package/lib/widget-library/template.component.d.ts +18 -0
  111. package/lib/widget-library/textarea.component.d.ts +21 -0
  112. package/lib/widget-library/widget-library.module.d.ts +31 -0
  113. package/lib/widget-library/widget-library.service.d.ts +22 -0
  114. package/package.json +66 -53
  115. package/{src/public_api.ts → public_api.d.ts} +9 -21
  116. package/karma.conf.js +0 -46
  117. package/ng-package.json +0 -11
  118. package/src/lib/framework-library/framework-library.service.ts +0 -195
  119. package/src/lib/framework-library/framework.ts +0 -11
  120. package/src/lib/framework-library/no-framework.component.html +0 -2
  121. package/src/lib/framework-library/no-framework.component.ts +0 -11
  122. package/src/lib/framework-library/no-framework.module.ts +0 -18
  123. package/src/lib/framework-library/no.framework.ts +0 -11
  124. package/src/lib/json-schema-form.component.html +0 -7
  125. package/src/lib/json-schema-form.component.ts +0 -809
  126. package/src/lib/json-schema-form.module.ts +0 -17
  127. package/src/lib/json-schema-form.service.ts +0 -907
  128. package/src/lib/locale/de-validation-messages.ts +0 -58
  129. package/src/lib/locale/en-validation-messages.ts +0 -58
  130. package/src/lib/locale/es-validation-messages.ts +0 -55
  131. package/src/lib/locale/fr-validation-messages.ts +0 -58
  132. package/src/lib/locale/it-validation-messages.ts +0 -58
  133. package/src/lib/locale/pt-validation-messages.ts +0 -58
  134. package/src/lib/locale/zh-validation-messages.ts +0 -58
  135. package/src/lib/locale-dates/en-US.ts +0 -5
  136. package/src/lib/shared/convert-schema-to-draft6.function.ts +0 -321
  137. package/src/lib/shared/form-group.functions.ts +0 -522
  138. package/src/lib/shared/format-regex.constants.ts +0 -73
  139. package/src/lib/shared/index.ts +0 -40
  140. package/src/lib/shared/json-schema.functions.ts +0 -788
  141. package/src/lib/shared/json.validators.ts +0 -878
  142. package/src/lib/shared/jsonpointer.functions.ts +0 -1012
  143. package/src/lib/shared/jspointer.functions.json.spec.ts +0 -103
  144. package/src/lib/shared/layout.functions.ts +0 -1233
  145. package/src/lib/shared/merge-schemas.function.ts +0 -329
  146. package/src/lib/shared/utility.functions.ts +0 -373
  147. package/src/lib/shared/validator.functions.spec.ts +0 -55
  148. package/src/lib/widget-library/add-reference.component.ts +0 -59
  149. package/src/lib/widget-library/button.component.ts +0 -54
  150. package/src/lib/widget-library/checkbox.component.ts +0 -74
  151. package/src/lib/widget-library/checkboxes.component.ts +0 -104
  152. package/src/lib/widget-library/file.component.ts +0 -36
  153. package/src/lib/widget-library/hidden.component.ts +0 -39
  154. package/src/lib/widget-library/input.component.ts +0 -76
  155. package/src/lib/widget-library/message.component.ts +0 -29
  156. package/src/lib/widget-library/none.component.ts +0 -12
  157. package/src/lib/widget-library/number.component.ts +0 -79
  158. package/src/lib/widget-library/one-of.component.ts +0 -36
  159. package/src/lib/widget-library/orderable.directive.ts +0 -130
  160. package/src/lib/widget-library/radios.component.ts +0 -101
  161. package/src/lib/widget-library/root.component.ts +0 -78
  162. package/src/lib/widget-library/section.component.ts +0 -133
  163. package/src/lib/widget-library/select-framework.component.ts +0 -50
  164. package/src/lib/widget-library/select-widget.component.ts +0 -46
  165. package/src/lib/widget-library/select.component.ts +0 -96
  166. package/src/lib/widget-library/submit.component.ts +0 -68
  167. package/src/lib/widget-library/tab.component.ts +0 -29
  168. package/src/lib/widget-library/tabs.component.ts +0 -83
  169. package/src/lib/widget-library/template.component.ts +0 -52
  170. package/src/lib/widget-library/textarea.component.ts +0 -68
  171. package/src/lib/widget-library/widget-library.module.ts +0 -13
  172. package/src/lib/widget-library/widget-library.service.ts +0 -234
  173. package/src/test.ts +0 -18
  174. package/tsconfig.lib.json +0 -25
  175. package/tsconfig.lib.prod.json +0 -9
  176. package/tsconfig.spec.json +0 -17
  177. package/tslint.json +0 -11
@@ -0,0 +1,31 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./add-reference.component";
3
+ import * as i2 from "./one-of.component";
4
+ import * as i3 from "./button.component";
5
+ import * as i4 from "./checkbox.component";
6
+ import * as i5 from "./checkboxes.component";
7
+ import * as i6 from "./file.component";
8
+ import * as i7 from "./hidden.component";
9
+ import * as i8 from "./input.component";
10
+ import * as i9 from "./message.component";
11
+ import * as i10 from "./none.component";
12
+ import * as i11 from "./number.component";
13
+ import * as i12 from "./radios.component";
14
+ import * as i13 from "./root.component";
15
+ import * as i14 from "./section.component";
16
+ import * as i15 from "./select.component";
17
+ import * as i16 from "./select-framework.component";
18
+ import * as i17 from "./select-widget.component";
19
+ import * as i18 from "./submit.component";
20
+ import * as i19 from "./tab.component";
21
+ import * as i20 from "./tabs.component";
22
+ import * as i21 from "./template.component";
23
+ import * as i22 from "./textarea.component";
24
+ import * as i23 from "./orderable.directive";
25
+ import * as i24 from "@angular/common";
26
+ import * as i25 from "@angular/forms";
27
+ export declare class WidgetLibraryModule {
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<WidgetLibraryModule, never>;
29
+ static ɵmod: i0.ɵɵNgModuleDeclaration<WidgetLibraryModule, [typeof i1.AddReferenceComponent, typeof i2.OneOfComponent, typeof i3.ButtonComponent, typeof i4.CheckboxComponent, typeof i5.CheckboxesComponent, typeof i6.FileComponent, typeof i7.HiddenComponent, typeof i8.InputComponent, typeof i9.MessageComponent, typeof i10.NoneComponent, typeof i11.NumberComponent, typeof i12.RadiosComponent, typeof i13.RootComponent, typeof i14.SectionComponent, typeof i15.SelectComponent, typeof i16.SelectFrameworkComponent, typeof i17.SelectWidgetComponent, typeof i18.SubmitComponent, typeof i19.TabComponent, typeof i20.TabsComponent, typeof i21.TemplateComponent, typeof i22.TextareaComponent, typeof i23.OrderableDirective], [typeof i24.CommonModule, typeof i25.FormsModule, typeof i25.ReactiveFormsModule], [typeof i1.AddReferenceComponent, typeof i2.OneOfComponent, typeof i3.ButtonComponent, typeof i4.CheckboxComponent, typeof i5.CheckboxesComponent, typeof i6.FileComponent, typeof i7.HiddenComponent, typeof i8.InputComponent, typeof i9.MessageComponent, typeof i10.NoneComponent, typeof i11.NumberComponent, typeof i12.RadiosComponent, typeof i13.RootComponent, typeof i14.SectionComponent, typeof i15.SelectComponent, typeof i16.SelectFrameworkComponent, typeof i17.SelectWidgetComponent, typeof i18.SubmitComponent, typeof i19.TabComponent, typeof i20.TabsComponent, typeof i21.TemplateComponent, typeof i22.TextareaComponent, typeof i23.OrderableDirective]>;
30
+ static ɵinj: i0.ɵɵInjectorDeclaration<WidgetLibraryModule>;
31
+ }
@@ -0,0 +1,22 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class WidgetLibraryService {
3
+ defaultWidget: string;
4
+ widgetLibrary: any;
5
+ registeredWidgets: any;
6
+ frameworkWidgets: any;
7
+ activeWidgets: any;
8
+ constructor();
9
+ setActiveWidgets(): boolean;
10
+ setDefaultWidget(type: string): boolean;
11
+ hasWidget(type: string, widgetSet?: string): boolean;
12
+ hasDefaultWidget(type: string): boolean;
13
+ registerWidget(type: string, widget: any): boolean;
14
+ unRegisterWidget(type: string): boolean;
15
+ unRegisterAllWidgets(unRegisterFrameworkWidgets?: boolean): boolean;
16
+ registerFrameworkWidgets(widgets: any): boolean;
17
+ unRegisterFrameworkWidgets(): boolean;
18
+ getWidget(type?: string, widgetSet?: string): any;
19
+ getAllWidgets(): any;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<WidgetLibraryService, never>;
21
+ static ɵprov: i0.ɵɵInjectableDeclaration<WidgetLibraryService>;
22
+ }
package/package.json CHANGED
@@ -1,54 +1,67 @@
1
- {
2
- "name": "@ng-formworks/core",
3
- "version": "17.2.7",
4
- "description": "Angular ng-formworks - JSON Schema Form builder core",
5
- "author": "https://github.com/zahmo/ng-formworks/graphs/contributors",
6
- "keywords": [
7
- "Angular",
8
- "ng",
9
- "Angular15",
10
- "Angular 15",
11
- "Angular16",
12
- "Angular 16",
13
- "Angular17",
14
- "Angular 17",
15
- "ng15",
16
- "ng16",
17
- "ng17",
18
- "JSON Schema",
19
- "form",
20
- "forms",
21
- "form builder",
22
- "form themes",
23
- "form generator",
24
- "ajsf",
25
- "ng-formworks",
26
- "ng formworks",
27
- "formworks",
28
- "angular json schema form"
29
- ],
30
- "license": "MIT",
31
- "repository": {
32
- "type": "git",
33
- "url": "git+https://github.com/zahmo/ng-formworks"
34
- },
35
- "bugs": {
36
- "url": "https://github.com/zahmo/ng-formworks/issues"
37
- },
38
- "private": false,
39
- "dependencies": {
40
- "lodash-es": "~4.17.21",
41
- "ajv": "^8.12.0",
42
- "tslib": "^2.0.0"
43
- },
44
- "peerDependencies": {
45
- "@angular/common": ">=17.0.0",
46
- "@angular/core": ">=17.0.0",
47
- "@angular/forms": ">=17.0.0",
48
- "@angular/platform-browser": ">=17.0.0",
49
- "rxjs": "^7.0.0"
50
- },
51
- "devDependencies": {
52
- "@types/lodash-es": "^4.17.6"
53
- }
1
+ {
2
+ "name": "@ng-formworks/core",
3
+ "version": "18.0.0",
4
+ "description": "Angular ng-formworks - JSON Schema Form builder core",
5
+ "author": "https://github.com/zahmo/ng-formworks/graphs/contributors",
6
+ "keywords": [
7
+ "Angular",
8
+ "ng",
9
+ "Angular15",
10
+ "Angular 15",
11
+ "Angular16",
12
+ "Angular 16",
13
+ "Angular17",
14
+ "Angular 17",
15
+ "Angular 18",
16
+ "ng15",
17
+ "ng16",
18
+ "ng17",
19
+ "ng18",
20
+ "JSON Schema",
21
+ "form",
22
+ "forms",
23
+ "form builder",
24
+ "form themes",
25
+ "form generator",
26
+ "ajsf",
27
+ "ng-formworks",
28
+ "ng formworks",
29
+ "formworks",
30
+ "angular json schema form"
31
+ ],
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/zahmo/ng-formworks"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/zahmo/ng-formworks/issues"
39
+ },
40
+ "private": false,
41
+ "dependencies": {
42
+ "lodash-es": "~4.17.21",
43
+ "ajv": "^8.12.0",
44
+ "tslib": "^2.7.0"
45
+ },
46
+ "peerDependencies": {
47
+ "@angular/common": ">=18.0.0",
48
+ "@angular/core": ">=18.0.0",
49
+ "@angular/forms": ">=18.0.0",
50
+ "@angular/platform-browser": ">=18.0.0",
51
+ "rxjs": "^7.0.0"
52
+ },
53
+ "module": "fesm2022/ng-formworks-core.mjs",
54
+ "typings": "index.d.ts",
55
+ "exports": {
56
+ "./package.json": {
57
+ "default": "./package.json"
58
+ },
59
+ ".": {
60
+ "types": "./index.d.ts",
61
+ "esm2022": "./esm2022/ng-formworks-core.mjs",
62
+ "esm": "./esm2022/ng-formworks-core.mjs",
63
+ "default": "./fesm2022/ng-formworks-core.mjs"
64
+ }
65
+ },
66
+ "sideEffects": false
54
67
  }
@@ -1,21 +1,9 @@
1
- /*
2
- * Public API Surface of json-schema-form
3
- */
4
-
5
- export { JsonSchemaFormModule } from './lib/json-schema-form.module';
6
- export { TitleMapItem, ErrorMessages, JsonSchemaFormService } from './lib/json-schema-form.service';
7
- export { JsonSchemaFormComponent } from './lib/json-schema-form.component';
8
- export { Framework } from './lib/framework-library/framework';
9
- export { FrameworkLibraryService } from './lib/framework-library/framework-library.service';
10
- export {
11
- deValidationMessages,
12
- enValidationMessages,
13
- esValidationMessages,
14
- frValidationMessages,
15
- itValidationMessages,
16
- ptValidationMessages,
17
- zhValidationMessages
18
- } from './lib/locale';
19
- export * from './lib/widget-library';
20
- export * from './lib/widget-library/widget-library.module';
21
- export * from './lib/shared';
1
+ export { JsonSchemaFormModule } from './lib/json-schema-form.module';
2
+ export { TitleMapItem, ErrorMessages, JsonSchemaFormService } from './lib/json-schema-form.service';
3
+ export { JsonSchemaFormComponent } from './lib/json-schema-form.component';
4
+ export { Framework } from './lib/framework-library/framework';
5
+ export { FrameworkLibraryService } from './lib/framework-library/framework-library.service';
6
+ export { deValidationMessages, enValidationMessages, esValidationMessages, frValidationMessages, itValidationMessages, ptValidationMessages, zhValidationMessages } from './lib/locale';
7
+ export * from './lib/widget-library';
8
+ export * from './lib/widget-library/widget-library.module';
9
+ export * from './lib/shared';
package/karma.conf.js DELETED
@@ -1,46 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma'),
14
- ],
15
- client: {
16
- clearContext: false, // leave Jasmine Spec Runner output visible in browser
17
- },
18
- coverageReporter: {
19
- dir: require('path').join(__dirname, '../../coverage/ajsf-core'),
20
- reporters: [
21
- {
22
- type: 'html',
23
- },
24
- {
25
- type: 'lcov',
26
- },
27
- {
28
- type: 'text-summary',
29
- },
30
- ],
31
- },
32
- reporters: ['progress', 'kjhtml'],
33
- port: 9876,
34
- colors: true,
35
- logLevel: config.LOG_INFO,
36
- autoWatch: true,
37
- singleRun: false,
38
- browsers: ['Chrome', 'ChromeHeadlessCI'],
39
- customLaunchers: {
40
- ChromeHeadlessCI: {
41
- base: 'ChromeHeadless',
42
- flags: ['--no-sandbox'],
43
- },
44
- },
45
- });
46
- };
package/ng-package.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/@ng-formworks/core",
4
- "lib": {
5
- "entryFile": "src/public_api.ts"
6
- },
7
- "allowedNonPeerDependencies": [
8
- "lodash-es",
9
- "ajv"
10
- ]
11
- }
@@ -1,195 +0,0 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { Inject, Injectable } from '@angular/core';
3
- import { Observable, Subject, lastValueFrom } from 'rxjs';
4
- import { hasOwn } from '../shared/utility.functions';
5
- import { WidgetLibraryService } from '../widget-library/widget-library.service';
6
- import { Framework } from './framework';
7
-
8
- // Possible future frameworks:
9
- // - Foundation 6:
10
- // http://justindavis.co/2017/06/15/using-foundation-6-in-angular-4/
11
- // https://github.com/zurb/foundation-sites
12
- // - Semantic UI:
13
- // https://github.com/edcarroll/ng2-semantic-ui
14
- // https://github.com/vladotesanovic/ngSemantic
15
-
16
- @Injectable({
17
- providedIn: 'root',
18
- })
19
- export class FrameworkLibraryService {
20
- activeFramework: Framework = null;
21
- stylesheets: (HTMLStyleElement|HTMLLinkElement)[];
22
- scripts: HTMLScriptElement[];
23
- loadExternalAssets = false;
24
- defaultFramework: string;
25
- frameworkLibrary: { [name: string]: Framework } = {};
26
-
27
- activeFrameworkName$: Observable<string>;
28
- private activeFrameworkNameSubject: Subject<string>;
29
- private activeFrameworkName:string;
30
-
31
- constructor(
32
- @Inject(Framework) private frameworks: any[],
33
- @Inject(WidgetLibraryService) private widgetLibrary: WidgetLibraryService,
34
- private http: HttpClient,
35
- ) {
36
- this.frameworks.forEach(framework =>
37
- this.frameworkLibrary[framework.name] = framework
38
- );
39
- this.defaultFramework = this.frameworks[0].name;
40
- //this.setFramework(this.defaultFramework);
41
-
42
- this.activeFrameworkName=this.defaultFramework;
43
- this.activeFrameworkNameSubject = new Subject<string>();
44
- this.activeFrameworkName$ = this.activeFrameworkNameSubject.asObservable();
45
- this.setFramework(this.defaultFramework);
46
- }
47
-
48
- public setLoadExternalAssets(loadExternalAssets = true): void {
49
- this.loadExternalAssets = !!loadExternalAssets;
50
- }
51
-
52
- public setFramework(
53
- framework: string|Framework = this.defaultFramework,
54
- loadExternalAssets = this.loadExternalAssets
55
- ): boolean {
56
- this.activeFramework =
57
- typeof framework === 'string' && this.hasFramework(framework) ?
58
- this.frameworkLibrary[framework] :
59
- typeof framework === 'object' && hasOwn(framework, 'framework') ?
60
- framework :
61
- this.frameworkLibrary[this.defaultFramework];
62
- if(this.activeFramework.name !=this.activeFrameworkName){
63
- this.activeFrameworkName=this.activeFramework.name;
64
- this.activeFrameworkNameSubject.next(this.activeFrameworkName);
65
- }
66
- return this.registerFrameworkWidgets(this.activeFramework);
67
- }
68
-
69
- registerFrameworkWidgets(framework: Framework): boolean {
70
- return hasOwn(framework, 'widgets') ?
71
- this.widgetLibrary.registerFrameworkWidgets(framework.widgets) :
72
- this.widgetLibrary.unRegisterFrameworkWidgets();
73
- }
74
-
75
- public hasFramework(type: string): boolean {
76
- return hasOwn(this.frameworkLibrary, type);
77
- }
78
-
79
- public getFramework(): any {
80
- if (!this.activeFramework) { this.setFramework('default', true); }
81
- return this.activeFramework.framework;
82
- }
83
-
84
- public getFrameworkList():{name:string,text:string}[] {
85
- return this.frameworks.map(fw=>{
86
- return {name:fw.name,text:fw.text};
87
- })
88
-
89
- }
90
-
91
- public getFrameworkWidgets(): any {
92
- return this.activeFramework.widgets || {};
93
- }
94
-
95
-
96
-
97
- public getFrameworkStylesheets(load: boolean = this.loadExternalAssets): string[] {
98
- return (load && this.activeFramework.stylesheets) || [];
99
- }
100
-
101
- public getFrameworkScripts(load: boolean = this.loadExternalAssets): string[] {
102
- return (load && this.activeFramework.scripts) || [];
103
- }
104
-
105
- //applies to CssFramework classes
106
- public getFrameworkConfig(existingFramework?:any): any {
107
- let actFramework:Framework& { [key: string]: any; }=existingFramework||this.activeFramework;
108
- return actFramework.config;
109
- }
110
-
111
- //this will load the list of assets to be loaded at runtime in case the dependent framework
112
- //scripts and styles are include locally with the parent app
113
- public getFrameworkAssetConfig(existingFramework?:any,useAssetRelPath=true):Promise<{stylesheets:string[],scripts:string[]}>{
114
- let actFramework:Framework& { [key: string]: any; }=existingFramework||this.activeFramework;
115
- //TODO move this into config
116
- const assetConfigPath = `assets/${actFramework.name}/cssframework`
117
- const assetConfigURL = `${assetConfigPath}/assets.json`;
118
- let subs=this.http
119
- .get(assetConfigURL, { responseType: 'text' })
120
- //.subscribe(assetConfig => {
121
- // assetConfig
122
- //})
123
-
124
- return lastValueFrom(subs).then(assetCfgText=>{
125
- let assetCfg=JSON.parse(assetCfgText);
126
- if(useAssetRelPath){
127
- assetCfg.stylesheets=assetCfg.stylesheets.map(styleLink=>{
128
- //ignore relative path if url starts with known protocol or //
129
- let nonRelPrefixes=["/","//","http:","https:"];//"//" list for completeness
130
- let isNonRel=false;
131
- nonRelPrefixes.forEach(prefix=>{
132
- isNonRel=isNonRel||styleLink.indexOf(prefix)==0;
133
- })
134
- if(isNonRel){
135
- return styleLink;
136
- }
137
- return `${assetConfigPath}/${styleLink}`;
138
- })
139
- assetCfg.scripts=assetCfg.scripts.map(scriptLink=>{
140
- return `${assetConfigPath}/${scriptLink}`;
141
- })
142
- }
143
- return assetCfg
144
- });
145
- }
146
-
147
- //applies to CssFramework classes
148
- public getFrameworkThemes():{name:string,text:string}[] {
149
- let cssfwConfig=this.getFrameworkConfig();
150
- let themes;
151
- if(cssfwConfig){
152
- themes=cssfwConfig?.widgetstyles?.__themes__||[]
153
- }
154
- return themes
155
- }
156
-
157
- //applies to CssFramework classes
158
- public requestThemeChange(name:string,validateThemeExists:boolean=false,existingFramework?:any){
159
- let actFramework:Framework& { [key: string]: any; }=existingFramework||this.activeFramework;
160
- if(actFramework.requestThemeChange){
161
- if(validateThemeExists){
162
- let themes=this.getFrameworkThemes();
163
- let foundThemes=themes.filter(thm=>{return thm.name==name});
164
- if(!foundThemes|| foundThemes.length==0){
165
- return false;
166
- }
167
- }
168
- actFramework.requestThemeChange(name);
169
- return true;
170
- }
171
- }
172
- //applies to CssFramework classes
173
- public getActiveTheme(existingFramework?:any):{name:string,text:string}{
174
- let actFramework:Framework& { [key: string]: any; }=existingFramework||this.activeFramework;
175
- if(actFramework.getActiveTheme){
176
- return actFramework.getActiveTheme();
177
- }
178
- }
179
-
180
- //applies to CssFramework classes
181
- public registerTheme(newTheme:{name:string,text:string},existingFramework?:any):boolean{
182
- let actFramework:Framework& { [key: string]: any; }=existingFramework||this.activeFramework;
183
- if(actFramework.registerTheme){
184
- return actFramework.registerTheme(newTheme);
185
- }
186
- }
187
-
188
- //applies to CssFramework classes
189
- public unregisterTheme(name:string,existingFramework?:any):boolean{
190
- let actFramework:Framework& { [key: string]: any; }=existingFramework||this.activeFramework;
191
- if(actFramework.registerTheme){
192
- return actFramework.unregisterTheme(name);
193
- }
194
- }
195
- }
@@ -1,11 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
-
3
- @Injectable()
4
- export class Framework {
5
- name: string;
6
- text:string;
7
- framework: any;
8
- widgets?: { [key: string]: any } = {};
9
- stylesheets?: string[] = [];
10
- scripts?: string[] = [];
11
- }
@@ -1,2 +0,0 @@
1
- <select-widget-widget [dataIndex]="dataIndex" [layoutIndex]="layoutIndex" [layoutNode]="layoutNode">
2
- </select-widget-widget>
@@ -1,11 +0,0 @@
1
- import { Component, Input } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'no-framework',
5
- templateUrl: './no-framework.component.html',
6
- })
7
- export class NoFrameworkComponent {
8
- @Input() layoutNode: any;
9
- @Input() layoutIndex: number[];
10
- @Input() dataIndex: number[];
11
- }
@@ -1,18 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { Framework } from './framework';
3
- import { NgModule } from '@angular/core';
4
- import { NoFramework } from './no.framework';
5
- import { NoFrameworkComponent } from './no-framework.component';
6
- import { WidgetLibraryModule } from '../widget-library/widget-library.module';
7
-
8
- // No framework - plain HTML controls (styles from form layout only)
9
-
10
- @NgModule({
11
- imports: [CommonModule, WidgetLibraryModule],
12
- declarations: [NoFrameworkComponent],
13
- exports: [NoFrameworkComponent],
14
- providers: [
15
- { provide: Framework, useClass: NoFramework, multi: true }
16
- ]
17
- })
18
- export class NoFrameworkModule { }
@@ -1,11 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { Framework } from './framework';
3
- import { NoFrameworkComponent } from './no-framework.component';
4
- // No framework - plain HTML controls (styles from form layout only)
5
-
6
- @Injectable()
7
- export class NoFramework extends Framework {
8
- name = 'no-framework';
9
- text ='None (plain HTML)';
10
- framework = NoFrameworkComponent;
11
- }
@@ -1,7 +0,0 @@
1
- <form [autocomplete]="jsf?.formOptions?.autocomplete ? 'on' : 'off'" class="json-schema-form" (ngSubmit)="submitForm()">
2
- <root-widget [layout]="jsf?.layout"></root-widget>
3
- </form>
4
- <div *ngIf="debug || jsf?.formOptions?.debug">
5
- Debug output:
6
- <pre>{{debugOutput}}</pre>
7
- </div>