@antify/ui 2.2.16 → 2.3.0
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/index.d.ts +2 -1
- package/dist/components/index.js +7 -0
- package/dist/components/index.mjs +2 -0
- package/dist/components/inputs/AntImageInput.vue +199 -0
- package/dist/components/inputs/__stories/AntImageInput.stories.d.ts +10 -0
- package/dist/components/inputs/__stories/AntImageInput.stories.js +139 -0
- package/dist/components/inputs/__stories/AntImageInput.stories.mjs +138 -0
- package/package.json +1 -1
|
@@ -38,6 +38,7 @@ import AntTagInput from './inputs/AntTagInput.vue';
|
|
|
38
38
|
import AntTextarea from './inputs/AntTextarea.vue';
|
|
39
39
|
import AntTextInput from './inputs/AntTextInput.vue';
|
|
40
40
|
import AntUnitInput from './inputs/AntUnitInput.vue';
|
|
41
|
+
import AntImageInput from './inputs/AntImageInput.vue';
|
|
41
42
|
import AntNavLeftLayout from './layouts/AntNavLeftLayout.vue';
|
|
42
43
|
import AntNavbar from './navbar/AntNavbar.vue';
|
|
43
44
|
import AntNavbarItem from './navbar/AntNavbarItem.vue';
|
|
@@ -63,4 +64,4 @@ import AntTag from './AntTag.vue';
|
|
|
63
64
|
import AntToast from './AntToast.vue';
|
|
64
65
|
import AntToaster from './AntToaster.vue';
|
|
65
66
|
import AntTooltip from './AntTooltip.vue';
|
|
66
|
-
export { AntActionButton, AntButton, AntCreateButton, AntDeleteButton, AntDuplicateButton, AntEditButton, AntSaveAndNewButton, AntSaveButton, AntCrud, AntCrudDetail, AntCrudDetailActions, AntCrudDetailNav, AntCrudTableFilter, AntCrudTableNav, AntDeleteDialog, AntDialog, AntField, AntFormGroup, AntFormGroupLabel, AntBaseInput, AntSelectMenu, AntInputDescription, AntInputLabel, AntInputLimiter, AntCheckbox, AntCheckboxGroup, AntDateInput, AntNumberInput, AntPasswordInput, AntRadio, AntRadioGroup, AntRangeSlider, AntSearch, AntSelect, AntSwitch, AntSwitcher, AntTagInput, AntTextarea, AntTextInput, AntUnitInput, AntNavLeftLayout, AntNavbar, AntNavbarItem, AntTable, AntTabs, AntTransitionCollapseHeight, AntAccordion, AntAccordionItem, AntAlert, AntCard, AntContent, AntDropdown, AntIcon, AntKeycap, AntListGroup, AntListGroupItem, AntModal, AntPagination, AntPopover, AntSkeleton, AntSpinner, AntTag, AntToast, AntToaster, AntTooltip, };
|
|
67
|
+
export { AntActionButton, AntButton, AntCreateButton, AntDeleteButton, AntDuplicateButton, AntEditButton, AntSaveAndNewButton, AntSaveButton, AntCrud, AntCrudDetail, AntCrudDetailActions, AntCrudDetailNav, AntCrudTableFilter, AntCrudTableNav, AntDeleteDialog, AntDialog, AntField, AntFormGroup, AntFormGroupLabel, AntBaseInput, AntSelectMenu, AntInputDescription, AntInputLabel, AntInputLimiter, AntCheckbox, AntCheckboxGroup, AntDateInput, AntNumberInput, AntPasswordInput, AntRadio, AntRadioGroup, AntRangeSlider, AntSearch, AntSelect, AntSwitch, AntSwitcher, AntTagInput, AntTextarea, AntTextInput, AntUnitInput, AntImageInput, AntNavLeftLayout, AntNavbar, AntNavbarItem, AntTable, AntTabs, AntTransitionCollapseHeight, AntAccordion, AntAccordionItem, AntAlert, AntCard, AntContent, AntDropdown, AntIcon, AntKeycap, AntListGroup, AntListGroupItem, AntModal, AntPagination, AntPopover, AntSkeleton, AntSpinner, AntTag, AntToast, AntToaster, AntTooltip, };
|
package/dist/components/index.js
CHANGED
|
@@ -171,6 +171,12 @@ Object.defineProperty(exports, "AntIcon", {
|
|
|
171
171
|
return _AntIcon.default;
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
|
+
Object.defineProperty(exports, "AntImageInput", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () {
|
|
177
|
+
return _AntImageInput.default;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
174
180
|
Object.defineProperty(exports, "AntInputDescription", {
|
|
175
181
|
enumerable: true,
|
|
176
182
|
get: function () {
|
|
@@ -433,6 +439,7 @@ var _AntTagInput = _interopRequireDefault(require("./inputs/AntTagInput.vue"));
|
|
|
433
439
|
var _AntTextarea = _interopRequireDefault(require("./inputs/AntTextarea.vue"));
|
|
434
440
|
var _AntTextInput = _interopRequireDefault(require("./inputs/AntTextInput.vue"));
|
|
435
441
|
var _AntUnitInput = _interopRequireDefault(require("./inputs/AntUnitInput.vue"));
|
|
442
|
+
var _AntImageInput = _interopRequireDefault(require("./inputs/AntImageInput.vue"));
|
|
436
443
|
var _AntNavLeftLayout = _interopRequireDefault(require("./layouts/AntNavLeftLayout.vue"));
|
|
437
444
|
var _AntNavbar = _interopRequireDefault(require("./navbar/AntNavbar.vue"));
|
|
438
445
|
var _AntNavbarItem = _interopRequireDefault(require("./navbar/AntNavbarItem.vue"));
|
|
@@ -38,6 +38,7 @@ import AntTagInput from "./inputs/AntTagInput.vue";
|
|
|
38
38
|
import AntTextarea from "./inputs/AntTextarea.vue";
|
|
39
39
|
import AntTextInput from "./inputs/AntTextInput.vue";
|
|
40
40
|
import AntUnitInput from "./inputs/AntUnitInput.vue";
|
|
41
|
+
import AntImageInput from "./inputs/AntImageInput.vue";
|
|
41
42
|
import AntNavLeftLayout from "./layouts/AntNavLeftLayout.vue";
|
|
42
43
|
import AntNavbar from "./navbar/AntNavbar.vue";
|
|
43
44
|
import AntNavbarItem from "./navbar/AntNavbarItem.vue";
|
|
@@ -104,6 +105,7 @@ export {
|
|
|
104
105
|
AntTextarea,
|
|
105
106
|
AntTextInput,
|
|
106
107
|
AntUnitInput,
|
|
108
|
+
AntImageInput,
|
|
107
109
|
AntNavLeftLayout,
|
|
108
110
|
AntNavbar,
|
|
109
111
|
AntNavbarItem,
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
onMounted,
|
|
5
|
+
ref,
|
|
6
|
+
} from 'vue';
|
|
7
|
+
import AntField from '../forms/AntField.vue';
|
|
8
|
+
import {
|
|
9
|
+
Size,
|
|
10
|
+
} from '../../enums/Size.enum';
|
|
11
|
+
import {
|
|
12
|
+
InputState, State,
|
|
13
|
+
} from '../../enums';
|
|
14
|
+
import {
|
|
15
|
+
useVModel,
|
|
16
|
+
} from '@vueuse/core';
|
|
17
|
+
import {
|
|
18
|
+
handleEnumValidation,
|
|
19
|
+
} from '../../handler';
|
|
20
|
+
import {
|
|
21
|
+
faImage, faMultiply, faUpload,
|
|
22
|
+
} from '@fortawesome/free-solid-svg-icons';
|
|
23
|
+
import AntIcon from '../AntIcon.vue';
|
|
24
|
+
import {
|
|
25
|
+
IconSize,
|
|
26
|
+
} from '../__types';
|
|
27
|
+
import AntButton from '../buttons/AntButton.vue';
|
|
28
|
+
import AntSpinner from '../AntSpinner.vue';
|
|
29
|
+
import AntInputDescription from './Elements/AntInputDescription.vue';
|
|
30
|
+
import AntSkeleton from '../AntSkeleton.vue';
|
|
31
|
+
|
|
32
|
+
defineOptions({
|
|
33
|
+
inheritAttrs: false,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const props = withDefaults(defineProps<{
|
|
37
|
+
modelValue: string | null;
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
label?: string;
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
size?: Size;
|
|
43
|
+
state?: InputState;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
skeleton?: boolean;
|
|
46
|
+
wrapperClass?: string | Record<string, boolean>;
|
|
47
|
+
messages?: string[];
|
|
48
|
+
expanded?: boolean;
|
|
49
|
+
}>(), {
|
|
50
|
+
state: InputState.base,
|
|
51
|
+
disabled: false,
|
|
52
|
+
skeleton: false,
|
|
53
|
+
size: Size.md,
|
|
54
|
+
messages: () => [],
|
|
55
|
+
expanded: true,
|
|
56
|
+
loading: false,
|
|
57
|
+
});
|
|
58
|
+
const emit = defineEmits([
|
|
59
|
+
'update:modelValue',
|
|
60
|
+
'validate',
|
|
61
|
+
]);
|
|
62
|
+
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
63
|
+
const descriptionFontSize = computed(() => {
|
|
64
|
+
if (props.size === Size.xs2 || props.size === Size.xs) {
|
|
65
|
+
return Size.xs;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return Size.sm;
|
|
69
|
+
});
|
|
70
|
+
const fileInput = ref<HTMLInputElement | null>(null);
|
|
71
|
+
|
|
72
|
+
const openFileDialog = () => {
|
|
73
|
+
fileInput.value?.click();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handleFileChange = (event: Event) => {
|
|
77
|
+
const target = event.target as HTMLInputElement;
|
|
78
|
+
const file = target.files?.[0];
|
|
79
|
+
if (file) {
|
|
80
|
+
const reader = new FileReader();
|
|
81
|
+
reader.onload = () => {
|
|
82
|
+
emit('update:modelValue', reader.result as string);
|
|
83
|
+
};
|
|
84
|
+
reader.readAsDataURL(file);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
onMounted(() => {
|
|
89
|
+
handleEnumValidation(props.state, InputState, 'state');
|
|
90
|
+
handleEnumValidation(props.size, Size, 'size');
|
|
91
|
+
});
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<AntField
|
|
96
|
+
:label="label"
|
|
97
|
+
:size="size"
|
|
98
|
+
:skeleton="skeleton"
|
|
99
|
+
:state="state"
|
|
100
|
+
:messages="messages"
|
|
101
|
+
:expanded="expanded"
|
|
102
|
+
>
|
|
103
|
+
<div
|
|
104
|
+
class="flex gap-2.5 w-full"
|
|
105
|
+
:class="{'cursor-pointer': !disabled && !skeleton}"
|
|
106
|
+
>
|
|
107
|
+
<div>
|
|
108
|
+
<div class="h-[70px] w-[70px] bg-gray-100 rounded-full overflow-hidden flex items-center justify-center relative">
|
|
109
|
+
<img
|
|
110
|
+
v-if="_modelValue && !skeleton"
|
|
111
|
+
:src="_modelValue"
|
|
112
|
+
alt="Image"
|
|
113
|
+
class="h-full w-full object-cover"
|
|
114
|
+
>
|
|
115
|
+
|
|
116
|
+
<AntIcon
|
|
117
|
+
v-else
|
|
118
|
+
class="text-base-300"
|
|
119
|
+
:size="IconSize.xl3"
|
|
120
|
+
:icon="faImage"
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
<div
|
|
124
|
+
v-if="loading"
|
|
125
|
+
class="absolute flex items-center justify-center inset-0 bg-base-600/50 rounded-full"
|
|
126
|
+
>
|
|
127
|
+
<AntSpinner
|
|
128
|
+
:state="State.primary"
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<AntSkeleton
|
|
133
|
+
v-if="skeleton"
|
|
134
|
+
absolute
|
|
135
|
+
rounded-full
|
|
136
|
+
/>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<div class="flex flex-col gap-2.5 w-full">
|
|
141
|
+
<div class="flex items-center relative w-full justify-between">
|
|
142
|
+
<input
|
|
143
|
+
v-if="!disabled && !skeleton"
|
|
144
|
+
ref="fileInput"
|
|
145
|
+
type="file"
|
|
146
|
+
accept="image/*"
|
|
147
|
+
class="hidden"
|
|
148
|
+
@change="handleFileChange"
|
|
149
|
+
>
|
|
150
|
+
|
|
151
|
+
<span class="text-sm text-for-white-bg-font relative">
|
|
152
|
+
Upload Image
|
|
153
|
+
|
|
154
|
+
<AntSkeleton
|
|
155
|
+
v-if="skeleton"
|
|
156
|
+
absolute
|
|
157
|
+
rounded
|
|
158
|
+
/>
|
|
159
|
+
</span>
|
|
160
|
+
|
|
161
|
+
<AntButton
|
|
162
|
+
v-if="_modelValue"
|
|
163
|
+
:size="Size.lg"
|
|
164
|
+
:icon-left="faMultiply"
|
|
165
|
+
:skeleton="skeleton"
|
|
166
|
+
:disabled="disabled"
|
|
167
|
+
@click.prevent="() => _modelValue = null"
|
|
168
|
+
>
|
|
169
|
+
<template #tooltip-content>
|
|
170
|
+
Remove image
|
|
171
|
+
</template>
|
|
172
|
+
</AntButton>
|
|
173
|
+
|
|
174
|
+
<AntButton
|
|
175
|
+
v-else
|
|
176
|
+
:size="Size.lg"
|
|
177
|
+
:icon-left="faUpload"
|
|
178
|
+
:skeleton="skeleton"
|
|
179
|
+
:disabled="disabled"
|
|
180
|
+
@click="openFileDialog"
|
|
181
|
+
>
|
|
182
|
+
<template #tooltip-content>
|
|
183
|
+
Upload image
|
|
184
|
+
</template>
|
|
185
|
+
</AntButton>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<AntInputDescription
|
|
189
|
+
v-if="description"
|
|
190
|
+
:skeleton="skeleton"
|
|
191
|
+
:size="descriptionFontSize"
|
|
192
|
+
:state="state"
|
|
193
|
+
>
|
|
194
|
+
{{ description }}
|
|
195
|
+
</AntInputDescription>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
</AntField>
|
|
199
|
+
</template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/vue3';
|
|
2
|
+
import AntImageInput from '../AntImageInput.vue';
|
|
3
|
+
declare const meta: Meta<typeof AntImageInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AntImageInput>;
|
|
6
|
+
export declare const Docs: Story;
|
|
7
|
+
export declare const Empty: Story;
|
|
8
|
+
export declare const Skeleton: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
10
|
+
export declare const Summary: Story;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = exports.Summary = exports.Skeleton = exports.Empty = exports.Docs = exports.Disabled = void 0;
|
|
7
|
+
var _Size = require("../../../enums/Size.enum");
|
|
8
|
+
var _AntImageInput = _interopRequireDefault(require("../AntImageInput.vue"));
|
|
9
|
+
var _enums = require("../../../enums");
|
|
10
|
+
var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
|
|
11
|
+
var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
|
|
12
|
+
var _vue = require("vue");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const meta = {
|
|
15
|
+
title: "Inputs/Image Input",
|
|
16
|
+
component: _AntImageInput.default,
|
|
17
|
+
parameters: {
|
|
18
|
+
controls: {
|
|
19
|
+
sort: "requiredFirst"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
modelValue: {
|
|
24
|
+
table: {
|
|
25
|
+
type: {
|
|
26
|
+
summary: "string|null"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
state: {
|
|
31
|
+
control: {
|
|
32
|
+
type: "select"
|
|
33
|
+
},
|
|
34
|
+
options: Object.values(_enums.InputState)
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
control: {
|
|
38
|
+
type: "select"
|
|
39
|
+
},
|
|
40
|
+
options: Object.values(_Size.Size)
|
|
41
|
+
},
|
|
42
|
+
placeholder: {
|
|
43
|
+
table: {
|
|
44
|
+
defaultValue: {
|
|
45
|
+
summary: "this.label"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
module.exports = meta;
|
|
52
|
+
const Docs = exports.Docs = {
|
|
53
|
+
render: args => ({
|
|
54
|
+
components: {
|
|
55
|
+
AntImageInput: _AntImageInput.default
|
|
56
|
+
},
|
|
57
|
+
setup() {
|
|
58
|
+
return {
|
|
59
|
+
args
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
template: `
|
|
63
|
+
<AntImageInput
|
|
64
|
+
v-bind="args"
|
|
65
|
+
v-model="args.modelValue"
|
|
66
|
+
/>`
|
|
67
|
+
}),
|
|
68
|
+
args: {
|
|
69
|
+
modelValue: "/avatar.jpg",
|
|
70
|
+
label: "Label",
|
|
71
|
+
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const Empty = exports.Empty = {
|
|
75
|
+
render: Docs.render,
|
|
76
|
+
args: {
|
|
77
|
+
...Docs.args,
|
|
78
|
+
modelValue: null
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const Skeleton = exports.Skeleton = {
|
|
82
|
+
render: Docs.render,
|
|
83
|
+
args: {
|
|
84
|
+
...Docs.args,
|
|
85
|
+
skeleton: true
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const Disabled = exports.Disabled = {
|
|
89
|
+
render: Docs.render,
|
|
90
|
+
args: {
|
|
91
|
+
...Docs.args,
|
|
92
|
+
disabled: true
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const Summary = exports.Summary = {
|
|
96
|
+
parameters: {
|
|
97
|
+
chromatic: {
|
|
98
|
+
disableSnapshot: false
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
render: () => ({
|
|
102
|
+
components: {
|
|
103
|
+
AntFormGroupLabel: _AntFormGroupLabel.default,
|
|
104
|
+
AntImageInput: _AntImageInput.default,
|
|
105
|
+
AntFormGroup: _AntFormGroup.default,
|
|
106
|
+
ref: _vue.ref
|
|
107
|
+
},
|
|
108
|
+
setup() {
|
|
109
|
+
const valuedModelValue = (0, _vue.ref)("/avatar.jpg");
|
|
110
|
+
const emptyModelValue = (0, _vue.ref)(null);
|
|
111
|
+
return {
|
|
112
|
+
valuedModelValue,
|
|
113
|
+
emptyModelValue
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
template: `
|
|
117
|
+
<AntFormGroup>
|
|
118
|
+
<AntFormGroupLabel>Default</AntFormGroupLabel>
|
|
119
|
+
<AntImageInput
|
|
120
|
+
v-model="valuedModelValue"
|
|
121
|
+
label="Label"
|
|
122
|
+
description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
123
|
+
/>
|
|
124
|
+
<AntFormGroupLabel>Empty</AntFormGroupLabel>
|
|
125
|
+
<AntImageInput
|
|
126
|
+
v-model="emptyModelValue"
|
|
127
|
+
label="Label"
|
|
128
|
+
description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
129
|
+
/>
|
|
130
|
+
<AntFormGroupLabel>Disabled</AntFormGroupLabel>
|
|
131
|
+
<AntImageInput
|
|
132
|
+
v-model="valuedModelValue"
|
|
133
|
+
label="Label"
|
|
134
|
+
description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
135
|
+
/>
|
|
136
|
+
</AntFormGroup>
|
|
137
|
+
`
|
|
138
|
+
})
|
|
139
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Size
|
|
3
|
+
} from "../../../enums/Size.enum.mjs";
|
|
4
|
+
import AntImageInput from "../AntImageInput.vue";
|
|
5
|
+
import {
|
|
6
|
+
InputState
|
|
7
|
+
} from "../../../enums/index.mjs";
|
|
8
|
+
import AntFormGroupLabel from "../../forms/AntFormGroupLabel.vue";
|
|
9
|
+
import AntFormGroup from "../../forms/AntFormGroup.vue";
|
|
10
|
+
import {
|
|
11
|
+
ref
|
|
12
|
+
} from "vue";
|
|
13
|
+
const meta = {
|
|
14
|
+
title: "Inputs/Image Input",
|
|
15
|
+
component: AntImageInput,
|
|
16
|
+
parameters: {
|
|
17
|
+
controls: {
|
|
18
|
+
sort: "requiredFirst"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
modelValue: {
|
|
23
|
+
table: {
|
|
24
|
+
type: {
|
|
25
|
+
summary: "string|null"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
state: {
|
|
30
|
+
control: {
|
|
31
|
+
type: "select"
|
|
32
|
+
},
|
|
33
|
+
options: Object.values(InputState)
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
control: {
|
|
37
|
+
type: "select"
|
|
38
|
+
},
|
|
39
|
+
options: Object.values(Size)
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
table: {
|
|
43
|
+
defaultValue: {
|
|
44
|
+
summary: "this.label"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export default meta;
|
|
51
|
+
export const Docs = {
|
|
52
|
+
render: (args) => ({
|
|
53
|
+
components: {
|
|
54
|
+
AntImageInput
|
|
55
|
+
},
|
|
56
|
+
setup() {
|
|
57
|
+
return {
|
|
58
|
+
args
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
template: `
|
|
62
|
+
<AntImageInput
|
|
63
|
+
v-bind="args"
|
|
64
|
+
v-model="args.modelValue"
|
|
65
|
+
/>`
|
|
66
|
+
}),
|
|
67
|
+
args: {
|
|
68
|
+
modelValue: "/avatar.jpg",
|
|
69
|
+
label: "Label",
|
|
70
|
+
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
export const Empty = {
|
|
74
|
+
render: Docs.render,
|
|
75
|
+
args: {
|
|
76
|
+
...Docs.args,
|
|
77
|
+
modelValue: null
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export const Skeleton = {
|
|
81
|
+
render: Docs.render,
|
|
82
|
+
args: {
|
|
83
|
+
...Docs.args,
|
|
84
|
+
skeleton: true
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
export const Disabled = {
|
|
88
|
+
render: Docs.render,
|
|
89
|
+
args: {
|
|
90
|
+
...Docs.args,
|
|
91
|
+
disabled: true
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
export const Summary = {
|
|
95
|
+
parameters: {
|
|
96
|
+
chromatic: {
|
|
97
|
+
disableSnapshot: false
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
render: () => ({
|
|
101
|
+
components: {
|
|
102
|
+
AntFormGroupLabel,
|
|
103
|
+
AntImageInput,
|
|
104
|
+
AntFormGroup,
|
|
105
|
+
ref
|
|
106
|
+
},
|
|
107
|
+
setup() {
|
|
108
|
+
const valuedModelValue = ref("/avatar.jpg");
|
|
109
|
+
const emptyModelValue = ref(null);
|
|
110
|
+
return {
|
|
111
|
+
valuedModelValue,
|
|
112
|
+
emptyModelValue
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
template: `
|
|
116
|
+
<AntFormGroup>
|
|
117
|
+
<AntFormGroupLabel>Default</AntFormGroupLabel>
|
|
118
|
+
<AntImageInput
|
|
119
|
+
v-model="valuedModelValue"
|
|
120
|
+
label="Label"
|
|
121
|
+
description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
122
|
+
/>
|
|
123
|
+
<AntFormGroupLabel>Empty</AntFormGroupLabel>
|
|
124
|
+
<AntImageInput
|
|
125
|
+
v-model="emptyModelValue"
|
|
126
|
+
label="Label"
|
|
127
|
+
description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
128
|
+
/>
|
|
129
|
+
<AntFormGroupLabel>Disabled</AntFormGroupLabel>
|
|
130
|
+
<AntImageInput
|
|
131
|
+
v-model="valuedModelValue"
|
|
132
|
+
label="Label"
|
|
133
|
+
description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
134
|
+
/>
|
|
135
|
+
</AntFormGroup>
|
|
136
|
+
`
|
|
137
|
+
})
|
|
138
|
+
};
|