@finema/core 1.2.2 → 1.3.0

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 (84) hide show
  1. package/README.md +32 -38
  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 +151 -4
  6. package/dist/runtime/components/Button/Group.vue +31 -0
  7. package/dist/runtime/components/Button/index.vue +17 -0
  8. package/dist/runtime/components/Dialog/index.vue +63 -0
  9. package/dist/runtime/components/Form/FieldWrapper.vue +10 -0
  10. package/dist/runtime/components/Form/Fields.vue +41 -0
  11. package/dist/runtime/components/Form/InputSelect/SelectMenu.vue +11 -0
  12. package/dist/runtime/components/Form/InputSelect/index.vue +11 -0
  13. package/dist/runtime/components/Form/InputStatic/index.vue +16 -0
  14. package/dist/runtime/components/Form/InputStatic/types.d.ts +4 -0
  15. package/dist/runtime/components/Form/InputText/index.vue +28 -0
  16. package/dist/runtime/components/Form/InputText/types.d.ts +10 -0
  17. package/dist/runtime/components/Form/InputText/types.mjs +0 -0
  18. package/dist/runtime/components/Form/InputToggle/index.vue +14 -0
  19. package/dist/runtime/components/Form/InputToggle/types.d.ts +6 -0
  20. package/dist/runtime/components/Form/InputToggle/types.mjs +0 -0
  21. package/dist/runtime/components/Form/index.vue +6 -0
  22. package/dist/runtime/components/Form/types.d.ts +47 -0
  23. package/dist/runtime/components/Form/types.mjs +8 -0
  24. package/dist/runtime/components/Icon.vue +11 -0
  25. package/dist/runtime/components/Loader.vue +6 -0
  26. package/dist/runtime/components/Modal/index.vue +145 -0
  27. package/dist/runtime/components/Slideover/index.vue +109 -0
  28. package/dist/runtime/components/Table/ColumnImage.vue +13 -0
  29. package/dist/runtime/components/Table/ColumnNumber.vue +14 -0
  30. package/dist/runtime/components/Table/index.vue +84 -0
  31. package/dist/runtime/components/Table/types.d.ts +57 -0
  32. package/dist/runtime/components/Table/types.mjs +10 -0
  33. package/dist/runtime/{lib/api → composables}/loaderList.d.ts +0 -1
  34. package/dist/runtime/{lib/api → composables}/loaderList.mjs +2 -2
  35. package/dist/runtime/{lib/api → composables}/loaderObject.d.ts +0 -1
  36. package/dist/runtime/{lib/api → composables}/loaderObject.mjs +2 -2
  37. package/dist/runtime/{lib/api → composables}/loaderPage.d.ts +4 -2
  38. package/dist/runtime/{lib/api → composables}/loaderPage.mjs +17 -8
  39. package/dist/runtime/composables/useConfig.d.ts +3 -0
  40. package/dist/runtime/composables/useConfig.mjs +9 -0
  41. package/dist/runtime/composables/useDialog.d.ts +26 -0
  42. package/dist/runtime/composables/useDialog.mjs +81 -0
  43. package/dist/runtime/composables/useForm.d.ts +24 -0
  44. package/dist/runtime/composables/useForm.mjs +44 -0
  45. package/dist/runtime/composables/useTable.d.ts +18 -0
  46. package/dist/runtime/composables/useTable.mjs +35 -0
  47. package/dist/runtime/composables/useWatch.d.ts +3 -0
  48. package/dist/runtime/composables/useWatch.mjs +22 -0
  49. package/dist/runtime/core.config.d.ts +4 -0
  50. package/dist/runtime/core.config.mjs +4 -0
  51. package/dist/runtime/{lib/api → helpers}/apiListHelper.d.ts +3 -3
  52. package/dist/runtime/{lib/api → helpers}/apiListHelper.mjs +3 -3
  53. package/dist/runtime/{lib/api → helpers}/apiObjectHelper.d.ts +3 -3
  54. package/dist/runtime/{lib/api → helpers}/apiObjectHelper.mjs +3 -3
  55. package/dist/runtime/{lib/api → helpers}/apiPageHelper.d.ts +4 -4
  56. package/dist/runtime/{lib/api → helpers}/apiPageHelper.mjs +7 -6
  57. package/dist/runtime/plugin.mjs +1 -1
  58. package/dist/runtime/types/common.d.ts +6 -8
  59. package/dist/runtime/types/common.mjs +0 -0
  60. package/dist/runtime/types/config.d.ts +1 -0
  61. package/dist/runtime/types/config.mjs +0 -0
  62. package/dist/runtime/types/lib.d.ts +63 -76
  63. package/dist/runtime/types/lib.mjs +0 -0
  64. package/dist/runtime/{lib/api → types}/loaderTypes.d.ts +1 -1
  65. package/dist/runtime/types/loaderTypes.mjs +0 -0
  66. package/dist/runtime/types/utils.d.ts +9 -0
  67. package/dist/runtime/ui.config.d.ts +2 -0
  68. package/dist/runtime/ui.config.mjs +44 -0
  69. package/dist/runtime/ui.css +14 -0
  70. package/dist/runtime/utils/StringHelper.mjs +1 -1
  71. package/dist/runtime/utils/lodash.d.ts +7 -0
  72. package/dist/runtime/utils/lodash.mjs +1 -0
  73. package/dist/types.d.mts +1 -1
  74. package/dist/types.d.ts +1 -1
  75. package/package.json +13 -12
  76. package/dist/runtime/composables/useLibs.d.ts +0 -24
  77. package/dist/runtime/composables/useLibs.mjs +0 -4
  78. package/dist/runtime/composables/useUtils.d.ts +0 -10
  79. package/dist/runtime/composables/useUtils.mjs +0 -12
  80. package/dist/runtime/lib/api/config.d.ts +0 -4
  81. package/dist/runtime/lib/api/config.mjs +0 -4
  82. package/dist/runtime/lib/index.d.ts +0 -8
  83. package/dist/runtime/lib/index.mjs +0 -8
  84. /package/dist/runtime/{lib/api/loaderTypes.mjs → components/Form/InputStatic/types.mjs} +0 -0
@@ -0,0 +1,81 @@
1
+ import { defineStore } from "pinia";
2
+ import { ref, useWatchFalse } from "#imports";
3
+ export var DialogType = /* @__PURE__ */ ((DialogType2) => {
4
+ DialogType2["ERROR"] = "error";
5
+ DialogType2["INFO"] = "info";
6
+ DialogType2["SUCCESS"] = "success";
7
+ DialogType2["WARNING"] = "warning";
8
+ return DialogType2;
9
+ })(DialogType || {});
10
+ export const useDialog = defineStore("_dialog", () => {
11
+ const isShow = ref(false);
12
+ const meta = ref(void 0);
13
+ const isReject = ref(false);
14
+ const proceed = ref(void 0);
15
+ const cancel = ref(void 0);
16
+ const openDialog = async (payload) => {
17
+ return new Promise((resolve, reject) => {
18
+ isShow.value = true;
19
+ meta.value = payload;
20
+ proceed.value = resolve;
21
+ cancel.value = reject;
22
+ });
23
+ };
24
+ const closeDialogProceed = () => {
25
+ isShow.value = false;
26
+ meta.value = void 0;
27
+ };
28
+ const closeDialogCancel = () => {
29
+ isShow.value = false;
30
+ meta.value = void 0;
31
+ isReject.value = true;
32
+ };
33
+ const error = async (payload) => {
34
+ return openDialog({
35
+ ...payload,
36
+ type: "error" /* ERROR */
37
+ });
38
+ };
39
+ const success = async (payload) => {
40
+ return openDialog({
41
+ ...payload,
42
+ type: "success" /* SUCCESS */
43
+ });
44
+ };
45
+ const info = async (payload) => {
46
+ return openDialog({
47
+ ...payload,
48
+ type: "info" /* INFO */
49
+ });
50
+ };
51
+ const warning = async (payload) => {
52
+ return openDialog({
53
+ ...payload,
54
+ type: "warning" /* WARNING */
55
+ });
56
+ };
57
+ useWatchFalse(
58
+ () => isShow.value,
59
+ (val) => {
60
+ if (isReject.value) {
61
+ cancel.value();
62
+ } else {
63
+ proceed.value();
64
+ }
65
+ proceed.value = void 0;
66
+ cancel.value = void 0;
67
+ isReject.value = false;
68
+ }
69
+ );
70
+ return {
71
+ isShow,
72
+ meta,
73
+ openDialog,
74
+ closeDialogCancel,
75
+ closeDialogProceed,
76
+ error,
77
+ success,
78
+ info,
79
+ warning
80
+ };
81
+ });
@@ -0,0 +1,24 @@
1
+ import { type DefineComponent, type ComputedRef } from 'vue';
2
+ import { type FieldContext, type FieldOptions } from 'vee-validate';
3
+ import { type IFormField } from '#core/components/Form/types';
4
+ export interface IFieldWrapperProps {
5
+ errorMessage?: string;
6
+ label?: string | any;
7
+ className?: any;
8
+ classInner?: any;
9
+ classInputInner?: any;
10
+ isRequired?: boolean;
11
+ isHideLabel?: boolean;
12
+ customErrorMessage?: string | DefineComponent;
13
+ name: string;
14
+ }
15
+ interface IFieldContext<TValue> extends FieldContext<TValue> {
16
+ isRequired: ComputedRef<boolean>;
17
+ onChange: (e: InputEvent) => void;
18
+ fieldClassName: ComputedRef<any[]>;
19
+ disabled: ComputedRef<boolean>;
20
+ wrapperProps: ComputedRef<IFieldWrapperProps>;
21
+ }
22
+ export declare const useFieldHOC: <TValue = unknown>(newFormProps: IFieldProps, opts?: Partial<FieldOptions<TValue>> | undefined) => IFieldContext<TValue>;
23
+ export declare const createFormFields: (fields: () => IFormField[]) => any;
24
+ export {};
@@ -0,0 +1,44 @@
1
+ import { useField } from "vee-validate";
2
+ import { toTypedSchema } from "@vee-validate/zod";
3
+ import { computed, toRef } from "#imports";
4
+ export const useFieldHOC = (newFormProps, opts) => {
5
+ const field = useField(toRef(newFormProps, "name"), toTypedSchema(newFormProps.rules), {
6
+ form: newFormProps.form,
7
+ ...opts
8
+ });
9
+ const isRequired = computed(() => false);
10
+ const onChange = (e) => {
11
+ const target = e.target;
12
+ const newValue = newFormProps.transform ? newFormProps.transform(target.value, field.value, e) : target.value;
13
+ target.value = newValue;
14
+ field.handleChange(newValue);
15
+ };
16
+ const fieldClassName = computed(() => {
17
+ return [
18
+ "form-control peer",
19
+ {
20
+ "input-error": !field.meta.valid && field.meta.dirty,
21
+ "input-success": field.meta.valid && field.meta.dirty
22
+ }
23
+ ];
24
+ });
25
+ return {
26
+ ...field,
27
+ isRequired,
28
+ onChange,
29
+ fieldClassName,
30
+ disabled: computed(() => newFormProps.isDisabled ?? newFormProps.isReadOnly ?? false),
31
+ wrapperProps: computed(() => ({
32
+ label: newFormProps.label,
33
+ errorMessage: field.errorMessage.value,
34
+ className: newFormProps.class,
35
+ classInner: newFormProps.classInner,
36
+ classInputInner: newFormProps.classInputInner,
37
+ isRequired: isRequired.value,
38
+ isHideLabel: newFormProps.isHideLabel,
39
+ customErrorMessage: newFormProps.customErrorMessage,
40
+ name: newFormProps.name
41
+ }))
42
+ };
43
+ };
44
+ export const createFormFields = (fields) => computed(fields);
@@ -0,0 +1,18 @@
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
+ options?: (() => Partial<ITableOptions<T>>) | Partial<ITableOptions<T>>;
9
+ }
10
+ export interface IUseSimpleTable<T = object> {
11
+ items: () => T[];
12
+ status?: () => IStatus;
13
+ columns: () => IColumn[];
14
+ options?: (() => Partial<ISimpleTableOptions<T>>) | Partial<ISimpleTableOptions<T>>;
15
+ }
16
+ export declare const useTable: <T = object>(options: IUseTable<T>) => ComputedRef<ITableOptions<T>>;
17
+ export declare const useSimpleTable: <T = object>(options: IUseSimpleTable<T>) => ComputedRef<ISimpleTableOptions<T>>;
18
+ export declare const createTableOptions: <T = object>(repo: IUsePageLoader<T>, columns: IColumn[], rows: IRow[], options: ITableOptions<T>) => ITableOptions<T>;
@@ -0,0 +1,35 @@
1
+ import { get } from "@vueuse/core";
2
+ import { computed, ObjectHelper } from "#imports";
3
+ import { useCoreConfig } from "./useConfig.mjs";
4
+ export const useTable = (options) => computed(() => {
5
+ return createTableOptions(
6
+ options.repo,
7
+ options.columns(),
8
+ get(options.repo.fetchItems),
9
+ typeof options.options === "function" ? options.options() : options.options ?? {}
10
+ );
11
+ });
12
+ export const useSimpleTable = (options) => computed(() => {
13
+ const config = useCoreConfig();
14
+ return {
15
+ items: options.items(),
16
+ columns: options.columns(),
17
+ rawData: options.items(),
18
+ status: options.status ? options.status() : ObjectHelper.createStatus(),
19
+ primary: config.default_primary_key,
20
+ ...typeof options.options === "function" ? options.options() : options.options ?? {}
21
+ };
22
+ });
23
+ export const createTableOptions = (repo, columns, rows, options) => {
24
+ const config = useCoreConfig();
25
+ return {
26
+ rawData: get(repo.fetchItems),
27
+ pageOptions: get(repo.fetchOptions),
28
+ columns,
29
+ status: get(repo.fetchStatus),
30
+ deleteStatus: get(repo.deleteStatus),
31
+ primary: get(repo.fetchOptions).primary ?? config.default_primary_key,
32
+ isNotChangeRoute: false,
33
+ ...options
34
+ };
35
+ };
@@ -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 core: {
2
+ limit_per_page: number;
3
+ default_primary_key: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export const core = {
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,8 @@
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 { useCoreConfig } from "../composables/useConfig.mjs";
6
6
  export const apiAddHelper = async (state, onUpdateStatus, onUpdateOptions, onUpdateData, onUpdateItems, data, opts) => {
7
7
  onUpdateStatus(ObjectHelper.toLoadingStatus(state().status));
8
8
  onUpdateOptions({});
@@ -88,6 +88,7 @@ export const apiDeleteHelper = async (state, onUpdateStatus, onUpdateOptions, _o
88
88
  onUpdateStatus(ObjectHelper.toCompleteStatus(state().status));
89
89
  };
90
90
  export const apiFetchHelper = async (state, onUpdateStatus, onUpdateOptions, onUpdateItems, page, query, opts) => {
91
+ const config = useCoreConfig();
91
92
  const timestamp = state().options._timestamp;
92
93
  if (opts.expire && timestamp) {
93
94
  if (timestamp + opts.expire > Date.now()) {
@@ -117,7 +118,7 @@ export const apiFetchHelper = async (state, onUpdateStatus, onUpdateOptions, onU
117
118
  ...opts.getBaseRequestOptions?.() || {},
118
119
  ...opts.fetch?.getRequestOptions?.(page, query, opts) ?? {}
119
120
  };
120
- const limit = reqOptions.params?.limit || CONFIG.LIMIT_PER_PAGE;
121
+ const limit = reqOptions.params?.limit || config.limit_per_page;
121
122
  reqOptions.params = {
122
123
  limit,
123
124
  page,
@@ -1,4 +1,4 @@
1
1
  import { defineNuxtPlugin } from "#app";
2
2
  export default defineNuxtPlugin((nuxtApp) => {
3
- console.log("Plugin injected by finema ui module!");
3
+ console.log("Plugin injected by @finema/core module!");
4
4
  });
@@ -1,13 +1,11 @@
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
6
+ value: any;
7
+ label: string;
9
8
  }
10
-
11
- interface IGetParams {
12
- params?: Record<string, any>
9
+ export interface IGetParams {
10
+ params?: Record<string, any>;
13
11
  }
File without changes
@@ -0,0 +1 @@
1
+ export type UIComponentList = 'modal' | 'slideover';
File without changes
@@ -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
+ }>
@@ -0,0 +1,2 @@
1
+ export declare const modal: any;
2
+ export declare const slideover: any;
@@ -0,0 +1,44 @@
1
+ import { modal as inheritModal, slideover as inheritSlideover } from "#ui/ui.config";
2
+ export const modal = {
3
+ ...inheritModal,
4
+ header: "px-4 py-2 border-b",
5
+ innerWrapper: "p-4",
6
+ size: {
7
+ sm: "sm:max-w-sm",
8
+ md: "sm:max-w-lg",
9
+ lg: "sm:max-w-2xl",
10
+ xl: "sm:max-w-4xl"
11
+ },
12
+ position: {
13
+ top: "flex min-h-full items-end sm:items-start justify-center text-center",
14
+ center: "flex min-h-full items-end sm:items-center justify-center text-center",
15
+ bottom: "flex min-h-full items-end sm:items-end justify-center text-center"
16
+ },
17
+ fixHeightSize: {
18
+ default: "max-h-[calc(100vh-4rem)]",
19
+ sm: "max-h-[256px]",
20
+ md: "max-h-[512px]",
21
+ lg: "max-h-[768px]",
22
+ xl: "max-h-[1024px]"
23
+ },
24
+ default: {
25
+ size: "md",
26
+ position: "center",
27
+ fixHeightSize: "default"
28
+ }
29
+ };
30
+ export const slideover = {
31
+ ...inheritSlideover,
32
+ bodyWrapper: "p-4",
33
+ size: {
34
+ sm: "w-screen max-w-xs",
35
+ md: "w-screen max-w-md",
36
+ lg: "w-screen max-w-xl",
37
+ xl: "w-screen max-w-2xl",
38
+ half: "w-screen max-w-[calc(100vw/2)]",
39
+ full: "w-screen max-w-full"
40
+ },
41
+ default: {
42
+ size: "md"
43
+ }
44
+ };
@@ -0,0 +1,14 @@
1
+ :root {
2
+ --color-primary-50: 248 248 255;
3
+ --color-primary-100: 232 239 253;
4
+ --color-primary-200: 190 227 248;
5
+ --color-primary-300: 144 205 244;
6
+ --color-primary-400: 99 179 237;
7
+ --color-primary-500: 54 117 251;
8
+ --color-primary-600: 0 104 254;
9
+ --color-primary-700: 43 108 176;
10
+ --color-primary-800: 44 82 130;
11
+ --color-primary-900: 32 36 62;
12
+ --color-primary-950: 32 36 62;
13
+ --color-primary-DEFAULT: 54 117 251;
14
+ }
@@ -33,7 +33,7 @@ export class StringHelper {
33
33
  if (errorData.code !== "INVALID_PARAMS" && !errorData.fields) {
34
34
  return msg;
35
35
  }
36
- for (const [_, value] of Object.entries(errorData.fields)) {
36
+ for (const [, value] of Object.entries(errorData.fields)) {
37
37
  msg = value.message;
38
38
  }
39
39
  return msg;
@@ -43,6 +43,13 @@ export declare const _map: {
43
43
  <T_5>(collection: lodash.Dictionary<T_5> | lodash.NumericDictionary<T_5> | null | undefined, iteratee?: string | undefined): any[];
44
44
  <T_6>(collection: lodash.Dictionary<T_6> | lodash.NumericDictionary<T_6> | null | undefined, iteratee?: object | undefined): boolean[];
45
45
  };
46
+ export declare const _merge: {
47
+ <TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
48
+ <TObject_1, TSource1, TSource2>(object: TObject_1, source1: TSource1, source2: TSource2): TObject_1 & TSource1 & TSource2;
49
+ <TObject_2, TSource1_1, TSource2_1, TSource3>(object: TObject_2, source1: TSource1_1, source2: TSource2_1, source3: TSource3): TObject_2 & TSource1_1 & TSource2_1 & TSource3;
50
+ <TObject_3, TSource1_2, TSource2_2, TSource3_1, TSource4>(object: TObject_3, source1: TSource1_2, source2: TSource2_2, source3: TSource3_1, source4: TSource4): TObject_3 & TSource1_2 & TSource2_2 & TSource3_1 & TSource4;
51
+ (object: any, ...otherArgs: any[]): any;
52
+ };
46
53
  export declare const _flatDeep: <T>(array: lodash.ListOfRecursiveArraysOrValues<T> | null | undefined) => lodash.Flat<T>[];
47
54
  export declare const _uniq: <T>(array: lodash.List<T> | null | undefined) => T[];
48
55
  export declare const _sortBy: {