How to use singleConfig method in root

Best JavaScript code snippet using root

Setting.js

Source:Setting.js Github

copy

Full Screen

1///////////////////////////////////////////////////////////////////////////2// Copyright © Esri. All Rights Reserved.3//4// Licensed under the Apache License Version 2.0 (the "License");5// you may not use this file except in compliance with the License.6// You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing, software11// distributed under the License is distributed on an "AS IS" BASIS,12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13// See the License for the specific language governing permissions and14// limitations under the License.15///////////////////////////////////////////////////////////////////////////16define([17 'dojo/_base/declare',18 'dojo/_base/lang',19 'dojo/_base/array',20 'dojo/_base/html',21 'dojo/on',22 'dijit/_WidgetsInTemplateMixin',23 'jimu/BaseWidgetSetting',24 'jimu/dijit/_FeaturelayerSourcePopup',25 'jimu/utils',26 'jimu/filterUtils',27 'jimu/LayerInfos/LayerInfos',28 './SingleChartSetting',29 './utils',30 'jimu/dijit/SimpleTable',31 'jimu/dijit/TabContainer',32 'jimu/dijit/ColorPicker',33 'dijit/form/Select',34 'dijit/form/TextBox'35],36function(declare, lang, array, html, on, _WidgetsInTemplateMixin, BaseWidgetSetting,37 _FeaturelayerSourcePopup, jimuUtils, FilterUtils, LayerInfos, SingleChartSetting, utils, SimpleTable) {38 return declare([BaseWidgetSetting, _WidgetsInTemplateMixin], {39 baseClass: 'jimu-widget-chart-setting',40 currentSCS: null,41 _numberFieldTypes: ['esriFieldTypeSmallInteger',42 'esriFieldTypeInteger',43 'esriFieldTypeSingle',44 'esriFieldTypeDouble'],45 postMixInProperties: function(){46 this.inherited(arguments);47 this.layerInfosObj = LayerInfos.getInstanceSync();48 utils.layerInfosObj = this.layerInfosObj;49 this.nls.horizontalAxis = this.nls.horizontalAxis || "Horizontal Axis";50 this.nls.verticalAxis = this.nls.verticalAxis || "Vertical Axis";51 this.nls.dataLabels = this.nls.dataLabels || "Data Labels";52 this.nls.color = this.nls.color || "Color";53 this.nls.colorful = this.nls.colorful || "Colorful";54 this.nls.monochromatic = this.nls.monochromatic || "Monochromatic";55 if(this.config){56 this._setUrlForConfig(this.config);57 this._updateConfig();58 }59 },60 postCreate: function(){61 this.inherited(arguments);62 this._initSelf();63 if(this.config){64 this.setConfig(this.config);65 }66 },67 _initSelf: function(){68 var fields = [{69 name: "name",70 title: this.nls.name,71 width: "auto",72 type: "text",73 editable: false74 }, {75 name: "actions",76 title: "",77 width: "70px",78 type: "actions",79 actions: ["up", "down", "delete"]80 }];81 this.chartList = new SimpleTable({82 fields: fields,83 autoHeight: false,84 selectable: true,85 style: "position:absolute; top:0; bottom:10px;"86 });87 html.addClass(this.chartList.domNode, 'chart-list-table');88 this.own(on(this.chartList, 'row-delete', lang.hitch(this, this._onChartItemRemoved)));89 this.own(on(this.chartList, 'row-select', lang.hitch(this, this._onChartItemSelected)));90 this.chartList.placeAt(this.chartListContent, 'first');91 },92 _updateConfig: function() {93 if (this.config && this.config.charts && this.config.charts.length > 0) {94 array.forEach(this.config.charts, lang.hitch(this, function(singleConfig) {95 this._rebuildFilter(singleConfig.url, singleConfig.filter);96 }));97 }98 },99 _setUrlForConfig: function(config){100 if(config.charts && config.charts.length > 0){101 array.forEach(config.charts, lang.hitch(this, function(singleConfig){102 if(singleConfig.webMapLayerId){103 var info = this.layerInfosObj.getLayerOrTableInfoById(singleConfig.webMapLayerId);104 if(info){105 singleConfig.url = info.getUrl();106 }107 }108 }));109 }110 },111 _rebuildFilter: function(url, filter) {112 try {113 if (filter) {114 delete filter.expr;115 var filterUtils = new FilterUtils();116 filterUtils.isHosted = jimuUtils.isHostedService(url);117 filterUtils.getExprByFilterObj(filter);118 }119 } catch (e) {120 console.log(e);121 }122 },123 setConfig: function(config){124 this._setUrlForConfig(config);125 if(this.currentSCS){126 this.currentSCS.destroy();127 }128 this.currentSCS = null;129 this.chartList.clear();130 this.config = config;131 var charts = this.config && this.config.charts;132 if(lang.isArrayLike(charts)){133 array.forEach(charts, lang.hitch(this, function(singleConfig, index){134 var addResult = this.chartList.addRow({name: singleConfig.name || ''});135 var tr = addResult.tr;136 tr.singleConfig = lang.clone(singleConfig);137 if(index === 0){138 this.chartList.selectRow(tr);139 }140 }));141 }142 },143 getConfig: function(){144 if(this.currentSCS){145 var currentSingleConfig = this.currentSCS.getConfig(true);146 if(currentSingleConfig){147 this.currentSCS.tr.singleConfig = lang.clone(currentSingleConfig);148 }149 else{150 return false;151 }152 }153 var config = {154 charts: []155 };156 var trs = this.chartList.getRows();157 for(var i = 0; i < trs.length; i++){158 var tr = trs[i];159 config.charts.push(lang.clone(tr.singleConfig));160 if(config.charts[i].webMapLayerId){161 config.charts[i].url = '';162 }163 }164 this.config = lang.clone(config);165 return config;166 },167 _onAddNewClicked: function(){168 if(this.currentSCS){169 var singleConfig = this.currentSCS.getConfig(true);170 if(singleConfig){171 this.currentSCS.tr.singleConfig = singleConfig;172 }173 else{174 return;175 }176 }177 var args = {178 titleLabel: this.nls.setDataSource,179 dijitArgs: {180 multiple: false,181 createMapResponse: this.map.webMapResponse,182 portalUrl: this.appConfig.portalUrl,183 style: {184 height: '100%'185 }186 }187 };188 var featurePopup = new _FeaturelayerSourcePopup(args);189 this.own(on(featurePopup, 'ok', lang.hitch(this, function(item){190 //{name, url, definition}191 var layerSourceType = featurePopup.getSelectedRadioType();192 featurePopup.close();193 if(this.currentSCS){194 this.currentSCS.destroy();195 this.currentSCS = null;196 }197 //var chartName = this._getSuitableQueryName(item.name);198 var chartName = item.name || "";199 var addResult = this.chartList.addRow({name: chartName});200 if (addResult.success) {201 var tr = addResult.tr;202 this.chartList.selectRow(tr);203 if (this.currentSCS) {204 var expr = null;205 // if(layerSourceType === 'map'){206 // var layerObject = item.layerInfo && item.layerInfo.layerObject;207 // if(layerObject && typeof layerObject.getDefinitionExpression === 'function'){208 // expr = layerObject.getDefinitionExpression();209 // }210 // }211 var layerId = item.layerInfo && item.layerInfo.id;212 var url = item.url;213 this.shelter.show();214 utils.getLayerDefinitionByLayerIdOrUrl(layerId, url).then(function(definition) {215 this.shelter.hide();216 item.definition = null;217 item.definition = definition;218 this.currentSCS.setNewLayerDefinition(item, layerSourceType, chartName, expr);219 }.bind(this), function(err) {220 console.error(err);221 this.shelter.hide();222 }.bind(this));223 }224 }225 })));226 this.own(on(featurePopup, 'cancel', lang.hitch(this, function(){227 featurePopup.close();228 })));229 featurePopup.startup();230 },231 _hasNumberFields: function(layerDefinition){232 var result = false;233 var fieldInfos = layerDefinition.fields;234 if(fieldInfos && fieldInfos.length > 0){235 result = array.some(fieldInfos, lang.hitch(this, function(fieldInfo){236 return this._numberFieldTypes.indexOf(fieldInfo.type) >= 0;237 }));238 }239 return result;240 },241 _onChartItemRemoved: function(tr){242 if(this.currentSCS){243 if(this.currentSCS.tr === tr){244 this.currentSCS.destroy();245 this.currentSCS = null;246 }247 }248 },249 _onChartItemSelected: function(tr){250 if(this.currentSCS){251 if(this.currentSCS.tr !== tr){252 var singleConfig = this.currentSCS.getConfig(true);253 if(singleConfig){254 this.currentSCS.tr.singleConfig = singleConfig;255 this.currentSCS.destroy();256 this.currentSCS = null;257 this._createSingleChartSetting(tr);258 }259 else{260 this.chartList.selectRow(this.currentSCS.tr);261 }262 }263 }264 else{265 this._createSingleChartSetting(tr);266 }267 },268 _createSingleChartSetting: function(tr){269 var args = {270 map: this.map,271 nls: this.nls,272 config: tr.singleConfig,273 tr: tr,274 _layerDefinition: tr._layerDefinition,275 folderUrl: this.folderUrl,276 appConfig: this.appConfig277 };278 this.currentSCS = new SingleChartSetting(args);279 this.currentSCS.placeAt(this.singleChartContainer);280 this.own(on(this.currentSCS, 'name-change', lang.hitch(this, function(chartName){281 this.chartList.editRow(tr, {name: chartName});282 })));283 this.own(on(this.currentSCS, 'show-shelter', lang.hitch(this, function(){284 this.shelter.show();285 })));286 this.own(on(this.currentSCS, 'hide-shelter', lang.hitch(this, function(){287 this.shelter.hide();288 })));289 this.currentSCS.startup();290 //first bind event, then setConfig291 this.currentSCS.setConfig(tr.singleConfig);292 return this.currentSCS;293 }294 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { singleConfig } = require("root");2const config = singleConfig();3const { multiConfig } = require("root");4const config = multiConfig();5module.exports = {6};7const { singleConfig } = require("root");8const config = singleConfig();9module.exports = {10};11const { multiConfig } = require("root");12const config = multiConfig("db");

Full Screen

Using AI Code Generation

copy

Full Screen

1const root = require('rootconfig');2console.log(root.get('key1'));3console.log(root.get('key2'));4console.log(root.get('key3'));5{6}7const root = require('rootconfig');8console.log(root.get('key1'));9console.log(root.get('key2'));10console.log(root.get('key3'));11{12}

Full Screen

Using AI Code Generation

copy

Full Screen

1const config = require('root-config')('test');2const config = require('root-config')('test', 'development');3{4 "development": {5 },6 "test": {7 },8 "production": {9 }10}11* **Dylan G. Johnson** - *Initial work* - [dylangjohnson](

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful