tmcgee/cmv-wab-widgets

View on GitHub
config/wab.js

Summary

Maintainability
A
0 mins
Test Coverage
define([
    'esri/units',
    'dojo/sniff'
], function (esriUnits, has) {

    return {

        isDebug: true,

        defaultMapClickMode: 'identify',

        mapOptions: {
            basemap: 'hybrid',
            center: [-96.59179687497497, 39.09596293629694],
            zoom: 5,
            sliderStyle: 'small'
        },

        titles: {
            header: 'CMV WAB Widgets Test',
            subHeader: 'This is an example of using Web App Builder widgets with CMV',
            pageTitle: 'CMV WAB Widgets Test'
        },

        panes: {
            left: {
                splitter: !has('touch'),
                style: 'width:340px;'
            }
        },
        collapseButtonsPane: 'center', //center or outer

        operationalLayers: [
            {
                type: 'feature',
                url: 'https://services.arcgis.com/doC3DvW5p9jGtDST/arcgis/rest/services/RestaurantInspections_April2018/FeatureServer/0/',
                title: 'Restaurants',
                options: {
                    id: 'restaurants',
                    opacity: 1.0,
                    visible: true,
                    outFields: ['*'],
                    featureReduction: has('phone') ? null : {
                        type: 'cluster',
                        clusterRadius: 10
                    },
                    mode: 0
                }
            }, {
                type: 'feature',
                url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/MapServer/0',
                title: 'Damage Assessment',
                options: {
                    id: 'DamageAssessment',
                    opacity: 1.0,
                    visible: true
                }
            }
        ],

        widgets: {
            identify: {
                include: true,
                id: 'identify',
                type: 'invisible',
                path: 'gis/dijit/Identify',
                title: 'Identify',
                options: 'config/identify'
            },

            coordinates: {
                include: true,
                id: 'coordinates',
                type: 'ui',
                placeAt: '.cmv-ui-map .cmv-ui-bottom-left',
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABCoordinate',
                                uri: 'wabwidgets/Coordinate/Widget'
                            }
                        ]
                    }
                }
            },
            mapButtons: {
                include: true,
                id: 'mapButtons',
                type: 'ui',
                placeAt: 'top-left',
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        // a BaseWidgetPanel can have multiple widgets
                        widgets: [
                            {
                                id: 'WABHome',
                                uri: 'wabwidgets/HomeButton/Widget'
                            },
                            {
                                id: 'WABMyLocation',
                                uri: 'wabwidgets/MyLocation/Widget'
                            }
                        ]
                    }
                }
            },
            basemapGallery: {
                include: true,
                id: 'basemapGallery',
                type: 'titlePane',
                position: 0,
                title: 'Basemap Gallery',
                iconClass: 'fas fa-fw fa-map',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABBasemapGallery',
                                uri: 'wabwidgets/BasemapGallery/Widget'
                            }
                        ]
                    }
                }
            },
            bookmarks: {
                include: true,
                id: 'bookmark',
                type: 'titlePane',
                position: 0,
                title: 'Bookmarks',
                iconClass: 'fas fa-fw fa-bookmark',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABBookmarks',
                                uri: 'wabwidgets/Bookmark/Widget'
                            }
                        ]
                    }
                }
            },
            chart: {
                include: true,
                id: 'chart',
                type: 'titlePane',
                position: 1,
                title: 'Charts',
                iconClass: 'fas fa-fw fa-chart-bar',
                open: false,
                canFloat: true,
                resizable: true,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    style: 'min-height: 400px;',
                    config: {
                        widgets: [
                            {
                                id: 'WABChart',
                                uri: 'wabwidgets/Chart/Widget',
                                version: 2.8,
                                config: 'config/chart.json'
                            }
                        ]
                    }
                }
            },
            directions: {
                include: true,
                id: 'direction',
                type: 'titlePane',
                position: 2,
                title: 'Directions',
                iconClass: 'fas fa-fw fa-map-signs',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABdirections',
                                uri: 'wabwidgets/Directions/Widget',
                                config: {
                                    routeTaskUrl: 'https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route',
                                    routeParams: {
                                        directionsLanguage: 'en-US',
                                        directionsLengthUnits: esriUnits.MILES
                                    },
                                    geocoderOptions: {
                                        geocoders: [
                                            {
                                                url: 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer'
                                            }
                                        ]
                                    }
                                }
                            }
                        ]
                    }
                }
            },
            draw: {
                include: true,
                id: 'draw',
                type: 'titlePane',
                position: 3,
                title: 'Draw',
                iconClass: 'fas fa-fw fa-paint-brush',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABDraw',
                                uri: 'wabwidgets/Draw/Widget'
                            }
                        ]
                    }
                }
            },
            layerList: {
                include: true,
                id: 'layerList',
                type: 'titlePane',
                position: 4,
                title: 'LayerList',
                iconClass: 'fas fa-fw fa-th-list',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    style: 'min-height: 200px;',
                    config: {
                        widgets: [
                            {
                                id: 'WABLayerList',
                                uri: 'wabwidgets/LayerList/Widget'
                            }
                        ]
                    }
                }
            },
            legend: {
                include: true,
                id: 'legend',
                type: 'titlePane',
                position: 5,
                title: 'Legend',
                iconClass: 'far fa-fw fa-images',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABLegend',
                                uri: 'wabwidgets/Legend/Widget',
                                config: {
                                    legend: {
                                        arrangement: 0,
                                        autoUpdate: true,
                                        respectCurrentMapScale: true
                                    }
                                }
                            }
                        ]
                    }
                }
            },
            measurement: {
                include: true,
                id: 'measurement',
                type: 'titlePane',
                position: 6,
                title: 'Measurement',
                iconClass: 'fas fa-fw fa-expand',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABMeasurement',
                                uri: 'wabwidgets/Measurement/Widget',
                                config: {
                                    measurement: {
                                        defaultLengthUnit: esriUnits.FEET,
                                        defaultAreaUnit: esriUnits.ACRES
                                    }
                                }
                            }
                        ]
                    }
                }
            },
            print: {
                include: true,
                id: 'print',
                type: 'titlePane',
                position: 7,
                title: 'Print',
                iconClass: 'fas fa-fw fa-print',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABPrint',
                                uri: 'wabwidgets/Print/Widget',
                                config: {
                                    serviceURL: '//utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task',
                                    defaultTitle: 'ArcGIS WebMap',
                                    defaultAuthor: '',
                                    defaultCopyright: '',
                                    defaultFormat: 'PDF',
                                    defaultLayout: 'Letter ANSI A Landscape'
                                }
                            }
                        ]
                    }
                }
            },
            edit: {
                include: true,
                id: 'edit',
                type: 'titlePane',
                position: 8,
                title: 'Edit',
                iconClass: 'fas fa-fw fa-pencil-alt',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABEdit',
                                uri: 'wabwidgets/SmartEditor/Widget'
                            }
                        ]
                    }
                }
            },

            query: {
                include: true,
                id: 'query',
                type: 'titlePane',
                position: 9,
                title: 'Query',
                iconClass: 'fas fa-fw fa-search',
                open: false,
                path: 'jimu/BaseWidgetPanel',
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABQuery',
                                uri: 'wabwidgets/Query/Widget',
                                config: {
                                    queries: [
                                        {
                                            name: 'Cities',
                                            url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer/0',
                                            filter: {
                                                logicalOperator: 'AND',
                                                parts: [
                                                    {
                                                        fieldObj: {
                                                            name: 'POP_RANK',
                                                            label: 'POP_RANK',
                                                            shortType: 'number',
                                                            type: 'esriFieldTypeInteger'
                                                        },
                                                        operator: 'numberOperatorIs',
                                                        valueObj: {
                                                            isValid: true,
                                                            type: 'value',
                                                            value: 3
                                                        },
                                                        interactiveObj: '',
                                                        caseSensitive: false,
                                                        expr: 'POP_RANK = 3'
                                                    }
                                                ],
                                                expr: 'POP_RANK = 3'
                                            },
                                            popup: {
                                                title: '${CITY_NAME}',
                                                fields: [
                                                    {
                                                        name: 'CITY_NAME',
                                                        alias: 'CITY_NAME',
                                                        specialType: 'none'
                                                    }
                                                ]
                                            },
                                            resultsSymbol: {
                                                color: [
                                                    0,
                                                    0,
                                                    128,
                                                    128
                                                ],
                                                size: 18,
                                                angle: 0,
                                                xoffset: 0,
                                                yoffset: 0,
                                                type: 'esriSMS',
                                                style: 'esriSMSCircle',
                                                outline: {
                                                    color: [
                                                        0,
                                                        0,
                                                        128,
                                                        255
                                                    ],
                                                    width: 0.75,
                                                    type: 'esriSLS',
                                                    style: 'esriSLSSolid'
                                                }
                                            },
                                            objectIdField: 'OBJECTID',
                                            orderByFields: []
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            },
            filter: {
                include: true,
                id: 'filter',
                type: 'titlePane',
                iconClass: 'fas fa-fw fa-filter',
                position: 10,
                title: 'Filter',
                path: 'jimu/BaseWidgetPanel',
                canFloat: true,
                open: false,
                options: {
                    widgetManager: true,
                    config: {
                        widgets: [
                            {
                                id: 'WABFilter',
                                uri: 'wabwidgets/Filter/Widget',
                                config: 'config/filter.json'
                            }
                        ]
                    }
                }
            }
        }
    };
});