sprintify-ui 0.8.64 → 0.8.66

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.
@@ -4,7 +4,7 @@ declare class SettingsStorage {
4
4
  private getFunction;
5
5
  private setFunction;
6
6
  constructor(getFunction?: SettingsStorageGetFunction, setFunction?: SettingsStorageSetFunction);
7
- get(key: string): Promise<string | null>;
7
+ get(key: string): Promise<Record<string, any> | string[] | number[] | number | string | boolean | null | undefined>;
8
8
  set(key: string, value: string): Promise<void>;
9
9
  }
10
10
  export { SettingsStorage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.8.64",
3
+ "version": "0.8.66",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
@@ -674,7 +674,23 @@ onMounted(async () => {
674
674
 
675
675
  const value = await settingsStorage.get(visibleColumnsKey);
676
676
 
677
- const visibleColumnsFromStorage = JSON.parse(value + '') as string[];
677
+ let visibleColumnsFromStorage = [];
678
+
679
+ if (typeof value === 'string') {
680
+ try {
681
+ visibleColumnsFromStorage.push(...JSON.parse(value));
682
+ } catch (e) {
683
+ console.error('Error parsing visible columns from storage', e);
684
+ }
685
+ }
686
+
687
+ if (typeof value === 'object' && value !== null) {
688
+ visibleColumnsFromStorage.push(Object.values(value));
689
+ }
690
+
691
+ if (Array.isArray(value)) {
692
+ visibleColumnsFromStorage = value;
693
+ }
678
694
 
679
695
  // If found, set visibleColumns
680
696
  if (
@@ -685,24 +701,16 @@ onMounted(async () => {
685
701
  visibleColumns.value = visibleColumnsFromStorage;
686
702
  }
687
703
 
688
- // If nothing is found, set visibleColumns to all columns from table
689
- const unWatchTable = watch(
690
- () => table.value,
691
- () => {
692
- if (
693
- table.value &&
694
- table.value.newColumns.length &&
695
- visibleColumns.value.length == 0
696
- ) {
697
- visibleColumns.value = table.value.newColumns
698
- .filter((c) => c.toggle)
699
- .filter((c) => c.toggleDefault ?? true)
700
- .map((c) => c.newKey);
701
-
702
- unWatchTable();
703
- }
704
- }
705
- );
704
+ if (
705
+ table.value &&
706
+ table.value.newColumns.length &&
707
+ visibleColumns.value.length == 0
708
+ ) {
709
+ visibleColumns.value = table.value.newColumns
710
+ .filter((c) => c.toggle)
711
+ .filter((c) => c.toggleDefault ?? true)
712
+ .map((c) => c.newKey);
713
+ }
706
714
  });
707
715
 
708
716
  /**
@@ -732,7 +740,23 @@ onMounted(async () => {
732
740
 
733
741
  const value = await settingsStorage.get(columnOrderKey);
734
742
 
735
- const columnOrderFromStorage = JSON.parse(value + '') as string[];
743
+ let columnOrderFromStorage = [];
744
+
745
+ if (typeof value === 'string') {
746
+ try {
747
+ columnOrderFromStorage.push(...JSON.parse(value));
748
+ } catch (e) {
749
+ console.error('Error parsing visible columns from storage', e);
750
+ }
751
+ }
752
+
753
+ if (typeof value === 'object' && value !== null) {
754
+ columnOrderFromStorage.push(Object.values(value));
755
+ }
756
+
757
+ if (Array.isArray(value)) {
758
+ columnOrderFromStorage = value;
759
+ }
736
760
 
737
761
  // If found, set columnOrder
738
762
  if (
@@ -24,7 +24,7 @@ class SettingsStorage {
24
24
  this.setFunction = setFunction ? setFunction : localStorageSet;
25
25
  }
26
26
 
27
- get(key: string): Promise<string | null> {
27
+ get(key: string): Promise<Record<string, any> | string[] | number[] | number | string | boolean | null | undefined> {
28
28
  return this.getFunction(key);
29
29
  }
30
30