@jsonforms/angular-material 3.2.1 → 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.
- package/lib/esm2022/library/controls/date.renderer.mjs +112 -14
- package/lib/esm2022/library/module.mjs +5 -3
- package/lib/esm2022/library/other/master-detail/master.mjs +3 -1
- package/lib/esm2022/library/other/table.renderer.mjs +21 -13
- package/lib/esm2022/library/util/date-format.mjs +27 -0
- package/lib/esm2022/library/util/dayjs-date-adapter.mjs +100 -0
- package/lib/fesm2022/jsonforms-angular-material.mjs +253 -27
- package/lib/fesm2022/jsonforms-angular-material.mjs.map +1 -1
- package/lib/library/controls/date.renderer.d.ts +15 -3
- package/lib/library/controls/date.renderer.d.ts.map +1 -1
- package/lib/library/module.d.ts +1 -1
- package/lib/library/module.d.ts.map +1 -1
- package/lib/library/other/master-detail/master.d.ts.map +1 -1
- package/lib/library/other/table.renderer.d.ts +10 -2
- package/lib/library/other/table.renderer.d.ts.map +1 -1
- package/lib/library/util/date-format.d.ts +17 -0
- package/lib/library/util/date-format.d.ts.map +1 -0
- package/lib/library/util/dayjs-date-adapter.d.ts +28 -0
- package/lib/library/util/dayjs-date-adapter.d.ts.map +1 -0
- package/lib/package.json +4 -3
- package/package.json +10 -8
- package/src/library/controls/date.renderer.ts +106 -8
- package/src/library/module.ts +2 -1
- package/src/library/other/master-detail/master.ts +1 -0
- package/src/library/other/table.renderer.ts +14 -10
- package/src/library/util/date-format.ts +24 -0
- package/src/library/util/dayjs-date-adapter.ts +101 -0
|
@@ -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
|
-
|
|
7
|
-
|
|
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":"
|
|
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"}
|
package/lib/library/module.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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,qBA2Fa,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;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;
|
|
1
|
+
{"version":3,"file":"table.renderer.d.ts","sourceRoot":"","sources":["../../../src/library/other/table.renderer.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAa,MAAM,EAAQ,aAAa,EAAE,MAAM,eAAe,CAAC;AACvE,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,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG;IAGzC,kBAAkB,CAAC,KAAK,EAAE,iBAAiB;IAS3C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAG3B,GAAG,IAAI,IAAI;IAMX,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAGvB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAGzB,QAAQ;IAaR,aAAa,WACH,UAAU,WACT,MAAM,KACd,iBAAiB,EAAE,CA+BpB;IAEF,mBAAmB,iBAAkB,UAAU,cAY7C;yCAtGS,aAAa;2CAAb,aAAa;CAuGzB;AACD,eAAO,MAAM,mBAAmB,EAAE,YAGjC,CAAC;AAEF,UAAU,iBAAiB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,kBAAkB,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,cAIlD,CAAC;AAEH,qBACa,QAAS,YAAW,aAAa;IAC5C,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;;;;;yCADvC,QAAQ;uCAAR,QAAQ;CASpB"}
|
|
@@ -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.
|
|
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.
|
|
55
|
-
"@jsonforms/core": "3.2.
|
|
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.
|
|
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.
|
|
55
|
-
"@jsonforms/core": "3.
|
|
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
|
-
"
|
|
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",
|
|
@@ -116,10 +118,10 @@
|
|
|
116
118
|
"webpack": "^5.78.0",
|
|
117
119
|
"yargs": "^17.7.2",
|
|
118
120
|
"zone.js": "~0.13.0",
|
|
119
|
-
"@jsonforms/angular": "3.
|
|
120
|
-
"@jsonforms/angular-test": "3.
|
|
121
|
-
"@jsonforms/core": "3.
|
|
122
|
-
"@jsonforms/examples": "3.
|
|
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 {
|
|
26
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
81
|
+
DateControlRenderer {
|
|
57
82
|
display: flex;
|
|
58
83
|
flex-direction: row;
|
|
59
84
|
}
|
|
60
|
-
|
|
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(
|
|
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) =>
|
|
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(
|
package/src/library/module.ts
CHANGED
|
@@ -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,
|
|
@@ -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]="
|
|
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
|
+
}
|