@finema/core 2.7.0 → 2.7.1

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/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
4
4
  "configKey": "core",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
package/dist/module.mjs CHANGED
@@ -3,7 +3,7 @@ import defu from 'defu';
3
3
  import * as theme from '../dist/runtime/theme/index.js';
4
4
 
5
5
  const name = "@finema/core";
6
- const version = "2.7.0";
6
+ const version = "2.7.1";
7
7
 
8
8
  const nuxtAppOptions = {
9
9
  head: {
@@ -1,29 +1,31 @@
1
- import { reactive, computed } from "vue";
1
+ import { ref } from "vue";
2
2
  import { ObjectHelper } from "../utils/ObjectHelper.js";
3
3
  import {
4
4
  apiObjectHelper
5
5
  } from "../helpers/apiObjectHelper.js";
6
6
  export const useObjectLoader = (loaderOptions) => {
7
- const result = reactive({
8
- data: null,
9
- status: ObjectHelper.createStatus(),
10
- options: {}
11
- });
7
+ const data = ref(null);
8
+ const status = ref(ObjectHelper.createStatus());
9
+ const options = ref({});
12
10
  const clear = () => {
13
- result.status = ObjectHelper.createStatus();
14
- result.data = null;
11
+ status.value = ObjectHelper.createStatus();
12
+ data.value = null;
15
13
  };
16
14
  const run = async (payload = {}) => {
17
15
  return await apiObjectHelper(
18
- () => result,
16
+ () => ({
17
+ data: data.value,
18
+ status: status.value,
19
+ options: options.value
20
+ }),
19
21
  (_data) => {
20
- result.status = _data;
22
+ status.value = _data;
21
23
  },
22
24
  (_data) => {
23
- result.options = _data;
25
+ options.value = _data;
24
26
  },
25
27
  (_data) => {
26
- result.data = _data ?? null;
28
+ data.value = _data ?? null;
27
29
  },
28
30
  payload.data,
29
31
  {
@@ -33,15 +35,15 @@ export const useObjectLoader = (loaderOptions) => {
33
35
  );
34
36
  };
35
37
  const setLoading = () => {
36
- result.status = ObjectHelper.toLoadingStatus(result.status);
38
+ status.value = ObjectHelper.toLoadingStatus(status.value);
37
39
  };
38
40
  const setData = (_data) => {
39
- result.data = _data;
41
+ data.value = _data;
40
42
  };
41
43
  return {
42
- data: computed(() => result.data),
43
- status: computed(() => result.status),
44
- options: computed(() => result.options),
44
+ data,
45
+ status,
46
+ options,
45
47
  run,
46
48
  clear,
47
49
  setLoading,
@@ -1,5 +1,5 @@
1
1
  import type { AxiosRequestConfig, Method } from 'axios';
2
- import type { ComputedRef } from 'vue';
2
+ import type { Ref, ComputedRef } from 'vue';
3
3
  import type { IAPIObjectState, IAPIOptions, IStatus } from '../types/lib.js';
4
4
  import { type IBaseLoaderOptions } from './apiBaseHelper.js';
5
5
  import type { IListRunLoaderOptions } from './apiListHelper.js';
@@ -17,9 +17,9 @@ export interface IObjectLoaderOptions<T = any, B = any, _O = any> {
17
17
  getRequestOptions?: (data: B | undefined, opts: IObjectRunLoaderOptions<T, B>) => AxiosRequestConfig;
18
18
  }
19
19
  export interface IUseObjectLoader<T, B, _O> {
20
- status: ComputedRef<IStatus>;
21
- data: ComputedRef<T | null>;
22
- options: ComputedRef<IAPIOptions>;
20
+ status: Ref<IStatus>;
21
+ data: Ref<T | null>;
22
+ options: Ref<IAPIOptions>;
23
23
  run: (payload?: IObjectRunLoaderOptions<T, B>) => Promise<void>;
24
24
  clear: () => void;
25
25
  setLoading: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",