@shival99/z-ui 1.2.33 → 1.2.34
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.
|
@@ -20,6 +20,7 @@ import { ZSafeHtmlPipe } from '@shival99/z-ui/pipes';
|
|
|
20
20
|
import { ZTranslateService, ZCacheService } from '@shival99/z-ui/services';
|
|
21
21
|
import { createAngularTable, getFacetedMinMaxValues, getFacetedUniqueValues, getFacetedRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, getExpandedRowModel, getCoreRowModel, FlexRenderDirective } from '@tanstack/angular-table';
|
|
22
22
|
import { NgScrollbar } from 'ngx-scrollbar';
|
|
23
|
+
import { effectOnceIf } from 'ngxtension/effect-once-if';
|
|
23
24
|
import { explicitEffect } from 'ngxtension/explicit-effect';
|
|
24
25
|
import { injectDestroy } from 'ngxtension/inject-destroy';
|
|
25
26
|
import { ZDropdownMenuComponent } from '@shival99/z-ui/components/z-dropdown-menu';
|
|
@@ -3056,13 +3057,35 @@ class ZTableComponent {
|
|
|
3056
3057
|
explicitEffect([this._zTranslate.currentLang], () => {
|
|
3057
3058
|
this._dataForceUpdate.update(v => v + 1);
|
|
3058
3059
|
});
|
|
3059
|
-
|
|
3060
|
-
|
|
3060
|
+
// Use effectOnceIf to load config cache at the right time
|
|
3061
|
+
// For 'local' mode: load immediately when key and columns are available
|
|
3062
|
+
// For 'server' mode: load when zLoading transitions from true to false (first time)
|
|
3063
|
+
effectOnceIf(computed(() => {
|
|
3064
|
+
const key = this.zKey();
|
|
3065
|
+
const config = this.zConfig();
|
|
3066
|
+
const loading = this.zLoading();
|
|
3067
|
+
const hasValidColumns = config.columns && config.columns.length > 0;
|
|
3068
|
+
const isServerMode = config.mode === 'server';
|
|
3069
|
+
// Must have key and valid columns
|
|
3070
|
+
if (!key || !hasValidColumns) {
|
|
3071
|
+
return false;
|
|
3072
|
+
}
|
|
3073
|
+
// For server mode, wait until loading is complete (loading goes from true to false)
|
|
3074
|
+
if (isServerMode) {
|
|
3075
|
+
// Only trigger when loading is false (data loaded)
|
|
3076
|
+
return !loading;
|
|
3077
|
+
}
|
|
3078
|
+
// For local mode, proceed immediately
|
|
3079
|
+
return true;
|
|
3080
|
+
}), () => {
|
|
3081
|
+
if (!this._configCacheLoaded) {
|
|
3061
3082
|
this._loadConfigCache();
|
|
3083
|
+
this._configCacheLoaded = true;
|
|
3062
3084
|
}
|
|
3063
3085
|
});
|
|
3064
3086
|
explicitEffect([this.zConfig], ([cfg]) => {
|
|
3065
3087
|
const initial = cfg.initialState;
|
|
3088
|
+
console.log('🚀 ~ initial:', initial);
|
|
3066
3089
|
if (initial) {
|
|
3067
3090
|
if (initial.columnPinning) {
|
|
3068
3091
|
this.columnPinning.set(initial.columnPinning);
|
|
@@ -3652,6 +3675,7 @@ class ZTableComponent {
|
|
|
3652
3675
|
}
|
|
3653
3676
|
try {
|
|
3654
3677
|
const config = ZCacheService.get(`table-config-${key}`);
|
|
3678
|
+
console.log('🚀 ~ config:', config);
|
|
3655
3679
|
if (!config) {
|
|
3656
3680
|
return;
|
|
3657
3681
|
}
|
|
@@ -3681,6 +3705,7 @@ class ZTableComponent {
|
|
|
3681
3705
|
if (config.columnSizing) {
|
|
3682
3706
|
this.table.setColumnSizing(config.columnSizing);
|
|
3683
3707
|
}
|
|
3708
|
+
console.log('zzz🚀 ~ config:', config);
|
|
3684
3709
|
}
|
|
3685
3710
|
catch (error) {
|
|
3686
3711
|
console.error('Failed to load table config:', error);
|