codexly-ui 0.1.11 → 0.1.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.
package/fesm2022/codexly-ui.mjs
CHANGED
|
@@ -4517,11 +4517,18 @@ class ClxSelectComponent {
|
|
|
4517
4517
|
_activeColor = computed(() => this.activeColor() ?? this._themeSvc.config().primaryColor, ...(ngDevMode ? [{ debugName: "_activeColor" }] : /* istanbul ignore next */ []));
|
|
4518
4518
|
_el = inject((ElementRef));
|
|
4519
4519
|
_sso = inject(ScrollStrategyOptions);
|
|
4520
|
+
_isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
4521
|
+
_loadedFonts = new Set();
|
|
4520
4522
|
_scrollStrategy = this._sso.reposition();
|
|
4521
4523
|
constructor() {
|
|
4522
4524
|
this._searchQuery = toSignal(this._searchControl.valueChanges.pipe(startWith(''), map(v => v ?? '')), { initialValue: '' });
|
|
4523
4525
|
if (this._ngControl)
|
|
4524
4526
|
this._ngControl.valueAccessor = this;
|
|
4527
|
+
effect(() => {
|
|
4528
|
+
const family = this._displayFontFamily();
|
|
4529
|
+
if (family)
|
|
4530
|
+
this._loadPreviewFont(family);
|
|
4531
|
+
});
|
|
4525
4532
|
// Async autocomplete: debounce + switchMap sobre el search control
|
|
4526
4533
|
this._searchControl.valueChanges.pipe(debounceTime(this.debounceMs()), distinctUntilChanged(), switchMap(query => {
|
|
4527
4534
|
const q = query ?? '';
|
|
@@ -4569,6 +4576,10 @@ class ClxSelectComponent {
|
|
|
4569
4576
|
const sel = this._selectedOptions();
|
|
4570
4577
|
return sel.length ? sel[0].label : this.placeholder();
|
|
4571
4578
|
}, ...(ngDevMode ? [{ debugName: "_displayValue" }] : /* istanbul ignore next */ []));
|
|
4579
|
+
_displayFontFamily = computed(() => {
|
|
4580
|
+
const sel = this._selectedOptions();
|
|
4581
|
+
return sel.length ? sel[0].previewFontFamily ?? null : null;
|
|
4582
|
+
}, ...(ngDevMode ? [{ debugName: "_displayFontFamily" }] : /* istanbul ignore next */ []));
|
|
4572
4583
|
_overlayWidth = computed(() => this._overlayWidthPx(), ...(ngDevMode ? [{ debugName: "_overlayWidth" }] : /* istanbul ignore next */ []));
|
|
4573
4584
|
_labelClass = computed(() => `${this._sizeConfig().label} ${CLX_TEXT_LABEL} leading-none`, ...(ngDevMode ? [{ debugName: "_labelClass" }] : /* istanbul ignore next */ []));
|
|
4574
4585
|
_hintClass = computed(() => `${this._sizeConfig().hint} ${CLX_TEXT_HINT}`, ...(ngDevMode ? [{ debugName: "_hintClass" }] : /* istanbul ignore next */ []));
|
|
@@ -4619,6 +4630,26 @@ class ClxSelectComponent {
|
|
|
4619
4630
|
if (!this.async())
|
|
4620
4631
|
this._searchControl.setValue('', { emitEvent: false });
|
|
4621
4632
|
this._isOpen.set(true);
|
|
4633
|
+
for (const opt of this.options()) {
|
|
4634
|
+
if (opt.previewFontFamily)
|
|
4635
|
+
this._loadPreviewFont(opt.previewFontFamily);
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
_loadPreviewFont(family) {
|
|
4639
|
+
if (!this._isBrowser || this._loadedFonts.has(family))
|
|
4640
|
+
return;
|
|
4641
|
+
const option = CLX_FONT_CATALOG.find(f => f.value === family);
|
|
4642
|
+
if (!option)
|
|
4643
|
+
return;
|
|
4644
|
+
this._loadedFonts.add(family);
|
|
4645
|
+
const id = `clx-preview-font-${family.replace(/\s+/g, '-').toLowerCase()}`;
|
|
4646
|
+
if (document.getElementById(id))
|
|
4647
|
+
return;
|
|
4648
|
+
const link = document.createElement('link');
|
|
4649
|
+
link.id = id;
|
|
4650
|
+
link.rel = 'stylesheet';
|
|
4651
|
+
link.href = option.googleUrl;
|
|
4652
|
+
document.head.appendChild(link);
|
|
4622
4653
|
}
|
|
4623
4654
|
_closePanel() {
|
|
4624
4655
|
this._isOpen.set(false);
|
|
@@ -4728,7 +4759,7 @@ class ClxSelectComponent {
|
|
|
4728
4759
|
|
|
4729
4760
|
<!-- Single mode: display value -->
|
|
4730
4761
|
} @else {
|
|
4731
|
-
<span [class]="_singleDisplayClass()">{{ _displayValue() }}</span>
|
|
4762
|
+
<span [class]="_singleDisplayClass()" [style.font-family]="_displayFontFamily()">{{ _displayValue() }}</span>
|
|
4732
4763
|
}
|
|
4733
4764
|
|
|
4734
4765
|
<!-- Right controls: clear + chevron -->
|
|
@@ -4808,7 +4839,7 @@ class ClxSelectComponent {
|
|
|
4808
4839
|
[disabled]="opt.disabled ?? false"
|
|
4809
4840
|
(mousedown)="$event.preventDefault()"
|
|
4810
4841
|
(click)="_selectOption(opt)">
|
|
4811
|
-
<span class="flex-1 text-left truncate">{{ opt.label }}</span>
|
|
4842
|
+
<span class="flex-1 text-left truncate" [style.font-family]="opt.previewFontFamily ?? null">{{ opt.label }}</span>
|
|
4812
4843
|
@if (_isSelected(opt.value)) {
|
|
4813
4844
|
<span clx-icon name="check" size="xs" class="shrink-0"></span>
|
|
4814
4845
|
}
|
|
@@ -4875,7 +4906,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
|
|
|
4875
4906
|
|
|
4876
4907
|
<!-- Single mode: display value -->
|
|
4877
4908
|
} @else {
|
|
4878
|
-
<span [class]="_singleDisplayClass()">{{ _displayValue() }}</span>
|
|
4909
|
+
<span [class]="_singleDisplayClass()" [style.font-family]="_displayFontFamily()">{{ _displayValue() }}</span>
|
|
4879
4910
|
}
|
|
4880
4911
|
|
|
4881
4912
|
<!-- Right controls: clear + chevron -->
|
|
@@ -4955,7 +4986,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
|
|
|
4955
4986
|
[disabled]="opt.disabled ?? false"
|
|
4956
4987
|
(mousedown)="$event.preventDefault()"
|
|
4957
4988
|
(click)="_selectOption(opt)">
|
|
4958
|
-
<span class="flex-1 text-left truncate">{{ opt.label }}</span>
|
|
4989
|
+
<span class="flex-1 text-left truncate" [style.font-family]="opt.previewFontFamily ?? null">{{ opt.label }}</span>
|
|
4959
4990
|
@if (_isSelected(opt.value)) {
|
|
4960
4991
|
<span clx-icon name="check" size="xs" class="shrink-0"></span>
|
|
4961
4992
|
}
|