@antify/ui 3.1.4 → 3.1.6
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 +3 -1
- package/dist/components/inputs/AntMultiSelect.vue +330 -0
- package/dist/components/inputs/__stories/AntMultiSelect.stories.d.ts +7 -0
- package/dist/components/inputs/__stories/AntMultiSelect.stories.js +248 -0
- package/dist/components/inputs/__stories/AntMultiSelect.stories.mjs +278 -0
- package/dist/components/inputs/__types/AntMultiSelect.types.d.ts +4 -0
- package/dist/components/inputs/__types/AntMultiSelect.types.js +1 -0
- package/dist/components/inputs/__types/AntMultiSelect.types.mjs +0 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import AntInputDescription from './inputs/Elements/AntInputDescription.vue';
|
|
|
9
9
|
import AntInputLabel from './inputs/Elements/AntInputLabel.vue';
|
|
10
10
|
import AntInputLimiter from './inputs/Elements/AntInputLimiter.vue';
|
|
11
11
|
import AntCheckbox from './inputs/AntCheckbox.vue';
|
|
12
|
+
import AntMultiSelect from './inputs/AntMultiSelect.vue';
|
|
12
13
|
import AntCheckboxGroup from './inputs/AntCheckboxGroup.vue';
|
|
13
14
|
import AntDateInput from './inputs/AntDateInput.vue';
|
|
14
15
|
import AntNumberInput from './inputs/AntNumberInput.vue';
|
|
@@ -51,4 +52,4 @@ import AntTag from './AntTag.vue';
|
|
|
51
52
|
import AntToast from './AntToast.vue';
|
|
52
53
|
import AntToaster from './AntToaster.vue';
|
|
53
54
|
import AntTooltip from './AntTooltip.vue';
|
|
54
|
-
export { AntButton, 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, AntColorInput, };
|
|
55
|
+
export { AntButton, 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, AntColorInput, AntMultiSelect, };
|
package/dist/components/index.js
CHANGED
|
@@ -153,6 +153,12 @@ Object.defineProperty(exports, "AntModal", {
|
|
|
153
153
|
return _AntModal.default;
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
|
+
Object.defineProperty(exports, "AntMultiSelect", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _AntMultiSelect.default;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
156
162
|
Object.defineProperty(exports, "AntNavLeftLayout", {
|
|
157
163
|
enumerable: true,
|
|
158
164
|
get: function () {
|
|
@@ -332,6 +338,7 @@ var _AntInputDescription = _interopRequireDefault(require("./inputs/Elements/Ant
|
|
|
332
338
|
var _AntInputLabel = _interopRequireDefault(require("./inputs/Elements/AntInputLabel.vue"));
|
|
333
339
|
var _AntInputLimiter = _interopRequireDefault(require("./inputs/Elements/AntInputLimiter.vue"));
|
|
334
340
|
var _AntCheckbox = _interopRequireDefault(require("./inputs/AntCheckbox.vue"));
|
|
341
|
+
var _AntMultiSelect = _interopRequireDefault(require("./inputs/AntMultiSelect.vue"));
|
|
335
342
|
var _AntCheckboxGroup = _interopRequireDefault(require("./inputs/AntCheckboxGroup.vue"));
|
|
336
343
|
var _AntDateInput = _interopRequireDefault(require("./inputs/AntDateInput.vue"));
|
|
337
344
|
var _AntNumberInput = _interopRequireDefault(require("./inputs/AntNumberInput.vue"));
|
|
@@ -9,6 +9,7 @@ import AntInputDescription from "./inputs/Elements/AntInputDescription.vue";
|
|
|
9
9
|
import AntInputLabel from "./inputs/Elements/AntInputLabel.vue";
|
|
10
10
|
import AntInputLimiter from "./inputs/Elements/AntInputLimiter.vue";
|
|
11
11
|
import AntCheckbox from "./inputs/AntCheckbox.vue";
|
|
12
|
+
import AntMultiSelect from "./inputs/AntMultiSelect.vue";
|
|
12
13
|
import AntCheckboxGroup from "./inputs/AntCheckboxGroup.vue";
|
|
13
14
|
import AntDateInput from "./inputs/AntDateInput.vue";
|
|
14
15
|
import AntNumberInput from "./inputs/AntNumberInput.vue";
|
|
@@ -104,5 +105,6 @@ export {
|
|
|
104
105
|
AntToast,
|
|
105
106
|
AntToaster,
|
|
106
107
|
AntTooltip,
|
|
107
|
-
AntColorInput
|
|
108
|
+
AntColorInput,
|
|
109
|
+
AntMultiSelect
|
|
108
110
|
};
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import AntField from '../forms/AntField.vue';
|
|
3
|
+
import {
|
|
4
|
+
type MultiSelectOption,
|
|
5
|
+
} from './__types/AntMultiSelect.types';
|
|
6
|
+
import {
|
|
7
|
+
computed, onMounted, ref, watch,
|
|
8
|
+
} from 'vue';
|
|
9
|
+
import {
|
|
10
|
+
Size,
|
|
11
|
+
} from '../../enums/Size.enum';
|
|
12
|
+
import {
|
|
13
|
+
handleEnumValidation,
|
|
14
|
+
} from '../../handler';
|
|
15
|
+
import {
|
|
16
|
+
Grouped,
|
|
17
|
+
} from '../../enums/Grouped.enum';
|
|
18
|
+
import AntIcon from '../AntIcon.vue';
|
|
19
|
+
import {
|
|
20
|
+
faChevronDown, faChevronUp, faMultiply,
|
|
21
|
+
} from '@fortawesome/free-solid-svg-icons';
|
|
22
|
+
import AntSkeleton from '../AntSkeleton.vue';
|
|
23
|
+
import AntDropdown from '../AntDropdown.vue';
|
|
24
|
+
import AntButton from '../AntButton.vue';
|
|
25
|
+
import {
|
|
26
|
+
InputState,
|
|
27
|
+
} from '../../enums';
|
|
28
|
+
import {
|
|
29
|
+
IconSize,
|
|
30
|
+
} from '../__types';
|
|
31
|
+
import AntCheckboxGroup from './AntCheckboxGroup.vue';
|
|
32
|
+
import type {
|
|
33
|
+
AntCheckboxType,
|
|
34
|
+
} from './__types/AntCheckbox.types';
|
|
35
|
+
|
|
36
|
+
defineOptions({
|
|
37
|
+
inheritAttrs: false,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const props = withDefaults(defineProps<{
|
|
41
|
+
modelValue: string[] | null;
|
|
42
|
+
options: MultiSelectOption[];
|
|
43
|
+
nullable?: boolean;
|
|
44
|
+
label?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
size?: Size;
|
|
48
|
+
state?: InputState;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
readonly?: boolean;
|
|
51
|
+
skeleton?: boolean;
|
|
52
|
+
grouped?: Grouped;
|
|
53
|
+
singularValueLabel?: string;
|
|
54
|
+
pluralValueLabel?: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
wrapperClass?: string | Record<string, boolean>;
|
|
57
|
+
expanded?: boolean;
|
|
58
|
+
messages?: string[];
|
|
59
|
+
}>(), {
|
|
60
|
+
state: InputState.base,
|
|
61
|
+
grouped: Grouped.none,
|
|
62
|
+
size: Size.md,
|
|
63
|
+
nullable: false,
|
|
64
|
+
disabled: false,
|
|
65
|
+
readonly: false,
|
|
66
|
+
skeleton: false,
|
|
67
|
+
expanded: true,
|
|
68
|
+
singularValueLabel: 'item selected',
|
|
69
|
+
pluralValueLabel: 'items selected',
|
|
70
|
+
messages: () => [],
|
|
71
|
+
});
|
|
72
|
+
const emit = defineEmits([
|
|
73
|
+
'update:modelValue',
|
|
74
|
+
'blur',
|
|
75
|
+
'validate',
|
|
76
|
+
]);
|
|
77
|
+
const isOpen = ref(false);
|
|
78
|
+
const _modelValue = computed<string[]>(() => [
|
|
79
|
+
...props.modelValue || [],
|
|
80
|
+
]);
|
|
81
|
+
const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
|
|
82
|
+
const inputClasses = computed(() => {
|
|
83
|
+
const variants: Record<InputState, string> = {
|
|
84
|
+
[InputState.base]: 'outline-base-300 bg-white focus:ring-primary-200',
|
|
85
|
+
[InputState.success]: 'outline-success-500 bg-success-100 focus:ring-success-200',
|
|
86
|
+
[InputState.info]: 'outline-info-500 bg-info-100 focus:ring-info-200',
|
|
87
|
+
[InputState.warning]: 'outline-warning-500 bg-warning-100 focus:ring-warning-200',
|
|
88
|
+
[InputState.danger]: 'outline-danger-500 bg-danger-100 focus:ring-danger-200',
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
'flex items-center transition-colors border-none outline relative': true,
|
|
93
|
+
'outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1': true,
|
|
94
|
+
'w-full': props.expanded,
|
|
95
|
+
[variants[props.state]]: true,
|
|
96
|
+
'cursor-pointer': !props.skeleton && !props.readonly && !props.disabled,
|
|
97
|
+
// Skeleton
|
|
98
|
+
invisible: props.skeleton,
|
|
99
|
+
// Disabled
|
|
100
|
+
'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
|
|
101
|
+
// Size
|
|
102
|
+
'p-1 gap-1 text-xs': props.size === Size.xs2,
|
|
103
|
+
'p-1.5 gap-1.5 text-xs': props.size === Size.xs,
|
|
104
|
+
'p-1.5 gap-1.5 text-sm': props.size === Size.sm,
|
|
105
|
+
'p-2 gap-2 text-sm': props.size === Size.md,
|
|
106
|
+
'p-2.5 gap-2.5 text-sm': props.size === Size.lg,
|
|
107
|
+
'focus:ring-2': !hasInputState.value && (props.size === Size.sm || props.size === Size.xs || props.size === Size.xs2),
|
|
108
|
+
'focus:ring-4': !hasInputState.value && (props.size === Size.lg || props.size === Size.md),
|
|
109
|
+
// Grouped
|
|
110
|
+
'rounded-tl-md rounded-bl-md rounded-tr-none rounded-br-none': props.grouped === Grouped.left ||
|
|
111
|
+
props.nullable && props.modelValue && props.modelValue.length > 0,
|
|
112
|
+
'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md': props.grouped === Grouped.right,
|
|
113
|
+
'rounded-none': props.grouped === Grouped.center,
|
|
114
|
+
'rounded-md': props.grouped === Grouped.none,
|
|
115
|
+
// Disabled
|
|
116
|
+
'opacity-50 cursor-not-allowed': props.disabled,
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
const placeholderClasses = computed(() => {
|
|
120
|
+
const variants: Record<InputState, string> = {
|
|
121
|
+
[InputState.base]: 'text-base-500',
|
|
122
|
+
[InputState.success]: 'text-success-700',
|
|
123
|
+
[InputState.info]: 'text-info-700',
|
|
124
|
+
[InputState.warning]: 'text-warning-700',
|
|
125
|
+
[InputState.danger]: 'text-danger-700',
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
'select-none text-ellipsis overflow-hidden whitespace-nowrap w-full': true,
|
|
130
|
+
[variants[props.state]]: true,
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
const arrowClasses = computed(() => {
|
|
134
|
+
const variants: Record<InputState, string> = {
|
|
135
|
+
[InputState.base]: 'text-for-white-bg-font',
|
|
136
|
+
[InputState.success]: 'text-success-100-font',
|
|
137
|
+
[InputState.info]: 'text-info-100-font',
|
|
138
|
+
[InputState.warning]: 'text-warning-100-font',
|
|
139
|
+
[InputState.danger]: 'text-danger-100-font',
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
[variants[props.state]]: true,
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
const valueLabel = computed(() => {
|
|
147
|
+
if (!_modelValue.value) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (_modelValue.value.length === 0) {
|
|
152
|
+
return props.label || props.placeholder;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (_modelValue.value.length === 1) {
|
|
156
|
+
return `${_modelValue.value.length} ${props.singularValueLabel}`;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return `${_modelValue.value.length} ${props.pluralValueLabel}`;
|
|
160
|
+
});
|
|
161
|
+
const iconSize = computed(() => {
|
|
162
|
+
if (props.size === Size.lg || props.size === Size.md || props.size === Size.sm) {
|
|
163
|
+
return IconSize.sm;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return IconSize.xs;
|
|
167
|
+
});
|
|
168
|
+
const selectedCheckboxes = ref<string[]>( [
|
|
169
|
+
..._modelValue.value,
|
|
170
|
+
]);
|
|
171
|
+
const inputRef = ref<HTMLElement | null>(null);
|
|
172
|
+
|
|
173
|
+
onMounted(() => {
|
|
174
|
+
handleEnumValidation(props.size, Size, 'size');
|
|
175
|
+
handleEnumValidation(props.state, InputState, 'state');
|
|
176
|
+
handleEnumValidation(props.grouped, Grouped, 'grouped');
|
|
177
|
+
|
|
178
|
+
if (!props.skeleton && props.modelValue !== null) {
|
|
179
|
+
emit('validate', props.modelValue);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
watch(isOpen, (val) => {
|
|
184
|
+
if (!val) {
|
|
185
|
+
emit('update:modelValue', selectedCheckboxes.value);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
watch(() => props.modelValue, (val) => selectedCheckboxes.value = val as string[], {
|
|
190
|
+
deep: true,
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Validate default value if given after delayed data fetching.
|
|
195
|
+
*/
|
|
196
|
+
watch(() => props.skeleton, (val) => {
|
|
197
|
+
if (!val && props.modelValue !== null) {
|
|
198
|
+
emit('validate', props.modelValue);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
watch(_modelValue, () => {
|
|
202
|
+
if (props.messages.length > 0) {
|
|
203
|
+
emit('validate', props.modelValue);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
function onBlur(e: FocusEvent) {
|
|
208
|
+
emit('validate', props.modelValue);
|
|
209
|
+
emit('blur', e);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function onClickSelectInput(e: MouseEvent) {
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
|
|
215
|
+
if (props.disabled || props.readonly) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (isOpen.value) {
|
|
220
|
+
inputRef.value?.focus();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
isOpen.value = !isOpen.value;
|
|
224
|
+
}
|
|
225
|
+
</script>
|
|
226
|
+
|
|
227
|
+
<template>
|
|
228
|
+
<AntField
|
|
229
|
+
:label="label"
|
|
230
|
+
:size="size"
|
|
231
|
+
:skeleton="skeleton"
|
|
232
|
+
:description="description"
|
|
233
|
+
:state="state"
|
|
234
|
+
:class="wrapperClass"
|
|
235
|
+
:expanded="expanded"
|
|
236
|
+
:messages="messages"
|
|
237
|
+
label-for="noop"
|
|
238
|
+
data-e2e="select"
|
|
239
|
+
@click-label="() => inputRef?.focus()"
|
|
240
|
+
>
|
|
241
|
+
<AntDropdown
|
|
242
|
+
v-model:show-dropdown="isOpen"
|
|
243
|
+
:expanded="expanded"
|
|
244
|
+
:content-padding="false"
|
|
245
|
+
>
|
|
246
|
+
<AntSkeleton
|
|
247
|
+
:visible="skeleton"
|
|
248
|
+
rounded
|
|
249
|
+
:grouped="grouped"
|
|
250
|
+
class="w-full"
|
|
251
|
+
>
|
|
252
|
+
<!-- Input -->
|
|
253
|
+
<div class="flex">
|
|
254
|
+
<div
|
|
255
|
+
ref="inputRef"
|
|
256
|
+
:class="inputClasses"
|
|
257
|
+
:tabindex="disabled || readonly ? -1 : 0"
|
|
258
|
+
v-bind="$attrs"
|
|
259
|
+
@mousedown="onClickSelectInput"
|
|
260
|
+
@click="() => inputRef?.focus()"
|
|
261
|
+
@blur="onBlur"
|
|
262
|
+
>
|
|
263
|
+
<slot name="icon" />
|
|
264
|
+
|
|
265
|
+
<div
|
|
266
|
+
v-if="(_modelValue === null || _modelValue.length === 0) && placeholder !== undefined"
|
|
267
|
+
:class="placeholderClasses"
|
|
268
|
+
>
|
|
269
|
+
{{ placeholder }}
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
<div
|
|
273
|
+
v-else-if="(_modelValue === null || _modelValue.length === 0) && label !== undefined"
|
|
274
|
+
:class="placeholderClasses"
|
|
275
|
+
>
|
|
276
|
+
{{ label }}
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
<div
|
|
280
|
+
v-else
|
|
281
|
+
class="flex items-center select-none overflow-hidden w-full"
|
|
282
|
+
>
|
|
283
|
+
<slot
|
|
284
|
+
v-bind="props"
|
|
285
|
+
name="value-label"
|
|
286
|
+
>
|
|
287
|
+
<div class="text-ellipsis overflow-hidden whitespace-nowrap w-full text-black">
|
|
288
|
+
{{ valueLabel }}
|
|
289
|
+
</div>
|
|
290
|
+
</slot>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<AntIcon
|
|
294
|
+
v-if="isOpen"
|
|
295
|
+
:icon="faChevronUp"
|
|
296
|
+
:size="iconSize"
|
|
297
|
+
:class="arrowClasses"
|
|
298
|
+
/>
|
|
299
|
+
|
|
300
|
+
<AntIcon
|
|
301
|
+
v-else
|
|
302
|
+
:icon="faChevronDown"
|
|
303
|
+
:size="iconSize"
|
|
304
|
+
:class="arrowClasses"
|
|
305
|
+
/>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
<AntButton
|
|
309
|
+
v-if="props.nullable && props.modelValue && props.modelValue.length > 0"
|
|
310
|
+
:icon-left="faMultiply"
|
|
311
|
+
:grouped="Grouped.right"
|
|
312
|
+
:size="size"
|
|
313
|
+
@click="emit('update:modelValue', [])"
|
|
314
|
+
/>
|
|
315
|
+
</div>
|
|
316
|
+
</AntSkeleton>
|
|
317
|
+
|
|
318
|
+
<template #content>
|
|
319
|
+
<div class="max-h-[250px] overflow-auto">
|
|
320
|
+
<AntCheckboxGroup
|
|
321
|
+
v-model="selectedCheckboxes"
|
|
322
|
+
class="p-2"
|
|
323
|
+
:size="size"
|
|
324
|
+
:checkboxes="options as AntCheckboxType[]"
|
|
325
|
+
/>
|
|
326
|
+
</div>
|
|
327
|
+
</template>
|
|
328
|
+
</AntDropdown>
|
|
329
|
+
</AntField>
|
|
330
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/vue3';
|
|
2
|
+
import AntMultiSelect from '../AntMultiSelect.vue';
|
|
3
|
+
declare const meta: Meta<typeof AntMultiSelect>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AntMultiSelect>;
|
|
6
|
+
export declare const Docs: Story;
|
|
7
|
+
export declare const Summary: Story;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = exports.Summary = exports.Docs = void 0;
|
|
7
|
+
var _Size = require("../../../enums/Size.enum");
|
|
8
|
+
var _AntMultiSelect = _interopRequireDefault(require("../AntMultiSelect.vue"));
|
|
9
|
+
var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
|
|
10
|
+
var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
|
|
11
|
+
var _vue = require("vue");
|
|
12
|
+
var _enums = require("../../../enums");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const meta = {
|
|
15
|
+
computed: {
|
|
16
|
+
Direction() {
|
|
17
|
+
return _enums.Direction;
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
title: "Inputs/Multi Select",
|
|
21
|
+
component: _AntMultiSelect.default,
|
|
22
|
+
parameters: {
|
|
23
|
+
controls: {
|
|
24
|
+
sort: "requiredFirst"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
modelValue: {
|
|
29
|
+
table: {
|
|
30
|
+
type: {
|
|
31
|
+
summary: "string|null"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
options: {
|
|
36
|
+
description: "List of SelectOptions",
|
|
37
|
+
table: {
|
|
38
|
+
type: {
|
|
39
|
+
summary: "SelectOption[]",
|
|
40
|
+
detail: "type SelectOption = {label: string; value: string | number;}"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
state: {
|
|
45
|
+
control: {
|
|
46
|
+
type: "select"
|
|
47
|
+
},
|
|
48
|
+
options: Object.values(_enums.InputState)
|
|
49
|
+
},
|
|
50
|
+
grouped: {
|
|
51
|
+
control: {
|
|
52
|
+
type: "select"
|
|
53
|
+
},
|
|
54
|
+
options: Object.values(_enums.Grouped),
|
|
55
|
+
table: {
|
|
56
|
+
defaultValue: {
|
|
57
|
+
summary: _enums.Grouped.none
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
size: {
|
|
62
|
+
control: {
|
|
63
|
+
type: "select"
|
|
64
|
+
},
|
|
65
|
+
options: Object.values(_Size.Size),
|
|
66
|
+
table: {
|
|
67
|
+
defaultValue: {
|
|
68
|
+
summary: _Size.Size.md
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
placeholder: {
|
|
73
|
+
table: {
|
|
74
|
+
defaultValue: {
|
|
75
|
+
summary: "this.label"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
module.exports = meta;
|
|
82
|
+
const options = [{
|
|
83
|
+
label: "Option 1",
|
|
84
|
+
value: "1"
|
|
85
|
+
}, {
|
|
86
|
+
label: "Option 2",
|
|
87
|
+
value: "2"
|
|
88
|
+
}, {
|
|
89
|
+
label: "Option 3",
|
|
90
|
+
value: "3"
|
|
91
|
+
}, {
|
|
92
|
+
label: "Option 4",
|
|
93
|
+
value: "4"
|
|
94
|
+
}, {
|
|
95
|
+
label: "Option 5",
|
|
96
|
+
value: "5"
|
|
97
|
+
}, {
|
|
98
|
+
label: "Option 6",
|
|
99
|
+
value: "6"
|
|
100
|
+
}, {
|
|
101
|
+
label: "Option 7",
|
|
102
|
+
value: "7"
|
|
103
|
+
}, {
|
|
104
|
+
label: "Option 8",
|
|
105
|
+
value: "8"
|
|
106
|
+
}, {
|
|
107
|
+
label: "Option 9",
|
|
108
|
+
value: "9"
|
|
109
|
+
}, {
|
|
110
|
+
label: "Option 10",
|
|
111
|
+
value: "10"
|
|
112
|
+
}, {
|
|
113
|
+
label: "Option 11",
|
|
114
|
+
value: "11"
|
|
115
|
+
}, {
|
|
116
|
+
label: "Option 12",
|
|
117
|
+
value: "12"
|
|
118
|
+
}, {
|
|
119
|
+
label: "Option 13",
|
|
120
|
+
value: "13"
|
|
121
|
+
}, {
|
|
122
|
+
label: "Option 14",
|
|
123
|
+
value: "14"
|
|
124
|
+
}, {
|
|
125
|
+
label: "Option 15",
|
|
126
|
+
value: "15"
|
|
127
|
+
}, {
|
|
128
|
+
label: "Option 16",
|
|
129
|
+
value: "16"
|
|
130
|
+
}, {
|
|
131
|
+
label: "Option 17",
|
|
132
|
+
value: "17"
|
|
133
|
+
}, {
|
|
134
|
+
label: "Option 18",
|
|
135
|
+
value: "18"
|
|
136
|
+
}, {
|
|
137
|
+
label: "Option 19",
|
|
138
|
+
value: "19"
|
|
139
|
+
}, {
|
|
140
|
+
label: "Option 20",
|
|
141
|
+
value: "20"
|
|
142
|
+
}, {
|
|
143
|
+
label: "Option 21",
|
|
144
|
+
value: "21"
|
|
145
|
+
}, {
|
|
146
|
+
label: "Option 22",
|
|
147
|
+
value: "22"
|
|
148
|
+
}, {
|
|
149
|
+
label: "Option 23",
|
|
150
|
+
value: "23"
|
|
151
|
+
}, {
|
|
152
|
+
label: "Option 24",
|
|
153
|
+
value: "24"
|
|
154
|
+
}];
|
|
155
|
+
const Docs = exports.Docs = {
|
|
156
|
+
render: args => ({
|
|
157
|
+
components: {
|
|
158
|
+
AntMultiSelect: _AntMultiSelect.default
|
|
159
|
+
},
|
|
160
|
+
setup() {
|
|
161
|
+
const value = (0, _vue.ref)(null);
|
|
162
|
+
return {
|
|
163
|
+
args,
|
|
164
|
+
value
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
template: `
|
|
168
|
+
<div class="flex flex-col justify-center">
|
|
169
|
+
<AntMultiSelect v-bind="args" v-model="value"/>
|
|
170
|
+
</div>
|
|
171
|
+
`
|
|
172
|
+
}),
|
|
173
|
+
args: {
|
|
174
|
+
label: "Label",
|
|
175
|
+
options,
|
|
176
|
+
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod",
|
|
177
|
+
nullable: true
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const Summary = exports.Summary = {
|
|
181
|
+
parameters: {
|
|
182
|
+
chromatic: {
|
|
183
|
+
disableSnapshot: false
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
render: args => ({
|
|
187
|
+
components: {
|
|
188
|
+
AntMultiSelect: _AntMultiSelect.default,
|
|
189
|
+
AntFormGroup: _AntFormGroup.default,
|
|
190
|
+
AntFormGroupLabel: _AntFormGroupLabel.default
|
|
191
|
+
},
|
|
192
|
+
setup() {
|
|
193
|
+
const value = (0, _vue.ref)(["1", "2", "3"]);
|
|
194
|
+
return {
|
|
195
|
+
args,
|
|
196
|
+
value,
|
|
197
|
+
Direction: _enums.Direction,
|
|
198
|
+
InputState: _enums.InputState,
|
|
199
|
+
Size: _Size.Size,
|
|
200
|
+
Grouped: _enums.Grouped
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
template: `
|
|
204
|
+
<AntFormGroup>
|
|
205
|
+
<AntFormGroupLabel>State</AntFormGroupLabel>
|
|
206
|
+
|
|
207
|
+
<AntFormGroup :direction="Direction.row">
|
|
208
|
+
<AntMultiSelect v-bind="args" v-model="value"/>
|
|
209
|
+
<AntMultiSelect v-bind="args" v-model="value" :state="InputState.info"/>
|
|
210
|
+
<AntMultiSelect v-bind="args" v-model="value" :state="InputState.success"/>
|
|
211
|
+
<AntMultiSelect v-bind="args" v-model="value" :state="InputState.warning"/>
|
|
212
|
+
<AntMultiSelect v-bind="args" v-model="value" :state="InputState.danger"/>
|
|
213
|
+
</AntFormGroup>
|
|
214
|
+
|
|
215
|
+
<AntFormGroupLabel>Size</AntFormGroupLabel>
|
|
216
|
+
|
|
217
|
+
<AntFormGroup :direction="Direction.row">
|
|
218
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.lg"/>
|
|
219
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.md"/>
|
|
220
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.sm"/>
|
|
221
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.xs"/>
|
|
222
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.xs2"/>
|
|
223
|
+
</AntFormGroup>
|
|
224
|
+
|
|
225
|
+
<AntFormGroupLabel>Disabled, Skeleton, Nullable</AntFormGroupLabel>
|
|
226
|
+
|
|
227
|
+
<AntFormGroup :direction="Direction.row">
|
|
228
|
+
<AntMultiSelect v-bind="args" v-model="value" disabled/>
|
|
229
|
+
<AntMultiSelect v-bind="args" v-model="value" skeleton/>
|
|
230
|
+
<AntMultiSelect v-bind="args" v-model="value" nullable/>
|
|
231
|
+
</AntFormGroup>
|
|
232
|
+
|
|
233
|
+
<AntFormGroupLabel>Label</AntFormGroupLabel>
|
|
234
|
+
<AntMultiSelect v-bind="args" v-model="value" label="Label"/>
|
|
235
|
+
|
|
236
|
+
<AntFormGroupLabel>Description</AntFormGroupLabel>
|
|
237
|
+
<AntMultiSelect v-bind="args" v-model="value" description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"/>
|
|
238
|
+
|
|
239
|
+
<AntFormGroupLabel>Labe + Description</AntFormGroupLabel>
|
|
240
|
+
<AntMultiSelect v-bind="args" v-model="value" label="Label" description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"/>
|
|
241
|
+
</AntFormGroup>
|
|
242
|
+
`
|
|
243
|
+
}),
|
|
244
|
+
args: {
|
|
245
|
+
placeholder: "Placeholder",
|
|
246
|
+
options
|
|
247
|
+
}
|
|
248
|
+
};
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Size
|
|
3
|
+
} from "../../../enums/Size.enum.mjs";
|
|
4
|
+
import AntMultiSelect from "../AntMultiSelect.vue";
|
|
5
|
+
import AntFormGroup from "../../forms/AntFormGroup.vue";
|
|
6
|
+
import AntFormGroupLabel from "../../forms/AntFormGroupLabel.vue";
|
|
7
|
+
import {
|
|
8
|
+
ref
|
|
9
|
+
} from "vue";
|
|
10
|
+
import {
|
|
11
|
+
Direction,
|
|
12
|
+
Grouped,
|
|
13
|
+
InputState
|
|
14
|
+
} from "../../../enums/index.mjs";
|
|
15
|
+
const meta = {
|
|
16
|
+
computed: {
|
|
17
|
+
Direction() {
|
|
18
|
+
return Direction;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
title: "Inputs/Multi Select",
|
|
22
|
+
component: AntMultiSelect,
|
|
23
|
+
parameters: {
|
|
24
|
+
controls: {
|
|
25
|
+
sort: "requiredFirst"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
modelValue: {
|
|
30
|
+
table: {
|
|
31
|
+
type: {
|
|
32
|
+
summary: "string|null"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
options: {
|
|
37
|
+
description: "List of SelectOptions",
|
|
38
|
+
table: {
|
|
39
|
+
type: {
|
|
40
|
+
summary: "SelectOption[]",
|
|
41
|
+
detail: "type SelectOption = {label: string; value: string | number;}"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
state: {
|
|
46
|
+
control: {
|
|
47
|
+
type: "select"
|
|
48
|
+
},
|
|
49
|
+
options: Object.values(InputState)
|
|
50
|
+
},
|
|
51
|
+
grouped: {
|
|
52
|
+
control: {
|
|
53
|
+
type: "select"
|
|
54
|
+
},
|
|
55
|
+
options: Object.values(Grouped),
|
|
56
|
+
table: {
|
|
57
|
+
defaultValue: {
|
|
58
|
+
summary: Grouped.none
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
size: {
|
|
63
|
+
control: {
|
|
64
|
+
type: "select"
|
|
65
|
+
},
|
|
66
|
+
options: Object.values(Size),
|
|
67
|
+
table: {
|
|
68
|
+
defaultValue: {
|
|
69
|
+
summary: Size.md
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
placeholder: {
|
|
74
|
+
table: {
|
|
75
|
+
defaultValue: {
|
|
76
|
+
summary: "this.label"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export default meta;
|
|
83
|
+
const options = [
|
|
84
|
+
{
|
|
85
|
+
label: "Option 1",
|
|
86
|
+
value: "1"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: "Option 2",
|
|
90
|
+
value: "2"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "Option 3",
|
|
94
|
+
value: "3"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: "Option 4",
|
|
98
|
+
value: "4"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: "Option 5",
|
|
102
|
+
value: "5"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
label: "Option 6",
|
|
106
|
+
value: "6"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
label: "Option 7",
|
|
110
|
+
value: "7"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: "Option 8",
|
|
114
|
+
value: "8"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: "Option 9",
|
|
118
|
+
value: "9"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: "Option 10",
|
|
122
|
+
value: "10"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: "Option 11",
|
|
126
|
+
value: "11"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: "Option 12",
|
|
130
|
+
value: "12"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
label: "Option 13",
|
|
134
|
+
value: "13"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
label: "Option 14",
|
|
138
|
+
value: "14"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: "Option 15",
|
|
142
|
+
value: "15"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
label: "Option 16",
|
|
146
|
+
value: "16"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
label: "Option 17",
|
|
150
|
+
value: "17"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
label: "Option 18",
|
|
154
|
+
value: "18"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: "Option 19",
|
|
158
|
+
value: "19"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: "Option 20",
|
|
162
|
+
value: "20"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: "Option 21",
|
|
166
|
+
value: "21"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: "Option 22",
|
|
170
|
+
value: "22"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: "Option 23",
|
|
174
|
+
value: "23"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
label: "Option 24",
|
|
178
|
+
value: "24"
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
export const Docs = {
|
|
182
|
+
render: (args) => ({
|
|
183
|
+
components: {
|
|
184
|
+
AntMultiSelect
|
|
185
|
+
},
|
|
186
|
+
setup() {
|
|
187
|
+
const value = ref(null);
|
|
188
|
+
return {
|
|
189
|
+
args,
|
|
190
|
+
value
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
template: `
|
|
194
|
+
<div class="flex flex-col justify-center">
|
|
195
|
+
<AntMultiSelect v-bind="args" v-model="value"/>
|
|
196
|
+
</div>
|
|
197
|
+
`
|
|
198
|
+
}),
|
|
199
|
+
args: {
|
|
200
|
+
label: "Label",
|
|
201
|
+
options,
|
|
202
|
+
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod",
|
|
203
|
+
nullable: true
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
export const Summary = {
|
|
207
|
+
parameters: {
|
|
208
|
+
chromatic: {
|
|
209
|
+
disableSnapshot: false
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
render: (args) => ({
|
|
213
|
+
components: {
|
|
214
|
+
AntMultiSelect,
|
|
215
|
+
AntFormGroup,
|
|
216
|
+
AntFormGroupLabel
|
|
217
|
+
},
|
|
218
|
+
setup() {
|
|
219
|
+
const value = ref([
|
|
220
|
+
"1",
|
|
221
|
+
"2",
|
|
222
|
+
"3"
|
|
223
|
+
]);
|
|
224
|
+
return {
|
|
225
|
+
args,
|
|
226
|
+
value,
|
|
227
|
+
Direction,
|
|
228
|
+
InputState,
|
|
229
|
+
Size,
|
|
230
|
+
Grouped
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
template: `
|
|
234
|
+
<AntFormGroup>
|
|
235
|
+
<AntFormGroupLabel>State</AntFormGroupLabel>
|
|
236
|
+
|
|
237
|
+
<AntFormGroup :direction="Direction.row">
|
|
238
|
+
<AntMultiSelect v-bind="args" v-model="value"/>
|
|
239
|
+
<AntMultiSelect v-bind="args" v-model="value" :state="InputState.info"/>
|
|
240
|
+
<AntMultiSelect v-bind="args" v-model="value" :state="InputState.success"/>
|
|
241
|
+
<AntMultiSelect v-bind="args" v-model="value" :state="InputState.warning"/>
|
|
242
|
+
<AntMultiSelect v-bind="args" v-model="value" :state="InputState.danger"/>
|
|
243
|
+
</AntFormGroup>
|
|
244
|
+
|
|
245
|
+
<AntFormGroupLabel>Size</AntFormGroupLabel>
|
|
246
|
+
|
|
247
|
+
<AntFormGroup :direction="Direction.row">
|
|
248
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.lg"/>
|
|
249
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.md"/>
|
|
250
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.sm"/>
|
|
251
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.xs"/>
|
|
252
|
+
<AntMultiSelect v-bind="args" v-model="value" :size="Size.xs2"/>
|
|
253
|
+
</AntFormGroup>
|
|
254
|
+
|
|
255
|
+
<AntFormGroupLabel>Disabled, Skeleton, Nullable</AntFormGroupLabel>
|
|
256
|
+
|
|
257
|
+
<AntFormGroup :direction="Direction.row">
|
|
258
|
+
<AntMultiSelect v-bind="args" v-model="value" disabled/>
|
|
259
|
+
<AntMultiSelect v-bind="args" v-model="value" skeleton/>
|
|
260
|
+
<AntMultiSelect v-bind="args" v-model="value" nullable/>
|
|
261
|
+
</AntFormGroup>
|
|
262
|
+
|
|
263
|
+
<AntFormGroupLabel>Label</AntFormGroupLabel>
|
|
264
|
+
<AntMultiSelect v-bind="args" v-model="value" label="Label"/>
|
|
265
|
+
|
|
266
|
+
<AntFormGroupLabel>Description</AntFormGroupLabel>
|
|
267
|
+
<AntMultiSelect v-bind="args" v-model="value" description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"/>
|
|
268
|
+
|
|
269
|
+
<AntFormGroupLabel>Labe + Description</AntFormGroupLabel>
|
|
270
|
+
<AntMultiSelect v-bind="args" v-model="value" label="Label" description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"/>
|
|
271
|
+
</AntFormGroup>
|
|
272
|
+
`
|
|
273
|
+
}),
|
|
274
|
+
args: {
|
|
275
|
+
placeholder: "Placeholder",
|
|
276
|
+
options
|
|
277
|
+
}
|
|
278
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|