@ship-ui/core 0.17.10 → 0.17.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.
|
@@ -1046,13 +1046,24 @@
|
|
|
1046
1046
|
"type": "boolean",
|
|
1047
1047
|
"description": "",
|
|
1048
1048
|
"defaultValue": "false"
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
"name": "content",
|
|
1052
|
+
"type": "string | TemplateRef<any> | null | undefined",
|
|
1053
|
+
"description": ""
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
"name": "close",
|
|
1057
|
+
"type": "() => void",
|
|
1058
|
+
"description": "",
|
|
1059
|
+
"defaultValue": "("
|
|
1049
1060
|
}
|
|
1050
1061
|
],
|
|
1051
1062
|
"outputs": [],
|
|
1052
1063
|
"methods": [
|
|
1053
1064
|
{
|
|
1054
1065
|
"name": "untracked",
|
|
1055
|
-
"parameters": "() => {\n if (this.isOpen()",
|
|
1066
|
+
"parameters": "() => {\n if (this.isOpen() && openRef?.component === this && openRef?.wrapperComponentRef",
|
|
1056
1067
|
"returnType": "any",
|
|
1057
1068
|
"description": ""
|
|
1058
1069
|
},
|
|
@@ -6892,6 +6892,12 @@ class ShipTooltipWrapper {
|
|
|
6892
6892
|
this.positionAnchorName = input.required(...(ngDevMode ? [{ debugName: "positionAnchorName" }] : []));
|
|
6893
6893
|
this.anchorEl = input.required(...(ngDevMode ? [{ debugName: "anchorEl" }] : []));
|
|
6894
6894
|
this.isOpen = input(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
6895
|
+
this.content = input(...(ngDevMode ? [undefined, { debugName: "content" }] : []));
|
|
6896
|
+
this.close = input(() => { }, ...(ngDevMode ? [{ debugName: "close" }] : []));
|
|
6897
|
+
this.tooltipContext = {
|
|
6898
|
+
close: () => this.close()(),
|
|
6899
|
+
};
|
|
6900
|
+
this.isTemplate = computed(() => this.content() instanceof TemplateRef, ...(ngDevMode ? [{ debugName: "isTemplate" }] : []));
|
|
6895
6901
|
this.#selfRef = inject((ElementRef));
|
|
6896
6902
|
this.#renderer = inject(Renderer2);
|
|
6897
6903
|
this.#positionAbort = null;
|
|
@@ -6951,20 +6957,29 @@ class ShipTooltipWrapper {
|
|
|
6951
6957
|
this.#positionAbort?.abort();
|
|
6952
6958
|
}
|
|
6953
6959
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ShipTooltipWrapper, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6954
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
6960
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: ShipTooltipWrapper, isStandalone: true, selector: "ship-tooltip-wrapper", inputs: { positionAnchorName: { classPropertyName: "positionAnchorName", publicName: "positionAnchorName", isSignal: true, isRequired: true, transformFunction: null }, anchorEl: { classPropertyName: "anchorEl", publicName: "anchorEl", isSignal: true, isRequired: true, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, close: { classPropertyName: "close", publicName: "close", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tooltip" }, properties: { "attr.popover": "\"manual\"", "style.position-anchor": "positionAnchorName()", "class.below": "isBelow()" } }, ngImport: i0, template: `
|
|
6955
6961
|
<div class="tooltip-content">
|
|
6956
|
-
|
|
6962
|
+
@if (isTemplate()) {
|
|
6963
|
+
<ng-container *ngTemplateOutlet="$any(content()); context: { $implicit: tooltipContext }" />
|
|
6964
|
+
} @else {
|
|
6965
|
+
{{ content() }}
|
|
6966
|
+
}
|
|
6957
6967
|
</div>
|
|
6958
|
-
`, isInline: true }); }
|
|
6968
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
6959
6969
|
}
|
|
6960
6970
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ShipTooltipWrapper, decorators: [{
|
|
6961
6971
|
type: Component,
|
|
6962
6972
|
args: [{
|
|
6963
6973
|
selector: 'ship-tooltip-wrapper',
|
|
6964
6974
|
standalone: true,
|
|
6975
|
+
imports: [NgTemplateOutlet],
|
|
6965
6976
|
template: `
|
|
6966
6977
|
<div class="tooltip-content">
|
|
6967
|
-
|
|
6978
|
+
@if (isTemplate()) {
|
|
6979
|
+
<ng-container *ngTemplateOutlet="$any(content()); context: { $implicit: tooltipContext }" />
|
|
6980
|
+
} @else {
|
|
6981
|
+
{{ content() }}
|
|
6982
|
+
}
|
|
6968
6983
|
</div>
|
|
6969
6984
|
`,
|
|
6970
6985
|
host: {
|
|
@@ -6974,17 +6989,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
6974
6989
|
'[class.below]': 'isBelow()',
|
|
6975
6990
|
},
|
|
6976
6991
|
}]
|
|
6977
|
-
}], propDecorators: { positionAnchorName: [{ type: i0.Input, args: [{ isSignal: true, alias: "positionAnchorName", required: true }] }], anchorEl: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorEl", required: true }] }], isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpen", required: false }] }] } });
|
|
6992
|
+
}], propDecorators: { positionAnchorName: [{ type: i0.Input, args: [{ isSignal: true, alias: "positionAnchorName", required: true }] }], anchorEl: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorEl", required: true }] }], isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpen", required: false }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], close: [{ type: i0.Input, args: [{ isSignal: true, alias: "close", required: false }] }] } });
|
|
6978
6993
|
let openRef = null;
|
|
6979
6994
|
class ShipTooltip {
|
|
6980
6995
|
constructor() {
|
|
6981
6996
|
this.shTooltip = input.required(...(ngDevMode ? [{ debugName: "shTooltip" }] : []));
|
|
6982
6997
|
this.#contentReplacedEffect = effect(() => {
|
|
6983
|
-
this.shTooltip();
|
|
6998
|
+
const content = this.shTooltip();
|
|
6984
6999
|
untracked(() => {
|
|
6985
|
-
if (this.isOpen()) {
|
|
6986
|
-
|
|
6987
|
-
|
|
7000
|
+
if (this.isOpen() && openRef?.component === this && openRef?.wrapperComponentRef) {
|
|
7001
|
+
openRef.wrapperComponentRef.setInput('content', content);
|
|
7002
|
+
openRef.wrapperComponentRef.changeDetectorRef.detectChanges();
|
|
6988
7003
|
}
|
|
6989
7004
|
});
|
|
6990
7005
|
}, ...(ngDevMode ? [{ debugName: "#contentReplacedEffect" }] : []));
|
|
@@ -6992,7 +7007,6 @@ class ShipTooltip {
|
|
|
6992
7007
|
this.#viewContainerRef = inject(ViewContainerRef);
|
|
6993
7008
|
this.#environmentInjector = inject(EnvironmentInjector);
|
|
6994
7009
|
this.#renderer = inject(Renderer2);
|
|
6995
|
-
this.#projectedViewRef = null;
|
|
6996
7010
|
this.DEBOUNCE_DELAY = 500;
|
|
6997
7011
|
this.anchorName = `--${generateUniqueId()}`;
|
|
6998
7012
|
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
@@ -7002,7 +7016,6 @@ class ShipTooltip {
|
|
|
7002
7016
|
#viewContainerRef;
|
|
7003
7017
|
#environmentInjector;
|
|
7004
7018
|
#renderer;
|
|
7005
|
-
#projectedViewRef;
|
|
7006
7019
|
onMouseEnter() {
|
|
7007
7020
|
if (openRef?.component.anchorName !== this.anchorName) {
|
|
7008
7021
|
this.cleanupTooltip();
|
|
@@ -7030,31 +7043,23 @@ class ShipTooltip {
|
|
|
7030
7043
|
}
|
|
7031
7044
|
}
|
|
7032
7045
|
showTooltip() {
|
|
7033
|
-
if (openRef?.wrapperComponentRef || !this.shTooltip())
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
if (typeof content === 'string') {
|
|
7038
|
-
nodesToProject = [[this.#renderer.createText(content)]];
|
|
7039
|
-
}
|
|
7040
|
-
else if (content instanceof TemplateRef) {
|
|
7041
|
-
this.#projectedViewRef = content.createEmbeddedView({});
|
|
7042
|
-
this.#projectedViewRef.detectChanges();
|
|
7043
|
-
nodesToProject = [this.#projectedViewRef.rootNodes];
|
|
7044
|
-
}
|
|
7045
|
-
else {
|
|
7046
|
+
if (openRef?.wrapperComponentRef || !this.shTooltip()) {
|
|
7047
|
+
if (openRef?.component === this && openRef?.wrapperComponentRef) {
|
|
7048
|
+
openRef.wrapperComponentRef.setInput('content', this.shTooltip());
|
|
7049
|
+
}
|
|
7046
7050
|
return;
|
|
7047
7051
|
}
|
|
7048
7052
|
openRef = {
|
|
7049
7053
|
wrapperComponentRef: this.#viewContainerRef.createComponent(ShipTooltipWrapper, {
|
|
7050
7054
|
environmentInjector: this.#environmentInjector,
|
|
7051
|
-
projectableNodes: nodesToProject,
|
|
7052
7055
|
}),
|
|
7053
7056
|
component: this,
|
|
7054
7057
|
};
|
|
7055
7058
|
openRef.wrapperComponentRef.setInput('positionAnchorName', this.anchorName);
|
|
7056
7059
|
openRef.wrapperComponentRef.setInput('anchorEl', this.#elementRef);
|
|
7057
|
-
openRef.wrapperComponentRef
|
|
7060
|
+
openRef.wrapperComponentRef.setInput('isOpen', this.isOpen);
|
|
7061
|
+
openRef.wrapperComponentRef.setInput('content', this.shTooltip());
|
|
7062
|
+
openRef.wrapperComponentRef.setInput('close', () => this.cleanupTooltip());
|
|
7058
7063
|
openRef.wrapperComponentRef.changeDetectorRef.detectChanges();
|
|
7059
7064
|
openRef.wrapperComponentRef.location.nativeElement.addEventListener('mouseenter', () => {
|
|
7060
7065
|
this.cancelCleanupTimer();
|
|
@@ -7073,10 +7078,6 @@ class ShipTooltip {
|
|
|
7073
7078
|
openRef.component.isOpen.set(false);
|
|
7074
7079
|
openRef = null;
|
|
7075
7080
|
}
|
|
7076
|
-
if (this.#projectedViewRef) {
|
|
7077
|
-
this.#projectedViewRef.destroy();
|
|
7078
|
-
this.#projectedViewRef = null;
|
|
7079
|
-
}
|
|
7080
7081
|
}
|
|
7081
7082
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ShipTooltip, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
7082
7083
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: ShipTooltip, isStandalone: true, selector: "[shTooltip]", inputs: { shTooltip: { classPropertyName: "shTooltip", publicName: "shTooltip", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" }, properties: { "style.anchor-name": "anchorName", "class.active": "isOpen()" }, classAttribute: "tooltip" }, ngImport: i0 }); }
|