@finema/core 1.3.2 → 1.3.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 (29) hide show
  1. package/README.md +88 -88
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +4 -31
  4. package/dist/runtime/components/Avatar.vue +27 -0
  5. package/dist/runtime/components/Button/Group.vue +31 -31
  6. package/dist/runtime/components/Button/index.vue +17 -17
  7. package/dist/runtime/components/Core.vue +4 -4
  8. package/dist/runtime/components/Dialog/index.vue +63 -63
  9. package/dist/runtime/components/Dropdown/index.vue +80 -0
  10. package/dist/runtime/components/Dropdown/types.d.ts +2 -0
  11. package/dist/runtime/components/Dropdown/types.mjs +17 -0
  12. package/dist/runtime/components/Form/FieldWrapper.vue +10 -10
  13. package/dist/runtime/components/Form/Fields.vue +41 -41
  14. package/dist/runtime/components/Form/InputSelect/SelectMenu.vue +11 -11
  15. package/dist/runtime/components/Form/InputSelect/index.vue +11 -11
  16. package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
  17. package/dist/runtime/components/Form/InputText/index.vue +30 -28
  18. package/dist/runtime/components/Form/InputText/types.d.ts +2 -0
  19. package/dist/runtime/components/Form/InputToggle/index.vue +14 -14
  20. package/dist/runtime/components/Form/index.vue +6 -6
  21. package/dist/runtime/components/Loader.vue +6 -6
  22. package/dist/runtime/components/Modal/index.vue +145 -145
  23. package/dist/runtime/components/Slideover/index.vue +109 -109
  24. package/dist/runtime/components/Table/index.vue +84 -84
  25. package/dist/runtime/types/config.d.ts +1 -1
  26. package/dist/runtime/ui.css +14 -14
  27. package/dist/runtime/utils/lodash.d.ts +109 -29
  28. package/dist/runtime/utils/lodash.mjs +60 -30
  29. package/package.json +79 -79
@@ -1,41 +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>
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>
@@ -1,11 +1,11 @@
1
- <template>
2
- <div>
3
- <USelectMenu v-bind="$attrs" />
4
- </div>
5
- </template>
6
-
7
- <script lang="ts" setup>
8
- defineOptions({
9
- inheritAttrs: true,
10
- })
11
- </script>
1
+ <template>
2
+ <div>
3
+ <USelectMenu v-bind="$attrs" />
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ defineOptions({
9
+ inheritAttrs: true,
10
+ })
11
+ </script>
@@ -1,11 +1,11 @@
1
- <template>
2
- <div>
3
- <USelect v-bind="$attrs" />
4
- </div>
5
- </template>
6
-
7
- <script lang="ts" setup>
8
- defineOptions({
9
- inheritAttrs: true,
10
- })
11
- </script>
1
+ <template>
2
+ <div>
3
+ <USelect v-bind="$attrs" />
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ defineOptions({
9
+ inheritAttrs: true,
10
+ })
11
+ </script>
@@ -1,16 +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>
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>
@@ -1,28 +1,30 @@
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>
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
+ :color="color"
11
+ :ui="ui"
12
+ />
13
+ </FieldWrapper>
14
+ </template>
15
+ <script lang="ts" setup>
16
+ import { ref } from '#imports'
17
+ import { type ITextFieldProps } from '#core/components/Form/InputText/types'
18
+ import { useFieldHOC } from '#core/composables/useForm'
19
+ import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
20
+
21
+ const props = withDefaults(defineProps<ITextFieldProps>(), {})
22
+ const emits = defineEmits<{
23
+ (event: 'change', value: string): void
24
+ (event: 'blur', value: string): void
25
+ }>()
26
+
27
+ const { value, wrapperProps, disabled, handleChange } = useFieldHOC<string>(props)
28
+
29
+ const isShowPassword = ref(false)
30
+ </script>
@@ -3,6 +3,8 @@ export interface ITextFieldProps extends IFieldProps {
3
3
  type?: 'text' | 'password' | 'email';
4
4
  prependIcon?: any;
5
5
  appendIcon?: any;
6
+ color?: string;
7
+ ui?: object | any;
6
8
  }
7
9
  export type ITextField = IFormFieldBase<INPUT_TYPES.TEXT | INPUT_TYPES.PASSWORD, ITextFieldProps, {
8
10
  change?: (value: string) => void;
@@ -1,14 +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>
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>
@@ -1,6 +1,6 @@
1
- <template>
2
- <form class="form">
3
- <slot />
4
- </form>
5
- </template>
6
- <script lang="ts" setup></script>
1
+ <template>
2
+ <form class="form">
3
+ <slot />
4
+ </form>
5
+ </template>
6
+ <script lang="ts" setup></script>
@@ -1,6 +1,6 @@
1
- <template>
2
- <div>
3
- <UIcon name="i-heroicons-arrow-path w-12 h-12 animate-spin" />
4
- </div>
5
- </template>
6
- <script lang="ts" setup></script>
1
+ <template>
2
+ <div>
3
+ <UIcon name="i-heroicons-arrow-path w-12 h-12 animate-spin" />
4
+ </div>
5
+ </template>
6
+ <script lang="ts" setup></script>
@@ -1,145 +1,145 @@
1
- <template>
2
- <UModal
3
- v-bind="attrs"
4
- :model-value="modelValue"
5
- :overlay="overlay"
6
- :transition="transition"
7
- :prevent-close="preventClose"
8
- :fullscreen="fullscreen"
9
- :initial-focus="modalWrapper"
10
- :ui="ui"
11
- @update:model-value="$emit('update:modelValue', $event)"
12
- >
13
- <div
14
- v-if="title"
15
- :class="[ui.header, { 'flex items-center justify-between': !isHideCloseBtn }]"
16
- >
17
- <h1 class="text-xl font-medium">{{ title }}</h1>
18
- <Icon
19
- v-if="!isHideCloseBtn"
20
- name="i-heroicons-x-mark"
21
- class="h-6 w-6 cursor-pointer"
22
- @click="close"
23
- />
24
- </div>
25
-
26
- <div
27
- v-if="(!title && !isHideCloseBtn && preventClose) || fullscreen"
28
- class="absolute right-0 m-4"
29
- >
30
- <Icon
31
- v-if="!isHideCloseBtn"
32
- name="i-heroicons-x-mark"
33
- class="h-6 w-6 cursor-pointer"
34
- @click="close"
35
- />
36
- </div>
37
-
38
- <div ref="modalWrapper" :class="['overflow-y-auto', ui.innerWrapper]">
39
- <slot />
40
- </div>
41
- </UModal>
42
- </template>
43
-
44
- <script lang="ts" setup>
45
- import { type PropType, defineShortcuts, ref, toRef, watch } from '#imports'
46
- import type { Strategy } from '#core/types/utils'
47
- import { useUI } from '#ui/composables/useUI'
48
- import { modal } from '#core/ui.config'
49
- import { useUiConfig } from '#core/composables/useConfig'
50
-
51
- const config = useUiConfig<typeof modal>(modal, 'modal')
52
-
53
- const props = defineProps({
54
- modelValue: {
55
- type: Boolean,
56
- default: false,
57
- },
58
- overlay: {
59
- type: Boolean,
60
- default: true,
61
- },
62
- transition: {
63
- type: Boolean,
64
- default: true,
65
- },
66
- preventClose: {
67
- type: Boolean,
68
- default: false,
69
- },
70
- fullscreen: {
71
- type: Boolean,
72
- default: false,
73
- },
74
- scrollable: {
75
- type: Boolean,
76
- default: false,
77
- },
78
- title: {
79
- type: String,
80
- default: '',
81
- },
82
- isHideCloseBtn: {
83
- type: Boolean,
84
- default: false,
85
- },
86
- size: {
87
- type: String as PropType<keyof typeof modal.size>,
88
- default: () => modal.default.size,
89
- },
90
- position: {
91
- type: String as PropType<keyof typeof modal.position>,
92
- default: () => modal.default.position,
93
- },
94
- fixHeightSize: {
95
- type: String as PropType<keyof typeof modal.fixHeightSize>,
96
- default: () => modal.default.fixHeightSize,
97
- },
98
- class: {
99
- type: [String, Array, Object] as PropType<any>,
100
- default: undefined,
101
- },
102
- ui: {
103
- type: Object as PropType<Partial<typeof config & { strategy?: Strategy }>>,
104
- default: undefined,
105
- },
106
- })
107
-
108
- const emits = defineEmits(['update:modelValue'])
109
-
110
- defineShortcuts({
111
- escape: {
112
- usingInput: true,
113
- handler: () => {
114
- if (props.preventClose) return
115
- emits('update:modelValue', false)
116
- },
117
- },
118
- })
119
-
120
- const modalWrapper = ref<HTMLElement | null>(null)
121
-
122
- const close = () => {
123
- emits('update:modelValue', false)
124
- }
125
-
126
- const { ui, attrs } = useUI('modal', toRef(props, 'ui'), config, toRef(props, 'class'))
127
-
128
- watch(
129
- () => props.modelValue,
130
- () => {
131
- if (props.modelValue) {
132
- const size = config.size[props.size]
133
- const fixHeightSize = config.fixHeightSize[props.fixHeightSize]
134
- const position = config.position[props.position]
135
-
136
- ui.value.width = size
137
- ui.value.container = position
138
-
139
- if (props.scrollable) {
140
- ui.value.height = fixHeightSize
141
- }
142
- }
143
- }
144
- )
145
- </script>
1
+ <template>
2
+ <UModal
3
+ v-bind="attrs"
4
+ :model-value="modelValue"
5
+ :overlay="overlay"
6
+ :transition="transition"
7
+ :prevent-close="preventClose"
8
+ :fullscreen="fullscreen"
9
+ :initial-focus="modalWrapper"
10
+ :ui="ui"
11
+ @update:model-value="$emit('update:modelValue', $event)"
12
+ >
13
+ <div
14
+ v-if="title"
15
+ :class="[ui.header, { 'flex items-center justify-between': !isHideCloseBtn }]"
16
+ >
17
+ <h1 class="text-xl font-medium">{{ title }}</h1>
18
+ <Icon
19
+ v-if="!isHideCloseBtn"
20
+ name="i-heroicons-x-mark"
21
+ class="h-6 w-6 cursor-pointer"
22
+ @click="close"
23
+ />
24
+ </div>
25
+
26
+ <div
27
+ v-if="(!title && !isHideCloseBtn && preventClose) || fullscreen"
28
+ class="absolute right-0 m-4"
29
+ >
30
+ <Icon
31
+ v-if="!isHideCloseBtn"
32
+ name="i-heroicons-x-mark"
33
+ class="h-6 w-6 cursor-pointer"
34
+ @click="close"
35
+ />
36
+ </div>
37
+
38
+ <div ref="modalWrapper" :class="['overflow-y-auto', ui.innerWrapper]">
39
+ <slot />
40
+ </div>
41
+ </UModal>
42
+ </template>
43
+
44
+ <script lang="ts" setup>
45
+ import { type PropType, defineShortcuts, ref, toRef, watch } from '#imports'
46
+ import type { Strategy } from '#core/types/utils'
47
+ import { useUI } from '#ui/composables/useUI'
48
+ import { modal } from '#core/ui.config'
49
+ import { useUiConfig } from '#core/composables/useConfig'
50
+
51
+ const config = useUiConfig<typeof modal>(modal, 'modal')
52
+
53
+ const props = defineProps({
54
+ modelValue: {
55
+ type: Boolean,
56
+ default: false,
57
+ },
58
+ overlay: {
59
+ type: Boolean,
60
+ default: true,
61
+ },
62
+ transition: {
63
+ type: Boolean,
64
+ default: true,
65
+ },
66
+ preventClose: {
67
+ type: Boolean,
68
+ default: false,
69
+ },
70
+ fullscreen: {
71
+ type: Boolean,
72
+ default: false,
73
+ },
74
+ scrollable: {
75
+ type: Boolean,
76
+ default: false,
77
+ },
78
+ title: {
79
+ type: String,
80
+ default: '',
81
+ },
82
+ isHideCloseBtn: {
83
+ type: Boolean,
84
+ default: false,
85
+ },
86
+ size: {
87
+ type: String as PropType<keyof typeof modal.size>,
88
+ default: () => modal.default.size,
89
+ },
90
+ position: {
91
+ type: String as PropType<keyof typeof modal.position>,
92
+ default: () => modal.default.position,
93
+ },
94
+ fixHeightSize: {
95
+ type: String as PropType<keyof typeof modal.fixHeightSize>,
96
+ default: () => modal.default.fixHeightSize,
97
+ },
98
+ class: {
99
+ type: [String, Array, Object] as PropType<any>,
100
+ default: undefined,
101
+ },
102
+ ui: {
103
+ type: Object as PropType<Partial<typeof config & { strategy?: Strategy }>>,
104
+ default: undefined,
105
+ },
106
+ })
107
+
108
+ const emits = defineEmits(['update:modelValue'])
109
+
110
+ defineShortcuts({
111
+ escape: {
112
+ usingInput: true,
113
+ handler: () => {
114
+ if (props.preventClose) return
115
+ emits('update:modelValue', false)
116
+ },
117
+ },
118
+ })
119
+
120
+ const modalWrapper = ref<HTMLElement | null>(null)
121
+
122
+ const close = () => {
123
+ emits('update:modelValue', false)
124
+ }
125
+
126
+ const { ui, attrs } = useUI('modal', toRef(props, 'ui'), config, toRef(props, 'class'))
127
+
128
+ watch(
129
+ () => props.modelValue,
130
+ () => {
131
+ if (props.modelValue) {
132
+ const size = config.size[props.size]
133
+ const fixHeightSize = config.fixHeightSize[props.fixHeightSize]
134
+ const position = config.position[props.position]
135
+
136
+ ui.value.width = size
137
+ ui.value.container = position
138
+
139
+ if (props.scrollable) {
140
+ ui.value.height = fixHeightSize
141
+ }
142
+ }
143
+ }
144
+ )
145
+ </script>