@antify/ui 1.0.4 → 1.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/dist/components/AntAccordion.vue +32 -7
- package/dist/components/AntAccordionItem.vue +48 -15
- package/dist/components/AntAlert.vue +8 -6
- package/dist/components/AntDropdown.vue +50 -36
- package/dist/components/AntIcon.vue +8 -6
- package/dist/components/AntKeycap.vue +22 -17
- package/dist/components/AntListGroup.vue +5 -3
- package/dist/components/AntModal.vue +17 -7
- package/dist/components/AntPopover.vue +118 -42
- package/dist/components/AntSkeleton.vue +1 -1
- package/dist/components/AntTooltip.vue +102 -76
- package/dist/components/__stories/AntAccordion.stories.d.ts +1 -0
- package/dist/components/__stories/AntAccordion.stories.js +73 -1
- package/dist/components/__stories/AntAccordion.stories.mjs +68 -0
- package/dist/components/__stories/AntDropdown.stories.js +27 -23
- package/dist/components/__stories/AntDropdown.stories.mjs +26 -22
- package/dist/components/__stories/AntKeycap.stories.js +13 -15
- package/dist/components/__stories/AntKeycap.stories.mjs +13 -13
- package/dist/components/__stories/AntListGroup.stories.js +1 -1
- package/dist/components/__stories/AntListGroup.stories.mjs +1 -1
- package/dist/components/__stories/AntModal.stories.js +2 -1
- package/dist/components/__stories/AntModal.stories.mjs +2 -1
- package/dist/components/__stories/AntPopover.stories.js +22 -21
- package/dist/components/__stories/AntPopover.stories.mjs +22 -20
- package/dist/components/__stories/AntTooltip.stories.d.ts +0 -10
- package/dist/components/__stories/AntTooltip.stories.js +32 -212
- package/dist/components/__stories/AntTooltip.stories.mjs +29 -193
- package/dist/components/__types/AntKeycap.types.d.ts +1 -0
- package/dist/components/__types/AntKeycap.types.js +1 -0
- package/dist/components/__types/AntKeycap.types.mjs +1 -0
- package/dist/components/buttons/AntButton.vue +41 -44
- package/dist/components/crud/AntCrud.vue +1 -1
- package/dist/components/crud/AntCrudDetailActions.vue +1 -0
- package/dist/components/crud/AntCrudTableFilter.vue +20 -18
- package/dist/components/forms/AntField.vue +7 -2
- package/dist/components/forms/__stories/AntField.stories.js +0 -16
- package/dist/components/forms/__stories/AntField.stories.mjs +2 -16
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +7 -7
- package/dist/components/index.mjs +2 -2
- package/dist/components/inputs/AntCheckbox.vue +25 -6
- package/dist/components/inputs/AntDateInput.vue +1 -1
- package/dist/components/inputs/AntRadio.vue +2 -1
- package/dist/components/inputs/AntSelect.vue +25 -22
- package/dist/components/inputs/AntSwitch.vue +2 -7
- package/dist/components/inputs/AntTagInput.vue +91 -114
- package/dist/components/inputs/AntTextarea.vue +7 -3
- package/dist/components/inputs/Elements/AntBaseInput.vue +2 -2
- package/dist/components/inputs/Elements/{AntDropDown.vue → AntSelectMenu.vue} +85 -40
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.d.ts +0 -1
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.js +1 -29
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +0 -22
- package/dist/components/inputs/Elements/index.d.ts +2 -1
- package/dist/components/inputs/Elements/index.js +7 -0
- package/dist/components/inputs/Elements/index.mjs +3 -1
- package/dist/components/inputs/__stories/AntCheckbox.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntCheckbox.stories.js +1 -43
- package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +0 -35
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.js +1 -31
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.mjs +0 -28
- package/dist/components/inputs/__stories/AntDateInput.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntDateInput.stories.js +1 -32
- package/dist/components/inputs/__stories/AntDateInput.stories.mjs +0 -28
- package/dist/components/inputs/__stories/AntNumberInput.stories.d.ts +0 -2
- package/dist/components/inputs/__stories/AntNumberInput.stories.js +1 -65
- package/dist/components/inputs/__stories/AntNumberInput.stories.mjs +1 -54
- package/dist/components/inputs/__stories/AntPasswordInput.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntPasswordInput.stories.js +1 -35
- package/dist/components/inputs/__stories/AntPasswordInput.stories.mjs +0 -25
- package/dist/components/inputs/__stories/AntRadioGroup.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntRadioGroup.stories.js +1 -47
- package/dist/components/inputs/__stories/AntRadioGroup.stories.mjs +0 -46
- package/dist/components/inputs/__stories/AntRangeSlider.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntRangeSlider.stories.js +1 -33
- package/dist/components/inputs/__stories/AntRangeSlider.stories.mjs +1 -28
- package/dist/components/inputs/__stories/AntSelect.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntSelect.stories.js +18 -46
- package/dist/components/inputs/__stories/AntSelect.stories.mjs +16 -47
- package/dist/components/inputs/__stories/AntSwitch.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntSwitch.stories.js +1 -42
- package/dist/components/inputs/__stories/AntSwitch.stories.mjs +1 -37
- package/dist/components/inputs/__stories/AntSwitcher.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntSwitcher.stories.js +1 -51
- package/dist/components/inputs/__stories/AntSwitcher.stories.mjs +1 -51
- package/dist/components/inputs/__stories/AntTagInput.stories.d.ts +0 -1
- package/dist/components/inputs/__stories/AntTagInput.stories.js +1 -35
- package/dist/components/inputs/__stories/AntTagInput.stories.mjs +0 -33
- package/dist/components/inputs/__stories/AntTextInput.stories.d.ts +0 -2
- package/dist/components/inputs/__stories/AntTextInput.stories.js +1 -107
- package/dist/components/inputs/__stories/AntTextInput.stories.mjs +0 -104
- package/dist/components/inputs/__stories/AntTextarea.stories.d.ts +0 -2
- package/dist/components/inputs/__stories/AntTextarea.stories.js +7 -66
- package/dist/components/inputs/__stories/AntTextarea.stories.mjs +6 -55
- package/dist/components/inputs/__stories/AntUnitInput.stories.d.ts +0 -2
- package/dist/components/inputs/__stories/AntUnitInput.stories.js +1 -61
- package/dist/components/inputs/__stories/AntUnitInput.stories.mjs +0 -53
- package/dist/components/table/AntTable.vue +17 -15
- package/dist/components/table/AntTd.vue +1 -2
- package/dist/components/table/__stories/AntTable.stories.js +7 -14
- package/dist/components/table/__stories/AntTable.stories.mjs +7 -15
- package/dist/components/tabs/AntTabItem.vue +16 -6
- package/dist/components/tabs/AntTabs.vue +8 -0
- package/dist/components/tabs/__types/AntTabItem.types.d.ts +1 -0
- package/package.json +2 -1
|
@@ -2,8 +2,6 @@ import { Size } from "../../../enums/Size.enum.mjs";
|
|
|
2
2
|
import AntUnitInput from "../AntUnitInput.vue";
|
|
3
3
|
import { faEuroSign } from "@fortawesome/free-solid-svg-icons";
|
|
4
4
|
import { InputState } from "../../../enums/index.mjs";
|
|
5
|
-
import { isRequiredRule, useFieldValidator } from "@antify/validate";
|
|
6
|
-
import { reactive } from "vue";
|
|
7
5
|
const meta = {
|
|
8
6
|
title: "Inputs/Unit Input",
|
|
9
7
|
component: AntUnitInput,
|
|
@@ -56,57 +54,6 @@ export const Docs = {
|
|
|
56
54
|
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
57
55
|
}
|
|
58
56
|
};
|
|
59
|
-
export const withValidator = {
|
|
60
|
-
render: (args) => ({
|
|
61
|
-
components: { AntUnitInput },
|
|
62
|
-
setup() {
|
|
63
|
-
const validator = reactive(useFieldValidator([isRequiredRule]));
|
|
64
|
-
return { args, validator, InputState };
|
|
65
|
-
},
|
|
66
|
-
template: `
|
|
67
|
-
<AntUnitInput
|
|
68
|
-
v-bind="args"
|
|
69
|
-
v-model="args.modelValue"
|
|
70
|
-
:unit="args.unit"
|
|
71
|
-
:state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
|
|
72
|
-
:messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
|
|
73
|
-
@validate="(val) => validator.validate(val)"
|
|
74
|
-
/>`
|
|
75
|
-
}),
|
|
76
|
-
args: {
|
|
77
|
-
modelValue: null,
|
|
78
|
-
unit: "\u20AC",
|
|
79
|
-
label: "Label",
|
|
80
|
-
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
export const Limited = {
|
|
84
|
-
render: (args) => ({
|
|
85
|
-
components: { AntUnitInput },
|
|
86
|
-
setup() {
|
|
87
|
-
const validator = reactive(useFieldValidator([
|
|
88
|
-
isRequiredRule,
|
|
89
|
-
(val) => val <= 10 || "Value should not be bigger than 10",
|
|
90
|
-
(val) => val <= 11 || "It should be really not bigger than 10!!!!"
|
|
91
|
-
]));
|
|
92
|
-
return { args, validator };
|
|
93
|
-
},
|
|
94
|
-
template: `
|
|
95
|
-
<AntUnitInput
|
|
96
|
-
v-bind="args"
|
|
97
|
-
v-model="args.modelValue"
|
|
98
|
-
:unit="args.unit"
|
|
99
|
-
:errors="Array.isArray(args.errors) ? args.errors : validator.getErrors()"
|
|
100
|
-
@validate="(val) => validator.validate(val)"
|
|
101
|
-
/>`
|
|
102
|
-
}),
|
|
103
|
-
args: {
|
|
104
|
-
...Docs.args,
|
|
105
|
-
modelValue: 50,
|
|
106
|
-
limiter: true,
|
|
107
|
-
max: 10
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
57
|
export const UnitAsIcon = {
|
|
111
58
|
render: Docs.render,
|
|
112
59
|
args: {
|
|
@@ -27,13 +27,15 @@ const props = withDefaults(
|
|
|
27
27
|
loading?: boolean;
|
|
28
28
|
selectableRows?: boolean;
|
|
29
29
|
showLightVersion?: boolean;
|
|
30
|
-
size?: AntTableSize
|
|
30
|
+
size?: AntTableSize;
|
|
31
|
+
headerColor?: string;
|
|
31
32
|
}>(), {
|
|
32
33
|
rowKey: 'id',
|
|
33
34
|
loading: false,
|
|
34
35
|
selectableRows: false,
|
|
35
36
|
showLightVersion: false,
|
|
36
|
-
size: AntTableSize.md
|
|
37
|
+
size: AntTableSize.md,
|
|
38
|
+
headerColor: 'bg-neutral-200'
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
const selected: Ref<Record<string, unknown> | undefined> = useVModel(props, 'selectedRow', emits);
|
|
@@ -96,7 +98,7 @@ function rowClick(elem: Record<string, unknown>): void {
|
|
|
96
98
|
class="min-w-full max-h-full relative"
|
|
97
99
|
:class="{'h-full': data.length === 0 && !_loading}"
|
|
98
100
|
>
|
|
99
|
-
<thead class="
|
|
101
|
+
<thead class="sticky top-0 z-10" :class="headerColor">
|
|
100
102
|
<tr>
|
|
101
103
|
<slot name="headerFirstCell"/>
|
|
102
104
|
|
|
@@ -124,15 +126,15 @@ function rowClick(elem: Record<string, unknown>): void {
|
|
|
124
126
|
<tbody class="bg-white relative">
|
|
125
127
|
<!-- TODO:: Add some kind of virtual list for very large tree data (or required pagination??) -->
|
|
126
128
|
<tr
|
|
127
|
-
v-for="(elem,
|
|
129
|
+
v-for="(elem, rowIndex) in data"
|
|
128
130
|
:id="elem[rowKey] as string"
|
|
129
|
-
:key="`table-row-${elem[rowKey]}-${
|
|
130
|
-
class="transition-all"
|
|
131
|
+
:key="`table-row-${elem[rowKey]}-${rowIndex}`"
|
|
131
132
|
:class="{
|
|
132
|
-
'bg-primary-200 text-primary-200-font': elem === selected,
|
|
133
|
-
'bg-white text-for-white-bg-font': elem !== selected &&
|
|
134
|
-
'bg-neutral-100 text-neutral-100-font': elem !== selected &&
|
|
135
|
-
'cursor-pointer': selectableRows
|
|
133
|
+
'bg-primary-200 text-primary-200-font transition-colors': elem === selected,
|
|
134
|
+
'bg-white text-for-white-bg-font': elem !== selected && rowIndex % 2 === 0,
|
|
135
|
+
'bg-neutral-100 text-neutral-100-font': elem !== selected && rowIndex % 2 !== 0,
|
|
136
|
+
'cursor-pointer': selectableRows,
|
|
137
|
+
'hover:bg-neutral-200': selectableRows && elem !== selected,
|
|
136
138
|
}"
|
|
137
139
|
>
|
|
138
140
|
<slot
|
|
@@ -140,10 +142,10 @@ function rowClick(elem: Record<string, unknown>): void {
|
|
|
140
142
|
v-bind="{ elem }"
|
|
141
143
|
/>
|
|
142
144
|
|
|
143
|
-
<template v-for="(header,
|
|
145
|
+
<template v-for="(header, colIndex) in _headers">
|
|
144
146
|
<AntTd
|
|
145
147
|
v-if="!_showLightVersion || (_showLightVersion && header.lightVersion)"
|
|
146
|
-
:key="`table-cell-${header.identifier}-${
|
|
148
|
+
:key="`table-cell-${header.identifier}-${colIndex}`"
|
|
147
149
|
:header="header"
|
|
148
150
|
:element="elem"
|
|
149
151
|
:align="header.align"
|
|
@@ -153,21 +155,21 @@ function rowClick(elem: Record<string, unknown>): void {
|
|
|
153
155
|
<template #beforeCellContent="props">
|
|
154
156
|
<slot
|
|
155
157
|
name="beforeCellContent"
|
|
156
|
-
v-bind="props"
|
|
158
|
+
v-bind="{...props, colIndex, rowIndex}"
|
|
157
159
|
/>
|
|
158
160
|
</template>
|
|
159
161
|
|
|
160
162
|
<template #cellContent="props">
|
|
161
163
|
<slot
|
|
162
164
|
name="cellContent"
|
|
163
|
-
v-bind="props"
|
|
165
|
+
v-bind="{...props, colIndex, rowIndex}"
|
|
164
166
|
/>
|
|
165
167
|
</template>
|
|
166
168
|
|
|
167
169
|
<template #afterCellContent="props">
|
|
168
170
|
<slot
|
|
169
171
|
name="afterCellContent"
|
|
170
|
-
v-bind="props"
|
|
172
|
+
v-bind="{...props, colIndex, rowIndex}"
|
|
171
173
|
/>
|
|
172
174
|
</template>
|
|
173
175
|
</AntTd>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
2
|
import {AntTableAlign, AntTableRowTypes, AntTableSize, type TableHeader} from './__types/TableHeader.types';
|
|
4
3
|
import {computed} from 'vue';
|
|
5
|
-
import type
|
|
4
|
+
import {type RouteLocationRaw, RouterLink} from 'vue-router';
|
|
6
5
|
|
|
7
6
|
const props =
|
|
8
7
|
withDefaults(
|
|
@@ -136,7 +136,7 @@ const meta = {
|
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
module.exports = meta;
|
|
139
|
-
const testData = [];
|
|
139
|
+
const testData = (0, _vue.ref)([]);
|
|
140
140
|
for (let i = 0; i < 100; i++) {
|
|
141
141
|
const randomName = _faker.faker.person.firstName() + " " + _faker.faker.person.lastName();
|
|
142
142
|
const randomNumber = _faker.faker.number.int({
|
|
@@ -145,13 +145,11 @@ for (let i = 0; i < 100; i++) {
|
|
|
145
145
|
});
|
|
146
146
|
const randomEmail = _faker.faker.internet.email();
|
|
147
147
|
const randomBoolean = _faker.faker.datatype.boolean();
|
|
148
|
-
testData.push({
|
|
148
|
+
testData.value.push({
|
|
149
149
|
name: randomName,
|
|
150
150
|
age: randomNumber,
|
|
151
151
|
email: randomEmail,
|
|
152
|
-
|
|
153
|
-
linkLabel: "Link here",
|
|
154
|
-
link: "/"
|
|
152
|
+
employed: randomBoolean
|
|
155
153
|
});
|
|
156
154
|
}
|
|
157
155
|
const Docs = exports.Docs = {
|
|
@@ -169,10 +167,10 @@ const Docs = exports.Docs = {
|
|
|
169
167
|
},
|
|
170
168
|
template: `
|
|
171
169
|
<div class="h-96 border border-dashed border-neutral-300">
|
|
172
|
-
<AntTable v-bind="args" v-model="selected">
|
|
170
|
+
<AntTable v-bind="args" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val">
|
|
173
171
|
<template #cellContent="{element: entry, header}">
|
|
174
172
|
<div v-if="header.identifier === 'employeed'">
|
|
175
|
-
<AntSwitch
|
|
173
|
+
<AntSwitch v-model="entry.employeed"/>
|
|
176
174
|
</div>
|
|
177
175
|
</template>
|
|
178
176
|
</AntTable>
|
|
@@ -202,13 +200,8 @@ const Docs = exports.Docs = {
|
|
|
202
200
|
identifier: "employeed",
|
|
203
201
|
rowClassList: "",
|
|
204
202
|
type: _TableHeader.AntTableRowTypes.slot
|
|
205
|
-
}, {
|
|
206
|
-
title: "Link",
|
|
207
|
-
identifier: "linkLabel",
|
|
208
|
-
toProp: "link",
|
|
209
|
-
type: _TableHeader.AntTableRowTypes.link
|
|
210
203
|
}],
|
|
211
|
-
data: testData
|
|
204
|
+
data: testData.value
|
|
212
205
|
}
|
|
213
206
|
};
|
|
214
207
|
const Empty = exports.Empty = {
|
|
@@ -303,6 +296,6 @@ const Loading = exports.Loading = {
|
|
|
303
296
|
toProp: "link",
|
|
304
297
|
type: _TableHeader.AntTableRowTypes.link
|
|
305
298
|
}],
|
|
306
|
-
data: testData
|
|
299
|
+
data: testData.value
|
|
307
300
|
}
|
|
308
301
|
};
|
|
@@ -89,19 +89,17 @@ const meta = {
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
export default meta;
|
|
92
|
-
const testData = [];
|
|
92
|
+
const testData = ref([]);
|
|
93
93
|
for (let i = 0; i < 100; i++) {
|
|
94
94
|
const randomName = faker.person.firstName() + " " + faker.person.lastName();
|
|
95
95
|
const randomNumber = faker.number.int({ min: 18, max: 60 });
|
|
96
96
|
const randomEmail = faker.internet.email();
|
|
97
97
|
const randomBoolean = faker.datatype.boolean();
|
|
98
|
-
testData.push({
|
|
98
|
+
testData.value.push({
|
|
99
99
|
name: randomName,
|
|
100
100
|
age: randomNumber,
|
|
101
101
|
email: randomEmail,
|
|
102
|
-
|
|
103
|
-
linkLabel: "Link here",
|
|
104
|
-
link: "/"
|
|
102
|
+
employed: randomBoolean
|
|
105
103
|
});
|
|
106
104
|
}
|
|
107
105
|
export const Docs = {
|
|
@@ -113,10 +111,10 @@ export const Docs = {
|
|
|
113
111
|
},
|
|
114
112
|
template: `
|
|
115
113
|
<div class="h-96 border border-dashed border-neutral-300">
|
|
116
|
-
<AntTable v-bind="args" v-model="selected">
|
|
114
|
+
<AntTable v-bind="args" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val">
|
|
117
115
|
<template #cellContent="{element: entry, header}">
|
|
118
116
|
<div v-if="header.identifier === 'employeed'">
|
|
119
|
-
<AntSwitch
|
|
117
|
+
<AntSwitch v-model="entry.employeed"/>
|
|
120
118
|
</div>
|
|
121
119
|
</template>
|
|
122
120
|
</AntTable>
|
|
@@ -150,15 +148,9 @@ export const Docs = {
|
|
|
150
148
|
identifier: "employeed",
|
|
151
149
|
rowClassList: "",
|
|
152
150
|
type: AntTableRowTypes.slot
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
title: "Link",
|
|
156
|
-
identifier: "linkLabel",
|
|
157
|
-
toProp: "link",
|
|
158
|
-
type: AntTableRowTypes.link
|
|
159
151
|
}
|
|
160
152
|
],
|
|
161
|
-
data: testData
|
|
153
|
+
data: testData.value
|
|
162
154
|
}
|
|
163
155
|
};
|
|
164
156
|
export const Empty = {
|
|
@@ -268,6 +260,6 @@ export const Loading = {
|
|
|
268
260
|
type: AntTableRowTypes.link
|
|
269
261
|
}
|
|
270
262
|
],
|
|
271
|
-
data: testData
|
|
263
|
+
data: testData.value
|
|
272
264
|
}
|
|
273
265
|
};
|
|
@@ -8,18 +8,23 @@ import {
|
|
|
8
8
|
import {computed} from 'vue';
|
|
9
9
|
import {type RouteLocationRaw, useRoute} from 'vue-router';
|
|
10
10
|
import {TabItemState} from './__types/AntTabItem.types';
|
|
11
|
+
import {AntSkeleton} from "../../../dist";
|
|
11
12
|
|
|
12
13
|
const props = withDefaults(defineProps<{
|
|
13
14
|
label: string;
|
|
14
15
|
active: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
15
17
|
state?: TabItemState
|
|
16
18
|
showIcon?: boolean;
|
|
17
19
|
icon?: IconDefinition;
|
|
18
20
|
to?: RouteLocationRaw;
|
|
19
21
|
expanded?: boolean;
|
|
22
|
+
skeleton?: boolean;
|
|
20
23
|
}>(), {
|
|
21
24
|
state: TabItemState.base,
|
|
22
25
|
showIcon: true,
|
|
26
|
+
disabled: false,
|
|
27
|
+
skeleton: false,
|
|
23
28
|
});
|
|
24
29
|
const route = useRoute();
|
|
25
30
|
|
|
@@ -31,11 +36,11 @@ const icons = {
|
|
|
31
36
|
const iconRight = computed<IconDefinition | null>(() => icons[props.state]);
|
|
32
37
|
const _active = computed<boolean>(() => {
|
|
33
38
|
if (typeof props.to === 'string') {
|
|
34
|
-
return route.path
|
|
39
|
+
return route.path.startsWith(props.to);
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
if (typeof props.to === 'object' && props.to?.name !== undefined) {
|
|
38
|
-
return route.name
|
|
43
|
+
return route.name.startsWith(props.to.name);
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
return props.active;
|
|
@@ -58,11 +63,13 @@ const containerClasses = computed(() => {
|
|
|
58
63
|
};
|
|
59
64
|
|
|
60
65
|
return {
|
|
61
|
-
'p-2
|
|
66
|
+
'p-2 text-center flex items-center justify-center gap-2 bg-white transition-[background-color] relative text-sm': true,
|
|
62
67
|
'grow': props.expanded,
|
|
63
|
-
[variants[props.state]]:
|
|
68
|
+
[variants[props.state]]: !props.disabled,
|
|
64
69
|
[activeVariants[props.state]]: _active.value,
|
|
65
70
|
[notActiveVariants[props.state]]: !_active.value,
|
|
71
|
+
'hover:cursor-pointer': !props.disabled,
|
|
72
|
+
'hover:cursor-not-allowed opacity-50': props.disabled,
|
|
66
73
|
};
|
|
67
74
|
});
|
|
68
75
|
const borderBoxClasses = computed(() => {
|
|
@@ -90,7 +97,7 @@ const iconColor = computed(() => {
|
|
|
90
97
|
|
|
91
98
|
<template>
|
|
92
99
|
<component
|
|
93
|
-
:is="to !== undefined ? 'router-link' : 'div'"
|
|
100
|
+
:is="to !== undefined && !disabled ? 'router-link' : 'div'"
|
|
94
101
|
:to="to"
|
|
95
102
|
:class="containerClasses"
|
|
96
103
|
>
|
|
@@ -102,7 +109,10 @@ const iconColor = computed(() => {
|
|
|
102
109
|
/>
|
|
103
110
|
</slot>
|
|
104
111
|
|
|
105
|
-
<
|
|
112
|
+
<div class="relative">
|
|
113
|
+
<slot>{{ label }}</slot>
|
|
114
|
+
<AntSkeleton v-if="skeleton" rounded absolute/>
|
|
115
|
+
</div>
|
|
106
116
|
|
|
107
117
|
<AntIcon
|
|
108
118
|
v-if="iconRight && showIcon"
|
|
@@ -9,8 +9,10 @@ const props = withDefaults(defineProps<{
|
|
|
9
9
|
modelValue?: string;
|
|
10
10
|
tabItems?: TabItem[];
|
|
11
11
|
expanded?: boolean;
|
|
12
|
+
skeleton?: boolean;
|
|
12
13
|
}>(), {
|
|
13
14
|
expanded: false,
|
|
15
|
+
skeleton: false,
|
|
14
16
|
});
|
|
15
17
|
|
|
16
18
|
const currentActive = useVModel(props, 'modelValue', emits);
|
|
@@ -25,6 +27,10 @@ function clickTab(tabItem: TabItem) {
|
|
|
25
27
|
tabItem.clickHandler();
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
if (tabItem.disabled){
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
currentActive.value = tabItem.id;
|
|
29
35
|
}
|
|
30
36
|
</script>
|
|
@@ -39,6 +45,8 @@ function clickTab(tabItem: TabItem) {
|
|
|
39
45
|
@click="clickTab(tabItem)"
|
|
40
46
|
:active="currentActive === tabItem.id"
|
|
41
47
|
:expanded="expanded"
|
|
48
|
+
:disabled="tabItem.disabled"
|
|
49
|
+
:skeleton="skeleton"
|
|
42
50
|
>
|
|
43
51
|
<slot name="content" v-bind="{item: tabItem, isActive: currentActive === tabItem.id}"></slot>
|
|
44
52
|
</AntTabItem>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antify/ui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"vue": "^3.4.29"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
+
"@floating-ui/vue": "^1.1.5",
|
|
49
50
|
"@fortawesome/free-regular-svg-icons": "^6.5.1",
|
|
50
51
|
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
51
52
|
"@fortawesome/vue-fontawesome": "^3.0.5",
|