@c8y/ngx-components 1018.0.151 → 1018.0.159
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/NOTICES +1 -1
- package/core/range-display/range-display.component.d.ts +19 -1
- package/core/realtime/realtime-subject.service.d.ts +4 -0
- package/core/realtime/realtime.service.d.ts +10 -0
- package/device-protocols/device-protocols.guard.d.ts +12 -0
- package/device-protocols/device-protocols.module.d.ts +8 -0
- package/device-protocols/device-type-detail-edited.service.d.ts +8 -0
- package/device-protocols/device-type-detail.component.d.ts +12 -0
- package/device-protocols/device-type-detail.directive.d.ts +9 -0
- package/device-protocols/index.d.ts +5 -0
- package/esm2020/core/range-display/range-display.component.mjs +87 -4
- package/esm2020/core/realtime/realtime-subject.service.mjs +47 -4
- package/esm2020/core/realtime/realtime.service.mjs +15 -1
- package/esm2020/device-protocols/c8y-ngx-components-device-protocols.mjs +5 -0
- package/esm2020/device-protocols/device-protocols.guard.mjs +40 -0
- package/esm2020/device-protocols/device-protocols.module.mjs +46 -0
- package/esm2020/device-protocols/device-type-detail-edited.service.mjs +19 -0
- package/esm2020/device-protocols/device-type-detail.component.mjs +45 -0
- package/esm2020/device-protocols/device-type-detail.directive.mjs +19 -0
- package/esm2020/device-protocols/index.mjs +6 -0
- package/esm2020/ecosystem/application-properties/subscription-modal/subscription-modal.component.mjs +4 -1
- package/esm2020/icon-selector/icons/ecommerce/index.mjs +2 -2
- package/esm2020/upgrade/ng1/downgraded.services.mjs +6 -4
- package/esm2020/upgrade/ng1/index.mjs +6 -5
- package/esm2020/upgrade/upgrade.module.mjs +10 -10
- package/fesm2015/c8y-ngx-components-device-protocols.mjs +162 -0
- package/fesm2015/c8y-ngx-components-device-protocols.mjs.map +1 -0
- package/fesm2015/c8y-ngx-components-ecosystem.mjs +3 -0
- package/fesm2015/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components-icon-selector-icons-ecommerce.mjs +1 -1
- package/fesm2015/c8y-ngx-components-icon-selector-icons-ecommerce.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components-upgrade.mjs +91 -88
- package/fesm2015/c8y-ngx-components-upgrade.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components.mjs +144 -4
- package/fesm2015/c8y-ngx-components.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-device-protocols.mjs +159 -0
- package/fesm2020/c8y-ngx-components-device-protocols.mjs.map +1 -0
- package/fesm2020/c8y-ngx-components-ecosystem.mjs +3 -0
- package/fesm2020/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-icon-selector-icons-ecommerce.mjs +1 -1
- package/fesm2020/c8y-ngx-components-icon-selector-icons-ecommerce.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-upgrade.mjs +90 -87
- package/fesm2020/c8y-ngx-components-upgrade.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components.mjs +142 -4
- package/fesm2020/c8y-ngx-components.mjs.map +1 -1
- package/icon-selector/icons/ecommerce/index.d.ts +1 -1
- package/locales/de.po +3 -0
- package/locales/en.po +80 -8
- package/locales/locales.pot +4 -4
- package/package.json +1 -1
- package/upgrade/ng1/downgraded.services.d.ts +1 -0
|
@@ -3701,6 +3701,20 @@ class RealtimeService {
|
|
|
3701
3701
|
get active() {
|
|
3702
3702
|
return this.isActive.value;
|
|
3703
3703
|
}
|
|
3704
|
+
/**
|
|
3705
|
+
* An observable emitting a value in case the realtime connection has been interrupted.
|
|
3706
|
+
* Can be used to reload data of e.g. a datapoint graph that wasn't received while realtime was interrupted.
|
|
3707
|
+
*/
|
|
3708
|
+
get reconnect$() {
|
|
3709
|
+
return this.realtimeSubject.reconnect$;
|
|
3710
|
+
}
|
|
3711
|
+
/**
|
|
3712
|
+
* An observable emitting either `connected` or `disconnected` depending on the state of the realtime connection.
|
|
3713
|
+
* Can be used to e.g. inform the user about the interrupted realtime connection.
|
|
3714
|
+
*/
|
|
3715
|
+
get connectionStatus$() {
|
|
3716
|
+
return this.realtimeSubject.connectionStatus$;
|
|
3717
|
+
}
|
|
3704
3718
|
/**
|
|
3705
3719
|
* Get an Observable of all realtime notifications.
|
|
3706
3720
|
*
|
|
@@ -26834,6 +26848,13 @@ class RangeDisplayComponent {
|
|
|
26834
26848
|
this.sanitizer = sanitizer;
|
|
26835
26849
|
this.config = {};
|
|
26836
26850
|
this.display = 'full';
|
|
26851
|
+
this.currentRangeWidthChanged = new Subject();
|
|
26852
|
+
// width of current range is changing within 150ms, see style declaration for .range-display__range__current
|
|
26853
|
+
this.CURRENT_RANGE_WIDTH_TRANSITION_TIME = 150;
|
|
26854
|
+
this.DEFAULT_TOOLTIP_SHIFT = '50%';
|
|
26855
|
+
this.MIN_TOOLTIP_SHIFT = 10;
|
|
26856
|
+
this.tooltipShift = this.DEFAULT_TOOLTIP_SHIFT;
|
|
26857
|
+
this.destroyed$ = new Subject();
|
|
26837
26858
|
}
|
|
26838
26859
|
get inlineStyle() {
|
|
26839
26860
|
this.config = this.config || {};
|
|
@@ -26849,6 +26870,8 @@ class RangeDisplayComponent {
|
|
|
26849
26870
|
return this.sanitizer.bypassSecurityTrustStyle(`
|
|
26850
26871
|
--range-min: ${this.config.min};
|
|
26851
26872
|
--range-max: ${this.config.max};
|
|
26873
|
+
--range-display-tooltip-translate: translate(${this.tooltipShift}, -56px);
|
|
26874
|
+
--range-display-tooltip-bg: var(${this.getTooltipBackground()});
|
|
26852
26875
|
--full-range: ${this.config.max - this.config.min};
|
|
26853
26876
|
--measurement-target: ${((this.config.target - this.config.min) * 100) / (this.config.max - this.config.min)}%;
|
|
26854
26877
|
--measurement-current: ${((this.config.current - this.config.min) * 100) / (this.config.max - this.config.min)}%;
|
|
@@ -26862,6 +26885,20 @@ class RangeDisplayComponent {
|
|
|
26862
26885
|
100}%;
|
|
26863
26886
|
`);
|
|
26864
26887
|
}
|
|
26888
|
+
ngOnChanges() {
|
|
26889
|
+
// It's necessary to handle tooltip shifting both in OnChanges and AfterViewInit. In case of Linear gauge widget, view is
|
|
26890
|
+
// rendered first (so as elements needed for calculating shifting) and config orientation is set later on.
|
|
26891
|
+
// In other cases it's possible that orientation is defined on initialization of class and view elements are rendered later.
|
|
26892
|
+
this.setupTooltipShiftingIfPossible();
|
|
26893
|
+
}
|
|
26894
|
+
ngAfterViewInit() {
|
|
26895
|
+
this.setupTooltipShiftingIfPossible();
|
|
26896
|
+
}
|
|
26897
|
+
ngOnDestroy() {
|
|
26898
|
+
this.currentRangeWidthObserver?.disconnect();
|
|
26899
|
+
this.destroyed$.next();
|
|
26900
|
+
this.destroyed$.complete();
|
|
26901
|
+
}
|
|
26865
26902
|
checkTarget() {
|
|
26866
26903
|
return (this.config.target !== undefined &&
|
|
26867
26904
|
this.config.target !== null &&
|
|
@@ -26889,12 +26926,64 @@ class RangeDisplayComponent {
|
|
|
26889
26926
|
isRangeDisplayed(rangeMin, rangeMax) {
|
|
26890
26927
|
return rangeMin === 0 || rangeMax === 0 || (rangeMin && rangeMax);
|
|
26891
26928
|
}
|
|
26929
|
+
setupTooltipShifting() {
|
|
26930
|
+
this.currentRangeWidthObserver = new ResizeObserver(([val]) => {
|
|
26931
|
+
if (getComputedStyle(val.target, null).display === 'block') {
|
|
26932
|
+
this.currentRangeWidthChanged.next(val.target);
|
|
26933
|
+
}
|
|
26934
|
+
});
|
|
26935
|
+
this.currentRangeWidthObserver.observe(this.currentRangeElement.nativeElement);
|
|
26936
|
+
this.currentRangeWidthChanged
|
|
26937
|
+
.pipe(debounceTime(this.CURRENT_RANGE_WIDTH_TRANSITION_TIME), map((rangeElement) => parseInt(getComputedStyle(rangeElement, null).width)), distinctUntilChanged(), takeUntil(this.destroyed$))
|
|
26938
|
+
.subscribe(rangeElementWidth => {
|
|
26939
|
+
this.setTooltipShiftValue(rangeElementWidth);
|
|
26940
|
+
});
|
|
26941
|
+
}
|
|
26942
|
+
setTooltipShiftValue(rangeElementWidth) {
|
|
26943
|
+
const tooltipWidth = parseInt(getComputedStyle(this.currentRangeElement.nativeElement, ':after').width);
|
|
26944
|
+
const currentRangeWidth = rangeElementWidth;
|
|
26945
|
+
const rangeDisplayWidth = parseInt(getComputedStyle(this.rangeDisplay.nativeElement, null).getPropertyValue('width'));
|
|
26946
|
+
const rangeDisplayPaddingLeft = parseInt(getComputedStyle(this.rangeDisplay.nativeElement, null).getPropertyValue('padding-left'));
|
|
26947
|
+
const tooltipOverflowsLeftEdge = tooltipWidth / 2 > rangeDisplayPaddingLeft + currentRangeWidth;
|
|
26948
|
+
const tooltipOverflowsRightEdge = tooltipWidth / 2 > rangeDisplayWidth - rangeDisplayPaddingLeft - currentRangeWidth;
|
|
26949
|
+
if (tooltipOverflowsLeftEdge) {
|
|
26950
|
+
this.tooltipShift = `${tooltipWidth - this.MIN_TOOLTIP_SHIFT}px`;
|
|
26951
|
+
}
|
|
26952
|
+
else if (tooltipOverflowsRightEdge) {
|
|
26953
|
+
this.tooltipShift = `${this.MIN_TOOLTIP_SHIFT}px`;
|
|
26954
|
+
}
|
|
26955
|
+
else {
|
|
26956
|
+
this.tooltipShift = this.DEFAULT_TOOLTIP_SHIFT;
|
|
26957
|
+
}
|
|
26958
|
+
}
|
|
26959
|
+
setupTooltipShiftingIfPossible() {
|
|
26960
|
+
if (this.config?.orientation === 'horizontal' &&
|
|
26961
|
+
!this.currentRangeWidthObserver &&
|
|
26962
|
+
this.rangeDisplay &&
|
|
26963
|
+
this.currentRangeElement) {
|
|
26964
|
+
this.setupTooltipShifting();
|
|
26965
|
+
}
|
|
26966
|
+
}
|
|
26967
|
+
getTooltipBackground() {
|
|
26968
|
+
const current = this.config.current;
|
|
26969
|
+
switch (true) {
|
|
26970
|
+
case this.isValueInRange(current, this.config.redRangeMin, this.config.redRangeMax):
|
|
26971
|
+
return '--c8y-palette-status-danger';
|
|
26972
|
+
case this.isValueInRange(current, this.config.yellowRangeMin, this.config.yellowRangeMax):
|
|
26973
|
+
return '--c8y-palette-status-warning';
|
|
26974
|
+
default:
|
|
26975
|
+
return '--c8y-palette-gray-30';
|
|
26976
|
+
}
|
|
26977
|
+
}
|
|
26978
|
+
isValueInRange(value, min, max) {
|
|
26979
|
+
return min != null && max != null && value >= min && value <= max;
|
|
26980
|
+
}
|
|
26892
26981
|
}
|
|
26893
26982
|
RangeDisplayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: RangeDisplayComponent, deps: [{ token: i1$4.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
26894
|
-
RangeDisplayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: RangeDisplayComponent, selector: "c8y-range-display", inputs: { config: "config", display: "display" }, host: { properties: { "attr.style": "this.inlineStyle" } }, ngImport: i0, template: "<div
|
|
26983
|
+
RangeDisplayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: RangeDisplayComponent, selector: "c8y-range-display", inputs: { config: "config", display: "display" }, host: { properties: { "attr.style": "this.inlineStyle" } }, viewQueries: [{ propertyName: "rangeDisplay", first: true, predicate: ["rangeDisplay"], descendants: true }, { propertyName: "currentRangeElement", first: true, predicate: ["currentRangeElement"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n [ngClass]=\"{\n 'range-display--vertical': config.orientation === 'vertical',\n 'range-display--compact': display === 'compact',\n 'range-display--inline': display === 'inline'\n }\"\n attr.data-label=\"{{ config.unit }}\"\n>\n <div\n class=\"range-display\"\n #rangeDisplay\n >\n <div class=\"range-display__range\">\n <div class=\"range-display__range__unit\">\n {{ config.unit }}\n </div>\n <div\n *ngIf=\"isYellowRangeDisplayed()\"\n class=\"range-display__range__min\"\n ></div>\n <div\n *ngIf=\"isRedRangeDisplayed()\"\n class=\"range-display__range__max\"\n ></div>\n <div\n *ngIf=\"checkTarget()\"\n class=\"range-display__range__target\"\n attr.data-label=\"{{ config.target }} {{ config.unit }}\"\n title=\"{{ 'Target' | translate }}: {{ config.target }} {{ config.unit }}\"\n ></div>\n <div\n [ngStyle]=\"{\n display:\n config.current != undefined &&\n config.current >= config.min &&\n config.current <= config.max\n ? 'block'\n : 'none'\n }\"\n #currentRangeElement\n class=\"range-display__range__current\"\n attr.data-label=\"{{ config.current }} {{ config.unit }} 
{{ config.time | c8yDate }}\"\n title=\"{{ 'Current' | translate }}: {{ config.current }} {{ config.unit }} | {{\n config.time | c8yDate\n }}\"\n ></div>\n </div>\n <div class=\"range-display__ruler\">\n <div\n *ngFor=\"let x of [].constructor(10); let index = index; trackBy: trackByIndex\"\n attr.data-label=\"{{ rulerCalc(index) }}\"\n class=\"range-display__tick\"\n ></div>\n <div\n attr.data-label=\"{{ config.max || 100 | number }}\"\n class=\"range-display__tick\"\n ></div>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i3.DecimalPipe, name: "number" }, { kind: "pipe", type: DatePipe, name: "c8yDate" }] });
|
|
26895
26984
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: RangeDisplayComponent, decorators: [{
|
|
26896
26985
|
type: Component,
|
|
26897
|
-
args: [{ selector: 'c8y-range-display', template: "<div
|
|
26986
|
+
args: [{ selector: 'c8y-range-display', template: "<div\n [ngClass]=\"{\n 'range-display--vertical': config.orientation === 'vertical',\n 'range-display--compact': display === 'compact',\n 'range-display--inline': display === 'inline'\n }\"\n attr.data-label=\"{{ config.unit }}\"\n>\n <div\n class=\"range-display\"\n #rangeDisplay\n >\n <div class=\"range-display__range\">\n <div class=\"range-display__range__unit\">\n {{ config.unit }}\n </div>\n <div\n *ngIf=\"isYellowRangeDisplayed()\"\n class=\"range-display__range__min\"\n ></div>\n <div\n *ngIf=\"isRedRangeDisplayed()\"\n class=\"range-display__range__max\"\n ></div>\n <div\n *ngIf=\"checkTarget()\"\n class=\"range-display__range__target\"\n attr.data-label=\"{{ config.target }} {{ config.unit }}\"\n title=\"{{ 'Target' | translate }}: {{ config.target }} {{ config.unit }}\"\n ></div>\n <div\n [ngStyle]=\"{\n display:\n config.current != undefined &&\n config.current >= config.min &&\n config.current <= config.max\n ? 'block'\n : 'none'\n }\"\n #currentRangeElement\n class=\"range-display__range__current\"\n attr.data-label=\"{{ config.current }} {{ config.unit }} 
{{ config.time | c8yDate }}\"\n title=\"{{ 'Current' | translate }}: {{ config.current }} {{ config.unit }} | {{\n config.time | c8yDate\n }}\"\n ></div>\n </div>\n <div class=\"range-display__ruler\">\n <div\n *ngFor=\"let x of [].constructor(10); let index = index; trackBy: trackByIndex\"\n attr.data-label=\"{{ rulerCalc(index) }}\"\n class=\"range-display__tick\"\n ></div>\n <div\n attr.data-label=\"{{ config.max || 100 | number }}\"\n class=\"range-display__tick\"\n ></div>\n </div>\n </div>\n</div>\n" }]
|
|
26898
26987
|
}], ctorParameters: function () { return [{ type: i1$4.DomSanitizer }]; }, propDecorators: { config: [{
|
|
26899
26988
|
type: Input
|
|
26900
26989
|
}], display: [{
|
|
@@ -26902,6 +26991,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
26902
26991
|
}], inlineStyle: [{
|
|
26903
26992
|
type: HostBinding,
|
|
26904
26993
|
args: ['attr.style']
|
|
26994
|
+
}], rangeDisplay: [{
|
|
26995
|
+
type: ViewChild,
|
|
26996
|
+
args: ['rangeDisplay', { static: false }]
|
|
26997
|
+
}], currentRangeElement: [{
|
|
26998
|
+
type: ViewChild,
|
|
26999
|
+
args: ['currentRangeElement', { static: false }]
|
|
26905
27000
|
}] } });
|
|
26906
27001
|
|
|
26907
27002
|
/**
|
|
@@ -28435,6 +28530,8 @@ class RealtimeSubjectService {
|
|
|
28435
28530
|
constructor(realtime) {
|
|
28436
28531
|
this.realtime = realtime;
|
|
28437
28532
|
this.subjects$ = new Map();
|
|
28533
|
+
this.reconnect$ = this.createObservableForReconnect().pipe(share());
|
|
28534
|
+
this.connectionStatus$ = this.createObservableForConnectionStatus().pipe(distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
28438
28535
|
}
|
|
28439
28536
|
getObservableForChannel(channel) {
|
|
28440
28537
|
if (this.subjects$.has(channel)) {
|
|
@@ -28447,7 +28544,7 @@ class RealtimeSubjectService {
|
|
|
28447
28544
|
}
|
|
28448
28545
|
createObservableForChannel(channel, realtime) {
|
|
28449
28546
|
return new Observable(observer => {
|
|
28450
|
-
|
|
28547
|
+
let realtimeSubscription = realtime.subscribe(channel, msg => {
|
|
28451
28548
|
const data = {
|
|
28452
28549
|
channel: msg.channel,
|
|
28453
28550
|
data: msg.data.data,
|
|
@@ -28456,13 +28553,54 @@ class RealtimeSubjectService {
|
|
|
28456
28553
|
};
|
|
28457
28554
|
observer.next(data);
|
|
28458
28555
|
});
|
|
28556
|
+
/**
|
|
28557
|
+
* In (rare) case of a re-handshake, resubscribe valid subscriptions.
|
|
28558
|
+
* @see https://docs.cometd.org/current/reference/#_javascript_subscribe_resubscribe
|
|
28559
|
+
*/
|
|
28560
|
+
const reconnectSubscription = this.reconnect$.subscribe(() => {
|
|
28561
|
+
try {
|
|
28562
|
+
realtimeSubscription = this.realtime.resubscribe(realtimeSubscription);
|
|
28563
|
+
}
|
|
28564
|
+
catch (e) {
|
|
28565
|
+
console.warn(`Failed to resubscribe to channel: "${channel}" after reconnect.`, e);
|
|
28566
|
+
observer.error(e);
|
|
28567
|
+
}
|
|
28568
|
+
});
|
|
28459
28569
|
return {
|
|
28460
|
-
unsubscribe() {
|
|
28570
|
+
unsubscribe: () => {
|
|
28571
|
+
reconnectSubscription.unsubscribe();
|
|
28461
28572
|
realtime.unsubscribe(realtimeSubscription);
|
|
28462
28573
|
}
|
|
28463
28574
|
};
|
|
28464
28575
|
});
|
|
28465
28576
|
}
|
|
28577
|
+
createObservableForReconnect() {
|
|
28578
|
+
return new Observable(observer => {
|
|
28579
|
+
const handle = this.realtime.addHandshakeListener(msg => {
|
|
28580
|
+
if (msg.successful && msg.reestablish) {
|
|
28581
|
+
observer.next();
|
|
28582
|
+
}
|
|
28583
|
+
});
|
|
28584
|
+
return {
|
|
28585
|
+
unsubscribe: () => {
|
|
28586
|
+
this.realtime.removeListener(handle);
|
|
28587
|
+
}
|
|
28588
|
+
};
|
|
28589
|
+
});
|
|
28590
|
+
}
|
|
28591
|
+
createObservableForConnectionStatus() {
|
|
28592
|
+
return new Observable(observer => {
|
|
28593
|
+
observer.next(!this.realtime.isDisconnected() ? 'connected' : 'disconnected');
|
|
28594
|
+
const handle = this.realtime.addConnectListener(msg => {
|
|
28595
|
+
observer.next(msg.successful ? 'connected' : 'disconnected');
|
|
28596
|
+
});
|
|
28597
|
+
return {
|
|
28598
|
+
unsubscribe: () => {
|
|
28599
|
+
this.realtime.removeListener(handle);
|
|
28600
|
+
}
|
|
28601
|
+
};
|
|
28602
|
+
});
|
|
28603
|
+
}
|
|
28466
28604
|
}
|
|
28467
28605
|
RealtimeSubjectService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: RealtimeSubjectService, deps: [{ token: i1$1.Realtime }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
28468
28606
|
RealtimeSubjectService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: RealtimeSubjectService, providedIn: 'root' });
|