diff --git a/packages/arcgis-rest-types/src/statisticDefinition.ts b/packages/arcgis-rest-types/src/statisticDefinition.ts index 3da594a9c4..e58034d4f0 100644 --- a/packages/arcgis-rest-types/src/statisticDefinition.ts +++ b/packages/arcgis-rest-types/src/statisticDefinition.ts @@ -1,6 +1,29 @@ /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ +/** + * Enum of all different statistics operations + */ +export const enum StatisticType { + Count = "count", + Sum = "sum", + Minimum = "min", + Maximum = "max", + Average = "avg", + StandardDeviation = "stddev", + Variance = "var", + ContinuousPercentile = "percentile_cont", + DiscretePercentile = "percentile_disc" +} + +/** + * Enum of sorting orders + */ +export const enum SortingOrder { + Ascending = "asc", + Descending = "desc" +} + export interface IStatisticDefinition { /** * Statistical operation to perform (count, sum, min, max, avg, stddev, var, percentile_cont, percentile_disc). @@ -14,13 +37,14 @@ export interface IStatisticDefinition { | "stddev" | "var" | "percentile_cont" - | "percentile_disc"; + | "percentile_disc" + | StatisticType; /** * Parameter to be used along with statisticType. Currently, only applicable for percentile_cont (continuous percentile) and percentile_disc (discrete percentile). */ statisticParameter?: { value: number; - orderBy?: "asc" | "desc"; + orderBy?: "asc" | "desc" | SortingOrder; }; /** * Field on which to perform the statistical operation. diff --git a/packages/arcgis-rest-types/src/symbol.ts b/packages/arcgis-rest-types/src/symbol.ts index 7e71823722..fb510150d2 100644 --- a/packages/arcgis-rest-types/src/symbol.ts +++ b/packages/arcgis-rest-types/src/symbol.ts @@ -6,15 +6,43 @@ */ export type Color = [number, number, number, number]; +/** + * + */ +export const enum FontStyle { + Italic = "italic", + Normal = "normal", + Oblique = "oblique" +} + +/** + * + */ +export const enum FontWeight { + Bold = "bold", + Bolder = "bolder", + Lighter = "lighter", + Normal = "normal" +} + +/** + * + */ +export const enum FontDecoration { + LineThrough = "line-through", + Underline = "underline", + None = "none" +} + /** * */ export interface IFont { family?: string; // ""; size?: number; // ; - style?: "italic" | "normal" | "oblique"; - weight?: "bold" | "bolder" | "lighter" | "normal"; - decoration?: "line-through" | "underline" | "none"; + style?: "italic" | "normal" | "oblique" | FontStyle; + weight?: "bold" | "bolder" | "lighter" | "normal" | FontWeight; + decoration?: "line-through" | "underline" | "none" | FontDecoration; } /** @@ -34,16 +62,27 @@ export interface IPictureSourced { /** * */ -export interface ISymbol { - type: SymbolType; - style?: string; +export const enum SymbolType { + SLS = "esriSLS", + SMS = "esriSMS", + SFS = "esriSFS", + PMS = "esriPMS", + PFS = "esriPFS", + TS = "esriTS" } /** * */ export interface ISymbol { - type: SymbolType; + type: + | "esriSLS" + | "esriSMS" + | "esriSFS" + | "esriPMS" + | "esriPFS" + | "esriTS" + | SymbolType; style?: string; } @@ -60,7 +99,7 @@ export interface IMarkerSymbol extends ISymbol { * */ export interface IPictureFillSymbol extends ISymbol, IPictureSourced { - type: "esriPFS"; + type: "esriPFS" | SymbolType.PFS; outline?: ISimpleLineSymbol; // if outline has been specified xscale?: number; yscale?: number; @@ -70,61 +109,62 @@ export interface IPictureFillSymbol extends ISymbol, IPictureSourced { * */ export interface IPictureMarkerSymbol extends IMarkerSymbol, IPictureSourced { - type: "esriPMS"; + type: "esriPMS" | SymbolType.PMS; } /** * */ -export type SimpleMarkerSymbolStyle = - | "esriSMSCircle" - | "esriSMSCross" - | "esriSMSDiamond" - | "esriSMSSquare" - | "esriSMSX" - | "esriSMSTriangle"; - -/** - * - */ -export type SimpleLineSymbolStyle = - | "esriSLSDash" - | "esriSLSDashDot" - | "esriSLSDashDotDot" - | "esriSLSDot" - | "esriSLSNull" - | "esriSLSSolid"; +export const enum SimpleMarkerSymbolStyle { + Circle = "esriSMSCircle", + Cross = "esriSMSCross", + Diamond = "esriSMSDiamond", + Square = "esriSMSSquare", + X = "esriSMSX", + Triangle = "esriSMSTriangle" +} /** * */ -export type SimpleFillSymbolStyle = - | "esriSFSBackwardDiagonal" - | "esriSFSCross" - | "esriSFSDiagonalCross" - | "esriSFSForwardDiagonal" - | "esriSFSHorizontal" - | "esriSFSNull" - | "esriSFSSolid" - | "esriSFSVertical"; +export const enum SimpleLineSymbolStyle { + Dash = "esriSLSDash", + DashDot = "esriSLSDashDot", + DashDotDot = "esriSLSDashDotDot", + Dot = "esriSLSDot", + Null = "esriSLSNull", + Solid = "esriSLSSolid" +} /** * */ -export type SymbolType = - | "esriSLS" - | "esriSMS" - | "esriSFS" - | "esriPMS" - | "esriPFS" - | "esriTS"; +export const enum SimpleFillSymbolStyle { + BackwardDiagonal = "esriSFSBackwardDiagonal", + Cross = "esriSFSCross", + DiagonalCross = "esriSFSDiagonalCross", + ForwardDiagonal = "esriSFSForwardDiagonal", + Horizontal = "esriSFSHorizontal", + Null = "esriSFSNull", + Solid = "esriSFSSolid", + Vertical = "esriSFSVertical" +} /** * */ export interface ISimpleFillSymbol extends ISymbol { - type: "esriSFS"; - style?: SimpleFillSymbolStyle; + type: "esriSFS" | SymbolType.SFS; + style?: + | "esriSFSBackwardDiagonal" + | "esriSFSCross" + | "esriSFSDiagonalCross" + | "esriSFSForwardDiagonal" + | "esriSFSHorizontal" + | "esriSFSNull" + | "esriSFSSolid" + | "esriSFSVertical" + | SimpleFillSymbolStyle; color?: Color; outline?: ISimpleLineSymbol; // if outline has been specified } @@ -133,8 +173,15 @@ export interface ISimpleFillSymbol extends ISymbol { * */ export interface ISimpleLineSymbol extends ISymbol { - type: "esriSLS"; - style?: SimpleLineSymbolStyle; + type: "esriSLS" | SymbolType.SLS; + style?: + | "esriSLSDash" + | "esriSLSDashDot" + | "esriSLSDashDotDot" + | "esriSLSDot" + | "esriSLSNull" + | "esriSLSSolid" + | SimpleLineSymbolStyle; color?: Color; width?: number; } @@ -143,26 +190,60 @@ export interface ISimpleLineSymbol extends ISymbol { * */ export interface ISimpleMarkerSymbol extends IMarkerSymbol { - type: "esriSMS"; - style?: SimpleMarkerSymbolStyle; + type: "esriSMS" | SymbolType.SMS; + style?: + | "esriSMSCircle" + | "esriSMSCross" + | "esriSMSDiamond" + | "esriSMSSquare" + | "esriSMSX" + | "esriSMSTriangle" + | SimpleMarkerSymbolStyle; color?: Color; size?: number; outline?: ISimpleLineSymbol; } +/** + * + */ +export const enum VerticalAlignment { + Baseline = "baseline", + Top = "top", + Middle = "middle", + Bottom = "bottom" +} + +export const enum HorizontalAlignment { + Left = "left", + Right = "right", + Center = "center", + Justify = "justify" +} + /** * */ export interface ITextSymbol extends IMarkerSymbol { - type: "esriTS"; + type: "esriTS" | SymbolType.TS; color?: Color; backgroundColor?: Color; borderLineSize?: number; // ; borderLineColor?: Color; haloSize?: number; // ; haloColor?: Color; - verticalAlignment?: "baseline" | "top" | "middle" | "bottom"; - horizontalAlignment?: "left" | "right" | "center" | "justify"; + verticalAlignment?: + | "baseline" + | "top" + | "middle" + | "bottom" + | VerticalAlignment; + horizontalAlignment?: + | "left" + | "right" + | "center" + | "justify" + | HorizontalAlignment; rightToLeft?: boolean; kerning?: boolean; font?: IFont; diff --git a/packages/arcgis-rest-types/src/webmap.ts b/packages/arcgis-rest-types/src/webmap.ts index fad6cd6082..f64f50f48e 100644 --- a/packages/arcgis-rest-types/src/webmap.ts +++ b/packages/arcgis-rest-types/src/webmap.ts @@ -22,20 +22,21 @@ import { /** * Field type. */ -export type FieldType = - | "esriFieldTypeBlob" - | "esriFieldTypeDate" - | "esriFieldTypeDouble" - | "esriFieldTypeGeometry" - | "esriFieldTypeGlobalID" - | "esriFieldTypeGUID" - | "esriFieldTypeInteger" - | "esriFieldTypeOID" - | "esriFieldTypeRaster" - | "esriFieldTypeSingle" - | "esriFieldTypeSmallInteger" - | "esriFieldTypeString" - | "esriFieldTypeXML"; +export const enum FieldType { + Blob = "esriFieldTypeBlob", + Date = "esriFieldTypeDate", + Double = "esriFieldTypeDouble", + Geometry = "esriFieldTypeGeometry", + GlobalID = "esriFieldTypeGlobalID", + GUID = "esriFieldTypeGUID", + Integer = "esriFieldTypeInteger", + OID = "esriFieldTypeOID", + Raster = "esriFieldTypeRaster", + Single = "esriFieldTypeSingle", + SmallInteger = "esriFieldTypeSmallInteger", + String = "esriFieldTypeString", + XML = "esriFieldTypeXML" +} /** * Contains information about an attribute field. @@ -50,7 +51,21 @@ export interface IField { /** A string defining the field name. */ name: string; /** A string defining the field type. */ - type: FieldType; + type: + | "esriFieldTypeBlob" + | "esriFieldTypeDate" + | "esriFieldTypeDouble" + | "esriFieldTypeGeometry" + | "esriFieldTypeGlobalID" + | "esriFieldTypeGUID" + | "esriFieldTypeInteger" + | "esriFieldTypeOID" + | "esriFieldTypeRaster" + | "esriFieldTypeSingle" + | "esriFieldTypeSmallInteger" + | "esriFieldTypeString" + | "esriFieldTypeXML" + | FieldType; /** A string defining the field alias. */ alias?: string; /** The domain objects if applicable. */ @@ -81,6 +96,28 @@ export interface IPagingParams { num?: number; } +/** + * Date fields types to specify how the date should appear in popup windows + */ +export const enum DateFormat { + ShortDate = "shortDate", + ShortDateLE = "shortDateLE", + LongMonthDayYear = "longMonthDayYear", + DayShortMonthYear = "dayShortMonthYear", + LongDate = "longDate", + ShortDateShortTime = "shortDateShortTime", + ShortDateLEShortTime = "shortDateLEShortTime", + ShortDateShortTime24 = "shortDateShortTime24", + ShortDateLEShortTime24 = "shortDateLEShortTime24", + ShortDateLongTime = "shortDateLongTime", + ShortDateLELongTime = "shortDateLELongTime", + ShortDateLongTime24 = "shortDateLongTime24", + ShortDateLELongTime24 = "shortDateLELongTime24", + LongMonthYear = "longMonthYear", + ShortMonthYear = "shortMonthYear", + Year = "year" +} + /** * The format object can be used with numerical or date fields to provide more detail about how values should be displayed in popup windows. */ @@ -102,7 +139,8 @@ export interface IFieldFormat { | "shortDateLELongTime24" | "longMonthYear" | "shortMonthYear" - | "year"; + | "year" + | DateFormat; /** * A Boolean used with numerical fields. A value of true allows the number to have a digit (or thousands) separator when the value appears in popup windows.