@ibragim-dev-org/ui-forge-library 1.2.1 → 1.2.3
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.
|
@@ -740,6 +740,8 @@ class UiAccordionComponent {
|
|
|
740
740
|
$transition = computed(() => `all ${this.$durationMs()}ms linear`, ...(ngDevMode ? [{ debugName: "$transition" }] : []));
|
|
741
741
|
$overflow = signal('hidden', ...(ngDevMode ? [{ debugName: "$overflow" }] : []));
|
|
742
742
|
$content = viewChild('container', ...(ngDevMode ? [{ debugName: "$content" }] : []));
|
|
743
|
+
$button = viewChild('buttonContainer', ...(ngDevMode ? [{ debugName: "$button" }] : []));
|
|
744
|
+
$hasButtonContent = signal(false, ...(ngDevMode ? [{ debugName: "$hasButtonContent" }] : []));
|
|
743
745
|
resizeDebounceTimer = new Subscription();
|
|
744
746
|
constructor(destroyRef, platformId) {
|
|
745
747
|
this.destroyRef = destroyRef;
|
|
@@ -755,7 +757,20 @@ class UiAccordionComponent {
|
|
|
755
757
|
});
|
|
756
758
|
}
|
|
757
759
|
ngAfterViewInit() {
|
|
760
|
+
this.setButtonContentState();
|
|
758
761
|
this.setSize();
|
|
762
|
+
const button = this.$button();
|
|
763
|
+
if (button && isPlatformBrowser(this.platformId)) {
|
|
764
|
+
const mutationObserver = new MutationObserver(() => {
|
|
765
|
+
this.setButtonContentState();
|
|
766
|
+
});
|
|
767
|
+
mutationObserver.observe(button.nativeElement, {
|
|
768
|
+
childList: true,
|
|
769
|
+
subtree: true,
|
|
770
|
+
characterData: true,
|
|
771
|
+
});
|
|
772
|
+
this.destroyRef.onDestroy(() => mutationObserver.disconnect());
|
|
773
|
+
}
|
|
759
774
|
const content = this.$content();
|
|
760
775
|
if (content && isPlatformBrowser(this.platformId)) {
|
|
761
776
|
const resizeObserver = new ResizeObserver(() => {
|
|
@@ -768,6 +783,23 @@ class UiAccordionComponent {
|
|
|
768
783
|
this.destroyRef.onDestroy(() => resizeObserver.disconnect());
|
|
769
784
|
}
|
|
770
785
|
}
|
|
786
|
+
setButtonContentState() {
|
|
787
|
+
const button = this.$button();
|
|
788
|
+
if (!button) {
|
|
789
|
+
this.$hasButtonContent.set(false);
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
const hasContent = Array.from(button.nativeElement.childNodes).some((node) => {
|
|
793
|
+
if (node.nodeType === 1) {
|
|
794
|
+
return true;
|
|
795
|
+
}
|
|
796
|
+
if (node.nodeType === 3) {
|
|
797
|
+
return Boolean(node.textContent?.trim());
|
|
798
|
+
}
|
|
799
|
+
return false;
|
|
800
|
+
});
|
|
801
|
+
this.$hasButtonContent.set(hasContent);
|
|
802
|
+
}
|
|
771
803
|
setSize() {
|
|
772
804
|
const content = this.$content();
|
|
773
805
|
if (content) {
|
|
@@ -776,15 +808,15 @@ class UiAccordionComponent {
|
|
|
776
808
|
}
|
|
777
809
|
}
|
|
778
810
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAccordionComponent, deps: [{ token: i0.DestroyRef }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
779
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.1", type: UiAccordionComponent, isStandalone: true, selector: "app-ui-accordion", inputs: { $isOpen: { classPropertyName: "$isOpen", publicName: "$isOpen", isSignal: true, isRequired: false, transformFunction: null }, $durationMs: { classPropertyName: "$durationMs", publicName: "$durationMs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { $isOpen: "$isOpenChange" }, viewQueries: [{ propertyName: "$content", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: "<button
|
|
811
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.1", type: UiAccordionComponent, isStandalone: true, selector: "app-ui-accordion", inputs: { $isOpen: { classPropertyName: "$isOpen", publicName: "$isOpen", isSignal: true, isRequired: false, transformFunction: null }, $durationMs: { classPropertyName: "$durationMs", publicName: "$durationMs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { $isOpen: "$isOpenChange" }, viewQueries: [{ propertyName: "$content", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "$button", first: true, predicate: ["buttonContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<button\r\n #buttonContainer\r\n class=\"button\"\r\n type=\"button\"\r\n [style.display]=\"$hasButtonContent() ? null : 'none'\"\r\n (click)=\"$isOpen.set(!$isOpen())\"\r\n>\r\n <ng-content select=\"[button]\"></ng-content>\r\n</button>\r\n\r\n<div\r\n class=\"content\"\r\n [ngStyle]=\"{\r\n maxHeight: $isOpen() ? $contentHeight() : 0 + 'px',\r\n transition: $transition(),\r\n overflow: $overflow(),\r\n }\"\r\n>\r\n <div #container>\r\n <ng-content select=\"[content]\"></ng-content>\r\n </div>\r\n</div>\r\n", styles: [":host{display:block;width:100%}.button{width:100%;cursor:pointer}.content{width:100%;overflow:hidden;max-height:auto}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
780
812
|
}
|
|
781
813
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAccordionComponent, decorators: [{
|
|
782
814
|
type: Component,
|
|
783
|
-
args: [{ selector: 'app-ui-accordion', standalone: true, imports: [NgStyle], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button
|
|
815
|
+
args: [{ selector: 'app-ui-accordion', standalone: true, imports: [NgStyle], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\r\n #buttonContainer\r\n class=\"button\"\r\n type=\"button\"\r\n [style.display]=\"$hasButtonContent() ? null : 'none'\"\r\n (click)=\"$isOpen.set(!$isOpen())\"\r\n>\r\n <ng-content select=\"[button]\"></ng-content>\r\n</button>\r\n\r\n<div\r\n class=\"content\"\r\n [ngStyle]=\"{\r\n maxHeight: $isOpen() ? $contentHeight() : 0 + 'px',\r\n transition: $transition(),\r\n overflow: $overflow(),\r\n }\"\r\n>\r\n <div #container>\r\n <ng-content select=\"[content]\"></ng-content>\r\n </div>\r\n</div>\r\n", styles: [":host{display:block;width:100%}.button{width:100%;cursor:pointer}.content{width:100%;overflow:hidden;max-height:auto}\n"] }]
|
|
784
816
|
}], ctorParameters: () => [{ type: i0.DestroyRef }, { type: undefined, decorators: [{
|
|
785
817
|
type: Inject,
|
|
786
818
|
args: [PLATFORM_ID]
|
|
787
|
-
}] }], propDecorators: { $isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "$isOpen", required: false }] }, { type: i0.Output, args: ["$isOpenChange"] }], $durationMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "$durationMs", required: false }] }], $content: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }] } });
|
|
819
|
+
}] }], propDecorators: { $isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "$isOpen", required: false }] }, { type: i0.Output, args: ["$isOpenChange"] }], $durationMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "$durationMs", required: false }] }], $content: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }], $button: [{ type: i0.ViewChild, args: ['buttonContainer', { isSignal: true }] }] } });
|
|
788
820
|
|
|
789
821
|
var AlertType;
|
|
790
822
|
(function (AlertType) {
|
|
@@ -1388,6 +1420,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
1388
1420
|
class UiPopupInstance {
|
|
1389
1421
|
overlayRef;
|
|
1390
1422
|
destroyRef;
|
|
1423
|
+
onClose;
|
|
1391
1424
|
id = '';
|
|
1392
1425
|
width = 0;
|
|
1393
1426
|
animationOrigin$ = new BehaviorSubject('center');
|
|
@@ -1399,7 +1432,8 @@ class UiPopupInstance {
|
|
|
1399
1432
|
};
|
|
1400
1433
|
closed = new Subject();
|
|
1401
1434
|
shouldClose = new Subject();
|
|
1402
|
-
|
|
1435
|
+
isClosing = false;
|
|
1436
|
+
constructor(overlayRef, destroyRef, onClose = () => { }, options = {
|
|
1403
1437
|
positionX: 0,
|
|
1404
1438
|
positionY: 0,
|
|
1405
1439
|
startTransition: 'scale(0.8)',
|
|
@@ -1407,6 +1441,7 @@ class UiPopupInstance {
|
|
|
1407
1441
|
}) {
|
|
1408
1442
|
this.overlayRef = overlayRef;
|
|
1409
1443
|
this.destroyRef = destroyRef;
|
|
1444
|
+
this.onClose = onClose;
|
|
1410
1445
|
this.options = options;
|
|
1411
1446
|
this.overlayRef
|
|
1412
1447
|
.detachments()
|
|
@@ -1418,6 +1453,11 @@ class UiPopupInstance {
|
|
|
1418
1453
|
});
|
|
1419
1454
|
}
|
|
1420
1455
|
close() {
|
|
1456
|
+
if (this.isClosing) {
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
this.isClosing = true;
|
|
1460
|
+
this.onClose();
|
|
1421
1461
|
this.shouldClose.next();
|
|
1422
1462
|
this.shouldClose.complete();
|
|
1423
1463
|
}
|
|
@@ -1545,7 +1585,7 @@ class UiPopupService {
|
|
|
1545
1585
|
*/
|
|
1546
1586
|
createPopup(overlayRef, component, options, id, parameters) {
|
|
1547
1587
|
const newParameters = this.fetchPopupParameters(parameters);
|
|
1548
|
-
const uiPopupInstance = new UiPopupInstance(overlayRef, this.destroyRef, newParameters.animationOptions);
|
|
1588
|
+
const uiPopupInstance = new UiPopupInstance(overlayRef, this.destroyRef, options.onClose, newParameters.animationOptions);
|
|
1549
1589
|
if (newParameters.width > 0) {
|
|
1550
1590
|
uiPopupInstance.width = newParameters.width;
|
|
1551
1591
|
}
|
|
@@ -3014,15 +3054,15 @@ class UIInputDateDirective extends UiInputDirective {
|
|
|
3014
3054
|
const end = inputElement.selectionEnd;
|
|
3015
3055
|
const oldValue = value;
|
|
3016
3056
|
const newValue = this.maskDate(oldValue);
|
|
3017
|
-
const
|
|
3018
|
-
const
|
|
3019
|
-
const
|
|
3020
|
-
const
|
|
3021
|
-
const
|
|
3022
|
-
const
|
|
3057
|
+
const pattern = this.$dividePattern();
|
|
3058
|
+
const escapedPattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
3059
|
+
const patternRegex = new RegExp(escapedPattern, 'g');
|
|
3060
|
+
const oldPatternCount = (oldValue.match(patternRegex) || []).length;
|
|
3061
|
+
const newPatternCount = (newValue.match(patternRegex) || []).length;
|
|
3062
|
+
const patternAdded = newPatternCount > oldPatternCount;
|
|
3023
3063
|
super.onInput(newValue);
|
|
3024
3064
|
inputElement.value = newValue;
|
|
3025
|
-
if (
|
|
3065
|
+
if (patternAdded) {
|
|
3026
3066
|
inputElement.setSelectionRange(newValue.length, newValue.length);
|
|
3027
3067
|
}
|
|
3028
3068
|
else {
|
|
@@ -3035,15 +3075,16 @@ class UIInputDateDirective extends UiInputDirective {
|
|
|
3035
3075
|
const limit = this.$isRangeSelection() ? 16 : 8;
|
|
3036
3076
|
const limited = digits.substring(0, limit);
|
|
3037
3077
|
const formatSingle = (str) => {
|
|
3078
|
+
const pattern = this.$dividePattern();
|
|
3038
3079
|
let res = '';
|
|
3039
3080
|
if (str.length > 0) {
|
|
3040
3081
|
res += str.substring(0, 2);
|
|
3041
3082
|
}
|
|
3042
3083
|
if (str.length >= 3) {
|
|
3043
|
-
res +=
|
|
3084
|
+
res += pattern + str.substring(2, 4);
|
|
3044
3085
|
}
|
|
3045
3086
|
if (str.length >= 5) {
|
|
3046
|
-
res +=
|
|
3087
|
+
res += pattern + str.substring(4, 8);
|
|
3047
3088
|
}
|
|
3048
3089
|
return res;
|
|
3049
3090
|
};
|