@esri/cedar
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -8,2 +8,9 @@ # Change Log | ||
## [1.1.0] | ||
### Added | ||
- pass dataset request options to `queryFeatures()` | ||
## [1.0.1] | ||
### Fixed | ||
@@ -286,3 +293,5 @@ - make @esri/arcis-rest-* `peerDependencies` of @esri/cedar | ||
[Unreleased]: https://github.com/Esri/cedar/compare/v1.0.0...master | ||
[Unreleased]: https://github.com/Esri/cedar/compare/v1.1.0...master | ||
[1.1.0]: https://github.com/Esri/cedar/compare/v1.0.1...v1.1.0 | ||
[1.0.1]: https://github.com/Esri/cedar/compare/v1.0.0...v1.0.1 | ||
[1.0.0]: https://github.com/Esri/cedar/compare/v1.0.0-rc.1...v1.0.0 | ||
@@ -289,0 +298,0 @@ [1.0.0-rc.1]: https://github.com/Esri/cedar/compare/v1.0.0-beta.9...v1.0.0-rc.1 |
@@ -0,1 +1,2 @@ | ||
import { IRequestOptions } from '@esri/arcgis-rest-request'; | ||
import { IFeatureSet } from '@esri/arcgis-rest-types'; | ||
@@ -70,2 +71,6 @@ export interface IField { | ||
domains?: IDomains; | ||
/** | ||
* Options to use for requests to this dataset. See: https://esri.github.io/arcgis-rest-js/api/request/IRequestOptions/ | ||
*/ | ||
requestOptions?: IRequestOptions; | ||
} | ||
@@ -72,0 +77,0 @@ /** |
@@ -5,2 +5,4 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
export * from './config'; | ||
// types | ||
export * from './common'; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,12 @@ | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
import { decodeValues, queryFeatures } from '@esri/arcgis-rest-feature-layer'; | ||
@@ -11,9 +22,8 @@ import config from '../config'; | ||
if (dataset.url) { | ||
var url = dataset.url, name_1 = dataset.name, query = dataset.query, requestOptions = dataset.requestOptions; | ||
// TODO: make name required on datasets, or required if > 1 dataset? | ||
names.push(dataset.name || "dataset" + i); | ||
var queryParams = createQueryParams(dataset.query); | ||
var options_1 = { | ||
url: dataset.url, | ||
params: queryParams | ||
}; | ||
names.push(name_1 || "dataset" + i); | ||
var params = __assign(__assign({}, (requestOptions && requestOptions.params)), createQueryParams(query)); | ||
var options_1 = __assign(__assign({}, requestOptions), { url: url, | ||
params: params }); | ||
if (config.fetch && typeof config.fetch === 'function') { | ||
@@ -20,0 +30,0 @@ // we are configured to use a custom fetch implementation |
/** | ||
* @esri/cedar - v1.0.1 - Tue May 07 2019 11:11:39 GMT-0700 (PDT) | ||
* Copyright (c) 2019 Environmental Systems Research Institute, Inc. | ||
* @esri/cedar - v1.1.0 - Tue Jan 05 2021 09:21:14 GMT-0800 (Pacific Standard Time) | ||
* Copyright (c) 2021 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.cedar={})}(this,function(e){"use strict";var l=function(e){return!(!(n=e)||"object"!=typeof n||(t=e,"[object RegExp]"===(r=Object.prototype.toString.call(t))||"[object Date]"===r||t.$$typeof===a));var t,r,n};var a="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function u(e,t){var r;return t&&!0===t.clone&&l(e)?d((r=e,Array.isArray(r)?[]:{}),e,t):e}function c(r,e,n){var a=r.slice();return e.forEach(function(e,t){void 0===a[t]?a[t]=u(e,n):l(e)?a[t]=d(r[t],e,n):-1===r.indexOf(e)&&a.push(u(e,n))}),a}function d(e,t,r){var n,a,o,i,s=Array.isArray(t);return s===Array.isArray(e)?s?((r||{arrayMerge:c}).arrayMerge||c)(e,t,r):(a=t,o=r,i={},l(n=e)&&Object.keys(n).forEach(function(e){i[e]=u(n[e],o)}),Object.keys(a).forEach(function(e){l(a[e])&&n[e]?i[e]=d(n[e],a[e],o):i[e]=u(a[e],o)}),i):u(t,r)}d.all=function(e,r){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,t){return d(e,t,r)})};var p=d,r={bar:{type:"serial",rotate:!1,theme:"calcite",chartCursor:{categoryBalloonEnabled:!1},graphs:[{type:"column",newStack:!0}],legend:{valueAlign:"left",spacing:25},valueAxes:[{stackType:"regular"}],export:{enabled:!0}},"bar-horizontal":{type:"serial",theme:"calcite",rotate:!0,chartCursor:{leaveCursor:!0,valueLineEnabled:!0,categoryBalloonEnabled:!1},graphs:[{type:"column"}],legend:{},valueAxes:[{gridAlpha:.2,stackType:"regular"}],export:{enabled:!0}},line:{type:"serial",theme:"calcite",chartCursor:{categoryBalloonEnabled:!1,valueLineBalloonEnabled:!0},graphs:[{bullet:"circle",bulletAlpha:1,bulletBorderAlpha:.8,bulletBorderThickness:0,dashLengthField:"dashLengthLine",fillAlphas:0,useLineColorForBulletBorder:!0}],legend:{position:"bottom",useGraphSettings:!0},export:{enabled:!0}},area:{type:"serial",theme:"calcite",chartCursor:{categoryBalloonEnabled:!1,valueLineBalloonEnabled:!0},graphs:[{bullet:"circle",bulletAlpha:1,bulletBorderAlpha:.8,bulletBorderThickness:0,dashLengthField:"dashLengthLine",fillAlphas:.5,useLineColorForBulletBorder:!0}],legend:{horizontalGap:10,position:"bottom",useGraphSettings:!0,markerSize:10},valueAxes:[{stackType:"regular"}],export:{enabled:!0}},pie:{type:"pie",theme:"calcite",innerRadius:"0%",startDuration:0,graphs:[{}],groupPercent:5,balloon:{fixedPosition:!0},legend:{enabled:!1},export:{enabled:!0}},radar:{type:"radar",valueAxes:[{gridType:"circles",minimum:0}],polarScatter:{minimum:0,maximum:400,step:1},startDuration:0,graphs:[{graphFillAlpha:0}],groupPercent:5,balloon:{fixedPosition:!0},legend:{position:"right",marginRight:100,autoMargins:!1}},scatter:{type:"xy",theme:"calcite",valueAxes:[{axisAlpha:.8,gridAlpha:.2,position:"bottom"},{axisAlpha:.8,gridAlpha:.2,position:"left"}],chartScrollbar:{scrollbarHeight:5,offset:-1,backgroundAlpha:.1,backgroundColor:"#888888",selectedBackgroundColor:"#67b7dc",selectedBackgroundAlpha:1,dragIconWidth:15,dragIconHeight:15},chartCursor:{categoryBalloonEnabled:!0,cursorAlpha:.3,valueLineAlpha:.3,valueLineBalloonEnabled:!0},graphs:[{fillAlphas:0,lineAlpha:0,bullet:"circle",bulletBorderAlpha:.2,bulletAlpha:.8,valueField:null,xField:null,yField:null}],export:{enabled:!0}},timeline:{type:"serial",theme:"calcite",chartCursor:{categoryBalloonEnabled:!1,valueLineBalloonEnabled:!0},graphs:[{bullet:"circle",bulletAlpha:1,bulletBorderAlpha:.8,bulletBorderThickness:0,dashLengthField:"dashLengthLine",fillAlphas:0,useLineColorForBulletBorder:!0}],legend:{position:"bottom",useGraphSettings:!0},categoryAxis:{parseDates:!0},export:{enabled:!0}}};function f(o,i){var s=o.graphs.pop(),l=1<i.datasets.length;if(o.categoryField=l?"categoryField":i.series[0].category.field,o.tabIndex=0,o.legend||(o.legend={}),i.legend&&i.legend.hasOwnProperty("enable")&&(i.legend.visible=i.legend.enable),1===i.series.length&&"pie"!==i.type&&"radar"!==i.type){o.legend.enabled=!1;var t=i.series[0].category.label,r=i.series[0].value.label;"xy"===o.type&&Array.isArray(o.valueAxes)?o.valueAxes.forEach(function(e){"bottom"===e.position?e.title=t:"left"===e.position&&(e.title=r)}):(o.valueAxes||(o.valueAxes=[{}]),o.valueAxes[0].title=i.series[0].value.label,o.valueAxes[0].position="left",o.categoryAxis||(o.categoryAxis={}),o.categoryAxis.title=t)}if(i.legend){var e=i.legend;e.hasOwnProperty("visible")&&(o.legend.enabled=e.visible,o.legend.tabIndex=0),e.position&&-1<["top","bottom","left","right"].indexOf(e.position)&&(o.legend.position=e.position)}if(i.style){var n=i.style;if(n.padding){var a=n.padding;o.autoMargins=!1,a.hasOwnProperty("top")&&(o.marginTop=a.top),a.hasOwnProperty("bottom")&&(o.marginBottom=a.bottom),a.hasOwnProperty("left")&&(o.marginLeft=a.left),a.hasOwnProperty("right")&&(o.marginRight=a.right)}if(n.pie){var u=n.pie;u.hasOwnProperty("innerRadius")&&(o.innerRadius=u.innerRadius),u.hasOwnProperty("expand")&&(o.pullOutRadius=u.expand)}n.colors&&Array.isArray(n.colors)&&(o.colors=n.colors)}return i.datasets.forEach(function(n,e){var a=n.name;i.series.forEach(function(e,t){if(n.name===e.source){var r=y(s);r.title=e.value.label,r.valueField=l?a+"_"+e.value.field:e.value.field,r.balloonText="<div>"+e.category.label+": [["+o.categoryField+"]]</div><div>"+r.title+": [["+r.valueField+"]]</div>",e.stack&&r.newStack&&(r.newStack=!1),"pie"===i.type&&(o.titleField=o.categoryField,o.valueField=r.valueField),"xy"===o.type&&e.category&&e.value&&(r.xField=e.category.field,r.yField=e.value.field,r.balloonText="<div>"+e.category.label+": [["+e.category.field+"]]</div><div>"+e.value.label+": [["+e.value.field+"]]</div>","xy"===o.type&&e.size?(r.valueField=e.size.field,r.balloonText=r.balloonText+"<div>"+e.size.label+": [["+r.valueField+"]]</div>"):delete r.valueField),o.graphs.push(r)}})}),o}function h(e){var t=e;return"time"===t?(console.warn("'time' is no longer a supported type. Please use 'timeline' instead"),t="timeline"):"bubble"===t?(console.warn("'bubble' is no longer a supported type. Please use 'scatter' instead"),t="scatter"):"grouped"===t&&(console.warn("'grouped' is no longer a supported type. Please use 'bar' instead"),t="bar"),y(r[t])}function y(e){return JSON.parse(JSON.stringify(e))}var n={renderChart:function(e,t,r){if("custom"===t.type)return AmCharts.makeChart(e,t.specification);var n=t.specification&&"string"!=typeof t.specification?y(t.specification):h(t.type),a=y(r);n.dataProvider=a,t.datasets&&(n=f(n,t)),t.overrides&&(n=p(n,t.overrides,{clone:!0}));var o,i,s,l=AmCharts.makeChart(e,n);return"pie"===t.type&&(l.balloonText=(i=(o=t).series[0].category.label?o.series[0].category.label+": ":"",s=o.series[0].value.label?o.series[0].value.label+": ":"","<div>"+i+"[[title]]</div><div>"+s+"[[percents]]% ([[value]])</div>")),l},fillInSpec:f,fetchSpec:h};function m(e){return e.features?e.features:e}function g(e){return e.attributes?e.attributes:e}function v(e,t,r){var n=e.name||r;return e.data||t[n]}function o(e,t){if(e){if(e.length<1)return[];var l,u,r,n=t&&t.datasetsData;if(1<e.length){var a=t&&t.series;return l=a,u=n,r=e.reduce(function(r,e,t){var n,o=e.join,a=v(e,u),i=e.name,s=(n=i,l.reduce(function(e,t){return t.source===n&&t.value&&e.push(t.value.field),e},[]));return m(a).forEach(function(e){var a=g(e),t=a[o];void 0===r[t]&&(r[t]={categoryField:t}),s.reduce(function(e,t){var r,n;return e[(r=i,n=t,r+"_"+n)]=a[t],e},r[t])}),r},{}),Object.keys(r).map(function(e){return r[e]})}var o,i=v(e[0],n,"dataset0");return 0<(o=m(i)).length&&o[0].attributes?o.map(g):o}}var s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var b=function(){return(b=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)}; | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.cedar={})}(this,function(e){"use strict";var l=function(e){return!(!(t=e)||"object"!=typeof t||(t=e,"[object RegExp]"===(e=Object.prototype.toString.call(t))||"[object Date]"===e||function(e){return e.$$typeof===r}(t)));var t};var r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function u(e,t){var r;return t&&!0===t.clone&&l(e)?d((r=e,Array.isArray(r)?[]:{}),e,t):e}function c(r,e,n){var o=r.slice();return e.forEach(function(e,t){void 0===o[t]?o[t]=u(e,n):l(e)?o[t]=d(r[t],e,n):-1===r.indexOf(e)&&o.push(u(e,n))}),o}function d(e,t,r){var n,o,a,i,s=Array.isArray(t);return s===Array.isArray(e)?s?((r||{arrayMerge:c}).arrayMerge||c)(e,t,r):(o=t,a=r,i={},l(n=e)&&Object.keys(n).forEach(function(e){i[e]=u(n[e],a)}),Object.keys(o).forEach(function(e){l(o[e])&&n[e]?i[e]=d(n[e],o[e],a):i[e]=u(o[e],a)}),i):u(t,r)}d.all=function(e,r){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,t){return d(e,t,r)})};var o=d,t={bar:{type:"serial",rotate:!1,theme:"calcite",chartCursor:{categoryBalloonEnabled:!1},graphs:[{type:"column",newStack:!0}],legend:{valueAlign:"left",spacing:25},valueAxes:[{stackType:"regular"}],export:{enabled:!0}},"bar-horizontal":{type:"serial",theme:"calcite",rotate:!0,chartCursor:{leaveCursor:!0,valueLineEnabled:!0,categoryBalloonEnabled:!1},graphs:[{type:"column"}],legend:{},valueAxes:[{gridAlpha:.2,stackType:"regular"}],export:{enabled:!0}},line:{type:"serial",theme:"calcite",chartCursor:{categoryBalloonEnabled:!1,valueLineBalloonEnabled:!0},graphs:[{bullet:"circle",bulletAlpha:1,bulletBorderAlpha:.8,bulletBorderThickness:0,dashLengthField:"dashLengthLine",fillAlphas:0,useLineColorForBulletBorder:!0}],legend:{position:"bottom",useGraphSettings:!0},export:{enabled:!0}},area:{type:"serial",theme:"calcite",chartCursor:{categoryBalloonEnabled:!1,valueLineBalloonEnabled:!0},graphs:[{bullet:"circle",bulletAlpha:1,bulletBorderAlpha:.8,bulletBorderThickness:0,dashLengthField:"dashLengthLine",fillAlphas:.5,useLineColorForBulletBorder:!0}],legend:{horizontalGap:10,position:"bottom",useGraphSettings:!0,markerSize:10},valueAxes:[{stackType:"regular"}],export:{enabled:!0}},pie:{type:"pie",theme:"calcite",innerRadius:"0%",startDuration:0,graphs:[{}],groupPercent:5,balloon:{fixedPosition:!0},legend:{enabled:!1},export:{enabled:!0}},radar:{type:"radar",valueAxes:[{gridType:"circles",minimum:0}],polarScatter:{minimum:0,maximum:400,step:1},startDuration:0,graphs:[{graphFillAlpha:0}],groupPercent:5,balloon:{fixedPosition:!0},legend:{position:"right",marginRight:100,autoMargins:!1}},scatter:{type:"xy",theme:"calcite",valueAxes:[{axisAlpha:.8,gridAlpha:.2,position:"bottom"},{axisAlpha:.8,gridAlpha:.2,position:"left"}],chartScrollbar:{scrollbarHeight:5,offset:-1,backgroundAlpha:.1,backgroundColor:"#888888",selectedBackgroundColor:"#67b7dc",selectedBackgroundAlpha:1,dragIconWidth:15,dragIconHeight:15},chartCursor:{categoryBalloonEnabled:!0,cursorAlpha:.3,valueLineAlpha:.3,valueLineBalloonEnabled:!0},graphs:[{fillAlphas:0,lineAlpha:0,bullet:"circle",bulletBorderAlpha:.2,bulletAlpha:.8,valueField:null,xField:null,yField:null}],export:{enabled:!0}},timeline:{type:"serial",theme:"calcite",chartCursor:{categoryBalloonEnabled:!1,valueLineBalloonEnabled:!0},graphs:[{bullet:"circle",bulletAlpha:1,bulletBorderAlpha:.8,bulletBorderThickness:0,dashLengthField:"dashLengthLine",fillAlphas:0,useLineColorForBulletBorder:!0}],legend:{position:"bottom",useGraphSettings:!0},categoryAxis:{parseDates:!0},export:{enabled:!0}}};function a(a,i){var t,r,e,n,s=a.graphs.pop(),l=1<i.datasets.length;return a.categoryField=l?"categoryField":i.series[0].category.field,a.tabIndex=0,a.legend||(a.legend={}),i.legend&&i.legend.hasOwnProperty("enable")&&(i.legend.visible=i.legend.enable),1===i.series.length&&"pie"!==i.type&&"radar"!==i.type&&(a.legend.enabled=!1,t=i.series[0].category.label,r=i.series[0].value.label,"xy"===a.type&&Array.isArray(a.valueAxes)?a.valueAxes.forEach(function(e){"bottom"===e.position?e.title=t:"left"===e.position&&(e.title=r)}):(a.valueAxes||(a.valueAxes=[{}]),a.valueAxes[0].title=i.series[0].value.label,a.valueAxes[0].position="left",a.categoryAxis||(a.categoryAxis={}),a.categoryAxis.title=t)),i.legend&&((e=i.legend).hasOwnProperty("visible")&&(a.legend.enabled=e.visible,a.legend.tabIndex=0),e.position&&-1<["top","bottom","left","right"].indexOf(e.position)&&(a.legend.position=e.position)),i.style&&((e=i.style).padding&&(n=e.padding,a.autoMargins=!1,n.hasOwnProperty("top")&&(a.marginTop=n.top),n.hasOwnProperty("bottom")&&(a.marginBottom=n.bottom),n.hasOwnProperty("left")&&(a.marginLeft=n.left),n.hasOwnProperty("right")&&(a.marginRight=n.right)),e.pie&&((n=e.pie).hasOwnProperty("innerRadius")&&(a.innerRadius=n.innerRadius),n.hasOwnProperty("expand")&&(a.pullOutRadius=n.expand)),e.colors&&Array.isArray(e.colors)&&(a.colors=e.colors)),i.datasets.forEach(function(n,e){var o=n.name;i.series.forEach(function(e,t){var r;n.name===e.source&&((r=p(s)).title=e.value.label,r.valueField=l?o+"_"+e.value.field:e.value.field,r.balloonText="<div>"+e.category.label+": [["+a.categoryField+"]]</div><div>"+r.title+": [["+r.valueField+"]]</div>",e.stack&&r.newStack&&(r.newStack=!1),"pie"===i.type&&(a.titleField=a.categoryField,a.valueField=r.valueField),"xy"===a.type&&e.category&&e.value&&(r.xField=e.category.field,r.yField=e.value.field,r.balloonText="<div>"+e.category.label+": [["+e.category.field+"]]</div><div>"+e.value.label+": [["+e.value.field+"]]</div>","xy"===a.type&&e.size?(r.valueField=e.size.field,r.balloonText=r.balloonText+"<div>"+e.size.label+": [["+r.valueField+"]]</div>"):delete r.valueField),a.graphs.push(r))})}),a}function i(e){return"time"===e?(console.warn("'time' is no longer a supported type. Please use 'timeline' instead"),e="timeline"):"bubble"===e?(console.warn("'bubble' is no longer a supported type. Please use 'scatter' instead"),e="scatter"):"grouped"===e&&(console.warn("'grouped' is no longer a supported type. Please use 'bar' instead"),e="bar"),p(t[e])}function p(e){return JSON.parse(JSON.stringify(e))}var n={renderChart:function(e,t,r){if("custom"===t.type)return AmCharts.makeChart(e,t.specification);var n=t.specification&&"string"!=typeof t.specification?p(t.specification):i(t.type),r=p(r);return n.dataProvider=r,t.datasets&&(n=a(n,t)),t.overrides&&(n=o(n,t.overrides,{clone:!0})),e=AmCharts.makeChart(e,n),"pie"===t.type&&(e.balloonText=(t=(n=t).series[0].category.label?n.series[0].category.label+": ":"",n=n.series[0].value.label?n.series[0].value.label+": ":"","<div>"+t+"[[title]]</div><div>"+n+"[[percents]]% ([[value]])</div>")),e},fillInSpec:a,fetchSpec:i};function f(e){return e.features||e}function h(e){return e.attributes||e}function y(e,t,r){r=e.name||r;return e.data||t[r]}function s(e,l,u){var t=e.reduce(function(t,e,r){var n,o=e.join,a=y(e,u),i=e.name,s=(n=i,l.reduce(function(e,t){return t.source===n&&t.value&&e.push(t.value.field),e},[]));return f(a).forEach(function(e){var r=h(e),e=r[o];void 0===t[e]&&(t[e]={categoryField:e}),s.reduce(function(e,t){return e[i+"_"+t]=r[t],e},t[e])}),t},{});return Object.keys(t).map(function(e){return t[e]})}function m(e,t){if(e){if(e.length<1)return[];var r=t&&t.datasetsData;if(1<e.length)return s(e,t&&t.series,r);var r=y(e[0],r,"dataset0");return 0<(r=f(r=r)).length&&r[0].attributes?r.map(h):r}}var g=function(e,t){return(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var b=function(){return(b=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)}; | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */function A(r){return Object.keys(r).some(function(e){var t=r[e];if(!t)return!1;switch(t&&t.toParam&&(t=t.toParam()),t.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}})}function O(n){var a={};return Object.keys(n).forEach(function(e){var t=n[e];if(t&&t.toParam&&(t=t.toParam()),t||0===t||"boolean"==typeof t||"string"==typeof t){var r;switch(t.constructor.name){case"Array":r=t[0]&&t[0].constructor&&"Object"===t[0].constructor.name?JSON.stringify(t):t.join(",");break;case"Object":r=JSON.stringify(t);break;case"Date":r=t.valueOf();break;case"Function":r=null;break;case"Boolean":r=t+"";break;default:r=t}(r||0===r||"string"==typeof r)&&(a[e]=r)}}),a} | ||
* Apache-2.0 */function v(t){return Object.keys(t).some(function(e){e=t[e];if(!e)return!1;switch(e&&e.toParam&&(e=e.toParam()),e.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}})}function A(o){var a={};return Object.keys(o).forEach(function(e){var t=o[e];if(t&&t.toParam&&(t=t.toParam()),t||0===t||"boolean"==typeof t||"string"==typeof t){switch(t.constructor.name){case"Array":var r=null===(r=null===(r=t[0])||void 0===r?void 0:r.constructor)||void 0===r?void 0:r.name,n="Array"===r?t:"Object"===r?JSON.stringify(t):t.join(",");break;case"Object":n=JSON.stringify(t);break;case"Date":n=t.valueOf();break;case"Function":n=null;break;case"Boolean":n=t+"";break;default:n=t}(n||0===n||"string"==typeof n||Array.isArray(n))&&(a[e]=n)}}),a} | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */function x(e){var n=O(e);return Object.keys(n).map(function(e){return r=n[t=e],encodeURIComponent(t)+"="+encodeURIComponent(r);var t,r}).join("&")} | ||
* Apache-2.0 */function O(e){var t=A(e);return Object.keys(t).map(function(e){return function t(r,e){return Array.isArray(e)&&e[0]&&Array.isArray(e[0])?e.map(function(e){return t(r,e)}).join("&"):encodeURIComponent(r)+"="+encodeURIComponent(e)}(e,t[e])}).join("&")} | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
@@ -15,3 +15,3 @@ * Apache-2.0 */ | ||
* Apache-2.0 */ | ||
var w=function(e,t,r,n,a){e=e||"UNKNOWN_ERROR",t=t||"UNKNOWN_ERROR_CODE",this.name="ArcGISRequestError",this.message="UNKNOWN_ERROR_CODE"===t?e:t+": "+e,this.originalMessage=e,this.code=t,this.response=r,this.url=n,this.options=a};w.prototype=Object.create(Error.prototype);var E=function(i){function e(e,t,r,n,a){void 0===e&&(e="AUTHENTICATION_ERROR"),void 0===t&&(t="AUTHENTICATION_ERROR_CODE");var o=i.call(this,e,t,r,n,a)||this;return o.name="ArcGISAuthError",o.message="AUTHENTICATION_ERROR_CODE"===t?e:t+": "+e,o}return function(e,t){function r(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(e,i),e.prototype.retry=function(e,n){var a=this;void 0===n&&(n=3);var o=0,i=function(t,r){e(a.url,a.options).then(function(e){var t=b({},a.options,{authentication:e});return o+=1,F(a.url,t)}).then(function(e){t(e)}).catch(function(e){"ArcGISAuthError"===e.name&&o<n?i(t,r):"ArcGISAuthError"===e.name&&n<=o?r(a):r(e)})};return new Promise(function(e,t){i(e,t)})},e}(w.prototype.constructor=w); | ||
var x=function(e,t,r,n,o){e=e||"UNKNOWN_ERROR",t=t||"UNKNOWN_ERROR_CODE",this.name="ArcGISRequestError",this.message="UNKNOWN_ERROR_CODE"===t?e:t+": "+e,this.originalMessage=e,this.code=t,this.response=r,this.url=n,this.options=o};x.prototype=Object.create(Error.prototype),x.prototype.constructor=x; | ||
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. | ||
@@ -21,3 +21,3 @@ * Apache-2.0 */ | ||
* Apache-2.0 */ | ||
var t,i,R="@esri/arcgis-rest-js",S={httpMethod:"POST",params:{f:"json"}};function F(n,e){void 0===e&&(e={params:{f:"json"}});var a=b({httpMethod:"POST"},S,e,{params:b({},S.params,e.params),headers:b({},S.headers,e.headers)}),t=[],r=[];if(a.fetch||"undefined"==typeof fetch?(t.push("`fetch`"),r.push("`isomorphic-fetch`")):a.fetch=fetch.bind(Function("return this")()),"undefined"==typeof Promise&&(t.push("`Promise`"),r.push("`es6-promise`")),"undefined"==typeof FormData&&(t.push("`FormData`"),r.push("`isomorphic-form-data`")),!a.fetch||"undefined"==typeof Promise||"undefined"==typeof FormData)throw new Error("`arcgis-rest-request` requires global variables for `fetch`, `Promise` and `FormData` to be present in the global scope. You are missing "+t.join(", ")+". We recommend installing the "+r.join(", ")+" modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info.");var o=a.httpMethod,i=a.authentication,s=a.rawResponse,l=b({f:"json"},a.params),u={method:o,credentials:"same-origin"};return(i?i.getToken(n,{fetch:a.fetch}).catch(function(e){throw e.url=n,e.options=a,e}):Promise.resolve("")).then(function(e){if(e.length&&(l.token=e),"GET"===u.method){var t=""===x(l)?n:n+"?"+x(l);a.maxUrlLength&&t.length>a.maxUrlLength?u.method="POST":n=t}var r=new RegExp("/items/.+/updateResources").test(n);return"POST"===u.method&&(u.body=function(e,t){var r=A(e)||t,n=O(e);if(r){var a=new FormData;return Object.keys(n).forEach(function(e){if("undefined"!=typeof Blob&&n[e]instanceof Blob){var t=n.fileName||n[e].name||e;a.append(e,n[e],t)}else a.append(e,n[e])}),a}return x(e)}(l,r)),u.headers=b({},a.headers),"undefined"!=typeof window||u.headers.referer||(u.headers.referer=R),A(l)||r||(u.headers["Content-Type"]="application/x-www-form-urlencoded"),a.fetch(n,u)}).then(function(e){if(!e.ok){var t=e.status,r=e.statusText;throw new w(r,"HTTP "+t,e,n,a)}if(s)return e;switch(l.f){case"json":case"geojson":return e.json();case"html":case"text":return e.text();default:return e.blob()}}).then(function(e){return"json"!==l.f&&"geojson"!==l.f||s?e:function(t,e,r,n){if(400<=t.code){var a=t.message,o=t.code;throw new w(a,o,t,e,n)}if(t.error){var i=t.error,s=(a=i.message,o=i.code,i.messageCode),l=s||o||"UNKNOWN_ERROR_CODE";if(498===o||499===o||"GWM_0003"===s||400===o&&"Unable to generate token."===a)throw new E(a,l,t,e,n);throw new w(a,l,t,e,n)}if("failed"===t.status||"failure"===t.status){a=void 0,o="UNKNOWN_ERROR_CODE";try{a=JSON.parse(t.statusMessage).message,o=JSON.parse(t.statusMessage).code}catch(e){a=t.statusMessage||t.message}throw new w(a,o,t,e,n)}return t}(e,n,0,a)})} | ||
var w,E,R,S="@esri/arcgis-rest-js",k={httpMethod:"POST",params:{f:"json"}},j=(g(E=F,R=w=x),E.prototype=null===R?Object.create(R):(P.prototype=R.prototype,new P),F.prototype.retry=function(e,n){var o=this;void 0===n&&(n=3);var a=0,i=function(t,r){e(o.url,o.options).then(function(e){e=b(b({},o.options),{authentication:e});return a+=1,_(o.url,e)}).then(function(e){t(e)}).catch(function(e){"ArcGISAuthError"===e.name&&a<n?i(t,r):"ArcGISAuthError"===e.name&&n<=a?r(o):r(e)})};return new Promise(function(e,t){i(e,t)})},F);function P(){this.constructor=E}function F(e,t,r,n,o){void 0===e&&(e="AUTHENTICATION_ERROR"),void 0===t&&(t="AUTHENTICATION_ERROR_CODE");o=w.call(this,e,t,r,n,o)||this;return o.name="ArcGISAuthError",o.message="AUTHENTICATION_ERROR_CODE"===t?e:t+": "+e,o}function _(n,e){void 0===e&&(e={params:{f:"json"}});var o=b(b(b({httpMethod:"POST"},k),e),{params:b(b({},k.params),e.params),headers:b(b({},k.headers),e.headers)}),t=[],e=[];if(o.fetch||"undefined"==typeof fetch?(t.push("`fetch`"),e.push("`node-fetch`")):o.fetch=fetch.bind(Function("return this")()),"undefined"==typeof Promise&&(t.push("`Promise`"),e.push("`es6-promise`")),"undefined"==typeof FormData&&(t.push("`FormData`"),e.push("`isomorphic-form-data`")),!o.fetch||"undefined"==typeof Promise||"undefined"==typeof FormData)throw new Error("`arcgis-rest-request` requires a `fetch` implementation and global variables for `Promise` and `FormData` to be present in the global scope. You are missing "+t.join(", ")+". We recommend installing the "+e.join(", ")+" modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info.");var t=o.httpMethod,e=o.authentication,a=o.rawResponse,i=b({f:"json"},o.params),r=null,s={method:t,credentials:"same-origin"};return o.headers&&o.headers["X-Esri-Auth-Client-Id"]&&-1<n.indexOf("/oauth2/platformSelf")&&(s.credentials="include"),(e?e.getToken(n,{fetch:o.fetch}).catch(function(e){return e.url=n,e.options=o,r=e,Promise.resolve("")}):Promise.resolve("")).then(function(e){e.length&&(i.token=e);var t={};"GET"===s.method&&(i.token&&o.hideToken&&"undefined"==typeof window&&(t["X-Esri-Authorization"]="Bearer "+i.token,delete i.token),r=""===O(i)?n:n+"?"+O(i),o.maxUrlLength&&r.length>o.maxUrlLength||i.token&&o.hideToken?(s.method="POST",e.length&&o.hideToken&&(i.token=e,delete t["X-Esri-Authorization"])):n=r);var r=new RegExp("/items/.+/updateResources").test(n);return"POST"===s.method&&(s.body=function(e,t){var t=v(e)||t,r=A(e);if(t){var n=new FormData;return Object.keys(r).forEach(function(e){var t;"undefined"!=typeof Blob&&r[e]instanceof Blob?(t=r.fileName||r[e].name||e,n.append(e,r[e],t)):n.append(e,r[e])}),n}return O(e)}(i,r)),s.headers=b(b({},t),o.headers),"undefined"!=typeof window||s.headers.referer||(s.headers.referer=S),v(i)||r||(s.headers["Content-Type"]="application/x-www-form-urlencoded"),o.fetch(n,s)}).then(function(e){if(!e.ok){var t=e.status,r=e.statusText;throw new x(r,"HTTP "+t,e,n,o)}if(a)return e;switch(i.f){case"json":case"geojson":return e.json();case"html":case"text":return e.text();default:return e.blob()}}).then(function(e){if("json"!==i.f&&"geojson"!==i.f||a)return e;var t=function(t,e,r,n){if(400<=t.code){var o=t.message,a=t.code;throw new x(o,a,t,e,r)}if(t.error){var i=t.error,o=i.message,a=i.code,s=i.messageCode,i=s||a||"UNKNOWN_ERROR_CODE";if(498===a||499===a||"GWM_0003"===s||400===a&&"Unable to generate token."===o)throw n||new j(o,i,t,e,r);throw new x(o,i,t,e,r)}if("failed"!==t.status&&"failure"!==t.status)return t;o=void 0,a="UNKNOWN_ERROR_CODE";try{o=JSON.parse(t.statusMessage).message,a=JSON.parse(t.statusMessage).code}catch(e){o=t.statusMessage||t.message}throw new x(o,a,t,e,r)}(e,n,o,r);return r&&(e=n.toLowerCase().split(/\/rest(\/admin)?\/services\//)[0],o.authentication.trustedServers[e]={token:[],expires:new Date(Date.now()+864e5)},r=null),t})} | ||
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. | ||
@@ -27,5 +27,9 @@ * Apache-2.0 */ | ||
* Apache-2.0 */ | ||
function P(e){return"/"===(e=e.trim())[e.length-1]&&(e=e.slice(0,-1)),e} | ||
function C(e){return"string"!=typeof e||"/"===(e=e.trim())[e.length-1]&&(e=e.slice(0,-1)),e} | ||
/* Copyright (c) 2017-2020 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
/* Copyright (c) 2018-2019 Environmental Systems Research Institute, Inc. | ||
@@ -35,3 +39,3 @@ * Apache-2.0 */ | ||
* Apache-2.0 */ | ||
function _(e){var r,t,n,a,o=(t=["where","objectIds","relationParam","time","distance","units","outFields","returnGeometry","maxAllowableOffset","geometryPrecision","outSR","gdbVersion","returnDistinctValues","returnIdsOnly","returnCountOnly","returnExtentOnly","orderByFields","groupByFieldsForStatistics","outStatistics","returnZ","returnM","multipatchOption","resultOffset","resultRecordCount","quantizationParameters","returnCentroid","resultType","historicMoment","returnTrueCurves","sqlFormat","returnExceededLimitFeatures"],n={httpMethod:"GET",params:b({where:"1=1",outFields:"*"},(r=e).params)},(a=b({params:{}},n,r)).params=t.reduce(function(e,t){return(r[t]||"boolean"==typeof r[t])&&(e[t]=r[t]),e},a.params),["params","httpMethod","rawResponse","authentication","portal","fetch","maxUrlLength","headers"].reduce(function(e,t){return a[t]&&(e[t]=a[t]),e},{}));return F(P(e.url)+"/query",o)} | ||
function T(e){var r,t,n,o,t=(t=["where","objectIds","relationParam","time","distance","units","outFields","geometry","geometryType","spatialRel","returnGeometry","maxAllowableOffset","geometryPrecision","inSR","outSR","gdbVersion","returnDistinctValues","returnIdsOnly","returnCountOnly","returnExtentOnly","orderByFields","groupByFieldsForStatistics","outStatistics","returnZ","returnM","multipatchOption","resultOffset","resultRecordCount","quantizationParameters","returnCentroid","resultType","historicMoment","returnTrueCurves","sqlFormat","returnExceededLimitFeatures","f"],n={httpMethod:"GET",params:b({where:"1=1",outFields:"*"},(r=e).params)},(o=b(b({params:{}},n),r)).params=t.reduce(function(e,t){return!r[t]&&"boolean"!=typeof r[t]||(e[t]=r[t]),e},o.params),["params","httpMethod","rawResponse","authentication","portal","fetch","maxUrlLength","headers"].reduce(function(e,t){return o[t]&&(e[t]=o[t]),e},{}));return _(C(e.url)+"/query",t)} | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
@@ -43,2 +47,4 @@ * Apache-2.0 */ | ||
* Apache-2.0 */ | ||
/* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
@@ -58,7 +64,9 @@ * Apache-2.0 */ | ||
* Apache-2.0 */ | ||
function j(r){return new Promise(function(t){if(!r.fields)return(e={url:r.url},F(P(e.url),e)).then(function(e){t(r.fields=e.fields)});var e;t(r.fields)}).then(function(e){var o=e.reduce(function(e,t){var r=t.domain;return r&&"codedValue"===r.type&&(e[t.name]=r),e},{});if(Object.keys(o).length<1)return r.queryResponse;var t=r.queryResponse.features.map(function(e){var t={};for(var r in e.attributes)if(e.attributes.hasOwnProperty(r)){var n=e.attributes[r],a=o[r];t[r]=null!==n&&a?C(n,a):n}return b({},e,{attributes:t})});return b({},r.queryResponse,{features:t})})}function C(t,e){var r=e.codedValues.find(function(e){return t===e.code});return r?r.name:t} | ||
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
function N(r){return new Promise(function(t){if(!r.fields)return _(C((e={url:r.url}).url),e).then(function(e){t(r.fields=e.fields)});var e;t(r.fields)}).then(function(e){var a=e.reduce(function(e,t){var r=t.domain;return r&&"codedValue"===r.type&&(e[t.name]=r),e},{});if(Object.keys(a).length<1)return r.queryResponse;e=r.queryResponse.features.map(function(e){var t,r,n,o={};for(t in e.attributes)e.attributes.hasOwnProperty(t)&&(r=e.attributes[t],n=a[t],o[t]=null!==r&&n?function(t,e){e=e.codedValues.find(function(e){return t===e.code});return e?e.name:t} | ||
/* Copyright (c) 2018-2019 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */(i=t||(t={})).ArcGISRequestError="ArcGISRequestError",i.ArcGISAuthError="ArcGISAuthError";var N={fetch:void 0};function k(e){var o=[],r=[];return e&&e.forEach(function(n,e){if(n.url){o.push(n.name||"dataset"+e);var t=function(n){void 0===n&&(n={});var a={where:"1=1",returnGeometry:!1,returnDistinctValues:!1,returnIdsOnly:!1,returnCountOnly:!1,outFields:"*",sqlFormat:"standard",f:"json"};if(n.bbox){if(n.geometry)throw new Error("Dataset.query can not have both a geometry and a bbox specified");var e=n.bbox.split(",");delete n.bbox,n.geometry=JSON.stringify({xmin:Number(e[0]),ymin:Number(e[1]),xmax:Number(e[2]),ymax:Number(e[3])}),n.inSR="4326"}return Object.keys(n).reduce(function(e,t){var r=n[t];return a[t]="object"==typeof r?JSON.stringify(r):r,e},a),a}(n.query),a={url:n.url,params:t};r.push(_(a).then(function(e){var t=n.domains,r=t&&Object.keys(t).map(function(e){return{name:e,domain:t[e]}});return r&&0<r.length?j({url:a.url,queryResponse:e,fields:r,fetch:N.fetch}):e}))}}),Promise.all(r).then(function(e){var t=e.reduce(function(e,t,r){return e[o[r]]=t,e},{});return Promise.resolve(t)})}var T=function(){function e(e,t){if(!e)throw new Error("A container is required");var r;this._container=e,t&&this.definition((r=t,JSON.parse(JSON.stringify(r))))}return e.prototype.definition=function(e){return void 0===e?this._definition:(this._definition=e,this)},e.prototype.datasets=function(e){return this._definitionAccessor("datasets",e)},e.prototype.series=function(e){return this._definitionAccessor("series",e)},e.prototype.type=function(e){return this._definitionAccessor("type",e)},e.prototype.specification=function(e){return this._definitionAccessor("specification",e)},e.prototype.overrides=function(e){return this._definitionAccessor("overrides",e)},e.prototype.legend=function(e){return this._definitionAccessor("legend",e)},e.prototype.style=function(e){return this._definitionAccessor("style",e)},e.prototype.data=function(){return this._data},e.prototype.dataset=function(t){var r,e=this.datasets();return e&&e.some(function(e){if(e.name===t)return r=e,!0}),r},e.prototype.query=function(){return k(this.datasets())},e.prototype.updateData=function(e){var t=this.datasets(),r={datasetsData:e,series:this.series()};return this._data=o(t,r),this},e.prototype.render=function(){return function(e,t,r){if((!e||!t||!r)&&t.type&&"custom"!==t.type)throw new Error("Element Id, definition, and data are all required.");t.type&&"custom"===t.type?n.renderChart(e,t):n.renderChart(e,t,r)}(this._container,this.definition(),this.data()),this},e.prototype.show=function(){var t=this;return this.query().then(function(e){return t.updateData(e).render()})},e.prototype._definitionAccessor=function(e,t){var r=this._definition;if(void 0===t)return r?r[e]:void 0;if(r)return r[e]=t,this;var n={};return n[e]=t,this.definition(n)},e}(); | ||
* Apache-2.0 */(r,n):r);return b(b({},e),{attributes:o})});return b(b({},r.queryResponse),{features:e})})}(L={}).ArcGISRequestError="ArcGISRequestError",L.ArcGISAuthError="ArcGISAuthError";var B={fetch:void 0};var D=function(){return(D=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function I(e){var s=[],l=[];return e&&e.forEach(function(n,e){var t,r,o,a,i;n.url&&(t=n.url,r=n.name,a=n.query,o=n.requestOptions,s.push(r||"dataset"+e),a=D(D({},o&&o.params),function(n){void 0===n&&(n={});var o={where:"1=1",returnGeometry:!1,returnDistinctValues:!1,returnIdsOnly:!1,returnCountOnly:!1,outFields:"*",sqlFormat:"standard",f:"json"};if(n.bbox){if(n.geometry)throw new Error("Dataset.query can not have both a geometry and a bbox specified");var e=n.bbox.split(",");delete n.bbox,n.geometry=JSON.stringify({xmin:Number(e[0]),ymin:Number(e[1]),xmax:Number(e[2]),ymax:Number(e[3])}),n.inSR="4326"}return Object.keys(n).reduce(function(e,t){var r=n[t];return o[t]="object"==typeof r?JSON.stringify(r):r,e},o),o}(a)),i=D(D({},o),{url:t,params:a}),l.push(T(i).then(function(e){var t=n.domains,r=t&&Object.keys(t).map(function(e){return{name:e,domain:t[e]}});return r&&0<r.length?N({url:i.url,queryResponse:e,fields:r,fetch:B.fetch}):e})))}),Promise.all(l).then(function(e){e=e.reduce(function(e,t,r){return e[s[r]]=t,e},{});return Promise.resolve(e)})}var L=(q.prototype.definition=function(e){return void 0===e?this._definition:(this._definition=e,this)},q.prototype.datasets=function(e){return this._definitionAccessor("datasets",e)},q.prototype.series=function(e){return this._definitionAccessor("series",e)},q.prototype.type=function(e){return this._definitionAccessor("type",e)},q.prototype.specification=function(e){return this._definitionAccessor("specification",e)},q.prototype.overrides=function(e){return this._definitionAccessor("overrides",e)},q.prototype.legend=function(e){return this._definitionAccessor("legend",e)},q.prototype.style=function(e){return this._definitionAccessor("style",e)},q.prototype.data=function(){return this._data},q.prototype.dataset=function(t){var r,e=this.datasets();return e&&e.some(function(e){if(e.name===t)return r=e,!0}),r},q.prototype.query=function(){return I(this.datasets())},q.prototype.updateData=function(e){var t=this.datasets(),e={datasetsData:e,series:this.series()};return this._data=m(t,e),this},q.prototype.render=function(){return function(e,t,r){if(e&&t&&r||!t.type||"custom"===t.type)return t.type&&"custom"===t.type?n.renderChart(e,t):n.renderChart(e,t,r);throw new Error("Element Id, definition, and data are all required.")}(this._container,this.definition(),this.data()),this},q.prototype.show=function(){var t=this;return this.query().then(function(e){return t.updateData(e).render()})},q.prototype._definitionAccessor=function(e,t){var r=this._definition;if(void 0===t)return r?r[e]:void 0;if(r)return r[e]=t,this;r={};return r[e]=t,this.definition(r)},q); | ||
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */e.Chart=T,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
* Apache-2.0 */function q(e,t){if(!e)throw new Error("A container is required");this._container=e,t&&this.definition((t=t,JSON.parse(JSON.stringify(t))))}e.Chart=L,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=cedar.min.js.map |
{ | ||
"name": "@esri/cedar", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Visualization framework for the ArcGIS Platform", | ||
@@ -67,3 +67,3 @@ "files": [ | ||
"dependencies": { | ||
"@esri/cedar-amcharts": "^1.0.0" | ||
"@esri/cedar-amcharts": "^1.1.0" | ||
}, | ||
@@ -70,0 +70,0 @@ "devDependencies": { |
176
README.md
@@ -24,7 +24,5 @@ # @esri/cedar | ||
You can install cedar and it's [dependencies](#dependencies) from npm: | ||
You can install cedar and its [dependencies](#dependencies) with npm: | ||
```bash | ||
npm install @esri/arcgis-rest-feature-layer@^2.0.0 | ||
npm install @esri/arcgis-rest-request@^2.0.0 | ||
npm install @esri/cedar | ||
npm install --save @esri/arcgis-rest-feature-layer@^2.0.0 @esri/arcgis-rest-request@^2.0.0 amcharts3 @esri/cedar | ||
``` | ||
@@ -35,41 +33,35 @@ | ||
```bash | ||
yarn add @esri/arcgis-rest-feature-layer@^2.0.0 | ||
yarn add @esri/arcgis-rest-request@^2.0.0 | ||
yarn add @esri/cedar | ||
yarn add @esri/arcgis-rest-feature-layer@^2.0.0 @esri/arcgis-rest-request@^2.0.0 amcharts3 @esri/cedar | ||
``` | ||
Alternatively, you can get cedar from the [unpkg.com](https://unpkg.com/) CDN as shown below. | ||
Alternatively, you can get cedar from the [unpkg.com](https://unpkg.com/) CDN as [shown below](#from-a-cdn). | ||
### Loading Cedar | ||
### Importing Cedar | ||
You can load Cedar and its [dependencies](#dependencies) by including script tags that point to the CDN or your locally installed versions of these libraries. This will make the `cedar` global available to your application. | ||
If you're using Cedar in a modern web application built with a bundler like [webpack](https://webpack.js.org/), you can load Cedar and its [dependencies](#dependencies) using `import` statements. | ||
```html | ||
<!-- load the amCharts base library --> | ||
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script> | ||
<!-- in this case, we only need bar charts, so we'll load the appropriate amCharts script --> | ||
<script src="https://www.amcharts.com/lib/3/serial.js"></script> | ||
<!-- load the arcgis-rest-js scripts --> | ||
<script src="https://unpkg.com/@esri/arcgis-rest-request"></script> | ||
<script src="https://unpkg.com/@esri/arcgis-rest-feature-layer"></script> | ||
<!-- optionally load an amcharts theme; cedar provides a calcite theme --> | ||
<script src="https://unpkg.com/@esri/cedar/dist/umd/themes/amCharts/calcite.js"></script> | ||
<!-- load cedar --> | ||
<script src="https://unpkg.com/@esri/cedar/dist/umd/cedar.js"></script> | ||
```js | ||
// import the amCharts base library | ||
import "amcharts3/amcharts/amcharts"; | ||
// in this case, we only need bar charts, so we'll import the appropriate amCharts module | ||
import "amcharts3/amcharts/serial"; | ||
// optionally import an amcharts theme; cedar provides a calcite theme | ||
import "@esri/cedar/dist/umd/themes/amCharts/calcite.js"; | ||
// import the cedar Chart class | ||
import { Chart } from "@esri/cedar" | ||
``` | ||
If you need to use other chart types, or want to use amCharts plugins, load the appropriate amCharts scripts before loading cedar: | ||
If you need to use other chart types, or want to use amCharts plugins, import the appropriate amCharts modules _before importing cedar_: | ||
```html | ||
<!-- for pie charts --> | ||
<script src="https://www.amcharts.com/lib/3/pie.js"></script> | ||
<!-- for scatter and bubble charts --> | ||
<script src="https://www.amcharts.com/lib/3/xy.js"></script> | ||
<!-- for radar charts --> | ||
<script src="https://www.amcharts.com/lib/3/radar.js"></script> | ||
<!-- optioinally load the amcharts plugin to export the chart as and image or table --> | ||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script> | ||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" /> | ||
```js | ||
// for pie charts | ||
import "amcharts3/amcharts/pie"; | ||
// for scatter and bubble charts | ||
import "amcharts3/amcharts/xy"; | ||
// for radar charts | ||
import "amcharts3/amcharts/radar"; | ||
``` | ||
See the [amCharts documentation](https://github.com/amcharts/amcharts3) for more information on importing amCharts modules. | ||
### Using Cedar | ||
@@ -85,43 +77,47 @@ | ||
```html | ||
<script> | ||
// connect to the data | ||
var datasets = [{ | ||
"url": "https://services.arcgis.com/uDTUpUPbk8X8mXwl/arcgis/rest/services/Public_Schools_in_Onondaga_County/FeatureServer/0", | ||
"name": "schools", | ||
"query": { | ||
"orderByFields": "Number_of_SUM DESC", | ||
"groupByFieldsForStatistics": "Type", | ||
"outStatistics": [{ | ||
"statisticType": "sum", | ||
"onStatisticField": "Number_of", | ||
"outStatisticFieldName": "Number_of_SUM" | ||
}] | ||
} | ||
}]; | ||
```js | ||
// connect to the data | ||
var datasets = [{ | ||
"url": "https://services.arcgis.com/uDTUpUPbk8X8mXwl/arcgis/rest/services/Public_Schools_in_Onondaga_County/FeatureServer/0", | ||
"name": "schools", | ||
"query": { | ||
"orderByFields": "Number_of_SUM DESC", | ||
"groupByFieldsForStatistics": "Type", | ||
"outStatistics": [{ | ||
"statisticType": "sum", | ||
"onStatisticField": "Number_of", | ||
"outStatisticFieldName": "Number_of_SUM" | ||
}] | ||
} | ||
}]; | ||
// designate a one or more series to show the data on the chart | ||
var series = [{ | ||
"category": {"field": "Type", "label": "Type"}, | ||
"value": {"field": "Number_of_SUM", "label": "Number of Students"}, | ||
"source": "schools" | ||
}]; | ||
// designate a one or more series to show the data on the chart | ||
var series = [{ | ||
"category": {"field": "Type", "label": "Type"}, | ||
"value": {"field": "Number_of_SUM", "label": "Number of Students"}, | ||
"source": "schools" | ||
}]; | ||
// optionally override any of the cart type's default styles | ||
var overrides = { | ||
"categoryAxis": { | ||
"labelRotation": -45 | ||
} | ||
// optionally override any of the cart type's default styles | ||
var overrides = { | ||
"categoryAxis": { | ||
"labelRotation": -45 | ||
} | ||
} | ||
//create a cedar chart using the known 'bar' type | ||
var elementId = 'chart'; | ||
var chart = new cedar.Chart(elementId, {"type": "bar"}) | ||
.datasets(datasets) | ||
.series(series) | ||
.overrides(overrides); | ||
//create a cedar chart using the known 'bar' type | ||
var elementId = 'chart'; | ||
// NOTE: the following line assumes you've imported Chart like: | ||
// import { Chart } from "@esri/cedar"; | ||
// if you've loaded the Cedar using script tags | ||
// and are using the cedar global instead | ||
// you should replace this line with: | ||
// var chart = new cedar.Chart(elementId, {"type": "bar"}) | ||
var chart = new Chart(elementId, {"type": "bar"}) | ||
.datasets(datasets) | ||
.series(series) | ||
.overrides(overrides); | ||
// render the chart | ||
chart.show(); | ||
</script> | ||
// render the chart | ||
chart.show(); | ||
``` | ||
@@ -131,2 +127,4 @@ | ||
See the [Demos](#demos) section below for examples of Cedar working with other libraries like ArcGIS API for JavaScript or React. | ||
### Configuring Cedar | ||
@@ -173,5 +171,41 @@ You can configure cedar to use a custom implementation of `fetch()` by setting `cedar.config.fetch = myCustomFetch`. | ||
See [this CodeSandbox](https://codesandbox.io/s/esri-cedar-in-react-forked-kyoc2?file=/src/App.js) for an example of how to use Cedar in React. | ||
### Loading Cedar | ||
Instead of [installing](installing-cedar) and [importing](importing-cedar) Cedar, you can load Cedar and its [dependencies](#dependencies) by including script tags that point to the CDN (or your locally installed versions of these libraries). This will make the `cedar` global available to your application. | ||
#### From a CDN | ||
```html | ||
<!-- load the amCharts base library --> | ||
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script> | ||
<!-- in this case, we only need bar charts, so we'll load the appropriate amCharts script --> | ||
<script src="https://www.amcharts.com/lib/3/serial.js"></script> | ||
<!-- load the arcgis-rest-js scripts --> | ||
<script src="https://unpkg.com/@esri/arcgis-rest-request"></script> | ||
<script src="https://unpkg.com/@esri/arcgis-rest-feature-layer"></script> | ||
<!-- optionally load an amcharts theme; cedar provides a calcite theme --> | ||
<script src="https://unpkg.com/@esri/cedar/dist/umd/themes/amCharts/calcite.js"></script> | ||
<!-- load cedar --> | ||
<script src="https://unpkg.com/@esri/cedar/dist/umd/cedar.js"></script> | ||
``` | ||
If you need to use other chart types, or want to use amCharts plugins, load the appropriate amCharts scripts before loading cedar: | ||
```html | ||
<!-- for pie charts --> | ||
<script src="https://www.amcharts.com/lib/3/pie.js"></script> | ||
<!-- for scatter and bubble charts --> | ||
<script src="https://www.amcharts.com/lib/3/xy.js"></script> | ||
<!-- for radar charts --> | ||
<script src="https://www.amcharts.com/lib/3/radar.js"></script> | ||
<!-- optioinally load the amcharts plugin to export the chart as and image or table --> | ||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script> | ||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" /> | ||
``` | ||
## Dependencies | ||
Cedar isn't yet another JavaScript charting library. Instead, cedar is a very thin wrapper around other libraries that do the heavy lifting. Cedar uses [amCharts](https://www.amcharts.com/javascript-charts/) library as it's charting engine. Cedar also uses [@esri/arcgis-rest-feature-layer](https://esri.github.io/arcgis-rest-js/api/feature-layer/) and [@esri/arcgis-rest-request](https://esri.github.io/arcgis-rest-js/api/request/) to query feature data. You will need to [install](#installing-cedar) these libraries along with cedar in your application. If you are loading cedar from a CDN, please refer to the [loading cedar](#loading-cedar) section above for the `<script>` tags that you will need to include. | ||
Cedar isn't yet another JavaScript charting library. Instead, cedar is a very thin wrapper around other libraries that do the heavy lifting. Cedar uses [amCharts](https://www.amcharts.com/javascript-charts/) library as its charting engine. Cedar also uses [@esri/arcgis-rest-feature-layer](https://esri.github.io/arcgis-rest-js/api/feature-layer/) and [@esri/arcgis-rest-request](https://esri.github.io/arcgis-rest-js/api/request/) to query feature data. You will need to [install](#installing-cedar) these libraries along with cedar in your application. If you are loading cedar from a CDN, please refer to the [loading cedar](#loading-cedar) section above for the `<script>` tags that you will need to include. | ||
@@ -210,3 +244,3 @@ Cedar supports the [same browsers as ArcGIS Online](https://doc.arcgis.com/en/arcgis-online/reference/browsers.htm), however you may need to include polyfills for [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) and [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), if your application has to support browers that don't support them (i.e. IE or older versions of Safari/Android). | ||
To run tests for any package as you update it's source code, `cd` into that package and run `yarn run test:watch` to continually run that package's tests as you make your changes. | ||
To run tests for any package as you update its source code, `cd` into that package and run `yarn run test:watch` to continually run that package's tests as you make your changes. | ||
@@ -213,0 +247,0 @@ ### Licensing |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
409749
2826
257
Updated@esri/cedar-amcharts@^1.1.0