Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] - IndexTable novo componente de listagem de itens #398

Merged
merged 37 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1dd837d
feat: add IndexTable
Merieli Nov 1, 2024
2ed49a2
Merge branch 'release/hub' of github.com:uxshop/design-system into fe…
Merieli Nov 1, 2024
acb6236
refactor: adjust format of enum
Merieli Nov 8, 2024
6ddf761
feat: update index table
Merieli Nov 8, 2024
20aaccf
docs: add stories of Table
Merieli Nov 11, 2024
f990a30
feat: add IndexTableList
Merieli Nov 11, 2024
2fa2308
feat: add cells
Merieli Nov 12, 2024
856c833
feat: define select in table
Merieli Nov 12, 2024
2a2e6b6
feat: add formCheckbox in IndexTable
Merieli Nov 21, 2024
1693e43
feat: prepare IndexTableList to slots
Merieli Dec 3, 2024
278d35f
refactor: remove unnecessary imports
Merieli Dec 3, 2024
4fce50c
docs: change storybook to IndexTable
Merieli Dec 3, 2024
1d0bd81
feat: adjust storybook and styles of buttons IndexTable
Merieli Dec 4, 2024
a6495d1
style: adjust indexTable to mobile sizes
Merieli Dec 4, 2024
ebe00f0
style: change styles for footer and top of indexTable
Merieli Dec 4, 2024
0faebc3
style: add tags to indexTable
Merieli Dec 4, 2024
126c427
feat: adjusts of IndexTable
Merieli Dec 4, 2024
f57643f
docs: add documentation filterTabWithoutItems in IndexTable
Merieli Dec 5, 2024
1c39fbf
feat: change acessibility of index-table
Merieli Dec 6, 2024
89ab294
feat: adjusts in IndextTable
Merieli Dec 9, 2024
fa5dec4
style: apply prettier in IndexTable and fix PlatformSelect
Merieli Dec 9, 2024
4a4df2a
refactor: fix prettier in files
Merieli Dec 9, 2024
a9ecbfe
refactor: change style of message and update prettierignore
Merieli Dec 9, 2024
236ac7c
feat: add tests, separe parts of IndexTable change configs of prettie…
Merieli Dec 9, 2024
244b2b1
refactor: change local of docs
Merieli Dec 9, 2024
3c77e2b
refactor: clear example of App.vue
Merieli Dec 9, 2024
7318d81
docs: change introduction of IndexTable
Merieli Dec 9, 2024
ce2f38d
refactor: adjusts for indextable
Merieli Dec 10, 2024
342c4a6
refactor: add prop in completeIndexTable and adjusts of class
Merieli Dec 10, 2024
6784af3
feat: add FeedbackMessage component and change IndexTable
Merieli Dec 11, 2024
3058f02
refactor: change emits of IndexTable
Merieli Dec 11, 2024
9511202
refactor: change actions of emptyMessage
Merieli Dec 11, 2024
33589eb
refactor: remove unnescessary object
Merieli Dec 11, 2024
eb42998
refactor: generate simulation of action in FeedbackMessage
Merieli Dec 11, 2024
a2c8578
fix: change props in test of useIndexTableList
Merieli Dec 11, 2024
bc392dd
refactor: change imports of vue
Merieli Dec 11, 2024
21c4eb1
build: update package-lock with typescript range
Merieli Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Files
*.md
*.mdx

# Folders
.husky/*
.vscode/*

*.yml
1 change: 1 addition & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const preview: Preview = {
schema,
brand,
},
tags: ['autodocs'],
};

export default preview;
7 changes: 4 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"recommendations": [
"Vue.volar",
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"EditorConfig.EditorConfig"
]
"EditorConfig.EditorConfig",
"Tobermory.es6-string-html"
]
}
15 changes: 12 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import vitest from '@vitest/eslint-plugin';
import prettierSkipFormattingConfig from '@vue/eslint-config-prettier/skip-formatting';
import pluginVue from 'eslint-plugin-vue';
import globals from 'globals';
import tseslint from 'typescript-eslint';

const globalFiles = ['**/*.{vue,js,mjs,cjs,ts}'];

Expand Down Expand Up @@ -108,10 +108,11 @@ export default [
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
'@typescript-eslint/no-empty-object-type': 'off', // Permite interfaces com uso de extends apenas
},
},
{
files: ['**/*.spec.ts'],
files: ['**/*.{test,spec}.ts'],
plugins: {
vitest,
},
Expand All @@ -123,6 +124,7 @@ export default [
'vitest/valid-title': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
...pluginVue.configs['flat/recommended'],
Expand Down Expand Up @@ -160,7 +162,7 @@ export default [
order: ['script', 'template', 'style'],
},
],
'vue/multi-word-component-names': 'warn',
'vue/multi-word-component-names': 'off', // Desabilitada devido ao padrão do DS em que os componentes ao serem usados em outros projetos podem conter um nome composto
'vue/block-tag-newline': 'error',
'vue/component-api-style': ['error', ['script-setup']],
'vue/no-setup-props-reactivity-loss': 'error',
Expand All @@ -170,4 +172,11 @@ export default [
'vue/padding-line-between-blocks': ['error', 'always'],
},
},
{
files: ['**/*.stories.ts'],
name: 'ds/docs',
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
];
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"postinstall": "npm run build"
},
"peerDependencies": {
"typescript": ">= 5.5.0",
"typescript": ">= 5.5.0 < 5.7.0",
"vue": ">= 3.4.29"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import Page from './components/admin/page/Page.vue';
import TextStyle from './components/ui/text-style/TextStyle.vue';
import type { IAction } from './types';

const action: IAction = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/admin/button-darkmode/ButtonDarkmode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ const colorSchemeStorageName = 'ds_color_scheme';
const setColorScheme = (val: any) => {
document.documentElement.setAttribute('data-theme', val);

if (val == ColorScheme.dark) {
if (val == ColorScheme.DARK) {
iconMode.value = 'light_mode';
} else {
iconMode.value = 'dark_mode';
}
};

const toggleDarkmode = () => {
const color = ColorSchemeService.get() === ColorScheme.dark ? ColorScheme.light : ColorScheme.dark;
const color = ColorSchemeService.get() === ColorScheme.DARK ? ColorScheme.LIGHT : ColorScheme.DARK;
emit('changeSchemeColor', color);
localStorage.setItem(colorSchemeStorageName, color);
setColorScheme(color);
Expand Down
13 changes: 9 additions & 4 deletions src/components/admin/platform-select/PlatformSelect.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { computed, onMounted, ref } from 'vue';
import Icon from '../../ui/icon/Icon.vue';
import Tab from '../../ui/tab/Tab.vue';
import TabItem from '../../ui/tab/TabItem.vue';
Expand All @@ -15,7 +15,11 @@ const props = defineProps<PlatformSelectProps>();

const badgeConfigMerged = computed(() => ({ ...badgeConfigDefault, ...(props.badgeConfig ?? {}) }));

const tab = ref(props.platformsList.find((item) => item.active)?.key);
const tab = ref('');

onMounted(() => {
tab.value = props.platformsList.find((item) => item.active)?.key ?? props.platformsList[0].key;
});

const emits = defineEmits(['change:platform']);

Expand All @@ -29,14 +33,15 @@ const hasBadge = (platform: IPlatform) => !!platform.badgeStatus;
<template>
<Tab v-model="tab" class="tab-container">
<TabItem
v-for="platform in platformsList"
v-for="(platform, index) in platformsList"
:key="index"
class="tab-item-btn"
:class="{ '-item-disabled': platform.disabled }"
:label="platform.name"
:index="platform.key"
@click="onChangeTab(platform)">
<div class="tab-item-container">
<div class="badge-container" v-if="hasBadge(platform)">
<div v-if="hasBadge(platform)" class="badge-container">
<Badge pill v-bind="badgeConfigMerged[platform.badgeStatus!]" />
</div>
<Icon :name="platform.icon" />
Expand Down
12 changes: 12 additions & 0 deletions src/components/admin/table-list/TableList.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<script lang="ts">
/**
* ### TableList Component
*
* @deprecated Este componente está depreciado e será removido em versões futuras.
* Por favor, use o novo componente `IndexTable` em vez deste.
*/
export default {};
</script>

<script setup lang="ts">
import { onMounted, watch, ref, reactive, onBeforeMount, computed } from 'vue';
import { union, clone, omit, concat, isEqual } from 'lodash-es';
Expand Down Expand Up @@ -202,6 +212,8 @@ onMounted(() => {
} else {
queryParams.value = assignDefaultQueryParams();
}

console.warn('ds - TableList is deprecated and will be removed in future versions. Please use IndexTable instead.');
});

let timerQ: ReturnType<typeof setTimeout>;
Expand Down
18 changes: 9 additions & 9 deletions src/components/admin/table-list/index.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
export { default as TableListEmptyMessage } from './snippets/TableListEmptyMessage.vue';
export { default as TableListEmptySearch } from './snippets/TableListEmptySearch.vue';
export { default as TableListNav } from './table-list-nav/TableListNav.vue';
export { default as TableListNavCustomFilter } from './table-list-nav/TableListNavCustomFilter.vue';
export { default as TableListNavRefresh } from './table-list-nav/TableListNavRefresh.vue';
export { default as TableListNavSearch } from './table-list-nav/TableListNavSearch.vue';
export { default as TableListNavSortable } from './table-list-nav/TableListNavSortable.vue';
export { default as TableListNavBulk } from './table-list-nav-bulk/TableListNavBulk.vue';
export { default as TableListNavFilter } from './table-list-nav-filter/TableListNavFilter.vue';
export { default as TableListNavFilterSidebar } from './table-list-nav-filter/TableListNavFilterSidebar.vue';
export { default as TableListNavLoader } from './table-list-nav-loader/TableListNavLoader.vue';
export { default as TableListNavPagination } from './table-list-nav-pagination/TableListNavPagination.vue';
export { default as TableListNav } from './table-list-nav/TableListNav.vue';
export { default as TableListNavCustomFilter } from './table-list-nav/TableListNavCustomFilter.vue';
export { default as TableListNavRefresh } from './table-list-nav/TableListNavRefresh.vue';
export { default as TableListNavSearch } from './table-list-nav/TableListNavSearch.vue';
export { default as TableListNavSortable } from './table-list-nav/TableListNavSortable.vue';
export { default as TableListTable } from './table-list-table/TableListTable.vue';
export { default as TableListTabs } from './table-list-tabs/TableListTabs.vue';
export { default as TableListTags } from './table-list-tags/TableListTags.vue';
export { default as TableList } from './TableList.vue';
export { default as TableListHeader } from './TableListHeader.vue';
export { default as TableListItem } from './TableListItem.vue';
export { default as TableListRow } from './TableListRow.vue';
export { default as TableList } from './TableList.vue';

export type {
ITableListConfig,
ITableListState,
TBulkActions,
TDialogDelete,
ITableListConfig,
TableListProps,
TableListItemProps,
ITableListState,
TableListNavBulkProps,
TableListNavCustomFilterProps,
TableListNavFilterProps,
Expand All @@ -35,6 +34,7 @@ export type {
TableListNavRefreshProps,
TableListNavSearchProps,
TableListNavSortableProps,
TableListProps,
TableListTablePros,
TableListTabsProps,
TableListTagsProps,
Expand Down
45 changes: 45 additions & 0 deletions src/components/admin/table/Table.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type { Meta, StoryObj } from '@storybook/vue3';
import Table from './Table.vue';
import TableBody from './TableBody.vue';
import TableCell from './TableCell.vue';
import TableHeadCell from './TableHeadCell.vue';
import TableRow from './TableRow.vue';

const meta: Meta<typeof Table> = {
title: 'Components/Table',
component: Table,
render: (args) => ({
components: { Table, TableHeadCell, TableBody, TableRow, TableCell },
setup() {
const products = [
{ id: 1, name: 'Product 1', price: '$10' },
{ id: 2, name: 'Product 2', price: '$20' },
{ id: 3, name: 'Product 3', price: '$30' },
];
return { args, products };
},
template: `
<Table v-bind="args">
<template #header>
<TableHeadCell>ID</TableHeadCell>
<TableHeadCell>Name</TableHeadCell>
<TableHeadCell>Price</TableHeadCell>
</template>
<TableBody>
<TableRow v-for="product in products" :key="product.id">
<TableCell>{{ product.id }}</TableCell>
<TableCell>{{ product.name }}</TableCell>
<TableCell>{{ product.price }}</TableCell>
</TableRow>
</TableBody>
</Table>
`,
}),
};

export default meta;
type Story = StoryObj<typeof meta>;

export const minimum: Story = {
args: {},
};
1 change: 0 additions & 1 deletion src/components/admin/table/Table.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import type { TableProps } from './types';

defineEmits(['click']);
defineProps<TableProps>();
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/table/TableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getComponent = () => {
</script>

<template>
<component :is="getComponent()" class="ui-table-row" :to="to" :class="{ '-head': head }">
<component :is="getComponent()" class="ui-table-row" :to="to" :class="{ '-head': head }" tabindex="0">
<slot />
</component>
</template>
15 changes: 15 additions & 0 deletions src/components/ui/feedback-message/FeedbackMessage.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Controls, Canvas, Meta } from '@storybook/blocks';

import * as FeedbackMessageStories from './FeedbackMessage.stories';

<Meta of={FeedbackMessageStories} />

# FeedbackMessage

O **FeedbackMessage** é um componente utilizado para exibir mensagens de feedback para o usuário. Ele é composto por um ícone, um texto e um botão de ação. É opcional exibir o botão de ação e o ícone.

A sua finalidade é a de fornecer um bloco visual e textual padronizado, que ajude a guiar o usuário sobre o que está acontecendo (por exemplo, não há dados disponíveis ou ocorreu um problema que precisa ser resolvido) e quais próximos passos podem ser tomados. Assim garantimos que o usuário tenha uma experiência familiar e coerente, independentemente de qual produto ou seção esteja utilizando.

<Canvas of={FeedbackMessageStories.minimum} />

<Controls />
36 changes: 36 additions & 0 deletions src/components/ui/feedback-message/FeedbackMessage.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.ui-feedback-message {
display: grid;
text-align: center;
justify-content: center;
height: 100%;
gap: var(--s-spacing-small);
transition: all var(--s-motion-ease-linear) var(--s-motion-duration-fast);

&-content {
display: grid;
gap: var(--s-spacing-quark);
}

&-icon {
color: var(--s-color-content-default);
}

&-title {
font: var(--s-typography-heading-medium);
color: var(--s-color-content-default);
font-weight: var(--s-font-weight-semibold);
margin-bottom: 0px;
}

&-text {
font: var(--s-typography-paragraph-regular);
color: var(--s-color-content-light);
margin-bottom: 0px;
}

&-action {
width: fit-content;
justify-self: center;
align-self: center;
}
}
40 changes: 40 additions & 0 deletions src/components/ui/feedback-message/FeedbackMessage.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { Meta, StoryObj } from '@storybook/vue3';
import FeeedbackMessage from './FeedbackMessage.vue';
import { fn } from '@storybook/test';

const meta: Meta<typeof FeeedbackMessage> = {
title: 'ui/FeeedbackMessage',
component: FeeedbackMessage,
render: (args) => ({
components: { FeeedbackMessage },
setup() {
return { args };
},
template: '<FeeedbackMessage v-bind="args" />',
}),
argTypes: {},
parameters: {
controls: { expanded: true },
docs: {
controls: { exclude: '^on.*' },
},
},
};

export default meta;
type Story = StoryObj<typeof meta>;

export const minimum: Story = {
args: {
title: 'Nenhum resultado encontrado',
subtitle:
'Não encontramos nenhum item que corresponda à sua pesquisa.<br>Verifique o termo digitado ou tente um filtro diferente.',
button: {
label: 'Limpar filtros',
variant: 'primary',
},
showIcon: true,
showButton: true,
onAction: fn(),
},
};
Loading
Loading