@ng-formworks/bootstrap3 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.
package/README.md ADDED
@@ -0,0 +1,244 @@
1
+ # @ng-formworks/bootstrap3
2
+ This module is a dependency of the [ng-formworks project][npm_core_ver] and is meant to work as a framework installation module for using Bootstrap 3 in the forms.
3
+
4
+ ## Getting started
5
+
6
+ If you are unfamiliar with with the ng-formworks project, it is highly recommended to
7
+ first have a look at the [@ng-formworks pages][npm_core_ver] for examples, demos, options and documentation.
8
+
9
+ ```shell
10
+ npm install @ng-formworks/core@latest @ng-formworks/cssframework@latest @ng-formworks/bootstrap3@latest
11
+ ```
12
+
13
+ With YARN, run the following:
14
+
15
+ ```shell
16
+ yarn add @ng-formworks/core@latest @ng-formworks/cssframework@latest @ng-formworks/bootstrap3@latest
17
+ ```
18
+
19
+ Then import `Bootstrap3FrameworkModule` in your main application module if you want to use `bootstrap3` UI, like this:
20
+
21
+ ```javascript
22
+ import { BrowserModule } from '@angular/platform-browser';
23
+ import { NgModule } from '@angular/core';
24
+
25
+ import { Bootstrap3FrameworkModule } from '@ng-formworks/bootstrap3';
26
+
27
+ import { AppComponent } from './app.component';
28
+
29
+ @NgModule({
30
+ declarations: [ AppComponent ],
31
+ imports: [
32
+ Bootstrap3FrameworkModule
33
+ ],
34
+ providers: [],
35
+ bootstrap: [ AppComponent ]
36
+ })
37
+ export class AppModule { }
38
+ ```
39
+
40
+ For basic use, after loading JsonSchemaFormModule as described above, to display a form in your Angular component, simply add the following to your component's template:
41
+
42
+ ```html
43
+ <json-schema-form
44
+ loadExternalAssets="true"
45
+ [schema]="yourJsonSchema"
46
+ framework="bootstrap-3"
47
+ [theme]="yourTheme"
48
+ (onSubmit)="yourOnSubmitFn($event)">
49
+ </json-schema-form>
50
+ ```
51
+
52
+ Where `schema` is a valid JSON schema object, and `onSubmit` calls a function to process the submitted JSON form data. If you don't already have your own schemas, you can find a bunch of samples to test with in the `demo/assets/example-schemas` folder, as described above.
53
+
54
+ `framework` is for the template you want to use, the default value is `no-framwork`. The possible values are:
55
+
56
+ * `material-design` for Material Design (if installed).
57
+ * `bootstrap-3` for Bootstrap 3.
58
+ * `bootstrap-4` for Bootstrap 4 (if installed).
59
+ * `bootstrap-5` for Bootstrap 5 (if installed).
60
+ * `daisyui` for DaisyUi (if installed).
61
+ * `no-framework` for (plain HTML).
62
+
63
+ `theme` is for the framework theme you want to use.
64
+ The possible values for this framework are:
65
+
66
+ * `bootstrap3_default` for the default theme.
67
+
68
+ the list of available themes can also be gotten using the
69
+ FrameworkLibraryService(found in '@ng-formworks/core'):
70
+ ```typescript
71
+ getFrameworkThemes()
72
+ ```
73
+ method
74
+
75
+ ## Custom theming
76
+
77
+ Custom theming can be achieved in two ways:
78
+
79
+ * the simplest is to overwrite the default theme(or any other themes) with css rules:
80
+ css changes can be made using the `data-bs-theme` attribute selector
81
+ so for example to change the .btn class of the default theme, you would
82
+ include the following rule in your application's styles
83
+
84
+ ```css
85
+ [data-bs-theme="bootstrap3_default"] .btn {
86
+ border-radius: 1rem
87
+ }
88
+ ```
89
+
90
+ * the other method is to add a new theme:
91
+ the first step will be to create the entire theme (see the specific frameworks underlying documentation for how this can be done) and have it use the `data-bs-theme` attribute selector for example:
92
+
93
+ ```css
94
+ [data-bs-theme="bootstrap3_custom"] {
95
+ background-color: green;
96
+ font: 15px Arial, sans-serif;
97
+ .
98
+ .
99
+ .
100
+ }
101
+ [data-bs-theme="bootstrap3_custom"] .btn {
102
+ border-color: coral;
103
+ .
104
+ .
105
+ .
106
+ }
107
+
108
+ ```
109
+ after making the css available, the theme will need to be registered using the
110
+ FrameworkLibraryService(found in '@ng-formworks/core'):
111
+ for example
112
+
113
+ ```typescript
114
+ constructor(
115
+ .
116
+ private frameworkLibrary: FrameworkLibraryService,
117
+ .
118
+ .
119
+ ) {
120
+
121
+ frameworkLibrary.registerTheme({name:'bootstrap3_custom',text:'Bootstrap3 custom theme'})
122
+
123
+ }
124
+
125
+ ```
126
+
127
+ ## Framework assets
128
+
129
+ Framework assets are typically third party assets (mainly js and css files) that are loaded at runtime for the particular framework's styling and effects to activate.
130
+ By default these assets are loaded from built in cdn urls. These assets can also be self hosted or loaded from different urls if need be.
131
+ To use custom urls the following steps must be followed:
132
+
133
+
134
+ * create a file called assets.json somewhere in your app src folder
135
+ * edit the assets.json file so that it contains both 'stylesheets' and 'scripts' properties-ex:
136
+
137
+ ```
138
+ {
139
+
140
+ "stylesheets": [
141
+ "http://some.domain/css/style1.css",
142
+ "http://some.domain/css/style2.css",
143
+ "localstyle.css",
144
+ ...
145
+ ],
146
+ "scripts": [
147
+ "http://some.domain/css/script1.js",
148
+ "localscript.js",
149
+ ...
150
+ ]
151
+
152
+ }
153
+
154
+ ```
155
+ * adapt your apps angular.json assets config accordingly, for example:
156
+
157
+ ```
158
+ "projects": {
159
+ "<your project name>": {
160
+ ...
161
+ "architect": {
162
+ "build": {
163
+ "builder": "@angular-devkit/build-angular:browser",
164
+ "options": {
165
+ ...
166
+ "assets": [
167
+ ...
168
+ {
169
+ "glob": "assets.json",
170
+ "input": "src",
171
+ "output": "/assets/bootstrap-3"
172
+ },
173
+ {
174
+ "glob": "localstyle.css",
175
+ "input": "./some/path/to/framework/cssfolder/",
176
+ "output": "/assets/bootstrap-3/cssframework"
177
+ },
178
+ {
179
+ "glob": "localscript.js",
180
+ "input": "./some/path/to/framework/jsfolder/",
181
+ "output": "/assets/bootstrap-3/cssframework"
182
+ }
183
+ ],
184
+ ...
185
+ ```
186
+ Note that relative asset urls will be assumed to reside under "/assets/bootstrap-3/cssframework" and the assets.json file must output to "/assets/bootstrap-3"
187
+
188
+ for convenince a default assets.json file is included for including the framework assets
189
+ from the node_modules folder, this assumes that the third party libraries were installed locally with npm and that they will reside in the "/assets/bootstrap-3/cssframework" deployment folder. In this case, the following config can be used and adapted similar to above:
190
+
191
+ ```
192
+ ...
193
+ "assets": [
194
+ ...
195
+ {
196
+ "glob": "**/*",
197
+ "input": "./node_modules/@ng-formworks/bootstrap3/assets",
198
+ "output": "/assets/bootstrap-3"
199
+ },
200
+ {
201
+ "glob": "jquery.min.js",
202
+ "input": "./node_modules/jquery/dist/",
203
+ "output": "/assets/bootstrap-3/cssframework"
204
+ },
205
+ {
206
+ "glob": "bootstrap.min.js",
207
+ "input": "./node_modules/bootstrap/dist/js/",
208
+ "output": "/assets/bootstrap-3/cssframework"
209
+ },
210
+ {
211
+ "glob": "bootstrap.min.css",
212
+ "input": "./node_modules/bootstrap/dist/css/",
213
+ "output": "/assets/bootstrap-3/cssframework"
214
+ },
215
+ {
216
+ "glob": "bootstrap-theme.min.css",
217
+ "input": "./node_modules/bootstrap/dist/css/",
218
+ "output": "/assets/bootstrap-3/cssframework"
219
+ }
220
+ ],
221
+ ```
222
+
223
+
224
+
225
+
226
+
227
+ ## Code scaffolding
228
+
229
+ Run `ng generate component component-name --project @ng-formworks/bootstrap3` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project @ng-formworks/bootstrap3`.
230
+ > Note: Don't forget to add `--project @ng-formworks/bootstrap3` or else it will be added to the default project in your `angular.json` file.
231
+
232
+ ## Build
233
+
234
+ Run `ng build @ng-formworks/bootstrap3` to build the project. The build artifacts will be stored in the `dist/` directory.
235
+
236
+ ## Running unit tests
237
+
238
+ Run `ng test @ng-formworks/bootstrap3` to execute the unit tests via [Karma](https://karma-runner.github.io).
239
+
240
+ ## Further help
241
+
242
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
243
+
244
+ [npm_core_ver]:https://www.npmjs.com/package/@ng-formworks/core
@@ -0,0 +1,13 @@
1
+ {
2
+
3
+ "stylesheets": [
4
+ "bootstrap.min.css",
5
+ "bootstrap-theme.min.css"
6
+ ],
7
+ "scripts": [
8
+ "jquery.min.js",
9
+ "jquery-ui.min.js",
10
+ "bootstrap.min.js"
11
+ ]
12
+
13
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+
3
+ "stylesheets": [
4
+ "//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css",
5
+ "//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
6
+ ],
7
+ "scripts": [
8
+ "//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js",
9
+ "//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js",
10
+ "//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
11
+ ]
12
+ }
package/karma.conf.js ADDED
@@ -0,0 +1,47 @@
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-bootstrap3'),
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
+ browsers: ['Chrome'],
38
+ singleRun: false,
39
+ browsers: ['Chrome', 'ChromeHeadlessCI'],
40
+ customLaunchers: {
41
+ ChromeHeadlessCI: {
42
+ base: 'ChromeHeadless',
43
+ flags: ['--no-sandbox'],
44
+ },
45
+ },
46
+ });
47
+ };
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/@ng-formworks/bootstrap3",
4
+ "lib": {
5
+ "entryFile": "src/public_api.ts"
6
+ },
7
+ "assets": ["./assets"],
8
+ "allowedNonPeerDependencies": [
9
+ "lodash-es",
10
+ "@ng-formworks/core",
11
+ "@ng-formworks/cssframework"
12
+ ]
13
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@ng-formworks/bootstrap3",
3
+ "version": "15.2.7",
4
+ "description": "Angular ng-formworks - JSON Schema Form builder using Bootstrap 3 UI",
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
+ "bootstrap",
25
+ "bootstrap 3",
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
+ "@ng-formworks/core": "~15.2.7",
44
+ "@ng-formworks/cssframework": "~15.2.7",
45
+ "tslib": "^2.0.0"
46
+ },
47
+ "peerDependencies": {
48
+ "@angular/common": ">=15.0.0",
49
+ "@angular/core": ">=15.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/lodash-es": "^4.17.3"
53
+ }
54
+ }
@@ -0,0 +1,109 @@
1
+ import { css_fw } from "@ng-formworks/cssframework";
2
+
3
+ export const cssFrameworkCfgBootstrap3:css_fw.frameworkcfg={
4
+ "name": "bootstrap-3",
5
+ "text":"Bootstrap 3",
6
+ "stylesheets": [
7
+ "//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css",
8
+ "//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
9
+ ],
10
+
11
+ "scripts": [
12
+ "//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js",
13
+ "//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js",
14
+ "//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
15
+ ],
16
+
17
+ "widgetstyles": {
18
+ "__themes__": [
19
+ {"name":"bootstrap3_default","text":"Bootstrap3 default"}
20
+ ],
21
+ "$ref": {
22
+ "fieldHtmlClass": "btn pull-right btn-info"
23
+ },
24
+ "__array_item_nonref__": {
25
+ "htmlClass": "list-group-item"
26
+ },
27
+ "__form_group__": {
28
+ "htmlClass": "form-group"
29
+ },
30
+ "__control_label__": {
31
+ "labelHtmlClass": "control-label"
32
+ },
33
+ "__active__": {
34
+ "activeClass": "active"
35
+ },
36
+ "__required_asterisk__": "text-danger",
37
+ "__screen_reader__": "sr-only",
38
+ "__remove_item__": "close pull-right",
39
+ "__help_block__": "help-block",
40
+ "__field_addon_left__": "input-group-addon",
41
+ "__field_addon_right__": "input-group-addon",
42
+ "alt-date": {},
43
+ "alt-datetime": {},
44
+ "__array__": {
45
+ "htmlClass": "list-group"
46
+ },
47
+ "array": {},
48
+ "authfieldset": {},
49
+ "advancedfieldset": {},
50
+ "button": {
51
+ "fieldHtmlClass": "btn btn-sm btn-primary"
52
+ },
53
+ "checkbox": { "fieldHtmlClass": "checkbox" },
54
+ "checkboxes": {
55
+ "fieldHtmlClass": "checkbox"
56
+ },
57
+ "checkboxbuttons": {
58
+ "fieldHtmlClass": "sr-only",
59
+ "htmlClass": "btn-group",
60
+ "itemLabelHtmlClass": "btn"
61
+ },
62
+ "checkboxes-inline": {
63
+ "htmlClass": "checkbox",
64
+ "itemLabelHtmlClass": "checkbox-inline"
65
+ },
66
+ "date": {},
67
+ "datetime-local": {},
68
+ "fieldset": {},
69
+ "integer": {},
70
+ "number": {},
71
+ "optionfieldset": {},
72
+ "password": {},
73
+ "radiobuttons": {
74
+ "fieldHtmlClass": "sr-only",
75
+ "htmlClass": "btn-group",
76
+ "itemLabelHtmlClass": "btn"
77
+ },
78
+ "radio": { "fieldHtmlClass": "radio" },
79
+ "radios": {
80
+ "fieldHtmlClass": "radio"
81
+ },
82
+ "radios-inline": {
83
+ "htmlClass": "radio",
84
+ "itemLabelHtmlClass": "radio-inline"
85
+ },
86
+ "range": {},
87
+ "section": {},
88
+ "selectfieldset": {},
89
+ "select": {},
90
+ "submit": {
91
+ "fieldHtmlClass": "btn btn-primary"
92
+ },
93
+ "text": {},
94
+ "tabs": {
95
+ "labelHtmlClass": "nav nav-tabs",
96
+ "htmlClass": "tab-content",
97
+ "fieldHtmlClass": "tab-pane"
98
+ },
99
+ "tabarray": {
100
+ "labelHtmlClass": "nav nav-tabs",
101
+ "htmlClass": "tab-content",
102
+ "fieldHtmlClass": "tab-pane"
103
+ },
104
+ "textarea": {},
105
+ "default": {
106
+ "fieldHtmlClass": "form-control"
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,62 @@
1
+ <div
2
+ [class]="options?.htmlClass || ''"
3
+ [class.has-feedback]="options?.feedback && options?.isInputWidget &&
4
+ (formControl?.dirty || options?.feedbackOnRender)"
5
+ [class.has-error]="options?.enableErrorState && formControl?.errors &&
6
+ (formControl?.dirty || options?.feedbackOnRender)"
7
+ [class.has-success]="options?.enableSuccessState && !formControl?.errors &&
8
+ (formControl?.dirty || options?.feedbackOnRender)">
9
+
10
+ <button *ngIf="showRemoveButton"
11
+ class="close pull-right"
12
+ type="button"
13
+ (click)="removeItem()">
14
+ <span aria-hidden="true">&times;</span>
15
+ <span class="sr-only">Close</span>
16
+ </button>
17
+ <div *ngIf="options?.messageLocation === 'top'">
18
+ <p *ngIf="options?.helpBlock"
19
+ class="help-block"
20
+ [innerHTML]="options?.helpBlock"></p>
21
+ </div>
22
+
23
+ <label *ngIf="options?.title && layoutNode?.type !== 'tab'"
24
+ [attr.for]="'control' + layoutNode?._id"
25
+ [class]="options?.labelHtmlClass || ''"
26
+ [class.sr-only]="options?.notitle"
27
+ [innerHTML]="options?.title"></label>
28
+ <p *ngIf="layoutNode?.type === 'submit' && jsf?.formOptions?.fieldsRequired">
29
+ <strong class="text-danger">*</strong> = required fields
30
+ </p>
31
+ <div [class.input-group]="options?.fieldAddonLeft || options?.fieldAddonRight">
32
+ <span *ngIf="options?.fieldAddonLeft"
33
+ class="input-group-addon"
34
+ [innerHTML]="options?.fieldAddonLeft"></span>
35
+
36
+ <select-widget-widget
37
+ [layoutNode]="widgetLayoutNode"
38
+ [dataIndex]="dataIndex"
39
+ [layoutIndex]="layoutIndex"></select-widget-widget>
40
+
41
+ <span *ngIf="options?.fieldAddonRight"
42
+ class="input-group-addon"
43
+ [innerHTML]="options?.fieldAddonRight"></span>
44
+ </div>
45
+
46
+ <span *ngIf="options?.feedback && options?.isInputWidget &&
47
+ !options?.fieldAddonRight && !layoutNode.arrayItem &&
48
+ (formControl?.dirty || options?.feedbackOnRender)"
49
+ [class.glyphicon-ok]="options?.enableSuccessState && !formControl?.errors"
50
+ [class.glyphicon-remove]="options?.enableErrorState && formControl?.errors"
51
+ aria-hidden="true"
52
+ class="form-control-feedback glyphicon"></span>
53
+ <div *ngIf="options?.messageLocation !== 'top'">
54
+ <p *ngIf="options?.helpBlock"
55
+ class="help-block"
56
+ [innerHTML]="options?.helpBlock"></p>
57
+ </div>
58
+ </div>
59
+
60
+ <div *ngIf="debug && debugOutput">debug:
61
+ <pre>{{debugOutput}}</pre>
62
+ </div>
@@ -0,0 +1,31 @@
1
+ :host ::ng-deep {
2
+ .list-group-item .form-control-feedback {
3
+ top: 40px;
4
+ }
5
+
6
+ .checkbox,
7
+ .radio {
8
+ margin-top: 0;
9
+ margin-bottom: 0;
10
+ }
11
+
12
+ .checkbox-inline,
13
+ .checkbox-inline + .checkbox-inline,
14
+ .checkbox-inline + .radio-inline,
15
+ .radio-inline,
16
+ .radio-inline + .radio-inline,
17
+ .radio-inline + .checkbox-inline {
18
+ margin-left: 0;
19
+ margin-right: 10px;
20
+ }
21
+
22
+ .checkbox-inline:last-child,
23
+ .radio-inline:last-child {
24
+ margin-right: 0;
25
+ }
26
+
27
+ .ng-invalid.ng-touched {
28
+ border: 1px solid #f44336;
29
+ }
30
+ }
31
+
@@ -0,0 +1,39 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
3
+ import {
4
+ JsonSchemaFormModule,
5
+ JsonSchemaFormService,
6
+ WidgetLibraryModule
7
+ } from '@ng-formworks/core';
8
+ import { Bootstrap3FrameworkComponent } from './bootstrap3-framework.component';
9
+
10
+ describe('Bootstrap3FrameworkComponent', () => {
11
+ let component: Bootstrap3FrameworkComponent;
12
+ let fixture: ComponentFixture<Bootstrap3FrameworkComponent>;
13
+
14
+ beforeEach(waitForAsync(() => {
15
+ TestBed.configureTestingModule({
16
+ imports: [
17
+ JsonSchemaFormModule,
18
+ CommonModule,
19
+ WidgetLibraryModule,
20
+ ],
21
+ declarations: [Bootstrap3FrameworkComponent],
22
+ providers: [JsonSchemaFormService]
23
+ })
24
+ .compileComponents();
25
+ }));
26
+
27
+ beforeEach(() => {
28
+ fixture = TestBed.createComponent(Bootstrap3FrameworkComponent);
29
+ component = fixture.componentInstance;
30
+ component.layoutNode = { options: {} };
31
+ component.layoutIndex = [];
32
+ component.dataIndex = [];
33
+ fixture.detectChanges();
34
+ });
35
+
36
+ it('should create', () => {
37
+ expect(component).toBeTruthy();
38
+ });
39
+ });
@@ -0,0 +1,57 @@
1
+ import { ChangeDetectorRef, Component, Input, OnChanges, OnInit, ViewEncapsulation } from '@angular/core';
2
+ import { JsonSchemaFormService } from '@ng-formworks/core';
3
+
4
+ /**
5
+ * Bootstrap 3 framework for Angular JSON Schema Form.
6
+ */
7
+ @Component({
8
+ // tslint:disable-next-line:component-selector
9
+ selector: 'bootstrap-3-framework',
10
+ template: `
11
+ <div>
12
+ <css-framework [layoutNode]="layoutNode"
13
+ [layoutIndex]="layoutIndex"
14
+ [dataIndex]="dataIndex">
15
+ </css-framework>
16
+ </div>
17
+ `,
18
+ styleUrls: ['./bootstrap3-framework.component.scss'],
19
+ encapsulation:ViewEncapsulation.None
20
+ })
21
+ export class Bootstrap3FrameworkComponent implements OnInit, OnChanges {
22
+ frameworkInitialized = false;
23
+ widgetOptions: any; // Options passed to child widget
24
+ widgetLayoutNode: any; // layoutNode passed to child widget
25
+ options: any; // Options used in this framework
26
+ formControl: any = null;
27
+ debugOutput: any = '';
28
+ debug: any = '';
29
+ parentArray: any = null;
30
+ isOrderable = false;
31
+ @Input() layoutNode: any;
32
+ @Input() layoutIndex: number[];
33
+ @Input() dataIndex: number[];
34
+
35
+
36
+ constructor(
37
+ public changeDetector: ChangeDetectorRef,
38
+ public jsf: JsonSchemaFormService
39
+ ) {
40
+ }
41
+
42
+
43
+
44
+ ngOnInit() {
45
+
46
+ }
47
+
48
+ ngOnChanges() {
49
+
50
+ }
51
+
52
+
53
+
54
+
55
+
56
+
57
+ }
@@ -0,0 +1,37 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { NgModule } from '@angular/core';
3
+ import {
4
+ Framework,
5
+ FrameworkLibraryService,
6
+ JsonSchemaFormModule,
7
+ JsonSchemaFormService,
8
+ WidgetLibraryModule,
9
+ WidgetLibraryService
10
+ } from '@ng-formworks/core';
11
+ import { CssFrameworkModule } from '@ng-formworks/cssframework';
12
+ import { Bootstrap3FrameworkComponent } from './bootstrap3-framework.component';
13
+ import { Bootstrap3Framework } from './bootstrap3.framework';
14
+
15
+ @NgModule({
16
+ imports: [
17
+ JsonSchemaFormModule,
18
+ CommonModule,
19
+ WidgetLibraryModule,
20
+ CssFrameworkModule
21
+ ],
22
+ declarations: [
23
+ Bootstrap3FrameworkComponent,
24
+ ],
25
+ exports: [
26
+ JsonSchemaFormModule,
27
+ Bootstrap3FrameworkComponent,
28
+ ],
29
+ providers: [
30
+ JsonSchemaFormService,
31
+ FrameworkLibraryService,
32
+ WidgetLibraryService,
33
+ { provide: Framework, useClass: Bootstrap3Framework, multi: true },
34
+ ]
35
+ })
36
+ export class Bootstrap3FrameworkModule {
37
+ }
@@ -0,0 +1,18 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { CssFramework, CssframeworkService } from '@ng-formworks/cssframework';
3
+ import { cssFrameworkCfgBootstrap3 } from './bootstrap3-cssframework';
4
+ import { Bootstrap3FrameworkComponent } from './bootstrap3-framework.component';
5
+
6
+ // Bootstrap 3 Framework
7
+ // https://github.com/valor-software/ng2-bootstrap
8
+
9
+ @Injectable()
10
+ export class Bootstrap3Framework extends CssFramework {
11
+ name = 'bootstrap-3';
12
+
13
+ framework = Bootstrap3FrameworkComponent;
14
+
15
+ constructor(public cssFWService:CssframeworkService){
16
+ super(cssFrameworkCfgBootstrap3,cssFWService);
17
+ }
18
+ }
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Public API Surface of @ng-formworks/bootstrap3
3
+ */
4
+
5
+ export * from './lib/bootstrap3-framework.component';
6
+ export * from './lib/bootstrap3-framework.module';
7
+ export * from './lib/bootstrap3.framework';
8
+
package/src/test.ts ADDED
@@ -0,0 +1,17 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js';
4
+ import 'zone.js/testing';
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import {
7
+ BrowserDynamicTestingModule,
8
+ platformBrowserDynamicTesting
9
+ } from '@angular/platform-browser-dynamic/testing';
10
+
11
+ // First, initialize the Angular testing environment.
12
+ getTestBed().initTestEnvironment(
13
+ BrowserDynamicTestingModule,
14
+ platformBrowserDynamicTesting(), {
15
+ teardown: { destroyAfterEach: false }
16
+ }
17
+ );
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/lib",
5
+ "declarationMap": true,
6
+ "declaration": true,
7
+ "inlineSources": true,
8
+ "types": [],
9
+ "lib": [
10
+ "dom",
11
+ "es2018"
12
+ ]
13
+ },
14
+ "angularCompilerOptions": {
15
+ "skipTemplateCodegen": true,
16
+ "strictMetadataEmit": true,
17
+ "fullTemplateTypeCheck": true,
18
+ "strictInjectionParameters": true,
19
+ "enableResourceInlining": true
20
+ },
21
+ "exclude": [
22
+ "src/test.ts",
23
+ "**/*.spec.ts"
24
+ ]
25
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "declarationMap": false
5
+ },
6
+ "angularCompilerOptions": {
7
+ "compilationMode": "partial"
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/spec",
5
+ "types": [
6
+ "jasmine",
7
+ "node"
8
+ ]
9
+ },
10
+ "files": [
11
+ "src/test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }
package/tslint.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tslint.json",
3
+ "rules": {
4
+ "directive-selector": [
5
+ true,
6
+ "attribute",
7
+ "lib",
8
+ "camelCase"
9
+ ]
10
+ }
11
+ }