This commit is contained in:
ali-hamud 2017-08-16 17:19:02 +03:00
Родитель 899d87bee3
Коммит 43561ce215
4 изменённых файлов: 79 добавлений и 2 удалений

Просмотреть файл

@ -11,6 +11,8 @@ export const settingsSchema = require('./schemas/settings.json');
export const basicFilterSchema = require('./schemas/basicFilter.json');
export const createReportSchema = require('./schemas/reportCreateConfiguration.json');
export const saveAsParametersSchema = require('./schemas/saveAsParameters.json');
export const customLayoutSchema = require('./schemas/customLayout.json');
export const pageSizeSchema = require('./schemas/pageSize.json');
/* tslint:enable:no-var-requires */
import * as jsen from 'jsen';
@ -62,16 +64,44 @@ function validate(schema: any, options?: any) {
};
}
export enum PageSizeType {
Widescreen,
Standard,
Cortana,
Letter,
Custom
}
export enum DisplayOption {
FitToPage,
FitToWidth,
ActualSize
}
export interface IPageSize {
type: PageSizeType;
width?: number;
height?: number;
}
export interface ICustomLayout {
pageSize?: IPageSize;
displayOption?: DisplayOption;
}
export interface ISettings {
filterPaneEnabled?: boolean;
navContentPaneEnabled?: boolean;
useCustomSaveAsDialog?: boolean;
customLayout?: ICustomLayout;
}
export const validateSettings = validate(settingsSchema, {
schemas: {
basicFilter: basicFilterSchema,
advancedFilter: advancedFilterSchema
advancedFilter: advancedFilterSchema,
customLayout: customLayoutSchema,
pageSize: pageSizeSchema
}
});
@ -90,7 +120,9 @@ export const validateReportLoad = validate(loadSchema, {
schemas: {
settings: settingsSchema,
basicFilter: basicFilterSchema,
advancedFilter: advancedFilterSchema
advancedFilter: advancedFilterSchema,
customLayout: customLayoutSchema,
pageSize: pageSizeSchema
}
});

Просмотреть файл

@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"pageSize": {
"$ref": "#pageSize"
},
"displayOption": {
"type": "number",
"enum": [0, 1, 2],
"default": 0,
"invalidMessage": "displayOption property is invalid"
}
}
}

27
src/schemas/pageSize.json Normal file
Просмотреть файл

@ -0,0 +1,27 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"width": {
"type": "number",
"messages": {
"type": "width must be a number"
}
},
"height": {
"type": "number",
"messages": {
"type": "height must be a number"
}
},
"type": {
"type": "number",
"enum": [0, 1, 2, 3, 4, 5],
"default": 0,
"invalidMessage": "type property is invalid"
}
},
"required": [
"type"
]
}

Просмотреть файл

@ -19,6 +19,9 @@
"messages": {
"type": "useCustomSaveAsDialog must be a boolean"
}
},
"customLayout": {
"$ref": "#customLayout"
}
}
}