@inspark/inspark-components 1.0.36 → 1.0.38

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.
Files changed (26) hide show
  1. package/full/bundles/inspark-inspark-components.umd.js +119 -2
  2. package/full/bundles/inspark-inspark-components.umd.js.map +1 -1
  3. package/full/bundles/inspark-inspark-components.umd.min.js +2 -2
  4. package/full/bundles/inspark-inspark-components.umd.min.js.map +1 -1
  5. package/full/components/content-toggle/content-toggle.component.d.ts +1 -0
  6. package/full/components/pie/pie.component.d.ts +16 -0
  7. package/full/components/pie/pie.service.d.ts +16 -0
  8. package/full/esm2015/components/content-toggle/content-toggle.component.js +7 -2
  9. package/full/esm2015/components/inspark.module.js +5 -2
  10. package/full/esm2015/components/pie/pie.component.js +59 -0
  11. package/full/esm2015/components/pie/pie.service.js +54 -0
  12. package/full/esm2015/inspark-inspark-components.js +3 -1
  13. package/full/esm5/components/content-toggle/content-toggle.component.js +7 -2
  14. package/full/esm5/components/inspark.module.js +5 -2
  15. package/full/esm5/components/pie/pie.component.js +60 -0
  16. package/full/esm5/components/pie/pie.service.js +56 -0
  17. package/full/esm5/inspark-inspark-components.js +3 -1
  18. package/full/fesm2015/inspark-inspark-components.js +115 -3
  19. package/full/fesm2015/inspark-inspark-components.js.map +1 -1
  20. package/full/fesm5/inspark-inspark-components.js +118 -3
  21. package/full/fesm5/inspark-inspark-components.js.map +1 -1
  22. package/full/inspark-inspark-components.d.ts +2 -0
  23. package/full/inspark-inspark-components.metadata.json +1 -1
  24. package/full/package.json +1 -1
  25. package/interface/package.json +1 -1
  26. package/package.json +1 -1
@@ -3705,6 +3705,7 @@
3705
3705
  this.cdr = cdr;
3706
3706
  this.isOpen = true;
3707
3707
  this.icon = null;
3708
+ this.manualArrow = true;
3708
3709
  this.toggle = new core.EventEmitter();
3709
3710
  }
3710
3711
  ContentToggleComponent.prototype.toggleOpen = function () {
@@ -3727,6 +3728,10 @@
3727
3728
  core.Input(),
3728
3729
  __metadata("design:type", String)
3729
3730
  ], ContentToggleComponent.prototype, "icon", void 0);
3731
+ __decorate([
3732
+ core.Input(),
3733
+ __metadata("design:type", Boolean)
3734
+ ], ContentToggleComponent.prototype, "manualArrow", void 0);
3730
3735
  __decorate([
3731
3736
  core.Output(),
3732
3737
  __metadata("design:type", core.EventEmitter)
@@ -3734,7 +3739,7 @@
3734
3739
  ContentToggleComponent = __decorate([
3735
3740
  core.Component({
3736
3741
  selector: 'in-content-toggle',
3737
- template: "<div class=\"block\" (click)=\"toggleOpen()\" tabIndex=\"1\">\n <span [ngClass]=\"{arrow: true, close: !isOpen}\">\n <in-svg [src]=\"'arrow-down.svg'\" width=\"48px\" height=\"48px\"></in-svg>\n </span>\n <span class=\"label\"><in-svg *ngIf=\"icon\" class=\"label-icon\" [src]=\"icon\"></in-svg> {{label}}</span>\n <span class=\"counter\">\n <ng-content select=\"[header]\"></ng-content>\n </span>\n</div>\n<div class=\"container\" *ngIf=\"isOpen\">\n <ng-content select=\"[body]\"></ng-content>\n</div>\n",
3742
+ template: "<div class=\"block\" (click)=\"toggleOpen()\" tabIndex=\"1\">\n <span [ngClass]=\"{arrow: true, close: !isOpen}\">\n <in-svg *ngIf=\"manualArrow\" [src]=\"'arrow-down.svg'\" width=\"48px\" height=\"48px\"></in-svg>\n <ng-content select=\"[arrow]\"></ng-content>\n </span>\n <span class=\"label\">\n <in-svg *ngIf=\"icon\" class=\"label-icon\" [src]=\"icon\"></in-svg>\n {{label}}\n </span>\n <span class=\"counter\">\n <ng-content select=\"[header]\"></ng-content>\n </span>\n</div>\n<div class=\"container\" *ngIf=\"isOpen\">\n <ng-content select=\"[body]\"></ng-content>\n</div>\n",
3738
3743
  styles: ["@charset \"UTF-8\";.block{font-size:12px;text-transform:uppercase;cursor:pointer;display:flex;white-space:nowrap}.block:hover{background:var(--colorBgLevel2)}.block>span{display:inline-block;margin-right:4px}.block .label{margin-right:8px;display:flex;align-items:center;overflow:hidden;text-overflow:ellipsis}.block .counter{display:flex;align-items:center;padding-right:8px}.block .arrow{margin-right:0}.block .arrow.close{transform:rotate(-90deg)}.label-icon{margin-right:4px;width:16px;height:16px}"]
3739
3744
  }),
3740
3745
  __metadata("design:paramtypes", [core.ChangeDetectorRef])
@@ -4244,6 +4249,114 @@
4244
4249
  return AutoCompleteComponentModule;
4245
4250
  }());
4246
4251
 
4252
+ var PieService = /** @class */ (function () {
4253
+ function PieService() {
4254
+ this.colorArray = ['-1', 0, 1, 2, 3, 4]; // Цвета и последовательность в которой они будут отображены
4255
+ this.colors = {
4256
+ 1: '#31ac51',
4257
+ 2: '#EE9946',
4258
+ 3: '#F95C5D',
4259
+ 4: '#a20000',
4260
+ 0: '#7E8087',
4261
+ '-1': '#85B3CB'
4262
+ };
4263
+ }
4264
+ PieService.prototype.create = function (statuses, size) {
4265
+ var _this = this;
4266
+ var data = [];
4267
+ var allCount = 0;
4268
+ this.colorArray.forEach(function (color) {
4269
+ allCount += statuses[color] || 0;
4270
+ });
4271
+ var cumulativePercent = 0;
4272
+ this.colorArray.forEach(function (color) {
4273
+ var count = statuses[color];
4274
+ if (!count) {
4275
+ return;
4276
+ }
4277
+ var percent = count / allCount;
4278
+ var _a = __read(_this.getCoordinatesForPercent(size, cumulativePercent), 2), startX = _a[0], startY = _a[1];
4279
+ cumulativePercent += percent;
4280
+ var _b = __read(_this.getCoordinatesForPercent(size, cumulativePercent), 2), endX = _b[0], endY = _b[1];
4281
+ var largeArcFlag = percent > .5 ? 1 : 0;
4282
+ var pathData = [
4283
+ "M " + startX + " " + startY,
4284
+ "A 20 20 0 " + largeArcFlag + " 1 " + endX + " " + endY,
4285
+ "L 0 0",
4286
+ ].join(' ');
4287
+ data.push({
4288
+ path: pathData,
4289
+ color: _this.colors[color + '']
4290
+ });
4291
+ });
4292
+ return data;
4293
+ };
4294
+ PieService.prototype.getCoordinatesForPercent = function (size, percent) {
4295
+ var x = size / 2 * Math.cos(2 * Math.PI * percent);
4296
+ var y = size / 2 * Math.sin(2 * Math.PI * percent);
4297
+ return [x, y];
4298
+ };
4299
+ PieService = __decorate([
4300
+ core.Injectable()
4301
+ ], PieService);
4302
+ return PieService;
4303
+ }());
4304
+
4305
+ var ObjectPieComponent = /** @class */ (function () {
4306
+ function ObjectPieComponent(translate, pieService, cdr) {
4307
+ this.translate = translate;
4308
+ this.pieService = pieService;
4309
+ this.cdr = cdr;
4310
+ this.count = 30;
4311
+ this.size = 40;
4312
+ this.statuses = {
4313
+ '-1': 20,
4314
+ 0: 4,
4315
+ 1: 3,
4316
+ 2: 4,
4317
+ 3: 5
4318
+ };
4319
+ }
4320
+ ObjectPieComponent.prototype.ngOnInit = function () {
4321
+ this.data = this.pieService.create(this.statuses, this.size);
4322
+ };
4323
+ ObjectPieComponent.prototype.ngOnDestroy = function () {
4324
+ };
4325
+ ObjectPieComponent.prototype.ngOnChanges = function (changes) {
4326
+ };
4327
+ ObjectPieComponent.ctorParameters = function () { return [
4328
+ { type: core$1.TranslateService },
4329
+ { type: PieService },
4330
+ { type: core.ChangeDetectorRef }
4331
+ ]; };
4332
+ __decorate([
4333
+ core.Input(),
4334
+ __metadata("design:type", Object)
4335
+ ], ObjectPieComponent.prototype, "count", void 0);
4336
+ __decorate([
4337
+ core.Input(),
4338
+ __metadata("design:type", Object)
4339
+ ], ObjectPieComponent.prototype, "size", void 0);
4340
+ __decorate([
4341
+ core.Input(),
4342
+ __metadata("design:type", Object)
4343
+ ], ObjectPieComponent.prototype, "statuses", void 0);
4344
+ ObjectPieComponent = __decorate([
4345
+ core.Component({
4346
+ selector: 'in-pie',
4347
+ template: "<div class=\"pie-block\">\n <svg viewBox=\"-20 -20 40 40\">\n <defs>\n <clipPath id=\"cut-off-bottom\">\n <circle cx=\"0\" cy=\"0\" r=\"12\"></circle>\n </clipPath>\n </defs>\n <mask id=\"re8-clip\">\n <circle cx=\"0\" cy=\"0\" r=\"20\" fill=\"white\"></circle>\n <circle cx=\"0\" cy=\"0\" r=\"14\" fill=\"black\"></circle>\n </mask>\n <path *ngFor=\"let path of data\" [attr.d]=\"path.path\" [attr.fill]=\"path.color\" mask=\"url(#re8-clip)\"></path>\n <text x=\"0\" y=\"4\" text-anchor=\"middle\" fill=\"currentColor\">{{count}}</text>\n </svg>\n</div>\n\n\n",
4348
+ encapsulation: core.ViewEncapsulation.Emulated,
4349
+ providers: [],
4350
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
4351
+ styles: [".pie-block{width:40px;height:40px;color:var(--text-color)}.pie-block text{width:20px;height:20px;background:var(--colorBgLevel2);font-size:11px}.pie-block svg{width:40px;height:40px}"]
4352
+ }),
4353
+ __metadata("design:paramtypes", [core$1.TranslateService,
4354
+ PieService,
4355
+ core.ChangeDetectorRef])
4356
+ ], ObjectPieComponent);
4357
+ return ObjectPieComponent;
4358
+ }());
4359
+
4247
4360
  var InsparkComponentsModule = /** @class */ (function () {
4248
4361
  function InsparkComponentsModule() {
4249
4362
  }
@@ -4294,7 +4407,8 @@
4294
4407
  RadiobuttonComponent,
4295
4408
  ObjectTreeComponent,
4296
4409
  ContentToggleComponent,
4297
- InputGroupComponent
4410
+ InputGroupComponent,
4411
+ ObjectPieComponent,
4298
4412
  ],
4299
4413
  exports: [
4300
4414
  ButtonComponent,
@@ -4329,6 +4443,7 @@
4329
4443
  RadiobuttonComponent,
4330
4444
  ObjectTreeComponent,
4331
4445
  ContentToggleComponent,
4446
+ ObjectPieComponent,
4332
4447
  InputGroupComponent,
4333
4448
  AutoCompleteComponentModule
4334
4449
  ],
@@ -4446,6 +4561,8 @@
4446
4561
  exports.ɵp = TableMenuOverlayComponent;
4447
4562
  exports.ɵq = TableClickOutsideDirective;
4448
4563
  exports.ɵr = InputGroupComponent;
4564
+ exports.ɵs = ObjectPieComponent;
4565
+ exports.ɵt = PieService;
4449
4566
 
4450
4567
  Object.defineProperty(exports, '__esModule', { value: true });
4451
4568