@antify/ui 2.5.2 → 2.5.4
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/components/AntModal.vue +1 -1
- package/dist/components/inputs/AntDateInput.vue +43 -27
- package/dist/components/inputs/__stories/AntDateInput.stories.d.ts +1 -1
- package/dist/components/inputs/__stories/AntDateInput.stories.js +35 -0
- package/dist/components/inputs/__stories/AntDateInput.stories.mjs +35 -0
- package/package.json +1 -1
|
@@ -65,7 +65,7 @@ function closeModal() {
|
|
|
65
65
|
:class="{'w-full h-full': fullscreen, 'border border-base-300 rounded-md shadow-md': !fullscreen}"
|
|
66
66
|
>
|
|
67
67
|
<div
|
|
68
|
-
class="bg-white p-2 flex items-center justify-between"
|
|
68
|
+
class="bg-white p-2 flex items-center justify-between gap-2"
|
|
69
69
|
>
|
|
70
70
|
<slot name="title">
|
|
71
71
|
<div class="relative text-for-white-bg-font text-lg font-medium">
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
} from 'vue';
|
|
5
5
|
import AntField from '../forms/AntField.vue';
|
|
6
6
|
import AntBaseInput from './Elements/AntBaseInput.vue';
|
|
7
|
+
import AntButton from '../buttons/AntButton.vue';
|
|
7
8
|
import AntIcon from '../AntIcon.vue';
|
|
8
9
|
import {
|
|
9
10
|
Size,
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
useVModel,
|
|
13
14
|
} from '@vueuse/core';
|
|
14
15
|
import {
|
|
15
|
-
InputState,
|
|
16
|
+
Grouped, InputState, State,
|
|
16
17
|
} from '../../enums';
|
|
17
18
|
import {
|
|
18
19
|
BaseInputType,
|
|
@@ -24,7 +25,7 @@ import {
|
|
|
24
25
|
AntDateInputTypes,
|
|
25
26
|
} from './__types/AntDateInput.types';
|
|
26
27
|
import {
|
|
27
|
-
faCalendar, faClock,
|
|
28
|
+
faCalendar, faClock, faMultiply,
|
|
28
29
|
} from '@fortawesome/free-solid-svg-icons';
|
|
29
30
|
import {
|
|
30
31
|
IconSize,
|
|
@@ -47,6 +48,7 @@ const props = withDefaults(defineProps<{
|
|
|
47
48
|
messages?: string[];
|
|
48
49
|
min?: string;
|
|
49
50
|
max?: string;
|
|
51
|
+
nullable?: boolean;
|
|
50
52
|
}>(), {
|
|
51
53
|
state: InputState.base,
|
|
52
54
|
type: AntDateInputTypes.date,
|
|
@@ -55,6 +57,7 @@ const props = withDefaults(defineProps<{
|
|
|
55
57
|
skeleton: false,
|
|
56
58
|
size: Size.md,
|
|
57
59
|
messages: () => [],
|
|
60
|
+
nullable: false,
|
|
58
61
|
});
|
|
59
62
|
const emit = defineEmits([
|
|
60
63
|
'update:modelValue',
|
|
@@ -78,6 +81,7 @@ const iconColor = computed(() => {
|
|
|
78
81
|
});
|
|
79
82
|
const iconSize = computed(() => props.size === Size.xs || props.size === Size.xs2 ? IconSize.xs : IconSize.sm);
|
|
80
83
|
const _icon = computed(() => props.type === AntDateInputTypes.time ? faClock : faCalendar);
|
|
84
|
+
const _nullable = computed(() => props.nullable && props.modelValue);
|
|
81
85
|
|
|
82
86
|
onMounted(() => {
|
|
83
87
|
handleEnumValidation(props.state, InputState, 'state');
|
|
@@ -102,30 +106,42 @@ function onClickCalendar() {
|
|
|
102
106
|
:state="state"
|
|
103
107
|
:messages="messages"
|
|
104
108
|
>
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
109
|
+
<div class="flex">
|
|
110
|
+
<AntBaseInput
|
|
111
|
+
v-model="_modelValue"
|
|
112
|
+
v-model:input-ref="inputRef"
|
|
113
|
+
:type="type as unknown as BaseInputType"
|
|
114
|
+
:state="state"
|
|
115
|
+
:size="size"
|
|
116
|
+
:skeleton="skeleton"
|
|
117
|
+
:disabled="disabled"
|
|
118
|
+
:readonly="readonly"
|
|
119
|
+
:show-icon="false"
|
|
120
|
+
:min="min"
|
|
121
|
+
:max="max"
|
|
122
|
+
:grouped="_nullable ? Grouped.left : Grouped.none"
|
|
123
|
+
v-bind="$attrs"
|
|
124
|
+
@validate="val => $emit('validate', val)"
|
|
125
|
+
>
|
|
126
|
+
<template #icon-right>
|
|
127
|
+
<AntIcon
|
|
128
|
+
:icon="_icon"
|
|
129
|
+
:color="iconColor"
|
|
130
|
+
:size="iconSize"
|
|
131
|
+
:class="{'cursor-pointer': !disabled && !readonly, 'opacity-50': disabled}"
|
|
132
|
+
@click="onClickCalendar"
|
|
133
|
+
/>
|
|
134
|
+
</template>
|
|
135
|
+
</AntBaseInput>
|
|
136
|
+
|
|
137
|
+
<AntButton
|
|
138
|
+
v-if="_nullable"
|
|
139
|
+
:icon-left="faMultiply"
|
|
140
|
+
:grouped="Grouped.right"
|
|
141
|
+
:state="state as unknown as State"
|
|
142
|
+
:size="size"
|
|
143
|
+
@click="_modelValue = null"
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
130
146
|
</AntField>
|
|
131
147
|
</template>
|
|
@@ -165,6 +165,41 @@ const Summary = exports.Summary = {
|
|
|
165
165
|
/>
|
|
166
166
|
</AntFormGroup>
|
|
167
167
|
|
|
168
|
+
<AntFormGroupLabel>
|
|
169
|
+
Nullable
|
|
170
|
+
</AntFormGroupLabel>
|
|
171
|
+
<AntFormGroup :direction="Direction.row">
|
|
172
|
+
<AntDateInput
|
|
173
|
+
v-bind="args"
|
|
174
|
+
model-value="2025-01-01"
|
|
175
|
+
nullable
|
|
176
|
+
/>
|
|
177
|
+
<AntDateInput
|
|
178
|
+
v-bind="args"
|
|
179
|
+
model-value="2025-01-01"
|
|
180
|
+
:state="InputState.info"
|
|
181
|
+
nullable
|
|
182
|
+
/>
|
|
183
|
+
<AntDateInput
|
|
184
|
+
v-bind="args"
|
|
185
|
+
model-value="2025-01-01"
|
|
186
|
+
:state="InputState.success"
|
|
187
|
+
nullable
|
|
188
|
+
/>
|
|
189
|
+
<AntDateInput
|
|
190
|
+
v-bind="args"
|
|
191
|
+
model-value="2025-01-01"
|
|
192
|
+
:state="InputState.warning"
|
|
193
|
+
nullable
|
|
194
|
+
/>
|
|
195
|
+
<AntDateInput
|
|
196
|
+
v-bind="args"
|
|
197
|
+
model-value="2025-01-01"
|
|
198
|
+
:state="InputState.danger"
|
|
199
|
+
nullable
|
|
200
|
+
/>
|
|
201
|
+
</AntFormGroup>
|
|
202
|
+
|
|
168
203
|
<AntFormGroupLabel>
|
|
169
204
|
Type
|
|
170
205
|
</AntFormGroupLabel>
|
|
@@ -166,6 +166,41 @@ export const Summary = {
|
|
|
166
166
|
/>
|
|
167
167
|
</AntFormGroup>
|
|
168
168
|
|
|
169
|
+
<AntFormGroupLabel>
|
|
170
|
+
Nullable
|
|
171
|
+
</AntFormGroupLabel>
|
|
172
|
+
<AntFormGroup :direction="Direction.row">
|
|
173
|
+
<AntDateInput
|
|
174
|
+
v-bind="args"
|
|
175
|
+
model-value="2025-01-01"
|
|
176
|
+
nullable
|
|
177
|
+
/>
|
|
178
|
+
<AntDateInput
|
|
179
|
+
v-bind="args"
|
|
180
|
+
model-value="2025-01-01"
|
|
181
|
+
:state="InputState.info"
|
|
182
|
+
nullable
|
|
183
|
+
/>
|
|
184
|
+
<AntDateInput
|
|
185
|
+
v-bind="args"
|
|
186
|
+
model-value="2025-01-01"
|
|
187
|
+
:state="InputState.success"
|
|
188
|
+
nullable
|
|
189
|
+
/>
|
|
190
|
+
<AntDateInput
|
|
191
|
+
v-bind="args"
|
|
192
|
+
model-value="2025-01-01"
|
|
193
|
+
:state="InputState.warning"
|
|
194
|
+
nullable
|
|
195
|
+
/>
|
|
196
|
+
<AntDateInput
|
|
197
|
+
v-bind="args"
|
|
198
|
+
model-value="2025-01-01"
|
|
199
|
+
:state="InputState.danger"
|
|
200
|
+
nullable
|
|
201
|
+
/>
|
|
202
|
+
</AntFormGroup>
|
|
203
|
+
|
|
169
204
|
<AntFormGroupLabel>
|
|
170
205
|
Type
|
|
171
206
|
</AntFormGroupLabel>
|