@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.
- package/README.md +32 -38
- package/dist/module.d.mts +30 -0
- package/dist/module.d.ts +30 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +151 -4
- package/dist/runtime/components/Button/Group.vue +31 -0
- package/dist/runtime/components/Button/index.vue +17 -0
- package/dist/runtime/components/Dialog/index.vue +63 -0
- package/dist/runtime/components/Form/FieldWrapper.vue +10 -0
- package/dist/runtime/components/Form/Fields.vue +41 -0
- package/dist/runtime/components/Form/InputSelect/SelectMenu.vue +11 -0
- package/dist/runtime/components/Form/InputSelect/index.vue +11 -0
- package/dist/runtime/components/Form/InputStatic/index.vue +16 -0
- package/dist/runtime/components/Form/InputStatic/types.d.ts +4 -0
- package/dist/runtime/components/Form/InputText/index.vue +28 -0
- package/dist/runtime/components/Form/InputText/types.d.ts +10 -0
- package/dist/runtime/components/Form/InputText/types.mjs +0 -0
- package/dist/runtime/components/Form/InputToggle/index.vue +14 -0
- package/dist/runtime/components/Form/InputToggle/types.d.ts +6 -0
- package/dist/runtime/components/Form/InputToggle/types.mjs +0 -0
- package/dist/runtime/components/Form/index.vue +6 -0
- package/dist/runtime/components/Form/types.d.ts +47 -0
- package/dist/runtime/components/Form/types.mjs +8 -0
- package/dist/runtime/components/Icon.vue +11 -0
- package/dist/runtime/components/Loader.vue +6 -0
- package/dist/runtime/components/Modal/index.vue +145 -0
- package/dist/runtime/components/Slideover/index.vue +109 -0
- package/dist/runtime/components/Table/ColumnImage.vue +13 -0
- package/dist/runtime/components/Table/ColumnNumber.vue +14 -0
- package/dist/runtime/components/Table/index.vue +84 -0
- package/dist/runtime/components/Table/types.d.ts +57 -0
- package/dist/runtime/components/Table/types.mjs +10 -0
- package/dist/runtime/{lib/api → composables}/loaderList.d.ts +0 -1
- package/dist/runtime/{lib/api → composables}/loaderList.mjs +2 -2
- package/dist/runtime/{lib/api → composables}/loaderObject.d.ts +0 -1
- package/dist/runtime/{lib/api → composables}/loaderObject.mjs +2 -2
- package/dist/runtime/{lib/api → composables}/loaderPage.d.ts +4 -2
- package/dist/runtime/{lib/api → composables}/loaderPage.mjs +17 -8
- package/dist/runtime/composables/useConfig.d.ts +3 -0
- package/dist/runtime/composables/useConfig.mjs +9 -0
- package/dist/runtime/composables/useDialog.d.ts +26 -0
- package/dist/runtime/composables/useDialog.mjs +81 -0
- package/dist/runtime/composables/useForm.d.ts +24 -0
- package/dist/runtime/composables/useForm.mjs +44 -0
- package/dist/runtime/composables/useTable.d.ts +18 -0
- package/dist/runtime/composables/useTable.mjs +35 -0
- package/dist/runtime/composables/useWatch.d.ts +3 -0
- package/dist/runtime/composables/useWatch.mjs +22 -0
- package/dist/runtime/core.config.d.ts +4 -0
- package/dist/runtime/core.config.mjs +4 -0
- package/dist/runtime/{lib/api → helpers}/apiListHelper.d.ts +3 -3
- package/dist/runtime/{lib/api → helpers}/apiListHelper.mjs +3 -3
- package/dist/runtime/{lib/api → helpers}/apiObjectHelper.d.ts +3 -3
- package/dist/runtime/{lib/api → helpers}/apiObjectHelper.mjs +3 -3
- package/dist/runtime/{lib/api → helpers}/apiPageHelper.d.ts +4 -4
- package/dist/runtime/{lib/api → helpers}/apiPageHelper.mjs +7 -6
- package/dist/runtime/plugin.mjs +1 -1
- package/dist/runtime/types/common.d.ts +6 -8
- package/dist/runtime/types/common.mjs +0 -0
- package/dist/runtime/types/config.d.ts +1 -0
- package/dist/runtime/types/config.mjs +0 -0
- package/dist/runtime/types/lib.d.ts +63 -76
- package/dist/runtime/types/lib.mjs +0 -0
- package/dist/runtime/{lib/api → types}/loaderTypes.d.ts +1 -1
- package/dist/runtime/types/loaderTypes.mjs +0 -0
- package/dist/runtime/types/utils.d.ts +9 -0
- package/dist/runtime/ui.config.d.ts +2 -0
- package/dist/runtime/ui.config.mjs +44 -0
- package/dist/runtime/ui.css +14 -0
- package/dist/runtime/utils/StringHelper.mjs +1 -1
- package/dist/runtime/utils/lodash.d.ts +7 -0
- package/dist/runtime/utils/lodash.mjs +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +13 -12
- package/dist/runtime/composables/useLibs.d.ts +0 -24
- package/dist/runtime/composables/useLibs.mjs +0 -4
- package/dist/runtime/composables/useUtils.d.ts +0 -10
- package/dist/runtime/composables/useUtils.mjs +0 -12
- package/dist/runtime/lib/api/config.d.ts +0 -4
- package/dist/runtime/lib/api/config.mjs +0 -4
- package/dist/runtime/lib/index.d.ts +0 -8
- package/dist/runtime/lib/index.mjs +0 -8
- /package/dist/runtime/{lib/api/loaderTypes.mjs → components/Form/InputStatic/types.mjs} +0 -0
package/README.md
CHANGED
|
@@ -1,31 +1,40 @@
|
|
|
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
1
|
# @finema/core Nuxt Module
|
|
11
2
|
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- [
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
[✨ Release Notes](/CHANGELOG.md)
|
|
4
|
+
|
|
5
|
+
## Todos
|
|
6
|
+
|
|
7
|
+
- [ ] Loader
|
|
8
|
+
- [ ] Button
|
|
9
|
+
- [ ] Table
|
|
10
|
+
- [ ] Icon
|
|
11
|
+
- [ ] Badge
|
|
12
|
+
- [ ] Status
|
|
13
|
+
- Form
|
|
14
|
+
- [ ] Static
|
|
15
|
+
- [ ] Input
|
|
16
|
+
- [ ] Textarea
|
|
17
|
+
- [ ] Select
|
|
18
|
+
- [ ] Select multi
|
|
19
|
+
- [ ] Checkbox
|
|
20
|
+
- [ ] radio
|
|
21
|
+
- [ ] toggle
|
|
22
|
+
- [ ] datetime
|
|
23
|
+
- [ ] upload
|
|
24
|
+
- [ ] upload multi
|
|
25
|
+
- [ ] Modal
|
|
26
|
+
- [ ] Notification
|
|
27
|
+
- [ ] Card
|
|
28
|
+
- [ ] Tab
|
|
29
|
+
- [ ] Alert
|
|
30
|
+
- [ ] Container
|
|
31
|
+
- [ ] Dropdown
|
|
22
32
|
|
|
23
33
|
## Features
|
|
24
34
|
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- 🌲 Baz
|
|
35
|
+
- UI components
|
|
36
|
+
- Useful composables
|
|
37
|
+
- Security
|
|
29
38
|
|
|
30
39
|
## Quick Setup
|
|
31
40
|
|
|
@@ -38,8 +47,6 @@ pnpm add -D @finema/core
|
|
|
38
47
|
# Using yarn
|
|
39
48
|
yarn add --dev @finema/core
|
|
40
49
|
|
|
41
|
-
# Using npm
|
|
42
|
-
npm install --save-dev @finema/core
|
|
43
50
|
```
|
|
44
51
|
|
|
45
52
|
1. Add `@finema/core` to the `modules` section of `nuxt.config.ts`
|
|
@@ -79,16 +86,3 @@ npm run test:watch
|
|
|
79
86
|
# Release new version
|
|
80
87
|
npm run release
|
|
81
88
|
```
|
|
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 core: {
|
|
4
|
+
limit_per_page: number;
|
|
5
|
+
default_primary_key: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare const config_core: typeof core;
|
|
9
|
+
declare namespace config {
|
|
10
|
+
export { config_core as core };
|
|
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 core: {
|
|
4
|
+
limit_per_page: number;
|
|
5
|
+
default_primary_key: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare const config_core: typeof core;
|
|
9
|
+
declare namespace config {
|
|
10
|
+
export { config_core as core };
|
|
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
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,89 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addPlugin, addImportsDir } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, installModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
+
import * as lodash from 'lodash';
|
|
2
3
|
|
|
3
4
|
const name = "@finema/core";
|
|
4
|
-
const version = "1.
|
|
5
|
+
const version = "1.3.0";
|
|
6
|
+
|
|
7
|
+
const _merge = lodash.merge;
|
|
8
|
+
|
|
9
|
+
const colors = {
|
|
10
|
+
black: "#20243E",
|
|
11
|
+
white: "#FFFFFF",
|
|
12
|
+
dark: {
|
|
13
|
+
DEFAULT: "#20243E",
|
|
14
|
+
50: "#6D7280",
|
|
15
|
+
100: "#505050"
|
|
16
|
+
},
|
|
17
|
+
light: {
|
|
18
|
+
DEFAULT: "#FAFAFA"
|
|
19
|
+
},
|
|
20
|
+
gray: {
|
|
21
|
+
DEFAULT: "#9095A6",
|
|
22
|
+
disabled: "#C1C4D0",
|
|
23
|
+
border: "#E2E4EA",
|
|
24
|
+
fill: "#F4F5FA"
|
|
25
|
+
},
|
|
26
|
+
customPrimary: {
|
|
27
|
+
DEFAULT: "#3675FB",
|
|
28
|
+
50: "#F8F8FF",
|
|
29
|
+
100: "#E8EFFD",
|
|
30
|
+
200: "#bee3f8",
|
|
31
|
+
300: "#90cdf4",
|
|
32
|
+
400: "#63b3ed",
|
|
33
|
+
500: "#3675FB",
|
|
34
|
+
600: "#0068FE",
|
|
35
|
+
700: "#2b6cb0",
|
|
36
|
+
800: "#2c5282",
|
|
37
|
+
900: "#20243E",
|
|
38
|
+
950: "#20243E"
|
|
39
|
+
},
|
|
40
|
+
secondary: {
|
|
41
|
+
DEFAULT: "#EE8B36",
|
|
42
|
+
50: "#fdf1e7",
|
|
43
|
+
100: "#f9d6b8",
|
|
44
|
+
200: "#f5bb89",
|
|
45
|
+
300: "#f1a05a",
|
|
46
|
+
400: "#ed852b",
|
|
47
|
+
500: "#d46b12",
|
|
48
|
+
600: "#a5540e",
|
|
49
|
+
700: "#763c0a",
|
|
50
|
+
800: "#472406",
|
|
51
|
+
900: "#180c02"
|
|
52
|
+
},
|
|
53
|
+
info: {
|
|
54
|
+
DEFAULT: "#F64976",
|
|
55
|
+
50: "#FFEBF0",
|
|
56
|
+
100: "#F87395",
|
|
57
|
+
400: "#F87395",
|
|
58
|
+
500: "#F87395"
|
|
59
|
+
},
|
|
60
|
+
danger: {
|
|
61
|
+
DEFAULT: "#FF4C4C",
|
|
62
|
+
50: "#ffe5e5",
|
|
63
|
+
100: "#FF4C4C",
|
|
64
|
+
400: "#FF4C4C",
|
|
65
|
+
500: "#FF4C4C"
|
|
66
|
+
},
|
|
67
|
+
success: {
|
|
68
|
+
DEFAULT: "#01B460",
|
|
69
|
+
50: "#E2FFF0",
|
|
70
|
+
100: "#52CB8C",
|
|
71
|
+
400: "#52CB8C",
|
|
72
|
+
500: "#52CB8C"
|
|
73
|
+
},
|
|
74
|
+
warning: {
|
|
75
|
+
DEFAULT: "#EE7336",
|
|
76
|
+
50: "#FFEBE2",
|
|
77
|
+
100: "#FF864B",
|
|
78
|
+
400: "#FF864B",
|
|
79
|
+
500: "#FF864B"
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const ui = {
|
|
84
|
+
primary: "customPrimary",
|
|
85
|
+
safelistColors: ["secondary"]
|
|
86
|
+
};
|
|
5
87
|
|
|
6
88
|
const module = defineNuxtModule({
|
|
7
89
|
meta: {
|
|
@@ -9,19 +91,84 @@ const module = defineNuxtModule({
|
|
|
9
91
|
version,
|
|
10
92
|
configKey: "core",
|
|
11
93
|
compatibility: {
|
|
12
|
-
nuxt: "^3.4
|
|
94
|
+
nuxt: "^3.7.4"
|
|
13
95
|
}
|
|
14
96
|
},
|
|
15
97
|
// Default configuration options of the Nuxt module
|
|
16
98
|
defaults: {},
|
|
17
|
-
setup(options, nuxt) {
|
|
99
|
+
async setup(options, nuxt) {
|
|
18
100
|
const { resolve } = createResolver(import.meta.url);
|
|
19
101
|
const runtimeDir = resolve("./runtime");
|
|
20
102
|
nuxt.options.build.transpile.push(runtimeDir);
|
|
103
|
+
nuxt.options.alias["#core"] = runtimeDir;
|
|
104
|
+
nuxt.options.css.push(resolve(runtimeDir, "ui.css"));
|
|
105
|
+
nuxt.options.appConfig.app = {
|
|
106
|
+
strategy: "merge"
|
|
107
|
+
};
|
|
108
|
+
nuxt.hook("tailwindcss:config", (tailwindConfig) => {
|
|
109
|
+
tailwindConfig.content = {
|
|
110
|
+
...tailwindConfig.content,
|
|
111
|
+
files: [
|
|
112
|
+
...tailwindConfig.content.files,
|
|
113
|
+
resolve(runtimeDir, "components/**/*.{vue,mjs,ts}"),
|
|
114
|
+
resolve(runtimeDir, "*.{mjs,js,ts}")
|
|
115
|
+
]
|
|
116
|
+
};
|
|
117
|
+
tailwindConfig.theme.extend.colors = {
|
|
118
|
+
...tailwindConfig.theme.extend.colors,
|
|
119
|
+
...colors
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
nuxt.options.appConfig.ui = _merge(ui, nuxt.options.appConfig.ui);
|
|
123
|
+
await installModule("@nuxt/ui");
|
|
124
|
+
await installModule("@pinia/nuxt");
|
|
125
|
+
await installModule("@vee-validate/nuxt", {
|
|
126
|
+
// disable or enable auto imports
|
|
127
|
+
autoImports: true,
|
|
128
|
+
// Use different names for components
|
|
129
|
+
componentNames: {
|
|
130
|
+
Form: "VForm",
|
|
131
|
+
Field: "VField",
|
|
132
|
+
FieldArray: "VFieldArray",
|
|
133
|
+
ErrorMessage: "VErrorMessage"
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
await installModule("nuxt-security", {
|
|
137
|
+
headers: {
|
|
138
|
+
xXSSProtection: "1; mode=block",
|
|
139
|
+
crossOriginEmbedderPolicy: "unsafe-none",
|
|
140
|
+
contentSecurityPolicy: {
|
|
141
|
+
"img-src": ["*", "'self'", "data:", "https"],
|
|
142
|
+
"script-src": [
|
|
143
|
+
"'self'",
|
|
144
|
+
"'unsafe-inline'",
|
|
145
|
+
"https://www.google-analytics.com",
|
|
146
|
+
"https://www.googletagmanager.com",
|
|
147
|
+
"https://fonts.googleapis.com",
|
|
148
|
+
"https://cdnjs.cloudflare.com"
|
|
149
|
+
],
|
|
150
|
+
"script-src-attr": [
|
|
151
|
+
"'unsafe-inline'",
|
|
152
|
+
"https://www.google-analytics.com",
|
|
153
|
+
"https://www.googletagmanager.com",
|
|
154
|
+
"https://fonts.googleapis.com",
|
|
155
|
+
"https://cdnjs.cloudflare.com"
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
21
160
|
addPlugin({
|
|
22
161
|
src: resolve(runtimeDir, "plugin")
|
|
23
162
|
});
|
|
163
|
+
void addComponentsDir({
|
|
164
|
+
path: resolve(runtimeDir, "components"),
|
|
165
|
+
prefix: options.prefix,
|
|
166
|
+
global: options.global,
|
|
167
|
+
watch: false
|
|
168
|
+
});
|
|
24
169
|
addImportsDir(resolve(runtimeDir, "composables"));
|
|
170
|
+
addImportsDir(resolve(runtimeDir, "utils"));
|
|
171
|
+
addImportsDir(resolve(runtimeDir, "types"));
|
|
25
172
|
}
|
|
26
173
|
});
|
|
27
174
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<UButtonGroup v-bind="$attrs">
|
|
4
|
+
<Button label="Button" />
|
|
5
|
+
<Button color="blue" size="xs">
|
|
6
|
+
<svg
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
fill="none"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
stroke-width="1.5"
|
|
11
|
+
stroke="currentColor"
|
|
12
|
+
class="h-3 w-3"
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
stroke-linecap="round"
|
|
16
|
+
stroke-linejoin="round"
|
|
17
|
+
d="M19.5 13.5L12 21m0 0l-7.5-7.5M12 21V3"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
</Button>
|
|
21
|
+
</UButtonGroup>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
defineOptions({
|
|
27
|
+
inheritAttrs: true,
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style></style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UButton v-bind="$attrs">
|
|
3
|
+
<template #leading>
|
|
4
|
+
<slot name="leading" />
|
|
5
|
+
</template>
|
|
6
|
+
<slot />
|
|
7
|
+
|
|
8
|
+
<template #trailing>
|
|
9
|
+
<slot name="trailing" />
|
|
10
|
+
</template>
|
|
11
|
+
</UButton>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
defineOptions({
|
|
15
|
+
inheritAttrs: true,
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal v-if="dialog.meta?.type" v-model="dialog.isShow" class="dialog" prevent-close>
|
|
3
|
+
<div :class="['flex items-center pt-8', { 'flex-col': !dialog.meta.isShowCancelBtn }]">
|
|
4
|
+
<div
|
|
5
|
+
:class="[
|
|
6
|
+
{
|
|
7
|
+
'text-warning': dialog.meta?.type === DialogType.WARNING,
|
|
8
|
+
'text-danger': dialog.meta?.type === DialogType.ERROR,
|
|
9
|
+
'text-info': dialog.meta?.type === DialogType.INFO,
|
|
10
|
+
'text-success': dialog.meta?.type === DialogType.SUCCESS,
|
|
11
|
+
'mr-4': dialog.meta.isShowCancelBtn,
|
|
12
|
+
},
|
|
13
|
+
]"
|
|
14
|
+
>
|
|
15
|
+
<em v-if="dialog.meta?.type === 'success'" class="ic ic-check-circle-solid dialog-icon" />
|
|
16
|
+
<em v-if="dialog.meta?.type === 'info'" class="ic ic-info-circle-solid dialog-icon" />
|
|
17
|
+
<em
|
|
18
|
+
v-if="dialog.meta?.type === 'warning'"
|
|
19
|
+
class="ic ic-exclamation-triangle-solid dialog-icon"
|
|
20
|
+
/>
|
|
21
|
+
<em v-if="dialog.meta?.type === 'error'" class="ic ic-x-circle-solid dialog-icon" />
|
|
22
|
+
</div>
|
|
23
|
+
<div :class="['flex w-full flex-col', { 'mt-4 text-center': !dialog.meta.isShowCancelBtn }]">
|
|
24
|
+
<h3 class="dialog-title">
|
|
25
|
+
{{ dialog.meta?.title }}
|
|
26
|
+
</h3>
|
|
27
|
+
<p class="dialog-message">
|
|
28
|
+
{{ dialog.meta?.message }}
|
|
29
|
+
</p>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div :class="['mt-5 flex', dialog.meta.isShowCancelBtn ? 'justify-end' : 'justify-center ']">
|
|
34
|
+
<Button
|
|
35
|
+
v-if="dialog.meta?.isShowCancelBtn"
|
|
36
|
+
class="text-gray mr-4"
|
|
37
|
+
type="button"
|
|
38
|
+
@click="dialog.closeDialogCancel"
|
|
39
|
+
>
|
|
40
|
+
{{ dialog.meta?.cancelText || 'ยกเลิก' }}
|
|
41
|
+
</Button>
|
|
42
|
+
<Button
|
|
43
|
+
:class="[
|
|
44
|
+
{
|
|
45
|
+
'btn-success': dialog.meta?.type === DialogType.SUCCESS,
|
|
46
|
+
'btn-danger': dialog.meta?.type === DialogType.ERROR,
|
|
47
|
+
'btn-info': dialog.meta?.type === DialogType.INFO,
|
|
48
|
+
'btn-warning': dialog.meta?.type === DialogType.WARNING,
|
|
49
|
+
'mr-3': dialog.meta.isShowCancelBtn,
|
|
50
|
+
},
|
|
51
|
+
]"
|
|
52
|
+
@click="dialog.closeDialogProceed"
|
|
53
|
+
>
|
|
54
|
+
{{ dialog.meta?.confirmText || 'ตกลง' }}
|
|
55
|
+
</Button>
|
|
56
|
+
</div>
|
|
57
|
+
</Modal>
|
|
58
|
+
</template>
|
|
59
|
+
<script lang="tsx" setup>
|
|
60
|
+
import { DialogType, useDialog } from '#core/composables/useDialog'
|
|
61
|
+
|
|
62
|
+
const dialog = useDialog()
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UFormGroup :label="label" :name="name" :error="errorMessage" :required="!!isRequired">
|
|
3
|
+
<slot />
|
|
4
|
+
</UFormGroup>
|
|
5
|
+
</template>
|
|
6
|
+
<script lang="ts" setup>
|
|
7
|
+
import { type IFieldWrapperProps } from '#core/composables/useForm'
|
|
8
|
+
|
|
9
|
+
defineProps<IFieldWrapperProps>()
|
|
10
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="fields">
|
|
3
|
+
<template v-for="(option, index) in options" :key="option.props.name + index + option.type">
|
|
4
|
+
<div v-if="!option.isHide" :class="option.class">
|
|
5
|
+
<FormInputStatic
|
|
6
|
+
v-if="option.type === INPUT_TYPES.STATIC"
|
|
7
|
+
:form="form"
|
|
8
|
+
v-bind="option.props"
|
|
9
|
+
v-on="option.on ?? {}"
|
|
10
|
+
/>
|
|
11
|
+
<FormInputText
|
|
12
|
+
v-if="option.type === INPUT_TYPES.TEXT"
|
|
13
|
+
:form="form"
|
|
14
|
+
v-bind="option.props"
|
|
15
|
+
v-on="option.on ?? {}"
|
|
16
|
+
/>
|
|
17
|
+
<FormInputToggle
|
|
18
|
+
v-if="option.type === INPUT_TYPES.TOGGLE"
|
|
19
|
+
:form="form"
|
|
20
|
+
v-bind="option.props"
|
|
21
|
+
v-on="option.on ?? {}"
|
|
22
|
+
/>
|
|
23
|
+
<FormInputSelect
|
|
24
|
+
v-if="option.type === INPUT_TYPES.SELECT"
|
|
25
|
+
:form="form"
|
|
26
|
+
v-bind="option.props"
|
|
27
|
+
v-on="option.on ?? {}"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
<script lang="ts" setup>
|
|
34
|
+
import { type FormContext } from 'vee-validate'
|
|
35
|
+
import { type IFormField, INPUT_TYPES } from '#core/components/Form/types'
|
|
36
|
+
|
|
37
|
+
defineProps<{
|
|
38
|
+
form?: FormContext
|
|
39
|
+
options: IFormField[]
|
|
40
|
+
}>()
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps" :is-required="false">
|
|
3
|
+
<p class="form-control-static">
|
|
4
|
+
{{ !value || value.length === 0 ? '-' : value }}
|
|
5
|
+
</p>
|
|
6
|
+
</FieldWrapper>
|
|
7
|
+
</template>
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import { type IStaticFieldProps } from '#core/components/Form/InputStatic/types'
|
|
10
|
+
import { useFieldHOC } from '#core/composables/useForm'
|
|
11
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<IStaticFieldProps>(), {})
|
|
14
|
+
|
|
15
|
+
const { value, label, wrapperProps, disabled } = useFieldHOC<string>(props)
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<UInput
|
|
4
|
+
v-model="value"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:name="name"
|
|
7
|
+
:placeholder="placeholder ?? props.label"
|
|
8
|
+
:type="isShowPassword ? 'text' : props.type || 'text'"
|
|
9
|
+
:autofocus="!!autoFocus"
|
|
10
|
+
/>
|
|
11
|
+
</FieldWrapper>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { ref } from '#imports'
|
|
15
|
+
import { type ITextFieldProps } from '#core/components/Form/InputText/types'
|
|
16
|
+
import { useFieldHOC } from '#core/composables/useForm'
|
|
17
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(defineProps<ITextFieldProps>(), {})
|
|
20
|
+
const emits = defineEmits<{
|
|
21
|
+
(event: 'change', value: string): void
|
|
22
|
+
(event: 'blur', value: string): void
|
|
23
|
+
}>()
|
|
24
|
+
|
|
25
|
+
const { value, wrapperProps, disabled, handleChange } = useFieldHOC<string>(props)
|
|
26
|
+
|
|
27
|
+
const isShowPassword = ref(false)
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '#core/components/Form/types';
|
|
2
|
+
export interface ITextFieldProps extends IFieldProps {
|
|
3
|
+
type?: 'text' | 'password' | 'email';
|
|
4
|
+
prependIcon?: any;
|
|
5
|
+
appendIcon?: any;
|
|
6
|
+
}
|
|
7
|
+
export type ITextField = IFormFieldBase<INPUT_TYPES.TEXT | INPUT_TYPES.PASSWORD, ITextFieldProps, {
|
|
8
|
+
change?: (value: string) => void;
|
|
9
|
+
blur?: (value: string) => void;
|
|
10
|
+
}>;
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<UToggle v-model="value" :disabled="disabled" :name="name" />
|
|
4
|
+
</FieldWrapper>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { useFieldHOC } from '#core/composables/useForm'
|
|
9
|
+
import { type IToggleFieldProps } from '#core/components/Form/InputToggle/types'
|
|
10
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<IToggleFieldProps>(), {})
|
|
13
|
+
const { value, wrapperProps, disabled, handleChange } = useFieldHOC<boolean>(props)
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '#core/components/Form/types';
|
|
2
|
+
export interface IToggleFieldProps extends IFieldProps {
|
|
3
|
+
}
|
|
4
|
+
export type IToggleField = IFormFieldBase<INPUT_TYPES.TOGGLE, IToggleFieldProps, {
|
|
5
|
+
change?: (value: string) => void;
|
|
6
|
+
}>;
|
|
File without changes
|