<commit_before>define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "esri/kernel", 
    "dijit/_WidgetBase", "dijit/_TemplatedMixin", "dojo/on",
    "dojo/Deferred", "dojo/promise/all", 
    "dojo/query", 
    "esri/tasks/query", "esri/tasks/QueryTask",
    "dojo/text!application/dijit/templates/FeatureList.html", 
    "dojo/dom", "dojo/dom-class", "dojo/dom-attr", "dojo/dom-style", "dojo/dom-construct", "dojo/_base/event", 
    "dojo/string", 
    "dojo/text!application/dijit/templates/FeatureListTemplate.html",
    "esri/symbols/SimpleMarkerSymbol", "esri/symbols/PictureMarkerSymbol", 
    "esri/symbols/CartographicLineSymbol", 
    "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol",
    "esri/graphic", "esri/Color", 
    "esri/dijit/InfoWindow",
    "dojo/NodeList-dom", "dojo/NodeList-traverse"
    
    ], function (
        Evented, declare, lang, has, esriNS,
        _WidgetBase, _TemplatedMixin, on, 
        Deferred, all, 
        query,
        Query, QueryTask,
        FeatureList, 
        dom, domClass, domAttr, domStyle, domConstruct, event, 
        string,
        listTemplate,
        SimpleMarkerSymbol, PictureMarkerSymbol, 
        CartographicLineSymbol, 
        SimpleFillSymbol, SimpleLineSymbol,
        Graphic, Color,
        InfoWindow
    ) {
    var Widget = declare("esri.dijit.FeatureList", [_WidgetBase, _TemplatedMixin, Evented], {
        // defaults
        templateString: FeatureList,

        options: {
            map: null,
            layers: null,
            visible: true
        },

        constructor: function (options, srcRefNode) {
            var defaults = lang.mixin({}, this.options, options);

            this.domNode = srcRefNode;
            // properties
            this.set("map", defaults.map);
            var Layers = this._getLayers(defaults.layers);
            this.set("Layers", Layers);

            if(options.animatedMarker) {
                window.markerSymbol = new esri.symbol.PictureMarkerSymbol({
                    "angle": 0,
                    "xoffset": 0,
                    "yoffset": 0,
                    "type": "esriPMS",
                    "url": require.toUrl("./"+options.markerImage),
                    "contentType": "image/gif",
                    "width": options.markerSize,
                    "height": options.markerSize
                });
            } else {
                window.markerSymbol = new SimpleMarkerSymbol({
                      "color": [3,126,175,20],
                      "size": options.markerSize,
                      "xoffset": 0,
                      "yoffset": 0,
                      "type": "esriSMS",
                      "style": "esriSMSCircle",
                      "outline": {
                        "color": [3,26,255,220],
                        "width": 2,
                        "type": "esriSLS",
                        "style": "esriSLSSolid"
                      }
                    });
            }
            this.css = {
            };
        },

        _getLayers : function(layers) {
            var l1 = layers.filter(function (l) { return l.hasOwnProperty("url");}); //l => l.hasOwnProperty("url"));
            var l2 = layers.filter(function (l) { return !l.hasOwnProperty("url");}); //l => !l.hasOwnProperty("url"));
            if(l2.length>0) {
                console.info("Feature List - These Layers are not services: ", l2);
            }
            return l1;
        },

        startup: function () {
            if (!this.map) {
                this.destroy();
                console.log("FeaturesList::map required");
            }
            if (this.map.loaded) {
                this._init();
            } else {
                on.once(this.map, "load", lang.hitch(this, function () {
                    this._init();
                }));
            }
        },

        _init: function () {
            this._createList();
            this.set("loaded", true);
            this.emit("load", {});

            on(this.toolbar, 'updateTool_features', lang.hitch(this, function(name) {
                this._reloadList(this.map);
                dom.byId('pageBody_features').focus();
            }));
        },

        FocusDetails: function() {
            if(!this._isVisible()) return;
            
            var details = this.domNode.querySelector('.showAttr');
            if(details) {
                var page = query(details).closest('.borderLi')[0];
                page.querySelector('.checkbox').focus();
            }
        },

        _isVisible : function() {
            var page = query(this.domNode).closest('.page')[0];
            return dojo.hasClass(page, "showAttr");
        },

        _reloadList : function(ext) {
            if(!this._isVisible()) return;
            var loading_features = this.domNode.parentNode.querySelector('#loading_features');
            domStyle.set(loading_features, 'display', '-webkit-inline-box');
            var list = query("#featuresList")[0];
            this.map.graphics.clear();
            window.tasks.filter(function(t) { return t.layer.visible && t.layer.visibleAtMapScale;}).forEach(lang.hitch(this.map, function(t) {
                t.query.geometry = ext.extent;
                var exp=t.layer.getDefinitionExpression();
                t.query.where = exp;
                t.result = t.task.execute(t.query);
            }));
            promises = all(window.tasks.map(function(t) {return t.result;}));
            promises.then(
                function(results) {
                    list.innerHTML = "";
                    var preselected = null;
                    if(results) for(var i = 0; i<results.length; i++)
                    {
                        if(window.tasks[i].layer.visible && window.tasks[i].layer.visibleAtMapScale) {
                            r = results[i];
                            var layer = window.tasks[i].layer;
                            var content = '';
                            if(!layer.infoTemplate) {
                                var x = 1;
                            }
                            var fieldsMap = layer.infoTemplate._fieldsMap;
                            for(var p in layer.infoTemplate._fieldsMap) {
                                if(fieldsMap.hasOwnProperty(p) && fieldsMap[p].visible)
                                {
                                    var pField = fieldsMap[p];
                                    var fieldName = '${'+pField.fieldName+'}';
                                    content+='<tr class="featureItem_${_layerId}_${_featureId} hideAttr" tabindex="0">\n';
                                    content+='    <td valign="top">\n';
                                    content+='      <!--<img src="..\\images\\Filter0.png" alt="filter" class="filterBtn"/>-->\n';
                                    content+='    </td>\n';
                                    content+='    <td valign="top" align="right">'+pField.label+'</td>\n';
                                    content+='    <td valign="top">:</td>\n';
                                    content+='    <td valign="top">';
                                    if(pField.format)
                                    { 
                                        if(pField.format.dateFormat) {
                                            content+='FORMAT_DATE('+fieldName+',"'+pField.format.dateFormat+'")';
                                        }
                                        else if(pField.format.digitSeparator) {
                                            content+='FORMAT_NUM('+fieldName+',"'+pField.format.places+'")';
                                        }
                                        else {
                                            content+=fieldName;
                                        }
                                    }
                                    else {
                                        content+=fieldName;
                                    }
                                    content+='</td>\n';
                                    content+='</tr>\n';
                                }
                            }
                            for(var j = 0; j<r.features.length; j++) {
                                var f = r.features[j];
                                if(window._prevSelected && window._prevSelected.split('_')[1] == f.attributes[r.objectIdFieldName]) {
                                    preselected = f;
                                }
<commit_msg>Aria label for Feature List items<commit_after>define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "esri/kernel", 
    "dijit/_WidgetBase", "dijit/_TemplatedMixin", "dojo/on",
    "dojo/Deferred", "dojo/promise/all", 
    "dojo/query", 
    "esri/tasks/query", "esri/tasks/QueryTask",
    "dojo/text!application/dijit/templates/FeatureList.html", 
    "dojo/dom", "dojo/dom-class", "dojo/dom-attr", "dojo/dom-style", "dojo/dom-construct", "dojo/_base/event", 
    "dojo/string", 
    "dojo/text!application/dijit/templates/FeatureListTemplate.html",
    "esri/symbols/SimpleMarkerSymbol", "esri/symbols/PictureMarkerSymbol", 
    "esri/symbols/CartographicLineSymbol", 
    "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol",
    "esri/graphic", "esri/Color", 
    "esri/dijit/InfoWindow",
    "dojo/NodeList-dom", "dojo/NodeList-traverse"
    
    ], function (
        Evented, declare, lang, has, esriNS,
        _WidgetBase, _TemplatedMixin, on, 
        Deferred, all, 
        query,
        Query, QueryTask,
        FeatureList, 
        dom, domClass, domAttr, domStyle, domConstruct, event, 
        string,
        listTemplate,
        SimpleMarkerSymbol, PictureMarkerSymbol, 
        CartographicLineSymbol, 
        SimpleFillSymbol, SimpleLineSymbol,
        Graphic, Color,
        InfoWindow
    ) {
    var Widget = declare("esri.dijit.FeatureList", [_WidgetBase, _TemplatedMixin, Evented], {
        // defaults
        templateString: FeatureList,

        options: {
            map: null,
            layers: null,
            visible: true
        },

        constructor: function (options, srcRefNode) {
            var defaults = lang.mixin({}, this.options, options);

            this.domNode = srcRefNode;
            // properties
            this.set("map", defaults.map);
            var Layers = this._getLayers(defaults.layers);
            this.set("Layers", Layers);

            if(options.animatedMarker) {
                window.markerSymbol = new esri.symbol.PictureMarkerSymbol({
                    "angle": 0,
                    "xoffset": 0,
                    "yoffset": 0,
                    "type": "esriPMS",
                    "url": require.toUrl("./"+options.markerImage),
                    "contentType": "image/gif",
                    "width": options.markerSize,
                    "height": options.markerSize
                });
            } else {
                window.markerSymbol = new SimpleMarkerSymbol({
                      "color": [3,126,175,20],
                      "size": options.markerSize,
                      "xoffset": 0,
                      "yoffset": 0,
                      "type": "esriSMS",
                      "style": "esriSMSCircle",
                      "outline": {
                        "color": [3,26,255,220],
                        "width": 2,
                        "type": "esriSLS",
                        "style": "esriSLSSolid"
                      }
                    });
            }
            this.css = {
            };
        },

        _getLayers : function(layers) {
            var l1 = layers.filter(function (l) { return l.hasOwnProperty("url");}); //l => l.hasOwnProperty("url"));
            var l2 = layers.filter(function (l) { return !l.hasOwnProperty("url");}); //l => !l.hasOwnProperty("url"));
            if(l2.length>0) {
                console.info("Feature List - These Layers are not services: ", l2);
            }
            return l1;
        },

        startup: function () {
            if (!this.map) {
                this.destroy();
                console.log("FeaturesList::map required");
            }
            if (this.map.loaded) {
                this._init();
            } else {
                on.once(this.map, "load", lang.hitch(this, function () {
                    this._init();
                }));
            }
        },

        _init: function () {
            this._createList();
            this.set("loaded", true);
            this.emit("load", {});

            on(this.toolbar, 'updateTool_features', lang.hitch(this, function(name) {
                this._reloadList(this.map);
                dom.byId('pageBody_features').focus();
            }));
        },

        FocusDetails: function() {
            if(!this._isVisible()) return;
            
            var details = this.domNode.querySelector('.showAttr');
            if(details) {
                var page = query(details).closest('.borderLi')[0];
                page.querySelector('.checkbox').focus();
            }
        },

        _isVisible : function() {
            var page = query(this.domNode).closest('.page')[0];
            return dojo.hasClass(page, "showAttr");
        },

        _reloadList : function(ext) {
            if(!this._isVisible()) return;
            var loading_features = this.domNode.parentNode.querySelector('#loading_features');
            domStyle.set(loading_features, 'display', '-webkit-inline-box');
            var list = query("#featuresList")[0];
            this.map.graphics.clear();
            window.tasks.filter(function(t) { return t.layer.visible && t.layer.visibleAtMapScale;}).forEach(lang.hitch(this.map, function(t) {
                t.query.geometry = ext.extent;
                var exp=t.layer.getDefinitionExpression();
                t.query.where = exp;
                t.result = t.task.execute(t.query);
            }));
            promises = all(window.tasks.map(function(t) {return t.result;}));
            promises.then(
                function(results) {
                    list.innerHTML = "";
                    var preselected = null;
                    if(results) for(var i = 0; i<results.length; i++)
                    {
                        if(window.tasks[i].layer.visible && window.tasks[i].layer.visibleAtMapScale) {
                            r = results[i];
                            var layer = window.tasks[i].layer;
                            var content = '';
                            if(!layer.infoTemplate) {
                                var x = 1;
                            }
                            var fieldsMap = layer.infoTemplate._fieldsMap;
                            for(var p in layer.infoTemplate._fieldsMap) {
                                if(fieldsMap.hasOwnProperty(p) && fieldsMap[p].visible)
                                {
                                    var pField = fieldsMap[p];
                                    var fieldName = '${'+pField.fieldName+'}';
                                    var fieldValue = fieldName;
                                    if(pField.format)
                                    { 
                                        if(pField.format.dateFormat) {
                                            fieldValue='FORMAT_DATE('+fieldName+',"'+pField.format.dateFormat+'")';
                                        }
                                        else if(pField.format.digitSeparator) {
                                            fieldValue='FORMAT_NUM('+fieldName+',"'+pField.format.places+'")';
                                        }
                                        else {
                                            fieldValue=fieldName;
                                        }
                                    }

                                    content+='<tr class="featureItem_${_layerId}_${_featureId} hideAttr" tabindex="0" aria-label="'+pField.label+', '+fieldValue+',"">\n';
                                    content+='    <td valign="top">\n';
                                    content+='      <!--<img src="..\\images\\Filter0.png" alt="filter" class="filterBtn"/>-->\n';
                                    content+='    </td>\n';
                                    content+='    <td valign="top" align="right">'+pField.label+'</td>\n';
                                    content+='    <td valign="top">:</td>\n';
                                    content+='    <td valign="top">'+fieldValue+'</td>\n';
                                    content+='</tr>\n';
                                }
                            }
                            for(var j = 0; j<r.features.length; j++) {
                                var f = r.features[j];
                                if(window._prevSelected && window._prevSelected.split('_')[1] == f.attributes[r.objectIdFieldName]) {
                                    preselected = f;
                                }

{'fraction_non_alphanumeric': 0.13056603773584904, 'fraction_numerical': 0.004528301886792453, 'mean_word_length': 1.2016871165644172, 'pattern_counts': {'":': 38, '<': 31, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 63, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1308157', 'n_tokens_mistral': 4544, 'n_tokens_neox': 4328, 'n_words': 689}