@ship-ui/core 0.17.10 → 0.17.12
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.
|
@@ -570,7 +570,7 @@
|
|
|
570
570
|
"examples": [
|
|
571
571
|
{
|
|
572
572
|
"name": "toggle-card-disallowed",
|
|
573
|
-
"html": "<sh-toggle-card [disableToggle]=\"true\"
|
|
573
|
+
"html": "<sh-toggle-card [disableToggle]=\"true\">\n <ng-container title>Advanced options</ng-container>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>\n</sh-toggle-card>\n",
|
|
574
574
|
"ts": "import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { ShipToggleCard } from 'ship-ui';\n\n@Component({\n selector: 'app-toggle-card-disallowed-example',\n standalone: true,\n imports: [ShipToggleCard],\n templateUrl: './toggle-card-disallowed.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ToggleCardDisallowedExampleComponent {}\n"
|
|
575
575
|
},
|
|
576
576
|
{
|
|
@@ -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
|
},
|
|
@@ -1658,7 +1669,7 @@
|
|
|
1658
1669
|
"name": "isActive",
|
|
1659
1670
|
"type": "boolean",
|
|
1660
1671
|
"description": "",
|
|
1661
|
-
"defaultValue": "
|
|
1672
|
+
"defaultValue": ""
|
|
1662
1673
|
}
|
|
1663
1674
|
],
|
|
1664
1675
|
"outputs": [],
|
|
@@ -6452,8 +6452,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
6452
6452
|
|
|
6453
6453
|
class ShipToggleCard {
|
|
6454
6454
|
constructor() {
|
|
6455
|
-
this.isActive = model(false, ...(ngDevMode ? [{ debugName: "isActive" }] : []));
|
|
6456
6455
|
this.disableToggle = input(false, ...(ngDevMode ? [{ debugName: "disableToggle" }] : []));
|
|
6456
|
+
this.isActive = model(...(ngDevMode ? [undefined, { debugName: "isActive" }] : []));
|
|
6457
|
+
this.#disabledEffect = effect(() => {
|
|
6458
|
+
if (this.disableToggle()) {
|
|
6459
|
+
this.isActive.set(true);
|
|
6460
|
+
}
|
|
6461
|
+
}, ...(ngDevMode ? [{ debugName: "#disabledEffect" }] : []));
|
|
6457
6462
|
this.color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
6458
6463
|
this.variant = input(null, ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
6459
6464
|
this.hostClasses = shipComponentClasses('card', {
|
|
@@ -6461,11 +6466,12 @@ class ShipToggleCard {
|
|
|
6461
6466
|
variant: this.variant,
|
|
6462
6467
|
});
|
|
6463
6468
|
}
|
|
6469
|
+
#disabledEffect;
|
|
6464
6470
|
toggle() {
|
|
6465
6471
|
this.isActive.set(!this.isActive());
|
|
6466
6472
|
}
|
|
6467
6473
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ShipToggleCard, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6468
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: ShipToggleCard, isStandalone: true, selector: "sh-toggle-card", inputs: {
|
|
6474
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: ShipToggleCard, isStandalone: true, selector: "sh-toggle-card", inputs: { disableToggle: { classPropertyName: "disableToggle", publicName: "disableToggle", isSignal: true, isRequired: false, transformFunction: null }, isActive: { classPropertyName: "isActive", publicName: "isActive", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isActive: "isActiveChange" }, host: { properties: { "class.active": "isActive()", "class": "hostClasses()" } }, ngImport: i0, template: `
|
|
6469
6475
|
<h3 (click)="!disableToggle() && toggle()">
|
|
6470
6476
|
<ng-content select="[title]">Title</ng-content>
|
|
6471
6477
|
|
|
@@ -6507,7 +6513,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
6507
6513
|
'[class]': 'hostClasses()',
|
|
6508
6514
|
},
|
|
6509
6515
|
}]
|
|
6510
|
-
}], propDecorators: {
|
|
6516
|
+
}], propDecorators: { disableToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableToggle", required: false }] }], isActive: [{ type: i0.Input, args: [{ isSignal: true, alias: "isActive", required: false }] }, { type: i0.Output, args: ["isActiveChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }] } });
|
|
6511
6517
|
|
|
6512
6518
|
class ShipToggle {
|
|
6513
6519
|
constructor() {
|
|
@@ -6892,6 +6898,12 @@ class ShipTooltipWrapper {
|
|
|
6892
6898
|
this.positionAnchorName = input.required(...(ngDevMode ? [{ debugName: "positionAnchorName" }] : []));
|
|
6893
6899
|
this.anchorEl = input.required(...(ngDevMode ? [{ debugName: "anchorEl" }] : []));
|
|
6894
6900
|
this.isOpen = input(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
6901
|
+
this.content = input(...(ngDevMode ? [undefined, { debugName: "content" }] : []));
|
|
6902
|
+
this.close = input(() => { }, ...(ngDevMode ? [{ debugName: "close" }] : []));
|
|
6903
|
+
this.tooltipContext = {
|
|
6904
|
+
close: () => this.close()(),
|
|
6905
|
+
};
|
|
6906
|
+
this.isTemplate = computed(() => this.content() instanceof TemplateRef, ...(ngDevMode ? [{ debugName: "isTemplate" }] : []));
|
|
6895
6907
|
this.#selfRef = inject((ElementRef));
|
|
6896
6908
|
this.#renderer = inject(Renderer2);
|
|
6897
6909
|
this.#positionAbort = null;
|
|
@@ -6951,20 +6963,29 @@ class ShipTooltipWrapper {
|
|
|
6951
6963
|
this.#positionAbort?.abort();
|
|
6952
6964
|
}
|
|
6953
6965
|
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.
|
|
6966
|
+
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
6967
|
<div class="tooltip-content">
|
|
6956
|
-
|
|
6968
|
+
@if (isTemplate()) {
|
|
6969
|
+
<ng-container *ngTemplateOutlet="$any(content()); context: { $implicit: tooltipContext }" />
|
|
6970
|
+
} @else {
|
|
6971
|
+
{{ content() }}
|
|
6972
|
+
}
|
|
6957
6973
|
</div>
|
|
6958
|
-
`, isInline: true }); }
|
|
6974
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
6959
6975
|
}
|
|
6960
6976
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ShipTooltipWrapper, decorators: [{
|
|
6961
6977
|
type: Component,
|
|
6962
6978
|
args: [{
|
|
6963
6979
|
selector: 'ship-tooltip-wrapper',
|
|
6964
6980
|
standalone: true,
|
|
6981
|
+
imports: [NgTemplateOutlet],
|
|
6965
6982
|
template: `
|
|
6966
6983
|
<div class="tooltip-content">
|
|
6967
|
-
|
|
6984
|
+
@if (isTemplate()) {
|
|
6985
|
+
<ng-container *ngTemplateOutlet="$any(content()); context: { $implicit: tooltipContext }" />
|
|
6986
|
+
} @else {
|
|
6987
|
+
{{ content() }}
|
|
6988
|
+
}
|
|
6968
6989
|
</div>
|
|
6969
6990
|
`,
|
|
6970
6991
|
host: {
|
|
@@ -6974,17 +6995,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
6974
6995
|
'[class.below]': 'isBelow()',
|
|
6975
6996
|
},
|
|
6976
6997
|
}]
|
|
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 }] }] } });
|
|
6998
|
+
}], 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
6999
|
let openRef = null;
|
|
6979
7000
|
class ShipTooltip {
|
|
6980
7001
|
constructor() {
|
|
6981
7002
|
this.shTooltip = input.required(...(ngDevMode ? [{ debugName: "shTooltip" }] : []));
|
|
6982
7003
|
this.#contentReplacedEffect = effect(() => {
|
|
6983
|
-
this.shTooltip();
|
|
7004
|
+
const content = this.shTooltip();
|
|
6984
7005
|
untracked(() => {
|
|
6985
|
-
if (this.isOpen()) {
|
|
6986
|
-
|
|
6987
|
-
|
|
7006
|
+
if (this.isOpen() && openRef?.component === this && openRef?.wrapperComponentRef) {
|
|
7007
|
+
openRef.wrapperComponentRef.setInput('content', content);
|
|
7008
|
+
openRef.wrapperComponentRef.changeDetectorRef.detectChanges();
|
|
6988
7009
|
}
|
|
6989
7010
|
});
|
|
6990
7011
|
}, ...(ngDevMode ? [{ debugName: "#contentReplacedEffect" }] : []));
|
|
@@ -6992,7 +7013,6 @@ class ShipTooltip {
|
|
|
6992
7013
|
this.#viewContainerRef = inject(ViewContainerRef);
|
|
6993
7014
|
this.#environmentInjector = inject(EnvironmentInjector);
|
|
6994
7015
|
this.#renderer = inject(Renderer2);
|
|
6995
|
-
this.#projectedViewRef = null;
|
|
6996
7016
|
this.DEBOUNCE_DELAY = 500;
|
|
6997
7017
|
this.anchorName = `--${generateUniqueId()}`;
|
|
6998
7018
|
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
@@ -7002,7 +7022,6 @@ class ShipTooltip {
|
|
|
7002
7022
|
#viewContainerRef;
|
|
7003
7023
|
#environmentInjector;
|
|
7004
7024
|
#renderer;
|
|
7005
|
-
#projectedViewRef;
|
|
7006
7025
|
onMouseEnter() {
|
|
7007
7026
|
if (openRef?.component.anchorName !== this.anchorName) {
|
|
7008
7027
|
this.cleanupTooltip();
|
|
@@ -7030,31 +7049,23 @@ class ShipTooltip {
|
|
|
7030
7049
|
}
|
|
7031
7050
|
}
|
|
7032
7051
|
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 {
|
|
7052
|
+
if (openRef?.wrapperComponentRef || !this.shTooltip()) {
|
|
7053
|
+
if (openRef?.component === this && openRef?.wrapperComponentRef) {
|
|
7054
|
+
openRef.wrapperComponentRef.setInput('content', this.shTooltip());
|
|
7055
|
+
}
|
|
7046
7056
|
return;
|
|
7047
7057
|
}
|
|
7048
7058
|
openRef = {
|
|
7049
7059
|
wrapperComponentRef: this.#viewContainerRef.createComponent(ShipTooltipWrapper, {
|
|
7050
7060
|
environmentInjector: this.#environmentInjector,
|
|
7051
|
-
projectableNodes: nodesToProject,
|
|
7052
7061
|
}),
|
|
7053
7062
|
component: this,
|
|
7054
7063
|
};
|
|
7055
7064
|
openRef.wrapperComponentRef.setInput('positionAnchorName', this.anchorName);
|
|
7056
7065
|
openRef.wrapperComponentRef.setInput('anchorEl', this.#elementRef);
|
|
7057
|
-
openRef.wrapperComponentRef
|
|
7066
|
+
openRef.wrapperComponentRef.setInput('isOpen', this.isOpen);
|
|
7067
|
+
openRef.wrapperComponentRef.setInput('content', this.shTooltip());
|
|
7068
|
+
openRef.wrapperComponentRef.setInput('close', () => this.cleanupTooltip());
|
|
7058
7069
|
openRef.wrapperComponentRef.changeDetectorRef.detectChanges();
|
|
7059
7070
|
openRef.wrapperComponentRef.location.nativeElement.addEventListener('mouseenter', () => {
|
|
7060
7071
|
this.cancelCleanupTimer();
|
|
@@ -7073,10 +7084,6 @@ class ShipTooltip {
|
|
|
7073
7084
|
openRef.component.isOpen.set(false);
|
|
7074
7085
|
openRef = null;
|
|
7075
7086
|
}
|
|
7076
|
-
if (this.#projectedViewRef) {
|
|
7077
|
-
this.#projectedViewRef.destroy();
|
|
7078
|
-
this.#projectedViewRef = null;
|
|
7079
|
-
}
|
|
7080
7087
|
}
|
|
7081
7088
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ShipTooltip, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
7082
7089
|
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 }); }
|