Skip to content

fix(grid): [grid] add grid no-data icon #3257

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

Merged
merged 5 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 41 additions & 0 deletions packages/theme-saas/src/svgs/grid-no-data.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/theme/src/base/dark-theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@
// -- 暗色新增 --
--tv-color-icon-inverse: var(--tv-base-color-common-1); // #fff 亮色暗色都是白色场景
--tv-color-icon-inverse-tint: var(--tv-base-color-common-13); // #000 暗色反色成黑色:按钮下拉线头
// -- 空状态图标 --
--tv-color-no-data-gary-1: var(--tv-base-color-common-10); // #262626
--tv-color-no-data-gary-2: var(--tv-base-color-common-9); // #333333
--tv-color-no-data-border: var(--tv-base-color-common-5); // #999999
--tv-color-no-data-brand: var(--tv-base-color-brand-7); // #317AF7

/** 2.6 背景色 **/

Expand Down
6 changes: 5 additions & 1 deletion packages/theme/src/base/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@
// -- 暗色新增 --
--tv-color-icon-inverse: var(--tv-base-color-common-1); // #fff 亮色暗色都是白色场景
--tv-color-icon-inverse-tint: var(--tv-base-color-common-1); // #fff 暗色反色成黑色:按钮下拉线头

// -- 空状态图标 --
--tv-color-no-data-gary-1: var(--tv-base-color-common-4); // #f0f0f0
--tv-color-no-data-gary-2: var(--tv-base-color-common-1); // #ffffff
--tv-color-no-data-border: var(--tv-base-color-common-8); // #808080
--tv-color-no-data-brand: var(--tv-base-color-brand-6); // #317af7

/** 2.6 背景色 **/

Expand Down
1 change: 0 additions & 1 deletion packages/theme/src/grid/table.less
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,6 @@
width: 100%;
height: 100px;
margin: 0;
background: var(--tv-Grid-empty-img) 50% no-repeat;
}

& &__empty-text {
Expand Down
2 changes: 0 additions & 2 deletions packages/theme/src/grid/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@
--tv-Grid-select-option-bg-color-hover: var(--tv-color-bg-hover, #f5f5f5);
// 加载中背景色
--tv-Grid-loading-mask-bg-color: var(--tv-color-bg-mask-block, rgba(255, 255, 255, 70%));
// 表格无数据背景图片
--tv-Grid-empty-img: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGNsaXBQYXRoIGlkPSJhIj48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLW9wYWNpdHk9IjAiIGQ9Ik0wIDBoODB2ODBIMHoiLz48L2NsaXBQYXRoPjwvZGVmcz48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxwYXRoIGQ9Ik03My42MSAzOS4zOXYzMC42N2MwIDIuMTctMS43NiAzLjkzLTMuOTQgMy45M0g1Mi41OXYtLjg3aDE3LjA4YzEuNyAwIDMuMDctMS4zNyAzLjA3LTMuMDZWMzkuMzloLjg3eiIgZmlsbD0iZ3JheSIvPjxwYXRoIGQ9Ik03My42MSAzOS4zOXYzMC42N2MwIDIuMTctMS43NiAzLjkzLTMuOTQgMy45M0g1Mi41OXYtLjg3aDE3LjA4YzEuNyAwIDMuMDctMS4zNyAzLjA3LTMuMDZWMzkuMzloLjg3eiIgZmlsbD0iZ3JheSIvPjxwYXRoIGQ9Ik01Ni45MiAyNXY0NS4wNmMwIDIuMTctMS43NyAzLjkzLTMuOTUgMy45M0gxMC45NEEzLjk0IDM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OS42M3oiIGZpbGw9ImdyYXkiLz48cmVjdCB4PSIxMy41IiB5PSI2NiIgcng9Ii41IiB3aWR0aD0iNSIgaGVpZ2h0PSIxIiBmaWxsPSJncmF5Ii8+PHBhdGggZD0iTTQwIDZjLjI3IDAgLjUuMTkuNS40NHY2LjE2YzAgLjI1LS4yMy40NC0uNS40NC0uMjggMC0uNTEtLjE5LS41MS0uNDRWNi40NGMwLS4yNS4yMy0uNDQuNTEtLjQ0ek01Ni41NSA4LjY0Yy4yNC4xNC4zMy40Mi4yMS42M2wtMy4wOCA1LjM0Yy0uMTIuMjEtLjQyLjI3LS42Ni4xMy0uMjQtLjE0LS4zMy0uNDItLjIxLS42M2wzLjA4LTUuMzRjLjEyLS4yMS40Mi0uMjcuNjYtLjEzek0yMy40NCA4LjY0Yy4yNC0uMTQuNTQtLjA4LjY2LjEzbDMuMDggNS4zNGMuMTIuMjEuMDMuNDktLjIxLjYzcy0uNTQuMDgtLjY2LS4xM2wtMy4wOC01LjM0Yy0uMTItLjIxLS4wMy0uNDkuMjEtLjYzeiIgZmlsbD0iZ3JheSIvPjwvZz48L3N2Zz4=');
// 边框模式复选框禁用边框色
--tv-Grid-border-color-disabled: var(--tv-color-border-disabled, #dbdbdb);
// 复选框过滤器模式底色
Expand Down
20 changes: 20 additions & 0 deletions packages/theme/src/svgs/grid-no-data.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/vue-icon-saas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ import IconMaterial from './src/material'
import IconMilestone from './src/milestone'
import IconMinscreenRight from './src/minscreen-right'
import IconNoData from './src/no-data'
import IconGridNoData from './src/grid-no-data'
import IconNoNews from './src/no-news'
import IconNoPerm from './src/no-perm'
import IconNoResult from './src/no-result'
Expand Down Expand Up @@ -1520,6 +1521,8 @@ export {
IconMinscreenRight as iconMinscreenRight,
IconNoData,
IconNoData as iconNoData,
IconGridNoData,
IconGridNoData as iconGridNoData,
IconNoNews,
IconNoNews as iconNoNews,
IconNoPerm,
Expand Down Expand Up @@ -2063,6 +2066,7 @@ export default {
IconMilestone,
IconMinscreenRight,
IconNoData,
IconGridNoData,
IconNoNews,
IconNoPerm,
IconNoResult,
Expand Down
4 changes: 4 additions & 0 deletions packages/vue-icon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ import IconMaterial from './src/material'
import IconMilestone from './src/milestone'
import IconMinscreenRight from './src/minscreen-right'
import IconNoData from './src/no-data'
import IconGridNoData from './src/grid-no-data'
import IconNoNews from './src/no-news'
import IconNoPerm from './src/no-perm'
import IconNoResult from './src/no-result'
Expand Down Expand Up @@ -1520,6 +1521,8 @@ export {
IconMinscreenRight as iconMinscreenRight,
IconNoData,
IconNoData as iconNoData,
IconGridNoData,
IconGridNoData as iconGridNoData,
IconNoNews,
IconNoNews as iconNoNews,
IconNoPerm,
Expand Down Expand Up @@ -2063,6 +2066,7 @@ export default {
IconMilestone,
IconMinscreenRight,
IconNoData,
IconGridNoData,
IconNoNews,
IconNoPerm,
IconNoResult,
Expand Down
4 changes: 4 additions & 0 deletions packages/vue-icon/src/grid-no-data/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { svg } from '@opentiny/vue-common'
import NoData from '@opentiny/vue-theme/svgs/grid-no-data.svg'

export default () => svg({ name: 'IconGridNoData', component: NoData })()
6 changes: 3 additions & 3 deletions packages/vue/src/grid/src/body/src/body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ import {
} from '@opentiny/vue-renderless/grid/utils'
import { getCellLabel } from '../../tools'
import GlobalConfig from '../../config'
import { iconChevronRight, iconChevronDown } from '@opentiny/vue-icon'
import { iconChevronRight, iconChevronDown, iconGridNoData } from '@opentiny/vue-icon'
import { h, hooks, $prefix, defineComponent } from '@opentiny/vue-common'
import { getTreeChildrenKey, getTreeShowKey, handleRowGroupFold, isVirtualRow } from '../../table/src/strategy'
import { generateFixedClassName } from '../../table/src/utils/handleFixedColumn'

const GridNoData = iconGridNoData()
// 滚动、拖动过程中不需要触发鼠标移入移出事件
const isOperateMouse = ($table) =>
$table._isResize || ($table.lastScrollTime && Date.now() < $table.lastScrollTime + $table.optimizeOpts.delayHover)
Expand Down Expand Up @@ -752,7 +752,7 @@ function renderRows({ h, _vm, $table, $seq, rowLevel, tableData, tableColumn, se

function renderDefEmpty(h) {
return [
h('p', {
h(GridNoData, {
class: 'tiny-grid__empty-img'
}),
h(
Expand Down
Loading
Loading