@ajsf/material 0.5.1-beta.1 → 0.5.1
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/LICENSE +21 -0
- package/README.md +2 -2
- package/ajsf-material.d.ts +4 -0
- package/ajsf-material.metadata.json +1 -0
- package/bundles/ajsf-material.umd.js +1422 -0
- package/bundles/ajsf-material.umd.js.map +1 -0
- package/esm2015/ajsf-material.js +5 -0
- package/esm2015/lib/angular-flex-monkey-patch.js +12 -0
- package/esm2015/lib/material-design-framework.component.js +101 -0
- package/esm2015/lib/material-design-framework.module.js +80 -0
- package/esm2015/lib/material-design.framework.js +54 -0
- package/esm2015/lib/widgets/flex-layout-root.component.js +55 -0
- package/esm2015/lib/widgets/flex-layout-section.component.js +221 -0
- package/esm2015/lib/widgets/material-add-reference.component.js +53 -0
- package/esm2015/lib/widgets/material-button-group.component.js +63 -0
- package/esm2015/lib/widgets/material-button.component.js +60 -0
- package/esm2015/lib/widgets/material-checkbox.component.js +109 -0
- package/esm2015/lib/widgets/material-checkboxes.component.js +101 -0
- package/esm2015/lib/widgets/material-chip-list.component.js +33 -0
- package/esm2015/lib/widgets/material-datepicker.component.js +90 -0
- package/esm2015/lib/widgets/material-file.component.js +33 -0
- package/esm2015/lib/widgets/material-input.component.js +95 -0
- package/esm2015/lib/widgets/material-number.component.js +97 -0
- package/esm2015/lib/widgets/material-one-of.component.js +33 -0
- package/esm2015/lib/widgets/material-radios.component.js +84 -0
- package/esm2015/lib/widgets/material-select.component.js +115 -0
- package/esm2015/lib/widgets/material-slider.component.js +60 -0
- package/esm2015/lib/widgets/material-stepper.component.js +33 -0
- package/esm2015/lib/widgets/material-tabs.component.js +69 -0
- package/esm2015/lib/widgets/material-textarea.component.js +88 -0
- package/esm2015/lib/widgets/public_api.js +52 -0
- package/esm2015/public_api.js +8 -0
- package/fesm2015/ajsf-material.js +1710 -0
- package/fesm2015/ajsf-material.js.map +1 -0
- package/lib/angular-flex-monkey-patch.d.ts +1 -0
- package/lib/material-design-framework.component.d.ts +25 -0
- package/lib/material-design-framework.module.d.ts +12 -0
- package/lib/material-design.framework.d.ts +41 -0
- package/lib/widgets/flex-layout-root.component.d.ts +12 -0
- package/lib/widgets/flex-layout-section.component.d.ts +22 -0
- package/lib/widgets/material-add-reference.component.d.ts +17 -0
- package/lib/widgets/material-button-group.component.d.ts +20 -0
- package/lib/widgets/material-button.component.d.ts +18 -0
- package/lib/widgets/material-checkbox.component.d.ts +22 -0
- package/lib/widgets/material-checkboxes.component.d.ts +24 -0
- package/lib/widgets/material-chip-list.component.d.ts +18 -0
- package/lib/widgets/material-datepicker.component.d.ts +19 -0
- package/lib/widgets/material-file.component.d.ts +18 -0
- package/lib/widgets/material-input.component.d.ts +20 -0
- package/lib/widgets/material-number.component.d.ts +23 -0
- package/lib/widgets/material-one-of.component.d.ts +18 -0
- package/lib/widgets/material-radios.component.d.ts +20 -0
- package/lib/widgets/material-select.component.d.ts +21 -0
- package/lib/widgets/material-slider.component.d.ts +22 -0
- package/lib/widgets/material-stepper.component.d.ts +18 -0
- package/lib/widgets/material-tabs.component.d.ts +17 -0
- package/lib/widgets/material-textarea.component.d.ts +19 -0
- package/{src/lib/widgets/public_api.ts → lib/widgets/public_api.d.ts} +1 -14
- package/package.json +12 -4
- package/{src/public_api.ts → public_api.d.ts} +0 -4
- package/karma.conf.js +0 -37
- package/ng-package.json +0 -16
- package/src/lib/angular-flex-monkey-patch.ts +0 -13
- package/src/lib/material-design-framework.component.html +0 -20
- package/src/lib/material-design-framework.component.scss +0 -51
- package/src/lib/material-design-framework.component.spec.ts +0 -37
- package/src/lib/material-design-framework.component.ts +0 -121
- package/src/lib/material-design-framework.module.ts +0 -84
- package/src/lib/material-design.framework.ts +0 -75
- package/src/lib/widgets/flex-layout-root.component.html +0 -11
- package/src/lib/widgets/flex-layout-root.component.ts +0 -52
- package/src/lib/widgets/flex-layout-section.component.ts +0 -216
- package/src/lib/widgets/material-add-reference.component.ts +0 -56
- package/src/lib/widgets/material-button-group.component.ts +0 -68
- package/src/lib/widgets/material-button.component.ts +0 -59
- package/src/lib/widgets/material-checkbox.component.ts +0 -112
- package/src/lib/widgets/material-checkboxes.component.ts +0 -109
- package/src/lib/widgets/material-chip-list.component.ts +0 -35
- package/src/lib/widgets/material-datepicker.component.ts +0 -103
- package/src/lib/widgets/material-file.component.ts +0 -35
- package/src/lib/widgets/material-input.component.ts +0 -97
- package/src/lib/widgets/material-number.component.ts +0 -95
- package/src/lib/widgets/material-one-of.component.ts +0 -35
- package/src/lib/widgets/material-radios.component.ts +0 -89
- package/src/lib/widgets/material-select.component.ts +0 -118
- package/src/lib/widgets/material-slider.component.ts +0 -61
- package/src/lib/widgets/material-stepper.component.ts +0 -35
- package/src/lib/widgets/material-tabs.component.ts +0 -69
- package/src/lib/widgets/material-textarea.component.ts +0 -88
- package/src/test.ts +0 -21
- package/tsconfig.lib.json +0 -26
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -11
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { JsonSchemaFormService } from '@ajsf/core';
|
|
4
|
+
export declare class MaterialRadiosComponent implements OnInit {
|
|
5
|
+
private jsf;
|
|
6
|
+
formControl: AbstractControl;
|
|
7
|
+
controlName: string;
|
|
8
|
+
controlValue: any;
|
|
9
|
+
controlDisabled: boolean;
|
|
10
|
+
boundControl: boolean;
|
|
11
|
+
options: any;
|
|
12
|
+
flexDirection: string;
|
|
13
|
+
radiosList: any[];
|
|
14
|
+
layoutNode: any;
|
|
15
|
+
layoutIndex: number[];
|
|
16
|
+
dataIndex: number[];
|
|
17
|
+
constructor(jsf: JsonSchemaFormService);
|
|
18
|
+
ngOnInit(): void;
|
|
19
|
+
updateValue(value: any): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { JsonSchemaFormService, isArray } from '@ajsf/core';
|
|
4
|
+
export declare class MaterialSelectComponent implements OnInit {
|
|
5
|
+
matFormFieldDefaultOptions: any;
|
|
6
|
+
private jsf;
|
|
7
|
+
formControl: AbstractControl;
|
|
8
|
+
controlName: string;
|
|
9
|
+
controlValue: any;
|
|
10
|
+
controlDisabled: boolean;
|
|
11
|
+
boundControl: boolean;
|
|
12
|
+
options: any;
|
|
13
|
+
selectList: any[];
|
|
14
|
+
isArray: typeof isArray;
|
|
15
|
+
layoutNode: any;
|
|
16
|
+
layoutIndex: number[];
|
|
17
|
+
dataIndex: number[];
|
|
18
|
+
constructor(matFormFieldDefaultOptions: any, jsf: JsonSchemaFormService);
|
|
19
|
+
ngOnInit(): void;
|
|
20
|
+
updateValue(event: any): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { JsonSchemaFormService } from '@ajsf/core';
|
|
4
|
+
export declare class MaterialSliderComponent implements OnInit {
|
|
5
|
+
private jsf;
|
|
6
|
+
formControl: AbstractControl;
|
|
7
|
+
controlName: string;
|
|
8
|
+
controlValue: any;
|
|
9
|
+
controlDisabled: boolean;
|
|
10
|
+
boundControl: boolean;
|
|
11
|
+
options: any;
|
|
12
|
+
allowNegative: boolean;
|
|
13
|
+
allowDecimal: boolean;
|
|
14
|
+
allowExponents: boolean;
|
|
15
|
+
lastValidNumber: string;
|
|
16
|
+
layoutNode: any;
|
|
17
|
+
layoutIndex: number[];
|
|
18
|
+
dataIndex: number[];
|
|
19
|
+
constructor(jsf: JsonSchemaFormService);
|
|
20
|
+
ngOnInit(): void;
|
|
21
|
+
updateValue(event: any): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { JsonSchemaFormService } from '@ajsf/core';
|
|
4
|
+
export declare class MaterialStepperComponent implements OnInit {
|
|
5
|
+
private jsf;
|
|
6
|
+
formControl: AbstractControl;
|
|
7
|
+
controlName: string;
|
|
8
|
+
controlValue: any;
|
|
9
|
+
controlDisabled: boolean;
|
|
10
|
+
boundControl: boolean;
|
|
11
|
+
options: any;
|
|
12
|
+
layoutNode: any;
|
|
13
|
+
layoutIndex: number[];
|
|
14
|
+
dataIndex: number[];
|
|
15
|
+
constructor(jsf: JsonSchemaFormService);
|
|
16
|
+
ngOnInit(): void;
|
|
17
|
+
updateValue(event: any): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { JsonSchemaFormService } from '@ajsf/core';
|
|
3
|
+
export declare class MaterialTabsComponent implements OnInit {
|
|
4
|
+
private jsf;
|
|
5
|
+
options: any;
|
|
6
|
+
itemCount: number;
|
|
7
|
+
selectedItem: number;
|
|
8
|
+
showAddTab: boolean;
|
|
9
|
+
layoutNode: any;
|
|
10
|
+
layoutIndex: number[];
|
|
11
|
+
dataIndex: number[];
|
|
12
|
+
constructor(jsf: JsonSchemaFormService);
|
|
13
|
+
ngOnInit(): void;
|
|
14
|
+
select(index: any): void;
|
|
15
|
+
updateControl(): void;
|
|
16
|
+
setTabTitle(item: any, index: number): string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { JsonSchemaFormService } from '@ajsf/core';
|
|
4
|
+
export declare class MaterialTextareaComponent implements OnInit {
|
|
5
|
+
matFormFieldDefaultOptions: any;
|
|
6
|
+
private jsf;
|
|
7
|
+
formControl: AbstractControl;
|
|
8
|
+
controlName: string;
|
|
9
|
+
controlValue: any;
|
|
10
|
+
controlDisabled: boolean;
|
|
11
|
+
boundControl: boolean;
|
|
12
|
+
options: any;
|
|
13
|
+
layoutNode: any;
|
|
14
|
+
layoutIndex: number[];
|
|
15
|
+
dataIndex: number[];
|
|
16
|
+
constructor(matFormFieldDefaultOptions: any, jsf: JsonSchemaFormService);
|
|
17
|
+
ngOnInit(): void;
|
|
18
|
+
updateValue(event: any): void;
|
|
19
|
+
}
|
|
@@ -18,20 +18,7 @@ import { MaterialSliderComponent } from './material-slider.component';
|
|
|
18
18
|
import { MaterialStepperComponent } from './material-stepper.component';
|
|
19
19
|
import { MaterialTabsComponent } from './material-tabs.component';
|
|
20
20
|
import { MaterialTextareaComponent } from './material-textarea.component';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export const MATERIAL_FRAMEWORK_COMPONENTS = [
|
|
24
|
-
FlexLayoutRootComponent, FlexLayoutSectionComponent,
|
|
25
|
-
MaterialAddReferenceComponent, MaterialOneOfComponent,
|
|
26
|
-
MaterialButtonComponent, MaterialButtonGroupComponent,
|
|
27
|
-
MaterialCheckboxComponent, MaterialCheckboxesComponent,
|
|
28
|
-
MaterialChipListComponent, MaterialDatepickerComponent,
|
|
29
|
-
MaterialFileComponent, MaterialInputComponent, MaterialNumberComponent,
|
|
30
|
-
MaterialRadiosComponent, MaterialSelectComponent, MaterialSliderComponent,
|
|
31
|
-
MaterialStepperComponent, MaterialTabsComponent, MaterialTextareaComponent,
|
|
32
|
-
MaterialDesignFrameworkComponent
|
|
33
|
-
];
|
|
34
|
-
|
|
21
|
+
export declare const MATERIAL_FRAMEWORK_COMPONENTS: (typeof FlexLayoutRootComponent | typeof FlexLayoutSectionComponent | typeof MaterialAddReferenceComponent | typeof MaterialButtonComponent | typeof MaterialButtonGroupComponent | typeof MaterialCheckboxComponent | typeof MaterialCheckboxesComponent | typeof MaterialChipListComponent | typeof MaterialDatepickerComponent | typeof MaterialDesignFrameworkComponent | typeof MaterialFileComponent | typeof MaterialInputComponent | typeof MaterialNumberComponent | typeof MaterialOneOfComponent | typeof MaterialRadiosComponent | typeof MaterialSelectComponent | typeof MaterialSliderComponent | typeof MaterialStepperComponent | typeof MaterialTabsComponent | typeof MaterialTextareaComponent)[];
|
|
35
22
|
export { FlexLayoutRootComponent } from './flex-layout-root.component';
|
|
36
23
|
export { FlexLayoutSectionComponent } from './flex-layout-section.component';
|
|
37
24
|
export { MaterialAddReferenceComponent } from './material-add-reference.component';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ajsf/material",
|
|
3
|
-
"version": "0.5.1
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Angular JSON Schema Form builder using Angular Material UI",
|
|
5
5
|
"author": "https://github.com/hamzahamidi/ajsf/graphs/contributors",
|
|
6
6
|
"keywords": [
|
|
@@ -29,12 +29,20 @@
|
|
|
29
29
|
"private": false,
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"lodash-es": "~4.17.21",
|
|
32
|
-
"@ajsf/core": "~0.5.1
|
|
32
|
+
"@ajsf/core": "~0.5.1",
|
|
33
33
|
"tslib": "^2.0.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@angular/flex-layout": ">=12.0.0-beta.35",
|
|
37
37
|
"@angular/material": ">=12.0.0",
|
|
38
38
|
"@angular/cdk": ">=12.0.0"
|
|
39
|
-
}
|
|
40
|
-
|
|
39
|
+
},
|
|
40
|
+
"main": "bundles/ajsf-material.umd.js",
|
|
41
|
+
"module": "fesm2015/ajsf-material.js",
|
|
42
|
+
"es2015": "fesm2015/ajsf-material.js",
|
|
43
|
+
"esm2015": "esm2015/ajsf-material.js",
|
|
44
|
+
"fesm2015": "fesm2015/ajsf-material.js",
|
|
45
|
+
"typings": "ajsf-material.d.ts",
|
|
46
|
+
"metadata": "ajsf-material.metadata.json",
|
|
47
|
+
"sideEffects": false
|
|
48
|
+
}
|
package/karma.conf.js
DELETED
|
@@ -1,37 +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-istanbul-reporter'),
|
|
13
|
-
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
-
],
|
|
15
|
-
client: {
|
|
16
|
-
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
17
|
-
},
|
|
18
|
-
coverageIstanbulReporter: {
|
|
19
|
-
dir: require('path').join(__dirname, '../../coverage/ajsf-material'),
|
|
20
|
-
reports: ['html', 'lcovonly', 'text-summary'],
|
|
21
|
-
fixWebpackSourcePaths: true
|
|
22
|
-
},
|
|
23
|
-
reporters: ['progress', 'kjhtml'],
|
|
24
|
-
port: 9876,
|
|
25
|
-
colors: true,
|
|
26
|
-
logLevel: config.LOG_INFO,
|
|
27
|
-
autoWatch: true,
|
|
28
|
-
browsers: ['Chrome', 'ChromeHeadlessNoSandbox'],
|
|
29
|
-
singleRun: false,
|
|
30
|
-
customLaunchers: {
|
|
31
|
-
ChromeHeadlessNoSandbox: {
|
|
32
|
-
base: 'ChromeHeadless',
|
|
33
|
-
flags: ['--no-sandbox']
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
};
|
package/ng-package.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
-
"dest": "../../dist/@ajsf/material",
|
|
4
|
-
"lib": {
|
|
5
|
-
"entryFile": "src/public_api.ts",
|
|
6
|
-
"umdModuleIds": {
|
|
7
|
-
"lodash/cloneDeep": "lodash-es",
|
|
8
|
-
"lodash/map": "lodash-es",
|
|
9
|
-
"@ajsf/core": "@ajsf/core"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"allowedNonPeerDependencies": [
|
|
13
|
-
"lodash-es",
|
|
14
|
-
"@ajsf/core"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MediaMarshaller } from '@angular/flex-layout/core';
|
|
2
|
-
|
|
3
|
-
export function fixAngularFlex() {
|
|
4
|
-
// monkey patch based on errors in console - https://github.com/angular/flex-layout/issues/1011
|
|
5
|
-
const MediaMarshallerUpdateElement = MediaMarshaller.prototype.updateElement;
|
|
6
|
-
|
|
7
|
-
MediaMarshaller.prototype.updateElement = function (element: HTMLElement, key: string, value: any) {
|
|
8
|
-
if (key === 'layout-gap' && (value === null || value === undefined)) {
|
|
9
|
-
value = '0px';
|
|
10
|
-
}
|
|
11
|
-
MediaMarshallerUpdateElement.apply(this, [element, key, value]);
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<div
|
|
2
|
-
[class.array-item]="widgetLayoutNode?.arrayItem && widgetLayoutNode?.type !== '$ref'"
|
|
3
|
-
[orderable]="isOrderable"
|
|
4
|
-
[dataIndex]="dataIndex"
|
|
5
|
-
[layoutIndex]="layoutIndex"
|
|
6
|
-
[layoutNode]="widgetLayoutNode">
|
|
7
|
-
<svg *ngIf="showRemoveButton"
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
height="18" width="18" viewBox="0 0 24 24"
|
|
10
|
-
class="close-button"
|
|
11
|
-
(click)="removeItem()">
|
|
12
|
-
<path
|
|
13
|
-
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>
|
|
14
|
-
</svg>
|
|
15
|
-
<select-widget-widget
|
|
16
|
-
[dataIndex]="dataIndex"
|
|
17
|
-
[layoutIndex]="layoutIndex"
|
|
18
|
-
[layoutNode]="widgetLayoutNode"></select-widget-widget>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="spacer" *ngIf="widgetLayoutNode?.arrayItem && widgetLayoutNode?.type !== '$ref'"></div>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
.array-item {
|
|
2
|
-
border-radius: 2px;
|
|
3
|
-
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2),
|
|
4
|
-
0 2px 2px 0 rgba(0, 0, 0, .14),
|
|
5
|
-
0 1px 5px 0 rgba(0, 0, 0, .12);
|
|
6
|
-
padding: 6px;
|
|
7
|
-
position: relative;
|
|
8
|
-
transition: all 280ms cubic-bezier(.4, 0, .2, 1);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.close-button {
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
position: absolute;
|
|
14
|
-
top: 6px;
|
|
15
|
-
right: 6px;
|
|
16
|
-
fill: rgba(0, 0, 0, .4);
|
|
17
|
-
visibility: hidden;
|
|
18
|
-
z-index: 500;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.close-button:hover {
|
|
22
|
-
fill: rgba(0, 0, 0, .8);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.array-item:hover > .close-button {
|
|
26
|
-
visibility: visible;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.spacer {
|
|
30
|
-
margin: 6px 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
[draggable=true]:hover {
|
|
34
|
-
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, .2),
|
|
35
|
-
0 8px 10px 1px rgba(0, 0, 0, .14),
|
|
36
|
-
0 3px 14px 2px rgba(0, 0, 0, .12);
|
|
37
|
-
cursor: move;
|
|
38
|
-
z-index: 10;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
[draggable=true].drag-target-top {
|
|
42
|
-
box-shadow: 0 -2px 0 #000;
|
|
43
|
-
position: relative;
|
|
44
|
-
z-index: 20;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
[draggable=true].drag-target-bottom {
|
|
48
|
-
box-shadow: 0 2px 0 #000;
|
|
49
|
-
position: relative;
|
|
50
|
-
z-index: 20;
|
|
51
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
4
|
-
JsonSchemaFormModule,
|
|
5
|
-
WidgetLibraryModule
|
|
6
|
-
} from '@ajsf/core';
|
|
7
|
-
import { MaterialDesignFrameworkComponent } from './material-design-framework.component';
|
|
8
|
-
|
|
9
|
-
describe('FwBootstrap4Component', () => {
|
|
10
|
-
let component: MaterialDesignFrameworkComponent;
|
|
11
|
-
let fixture: ComponentFixture<MaterialDesignFrameworkComponent>;
|
|
12
|
-
|
|
13
|
-
beforeEach(waitForAsync(() => {
|
|
14
|
-
TestBed.configureTestingModule({
|
|
15
|
-
imports: [
|
|
16
|
-
JsonSchemaFormModule,
|
|
17
|
-
CommonModule,
|
|
18
|
-
WidgetLibraryModule,
|
|
19
|
-
],
|
|
20
|
-
declarations: [MaterialDesignFrameworkComponent]
|
|
21
|
-
})
|
|
22
|
-
.compileComponents();
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
beforeEach(() => {
|
|
26
|
-
fixture = TestBed.createComponent(MaterialDesignFrameworkComponent);
|
|
27
|
-
component = fixture.componentInstance;
|
|
28
|
-
component.layoutNode = { options: {} };
|
|
29
|
-
component.layoutIndex = [];
|
|
30
|
-
component.dataIndex = [];
|
|
31
|
-
fixture.detectChanges();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should create', () => {
|
|
35
|
-
expect(component).toBeTruthy();
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import {ChangeDetectorRef, Component, Input, OnChanges, OnInit} from '@angular/core';
|
|
2
|
-
import {isDefined, JsonSchemaFormService} from '@ajsf/core';
|
|
3
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
// tslint:disable-next-line:component-selector
|
|
7
|
-
selector: 'material-design-framework',
|
|
8
|
-
templateUrl: './material-design-framework.component.html',
|
|
9
|
-
styleUrls: ['./material-design-framework.component.scss'],
|
|
10
|
-
})
|
|
11
|
-
export class MaterialDesignFrameworkComponent implements OnInit, OnChanges {
|
|
12
|
-
frameworkInitialized = false;
|
|
13
|
-
inputType: string;
|
|
14
|
-
options: any; // Options used in this framework
|
|
15
|
-
widgetLayoutNode: any; // layoutNode passed to child widget
|
|
16
|
-
widgetOptions: any; // Options passed to child widget
|
|
17
|
-
formControl: any = null;
|
|
18
|
-
parentArray: any = null;
|
|
19
|
-
isOrderable = false;
|
|
20
|
-
dynamicTitle: string = null;
|
|
21
|
-
@Input() layoutNode: any;
|
|
22
|
-
@Input() layoutIndex: number[];
|
|
23
|
-
@Input() dataIndex: number[];
|
|
24
|
-
|
|
25
|
-
constructor(
|
|
26
|
-
private changeDetector: ChangeDetectorRef,
|
|
27
|
-
private jsf: JsonSchemaFormService
|
|
28
|
-
) {
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
get showRemoveButton(): boolean {
|
|
32
|
-
if (!this.layoutNode || !this.widgetOptions.removable ||
|
|
33
|
-
this.widgetOptions.readonly || this.layoutNode.type === '$ref'
|
|
34
|
-
) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
if (this.layoutNode.recursiveReference) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
if (!this.layoutNode.arrayItem || !this.parentArray) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
// If array length <= minItems, don't allow removing any items
|
|
44
|
-
return this.parentArray.items.length - 1 <= this.parentArray.options.minItems ? false :
|
|
45
|
-
// For removable list items, allow removing any item
|
|
46
|
-
this.layoutNode.arrayItemType === 'list' ? true :
|
|
47
|
-
// For removable tuple items, only allow removing last item in list
|
|
48
|
-
this.layoutIndex[this.layoutIndex.length - 1] === this.parentArray.items.length - 2;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
ngOnInit() {
|
|
52
|
-
this.initializeFramework();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
ngOnChanges() {
|
|
56
|
-
if (!this.frameworkInitialized) {
|
|
57
|
-
this.initializeFramework();
|
|
58
|
-
}
|
|
59
|
-
if (this.dynamicTitle) {
|
|
60
|
-
this.updateTitle();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
initializeFramework() {
|
|
65
|
-
if (this.layoutNode) {
|
|
66
|
-
this.options = cloneDeep(this.layoutNode.options || {});
|
|
67
|
-
this.widgetLayoutNode = {
|
|
68
|
-
...this.layoutNode,
|
|
69
|
-
options: cloneDeep(this.layoutNode.options || {})
|
|
70
|
-
};
|
|
71
|
-
this.widgetOptions = this.widgetLayoutNode.options;
|
|
72
|
-
this.formControl = this.jsf.getFormControl(this);
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
isDefined(this.widgetOptions.minimum) &&
|
|
76
|
-
isDefined(this.widgetOptions.maximum) &&
|
|
77
|
-
this.widgetOptions.multipleOf >= 1
|
|
78
|
-
) {
|
|
79
|
-
this.layoutNode.type = 'range';
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
!['$ref', 'advancedfieldset', 'authfieldset', 'button', 'card',
|
|
84
|
-
'checkbox', 'expansion-panel', 'help', 'message', 'msg', 'section',
|
|
85
|
-
'submit', 'tabarray', 'tabs'].includes(this.layoutNode.type) &&
|
|
86
|
-
/{{.+?}}/.test(this.widgetOptions.title || '')
|
|
87
|
-
) {
|
|
88
|
-
this.dynamicTitle = this.widgetOptions.title;
|
|
89
|
-
this.updateTitle();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (this.layoutNode.arrayItem && this.layoutNode.type !== '$ref') {
|
|
93
|
-
this.parentArray = this.jsf.getParentNode(this);
|
|
94
|
-
if (this.parentArray) {
|
|
95
|
-
this.isOrderable =
|
|
96
|
-
this.parentArray.type.slice(0, 3) !== 'tab' &&
|
|
97
|
-
this.layoutNode.arrayItemType === 'list' &&
|
|
98
|
-
!this.widgetOptions.readonly &&
|
|
99
|
-
this.parentArray.options.orderable;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
this.frameworkInitialized = true;
|
|
104
|
-
} else {
|
|
105
|
-
this.options = {};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
updateTitle() {
|
|
110
|
-
this.widgetLayoutNode.options.title = this.jsf.parseText(
|
|
111
|
-
this.dynamicTitle,
|
|
112
|
-
this.jsf.getFormControlValue(this),
|
|
113
|
-
this.jsf.getFormControlGroup(this).value,
|
|
114
|
-
this.dataIndex[this.dataIndex.length - 1]
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
removeItem() {
|
|
119
|
-
this.jsf.removeItem(this);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Framework,
|
|
3
|
-
FrameworkLibraryService,
|
|
4
|
-
JsonSchemaFormModule,
|
|
5
|
-
JsonSchemaFormService,
|
|
6
|
-
WidgetLibraryModule, WidgetLibraryService
|
|
7
|
-
} from '@ajsf/core';
|
|
8
|
-
import {NgModule} from '@angular/core';
|
|
9
|
-
import {CommonModule} from '@angular/common';
|
|
10
|
-
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
|
11
|
-
import {FlexLayoutModule} from '@angular/flex-layout';
|
|
12
|
-
import {MatAutocompleteModule} from '@angular/material/autocomplete';
|
|
13
|
-
import {MatButtonModule} from '@angular/material/button';
|
|
14
|
-
import {MatButtonToggleModule} from '@angular/material/button-toggle';
|
|
15
|
-
import {MatCardModule} from '@angular/material/card';
|
|
16
|
-
import {MatCheckboxModule} from '@angular/material/checkbox';
|
|
17
|
-
import {MatChipsModule} from '@angular/material/chips';
|
|
18
|
-
import {MatNativeDateModule} from '@angular/material/core';
|
|
19
|
-
import {MatDatepickerModule} from '@angular/material/datepicker';
|
|
20
|
-
import {MatExpansionModule} from '@angular/material/expansion';
|
|
21
|
-
import {MatFormFieldModule} from '@angular/material/form-field';
|
|
22
|
-
import {MatIconModule} from '@angular/material/icon';
|
|
23
|
-
import {MatInputModule} from '@angular/material/input';
|
|
24
|
-
import {MatRadioModule} from '@angular/material/radio';
|
|
25
|
-
import {MatSelectModule} from '@angular/material/select';
|
|
26
|
-
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
|
|
27
|
-
import {MatSliderModule} from '@angular/material/slider';
|
|
28
|
-
import {MatStepperModule} from '@angular/material/stepper';
|
|
29
|
-
import {MatTabsModule} from '@angular/material/tabs';
|
|
30
|
-
import {MatTooltipModule} from '@angular/material/tooltip';
|
|
31
|
-
import {MatMenuModule} from '@angular/material/menu';
|
|
32
|
-
import {MatToolbarModule} from '@angular/material/toolbar';
|
|
33
|
-
import {MaterialDesignFramework} from './material-design.framework';
|
|
34
|
-
import {MATERIAL_FRAMEWORK_COMPONENTS} from './widgets/public_api';
|
|
35
|
-
import {fixAngularFlex} from './angular-flex-monkey-patch';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* unused @angular/material modules:
|
|
39
|
-
* MatDialogModule, MatGridListModule, MatListModule, MatMenuModule,
|
|
40
|
-
* MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule,
|
|
41
|
-
* MatSidenavModule, MatSnackBarModule, MatSortModule, MatTableModule,
|
|
42
|
-
* ,
|
|
43
|
-
*/
|
|
44
|
-
export const ANGULAR_MATERIAL_MODULES = [
|
|
45
|
-
MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule,
|
|
46
|
-
MatCheckboxModule, MatChipsModule, MatDatepickerModule, MatExpansionModule,
|
|
47
|
-
MatFormFieldModule, MatIconModule, MatInputModule, MatNativeDateModule,
|
|
48
|
-
MatRadioModule, MatSelectModule, MatSliderModule, MatSlideToggleModule,
|
|
49
|
-
MatStepperModule, MatTabsModule, MatTooltipModule,
|
|
50
|
-
MatToolbarModule, MatMenuModule, MatToolbarModule,
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
@NgModule({
|
|
54
|
-
imports: [
|
|
55
|
-
CommonModule,
|
|
56
|
-
FormsModule,
|
|
57
|
-
ReactiveFormsModule,
|
|
58
|
-
FlexLayoutModule,
|
|
59
|
-
...ANGULAR_MATERIAL_MODULES,
|
|
60
|
-
WidgetLibraryModule,
|
|
61
|
-
JsonSchemaFormModule,
|
|
62
|
-
],
|
|
63
|
-
declarations: [
|
|
64
|
-
...MATERIAL_FRAMEWORK_COMPONENTS,
|
|
65
|
-
],
|
|
66
|
-
exports: [
|
|
67
|
-
JsonSchemaFormModule,
|
|
68
|
-
...MATERIAL_FRAMEWORK_COMPONENTS,
|
|
69
|
-
],
|
|
70
|
-
providers: [
|
|
71
|
-
JsonSchemaFormService,
|
|
72
|
-
FrameworkLibraryService,
|
|
73
|
-
WidgetLibraryService,
|
|
74
|
-
{provide: Framework, useClass: MaterialDesignFramework, multi: true},
|
|
75
|
-
],
|
|
76
|
-
entryComponents: [
|
|
77
|
-
...MATERIAL_FRAMEWORK_COMPONENTS,
|
|
78
|
-
]
|
|
79
|
-
})
|
|
80
|
-
export class MaterialDesignFrameworkModule {
|
|
81
|
-
constructor() {
|
|
82
|
-
fixAngularFlex();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {Injectable} from '@angular/core';
|
|
2
|
-
import {Framework} from '@ajsf/core';
|
|
3
|
-
import {
|
|
4
|
-
FlexLayoutRootComponent,
|
|
5
|
-
FlexLayoutSectionComponent,
|
|
6
|
-
MaterialAddReferenceComponent,
|
|
7
|
-
MaterialButtonComponent,
|
|
8
|
-
MaterialButtonGroupComponent,
|
|
9
|
-
MaterialCheckboxComponent,
|
|
10
|
-
MaterialCheckboxesComponent,
|
|
11
|
-
MaterialChipListComponent,
|
|
12
|
-
MaterialDatepickerComponent,
|
|
13
|
-
MaterialDesignFrameworkComponent,
|
|
14
|
-
MaterialFileComponent,
|
|
15
|
-
MaterialInputComponent,
|
|
16
|
-
MaterialNumberComponent,
|
|
17
|
-
MaterialOneOfComponent,
|
|
18
|
-
MaterialRadiosComponent,
|
|
19
|
-
MaterialSelectComponent,
|
|
20
|
-
MaterialSliderComponent,
|
|
21
|
-
MaterialStepperComponent,
|
|
22
|
-
MaterialTabsComponent,
|
|
23
|
-
MaterialTextareaComponent
|
|
24
|
-
} from './widgets/public_api';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// Material Design Framework
|
|
28
|
-
// https://github.com/angular/material2
|
|
29
|
-
|
|
30
|
-
@Injectable()
|
|
31
|
-
export class MaterialDesignFramework extends Framework {
|
|
32
|
-
name = 'material-design';
|
|
33
|
-
|
|
34
|
-
framework = MaterialDesignFrameworkComponent;
|
|
35
|
-
|
|
36
|
-
stylesheets = [
|
|
37
|
-
'//fonts.googleapis.com/icon?family=Material+Icons',
|
|
38
|
-
'//fonts.googleapis.com/css?family=Roboto:300,400,500,700',
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
widgets = {
|
|
42
|
-
'root': FlexLayoutRootComponent,
|
|
43
|
-
'section': FlexLayoutSectionComponent,
|
|
44
|
-
'$ref': MaterialAddReferenceComponent,
|
|
45
|
-
'button': MaterialButtonComponent,
|
|
46
|
-
'button-group': MaterialButtonGroupComponent,
|
|
47
|
-
'checkbox': MaterialCheckboxComponent,
|
|
48
|
-
'checkboxes': MaterialCheckboxesComponent,
|
|
49
|
-
'chip-list': MaterialChipListComponent,
|
|
50
|
-
'date': MaterialDatepickerComponent,
|
|
51
|
-
'file': MaterialFileComponent,
|
|
52
|
-
'number': MaterialNumberComponent,
|
|
53
|
-
'one-of': MaterialOneOfComponent,
|
|
54
|
-
'radios': MaterialRadiosComponent,
|
|
55
|
-
'select': MaterialSelectComponent,
|
|
56
|
-
'slider': MaterialSliderComponent,
|
|
57
|
-
'stepper': MaterialStepperComponent,
|
|
58
|
-
'tabs': MaterialTabsComponent,
|
|
59
|
-
'text': MaterialInputComponent,
|
|
60
|
-
'textarea': MaterialTextareaComponent,
|
|
61
|
-
'alt-date': 'date',
|
|
62
|
-
'any-of': 'one-of',
|
|
63
|
-
'card': 'section',
|
|
64
|
-
'color': 'text',
|
|
65
|
-
'expansion-panel': 'section',
|
|
66
|
-
'hidden': 'none',
|
|
67
|
-
'image': 'none',
|
|
68
|
-
'integer': 'number',
|
|
69
|
-
'radiobuttons': 'button-group',
|
|
70
|
-
'range': 'slider',
|
|
71
|
-
'submit': 'button',
|
|
72
|
-
'tagsinput': 'chip-list',
|
|
73
|
-
'wizard': 'stepper',
|
|
74
|
-
};
|
|
75
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<div *ngFor="let layoutNode of layout; let i = index" [class.form-flex-item]="isFlexItem"
|
|
2
|
-
[style.flex-grow]="getFlexAttribute(layoutNode, 'flex-grow')"
|
|
3
|
-
[style.flex-shrink]="getFlexAttribute(layoutNode, 'flex-shrink')"
|
|
4
|
-
[style.flex-basis]="getFlexAttribute(layoutNode, 'flex-basis')"
|
|
5
|
-
[style.align-self]="(layoutNode?.options || {})['align-self']" [style.order]="layoutNode?.options?.order"
|
|
6
|
-
[fxFlex]="layoutNode?.options?.fxFlex" [fxFlexOrder]="layoutNode?.options?.fxFlexOrder"
|
|
7
|
-
[fxFlexOffset]="layoutNode?.options?.fxFlexOffset" [fxFlexAlign]="layoutNode?.options?.fxFlexAlign">
|
|
8
|
-
<select-framework-widget *ngIf="showWidget(layoutNode)"
|
|
9
|
-
[dataIndex]="layoutNode?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
|
|
10
|
-
[layoutIndex]="(layoutIndex || []).concat(i)" [layoutNode]="layoutNode"></select-framework-widget>
|
|
11
|
-
<div>
|