@finema/core 1.2.5 → 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 +88 -94
- package/dist/module.d.mts +3 -3
- package/dist/module.d.ts +3 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +98 -75
- 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/InputStatic/types.mjs +0 -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 -11
- package/dist/runtime/components/Table/types.d.ts +2 -17
- package/dist/runtime/components/Table/types.mjs +1 -6
- package/dist/runtime/composables/loaderPage.mjs +2 -4
- 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 +0 -2
- package/dist/runtime/composables/useTable.mjs +4 -8
- package/dist/runtime/core.config.d.ts +1 -1
- package/dist/runtime/core.config.mjs +1 -1
- package/dist/runtime/helpers/apiPageHelper.mjs +2 -4
- package/dist/runtime/plugin.mjs +1 -1
- package/dist/runtime/types/common.d.ts +3 -0
- package/dist/runtime/types/config.d.ts +1 -0
- package/dist/runtime/types/config.mjs +0 -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/ParamHelper.d.ts +2 -2
- 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 +10 -12
package/README.md
CHANGED
|
@@ -1,94 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
npm run
|
|
78
|
-
|
|
79
|
-
#
|
|
80
|
-
npm run
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
+
# @finema/core Nuxt Module
|
|
2
|
+
|
|
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
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- UI components
|
|
36
|
+
- Useful composables
|
|
37
|
+
- Security
|
|
38
|
+
|
|
39
|
+
## Quick Setup
|
|
40
|
+
|
|
41
|
+
1. Add `@finema/core` dependency to your project
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Using pnpm
|
|
45
|
+
pnpm add -D @finema/core
|
|
46
|
+
|
|
47
|
+
# Using yarn
|
|
48
|
+
yarn add --dev @finema/core
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
1. Add `@finema/core` to the `modules` section of `nuxt.config.ts`
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
export default defineNuxtConfig({
|
|
56
|
+
modules: [
|
|
57
|
+
'@finema/core'
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
That's it! You can now use @finema/core in your Nuxt app ✨
|
|
63
|
+
|
|
64
|
+
## Development
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Install dependencies
|
|
68
|
+
npm install
|
|
69
|
+
|
|
70
|
+
# Generate type stubs
|
|
71
|
+
npm run dev:prepare
|
|
72
|
+
|
|
73
|
+
# Develop with the playground
|
|
74
|
+
npm run dev
|
|
75
|
+
|
|
76
|
+
# Build the playground
|
|
77
|
+
npm run dev:build
|
|
78
|
+
|
|
79
|
+
# Run ESLint
|
|
80
|
+
npm run lint
|
|
81
|
+
|
|
82
|
+
# Run Vitest
|
|
83
|
+
npm run test
|
|
84
|
+
npm run test:watch
|
|
85
|
+
|
|
86
|
+
# Release new version
|
|
87
|
+
npm run release
|
|
88
|
+
```
|
package/dist/module.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
3
|
+
declare const core: {
|
|
4
4
|
limit_per_page: number;
|
|
5
5
|
default_primary_key: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
declare const
|
|
8
|
+
declare const config_core: typeof core;
|
|
9
9
|
declare namespace config {
|
|
10
|
-
export {
|
|
10
|
+
export { config_core as core };
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
type Strategy = 'merge' | 'override'
|
package/dist/module.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
3
|
+
declare const core: {
|
|
4
4
|
limit_per_page: number;
|
|
5
5
|
default_primary_key: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
declare const
|
|
8
|
+
declare const config_core: typeof core;
|
|
9
9
|
declare namespace config {
|
|
10
|
-
export {
|
|
10
|
+
export { config_core as core };
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
type Strategy = 'merge' | 'override'
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,89 @@
|
|
|
1
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: {
|
|
@@ -19,84 +101,25 @@ const module = defineNuxtModule({
|
|
|
19
101
|
const runtimeDir = resolve("./runtime");
|
|
20
102
|
nuxt.options.build.transpile.push(runtimeDir);
|
|
21
103
|
nuxt.options.alias["#core"] = runtimeDir;
|
|
104
|
+
nuxt.options.css.push(resolve(runtimeDir, "ui.css"));
|
|
22
105
|
nuxt.options.appConfig.app = {
|
|
23
106
|
strategy: "merge"
|
|
24
107
|
};
|
|
25
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
|
+
};
|
|
26
117
|
tailwindConfig.theme.extend.colors = {
|
|
27
118
|
...tailwindConfig.theme.extend.colors,
|
|
28
|
-
|
|
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
|
-
}
|
|
119
|
+
...colors
|
|
98
120
|
};
|
|
99
121
|
});
|
|
122
|
+
nuxt.options.appConfig.ui = _merge(ui, nuxt.options.appConfig.ui);
|
|
100
123
|
await installModule("@nuxt/ui");
|
|
101
124
|
await installModule("@pinia/nuxt");
|
|
102
125
|
await installModule("@vee-validate/nuxt", {
|
|
@@ -104,10 +127,10 @@ const module = defineNuxtModule({
|
|
|
104
127
|
autoImports: true,
|
|
105
128
|
// Use different names for components
|
|
106
129
|
componentNames: {
|
|
107
|
-
Form: "
|
|
108
|
-
Field: "
|
|
109
|
-
FieldArray: "
|
|
110
|
-
ErrorMessage: "
|
|
130
|
+
Form: "VForm",
|
|
131
|
+
Field: "VField",
|
|
132
|
+
FieldArray: "VFieldArray",
|
|
133
|
+
ErrorMessage: "VErrorMessage"
|
|
111
134
|
}
|
|
112
135
|
});
|
|
113
136
|
await installModule("nuxt-security", {
|
|
@@ -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>
|
|
File without changes
|
|
@@ -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>
|