@shival99/z-ui 1.2.36 → 1.2.37

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.
@@ -2350,7 +2350,6 @@ class ZTableComponent {
2350
2350
  _dataForceUpdate = signal(0, ...(ngDevMode ? [{ debugName: "_dataForceUpdate" }] : []));
2351
2351
  _columnConfigCache = new Map();
2352
2352
  _lastColumnsRef = null;
2353
- _configCacheLoaded = false;
2354
2353
  pinnedColumnIds = computed(() => {
2355
2354
  this._columnPinVersion();
2356
2355
  return this.columnOrder().filter(id => {
@@ -3056,22 +3055,20 @@ class ZTableComponent {
3056
3055
  explicitEffect([this._zTranslate.currentLang], () => {
3057
3056
  this._dataForceUpdate.update(v => v + 1);
3058
3057
  });
3059
- explicitEffect([this.zKey, this.zConfig], ([key, config]) => {
3060
- console.log('🚀 ~ key:', key);
3061
- if (key && config.columns && config.columns.length > 0) {
3062
- console.log('🚀 ~ key:', key);
3063
- this._loadConfigCache();
3058
+ explicitEffect([this.zKey, this.zConfig], ([key, cfg]) => {
3059
+ if (!cfg.columns || cfg.columns.length === 0) {
3060
+ return;
3064
3061
  }
3065
- }, { defer: true });
3066
- explicitEffect([this.zConfig], ([cfg]) => {
3062
+ const cacheLoaded = key ? this._loadConfigCache(key) : false;
3067
3063
  const initial = cfg.initialState;
3068
- console.log('🚀 ~ initial:', initial);
3069
3064
  if (initial) {
3070
- if (initial.columnPinning) {
3071
- this.columnPinning.set(initial.columnPinning);
3072
- }
3073
- if (initial.columnVisibility) {
3074
- this.columnVisibility.set(initial.columnVisibility);
3065
+ if (!cacheLoaded) {
3066
+ if (initial.columnPinning) {
3067
+ this.columnPinning.set(initial.columnPinning);
3068
+ }
3069
+ if (initial.columnVisibility) {
3070
+ this.columnVisibility.set(initial.columnVisibility);
3071
+ }
3075
3072
  }
3076
3073
  if (initial.sorting) {
3077
3074
  this.sorting.set(initial.sorting);
@@ -3095,7 +3092,9 @@ class ZTableComponent {
3095
3092
  this.pagination.set(initial.pagination);
3096
3093
  }
3097
3094
  }
3098
- this.showHeaderFooterShadow.set(cfg.showHeaderShadow ?? cfg.showFooterShadow ?? true);
3095
+ if (!cacheLoaded) {
3096
+ this.showHeaderFooterShadow.set(cfg.showHeaderShadow ?? cfg.showFooterShadow ?? true);
3097
+ }
3099
3098
  const cols = cfg.columns ?? [];
3100
3099
  const leftPinned = [...(initial?.columnPinning?.left ?? [])];
3101
3100
  const rightPinned = [...(initial?.columnPinning?.right ?? [])];
@@ -3113,11 +3112,10 @@ class ZTableComponent {
3113
3112
  }
3114
3113
  };
3115
3114
  collectPinnedColumns(cols);
3116
- if (leftPinned.length > 0 || rightPinned.length > 0) {
3115
+ if (!cacheLoaded && (leftPinned.length > 0 || rightPinned.length > 0)) {
3117
3116
  this.columnPinning.set({ left: leftPinned, right: rightPinned });
3118
3117
  }
3119
- console.log('🚀 ~ this.columnPinning:', this.columnPinning);
3120
- });
3118
+ }, { defer: true });
3121
3119
  explicitEffect([this.zConfig], ([cfg]) => {
3122
3120
  if (cfg.enableRowPinning && !this.hasBodyRowSpan()) {
3123
3121
  const cols = cfg.columns ?? [];
@@ -3648,21 +3646,18 @@ class ZTableComponent {
3648
3646
  collect(columns);
3649
3647
  return result;
3650
3648
  }
3651
- _loadConfigCache() {
3652
- const key = this.zKey();
3649
+ _loadConfigCache(key) {
3653
3650
  if (!key) {
3654
- return;
3651
+ return false;
3655
3652
  }
3656
3653
  try {
3657
3654
  const config = ZCacheService.get(`table-config-${key}`);
3658
- console.log('🚀 ~ config:', config);
3659
3655
  if (!config) {
3660
- return;
3656
+ return false;
3661
3657
  }
3662
3658
  if (!this._isColumnConfigValid(config.columnInfo)) {
3663
- console.warn('Saved table config is invalid or outdated. Ignoring saved config.');
3664
3659
  ZCacheService.delete(`table-config-${key}`);
3665
- return;
3660
+ return false;
3666
3661
  }
3667
3662
  if (config.columnOrder && config.columnOrder.length > 0) {
3668
3663
  this.columnOrder.set(config.columnOrder);
@@ -3685,10 +3680,11 @@ class ZTableComponent {
3685
3680
  if (config.columnSizing) {
3686
3681
  this.table.setColumnSizing(config.columnSizing);
3687
3682
  }
3688
- console.log('zzz🚀 ~ config:', config);
3683
+ return true;
3689
3684
  }
3690
3685
  catch (error) {
3691
3686
  console.error('Failed to load table config:', error);
3687
+ return false;
3692
3688
  }
3693
3689
  }
3694
3690
  _isColumnConfigValid(cachedColumnInfo) {