<commit_before>goog.provide('gmf.printDirective');

goog.require('gmf');
/** @suppress {extraRequire} */
goog.require('gmf.authenticationDirective');
goog.require('ngeo.CreatePrint');
goog.require('ngeo.FeatureOverlayMgr');
goog.require('ngeo.LayerHelper');
goog.require('ngeo.PrintUtils');
goog.require('ol.Observable');
goog.require('ol.math');
goog.require('ol.Map');
goog.require('ol.layer.Group');


/**
 * @enum {string}
 * @export
 */
gmf.PrintStateEnum = {

  /**
   * @type {string}
   * @export
   */
  NOT_IN_USE: 'notInUse',

  /**
   * @type {string}
   * @export
   */
  PRINTING: 'printing',

  /**
   * @type {string}
   * @export
   */
  ERROR_ON_REPORT: 'errorOnReport',

  /**
   * @type {string}
   * @export
   */
  CAPABILITIES_NOT_LOADED: 'capabilitiesNotLoaded',

  /**
   * @type {string}
   * @export
   */
  ERROR_ON_GETCAPABILITIES: 'errorOnGetCapabilities'
};

gmf.module.value('gmfPrintState', {
  'state': gmf.PrintStateEnum.CAPABILITIES_NOT_LOADED
});

gmf.module.value('gmfPrintTemplateUrl',
  /**
     * @param {angular.JQLite} element Element.
     * @param {angular.Attributes} attrs Attributes.
     * @return {string} Template.
     */
  (element, attrs) => {
    const templateUrl = attrs['gmfPrintTemplateurl'];
    return templateUrl !== undefined ? templateUrl :
      `${gmf.baseTemplateUrl}/print.html`;
  });


/**
 * Provide a directive that display a print panel. This panel is populated with
 * a form corresponding to the capabilities delivered by a GMF print v3 server.
 * If you want to use another template for your print panel, you can see the
 * available layout information in the 'gmfx.PrintLayoutInfo' classes.
 *
 * Simple example:
 *
 *      <gmf-print
 *        gmf-print-map="mainCtrl.map"
 *        gmf-print-active="printActive"
 *        gmf-print-rotatemask="true">
 *      </gmf-print>
 *
 * Example with user defined attribute:
 *
 *      <gmf-print
 *        gmf-print-map="mainCtrl.map"
 *        gmf-print-active="printActive"
 *        gmf-print-rotatemask="true"
 *        gmf-print-hiddenfields="['name']"
 *        gmf-print-attributes-out="attributes">
 *        <div ng-repeat="attribute in attributes">
 *          <div ng-if="attribute.name == 'name'">
 *            <input ng-model="attribute.value" placeholder="name" />
 *          </div>
 *        </div>
 *      </gmf-print>
 *
 * Note: The 'print' and 'cancel' functions can also be called via globals
 * events 'gmfStartPrint' and 'gmfCancelPrint'.
 *
 * @htmlAttribute {ol.Map} gmf-print-map The map.
 * @htmlAttribute {boolean} gmf-print-active A boolean that informs if the
 *     panel is open or not.
 * @htmlAttribute {boolean} gmf-print-rotatemask Optional. True to apply
 *     rotation on the mask instead of the map. By default, the map rotates.
 * @htmlAttribute {Object.<string, string|number|boolean>}
 *     gmf-print-fieldvalues optional. Key, value object to define default
 *     value in each of your print panel field. The key refers to the
 *     property's name of the field.
 *     Example: {'comments': 'demo', 'legend': false}. Doesn't work for the dpi
 *     and the scale. Server's values are used in priorty.
 * @htmlAttribute {Array.<string>} gmf-print-hiddenattributes The list of attributes that should be hidden.
 * @param {string|function(!angular.JQLite=, !angular.Attributes=)}
 *     gmfPrintTemplateUrl Template url for the directive.
 * @return {angular.Directive} Directive Definition Object.
 * @ngInject
 * @ngdoc directive
 * @ngname gmfPrint
 */
gmf.printDirective = function(gmfPrintTemplateUrl) {
  return {
    bindToController: true,
    controller: 'GmfPrintController as ctrl',
    templateUrl: gmfPrintTemplateUrl,
    replace: true,
    restrict: 'E',
    transclude: true,
    scope: {
      'map': '=gmfPrintMap',
      'active': '=gmfPrintActive',
      'rotateMask': '&?gmfPrintRotatemask',
      'fieldValues': '&?gmfPrintFieldvalues',
      'hiddenAttributeNames': '=gmfPrintHiddenattributes',
      'attributesOut': '=gmfPrintAttributesOut'
    },
    link(scope, element, attr) {
      const ctrl = scope['ctrl'];

      scope.$watch(() => ctrl.active, function(active) {
        this.togglePrintPanel_(active);<commit_msg>Make hiddenAttributeNames & attributesOut optional parameters for gmf-print directive<commit_after>goog.provide('gmf.printDirective');

goog.require('gmf');
/** @suppress {extraRequire} */
goog.require('gmf.authenticationDirective');
goog.require('ngeo.CreatePrint');
goog.require('ngeo.FeatureOverlayMgr');
goog.require('ngeo.LayerHelper');
goog.require('ngeo.PrintUtils');
goog.require('ol.Observable');
goog.require('ol.math');
goog.require('ol.Map');
goog.require('ol.layer.Group');


/**
 * @enum {string}
 * @export
 */
gmf.PrintStateEnum = {

  /**
   * @type {string}
   * @export
   */
  NOT_IN_USE: 'notInUse',

  /**
   * @type {string}
   * @export
   */
  PRINTING: 'printing',

  /**
   * @type {string}
   * @export
   */
  ERROR_ON_REPORT: 'errorOnReport',

  /**
   * @type {string}
   * @export
   */
  CAPABILITIES_NOT_LOADED: 'capabilitiesNotLoaded',

  /**
   * @type {string}
   * @export
   */
  ERROR_ON_GETCAPABILITIES: 'errorOnGetCapabilities'
};

gmf.module.value('gmfPrintState', {
  'state': gmf.PrintStateEnum.CAPABILITIES_NOT_LOADED
});

gmf.module.value('gmfPrintTemplateUrl',
  /**
     * @param {angular.JQLite} element Element.
     * @param {angular.Attributes} attrs Attributes.
     * @return {string} Template.
     */
  (element, attrs) => {
    const templateUrl = attrs['gmfPrintTemplateurl'];
    return templateUrl !== undefined ? templateUrl :
      `${gmf.baseTemplateUrl}/print.html`;
  });


/**
 * Provide a directive that display a print panel. This panel is populated with
 * a form corresponding to the capabilities delivered by a GMF print v3 server.
 * If you want to use another template for your print panel, you can see the
 * available layout information in the 'gmfx.PrintLayoutInfo' classes.
 *
 * Simple example:
 *
 *      <gmf-print
 *        gmf-print-map="mainCtrl.map"
 *        gmf-print-active="printActive"
 *        gmf-print-rotatemask="true">
 *      </gmf-print>
 *
 * Example with user defined attribute:
 *
 *      <gmf-print
 *        gmf-print-map="mainCtrl.map"
 *        gmf-print-active="printActive"
 *        gmf-print-rotatemask="true"
 *        gmf-print-hiddenfields="['name']"
 *        gmf-print-attributes-out="attributes">
 *        <div ng-repeat="attribute in attributes">
 *          <div ng-if="attribute.name == 'name'">
 *            <input ng-model="attribute.value" placeholder="name" />
 *          </div>
 *        </div>
 *      </gmf-print>
 *
 * Note: The 'print' and 'cancel' functions can also be called via globals
 * events 'gmfStartPrint' and 'gmfCancelPrint'.
 *
 * @htmlAttribute {ol.Map} gmf-print-map The map.
 * @htmlAttribute {boolean} gmf-print-active A boolean that informs if the
 *     panel is open or not.
 * @htmlAttribute {boolean} gmf-print-rotatemask Optional. True to apply
 *     rotation on the mask instead of the map. By default, the map rotates.
 * @htmlAttribute {Object.<string, string|number|boolean>}
 *     gmf-print-fieldvalues optional. Key, value object to define default
 *     value in each of your print panel field. The key refers to the
 *     property's name of the field.
 *     Example: {'comments': 'demo', 'legend': false}. Doesn't work for the dpi
 *     and the scale. Server's values are used in priorty.
 * @htmlAttribute {Array.<string>} gmf-print-hiddenattributes The list of attributes that should be hidden.
 * @param {string|function(!angular.JQLite=, !angular.Attributes=)}
 *     gmfPrintTemplateUrl Template url for the directive.
 * @return {angular.Directive} Directive Definition Object.
 * @ngInject
 * @ngdoc directive
 * @ngname gmfPrint
 */
gmf.printDirective = function(gmfPrintTemplateUrl) {
  return {
    bindToController: true,
    controller: 'GmfPrintController as ctrl',
    templateUrl: gmfPrintTemplateUrl,
    replace: true,
    restrict: 'E',
    transclude: true,
    scope: {
      'map': '=gmfPrintMap',
      'active': '=gmfPrintActive',
      'rotateMask': '&?gmfPrintRotatemask',
      'fieldValues': '&?gmfPrintFieldvalues',
      'hiddenAttributeNames': '=?gmfPrintHiddenattributes',
      'attributesOut': '=?gmfPrintAttributesOut'
    },
    link(scope, element, attr) {
      const ctrl = scope['ctrl'];

      scope.$watch(() => ctrl.active, function(active) {
        this.togglePrintPanel_(active);
{'fraction_non_alphanumeric': 0.1415471431930402, 'fraction_numerical': 0.00023512814483893723, 'mean_word_length': 3.37153134635149, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2998324', 'n_tokens_mistral': 2738, 'n_tokens_neox': 2680, 'n_words': 644}