@finema/core 1.2.2 → 1.2.5

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.
Files changed (45) hide show
  1. package/README.md +94 -94
  2. package/dist/module.d.mts +30 -0
  3. package/dist/module.d.ts +30 -0
  4. package/dist/module.json +2 -2
  5. package/dist/module.mjs +128 -4
  6. package/dist/runtime/components/Table/index.vue +11 -0
  7. package/dist/runtime/components/Table/types.d.ts +72 -0
  8. package/dist/runtime/components/Table/types.mjs +15 -0
  9. package/dist/runtime/{lib/api → composables}/loaderList.d.ts +0 -1
  10. package/dist/runtime/{lib/api → composables}/loaderList.mjs +2 -2
  11. package/dist/runtime/{lib/api → composables}/loaderObject.d.ts +0 -1
  12. package/dist/runtime/{lib/api → composables}/loaderObject.mjs +2 -2
  13. package/dist/runtime/{lib/api → composables}/loaderPage.d.ts +4 -2
  14. package/dist/runtime/{lib/api → composables}/loaderPage.mjs +19 -8
  15. package/dist/runtime/composables/useTable.d.ts +20 -0
  16. package/dist/runtime/composables/useTable.mjs +39 -0
  17. package/dist/runtime/composables/useWatch.d.ts +3 -0
  18. package/dist/runtime/composables/useWatch.mjs +22 -0
  19. package/dist/runtime/core.config.d.ts +4 -0
  20. package/dist/runtime/core.config.mjs +4 -0
  21. package/dist/runtime/{lib/api → helpers}/apiListHelper.d.ts +3 -3
  22. package/dist/runtime/{lib/api → helpers}/apiListHelper.mjs +3 -3
  23. package/dist/runtime/{lib/api → helpers}/apiObjectHelper.d.ts +3 -3
  24. package/dist/runtime/{lib/api → helpers}/apiObjectHelper.mjs +3 -3
  25. package/dist/runtime/{lib/api → helpers}/apiPageHelper.d.ts +4 -4
  26. package/dist/runtime/{lib/api → helpers}/apiPageHelper.mjs +9 -6
  27. package/dist/runtime/types/common.d.ts +4 -9
  28. package/dist/runtime/types/lib.d.ts +63 -76
  29. package/dist/runtime/types/lib.mjs +0 -0
  30. package/dist/runtime/{lib/api → types}/loaderTypes.d.ts +1 -1
  31. package/dist/runtime/types/loaderTypes.mjs +0 -0
  32. package/dist/runtime/types/utils.d.ts +9 -0
  33. package/dist/runtime/utils/ParamHelper.d.ts +2 -2
  34. package/dist/types.d.mts +1 -1
  35. package/dist/types.d.ts +1 -1
  36. package/package.json +4 -1
  37. package/dist/runtime/composables/useLibs.d.ts +0 -24
  38. package/dist/runtime/composables/useLibs.mjs +0 -4
  39. package/dist/runtime/composables/useUtils.d.ts +0 -10
  40. package/dist/runtime/composables/useUtils.mjs +0 -12
  41. package/dist/runtime/lib/api/config.d.ts +0 -4
  42. package/dist/runtime/lib/api/config.mjs +0 -4
  43. package/dist/runtime/lib/index.d.ts +0 -8
  44. package/dist/runtime/lib/index.mjs +0 -8
  45. /package/dist/runtime/{lib/api/loaderTypes.mjs → types/common.mjs} +0 -0
package/README.md CHANGED
@@ -1,94 +1,94 @@
1
- <!--
2
- Get your module up and running quickly.
3
-
4
- Find and replace all on all files (CMD+SHIFT+F):
5
- - Name: My Module
6
- - Package name: my-module
7
- - Description: My new Nuxt module
8
- -->
9
-
10
- # @finema/core Nuxt Module
11
-
12
- [![npm version][npm-version-src]][npm-version-href]
13
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
14
- [![License][license-src]][license-href]
15
- [![Nuxt][nuxt-src]][nuxt-href]
16
-
17
- @finema/core for doing amazing things.
18
-
19
- - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
- <!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
21
- <!-- - [📖 &nbsp;Documentation](https://example.com) -->
22
-
23
- ## Features
24
-
25
- <!-- Highlight some of the features your module provide here -->
26
- - ⛰ &nbsp;Foo
27
- - 🚠 &nbsp;Bar
28
- - 🌲 &nbsp;Baz
29
-
30
- ## Quick Setup
31
-
32
- 1. Add `@finema/core` dependency to your project
33
-
34
- ```bash
35
- # Using pnpm
36
- pnpm add -D @finema/core
37
-
38
- # Using yarn
39
- yarn add --dev @finema/core
40
-
41
- # Using npm
42
- npm install --save-dev @finema/core
43
- ```
44
-
45
- 1. Add `@finema/core` to the `modules` section of `nuxt.config.ts`
46
-
47
- ```js
48
- export default defineNuxtConfig({
49
- modules: [
50
- '@finema/core'
51
- ]
52
- })
53
- ```
54
-
55
- That's it! You can now use @finema/core in your Nuxt app ✨
56
-
57
- ## Development
58
-
59
- ```bash
60
- # Install dependencies
61
- npm install
62
-
63
- # Generate type stubs
64
- npm run dev:prepare
65
-
66
- # Develop with the playground
67
- npm run dev
68
-
69
- # Build the playground
70
- npm run dev:build
71
-
72
- # Run ESLint
73
- npm run lint
74
-
75
- # Run Vitest
76
- npm run test
77
- npm run test:watch
78
-
79
- # Release new version
80
- npm run release
81
- ```
82
-
83
- <!-- Badges -->
84
- [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
85
- [npm-version-href]: https://npmjs.com/package/my-module
86
-
87
- [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
88
- [npm-downloads-href]: https://npmjs.com/package/my-module
89
-
90
- [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
91
- [license-href]: https://npmjs.com/package/my-module
92
-
93
- [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
94
- [nuxt-href]: https://nuxt.com
1
+ <!--
2
+ Get your module up and running quickly.
3
+
4
+ Find and replace all on all files (CMD+SHIFT+F):
5
+ - Name: My Module
6
+ - Package name: my-module
7
+ - Description: My new Nuxt module
8
+ -->
9
+
10
+ # @finema/core Nuxt Module
11
+
12
+ [![npm version][npm-version-src]][npm-version-href]
13
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
14
+ [![License][license-src]][license-href]
15
+ [![Nuxt][nuxt-src]][nuxt-href]
16
+
17
+ @finema/core for doing amazing things.
18
+
19
+ - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
+ <!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
21
+ <!-- - [📖 &nbsp;Documentation](https://example.com) -->
22
+
23
+ ## Features
24
+
25
+ <!-- Highlight some of the features your module provide here -->
26
+ - ⛰ &nbsp;Foo
27
+ - 🚠 &nbsp;Bar
28
+ - 🌲 &nbsp;Baz
29
+
30
+ ## Quick Setup
31
+
32
+ 1. Add `@finema/core` dependency to your project
33
+
34
+ ```bash
35
+ # Using pnpm
36
+ pnpm add -D @finema/core
37
+
38
+ # Using yarn
39
+ yarn add --dev @finema/core
40
+
41
+ # Using npm
42
+ npm install --save-dev @finema/core
43
+ ```
44
+
45
+ 1. Add `@finema/core` to the `modules` section of `nuxt.config.ts`
46
+
47
+ ```js
48
+ export default defineNuxtConfig({
49
+ modules: [
50
+ '@finema/core'
51
+ ]
52
+ })
53
+ ```
54
+
55
+ That's it! You can now use @finema/core in your Nuxt app ✨
56
+
57
+ ## Development
58
+
59
+ ```bash
60
+ # Install dependencies
61
+ npm install
62
+
63
+ # Generate type stubs
64
+ npm run dev:prepare
65
+
66
+ # Develop with the playground
67
+ npm run dev
68
+
69
+ # Build the playground
70
+ npm run dev:build
71
+
72
+ # Run ESLint
73
+ npm run lint
74
+
75
+ # Run Vitest
76
+ npm run test
77
+ npm run test:watch
78
+
79
+ # Release new version
80
+ npm run release
81
+ ```
82
+
83
+ <!-- Badges -->
84
+ [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
85
+ [npm-version-href]: https://npmjs.com/package/my-module
86
+
87
+ [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
88
+ [npm-downloads-href]: https://npmjs.com/package/my-module
89
+
90
+ [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
91
+ [license-href]: https://npmjs.com/package/my-module
92
+
93
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
94
+ [nuxt-href]: https://nuxt.com
package/dist/module.d.mts CHANGED
@@ -1,5 +1,21 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
+ declare const app: {
4
+ limit_per_page: number;
5
+ default_primary_key: string;
6
+ };
7
+
8
+ declare const config_app: typeof app;
9
+ declare namespace config {
10
+ export { config_app as app };
11
+ }
12
+
13
+ type Strategy = 'merge' | 'override'
14
+
15
+ type DeepPartial<T> = Partial<{
16
+ [P in keyof T]: DeepPartial<T[P]> | Record<string, string>
17
+ }>
18
+
3
19
  interface ModuleOptions {
4
20
  /**
5
21
  * @default ''
@@ -10,6 +26,20 @@ interface ModuleOptions {
10
26
  */
11
27
  global?: boolean;
12
28
  }
29
+ type CORE = {
30
+ strategy?: Strategy;
31
+ [key: string]: any;
32
+ } & DeepPartial<typeof config>;
33
+ declare module 'nuxt/schema' {
34
+ interface AppConfigInput {
35
+ core?: CORE;
36
+ }
37
+ }
38
+ declare module '@nuxt/schema' {
39
+ interface AppConfigInput {
40
+ core?: CORE;
41
+ }
42
+ }
13
43
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
14
44
 
15
45
  export { type ModuleOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -1,5 +1,21 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
+ declare const app: {
4
+ limit_per_page: number;
5
+ default_primary_key: string;
6
+ };
7
+
8
+ declare const config_app: typeof app;
9
+ declare namespace config {
10
+ export { config_app as app };
11
+ }
12
+
13
+ type Strategy = 'merge' | 'override'
14
+
15
+ type DeepPartial<T> = Partial<{
16
+ [P in keyof T]: DeepPartial<T[P]> | Record<string, string>
17
+ }>
18
+
3
19
  interface ModuleOptions {
4
20
  /**
5
21
  * @default ''
@@ -10,6 +26,20 @@ interface ModuleOptions {
10
26
  */
11
27
  global?: boolean;
12
28
  }
29
+ type CORE = {
30
+ strategy?: Strategy;
31
+ [key: string]: any;
32
+ } & DeepPartial<typeof config>;
33
+ declare module 'nuxt/schema' {
34
+ interface AppConfigInput {
35
+ core?: CORE;
36
+ }
37
+ }
38
+ declare module '@nuxt/schema' {
39
+ interface AppConfigInput {
40
+ core?: CORE;
41
+ }
42
+ }
13
43
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
14
44
 
15
45
  export { type ModuleOptions, _default as default };
package/dist/module.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.2.2",
3
+ "version": "1.2.5",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
- "nuxt": "^3.4.0"
6
+ "nuxt": "^3.7.4"
7
7
  }
8
8
  }
package/dist/module.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { defineNuxtModule, createResolver, addPlugin, addImportsDir } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, installModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
2
 
3
3
  const name = "@finema/core";
4
- const version = "1.2.2";
4
+ const version = "1.2.5";
5
5
 
6
6
  const module = defineNuxtModule({
7
7
  meta: {
@@ -9,19 +9,143 @@ const module = defineNuxtModule({
9
9
  version,
10
10
  configKey: "core",
11
11
  compatibility: {
12
- nuxt: "^3.4.0"
12
+ nuxt: "^3.7.4"
13
13
  }
14
14
  },
15
15
  // Default configuration options of the Nuxt module
16
16
  defaults: {},
17
- setup(options, nuxt) {
17
+ async setup(options, nuxt) {
18
18
  const { resolve } = createResolver(import.meta.url);
19
19
  const runtimeDir = resolve("./runtime");
20
20
  nuxt.options.build.transpile.push(runtimeDir);
21
+ nuxt.options.alias["#core"] = runtimeDir;
22
+ nuxt.options.appConfig.app = {
23
+ strategy: "merge"
24
+ };
25
+ nuxt.hook("tailwindcss:config", (tailwindConfig) => {
26
+ tailwindConfig.theme.extend.colors = {
27
+ ...tailwindConfig.theme.extend.colors,
28
+ black: "#20243E",
29
+ white: "#FFFFFF",
30
+ dark: {
31
+ DEFAULT: "#20243E",
32
+ 50: "#6D7280",
33
+ 100: "#505050"
34
+ },
35
+ light: {
36
+ DEFAULT: "#FAFAFA"
37
+ },
38
+ gray: {
39
+ DEFAULT: "#9095A6",
40
+ disabled: "#C1C4D0",
41
+ border: "#E2E4EA",
42
+ fill: "#F4F5FA"
43
+ },
44
+ finema: {
45
+ DEFAULT: "#3675FB",
46
+ 50: "#F8F8FF",
47
+ 100: "#E8EFFD",
48
+ 200: "#bee3f8",
49
+ 300: "#90cdf4",
50
+ 400: "#63b3ed",
51
+ 500: "#3675FB",
52
+ 600: "#0068FE",
53
+ 700: "#2b6cb0",
54
+ 800: "#2c5282",
55
+ 900: "#20243E"
56
+ },
57
+ secondary: {
58
+ DEFAULT: "#EE8B36",
59
+ 50: "#fdf1e7",
60
+ 100: "#f9d6b8",
61
+ 200: "#f5bb89",
62
+ 300: "#f1a05a",
63
+ 400: "#ed852b",
64
+ 500: "#d46b12",
65
+ 600: "#a5540e",
66
+ 700: "#763c0a",
67
+ 800: "#472406",
68
+ 900: "#180c02"
69
+ },
70
+ info: {
71
+ DEFAULT: "#F64976",
72
+ 50: "#FFEBF0",
73
+ 100: "#F87395",
74
+ 400: "#F87395",
75
+ 500: "#F87395"
76
+ },
77
+ danger: {
78
+ DEFAULT: "#FF4C4C",
79
+ 50: "#ffe5e5",
80
+ 100: "#FF4C4C",
81
+ 400: "#FF4C4C",
82
+ 500: "#FF4C4C"
83
+ },
84
+ success: {
85
+ DEFAULT: "#01B460",
86
+ 50: "#E2FFF0",
87
+ 100: "#52CB8C",
88
+ 400: "#52CB8C",
89
+ 500: "#52CB8C"
90
+ },
91
+ warning: {
92
+ DEFAULT: "#EE7336",
93
+ 50: "#FFEBE2",
94
+ 100: "#FF864B",
95
+ 400: "#FF864B",
96
+ 500: "#FF864B"
97
+ }
98
+ };
99
+ });
100
+ await installModule("@nuxt/ui");
101
+ await installModule("@pinia/nuxt");
102
+ await installModule("@vee-validate/nuxt", {
103
+ // disable or enable auto imports
104
+ autoImports: true,
105
+ // Use different names for components
106
+ componentNames: {
107
+ Form: "VeeForm",
108
+ Field: "VeeField",
109
+ FieldArray: "VeeFieldArray",
110
+ ErrorMessage: "VeeErrorMessage"
111
+ }
112
+ });
113
+ await installModule("nuxt-security", {
114
+ headers: {
115
+ xXSSProtection: "1; mode=block",
116
+ crossOriginEmbedderPolicy: "unsafe-none",
117
+ contentSecurityPolicy: {
118
+ "img-src": ["*", "'self'", "data:", "https"],
119
+ "script-src": [
120
+ "'self'",
121
+ "'unsafe-inline'",
122
+ "https://www.google-analytics.com",
123
+ "https://www.googletagmanager.com",
124
+ "https://fonts.googleapis.com",
125
+ "https://cdnjs.cloudflare.com"
126
+ ],
127
+ "script-src-attr": [
128
+ "'unsafe-inline'",
129
+ "https://www.google-analytics.com",
130
+ "https://www.googletagmanager.com",
131
+ "https://fonts.googleapis.com",
132
+ "https://cdnjs.cloudflare.com"
133
+ ]
134
+ }
135
+ }
136
+ });
21
137
  addPlugin({
22
138
  src: resolve(runtimeDir, "plugin")
23
139
  });
140
+ void addComponentsDir({
141
+ path: resolve(runtimeDir, "components"),
142
+ prefix: options.prefix,
143
+ global: options.global,
144
+ watch: false
145
+ });
24
146
  addImportsDir(resolve(runtimeDir, "composables"));
147
+ addImportsDir(resolve(runtimeDir, "utils"));
148
+ addImportsDir(resolve(runtimeDir, "types"));
25
149
  }
26
150
  });
27
151
 
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <UTable :loading="options.status.isLoading" :columns="options.columns" :rows="options.rawData"/>
3
+ </template>
4
+ <script lang="ts" setup>
5
+ import {PropType} from 'vue';
6
+ import {ITableOptions} from '#core/components/Table/types';
7
+
8
+ defineProps({
9
+ options: {type: Object as PropType<ITableOptions>, required: true},
10
+ });
11
+ </script>
@@ -0,0 +1,72 @@
1
+ import { type IPageOptions, type IStatus } from '#core/types/lib';
2
+ export declare const enum COLUMN_TYPES {
3
+ VALUE = "VALUE",
4
+ COMPONENT = "COMPONENT",
5
+ DATE = "DATE",
6
+ DATE_TIME = "DATE_TIME",
7
+ NUMBER = "NUMBER",
8
+ ACTION = "ACTION"
9
+ }
10
+ export declare const enum SORT_STATUS {
11
+ ASC = "asc",
12
+ DESC = "desc",
13
+ NONE = "none"
14
+ }
15
+ export interface IColumn {
16
+ [key: string]: any;
17
+ key: string;
18
+ sortable?: boolean;
19
+ direction?: 'asc' | 'desc';
20
+ class?: string;
21
+ }
22
+ export interface IColumnItem extends IColumn {
23
+ sortStatus?: SORT_STATUS;
24
+ }
25
+ export interface IColumnSortStatus {
26
+ value: string | any;
27
+ sortKey?: string;
28
+ sortStatus: SORT_STATUS;
29
+ }
30
+ export interface IRowItem<T = object> {
31
+ value: string | any;
32
+ type?: COLUMN_TYPES;
33
+ title?: string;
34
+ className?: string;
35
+ isSelect?: boolean;
36
+ props?: Record<string, any>;
37
+ on?: Record<string, any>;
38
+ }
39
+ export type IRow<T = object> = Record<number, IRowItem<T>>;
40
+ export interface ITableOptions<T = object> {
41
+ rawData: T[];
42
+ primary: string;
43
+ isHideBottomPagination?: boolean;
44
+ isHideTopPagination?: boolean;
45
+ isNotChangeRoute: boolean;
46
+ status: IStatus;
47
+ pageOptions: IPageOptions;
48
+ columns: IColumn[];
49
+ rows: any[];
50
+ isHideToolbar?: boolean;
51
+ isShowCheckbox?: boolean;
52
+ deleteStatus?: IStatus;
53
+ onRowClick?: (index: number, columns: Array<{
54
+ value: string;
55
+ }>) => void;
56
+ onCheckBoxClick?: (index: number[]) => void;
57
+ onSortChange?: (sortStatus: IColumnSortStatus[]) => void;
58
+ disabledCheckIndexes?: number[];
59
+ }
60
+ export interface ISimpleTableOptions<T = object> {
61
+ rawData: T[];
62
+ primary: string;
63
+ status: IStatus;
64
+ columns: IColumn[];
65
+ rows: Array<IRow<T>>;
66
+ isHideBottomPagination?: boolean;
67
+ onRowClick?: (index: number, columns: Array<{
68
+ value: string;
69
+ }>) => void;
70
+ onCheckBoxClick?: (index: number[]) => void;
71
+ onSortChange?: (sortStatus: IColumnSortStatus[]) => void;
72
+ }
@@ -0,0 +1,15 @@
1
+ export var COLUMN_TYPES = /* @__PURE__ */ ((COLUMN_TYPES2) => {
2
+ COLUMN_TYPES2["VALUE"] = "VALUE";
3
+ COLUMN_TYPES2["COMPONENT"] = "COMPONENT";
4
+ COLUMN_TYPES2["DATE"] = "DATE";
5
+ COLUMN_TYPES2["DATE_TIME"] = "DATE_TIME";
6
+ COLUMN_TYPES2["NUMBER"] = "NUMBER";
7
+ COLUMN_TYPES2["ACTION"] = "ACTION";
8
+ return COLUMN_TYPES2;
9
+ })(COLUMN_TYPES || {});
10
+ export var SORT_STATUS = /* @__PURE__ */ ((SORT_STATUS2) => {
11
+ SORT_STATUS2["ASC"] = "asc";
12
+ SORT_STATUS2["DESC"] = "desc";
13
+ SORT_STATUS2["NONE"] = "none";
14
+ return SORT_STATUS2;
15
+ })(SORT_STATUS || {});
@@ -1,2 +1 @@
1
- import { type IListLoaderOptions, type IUseListLoader } from './loaderTypes';
2
1
  export declare const useListLoader: <T = any, O = Record<string, any>>(loaderOptions: IListLoaderOptions<T, O>) => IUseListLoader<T, O>;
@@ -1,6 +1,6 @@
1
1
  import { ref } from "vue";
2
- import { ObjectHelper } from "../../utils/ObjectHelper.mjs";
3
- import { apiListHelper } from "./apiListHelper.mjs";
2
+ import { ObjectHelper } from "../utils/ObjectHelper.mjs";
3
+ import { apiListHelper } from "#core/helpers/apiListHelper";
4
4
  export const useListLoader = (loaderOptions) => {
5
5
  const status = ref(ObjectHelper.createStatus());
6
6
  const items = ref([]);
@@ -1,2 +1 @@
1
- import { type IObjectLoaderOptions, type IUseObjectLoader } from './loaderTypes';
2
1
  export declare const useObjectLoader: <T = any, B = any, O = Record<string, any>>(loaderOptions: IObjectLoaderOptions<T, B, O>) => IUseObjectLoader<T, B, O>;
@@ -1,6 +1,6 @@
1
1
  import { ref } from "vue";
2
- import { ObjectHelper } from "../../utils/ObjectHelper.mjs";
3
- import { apiObjectHelper } from "./apiObjectHelper.mjs";
2
+ import { ObjectHelper } from "../utils/ObjectHelper.mjs";
3
+ import { apiObjectHelper } from "#core/helpers/apiObjectHelper";
4
4
  export const useObjectLoader = (loaderOptions) => {
5
5
  const status = ref(ObjectHelper.createStatus());
6
6
  const data = ref(null);
@@ -1,5 +1,7 @@
1
- import { type IPageLoaderOptions, type IUsePageLoader } from './loaderTypes';
2
- export declare const initPageOptions: () => {
1
+ export declare const initPageOptions: (options: {
2
+ limit: number;
3
+ primary: string;
4
+ }) => {
3
5
  currentPageCount: number;
4
6
  currentPage: number;
5
7
  totalPage: number;
@@ -1,23 +1,26 @@
1
1
  import { ref } from "vue";
2
- import { ObjectHelper } from "../../utils/ObjectHelper.mjs";
2
+ import { ObjectHelper } from "../utils/ObjectHelper.mjs";
3
+ import { mergeConfig } from "#ui/utils";
4
+ import { app } from "#core/core.config";
3
5
  import {
4
6
  apiAddHelper,
5
7
  apiDeleteHelper,
6
8
  apiFetchHelper,
7
9
  apiFindHelper,
8
10
  updateHelper
9
- } from "./apiPageHelper.mjs";
10
- import { CONFIG } from "./config.mjs";
11
- export const initPageOptions = () => ({
11
+ } from "#core/helpers/apiPageHelper";
12
+ import appConfig from "#build/app.config";
13
+ export const initPageOptions = (options) => ({
12
14
  currentPageCount: 0,
13
15
  currentPage: 1,
14
16
  totalPage: 0,
15
17
  totalCount: 0,
16
- limit: CONFIG.LIMIT_PER_PAGE,
18
+ limit: options.limit,
17
19
  search: "",
18
- primary: CONFIG.DEFAULT_PRIMARY
20
+ primary: options.primary
19
21
  });
20
22
  export const usePageLoader = (loaderOptions) => {
23
+ const config = mergeConfig(appConfig.app.strategy, appConfig.app, app);
21
24
  const fetchStatus = ref(ObjectHelper.createStatus());
22
25
  const fetchItems = ref([]);
23
26
  const findItem = ref(null);
@@ -28,7 +31,12 @@ export const usePageLoader = (loaderOptions) => {
28
31
  const addStatus = ref(ObjectHelper.createStatus());
29
32
  const updateStatus = ref(ObjectHelper.createStatus());
30
33
  const deleteStatus = ref(ObjectHelper.createStatus());
31
- const fetchOptions = ref(initPageOptions());
34
+ const fetchOptions = ref(
35
+ initPageOptions({
36
+ limit: config.limit_per_page,
37
+ primary: config.default_primary_key
38
+ })
39
+ );
32
40
  const addOptions = ref({});
33
41
  const findOptions = ref({});
34
42
  const updateOptions = ref({});
@@ -42,7 +50,10 @@ export const usePageLoader = (loaderOptions) => {
42
50
  deleteItem.value = null;
43
51
  updateItem.value = null;
44
52
  fetchStatus.value = ObjectHelper.createStatus();
45
- fetchOptions.value = initPageOptions();
53
+ fetchOptions.value = initPageOptions({
54
+ limit: config.limit_per_page,
55
+ primary: config.default_primary_key
56
+ });
46
57
  findOptions.value = {};
47
58
  addOptions.value = {};
48
59
  deleteOptions.value = {};
@@ -0,0 +1,20 @@
1
+ import { type ComputedRef } from 'vue';
2
+ import { type Store } from 'pinia';
3
+ import { type IStatus, type IUsePageLoader } from '#imports';
4
+ import { type IColumn, type IRow, type ISimpleTableOptions, type ITableOptions } from '#core/components/Table/types';
5
+ export interface IUseTable<T = object> {
6
+ repo: IUsePageLoader<T> | Store<any, any>;
7
+ columns: () => IColumn[];
8
+ rows: (items: T[]) => IRow[];
9
+ options?: (() => Partial<ITableOptions<T>>) | Partial<ITableOptions<T>>;
10
+ }
11
+ export interface IUseSimpleTable<T = object> {
12
+ items: () => T[];
13
+ status?: () => IStatus;
14
+ columns: () => IColumn[];
15
+ rows: (items: T[]) => IRow[];
16
+ options?: (() => Partial<ISimpleTableOptions<T>>) | Partial<ISimpleTableOptions<T>>;
17
+ }
18
+ export declare const useTable: <T = object>(options: IUseTable<T>) => ComputedRef<ITableOptions<T>>;
19
+ export declare const useSimpleTable: <T = object>(options: IUseSimpleTable<T>) => ComputedRef<ISimpleTableOptions<T>>;
20
+ export declare const createTableOptions: <T = object>(repo: IUsePageLoader<T>, columns: IColumn[], rows: IRow[], options: ITableOptions<T>) => ITableOptions<T>;
@@ -0,0 +1,39 @@
1
+ import { get } from "@vueuse/core";
2
+ import { computed, ObjectHelper } from "#imports";
3
+ import { mergeConfig } from "#ui/utils";
4
+ import { app } from "#core/core.config";
5
+ import appConfig from "#build/app.config";
6
+ export const useTable = (options) => computed(() => {
7
+ return createTableOptions(
8
+ options.repo,
9
+ options.columns(),
10
+ options.rows(get(options.repo.fetchItems)),
11
+ typeof options.options === "function" ? options.options() : options.options ?? {}
12
+ );
13
+ });
14
+ export const useSimpleTable = (options) => computed(() => {
15
+ const config = mergeConfig(appConfig.app.strategy, appConfig.app, app);
16
+ return {
17
+ items: options.items(),
18
+ columns: options.columns(),
19
+ rows: options.rows(options.items()),
20
+ rawData: options.items(),
21
+ status: options.status ? options.status() : ObjectHelper.createStatus(),
22
+ primary: config.default_primary_key,
23
+ ...typeof options.options === "function" ? options.options() : options.options ?? {}
24
+ };
25
+ });
26
+ export const createTableOptions = (repo, columns, rows, options) => {
27
+ const config = mergeConfig(appConfig.app.strategy, appConfig.app, app);
28
+ return {
29
+ rawData: get(repo.fetchItems),
30
+ pageOptions: get(repo.fetchOptions),
31
+ columns,
32
+ rows,
33
+ status: get(repo.fetchStatus),
34
+ deleteStatus: get(repo.deleteStatus),
35
+ primary: get(repo.fetchOptions).primary ?? config.default_primary_key,
36
+ isNotChangeRoute: false,
37
+ ...options
38
+ };
39
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useWatchTrue: (source: () => boolean, cb: (v: boolean, o: boolean) => any) => void;
2
+ export declare const useWatchFalse: (source: () => boolean, cb: (v: boolean, o: boolean) => any) => void;
3
+ export declare const useWatchChange: (source: () => any, cb: (v: any, o: any) => any) => void;
@@ -0,0 +1,22 @@
1
+ import { ParamHelper, watch } from "#imports";
2
+ export const useWatchTrue = (source, cb) => {
3
+ watch(source, (value, oldVal) => {
4
+ if (ParamHelper.isChangeWithTrue(value, oldVal)) {
5
+ cb(value, oldVal);
6
+ }
7
+ });
8
+ };
9
+ export const useWatchFalse = (source, cb) => {
10
+ watch(source, (value, oldVal) => {
11
+ if (ParamHelper.isChangeWithFalse(value, oldVal)) {
12
+ cb(value, oldVal);
13
+ }
14
+ });
15
+ };
16
+ export const useWatchChange = (source, cb) => {
17
+ watch(source, (value, oldVal) => {
18
+ if (value !== oldVal) {
19
+ cb(value, oldVal);
20
+ }
21
+ });
22
+ };
@@ -0,0 +1,4 @@
1
+ export declare const app: {
2
+ limit_per_page: number;
3
+ default_primary_key: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export const app = {
2
+ limit_per_page: 30,
3
+ default_primary_key: "id"
4
+ };
@@ -1,3 +1,3 @@
1
- import { type IAPIListState, type IAPIOptions, type IStatus } from '../../types/lib';
2
- import { type IListLoaderOptions, type IListRunLoaderOptions } from './loaderTypes';
3
- export declare const apiListHelper: <T, O>(state: () => IAPIListState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateItems: (data: T[]) => void, opts: IListLoaderOptions<T, O> & IListRunLoaderOptions<T, O>) => Promise<void>;
1
+ import { type IAPIListState, type IAPIOptions, type IStatus } from '#core/types/lib';
2
+ import { type IListLoaderOptions, type IListRunLoaderOptions } from '#core/types/loaderTypes';
3
+ export declare const apiListHelper: <T, O>(state: () => IAPIListState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateItems: (data: T[]) => void, opts: any) => Promise<void>;
@@ -1,6 +1,6 @@
1
- import { NewRequester } from "../Requester.mjs";
2
- import { ObjectHelper } from "../../utils/ObjectHelper.mjs";
3
- import { ParamHelper } from "../../utils/ParamHelper.mjs";
1
+ import { ObjectHelper } from "../utils/ObjectHelper.mjs";
2
+ import { ParamHelper } from "#imports";
3
+ import { NewRequester } from "#core/lib/Requester";
4
4
  export const apiListHelper = async (state, onUpdateStatus, onUpdateOptions, onUpdateItems, opts) => {
5
5
  const timestamp = state().options._timestamp;
6
6
  if (opts.expire && timestamp) {
@@ -1,3 +1,3 @@
1
- import { type IAPIObjectState, type IAPIOptions, type IStatus } from '../../types/lib';
2
- import { type IObjectLoaderOptions, type IObjectRunLoaderOptions } from './loaderTypes';
3
- export declare const apiObjectHelper: <T, B, O>(state: () => IAPIObjectState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, data: B | undefined, opts: IObjectLoaderOptions<T, B, O> & IObjectRunLoaderOptions<T, O>) => Promise<void>;
1
+ import { type IAPIObjectState, type IAPIOptions, type IStatus } from '#core/types/lib';
2
+ import { type IObjectLoaderOptions, type IObjectRunLoaderOptions } from '#core/types/loaderTypes';
3
+ export declare const apiObjectHelper: <T, B, O>(state: () => IAPIObjectState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, data: B | undefined, opts: any) => Promise<void>;
@@ -1,6 +1,6 @@
1
- import { NewRequester } from "../Requester.mjs";
2
- import { ObjectHelper } from "../../utils/ObjectHelper.mjs";
3
- import { ParamHelper } from "../../utils/ParamHelper.mjs";
1
+ import { ObjectHelper } from "../utils/ObjectHelper.mjs";
2
+ import { ParamHelper } from "#core/utils/ParamHelper";
3
+ import { NewRequester } from "#core/lib/Requester";
4
4
  export const apiObjectHelper = async (state, onUpdateStatus, onUpdateOptions, onUpdateData, data, opts) => {
5
5
  const timestamp = state().options._timestamp;
6
6
  if (opts.expire && timestamp) {
@@ -1,7 +1,7 @@
1
- import { type IAPIAddState, type IAPIDeleteState, type IAPIFetchState, type IAPIFindState, type IAPIOptions, type IAPIUpdateState, type IPageOptions, type IStatus } from '../../types/lib';
2
- import { type IPageDeleteLoaderOptions, type IPageFetchLoaderOptions, type IPageFindLoaderOptions, type IPageLoaderOptions, type IPageUpdateLoaderOptions } from './loaderTypes';
1
+ import { type IPageDeleteLoaderOptions, type IPageFetchLoaderOptions, type IPageFindLoaderOptions, type IPageLoaderOptions, type IPageUpdateLoaderOptions } from '#core/types/loaderTypes';
2
+ import { type IAPIAddState, type IAPIDeleteState, type IAPIFetchState, type IAPIFindState, type IAPIOptions, type IAPIUpdateState, type IPageOptions, type IStatus } from '#core/types/lib';
3
3
  export declare const apiAddHelper: <T>(state: () => IAPIAddState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, onUpdateItems: (data: any[]) => void, data: any, opts: IPageLoaderOptions<any> & IPageFetchLoaderOptions) => Promise<void>;
4
4
  export declare const apiDeleteHelper: <T>(state: () => IAPIDeleteState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, _onUpdateData: (data: T) => void, onUpdateItems: (data: T[]) => void, id: string | number, opts: IPageLoaderOptions<any> & IPageDeleteLoaderOptions) => Promise<void>;
5
- export declare const apiFetchHelper: <T>(state: () => IAPIFetchState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IPageOptions) => void, onUpdateItems: (items: T[]) => void, page: number, query: string, opts: IPageLoaderOptions<T> & IPageFetchLoaderOptions<any>) => Promise<void>;
6
- export declare const apiFindHelper: <T>(state: () => IAPIFindState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, id: string | number, opts: IPageLoaderOptions<T> & IPageFindLoaderOptions<Record<string, any>>) => Promise<void>;
5
+ export declare const apiFetchHelper: <T>(state: () => IAPIFetchState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IPageOptions) => void, onUpdateItems: (items: T[]) => void, page: number, query: string, opts: any) => Promise<void>;
6
+ export declare const apiFindHelper: <T>(state: () => IAPIFindState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, id: string | number, opts: any) => Promise<void>;
7
7
  export declare const updateHelper: <T>(state: () => IAPIUpdateState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: T) => void, _onUpdateItems: (data: T[]) => void, onUpdateOldData: (data: T) => void, id: string | number, data: any, opts: IPageLoaderOptions<any> & IPageUpdateLoaderOptions) => Promise<void>;
@@ -1,8 +1,10 @@
1
- import { NewRequester } from "../Requester.mjs";
2
- import { ObjectHelper } from "../../utils/ObjectHelper.mjs";
3
- import { _findIndex, _get, _shuffle } from "../../utils/lodash.mjs";
4
- import { ParamHelper } from "../../utils/ParamHelper.mjs";
5
- import { CONFIG } from "./config.mjs";
1
+ import { ObjectHelper } from "../utils/ObjectHelper.mjs";
2
+ import { ParamHelper } from "#core/utils/ParamHelper";
3
+ import { NewRequester } from "#core/lib/Requester";
4
+ import { _findIndex, _get, _shuffle } from "#core/utils/lodash";
5
+ import { mergeConfig } from "#ui/utils";
6
+ import { app } from "#core/core.config";
7
+ import appConfig from "#build/app.config";
6
8
  export const apiAddHelper = async (state, onUpdateStatus, onUpdateOptions, onUpdateData, onUpdateItems, data, opts) => {
7
9
  onUpdateStatus(ObjectHelper.toLoadingStatus(state().status));
8
10
  onUpdateOptions({});
@@ -88,6 +90,7 @@ export const apiDeleteHelper = async (state, onUpdateStatus, onUpdateOptions, _o
88
90
  onUpdateStatus(ObjectHelper.toCompleteStatus(state().status));
89
91
  };
90
92
  export const apiFetchHelper = async (state, onUpdateStatus, onUpdateOptions, onUpdateItems, page, query, opts) => {
93
+ const config = mergeConfig(appConfig.app.strategy, appConfig.app, app);
91
94
  const timestamp = state().options._timestamp;
92
95
  if (opts.expire && timestamp) {
93
96
  if (timestamp + opts.expire > Date.now()) {
@@ -117,7 +120,7 @@ export const apiFetchHelper = async (state, onUpdateStatus, onUpdateOptions, onU
117
120
  ...opts.getBaseRequestOptions?.() || {},
118
121
  ...opts.fetch?.getRequestOptions?.(page, query, opts) ?? {}
119
122
  };
120
- const limit = reqOptions.params?.limit || CONFIG.LIMIT_PER_PAGE;
123
+ const limit = reqOptions.params?.limit || config.limit_per_page;
121
124
  reqOptions.params = {
122
125
  limit,
123
126
  page,
@@ -1,13 +1,8 @@
1
1
  export interface IError {
2
- code: string
3
- message: any
2
+ code: string;
3
+ message: any;
4
4
  }
5
-
6
5
  export interface IOption {
7
- value: any
8
- label: string
9
- }
10
-
11
- interface IGetParams {
12
- params?: Record<string, any>
6
+ value: any;
7
+ label: string;
13
8
  }
@@ -1,102 +1,89 @@
1
- import { type AxiosRequestConfig } from 'axios'
2
-
1
+ import { type AxiosRequestConfig } from 'axios';
3
2
  export interface IAPIOptions {
4
- _status?: number
5
- _timestamp?: number
6
- request?: Partial<AxiosRequestConfig>
7
- [key: string]: any
3
+ _status?: number;
4
+ _timestamp?: number;
5
+ request?: Partial<AxiosRequestConfig>;
6
+ [key: string]: any;
8
7
  }
9
-
10
8
  export interface IPageOptions extends IAPIOptions {
11
- currentPageCount: number
12
- currentPage: number
13
- totalPage: number
14
- totalCount: number
15
- limit: number
16
- search?: string
17
- primary?: string
9
+ currentPageCount: number;
10
+ currentPage: number;
11
+ totalPage: number;
12
+ totalCount: number;
13
+ limit: number;
14
+ search?: string;
15
+ primary?: string;
18
16
  }
19
-
20
17
  export interface IStatus {
21
- isError: boolean
22
- isSuccess: boolean
23
- isLoading: boolean
24
- isLoaded: boolean
25
- errorData: any | null
18
+ isError: boolean;
19
+ isSuccess: boolean;
20
+ isLoading: boolean;
21
+ isLoaded: boolean;
22
+ errorData: any | null;
26
23
  }
27
-
28
24
  export interface IAPIFetchState<T> {
29
- items: T[]
30
- status: IStatus
31
- options: IPageOptions
25
+ items: T[];
26
+ status: IStatus;
27
+ options: IPageOptions;
32
28
  }
33
-
34
29
  export interface IAPIFindState<T> {
35
- data: T
36
- status: IStatus
37
- options: IAPIOptions
30
+ data: T;
31
+ status: IStatus;
32
+ options: IAPIOptions;
38
33
  }
39
-
40
34
  export interface IAPIAddState<T> {
41
- data: T
42
- items: T[]
43
- status: IStatus
44
- options: IAPIOptions
35
+ data: T;
36
+ items: T[];
37
+ status: IStatus;
38
+ options: IAPIOptions;
45
39
  }
46
-
47
40
  export interface IAPIObjectState<T> {
48
- data: T | null
49
- status: IStatus
50
- options: IAPIOptions
41
+ data: T | null;
42
+ status: IStatus;
43
+ options: IAPIOptions;
51
44
  }
52
-
53
45
  export interface IAPIListState<T> {
54
- items: T[]
55
- status: IStatus
56
- options: IAPIOptions
46
+ items: T[];
47
+ status: IStatus;
48
+ options: IAPIOptions;
57
49
  }
58
-
59
50
  export interface IAPIDeleteState<T> {
60
- data: T
61
- items: T[]
62
- status: IStatus
63
- options: IAPIOptions
51
+ data: T;
52
+ items: T[];
53
+ status: IStatus;
54
+ options: IAPIOptions;
64
55
  }
65
-
66
56
  export interface IAPIUpdateState<T> {
67
- data: T
68
- oldData: T
69
- items: T[] | undefined | null
70
- status: IStatus
71
- options: IAPIOptions
57
+ data: T;
58
+ oldData: T;
59
+ items: T[] | undefined | null;
60
+ status: IStatus;
61
+ options: IAPIOptions;
72
62
  }
73
-
74
63
  export interface IPageState<T> {
75
- deleteStatus: IStatus
76
- updateStatus: IStatus
77
- addStatus: IStatus
78
- findStatus: IStatus
79
- fetchStatus: IStatus
80
- fetchItems: T[]
81
- findItem: null | T
82
- addItem: null | T
83
- updateItem: null | T
84
- deleteItem: null | T | any
85
- findOptions: object
86
- addOptions: object
87
- deleteOptions: object
88
- updateOptions: object
89
- fetchOptions: IPageOptions
64
+ deleteStatus: IStatus;
65
+ updateStatus: IStatus;
66
+ addStatus: IStatus;
67
+ findStatus: IStatus;
68
+ fetchStatus: IStatus;
69
+ fetchItems: T[];
70
+ findItem: null | T;
71
+ addItem: null | T;
72
+ updateItem: null | T;
73
+ deleteItem: null | T | any;
74
+ findOptions: object;
75
+ addOptions: object;
76
+ deleteOptions: object;
77
+ updateOptions: object;
78
+ fetchOptions: IPageOptions;
90
79
  }
91
-
92
80
  export interface IObjectState<T> {
93
- data: T | null
94
- status: IStatus
95
- options: IAPIOptions
81
+ data: T | null;
82
+ status: IStatus;
83
+ options: IAPIOptions;
96
84
  }
97
-
98
85
  export interface IListState<T> {
99
- items: T[]
100
- status: IStatus
101
- options: IAPIOptions
86
+ items: T[];
87
+ status: IStatus;
88
+ options: IAPIOptions;
102
89
  }
File without changes
@@ -1,6 +1,6 @@
1
1
  import { type AxiosRequestConfig, type Method } from 'axios';
2
2
  import { type Ref, type UnwrapRef } from 'vue';
3
- import { type IAPIOptions, type IPageOptions, type IStatus } from '../../types/lib';
3
+ import { type IAPIOptions, type IPageOptions, type IStatus } from '~/src/runtime/types/lib';
4
4
  export interface IPageFetchLoaderOptions<D = Record<string, any>> {
5
5
  isMock?: boolean;
6
6
  params?: Record<string, any>;
File without changes
@@ -0,0 +1,9 @@
1
+ export type Strategy = 'merge' | 'override'
2
+
3
+ export type NestedKeyOf<ObjectType extends object> = {
4
+ [Key in keyof ObjectType]: ObjectType[Key] extends object ? NestedKeyOf<ObjectType[Key]> : Key
5
+ }[keyof ObjectType]
6
+
7
+ export type DeepPartial<T> = Partial<{
8
+ [P in keyof T]: DeepPartial<T[P]> | Record<string, string>
9
+ }>
@@ -1,6 +1,6 @@
1
- import { type IError, type IGetParams } from '../types/common';
1
+ import { type IError } from '../types/common';
2
2
  export declare class ParamHelper {
3
- static getParams: (opts: IGetParams, reqOptions: IGetParams) => Record<string, any> | undefined;
3
+ static getParams: (opts: IGetParams, reqOptions: IGetParams) => any;
4
4
  static getBoolTrue: (bool: any) => boolean;
5
5
  static getBoolFalse: (bool: any) => boolean;
6
6
  static isNotFoundError: (error: IError | any) => boolean;
package/dist/types.d.mts CHANGED
@@ -12,4 +12,4 @@ declare module 'nuxt/schema' {
12
12
  }
13
13
 
14
14
 
15
- export { ModuleOptions, default } from './module'
15
+ export { app } from './module'
package/dist/types.d.ts CHANGED
@@ -12,4 +12,4 @@ declare module 'nuxt/schema' {
12
12
  }
13
13
 
14
14
 
15
- export { ModuleOptions, default } from './module'
15
+ export { app } from './module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.2.2",
3
+ "version": "1.2.5",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Development Team",
@@ -33,10 +33,13 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@nuxt/kit": "^3.7.4",
36
+ "@nuxt/ui": "^2.9.0",
36
37
  "@pinia/nuxt": "^0.4.11",
38
+ "@vee-validate/nuxt": "^4.11.8",
37
39
  "axios": "^1.5.1",
38
40
  "dayjs": "^1.11.10",
39
41
  "lodash": "^4.17.21",
42
+ "nuxt-security": "^0.14.4",
40
43
  "pinia": "^2.1.6",
41
44
  "url-join": "^5.0.0"
42
45
  },
@@ -1,24 +0,0 @@
1
- import * as CoreLibs from '../lib';
2
- export declare const useLibs: () => {
3
- Requester: typeof CoreLibs.Requester;
4
- NewRequester: CoreLibs.IRequester;
5
- apiListHelper: <T, O>(state: () => import("../types/lib").IAPIListState<T>, onUpdateStatus: (status: import("../types/lib").IStatus) => void, onUpdateOptions: (options: import("../types/lib").IAPIOptions) => void, onUpdateItems: (data: T[]) => void, opts: CoreLibs.IListLoaderOptions<T, O> & CoreLibs.IListRunLoaderOptions<T, O>) => Promise<void>;
6
- apiObjectHelper: <T_1, B, O_1>(state: () => import("../types/lib").IAPIObjectState<T_1>, onUpdateStatus: (status: import("../types/lib").IStatus) => void, onUpdateOptions: (options: import("../types/lib").IAPIOptions) => void, onUpdateData: (data: any) => void, data: B | undefined, opts: CoreLibs.IObjectLoaderOptions<T_1, B, O_1> & CoreLibs.IObjectRunLoaderOptions<T_1, O_1>) => Promise<void>;
7
- apiAddHelper: <T_2>(state: () => import("../types/lib").IAPIAddState<T_2>, onUpdateStatus: (status: import("../types/lib").IStatus) => void, onUpdateOptions: (options: import("../types/lib").IAPIOptions) => void, onUpdateData: (data: any) => void, onUpdateItems: (data: any[]) => void, data: any, opts: CoreLibs.IPageLoaderOptions<any> & CoreLibs.IPageFetchLoaderOptions<Record<string, any>>) => Promise<void>;
8
- apiDeleteHelper: <T_3>(state: () => import("../types/lib").IAPIDeleteState<T_3>, onUpdateStatus: (status: import("../types/lib").IStatus) => void, onUpdateOptions: (options: import("../types/lib").IAPIOptions) => void, _onUpdateData: (data: T_3) => void, onUpdateItems: (data: T_3[]) => void, id: string | number, opts: CoreLibs.IPageLoaderOptions<any> & CoreLibs.IPageDeleteLoaderOptions<Record<string, any>>) => Promise<void>;
9
- apiFetchHelper: <T_4>(state: () => import("../types/lib").IAPIFetchState<T_4>, onUpdateStatus: (status: import("../types/lib").IStatus) => void, onUpdateOptions: (options: import("../types/lib").IPageOptions) => void, onUpdateItems: (items: T_4[]) => void, page: number, query: string, opts: CoreLibs.IPageLoaderOptions<T_4> & CoreLibs.IPageFetchLoaderOptions<any>) => Promise<void>;
10
- apiFindHelper: <T_5>(state: () => import("../types/lib").IAPIFindState<T_5>, onUpdateStatus: (status: import("../types/lib").IStatus) => void, onUpdateOptions: (options: import("../types/lib").IAPIOptions) => void, onUpdateData: (data: any) => void, id: string | number, opts: CoreLibs.IPageLoaderOptions<T_5> & CoreLibs.IPageFindLoaderOptions<Record<string, any>>) => Promise<void>;
11
- updateHelper: <T_6>(state: () => import("../types/lib").IAPIUpdateState<T_6>, onUpdateStatus: (status: import("../types/lib").IStatus) => void, onUpdateOptions: (options: import("../types/lib").IAPIOptions) => void, onUpdateData: (data: T_6) => void, _onUpdateItems: (data: T_6[]) => void, onUpdateOldData: (data: T_6) => void, id: string | number, data: any, opts: CoreLibs.IPageLoaderOptions<any> & CoreLibs.IPageUpdateLoaderOptions<Record<string, any>>) => Promise<void>;
12
- useListLoader: <T_7 = any, O_2 = Record<string, any>>(loaderOptions: CoreLibs.IListLoaderOptions<T_7, O_2>) => CoreLibs.IUseListLoader<T_7, O_2>;
13
- useObjectLoader: <T_8 = any, B_1 = any, O_3 = Record<string, any>>(loaderOptions: CoreLibs.IObjectLoaderOptions<T_8, B_1, O_3>) => CoreLibs.IUseObjectLoader<T_8, B_1, O_3>;
14
- initPageOptions: () => {
15
- currentPageCount: number;
16
- currentPage: number;
17
- totalPage: number;
18
- totalCount: number;
19
- limit: number;
20
- search: string;
21
- primary: string;
22
- };
23
- usePageLoader: <T_9 = any>(loaderOptions: CoreLibs.IPageLoaderOptions<T_9>) => CoreLibs.IUsePageLoader<T_9>;
24
- };
@@ -1,4 +0,0 @@
1
- import * as CoreLibs from "../lib/index.mjs";
2
- export const useLibs = () => {
3
- return { ...CoreLibs };
4
- };
@@ -1,10 +0,0 @@
1
- import { StringHelper } from '../utils/StringHelper';
2
- import { TimeHelper } from '../utils/TimeHelper';
3
- import { ParamHelper } from '../utils/ParamHelper';
4
- import { FileHelper } from '../utils/FileHelper';
5
- export declare const useUtils: () => {
6
- StringHelper: typeof StringHelper;
7
- TimeHelper: typeof TimeHelper;
8
- ParamHelper: typeof ParamHelper;
9
- FileHelper: typeof FileHelper;
10
- };
@@ -1,12 +0,0 @@
1
- import { StringHelper } from "../utils/StringHelper.mjs";
2
- import { TimeHelper } from "../utils/TimeHelper.mjs";
3
- import { ParamHelper } from "../utils/ParamHelper.mjs";
4
- import { FileHelper } from "../utils/FileHelper.mjs";
5
- export const useUtils = () => {
6
- return {
7
- StringHelper,
8
- TimeHelper,
9
- ParamHelper,
10
- FileHelper
11
- };
12
- };
@@ -1,4 +0,0 @@
1
- export declare const CONFIG: {
2
- LIMIT_PER_PAGE: number;
3
- DEFAULT_PRIMARY: string;
4
- };
@@ -1,4 +0,0 @@
1
- export const CONFIG = {
2
- LIMIT_PER_PAGE: 30,
3
- DEFAULT_PRIMARY: "id"
4
- };
@@ -1,8 +0,0 @@
1
- export * from './Requester';
2
- export * from './api/apiListHelper';
3
- export * from './api/apiObjectHelper';
4
- export * from './api/apiPageHelper';
5
- export * from './api/loaderList';
6
- export * from './api/loaderObject';
7
- export * from './api/loaderPage';
8
- export * from './api/loaderTypes';
@@ -1,8 +0,0 @@
1
- export * from "./Requester.mjs";
2
- export * from "./api/apiListHelper.mjs";
3
- export * from "./api/apiObjectHelper.mjs";
4
- export * from "./api/apiPageHelper.mjs";
5
- export * from "./api/loaderList.mjs";
6
- export * from "./api/loaderObject.mjs";
7
- export * from "./api/loaderPage.mjs";
8
- export * from "./api/loaderTypes.mjs";