@antify/ui 2.0.0 → 2.2.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/README.md +13 -0
- package/dist/components/AntDropdown.vue +1 -1
- package/dist/components/AntModal.vue +1 -1
- package/dist/components/AntToaster.vue +1 -1
- package/dist/components/AntTooltip.vue +3 -1
- package/dist/components/__stories/AntTooltip.stories.d.ts +1 -0
- package/dist/components/__stories/AntTooltip.stories.js +8 -1
- package/dist/components/__stories/AntTooltip.stories.mjs +7 -0
- package/dist/components/buttons/AntButton.vue +0 -1
- package/dist/components/crud/AntCrudTableFilter.vue +18 -20
- package/dist/components/inputs/AntNumberInput.vue +40 -12
- package/dist/components/inputs/AntRangeSlider.vue +1 -1
- package/dist/components/inputs/AntSelect.vue +2 -1
- package/dist/components/inputs/AntTextarea.vue +1 -1
- package/dist/components/inputs/Elements/AntBaseInput.vue +2 -1
- package/dist/components/inputs/Elements/AntSelectMenu.vue +25 -26
- package/dist/components/inputs/__stories/AntNumberInput.stories.js +21 -1
- package/dist/components/inputs/__stories/AntNumberInput.stories.mjs +15 -1
- package/dist/components/inputs/__stories/AntSelect.stories.d.ts +1 -0
- package/dist/components/inputs/__stories/AntSelect.stories.js +36 -3
- package/dist/components/inputs/__stories/AntSelect.stories.mjs +34 -2
- package/dist/components/table/AntCollapsibleTableRowContent.vue +25 -0
- package/dist/components/table/AntTable.vue +112 -49
- package/dist/components/table/AntTd.vue +0 -4
- package/dist/components/table/__stories/AntTable.stories.d.ts +3 -0
- package/dist/components/table/__stories/AntTable.stories.js +146 -6
- package/dist/components/table/__stories/AntTable.stories.mjs +121 -5
- package/dist/components/table/__types/AntCollapsibleTable.types.d.ts +4 -0
- package/dist/components/table/__types/AntCollapsibleTable.types.js +11 -0
- package/dist/components/table/__types/AntCollapsibleTable.types.mjs +5 -0
- package/dist/components/table/__types/index.d.ts +1 -0
- package/dist/components/table/__types/index.js +11 -0
- package/dist/components/table/__types/index.mjs +1 -0
- package/dist/tailwind.config.d.ts +2 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -8,6 +8,19 @@ The antify ui is a vue component library for applications based on tailwindcss.
|
|
|
8
8
|
pnpm i && pnpm dev
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Component Hierarchy
|
|
12
|
+
Certain components, such as modals and toasts, need to be displayed on top of other elements to remain visible at all times. As a result, they require a higher z-index. The following hierarchy defines the rendering order for components with this property.
|
|
13
|
+
|
|
14
|
+
| Component | z-index |
|
|
15
|
+
|-------------|---------|
|
|
16
|
+
| AntDropdown | 50 |
|
|
17
|
+
| AntModal | 80 |
|
|
18
|
+
| AntPopover | 90 |
|
|
19
|
+
| AntToaster | 100 |
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
11
24
|
## Useful links:
|
|
12
25
|
|
|
13
26
|
- Chromatic docu: https://www.chromatic.com/docs/
|
|
@@ -47,7 +47,7 @@ function closeModal() {
|
|
|
47
47
|
<Transition name="fade">
|
|
48
48
|
<div
|
|
49
49
|
v-if="openBackground"
|
|
50
|
-
class="absolute inset-0 flex items-center justify-center z-
|
|
50
|
+
class="absolute inset-0 flex items-center justify-center z-[80] cursor-pointer overflow-hidden"
|
|
51
51
|
:class="{'bg-black/50 backdrop-blur-sm': !fullscreen}"
|
|
52
52
|
@click.self="closeModal"
|
|
53
53
|
>
|
|
@@ -9,10 +9,12 @@ const props = withDefaults(defineProps<{
|
|
|
9
9
|
state?: InputState,
|
|
10
10
|
delay?: number,
|
|
11
11
|
tooltipClasses?: string | Record<string, boolean>
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
}>(), {
|
|
13
14
|
state: InputState.base,
|
|
14
15
|
delay: 600,
|
|
15
16
|
tooltipClasses: '',
|
|
17
|
+
disabled: false,
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
const floatOpen = ref<boolean>(false)
|
|
@@ -157,7 +159,7 @@ function onClick() {
|
|
|
157
159
|
|
|
158
160
|
<teleport to="body">
|
|
159
161
|
<div
|
|
160
|
-
v-if="floatOpen && hasSlotContent($slots.content)"
|
|
162
|
+
v-if="floatOpen && hasSlotContent($slots.content) && !disabled"
|
|
161
163
|
:class="_tooltipClasses"
|
|
162
164
|
ref="floating"
|
|
163
165
|
:style="{
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
6
|
+
exports.disabled = exports.default = exports.Docs = void 0;
|
|
7
7
|
var _AntTooltip = _interopRequireDefault(require("../AntTooltip.vue"));
|
|
8
8
|
var _enums = require("../../enums");
|
|
9
9
|
var _AntButton = _interopRequireDefault(require("../buttons/AntButton.vue"));
|
|
@@ -102,4 +102,11 @@ const Docs = exports.Docs = {
|
|
|
102
102
|
});
|
|
103
103
|
},
|
|
104
104
|
args: {}
|
|
105
|
+
};
|
|
106
|
+
const disabled = exports.disabled = {
|
|
107
|
+
render: Docs.render,
|
|
108
|
+
args: {
|
|
109
|
+
...Docs.args,
|
|
110
|
+
disabled: true
|
|
111
|
+
}
|
|
105
112
|
};
|
|
@@ -108,7 +108,6 @@ const classes = computed(() => {
|
|
|
108
108
|
|
|
109
109
|
return {
|
|
110
110
|
'transition-all inline-flex items-center justify-center relative font-medium': true,
|
|
111
|
-
'focus:z-10': true,
|
|
112
111
|
'active:shadow-[inset_0_4px_4px_rgba(0,0,0,0.25)]': !hasInputState.value,
|
|
113
112
|
'p-1 text-xs gap-1': props.size === Size.xs2,
|
|
114
113
|
'p-1.5 text-xs gap-1.5': props.size === Size.xs,
|
|
@@ -81,27 +81,25 @@ watch(() => props.fullWidth, (val) => {
|
|
|
81
81
|
v-model:show-dropdown="showDropdown"
|
|
82
82
|
:position="Position.left"
|
|
83
83
|
>
|
|
84
|
-
<
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/>
|
|
84
|
+
<div class="flex">
|
|
85
|
+
<AntButton
|
|
86
|
+
:state="hasFilter ? State.info : State.base"
|
|
87
|
+
:grouped="hasFilter ? Grouped.left : Grouped.none"
|
|
88
|
+
:skeleton="skeleton"
|
|
89
|
+
:icon-left="faFilter"
|
|
90
|
+
@click="() => showDropdown = !showDropdown"
|
|
91
|
+
/>
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</template>
|
|
93
|
+
<AntButton
|
|
94
|
+
v-if="hasFilter"
|
|
95
|
+
:state="State.info"
|
|
96
|
+
:grouped="Grouped.right"
|
|
97
|
+
:skeleton="skeleton"
|
|
98
|
+
:icon-left="faMultiply"
|
|
99
|
+
filled
|
|
100
|
+
@click="$emit('removeFilter')"
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
105
103
|
|
|
106
104
|
<template #content>
|
|
107
105
|
<slot name="dropdownContent"/>
|
|
@@ -10,11 +10,17 @@ import {handleEnumValidation} from '../../handler';
|
|
|
10
10
|
import {useVModel} from '@vueuse/core';
|
|
11
11
|
import {Grouped} from '../../enums/Grouped.enum';
|
|
12
12
|
import {BaseInputType} from './Elements/__types';
|
|
13
|
+
import Big from 'big.js';
|
|
14
|
+
Big.RM = Big.roundHalfEven;
|
|
13
15
|
|
|
14
16
|
defineOptions({inheritAttrs: false});
|
|
15
17
|
|
|
18
|
+
/**
|
|
19
|
+
* We use a string as the modelValue to ensure that numbers are correctly padded with a trailing 0 instead of cut off (e.g. 0.10 would be converted to 0.1).
|
|
20
|
+
* Additionally, the initial value (if none is given) gets set to "0" with the same amount of decimals as used in the steps.
|
|
21
|
+
*/
|
|
16
22
|
const props = withDefaults(defineProps<{
|
|
17
|
-
modelValue:
|
|
23
|
+
modelValue: string | null;
|
|
18
24
|
label?: string;
|
|
19
25
|
placeholder?: string;
|
|
20
26
|
description?: string;
|
|
@@ -42,6 +48,7 @@ const props = withDefaults(defineProps<{
|
|
|
42
48
|
});
|
|
43
49
|
const emit = defineEmits(['update:modelValue', 'validate']);
|
|
44
50
|
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
51
|
+
|
|
45
52
|
const isPrevButtonDisabled = computed(() => {
|
|
46
53
|
if (props.disabled) {
|
|
47
54
|
return true;
|
|
@@ -51,7 +58,7 @@ const isPrevButtonDisabled = computed(() => {
|
|
|
51
58
|
return false;
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
return props.min !== undefined ? _modelValue.value <= props.min : false;
|
|
61
|
+
return props.min !== undefined ? Number(_modelValue.value) <= props.min : false;
|
|
55
62
|
});
|
|
56
63
|
const isNextButtonDisabled = computed(() => {
|
|
57
64
|
if (props.disabled) {
|
|
@@ -62,7 +69,7 @@ const isNextButtonDisabled = computed(() => {
|
|
|
62
69
|
return false;
|
|
63
70
|
}
|
|
64
71
|
|
|
65
|
-
return props.max !== undefined ? _modelValue.value >= props.max : false;
|
|
72
|
+
return props.max !== undefined ? Number(_modelValue.value) >= props.max : false;
|
|
66
73
|
});
|
|
67
74
|
|
|
68
75
|
onMounted(() => {
|
|
@@ -70,23 +77,44 @@ onMounted(() => {
|
|
|
70
77
|
handleEnumValidation(props.state, InputState, 'state');
|
|
71
78
|
});
|
|
72
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Returns the amount of decimal places of the given value.
|
|
82
|
+
* @param value Number to get decimal places from.
|
|
83
|
+
*/
|
|
84
|
+
function getDecimalPlaces(value: number | string) {
|
|
85
|
+
const strValue = String(value);
|
|
86
|
+
const decimalIndex = strValue.indexOf('.');
|
|
87
|
+
|
|
88
|
+
if (decimalIndex === -1) return 0;
|
|
89
|
+
|
|
90
|
+
return strValue.length - decimalIndex - 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
73
93
|
function subtract() {
|
|
94
|
+
const modelDecimalPlaces = getDecimalPlaces(_modelValue.value || 0);
|
|
95
|
+
const stepDecimalPlaces = getDecimalPlaces(props.steps);
|
|
96
|
+
const decimalPlaces = Math.max(modelDecimalPlaces, stepDecimalPlaces);
|
|
97
|
+
|
|
74
98
|
if (_modelValue.value === null) {
|
|
75
|
-
_modelValue.value = props.max || 0;
|
|
76
|
-
} else if (props.max !== undefined && _modelValue.value - props.steps > props.max) {
|
|
77
|
-
_modelValue.value = props.max;
|
|
99
|
+
_modelValue.value = String(props.max || new Big(0).toFixed(decimalPlaces));
|
|
100
|
+
} else if (props.max !== undefined && Number(_modelValue.value) - props.steps > props.max) {
|
|
101
|
+
_modelValue.value = String(props.max);
|
|
78
102
|
} else {
|
|
79
|
-
_modelValue.value
|
|
103
|
+
_modelValue.value = new Big(_modelValue.value).sub(props.steps).toFixed(decimalPlaces);
|
|
80
104
|
}
|
|
81
105
|
}
|
|
82
106
|
|
|
83
107
|
function add() {
|
|
108
|
+
const modelDecimalPlaces = getDecimalPlaces(_modelValue.value || 0);
|
|
109
|
+
const stepDecimalPlaces = getDecimalPlaces(props.steps);
|
|
110
|
+
const decimalPlaces = Math.max(modelDecimalPlaces, stepDecimalPlaces);
|
|
111
|
+
|
|
84
112
|
if (_modelValue.value === null) {
|
|
85
|
-
return _modelValue.value = props.min || 0;
|
|
86
|
-
} else if (props.min !== undefined && _modelValue.value + props.steps < props.min) {
|
|
87
|
-
return _modelValue.value = props.min;
|
|
113
|
+
return _modelValue.value = String(props.min || new Big(0).toFixed(decimalPlaces));
|
|
114
|
+
} else if (props.min !== undefined && Number(_modelValue.value) + props.steps < props.min) {
|
|
115
|
+
return _modelValue.value = String(props.min);
|
|
88
116
|
} else {
|
|
89
|
-
_modelValue.value
|
|
117
|
+
_modelValue.value = new Big(_modelValue.value).add(props.steps).toFixed(decimalPlaces);
|
|
90
118
|
}
|
|
91
119
|
}
|
|
92
120
|
|
|
@@ -103,7 +131,7 @@ function onButtonBlur() {
|
|
|
103
131
|
:description="description"
|
|
104
132
|
:state="state"
|
|
105
133
|
:limiter-max-value="limiter && max !== undefined ? max : undefined"
|
|
106
|
-
:limiter-value="limiter && _modelValue !== undefined && _modelValue !== null ? _modelValue : undefined"
|
|
134
|
+
:limiter-value="limiter && _modelValue !== undefined && _modelValue !== null ? Number(_modelValue) : undefined"
|
|
107
135
|
:messages="messages"
|
|
108
136
|
>
|
|
109
137
|
<div
|
|
@@ -38,7 +38,7 @@ const inputClasses = computed(() => {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
return {
|
|
41
|
-
'ant-range-slider transition-colors relative border-none w-full
|
|
41
|
+
'ant-range-slider transition-colors relative border-none w-full h-2 bg-base-300 rounded-md outline-none': true,
|
|
42
42
|
'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
|
|
43
43
|
'invisible': props.skeleton,
|
|
44
44
|
[variants[props.state]]: true
|
|
@@ -79,7 +79,7 @@ const inputClasses = computed(() => {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
return {
|
|
82
|
-
'flex items-center transition-colors border-none outline relative
|
|
82
|
+
'flex items-center transition-colors border-none outline relative': true,
|
|
83
83
|
'outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1': true,
|
|
84
84
|
[variants[props.state]]: true,
|
|
85
85
|
// Skeleton
|
|
@@ -315,6 +315,7 @@ function onClickRemoveButton() {
|
|
|
315
315
|
:grouped="[Grouped.left, Grouped.center].some(item => item === grouped) ? Grouped.center : Grouped.right"
|
|
316
316
|
:size="size"
|
|
317
317
|
:skeleton="skeleton"
|
|
318
|
+
:disabled="disabled"
|
|
318
319
|
@click="onClickRemoveButton"
|
|
319
320
|
/>
|
|
320
321
|
</div>
|
|
@@ -70,7 +70,7 @@ const inputClasses = computed(() => {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
return {
|
|
73
|
-
'block transition-colors relative border-none outline w-full
|
|
73
|
+
'block transition-colors relative border-none outline w-full h-full text-black': true,
|
|
74
74
|
'outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1': true,
|
|
75
75
|
'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
|
|
76
76
|
[variants[props.state]]: true,
|
|
@@ -68,7 +68,7 @@ const inputClasses = computed(() => {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
return {
|
|
71
|
-
'block transition-colors relative border-none outline w-full
|
|
71
|
+
'block transition-colors relative border-none outline w-full text-black font-regular': true,
|
|
72
72
|
'outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1': true,
|
|
73
73
|
'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
|
|
74
74
|
'text-right': props.type === BaseInputType.number,
|
|
@@ -228,6 +228,7 @@ function onClickClearIcon() {
|
|
|
228
228
|
:disabled="disabled || skeleton"
|
|
229
229
|
:readonly="readonly"
|
|
230
230
|
:tabindex="hasInputState ? -1 : 0"
|
|
231
|
+
title=""
|
|
231
232
|
v-bind="$attrs"
|
|
232
233
|
@blur="onBlur"
|
|
233
234
|
>
|
|
@@ -12,7 +12,6 @@ import type {SelectOption} from '../__types';
|
|
|
12
12
|
import {useElementSize, useVModel, onClickOutside} from '@vueuse/core';
|
|
13
13
|
import type {Validator} from '@antify/validate';
|
|
14
14
|
import {autoUpdate, flip, offset, useFloating} from "@floating-ui/vue";
|
|
15
|
-
import {vOnClickOutside} from '@vueuse/components';
|
|
16
15
|
|
|
17
16
|
const emit = defineEmits(['update:open', 'update:modelValue', 'update:focused', 'selectElement']);
|
|
18
17
|
const props = withDefaults(defineProps<{
|
|
@@ -35,7 +34,7 @@ const props = withDefaults(defineProps<{
|
|
|
35
34
|
closeOnSelectItem: true,
|
|
36
35
|
});
|
|
37
36
|
const reference = ref<HTMLElement | null | undefined>(props.inputRef)
|
|
38
|
-
const
|
|
37
|
+
const elementSize = useElementSize(reference);
|
|
39
38
|
const floating = ref<HTMLElement | null>(null)
|
|
40
39
|
const {floatingStyles, middlewareData, placement} = useFloating(reference, floating, {
|
|
41
40
|
placement: 'bottom',
|
|
@@ -69,7 +68,7 @@ const dropdownClasses = computed(() => {
|
|
|
69
68
|
};
|
|
70
69
|
|
|
71
70
|
return {
|
|
72
|
-
'w-full border flex flex-col gap-px outline-none -mt-px overflow-
|
|
71
|
+
'w-full border flex flex-col gap-px outline-none -mt-px overflow-y-auto shadow-md z-[90] max-h-[250px]': true,
|
|
73
72
|
'rounded-md': true,
|
|
74
73
|
[variants[props.state]]: true,
|
|
75
74
|
};
|
|
@@ -84,7 +83,7 @@ const dropDownItemClasses = computed(() => {
|
|
|
84
83
|
};
|
|
85
84
|
|
|
86
85
|
return {
|
|
87
|
-
'select-none text-ellipsis overflow-hidden whitespace-nowrap': true,
|
|
86
|
+
'select-none text-ellipsis overflow-hidden whitespace-nowrap min-h-fit': true,
|
|
88
87
|
[variants[props.state]]: true,
|
|
89
88
|
// Size
|
|
90
89
|
'p-1 text-xs': props.size === Size.xs2,
|
|
@@ -203,31 +202,31 @@ watch(_modelValue, (val) => {
|
|
|
203
202
|
<slot/>
|
|
204
203
|
|
|
205
204
|
<teleport to="body">
|
|
206
|
-
<div
|
|
207
|
-
v-if="isOpen"
|
|
208
|
-
:class="dropdownClasses"
|
|
209
|
-
ref="floating"
|
|
210
|
-
:style="{width: `${width.width.value}px!important`, ...floatingStyles}"
|
|
211
|
-
>
|
|
212
205
|
<div
|
|
213
|
-
v-
|
|
214
|
-
:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
@mouseover="() => focusedDropDownItem = option.value"
|
|
206
|
+
v-if="isOpen"
|
|
207
|
+
:class="dropdownClasses"
|
|
208
|
+
ref="floating"
|
|
209
|
+
:style="{width: `${elementSize.width.value}px!important`, ...floatingStyles}"
|
|
218
210
|
>
|
|
219
|
-
|
|
211
|
+
<div
|
|
212
|
+
v-for="(option, index) in options"
|
|
213
|
+
:key="`option-${index}`"
|
|
214
|
+
:class="{...dropDownItemClasses, ...getActiveDropDownItemClasses(option)}"
|
|
215
|
+
@mousedown="(e) => onClickDropDownItem(e, option.value)"
|
|
216
|
+
@mouseover="() => focusedDropDownItem = option.value"
|
|
217
|
+
>
|
|
218
|
+
{{ option.label }}
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<div
|
|
222
|
+
v-if="options.length === 0"
|
|
223
|
+
:class="{...dropDownItemClasses}"
|
|
224
|
+
>
|
|
225
|
+
<slot name="empty">
|
|
226
|
+
No options available
|
|
227
|
+
</slot>
|
|
228
|
+
</div>
|
|
220
229
|
</div>
|
|
221
|
-
|
|
222
|
-
<div
|
|
223
|
-
v-if="options.length === 0"
|
|
224
|
-
:class="{...dropDownItemClasses}"
|
|
225
|
-
>
|
|
226
|
-
<slot name="empty">
|
|
227
|
-
No options available
|
|
228
|
-
</slot>
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
230
|
</teleport>
|
|
232
231
|
</div>
|
|
233
232
|
</template>
|
|
@@ -81,7 +81,27 @@ const Docs = exports.Docs = {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
const WithIndicators = exports.WithIndicators = {
|
|
84
|
-
render:
|
|
84
|
+
render: args => ({
|
|
85
|
+
components: {
|
|
86
|
+
AntNumberInput: _AntNumberInput.default,
|
|
87
|
+
AntFormGroup: _AntFormGroup.default,
|
|
88
|
+
AntFormGroupLabel: _AntFormGroupLabel.default
|
|
89
|
+
},
|
|
90
|
+
setup() {
|
|
91
|
+
return {
|
|
92
|
+
args
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
template: `
|
|
96
|
+
<AntFormGroup>
|
|
97
|
+
<AntFormGroup direction="column">
|
|
98
|
+
<AntNumberInput v-bind="args" v-model="args.modelValue" label="Label"
|
|
99
|
+
description="Lorem ipsum dolor sit amet"/>
|
|
100
|
+
<AntNumberInput v-bind="args" v-model="args.modelValue" label="Label"
|
|
101
|
+
description="Lorem ipsum dolor sit amet" :steps="0.0001"/>
|
|
102
|
+
</AntFormGroup>
|
|
103
|
+
</AntFormGroup>`
|
|
104
|
+
}),
|
|
85
105
|
args: {
|
|
86
106
|
...Docs.args,
|
|
87
107
|
indicators: true
|
|
@@ -48,7 +48,21 @@ export const Docs = {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
export const WithIndicators = {
|
|
51
|
-
render:
|
|
51
|
+
render: (args) => ({
|
|
52
|
+
components: { AntNumberInput, AntFormGroup, AntFormGroupLabel },
|
|
53
|
+
setup() {
|
|
54
|
+
return { args };
|
|
55
|
+
},
|
|
56
|
+
template: `
|
|
57
|
+
<AntFormGroup>
|
|
58
|
+
<AntFormGroup direction="column">
|
|
59
|
+
<AntNumberInput v-bind="args" v-model="args.modelValue" label="Label"
|
|
60
|
+
description="Lorem ipsum dolor sit amet"/>
|
|
61
|
+
<AntNumberInput v-bind="args" v-model="args.modelValue" label="Label"
|
|
62
|
+
description="Lorem ipsum dolor sit amet" :steps="0.0001"/>
|
|
63
|
+
</AntFormGroup>
|
|
64
|
+
</AntFormGroup>`
|
|
65
|
+
}),
|
|
52
66
|
args: {
|
|
53
67
|
...Docs.args,
|
|
54
68
|
indicators: true
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof AntSelect>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof AntSelect>;
|
|
6
6
|
export declare const Docs: Story;
|
|
7
|
+
export declare const manyOptions: Story;
|
|
7
8
|
export declare const nullable: Story;
|
|
8
9
|
export declare const skeleton: Story;
|
|
9
10
|
export declare const disabled: Story;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.withPlaceholder = exports.summary = exports.skeleton = exports.nullable = exports.ellipsisText = exports.disabled = exports.default = exports.Docs = void 0;
|
|
6
|
+
exports.withPlaceholder = exports.summary = exports.skeleton = exports.nullable = exports.manyOptions = exports.ellipsisText = exports.disabled = exports.default = exports.Docs = void 0;
|
|
7
7
|
var _Size = require("../../../enums/Size.enum");
|
|
8
8
|
var _AntSelect = _interopRequireDefault(require("../AntSelect.vue"));
|
|
9
9
|
var _AntSelectMenu = _interopRequireDefault(require("../Elements/AntSelectMenu.vue"));
|
|
@@ -75,6 +75,10 @@ const options = [{
|
|
|
75
75
|
label: "Option 4",
|
|
76
76
|
value: "4"
|
|
77
77
|
}];
|
|
78
|
+
const manySelectOptions = [...Array(24).keys()].map(key => ({
|
|
79
|
+
label: `Option ${Number(key) + 1}`,
|
|
80
|
+
value: Number(key) + 1
|
|
81
|
+
}));
|
|
78
82
|
const Docs = exports.Docs = {
|
|
79
83
|
render: args => ({
|
|
80
84
|
components: {
|
|
@@ -115,6 +119,13 @@ const Docs = exports.Docs = {
|
|
|
115
119
|
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
116
120
|
}
|
|
117
121
|
};
|
|
122
|
+
const manyOptions = exports.manyOptions = {
|
|
123
|
+
render: Docs.render,
|
|
124
|
+
args: {
|
|
125
|
+
...Docs.args,
|
|
126
|
+
options: manySelectOptions
|
|
127
|
+
}
|
|
128
|
+
};
|
|
118
129
|
const nullable = exports.nullable = {
|
|
119
130
|
render: Docs.render,
|
|
120
131
|
args: {
|
|
@@ -132,9 +143,23 @@ const skeleton = exports.skeleton = {
|
|
|
132
143
|
}
|
|
133
144
|
};
|
|
134
145
|
const disabled = exports.disabled = {
|
|
135
|
-
render:
|
|
146
|
+
render: (args, ctx) => ({
|
|
147
|
+
// @ts-ignore
|
|
148
|
+
components: Docs.render(args, ctx).components,
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
setup: Docs.render(args, ctx).setup,
|
|
151
|
+
template: `
|
|
152
|
+
<div ref="scrollContainer" class="overflow-y-auto h-[100vh] p-2.5 dashed">
|
|
153
|
+
<div class="flex flex-col gap-4 justify-center h-[200vh]">
|
|
154
|
+
<AntSelect v-bind="args" v-model="modelValue"/>
|
|
155
|
+
<AntSelect v-bind="args" v-model="modelValue" nullable/>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
`
|
|
159
|
+
}),
|
|
136
160
|
args: {
|
|
137
161
|
...Docs.args,
|
|
162
|
+
modelValue: "1",
|
|
138
163
|
disabled: true
|
|
139
164
|
}
|
|
140
165
|
};
|
|
@@ -185,7 +210,8 @@ const summary = exports.summary = {
|
|
|
185
210
|
},
|
|
186
211
|
setup() {
|
|
187
212
|
return {
|
|
188
|
-
args
|
|
213
|
+
args,
|
|
214
|
+
manySelectOptions
|
|
189
215
|
};
|
|
190
216
|
},
|
|
191
217
|
template: `
|
|
@@ -230,6 +256,13 @@ const summary = exports.summary = {
|
|
|
230
256
|
<AntSelect v-bind="args" value="1" size="sm" state="warning" disabled/>
|
|
231
257
|
<AntSelect v-bind="args" value="1" size="sm" state="danger" disabled/>
|
|
232
258
|
</div>
|
|
259
|
+
<div class="flex gap-2.5">
|
|
260
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="base" disabled nullable/>
|
|
261
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="info" disabled nullable/>
|
|
262
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="success" disabled nullable/>
|
|
263
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="warning" disabled nullable/>
|
|
264
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="danger" disabled nullable/>
|
|
265
|
+
</div>
|
|
233
266
|
<div class="flex gap-2.5">
|
|
234
267
|
<AntSelect v-bind="args" :value="null" grouped="none"/>
|
|
235
268
|
<AntSelect v-bind="args" :value="null" grouped="right"/>
|
|
@@ -53,6 +53,10 @@ const options = [
|
|
|
53
53
|
value: "4"
|
|
54
54
|
}
|
|
55
55
|
];
|
|
56
|
+
const manySelectOptions = [...Array(24).keys()].map((key) => ({
|
|
57
|
+
label: `Option ${Number(key) + 1}`,
|
|
58
|
+
value: Number(key) + 1
|
|
59
|
+
}));
|
|
56
60
|
export const Docs = {
|
|
57
61
|
render: (args) => ({
|
|
58
62
|
components: { AntSelect, AntDropdown },
|
|
@@ -86,6 +90,13 @@ export const Docs = {
|
|
|
86
90
|
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
87
91
|
}
|
|
88
92
|
};
|
|
93
|
+
export const manyOptions = {
|
|
94
|
+
render: Docs.render,
|
|
95
|
+
args: {
|
|
96
|
+
...Docs.args,
|
|
97
|
+
options: manySelectOptions
|
|
98
|
+
}
|
|
99
|
+
};
|
|
89
100
|
export const nullable = {
|
|
90
101
|
render: Docs.render,
|
|
91
102
|
args: {
|
|
@@ -103,9 +114,23 @@ export const skeleton = {
|
|
|
103
114
|
}
|
|
104
115
|
};
|
|
105
116
|
export const disabled = {
|
|
106
|
-
render:
|
|
117
|
+
render: (args, ctx) => ({
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
components: Docs.render(args, ctx).components,
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
setup: Docs.render(args, ctx).setup,
|
|
122
|
+
template: `
|
|
123
|
+
<div ref="scrollContainer" class="overflow-y-auto h-[100vh] p-2.5 dashed">
|
|
124
|
+
<div class="flex flex-col gap-4 justify-center h-[200vh]">
|
|
125
|
+
<AntSelect v-bind="args" v-model="modelValue"/>
|
|
126
|
+
<AntSelect v-bind="args" v-model="modelValue" nullable/>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
`
|
|
130
|
+
}),
|
|
107
131
|
args: {
|
|
108
132
|
...Docs.args,
|
|
133
|
+
modelValue: "1",
|
|
109
134
|
disabled: true
|
|
110
135
|
}
|
|
111
136
|
};
|
|
@@ -151,7 +176,7 @@ export const summary = {
|
|
|
151
176
|
render: (args) => ({
|
|
152
177
|
components: { AntSelect },
|
|
153
178
|
setup() {
|
|
154
|
-
return { args };
|
|
179
|
+
return { args, manySelectOptions };
|
|
155
180
|
},
|
|
156
181
|
template: `
|
|
157
182
|
<div class="p-4 flex flex-col gap-2.5">
|
|
@@ -195,6 +220,13 @@ export const summary = {
|
|
|
195
220
|
<AntSelect v-bind="args" value="1" size="sm" state="warning" disabled/>
|
|
196
221
|
<AntSelect v-bind="args" value="1" size="sm" state="danger" disabled/>
|
|
197
222
|
</div>
|
|
223
|
+
<div class="flex gap-2.5">
|
|
224
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="base" disabled nullable/>
|
|
225
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="info" disabled nullable/>
|
|
226
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="success" disabled nullable/>
|
|
227
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="warning" disabled nullable/>
|
|
228
|
+
<AntSelect v-bind="args" :value="1" v-model="modelValue" size="sm" state="danger" disabled nullable/>
|
|
229
|
+
</div>
|
|
198
230
|
<div class="flex gap-2.5">
|
|
199
231
|
<AntSelect v-bind="args" :value="null" grouped="none"/>
|
|
200
232
|
<AntSelect v-bind="args" :value="null" grouped="right"/>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {computed} from "vue";
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
skeleton?: boolean;
|
|
7
|
+
}>(), {
|
|
8
|
+
skeleton: false,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const rowContentClasses = computed(() => ({
|
|
12
|
+
"grid transition-all duration-300 delay-0 ease-in-out": true,
|
|
13
|
+
"grid-rows-[0fr]": !props.isOpen,
|
|
14
|
+
"grid-rows-[1fr]": props.isOpen,
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div :class="rowContentClasses">
|
|
21
|
+
<div class="overflow-hidden">
|
|
22
|
+
<slot/>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|