@jsonforms/angular-material 3.2.0 → 3.3.0-alpha.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.
@@ -1,10 +1,22 @@
1
- import { RankedTester } from '@jsonforms/core';
1
+ import { JsonFormsState, RankedTester, StatePropsOfControl } from '@jsonforms/core';
2
2
  import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
3
+ import { MyFormat } from '../util/date-format';
4
+ import { DayJsDateAdapter } from '../util/dayjs-date-adapter';
5
+ import { MatDatepicker } from '@angular/material/datepicker';
3
6
  import * as i0 from "@angular/core";
4
7
  export declare class DateControlRenderer extends JsonFormsControl {
8
+ private dateFormat;
9
+ private dateAdapter;
5
10
  focused: boolean;
6
- constructor(jsonformsService: JsonFormsAngularService);
7
- getEventValue: (event: any) => any;
11
+ views: string[];
12
+ startView: string;
13
+ panelClass: string;
14
+ constructor(jsonformsService: JsonFormsAngularService, dateFormat: MyFormat, dateAdapter: DayJsDateAdapter);
15
+ getEventValue: (event: any) => string;
16
+ protected mapToProps(state: JsonFormsState): StatePropsOfControl;
17
+ yearSelected($event: any, datepicker: MatDatepicker<DayJsDateAdapter>): void;
18
+ monthSelected($event: any, datepicker: MatDatepicker<DayJsDateAdapter>): void;
19
+ setViewProperties(): void;
8
20
  static ɵfac: i0.ɵɵFactoryDeclaration<DateControlRenderer, never>;
9
21
  static ɵcmp: i0.ɵɵComponentDeclaration<DateControlRenderer, "DateControlRenderer", never, {}, {}, never, never, false, never>;
10
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"date.renderer.d.ts","sourceRoot":"","sources":["../../../src/library/controls/date.renderer.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAiB,YAAY,EAAY,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;;AAE/E,qBAsCa,mBAAoB,SAAQ,gBAAgB;IACvD,OAAO,UAAS;gBAEJ,gBAAgB,EAAE,uBAAuB;IAIrD,aAAa,UAAW,GAAG,SAA6C;yCAP7D,mBAAmB;2CAAnB,mBAAmB;CAQ/B;AAED,eAAO,MAAM,yBAAyB,EAAE,YAGvC,CAAC"}
1
+ {"version":3,"file":"date.renderer.d.ts","sourceRoot":"","sources":["../../../src/library/controls/date.renderer.ts"],"names":[],"mappings":"AA8BA,OAAO,EAGL,cAAc,EACd,YAAY,EAEZ,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;;AAE7D,qBAgEa,mBAAoB,SAAQ,gBAAgB;IAQ3B,OAAO,CAAC,UAAU;IACvB,OAAO,CAAC,WAAW;IAR1C,OAAO,UAAS;IAChB,KAAK,EAAE,MAAM,EAAE,CAAM;IACrB,SAAS,SAAM;IACf,UAAU,SAAM;gBAGd,gBAAgB,EAAE,uBAAuB,EACP,UAAU,EAAE,QAAQ,EACzB,WAAW,EAAE,gBAAgB;IAK5D,aAAa,UAAW,GAAG,YAGzB;IAEF,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,mBAAmB;IAwBhE,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC;IAMrE,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC;IAOtE,iBAAiB;yCAxDN,mBAAmB;2CAAnB,mBAAmB;CAgE/B;AAED,eAAO,MAAM,yBAAyB,EAAE,YAGvC,CAAC"}
@@ -42,7 +42,7 @@ import * as i40 from "@angular/material/tooltip";
42
42
  import * as i41 from "@angular/material/badge";
43
43
  export declare class JsonFormsAngularMaterialModule {
44
44
  static ɵfac: i0.ɵɵFactoryDeclaration<JsonFormsAngularMaterialModule, never>;
45
- static ɵmod: i0.ɵɵNgModuleDeclaration<JsonFormsAngularMaterialModule, [typeof i1.BooleanControlRenderer, typeof i2.TextAreaRenderer, typeof i3.TextControlRenderer, typeof i4.NumberControlRenderer, typeof i5.RangeControlRenderer, typeof i6.DateControlRenderer, typeof i7.ToggleControlRenderer, typeof i8.VerticalLayoutRenderer, typeof i9.HorizontalLayoutRenderer, typeof i10.CategorizationTabLayoutRenderer, typeof i11.GroupLayoutRenderer, typeof i12.LabelRenderer, typeof i13.MasterListComponent, typeof i14.JsonFormsDetailComponent, typeof i15.ObjectControlRenderer, typeof i16.AutocompleteControlRenderer, typeof i17.TableRenderer, typeof i18.ArrayLayoutRenderer, typeof i19.LayoutChildrenRenderPropsPipe], [typeof i20.CommonModule, typeof i21.JsonFormsModule, typeof i22.MatFormFieldModule, typeof i23.MatCheckboxModule, typeof i24.MatInputModule, typeof i25.MatSliderModule, typeof i26.MatSlideToggleModule, typeof i27.MatNativeDateModule, typeof i28.MatDatepickerModule, typeof i29.MatTabsModule, typeof i30.MatSidenavModule, typeof i31.MatListModule, typeof i32.ReactiveFormsModule, typeof i33.MatCardModule, typeof i34.MatSelectModule, typeof i35.MatButtonModule, typeof i36.MatIconModule, typeof i37.MatAutocompleteModule, typeof i38.MatTableModule, typeof i39.MatToolbarModule, typeof i40.MatTooltipModule, typeof i41.MatBadgeModule], [typeof i20.CommonModule, typeof i21.JsonFormsModule, typeof i22.MatFormFieldModule, typeof i23.MatCheckboxModule, typeof i24.MatInputModule, typeof i25.MatSliderModule, typeof i26.MatSlideToggleModule, typeof i27.MatNativeDateModule, typeof i28.MatDatepickerModule, typeof i29.MatTabsModule, typeof i30.MatSidenavModule, typeof i31.MatListModule, typeof i32.ReactiveFormsModule, typeof i33.MatCardModule, typeof i34.MatSelectModule, typeof i35.MatButtonModule, typeof i36.MatIconModule, typeof i37.MatAutocompleteModule]>;
45
+ static ɵmod: i0.ɵɵNgModuleDeclaration<JsonFormsAngularMaterialModule, [typeof i1.BooleanControlRenderer, typeof i2.TextAreaRenderer, typeof i3.TextControlRenderer, typeof i4.NumberControlRenderer, typeof i5.RangeControlRenderer, typeof i6.DateControlRenderer, typeof i7.ToggleControlRenderer, typeof i8.VerticalLayoutRenderer, typeof i9.HorizontalLayoutRenderer, typeof i10.CategorizationTabLayoutRenderer, typeof i11.GroupLayoutRenderer, typeof i12.LabelRenderer, typeof i13.MasterListComponent, typeof i14.JsonFormsDetailComponent, typeof i15.ObjectControlRenderer, typeof i16.AutocompleteControlRenderer, typeof i17.TableRenderer, typeof i18.ArrayLayoutRenderer, typeof i19.LayoutChildrenRenderPropsPipe, typeof i17.GetProps], [typeof i20.CommonModule, typeof i21.JsonFormsModule, typeof i22.MatFormFieldModule, typeof i23.MatCheckboxModule, typeof i24.MatInputModule, typeof i25.MatSliderModule, typeof i26.MatSlideToggleModule, typeof i27.MatNativeDateModule, typeof i28.MatDatepickerModule, typeof i29.MatTabsModule, typeof i30.MatSidenavModule, typeof i31.MatListModule, typeof i32.ReactiveFormsModule, typeof i33.MatCardModule, typeof i34.MatSelectModule, typeof i35.MatButtonModule, typeof i36.MatIconModule, typeof i37.MatAutocompleteModule, typeof i38.MatTableModule, typeof i39.MatToolbarModule, typeof i40.MatTooltipModule, typeof i41.MatBadgeModule], [typeof i20.CommonModule, typeof i21.JsonFormsModule, typeof i22.MatFormFieldModule, typeof i23.MatCheckboxModule, typeof i24.MatInputModule, typeof i25.MatSliderModule, typeof i26.MatSlideToggleModule, typeof i27.MatNativeDateModule, typeof i28.MatDatepickerModule, typeof i29.MatTabsModule, typeof i30.MatSidenavModule, typeof i31.MatListModule, typeof i32.ReactiveFormsModule, typeof i33.MatCardModule, typeof i34.MatSelectModule, typeof i35.MatButtonModule, typeof i36.MatIconModule, typeof i37.MatAutocompleteModule]>;
46
46
  static ɵinj: i0.ɵɵInjectorDeclaration<JsonFormsAngularMaterialModule>;
47
47
  }
48
48
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/library/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,qBAqEa,8BAA8B;yCAA9B,8BAA8B;0CAA9B,8BAA8B;0CAA9B,8BAA8B;CAAG"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/library/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,qBAsEa,8BAA8B;yCAA9B,8BAA8B;0CAA9B,8BAA8B;0CAA9B,8BAA8B;CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"master.d.ts","sourceRoot":"","sources":["../../../../src/library/other/master-detail/master.ts"],"names":[],"mappings":"AA0BA,OAAO,EAEL,iBAAiB,EAEjB,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAMjB,cAAc,EAGd,YAAY,EAGZ,wBAAwB,EAEzB,MAAM,iBAAiB,CAAC;;AAIzB,eAAO,MAAM,oBAAoB,SAAU,MAAM,WAOhD,CAAC;AAEF,qBA0Fa,mBACX,SAAQ,qBACR,YAAW,MAAM;IAYf,OAAO,CAAC,iBAAiB;IAV3B,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,YAAY,EAAE,GAAG,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,MAAM,IAAI,CAAC;IAClD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,MAAM,IAAI,CAAC;IA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AAE,QAAQ,EAAE,MAAM,EAAE,KAAK,MAAM,IAAI,CAAC;IAC9D,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,iBAAiB,CAAC;gBAG9B,gBAAgB,EAAE,uBAAuB,EACjC,iBAAiB,EAAE,iBAAiB;IAK9C,eAAe,CAAC,GAAG,EAAE,MAAM;IAI3B,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAIzC,QAAQ;IAUR,kBAAkB,CAAC,KAAK,EAAE,iBAAiB;IAwE3C,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAKtC,UAAU;IAOV,aAAa,CAAC,IAAI,EAAE,MAAM;IAI1B,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,wBAAwB;yCA7H1D,mBAAmB;2CAAnB,mBAAmB;CAiI/B;AAED,eAAO,MAAM,kBAAkB,EAAE,YAGhC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { OnInit } from '@angular/core';
1
+ import { OnInit, PipeTransform } from '@angular/core';
2
2
  import { JsonFormsAngularService, JsonFormsArrayControl } from '@jsonforms/angular';
3
3
  import { ArrayControlProps, ArrayTranslations, ControlElement, JsonSchema, OwnPropsOfRenderer, RankedTester, UISchemaElement } from '@jsonforms/core';
4
4
  import * as i0 from "@angular/core";
@@ -15,7 +15,6 @@ export declare class TableRenderer extends JsonFormsArrayControl implements OnIn
15
15
  constructor(jsonformsService: JsonFormsAngularService);
16
16
  trackElement(index: number, _element: any): number;
17
17
  mapAdditionalProps(props: ArrayControlProps): void;
18
- getProps(index: number, props: OwnPropsOfRenderer): OwnPropsOfRenderer;
19
18
  remove(index: number): void;
20
19
  add(): void;
21
20
  up(index: number): void;
@@ -33,5 +32,14 @@ interface ColumnDescription {
33
32
  props: OwnPropsOfRenderer;
34
33
  }
35
34
  export declare const controlWithoutLabel: (scope: string) => ControlElement;
35
+ export declare class GetProps implements PipeTransform {
36
+ transform(index: number, props: OwnPropsOfRenderer): {
37
+ schema: JsonSchema;
38
+ uischema: UISchemaElement;
39
+ path: string;
40
+ };
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<GetProps, never>;
42
+ static ɵpipe: i0.ɵɵPipeDeclaration<GetProps, "getProps", false>;
43
+ }
36
44
  export {};
37
45
  //# sourceMappingURL=table.renderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.renderer.d.ts","sourceRoot":"","sources":["../../../src/library/other/table.renderer.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAa,MAAM,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EAMd,UAAU,EAGV,kBAAkB,EAElB,YAAY,EAGZ,eAAe,EAChB,MAAM,iBAAiB,CAAC;;AAEzB,qBAyFa,aAAc,SAAQ,qBAAsB,YAAW,MAAM;IACxE,cAAc,EAAE,eAAe,CAAC;IAChC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,QAAQ,CAAC,eAAe,WAAuB;IAC/C,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,MAAM,IAAI,CAAC;IAClD,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,IAAI,CAAC;IACxD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,IAAI,CAAC;IAC1D,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,MAAM,IAAI,CAAC;IAC9D,YAAY,EAAE,iBAAiB,CAAC;gBAEpB,gBAAgB,EAAE,uBAAuB;IAGrD,YAAY,CAAC,K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0,0 +1,17 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class MyFormat {
3
+ displayFormat: string;
4
+ setDisplayFormat(displayFormat: string): void;
5
+ get display(): {
6
+ monthYearLabel: string;
7
+ dateA11yLabel: string;
8
+ monthYearA11yLabel: string;
9
+ dateInput: string;
10
+ };
11
+ get parse(): {
12
+ dateInput: string;
13
+ };
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<MyFormat, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<MyFormat>;
16
+ }
17
+ //# sourceMappingURL=date-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-format.d.ts","sourceRoot":"","sources":["../../../src/library/util/date-format.ts"],"names":[],"mappings":";AAEA,qBACa,QAAQ;IACnB,aAAa,SAAc;IAE3B,gBAAgB,CAAC,aAAa,EAAE,MAAM;IAItC,IAAI,OAAO;;;;;MAOV;IACD,IAAI,KAAK;;MAIR;yCAnBU,QAAQ;6CAAR,QAAQ;CAoBpB"}
@@ -0,0 +1,28 @@
1
+ import { NativeDateAdapter } from '@angular/material/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * date adapter for dayjs to parse and format dates
5
+ */
6
+ export declare class DayJsDateAdapter extends NativeDateAdapter {
7
+ saveFormat: string;
8
+ setSaveFormat(format: string): void;
9
+ /**
10
+ * parses a given data prop string in the save-format into a date object
11
+ * @param value date string to be parsed
12
+ * @returns date object or null if parsing failed
13
+ */
14
+ parseSaveFormat(value: string): Date | null;
15
+ parse(value: string, format: string): Date | null;
16
+ toSaveFormat(value: Date): string;
17
+ /**
18
+ * transforms the date to a string representation for display
19
+ * @param date date to be formatted
20
+ * @param displayFormat format to be used for formatting the date e.g. YYYY-MM-DD
21
+ * @returns string representation of the date
22
+ */
23
+ format(date: Date, displayFormat: string): string;
24
+ deserialize(value: any): Date | null;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<DayJsDateAdapter, never>;
26
+ static ɵprov: i0.ɵɵInjectableDeclaration<DayJsDateAdapter>;
27
+ }
28
+ //# sourceMappingURL=dayjs-date-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dayjs-date-adapter.d.ts","sourceRoot":"","sources":["../../../src/library/util/dayjs-date-adapter.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;;AAQ3D;;GAEG;AACH,qBACa,gBAAiB,SAAQ,iBAAiB;IACrD,UAAU,EAAE,MAAM,CAAqB;IAEvC,aAAa,CAAC,MAAM,EAAE,MAAM;IAI5B;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAI3C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAajD,YAAY,CAAC,KAAK,EAAE,IAAI;IAYxB;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM;IAIjD,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;yCAnDzB,gBAAgB;6CAAhB,gBAAgB;CA8D5B"}
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/angular-material",
3
- "version": "3.2.0-beta.1",
3
+ "version": "3.2.1",
4
4
  "description": "Material Renderer Set for Angular module of JSON Forms",
5
5
  "repository": "https://github.com/eclipsesource/jsonforms",
6
6
  "bugs": "https://github.com/eclipsesource/jsonforms/issues",
@@ -51,8 +51,9 @@
51
51
  "@angular/material": "^16.0.0 || ^17.0.0",
52
52
  "@angular/platform-browser": "^16.0.0 || ^17.0.0",
53
53
  "@angular/router": "^16.0.0 || ^17.0.0",
54
- "@jsonforms/angular": "3.2.0-beta.1",
55
- "@jsonforms/core": "3.2.0-beta.1",
54
+ "@jsonforms/angular": "3.2.1",
55
+ "@jsonforms/core": "3.2.1",
56
+ "dayjs": "^1.11.7",
56
57
  "rxjs": "^6.6.0 || ^7.4.0"
57
58
  },
58
59
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/angular-material",
3
- "version": "3.2.0",
3
+ "version": "3.3.0-alpha.0",
4
4
  "description": "Material Renderer Set for Angular module of JSON Forms",
5
5
  "repository": "https://github.com/eclipsesource/jsonforms",
6
6
  "bugs": "https://github.com/eclipsesource/jsonforms/issues",
@@ -51,8 +51,9 @@
51
51
  "@angular/material": "^16.0.0 || ^17.0.0",
52
52
  "@angular/platform-browser": "^16.0.0 || ^17.0.0",
53
53
  "@angular/router": "^16.0.0 || ^17.0.0",
54
- "@jsonforms/angular": "3.2.0",
55
- "@jsonforms/core": "3.2.0",
54
+ "@jsonforms/angular": "3.3.0-alpha.0",
55
+ "@jsonforms/core": "3.3.0-alpha.0",
56
+ "dayjs": "^1.11.7",
56
57
  "rxjs": "^6.6.0 || ^7.4.0"
57
58
  },
58
59
  "dependencies": {
@@ -87,7 +88,8 @@
87
88
  "@typescript-eslint/parser": "^5.54.1",
88
89
  "babel-loader": "^8.0.6",
89
90
  "copy-webpack-plugin": "^11.0.0",
90
- "eslint": "^7.32.0",
91
+ "dayjs": "^1.11.10",
92
+ "eslint": "^8.56.0",
91
93
  "eslint-config-prettier": "^8.7.0",
92
94
  "eslint-plugin-import": "^2.27.5",
93
95
  "eslint-plugin-prettier": "^4.2.1",
@@ -109,17 +111,17 @@
109
111
  "protractor": "^7.0.0",
110
112
  "rimraf": "^3.0.2",
111
113
  "rxjs": "^6.6.0",
112
- "ts-loader": "^6.2.1",
114
+ "ts-loader": "^9.5.1",
113
115
  "tslib": "^2.5.0",
114
116
  "typedoc": "~0.25.3",
115
117
  "typescript": "~4.9.5",
116
118
  "webpack": "^5.78.0",
117
119
  "yargs": "^17.7.2",
118
120
  "zone.js": "~0.13.0",
119
- "@jsonforms/angular": "3.2.0",
120
- "@jsonforms/core": "3.2.0",
121
- "@jsonforms/examples": "3.2.0",
122
- "@jsonforms/angular-test": "3.2.0"
121
+ "@jsonforms/angular": "3.3.0-alpha.0",
122
+ "@jsonforms/angular-test": "3.3.0-alpha.0",
123
+ "@jsonforms/core": "3.3.0-alpha.0",
124
+ "@jsonforms/examples": "3.3.0-alpha.0"
123
125
  },
124
126
  "scripts": {
125
127
  "build": "node ./build-package.js",
@@ -22,14 +22,33 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
- import { Component, ChangeDetectionStrategy } from '@angular/core';
26
- import { isDateControl, RankedTester, rankWith } from '@jsonforms/core';
25
+ import {
26
+ Component,
27
+ ChangeDetectionStrategy,
28
+ Inject,
29
+ ViewEncapsulation,
30
+ } from '@angular/core';
31
+ import {
32
+ defaultDateFormat,
33
+ isDateControl,
34
+ JsonFormsState,
35
+ RankedTester,
36
+ rankWith,
37
+ StatePropsOfControl,
38
+ } from '@jsonforms/core';
27
39
  import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
40
+ import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
41
+ import { MyFormat } from '../util/date-format';
42
+ import { DayJsDateAdapter } from '../util/dayjs-date-adapter';
43
+ import { MatDatepicker } from '@angular/material/datepicker';
28
44
 
29
45
  @Component({
30
46
  selector: 'DateControlRenderer',
31
47
  template: `
32
- <mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
48
+ <mat-form-field
49
+ class="date-control-renderer"
50
+ [ngStyle]="{ display: hidden ? 'none' : '' }"
51
+ >
33
52
  <mat-label>{{ label }}</mat-label>
34
53
  <input
35
54
  matInput
@@ -44,7 +63,13 @@ import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
44
63
  matSuffix
45
64
  [for]="datepicker"
46
65
  ></mat-datepicker-toggle>
47
- <mat-datepicker #datepicker></mat-datepicker>
66
+ <mat-datepicker
67
+ #datepicker
68
+ (monthSelected)="monthSelected($event, datepicker)"
69
+ (yearSelected)="yearSelected($event, datepicker)"
70
+ [startView]="startView"
71
+ [panelClass]="panelClass"
72
+ ></mat-datepicker>
48
73
  <mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
49
74
  description
50
75
  }}</mat-hint>
@@ -53,25 +78,98 @@ import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
53
78
  `,
54
79
  styles: [
55
80
  `
56
- :host {
81
+ DateControlRenderer {
57
82
  display: flex;
58
83
  flex-direction: row;
59
84
  }
60
- mat-form-field {
85
+ .date-control-renderer {
61
86
  flex: 1 1 auto;
62
87
  }
88
+ .no-panel-navigation .mat-calendar-period-button {
89
+ pointer-events: none;
90
+ }
91
+ .no-panel-navigation .mat-calendar-arrow {
92
+ display: none;
93
+ }
63
94
  `,
64
95
  ],
96
+ encapsulation: ViewEncapsulation.None,
65
97
  changeDetection: ChangeDetectionStrategy.OnPush,
98
+ providers: [
99
+ {
100
+ provide: DateAdapter,
101
+ useClass: DayJsDateAdapter,
102
+ },
103
+ {
104
+ provide: MAT_DATE_FORMATS,
105
+ useClass: MyFormat,
106
+ },
107
+ ],
66
108
  })
67
109
  export class DateControlRenderer extends JsonFormsControl {
68
110
  focused = false;
111
+ views: string[] = [];
112
+ startView = '';
113
+ panelClass = '';
69
114
 
70
- constructor(jsonformsService: JsonFormsAngularService) {
115
+ constructor(
116
+ jsonformsService: JsonFormsAngularService,
117
+ @Inject(MAT_DATE_FORMATS) private dateFormat: MyFormat,
118
+ @Inject(DateAdapter) private dateAdapter: DayJsDateAdapter
119
+ ) {
71
120
  super(jsonformsService);
72
121
  }
73
122
 
74
- getEventValue = (event: any) => event.value.toISOString().substr(0, 10);
123
+ getEventValue = (event: any) => {
124
+ const value = event.value ? event.value : event;
125
+ return this.dateAdapter.toSaveFormat(value);
126
+ };
127
+
128
+ protected mapToProps(state: JsonFormsState): StatePropsOfControl {
129
+ const props = super.mapToProps(state);
130
+ const saveFormat = this.uischema?.options?.dateSaveFormat
131
+ ? this.uischema.options.dateSaveFormat
132
+ : defaultDateFormat;
133
+ this.views = this.uischema?.options?.views
134
+ ? this.uischema.options.views
135
+ : ['year', 'month', 'day'];
136
+ this.setViewProperties();
137
+
138
+ const dateFormat = this.uischema?.options?.dateFormat;
139
+
140
+ if (dateFormat) {
141
+ this.dateFormat.setDisplayFormat(dateFormat);
142
+ }
143
+
144
+ this.dateAdapter.setSaveFormat(saveFormat);
145
+ if (this.jsonFormsService.getLocale()) {
146
+ this.dateAdapter.setLocale(this.jsonFormsService.getLocale());
147
+ }
148
+ const date = this.dateAdapter.parseSaveFormat(props.data);
149
+ return { ...props, data: date };
150
+ }
151
+
152
+ yearSelected($event: any, datepicker: MatDatepicker<DayJsDateAdapter>) {
153
+ if (!this.views.includes('day') && !this.views.includes('month')) {
154
+ this.onChange($event);
155
+ datepicker.close();
156
+ }
157
+ }
158
+ monthSelected($event: any, datepicker: MatDatepicker<DayJsDateAdapter>) {
159
+ if (!this.views.includes('day')) {
160
+ this.onChange($event);
161
+ datepicker.close();
162
+ }
163
+ }
164
+
165
+ setViewProperties() {
166
+ if (!this.views.includes('day')) {
167
+ this.startView = 'multi-year';
168
+ this.panelClass = 'no-panel-navigation';
169
+ } else {
170
+ this.startView = 'month';
171
+ }
172
+ }
75
173
  }
76
174
 
77
175
  export const DateControlRendererTester: RankedTester = rankWith(
@@ -57,7 +57,7 @@ import { LabelRenderer } from './other/label.renderer';
57
57
  import { JsonFormsDetailComponent } from './other/master-detail/detail';
58
58
  import { MasterListComponent } from './other/master-detail/master';
59
59
  import { ObjectControlRenderer } from './other/object.renderer';
60
- import { TableRenderer } from './other/table.renderer';
60
+ import { TableRenderer, GetProps } from './other/table.renderer';
61
61
  import { CategorizationTabLayoutRenderer } from './layouts/categorization-layout.renderer';
62
62
  import { GroupLayoutRenderer } from './layouts/group-layout.renderer';
63
63
  import { HorizontalLayoutRenderer } from './layouts/horizontal-layout.renderer';
@@ -110,6 +110,7 @@ import { LayoutChildrenRenderPropsPipe } from './layouts';
110
110
  TableRenderer,
111
111
  ArrayLayoutRenderer,
112
112
  LayoutChildrenRenderPropsPipe,
113
+ GetProps,
113
114
  ],
114
115
  exports: [
115
116
  CommonModule,
@@ -68,6 +68,7 @@ export const removeSchemaKeywords = (path: string) => {
68
68
  template: `
69
69
  <mat-sidenav-container
70
70
  [ngStyle]="{ display: hidden ? 'none' : '' }"
71
+ autosize="true"
71
72
  class="container"
72
73
  >
73
74
  <mat-sidenav mode="side" opened>
@@ -23,7 +23,7 @@
23
23
  THE SOFTWARE.
24
24
  */
25
25
  import startCase from 'lodash/startCase';
26
- import { Component, OnInit } from '@angular/core';
26
+ import { Component, OnInit, Pipe, PipeTransform } from '@angular/core';
27
27
  import {
28
28
  JsonFormsAngularService,
29
29
  JsonFormsArrayControl,
@@ -126,7 +126,7 @@ import {
126
126
  <th mat-header-cell *matHeaderCellDef>{{ item.header }}</th>
127
127
  <td mat-cell *matCellDef="let index = index">
128
128
  <jsonforms-outlet
129
- [renderProps]="getProps(index, item.props)"
129
+ [renderProps]="index | getProps : item.props"
130
130
  ></jsonforms-outlet>
131
131
  </td>
132
132
  </ng-container>
@@ -162,14 +162,6 @@ export class TableRenderer extends JsonFormsArrayControl implements OnInit {
162
162
  }
163
163
  this.translations = props.translations;
164
164
  }
165
- getProps(index: number, props: OwnPropsOfRenderer): OwnPropsOfRenderer {
166
- const rowPath = Paths.compose(props.path, `${index}`);
167
- return {
168
- schema: props.schema,
169
- uischema: props.uischema,
170
- path: rowPath,
171
- };
172
- }
173
165
 
174
166
  remove(index: number): void {
175
167
  this.removeItems(this.propsPath, [index])();
@@ -265,3 +257,15 @@ export const controlWithoutLabel = (scope: string): ControlElement => ({
265
257
  scope: scope,
266
258
  label: false,
267
259
  });
260
+
261
+ @Pipe({ name: 'getProps' })
262
+ export class GetProps implements PipeTransform {
263
+ transform(index: number, props: OwnPropsOfRenderer) {
264
+ const rowPath = Paths.compose(props.path, `${index}`);
265
+ return {
266
+ schema: props.schema,
267
+ uischema: props.uischema,
268
+ path: rowPath,
269
+ };
270
+ }
271
+ }
@@ -0,0 +1,24 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable()
4
+ export class MyFormat {
5
+ displayFormat = 'M/D/YYYY';
6
+
7
+ setDisplayFormat(displayFormat: string) {
8
+ this.displayFormat = displayFormat;
9
+ }
10
+
11
+ get display() {
12
+ return {
13
+ monthYearLabel: 'YYYY-MM',
14
+ dateA11yLabel: 'YYYY-MM-DD',
15
+ monthYearA11yLabel: 'YYYY-MM',
16
+ dateInput: this.displayFormat,
17
+ };
18
+ }
19
+ get parse() {
20
+ return {
21
+ dateInput: this.displayFormat,
22
+ };
23
+ }
24
+ }
@@ -0,0 +1,101 @@
1
+ /*
2
+ The MIT License
3
+
4
+ Copyright (c) 2017-2019 EclipseSource Munich
5
+ https://github.com/eclipsesource/jsonforms
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ import { Injectable } from '@angular/core';
27
+ import { NativeDateAdapter } from '@angular/material/core';
28
+ import { defaultDateFormat } from '@jsonforms/core';
29
+ import dayjs from 'dayjs';
30
+ import customParsing from 'dayjs/plugin/customParseFormat';
31
+
32
+ // allows to parse date strings with custom format
33
+ dayjs.extend(customParsing);
34
+
35
+ /**
36
+ * date adapter for dayjs to parse and format dates
37
+ */
38
+ @Injectable()
39
+ export class DayJsDateAdapter extends NativeDateAdapter {
40
+ saveFormat: string = defaultDateFormat;
41
+
42
+ setSaveFormat(format: string) {
43
+ this.saveFormat = format;
44
+ }
45
+
46
+ /**
47
+ * parses a given data prop string in the save-format into a date object
48
+ * @param value date string to be parsed
49
+ * @returns date object or null if parsing failed
50
+ */
51
+ parseSaveFormat(value: string): Date | null {
52
+ return this.parse(value, this.saveFormat);
53
+ }
54
+
55
+ parse(value: string, format: string): Date | null {
56
+ if (!value) {
57
+ return null;
58
+ }
59
+ const date = dayjs(value, format);
60
+
61
+ if (date.isValid()) {
62
+ return date.toDate();
63
+ } else {
64
+ return null;
65
+ }
66
+ }
67
+
68
+ toSaveFormat(value: Date) {
69
+ if (!value) {
70
+ return undefined;
71
+ }
72
+ const date = dayjs(value);
73
+ if (date.isValid()) {
74
+ return date.format(this.saveFormat);
75
+ } else {
76
+ return undefined;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * transforms the date to a string representation for display
82
+ * @param date date to be formatted
83
+ * @param displayFormat format to be used for formatting the date e.g. YYYY-MM-DD
84
+ * @returns string representation of the date
85
+ */
86
+ format(date: Date, displayFormat: string): string {
87
+ return dayjs(date).format(displayFormat);
88
+ }
89
+
90
+ deserialize(value: any): Date | null {
91
+ if (!value) {
92
+ return null;
93
+ }
94
+ const date = dayjs(value);
95
+ if (date.isValid()) {
96
+ return date.toDate();
97
+ } else {
98
+ return null;
99
+ }
100
+ }
101
+ }