@finema/core 1.3.11 → 1.3.13

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/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.7.4"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { defineNuxtModule, createResolver, installModule, addPlugin, addComponen
2
2
  import { merge } from 'lodash-es';
3
3
 
4
4
  const name = "@finema/core";
5
- const version = "1.3.11";
5
+ const version = "1.3.13";
6
6
 
7
7
  const colors = {
8
8
  black: "#20243E",
@@ -28,6 +28,12 @@
28
28
  v-bind="option.props"
29
29
  v-on="option.on ?? {}"
30
30
  />
31
+ <FormInputTextarea
32
+ v-if="option.type === INPUT_TYPES.TEXTAREA"
33
+ :form="form"
34
+ v-bind="option.props"
35
+ v-on="option.on ?? {}"
36
+ />
31
37
  <FormInputToggle
32
38
  v-if="option.type === INPUT_TYPES.TOGGLE"
33
39
  :form="form"
@@ -16,7 +16,13 @@
16
16
  :size="size"
17
17
  :ui="ui"
18
18
  :ui-menu="uiMenu"
19
- />
19
+ >
20
+ <template #label>
21
+ <span v-if="value" class="truncate">
22
+ {{ options.find((item) => item.value === value)?.label || value }}
23
+ </span>
24
+ </template>
25
+ </USelectMenu>
20
26
  </FieldWrapper>
21
27
  </template>
22
28
 
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <UTextarea
4
+ v-model="value"
5
+ :disabled="disabled"
6
+ :name="name"
7
+ :resize="resize"
8
+ :placeholder="placeholder ?? props.label"
9
+ :autofocus="!!autoFocus"
10
+ :autoresize="autoresize"
11
+ :rows="rows"
12
+ :color="color"
13
+ :ui="ui"
14
+ />
15
+ </FieldWrapper>
16
+ </template>
17
+ <script lang="ts" setup>
18
+ import { useFieldHOC } from '#core/composables/useForm'
19
+ import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
20
+ import { type ITextareaFieldProps } from '#core/components/Form/InputTextarea/types'
21
+
22
+ const props = withDefaults(defineProps<ITextareaFieldProps>(), {})
23
+ const emits = defineEmits<{
24
+ (event: 'change', value: string): void
25
+ (event: 'blur', value: string): void
26
+ }>()
27
+
28
+ const { value, wrapperProps, disabled, handleChange } = useFieldHOC<string>(props)
29
+ </script>
@@ -0,0 +1,12 @@
1
+ import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '#core/components/Form/types';
2
+ export interface ITextareaFieldProps extends IFieldProps {
3
+ autoresize?: boolean;
4
+ resize?: boolean;
5
+ rows?: number;
6
+ color?: string;
7
+ ui?: object | any;
8
+ }
9
+ export type ITextareaField = IFormFieldBase<INPUT_TYPES.TEXTAREA, ITextareaFieldProps, {
10
+ change?: (value: string) => void;
11
+ blur?: (value: string) => void;
12
+ }>;
@@ -6,8 +6,10 @@ import { type ICheckboxField } from '#core/components/Form/InputCheckbox/types';
6
6
  import { type IRadioField } from '#core/components/Form/InputRadio/types';
7
7
  import { type ISelectField } from '#core/components/Form/InputSelect/types';
8
8
  import { type IToggleField } from '#core/components/Form/InputToggle/types';
9
+ import { type ITextareaField } from '#core/components/Form/InputTextarea/types';
9
10
  export declare const enum INPUT_TYPES {
10
11
  TEXT = "TEXT",
12
+ TEXTAREA = "TEXTAREA",
11
13
  PASSWORD = "PASSWORD",
12
14
  EMAIL = "EMAIL",
13
15
  STATIC = "STATIC",
@@ -35,7 +37,7 @@ export interface IFieldProps {
35
37
  classInputInner?: any;
36
38
  placeholder?: string;
37
39
  isDisabled?: boolean;
38
- isReadOnly?: boolean;
40
+ isRequired?: boolean;
39
41
  isLoading?: boolean;
40
42
  help?: string;
41
43
  isHideLabel?: boolean;
@@ -51,4 +53,4 @@ export interface IFormFieldBase<I extends INPUT_TYPES, P extends object = never,
51
53
  props: IFieldProps & P;
52
54
  on?: O;
53
55
  }
54
- export type IFormField = ITextField | IStaticField | ICheckboxField | IRadioField | ISelectField | IToggleField;
56
+ export type IFormField = ITextField | IStaticField | ICheckboxField | IRadioField | ISelectField | IToggleField | ITextareaField;
@@ -1,5 +1,6 @@
1
1
  export var INPUT_TYPES = /* @__PURE__ */ ((INPUT_TYPES2) => {
2
2
  INPUT_TYPES2["TEXT"] = "TEXT";
3
+ INPUT_TYPES2["TEXTAREA"] = "TEXTAREA";
3
4
  INPUT_TYPES2["PASSWORD"] = "PASSWORD";
4
5
  INPUT_TYPES2["EMAIL"] = "EMAIL";
5
6
  INPUT_TYPES2["STATIC"] = "STATIC";
@@ -13,10 +13,10 @@ export interface IFieldWrapperProps {
13
13
  name: string;
14
14
  }
15
15
  interface IFieldContext<TValue> extends FieldContext<TValue> {
16
- isRequired: ComputedRef<boolean>;
16
+ isRequired: boolean;
17
17
  onChange: (e: InputEvent) => void;
18
18
  fieldClassName: ComputedRef<any[]>;
19
- disabled: ComputedRef<boolean>;
19
+ disabled: boolean;
20
20
  wrapperProps: ComputedRef<IFieldWrapperProps>;
21
21
  }
22
22
  export declare const useFieldHOC: <TValue = unknown>(newFormProps: IFieldProps, opts?: Partial<FieldOptions<TValue>> | undefined) => IFieldContext<TValue>;
@@ -6,7 +6,6 @@ export const useFieldHOC = (newFormProps, opts) => {
6
6
  form: newFormProps.form,
7
7
  ...opts
8
8
  });
9
- const isRequired = computed(() => false);
10
9
  const onChange = (e) => {
11
10
  const target = e.target;
12
11
  const newValue = newFormProps.transform ? newFormProps.transform(target.value, field.value, e) : target.value;
@@ -24,17 +23,17 @@ export const useFieldHOC = (newFormProps, opts) => {
24
23
  });
25
24
  return {
26
25
  ...field,
27
- isRequired,
26
+ isRequired: !!newFormProps.isRequired,
28
27
  onChange,
29
28
  fieldClassName,
30
- disabled: computed(() => newFormProps.isDisabled ?? newFormProps.isReadOnly ?? false),
29
+ disabled: !!newFormProps.isDisabled,
31
30
  wrapperProps: computed(() => ({
32
31
  label: newFormProps.label,
33
32
  errorMessage: field.errorMessage.value,
34
33
  className: newFormProps.class,
35
34
  classInner: newFormProps.classInner,
36
35
  classInputInner: newFormProps.classInputInner,
37
- isRequired: isRequired.value,
36
+ isRequired: newFormProps.isRequired,
38
37
  isHideLabel: newFormProps.isHideLabel,
39
38
  customErrorMessage: newFormProps.customErrorMessage,
40
39
  name: newFormProps.name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Development Team",