aq-fe-framework 0.1.448 → 0.1.450

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.
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  useMyReactMutation,
14
14
  useMyReactQuery
15
- } from "./chunk-PRN7KYPD.mjs";
15
+ } from "./chunk-5LQERGH7.mjs";
16
16
  import {
17
17
  utils_notification_show
18
18
  } from "./chunk-7ZCOFATU.mjs";
@@ -207,7 +207,10 @@ function useQ_AQ_GetAQModule() {
207
207
  queryFn: async () => {
208
208
  const res = await baseAxios_default.get("/AQ/GetAQModule");
209
209
  return res.data.data;
210
- }
210
+ },
211
+ staleTime: Infinity,
212
+ refetchOnMount: false,
213
+ refetchOnWindowFocus: false
211
214
  });
212
215
  return query;
213
216
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createGenericStore
3
- } from "./chunk-Y3YGC5IH.mjs";
3
+ } from "./chunk-U62R2QKJ.mjs";
4
4
  import {
5
5
  utils_pdf_download
6
6
  } from "./chunk-5U2JSHSJ.mjs";
@@ -16,7 +16,7 @@ import {
16
16
  baseAxios_default,
17
17
  useMyReactMutation,
18
18
  useQ_AQ_GetAQModule
19
- } from "./chunk-PRN7KYPD.mjs";
19
+ } from "./chunk-5LQERGH7.mjs";
20
20
  import {
21
21
  utils_notification_show
22
22
  } from "./chunk-7ZCOFATU.mjs";
@@ -0,0 +1,72 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "./chunk-FWCSY2DS.mjs";
5
+
6
+ // src/stores/CreateGenericStore.ts
7
+ import { create } from "zustand";
8
+ import { persist } from "zustand/middleware";
9
+ function createGenericStore({ initialState, storageKey }) {
10
+ const storeCreator = (set) => ({
11
+ state: initialState,
12
+ setState: (newState) => set({ state: newState }),
13
+ setProperty: (key, value) => set((store) => ({ state: __spreadProps(__spreadValues({}, store.state), { [key]: value }) })),
14
+ resetState: () => set({ state: initialState })
15
+ });
16
+ return storageKey ? create(persist(storeCreator, { name: storageKey })) : create(storeCreator);
17
+ }
18
+
19
+ // src/stores/createStateStore.ts
20
+ import { create as create2 } from "zustand";
21
+ import { persist as persist2 } from "zustand/middleware";
22
+ function createStateStore({
23
+ initialState,
24
+ storageKey
25
+ }) {
26
+ const createStateWithSetters = (set) => {
27
+ const setterObj = {};
28
+ for (const key in initialState) {
29
+ const fnName = `set${key.charAt(0).toUpperCase()}${key.slice(1)}`;
30
+ setterObj[fnName] = (value) => {
31
+ set((store2) => ({
32
+ state: __spreadProps(__spreadValues({}, store2.state), {
33
+ [key]: value
34
+ })
35
+ }));
36
+ };
37
+ }
38
+ const fullState = __spreadValues(__spreadValues({}, initialState), setterObj);
39
+ const stateWithReset = __spreadProps(__spreadValues({}, fullState), {
40
+ resetState: () => set({
41
+ state: __spreadProps(__spreadValues(__spreadValues({}, initialState), setterObj), {
42
+ resetState: () => {
43
+ }
44
+ })
45
+ })
46
+ });
47
+ return { state: stateWithReset };
48
+ };
49
+ const store = storageKey ? create2(persist2(createStateWithSetters, { name: storageKey })) : create2(createStateWithSetters);
50
+ const current = store.getState();
51
+ const actualReset = () => store.setState({
52
+ state: __spreadProps(__spreadValues(__spreadValues({}, initialState), Object.fromEntries(
53
+ Object.keys(initialState).map((k) => {
54
+ const fnName = `set${k.charAt(0).toUpperCase()}${k.slice(1)}`;
55
+ return [fnName, current.state[fnName]];
56
+ })
57
+ )), {
58
+ resetState: current.state.resetState
59
+ })
60
+ });
61
+ store.setState({
62
+ state: __spreadProps(__spreadValues({}, current.state), {
63
+ resetState: actualReset
64
+ })
65
+ });
66
+ return store;
67
+ }
68
+
69
+ export {
70
+ createGenericStore,
71
+ createStateStore
72
+ };
@@ -62,8 +62,8 @@ import {
62
62
  useS_BasicAppShell,
63
63
  useS_ButtonImport,
64
64
  utils_layout_getItemsWithoutLinks
65
- } from "../chunk-JLROGQ4X.mjs";
66
- import "../chunk-Y3YGC5IH.mjs";
65
+ } from "../chunk-LF3ET3DR.mjs";
66
+ import "../chunk-U62R2QKJ.mjs";
67
67
  import "../chunk-5U2JSHSJ.mjs";
68
68
  import {
69
69
  MyDataTable,
@@ -71,7 +71,7 @@ import {
71
71
  MyFlexRow
72
72
  } from "../chunk-RZBHPPQT.mjs";
73
73
  import "../chunk-OMJJAHOC.mjs";
74
- import "../chunk-PRN7KYPD.mjs";
74
+ import "../chunk-5LQERGH7.mjs";
75
75
  import "../chunk-7ZCOFATU.mjs";
76
76
  import "../chunk-FWCSY2DS.mjs";
77
77
  export {
@@ -14,12 +14,12 @@ import {
14
14
  MyStatsCard,
15
15
  MyTextInput,
16
16
  MyWeeklySessionSchedulerPicker
17
- } from "../chunk-YSIPY7DY.mjs";
17
+ } from "../chunk-3DBUUHTM.mjs";
18
18
  import "../chunk-RZBHPPQT.mjs";
19
19
  import "../chunk-GFEMKKFH.mjs";
20
20
  import "../chunk-OMJJAHOC.mjs";
21
21
  import "../chunk-K6S7R6LU.mjs";
22
- import "../chunk-PRN7KYPD.mjs";
22
+ import "../chunk-5LQERGH7.mjs";
23
23
  import "../chunk-7ZCOFATU.mjs";
24
24
  import "../chunk-FWCSY2DS.mjs";
25
25
  export {
@@ -7,7 +7,7 @@ import {
7
7
  useMyReactQuery,
8
8
  useMyRouter,
9
9
  useQ_AQ_GetAQModule
10
- } from "../chunk-PRN7KYPD.mjs";
10
+ } from "../chunk-5LQERGH7.mjs";
11
11
  import "../chunk-7ZCOFATU.mjs";
12
12
  import "../chunk-FWCSY2DS.mjs";
13
13
  export {
@@ -33,16 +33,16 @@ import {
33
33
  groupToTwoLevels,
34
34
  useS_authenticate,
35
35
  utils_layout_getItemsWithoutLinks
36
- } from "../chunk-JLROGQ4X.mjs";
36
+ } from "../chunk-LF3ET3DR.mjs";
37
37
  import {
38
38
  createGenericStore
39
- } from "../chunk-Y3YGC5IH.mjs";
39
+ } from "../chunk-U62R2QKJ.mjs";
40
40
  import "../chunk-5U2JSHSJ.mjs";
41
41
  import {
42
42
  MyButton as MyButton2,
43
43
  MyDataTableSelectOne,
44
44
  MyTextInput as MyTextInput2
45
- } from "../chunk-YSIPY7DY.mjs";
45
+ } from "../chunk-3DBUUHTM.mjs";
46
46
  import {
47
47
  MyDataTable,
48
48
  MyFlexColumn,
@@ -67,7 +67,7 @@ import {
67
67
  useMyRouter,
68
68
  useQ_AQ_GetAQModule,
69
69
  useQ_SkillCenter_GetAll
70
- } from "../chunk-PRN7KYPD.mjs";
70
+ } from "../chunk-5LQERGH7.mjs";
71
71
  import {
72
72
  utils_notification_show
73
73
  } from "../chunk-7ZCOFATU.mjs";
@@ -1,6 +1,6 @@
1
1
  import * as zustand from 'zustand';
2
2
 
3
- interface GenericStore<T> {
3
+ interface GenericStore$1<T> {
4
4
  state: T;
5
5
  setState: (newState: T) => void;
6
6
  setProperty: <K extends keyof T>(key: K, value: T[K]) => void;
@@ -9,6 +9,19 @@ interface GenericStore<T> {
9
9
  declare function createGenericStore<T>({ initialState, storageKey }: {
10
10
  initialState: T;
11
11
  storageKey?: string;
12
+ }): zustand.UseBoundStore<zustand.StoreApi<GenericStore$1<T>>>;
13
+
14
+ type SetterFuncs<T> = {
15
+ [K in keyof T as `set${Capitalize<string & K>}`]: (value: T[K]) => void;
16
+ };
17
+ type GenericStore<T> = {
18
+ state: T & SetterFuncs<T> & {
19
+ resetState: () => void;
20
+ };
21
+ };
22
+ declare function createStateStore<T extends Record<string, any>>({ initialState, storageKey, }: {
23
+ initialState: T;
24
+ storageKey?: string;
12
25
  }): zustand.UseBoundStore<zustand.StoreApi<GenericStore<T>>>;
13
26
 
14
- export { createGenericStore };
27
+ export { createGenericStore, createStateStore };
@@ -1,7 +1,9 @@
1
1
  import {
2
- createGenericStore
3
- } from "../chunk-Y3YGC5IH.mjs";
2
+ createGenericStore,
3
+ createStateStore
4
+ } from "../chunk-U62R2QKJ.mjs";
4
5
  import "../chunk-FWCSY2DS.mjs";
5
6
  export {
6
- createGenericStore
7
+ createGenericStore,
8
+ createStateStore
7
9
  };
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/columns/index.d.mts"
43
43
  }
44
44
  },
45
- "version": "0.1.448",
45
+ "version": "0.1.450",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"
@@ -1,21 +0,0 @@
1
- import {
2
- __spreadProps,
3
- __spreadValues
4
- } from "./chunk-FWCSY2DS.mjs";
5
-
6
- // src/stores/CreateGenericStore.ts
7
- import { create } from "zustand";
8
- import { persist } from "zustand/middleware";
9
- function createGenericStore({ initialState, storageKey }) {
10
- const storeCreator = (set) => ({
11
- state: initialState,
12
- setState: (newState) => set({ state: newState }),
13
- setProperty: (key, value) => set((store) => ({ state: __spreadProps(__spreadValues({}, store.state), { [key]: value }) })),
14
- resetState: () => set({ state: initialState })
15
- });
16
- return storageKey ? create(persist(storeCreator, { name: storageKey })) : create(storeCreator);
17
- }
18
-
19
- export {
20
- createGenericStore
21
- };