@antify/ui 2.2.0 → 2.2.3
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 +25 -12
- package/dist/components/AntAccordionItem.vue +28 -13
- package/dist/components/AntAlert.vue +25 -15
- package/dist/components/AntCard.vue +26 -14
- package/dist/components/AntContent.vue +4 -4
- package/dist/components/AntDropdown.vue +41 -23
- package/dist/components/AntIcon.vue +18 -6
- package/dist/components/AntKeycap.vue +31 -16
- package/dist/components/AntListGroup.vue +13 -11
- package/dist/components/AntListGroupItem.vue +19 -9
- package/dist/components/AntModal.vue +26 -15
- package/dist/components/AntPagination.vue +28 -15
- package/dist/components/AntPopover.vue +74 -51
- package/dist/components/AntSkeleton.vue +8 -4
- package/dist/components/AntSpinner.vue +14 -6
- package/dist/components/AntTag.vue +25 -13
- package/dist/components/AntToast.vue +19 -11
- package/dist/components/AntToaster.vue +13 -5
- package/dist/components/AntTooltip.vue +78 -54
- package/dist/components/__stories/AntAccordion.stories.js +4 -4
- package/dist/components/__stories/AntAccordion.stories.mjs +50 -17
- package/dist/components/__stories/AntAlert.stories.mjs +18 -5
- package/dist/components/__stories/AntCard.stories.mjs +36 -10
- package/dist/components/__stories/AntContent.stories.mjs +14 -4
- package/dist/components/__stories/AntDropdown.stories.mjs +20 -4
- package/dist/components/__stories/AntIcon.stories.mjs +38 -12
- package/dist/components/__stories/AntKeycap.stories.mjs +35 -10
- package/dist/components/__stories/AntListGroup.stories.d.ts +1 -1
- package/dist/components/__stories/AntListGroup.stories.mjs +22 -4
- package/dist/components/__stories/AntListGroupItem.stories.mjs +27 -8
- package/dist/components/__stories/AntModal.stories.mjs +17 -4
- package/dist/components/__stories/AntPagination.stories.mjs +21 -6
- package/dist/components/__stories/AntPopover.stories.mjs +20 -4
- package/dist/components/__stories/AntSkeleton.stories.mjs +17 -5
- package/dist/components/__stories/AntSpinner.stories.mjs +33 -9
- package/dist/components/__stories/AntTag.stories.mjs +28 -8
- package/dist/components/__stories/AntToast.stories.mjs +19 -5
- package/dist/components/__stories/AntToaster.stories.d.ts +1 -1
- package/dist/components/__stories/AntToaster.stories.mjs +35 -9
- package/dist/components/__stories/AntTooltip.stories.js +1 -1
- package/dist/components/__stories/AntTooltip.stories.mjs +44 -13
- package/dist/components/buttons/AntActionButton.vue +38 -29
- package/dist/components/buttons/AntButton.vue +34 -13
- package/dist/components/buttons/AntCreateButton.vue +11 -4
- package/dist/components/buttons/AntDeleteButton.vue +11 -4
- package/dist/components/buttons/AntDuplicateButton.vue +11 -4
- package/dist/components/buttons/AntEditButton.vue +11 -4
- package/dist/components/buttons/AntSaveAndNewButton.vue +11 -4
- package/dist/components/buttons/AntSaveButton.vue +11 -4
- package/dist/components/buttons/__stories/AntActionButton.stories.mjs +35 -10
- package/dist/components/buttons/__stories/AntButton.stories.mjs +77 -23
- package/dist/components/buttons/__stories/AntCreateButton.stories.mjs +25 -7
- package/dist/components/buttons/__stories/AntDeleteButton.stories.mjs +25 -7
- package/dist/components/buttons/__stories/AntDuplicateButton.stories.mjs +25 -7
- package/dist/components/buttons/__stories/AntEditButton.stories.mjs +25 -7
- package/dist/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +25 -7
- package/dist/components/buttons/__stories/AntSaveButton.stories.mjs +25 -7
- package/dist/components/crud/AntCrud.vue +6 -6
- package/dist/components/crud/AntCrudDetail.vue +8 -5
- package/dist/components/crud/AntCrudDetailActions.vue +14 -8
- package/dist/components/crud/AntCrudDetailNav.vue +21 -13
- package/dist/components/crud/AntCrudTableFilter.vue +29 -17
- package/dist/components/crud/AntCrudTableNav.vue +36 -22
- package/dist/components/crud/__stories/AntCrud.stories.mjs +17 -5
- package/dist/components/crud/__stories/AntCrudDetail.stories.mjs +11 -3
- package/dist/components/crud/__stories/AntCrudDetailActions.stories.mjs +10 -2
- package/dist/components/crud/__stories/AntCrudDetailNav.stories.mjs +11 -3
- package/dist/components/crud/__stories/AntCrudTableFilter.stories.mjs +17 -5
- package/dist/components/crud/__stories/AntCrudTableNav.stories.mjs +23 -7
- package/dist/components/dialogs/AntDeleteDialog.vue +13 -5
- package/dist/components/dialogs/AntDialog.vue +23 -13
- package/dist/components/dialogs/__stories/AndDeleteDialog.stories.mjs +12 -3
- package/dist/components/dialogs/__stories/AntDialog.stories.mjs +28 -7
- package/dist/components/forms/AntField.vue +18 -7
- package/dist/components/forms/AntFormGroup.vue +9 -5
- package/dist/components/forms/AntFormGroupLabel.vue +1 -1
- package/dist/components/forms/__stories/AntField.stories.mjs +37 -9
- package/dist/components/forms/__stories/AntFormGroup.stories.mjs +20 -5
- package/dist/components/forms/__stories/AntFormGroupLabel.stories.mjs +11 -3
- package/dist/components/index.d.ts +1 -1
- package/dist/components/inputs/AntCheckbox.vue +61 -36
- package/dist/components/inputs/AntCheckboxGroup.vue +40 -15
- package/dist/components/inputs/AntDateInput.vue +35 -12
- package/dist/components/inputs/AntNumberInput.vue +33 -12
- package/dist/components/inputs/AntPasswordInput.vue +32 -11
- package/dist/components/inputs/AntRadio.vue +57 -34
- package/dist/components/inputs/AntRadioGroup.vue +60 -35
- package/dist/components/inputs/AntRangeSlider.vue +31 -12
- package/dist/components/inputs/AntSearch.vue +19 -7
- package/dist/components/inputs/AntSelect.vue +107 -83
- package/dist/components/inputs/AntSwitch.vue +36 -18
- package/dist/components/inputs/AntSwitcher.vue +30 -15
- package/dist/components/inputs/AntTagInput.vue +91 -61
- package/dist/components/inputs/AntTextInput.vue +31 -11
- package/dist/components/inputs/AntTextarea.vue +53 -25
- package/dist/components/inputs/AntUnitInput.vue +33 -12
- package/dist/components/inputs/Elements/AntBaseInput.vue +47 -18
- package/dist/components/inputs/Elements/AntInputDescription.vue +16 -8
- package/dist/components/inputs/Elements/AntInputLabel.vue +13 -5
- package/dist/components/inputs/Elements/AntInputLimiter.vue +13 -5
- package/dist/components/inputs/Elements/AntSelectMenu.vue +65 -41
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +104 -27
- package/dist/components/inputs/Elements/__stories/AntInputDescription.stories.mjs +33 -9
- package/dist/components/inputs/Elements/__stories/AntInputLabel.stories.mjs +34 -9
- package/dist/components/inputs/Elements/__stories/AntInputLimiter.stories.mjs +33 -9
- package/dist/components/inputs/Elements/index.d.ts +1 -1
- package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +34 -9
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.mjs +45 -21
- package/dist/components/inputs/__stories/AntDateInput.stories.mjs +52 -14
- package/dist/components/inputs/__stories/AntNumberInput.stories.mjs +66 -17
- package/dist/components/inputs/__stories/AntPasswordInput.stories.mjs +51 -13
- package/dist/components/inputs/__stories/AntRadioGroup.stories.mjs +45 -12
- package/dist/components/inputs/__stories/AntRangeSlider.stories.mjs +16 -5
- package/dist/components/inputs/__stories/AntSearch.stories.mjs +41 -10
- package/dist/components/inputs/__stories/AntSelect.stories.mjs +59 -15
- package/dist/components/inputs/__stories/AntSwitch.stories.js +126 -102
- package/dist/components/inputs/__stories/AntSwitch.stories.mjs +162 -112
- package/dist/components/inputs/__stories/AntSwitcher.stories.mjs +38 -10
- package/dist/components/inputs/__stories/AntTagInput.stories.mjs +46 -12
- package/dist/components/inputs/__stories/AntTextInput.stories.mjs +59 -16
- package/dist/components/inputs/__stories/AntTextarea.stories.mjs +47 -13
- package/dist/components/inputs/__stories/AntUnitInput.stories.mjs +46 -12
- package/dist/components/layouts/AntNavLeftLayout.vue +12 -6
- package/dist/components/layouts/__stories/AntNavLeftLayout.stories.mjs +10 -2
- package/dist/components/navbar/AntNavbar.vue +7 -3
- package/dist/components/navbar/AntNavbarItem.vue +12 -6
- package/dist/components/navbar/__stories/AntNavbar.stories.mjs +59 -37
- package/dist/components/table/AntCollapsibleTableRowContent.vue +7 -5
- package/dist/components/table/AntTable.vue +227 -165
- package/dist/components/table/AntTableSkeleton.vue +126 -0
- package/dist/components/table/AntTableSortButton.vue +22 -13
- package/dist/components/table/AntTd.vue +21 -17
- package/dist/components/table/AntTh.vue +19 -12
- package/dist/components/table/__stories/AntTable.stories.js +132 -14
- package/dist/components/table/__stories/AntTable.stories.mjs +253 -31
- package/dist/components/table/__types/index.d.ts +0 -1
- package/dist/components/table/__types/index.js +0 -11
- package/dist/components/table/__types/index.mjs +0 -1
- package/dist/components/tabs/AntTabItem.vue +20 -8
- package/dist/components/tabs/AntTabs.vue +35 -21
- package/dist/components/tabs/__stories/AntTabItem.stories.mjs +23 -7
- package/dist/components/tabs/__stories/AntTabs.stories.mjs +45 -13
- package/dist/components/transitions/AntTransitionCollapseHeight.vue +1 -1
- package/dist/composables/useToaster.mjs +25 -7
- package/dist/index.css +1 -0
- package/dist/utils.mjs +3 -1
- package/package.json +23 -16
- package/dist/tailwind.config.d.ts +0 -3
- package/dist/tailwind.config.js +0 -198
- package/dist/tailwind.config.mjs +0 -189
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
import AntTable from "../AntTable.vue";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import AntButton from "../../buttons/AntButton.vue";
|
|
3
|
+
import AntSelect from "../../inputs/AntSelect.vue";
|
|
4
|
+
import AntCheckboxGroup from "../../inputs/AntCheckboxGroup.vue";
|
|
5
|
+
import {
|
|
6
|
+
AntTableAlign,
|
|
7
|
+
AntTableRowTypes,
|
|
8
|
+
AntTableSize
|
|
9
|
+
} from "../__types/TableHeader.types.mjs";
|
|
10
|
+
import {
|
|
11
|
+
ref
|
|
12
|
+
} from "vue";
|
|
13
|
+
import {
|
|
14
|
+
faker
|
|
15
|
+
} from "@faker-js/faker";
|
|
5
16
|
import AntSwitch from "../../inputs/AntSwitch.vue";
|
|
17
|
+
import {
|
|
18
|
+
expect,
|
|
19
|
+
userEvent,
|
|
20
|
+
waitFor
|
|
21
|
+
} from "@storybook/test";
|
|
6
22
|
const meta = {
|
|
23
|
+
components: {
|
|
24
|
+
AntSelect,
|
|
25
|
+
AntCheckboxGroup
|
|
26
|
+
},
|
|
7
27
|
title: "Components/Table",
|
|
8
28
|
component: AntTable,
|
|
9
|
-
parameters: {
|
|
29
|
+
parameters: {
|
|
30
|
+
controls: {
|
|
31
|
+
sort: "requiredFirst"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
10
34
|
argTypes: {
|
|
11
35
|
headers: {
|
|
12
36
|
description: "List of header definitions. <br>If this value get changed from outside, because the table size should change, the change will take 350 ms to have a more smooth transition.",
|
|
@@ -41,46 +65,82 @@ const meta = {
|
|
|
41
65
|
description: "If true will display skeleton rows instead of an empty table if there is no data provided, otherwise it will display an overlay."
|
|
42
66
|
},
|
|
43
67
|
size: {
|
|
44
|
-
control: {
|
|
68
|
+
control: {
|
|
69
|
+
type: "select"
|
|
70
|
+
},
|
|
45
71
|
options: Object.values(AntTableSize),
|
|
46
|
-
table: {
|
|
72
|
+
table: {
|
|
73
|
+
defaultValue: {
|
|
74
|
+
summary: AntTableSize.md
|
|
75
|
+
}
|
|
76
|
+
}
|
|
47
77
|
},
|
|
48
78
|
// Slots
|
|
49
79
|
afterCellContent: {
|
|
50
80
|
description: "Slot to add custom elements to all cells. Gets {elem, header} as property.",
|
|
51
|
-
table: {
|
|
81
|
+
table: {
|
|
82
|
+
type: {
|
|
83
|
+
summary: "HTML"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
52
86
|
},
|
|
53
87
|
beforeCellContent: {
|
|
54
88
|
description: "Slot to add custom elements to all cells. Gets {elem, header} as property.",
|
|
55
|
-
table: {
|
|
89
|
+
table: {
|
|
90
|
+
type: {
|
|
91
|
+
summary: "HTML"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
56
94
|
},
|
|
57
95
|
emptyState: {
|
|
58
96
|
description: "Place for custom empty states.",
|
|
59
|
-
table: {
|
|
97
|
+
table: {
|
|
98
|
+
type: {
|
|
99
|
+
summary: "HTML"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
60
102
|
},
|
|
61
103
|
headerContent: {
|
|
62
104
|
description: "Overwrite for the default header items. Gets header as property.",
|
|
63
|
-
table: {
|
|
105
|
+
table: {
|
|
106
|
+
type: {
|
|
107
|
+
summary: "HTML"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
64
110
|
},
|
|
65
111
|
headerFirstCell: {
|
|
66
112
|
description: "Space to add cells to the header.",
|
|
67
|
-
table: {
|
|
113
|
+
table: {
|
|
114
|
+
type: {
|
|
115
|
+
summary: "HTML"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
68
118
|
},
|
|
69
119
|
headerLastCell: {
|
|
70
120
|
description: "Space to add cells to the header.",
|
|
71
|
-
table: {
|
|
121
|
+
table: {
|
|
122
|
+
type: {
|
|
123
|
+
summary: "HTML"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
72
126
|
},
|
|
73
127
|
rowFirstCell: {
|
|
74
128
|
description: "Space to add cells to the beginning of a row. Be aware that you have to add headerFirstCells as well otherwise the headers will not match up to your cells."
|
|
75
129
|
},
|
|
76
130
|
rowLastCell: {
|
|
77
131
|
description: "Space to add cells to all rows. Gets the current element as property.",
|
|
78
|
-
table: {
|
|
132
|
+
table: {
|
|
133
|
+
type: {
|
|
134
|
+
summary: "HTML"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
79
137
|
},
|
|
80
138
|
cellContent: {
|
|
81
139
|
description: 'Is used if the ROW_TYPE = "SLOT". Gets the current element and the header element to identifier witch cell is currently displayed.',
|
|
82
140
|
table: {
|
|
83
|
-
type: {
|
|
141
|
+
type: {
|
|
142
|
+
summary: "HTML"
|
|
143
|
+
}
|
|
84
144
|
}
|
|
85
145
|
},
|
|
86
146
|
showLightVersion: {
|
|
@@ -90,24 +150,56 @@ const meta = {
|
|
|
90
150
|
};
|
|
91
151
|
export default meta;
|
|
92
152
|
const testData = ref([]);
|
|
93
|
-
|
|
153
|
+
function getRandomEntry() {
|
|
94
154
|
const randomName = faker.person.firstName() + " " + faker.person.lastName();
|
|
95
|
-
const randomNumber = faker.number.int({
|
|
155
|
+
const randomNumber = faker.number.int({
|
|
156
|
+
min: 18,
|
|
157
|
+
max: 60
|
|
158
|
+
});
|
|
96
159
|
const randomEmail = faker.internet.email();
|
|
97
160
|
const randomBoolean = faker.datatype.boolean();
|
|
98
|
-
|
|
161
|
+
const randomPermissions = faker.helpers.arrayElements([
|
|
162
|
+
"read",
|
|
163
|
+
"write"
|
|
164
|
+
], {
|
|
165
|
+
min: 0,
|
|
166
|
+
max: 2
|
|
167
|
+
});
|
|
168
|
+
return {
|
|
99
169
|
name: randomName,
|
|
100
170
|
age: randomNumber,
|
|
101
171
|
email: randomEmail,
|
|
102
|
-
employed: randomBoolean
|
|
103
|
-
|
|
172
|
+
employed: randomBoolean,
|
|
173
|
+
permissions: randomPermissions
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
for (let i = 0; i < 100; i++) {
|
|
177
|
+
testData.value.push(getRandomEntry());
|
|
104
178
|
}
|
|
105
179
|
export const Docs = {
|
|
106
180
|
render: (args) => ({
|
|
107
|
-
components: {
|
|
181
|
+
components: {
|
|
182
|
+
AntTable,
|
|
183
|
+
AntSwitch,
|
|
184
|
+
AntCheckboxGroup
|
|
185
|
+
},
|
|
108
186
|
setup() {
|
|
109
187
|
const selected = ref();
|
|
110
|
-
|
|
188
|
+
const checkboxes = [
|
|
189
|
+
{
|
|
190
|
+
label: "Read",
|
|
191
|
+
value: "read"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
label: "Write",
|
|
195
|
+
value: "write"
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
return {
|
|
199
|
+
args,
|
|
200
|
+
selected,
|
|
201
|
+
checkboxes
|
|
202
|
+
};
|
|
111
203
|
},
|
|
112
204
|
template: `
|
|
113
205
|
<div class="h-96 border border-dashed border-base-300">
|
|
@@ -116,11 +208,52 @@ export const Docs = {
|
|
|
116
208
|
<div v-if="header.identifier === 'employed'">
|
|
117
209
|
<AntSwitch v-model="entry.employed"/>
|
|
118
210
|
</div>
|
|
211
|
+
|
|
212
|
+
<div v-if="header.identifier === 'permissions'">
|
|
213
|
+
<AntCheckboxGroup v-model="entry.permissions" :checkboxes="checkboxes" direction="row"/>
|
|
214
|
+
</div>
|
|
119
215
|
</template>
|
|
120
216
|
</AntTable>
|
|
121
217
|
</div>
|
|
122
218
|
`
|
|
123
219
|
}),
|
|
220
|
+
play: async ({
|
|
221
|
+
step
|
|
222
|
+
}) => {
|
|
223
|
+
const firstRow = document.querySelectorAll('[data-e2e="table-row"]')[0];
|
|
224
|
+
const employedCell = firstRow.querySelector('[data-e2e="table-cell-employed"]');
|
|
225
|
+
const employedSwitch = employedCell?.querySelector('[data-e2e="switch"]')?.querySelector("button");
|
|
226
|
+
const permissionsCell = firstRow.querySelector('[data-e2e="table-cell-permissions"]');
|
|
227
|
+
const permissionCheckboxWithLabel = permissionsCell?.querySelector('[data-e2e="checkbox"]');
|
|
228
|
+
const permissionCheckbox = permissionCheckboxWithLabel?.querySelector('[type="checkbox"]');
|
|
229
|
+
const permissionLabel = permissionCheckboxWithLabel?.querySelector("label");
|
|
230
|
+
await step("Click on a table cell and expect the row to be selected", async () => {
|
|
231
|
+
await userEvent.click(employedCell);
|
|
232
|
+
await waitFor(() => expect(firstRow).toHaveClass("bg-primary-200"), {
|
|
233
|
+
timeout: 600
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
await step("Click on employed switch and expect the value to toggle", async () => {
|
|
237
|
+
const initialAriaChecked = JSON.parse(employedSwitch?.getAttribute("aria-checked"));
|
|
238
|
+
await userEvent.click(employedSwitch);
|
|
239
|
+
await waitFor(() => {
|
|
240
|
+
const toggledAriaChecked = JSON.parse(employedSwitch?.getAttribute("aria-checked"));
|
|
241
|
+
expect(toggledAriaChecked).toBe(!initialAriaChecked);
|
|
242
|
+
}, {
|
|
243
|
+
timeout: 600
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
await step("Click on one of the permissions and expect the value to toggle", async () => {
|
|
247
|
+
const initialAriaChecked = JSON.parse(permissionCheckbox?.getAttribute("aria-checked"));
|
|
248
|
+
await userEvent.click(permissionLabel);
|
|
249
|
+
await waitFor(() => {
|
|
250
|
+
const toggledAriaChecked = JSON.parse(permissionCheckbox?.getAttribute("aria-checked"));
|
|
251
|
+
expect(toggledAriaChecked).toBe(!initialAriaChecked);
|
|
252
|
+
}, {
|
|
253
|
+
timeout: 600
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
},
|
|
124
257
|
args: {
|
|
125
258
|
headers: [
|
|
126
259
|
{
|
|
@@ -148,6 +281,12 @@ export const Docs = {
|
|
|
148
281
|
identifier: "employed",
|
|
149
282
|
rowClassList: "",
|
|
150
283
|
type: AntTableRowTypes.slot
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
title: "Permissions",
|
|
287
|
+
identifier: "permissions",
|
|
288
|
+
rowClassList: "",
|
|
289
|
+
type: AntTableRowTypes.slot
|
|
151
290
|
}
|
|
152
291
|
],
|
|
153
292
|
data: testData.value
|
|
@@ -155,10 +294,16 @@ export const Docs = {
|
|
|
155
294
|
};
|
|
156
295
|
export const Empty = {
|
|
157
296
|
render: (args) => ({
|
|
158
|
-
components: {
|
|
297
|
+
components: {
|
|
298
|
+
AntTable,
|
|
299
|
+
AntSwitch
|
|
300
|
+
},
|
|
159
301
|
setup() {
|
|
160
302
|
const selected = ref();
|
|
161
|
-
return {
|
|
303
|
+
return {
|
|
304
|
+
args,
|
|
305
|
+
selected
|
|
306
|
+
};
|
|
162
307
|
},
|
|
163
308
|
template: `
|
|
164
309
|
<div class="flex flex-col gap-2">
|
|
@@ -294,10 +439,28 @@ export const Loading = {
|
|
|
294
439
|
};
|
|
295
440
|
export const Collapsible = {
|
|
296
441
|
render: (args) => ({
|
|
297
|
-
components: {
|
|
442
|
+
components: {
|
|
443
|
+
AntTable,
|
|
444
|
+
AntSwitch,
|
|
445
|
+
AntCheckboxGroup
|
|
446
|
+
},
|
|
298
447
|
setup() {
|
|
299
448
|
const selected = ref();
|
|
300
|
-
|
|
449
|
+
const checkboxes = [
|
|
450
|
+
{
|
|
451
|
+
label: "Read",
|
|
452
|
+
value: "read"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
label: "Write",
|
|
456
|
+
value: "write"
|
|
457
|
+
}
|
|
458
|
+
];
|
|
459
|
+
return {
|
|
460
|
+
args,
|
|
461
|
+
selected,
|
|
462
|
+
checkboxes
|
|
463
|
+
};
|
|
301
464
|
},
|
|
302
465
|
template: `
|
|
303
466
|
<div class="h-96 border border-dashed border-base-300">
|
|
@@ -306,6 +469,10 @@ export const Collapsible = {
|
|
|
306
469
|
<div v-if="header.identifier === 'employed'">
|
|
307
470
|
<AntSwitch v-model="entry.employed"/>
|
|
308
471
|
</div>
|
|
472
|
+
|
|
473
|
+
<div v-if="header.identifier === 'permissions'">
|
|
474
|
+
<AntCheckboxGroup v-model="entry.permissions" :checkboxes="checkboxes" direction="row"/>
|
|
475
|
+
</div>
|
|
309
476
|
</template>
|
|
310
477
|
|
|
311
478
|
<template #afterRowContent="{element, rowIndex}">
|
|
@@ -323,10 +490,28 @@ export const Collapsible = {
|
|
|
323
490
|
};
|
|
324
491
|
export const MultipleCollapseStrategy = {
|
|
325
492
|
render: (args) => ({
|
|
326
|
-
components: {
|
|
493
|
+
components: {
|
|
494
|
+
AntTable,
|
|
495
|
+
AntSwitch,
|
|
496
|
+
AntCheckboxGroup
|
|
497
|
+
},
|
|
327
498
|
setup() {
|
|
328
499
|
const selected = ref();
|
|
329
|
-
|
|
500
|
+
const checkboxes = [
|
|
501
|
+
{
|
|
502
|
+
label: "Read",
|
|
503
|
+
value: "read"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
label: "Write",
|
|
507
|
+
value: "write"
|
|
508
|
+
}
|
|
509
|
+
];
|
|
510
|
+
return {
|
|
511
|
+
args,
|
|
512
|
+
selected,
|
|
513
|
+
checkboxes
|
|
514
|
+
};
|
|
330
515
|
},
|
|
331
516
|
template: `
|
|
332
517
|
<div class="h-96 border border-dashed border-base-300">
|
|
@@ -335,6 +520,10 @@ export const MultipleCollapseStrategy = {
|
|
|
335
520
|
<div v-if="header.identifier === 'employed'">
|
|
336
521
|
<AntSwitch v-model="entry.employed"/>
|
|
337
522
|
</div>
|
|
523
|
+
|
|
524
|
+
<div v-if="header.identifier === 'permissions'">
|
|
525
|
+
<AntCheckboxGroup v-model="entry.permissions" :checkboxes="checkboxes" direction="row"/>
|
|
526
|
+
</div>
|
|
338
527
|
</template>
|
|
339
528
|
|
|
340
529
|
<template #afterRowContent="{element, rowIndex}">
|
|
@@ -352,18 +541,51 @@ export const MultipleCollapseStrategy = {
|
|
|
352
541
|
};
|
|
353
542
|
export const DefaultCollapseOpen = {
|
|
354
543
|
render: (args) => ({
|
|
355
|
-
components: {
|
|
544
|
+
components: {
|
|
545
|
+
AntTable,
|
|
546
|
+
AntSwitch,
|
|
547
|
+
AntCheckboxGroup,
|
|
548
|
+
AntButton
|
|
549
|
+
},
|
|
356
550
|
setup() {
|
|
357
551
|
const selected = ref();
|
|
358
|
-
|
|
552
|
+
const data = ref(args.data.splice(0, 5));
|
|
553
|
+
const checkboxes = [
|
|
554
|
+
{
|
|
555
|
+
label: "Read",
|
|
556
|
+
value: "read"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
label: "Write",
|
|
560
|
+
value: "write"
|
|
561
|
+
}
|
|
562
|
+
];
|
|
563
|
+
function addRandomEntry() {
|
|
564
|
+
data.value = [
|
|
565
|
+
...data.value,
|
|
566
|
+
getRandomEntry()
|
|
567
|
+
];
|
|
568
|
+
}
|
|
569
|
+
return {
|
|
570
|
+
args,
|
|
571
|
+
data,
|
|
572
|
+
selected,
|
|
573
|
+
checkboxes,
|
|
574
|
+
addRandomEntry
|
|
575
|
+
};
|
|
359
576
|
},
|
|
360
577
|
template: `
|
|
361
|
-
<div class="h-96 border border-dashed border-base-300">
|
|
362
|
-
<
|
|
578
|
+
<div class="h-96 border border-dashed border-base-300 flex flex-col gap-2">
|
|
579
|
+
<AntButton state="primary" @click="addRandomEntry" filled>Add Random Entry</AntButton>
|
|
580
|
+
<AntTable v-bind="args" :data="data" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val" collapse-strategy="multiple" expandedRows>
|
|
363
581
|
<template #cellContent="{element: entry, header}">
|
|
364
582
|
<div v-if="header.identifier === 'employed'">
|
|
365
583
|
<AntSwitch v-model="entry.employed"/>
|
|
366
584
|
</div>
|
|
585
|
+
|
|
586
|
+
<div v-if="header.identifier === 'permissions'">
|
|
587
|
+
<AntCheckboxGroup v-model="entry.permissions" :checkboxes="checkboxes" direction="row"/>
|
|
588
|
+
</div>
|
|
367
589
|
</template>
|
|
368
590
|
|
|
369
591
|
<template #afterRowContent="{element, rowIndex}">
|
|
@@ -13,15 +13,4 @@ Object.keys(_TableHeader).forEach(function (key) {
|
|
|
13
13
|
return _TableHeader[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
});
|
|
17
|
-
var _AntCollapsibleTable = require("./AntCollapsibleTable.types");
|
|
18
|
-
Object.keys(_AntCollapsibleTable).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _AntCollapsibleTable[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _AntCollapsibleTable[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
16
|
});
|
|
@@ -4,18 +4,26 @@ import {
|
|
|
4
4
|
faCircleInfo,
|
|
5
5
|
faExclamationCircle,
|
|
6
6
|
faExclamationTriangle,
|
|
7
|
-
type IconDefinition
|
|
7
|
+
type IconDefinition,
|
|
8
8
|
} from '@fortawesome/free-solid-svg-icons';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
computed,
|
|
11
|
+
} from 'vue';
|
|
12
|
+
import {
|
|
13
|
+
type RouteLocationRaw, useRoute,
|
|
14
|
+
} from 'vue-router';
|
|
15
|
+
import {
|
|
16
|
+
TabItemState,
|
|
17
|
+
} from './__types/AntTabItem.types';
|
|
18
|
+
import {
|
|
19
|
+
AntSkeleton,
|
|
20
|
+
} from '../../../dist';
|
|
13
21
|
|
|
14
22
|
const props = withDefaults(defineProps<{
|
|
15
23
|
label: string;
|
|
16
24
|
active: boolean;
|
|
17
25
|
disabled?: boolean;
|
|
18
|
-
state?: TabItemState
|
|
26
|
+
state?: TabItemState;
|
|
19
27
|
showIcon?: boolean;
|
|
20
28
|
icon?: IconDefinition;
|
|
21
29
|
to?: RouteLocationRaw;
|
|
@@ -69,7 +77,7 @@ const containerClasses = computed(() => {
|
|
|
69
77
|
|
|
70
78
|
return {
|
|
71
79
|
'p-2 text-center flex items-center justify-center gap-2 bg-white transition-[background-color] relative text-sm text-nowrap': true,
|
|
72
|
-
|
|
80
|
+
grow: props.expanded,
|
|
73
81
|
[variants[props.state]]: !props.disabled,
|
|
74
82
|
[activeVariants[props.state]]: _active.value,
|
|
75
83
|
[notActiveVariants[props.state]]: !_active.value,
|
|
@@ -118,7 +126,11 @@ const iconColor = computed(() => {
|
|
|
118
126
|
|
|
119
127
|
<div class="relative">
|
|
120
128
|
<slot>{{ label }}</slot>
|
|
121
|
-
<AntSkeleton
|
|
129
|
+
<AntSkeleton
|
|
130
|
+
v-if="skeleton"
|
|
131
|
+
rounded
|
|
132
|
+
absolute
|
|
133
|
+
/>
|
|
122
134
|
</div>
|
|
123
135
|
|
|
124
136
|
<AntIcon
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import AntTabItem from './AntTabItem.vue';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
type TabItem,
|
|
5
|
+
} from './__types/AntTabItem.types';
|
|
6
|
+
import {
|
|
7
|
+
useVModel,
|
|
8
|
+
} from '@vueuse/core';
|
|
9
|
+
import {
|
|
10
|
+
computed,
|
|
11
|
+
} from 'vue';
|
|
6
12
|
|
|
7
|
-
const emits = defineEmits([
|
|
13
|
+
const emits = defineEmits([
|
|
14
|
+
'update:modelValue',
|
|
15
|
+
]);
|
|
8
16
|
const props = withDefaults(defineProps<{
|
|
9
17
|
modelValue?: string;
|
|
10
18
|
tabItems?: TabItem[];
|
|
@@ -29,8 +37,8 @@ function clickTab(tabItem: TabItem) {
|
|
|
29
37
|
tabItem.clickHandler();
|
|
30
38
|
}
|
|
31
39
|
|
|
32
|
-
if (tabItem.disabled){
|
|
33
|
-
return
|
|
40
|
+
if (tabItem.disabled) {
|
|
41
|
+
return;
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
currentActive.value = tabItem.id;
|
|
@@ -39,21 +47,27 @@ function clickTab(tabItem: TabItem) {
|
|
|
39
47
|
|
|
40
48
|
<template>
|
|
41
49
|
<div :class="containerClasses">
|
|
42
|
-
<div
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
<div
|
|
51
|
+
class="flex gap-px bg-base-300 border-l border-r border-base-300 overflow-x-auto"
|
|
52
|
+
:class="scrollContainerClasses"
|
|
53
|
+
>
|
|
54
|
+
<slot>
|
|
55
|
+
<AntTabItem
|
|
56
|
+
v-for="(tabItem, index) in tabItems"
|
|
57
|
+
:key="`tab-item-${index}`"
|
|
58
|
+
v-bind="tabItem"
|
|
59
|
+
:active="currentActive === tabItem.id"
|
|
60
|
+
:expanded="expanded"
|
|
61
|
+
:disabled="tabItem.disabled"
|
|
62
|
+
:skeleton="skeleton"
|
|
63
|
+
@click="clickTab(tabItem)"
|
|
64
|
+
>
|
|
65
|
+
<slot
|
|
66
|
+
name="content"
|
|
67
|
+
v-bind="{item: tabItem, isActive: currentActive === tabItem.id}"
|
|
68
|
+
/>
|
|
69
|
+
</AntTabItem>
|
|
70
|
+
</slot>
|
|
57
71
|
</div>
|
|
58
72
|
</div>
|
|
59
73
|
</template>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import AntTabItem from "../AntTabItem.vue";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
TabItemState
|
|
4
|
+
} from "../__types/AntTabItem.types.mjs";
|
|
5
|
+
import {
|
|
6
|
+
vueRouter
|
|
7
|
+
} from "storybook-vue3-router";
|
|
4
8
|
const meta = {
|
|
5
9
|
title: "Components/Tab Item",
|
|
6
10
|
component: AntTabItem,
|
|
7
|
-
parameters: {
|
|
11
|
+
parameters: {
|
|
12
|
+
controls: {
|
|
13
|
+
sort: "requiredFirst"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
8
16
|
decorators: [
|
|
9
|
-
() => ({
|
|
17
|
+
() => ({
|
|
18
|
+
template: '<div class="dashed"><story /></div>'
|
|
19
|
+
}),
|
|
10
20
|
vueRouter()
|
|
11
21
|
],
|
|
12
22
|
argTypes: {
|
|
@@ -15,7 +25,9 @@ const meta = {
|
|
|
15
25
|
description: "Some InputStates can have an icon. Control with this property if it gets shown or not."
|
|
16
26
|
},
|
|
17
27
|
state: {
|
|
18
|
-
control: {
|
|
28
|
+
control: {
|
|
29
|
+
type: "select"
|
|
30
|
+
},
|
|
19
31
|
options: Object.values(TabItemState)
|
|
20
32
|
}
|
|
21
33
|
}
|
|
@@ -23,9 +35,13 @@ const meta = {
|
|
|
23
35
|
export default meta;
|
|
24
36
|
export const Docs = {
|
|
25
37
|
render: (args) => ({
|
|
26
|
-
components: {
|
|
38
|
+
components: {
|
|
39
|
+
AntTabItem
|
|
40
|
+
},
|
|
27
41
|
setup() {
|
|
28
|
-
return {
|
|
42
|
+
return {
|
|
43
|
+
args
|
|
44
|
+
};
|
|
29
45
|
},
|
|
30
46
|
template: '<AntTabItem v-bind="args"/>'
|
|
31
47
|
}),
|