@finema/core 2.14.1 → 2.15.1

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 (43) hide show
  1. package/README.md +79 -79
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/components/DevToolsWindow/index.vue +95 -95
  5. package/dist/runtime/components/FlexDeck/Base.vue +67 -67
  6. package/dist/runtime/components/FlexDeck/index.vue +33 -33
  7. package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
  8. package/dist/runtime/components/Form/Fields.vue +23 -15
  9. package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
  10. package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
  11. package/dist/runtime/components/Form/InputRadio/index.vue +56 -0
  12. package/dist/runtime/components/Form/InputRadio/index.vue.d.ts +11 -0
  13. package/dist/runtime/components/Form/InputRadio/types.d.ts +19 -0
  14. package/dist/runtime/components/Form/InputRadio/types.js +0 -0
  15. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -43
  16. package/dist/runtime/components/Form/InputText/index.vue +48 -48
  17. package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
  18. package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
  19. package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue +38 -0
  20. package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue.d.ts +11 -0
  21. package/dist/runtime/components/Form/InputWYSIWYG/index.vue +281 -0
  22. package/dist/runtime/components/Form/InputWYSIWYG/index.vue.d.ts +6 -0
  23. package/dist/runtime/components/Form/InputWYSIWYG/types.d.ts +52 -0
  24. package/dist/runtime/components/Form/InputWYSIWYG/types.js +0 -0
  25. package/dist/runtime/components/Form/index.vue +5 -5
  26. package/dist/runtime/components/Form/types.d.ts +3 -1
  27. package/dist/runtime/components/Image.vue +28 -28
  28. package/dist/runtime/components/Log/index.vue +17 -17
  29. package/dist/runtime/components/Table/ColumnDate.vue +1 -1
  30. package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
  31. package/dist/runtime/components/Table/ColumnImage.vue +4 -4
  32. package/dist/runtime/components/Table/ColumnNumber.vue +1 -1
  33. package/dist/runtime/components/Table/ColumnText.vue +1 -1
  34. package/dist/runtime/server/tsconfig.json +3 -3
  35. package/dist/runtime/styles/main.css +1 -1
  36. package/dist/runtime/theme/index.d.ts +2 -0
  37. package/dist/runtime/theme/index.js +2 -0
  38. package/dist/runtime/theme/radioGroup.d.ts +6 -0
  39. package/dist/runtime/theme/radioGroup.js +6 -0
  40. package/dist/runtime/theme/uploadFileDropzone.js +4 -4
  41. package/dist/runtime/theme/wysiwyg.d.ts +53 -0
  42. package/dist/runtime/theme/wysiwyg.js +53 -0
  43. package/package.json +4 -3
@@ -1,19 +1,19 @@
1
1
  <template>
2
- <div
2
+ <div
3
3
  :class="[theme.base({
4
4
  class: [$props.class, ui?.base]
5
- })]"
6
- >
7
- <component
8
- :is="componentMap[option.type]?.component"
9
- v-for="option in options.filter((item) => !item.isHide)"
10
- :key="option.props.name"
11
- :class="option.class"
12
- :form="form"
13
- v-bind="{ ...getFieldBinding(option), ...componentMap[option.type]?.props }"
14
- v-on="option.on ?? {}"
15
- />
16
- </div>
5
+ })]"
6
+ >
7
+ <component
8
+ :is="componentMap[option.type]?.component"
9
+ v-for="option in options.filter((item) => !item.isHide)"
10
+ :key="option.props.name"
11
+ :class="option.class"
12
+ :form="form"
13
+ v-bind="{ ...getFieldBinding(option), ...componentMap[option.type]?.props }"
14
+ v-on="option.on ?? {}"
15
+ />
16
+ </div>
17
17
  </template>
18
18
 
19
19
  <script setup>
@@ -25,9 +25,11 @@ import FormInputToggle from "./InputToggle/index.vue";
25
25
  import FormInputCheckbox from "./InputCheckbox/index.vue";
26
26
  import FormInputSelect from "./InputSelect/index.vue";
27
27
  import FormInputSelectMultiple from "./InputSelectMultiple/index.vue";
28
+ import FormInputRadio from "./InputRadio/index.vue";
28
29
  import FormInputDateTime from "./InputDateTime/index.vue";
29
30
  import FormInputDateTimeRange from "./InputDateTimeRange/index.vue";
30
31
  import FormInputUploadDropzoneAuto from "./InputUploadDropzoneAuto/index.vue";
32
+ import FormInputWYSIWYG from "./InputWYSIWYG/index.vue";
31
33
  import { INPUT_TYPES } from "#core/components/Form/types";
32
34
  import { formTheme } from "#core/theme/form";
33
35
  import { useUiConfig } from "#core/composables/useConfig";
@@ -84,7 +86,10 @@ const componentMap = {
84
86
  }
85
87
  },
86
88
  [INPUT_TYPES.STATIC]: void 0,
87
- [INPUT_TYPES.RADIO]: void 0,
89
+ [INPUT_TYPES.RADIO]: {
90
+ component: FormInputRadio,
91
+ props: {}
92
+ },
88
93
  [INPUT_TYPES.DATE_TIME]: {
89
94
  component: FormInputDateTime,
90
95
  props: {}
@@ -115,7 +120,10 @@ const componentMap = {
115
120
  },
116
121
  [INPUT_TYPES.UPLOAD_DROPZONE_AUTO_MULTIPLE]: void 0,
117
122
  [INPUT_TYPES.UPLOAD_DROPZONE_IMAGE_AUTO_MULTIPLE]: void 0,
118
- [INPUT_TYPES.WYSIWYG]: void 0,
123
+ [INPUT_TYPES.WYSIWYG]: {
124
+ component: FormInputWYSIWYG,
125
+ props: {}
126
+ },
119
127
  [INPUT_TYPES.TAGS]: void 0
120
128
  };
121
129
  const theme = computed(() => useUiConfig(formTheme, "form")({
@@ -1,22 +1,22 @@
1
1
  <template>
2
- <FieldWrapper
3
- v-bind="wrapperProps"
4
- label=""
5
- description=""
6
- >
7
- <Checkbox
8
- :model-value="value"
9
- :disabled="wrapperProps.disabled"
10
- :name="name"
11
- :label="label"
12
- :description="description"
13
- :required="required"
14
- :variant="variant"
15
- :indicator="indicator"
16
- :ui="ui"
17
- @update:modelValue="onChange"
18
- />
19
- </FieldWrapper>
2
+ <FieldWrapper
3
+ v-bind="wrapperProps"
4
+ label=""
5
+ description=""
6
+ >
7
+ <Checkbox
8
+ :model-value="value"
9
+ :disabled="wrapperProps.disabled"
10
+ :name="name"
11
+ :label="label"
12
+ :description="description"
13
+ :required="required"
14
+ :variant="variant"
15
+ :indicator="indicator"
16
+ :ui="ui"
17
+ @update:modelValue="onChange"
18
+ />
19
+ </FieldWrapper>
20
20
  </template>
21
21
 
22
22
  <script setup>
@@ -1,24 +1,24 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <InputNumber
4
- :model-value="value"
5
- :disabled="wrapperProps.disabled"
6
- :name="name"
7
- :placeholder="wrapperProps.placeholder"
8
- :autofocus="!!autoFocus"
9
- :readonly="readonly"
10
- :orientation="orientation"
11
- :increment-disabled="incrementDisabled"
12
- :decrement-disabled="decrementDisabled"
13
- :min="min"
14
- :max="max"
15
- :step="step"
16
- :disable-wheel-change="disableWheelChange"
17
- :format-options="formatOptions"
18
- :ui="ui"
19
- @update:model-value="onChange"
20
- />
21
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <InputNumber
4
+ :model-value="value"
5
+ :disabled="wrapperProps.disabled"
6
+ :name="name"
7
+ :placeholder="wrapperProps.placeholder"
8
+ :autofocus="!!autoFocus"
9
+ :readonly="readonly"
10
+ :orientation="orientation"
11
+ :increment-disabled="incrementDisabled"
12
+ :decrement-disabled="decrementDisabled"
13
+ :min="min"
14
+ :max="max"
15
+ :step="step"
16
+ :disable-wheel-change="disableWheelChange"
17
+ :format-options="formatOptions"
18
+ :ui="ui"
19
+ @update:model-value="onChange"
20
+ />
21
+ </FieldWrapper>
22
22
  </template>
23
23
 
24
24
  <script setup>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <RadioGroup
4
+ :model-value="value"
5
+ :items="options"
6
+ :variant="variant"
7
+ :orientation="orientation"
8
+ :indicator="indicator"
9
+ :legend="legend"
10
+ :disabled="wrapperProps.disabled"
11
+ :required="wrapperProps.required"
12
+ :name="wrapperProps.name"
13
+ value-key="value"
14
+ label-key="label"
15
+ description-key="description"
16
+ :ui="ui"
17
+ @update:model-value="onChange"
18
+ />
19
+ </FieldWrapper>
20
+ </template>
21
+
22
+ <script setup>
23
+ import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
24
+ import { useFieldHOC } from "#core/composables/useForm";
25
+ const emits = defineEmits(["change"]);
26
+ const props = defineProps({
27
+ variant: { type: String, required: false, default: "list" },
28
+ orientation: { type: String, required: false, default: "vertical" },
29
+ indicator: { type: String, required: false, default: "start" },
30
+ options: { type: Array, required: true },
31
+ legend: { type: String, required: false },
32
+ form: { type: Object, required: false },
33
+ name: { type: String, required: true },
34
+ errorMessage: { type: String, required: false },
35
+ label: { type: null, required: false },
36
+ description: { type: String, required: false },
37
+ hint: { type: String, required: false },
38
+ rules: { type: null, required: false },
39
+ autoFocus: { type: Boolean, required: false },
40
+ placeholder: { type: String, required: false },
41
+ disabled: { type: Boolean, required: false },
42
+ readonly: { type: Boolean, required: false },
43
+ required: { type: Boolean, required: false },
44
+ help: { type: String, required: false },
45
+ ui: { type: null, required: false }
46
+ });
47
+ const {
48
+ value,
49
+ wrapperProps,
50
+ handleChange
51
+ } = useFieldHOC(props);
52
+ const onChange = (newValue) => {
53
+ handleChange(newValue);
54
+ emits("change", newValue);
55
+ };
56
+ </script>
@@ -0,0 +1,11 @@
1
+ import type { IRadioFieldProps } from '#core/components/Form/InputRadio/types';
2
+ declare const _default: import("vue").DefineComponent<IRadioFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ change: (value: any) => any;
4
+ }, string, import("vue").PublicProps, Readonly<IRadioFieldProps> & Readonly<{
5
+ onChange?: ((value: any) => any) | undefined;
6
+ }>, {
7
+ orientation: "horizontal" | "vertical";
8
+ variant: "list" | "card" | "table";
9
+ indicator: "start" | "end" | "hidden";
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '#core/components/Form/types';
2
+ import type { IOption } from '#core/types/common';
3
+ export type RadioOption = IOption & {
4
+ label?: string;
5
+ value?: any;
6
+ description?: string;
7
+ disabled?: boolean;
8
+ class?: any;
9
+ };
10
+ export interface IRadioFieldProps extends IFieldProps {
11
+ variant?: 'list' | 'card' | 'table';
12
+ orientation?: 'horizontal' | 'vertical';
13
+ indicator?: 'start' | 'end' | 'hidden';
14
+ options: RadioOption[];
15
+ legend?: string;
16
+ }
17
+ export type IRadioField = IFormFieldBase<INPUT_TYPES.RADIO, IRadioFieldProps, {
18
+ change?: (value: any) => void;
19
+ }>;
@@ -1,57 +1,57 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <SelectMenu
4
- :model-value="value"
5
- :items="options"
6
- multiple
7
- :placeholder="wrapperProps.placeholder"
8
- :disabled="wrapperProps.disabled"
9
- :loading="loading"
10
- :search-input="searchInput"
11
- :selected-icon="selectedIcon"
12
- value-key="value"
13
- label-key="label"
14
- :icon="icon"
15
- :ui="ui"
16
- :ignore-filter="!!$attrs.onSearch"
17
- @update:model-value="onChange"
18
- @update:searchTerm="onSearch"
19
- >
20
- <template #default="{ modelValue }">
21
- <div
22
- v-if="!ArrayHelper.isEmpty(value)"
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <SelectMenu
4
+ :model-value="value"
5
+ :items="options"
6
+ multiple
7
+ :placeholder="wrapperProps.placeholder"
8
+ :disabled="wrapperProps.disabled"
9
+ :loading="loading"
10
+ :search-input="searchInput"
11
+ :selected-icon="selectedIcon"
12
+ value-key="value"
13
+ label-key="label"
14
+ :icon="icon"
15
+ :ui="ui"
16
+ :ignore-filter="!!$attrs.onSearch"
17
+ @update:model-value="onChange"
18
+ @update:searchTerm="onSearch"
19
+ >
20
+ <template #default="{ modelValue }">
21
+ <div
22
+ v-if="!ArrayHelper.isEmpty(value)"
23
23
  :class="theme.tagsWrapper({
24
24
  class: [ui?.tagsWrapper]
25
- })"
26
- >
27
- <div
28
- v-for="_value in ArrayHelper.toArray(modelValue)"
29
- :key="_value"
25
+ })"
26
+ >
27
+ <div
28
+ v-for="_value in ArrayHelper.toArray(modelValue)"
29
+ :key="_value"
30
30
  :class="theme.tagsItem({
31
31
  class: [ui?.tagsItem]
32
- })"
33
- >
34
- <div
32
+ })"
33
+ >
34
+ <div
35
35
  :class="theme.tagsItemText({
36
36
  class: [ui?.tagsItemText]
37
- })"
38
- >
39
- {{ options.find((item) => item.value === _value)?.label || _value }}
40
- <Icon
37
+ })"
38
+ >
39
+ {{ options.find((item) => item.value === _value)?.label || _value }}
40
+ <Icon
41
41
  :name="theme.tagsItemDeleteIcon({
42
42
  class: [ui?.tagsItemDeleteIcon]
43
- })"
43
+ })"
44
44
  :class="theme.tagsItemDelete({
45
45
  class: [ui?.tagsItemDelete]
46
- })"
47
- @click.stop="handleDelete(_value)"
48
- />
49
- </div>
50
- </div>
51
- </div>
52
- </template>
53
- </SelectMenu>
54
- </FieldWrapper>
46
+ })"
47
+ @click.stop="handleDelete(_value)"
48
+ />
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </template>
53
+ </SelectMenu>
54
+ </FieldWrapper>
55
55
  </template>
56
56
 
57
57
  <script setup>
@@ -1,52 +1,52 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <Input
4
- v-if="type === 'password'"
5
- v-maska="activeMaskOptions"
6
- :model-value="value"
7
- :disabled="wrapperProps.disabled"
8
- :leading-icon="leadingIcon"
9
- :trailing-icon="trailingIcon"
10
- :loading="loading"
11
- :loading-icon="loadingIcon"
12
- :name="name"
13
- :placeholder="wrapperProps.placeholder"
14
- :type="isShowPassword ? 'text' : 'password'"
15
- :autofocus="!!autoFocus"
16
- :icon="icon"
17
- :readonly="readonly"
18
- :ui="defu(ui, { icon: { trailing: { pointer: '' } } })"
19
- @update:model-value="onChange"
20
- >
21
- <template #trailing>
22
- <Button
23
- color="neutral"
24
- variant="link"
25
- :icon="isShowPassword ? 'i-heroicons-eye-slash' : 'i-heroicons-eye'"
26
- :padded="false"
27
- @click="isShowPassword = !isShowPassword"
28
- />
29
- </template>
30
- </Input>
31
- <Input
32
- v-else
33
- v-maska="activeMaskOptions"
34
- :model-value="value"
35
- :disabled="wrapperProps.disabled"
36
- :leading-icon="leadingIcon"
37
- :trailing-icon="trailingIcon"
38
- :loading="loading"
39
- :loading-icon="loadingIcon"
40
- :name="name"
41
- :placeholder="wrapperProps.placeholder"
42
- :type="type"
43
- :autofocus="!!autoFocus"
44
- :icon="icon"
45
- :readonly="readonly"
46
- :ui="ui"
47
- @update:model-value="onChange"
48
- />
49
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <Input
4
+ v-if="type === 'password'"
5
+ v-maska="activeMaskOptions"
6
+ :model-value="value"
7
+ :disabled="wrapperProps.disabled"
8
+ :leading-icon="leadingIcon"
9
+ :trailing-icon="trailingIcon"
10
+ :loading="loading"
11
+ :loading-icon="loadingIcon"
12
+ :name="name"
13
+ :placeholder="wrapperProps.placeholder"
14
+ :type="isShowPassword ? 'text' : 'password'"
15
+ :autofocus="!!autoFocus"
16
+ :icon="icon"
17
+ :readonly="readonly"
18
+ :ui="defu(ui, { icon: { trailing: { pointer: '' } } })"
19
+ @update:model-value="onChange"
20
+ >
21
+ <template #trailing>
22
+ <Button
23
+ color="neutral"
24
+ variant="link"
25
+ :icon="isShowPassword ? 'i-heroicons-eye-slash' : 'i-heroicons-eye'"
26
+ :padded="false"
27
+ @click="isShowPassword = !isShowPassword"
28
+ />
29
+ </template>
30
+ </Input>
31
+ <Input
32
+ v-else
33
+ v-maska="activeMaskOptions"
34
+ :model-value="value"
35
+ :disabled="wrapperProps.disabled"
36
+ :leading-icon="leadingIcon"
37
+ :trailing-icon="trailingIcon"
38
+ :loading="loading"
39
+ :loading-icon="loadingIcon"
40
+ :name="name"
41
+ :placeholder="wrapperProps.placeholder"
42
+ :type="type"
43
+ :autofocus="!!autoFocus"
44
+ :icon="icon"
45
+ :readonly="readonly"
46
+ :ui="ui"
47
+ @update:model-value="onChange"
48
+ />
49
+ </FieldWrapper>
50
50
  </template>
51
51
 
52
52
  <script setup>
@@ -1,22 +1,22 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <Textarea
4
- :model-value="value"
5
- :disabled="wrapperProps.disabled"
6
- :name="name"
7
- :resize="resize"
8
- :placeholder="wrapperProps.placeholder"
9
- :autofocus="!!autoFocus"
10
- :autoresize="autoresize"
11
- :rows="rows"
12
- :maxrows="maxrows"
13
- :loading="loading"
14
- :loading-icon="loadingIcon"
15
- :readonly="readonly"
16
- :ui="ui"
17
- @update:model-value="onChange"
18
- />
19
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <Textarea
4
+ :model-value="value"
5
+ :disabled="wrapperProps.disabled"
6
+ :name="name"
7
+ :resize="resize"
8
+ :placeholder="wrapperProps.placeholder"
9
+ :autofocus="!!autoFocus"
10
+ :autoresize="autoresize"
11
+ :rows="rows"
12
+ :maxrows="maxrows"
13
+ :loading="loading"
14
+ :loading-icon="loadingIcon"
15
+ :readonly="readonly"
16
+ :ui="ui"
17
+ @update:model-value="onChange"
18
+ />
19
+ </FieldWrapper>
20
20
  </template>
21
21
 
22
22
  <script setup>
@@ -1,21 +1,21 @@
1
1
  <template>
2
- <FieldWrapper
3
- v-bind="wrapperProps"
4
- label=""
5
- description=""
6
- >
7
- <Switch
8
- :model-value="value"
9
- :disabled="wrapperProps.disabled"
10
- :name="name"
11
- :ui="ui"
12
- :label="label"
13
- :description="description"
14
- :loading="loading"
15
- :loading-icon="loadingIcon"
16
- @update:modelValue="onChange"
17
- />
18
- </FieldWrapper>
2
+ <FieldWrapper
3
+ v-bind="wrapperProps"
4
+ label=""
5
+ description=""
6
+ >
7
+ <Switch
8
+ :model-value="value"
9
+ :disabled="wrapperProps.disabled"
10
+ :name="name"
11
+ :ui="ui"
12
+ :label="label"
13
+ :description="description"
14
+ :loading="loading"
15
+ :loading-icon="loadingIcon"
16
+ @update:modelValue="onChange"
17
+ />
18
+ </FieldWrapper>
19
19
  </template>
20
20
 
21
21
  <script setup>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div class="upload-image-form">
3
+ <input
4
+ ref="fileInput"
5
+ type="file"
6
+ accept="image/*"
7
+ @change="handleFileSelect"
8
+ />
9
+ <button
10
+ type="button"
11
+ @click="handleUpload"
12
+ >
13
+ Upload
14
+ </button>
15
+ </div>
16
+ </template>
17
+
18
+ <script setup>
19
+ import { ref } from "vue";
20
+ const props = defineProps({
21
+ options: { type: Object, required: false }
22
+ });
23
+ const emit = defineEmits(["submit"]);
24
+ const fileInput = ref();
25
+ const selectedFile = ref(null);
26
+ const handleFileSelect = (event) => {
27
+ const target = event.target;
28
+ const file = target.files?.[0];
29
+ if (file) {
30
+ selectedFile.value = file;
31
+ }
32
+ };
33
+ const handleUpload = async () => {
34
+ if (!selectedFile.value) return;
35
+ const url = URL.createObjectURL(selectedFile.value);
36
+ emit("submit", url);
37
+ };
38
+ </script>
@@ -0,0 +1,11 @@
1
+ interface Props {
2
+ options?: {
3
+ requestOptions?: any;
4
+ };
5
+ }
6
+ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ submit: (url: string) => any;
8
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
9
+ onSubmit?: ((url: string) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ export default _default;