@vc-shell/framework 1.0.214 → 1.0.216
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/CHANGELOG.md +32 -0
- package/core/composables/useSettings/index.ts +1 -1
- package/dist/core/composables/useSettings/index.d.ts.map +1 -1
- package/dist/framework.js +32321 -24260
- package/dist/index.css +1 -1
- package/dist/locales/en.json +8 -0
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/types/index.d.ts +2 -0
- package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/FIELD_MAP.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/factories.d.ts +2 -1
- package/dist/shared/modules/dynamic/components/factories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/RadioButtonGroup.d.ts +121 -0
- package/dist/shared/modules/dynamic/components/fields/RadioButtonGroup.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.d.ts +362 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +67 -3
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts +4 -1
- package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/index.d.ts +0 -1
- package/dist/ui/components/atoms/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts +40 -28
- package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts +6 -6
- package/dist/ui/components/molecules/index.d.ts +2 -0
- package/dist/ui/components/molecules/index.d.ts.map +1 -1
- package/dist/ui/components/{atoms → molecules}/vc-checkbox/index.d.ts +16 -16
- package/dist/ui/components/{atoms → molecules}/vc-checkbox/index.d.ts.map +1 -1
- package/dist/ui/components/{atoms → molecules}/vc-checkbox/vc-checkbox.stories.d.ts +160 -160
- package/dist/ui/components/molecules/vc-checkbox/vc-checkbox.stories.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-checkbox/vc-checkbox.vue.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts +40 -28
- package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +10 -0
- package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts +28 -28
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts +63 -63
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +9 -9
- package/dist/ui/components/molecules/vc-radio-button/index.d.ts +2 -0
- package/dist/ui/components/molecules/vc-radio-button/index.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.stories.d.ts +687 -0
- package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.stories.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.vue.d.ts +81 -0
- package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.vue.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts +90 -90
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +9 -9
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts +168 -168
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts +1 -0
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts +4 -4
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.stories.d.ts +6 -6
- package/dist/ui/components/organisms/vc-login-form/index.d.ts +1 -72
- package/dist/ui/components/organisms/vc-login-form/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-login-form/vc-login-form.vue.d.ts +4 -2
- package/dist/ui/components/organisms/vc-login-form/vc-login-form.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +5 -4
- package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +71 -42
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +9 -3
- package/shared/components/blade-navigation/types/index.ts +2 -0
- package/shared/modules/dynamic/components/FIELD_MAP.ts +2 -0
- package/shared/modules/dynamic/components/factories.ts +10 -0
- package/shared/modules/dynamic/components/fields/InputCurrency.ts +4 -1
- package/shared/modules/dynamic/components/fields/RadioButtonGroup.ts +82 -0
- package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +1 -1
- package/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.ts +224 -0
- package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +202 -33
- package/shared/modules/dynamic/factories/types/index.ts +1 -1
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +3 -3
- package/shared/modules/dynamic/pages/dynamic-blade-list.vue +1 -1
- package/shared/modules/dynamic/types/index.ts +72 -3
- package/shared/modules/dynamic/types/models.ts +5 -0
- package/ui/components/atoms/index.ts +0 -1
- package/ui/components/atoms/vc-label/vc-label.vue +1 -1
- package/ui/components/molecules/index.ts +2 -0
- package/ui/components/{atoms → molecules}/vc-checkbox/vc-checkbox.stories.ts +3 -3
- package/ui/components/molecules/vc-checkbox/vc-checkbox.vue +204 -0
- package/ui/components/molecules/vc-file-upload/vc-file-upload.vue +1 -1
- package/ui/components/molecules/vc-input/vc-input.vue +122 -33
- package/ui/components/molecules/vc-radio-button/index.ts +1 -0
- package/ui/components/molecules/vc-radio-button/vc-radio-button.stories.ts +97 -0
- package/ui/components/molecules/vc-radio-button/vc-radio-button.vue +197 -0
- package/ui/components/molecules/vc-select/vc-select.vue +1 -1
- package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +42 -0
- package/ui/components/organisms/vc-blade/vc-blade.vue +4 -2
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +4 -4
- package/ui/components/organisms/vc-login-form/index.ts +1 -10
- package/ui/components/organisms/vc-login-form/vc-login-form.vue +20 -0
- package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +8 -0
- package/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +16 -22
- package/ui/components/organisms/vc-table/vc-table.vue +23 -3
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +0 -1
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.vue.d.ts.map +0 -1
- package/ui/components/atoms/vc-checkbox/vc-checkbox.vue +0 -146
- /package/dist/ui/components/{atoms → molecules}/vc-checkbox/vc-checkbox.vue.d.ts +0 -0
- /package/ui/components/{atoms → molecules}/vc-checkbox/index.ts +0 -0
|
@@ -770,6 +770,33 @@ export interface CheckboxSchema extends Omit<SchemaBase, "multilanguage" | "plac
|
|
|
770
770
|
falseValue?: boolean;
|
|
771
771
|
}
|
|
772
772
|
|
|
773
|
+
export interface RadioButtonSchema extends Omit<SchemaBase, "multilanguage" | "placeholder"> {
|
|
774
|
+
/**
|
|
775
|
+
* Component type for radio button.
|
|
776
|
+
* @type {"vc-radio-button-group"}
|
|
777
|
+
*/
|
|
778
|
+
component: "vc-radio-button-group";
|
|
779
|
+
/**
|
|
780
|
+
* Allows to select a boolean value.
|
|
781
|
+
*/
|
|
782
|
+
binary?: boolean;
|
|
783
|
+
/**
|
|
784
|
+
* List of options to be displayed as radio-buttons.
|
|
785
|
+
* @description Array of should be defined in the blade `scope`.
|
|
786
|
+
*/
|
|
787
|
+
options: string;
|
|
788
|
+
/**
|
|
789
|
+
* Name of property that holds radio button value.
|
|
790
|
+
* @type {string}
|
|
791
|
+
*/
|
|
792
|
+
optionValue?: string;
|
|
793
|
+
/**
|
|
794
|
+
* Name of property that holds radio button label.
|
|
795
|
+
* @type {string}
|
|
796
|
+
*/
|
|
797
|
+
optionLabel?: string;
|
|
798
|
+
}
|
|
799
|
+
|
|
773
800
|
/**
|
|
774
801
|
* Fieldset schema interface.
|
|
775
802
|
* @interface
|
|
@@ -963,13 +990,17 @@ export type ControlSchema =
|
|
|
963
990
|
| SwitchSchema
|
|
964
991
|
| TableSchema
|
|
965
992
|
| CustomComponentSchema
|
|
966
|
-
| RatingSchema
|
|
993
|
+
| RatingSchema
|
|
994
|
+
| RadioButtonSchema;
|
|
967
995
|
|
|
968
996
|
export interface FilterBase {
|
|
969
997
|
columns: {
|
|
970
|
-
|
|
998
|
+
/**
|
|
999
|
+
* @deprecated use 'label' in 'controls' instead
|
|
1000
|
+
*/
|
|
1001
|
+
title?: string;
|
|
971
1002
|
id: string;
|
|
972
|
-
controls: (FilterCheckbox | FilterDateInput)[];
|
|
1003
|
+
controls: (FilterCheckbox | FilterDateInput | FilterSwitch | FilterSelect | FilterRadio)[];
|
|
973
1004
|
}[];
|
|
974
1005
|
}
|
|
975
1006
|
|
|
@@ -977,6 +1008,8 @@ export type FilterCheckbox = {
|
|
|
977
1008
|
id: string;
|
|
978
1009
|
field: string;
|
|
979
1010
|
multiple?: boolean;
|
|
1011
|
+
label?: string;
|
|
1012
|
+
tooltip?: string;
|
|
980
1013
|
data: string;
|
|
981
1014
|
optionValue: string;
|
|
982
1015
|
optionLabel: string;
|
|
@@ -987,9 +1020,45 @@ export type FilterDateInput = {
|
|
|
987
1020
|
id: string;
|
|
988
1021
|
field: string;
|
|
989
1022
|
label?: string;
|
|
1023
|
+
tooltip?: string;
|
|
990
1024
|
component: InputSchema["component"];
|
|
991
1025
|
};
|
|
992
1026
|
|
|
1027
|
+
export type FilterSwitch = {
|
|
1028
|
+
id: string;
|
|
1029
|
+
field: string;
|
|
1030
|
+
data: string;
|
|
1031
|
+
label?: string;
|
|
1032
|
+
tooltip?: string;
|
|
1033
|
+
multiple?: boolean;
|
|
1034
|
+
optionValue: string;
|
|
1035
|
+
optionLabel: string;
|
|
1036
|
+
component: SwitchSchema["component"];
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
export type FilterSelect = {
|
|
1040
|
+
id: string;
|
|
1041
|
+
field: string;
|
|
1042
|
+
label?: string;
|
|
1043
|
+
tooltip?: string;
|
|
1044
|
+
data: string;
|
|
1045
|
+
multiple?: boolean;
|
|
1046
|
+
component: SelectSchema["component"];
|
|
1047
|
+
optionValue: string;
|
|
1048
|
+
optionLabel: string;
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
export type FilterRadio = {
|
|
1052
|
+
id: string;
|
|
1053
|
+
field: string;
|
|
1054
|
+
label?: string;
|
|
1055
|
+
tooltip?: string;
|
|
1056
|
+
data: string;
|
|
1057
|
+
optionValue: string;
|
|
1058
|
+
optionLabel: string;
|
|
1059
|
+
component: RadioButtonSchema["component"];
|
|
1060
|
+
};
|
|
1061
|
+
|
|
993
1062
|
export type FilterSchema = FilterBase;
|
|
994
1063
|
|
|
995
1064
|
export interface OverridesSchema {
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
VcSwitch,
|
|
20
20
|
VcTable,
|
|
21
21
|
VcRating,
|
|
22
|
+
VcRadioButton,
|
|
22
23
|
} from "../../../../ui/components";
|
|
23
24
|
import type { ComponentProps, ComponentEmit, ComponentSlots } from "vue-component-type-helpers";
|
|
24
25
|
|
|
@@ -134,6 +135,10 @@ export type ICheckbox = {
|
|
|
134
135
|
slots?: Partial<Pick<ComponentSlots<typeof VcCheckbox>, "default" | "error">>;
|
|
135
136
|
} & FieldOpts<typeof VcCheckbox>;
|
|
136
137
|
|
|
138
|
+
export type IRadioButton = {
|
|
139
|
+
props: ComponentProps<typeof VcRadioButton> | IControlBaseProps;
|
|
140
|
+
} & FieldOpts<typeof VcRadioButton>;
|
|
141
|
+
|
|
137
142
|
export type IDynamicProperties = {
|
|
138
143
|
props:
|
|
139
144
|
| (ComponentProps<typeof VcDynamicProperty> & FromGenericEventsToProps<ComponentEmit<typeof VcDynamicProperty>>)
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
v-if="tooltipVisible"
|
|
28
28
|
ref="tooltipRef"
|
|
29
29
|
:style="floatingStyles"
|
|
30
|
-
class="tw-absolute tw-z-
|
|
30
|
+
class="tw-absolute tw-z-[101] tw-bg-white tw-border tw-border-solid tw-border-[color:#eef0f2] tw-shadow-[1px_1px_8px_rgba(126,142,157,0.25)] tw-rounded-[3px] tw-text-[color:#8e9daa] tw-font-normal tw-py-1 tw-px-2 tw-ml-4"
|
|
31
31
|
>
|
|
32
32
|
<slot name="tooltip"></slot>
|
|
33
33
|
</span>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
2
2
|
import { VcCheckbox } from "./";
|
|
3
|
-
import { VcLabel } from "
|
|
3
|
+
import { VcLabel } from "../../atoms/vc-label";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
title: "
|
|
6
|
+
title: "molecules/VcCheckbox",
|
|
7
7
|
component: VcCheckbox,
|
|
8
8
|
args: {
|
|
9
9
|
modelValue: true,
|
|
@@ -66,7 +66,7 @@ export const Required = Template.bind({});
|
|
|
66
66
|
Required.args = { required: true };
|
|
67
67
|
|
|
68
68
|
export const Error = Template.bind({});
|
|
69
|
-
Error.args = { errorMessage: "This is an error message" };
|
|
69
|
+
Error.args = { errorMessage: "This is an error message", modelValue: false };
|
|
70
70
|
|
|
71
71
|
export const Tooltip = Template.bind({});
|
|
72
72
|
Tooltip.args = { tooltip: "This is a tooltip" };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="vc-checkbox"
|
|
4
|
+
:class="{ 'vc-checkbox_disabled': disabled }"
|
|
5
|
+
>
|
|
6
|
+
<!-- Input label -->
|
|
7
|
+
<VcLabel
|
|
8
|
+
v-if="label"
|
|
9
|
+
class="tw-mb-2"
|
|
10
|
+
:required="required"
|
|
11
|
+
>
|
|
12
|
+
<span>{{ label }}</span>
|
|
13
|
+
<template
|
|
14
|
+
v-if="tooltip"
|
|
15
|
+
#tooltip
|
|
16
|
+
>{{ tooltip }}</template
|
|
17
|
+
>
|
|
18
|
+
</VcLabel>
|
|
19
|
+
<label class="tw-inline-flex tw-select-none tw-cursor-pointer tw-text-base tw-items-center">
|
|
20
|
+
<input
|
|
21
|
+
v-model="value"
|
|
22
|
+
type="checkbox"
|
|
23
|
+
class="vc-checkbox__input"
|
|
24
|
+
:disabled="disabled"
|
|
25
|
+
:true-value="trueValue"
|
|
26
|
+
:false-value="falseValue"
|
|
27
|
+
:class="{
|
|
28
|
+
'vc-checkbox_error': errorMessage,
|
|
29
|
+
}"
|
|
30
|
+
/>
|
|
31
|
+
<span
|
|
32
|
+
v-if="$slots['default']"
|
|
33
|
+
class="tw-ml-2"
|
|
34
|
+
>
|
|
35
|
+
<slot></slot>
|
|
36
|
+
</span>
|
|
37
|
+
<span
|
|
38
|
+
v-if="!label && required"
|
|
39
|
+
class="tw-text-[color:var(--checkbox-required-color)] tw-ml-1"
|
|
40
|
+
>*</span
|
|
41
|
+
>
|
|
42
|
+
</label>
|
|
43
|
+
|
|
44
|
+
<slot
|
|
45
|
+
v-if="errorMessage"
|
|
46
|
+
name="error"
|
|
47
|
+
>
|
|
48
|
+
<VcHint class="vc-checkbox__error tw-mt-1">
|
|
49
|
+
{{ errorMessage }}
|
|
50
|
+
</VcHint>
|
|
51
|
+
</slot>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
55
|
+
<script lang="ts" setup>
|
|
56
|
+
import { MaybeRef, computed, unref } from "vue";
|
|
57
|
+
import { VcHint } from "./../../atoms/vc-hint";
|
|
58
|
+
import { VcLabel } from "../../atoms/vc-label";
|
|
59
|
+
export interface Props {
|
|
60
|
+
modelValue: MaybeRef<boolean>;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
required?: boolean;
|
|
63
|
+
name?: string;
|
|
64
|
+
errorMessage?: string;
|
|
65
|
+
trueValue?: boolean;
|
|
66
|
+
falseValue?: boolean;
|
|
67
|
+
label?: string;
|
|
68
|
+
tooltip?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface Emits {
|
|
72
|
+
(event: "update:modelValue", value: boolean): void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const props = withDefaults(defineProps<Props>(), { name: "Field", trueValue: true, falseValue: false });
|
|
76
|
+
const emit = defineEmits<Emits>();
|
|
77
|
+
|
|
78
|
+
defineSlots<{
|
|
79
|
+
default: (props: any) => any;
|
|
80
|
+
error: (props: any) => any;
|
|
81
|
+
}>();
|
|
82
|
+
|
|
83
|
+
const value = computed({
|
|
84
|
+
get() {
|
|
85
|
+
return unref(props.modelValue);
|
|
86
|
+
},
|
|
87
|
+
set(newValue) {
|
|
88
|
+
emit("update:modelValue", newValue);
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<style lang="scss">
|
|
94
|
+
:root {
|
|
95
|
+
--checkbox-size: 14px;
|
|
96
|
+
--checkbox-border-radius: 2px;
|
|
97
|
+
--checkbox-background-color: #ffffff;
|
|
98
|
+
--checkbox-color-error: #f14e4e;
|
|
99
|
+
--checkbox-required-color: #f14e4e;
|
|
100
|
+
|
|
101
|
+
--checkbox-active: #43b0e6;
|
|
102
|
+
--checkbox-active-inner: #fff;
|
|
103
|
+
--checkbox-focus: 2px rgba(39, 94, 254, 0.3);
|
|
104
|
+
--checkbox-border: #bbc1e1;
|
|
105
|
+
--checkbox-border-hover: #43b0e6;
|
|
106
|
+
--checkbox-background: #fff;
|
|
107
|
+
--checkbox-disabled: #f6f8ff;
|
|
108
|
+
--checkbox-disabled-inner: #e1e6f9;
|
|
109
|
+
--checkbox-error: #f14e4e;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.vc-checkbox {
|
|
113
|
+
input[type="checkbox"] {
|
|
114
|
+
border-radius: 2px;
|
|
115
|
+
appearance: none;
|
|
116
|
+
height: var(--checkbox-size);
|
|
117
|
+
outline: none;
|
|
118
|
+
display: inline-block;
|
|
119
|
+
vertical-align: top;
|
|
120
|
+
position: relative;
|
|
121
|
+
margin: 0;
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
border: 1px solid var(--checkbox-border-color, var(--checkbox-border));
|
|
124
|
+
background: var(--checkbox-bg, var(--checkbox-background));
|
|
125
|
+
width: var(--checkbox-size);
|
|
126
|
+
border-radius: 3px;
|
|
127
|
+
transition:
|
|
128
|
+
background 0.3s,
|
|
129
|
+
border-color 0.3s,
|
|
130
|
+
box-shadow 0.2s;
|
|
131
|
+
|
|
132
|
+
&:checked {
|
|
133
|
+
--checkbox-bg: var(--checkbox-active);
|
|
134
|
+
--checkbox-border-color: var(--checkbox-active);
|
|
135
|
+
--checkbox-after-opacity-duration: 0.3s;
|
|
136
|
+
--checkbox-after-transform-duration: 0.6s;
|
|
137
|
+
--checkbox-after-transform-ease: cubic-bezier(0.2, 0.85, 0.32, 1.2);
|
|
138
|
+
--checkbox-scale: 0.5;
|
|
139
|
+
--checkbox-after-opacity: 1;
|
|
140
|
+
--r: 43deg;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:disabled {
|
|
144
|
+
--checkbox-bg: var(--checkbox-disabled);
|
|
145
|
+
cursor: not-allowed;
|
|
146
|
+
opacity: 0.9;
|
|
147
|
+
&:checked {
|
|
148
|
+
--checkbox-bg: var(--checkbox-disabled-inner);
|
|
149
|
+
--checkbox-border-color: var(--checkbox-border);
|
|
150
|
+
}
|
|
151
|
+
& + label {
|
|
152
|
+
cursor: not-allowed;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&:hover {
|
|
157
|
+
&:not(:checked) {
|
|
158
|
+
&:not(:disabled) {
|
|
159
|
+
--checkbox-border-color: var(--checkbox-border-hover);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:after {
|
|
165
|
+
content: "";
|
|
166
|
+
display: block;
|
|
167
|
+
position: absolute;
|
|
168
|
+
width: 5px;
|
|
169
|
+
height: 9px;
|
|
170
|
+
border: 2px solid var(--checkbox-background);
|
|
171
|
+
border-top: 0;
|
|
172
|
+
border-left: 0;
|
|
173
|
+
left: 4px;
|
|
174
|
+
top: 1px;
|
|
175
|
+
transform: rotate(var(--r, 20deg));
|
|
176
|
+
opacity: var(--checkbox-after-opacity, 0);
|
|
177
|
+
transition:
|
|
178
|
+
transform var(--checkbox-after-transform-duration, 0.3s) var(--checkbox-after-transform-ease, ease),
|
|
179
|
+
opacity var(--checkbox-after-opacity-duration, 0.2s);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
& + label {
|
|
183
|
+
font-size: 14px;
|
|
184
|
+
line-height: 21px;
|
|
185
|
+
display: inline-flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
cursor: pointer;
|
|
188
|
+
margin-left: 4px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&.vc-checkbox_error {
|
|
192
|
+
--checkbox-border-color: var(--checkbox-error);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&_disabled &__label {
|
|
197
|
+
cursor: auto;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
&__error {
|
|
201
|
+
--hint-color: var(--checkbox-error);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
</style>
|
|
@@ -74,7 +74,7 @@ export interface Emits {
|
|
|
74
74
|
|
|
75
75
|
const props = withDefaults(defineProps<Props>(), {
|
|
76
76
|
variant: "gallery",
|
|
77
|
-
accept: ".jpg, .png, .jpeg, .webp, .heic",
|
|
77
|
+
accept: ".jpg, .png, .jpeg, .webp, .heic, .svg",
|
|
78
78
|
name: "Gallery",
|
|
79
79
|
icon: "fas fa-cloud-upload-alt",
|
|
80
80
|
});
|
|
@@ -58,19 +58,55 @@
|
|
|
58
58
|
:emit-value="emitValue"
|
|
59
59
|
:placeholder="placeholder"
|
|
60
60
|
>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
<template v-if="type === 'datetime-local' || type === 'date'">
|
|
62
|
+
<VueDatePicker
|
|
63
|
+
v-model="handleValue"
|
|
64
|
+
:placeholder="
|
|
65
|
+
placeholder || type === 'datetime-local'
|
|
66
|
+
? $t('COMPONENTS.MOLECULES.VC_INPUT.DATE_TIME_PLACEHOLDER')
|
|
67
|
+
: $t('COMPONENTS.MOLECULES.VC_INPUT.DATE_PLACEHOLDER')
|
|
68
|
+
"
|
|
69
|
+
:disabled="disabled"
|
|
70
|
+
:name="name"
|
|
71
|
+
:maxlength="maxlength"
|
|
72
|
+
:autofocus="autofocus"
|
|
73
|
+
:max-date="maxDate"
|
|
74
|
+
time-picker-inline
|
|
75
|
+
:enable-time-picker="type === 'datetime-local'"
|
|
76
|
+
:format="formatDateWithLocale"
|
|
77
|
+
:locale="locale"
|
|
78
|
+
:start-time="{
|
|
79
|
+
hours: 0,
|
|
80
|
+
minutes: 0,
|
|
81
|
+
}"
|
|
82
|
+
:clearable="false"
|
|
83
|
+
:config="{
|
|
84
|
+
closeOnAutoApply: false,
|
|
85
|
+
}"
|
|
86
|
+
auto-apply
|
|
87
|
+
:teleport-center="$isMobile.value"
|
|
88
|
+
:is24="isBrowserLocale24h"
|
|
89
|
+
v-bind="datePickerOptions"
|
|
90
|
+
:teleport="$isDesktop.value ? 'body' : undefined"
|
|
91
|
+
class="vc-input__input"
|
|
92
|
+
@keydown="onKeyDown"
|
|
93
|
+
></VueDatePicker>
|
|
94
|
+
</template>
|
|
95
|
+
<template v-else>
|
|
96
|
+
<input
|
|
97
|
+
ref="inputRef"
|
|
98
|
+
v-model="handleValue"
|
|
99
|
+
:placeholder="placeholder"
|
|
100
|
+
:type="internalTypeComputed"
|
|
101
|
+
:disabled="disabled"
|
|
102
|
+
:name="name"
|
|
103
|
+
:maxlength="maxlength"
|
|
104
|
+
:autofocus="autofocus"
|
|
105
|
+
:max="maxDate"
|
|
106
|
+
class="vc-input__input"
|
|
107
|
+
@keydown="onKeyDown"
|
|
108
|
+
/>
|
|
109
|
+
</template>
|
|
74
110
|
</slot>
|
|
75
111
|
<div
|
|
76
112
|
v-if="suffix"
|
|
@@ -173,6 +209,10 @@
|
|
|
173
209
|
import { computed, ref, unref, watch } from "vue";
|
|
174
210
|
import { VcLabel, VcIcon, VcHint } from "./../../";
|
|
175
211
|
import moment from "moment";
|
|
212
|
+
import VueDatePicker, { VueDatePickerProps } from "@vuepic/vue-datepicker";
|
|
213
|
+
import "@vuepic/vue-datepicker/dist/main.css";
|
|
214
|
+
import * as Locales from "date-fns/locale";
|
|
215
|
+
import { Locale } from "date-fns";
|
|
176
216
|
|
|
177
217
|
export interface Props {
|
|
178
218
|
/**
|
|
@@ -262,6 +302,14 @@ export interface Props {
|
|
|
262
302
|
* Input current language
|
|
263
303
|
*/
|
|
264
304
|
currentLanguage?: string;
|
|
305
|
+
/**
|
|
306
|
+
* VueDatePicker options
|
|
307
|
+
*
|
|
308
|
+
* Used only when type is 'date' or 'datetime-local'
|
|
309
|
+
*
|
|
310
|
+
* @see https://vue3datepicker.com/
|
|
311
|
+
*/
|
|
312
|
+
datePickerOptions?: VueDatePickerProps;
|
|
265
313
|
}
|
|
266
314
|
|
|
267
315
|
export interface Emits {
|
|
@@ -338,7 +386,7 @@ let emitTimer: NodeJS.Timeout;
|
|
|
338
386
|
let emitValueFn;
|
|
339
387
|
const temp = ref();
|
|
340
388
|
const inputRef = ref();
|
|
341
|
-
|
|
389
|
+
const locale = window.navigator.language;
|
|
342
390
|
const internalType = ref(unref(props.type));
|
|
343
391
|
|
|
344
392
|
const internalTypeComputed = computed({
|
|
@@ -370,13 +418,7 @@ const mutatedModel = ref();
|
|
|
370
418
|
watch(
|
|
371
419
|
rawModel,
|
|
372
420
|
(newVal) => {
|
|
373
|
-
if (props.type === "
|
|
374
|
-
if (newVal instanceof Date && !isNaN(newVal.valueOf())) {
|
|
375
|
-
mutatedModel.value = moment(newVal).format(props.type === "datetime-local" ? "YYYY-MM-DDTHH:mm" : "YYYY-MM-DD");
|
|
376
|
-
} else if (typeof newVal === "string") {
|
|
377
|
-
mutatedModel.value = new Date(newVal).toISOString().slice(0, props.type === "datetime-local" ? 16 : 10);
|
|
378
|
-
}
|
|
379
|
-
} else if (props.type === "number" && newVal !== null) {
|
|
421
|
+
if (props.type === "number" && newVal !== null) {
|
|
380
422
|
mutatedModel.value = parseFloat(newVal as string);
|
|
381
423
|
} else if (props.type === "integer" && newVal !== null) {
|
|
382
424
|
mutatedModel.value = Math.trunc(newVal as number);
|
|
@@ -391,6 +433,27 @@ watch(
|
|
|
391
433
|
{ immediate: true },
|
|
392
434
|
);
|
|
393
435
|
|
|
436
|
+
const isBrowserLocale24h = (() => {
|
|
437
|
+
const hr = new Intl.DateTimeFormat(locale, { hour: "numeric" }).format();
|
|
438
|
+
return Number.isInteger(Number(hr));
|
|
439
|
+
})();
|
|
440
|
+
|
|
441
|
+
const formatDateWithLocale: (date: Date) => string = (date) => {
|
|
442
|
+
const options: Intl.DateTimeFormatOptions = {
|
|
443
|
+
year: "numeric",
|
|
444
|
+
month: "numeric",
|
|
445
|
+
day: "numeric",
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
if (props.type === "datetime-local") {
|
|
449
|
+
options.hour = "numeric";
|
|
450
|
+
options.minute = "numeric";
|
|
451
|
+
options.hour12 = !isBrowserLocale24h;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
455
|
+
};
|
|
456
|
+
|
|
394
457
|
function onKeyDown(e: KeyboardEvent) {
|
|
395
458
|
const allowedKeys = ["Backspace", "Delete", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
396
459
|
const keypressed = e.key;
|
|
@@ -411,9 +474,7 @@ function emitValue(val: string | number | Date | null) {
|
|
|
411
474
|
emitValueFn = () => {
|
|
412
475
|
if (mutatedModel.value !== val) {
|
|
413
476
|
let value;
|
|
414
|
-
if (
|
|
415
|
-
value = val ? moment(val).toDate() : undefined;
|
|
416
|
-
} else if (props.type === "number" && val !== null) {
|
|
477
|
+
if (props.type === "number" && val !== null) {
|
|
417
478
|
value = parseFloat(val as string);
|
|
418
479
|
} else if (props.type === "integer" && val !== null) {
|
|
419
480
|
value = Math.trunc(parseInt(val as string));
|
|
@@ -451,6 +512,10 @@ function onReset() {
|
|
|
451
512
|
--input-placeholder-color: #a5a5a5;
|
|
452
513
|
--input-clear-color: #43b0e6;
|
|
453
514
|
--input-clear-color-hover: #319ed4;
|
|
515
|
+
--dp-input-padding: 10px 0px 10px 10px;
|
|
516
|
+
--dp-input-icon-padding: 25px;
|
|
517
|
+
--dp-font-size: 13px;
|
|
518
|
+
--dp-font-family: "Roboto", sans-serif;
|
|
454
519
|
}
|
|
455
520
|
|
|
456
521
|
.vc-input {
|
|
@@ -531,20 +596,44 @@ function onReset() {
|
|
|
531
596
|
&_disabled &__field {
|
|
532
597
|
@apply tw-bg-[#fafafa] tw-text-[#424242];
|
|
533
598
|
}
|
|
599
|
+
|
|
600
|
+
.slide-up-enter-active,
|
|
601
|
+
.slide-up-leave-active {
|
|
602
|
+
transition: all 0.25s ease-out;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.slide-up-enter-from {
|
|
606
|
+
opacity: 0;
|
|
607
|
+
transform: translateY(5px);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.slide-up-leave-to {
|
|
611
|
+
opacity: 0;
|
|
612
|
+
transform: translateY(-5px);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.dp__pm_am_button {
|
|
617
|
+
background: var(--dp-primary-color) !important;
|
|
618
|
+
color: var(--dp-primary-text-color) !important;
|
|
619
|
+
border: none !important;
|
|
620
|
+
padding: var(--dp-common-padding) !important;
|
|
621
|
+
border-radius: var(--dp-border-radius) !important;
|
|
622
|
+
cursor: pointer !important;
|
|
534
623
|
}
|
|
535
624
|
|
|
536
|
-
.
|
|
537
|
-
|
|
538
|
-
transition: all 0.25s ease-out;
|
|
625
|
+
.dp__input_icons {
|
|
626
|
+
padding: 6px 0 !important;
|
|
539
627
|
}
|
|
540
628
|
|
|
541
|
-
.
|
|
542
|
-
|
|
543
|
-
|
|
629
|
+
.dp__input {
|
|
630
|
+
&::-ms-reveal,
|
|
631
|
+
&::-ms-clear {
|
|
632
|
+
@apply tw-hidden;
|
|
633
|
+
}
|
|
544
634
|
}
|
|
545
635
|
|
|
546
|
-
.
|
|
547
|
-
|
|
548
|
-
transform: translateY(-5px);
|
|
636
|
+
input.dp__input::placeholder {
|
|
637
|
+
color: #818181 !important;
|
|
549
638
|
}
|
|
550
639
|
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as VcRadioButton } from "./vc-radio-button.vue";
|