templates.js 1.2 KB

12345
  1. /*
  2. All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. See https://js.arcgis.com/4.25/esri/copyright.txt for details.
  4. */
  5. import e from"../../core/Error.js";import{getTemplates as r}from"./classBreaks.js";import{getTemplates as t}from"./dotDensity.js";import{getTemplates as a}from"./heatmap.js";import{getTemplates as n}from"./predominance.js";import{getTemplates as s}from"./relationship.js";import{getTemplates as o}from"./simple.js";import{getTemplates as i}from"./uniqueValues.js";function p(r){const{layer:t}=r,a=r.renderer||t.renderer;if(!a)throw new e("getTemplates:invalid-parameters","'renderer' or 'layer.renderer' must be provided");return{layer:t,renderer:a}}async function m(e){const{renderer:m,layer:l}=p(e);if("simple"===m.type)return o({renderer:m,layer:l});if("class-breaks"===m.type)return r({renderer:m,layer:l});if("dot-density"===m.type)return t({renderer:m,layer:l});if("heatmap"===m.type)return a({renderer:m,layer:l});if("unique-value"===m.type){const e=m.authoringInfo&&m.authoringInfo.type;return"predominance"===e?n({renderer:m,layer:l}):"relationship"===e?s({renderer:m,layer:l}):i({renderer:m,layer:l})}return null}export{m as getTemplates};