icon-label-d3 0.0.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,6 +29,7 @@
29
29
  var IconLabelD3Component = /** @class */ (function () {
30
30
  function IconLabelD3Component() {
31
31
  var _this = this;
32
+ this.debug = false;
32
33
  this.title = 'Etiquetas';
33
34
  setTimeout((/**
34
35
  * @return {?}
@@ -68,6 +69,9 @@
68
69
  */
69
70
  function () {
70
71
  var _this = this;
72
+ if (this.debug) {
73
+ console.log({ iconsElements: this.iconsElements });
74
+ }
71
75
  this.iconsElements.map((/**
72
76
  * @param {?} element
73
77
  * @return {?}
@@ -88,10 +92,17 @@
88
92
  * @return {?}
89
93
  */
90
94
  function () { return document.createElementNS(d3.namespaces.svg, 'polygon'); }));
95
+ if (_this.debug) {
96
+ console.log({ collection: _this.collection, identifier: identifier, dataElement: dataElement });
97
+ }
91
98
  point.attr('width', dataElement.style.width)
92
99
  .attr('heigth', dataElement.style.heigth)
93
100
  .attr('points', dataElement.draw)
94
101
  .style('fill', dataElement.fill);
102
+ if (_this.debug) {
103
+ var style = dataElement.style, draw = dataElement.draw, fill = dataElement.fill, identifier_1 = dataElement.identifier;
104
+ console.log({ style: style, draw: draw, fill: fill, identifier: identifier_1 });
105
+ }
95
106
  }));
96
107
  };
97
108
  IconLabelD3Component.decorators = [
@@ -104,6 +115,7 @@
104
115
  /** @nocollapse */
105
116
  IconLabelD3Component.ctorParameters = function () { return []; };
106
117
  IconLabelD3Component.propDecorators = {
118
+ debug: [{ type: core.Input }],
107
119
  title: [{ type: core.Input }],
108
120
  collection: [{ type: core.Input }],
109
121
  iconsElements: [{ type: core.ViewChildren, args: ['cmp',] }]
@@ -111,6 +123,8 @@
111
123
  return IconLabelD3Component;
112
124
  }());
113
125
  if (false) {
126
+ /** @type {?} */
127
+ IconLabelD3Component.prototype.debug;
114
128
  /** @type {?} */
115
129
  IconLabelD3Component.prototype.title;
116
130
  /** @type {?} */
@@ -138,6 +152,42 @@
138
152
  return IconLabelD3Module;
139
153
  }());
140
154
 
155
+ /**
156
+ * @fileoverview added by tsickle
157
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
158
+ */
159
+ /**
160
+ * @record
161
+ */
162
+ function StructLabelItemInterface() { }
163
+ if (false) {
164
+ /** @type {?} */
165
+ StructLabelItemInterface.prototype.identifier;
166
+ /** @type {?} */
167
+ StructLabelItemInterface.prototype.name;
168
+ /** @type {?} */
169
+ StructLabelItemInterface.prototype.fill;
170
+ /** @type {?} */
171
+ StructLabelItemInterface.prototype.draw;
172
+ /** @type {?} */
173
+ StructLabelItemInterface.prototype.style;
174
+ }
175
+
176
+ /**
177
+ * @fileoverview added by tsickle
178
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
179
+ */
180
+ /**
181
+ * @record
182
+ */
183
+ function StructStyleLibelItemInterface() { }
184
+ if (false) {
185
+ /** @type {?} */
186
+ StructStyleLibelItemInterface.prototype.width;
187
+ /** @type {?} */
188
+ StructStyleLibelItemInterface.prototype.heigth;
189
+ }
190
+
141
191
  exports.IconLabelD3Component = IconLabelD3Component;
142
192
  exports.IconLabelD3Module = IconLabelD3Module;
143
193
  exports.IconLabelD3Service = IconLabelD3Service;
@@ -1 +1 @@
1
- {"version":3,"file":"icon-label-d3.umd.js","sources":["ng://icon-label-d3/lib/icon-label-d3.service.ts","ng://icon-label-d3/lib/icon-label-d3.component.ts","ng://icon-label-d3/lib/icon-label-d3.module.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class IconLabelD3Service {\n\n constructor() { }\n}\n","import {Component, ElementRef, Input, QueryList, ViewChildren} from '@angular/core';\nimport * as d3 from 'd3';\n\nimport {StructLabelItemInterface} from './interfaces/struct-label-item-interface';\n\n@Component({\n selector: 'ngx-icon-label-d3',\n template: `\n <div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"text-center\">\n <label>{{title}}: </label>\n <label\n *ngFor=\"let item of collection; let indx = index;\">\n <span *ngIf=\"indx!==0\">,</span>\n <span style=\"width: 10px; height: 10px; position: absolute;\"\n #cmp\n title=\"icon_{{item.identifier}}\"></span>\n <strong style=\"margin-left: 10px;\">\n {{item.name}}\n </strong>\n </label>\n </div>\n </div>\n </div>\n `,\n styleUrls: ['../../node_modules/bootstrap/dist/css/bootstrap.css']\n})\nexport class IconLabelD3Component {\n\n constructor() {\n setTimeout(() => {\n this.applayIconCanvas();\n }, 50);\n }\n\n @Input() title = 'Etiquetas';\n @Input() collection: Array<StructLabelItemInterface>;\n @ViewChildren('cmp') iconsElements: QueryList<ElementRef>;\n\n private static makeSvg(element: ElementRef<any>) {\n return d3.select(element.nativeElement)\n .append('svg')\n .attr('width', '100%')\n .attr('height', '100%')\n .append('g')\n .attr('clip-path', 'url(#chart-content)')\n .selectAll('svg')\n .data([0])\n .enter();\n }\n\n private applayIconCanvas() {\n this.iconsElements.map((element) => {\n const identifier = element.nativeElement.title.replace('icon_', '');\n const svg = IconLabelD3Component.makeSvg(element);\n const dataElement = this.collection.find(item => item.identifier === +identifier);\n const point = svg.append(() => document.createElementNS(d3.namespaces.svg, 'polygon'));\n\n point.attr('width', dataElement.style.width)\n .attr('heigth', dataElement.style.heigth)\n .attr('points', dataElement.draw)\n .style('fill', dataElement.fill);\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { IconLabelD3Component } from './icon-label-d3.component';\nimport {CommonModule} from '@angular/common';\n\n\n\n@NgModule({\n declarations: [IconLabelD3Component],\n imports: [\n CommonModule\n ],\n exports: [IconLabelD3Component]\n})\nexport class IconLabelD3Module { }\n"],"names":["Injectable","d3.select","d3.namespaces","Component","Input","ViewChildren","NgModule","CommonModule"],"mappings":";;;;;;;;;;AAAA;QAOE;SAAiB;;oBALlBA,eAAU,SAAC;wBACV,UAAU,EAAE,MAAM;qBACnB;;;;;iCAJ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C;qBACxC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC;qBAChC,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;aACpC,EAAC,CAAC;SACJ;;oBA3DFC,cAAS,SAAC;wBACT,QAAQ,EAAE,mBAAmB;wBAC7B,QAAQ,EAAE,slBAkBT;;qBAEF;;;;;4BASEC,UAAK;iCACLA,UAAK;oCACLC,iBAAY,SAAC,KAAK;;QA2BrB,2BAAC;KA5DD,IA4DC;;;QA7BC,qCAA6B;;QAC7B,0CAAqD;;QACrD,6CAA0D;;;;;;;ACtC5D;QAMA;SAOkC;;oBAPjCC,aAAQ,SAAC;wBACR,YAAY,EAAE,CAAC,oBAAoB,CAAC;wBACpC,OAAO,EAAE;4BACPC,mBAAY;yBACb;wBACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;qBAChC;;QACgC,wBAAC;KAPlC;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"icon-label-d3.umd.js","sources":["ng://icon-label-d3/lib/icon-label-d3.service.ts","ng://icon-label-d3/lib/icon-label-d3.component.ts","ng://icon-label-d3/lib/icon-label-d3.module.ts","ng://icon-label-d3/lib/interfaces/struct-label-item-interface.ts","ng://icon-label-d3/lib/interfaces/struct-style-libel-item-interface.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class IconLabelD3Service {\n\n constructor() { }\n}\n","import {Component, ElementRef, Input, QueryList, ViewChildren} from '@angular/core';\nimport * as d3 from 'd3';\n\nimport {StructLabelItemInterface} from './interfaces/struct-label-item-interface';\n\n@Component({\n selector: 'ngx-icon-label-d3',\n template: `\n <div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"text-center\">\n <label>{{title}}: </label>\n <label\n *ngFor=\"let item of collection; let indx = index;\">\n <span *ngIf=\"indx!==0\">,</span>\n <span style=\"width: 10px; height: 10px; position: absolute;\"\n #cmp\n title=\"icon_{{item.identifier}}\"></span>\n <strong style=\"margin-left: 10px;\">\n {{item.name}}\n </strong>\n </label>\n </div>\n </div>\n </div>\n `,\n styleUrls: ['../../node_modules/bootstrap/dist/css/bootstrap.css']\n})\nexport class IconLabelD3Component {\n\n constructor() {\n setTimeout(() => {\n this.applayIconCanvas();\n }, 50);\n }\n\n @Input() debug = false;\n @Input() title = 'Etiquetas';\n @Input() collection: Array<StructLabelItemInterface>;\n @ViewChildren('cmp') iconsElements: QueryList<ElementRef>;\n\n private static makeSvg(element: ElementRef<any>) {\n return d3.select(element.nativeElement)\n .append('svg')\n .attr('width', '100%')\n .attr('height', '100%')\n .append('g')\n .attr('clip-path', 'url(#chart-content)')\n .selectAll('svg')\n .data([0])\n .enter();\n }\n\n private applayIconCanvas() {\n if (this.debug) {\n console.log({iconsElements: this.iconsElements});\n }\n this.iconsElements.map((element) => {\n const identifier = element.nativeElement.title.replace('icon_', '');\n const svg = IconLabelD3Component.makeSvg(element);\n const dataElement = this.collection.find(item => item.identifier === +identifier);\n const point = svg.append(() => document.createElementNS(d3.namespaces.svg, 'polygon'));\n\n if (this.debug) {\n console.log({collection: this.collection, identifier, dataElement});\n }\n\n point.attr('width', dataElement.style.width)\n .attr('heigth', dataElement.style.heigth)\n .attr('points', dataElement.draw)\n .style('fill', dataElement.fill);\n\n if (this.debug) {\n const {style, draw, fill, identifier} = dataElement;\n console.log({style, draw, fill, identifier});\n }\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { IconLabelD3Component } from './icon-label-d3.component';\nimport {CommonModule} from '@angular/common';\n\n\n\n@NgModule({\n declarations: [IconLabelD3Component],\n imports: [\n CommonModule\n ],\n exports: [IconLabelD3Component]\n})\nexport class IconLabelD3Module { }\n","import {StructStyleLibelItemInterface} from './struct-style-libel-item-interface';\n\nexport interface StructLabelItemInterface {\n identifier: number | string;\n name: string;\n fill: string;\n draw: string;\n style: StructStyleLibelItemInterface;\n}\n","export interface StructStyleLibelItemInterface {\n width: string;\n heigth: string;\n}\n"],"names":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