@hestia-earth/ui-components 0.0.8 → 0.0.11
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.
- package/README.md +5 -22
- package/bibliographies/bibliographies-search-confirm/bibliographies-search-confirm.component.d.ts +1 -1
- package/bundles/hestia-earth-ui-components.umd.js +2412 -815
- package/bundles/hestia-earth-ui-components.umd.js.map +1 -1
- package/common/blank-node-state/blank-node-state.component.d.ts +2 -2
- package/common/common.light.module.d.ts +19 -0
- package/common/common.module.d.ts +10 -19
- package/common/delta-utils.d.ts +1 -1
- package/common/index.d.ts +1 -0
- package/common/link-key-value/link-key-value.component.d.ts +1 -1
- package/common/maps-utils.d.ts +2 -2
- package/common/precision.pipe.d.ts +1 -1
- package/common/tags-input.directive.d.ts +1 -1
- package/common/utils.d.ts +7 -7
- package/cycles/cycles-emissions-chart/cycles-emissions-chart.component.d.ts +2 -2
- package/cycles/cycles-suggest-form/cycles-suggest-form.component.d.ts +1 -2
- package/cycles/cycles.model.d.ts +1 -1
- package/engine/aggregation-engine.service.d.ts +2 -2
- package/engine/engine.service.d.ts +3 -3
- package/esm2015/common/common.light.module.js +66 -0
- package/esm2015/common/common.module.js +11 -47
- package/esm2015/common/index.js +2 -1
- package/esm2015/common/tags-input.directive.js +3 -3
- package/esm2015/common/utils.js +1 -2
- package/esm2015/files/files-error-summary.model.js +55 -0
- package/esm2015/files/files-error.model.js +2 -2
- package/esm2015/files/files-form.model.js +2 -2
- package/esm2015/files/index.js +2 -1
- package/esm2015/tags-input/defaultOptions.js +26 -0
- package/esm2015/tags-input/index.js +1053 -0
- package/esm2015/tags-input/templates/dropdown-item.js +3 -0
- package/esm2015/tags-input/templates/tag.js +6 -0
- package/esm2015/tags-input/templates/wrapper.js +10 -0
- package/esm2015/tags-input/utils/component.js +80 -0
- package/esm2015/tags-input/utils/dom.js +98 -0
- package/esm2015/tags-input/utils/events.js +147 -0
- package/esm2015/tags-input/utils/type.js +41 -0
- package/esm2015/tags-input/utils/uuid.js +3 -0
- package/fesm2015/hestia-earth-ui-components.js +2033 -510
- package/fesm2015/hestia-earth-ui-components.js.map +1 -1
- package/files/files-error-summary.model.d.ts +27 -0
- package/files/files-error.model.d.ts +6 -6
- package/files/files-form/files-form.component.d.ts +7 -7
- package/files/files-form.model.d.ts +11 -11
- package/files/index.d.ts +1 -0
- package/impact-assessments/impact-assessments-indicators-chart/impact-assessments-indicators-chart.component.d.ts +2 -2
- package/impact-assessments/impact-assessments-products/impact-assessments-products.component.d.ts +2 -2
- package/node/node-icon/node-icon.component.d.ts +1 -1
- package/node/node-link/node-link.component.d.ts +1 -1
- package/node/node-logs-models/node-logs-models.component.d.ts +1 -1
- package/node/node.service.d.ts +2 -2
- package/package.json +1 -2
- package/schema/schema.service.d.ts +1 -1
- package/search/search.model.d.ts +18 -17
- package/search/search.service.d.ts +7 -7
- package/sites/sites-maps/sites-maps.component.d.ts +1 -1
- package/sites/sites-measurements/sites-measurements.component.d.ts +1 -1
- package/sites/sites.model.d.ts +1 -1
- package/styles.scss +1 -1
- package/tags-input/defaultOptions.d.ts +25 -0
- package/tags-input/index.d.ts +277 -0
- package/tags-input/styles.sass +154 -0
- package/tags-input/templates/dropdown-item.d.ts +2 -0
- package/tags-input/templates/tag.d.ts +2 -0
- package/tags-input/templates/wrapper.d.ts +2 -0
- package/tags-input/utils/component.d.ts +22 -0
- package/tags-input/utils/dom.d.ts +38 -0
- package/tags-input/utils/events.d.ts +72 -0
- package/tags-input/utils/type.d.ts +17 -0
- package/tags-input/utils/uuid.d.ts +2 -0
- package/terms/terms.model.d.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/router'), require('@ng-bootstrap/ng-bootstrap'), require('@angular/google-maps'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-regular-svg-icons'), require('@fortawesome/free-solid-svg-icons'), require('random-material-color'), require('@hestia-earth/schema'), require('@hestia-earth/api'), require('@hestia-earth/utils'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@hestia-earth/ui-components', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/router', '@ng-bootstrap/ng-bootstrap', '@angular/google-maps', '@fortawesome/angular-fontawesome', '@fortawesome/free-regular-svg-icons', '@fortawesome/free-solid-svg-icons', 'random-material-color', '@hestia-earth/schema', '@hestia-earth/api', '@hestia-earth/utils', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["hestia-earth"] = global["hestia-earth"] || {}, global["hestia-earth"]["ui-components"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.router, global.i10, global.ng.googleMaps, global.i1, global.freeRegularSvgIcons, global.freeSolidSvgIcons, global.randomMaterialColor, global.schema, global.api, global.utils, global.
|
|
5
|
-
})(this, (function (exports, i0, i3, i1$
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/router'), require('@ng-bootstrap/ng-bootstrap'), require('@angular/google-maps'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-regular-svg-icons'), require('@fortawesome/free-solid-svg-icons'), require('@angular/platform-browser'), require('rxjs'), require('random-material-color'), require('@hestia-earth/schema'), require('@hestia-earth/api'), require('@hestia-earth/utils'), require('pluralize'), require('rxjs/operators'), require('csvtojson'), require('@angular/common/http'), require('json-2-csv'), require('@angular/cdk/drag-drop'), require('@hestia-earth/schema-convert'), require('@hestia-earth/json-schema/schema-utils'), require('jsondiffpatch'), require('chart.js'), require('moment'), require('moment/locale/en-gb'), require('uuid'), require('@google/markerclustererplus'), require('chartjs-plugin-datalabels')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@hestia-earth/ui-components', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/router', '@ng-bootstrap/ng-bootstrap', '@angular/google-maps', '@fortawesome/angular-fontawesome', '@fortawesome/free-regular-svg-icons', '@fortawesome/free-solid-svg-icons', '@angular/platform-browser', 'rxjs', 'random-material-color', '@hestia-earth/schema', '@hestia-earth/api', '@hestia-earth/utils', 'pluralize', 'rxjs/operators', 'csvtojson', '@angular/common/http', 'json-2-csv', '@angular/cdk/drag-drop', '@hestia-earth/schema-convert', '@hestia-earth/json-schema/schema-utils', 'jsondiffpatch', 'chart.js', 'moment', 'moment/locale/en-gb', 'uuid', '@google/markerclustererplus', 'chartjs-plugin-datalabels'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["hestia-earth"] = global["hestia-earth"] || {}, global["hestia-earth"]["ui-components"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.router, global.i10, global.ng.googleMaps, global.i1, global.freeRegularSvgIcons, global.freeSolidSvgIcons, global.ng.platformBrowser, global.rxjs, global.randomMaterialColor, global.schema, global.api, global.utils, global.pluralize, global.rxjs.operators, global.csvtojson, global.ng.common.http, global.json2Csv, global.ng.cdk.dragDrop, global.schemaConvert, global.schemaUtils, global.jsondiffpatch, global.chart_js, global.moment, null, global.uuid$1, global.MarkerClusterer, global.ChartDataLabels));
|
|
5
|
+
})(this, (function (exports, i0, i3, i1$2, i4, i10, i1$4, i1, freeRegularSvgIcons, freeSolidSvgIcons, i1$1, rxjs, randomMaterialColor, schema, api, utils, pluralize, operators, csvtojson, i1$3, json2Csv, i6, schemaConvert, schemaUtils, jsondiffpatch, chart_js, moment, enGb, uuid$1, MarkerClusterer, ChartDataLabels) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -26,16 +26,15 @@
|
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
28
|
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
|
29
|
-
var i1__namespace$4 = /*#__PURE__*/_interopNamespace(i1$
|
|
29
|
+
var i1__namespace$4 = /*#__PURE__*/_interopNamespace(i1$2);
|
|
30
30
|
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
31
31
|
var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
|
|
32
|
-
var i1__namespace$
|
|
32
|
+
var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$4);
|
|
33
33
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
34
|
-
var csvtojson__namespace = /*#__PURE__*/_interopNamespace(csvtojson);
|
|
35
34
|
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
36
|
-
var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
|
|
37
35
|
var pluralize__namespace = /*#__PURE__*/_interopNamespace(pluralize);
|
|
38
|
-
var
|
|
36
|
+
var csvtojson__namespace = /*#__PURE__*/_interopNamespace(csvtojson);
|
|
37
|
+
var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$3);
|
|
39
38
|
var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
|
|
40
39
|
var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
|
|
41
40
|
var MarkerClusterer__default = /*#__PURE__*/_interopDefaultLegacy(MarkerClusterer);
|
|
@@ -417,8 +416,163 @@
|
|
|
417
416
|
}]
|
|
418
417
|
}], ctorParameters: function () { return [{ type: i1__namespace.FaIconLibrary }]; } });
|
|
419
418
|
|
|
419
|
+
var SocialTagsComponent = /** @class */ (function () {
|
|
420
|
+
function SocialTagsComponent(meta) {
|
|
421
|
+
this.meta = meta;
|
|
422
|
+
this.config = {};
|
|
423
|
+
this.classes = 'is-hidden';
|
|
424
|
+
}
|
|
425
|
+
SocialTagsComponent.prototype.ngOnInit = function () {
|
|
426
|
+
var _this = this;
|
|
427
|
+
this.meta.addTag({ charset: 'UTF-8' });
|
|
428
|
+
var config = Object.assign({ 'og:url': window.location.href.split('?')[0] }, this.config);
|
|
429
|
+
Object.keys(config).map(function (name) {
|
|
430
|
+
var content = config[name];
|
|
431
|
+
_this.meta.updateTag({ name: name, content: content });
|
|
432
|
+
if (name === 'og:description') {
|
|
433
|
+
_this.meta.updateTag({ name: 'description', content: content });
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
return SocialTagsComponent;
|
|
438
|
+
}());
|
|
439
|
+
SocialTagsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SocialTagsComponent, deps: [{ token: i1__namespace$1.Meta }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
440
|
+
SocialTagsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SocialTagsComponent, selector: "he-social-tags", inputs: { config: "config" }, host: { properties: { "class": "this.classes" } }, ngImport: i0__namespace, template: "<span></span>\n", styles: [""] });
|
|
441
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SocialTagsComponent, decorators: [{
|
|
442
|
+
type: i0.Component,
|
|
443
|
+
args: [{
|
|
444
|
+
selector: 'he-social-tags',
|
|
445
|
+
templateUrl: './social-tags.component.html',
|
|
446
|
+
styleUrls: ['./social-tags.component.scss']
|
|
447
|
+
}]
|
|
448
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.Meta }]; }, propDecorators: { config: [{
|
|
449
|
+
type: i0.Input
|
|
450
|
+
}], classes: [{
|
|
451
|
+
type: i0.HostBinding,
|
|
452
|
+
args: ['class']
|
|
453
|
+
}] } });
|
|
454
|
+
|
|
455
|
+
var toastId = 0;
|
|
456
|
+
var HeToastService = /** @class */ (function () {
|
|
457
|
+
function HeToastService() {
|
|
458
|
+
this.toasts = new rxjs.ReplaySubject(1);
|
|
459
|
+
}
|
|
460
|
+
HeToastService.prototype.success = function (message, duration) {
|
|
461
|
+
if (duration === void 0) { duration = 3000; }
|
|
462
|
+
this.toasts.next({
|
|
463
|
+
id: ++toastId,
|
|
464
|
+
message: message,
|
|
465
|
+
duration: duration,
|
|
466
|
+
color: 'success',
|
|
467
|
+
showRawMessage: true
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
HeToastService.prototype.error = function (message, showRawMessage, duration) {
|
|
471
|
+
if (showRawMessage === void 0) { showRawMessage = true; }
|
|
472
|
+
if (duration === void 0) { duration = 3000; }
|
|
473
|
+
this.toasts.next({
|
|
474
|
+
id: ++toastId,
|
|
475
|
+
message: ("" + message || '').trim(),
|
|
476
|
+
duration: duration,
|
|
477
|
+
color: 'danger',
|
|
478
|
+
showRawMessage: showRawMessage
|
|
479
|
+
});
|
|
480
|
+
};
|
|
481
|
+
return HeToastService;
|
|
482
|
+
}());
|
|
483
|
+
HeToastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeToastService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
484
|
+
HeToastService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeToastService, providedIn: 'root' });
|
|
485
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeToastService, decorators: [{
|
|
486
|
+
type: i0.Injectable,
|
|
487
|
+
args: [{
|
|
488
|
+
providedIn: 'root'
|
|
489
|
+
}]
|
|
490
|
+
}] });
|
|
491
|
+
|
|
492
|
+
var ToastComponent = /** @class */ (function () {
|
|
493
|
+
function ToastComponent(toastService) {
|
|
494
|
+
this.toastService = toastService;
|
|
495
|
+
this.subscriptions = [];
|
|
496
|
+
this.toasts = [];
|
|
497
|
+
}
|
|
498
|
+
ToastComponent.prototype.ngOnInit = function () {
|
|
499
|
+
var _this = this;
|
|
500
|
+
this.subscriptions.push(this.toastService.toasts.subscribe(function (toast) { return _this.add(toast); }));
|
|
501
|
+
};
|
|
502
|
+
ToastComponent.prototype.ngOnDestroy = function () {
|
|
503
|
+
this.subscriptions.forEach(function (subscription) { return subscription.unsubscribe(); });
|
|
504
|
+
};
|
|
505
|
+
ToastComponent.prototype.add = function (toast) {
|
|
506
|
+
var _this = this;
|
|
507
|
+
this.toasts.push(toast);
|
|
508
|
+
if (toast.duration) {
|
|
509
|
+
toast.timeout = setTimeout(function () { return _this.dismiss(toast); }, toast.duration);
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
ToastComponent.prototype.dismiss = function (toast) {
|
|
513
|
+
this.toasts.splice(this.toasts.findIndex(function (val) { return val.id === toast.id; }), 1);
|
|
514
|
+
};
|
|
515
|
+
return ToastComponent;
|
|
516
|
+
}());
|
|
517
|
+
ToastComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ToastComponent, deps: [{ token: HeToastService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
518
|
+
ToastComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ToastComponent, selector: "he-toast", ngImport: i0__namespace, template: "<div class=\"mb-3 columns is-centered is-vcentered\">\n <div class=\"notification is-{{toast.color}}\" role=\"alert\" *ngFor=\"let toast of toasts\">\n <button class=\"delete\" aria-label=\"delete\" (click)=\"dismiss(toast)\">\n <span aria-hidden=\"true\">×</span>\n </button>\n <strong [ngSwitch]=\"toast.color\">\n <ng-container *ngSwitchCase=\"'danger'\">\n <ng-container [ngSwitch]=\"toast.message\">\n <span *ngSwitchCase=\"'Unauthorized'\">You are not allowed to perform this action.</span>\n <span *ngSwitchCase=\"'form-invalid'\">Please fix all the errors on this page.</span>\n <span *ngSwitchCase=\"'users-email-already-taken'\">Email already taken.</span>\n <span *ngSwitchCase=\"'users-auth-already-taken'\">Account already connected.</span>\n <span *ngSwitchDefault>\n <span *ngIf=\"toast.showRawMessage\">{{toast.message}}</span>\n <span [class.is-hidden]=\"toast.showRawMessage\">An unknown error occurred. Please try again later.</span>\n </span>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <span *ngIf=\"toast.showRawMessage\">{{toast.message}}</span>\n <span [class.is-hidden]=\"toast.showRawMessage\">An unknown error occurred. Please try again later.</span>\n </ng-container>\n </strong>\n </div>\n</div>\n", styles: [":host{bottom:0;position:fixed;width:100%}\n"], directives: [{ type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
519
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ToastComponent, decorators: [{
|
|
520
|
+
type: i0.Component,
|
|
521
|
+
args: [{
|
|
522
|
+
selector: 'he-toast',
|
|
523
|
+
templateUrl: './toast.component.html',
|
|
524
|
+
styleUrls: ['./toast.component.scss']
|
|
525
|
+
}]
|
|
526
|
+
}], ctorParameters: function () { return [{ type: HeToastService }]; } });
|
|
527
|
+
|
|
528
|
+
/* eslint-disable @angular-eslint/directive-selector */
|
|
529
|
+
var BindOnceDirective = /** @class */ (function () {
|
|
530
|
+
function BindOnceDirective(templateRef, viewContainerRef) {
|
|
531
|
+
this.embeddedViewRef = viewContainerRef.createEmbeddedView(templateRef);
|
|
532
|
+
this.embeddedViewRef.detach();
|
|
533
|
+
}
|
|
534
|
+
BindOnceDirective.prototype.ngOnChanges = function () {
|
|
535
|
+
this.embeddedViewRef.detectChanges();
|
|
536
|
+
};
|
|
537
|
+
return BindOnceDirective;
|
|
538
|
+
}());
|
|
539
|
+
BindOnceDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BindOnceDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
540
|
+
BindOnceDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: BindOnceDirective, selector: "[bindOnce]", inputs: { bindOnce: "bindOnce" }, usesOnChanges: true, ngImport: i0__namespace });
|
|
541
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BindOnceDirective, decorators: [{
|
|
542
|
+
type: i0.Directive,
|
|
543
|
+
args: [{
|
|
544
|
+
selector: '[bindOnce]'
|
|
545
|
+
}]
|
|
546
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: i0__namespace.ViewContainerRef }]; }, propDecorators: { bindOnce: [{
|
|
547
|
+
type: i0.Input
|
|
548
|
+
}] } });
|
|
549
|
+
|
|
550
|
+
var shouldDefault = {
|
|
551
|
+
string: function (value) { return !value; },
|
|
552
|
+
number: function (value) { return !value && value !== 0; },
|
|
553
|
+
boolean: function (value) { return !value; },
|
|
554
|
+
object: function (value) { return !value || !Object.keys(value).length; },
|
|
555
|
+
undefined: function () { return true; }
|
|
556
|
+
};
|
|
557
|
+
var DefaultPipe = /** @class */ (function () {
|
|
558
|
+
function DefaultPipe() {
|
|
559
|
+
}
|
|
560
|
+
DefaultPipe.prototype.transform = function (value, defaultValue) {
|
|
561
|
+
return shouldDefault[typeof value](value) ? defaultValue : value;
|
|
562
|
+
};
|
|
563
|
+
return DefaultPipe;
|
|
564
|
+
}());
|
|
565
|
+
DefaultPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DefaultPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
566
|
+
DefaultPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DefaultPipe, name: "default" });
|
|
567
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DefaultPipe, decorators: [{
|
|
568
|
+
type: i0.Pipe,
|
|
569
|
+
args: [{
|
|
570
|
+
name: 'default'
|
|
571
|
+
}]
|
|
572
|
+
}] });
|
|
573
|
+
|
|
420
574
|
var _a$6;
|
|
421
|
-
var get$
|
|
575
|
+
var get$5 = require('lodash.get');
|
|
422
576
|
var gitHome = 'https://gitlab.com/hestia-earth';
|
|
423
577
|
var gitRawBaseUrl = 'https://glcdn.githack.com/hestia-earth';
|
|
424
578
|
var gitBranch = function () { return ['dev', 'staging'].some(function (env) { return baseUrl().includes(env); }) ? 'develop' : 'master'; };
|
|
@@ -429,9 +583,8 @@
|
|
|
429
583
|
window.location.origin :
|
|
430
584
|
'https://www.hestia.earth'; };
|
|
431
585
|
var isExternal = function () { return baseUrl() !== window.location.origin; };
|
|
432
|
-
;
|
|
433
586
|
var parseErrorStatus = function (error) { return ((error === null || error === void 0 ? void 0 : error.statusText) || '').toLowerCase().replace(/\s/g, '-'); };
|
|
434
|
-
var parseErrorMessage = function (error) { return get$
|
|
587
|
+
var parseErrorMessage = function (error) { return get$5(error, 'error.error', get$5(error, 'error.message', get$5(error, 'error', get$5(error, 'message', error)))); };
|
|
435
588
|
var handleAPIError = function (error) {
|
|
436
589
|
try {
|
|
437
590
|
error = parseErrorMessage(error);
|
|
@@ -533,7 +686,7 @@
|
|
|
533
686
|
group[termId].values[nodeId].nodes.push(blankNode);
|
|
534
687
|
group[termId].values[nodeId].value = concatBlankNodeValue(group[termId].values[nodeId].value, blankNode.value);
|
|
535
688
|
grouppedValueKeys.forEach(function (arrayKey) {
|
|
536
|
-
var newValue = get$
|
|
689
|
+
var newValue = get$5(blankNode, arrayKey, []);
|
|
537
690
|
group[termId].values[nodeId][arrayKey] = __spreadArray(__spreadArray([], __read((group[termId].values[nodeId][arrayKey] || []))), __read((Array.isArray(newValue) ? newValue : [newValue])));
|
|
538
691
|
});
|
|
539
692
|
return group;
|
|
@@ -543,7 +696,7 @@
|
|
|
543
696
|
Object.keys(group.values).map(function (nodeId) {
|
|
544
697
|
var index = group.values[nodeId].index;
|
|
545
698
|
var termId = group.term['@id'];
|
|
546
|
-
var originalValue = get$
|
|
699
|
+
var originalValue = get$5(originalValues, "[" + index + "]." + key, []).filter(function (val) { return val.term['@id'] === termId; });
|
|
547
700
|
if (originalValue.length > 0) {
|
|
548
701
|
var value = originalValue.reduce(function (array, curr) { return concatBlankNodeValue(array, curr.value); }, []);
|
|
549
702
|
group.originalValues[nodeId] = { value: propertyValue$1(value) };
|
|
@@ -623,176 +776,24 @@
|
|
|
623
776
|
return file.endsWith('.') ? file.substring(0, file.length - 1) : file;
|
|
624
777
|
};
|
|
625
778
|
|
|
626
|
-
var
|
|
627
|
-
|
|
628
|
-
var WARNING_CRITERION_MAX_DELTA_PERCENT = 20;
|
|
629
|
-
exports.DeltaColour = void 0;
|
|
630
|
-
(function (DeltaColour) {
|
|
631
|
-
DeltaColour["Success"] = "success";
|
|
632
|
-
DeltaColour["Warning"] = "warning";
|
|
633
|
-
DeltaColour["Danger"] = "danger";
|
|
634
|
-
})(exports.DeltaColour || (exports.DeltaColour = {}));
|
|
635
|
-
exports.DeltaDisplayType = void 0;
|
|
636
|
-
(function (DeltaDisplayType) {
|
|
637
|
-
DeltaDisplayType["absolute"] = "absolute";
|
|
638
|
-
DeltaDisplayType["percent"] = "percent";
|
|
639
|
-
})(exports.DeltaDisplayType || (exports.DeltaDisplayType = {}));
|
|
640
|
-
var deltaPerType = (_a$5 = {},
|
|
641
|
-
_a$5[exports.DeltaDisplayType.absolute] = function (value, original) { return value - original; },
|
|
642
|
-
_a$5[exports.DeltaDisplayType.percent] = function (value, original) { return ((value - original) / original) * 100; },
|
|
643
|
-
_a$5);
|
|
644
|
-
var roundValue = function (value) { return +("" + value).substring(0, 10); };
|
|
645
|
-
var delta = function (value, originalValue, displayType, mapping) {
|
|
646
|
-
if (displayType === void 0) { displayType = exports.DeltaDisplayType.percent; }
|
|
647
|
-
var vvalue = roundValue(propertyValue$1(value));
|
|
648
|
-
var voriginalValue = roundValue(propertyValue$1(originalValue));
|
|
649
|
-
var deltaFuncs = Object.assign(Object.assign({}, deltaPerType), mapping);
|
|
650
|
-
var diff = vvalue === voriginalValue ? 0 : deltaFuncs[displayType](vvalue, voriginalValue);
|
|
651
|
-
return Number.isFinite(diff) ? (diff === -0 ? 0 : diff) : 0;
|
|
652
|
-
};
|
|
653
|
-
var PercentDeltaConditions;
|
|
654
|
-
(function (PercentDeltaConditions) {
|
|
655
|
-
PercentDeltaConditions["recalculated0"] = "recalculated should be 0";
|
|
656
|
-
PercentDeltaConditions["original0"] = "original is 0";
|
|
657
|
-
})(PercentDeltaConditions || (PercentDeltaConditions = {}));
|
|
658
|
-
var calculatePercentDeltaConditions = (_b$2 = {},
|
|
659
|
-
_b$2[PercentDeltaConditions.recalculated0] = function (original, recalculated) { return original > 0 && recalculated === 0; },
|
|
660
|
-
_b$2[PercentDeltaConditions.original0] = function (original, recalculated) { return original === 0 && recalculated > 0; },
|
|
661
|
-
_b$2);
|
|
662
|
-
var calculatePercentDeltaResult = (_c$2 = {},
|
|
663
|
-
_c$2[PercentDeltaConditions.recalculated0] = function (original, recalculated) { return (recalculated - original) / (original + 1); },
|
|
664
|
-
// Always considered an error so deliberately exceed SUCCESS_CRITERION_MAX_DELTA_PERCENT
|
|
665
|
-
_c$2[PercentDeltaConditions.original0] = function (original, recalculated) { return Math.sign(recalculated - original); },
|
|
666
|
-
_c$2.default = function (original, recalculated) { return (recalculated - original) / original; },
|
|
667
|
-
_c$2);
|
|
668
|
-
var calculatePercentDelta = function (recalculated, original) {
|
|
669
|
-
var matchingCondition = Object.values(PercentDeltaConditions).find(function (value) { return calculatePercentDeltaConditions[value](original, recalculated); }) || 'default';
|
|
670
|
-
return calculatePercentDeltaResult[matchingCondition](original, recalculated) * 100;
|
|
671
|
-
};
|
|
672
|
-
var customDeltaFuncs = (_d$2 = {},
|
|
673
|
-
_d$2[exports.DeltaDisplayType.percent] = calculatePercentDelta,
|
|
674
|
-
_d$2);
|
|
675
|
-
var evaluateSuccess = function (deltaValue) { return Math.abs(deltaValue) < SUCCESS_CRITERION_MAX_DELTA_PERCENT
|
|
676
|
-
? exports.DeltaColour.Success
|
|
677
|
-
: Math.abs(deltaValue) < WARNING_CRITERION_MAX_DELTA_PERCENT
|
|
678
|
-
? exports.DeltaColour.Warning
|
|
679
|
-
: exports.DeltaColour.Danger; };
|
|
680
|
-
|
|
681
|
-
/* eslint-disable @angular-eslint/directive-selector */
|
|
682
|
-
var BindOnceDirective = /** @class */ (function () {
|
|
683
|
-
function BindOnceDirective(templateRef, viewContainerRef) {
|
|
684
|
-
this.embeddedViewRef = viewContainerRef.createEmbeddedView(templateRef);
|
|
685
|
-
this.embeddedViewRef.detach();
|
|
686
|
-
}
|
|
687
|
-
BindOnceDirective.prototype.ngOnChanges = function () {
|
|
688
|
-
this.embeddedViewRef.detectChanges();
|
|
689
|
-
};
|
|
690
|
-
return BindOnceDirective;
|
|
691
|
-
}());
|
|
692
|
-
BindOnceDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BindOnceDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
693
|
-
BindOnceDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: BindOnceDirective, selector: "[bindOnce]", inputs: { bindOnce: "bindOnce" }, usesOnChanges: true, ngImport: i0__namespace });
|
|
694
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BindOnceDirective, decorators: [{
|
|
695
|
-
type: i0.Directive,
|
|
696
|
-
args: [{
|
|
697
|
-
selector: '[bindOnce]'
|
|
698
|
-
}]
|
|
699
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: i0__namespace.ViewContainerRef }]; }, propDecorators: { bindOnce: [{
|
|
700
|
-
type: i0.Input
|
|
701
|
-
}] } });
|
|
702
|
-
|
|
703
|
-
var PrecisionPipe = /** @class */ (function () {
|
|
704
|
-
function PrecisionPipe() {
|
|
779
|
+
var EllipsisPipe = /** @class */ (function () {
|
|
780
|
+
function EllipsisPipe() {
|
|
705
781
|
}
|
|
706
|
-
|
|
707
|
-
return
|
|
708
|
-
null : (utils.isNumber(value) ?
|
|
709
|
-
("" + utils.toPrecision(parseFloat("" + value), parseInt("" + precision, 10))).replace(/\.00$/, '') :
|
|
710
|
-
value);
|
|
782
|
+
EllipsisPipe.prototype.transform = function (value, maxLength) {
|
|
783
|
+
return ellipsis("" + value, maxLength);
|
|
711
784
|
};
|
|
712
|
-
return
|
|
785
|
+
return EllipsisPipe;
|
|
713
786
|
}());
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type:
|
|
787
|
+
EllipsisPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: EllipsisPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
788
|
+
EllipsisPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: EllipsisPipe, name: "ellipsis" });
|
|
789
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: EllipsisPipe, decorators: [{
|
|
717
790
|
type: i0.Pipe,
|
|
718
791
|
args: [{
|
|
719
|
-
name: '
|
|
792
|
+
name: 'ellipsis'
|
|
720
793
|
}]
|
|
721
794
|
}] });
|
|
722
795
|
|
|
723
|
-
var
|
|
724
|
-
function BlankNodeValueDeltaComponent() {
|
|
725
|
-
this.displayType = exports.DeltaDisplayType.percent;
|
|
726
|
-
this.DeltaDisplayType = exports.DeltaDisplayType;
|
|
727
|
-
}
|
|
728
|
-
Object.defineProperty(BlankNodeValueDeltaComponent.prototype, "hide", {
|
|
729
|
-
get: function () {
|
|
730
|
-
return emptyValue(this.value) || emptyValue(this.originalValue);
|
|
731
|
-
},
|
|
732
|
-
enumerable: false,
|
|
733
|
-
configurable: true
|
|
734
|
-
});
|
|
735
|
-
Object.defineProperty(BlankNodeValueDeltaComponent.prototype, "delta", {
|
|
736
|
-
get: function () {
|
|
737
|
-
return delta(this.value, this.originalValue, this.displayType, customDeltaFuncs);
|
|
738
|
-
},
|
|
739
|
-
enumerable: false,
|
|
740
|
-
configurable: true
|
|
741
|
-
});
|
|
742
|
-
Object.defineProperty(BlankNodeValueDeltaComponent.prototype, "color", {
|
|
743
|
-
get: function () {
|
|
744
|
-
return this.displayType === exports.DeltaDisplayType.percent ? evaluateSuccess(this.delta) : '';
|
|
745
|
-
},
|
|
746
|
-
enumerable: false,
|
|
747
|
-
configurable: true
|
|
748
|
-
});
|
|
749
|
-
return BlankNodeValueDeltaComponent;
|
|
750
|
-
}());
|
|
751
|
-
BlankNodeValueDeltaComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlankNodeValueDeltaComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
752
|
-
BlankNodeValueDeltaComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: BlankNodeValueDeltaComponent, selector: "he-blank-node-value-delta", inputs: { value: "value", originalValue: "originalValue", displayType: "displayType" }, ngImport: i0__namespace, template: "<small [class.is-hidden]=\"hide\">\n <span class=\"has-text-{{color}}\">\n <span *ngIf=\"delta > 0\">+</span>\n <ng-container [ngSwitch]=\"displayType\">\n <ng-container *ngSwitchCase=\"DeltaDisplayType.absolute\">\n <span *bindOnce=\"delta\">{{delta | precision:3}}</span>\n </ng-container>\n <ng-container *ngSwitchCase=\"DeltaDisplayType.percent\">\n <span *bindOnce=\"delta\">{{delta | number:'1.0-2'}}</span>\n <span>%</span>\n </ng-container>\n </ng-container>\n </span>\n</small>\n", styles: [""], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }], pipes: { "precision": PrecisionPipe, "number": i3__namespace.DecimalPipe } });
|
|
753
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlankNodeValueDeltaComponent, decorators: [{
|
|
754
|
-
type: i0.Component,
|
|
755
|
-
args: [{
|
|
756
|
-
selector: 'he-blank-node-value-delta',
|
|
757
|
-
templateUrl: './blank-node-value-delta.component.html',
|
|
758
|
-
styleUrls: ['./blank-node-value-delta.component.scss']
|
|
759
|
-
}]
|
|
760
|
-
}], propDecorators: { value: [{
|
|
761
|
-
type: i0.Input
|
|
762
|
-
}], originalValue: [{
|
|
763
|
-
type: i0.Input
|
|
764
|
-
}], displayType: [{
|
|
765
|
-
type: i0.Input
|
|
766
|
-
}] } });
|
|
767
|
-
|
|
768
|
-
var BlankNodeDiffsComponent = /** @class */ (function () {
|
|
769
|
-
function BlankNodeDiffsComponent() {
|
|
770
|
-
this.originalValues = [];
|
|
771
|
-
this.recalculatedValues = [];
|
|
772
|
-
this.propertyValue = propertyValue$1;
|
|
773
|
-
this.values = [];
|
|
774
|
-
}
|
|
775
|
-
BlankNodeDiffsComponent.prototype.ngOnInit = function () {
|
|
776
|
-
this.values = formatDiffValues(this.originalValues, this.recalculatedValues);
|
|
777
|
-
};
|
|
778
|
-
return BlankNodeDiffsComponent;
|
|
779
|
-
}());
|
|
780
|
-
BlankNodeDiffsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlankNodeDiffsComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
781
|
-
BlankNodeDiffsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: BlankNodeDiffsComponent, selector: "he-blank-node-diffs", inputs: { originalValues: "originalValues", recalculatedValues: "recalculatedValues" }, ngImport: i0__namespace, template: "<div class=\"table-container data-table-container mb-1\">\n <table class=\"table is-narrow data-table has-children-3\" *bindOnce=\"values\">\n <thead>\n <tr>\n <th class=\"width-auto\"></th>\n <th>Original</th>\n <th>Recalculated</th>\n <th>Difference</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let value of values\"\n [class.has-background-light]=\"!!value.original && value.original !== value.recalculated\"\n >\n <td class=\"width-auto\" [attr.title]=\"value.term.name\">\n <ng-container *ngTemplateOutlet=\"termLink; context: {$implicit: value.term}\"></ng-container>\n </td>\n <td>\n <span>{{value.original === undefined ? '-' : value.original}}</span>\n </td>\n <td>\n <span>{{value.recalculated === undefined ? '-' : value.recalculated}}</span>\n </td>\n <td class=\"is-nowrap\">\n <he-blank-node-value-delta\n [value]=\"value.recalculated\"\n [originalValue]=\"value.original\"\n ></he-blank-node-value-delta>\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n\n<ng-template #termLink let-term>\n <a [routerLink]=\"['/', 'term', term['@id']]\" target=\"_blank\">\n <span class=\"is-nowrap has-text-ellipsis\">{{term.name}}</span>\n </a>\n</ng-template>\n", styles: ["table.data-table th:first-child,table.data-table td:first-child{width:auto}\n"], components: [{ type: BlankNodeValueDeltaComponent, selector: "he-blank-node-value-delta", inputs: ["value", "originalValue", "displayType"] }], directives: [{ type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4__namespace.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }] });
|
|
782
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlankNodeDiffsComponent, decorators: [{
|
|
783
|
-
type: i0.Component,
|
|
784
|
-
args: [{
|
|
785
|
-
selector: 'he-blank-node-diffs',
|
|
786
|
-
templateUrl: './blank-node-diffs.component.html',
|
|
787
|
-
styleUrls: ['./blank-node-diffs.component.scss']
|
|
788
|
-
}]
|
|
789
|
-
}], propDecorators: { originalValues: [{
|
|
790
|
-
type: i0.Input
|
|
791
|
-
}], recalculatedValues: [{
|
|
792
|
-
type: i0.Input
|
|
793
|
-
}] } });
|
|
794
|
-
|
|
795
|
-
var _a$4, _b$1, _c$1;
|
|
796
|
+
var _a$5, _b$2, _c$2;
|
|
796
797
|
var termProperties = function (term) { return Object.keys(term).filter(function (key) { return !schema.isExpandable(term[key]) && ![
|
|
797
798
|
'pinned', 'expanded', 'extended', 'selected', 'loading',
|
|
798
799
|
'_score', '@type', '@id', '@context', 'createdAt',
|
|
@@ -818,20 +819,20 @@
|
|
|
818
819
|
lng: longitude
|
|
819
820
|
});
|
|
820
821
|
};
|
|
821
|
-
var termTypeToLabel = (_a$
|
|
822
|
-
_a$
|
|
823
|
-
_a$
|
|
824
|
-
_a$
|
|
825
|
-
_a$
|
|
826
|
-
_a$
|
|
827
|
-
_a$
|
|
822
|
+
var termTypeToLabel = (_a$5 = {},
|
|
823
|
+
_a$5[schema.TermTermType.methodEmissionResourceUse] = 'Method (Emissions)',
|
|
824
|
+
_a$5[schema.TermTermType.methodMeasurement] = 'Method (Measurement)',
|
|
825
|
+
_a$5[schema.TermTermType.pesticideAI] = 'Pesticide Active Ingredient',
|
|
826
|
+
_a$5[schema.TermTermType.standardsLabels] = 'Standards & Labels',
|
|
827
|
+
_a$5[schema.TermTermType.usdaSoilType] = 'USDA Soil Type',
|
|
828
|
+
_a$5);
|
|
828
829
|
var termTypeLabel = function (type) {
|
|
829
830
|
if (type === void 0) { type = 'N/A'; }
|
|
830
831
|
return type in termTypeToLabel ? termTypeToLabel[type] : keyToLabel(type);
|
|
831
832
|
};
|
|
832
833
|
var termTypesToChildren = function (termTypes) { return termTypes.map(function (termType) { return ({ label: termTypeLabel(termType), termType: termType }); }); };
|
|
833
|
-
var groups = Object.freeze((_b$
|
|
834
|
-
_b$
|
|
834
|
+
var groups = Object.freeze((_b$2 = {},
|
|
835
|
+
_b$2[schema.TermTermType.emission] = {
|
|
835
836
|
label: 'Emissions & Resource Use',
|
|
836
837
|
termType: 'Emissions & Resource Use',
|
|
837
838
|
children: termTypesToChildren([
|
|
@@ -843,12 +844,12 @@
|
|
|
843
844
|
schema.TermTermType.methodEmissionResourceUse
|
|
844
845
|
])
|
|
845
846
|
},
|
|
846
|
-
_b$
|
|
847
|
+
_b$2[schema.TermTermType.region] = {
|
|
847
848
|
label: termTypeLabel(schema.TermTermType.region),
|
|
848
849
|
termType: schema.TermTermType.region,
|
|
849
850
|
children: []
|
|
850
851
|
},
|
|
851
|
-
_b$
|
|
852
|
+
_b$2.infrastructure = {
|
|
852
853
|
label: 'Infrastructure & Equipment',
|
|
853
854
|
termType: 'Infrastructure & Equipment',
|
|
854
855
|
children: termTypesToChildren([
|
|
@@ -859,7 +860,7 @@
|
|
|
859
860
|
schema.TermTermType.machinery
|
|
860
861
|
])
|
|
861
862
|
},
|
|
862
|
-
_b$
|
|
863
|
+
_b$2.input = {
|
|
863
864
|
label: 'Inputs',
|
|
864
865
|
termType: 'Inputs',
|
|
865
866
|
children: termTypesToChildren([
|
|
@@ -877,7 +878,7 @@
|
|
|
877
878
|
schema.TermTermType.water
|
|
878
879
|
])
|
|
879
880
|
},
|
|
880
|
-
_b$
|
|
881
|
+
_b$2[schema.TermTermType.measurement] = {
|
|
881
882
|
label: 'Measurements',
|
|
882
883
|
termType: 'Measurements',
|
|
883
884
|
children: termTypesToChildren([
|
|
@@ -888,7 +889,7 @@
|
|
|
888
889
|
schema.TermTermType.methodMeasurement
|
|
889
890
|
])
|
|
890
891
|
},
|
|
891
|
-
_b$
|
|
892
|
+
_b$2.practice = {
|
|
892
893
|
label: 'Practices',
|
|
893
894
|
termType: 'Production Practices',
|
|
894
895
|
children: termTypesToChildren([
|
|
@@ -906,7 +907,7 @@
|
|
|
906
907
|
schema.TermTermType.waterRegime,
|
|
907
908
|
])
|
|
908
909
|
},
|
|
909
|
-
_b$
|
|
910
|
+
_b$2.product = {
|
|
910
911
|
label: 'Products',
|
|
911
912
|
termType: 'Products',
|
|
912
913
|
children: termTypesToChildren([
|
|
@@ -919,12 +920,12 @@
|
|
|
919
920
|
schema.TermTermType.processedFood
|
|
920
921
|
])
|
|
921
922
|
},
|
|
922
|
-
_b$
|
|
923
|
+
_b$2[schema.TermTermType.property] = {
|
|
923
924
|
label: termTypeLabel(schema.TermTermType.property),
|
|
924
925
|
termType: schema.TermTermType.property,
|
|
925
926
|
children: []
|
|
926
927
|
},
|
|
927
|
-
_b$
|
|
928
|
+
_b$2));
|
|
928
929
|
var termTypeGroups = [
|
|
929
930
|
groups.property,
|
|
930
931
|
groups.region,
|
|
@@ -935,10 +936,10 @@
|
|
|
935
936
|
groups.measurement,
|
|
936
937
|
groups.infrastructure
|
|
937
938
|
];
|
|
938
|
-
var termToParent = (_c$
|
|
939
|
-
_c$
|
|
940
|
-
_c$
|
|
941
|
-
_c$
|
|
939
|
+
var termToParent = (_c$2 = {},
|
|
940
|
+
_c$2[schema.TermTermType.property] = 'Properties',
|
|
941
|
+
_c$2[schema.TermTermType.region] = 'Geographies',
|
|
942
|
+
_c$2);
|
|
942
943
|
var termChildToParent = function (termType) { return termTypeGroups.find(function (_a) {
|
|
943
944
|
var children = _a.children;
|
|
944
945
|
return (children || []).some(function (child) { return child.termType === termType; });
|
|
@@ -993,267 +994,525 @@
|
|
|
993
994
|
schema.TermTermType.standardsLabels
|
|
994
995
|
];
|
|
995
996
|
|
|
996
|
-
var
|
|
997
|
-
|
|
998
|
-
function HeCommonService(_apiBaseUrl) {
|
|
999
|
-
this._apiBaseUrl = _apiBaseUrl;
|
|
997
|
+
var KeyToLabelPipe = /** @class */ (function () {
|
|
998
|
+
function KeyToLabelPipe() {
|
|
1000
999
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
configurable: true
|
|
1007
|
-
});
|
|
1008
|
-
return HeCommonService;
|
|
1000
|
+
KeyToLabelPipe.prototype.transform = function (value) {
|
|
1001
|
+
// using termTypeLabel here which defaults to `keyToLabel` function
|
|
1002
|
+
return termTypeLabel(value);
|
|
1003
|
+
};
|
|
1004
|
+
return KeyToLabelPipe;
|
|
1009
1005
|
}());
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type:
|
|
1013
|
-
type: i0.
|
|
1006
|
+
KeyToLabelPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KeyToLabelPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
1007
|
+
KeyToLabelPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KeyToLabelPipe, name: "keyToLabel" });
|
|
1008
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KeyToLabelPipe, decorators: [{
|
|
1009
|
+
type: i0.Pipe,
|
|
1014
1010
|
args: [{
|
|
1015
|
-
|
|
1011
|
+
name: 'keyToLabel'
|
|
1016
1012
|
}]
|
|
1017
|
-
}]
|
|
1018
|
-
return [{ type: undefined, decorators: [{
|
|
1019
|
-
type: i0.Inject,
|
|
1020
|
-
args: [HE_API_BASE_URL]
|
|
1021
|
-
}] }];
|
|
1022
|
-
} });
|
|
1013
|
+
}] });
|
|
1023
1014
|
|
|
1024
|
-
var
|
|
1025
|
-
|
|
1026
|
-
* Get the full url to fetch the node data.
|
|
1027
|
-
*
|
|
1028
|
-
* @param apiBaseUrl The url of the API hosting the data.
|
|
1029
|
-
* @param node The node with a type, id and optionally a dataState
|
|
1030
|
-
* @returns The full url.
|
|
1031
|
-
*/
|
|
1032
|
-
var nodeUrl = function (apiBaseUrl, _a) {
|
|
1033
|
-
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1034
|
-
return nodeTypeUrl(apiBaseUrl, node['@type'] || node.type) + "/" + (node['@id'] || node.id) + (dataState ? "?dataState=" + dataState : '');
|
|
1035
|
-
};
|
|
1036
|
-
var nodeLogsUrl = function (apiBaseUrl, _a) {
|
|
1037
|
-
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1038
|
-
return nodeUrl(apiBaseUrl, node) + "/log" + (dataState ? "?dataState=" + dataState : '');
|
|
1039
|
-
};
|
|
1040
|
-
var lookupUrl = function (filename) { return filename.startsWith('http') ? filename : baseUrl() + "/glossary/lookups/" + filename + ".csv"; };
|
|
1041
|
-
var termTypeLookupUrl = function (termType) { return baseUrl() + "/glossary/" + termChildToParent(termType).termType + "/" + termType + ".csv"; };
|
|
1042
|
-
var HeNodeService = /** @class */ (function () {
|
|
1043
|
-
function HeNodeService(http, authService, commonService) {
|
|
1044
|
-
this.http = http;
|
|
1045
|
-
this.authService = authService;
|
|
1046
|
-
this.commonService = commonService;
|
|
1015
|
+
var KeysPipe = /** @class */ (function () {
|
|
1016
|
+
function KeysPipe() {
|
|
1047
1017
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
HeNodeService.prototype.get = function (node, defaultForState) {
|
|
1056
|
-
if (defaultForState === void 0) { defaultForState = true; }
|
|
1057
|
-
return this.get$(node)
|
|
1058
|
-
.toPromise()
|
|
1059
|
-
.catch(function () { return node.dataState && defaultForState ? node : ({}); });
|
|
1060
|
-
};
|
|
1061
|
-
HeNodeService.prototype.getLog = function (_a) {
|
|
1062
|
-
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1063
|
-
return this.http.get(this.nodeUrl(node) + "/log", {
|
|
1064
|
-
headers: this.authService.headers,
|
|
1065
|
-
responseType: 'text',
|
|
1066
|
-
params: filterParams({ dataState: dataState })
|
|
1067
|
-
}).pipe(operators.catchError(function () { return rxjs.of(''); }));
|
|
1068
|
-
};
|
|
1069
|
-
HeNodeService.prototype.getMissingLookupsLog = function (_a) {
|
|
1070
|
-
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1071
|
-
return this.http.get(this.nodeUrl(node) + "/log/lookups", {
|
|
1072
|
-
headers: this.authService.headers,
|
|
1073
|
-
params: filterParams({ dataState: dataState })
|
|
1074
|
-
}).toPromise().catch(handleAPIError);
|
|
1075
|
-
};
|
|
1076
|
-
HeNodeService.prototype.getModelsLog = function (_a) {
|
|
1077
|
-
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1078
|
-
return this.http.get(this.nodeUrl(node) + "/log/models", {
|
|
1079
|
-
headers: this.authService.headers,
|
|
1080
|
-
params: filterParams({ dataState: dataState })
|
|
1081
|
-
}).toPromise().catch(handleAPIError);
|
|
1082
|
-
};
|
|
1083
|
-
HeNodeService.prototype.triggerPipeline = function (_a) {
|
|
1084
|
-
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1085
|
-
return this.http.post(this.nodeUrl(node) + "/pipeline", dataState ? { dataState: dataState } : {}, {
|
|
1086
|
-
headers: this.authService.headers
|
|
1087
|
-
}).toPromise().catch(handleAPIError);
|
|
1088
|
-
};
|
|
1089
|
-
HeNodeService.prototype.downloadRaw = function (url, responseType) {
|
|
1090
|
-
if (responseType === void 0) { responseType = 'json'; }
|
|
1091
|
-
return this.http.get(url, { responseType: responseType })
|
|
1092
|
-
.toPromise()
|
|
1093
|
-
.catch(function () { return (responseType === 'json' ? ({}) : ''); });
|
|
1094
|
-
};
|
|
1095
|
-
HeNodeService.prototype.nodeTypeUrl = function (type) {
|
|
1096
|
-
return nodeTypeUrl(this.commonService.apiBaseUrl, type);
|
|
1097
|
-
};
|
|
1098
|
-
HeNodeService.prototype.nodeUrl = function (node) {
|
|
1099
|
-
return nodeUrl(this.commonService.apiBaseUrl, node);
|
|
1100
|
-
};
|
|
1101
|
-
HeNodeService.prototype.nodeLogsUrl = function (node) {
|
|
1102
|
-
return nodeLogsUrl(this.commonService.apiBaseUrl, node);
|
|
1103
|
-
};
|
|
1104
|
-
HeNodeService.prototype.downloadLookup = function (filename) {
|
|
1105
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1106
|
-
var url;
|
|
1107
|
-
return __generator(this, function (_b) {
|
|
1108
|
-
try {
|
|
1109
|
-
url = lookupUrl(filename);
|
|
1110
|
-
return [2 /*return*/, this.downloadRaw(url, 'text')];
|
|
1111
|
-
}
|
|
1112
|
-
catch (_err) {
|
|
1113
|
-
return [2 /*return*/, null];
|
|
1114
|
-
}
|
|
1115
|
-
return [2 /*return*/];
|
|
1116
|
-
});
|
|
1117
|
-
});
|
|
1118
|
-
};
|
|
1119
|
-
HeNodeService.prototype.lookupLink = function (termType) {
|
|
1120
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1121
|
-
var data, _err_1;
|
|
1122
|
-
return __generator(this, function (_b) {
|
|
1123
|
-
switch (_b.label) {
|
|
1124
|
-
case 0:
|
|
1125
|
-
_b.trys.push([0, 2, , 3]);
|
|
1126
|
-
return [4 /*yield*/, this.downloadLookup(termType)];
|
|
1127
|
-
case 1:
|
|
1128
|
-
data = _b.sent();
|
|
1129
|
-
return [2 /*return*/, (data === null || data === void 0 ? void 0 : data.startsWith('term.id')) ? lookupUrl(termType) : null];
|
|
1130
|
-
case 2:
|
|
1131
|
-
_err_1 = _b.sent();
|
|
1132
|
-
return [2 /*return*/, null];
|
|
1133
|
-
case 3: return [2 /*return*/];
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
});
|
|
1018
|
+
KeysPipe.prototype.transform = function (value, sort) {
|
|
1019
|
+
if (sort === void 0) { sort = false; }
|
|
1020
|
+
var keys = Object.keys(value).map(function (key) { return ({ key: key, value: value[key] }); });
|
|
1021
|
+
if (sort) {
|
|
1022
|
+
keys.sort(function (a, b) { return a.key.localeCompare(b.key); });
|
|
1023
|
+
}
|
|
1024
|
+
return keys;
|
|
1137
1025
|
};
|
|
1138
|
-
return
|
|
1026
|
+
return KeysPipe;
|
|
1139
1027
|
}());
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type:
|
|
1143
|
-
type: i0.
|
|
1028
|
+
KeysPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KeysPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
1029
|
+
KeysPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KeysPipe, name: "keys" });
|
|
1030
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KeysPipe, decorators: [{
|
|
1031
|
+
type: i0.Pipe,
|
|
1144
1032
|
args: [{
|
|
1145
|
-
|
|
1033
|
+
name: 'keys'
|
|
1146
1034
|
}]
|
|
1147
|
-
}]
|
|
1035
|
+
}] });
|
|
1148
1036
|
|
|
1149
|
-
var
|
|
1150
|
-
|
|
1151
|
-
var lookups = Object.freeze({
|
|
1152
|
-
cropYield: 'region-crop-cropGroupingFaostatProduction-yield',
|
|
1153
|
-
cropGroupingColumn: 'cropGroupingFaostatProduction'
|
|
1154
|
-
});
|
|
1155
|
-
var HeAggregationEngineService = /** @class */ (function () {
|
|
1156
|
-
function HeAggregationEngineService(http, nodeService) {
|
|
1157
|
-
this.http = http;
|
|
1158
|
-
this.nodeService = nodeService;
|
|
1159
|
-
this.modelsLoading = false;
|
|
1160
|
-
this.modelsLoaded = false;
|
|
1161
|
-
this._models = new rxjs.ReplaySubject(1);
|
|
1162
|
-
this.lookupsLoading = false;
|
|
1163
|
-
this.lookupsLoaded = false;
|
|
1164
|
-
this._lookups = new rxjs.ReplaySubject(1);
|
|
1165
|
-
this.init();
|
|
1037
|
+
var PluralizePipe = /** @class */ (function () {
|
|
1038
|
+
function PluralizePipe() {
|
|
1166
1039
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
switch (_b.label) {
|
|
1171
|
-
case 0: return [4 /*yield*/, this.loadModels().toPromise()];
|
|
1172
|
-
case 1:
|
|
1173
|
-
_b.sent();
|
|
1174
|
-
return [2 /*return*/];
|
|
1175
|
-
}
|
|
1176
|
-
});
|
|
1177
|
-
});
|
|
1040
|
+
PluralizePipe.prototype.transform = function (value, times) {
|
|
1041
|
+
if (times === void 0) { times = 0; }
|
|
1042
|
+
return pluralize__namespace(value, times);
|
|
1178
1043
|
};
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1044
|
+
return PluralizePipe;
|
|
1045
|
+
}());
|
|
1046
|
+
PluralizePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PluralizePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
1047
|
+
PluralizePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PluralizePipe, name: "pluralize" });
|
|
1048
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PluralizePipe, decorators: [{
|
|
1049
|
+
type: i0.Pipe,
|
|
1050
|
+
args: [{
|
|
1051
|
+
name: 'pluralize'
|
|
1052
|
+
}]
|
|
1053
|
+
}] });
|
|
1054
|
+
|
|
1055
|
+
var PrecisionPipe = /** @class */ (function () {
|
|
1056
|
+
function PrecisionPipe() {
|
|
1057
|
+
}
|
|
1058
|
+
PrecisionPipe.prototype.transform = function (value, precision) {
|
|
1059
|
+
return utils.isUndefined(value) ?
|
|
1060
|
+
null : (utils.isNumber(value) ?
|
|
1061
|
+
("" + utils.toPrecision(parseFloat("" + value), parseInt("" + precision, 10))).replace(/\.00$/, '') :
|
|
1062
|
+
value);
|
|
1192
1063
|
};
|
|
1193
|
-
|
|
1064
|
+
return PrecisionPipe;
|
|
1065
|
+
}());
|
|
1066
|
+
PrecisionPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PrecisionPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
1067
|
+
PrecisionPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PrecisionPipe, name: "precision" });
|
|
1068
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PrecisionPipe, decorators: [{
|
|
1069
|
+
type: i0.Pipe,
|
|
1070
|
+
args: [{
|
|
1071
|
+
name: 'precision'
|
|
1072
|
+
}]
|
|
1073
|
+
}] });
|
|
1074
|
+
|
|
1075
|
+
var components$7 = [
|
|
1076
|
+
SocialTagsComponent,
|
|
1077
|
+
ToastComponent,
|
|
1078
|
+
BindOnceDirective,
|
|
1079
|
+
DefaultPipe,
|
|
1080
|
+
EllipsisPipe,
|
|
1081
|
+
KeysPipe,
|
|
1082
|
+
PluralizePipe,
|
|
1083
|
+
KeyToLabelPipe,
|
|
1084
|
+
PrecisionPipe
|
|
1085
|
+
];
|
|
1086
|
+
var HeCommonLightModule = /** @class */ (function () {
|
|
1087
|
+
function HeCommonLightModule() {
|
|
1088
|
+
}
|
|
1089
|
+
return HeCommonLightModule;
|
|
1090
|
+
}());
|
|
1091
|
+
HeCommonLightModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonLightModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1092
|
+
HeCommonLightModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonLightModule, declarations: [SocialTagsComponent,
|
|
1093
|
+
ToastComponent,
|
|
1094
|
+
BindOnceDirective,
|
|
1095
|
+
DefaultPipe,
|
|
1096
|
+
EllipsisPipe,
|
|
1097
|
+
KeysPipe,
|
|
1098
|
+
PluralizePipe,
|
|
1099
|
+
KeyToLabelPipe,
|
|
1100
|
+
PrecisionPipe], imports: [i3.CommonModule, i1$2.FormsModule, i4.RouterModule,
|
|
1101
|
+
HeFontawesomeModule], exports: [HeFontawesomeModule, SocialTagsComponent,
|
|
1102
|
+
ToastComponent,
|
|
1103
|
+
BindOnceDirective,
|
|
1104
|
+
DefaultPipe,
|
|
1105
|
+
EllipsisPipe,
|
|
1106
|
+
KeysPipe,
|
|
1107
|
+
PluralizePipe,
|
|
1108
|
+
KeyToLabelPipe,
|
|
1109
|
+
PrecisionPipe] });
|
|
1110
|
+
HeCommonLightModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonLightModule, imports: [[
|
|
1111
|
+
i3.CommonModule, i1$2.FormsModule, i4.RouterModule,
|
|
1112
|
+
HeFontawesomeModule
|
|
1113
|
+
], HeFontawesomeModule] });
|
|
1114
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonLightModule, decorators: [{
|
|
1115
|
+
type: i0.NgModule,
|
|
1116
|
+
args: [{
|
|
1117
|
+
declarations: components$7,
|
|
1118
|
+
exports: __spreadArray([
|
|
1119
|
+
HeFontawesomeModule
|
|
1120
|
+
], __read(components$7)),
|
|
1121
|
+
imports: [
|
|
1122
|
+
i3.CommonModule, i1$2.FormsModule, i4.RouterModule,
|
|
1123
|
+
HeFontawesomeModule
|
|
1124
|
+
]
|
|
1125
|
+
}]
|
|
1126
|
+
}] });
|
|
1127
|
+
|
|
1128
|
+
var _a$4, _b$1, _c$1, _d$2;
|
|
1129
|
+
var SUCCESS_CRITERION_MAX_DELTA_PERCENT = 5;
|
|
1130
|
+
var WARNING_CRITERION_MAX_DELTA_PERCENT = 20;
|
|
1131
|
+
exports.DeltaColour = void 0;
|
|
1132
|
+
(function (DeltaColour) {
|
|
1133
|
+
DeltaColour["Success"] = "success";
|
|
1134
|
+
DeltaColour["Warning"] = "warning";
|
|
1135
|
+
DeltaColour["Danger"] = "danger";
|
|
1136
|
+
})(exports.DeltaColour || (exports.DeltaColour = {}));
|
|
1137
|
+
exports.DeltaDisplayType = void 0;
|
|
1138
|
+
(function (DeltaDisplayType) {
|
|
1139
|
+
DeltaDisplayType["absolute"] = "absolute";
|
|
1140
|
+
DeltaDisplayType["percent"] = "percent";
|
|
1141
|
+
})(exports.DeltaDisplayType || (exports.DeltaDisplayType = {}));
|
|
1142
|
+
var deltaPerType = (_a$4 = {},
|
|
1143
|
+
_a$4[exports.DeltaDisplayType.absolute] = function (value, original) { return value - original; },
|
|
1144
|
+
_a$4[exports.DeltaDisplayType.percent] = function (value, original) { return ((value - original) / original) * 100; },
|
|
1145
|
+
_a$4);
|
|
1146
|
+
var roundValue = function (value) { return +("" + value).substring(0, 10); };
|
|
1147
|
+
var delta = function (value, originalValue, displayType, mapping) {
|
|
1148
|
+
if (displayType === void 0) { displayType = exports.DeltaDisplayType.percent; }
|
|
1149
|
+
var vvalue = roundValue(propertyValue$1(value));
|
|
1150
|
+
var voriginalValue = roundValue(propertyValue$1(originalValue));
|
|
1151
|
+
var deltaFuncs = Object.assign(Object.assign({}, deltaPerType), mapping);
|
|
1152
|
+
var diff = vvalue === voriginalValue ? 0 : deltaFuncs[displayType](vvalue, voriginalValue);
|
|
1153
|
+
return Number.isFinite(diff) ? (diff === -0 ? 0 : diff) : 0;
|
|
1154
|
+
};
|
|
1155
|
+
var PercentDeltaConditions;
|
|
1156
|
+
(function (PercentDeltaConditions) {
|
|
1157
|
+
PercentDeltaConditions["recalculated0"] = "recalculated should be 0";
|
|
1158
|
+
PercentDeltaConditions["original0"] = "original is 0";
|
|
1159
|
+
})(PercentDeltaConditions || (PercentDeltaConditions = {}));
|
|
1160
|
+
var calculatePercentDeltaConditions = (_b$1 = {},
|
|
1161
|
+
_b$1[PercentDeltaConditions.recalculated0] = function (original, recalculated) { return original > 0 && recalculated === 0; },
|
|
1162
|
+
_b$1[PercentDeltaConditions.original0] = function (original, recalculated) { return original === 0 && recalculated > 0; },
|
|
1163
|
+
_b$1);
|
|
1164
|
+
var calculatePercentDeltaResult = (_c$1 = {},
|
|
1165
|
+
_c$1[PercentDeltaConditions.recalculated0] = function (original, recalculated) { return (recalculated - original) / (original + 1); },
|
|
1166
|
+
// Always considered an error so deliberately exceed SUCCESS_CRITERION_MAX_DELTA_PERCENT
|
|
1167
|
+
_c$1[PercentDeltaConditions.original0] = function (original, recalculated) { return Math.sign(recalculated - original); },
|
|
1168
|
+
_c$1.default = function (original, recalculated) { return (recalculated - original) / original; },
|
|
1169
|
+
_c$1);
|
|
1170
|
+
var calculatePercentDelta = function (recalculated, original) {
|
|
1171
|
+
var matchingCondition = Object.values(PercentDeltaConditions).find(function (value) { return calculatePercentDeltaConditions[value](original, recalculated); }) || 'default';
|
|
1172
|
+
return calculatePercentDeltaResult[matchingCondition](original, recalculated) * 100;
|
|
1173
|
+
};
|
|
1174
|
+
var customDeltaFuncs = (_d$2 = {},
|
|
1175
|
+
_d$2[exports.DeltaDisplayType.percent] = calculatePercentDelta,
|
|
1176
|
+
_d$2);
|
|
1177
|
+
var evaluateSuccess = function (deltaValue) { return Math.abs(deltaValue) < SUCCESS_CRITERION_MAX_DELTA_PERCENT
|
|
1178
|
+
? exports.DeltaColour.Success
|
|
1179
|
+
: Math.abs(deltaValue) < WARNING_CRITERION_MAX_DELTA_PERCENT
|
|
1180
|
+
? exports.DeltaColour.Warning
|
|
1181
|
+
: exports.DeltaColour.Danger; };
|
|
1182
|
+
|
|
1183
|
+
var BlankNodeValueDeltaComponent = /** @class */ (function () {
|
|
1184
|
+
function BlankNodeValueDeltaComponent() {
|
|
1185
|
+
this.displayType = exports.DeltaDisplayType.percent;
|
|
1186
|
+
this.DeltaDisplayType = exports.DeltaDisplayType;
|
|
1187
|
+
}
|
|
1188
|
+
Object.defineProperty(BlankNodeValueDeltaComponent.prototype, "hide", {
|
|
1194
1189
|
get: function () {
|
|
1195
|
-
return this.
|
|
1190
|
+
return emptyValue(this.value) || emptyValue(this.originalValue);
|
|
1196
1191
|
},
|
|
1197
1192
|
enumerable: false,
|
|
1198
1193
|
configurable: true
|
|
1199
1194
|
});
|
|
1200
|
-
|
|
1201
|
-
return this.models$.pipe(operators.take(1)).toPromise();
|
|
1202
|
-
};
|
|
1203
|
-
HeAggregationEngineService.prototype.model$ = function (model) {
|
|
1204
|
-
return this.models$.pipe(operators.map(function (models) { return models.find(function (m) { return Object.keys(model).every(function (key) { return model[key] === m[key]; }); }); }));
|
|
1205
|
-
};
|
|
1206
|
-
HeAggregationEngineService.prototype.model = function (model) {
|
|
1207
|
-
return this.model$(model).pipe(operators.take(1)).toPromise();
|
|
1208
|
-
};
|
|
1209
|
-
HeAggregationEngineService.prototype.loadLookup = function (filename) {
|
|
1210
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1211
|
-
var data;
|
|
1212
|
-
return __generator(this, function (_b) {
|
|
1213
|
-
switch (_b.label) {
|
|
1214
|
-
case 0: return [4 /*yield*/, this.nodeService.downloadLookup(filename)];
|
|
1215
|
-
case 1:
|
|
1216
|
-
data = _b.sent();
|
|
1217
|
-
return [2 /*return*/, csvtojson__namespace({ delimiter: 'auto' }).fromString(data)];
|
|
1218
|
-
}
|
|
1219
|
-
});
|
|
1220
|
-
});
|
|
1221
|
-
};
|
|
1222
|
-
HeAggregationEngineService.prototype.loadLookups = function () {
|
|
1223
|
-
var _this = this;
|
|
1224
|
-
return rxjs.forkJoin({
|
|
1225
|
-
cropYield: rxjs.from(this.loadLookup(lookups.cropYield)),
|
|
1226
|
-
crop: rxjs.from(this.loadLookup(schema.TermTermType.crop))
|
|
1227
|
-
}).pipe(operators.map(function (values) {
|
|
1228
|
-
_this._lookups.next(values);
|
|
1229
|
-
_this.lookupsLoading = false;
|
|
1230
|
-
_this.lookupsLoaded = true;
|
|
1231
|
-
return values;
|
|
1232
|
-
}));
|
|
1233
|
-
};
|
|
1234
|
-
Object.defineProperty(HeAggregationEngineService.prototype, "lookups$", {
|
|
1195
|
+
Object.defineProperty(BlankNodeValueDeltaComponent.prototype, "delta", {
|
|
1235
1196
|
get: function () {
|
|
1236
|
-
return this.
|
|
1197
|
+
return delta(this.value, this.originalValue, this.displayType, customDeltaFuncs);
|
|
1237
1198
|
},
|
|
1238
1199
|
enumerable: false,
|
|
1239
1200
|
configurable: true
|
|
1240
1201
|
});
|
|
1241
|
-
|
|
1242
|
-
|
|
1202
|
+
Object.defineProperty(BlankNodeValueDeltaComponent.prototype, "color", {
|
|
1203
|
+
get: function () {
|
|
1204
|
+
return this.displayType === exports.DeltaDisplayType.percent ? evaluateSuccess(this.delta) : '';
|
|
1205
|
+
},
|
|
1206
|
+
enumerable: false,
|
|
1207
|
+
configurable: true
|
|
1208
|
+
});
|
|
1209
|
+
return BlankNodeValueDeltaComponent;
|
|
1210
|
+
}());
|
|
1211
|
+
BlankNodeValueDeltaComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlankNodeValueDeltaComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1212
|
+
BlankNodeValueDeltaComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: BlankNodeValueDeltaComponent, selector: "he-blank-node-value-delta", inputs: { value: "value", originalValue: "originalValue", displayType: "displayType" }, ngImport: i0__namespace, template: "<small [class.is-hidden]=\"hide\">\n <span class=\"has-text-{{color}}\">\n <span *ngIf=\"delta > 0\">+</span>\n <ng-container [ngSwitch]=\"displayType\">\n <ng-container *ngSwitchCase=\"DeltaDisplayType.absolute\">\n <span *bindOnce=\"delta\">{{delta | precision:3}}</span>\n </ng-container>\n <ng-container *ngSwitchCase=\"DeltaDisplayType.percent\">\n <span *bindOnce=\"delta\">{{delta | number:'1.0-2'}}</span>\n <span>%</span>\n </ng-container>\n </ng-container>\n </span>\n</small>\n", styles: [""], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }], pipes: { "precision": PrecisionPipe, "number": i3__namespace.DecimalPipe } });
|
|
1213
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlankNodeValueDeltaComponent, decorators: [{
|
|
1214
|
+
type: i0.Component,
|
|
1215
|
+
args: [{
|
|
1216
|
+
selector: 'he-blank-node-value-delta',
|
|
1217
|
+
templateUrl: './blank-node-value-delta.component.html',
|
|
1218
|
+
styleUrls: ['./blank-node-value-delta.component.scss']
|
|
1219
|
+
}]
|
|
1220
|
+
}], propDecorators: { value: [{
|
|
1221
|
+
type: i0.Input
|
|
1222
|
+
}], originalValue: [{
|
|
1223
|
+
type: i0.Input
|
|
1224
|
+
}], displayType: [{
|
|
1225
|
+
type: i0.Input
|
|
1226
|
+
}] } });
|
|
1227
|
+
|
|
1228
|
+
var BlankNodeDiffsComponent = /** @class */ (function () {
|
|
1229
|
+
function BlankNodeDiffsComponent() {
|
|
1230
|
+
this.originalValues = [];
|
|
1231
|
+
this.recalculatedValues = [];
|
|
1232
|
+
this.propertyValue = propertyValue$1;
|
|
1233
|
+
this.values = [];
|
|
1234
|
+
}
|
|
1235
|
+
BlankNodeDiffsComponent.prototype.ngOnInit = function () {
|
|
1236
|
+
this.values = formatDiffValues(this.originalValues, this.recalculatedValues);
|
|
1243
1237
|
};
|
|
1244
|
-
return
|
|
1238
|
+
return BlankNodeDiffsComponent;
|
|
1245
1239
|
}());
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type:
|
|
1240
|
+
BlankNodeDiffsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlankNodeDiffsComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1241
|
+
BlankNodeDiffsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: BlankNodeDiffsComponent, selector: "he-blank-node-diffs", inputs: { originalValues: "originalValues", recalculatedValues: "recalculatedValues" }, ngImport: i0__namespace, template: "<div class=\"table-container data-table-container mb-1\">\n <table class=\"table is-narrow data-table has-children-3\" *bindOnce=\"values\">\n <thead>\n <tr>\n <th class=\"width-auto\"></th>\n <th>Original</th>\n <th>Recalculated</th>\n <th>Difference</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let value of values\"\n [class.has-background-light]=\"!!value.original && value.original !== value.recalculated\"\n >\n <td class=\"width-auto\" [attr.title]=\"value.term.name\">\n <ng-container *ngTemplateOutlet=\"termLink; context: {$implicit: value.term}\"></ng-container>\n </td>\n <td>\n <span>{{value.original === undefined ? '-' : value.original}}</span>\n </td>\n <td>\n <span>{{value.recalculated === undefined ? '-' : value.recalculated}}</span>\n </td>\n <td class=\"is-nowrap\">\n <he-blank-node-value-delta\n [value]=\"value.recalculated\"\n [originalValue]=\"value.original\"\n ></he-blank-node-value-delta>\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n\n<ng-template #termLink let-term>\n <a [routerLink]=\"['/', 'term', term['@id']]\" target=\"_blank\">\n <span class=\"is-nowrap has-text-ellipsis\">{{term.name}}</span>\n </a>\n</ng-template>\n", styles: ["table.data-table th:first-child,table.data-table td:first-child{width:auto}\n"], components: [{ type: BlankNodeValueDeltaComponent, selector: "he-blank-node-value-delta", inputs: ["value", "originalValue", "displayType"] }], directives: [{ type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4__namespace.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }] });
|
|
1242
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: BlankNodeDiffsComponent, decorators: [{
|
|
1243
|
+
type: i0.Component,
|
|
1244
|
+
args: [{
|
|
1245
|
+
selector: 'he-blank-node-diffs',
|
|
1246
|
+
templateUrl: './blank-node-diffs.component.html',
|
|
1247
|
+
styleUrls: ['./blank-node-diffs.component.scss']
|
|
1248
|
+
}]
|
|
1249
|
+
}], propDecorators: { originalValues: [{
|
|
1250
|
+
type: i0.Input
|
|
1251
|
+
}], recalculatedValues: [{
|
|
1252
|
+
type: i0.Input
|
|
1253
|
+
}] } });
|
|
1254
|
+
|
|
1255
|
+
var HE_API_BASE_URL = new i0.InjectionToken('HE_API_BASE_URL');
|
|
1256
|
+
var HeCommonService = /** @class */ (function () {
|
|
1257
|
+
function HeCommonService(_apiBaseUrl) {
|
|
1258
|
+
this._apiBaseUrl = _apiBaseUrl;
|
|
1259
|
+
}
|
|
1260
|
+
Object.defineProperty(HeCommonService.prototype, "apiBaseUrl", {
|
|
1261
|
+
get: function () {
|
|
1262
|
+
return this._apiBaseUrl || '/api';
|
|
1263
|
+
},
|
|
1264
|
+
enumerable: false,
|
|
1265
|
+
configurable: true
|
|
1266
|
+
});
|
|
1267
|
+
return HeCommonService;
|
|
1268
|
+
}());
|
|
1269
|
+
HeCommonService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonService, deps: [{ token: HE_API_BASE_URL }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1270
|
+
HeCommonService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonService, providedIn: 'root' });
|
|
1271
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonService, decorators: [{
|
|
1249
1272
|
type: i0.Injectable,
|
|
1250
1273
|
args: [{
|
|
1251
1274
|
providedIn: 'root'
|
|
1252
1275
|
}]
|
|
1253
|
-
}], ctorParameters: function () {
|
|
1276
|
+
}], ctorParameters: function () {
|
|
1277
|
+
return [{ type: undefined, decorators: [{
|
|
1278
|
+
type: i0.Inject,
|
|
1279
|
+
args: [HE_API_BASE_URL]
|
|
1280
|
+
}] }];
|
|
1281
|
+
} });
|
|
1254
1282
|
|
|
1255
|
-
var
|
|
1256
|
-
|
|
1283
|
+
var nodeTypeUrl = function (apiBaseUrl, type) { return type ? apiBaseUrl + "/" + api.nodeTypeToParam(type) : ''; };
|
|
1284
|
+
/**
|
|
1285
|
+
* Get the full url to fetch the node data.
|
|
1286
|
+
*
|
|
1287
|
+
* @param apiBaseUrl The url of the API hosting the data.
|
|
1288
|
+
* @param node The node with a type, id and optionally a dataState
|
|
1289
|
+
* @returns The full url.
|
|
1290
|
+
*/
|
|
1291
|
+
var nodeUrl = function (apiBaseUrl, _a) {
|
|
1292
|
+
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1293
|
+
return nodeTypeUrl(apiBaseUrl, node['@type'] || node.type) + "/" + (node['@id'] || node.id) + (dataState ? "?dataState=" + dataState : '');
|
|
1294
|
+
};
|
|
1295
|
+
var nodeLogsUrl = function (apiBaseUrl, _a) {
|
|
1296
|
+
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1297
|
+
return nodeUrl(apiBaseUrl, node) + "/log" + (dataState ? "?dataState=" + dataState : '');
|
|
1298
|
+
};
|
|
1299
|
+
var lookupUrl = function (filename) { return filename.startsWith('http') ? filename : baseUrl() + "/glossary/lookups/" + filename + ".csv"; };
|
|
1300
|
+
var termTypeLookupUrl = function (termType) { return baseUrl() + "/glossary/" + termChildToParent(termType).termType + "/" + termType + ".csv"; };
|
|
1301
|
+
var HeNodeService = /** @class */ (function () {
|
|
1302
|
+
function HeNodeService(http, authService, commonService) {
|
|
1303
|
+
this.http = http;
|
|
1304
|
+
this.authService = authService;
|
|
1305
|
+
this.commonService = commonService;
|
|
1306
|
+
}
|
|
1307
|
+
HeNodeService.prototype.get$ = function (_a) {
|
|
1308
|
+
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1309
|
+
return this.http.get(this.nodeUrl(node), {
|
|
1310
|
+
headers: this.authService.headers,
|
|
1311
|
+
params: filterParams({ dataState: dataState })
|
|
1312
|
+
});
|
|
1313
|
+
};
|
|
1314
|
+
HeNodeService.prototype.get = function (node, defaultForState) {
|
|
1315
|
+
if (defaultForState === void 0) { defaultForState = true; }
|
|
1316
|
+
return this.get$(node)
|
|
1317
|
+
.toPromise()
|
|
1318
|
+
.catch(function () { return node.dataState && defaultForState ? node : ({}); });
|
|
1319
|
+
};
|
|
1320
|
+
HeNodeService.prototype.getLog = function (_a) {
|
|
1321
|
+
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1322
|
+
return this.http.get(this.nodeUrl(node) + "/log", {
|
|
1323
|
+
headers: this.authService.headers,
|
|
1324
|
+
responseType: 'text',
|
|
1325
|
+
params: filterParams({ dataState: dataState })
|
|
1326
|
+
}).pipe(operators.catchError(function () { return rxjs.of(''); }));
|
|
1327
|
+
};
|
|
1328
|
+
HeNodeService.prototype.getMissingLookupsLog = function (_a) {
|
|
1329
|
+
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1330
|
+
return this.http.get(this.nodeUrl(node) + "/log/lookups", {
|
|
1331
|
+
headers: this.authService.headers,
|
|
1332
|
+
params: filterParams({ dataState: dataState })
|
|
1333
|
+
}).toPromise().catch(handleAPIError);
|
|
1334
|
+
};
|
|
1335
|
+
HeNodeService.prototype.getModelsLog = function (_a) {
|
|
1336
|
+
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1337
|
+
return this.http.get(this.nodeUrl(node) + "/log/models", {
|
|
1338
|
+
headers: this.authService.headers,
|
|
1339
|
+
params: filterParams({ dataState: dataState })
|
|
1340
|
+
}).toPromise().catch(handleAPIError);
|
|
1341
|
+
};
|
|
1342
|
+
HeNodeService.prototype.triggerPipeline = function (_a) {
|
|
1343
|
+
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1344
|
+
return this.http.post(this.nodeUrl(node) + "/pipeline", dataState ? { dataState: dataState } : {}, {
|
|
1345
|
+
headers: this.authService.headers
|
|
1346
|
+
}).toPromise().catch(handleAPIError);
|
|
1347
|
+
};
|
|
1348
|
+
HeNodeService.prototype.downloadRaw = function (url, responseType) {
|
|
1349
|
+
if (responseType === void 0) { responseType = 'json'; }
|
|
1350
|
+
return this.http.get(url, { responseType: responseType })
|
|
1351
|
+
.toPromise()
|
|
1352
|
+
.catch(function () { return (responseType === 'json' ? ({}) : ''); });
|
|
1353
|
+
};
|
|
1354
|
+
HeNodeService.prototype.nodeTypeUrl = function (type) {
|
|
1355
|
+
return nodeTypeUrl(this.commonService.apiBaseUrl, type);
|
|
1356
|
+
};
|
|
1357
|
+
HeNodeService.prototype.nodeUrl = function (node) {
|
|
1358
|
+
return nodeUrl(this.commonService.apiBaseUrl, node);
|
|
1359
|
+
};
|
|
1360
|
+
HeNodeService.prototype.nodeLogsUrl = function (node) {
|
|
1361
|
+
return nodeLogsUrl(this.commonService.apiBaseUrl, node);
|
|
1362
|
+
};
|
|
1363
|
+
HeNodeService.prototype.downloadLookup = function (filename) {
|
|
1364
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1365
|
+
var url;
|
|
1366
|
+
return __generator(this, function (_b) {
|
|
1367
|
+
try {
|
|
1368
|
+
url = lookupUrl(filename);
|
|
1369
|
+
return [2 /*return*/, this.downloadRaw(url, 'text')];
|
|
1370
|
+
}
|
|
1371
|
+
catch (_err) {
|
|
1372
|
+
return [2 /*return*/, null];
|
|
1373
|
+
}
|
|
1374
|
+
return [2 /*return*/];
|
|
1375
|
+
});
|
|
1376
|
+
});
|
|
1377
|
+
};
|
|
1378
|
+
HeNodeService.prototype.lookupLink = function (termType) {
|
|
1379
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1380
|
+
var data, _err_1;
|
|
1381
|
+
return __generator(this, function (_b) {
|
|
1382
|
+
switch (_b.label) {
|
|
1383
|
+
case 0:
|
|
1384
|
+
_b.trys.push([0, 2, , 3]);
|
|
1385
|
+
return [4 /*yield*/, this.downloadLookup(termType)];
|
|
1386
|
+
case 1:
|
|
1387
|
+
data = _b.sent();
|
|
1388
|
+
return [2 /*return*/, (data === null || data === void 0 ? void 0 : data.startsWith('term.id')) ? lookupUrl(termType) : null];
|
|
1389
|
+
case 2:
|
|
1390
|
+
_err_1 = _b.sent();
|
|
1391
|
+
return [2 /*return*/, null];
|
|
1392
|
+
case 3: return [2 /*return*/];
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
});
|
|
1396
|
+
};
|
|
1397
|
+
return HeNodeService;
|
|
1398
|
+
}());
|
|
1399
|
+
HeNodeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeNodeService, deps: [{ token: i1__namespace$2.HttpClient }, { token: HeAuthService }, { token: HeCommonService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1400
|
+
HeNodeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeNodeService, providedIn: 'root' });
|
|
1401
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeNodeService, decorators: [{
|
|
1402
|
+
type: i0.Injectable,
|
|
1403
|
+
args: [{
|
|
1404
|
+
providedIn: 'root'
|
|
1405
|
+
}]
|
|
1406
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$2.HttpClient }, { type: HeAuthService }, { type: HeCommonService }]; } });
|
|
1407
|
+
|
|
1408
|
+
var gitUrl$1 = function () { return gitHome + "/hestia-aggregation-engine/-/blob/" + gitBranch(); };
|
|
1409
|
+
var rawUrl$1 = function () { return gitRawBaseUrl + "/hestia-aggregation-engine/-/raw/" + gitBranch(); };
|
|
1410
|
+
var lookups = Object.freeze({
|
|
1411
|
+
cropYield: 'region-crop-cropGroupingFaostatProduction-yield',
|
|
1412
|
+
cropGroupingColumn: 'cropGroupingFaostatProduction'
|
|
1413
|
+
});
|
|
1414
|
+
var HeAggregationEngineService = /** @class */ (function () {
|
|
1415
|
+
function HeAggregationEngineService(http, nodeService) {
|
|
1416
|
+
this.http = http;
|
|
1417
|
+
this.nodeService = nodeService;
|
|
1418
|
+
this.modelsLoading = false;
|
|
1419
|
+
this.modelsLoaded = false;
|
|
1420
|
+
this._models = new rxjs.ReplaySubject(1);
|
|
1421
|
+
this.lookupsLoading = false;
|
|
1422
|
+
this.lookupsLoaded = false;
|
|
1423
|
+
this._lookups = new rxjs.ReplaySubject(1);
|
|
1424
|
+
this.init();
|
|
1425
|
+
}
|
|
1426
|
+
HeAggregationEngineService.prototype.init = function () {
|
|
1427
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1428
|
+
return __generator(this, function (_b) {
|
|
1429
|
+
switch (_b.label) {
|
|
1430
|
+
case 0: return [4 /*yield*/, this.loadModels().toPromise()];
|
|
1431
|
+
case 1:
|
|
1432
|
+
_b.sent();
|
|
1433
|
+
return [2 /*return*/];
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
});
|
|
1437
|
+
};
|
|
1438
|
+
HeAggregationEngineService.prototype.loadModels = function () {
|
|
1439
|
+
var _this = this;
|
|
1440
|
+
this.modelsLoading = true;
|
|
1441
|
+
return this.http.get(rawUrl$1() + "/model-links.json").pipe(operators.catchError(function () { return rxjs.of({ links: [] }); }), operators.map(function (_b) {
|
|
1442
|
+
var links = _b.links;
|
|
1443
|
+
_this._models.next(links.map(function (_a) {
|
|
1444
|
+
var modelPath = _a.path, docPath = _a.docPath, link = __rest(_a, ["path", "docPath"]);
|
|
1445
|
+
return (Object.assign(Object.assign({}, link), { path: gitUrl$1() + "/" + modelPath, docPath: gitUrl$1() + "/" + docPath }));
|
|
1446
|
+
}));
|
|
1447
|
+
_this.modelsLoading = false;
|
|
1448
|
+
_this.modelsLoaded = true;
|
|
1449
|
+
return links;
|
|
1450
|
+
}));
|
|
1451
|
+
};
|
|
1452
|
+
Object.defineProperty(HeAggregationEngineService.prototype, "models$", {
|
|
1453
|
+
get: function () {
|
|
1454
|
+
return this.modelsLoading || this.modelsLoaded ? this._models.asObservable() : this.loadModels();
|
|
1455
|
+
},
|
|
1456
|
+
enumerable: false,
|
|
1457
|
+
configurable: true
|
|
1458
|
+
});
|
|
1459
|
+
HeAggregationEngineService.prototype.models = function () {
|
|
1460
|
+
return this.models$.pipe(operators.take(1)).toPromise();
|
|
1461
|
+
};
|
|
1462
|
+
HeAggregationEngineService.prototype.model$ = function (model) {
|
|
1463
|
+
return this.models$.pipe(operators.map(function (models) { return models.find(function (m) { return Object.keys(model).every(function (key) { return model[key] === m[key]; }); }); }));
|
|
1464
|
+
};
|
|
1465
|
+
HeAggregationEngineService.prototype.model = function (model) {
|
|
1466
|
+
return this.model$(model).pipe(operators.take(1)).toPromise();
|
|
1467
|
+
};
|
|
1468
|
+
HeAggregationEngineService.prototype.loadLookup = function (filename) {
|
|
1469
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1470
|
+
var data;
|
|
1471
|
+
return __generator(this, function (_b) {
|
|
1472
|
+
switch (_b.label) {
|
|
1473
|
+
case 0: return [4 /*yield*/, this.nodeService.downloadLookup(filename)];
|
|
1474
|
+
case 1:
|
|
1475
|
+
data = _b.sent();
|
|
1476
|
+
return [2 /*return*/, csvtojson__namespace({ delimiter: 'auto' }).fromString(data)];
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
});
|
|
1480
|
+
};
|
|
1481
|
+
HeAggregationEngineService.prototype.loadLookups = function () {
|
|
1482
|
+
var _this = this;
|
|
1483
|
+
return rxjs.forkJoin({
|
|
1484
|
+
cropYield: rxjs.from(this.loadLookup(lookups.cropYield)),
|
|
1485
|
+
crop: rxjs.from(this.loadLookup(schema.TermTermType.crop))
|
|
1486
|
+
}).pipe(operators.map(function (values) {
|
|
1487
|
+
_this._lookups.next(values);
|
|
1488
|
+
_this.lookupsLoading = false;
|
|
1489
|
+
_this.lookupsLoaded = true;
|
|
1490
|
+
return values;
|
|
1491
|
+
}));
|
|
1492
|
+
};
|
|
1493
|
+
Object.defineProperty(HeAggregationEngineService.prototype, "lookups$", {
|
|
1494
|
+
get: function () {
|
|
1495
|
+
return this.lookupsLoading || this.lookupsLoaded ? this._lookups.asObservable() : this.loadLookups();
|
|
1496
|
+
},
|
|
1497
|
+
enumerable: false,
|
|
1498
|
+
configurable: true
|
|
1499
|
+
});
|
|
1500
|
+
HeAggregationEngineService.prototype.lookups = function () {
|
|
1501
|
+
return this.lookups$.pipe(operators.take(1)).toPromise();
|
|
1502
|
+
};
|
|
1503
|
+
return HeAggregationEngineService;
|
|
1504
|
+
}());
|
|
1505
|
+
HeAggregationEngineService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeAggregationEngineService, deps: [{ token: i1__namespace$2.HttpClient }, { token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1506
|
+
HeAggregationEngineService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeAggregationEngineService, providedIn: 'root' });
|
|
1507
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeAggregationEngineService, decorators: [{
|
|
1508
|
+
type: i0.Injectable,
|
|
1509
|
+
args: [{
|
|
1510
|
+
providedIn: 'root'
|
|
1511
|
+
}]
|
|
1512
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$2.HttpClient }, { type: HeNodeService }]; } });
|
|
1513
|
+
|
|
1514
|
+
var HE_ORCHESTRATOR_BASE_URL = new i0.InjectionToken('HE_ORCHESTRATOR_BASE_URL');
|
|
1515
|
+
var gitUrl = function () { return gitHome + "/hestia-engine-models/-/blob/" + gitBranch(); };
|
|
1257
1516
|
var rawUrl = function () { return gitRawBaseUrl + "/hestia-engine-models/-/raw/" + gitBranch(); };
|
|
1258
1517
|
var findConfigModels = function (_b, modelId, modelKey) {
|
|
1259
1518
|
var models = _b.models;
|
|
@@ -1329,7 +1588,7 @@
|
|
|
1329
1588
|
};
|
|
1330
1589
|
return HeEngineService;
|
|
1331
1590
|
}());
|
|
1332
|
-
HeEngineService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeEngineService, deps: [{ token: HE_ORCHESTRATOR_BASE_URL }, { token: i1__namespace$
|
|
1591
|
+
HeEngineService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeEngineService, deps: [{ token: HE_ORCHESTRATOR_BASE_URL }, { token: i1__namespace$2.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1333
1592
|
HeEngineService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeEngineService, providedIn: 'root' });
|
|
1334
1593
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeEngineService, decorators: [{
|
|
1335
1594
|
type: i0.Injectable,
|
|
@@ -1340,7 +1599,7 @@
|
|
|
1340
1599
|
return [{ type: undefined, decorators: [{
|
|
1341
1600
|
type: i0.Inject,
|
|
1342
1601
|
args: [HE_ORCHESTRATOR_BASE_URL]
|
|
1343
|
-
}] }, { type: i1__namespace$
|
|
1602
|
+
}] }, { type: i1__namespace$2.HttpClient }];
|
|
1344
1603
|
} });
|
|
1345
1604
|
|
|
1346
1605
|
var NodeKeyState;
|
|
@@ -1794,7 +2053,7 @@
|
|
|
1794
2053
|
return MapsDrawingConfirmComponent;
|
|
1795
2054
|
}());
|
|
1796
2055
|
MapsDrawingConfirmComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: MapsDrawingConfirmComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1797
|
-
MapsDrawingConfirmComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MapsDrawingConfirmComponent, selector: "he-maps-drawing-confirm", inputs: { value: "value", modes: "modes", center: "center", zoom: "zoom" }, outputs: { closed: "closed" }, viewQueries: [{ propertyName: "map", first: true, predicate: i1$
|
|
2056
|
+
MapsDrawingConfirmComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MapsDrawingConfirmComponent, selector: "he-maps-drawing-confirm", inputs: { value: "value", modes: "modes", center: "center", zoom: "zoom" }, outputs: { closed: "closed" }, viewQueries: [{ propertyName: "map", first: true, predicate: i1$4.GoogleMap, descendants: true }], ngImport: i0__namespace, template: "<div class=\"modal is-large is-active\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-card\">\n <header class=\"modal-card-head\">\n <p class=\"modal-card-title\">Draw on Map</p>\n <button class=\"delete\" aria-label=\"close\" (click)=\"closed.next(value)\"></button>\n </header>\n <section class=\"modal-card-body p-0\">\n <google-map\n height=\"100%\"\n width=\"100%\"\n [zoom]=\"zoom\"\n [center]=\"center\"\n [options]=\"options\"\n ></google-map>\n </section>\n <footer class=\"modal-card-foot\">\n <button class=\"button is-primary\" (click)=\"confirm()\">\n <span>Confirm</span>\n </button>\n <button class=\"button\" (click)=\"closed.next(value)\">\n <span>Close</span>\n </button>\n <button class=\"button is-danger is-outlined\" (click)=\"clear()\">\n <fa-icon class=\"mr-2\" icon=\"times\"></fa-icon>\n <span>Clear</span>\n </button>\n </footer>\n </div>\n</div>\n", styles: ["google-map{display:block;height:100%;max-height:calc(100vh - 146px);min-height:500px}\n"], components: [{ type: i1__namespace$3.GoogleMap, selector: "google-map", inputs: ["height", "width", "center", "zoom", "options", "mapTypeId"], outputs: ["authFailure", "boundsChanged", "centerChanged", "mapClick", "mapDblclick", "mapDrag", "mapDragend", "mapDragstart", "headingChanged", "idle", "maptypeidChanged", "mapMousemove", "mapMouseout", "mapMouseover", "projectionChanged", "mapRightclick", "tilesloaded", "tiltChanged", "zoomChanged"], exportAs: ["googleMap"] }, { type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }] });
|
|
1798
2057
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: MapsDrawingConfirmComponent, decorators: [{
|
|
1799
2058
|
type: i0.Component,
|
|
1800
2059
|
args: [{
|
|
@@ -1804,7 +2063,7 @@
|
|
|
1804
2063
|
}]
|
|
1805
2064
|
}], propDecorators: { map: [{
|
|
1806
2065
|
type: i0.ViewChild,
|
|
1807
|
-
args: [i1$
|
|
2066
|
+
args: [i1$4.GoogleMap]
|
|
1808
2067
|
}], value: [{
|
|
1809
2068
|
type: i0.Input
|
|
1810
2069
|
}], modes: [{
|
|
@@ -1980,340 +2239,1634 @@
|
|
|
1980
2239
|
args: ['style.height']
|
|
1981
2240
|
}] } });
|
|
1982
2241
|
|
|
1983
|
-
var
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
this.
|
|
2242
|
+
var parsePropertyValue = function (value) { return utils.isNumber(value) ? +value : (utils.isBoolean(value) ? value.toString() === 'true' : value); };
|
|
2243
|
+
var parseResult = function (value) { return isNaN(value) ? '' : ("" + value).replace(',', '.'); };
|
|
2244
|
+
var UnitConverterComponent = /** @class */ (function () {
|
|
2245
|
+
function UnitConverterComponent() {
|
|
2246
|
+
this.value = 1;
|
|
2247
|
+
this.ConvertUnits = utils.ConvertUnits;
|
|
2248
|
+
this.result = '';
|
|
2249
|
+
this.arguments = [];
|
|
1988
2250
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
var
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2251
|
+
UnitConverterComponent.prototype.ngOnInit = function () {
|
|
2252
|
+
return this.updateValue();
|
|
2253
|
+
};
|
|
2254
|
+
Object.defineProperty(UnitConverterComponent.prototype, "args", {
|
|
2255
|
+
get: function () {
|
|
2256
|
+
var _a;
|
|
2257
|
+
return (((_a = this.term) === null || _a === void 0 ? void 0 : _a.defaultProperties) || []).reduce(function (prev, prop) {
|
|
2258
|
+
var _c;
|
|
2259
|
+
var _a, _b;
|
|
2260
|
+
return (Object.assign(Object.assign({}, prev), (_c = {}, _c[(_b = (_a = prop.term) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()] = parsePropertyValue(prop.value), _c)));
|
|
2261
|
+
}, {});
|
|
2262
|
+
},
|
|
2263
|
+
enumerable: false,
|
|
2264
|
+
configurable: true
|
|
2265
|
+
});
|
|
2266
|
+
Object.defineProperty(UnitConverterComponent.prototype, "units", {
|
|
2267
|
+
get: function () {
|
|
2268
|
+
var _this = this;
|
|
2269
|
+
return this.fromUnits ?
|
|
2270
|
+
Object.values(utils.ConvertUnits).filter(function (v) { return v in utils.converters[_this.fromUnits]; }) :
|
|
2271
|
+
[];
|
|
2272
|
+
},
|
|
2273
|
+
enumerable: false,
|
|
2274
|
+
configurable: true
|
|
2275
|
+
});
|
|
2276
|
+
UnitConverterComponent.prototype.requireArgs = function (keys) {
|
|
2277
|
+
var args = this.args;
|
|
2278
|
+
this.arguments = keys.map(function (key) { return ({ key: key, value: args[key] || '' }); });
|
|
2279
|
+
};
|
|
2280
|
+
UnitConverterComponent.prototype.updateUnits = function () {
|
|
2281
|
+
var requiredKeys = [];
|
|
2282
|
+
if (this.fromUnits === utils.ConvertUnits.kg || this.toUnits === utils.ConvertUnits.kg) {
|
|
2283
|
+
requiredKeys = ['density'];
|
|
2284
|
+
}
|
|
2285
|
+
this.requireArgs(requiredKeys);
|
|
2286
|
+
return this.updateValue();
|
|
2287
|
+
};
|
|
2288
|
+
UnitConverterComponent.prototype.updateValue = function () {
|
|
2289
|
+
if (!this.fromUnits || !this.toUnits) {
|
|
2290
|
+
return;
|
|
2291
|
+
}
|
|
2292
|
+
var args = Object.assign(Object.assign({}, this.args), this.arguments.reduce(function (prev, _c) {
|
|
2293
|
+
var _d;
|
|
2294
|
+
var key = _c.key, value = _c.value;
|
|
2295
|
+
return (Object.assign(Object.assign({}, prev), (_d = {}, _d[key] = value, _d)));
|
|
2296
|
+
}, {}));
|
|
2297
|
+
try {
|
|
2298
|
+
this.result = parseResult(utils.convertValue(this.value, this.fromUnits, this.toUnits, args));
|
|
2299
|
+
}
|
|
2300
|
+
catch (_) { }
|
|
2301
|
+
};
|
|
2302
|
+
return UnitConverterComponent;
|
|
2303
|
+
}());
|
|
2304
|
+
UnitConverterComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: UnitConverterComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2305
|
+
UnitConverterComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: UnitConverterComponent, selector: "he-unit-converter", inputs: { term: "term", value: "value", fromUnits: "fromUnits", toUnits: "toUnits" }, ngImport: i0__namespace, template: "<div class=\"columns mb-0\">\n <div class=\"column\">\n <label class=\"label has-text-white\" for=\"value\">Value</label>\n </div>\n <div class=\"column\">\n <label class=\"label has-text-white\" for=\"result\">Convert To</label>\n </div>\n</div>\n\n<div class=\"columns\">\n <div class=\"column\">\n <div class=\"field has-addons\">\n <div class=\"control\">\n <input type=\"number\" class=\"input\" [(ngModel)]=\"value\" name=\"value\" id=\"value\"\n (input)=\"updateValue()\"\n >\n </div>\n <div class=\"control is-expanded\">\n <div class=\"select is-fullwidth\">\n <select [(ngModel)]=\"fromUnits\" name=\"fromUnits\" id=\"fromUnits\"\n (change)=\"updateUnits()\"\n >\n <option [value]=\"undefined\">Unit</option>\n <option *ngFor=\"let unit of ConvertUnits | keys\" [value]=\"unit.value\">{{unit.key}}</option>\n </select>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"column\">\n <div class=\"field has-addons\">\n <div class=\"control\">\n <input type=\"string\" class=\"input\" [value]=\"result\" name=\"result\" id=\"result\" readonly>\n </div>\n <div class=\"control\">\n <div class=\"select is-fullwidth\">\n <select [(ngModel)]=\"toUnits\" name=\"toUnits\" id=\"toUnits\"\n (change)=\"updateUnits()\"\n >\n <option [value]=\"undefined\">Unit</option>\n <option *ngFor=\"let unit of units\" [value]=\"unit\">{{unit}}</option>\n </select>\n </div>\n </div>\n <div class=\"control\">\n <he-clipboard clipboardClass=\"button is-white px-2\"\n [value]=\"result\" [disabled]=\"!result\" [hideText]=\"true\"\n ></he-clipboard>\n </div>\n </div>\n </div>\n</div>\n\n<div class=\"field is-horizontal\" *ngFor=\"let arg of arguments\">\n <div class=\"field-label is-normal\">\n <label class=\"label has-text-white\" [for]=\"arg.key\">\n <span class=\"is-capitalized\">{{arg.key}}</span>\n <span class=\"has-text-danger pl-1\">*</span>\n </label>\n </div>\n <div class=\"field-body\">\n <div class=\"field\">\n <div class=\"control\">\n <input type=\"string\" class=\"input is-small\"\n [(ngModel)]=\"arg.value\" [id]=\"arg.key\"\n (input)=\"updateValue()\"\n placeholder=\"Required for conversion\"\n >\n </div>\n </div>\n </div>\n</div>\n", styles: [".select{min-width:85px}\n"], components: [{ type: ClipboardComponent, selector: "he-clipboard", inputs: ["value", "disabled", "hideText", "icon", "size", "rotate", "clipboardClass"] }], directives: [{ type: i1__namespace$4.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i1__namespace$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1__namespace$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1__namespace$4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i1__namespace$4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "keys": KeysPipe } });
|
|
2306
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: UnitConverterComponent, decorators: [{
|
|
2307
|
+
type: i0.Component,
|
|
2308
|
+
args: [{
|
|
2309
|
+
selector: 'he-unit-converter',
|
|
2310
|
+
templateUrl: './unit-converter.component.html',
|
|
2311
|
+
styleUrls: ['./unit-converter.component.scss']
|
|
2312
|
+
}]
|
|
2313
|
+
}], propDecorators: { term: [{
|
|
2314
|
+
type: i0.Input
|
|
2315
|
+
}], value: [{
|
|
2316
|
+
type: i0.Input
|
|
2317
|
+
}], fromUnits: [{
|
|
2318
|
+
type: i0.Input
|
|
2319
|
+
}], toUnits: [{
|
|
2320
|
+
type: i0.Input
|
|
2321
|
+
}] } });
|
|
2322
|
+
|
|
2323
|
+
/* eslint-disable @angular-eslint/directive-selector */
|
|
2324
|
+
var ClickOutsideDirective = /** @class */ (function () {
|
|
2325
|
+
function ClickOutsideDirective(elementRef) {
|
|
2326
|
+
this.elementRef = elementRef;
|
|
2327
|
+
this.clickOutside = new i0.EventEmitter();
|
|
2328
|
+
}
|
|
2329
|
+
ClickOutsideDirective.prototype.onClick = function (event) {
|
|
2330
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
2331
|
+
this.clickOutside.emit();
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
return ClickOutsideDirective;
|
|
2335
|
+
}());
|
|
2336
|
+
ClickOutsideDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ClickOutsideDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2337
|
+
ClickOutsideDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ClickOutsideDirective, selector: "[clickOutside]", outputs: { clickOutside: "clickOutside" }, host: { listeners: { "document:click": "onClick($event)" } }, ngImport: i0__namespace });
|
|
2338
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ClickOutsideDirective, decorators: [{
|
|
2339
|
+
type: i0.Directive,
|
|
2340
|
+
args: [{
|
|
2341
|
+
selector: '[clickOutside]'
|
|
2342
|
+
}]
|
|
2343
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { clickOutside: [{
|
|
2344
|
+
type: i0.Output
|
|
2345
|
+
}], onClick: [{
|
|
2346
|
+
type: i0.HostListener,
|
|
2347
|
+
args: ['document:click', ['$event']]
|
|
2348
|
+
}] } });
|
|
2349
|
+
|
|
2350
|
+
var get$4 = require('lodash.get');
|
|
2351
|
+
var GetPipe = /** @class */ (function () {
|
|
2352
|
+
function GetPipe() {
|
|
2353
|
+
}
|
|
2354
|
+
GetPipe.prototype.transform = function (value, key, defaultValue) {
|
|
2355
|
+
if (defaultValue === void 0) { defaultValue = ''; }
|
|
2356
|
+
return get$4(value, key, defaultValue);
|
|
2357
|
+
};
|
|
2358
|
+
return GetPipe;
|
|
2359
|
+
}());
|
|
2360
|
+
GetPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GetPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
2361
|
+
GetPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GetPipe, name: "get" });
|
|
2362
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: GetPipe, decorators: [{
|
|
2363
|
+
type: i0.Pipe,
|
|
2364
|
+
args: [{
|
|
2365
|
+
name: 'get'
|
|
2366
|
+
}]
|
|
2367
|
+
}] });
|
|
2368
|
+
|
|
2369
|
+
/* eslint-disable */
|
|
2370
|
+
/**
|
|
2371
|
+
* @class EventEmitter
|
|
2372
|
+
*
|
|
2373
|
+
* @property {Array} _listeners
|
|
2374
|
+
*/
|
|
2375
|
+
var EventEmitter = /** @class */ (function () {
|
|
2376
|
+
/**
|
|
2377
|
+
* Construct EventEmitter
|
|
2378
|
+
*
|
|
2379
|
+
* @param listeners
|
|
2380
|
+
*/
|
|
2381
|
+
function EventEmitter(listeners) {
|
|
2382
|
+
if (listeners === void 0) { listeners = []; }
|
|
2383
|
+
this._listeners = new Map(listeners);
|
|
2384
|
+
}
|
|
2385
|
+
/**
|
|
2386
|
+
* Destroys EventEmitter
|
|
2387
|
+
*/
|
|
2388
|
+
EventEmitter.prototype.destroy = function () {
|
|
2389
|
+
this._listeners = {};
|
|
2390
|
+
};
|
|
2391
|
+
/**
|
|
2392
|
+
* Count listeners registered for the provided eventName
|
|
2393
|
+
*
|
|
2394
|
+
* @param eventName
|
|
2395
|
+
*/
|
|
2396
|
+
EventEmitter.prototype.listenerCount = function (eventName) {
|
|
2397
|
+
if (!this._listeners.has(eventName)) {
|
|
2398
|
+
return 0;
|
|
2399
|
+
}
|
|
2400
|
+
return this._listeners.get(eventName).length;
|
|
2401
|
+
};
|
|
2402
|
+
/**
|
|
2403
|
+
* Subscribes on event eventName specified function
|
|
2404
|
+
*
|
|
2405
|
+
* @param eventName
|
|
2406
|
+
* @param listener
|
|
2407
|
+
*/
|
|
2408
|
+
EventEmitter.prototype.on = function (eventName, listener) {
|
|
2409
|
+
this._addListener(eventName, listener, false);
|
|
2410
|
+
};
|
|
2411
|
+
/**
|
|
2412
|
+
* Subscribes on event name specified function to fire only once
|
|
2413
|
+
*
|
|
2414
|
+
* @param eventName
|
|
2415
|
+
* @param listener
|
|
2416
|
+
*/
|
|
2417
|
+
EventEmitter.prototype.once = function (eventName, listener) {
|
|
2418
|
+
this._addListener(eventName, listener, true);
|
|
2419
|
+
};
|
|
2420
|
+
/**
|
|
2421
|
+
* Removes event with specified eventName.
|
|
2422
|
+
*
|
|
2423
|
+
* @param eventName
|
|
2424
|
+
*/
|
|
2425
|
+
EventEmitter.prototype.off = function (eventName) {
|
|
2426
|
+
this._removeListeners(eventName);
|
|
2427
|
+
};
|
|
2428
|
+
/**
|
|
2429
|
+
* Emits event with specified name and params.
|
|
2430
|
+
*
|
|
2431
|
+
* @param eventName
|
|
2432
|
+
* @param eventArgs
|
|
2433
|
+
*/
|
|
2434
|
+
EventEmitter.prototype.emit = function (eventName) {
|
|
2435
|
+
var eventArgs = [];
|
|
2436
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2437
|
+
eventArgs[_i - 1] = arguments[_i];
|
|
2438
|
+
}
|
|
2439
|
+
return this._applyEvents(eventName, eventArgs);
|
|
2440
|
+
};
|
|
2441
|
+
/**
|
|
2442
|
+
* Register a new listener
|
|
2443
|
+
*
|
|
2444
|
+
* @param eventName
|
|
2445
|
+
* @param listener
|
|
2446
|
+
* @param once
|
|
2447
|
+
*/
|
|
2448
|
+
EventEmitter.prototype._addListener = function (eventName, listener, once) {
|
|
2449
|
+
var _this = this;
|
|
2450
|
+
if (once === void 0) { once = false; }
|
|
2451
|
+
if (Array.isArray(eventName)) {
|
|
2452
|
+
eventName.forEach(function (e) { return _this._addListener(e, listener, once); });
|
|
2453
|
+
}
|
|
2454
|
+
else {
|
|
2455
|
+
eventName = eventName.toString();
|
|
2456
|
+
var split = eventName.split(/,|, | /);
|
|
2457
|
+
if (split.length > 1) {
|
|
2458
|
+
split.forEach(function (e) { return _this._addListener(e, listener, once); });
|
|
2459
|
+
}
|
|
2460
|
+
else {
|
|
2461
|
+
if (!Array.isArray(this._listeners.get(eventName))) {
|
|
2462
|
+
this._listeners.set(eventName, []);
|
|
2463
|
+
}
|
|
2464
|
+
(this._listeners.get(eventName)).push({
|
|
2465
|
+
once: once,
|
|
2466
|
+
fn: listener
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
};
|
|
2471
|
+
/**
|
|
2472
|
+
*
|
|
2473
|
+
* @param eventName
|
|
2474
|
+
*/
|
|
2475
|
+
EventEmitter.prototype._removeListeners = function (eventName) {
|
|
2476
|
+
var _this = this;
|
|
2477
|
+
if (eventName === void 0) { eventName = null; }
|
|
2478
|
+
if (eventName !== null) {
|
|
2479
|
+
if (Array.isArray(eventName)) {
|
|
2480
|
+
eventName.forEach(function (e) { return _this._removeListeners(e); });
|
|
2481
|
+
}
|
|
2482
|
+
else {
|
|
2483
|
+
eventName = eventName.toString();
|
|
2484
|
+
var split = eventName.split(/,|, | /);
|
|
2485
|
+
if (split.length > 1) {
|
|
2486
|
+
split.forEach(function (e) { return _this._removeListeners(e); });
|
|
2487
|
+
}
|
|
2488
|
+
else {
|
|
2489
|
+
this._listeners.delete(eventName);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
else {
|
|
2494
|
+
this._listeners = new Map();
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2497
|
+
/**
|
|
2498
|
+
* Applies arguments to specified event
|
|
2499
|
+
*
|
|
2500
|
+
* @param eventName
|
|
2501
|
+
* @param eventArguments
|
|
2502
|
+
* @protected
|
|
2503
|
+
*/
|
|
2504
|
+
EventEmitter.prototype._applyEvents = function (eventName, eventArguments) {
|
|
2505
|
+
var result = eventArguments;
|
|
2506
|
+
if (this._listeners.has(eventName)) {
|
|
2507
|
+
var listeners_1 = this._listeners.get(eventName);
|
|
2508
|
+
var removableListeners_1 = [];
|
|
2509
|
+
listeners_1.forEach(function (listener, index) {
|
|
2510
|
+
if (result = listener.fn.apply(null, eventArguments)) {
|
|
2511
|
+
if (listener.once) {
|
|
2512
|
+
removableListeners_1.unshift(index);
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2516
|
+
removableListeners_1.forEach(function (index) {
|
|
2517
|
+
listeners_1.splice(index, 1);
|
|
2518
|
+
});
|
|
2519
|
+
return result;
|
|
2520
|
+
}
|
|
2521
|
+
return result[0];
|
|
2522
|
+
};
|
|
2523
|
+
return EventEmitter;
|
|
2524
|
+
}());
|
|
2525
|
+
|
|
2526
|
+
var isFunction = function (unknown) { return typeof unknown === 'function'; };
|
|
2527
|
+
var isString = function (unknown) { return (typeof unknown === 'string' ||
|
|
2528
|
+
((!!unknown && typeof unknown === 'object') && Object.prototype.toString.call(unknown) === '[object String]')); };
|
|
2529
|
+
var isObject = function (unknown) { return ((typeof unknown === 'function' || (typeof unknown === 'object' && !!unknown)) && !Array.isArray(unknown)); };
|
|
2530
|
+
// Returns true if the value has a "then" function. Adapted from
|
|
2531
|
+
// https://github.com/graphql/graphql-js/blob/499a75939f70c4863d44149371d6a99d57ff7c35/src/jsutils/isPromise.js
|
|
2532
|
+
var isPromise = function (value) { return Boolean(value && typeof value.then === 'function'); };
|
|
2533
|
+
var isNode = function (unknown) {
|
|
2534
|
+
try {
|
|
2535
|
+
Node.prototype.cloneNode.call(unknown, false);
|
|
2536
|
+
return true;
|
|
2537
|
+
}
|
|
2538
|
+
catch (err) {
|
|
2539
|
+
return false;
|
|
2540
|
+
}
|
|
2541
|
+
};
|
|
2542
|
+
/**
|
|
2543
|
+
* Convert String (false,False,True,true,no,yes,0,1) to real Boolean
|
|
2544
|
+
*
|
|
2545
|
+
* @param val
|
|
2546
|
+
*/
|
|
2547
|
+
var BooleanParse = function (val) {
|
|
2548
|
+
var falsy = /^(?:f(?:alse)?|no?|0+)$/i;
|
|
2549
|
+
return !falsy.test(val) && !!val;
|
|
2550
|
+
};
|
|
2551
|
+
/**
|
|
2552
|
+
* Check if given query selector is valid
|
|
2553
|
+
*
|
|
2554
|
+
* @param selector
|
|
2555
|
+
*/
|
|
2556
|
+
var isSelectorValid = function (selector) {
|
|
2557
|
+
var queryCheck = function (s) { return document.createDocumentFragment().querySelector(s); };
|
|
2558
|
+
try {
|
|
2559
|
+
queryCheck(selector);
|
|
2560
|
+
}
|
|
2561
|
+
catch (_a) {
|
|
2562
|
+
return false;
|
|
2563
|
+
}
|
|
2564
|
+
return true;
|
|
2565
|
+
};
|
|
2566
|
+
|
|
2567
|
+
/**
|
|
2568
|
+
* querySelector under steroid
|
|
2569
|
+
* Can use as selector:
|
|
2570
|
+
* - function
|
|
2571
|
+
* - DOM Node
|
|
2572
|
+
* - String
|
|
2573
|
+
*
|
|
2574
|
+
* @param selector
|
|
2575
|
+
* @param node
|
|
2576
|
+
*/
|
|
2577
|
+
var querySelector = function (selector, node) {
|
|
2578
|
+
if (isFunction(selector)) {
|
|
2579
|
+
return selector(node);
|
|
2580
|
+
}
|
|
2581
|
+
if (isNode(selector)) {
|
|
2582
|
+
return selector;
|
|
2583
|
+
}
|
|
2584
|
+
if (isString(selector)) {
|
|
2585
|
+
if (!node || !isNode(node) || node.nodeType !== 1) {
|
|
2586
|
+
node = document;
|
|
2587
|
+
}
|
|
2588
|
+
return node.querySelector(selector);
|
|
2589
|
+
}
|
|
2590
|
+
if (Array.isArray(selector) || (typeof NodeList !== 'undefined' && NodeList.prototype.isPrototypeOf(selector))) {
|
|
2591
|
+
return selector[0];
|
|
2592
|
+
}
|
|
2593
|
+
};
|
|
2594
|
+
/**
|
|
2595
|
+
* querySelectorAll under steroid
|
|
2596
|
+
* Can use as selector:
|
|
2597
|
+
* - function
|
|
2598
|
+
* - DOM Node
|
|
2599
|
+
* - String
|
|
2600
|
+
*
|
|
2601
|
+
* @param selector
|
|
2602
|
+
* @param node
|
|
2603
|
+
*/
|
|
2604
|
+
var querySelectorAll = function (selector, node) {
|
|
2605
|
+
if (isFunction(selector)) {
|
|
2606
|
+
return selector(node);
|
|
2607
|
+
}
|
|
2608
|
+
if (isNode(selector)) {
|
|
2609
|
+
return [selector];
|
|
2610
|
+
}
|
|
2611
|
+
if (isString(selector)) {
|
|
2612
|
+
if (!node || !isNode(node) || node.nodeType !== 1) {
|
|
2613
|
+
node = document;
|
|
2614
|
+
}
|
|
2615
|
+
return node.querySelectorAll(selector);
|
|
2616
|
+
}
|
|
2617
|
+
if (typeof NodeList !== 'undefined' && NodeList.prototype.isPrototypeOf(selector)) {
|
|
2618
|
+
return selector;
|
|
2619
|
+
}
|
|
2620
|
+
return [];
|
|
2621
|
+
};
|
|
2622
|
+
// Convert dataset into Object
|
|
2623
|
+
var optionsFromDataset = function (node, defaultOptions) {
|
|
2624
|
+
if (defaultOptions === void 0) { defaultOptions = {}; }
|
|
2625
|
+
if (isNode(node)) {
|
|
2626
|
+
return node.dataset ? Object.keys(node.dataset)
|
|
2627
|
+
.filter(function (key) { return Object.keys(defaultOptions).includes(key); })
|
|
2628
|
+
.reduce(function (obj, key) {
|
|
2629
|
+
var _a;
|
|
2630
|
+
return (Object.assign(Object.assign({}, obj), (_a = {}, _a[key] = node.dataset[key], _a)));
|
|
2631
|
+
}, {}) : {};
|
|
2632
|
+
}
|
|
2633
|
+
return {};
|
|
2634
|
+
};
|
|
2635
|
+
/**
|
|
2636
|
+
* Copy HTML attributes from a source element to a target element
|
|
2637
|
+
*
|
|
2638
|
+
* @param target
|
|
2639
|
+
* @param source
|
|
2640
|
+
* @param except list of attributes to skip (separated by space)
|
|
2641
|
+
*/
|
|
2642
|
+
var cloneAttributes = function (target, source, except) {
|
|
2643
|
+
if (except === void 0) { except = null; }
|
|
2644
|
+
if (except !== null) {
|
|
2645
|
+
except = except.split(' ');
|
|
2646
|
+
}
|
|
2647
|
+
__spreadArray([], __read(source.attributes)).forEach(function (attr) {
|
|
2648
|
+
if (!except.includes(attr.nodeName)) {
|
|
2649
|
+
target.setAttribute(attr.nodeName === 'id' ? 'data-id' : attr.nodeName, attr.nodeValue);
|
|
2650
|
+
}
|
|
2651
|
+
});
|
|
2652
|
+
};
|
|
2653
|
+
/**
|
|
2654
|
+
* Escapes string for insertion into HTML, replacing special characters with HTML
|
|
2655
|
+
* entities.
|
|
2656
|
+
*
|
|
2657
|
+
* @param string
|
|
2658
|
+
*/
|
|
2659
|
+
var escape = function (string) { return isString(string) ?
|
|
2660
|
+
string.replace(/(['"<>])/g, function (char) { return ({
|
|
2661
|
+
'<': '<',
|
|
2662
|
+
'>': '>',
|
|
2663
|
+
'"': '"',
|
|
2664
|
+
'\'': '''
|
|
2665
|
+
}[char]); })
|
|
2666
|
+
: string; };
|
|
2667
|
+
|
|
2668
|
+
/* eslint-disable */
|
|
2669
|
+
var uuid = (function (prefix) {
|
|
2670
|
+
if (prefix === void 0) { prefix = ''; }
|
|
2671
|
+
return (prefix + (1e7 + -1e3 + -4e3 + -8e3 + -1e11)).replace(/[018]/g, function (c) { return (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16); });
|
|
2672
|
+
});
|
|
2673
|
+
|
|
2674
|
+
var Component = /** @class */ (function (_super) {
|
|
2675
|
+
__extends(Component, _super);
|
|
2676
|
+
function Component(element, options, defaultOptions) {
|
|
2677
|
+
if (options === void 0) { options = {}; }
|
|
2678
|
+
if (defaultOptions === void 0) { defaultOptions = {}; }
|
|
2679
|
+
var _this = _super.call(this) || this;
|
|
2680
|
+
_this.element = querySelector(element, document);
|
|
2681
|
+
// An invalid selector or non-DOM node has been provided.
|
|
2682
|
+
if (!_this.element) {
|
|
2683
|
+
throw new Error("An invalid selector or non-DOM node has been provided for " + _this.constructor.name + ".");
|
|
2684
|
+
}
|
|
2685
|
+
_this.id = uuid('c-');
|
|
2686
|
+
_this.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), options), optionsFromDataset(_this.element, defaultOptions) // Use Element dataset values to override options
|
|
2687
|
+
);
|
|
2688
|
+
return _this;
|
|
2689
|
+
}
|
|
2690
|
+
/**
|
|
2691
|
+
* Initiate all DOM element corresponding to selector
|
|
2692
|
+
*
|
|
2693
|
+
* @method
|
|
2694
|
+
* @return Array of all Plugin instances
|
|
2695
|
+
*/
|
|
2696
|
+
Component.attach = function (selector, options, node) {
|
|
2697
|
+
var _this = this;
|
|
2698
|
+
if (selector === void 0) { selector = null; }
|
|
2699
|
+
if (options === void 0) { options = {}; }
|
|
2700
|
+
if (node === void 0) { node = null; }
|
|
2701
|
+
var instances = new Array();
|
|
2702
|
+
if (selector !== null) {
|
|
2703
|
+
querySelectorAll(selector, node).forEach(function (element) {
|
|
2704
|
+
// Check if plugin has already been instantiated for element
|
|
2705
|
+
if (typeof element[_this.name] === 'undefined') { // If no then instantiate it and register it in element
|
|
2706
|
+
instances.push(new _this(element, Object.assign({ selector: selector }, options)));
|
|
2707
|
+
}
|
|
2708
|
+
else { // If Yes then return the existing instance
|
|
2709
|
+
instances.push(element[_this.name]);
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
if (typeof window[this.name] === 'undefined') {
|
|
2713
|
+
window[this.name] = {
|
|
2714
|
+
observers: []
|
|
2715
|
+
};
|
|
2716
|
+
}
|
|
2717
|
+
if (window[this.name]['observers'] && !window[this.name]['observers'].includes(selector)) {
|
|
2718
|
+
this.observeDom(selector, options);
|
|
2719
|
+
window[this.name]['observers'].push(selector);
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
return instances;
|
|
2723
|
+
};
|
|
2724
|
+
/**
|
|
2725
|
+
* Observe DOM mutations to automatically initialize plugin on new elements when added to the DOM
|
|
2726
|
+
*
|
|
2727
|
+
* @param selector
|
|
2728
|
+
* @param options
|
|
2729
|
+
*/
|
|
2730
|
+
Component.observeDom = function (selector, options) {
|
|
2731
|
+
var _this = this;
|
|
2732
|
+
var observer = new MutationObserver(function (mutations) {
|
|
2733
|
+
mutations.forEach(function (mutation) {
|
|
2734
|
+
for (var i = 0; i < mutation.addedNodes.length; i++) {
|
|
2735
|
+
if (typeof window[_this.name] !== 'undefined') {
|
|
2736
|
+
_this.attach(selector, options, mutation.addedNodes[i]);
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
});
|
|
2740
|
+
});
|
|
2741
|
+
if (typeof document !== 'undefined') {
|
|
2742
|
+
observer.observe(document, {
|
|
2743
|
+
childList: true,
|
|
2744
|
+
subtree: true
|
|
2745
|
+
});
|
|
2746
|
+
}
|
|
2747
|
+
};
|
|
2748
|
+
Component._interface = function (name, options) {
|
|
2749
|
+
if (name === void 0) { name = null; }
|
|
2750
|
+
if (options === void 0) { options = {}; }
|
|
2751
|
+
if (typeof name === 'string') {
|
|
2752
|
+
if (typeof this[name] === 'undefined') {
|
|
2753
|
+
throw new TypeError("No method named \"" + name + "\"");
|
|
2754
|
+
}
|
|
2755
|
+
return this[name](options);
|
|
2756
|
+
}
|
|
2757
|
+
return this;
|
|
2758
|
+
};
|
|
2759
|
+
return Component;
|
|
2760
|
+
}(EventEmitter));
|
|
2761
|
+
|
|
2762
|
+
var defaultOptions = {
|
|
2763
|
+
allowDuplicates: false,
|
|
2764
|
+
caseSensitive: true,
|
|
2765
|
+
clearSelectionOnTyping: false,
|
|
2766
|
+
closeDropdownOnItemSelect: true,
|
|
2767
|
+
delimiter: ',',
|
|
2768
|
+
freeInput: true,
|
|
2769
|
+
highlightDuplicate: true,
|
|
2770
|
+
highlightMatchesString: true,
|
|
2771
|
+
itemValue: undefined,
|
|
2772
|
+
itemText: undefined,
|
|
2773
|
+
maxTags: undefined,
|
|
2774
|
+
maxChars: undefined,
|
|
2775
|
+
minChars: 1,
|
|
2776
|
+
noResultsLabel: 'No results found',
|
|
2777
|
+
placeholder: '',
|
|
2778
|
+
removable: true,
|
|
2779
|
+
searchMinChars: 1,
|
|
2780
|
+
searchOn: 'text',
|
|
2781
|
+
selectable: true,
|
|
2782
|
+
source: undefined,
|
|
2783
|
+
tagClass: 'is-rounded',
|
|
2784
|
+
trim: true // Should we trim value before processing them ?
|
|
2785
|
+
};
|
|
2786
|
+
|
|
2787
|
+
var tagTemplate = (function (data) { return "<span class=\"tag " + escape(data.style) + "\" data-value=\"" + escape(data.value) + "\">\n " + escape(data.text) + "\n " + (data.removable ? '<div class="delete is-small" data-tag="delete"></div>' : '') + "\n </span>"; });
|
|
2788
|
+
|
|
2789
|
+
var containerTemplate = (function (data) { return "<div class=\"tags-input\">\n <input class=\"input\" type=\"text\" placeholder=\"" + escape(data.placeholder) + "\">\n <div id=\"" + escape(data.uuid) + "-list\" class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <span class=\"dropdown-item empty-title\">" + escape(data.emptyTitle) + "</span>\n </div>\n </div>\n </div>"; });
|
|
2790
|
+
|
|
2791
|
+
var dropdownItemTemplate = (function (data) { return "<a href=\"javascript:void(0);\" class=\"dropdown-item\" data-value=\"" + escape(data.value) + "\" data-text=\"" + escape(data.text) + "\">" + escape(data.text) + "</a>"; });
|
|
2792
|
+
|
|
2793
|
+
// TODO: add pattern or function to valdiate value before adding
|
|
2794
|
+
var BulmaTagsInput = /** @class */ (function (_super) {
|
|
2795
|
+
__extends(BulmaTagsInput, _super);
|
|
2796
|
+
function BulmaTagsInput(element, options) {
|
|
2797
|
+
if (options === void 0) { options = {}; }
|
|
2798
|
+
var _this = _super.call(this, element, options, defaultOptions) || this;
|
|
2799
|
+
// Convert Boolean string options to full Boolean
|
|
2800
|
+
_this.options.allowDuplicates = BooleanParse(_this.options.allowDuplicates);
|
|
2801
|
+
_this.options.caseSensitive = BooleanParse(_this.options.caseSensitive);
|
|
2802
|
+
_this.options.clearSelectionOnTyping = BooleanParse(_this.options.clearSelectionOnTyping);
|
|
2803
|
+
_this.options.closeDropdownOnItemSelect = BooleanParse(_this.options.closeDropdownOnItemSelect);
|
|
2804
|
+
_this.options.freeInput = BooleanParse(_this.options.freeInput);
|
|
2805
|
+
_this.options.highlightDuplicate = BooleanParse(_this.options.highlightDuplicate);
|
|
2806
|
+
_this.options.highlightMatchesString = BooleanParse(_this.options.highlightMatchesString);
|
|
2807
|
+
_this.options.removable = BooleanParse(_this.options.removable);
|
|
2808
|
+
_this.options.searchOn = _this.options.searchOn.toLowerCase();
|
|
2809
|
+
_this.options.selectable = BooleanParse(_this.options.selectable);
|
|
2810
|
+
_this.options.trim = BooleanParse(_this.options.trim);
|
|
2811
|
+
//Bind events to current class
|
|
2812
|
+
_this._onDocumentClick = _this._onDocumentClick.bind(_this);
|
|
2813
|
+
_this._onInputChange = _this._onInputChange.bind(_this);
|
|
2814
|
+
_this._onInputClick = _this._onInputClick.bind(_this);
|
|
2815
|
+
_this._onInputFocusOut = _this._onInputFocusOut.bind(_this);
|
|
2816
|
+
_this._onInputFocusIn = _this._onInputFocusIn.bind(_this);
|
|
2817
|
+
_this._onInputKeyDown = _this._onInputKeyDown.bind(_this);
|
|
2818
|
+
_this._onInputKeyPress = _this._onInputKeyPress.bind(_this);
|
|
2819
|
+
_this._onOriginalInputChange = _this._onOriginalInputChange.bind(_this);
|
|
2820
|
+
_this._onTagDeleteClick = _this._onTagDeleteClick.bind(_this);
|
|
2821
|
+
_this._onTagClick = _this._onTagClick.bind(_this);
|
|
2822
|
+
_this._onDropdownItemClick = _this._onDropdownItemClick.bind(_this);
|
|
2823
|
+
// Define internal variables
|
|
2824
|
+
_this._items = [];
|
|
2825
|
+
_this._selected = -1; // index of selected item
|
|
2826
|
+
// Initiate plugin
|
|
2827
|
+
_this._init();
|
|
2828
|
+
return _this;
|
|
2829
|
+
}
|
|
2830
|
+
/**
|
|
2831
|
+
* Initiate all DOM element corresponding to selector
|
|
2832
|
+
*
|
|
2833
|
+
* @method
|
|
2834
|
+
* @return Array of all Plugin instances
|
|
2835
|
+
*/
|
|
2836
|
+
BulmaTagsInput.attach = function (selector, options, container) {
|
|
2837
|
+
if (selector === void 0) { selector = 'input[data-type="tags"], input[type="tags"], select[data-type="tags"], select[type="tags"]'; }
|
|
2838
|
+
if (options === void 0) { options = {}; }
|
|
2839
|
+
if (container === void 0) { container = null; }
|
|
2840
|
+
return _super.attach.call(this, selector, options, container);
|
|
2841
|
+
};
|
|
2842
|
+
/**
|
|
2843
|
+
* Initiate plugin
|
|
2844
|
+
*
|
|
2845
|
+
* @method init
|
|
2846
|
+
* @return
|
|
2847
|
+
*/
|
|
2848
|
+
BulmaTagsInput.prototype._init = function () {
|
|
2849
|
+
var _this = this;
|
|
2850
|
+
// Detect if original input was a Select element
|
|
2851
|
+
this._isSelect = (this.element.tagName === 'SELECT');
|
|
2852
|
+
this._isMultiple = (this._isSelect && this.element.hasAttribute('multiple'));
|
|
2853
|
+
// Detect if we work with Object items or not
|
|
2854
|
+
// Object Items is forced when working with select element
|
|
2855
|
+
this._objectItems = (typeof this.options.itemValue !== 'undefined') || this._isSelect;
|
|
2856
|
+
this.options.itemValue = this.options.itemValue ? this.options.itemValue : (this._isSelect ? 'value' : undefined);
|
|
2857
|
+
this.options.itemText = this.options.itemText ? this.options.itemText : (this._isSelect ? 'text' : undefined);
|
|
2858
|
+
// If no itemText pass then use itemValue as itemText
|
|
2859
|
+
if (typeof this.options.itemText === 'undefined') {
|
|
2860
|
+
this.options.itemText = this.options.itemValue;
|
|
2861
|
+
}
|
|
2862
|
+
// Force freeInput to False if working with object items
|
|
2863
|
+
this.options.freeInput = this._objectItems ? false : this.options.freeInput;
|
|
2864
|
+
// Init search engine
|
|
2865
|
+
this.source = null;
|
|
2866
|
+
if (typeof this.options.source !== 'undefined') {
|
|
2867
|
+
// Fix searchOn option if wrong
|
|
2868
|
+
if (!['value', 'text'].includes(this.options.searchOn)) {
|
|
2869
|
+
this.options.searchOn = defaultOptions.searchOn;
|
|
2870
|
+
}
|
|
2871
|
+
if (isPromise(this.options.source)) {
|
|
2872
|
+
this.source = this.options.source;
|
|
2873
|
+
}
|
|
2874
|
+
else if (isFunction(this.options.source)) {
|
|
2875
|
+
this.source = function (value) { return Promise.resolve(_this.options.source(value)); };
|
|
2876
|
+
}
|
|
2877
|
+
else if (Array.isArray(this.options.source)) {
|
|
2878
|
+
this.source = function (value) { return Promise.resolve(_this.options.source.filter(function (i) {
|
|
2879
|
+
var val = (_this._objectItems ? i[_this.options.itemValue] : i);
|
|
2880
|
+
return _this.options.caseSensitive ? val.includes(value) : val.toLowerCase().includes(value.toLowerCase());
|
|
2881
|
+
})); };
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
// Determine allowed input modes
|
|
2885
|
+
this._manualInputAllowed = !this._isSelect && this.options.freeInput;
|
|
2886
|
+
this._filterInputAllowed = this._isSelect || this.source;
|
|
2887
|
+
this._build();
|
|
2888
|
+
};
|
|
2889
|
+
/**
|
|
2890
|
+
* Build TagsInput DOM elements
|
|
2891
|
+
*/
|
|
2892
|
+
BulmaTagsInput.prototype._build = function () {
|
|
2893
|
+
var _this = this;
|
|
2894
|
+
// Create TagsInput DOM
|
|
2895
|
+
var containerFragment = document.createRange().createContextualFragment(containerTemplate({
|
|
2896
|
+
emptyTitle: typeof this.options.noResultsLabel !== 'undefined' ? this.options.noResultsLabel : 'No results found',
|
|
2897
|
+
placeholder: this.element.placeholder ? this.element.placeholder : this.options.placeholder,
|
|
2898
|
+
uuid: this.id
|
|
2899
|
+
}));
|
|
2900
|
+
this.container = containerFragment.firstElementChild;
|
|
2901
|
+
this._input = this.container.querySelector('input');
|
|
2902
|
+
this.dropdown = this.container.querySelector("#" + this.id + "-list .dropdown-content");
|
|
2903
|
+
this.dropdownEmptyOption = this.dropdown.querySelector('.empty-title');
|
|
2904
|
+
// Clone attributes between original and new input
|
|
2905
|
+
cloneAttributes(this._input, this.element, 'data-type multiple name type value');
|
|
2906
|
+
if (this.element.disabled) {
|
|
2907
|
+
this.container.setAttribute('disabled', 'disabled');
|
|
2908
|
+
this.options.removable = false;
|
|
2909
|
+
this.options.selectable = false;
|
|
2910
|
+
}
|
|
2911
|
+
// Propagate original input disabled attribute to the container
|
|
2912
|
+
if (this._input.getAttribute('disabled') || this._input.classList.contains('is-disabled')) {
|
|
2913
|
+
this.container.setAttribute('disabled', 'disabled');
|
|
2914
|
+
}
|
|
2915
|
+
if (!this._manualInputAllowed) {
|
|
2916
|
+
this.container.classList.add(this._filterInputAllowed ? 'is-filter' : 'no-input');
|
|
2917
|
+
}
|
|
2918
|
+
// Remove dropdown if no source or original input is not a select element
|
|
2919
|
+
if (!this._isSelect && typeof this.options.source === 'undefined') {
|
|
2920
|
+
this.dropdown.remove();
|
|
2921
|
+
this.dropdown = null;
|
|
2922
|
+
this._input.setAttribute('list', null);
|
|
2923
|
+
}
|
|
2924
|
+
// Initialize plugin value from original input value
|
|
2925
|
+
if (this._isSelect) {
|
|
2926
|
+
Array.from(this.element.options).forEach(function (option) {
|
|
2927
|
+
if (option.selected) {
|
|
2928
|
+
// HTML Option element contains value and text properties
|
|
2929
|
+
// Add it silently to not propagate to the original element
|
|
2930
|
+
_this.add(option.value ? option : {
|
|
2931
|
+
value: option.text,
|
|
2932
|
+
text: option.text
|
|
2933
|
+
}, true);
|
|
2934
|
+
}
|
|
2935
|
+
_this._createDropdownItem(option);
|
|
2936
|
+
});
|
|
2937
|
+
}
|
|
2938
|
+
else {
|
|
2939
|
+
// We have on input element
|
|
2940
|
+
if (this.element.value.length) {
|
|
2941
|
+
this.add(this._objectItems ? JSON.parse(this.element.value) : this.element.value, true);
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
this._bindEvents();
|
|
2945
|
+
// Insert container right before original input and make original input hidden
|
|
2946
|
+
this.element.parentNode.insertBefore(this.container, this.element);
|
|
2947
|
+
// Hide original input (type="hidden" only works on select)
|
|
2948
|
+
this.element.style.display = 'none';
|
|
2949
|
+
};
|
|
2950
|
+
/**
|
|
2951
|
+
* Bind all events listener
|
|
2952
|
+
*/
|
|
2953
|
+
BulmaTagsInput.prototype._bindEvents = function () {
|
|
2954
|
+
// Bind document click event to close dropdown
|
|
2955
|
+
document.addEventListener('click', this._onDocumentClick);
|
|
2956
|
+
// Bind event handlers to orginal input
|
|
2957
|
+
this.element.addEventListener('change', this._onOriginalInputChange);
|
|
2958
|
+
// Bind event handlers to internal input
|
|
2959
|
+
this._input.addEventListener('input', this._onInputChange);
|
|
2960
|
+
this._input.addEventListener('click', this._onInputClick);
|
|
2961
|
+
this._input.addEventListener('keydown', this._onInputKeyDown);
|
|
2962
|
+
this._input.addEventListener('keypress', this._onInputKeyPress);
|
|
2963
|
+
this._input.addEventListener('focusout', this._onInputFocusOut);
|
|
2964
|
+
this._input.addEventListener('focusin', this._onInputFocusIn);
|
|
2965
|
+
};
|
|
2966
|
+
/**
|
|
2967
|
+
* Check if caret is at the beginning of the input value
|
|
2968
|
+
*/
|
|
2969
|
+
BulmaTagsInput.prototype._caretAtStart = function () {
|
|
2970
|
+
try {
|
|
2971
|
+
return this._input.selectionStart === 0 && this._input.selectionEnd === 0;
|
|
2972
|
+
}
|
|
2973
|
+
catch (e) {
|
|
2974
|
+
return this._input.value === '';
|
|
2975
|
+
}
|
|
2976
|
+
};
|
|
2977
|
+
/**
|
|
2978
|
+
* Check value length constraint if option activated
|
|
2979
|
+
*
|
|
2980
|
+
* @param item
|
|
2981
|
+
*/
|
|
2982
|
+
BulmaTagsInput.prototype._checkLength = function (item) {
|
|
2983
|
+
var value = this._objectItems ? item[this.options.itemValue] : item;
|
|
2984
|
+
if (!isString(value)) {
|
|
2985
|
+
return true;
|
|
2986
|
+
}
|
|
2987
|
+
return value.length >= this.options.minChars && (typeof this.options.maxChars === 'undefined' || value.length <= this.options.maxChars);
|
|
2988
|
+
};
|
|
2989
|
+
/**
|
|
2990
|
+
* Close dropdown
|
|
2991
|
+
*/
|
|
2992
|
+
BulmaTagsInput.prototype._closeDropdown = function () {
|
|
2993
|
+
if (this.dropdown) {
|
|
2994
|
+
this.emit('before.dropdown.close', this);
|
|
2995
|
+
this.container.classList.remove('is-active');
|
|
2996
|
+
this.emit('after.dropdown.close', this);
|
|
2997
|
+
}
|
|
2998
|
+
};
|
|
2999
|
+
/**
|
|
3000
|
+
* Create a new dropdown item based on given item data
|
|
3001
|
+
*
|
|
3002
|
+
* @param item
|
|
3003
|
+
*/
|
|
3004
|
+
BulmaTagsInput.prototype._createDropdownItem = function (item) {
|
|
3005
|
+
if (this.dropdown) {
|
|
3006
|
+
// TODO: add possibility to provide template through options
|
|
3007
|
+
var dropdownItemFragment = document.createRange().createContextualFragment(dropdownItemTemplate({
|
|
3008
|
+
text: item.text,
|
|
3009
|
+
value: item.value
|
|
3010
|
+
}));
|
|
3011
|
+
var dropdownItem = dropdownItemFragment.firstElementChild;
|
|
3012
|
+
// Save item data into dataset
|
|
3013
|
+
dropdownItem.dataset.value = item.value;
|
|
3014
|
+
dropdownItem.dataset.text = item.text;
|
|
3015
|
+
dropdownItem.addEventListener('click', this._onDropdownItemClick);
|
|
3016
|
+
this.dropdown.append(dropdownItem);
|
|
3017
|
+
}
|
|
3018
|
+
};
|
|
3019
|
+
/**
|
|
3020
|
+
* Create a new tag and add it to the DOM
|
|
3021
|
+
*
|
|
3022
|
+
* @param string value
|
|
3023
|
+
*/
|
|
3024
|
+
BulmaTagsInput.prototype._createTag = function (item) {
|
|
3025
|
+
var tagFragment = document.createRange().createContextualFragment(tagTemplate({
|
|
3026
|
+
removable: this.options.removable,
|
|
3027
|
+
style: this.options.tagClass,
|
|
3028
|
+
text: item.text,
|
|
3029
|
+
value: item.value
|
|
3030
|
+
}));
|
|
3031
|
+
var tag = tagFragment.firstElementChild;
|
|
3032
|
+
// Attach tag click event to select it
|
|
3033
|
+
tag.addEventListener('click', this._onTagClick);
|
|
3034
|
+
if (this.options.removable) {
|
|
3035
|
+
// Find delete button and attach click event
|
|
3036
|
+
var deleteButton = tag.querySelector('.delete');
|
|
3037
|
+
if (deleteButton) {
|
|
3038
|
+
deleteButton.addEventListener('click', this._onTagDeleteClick);
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
// insert new tag at the end (ie just before input)
|
|
3042
|
+
this.container.insertBefore(tag, this._input);
|
|
3043
|
+
};
|
|
3044
|
+
/**
|
|
3045
|
+
* Remove all dropdown items except the empty title
|
|
3046
|
+
*/
|
|
3047
|
+
BulmaTagsInput.prototype._emptyDropdown = function () {
|
|
3048
|
+
if (this.dropdown) {
|
|
3049
|
+
Array.from(this.dropdown.children).filter(function (child) { return !child.classList.contains('empty-title'); }).forEach(function (child) {
|
|
3050
|
+
child.remove();
|
|
3051
|
+
});
|
|
3052
|
+
}
|
|
3053
|
+
};
|
|
3054
|
+
/**
|
|
3055
|
+
* Find needle into a string and wrap it with <mark> HTML tag
|
|
3056
|
+
*
|
|
3057
|
+
* @param string
|
|
3058
|
+
* @param needle
|
|
3059
|
+
*/
|
|
3060
|
+
BulmaTagsInput.prototype._highlightMatchesInString = function (string, needle) {
|
|
3061
|
+
var reg = '(' + needle + ')(?![^<]*>|[^<>]*</)'; // explanation: http://stackoverflow.com/a/18622606/1147859
|
|
3062
|
+
var regex = new RegExp(reg, 'i');
|
|
3063
|
+
// If the regex doesn't match the string just return initial string
|
|
3064
|
+
if (!string.match(regex)) {
|
|
3065
|
+
return string;
|
|
3066
|
+
}
|
|
3067
|
+
// Otherwise, get to highlighting
|
|
3068
|
+
var matchStartPosition = string.match(regex).index;
|
|
3069
|
+
var matchEndPosition = matchStartPosition + string.match(regex)[0].toString().length;
|
|
3070
|
+
var originalTextFoundByRegex = string.substring(matchStartPosition, matchEndPosition);
|
|
3071
|
+
string = string.replace(regex, "<mark class=\"is-highlighted\">" + originalTextFoundByRegex + "</mark>");
|
|
3072
|
+
return string;
|
|
3073
|
+
};
|
|
3074
|
+
/**
|
|
3075
|
+
* Open dropdown
|
|
3076
|
+
*/
|
|
3077
|
+
BulmaTagsInput.prototype._openDropdown = function () {
|
|
3078
|
+
if (this.dropdown) {
|
|
3079
|
+
this.container.classList.add('is-active');
|
|
3080
|
+
}
|
|
3081
|
+
};
|
|
3082
|
+
/**
|
|
3083
|
+
* Propagate internal input changes to the original input
|
|
3084
|
+
*/
|
|
3085
|
+
BulmaTagsInput.prototype._propagateChange = function () {
|
|
3086
|
+
var _this = this;
|
|
3087
|
+
if (!this._isSelect) {
|
|
3088
|
+
// If original element is an input element
|
|
3089
|
+
this.element.value = this.value;
|
|
3090
|
+
}
|
|
3091
|
+
else {
|
|
3092
|
+
// If original element is a select element
|
|
3093
|
+
Array.from(this.element.options).forEach(function (option) {
|
|
3094
|
+
option.setAttribute('selected', undefined);
|
|
3095
|
+
option.selected = false;
|
|
3096
|
+
// If option has been added by TagsInput then we remove it
|
|
3097
|
+
// Otherwise it is an original option
|
|
3098
|
+
if (typeof option.dataset.source !== 'undefined') {
|
|
3099
|
+
option.remove();
|
|
3100
|
+
}
|
|
3101
|
+
});
|
|
3102
|
+
// Update original element options selected attributes
|
|
3103
|
+
this._items.forEach(function (item) {
|
|
3104
|
+
_this._updateSelectOptions({
|
|
3105
|
+
value: _this._objectItems ? item[_this.options.itemValue] : item,
|
|
3106
|
+
text: _this._objectItems ? item[_this.options.itemText] : item
|
|
3107
|
+
});
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
// Trigger Change event manually (because original input is now hidden)
|
|
3111
|
+
// Trick: Passes current class constructor name to prevent loop with _onOriginalInputChange handler)
|
|
3112
|
+
var changeEvent = new CustomEvent('change', {
|
|
3113
|
+
detail: this.constructor.name
|
|
3114
|
+
});
|
|
3115
|
+
this.element.dispatchEvent(changeEvent);
|
|
3116
|
+
};
|
|
3117
|
+
/**
|
|
3118
|
+
* Trim value if option activated
|
|
3119
|
+
*
|
|
3120
|
+
* @param item
|
|
3121
|
+
*/
|
|
3122
|
+
BulmaTagsInput.prototype._trim = function (item) {
|
|
3123
|
+
if (this.options.trim) {
|
|
3124
|
+
if (this._objectItems) {
|
|
3125
|
+
if (isString(item[this.options.itemValue])) {
|
|
3126
|
+
item[this.options.itemValue] = item[this.options.itemValue].trim();
|
|
3127
|
+
}
|
|
3128
|
+
if (isString(item[this.options.itemText])) {
|
|
3129
|
+
item[this.options.itemText] = item[this.options.itemText].trim();
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
else {
|
|
3133
|
+
item = item.trim();
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
return item;
|
|
3137
|
+
};
|
|
3138
|
+
/**
|
|
3139
|
+
* Filter Dropdown items to be compliant with already selected items and current input value
|
|
3140
|
+
* Filtering is made on Text by default (can be changed with option)
|
|
3141
|
+
*/
|
|
3142
|
+
BulmaTagsInput.prototype._filterDropdownItems = function (value) {
|
|
3143
|
+
var _this = this;
|
|
3144
|
+
if (value === void 0) { value = null; }
|
|
3145
|
+
if (this.dropdown) {
|
|
3146
|
+
if (this.emit('before.dropdown.filter', this)) {
|
|
3147
|
+
Array.from(this.dropdown.children).filter(function (child) { return !child.classList.contains('empty-title'); }).forEach(function (child) {
|
|
3148
|
+
var childValue = child.dataset[_this.options.searchOn];
|
|
3149
|
+
// Remove highlights
|
|
3150
|
+
if (_this.options.highlightMatchesString) {
|
|
3151
|
+
child.textContent = child.textContent.replace(/<\/?(mark\s?(class="is\-highlighted")?)?>]*>?/gm, '');
|
|
3152
|
+
}
|
|
3153
|
+
// If value is found in dropdown
|
|
3154
|
+
if ((value && value.length)) {
|
|
3155
|
+
if (_this.options.caseSensitive) {
|
|
3156
|
+
child.style.display = childValue.includes(value) ? 'block' : 'none';
|
|
3157
|
+
}
|
|
3158
|
+
else {
|
|
3159
|
+
child.style.display = childValue.toLowerCase().includes(value.toLowerCase()) ? 'block' : 'none';
|
|
3160
|
+
}
|
|
3161
|
+
if (_this.options.highlightMatchesString) {
|
|
3162
|
+
child.innerHTML = _this._highlightMatchesInString(child.innerHTML, value);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
else {
|
|
3166
|
+
child.style.display = 'block';
|
|
3167
|
+
}
|
|
3168
|
+
if (!_this.options.allowDuplicates || (_this._isSelect && !_this._isMultiple)) {
|
|
3169
|
+
var hasValue = _this.options.searchOn === 'value' ? _this.hasValue(childValue) : _this.hasText(childValue);
|
|
3170
|
+
child.style.display = hasValue ? 'none' : child.style.display;
|
|
3171
|
+
}
|
|
3172
|
+
});
|
|
3173
|
+
var hasActiveItems = Array.from(this.dropdown.children).filter(function (child) { return !child.classList.contains('empty-title'); }).some(function (child) { return child.style.display !== 'none'; });
|
|
3174
|
+
if (hasActiveItems) {
|
|
3175
|
+
this.dropdownEmptyOption.style.display = 'none';
|
|
3176
|
+
}
|
|
3177
|
+
else {
|
|
3178
|
+
this.dropdownEmptyOption.style.display = 'block';
|
|
3179
|
+
}
|
|
3180
|
+
this.emit('after.dropdown.filter', this);
|
|
3181
|
+
return hasActiveItems;
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
return true;
|
|
3185
|
+
};
|
|
3186
|
+
/**
|
|
3187
|
+
* Update original select option based on given item
|
|
3188
|
+
*
|
|
3189
|
+
* @param item
|
|
3190
|
+
*/
|
|
3191
|
+
BulmaTagsInput.prototype._updateSelectOptions = function (item) {
|
|
3192
|
+
if (this._isSelect) {
|
|
3193
|
+
// Check to see if the tag exists in its raw or uri-encoded form
|
|
3194
|
+
var option = this.element.querySelector("option[value=\"" + encodeURIComponent(item.value) + "\"]") || this.element.querySelector("option[value=\"" + item.value + "\"]");
|
|
3195
|
+
// add <option /> if item represents a value not present in one of the <select />'s options
|
|
3196
|
+
if (!option) {
|
|
3197
|
+
var optionFragment = document.createRange().createContextualFragment("<option value=\"" + item.value + "\" data-source=\"" + this.id + "\" selected>" + item.text + "</option>");
|
|
3198
|
+
option = optionFragment.firstElementChild;
|
|
3199
|
+
this.element.add(option);
|
|
3200
|
+
}
|
|
3201
|
+
// mark option as selected
|
|
3202
|
+
option.setAttribute('selected', 'selected');
|
|
3203
|
+
option.selected = true;
|
|
3204
|
+
}
|
|
3205
|
+
};
|
|
3206
|
+
/**
|
|
3207
|
+
* Add given item
|
|
3208
|
+
* item = 'john'
|
|
3209
|
+
* item = 'john,jane'
|
|
3210
|
+
* item = ['john', 'jane']
|
|
3211
|
+
* item = [{
|
|
3212
|
+
* "value": "1",
|
|
3213
|
+
* "text": "John"
|
|
3214
|
+
* }, {
|
|
3215
|
+
* "value": "2",
|
|
3216
|
+
* "text": "Jane"
|
|
3217
|
+
* }]
|
|
3218
|
+
*
|
|
3219
|
+
* @param item
|
|
3220
|
+
* @param silently Should the change be propagated to the original element
|
|
3221
|
+
*/
|
|
3222
|
+
BulmaTagsInput.prototype.add = function (items, silently) {
|
|
3223
|
+
var _this = this;
|
|
3224
|
+
if (silently === void 0) { silently = false; }
|
|
3225
|
+
// Check if number of items is limited ans reached
|
|
3226
|
+
if (typeof this.options.maxTags !== 'undefined' && this._items.length >= this.options.maxTags) {
|
|
3227
|
+
return this;
|
|
3228
|
+
}
|
|
3229
|
+
// Make sure to work with an array of items
|
|
3230
|
+
items = Array.isArray(items) ? items : isObject(items) ? [items] : items.split(this.options.delimiter);
|
|
3231
|
+
// If string items are expected then check every item is a string
|
|
3232
|
+
if (!this._objectItems && (items.filter(function (item) { return isString(item); }).length !== items.length)) {
|
|
3233
|
+
throw ('Item must be a string or an array of strings');
|
|
3234
|
+
}
|
|
3235
|
+
// If object items are expected then check every item is an object
|
|
3236
|
+
if (this._objectItems && (items.filter(function (item) { return isObject(item); }).length !== items.length)) {
|
|
3237
|
+
throw ('Item must be an object or an array of objects');
|
|
3238
|
+
}
|
|
3239
|
+
items.forEach(function (item) {
|
|
3240
|
+
item = _this._trim(item);
|
|
3241
|
+
// Check if item respects min/max chars
|
|
3242
|
+
if (_this._checkLength(item)) {
|
|
3243
|
+
// If original input is a non multiple select element
|
|
3244
|
+
if (_this._isSelect && !_this._isMultiple && _this._items.length > 0) {
|
|
3245
|
+
_this.removeAtIndex(0);
|
|
3246
|
+
_this.element.remove(_this.element.selectedIndex);
|
|
3247
|
+
}
|
|
3248
|
+
// check if duplicates are allowed or not
|
|
3249
|
+
if (item = _this.emit('before.add', item)) {
|
|
3250
|
+
if (_this.options.allowDuplicates || !_this.has(item)) {
|
|
3251
|
+
var itemData = {
|
|
3252
|
+
value: _this._objectItems ? item[_this.options.itemValue] : item,
|
|
3253
|
+
text: _this._objectItems ? item[_this.options.itemText] : item
|
|
3254
|
+
};
|
|
3255
|
+
var tag = _this._createTag(itemData);
|
|
3256
|
+
// save item into the internal array
|
|
3257
|
+
_this._items.push(item);
|
|
3258
|
+
if (!silently) {
|
|
3259
|
+
// Propagate change event to the original input
|
|
3260
|
+
_this._propagateChange();
|
|
3261
|
+
_this.emit('after.add', {
|
|
3262
|
+
item: item,
|
|
3263
|
+
tag: tag
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
else {
|
|
3268
|
+
if (_this.options.highlightDuplicate) {
|
|
3269
|
+
var duplicateTag_1 = Array.from(_this.container.children).filter(function (child) { return child.classList.contains('tag'); })[_this.indexOf(item)];
|
|
3270
|
+
if (duplicateTag_1) {
|
|
3271
|
+
duplicateTag_1.classList.add('is-duplicate');
|
|
3272
|
+
setTimeout(function () {
|
|
3273
|
+
duplicateTag_1.classList.remove('is-duplicate');
|
|
3274
|
+
}, 1250);
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
_this.emit('item.duplicate', item);
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
1998
3280
|
}
|
|
1999
3281
|
});
|
|
3282
|
+
return this;
|
|
2000
3283
|
};
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
this
|
|
2023
|
-
}
|
|
2024
|
-
HeToastService.prototype.success = function (message, duration) {
|
|
2025
|
-
if (duration === void 0) { duration = 3000; }
|
|
2026
|
-
this.toasts.next({
|
|
2027
|
-
id: ++toastId,
|
|
2028
|
-
message: message,
|
|
2029
|
-
duration: duration,
|
|
2030
|
-
color: 'success',
|
|
2031
|
-
showRawMessage: true
|
|
2032
|
-
});
|
|
3284
|
+
/**
|
|
3285
|
+
* Unselect the selected item
|
|
3286
|
+
*/
|
|
3287
|
+
BulmaTagsInput.prototype.clearSelection = function () {
|
|
3288
|
+
if (this._selected >= 0) {
|
|
3289
|
+
var item = this._items[this._selected];
|
|
3290
|
+
var tag = Array.from(this.container.children).filter(function (child) { return child.classList.contains('tag'); })[this._selected];
|
|
3291
|
+
if (this.emit('before.unselect', {
|
|
3292
|
+
item: item,
|
|
3293
|
+
tag: tag
|
|
3294
|
+
})) {
|
|
3295
|
+
if (tag) {
|
|
3296
|
+
tag.classList.remove('is-selected');
|
|
3297
|
+
}
|
|
3298
|
+
this._selected = -1;
|
|
3299
|
+
this.emit('after.unselect', {
|
|
3300
|
+
item: item,
|
|
3301
|
+
tag: tag
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
return this;
|
|
2033
3306
|
};
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
3307
|
+
/**
|
|
3308
|
+
* Shortcut to removeAll method
|
|
3309
|
+
*/
|
|
3310
|
+
BulmaTagsInput.prototype.flush = function () {
|
|
3311
|
+
return this.removeAll();
|
|
3312
|
+
};
|
|
3313
|
+
/**
|
|
3314
|
+
* Sets focus on the input
|
|
3315
|
+
*/
|
|
3316
|
+
BulmaTagsInput.prototype.focus = function () {
|
|
3317
|
+
this.container.classList.add('is-focused');
|
|
3318
|
+
this._input.focus();
|
|
3319
|
+
return this;
|
|
3320
|
+
};
|
|
3321
|
+
/**
|
|
3322
|
+
* Check if given item is present
|
|
3323
|
+
*
|
|
3324
|
+
* @param item
|
|
3325
|
+
*/
|
|
3326
|
+
BulmaTagsInput.prototype.has = function (item) {
|
|
3327
|
+
var _this = this;
|
|
3328
|
+
item = this._trim(item);
|
|
3329
|
+
if (this._objectItems) {
|
|
3330
|
+
return this._items.some(function (i) { return _this.options.caseSensitive || !isString(i[_this.options.itemValue]) ? i[_this.options.itemValue] === item[_this.options.itemValue] : i[_this.options.itemValue].toLowerCase() === item[_this.options.itemValue].toLowerCase(); });
|
|
3331
|
+
}
|
|
3332
|
+
else {
|
|
3333
|
+
return this.hasValue(item);
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3336
|
+
/**
|
|
3337
|
+
* Check if given text is present
|
|
3338
|
+
*
|
|
3339
|
+
* @param value
|
|
3340
|
+
*/
|
|
3341
|
+
BulmaTagsInput.prototype.hasText = function (value) {
|
|
3342
|
+
var _this = this;
|
|
3343
|
+
if (this.options.trim) {
|
|
3344
|
+
value = value.trim();
|
|
3345
|
+
}
|
|
3346
|
+
return this._items.some(function (i) {
|
|
3347
|
+
var val = (_this._objectItems ? i[_this.options.itemText] : i);
|
|
3348
|
+
return _this.options.caseSensitive ? val === value : val.toLowerCase() === value.toLowerCase();
|
|
2043
3349
|
});
|
|
2044
3350
|
};
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
args: [{
|
|
2052
|
-
providedIn: 'root'
|
|
2053
|
-
}]
|
|
2054
|
-
}] });
|
|
2055
|
-
|
|
2056
|
-
var ToastComponent = /** @class */ (function () {
|
|
2057
|
-
function ToastComponent(toastService) {
|
|
2058
|
-
this.toastService = toastService;
|
|
2059
|
-
this.subscriptions = [];
|
|
2060
|
-
this.toasts = [];
|
|
2061
|
-
}
|
|
2062
|
-
ToastComponent.prototype.ngOnInit = function () {
|
|
3351
|
+
/**
|
|
3352
|
+
* Check if given value is present
|
|
3353
|
+
*
|
|
3354
|
+
* @param value
|
|
3355
|
+
*/
|
|
3356
|
+
BulmaTagsInput.prototype.hasValue = function (value) {
|
|
2063
3357
|
var _this = this;
|
|
2064
|
-
|
|
3358
|
+
if (this.options.trim) {
|
|
3359
|
+
value = value.trim();
|
|
3360
|
+
}
|
|
3361
|
+
return this._items.some(function (i) {
|
|
3362
|
+
var val = (_this._objectItems ? i[_this.options.itemValue] : i);
|
|
3363
|
+
return _this.options.caseSensitive ? val === value : val.toLowerCase() === value.toLowerCase();
|
|
3364
|
+
});
|
|
2065
3365
|
};
|
|
2066
|
-
|
|
2067
|
-
|
|
3366
|
+
/**
|
|
3367
|
+
* Get index of given item
|
|
3368
|
+
*
|
|
3369
|
+
* @param item
|
|
3370
|
+
*/
|
|
3371
|
+
BulmaTagsInput.prototype.indexOf = function (item) {
|
|
3372
|
+
item = this._trim(item);
|
|
3373
|
+
if (this._objectItems) {
|
|
3374
|
+
if (!isObject(item)) {
|
|
3375
|
+
throw ('Item must be an object');
|
|
3376
|
+
}
|
|
3377
|
+
return this._items.map(function (e) { return e.value; }).indexOf(item.value);
|
|
3378
|
+
}
|
|
3379
|
+
else {
|
|
3380
|
+
return this._items.indexOf(item);
|
|
3381
|
+
}
|
|
2068
3382
|
};
|
|
2069
|
-
|
|
3383
|
+
/**
|
|
3384
|
+
* Returns the internal input element
|
|
3385
|
+
*/
|
|
3386
|
+
BulmaTagsInput.prototype.input = function () {
|
|
3387
|
+
return this._input;
|
|
3388
|
+
};
|
|
3389
|
+
/**
|
|
3390
|
+
* Get items
|
|
3391
|
+
*/
|
|
3392
|
+
BulmaTagsInput.prototype.items = function () {
|
|
3393
|
+
return this._items;
|
|
3394
|
+
};
|
|
3395
|
+
/**
|
|
3396
|
+
* Remove given item
|
|
3397
|
+
* item = 'john'
|
|
3398
|
+
* item = 'john,jane'
|
|
3399
|
+
*
|
|
3400
|
+
* @param String item
|
|
3401
|
+
*/
|
|
3402
|
+
BulmaTagsInput.prototype.remove = function (items) {
|
|
2070
3403
|
var _this = this;
|
|
2071
|
-
this.
|
|
2072
|
-
|
|
2073
|
-
|
|
3404
|
+
if (this.options.removable) {
|
|
3405
|
+
// Make sure to work with an array of items
|
|
3406
|
+
items = Array.isArray(items) ? items : isObject(items) ? [items] : items.split(this.options.delimiter);
|
|
3407
|
+
// If string items are expected then check every item is a string
|
|
3408
|
+
if (!this._objectItems && (items.filter(function (item) { return isString(item); }).length !== items.length)) {
|
|
3409
|
+
throw ('Item must be a string or an array of strings');
|
|
3410
|
+
}
|
|
3411
|
+
// If object items are expected then check every item is an object
|
|
3412
|
+
if (this._objectItems && (items.filter(function (item) { return isObject(item); }).length !== items.length)) {
|
|
3413
|
+
throw ('Item must be an object or an array of objects');
|
|
3414
|
+
}
|
|
3415
|
+
items.forEach(function (item) {
|
|
3416
|
+
var index = _this.indexOf(item);
|
|
3417
|
+
while (index >= 0) {
|
|
3418
|
+
_this.removeAtIndex(index);
|
|
3419
|
+
index = _this.indexOf(item);
|
|
3420
|
+
}
|
|
3421
|
+
});
|
|
2074
3422
|
}
|
|
3423
|
+
return this;
|
|
2075
3424
|
};
|
|
2076
|
-
|
|
2077
|
-
|
|
3425
|
+
/**
|
|
3426
|
+
* Remove all tags at once
|
|
3427
|
+
*/
|
|
3428
|
+
BulmaTagsInput.prototype.removeAll = function () {
|
|
3429
|
+
if (this.options.removable) {
|
|
3430
|
+
if (this.emit('before.flush', this._items)) {
|
|
3431
|
+
this.clearSelection();
|
|
3432
|
+
Array.from(this.container.children).filter(function (child) { return child.classList.contains('tag'); }).forEach(function (tag) { return tag.remove(); });
|
|
3433
|
+
this._items = [];
|
|
3434
|
+
this._filterDropdownItems();
|
|
3435
|
+
this._propagateChange();
|
|
3436
|
+
this.emit('after.flush', this._items);
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
return this;
|
|
2078
3440
|
};
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
3441
|
+
/**
|
|
3442
|
+
* Remove item at given index
|
|
3443
|
+
*
|
|
3444
|
+
* @param Integer index
|
|
3445
|
+
*/
|
|
3446
|
+
BulmaTagsInput.prototype.removeAtIndex = function (index, clearSelection) {
|
|
3447
|
+
if (clearSelection === void 0) { clearSelection = true; }
|
|
3448
|
+
if (this.options.removable && !isNaN(index) && index >= 0 && index < this._items.length) {
|
|
3449
|
+
var tag = Array.from(this.container.children).filter(function (child) { return child.classList.contains('tag'); })[index];
|
|
3450
|
+
var item = this._items[index];
|
|
3451
|
+
if (this.emit('before.remove', item)) {
|
|
3452
|
+
if (clearSelection) {
|
|
3453
|
+
this.clearSelection();
|
|
3454
|
+
}
|
|
3455
|
+
if (tag) {
|
|
3456
|
+
tag.remove();
|
|
3457
|
+
}
|
|
3458
|
+
// If original input is a select element
|
|
3459
|
+
// then deselect related option
|
|
3460
|
+
if (this._isSelect) {
|
|
3461
|
+
this.element.options[index].selected = false;
|
|
3462
|
+
}
|
|
3463
|
+
if (this._selected == index) {
|
|
3464
|
+
this._selected = -1;
|
|
3465
|
+
}
|
|
3466
|
+
else if (this._selected >= 0) {
|
|
3467
|
+
// One item less so selected index is
|
|
3468
|
+
this._selected -= 1;
|
|
3469
|
+
}
|
|
3470
|
+
this._items.splice(index, 1);
|
|
3471
|
+
this._filterDropdownItems();
|
|
3472
|
+
this._propagateChange();
|
|
3473
|
+
this.emit('after.remove', item);
|
|
3474
|
+
}
|
|
2100
3475
|
}
|
|
2101
|
-
return
|
|
3476
|
+
return this;
|
|
2102
3477
|
};
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
3478
|
+
/**
|
|
3479
|
+
* Select given item
|
|
3480
|
+
*
|
|
3481
|
+
* @param item
|
|
3482
|
+
*/
|
|
3483
|
+
BulmaTagsInput.prototype.select = function (items) {
|
|
3484
|
+
var _this = this;
|
|
3485
|
+
if (this.options.selectable) {
|
|
3486
|
+
// Make sure to work with an array of items
|
|
3487
|
+
items = Array.isArray(items) ? items : isObject(items) ? [items] : items.split(this.options.delimiter);
|
|
3488
|
+
// If string items are expected then check every item is a string
|
|
3489
|
+
if (!this._objectItems && (items.filter(function (item) { return isString(item); }).length !== items.length)) {
|
|
3490
|
+
throw ('Item must be a string or an array of strings');
|
|
3491
|
+
}
|
|
3492
|
+
// If object items are expected then check every item is an object
|
|
3493
|
+
if (this._objectItems && (items.filter(function (item) { return isObject(item); }).length !== items.length)) {
|
|
3494
|
+
throw ('Item must be an object or an array of objects');
|
|
3495
|
+
}
|
|
3496
|
+
items.forEach(function (item) {
|
|
3497
|
+
_this.selectAtIndex(_this.indexOf(item));
|
|
3498
|
+
});
|
|
3499
|
+
}
|
|
3500
|
+
return this;
|
|
2125
3501
|
};
|
|
2126
|
-
|
|
3502
|
+
/**
|
|
3503
|
+
* Select tag at given index
|
|
3504
|
+
*
|
|
3505
|
+
* @param Integer index
|
|
3506
|
+
*/
|
|
3507
|
+
BulmaTagsInput.prototype.selectAtIndex = function (index) {
|
|
3508
|
+
if (this.options.selectable) {
|
|
3509
|
+
// Clear selection
|
|
3510
|
+
this.clearSelection();
|
|
3511
|
+
if (!isNaN(index) && index >= 0 && index < this._items.length) {
|
|
3512
|
+
var tag = Array.from(this.container.children).filter(function (child) { return child.classList.contains('tag'); })[index];
|
|
3513
|
+
var item = this._items[index];
|
|
3514
|
+
if (this.emit('before.select', {
|
|
3515
|
+
item: item,
|
|
3516
|
+
tag: tag
|
|
3517
|
+
})) {
|
|
3518
|
+
if (tag) {
|
|
3519
|
+
tag.classList.add('is-selected');
|
|
3520
|
+
}
|
|
3521
|
+
this._selected = index;
|
|
3522
|
+
this.emit('after.select', {
|
|
3523
|
+
item: item,
|
|
3524
|
+
tag: tag
|
|
3525
|
+
});
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
return this;
|
|
3530
|
+
};
|
|
3531
|
+
Object.defineProperty(BulmaTagsInput.prototype, "selected", {
|
|
3532
|
+
/**
|
|
3533
|
+
* Get selected item
|
|
3534
|
+
*/
|
|
2127
3535
|
get: function () {
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
return
|
|
2133
|
-
}
|
|
3536
|
+
if (this._selected >= 0) {
|
|
3537
|
+
return this._items[this._selected];
|
|
3538
|
+
}
|
|
3539
|
+
else {
|
|
3540
|
+
return null;
|
|
3541
|
+
}
|
|
2134
3542
|
},
|
|
2135
3543
|
enumerable: false,
|
|
2136
3544
|
configurable: true
|
|
2137
3545
|
});
|
|
2138
|
-
Object.defineProperty(
|
|
3546
|
+
Object.defineProperty(BulmaTagsInput.prototype, "selectedIndex", {
|
|
3547
|
+
/**
|
|
3548
|
+
* Get selected item index
|
|
3549
|
+
*/
|
|
2139
3550
|
get: function () {
|
|
2140
|
-
|
|
2141
|
-
return this.fromUnits ?
|
|
2142
|
-
Object.values(utils.ConvertUnits).filter(function (v) { return v in utils.converters[_this.fromUnits]; }) :
|
|
2143
|
-
[];
|
|
3551
|
+
return this._selected;
|
|
2144
3552
|
},
|
|
2145
3553
|
enumerable: false,
|
|
2146
3554
|
configurable: true
|
|
2147
3555
|
});
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
3556
|
+
Object.defineProperty(BulmaTagsInput.prototype, "value", {
|
|
3557
|
+
/**
|
|
3558
|
+
* Get value
|
|
3559
|
+
*/
|
|
3560
|
+
get: function () {
|
|
3561
|
+
if (!this._isSelect) {
|
|
3562
|
+
if (this._objectItems) {
|
|
3563
|
+
return this._items.map(function (item) { return item.value; }).join(this.options.delimiter);
|
|
3564
|
+
}
|
|
3565
|
+
else {
|
|
3566
|
+
return this._items.join(this.options.delimiter);
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
else {
|
|
3570
|
+
return Array.from(this.element.options).filter(function (option) { return option.selected; }).map(function (option) { return option.value; });
|
|
3571
|
+
}
|
|
3572
|
+
},
|
|
3573
|
+
/**
|
|
3574
|
+
* Set value
|
|
3575
|
+
*/
|
|
3576
|
+
set: function (string) {
|
|
3577
|
+
this.removeAll();
|
|
3578
|
+
this.add(string);
|
|
3579
|
+
},
|
|
3580
|
+
enumerable: false,
|
|
3581
|
+
configurable: true
|
|
3582
|
+
});
|
|
3583
|
+
/**
|
|
3584
|
+
* Document click event handler
|
|
3585
|
+
*
|
|
3586
|
+
* @param e
|
|
3587
|
+
*/
|
|
3588
|
+
BulmaTagsInput.prototype._onDocumentClick = function (e) {
|
|
3589
|
+
if (this.dropdown) {
|
|
3590
|
+
// If we click on element inside container then do nothing
|
|
3591
|
+
if (this.container.contains(e.target)) {
|
|
3592
|
+
return;
|
|
3593
|
+
}
|
|
3594
|
+
// Tag and delete button already deleted when event triggered
|
|
3595
|
+
// So we check if target is a tag delete button
|
|
3596
|
+
if (e.target.dataset.tag && e.target.dataset.tag === 'delete') {
|
|
3597
|
+
return;
|
|
3598
|
+
}
|
|
3599
|
+
// Click outside dropdown so close it
|
|
3600
|
+
this._closeDropdown();
|
|
2156
3601
|
}
|
|
2157
|
-
this.requireArgs(requiredKeys);
|
|
2158
|
-
return this.updateValue();
|
|
2159
3602
|
};
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
3603
|
+
/**
|
|
3604
|
+
* Input focus lost event handler
|
|
3605
|
+
*
|
|
3606
|
+
* @param e
|
|
3607
|
+
*/
|
|
3608
|
+
BulmaTagsInput.prototype._onDropdownItemClick = function (e) {
|
|
3609
|
+
e.preventDefault();
|
|
3610
|
+
if (this.dropdown) {
|
|
3611
|
+
if (this._objectItems) {
|
|
3612
|
+
var item = {};
|
|
3613
|
+
item[this.options.itemText] = e.currentTarget.dataset.text;
|
|
3614
|
+
item[this.options.itemValue] = e.currentTarget.dataset.value;
|
|
3615
|
+
this.add(item);
|
|
3616
|
+
}
|
|
3617
|
+
else {
|
|
3618
|
+
this.add(e.currentTarget.dataset.value);
|
|
3619
|
+
}
|
|
3620
|
+
this._filterDropdownItems();
|
|
3621
|
+
this._input.value = '';
|
|
3622
|
+
this._input.focus();
|
|
3623
|
+
if (this.options.closeDropdownOnItemSelect) {
|
|
3624
|
+
this._closeDropdown();
|
|
3625
|
+
}
|
|
2163
3626
|
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
3627
|
+
};
|
|
3628
|
+
/**
|
|
3629
|
+
* Input change event handler
|
|
3630
|
+
*
|
|
3631
|
+
* @param e
|
|
3632
|
+
*/
|
|
3633
|
+
BulmaTagsInput.prototype._onInputChange = function (e) {
|
|
3634
|
+
this._filterDropdownItems(this._input.value);
|
|
3635
|
+
};
|
|
3636
|
+
/**
|
|
3637
|
+
* Input click event handler
|
|
3638
|
+
*
|
|
3639
|
+
* @param e
|
|
3640
|
+
*/
|
|
3641
|
+
BulmaTagsInput.prototype._onInputClick = function (e) {
|
|
3642
|
+
e.preventDefault();
|
|
3643
|
+
if (!this.source || this._input.value.length >= this.options.searchMinChars) {
|
|
3644
|
+
this._openDropdown();
|
|
3645
|
+
this._filterDropdownItems();
|
|
2171
3646
|
}
|
|
2172
|
-
catch (_) { }
|
|
2173
3647
|
};
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
}]
|
|
2185
|
-
}], propDecorators: { term: [{
|
|
2186
|
-
type: i0.Input
|
|
2187
|
-
}], value: [{
|
|
2188
|
-
type: i0.Input
|
|
2189
|
-
}], fromUnits: [{
|
|
2190
|
-
type: i0.Input
|
|
2191
|
-
}], toUnits: [{
|
|
2192
|
-
type: i0.Input
|
|
2193
|
-
}] } });
|
|
2194
|
-
|
|
2195
|
-
/* eslint-disable @angular-eslint/directive-selector */
|
|
2196
|
-
var ClickOutsideDirective = /** @class */ (function () {
|
|
2197
|
-
function ClickOutsideDirective(elementRef) {
|
|
2198
|
-
this.elementRef = elementRef;
|
|
2199
|
-
this.clickOutside = new i0.EventEmitter();
|
|
2200
|
-
}
|
|
2201
|
-
ClickOutsideDirective.prototype.onClick = function (event) {
|
|
2202
|
-
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
2203
|
-
this.clickOutside.emit();
|
|
3648
|
+
/**
|
|
3649
|
+
* Input focus event handler
|
|
3650
|
+
*
|
|
3651
|
+
* @param e
|
|
3652
|
+
*/
|
|
3653
|
+
BulmaTagsInput.prototype._onInputFocusIn = function (e) {
|
|
3654
|
+
e.preventDefault();
|
|
3655
|
+
if (this.container.getAttribute('disabled') !== null || this.container.classList.contains('is-disabled')) {
|
|
3656
|
+
this._input.blur();
|
|
3657
|
+
return false;
|
|
2204
3658
|
}
|
|
3659
|
+
this.container.classList.add('is-focused');
|
|
2205
3660
|
};
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
}]
|
|
2215
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { clickOutside: [{
|
|
2216
|
-
type: i0.Output
|
|
2217
|
-
}], onClick: [{
|
|
2218
|
-
type: i0.HostListener,
|
|
2219
|
-
args: ['document:click', ['$event']]
|
|
2220
|
-
}] } });
|
|
2221
|
-
|
|
2222
|
-
var shouldDefault = {
|
|
2223
|
-
string: function (value) { return !value; },
|
|
2224
|
-
number: function (value) { return !value && value !== 0; },
|
|
2225
|
-
boolean: function (value) { return !value; },
|
|
2226
|
-
object: function (value) { return !value || !Object.keys(value).length; },
|
|
2227
|
-
undefined: function () { return true; }
|
|
2228
|
-
};
|
|
2229
|
-
var DefaultPipe = /** @class */ (function () {
|
|
2230
|
-
function DefaultPipe() {
|
|
2231
|
-
}
|
|
2232
|
-
DefaultPipe.prototype.transform = function (value, defaultValue) {
|
|
2233
|
-
return shouldDefault[typeof value](value) ? defaultValue : value;
|
|
3661
|
+
/**
|
|
3662
|
+
* Input focus lost event handler
|
|
3663
|
+
*
|
|
3664
|
+
* @param e
|
|
3665
|
+
*/
|
|
3666
|
+
BulmaTagsInput.prototype._onInputFocusOut = function (e) {
|
|
3667
|
+
e.preventDefault();
|
|
3668
|
+
this.container.classList.remove('is-focused');
|
|
2234
3669
|
};
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
3670
|
+
/**
|
|
3671
|
+
* Input Keydown event handler
|
|
3672
|
+
*
|
|
3673
|
+
* @param e
|
|
3674
|
+
*/
|
|
3675
|
+
BulmaTagsInput.prototype._onInputKeyDown = function (e) {
|
|
3676
|
+
var key = e.charCode || e.keyCode || e.which;
|
|
3677
|
+
switch (key) {
|
|
3678
|
+
// BACKSPACE
|
|
3679
|
+
case 8:
|
|
3680
|
+
if (this.options.removable) {
|
|
3681
|
+
if (this._caretAtStart() && this._selected >= 0) {
|
|
3682
|
+
var currentItemIndex = this._selected;
|
|
3683
|
+
// If tag was selected then select next (or previous if next does not exists)
|
|
3684
|
+
if (currentItemIndex >= 0) {
|
|
3685
|
+
this.selectAtIndex(currentItemIndex + 1 < this._items.length ? currentItemIndex + 1 : currentItemIndex - 1);
|
|
3686
|
+
}
|
|
3687
|
+
this.removeAtIndex(currentItemIndex, false);
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
if (this.source && (this._input.value.length) < this.options.searchMinChars) {
|
|
3691
|
+
this._closeDropdown();
|
|
3692
|
+
}
|
|
3693
|
+
break;
|
|
3694
|
+
// ESCAPE
|
|
3695
|
+
case 27:
|
|
3696
|
+
if (this._selected >= 0) {
|
|
3697
|
+
this.clearSelection();
|
|
3698
|
+
}
|
|
3699
|
+
this._closeDropdown();
|
|
3700
|
+
break;
|
|
3701
|
+
// DELETE
|
|
3702
|
+
case 46:
|
|
3703
|
+
if (this.options.removable) {
|
|
3704
|
+
if (this._caretAtStart() && this._selected >= 0) {
|
|
3705
|
+
var currentItemIndex = this._selected;
|
|
3706
|
+
// If tag was selected then select next (or previous if next does not exists)
|
|
3707
|
+
if (currentItemIndex >= 0) {
|
|
3708
|
+
this.selectAtIndex(currentItemIndex + 1 < this._items.length ? currentItemIndex + 1 : currentItemIndex - 1);
|
|
3709
|
+
}
|
|
3710
|
+
this.removeAtIndex(currentItemIndex, false);
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3713
|
+
if (this.source && (this._input.value.length) < this.options.searchMinChars) {
|
|
3714
|
+
this._closeDropdown();
|
|
3715
|
+
}
|
|
3716
|
+
break;
|
|
3717
|
+
// LEFT ARROW
|
|
3718
|
+
case 37:
|
|
3719
|
+
if (!this._input.value.length) {
|
|
3720
|
+
if (this._selected < 0) {
|
|
3721
|
+
this.selectAtIndex(this._items.length - 1);
|
|
3722
|
+
}
|
|
3723
|
+
else {
|
|
3724
|
+
this.selectAtIndex(this._selected - 1 >= 0 ? this._selected - 1 : this._items.length - 1);
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
break;
|
|
3728
|
+
// RIGHT ARROW
|
|
3729
|
+
case 39:
|
|
3730
|
+
if (!this._input.value.length) {
|
|
3731
|
+
if (this._selected < 0) {
|
|
3732
|
+
this.selectAtIndex(0);
|
|
3733
|
+
}
|
|
3734
|
+
else {
|
|
3735
|
+
this.selectAtIndex(this._selected + 1 >= this._items.length ? 0 : this._selected + 1);
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
break;
|
|
3739
|
+
default:
|
|
3740
|
+
if (this.options.clearSelectionOnTyping) {
|
|
3741
|
+
this.clearSelection();
|
|
3742
|
+
}
|
|
3743
|
+
// ignore
|
|
3744
|
+
}
|
|
2251
3745
|
};
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
3746
|
+
/**
|
|
3747
|
+
* Input Keypress event handler
|
|
3748
|
+
*
|
|
3749
|
+
* @param e
|
|
3750
|
+
*/
|
|
3751
|
+
BulmaTagsInput.prototype._onInputKeyPress = function (e) {
|
|
3752
|
+
var _this = this;
|
|
3753
|
+
var key = e.charCode || e.keyCode || e.which;
|
|
3754
|
+
var value = this._trim(this._input.value) + String.fromCharCode(key);
|
|
3755
|
+
if (!this._manualInputAllowed && !this._filterInputAllowed) {
|
|
3756
|
+
e.preventDefault();
|
|
3757
|
+
return false;
|
|
3758
|
+
}
|
|
3759
|
+
// ENTER
|
|
3760
|
+
if (!value.length && key !== 13) {
|
|
3761
|
+
return false;
|
|
3762
|
+
}
|
|
3763
|
+
if (this._filterInputAllowed) {
|
|
3764
|
+
this._filterDropdownItems(value);
|
|
3765
|
+
}
|
|
3766
|
+
if (this._filterInputAllowed && this.source && value.length >= this.options.searchMinChars && key !== 13) {
|
|
3767
|
+
this._openDropdown();
|
|
3768
|
+
this.dropdown.classList.add('is-loading');
|
|
3769
|
+
this._emptyDropdown();
|
|
3770
|
+
this.source(value).then(function (results) {
|
|
3771
|
+
results = _this.emit('on.results.received', results);
|
|
3772
|
+
if (results.length) {
|
|
3773
|
+
results.forEach(function (result) {
|
|
3774
|
+
var item = {
|
|
3775
|
+
value: null,
|
|
3776
|
+
text: null
|
|
3777
|
+
};
|
|
3778
|
+
if (!isObject(result)) {
|
|
3779
|
+
item.value = result;
|
|
3780
|
+
item.text = result;
|
|
3781
|
+
}
|
|
3782
|
+
else {
|
|
3783
|
+
item.value = result[_this.options.itemValue];
|
|
3784
|
+
item.text = result[_this.options.itemText];
|
|
3785
|
+
}
|
|
3786
|
+
_this._createDropdownItem(item);
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
_this._filterDropdownItems(value);
|
|
3790
|
+
_this.dropdown.classList.remove('is-loading');
|
|
3791
|
+
});
|
|
3792
|
+
}
|
|
3793
|
+
if (this._manualInputAllowed && (value.includes(this.options.delimiter) || key == 13)) {
|
|
3794
|
+
// Prevent default behavior (ie: add char into input value)
|
|
3795
|
+
e.preventDefault();
|
|
3796
|
+
// Split value by delimiter in case we copy/paste multiple values
|
|
3797
|
+
var values = value.split(this.options.delimiter);
|
|
3798
|
+
values.forEach(function (value) {
|
|
3799
|
+
// check if empty text when delimiter is removed
|
|
3800
|
+
if ((value = value.replace(_this.options.delimiter, '')) != '') {
|
|
3801
|
+
// push to array and remove delimiter
|
|
3802
|
+
_this.add(value);
|
|
3803
|
+
}
|
|
3804
|
+
});
|
|
3805
|
+
value = '';
|
|
3806
|
+
// clear input
|
|
3807
|
+
this._input.value = '';
|
|
3808
|
+
this._closeDropdown();
|
|
3809
|
+
return false;
|
|
3810
|
+
}
|
|
2270
3811
|
};
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
}
|
|
2285
|
-
KeyToLabelPipe.prototype.transform = function (value) {
|
|
2286
|
-
// using termTypeLabel here which defaults to `keyToLabel` function
|
|
2287
|
-
return termTypeLabel(value);
|
|
3812
|
+
/**
|
|
3813
|
+
* Original input change event handler
|
|
3814
|
+
* CAUTION: because original input is now hidden the change event must be triggered manually on change
|
|
3815
|
+
* Example how to trigger change event manually
|
|
3816
|
+
* var changeEvent = new Event('change');
|
|
3817
|
+
* input.dispatchEvent(changeEvent);
|
|
3818
|
+
*
|
|
3819
|
+
* @param e
|
|
3820
|
+
*/
|
|
3821
|
+
BulmaTagsInput.prototype._onOriginalInputChange = function (e) {
|
|
3822
|
+
if (!e.detail || isString(e.detail) && e.detail !== this.constructor.name) {
|
|
3823
|
+
this.value = e.currentTarget.value;
|
|
3824
|
+
}
|
|
2288
3825
|
};
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
3826
|
+
/**
|
|
3827
|
+
* Tag click event handler
|
|
3828
|
+
*
|
|
3829
|
+
* @param e
|
|
3830
|
+
*/
|
|
3831
|
+
BulmaTagsInput.prototype._onTagClick = function (e) {
|
|
3832
|
+
e.preventDefault();
|
|
3833
|
+
if (e.currentTarget.classList.contains('delete')) {
|
|
3834
|
+
return false;
|
|
3835
|
+
}
|
|
3836
|
+
if (this.container.getAttribute('disabled') !== null || this.container.classList.contains('is-disabled')) {
|
|
3837
|
+
return false;
|
|
3838
|
+
}
|
|
3839
|
+
this._input.focus();
|
|
3840
|
+
if (this.options.selectable) {
|
|
3841
|
+
var tag = e.currentTarget.closest('.tag');
|
|
3842
|
+
if (tag) {
|
|
3843
|
+
var tagIndex = Array.from(this.container.children).indexOf(tag);
|
|
3844
|
+
if (tagIndex === this._selected) {
|
|
3845
|
+
this.clearSelection();
|
|
3846
|
+
}
|
|
3847
|
+
else {
|
|
3848
|
+
this.selectAtIndex(tagIndex);
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
2306
3852
|
};
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
}
|
|
3853
|
+
/**
|
|
3854
|
+
* Delete tag button click event handler
|
|
3855
|
+
*
|
|
3856
|
+
* @param e
|
|
3857
|
+
*/
|
|
3858
|
+
BulmaTagsInput.prototype._onTagDeleteClick = function (e) {
|
|
3859
|
+
e.preventDefault();
|
|
3860
|
+
if (this.container.getAttribute('disabled') !== null || this.container.classList.contains('is-disabled')) {
|
|
3861
|
+
return false;
|
|
3862
|
+
}
|
|
3863
|
+
var tag = e.currentTarget.closest('.tag');
|
|
3864
|
+
if (tag) {
|
|
3865
|
+
this.removeAtIndex(Array.from(this.container.children).indexOf(tag));
|
|
3866
|
+
}
|
|
3867
|
+
};
|
|
3868
|
+
return BulmaTagsInput;
|
|
3869
|
+
}(Component));
|
|
2317
3870
|
|
|
2318
3871
|
var restrictToType = {
|
|
2319
3872
|
number: function (val) { return parseFloat(val) === +val ? val : false; }
|
|
@@ -2337,7 +3890,7 @@
|
|
|
2337
3890
|
return _this.tagsInputInput.removeEventListener(event, listener);
|
|
2338
3891
|
});
|
|
2339
3892
|
this.inputEvents = [];
|
|
2340
|
-
this.tagsInput =
|
|
3893
|
+
this.tagsInput = undefined;
|
|
2341
3894
|
};
|
|
2342
3895
|
Object.defineProperty(TagsInputDirective.prototype, "input", {
|
|
2343
3896
|
get: function () {
|
|
@@ -2378,7 +3931,7 @@
|
|
|
2378
3931
|
var _this = this;
|
|
2379
3932
|
try {
|
|
2380
3933
|
var _a = this.appTagsInput, enabled = _a.enabled, items = _a.items, options = __rest(_a, ["enabled", "items"]);
|
|
2381
|
-
this.tagsInput = new
|
|
3934
|
+
this.tagsInput = new BulmaTagsInput(this.input, options);
|
|
2382
3935
|
// TODO: remove when fixed, @see https://github.com/CreativeBulma/bulma-tagsinput/issues/23
|
|
2383
3936
|
var classes = ['is-small', 'is-large'].filter(function (v) { return _this.input.classList.contains(v); });
|
|
2384
3937
|
classes.map(function (v) { return _this.tagsInputNode.classList.add(v); });
|
|
@@ -2436,18 +3989,9 @@
|
|
|
2436
3989
|
UnitConverterComponent,
|
|
2437
3990
|
BlankNodeDiffsComponent,
|
|
2438
3991
|
TimesPipe,
|
|
2439
|
-
ToastComponent,
|
|
2440
3992
|
ClickOutsideDirective,
|
|
2441
|
-
KeysPipe,
|
|
2442
|
-
PrecisionPipe,
|
|
2443
|
-
SocialTagsComponent,
|
|
2444
|
-
DefaultPipe,
|
|
2445
3993
|
SkeletonTextComponent,
|
|
2446
|
-
|
|
2447
|
-
KeyToLabelPipe,
|
|
2448
|
-
BindOnceDirective,
|
|
2449
|
-
GetPipe,
|
|
2450
|
-
EllipsisPipe
|
|
3994
|
+
GetPipe
|
|
2451
3995
|
];
|
|
2452
3996
|
var HeCommonModule = /** @class */ (function () {
|
|
2453
3997
|
function HeCommonModule() {
|
|
@@ -2468,23 +4012,14 @@
|
|
|
2468
4012
|
UnitConverterComponent,
|
|
2469
4013
|
BlankNodeDiffsComponent,
|
|
2470
4014
|
TimesPipe,
|
|
2471
|
-
ToastComponent,
|
|
2472
4015
|
ClickOutsideDirective,
|
|
2473
|
-
KeysPipe,
|
|
2474
|
-
PrecisionPipe,
|
|
2475
|
-
SocialTagsComponent,
|
|
2476
|
-
DefaultPipe,
|
|
2477
4016
|
SkeletonTextComponent,
|
|
2478
|
-
|
|
2479
|
-
KeyToLabelPipe,
|
|
2480
|
-
BindOnceDirective,
|
|
2481
|
-
GetPipe,
|
|
2482
|
-
EllipsisPipe], imports: [i3.CommonModule, i1$4.FormsModule, i4.RouterModule,
|
|
4017
|
+
GetPipe], imports: [i3.CommonModule, i1$2.FormsModule, i4.RouterModule,
|
|
2483
4018
|
i10.NgbTypeaheadModule, i10.NgbTooltipModule, i10.NgbPopoverModule,
|
|
2484
|
-
i1$
|
|
2485
|
-
|
|
2486
|
-
i1$
|
|
2487
|
-
|
|
4019
|
+
i1$4.GoogleMapsModule,
|
|
4020
|
+
HeCommonLightModule], exports: [i10.NgbTypeaheadModule, i10.NgbTooltipModule, i10.NgbPopoverModule,
|
|
4021
|
+
i1$4.GoogleMapsModule,
|
|
4022
|
+
HeCommonLightModule, ClipboardComponent,
|
|
2488
4023
|
PopoverComponent,
|
|
2489
4024
|
PopoverConfirmComponent,
|
|
2490
4025
|
TagsInputDirective,
|
|
@@ -2497,40 +4032,31 @@
|
|
|
2497
4032
|
UnitConverterComponent,
|
|
2498
4033
|
BlankNodeDiffsComponent,
|
|
2499
4034
|
TimesPipe,
|
|
2500
|
-
ToastComponent,
|
|
2501
4035
|
ClickOutsideDirective,
|
|
2502
|
-
KeysPipe,
|
|
2503
|
-
PrecisionPipe,
|
|
2504
|
-
SocialTagsComponent,
|
|
2505
|
-
DefaultPipe,
|
|
2506
4036
|
SkeletonTextComponent,
|
|
2507
|
-
|
|
2508
|
-
KeyToLabelPipe,
|
|
2509
|
-
BindOnceDirective,
|
|
2510
|
-
GetPipe,
|
|
2511
|
-
EllipsisPipe] });
|
|
4037
|
+
GetPipe] });
|
|
2512
4038
|
HeCommonModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonModule, imports: [[
|
|
2513
|
-
i3.CommonModule, i1$
|
|
4039
|
+
i3.CommonModule, i1$2.FormsModule, i4.RouterModule,
|
|
2514
4040
|
i10.NgbTypeaheadModule, i10.NgbTooltipModule, i10.NgbPopoverModule,
|
|
2515
|
-
i1$
|
|
2516
|
-
|
|
4041
|
+
i1$4.GoogleMapsModule,
|
|
4042
|
+
HeCommonLightModule
|
|
2517
4043
|
], i10.NgbTypeaheadModule, i10.NgbTooltipModule, i10.NgbPopoverModule,
|
|
2518
|
-
i1$
|
|
2519
|
-
|
|
4044
|
+
i1$4.GoogleMapsModule,
|
|
4045
|
+
HeCommonLightModule] });
|
|
2520
4046
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCommonModule, decorators: [{
|
|
2521
4047
|
type: i0.NgModule,
|
|
2522
4048
|
args: [{
|
|
2523
4049
|
declarations: components$6,
|
|
2524
4050
|
exports: __spreadArray([
|
|
2525
4051
|
i10.NgbTypeaheadModule, i10.NgbTooltipModule, i10.NgbPopoverModule,
|
|
2526
|
-
i1$
|
|
2527
|
-
|
|
4052
|
+
i1$4.GoogleMapsModule,
|
|
4053
|
+
HeCommonLightModule
|
|
2528
4054
|
], __read(components$6)),
|
|
2529
4055
|
imports: [
|
|
2530
|
-
i3.CommonModule, i1$
|
|
4056
|
+
i3.CommonModule, i1$2.FormsModule, i4.RouterModule,
|
|
2531
4057
|
i10.NgbTypeaheadModule, i10.NgbTooltipModule, i10.NgbPopoverModule,
|
|
2532
|
-
i1$
|
|
2533
|
-
|
|
4058
|
+
i1$4.GoogleMapsModule,
|
|
4059
|
+
HeCommonLightModule
|
|
2534
4060
|
]
|
|
2535
4061
|
}]
|
|
2536
4062
|
}] });
|
|
@@ -2562,14 +4088,14 @@
|
|
|
2562
4088
|
};
|
|
2563
4089
|
return HeMendeleyService;
|
|
2564
4090
|
}());
|
|
2565
|
-
HeMendeleyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeMendeleyService, deps: [{ token: i1__namespace$
|
|
4091
|
+
HeMendeleyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeMendeleyService, deps: [{ token: i1__namespace$2.HttpClient }, { token: HeCommonService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2566
4092
|
HeMendeleyService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeMendeleyService, providedIn: 'root' });
|
|
2567
4093
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeMendeleyService, decorators: [{
|
|
2568
4094
|
type: i0.Injectable,
|
|
2569
4095
|
args: [{
|
|
2570
4096
|
providedIn: 'root'
|
|
2571
4097
|
}]
|
|
2572
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
4098
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$2.HttpClient }, { type: HeCommonService }]; } });
|
|
2573
4099
|
|
|
2574
4100
|
var _a$3, _b, _c, _d$1, _e;
|
|
2575
4101
|
var searchableTypes = [
|
|
@@ -2913,14 +4439,14 @@
|
|
|
2913
4439
|
};
|
|
2914
4440
|
return HeSearchService;
|
|
2915
4441
|
}());
|
|
2916
|
-
HeSearchService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSearchService, deps: [{ token: i1__namespace$
|
|
4442
|
+
HeSearchService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSearchService, deps: [{ token: i1__namespace$2.HttpClient }, { token: HeCommonService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2917
4443
|
HeSearchService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSearchService, providedIn: 'root' });
|
|
2918
4444
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSearchService, decorators: [{
|
|
2919
4445
|
type: i0.Injectable,
|
|
2920
4446
|
args: [{
|
|
2921
4447
|
providedIn: 'root'
|
|
2922
4448
|
}]
|
|
2923
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
4449
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$2.HttpClient }, { type: HeCommonService }]; } });
|
|
2924
4450
|
|
|
2925
4451
|
var BibliographiesSearchConfirmComponent = /** @class */ (function () {
|
|
2926
4452
|
function BibliographiesSearchConfirmComponent(formBuilder, mendeleyService, searchService) {
|
|
@@ -2935,7 +4461,7 @@
|
|
|
2935
4461
|
this.loading = true;
|
|
2936
4462
|
this.hasResults = false;
|
|
2937
4463
|
this.formGroup = formBuilder.group({
|
|
2938
|
-
search: ['', i1$
|
|
4464
|
+
search: ['', i1$2.Validators.required]
|
|
2939
4465
|
});
|
|
2940
4466
|
this.results = this.searchControl.valueChanges.pipe(operators.debounceTime(300), operators.distinctUntilChanged(), operators.tap(function () {
|
|
2941
4467
|
_this.loading = true;
|
|
@@ -3033,10 +4559,10 @@
|
|
|
3033
4559
|
return HeBibliographiesModule;
|
|
3034
4560
|
}());
|
|
3035
4561
|
HeBibliographiesModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeBibliographiesModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
3036
|
-
HeBibliographiesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeBibliographiesModule, declarations: [BibliographiesSearchConfirmComponent], imports: [i3.CommonModule, i1$
|
|
4562
|
+
HeBibliographiesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeBibliographiesModule, declarations: [BibliographiesSearchConfirmComponent], imports: [i3.CommonModule, i1$2.ReactiveFormsModule,
|
|
3037
4563
|
HeCommonModule], exports: [BibliographiesSearchConfirmComponent] });
|
|
3038
4564
|
HeBibliographiesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeBibliographiesModule, imports: [[
|
|
3039
|
-
i3.CommonModule, i1$
|
|
4565
|
+
i3.CommonModule, i1$2.ReactiveFormsModule,
|
|
3040
4566
|
HeCommonModule
|
|
3041
4567
|
]] });
|
|
3042
4568
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeBibliographiesModule, decorators: [{
|
|
@@ -3045,7 +4571,7 @@
|
|
|
3045
4571
|
declarations: components$5,
|
|
3046
4572
|
exports: components$5,
|
|
3047
4573
|
imports: [
|
|
3048
|
-
i3.CommonModule, i1$
|
|
4574
|
+
i3.CommonModule, i1$2.ReactiveFormsModule,
|
|
3049
4575
|
HeCommonModule
|
|
3050
4576
|
]
|
|
3051
4577
|
}]
|
|
@@ -3299,14 +4825,14 @@
|
|
|
3299
4825
|
;
|
|
3300
4826
|
return HeSchemaService;
|
|
3301
4827
|
}());
|
|
3302
|
-
HeSchemaService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSchemaService, deps: [{ token: i1__namespace$
|
|
4828
|
+
HeSchemaService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSchemaService, deps: [{ token: i1__namespace$2.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
3303
4829
|
HeSchemaService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSchemaService, providedIn: 'root' });
|
|
3304
4830
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSchemaService, decorators: [{
|
|
3305
4831
|
type: i0.Injectable,
|
|
3306
4832
|
args: [{
|
|
3307
4833
|
providedIn: 'root'
|
|
3308
4834
|
}]
|
|
3309
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
4835
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$2.HttpClient }]; } });
|
|
3310
4836
|
|
|
3311
4837
|
var headerGroup = function (header) {
|
|
3312
4838
|
var parts = header.split('.');
|
|
@@ -3508,7 +5034,7 @@
|
|
|
3508
5034
|
});
|
|
3509
5035
|
return NodeCsvExportConfirmComponent;
|
|
3510
5036
|
}());
|
|
3511
|
-
NodeCsvExportConfirmComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeCsvExportConfirmComponent, deps: [{ token: i1__namespace$
|
|
5037
|
+
NodeCsvExportConfirmComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeCsvExportConfirmComponent, deps: [{ token: i1__namespace$1.DomSanitizer }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3512
5038
|
NodeCsvExportConfirmComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeCsvExportConfirmComponent, selector: "he-node-csv-export-confirm", inputs: { nodes: "nodes", filename: "filename", headerKeys: "headerKeys", extension: "extension", isUpload: "isUpload" }, outputs: { closed: "closed" }, ngImport: i0__namespace, template: "<div class=\"modal is-active\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-card\">\n <header class=\"modal-card-head\">\n <p class=\"modal-card-title\">Export as CSV</p>\n <button class=\"delete\" aria-label=\"close\" (click)=\"closed.next(true)\"></button>\n </header>\n <section class=\"modal-card-body\">\n <div class=\"notification is-info\" role=\"alert\" *ngIf=\"isUpload\">\n <span>After Download, you can edit and</span>\n <a class=\"px-1\" routerLink=\"../\">upload the CSV file</a>\n <span>to submit your content on the Hestia platform, and your draft will remain unchanged.</span>\n\n <p>\n <span>Alternatively, you can import the CSV file right back by clicking on the \"Import from CSV\" button and selecting the exported file.</span>\n </p>\n </div>\n\n <ng-container *ngIf=\"!isUpload && includedNodes.length > 1\">\n <p class=\"mb-2\">\n <b>{{includedNodes.length}}</b>\n <span class=\"px-1\">Nodes will be included in your download.</span>\n <a (click)=\"showIncludeNodes = !showIncludeNodes\">\n <ng-container *ngIf=\"!showIncludeNodes\">Show list</ng-container>\n <ng-container *ngIf=\"showIncludeNodes\">Hide list</ng-container>\n </a>\n </p>\n\n <div class=\"table-container\" *ngIf=\"showIncludeNodes\">\n <table class=\"table is-fullwidth is-hoverable mb-0\">\n <thead class=\"has-background-black\">\n <tr>\n <th>\n <span class=\"has-text-white\">@type</span>\n </th>\n <th>\n <span class=\"has-text-white\">@id</span>\n </th>\n <th>\n <span class=\"has-text-white\">Name</span>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let node of includedNodes\">\n <td>\n <span *bindOnce=\"node\">{{node.node['@type']}}</span>\n </td>\n <td>\n <span *bindOnce=\"node\">{{node.node['@id']}}</span>\n </td>\n <td>\n <span *bindOnce=\"node\">{{node.node.name}}</span>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </ng-container>\n\n <he-node-csv-select-headers [class.is-hidden]=\"isUpload\"\n [csv]=\"csvData\" [keys]=\"headerKeys\" [includeDefaultCSV]=\"isUpload\"\n (headersChanged)=\"headersUpdated($event)\"\n ></he-node-csv-select-headers>\n </section>\n <footer class=\"modal-card-foot\">\n <a class=\"button is-success\" target=\"_blank\"\n [attr.disabled]=\"csvContent ? null : true\"\n [href]=\"csvContent\"\n [attr.download]=\"csvContent ? downloadFilename : null\"\n (click)=\"closed.next(true)\"\n >\n <fa-icon class=\"mr-2\" icon=\"download\"></fa-icon>\n <span>Download CSV</span>\n </a>\n <button class=\"button\" (click)=\"closed.next(true)\">\n <span>Cancel</span>\n </button>\n </footer>\n </div>\n</div>\n", styles: [""], components: [{ type: NodeCsvSelectHeadersComponent, selector: "he-node-csv-select-headers", inputs: ["csv", "keys", "includeDefaultCSV"], outputs: ["headersChanged"] }, { type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }] });
|
|
3513
5039
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeCsvExportConfirmComponent, decorators: [{
|
|
3514
5040
|
type: i0.Component,
|
|
@@ -3517,7 +5043,7 @@
|
|
|
3517
5043
|
templateUrl: './node-csv-export-confirm.component.html',
|
|
3518
5044
|
styleUrls: ['./node-csv-export-confirm.component.scss']
|
|
3519
5045
|
}]
|
|
3520
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
5046
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.DomSanitizer }]; }, propDecorators: { nodes: [{
|
|
3521
5047
|
type: i0.Input
|
|
3522
5048
|
}], filename: [{
|
|
3523
5049
|
type: i0.Input
|
|
@@ -3739,7 +5265,7 @@
|
|
|
3739
5265
|
};
|
|
3740
5266
|
return NodeLogsFileComponent;
|
|
3741
5267
|
}());
|
|
3742
|
-
NodeLogsFileComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeLogsFileComponent, deps: [{ token: i1__namespace$
|
|
5268
|
+
NodeLogsFileComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeLogsFileComponent, deps: [{ token: i1__namespace$1.DomSanitizer }, { token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3743
5269
|
NodeLogsFileComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeLogsFileComponent, selector: "he-node-logs-file", inputs: { node: "node", dataState: "dataState" }, ngImport: i0__namespace, template: "<div class=\"is-relative\">\n <div class=\"copy-clipboard\">\n <div class=\"field has-addons\">\n <div class=\"control\">\n <he-clipboard clipboardClass=\"button is-link is-small\"\n [value]=\"nodeLog | async\" [hideText]=\"true\" [icon]=\"['far', 'clone']\" size=\"lg\" rotate=\"180\"\n ></he-clipboard>\n </div>\n <ng-container *ngIf=\"showFilters\">\n <div class=\"control\">\n <input class=\"input is-link is-small\"\n [(ngModel)]=\"modelFilter\" id=\"modelFilter\"\n (input)=\"applyFilters()\"\n placeholder=\"Filter by Method / Model\"\n >\n </div>\n <div class=\"control\">\n <input class=\"input is-link is-small\"\n [(ngModel)]=\"termFilter\" id=\"termFilter\"\n (input)=\"applyFilters()\"\n placeholder=\"Filter by Term\"\n >\n </div>\n <div class=\"control\">\n <div class=\"select is-link is-small\">\n <select (change)=\"applyFilters()\"\n [(ngModel)]=\"selectedLevel\" id=\"selectedLevel\"\n >\n <option *ngFor=\"let level of Level | keys\" [value]=\"level.value\">{{level.value}}</option>\n </select>\n </div>\n </div>\n </ng-container>\n <div class=\"control\">\n <button class=\"button is-small\" (click)=\"showFilters = !showFilters\"\n [ngbTooltip]=\"showFilters ? 'Hide filters' : 'Show filters'\" placement=\"bottom\" container=\"body\"\n >\n <fa-icon icon=\"filter\"></fa-icon>\n </button>\n </div>\n <div class=\"control pl-3\">\n <a class=\"button is-dark is-outlined is-small\" target=\"_blank\"\n [href]=\"csvContent\"\n [download]=\"fileToExt(node!['@id'], 'csv')\"\n >\n <fa-icon class=\"mr-2\" icon=\"download\"></fa-icon>\n <span>Download (CSV)</span>\n </a>\n </div>\n </div>\n </div>\n\n <pre class=\"pl-3 pt-3 ml-3\"><code class=\"is-block {{line.class}}\" *ngFor=\"let line of nodeLogLines\">{{line.data.timestamp}} {{('[' + line.data.level + ']:').padEnd(9, ' ')}} {{line.data.message}}</code></pre>\n</div>\n", styles: [":host{display:block}pre{background-color:inherit;color:inherit;min-height:38px;max-height:500px}\n"], components: [{ type: ClipboardComponent, selector: "he-clipboard", inputs: ["value", "disabled", "hideText", "icon", "size", "rotate", "clipboardClass"] }, { type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1__namespace$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1__namespace$4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace$4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i10__namespace.NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "triggers", "container", "disableTooltip", "tooltipClass", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }], pipes: { "async": i3__namespace.AsyncPipe, "keys": KeysPipe } });
|
|
3744
5270
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeLogsFileComponent, decorators: [{
|
|
3745
5271
|
type: i0.Component,
|
|
@@ -3748,13 +5274,13 @@
|
|
|
3748
5274
|
templateUrl: './node-logs-file.component.html',
|
|
3749
5275
|
styleUrls: ['./node-logs-file.component.scss']
|
|
3750
5276
|
}]
|
|
3751
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
5277
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.DomSanitizer }, { type: HeNodeService }]; }, propDecorators: { node: [{
|
|
3752
5278
|
type: i0.Input
|
|
3753
5279
|
}], dataState: [{
|
|
3754
5280
|
type: i0.Input
|
|
3755
5281
|
}] } });
|
|
3756
5282
|
|
|
3757
|
-
var get$
|
|
5283
|
+
var get$3 = require('lodash.get');
|
|
3758
5284
|
var orderBy$4 = require('lodash.orderby');
|
|
3759
5285
|
var reduceValues = function (values) { return values.length ? values.reduce(function (p, v) { return p + propertyValue$1(v.value); }, 0) : null; };
|
|
3760
5286
|
var logSubValue = function (logs, key, prop) { return logs[key][prop] ? {
|
|
@@ -3825,7 +5351,7 @@
|
|
|
3825
5351
|
case 4:
|
|
3826
5352
|
_e.allTerms = _f.sent();
|
|
3827
5353
|
this.allBlankNodes = this.allTerms.flatMap(function (term) {
|
|
3828
|
-
var emissionLogs = get$
|
|
5354
|
+
var emissionLogs = get$3(_this.logs, term['@id'], {});
|
|
3829
5355
|
var original = originalValues.filter(function (v) { return term['@id'] === v.term['@id']; });
|
|
3830
5356
|
var recalculated = recalculatedValues.filter(function (v) { return term['@id'] === v.term['@id']; });
|
|
3831
5357
|
var hasData = !!original.length || !!recalculated.length || Object.keys(emissionLogs).length > 0;
|
|
@@ -3885,7 +5411,7 @@
|
|
|
3885
5411
|
};
|
|
3886
5412
|
NodeLogsModelsComponent.prototype.validSubValue = function (node, index, subValue) {
|
|
3887
5413
|
var methodId = this.getMethodIdAt(node, index, subValue);
|
|
3888
|
-
return !(subValue === null || subValue === void 0 ? void 0 : subValue.value) || get$
|
|
5414
|
+
return !(subValue === null || subValue === void 0 ? void 0 : subValue.value) || get$3(node.logs[methodId], subValue === null || subValue === void 0 ? void 0 : subValue.key, null) === (subValue === null || subValue === void 0 ? void 0 : subValue.value);
|
|
3889
5415
|
};
|
|
3890
5416
|
NodeLogsModelsComponent.prototype.getMethodIdAt = function (node, index, subValue) {
|
|
3891
5417
|
var configModels = (subValue || node).configModels;
|
|
@@ -4059,7 +5585,7 @@
|
|
|
4059
5585
|
NodeLogsFileComponent,
|
|
4060
5586
|
NodeLogsModelsComponent,
|
|
4061
5587
|
NodeMissingLookupFactorsComponent,
|
|
4062
|
-
NodeValueDetailsComponent], imports: [i3.CommonModule, i4.RouterModule, i1$
|
|
5588
|
+
NodeValueDetailsComponent], imports: [i3.CommonModule, i4.RouterModule, i1$2.FormsModule,
|
|
4063
5589
|
i6.DragDropModule,
|
|
4064
5590
|
HeCommonModule], exports: [NodeIconComponent,
|
|
4065
5591
|
NodeLinkComponent,
|
|
@@ -4071,7 +5597,7 @@
|
|
|
4071
5597
|
NodeMissingLookupFactorsComponent,
|
|
4072
5598
|
NodeValueDetailsComponent] });
|
|
4073
5599
|
HeNodeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeNodeModule, imports: [[
|
|
4074
|
-
i3.CommonModule, i4.RouterModule, i1$
|
|
5600
|
+
i3.CommonModule, i4.RouterModule, i1$2.FormsModule,
|
|
4075
5601
|
i6.DragDropModule,
|
|
4076
5602
|
HeCommonModule
|
|
4077
5603
|
]] });
|
|
@@ -4081,7 +5607,7 @@
|
|
|
4081
5607
|
declarations: components$4,
|
|
4082
5608
|
exports: components$4,
|
|
4083
5609
|
imports: [
|
|
4084
|
-
i3.CommonModule, i4.RouterModule, i1$
|
|
5610
|
+
i3.CommonModule, i4.RouterModule, i1$2.FormsModule,
|
|
4085
5611
|
i6.DragDropModule,
|
|
4086
5612
|
HeCommonModule
|
|
4087
5613
|
]
|
|
@@ -4117,7 +5643,7 @@
|
|
|
4117
5643
|
this.cycles = [];
|
|
4118
5644
|
this.cycleAdded = new i0.EventEmitter();
|
|
4119
5645
|
this.form = this.formBuilder.group({
|
|
4120
|
-
search: ['', i1$
|
|
5646
|
+
search: ['', i1$2.Validators.required]
|
|
4121
5647
|
});
|
|
4122
5648
|
this.loading = false;
|
|
4123
5649
|
this.suggesting = false;
|
|
@@ -4758,7 +6284,7 @@
|
|
|
4758
6284
|
CyclesEmissionsLogsComponent,
|
|
4759
6285
|
CyclesFunctionalUnitMeasureComponent,
|
|
4760
6286
|
CyclesResultComponent,
|
|
4761
|
-
CyclesSuggestFormComponent], imports: [i3.CommonModule, i1$
|
|
6287
|
+
CyclesSuggestFormComponent], imports: [i3.CommonModule, i1$2.FormsModule, i1$2.ReactiveFormsModule,
|
|
4762
6288
|
HeCommonModule,
|
|
4763
6289
|
HeNodeModule], exports: [CyclesActivityComponent,
|
|
4764
6290
|
CyclesActivityLogsComponent,
|
|
@@ -4770,7 +6296,7 @@
|
|
|
4770
6296
|
CyclesResultComponent,
|
|
4771
6297
|
CyclesSuggestFormComponent] });
|
|
4772
6298
|
HeCyclesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeCyclesModule, imports: [[
|
|
4773
|
-
i3.CommonModule, i1$
|
|
6299
|
+
i3.CommonModule, i1$2.FormsModule, i1$2.ReactiveFormsModule,
|
|
4774
6300
|
HeCommonModule,
|
|
4775
6301
|
HeNodeModule
|
|
4776
6302
|
]] });
|
|
@@ -4780,7 +6306,7 @@
|
|
|
4780
6306
|
declarations: components$3,
|
|
4781
6307
|
exports: components$3,
|
|
4782
6308
|
imports: [
|
|
4783
|
-
i3.CommonModule, i1$
|
|
6309
|
+
i3.CommonModule, i1$2.FormsModule, i1$2.ReactiveFormsModule,
|
|
4784
6310
|
HeCommonModule,
|
|
4785
6311
|
HeNodeModule
|
|
4786
6312
|
]
|
|
@@ -4790,6 +6316,7 @@
|
|
|
4790
6316
|
var _f;
|
|
4791
6317
|
var mapErrorMessage = 'does not contain latitude and longitude';
|
|
4792
6318
|
var parseDataPath = function (dataPath) {
|
|
6319
|
+
if (dataPath === void 0) { dataPath = ''; }
|
|
4793
6320
|
var _f = __read(dataPath.split('.')), _ = _f[0], paths = _f.slice(1);
|
|
4794
6321
|
return paths.map(function (path) { return ({ path: path, label: keyToLabel(path.replace(/\[\d+\]/g, '')) }); });
|
|
4795
6322
|
};
|
|
@@ -4984,7 +6511,7 @@
|
|
|
4984
6511
|
|
|
4985
6512
|
var _d;
|
|
4986
6513
|
/* eslint-disable complexity */
|
|
4987
|
-
var get$
|
|
6514
|
+
var get$2 = require('lodash.get');
|
|
4988
6515
|
var ARRAY_DELIMITER = ';';
|
|
4989
6516
|
var privateKeys = [
|
|
4990
6517
|
'filepath'
|
|
@@ -4994,6 +6521,7 @@
|
|
|
4994
6521
|
var nonExpandableArrayDataPath = function (key) { return key.replace(/\[\d+\]$/, ''); };
|
|
4995
6522
|
var keyToDataPath = function (key) { return (key === null || key === void 0 ? void 0 : key.length) ? "." + key : ''; };
|
|
4996
6523
|
var dataPathToKey = function (dataPath, trimArray) {
|
|
6524
|
+
if (dataPath === void 0) { dataPath = ''; }
|
|
4997
6525
|
if (trimArray === void 0) { trimArray = false; }
|
|
4998
6526
|
return trimArray ? nonExpandableArrayDataPath(dataPath.substring(1)) : dataPath.substring(1);
|
|
4999
6527
|
};
|
|
@@ -5168,7 +6696,7 @@
|
|
|
5168
6696
|
};
|
|
5169
6697
|
var nodeAvailableProperties = function (node, _d) {
|
|
5170
6698
|
var fullKey = _d.fullKey, schema = _d.schema, schemaType = _d.schemaType;
|
|
5171
|
-
return availableProperties(schema, schemaType, fullKey ? get$
|
|
6699
|
+
return availableProperties(schema, schemaType, fullKey ? get$2(node, fullKey, {}) : node, fullKey.length > 0);
|
|
5172
6700
|
};
|
|
5173
6701
|
var isAddPropertyEnabled = function (node, schemaType, schema, fullKey) {
|
|
5174
6702
|
if (fullKey === void 0) { fullKey = ''; }
|
|
@@ -5177,7 +6705,7 @@
|
|
|
5177
6705
|
(!fullKey || nestingTypeEnabled(schemaType));
|
|
5178
6706
|
};
|
|
5179
6707
|
var editableKey = function (key) { return !['type', '@type', 'termType'].includes(key); };
|
|
5180
|
-
var propertyId = function () { return uuid.v4(); };
|
|
6708
|
+
var propertyId = function () { return uuid$1.v4(); };
|
|
5181
6709
|
var propertyUrl = function (node, key) { return ['@id', 'name'].includes(key) && linkTypeEnabled(node['@type']) ?
|
|
5182
6710
|
{
|
|
5183
6711
|
url: baseUrl() + "/" + node['@type'].toLowerCase() + "/" + node['@id'],
|
|
@@ -5209,7 +6737,7 @@
|
|
|
5209
6737
|
var _d = __read(fullKey.split('.')), parent = _d[0], keys = _d.slice(1);
|
|
5210
6738
|
var properties = schema.properties || {};
|
|
5211
6739
|
var examples = (parent in properties ? properties[parent] : { examples: [] }).examples;
|
|
5212
|
-
return (examples === null || examples === void 0 ? void 0 : examples.length) && typeof examples[0] === 'object' ? get$
|
|
6740
|
+
return (examples === null || examples === void 0 ? void 0 : examples.length) && typeof examples[0] === 'object' ? get$2(examples[0], keys.join('.'), null) : null;
|
|
5213
6741
|
};
|
|
5214
6742
|
var propertyPlaceholder = function (schema, valueType, fullKey, parentSchema) {
|
|
5215
6743
|
if (fullKey === void 0) { fullKey = ''; }
|
|
@@ -5374,7 +6902,7 @@
|
|
|
5374
6902
|
var _d = __read(fullKey.split('.')), _t = _d[0], keys = _d.slice(1);
|
|
5375
6903
|
var key = keys.pop();
|
|
5376
6904
|
var parent = keys.join('.');
|
|
5377
|
-
var parentNode = parent.length ? get$
|
|
6905
|
+
var parentNode = parent.length ? get$2(node, parent) : node;
|
|
5378
6906
|
var schemaType = schema.typeToSchemaType(parentNode.type || parentNode['@type']);
|
|
5379
6907
|
var parentSchema = schemas[schemaType];
|
|
5380
6908
|
return propertyFromNode(schemas, errors, parentSchema, true, parent, parentNode)(key);
|
|
@@ -5586,6 +7114,73 @@
|
|
|
5586
7114
|
return moment__namespace(endDate.value).locale('en-gb').subtract(cycleDuration.value, 'days').format('YYYY-MM-DD');
|
|
5587
7115
|
};
|
|
5588
7116
|
|
|
7117
|
+
var get$1 = require('lodash.get');
|
|
7118
|
+
var nodeTerm = function (node, key) {
|
|
7119
|
+
var termType = get$1(node, key + ".type", get$1(node, key + ".@type", null));
|
|
7120
|
+
return termType === schema.SchemaType.Term ? get$1(node, key, null) : null;
|
|
7121
|
+
};
|
|
7122
|
+
var findNodeTerm = function (node, _b) {
|
|
7123
|
+
var dataPath = _b.dataPath;
|
|
7124
|
+
return nodeTerm(node, dataPathToKey(dataPath)) ||
|
|
7125
|
+
nodeTerm(node, dataPathToKey(dataPath) + ".term") ||
|
|
7126
|
+
nodeTerm(node, dataPathToKey(dataPath, true)) ||
|
|
7127
|
+
nodeTerm(node, dataPathToKey(dataPath, true) + ".term");
|
|
7128
|
+
};
|
|
7129
|
+
var uniqueTerms = function (errors) { return utils.unique(errors
|
|
7130
|
+
.map(function (_b) {
|
|
7131
|
+
var term = _b.term;
|
|
7132
|
+
return term ? nodeLink(term) || code(term.name || term['@id'] || term.id) : null;
|
|
7133
|
+
})
|
|
7134
|
+
.filter(Boolean)); };
|
|
7135
|
+
var summaryShowErrors = function (summaryData, _b) {
|
|
7136
|
+
var path = _b.path, level = _b.level, message = _b.message;
|
|
7137
|
+
var _a;
|
|
7138
|
+
return ((_a = summaryData.find(function (summary) { return summary.path === path && summary.level === level && summary.message === message; })) === null || _a === void 0 ? void 0 : _a.showErrors) || true;
|
|
7139
|
+
};
|
|
7140
|
+
/**
|
|
7141
|
+
* Build the summary objects.
|
|
7142
|
+
*
|
|
7143
|
+
* @param nodes The list of nodes.
|
|
7144
|
+
* @param errors The list of errors per node.
|
|
7145
|
+
* @param summaryData The previously computed summary objects.
|
|
7146
|
+
* @returns
|
|
7147
|
+
*/
|
|
7148
|
+
var buildSummary = function (nodes, errors, summaryData) {
|
|
7149
|
+
if (nodes === void 0) { nodes = []; }
|
|
7150
|
+
if (errors === void 0) { errors = []; }
|
|
7151
|
+
if (summaryData === void 0) { summaryData = []; }
|
|
7152
|
+
return rxjs.from(errors).pipe(operators.mergeMap(function (error) { return 'error' in error ? error.error : error; }), operators.filter(filterError), operators.reduce(function (prev, error) {
|
|
7153
|
+
var _a;
|
|
7154
|
+
var message = error.message;
|
|
7155
|
+
var _b = __read(parseDataPath(error.dataPath), 1), dataPath = _b[0];
|
|
7156
|
+
var node = get$1(nodes, error.nodeIndex, null);
|
|
7157
|
+
var label = dataPath ? dataPath.label : node === null || node === void 0 ? void 0 : node.type;
|
|
7158
|
+
var term = ((_a = error.params) === null || _a === void 0 ? void 0 : _a.term) || findNodeTerm(node, error);
|
|
7159
|
+
prev[message] = prev[message] || { level: error.level, paths: {} };
|
|
7160
|
+
prev[message].paths[label] = prev[message].paths[label] || [];
|
|
7161
|
+
prev[message].paths[label].push({ node: node, error: error, term: term });
|
|
7162
|
+
return prev;
|
|
7163
|
+
}, {}), operators.mergeMap(function (data) { return rxjs.from(Object.keys(data)).pipe(operators.filter(function (message) { return !!message; }), operators.mergeMap(function (message) { return Object.keys(data[message].paths).map(function (path) {
|
|
7164
|
+
var _a;
|
|
7165
|
+
return ({
|
|
7166
|
+
level: data[message].level,
|
|
7167
|
+
path: path,
|
|
7168
|
+
message: message,
|
|
7169
|
+
formattedMessage: (_a = formatError(data[message].paths[path][0].error, data[message].paths[path].length)) === null || _a === void 0 ? void 0 : _a.message,
|
|
7170
|
+
terms: uniqueTerms(data[message].paths[path]).join(' ; '),
|
|
7171
|
+
errors: data[message].paths[path],
|
|
7172
|
+
count: data[message].paths[path].length,
|
|
7173
|
+
showErrors: summaryShowErrors(summaryData, { level: data[message].level, path: path, message: message })
|
|
7174
|
+
});
|
|
7175
|
+
}); }), operators.filter(function (_b) {
|
|
7176
|
+
var formattedMessage = _b.formattedMessage;
|
|
7177
|
+
return !!formattedMessage;
|
|
7178
|
+
})); }), operators.toArray(), operators.map(function (values) { return values.sort(function (_b) {
|
|
7179
|
+
var level = _b.level;
|
|
7180
|
+
return level === 'error' ? -1 : 1;
|
|
7181
|
+
}); }));
|
|
7182
|
+
};
|
|
7183
|
+
|
|
5589
7184
|
var isSite = function (_a) {
|
|
5590
7185
|
var type = _a["@type"], id = _a["@id"];
|
|
5591
7186
|
return type === schema.NodeType.Site && !!id;
|
|
@@ -5800,7 +7395,7 @@
|
|
|
5800
7395
|
return SitesMapsComponent;
|
|
5801
7396
|
}());
|
|
5802
7397
|
SitesMapsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMapsComponent, deps: [{ token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
5803
|
-
SitesMapsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SitesMapsComponent, selector: "he-sites-maps", inputs: { loadPolygons: "loadPolygons", sites: "sites", nodes: "nodes", center: "center", zoom: "zoom", showNotice: "showNotice" }, viewQueries: [{ propertyName: "map", first: true, predicate: i1$
|
|
7398
|
+
SitesMapsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SitesMapsComponent, selector: "he-sites-maps", inputs: { loadPolygons: "loadPolygons", sites: "sites", nodes: "nodes", center: "center", zoom: "zoom", showNotice: "showNotice" }, viewQueries: [{ propertyName: "map", first: true, predicate: i1$4.GoogleMap, descendants: true }], ngImport: i0__namespace, template: "<google-map *ngIf=\"googleLoaded\"\n height=\"100%\"\n width=\"100%\"\n [zoom]=\"zoom\"\n [center]=\"center\"\n></google-map>\n\n<p *ngIf=\"showNotice\" class=\"mt-2 is-italic is-size-7\">The information provided might not be complete</p>\n\n<div class=\"no-location has-text-center has-text-light\" *ngIf=\"showNoLocation\">\n <span>No precise location data</span>\n</div>\n", styles: [":host{display:block;height:100%;position:relative;width:100%}.no-location{background-color:#0000004d;left:0;height:100%;position:absolute;top:0;width:100%;z-index:9}.no-location>span{display:inline-block;margin-top:12%}\n"], components: [{ type: i1__namespace$3.GoogleMap, selector: "google-map", inputs: ["height", "width", "center", "zoom", "options", "mapTypeId"], outputs: ["authFailure", "boundsChanged", "centerChanged", "mapClick", "mapDblclick", "mapDrag", "mapDragend", "mapDragstart", "headingChanged", "idle", "maptypeidChanged", "mapMousemove", "mapMouseout", "mapMouseover", "projectionChanged", "mapRightclick", "tilesloaded", "tiltChanged", "zoomChanged"], exportAs: ["googleMap"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
5804
7399
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMapsComponent, decorators: [{
|
|
5805
7400
|
type: i0.Component,
|
|
5806
7401
|
args: [{
|
|
@@ -5810,7 +7405,7 @@
|
|
|
5810
7405
|
}]
|
|
5811
7406
|
}], ctorParameters: function () { return [{ type: HeNodeService }]; }, propDecorators: { map: [{
|
|
5812
7407
|
type: i0.ViewChild,
|
|
5813
|
-
args: [i1$
|
|
7408
|
+
args: [i1$4.GoogleMap]
|
|
5814
7409
|
}], loadPolygons: [{
|
|
5815
7410
|
type: i0.Input
|
|
5816
7411
|
}], sites: [{
|
|
@@ -5995,13 +7590,13 @@
|
|
|
5995
7590
|
HeSitesModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
5996
7591
|
HeSitesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, declarations: [SitesMapsComponent,
|
|
5997
7592
|
SitesMeasurementsComponent,
|
|
5998
|
-
SitesMeasurementsLogsComponent], imports: [i3.CommonModule, i1$
|
|
7593
|
+
SitesMeasurementsLogsComponent], imports: [i3.CommonModule, i1$2.ReactiveFormsModule,
|
|
5999
7594
|
HeCommonModule,
|
|
6000
7595
|
HeNodeModule], exports: [SitesMapsComponent,
|
|
6001
7596
|
SitesMeasurementsComponent,
|
|
6002
7597
|
SitesMeasurementsLogsComponent] });
|
|
6003
7598
|
HeSitesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, imports: [[
|
|
6004
|
-
i3.CommonModule, i1$
|
|
7599
|
+
i3.CommonModule, i1$2.ReactiveFormsModule,
|
|
6005
7600
|
HeCommonModule,
|
|
6006
7601
|
HeNodeModule
|
|
6007
7602
|
]] });
|
|
@@ -6011,7 +7606,7 @@
|
|
|
6011
7606
|
declarations: components$2,
|
|
6012
7607
|
exports: components$2,
|
|
6013
7608
|
imports: [
|
|
6014
|
-
i3.CommonModule, i1$
|
|
7609
|
+
i3.CommonModule, i1$2.ReactiveFormsModule,
|
|
6015
7610
|
HeCommonModule,
|
|
6016
7611
|
HeNodeModule
|
|
6017
7612
|
]
|
|
@@ -6495,13 +8090,13 @@
|
|
|
6495
8090
|
return HeFilesModule;
|
|
6496
8091
|
}());
|
|
6497
8092
|
HeFilesModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeFilesModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
6498
|
-
HeFilesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeFilesModule, declarations: [FilesFormComponent], imports: [i3.CommonModule, i1$
|
|
8093
|
+
HeFilesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeFilesModule, declarations: [FilesFormComponent], imports: [i3.CommonModule, i1$2.FormsModule,
|
|
6499
8094
|
HeCommonModule,
|
|
6500
8095
|
HeNodeModule,
|
|
6501
8096
|
HeBibliographiesModule,
|
|
6502
8097
|
HeSitesModule], exports: [FilesFormComponent] });
|
|
6503
8098
|
HeFilesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeFilesModule, imports: [[
|
|
6504
|
-
i3.CommonModule, i1$
|
|
8099
|
+
i3.CommonModule, i1$2.FormsModule,
|
|
6505
8100
|
HeCommonModule,
|
|
6506
8101
|
HeNodeModule,
|
|
6507
8102
|
HeBibliographiesModule,
|
|
@@ -6513,7 +8108,7 @@
|
|
|
6513
8108
|
declarations: components$1,
|
|
6514
8109
|
exports: components$1,
|
|
6515
8110
|
imports: [
|
|
6516
|
-
i3.CommonModule, i1$
|
|
8111
|
+
i3.CommonModule, i1$2.FormsModule,
|
|
6517
8112
|
HeCommonModule,
|
|
6518
8113
|
HeNodeModule,
|
|
6519
8114
|
HeBibliographiesModule,
|
|
@@ -6686,7 +8281,7 @@
|
|
|
6686
8281
|
};
|
|
6687
8282
|
return ImpactAssessmentsIndicatorBreakdownChartComponent;
|
|
6688
8283
|
}());
|
|
6689
|
-
ImpactAssessmentsIndicatorBreakdownChartComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ImpactAssessmentsIndicatorBreakdownChartComponent, deps: [{ token: i1__namespace$
|
|
8284
|
+
ImpactAssessmentsIndicatorBreakdownChartComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ImpactAssessmentsIndicatorBreakdownChartComponent, deps: [{ token: i1__namespace$1.DomSanitizer }, { token: HeSearchService }, { token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
6690
8285
|
ImpactAssessmentsIndicatorBreakdownChartComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ImpactAssessmentsIndicatorBreakdownChartComponent, selector: "he-impact-assessments-indicator-breakdown-chart", inputs: { impactAssessment: "impactAssessment", indicators: "indicators" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], ngImport: i0__namespace, template: "<div class=\"p-3\" [class.is-hidden]=\"loading || !terms?.length\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"field has-addons\">\n <div class=\"control\">\n <span class=\"button is-small is-static\">Select an Indicator</span>\n </div>\n <div class=\"control is-expanded\">\n <div class=\"select is-fullwidth is-small\">\n <select (change)=\"updateChart()\" [(ngModel)]=\"selectedTerm\" id=\"selectedTerm\">\n <option *ngFor=\"let term of terms\" [ngValue]=\"term\">{{term.name}} ({{term.units}})</option>\n </select>\n </div>\n </div>\n </div>\n </div>\n <div class=\"column is-narrow\">\n <a class=\"button is-dark is-outlined is-small\" [href]=\"csvContent\" [download]=\"id + '-logs.csv'\">\n <fa-icon icon=\"download\"></fa-icon>\n <span class=\"pl-2\">Download All (CSV)</span>\n </a>\n </div>\n </div>\n\n <div class=\"mt-1\">\n <p *ngIf=\"noData\" class=\"has-text-centered\">No breakdown available for {{selectedTerm?.name}}.</p>\n <div class=\"chart-container h-100\">\n <canvas #chart></canvas>\n </div>\n </div>\n</div>\n\n<ng-container *ngIf=\"loading\">\n <div class=\"has-text-center py-3\">\n <fa-icon icon=\"spinner\" [pulse]=\"true\" size=\"lg\"></fa-icon>\n </div>\n</ng-container>\n", styles: [":host{display:block;overflow:visible}.chart-container{height:400px;position:relative}\n"], components: [{ type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }], directives: [{ type: i1__namespace$4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i1__namespace$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace$4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
6691
8286
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ImpactAssessmentsIndicatorBreakdownChartComponent, decorators: [{
|
|
6692
8287
|
type: i0.Component,
|
|
@@ -6695,7 +8290,7 @@
|
|
|
6695
8290
|
templateUrl: './impact-assessments-indicator-breakdown-chart.component.html',
|
|
6696
8291
|
styleUrls: ['./impact-assessments-indicator-breakdown-chart.component.scss']
|
|
6697
8292
|
}]
|
|
6698
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
8293
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.DomSanitizer }, { type: HeSearchService }, { type: HeNodeService }]; }, propDecorators: { chartRef: [{
|
|
6699
8294
|
type: i0.ViewChild,
|
|
6700
8295
|
args: ['chart']
|
|
6701
8296
|
}], impactAssessment: [{
|
|
@@ -6956,7 +8551,7 @@
|
|
|
6956
8551
|
this.indicators = [];
|
|
6957
8552
|
// Adding impacts to compare
|
|
6958
8553
|
this.form = this.formBuilder.group({
|
|
6959
|
-
search: ['', i1$
|
|
8554
|
+
search: ['', i1$2.Validators.required]
|
|
6960
8555
|
});
|
|
6961
8556
|
this.selectedImpactAssessments = [];
|
|
6962
8557
|
this.loading = false;
|
|
@@ -7245,14 +8840,14 @@
|
|
|
7245
8840
|
HeImpactAssessmentsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeImpactAssessmentsModule, declarations: [ImpactAssessmentsProductsComponent,
|
|
7246
8841
|
ImpactAssessmentsIndicatorsChartComponent,
|
|
7247
8842
|
ImpactAssessmentsProductsLogsComponent,
|
|
7248
|
-
ImpactAssessmentsIndicatorBreakdownChartComponent], imports: [i3.CommonModule, i4.RouterModule, i1$
|
|
8843
|
+
ImpactAssessmentsIndicatorBreakdownChartComponent], imports: [i3.CommonModule, i4.RouterModule, i1$2.FormsModule, i1$2.ReactiveFormsModule,
|
|
7249
8844
|
HeCommonModule,
|
|
7250
8845
|
HeNodeModule], exports: [ImpactAssessmentsProductsComponent,
|
|
7251
8846
|
ImpactAssessmentsIndicatorsChartComponent,
|
|
7252
8847
|
ImpactAssessmentsProductsLogsComponent,
|
|
7253
8848
|
ImpactAssessmentsIndicatorBreakdownChartComponent] });
|
|
7254
8849
|
HeImpactAssessmentsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeImpactAssessmentsModule, imports: [[
|
|
7255
|
-
i3.CommonModule, i4.RouterModule, i1$
|
|
8850
|
+
i3.CommonModule, i4.RouterModule, i1$2.FormsModule, i1$2.ReactiveFormsModule,
|
|
7256
8851
|
HeCommonModule,
|
|
7257
8852
|
HeNodeModule
|
|
7258
8853
|
]] });
|
|
@@ -7262,7 +8857,7 @@
|
|
|
7262
8857
|
declarations: components,
|
|
7263
8858
|
exports: components,
|
|
7264
8859
|
imports: [
|
|
7265
|
-
i3.CommonModule, i4.RouterModule, i1$
|
|
8860
|
+
i3.CommonModule, i4.RouterModule, i1$2.FormsModule, i1$2.ReactiveFormsModule,
|
|
7266
8861
|
HeCommonModule,
|
|
7267
8862
|
HeNodeModule
|
|
7268
8863
|
]
|
|
@@ -7341,6 +8936,7 @@
|
|
|
7341
8936
|
exports.HeAggregationEngineService = HeAggregationEngineService;
|
|
7342
8937
|
exports.HeAuthService = HeAuthService;
|
|
7343
8938
|
exports.HeBibliographiesModule = HeBibliographiesModule;
|
|
8939
|
+
exports.HeCommonLightModule = HeCommonLightModule;
|
|
7344
8940
|
exports.HeCommonModule = HeCommonModule;
|
|
7345
8941
|
exports.HeCommonService = HeCommonService;
|
|
7346
8942
|
exports.HeCyclesModule = HeCyclesModule;
|
|
@@ -7397,6 +8993,7 @@
|
|
|
7397
8993
|
exports.availableProperties = availableProperties;
|
|
7398
8994
|
exports.baseUrl = baseUrl;
|
|
7399
8995
|
exports.bottom = bottom;
|
|
8996
|
+
exports.buildSummary = buildSummary;
|
|
7400
8997
|
exports.calculateCycleDuration = calculateCycleDuration;
|
|
7401
8998
|
exports.calculateCycleDurationEnabled = calculateCycleDurationEnabled;
|
|
7402
8999
|
exports.calculateCycleStartDate = calculateCycleStartDate;
|