@ship-ui/core 0.14.11 → 0.14.14
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/fesm2022/ship-ui-core.mjs +30 -19
- package/fesm2022/ship-ui-core.mjs.map +1 -1
- package/index.d.ts +3 -1
- package/package.json +1 -1
- package/styles/components/ship-datepicker.component.scss +1 -0
- package/styles/components/ship-tooltip.component.scss +6 -10
- package/styles/core/core/loader.scss +0 -25
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, Renderer2, ChangeDetectionStrategy, Component, signal, DestroyRef, InjectionToken, input, computed, viewChild, effect, HostListener, NgModule, Injectable, model, output, ApplicationRef, createComponent, isSignal, OutputEmitterRef, contentChildren, afterNextRender, assertInInjectionContext, Injector, HostBinding,
|
|
2
|
+
import { inject, ElementRef, Renderer2, ChangeDetectionStrategy, Component, signal, DestroyRef, InjectionToken, input, computed, viewChild, effect, HostListener, NgModule, Injectable, model, output, ApplicationRef, createComponent, isSignal, OutputEmitterRef, contentChild, contentChildren, afterNextRender, assertInInjectionContext, Injector, HostBinding, TemplateRef, runInInjectionContext, Directive, ChangeDetectorRef, viewChildren, ViewContainerRef, EnvironmentInjector } from '@angular/core';
|
|
3
3
|
import { DatePipe, NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { NgModel } from '@angular/forms';
|
|
4
5
|
import { SIGNAL } from '@angular/core/primitives/signals';
|
|
5
6
|
|
|
6
7
|
const iconTypes = ['bold', 'thin', 'light', 'fill', 'duotone'];
|
|
@@ -1315,6 +1316,8 @@ function contentProjectionSignal(hostElement, querySelector) {
|
|
|
1315
1316
|
}
|
|
1316
1317
|
projectedElementsSignal.set(elements);
|
|
1317
1318
|
};
|
|
1319
|
+
if (typeof MutationObserver === 'undefined')
|
|
1320
|
+
return projectedElementsSignal.asReadonly();
|
|
1318
1321
|
const observer = new MutationObserver((mutations) => {
|
|
1319
1322
|
// Only update if child nodes have been added or removed.
|
|
1320
1323
|
const hasChildListChanges = mutations.some((mutation) => mutation.type === 'childList');
|
|
@@ -1663,6 +1666,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
1663
1666
|
class ShipDatepickerInputComponent {
|
|
1664
1667
|
constructor() {
|
|
1665
1668
|
this.#INIT_DATE = this.#getUTCDate(new Date());
|
|
1669
|
+
this.ngModels = contentChild(NgModel, ...(ngDevMode ? [{ debugName: "ngModels" }] : []));
|
|
1666
1670
|
this.#datePipe = inject(DatePipe);
|
|
1667
1671
|
this.#elementRef = inject((ElementRef));
|
|
1668
1672
|
this.#inputRef = signal(null, ...(ngDevMode ? [{ debugName: "#inputRef" }] : []));
|
|
@@ -1712,7 +1716,8 @@ class ShipDatepickerInputComponent {
|
|
|
1712
1716
|
this.internalDate.set(date);
|
|
1713
1717
|
const input = this.#inputRef();
|
|
1714
1718
|
if (input) {
|
|
1715
|
-
input.value = date ? date.
|
|
1719
|
+
input.value = date ? date.toString() : '';
|
|
1720
|
+
input.dispatchEvent(new Event('input'));
|
|
1716
1721
|
}
|
|
1717
1722
|
}
|
|
1718
1723
|
open($event) {
|
|
@@ -1752,7 +1757,7 @@ class ShipDatepickerInputComponent {
|
|
|
1752
1757
|
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()) + timeDiffMillis);
|
|
1753
1758
|
}
|
|
1754
1759
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipDatepickerInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1755
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: ShipDatepickerInputComponent, isStandalone: true, selector: "sh-datepicker-input", inputs: { masking: { classPropertyName: "masking", publicName: "masking", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", isOpen: "isOpenChange" }, providers: [DatePipe], ngImport: i0, template: `
|
|
1760
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: ShipDatepickerInputComponent, isStandalone: true, selector: "sh-datepicker-input", inputs: { masking: { classPropertyName: "masking", publicName: "masking", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", isOpen: "isOpenChange" }, providers: [DatePipe], queries: [{ propertyName: "ngModels", first: true, predicate: NgModel, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1756
1761
|
<sh-form-field-popover (click)="open($event)" (closed)="close()" [(isOpen)]="isOpen">
|
|
1757
1762
|
<ng-content select="label" ngProjectAs="label" />
|
|
1758
1763
|
|
|
@@ -5533,6 +5538,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
5533
5538
|
},
|
|
5534
5539
|
}]
|
|
5535
5540
|
}], ctorParameters: () => [] });
|
|
5541
|
+
let openRef = null;
|
|
5536
5542
|
class ShipTooltipDirective {
|
|
5537
5543
|
constructor() {
|
|
5538
5544
|
this.shTooltip = input.required(...(ngDevMode ? [{ debugName: "shTooltip" }] : []));
|
|
@@ -5540,7 +5546,6 @@ class ShipTooltipDirective {
|
|
|
5540
5546
|
this.#viewContainerRef = inject(ViewContainerRef);
|
|
5541
5547
|
this.#environmentInjector = inject(EnvironmentInjector);
|
|
5542
5548
|
this.#renderer = inject(Renderer2);
|
|
5543
|
-
this.#wrapperComponentRef = null;
|
|
5544
5549
|
this.#projectedViewRef = null;
|
|
5545
5550
|
this.anchorName = `--${generateUniqueId()}`;
|
|
5546
5551
|
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
@@ -5549,19 +5554,19 @@ class ShipTooltipDirective {
|
|
|
5549
5554
|
#viewContainerRef;
|
|
5550
5555
|
#environmentInjector;
|
|
5551
5556
|
#renderer;
|
|
5552
|
-
#wrapperComponentRef;
|
|
5553
5557
|
#projectedViewRef;
|
|
5554
5558
|
onMouseEnter() {
|
|
5555
|
-
this
|
|
5559
|
+
if (openRef?.component !== this) {
|
|
5560
|
+
this.cleanupTooltip();
|
|
5561
|
+
}
|
|
5556
5562
|
queueMicrotask(() => this.showTooltip());
|
|
5557
5563
|
}
|
|
5558
5564
|
ngOnDestroy() {
|
|
5559
5565
|
this.cleanupTooltip();
|
|
5560
5566
|
}
|
|
5561
5567
|
showTooltip() {
|
|
5562
|
-
if (
|
|
5568
|
+
if (openRef?.wrapperComponentRef || !this.shTooltip())
|
|
5563
5569
|
return;
|
|
5564
|
-
this.isOpen.set(true);
|
|
5565
5570
|
let nodesToProject;
|
|
5566
5571
|
const content = this.shTooltip();
|
|
5567
5572
|
if (typeof content === 'string') {
|
|
@@ -5575,20 +5580,26 @@ class ShipTooltipDirective {
|
|
|
5575
5580
|
else {
|
|
5576
5581
|
return;
|
|
5577
5582
|
}
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5583
|
+
openRef = {
|
|
5584
|
+
wrapperComponentRef: this.#viewContainerRef.createComponent(ShipTooltipWrapper, {
|
|
5585
|
+
environmentInjector: this.#environmentInjector,
|
|
5586
|
+
projectableNodes: nodesToProject,
|
|
5587
|
+
}),
|
|
5588
|
+
component: this,
|
|
5589
|
+
};
|
|
5590
|
+
openRef.wrapperComponentRef.setInput('positionAnchorName', this.anchorName);
|
|
5591
|
+
openRef.wrapperComponentRef.setInput('anchorEl', this.#elementRef);
|
|
5592
|
+
openRef.wrapperComponentRef?.setInput('isOpen', this.isOpen);
|
|
5593
|
+
openRef.wrapperComponentRef.changeDetectorRef.detectChanges();
|
|
5594
|
+
setTimeout(() => {
|
|
5595
|
+
this.isOpen.set(true);
|
|
5581
5596
|
});
|
|
5582
|
-
this.#wrapperComponentRef.setInput('positionAnchorName', this.anchorName);
|
|
5583
|
-
this.#wrapperComponentRef.setInput('anchorEl', this.#elementRef);
|
|
5584
|
-
this.#wrapperComponentRef.setInput('isOpen', this.isOpen);
|
|
5585
|
-
this.#wrapperComponentRef.changeDetectorRef.detectChanges();
|
|
5586
5597
|
}
|
|
5587
5598
|
cleanupTooltip() {
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5599
|
+
if (openRef?.wrapperComponentRef) {
|
|
5600
|
+
openRef.wrapperComponentRef.destroy();
|
|
5601
|
+
openRef.component.isOpen.set(false);
|
|
5602
|
+
openRef = null;
|
|
5592
5603
|
}
|
|
5593
5604
|
if (this.#projectedViewRef) {
|
|
5594
5605
|
this.#projectedViewRef.destroy();
|