@import "./functions/func.scss"; .ui-grid { position: relative; box-sizing: border-box; overflow: auto; & { --cell-hover-bg-color: lightyellow; --header-border-color: #adaba9; --header-bg-color: #fafafa; --header-fore-color: #000; --cell-border-color: #f0f0f0; --cell-fore-color: #333; --dark-border-color: #666; --split-border-color: #b3b3b3; --dragger-bg-color: #fff; --dragger-cursor-color: #333; --row-bg-color: #fff; --row-active-bg-color: #fafafa; --row-selected-bg-color: #e6f2fb; --text-disabled-color: gray; --filter-shadow: 0 3px 6px -4px rgba(0, 0, 0, .12), 0 6px 16px 0 rgba(0, 0, 0, .08), 0 9px 28px 8px rgba(0, 0, 0, .05); --filter-transition: transform .12s ease, opacity .24s ease; --row-height: 36px; --header-line-height: 26px; --text-indent: 8px; --loading-size: 40px; --loading-border-radius: 20px; --arrow-size: 4px; --filter-size: 10px; --split-width: 8px; --dragger-size: 20px; --dragger-opacity: .6; --dragger-cursor-size: 4px; --dragger-cursor-pos: -4px; --dragger-cursor-opacity: .3; --header-padding: 4px 12px 4px 8px; --header-filter-padding: 4px 26px 4px 8px; --spacing-s: 4px; --spacing-cell: 6px 4px 6px 8px; --filter-line-height: 30px; --filter-item-padding: 0 4px; } @include outline(); @include scrollbar(); &, input[type="text"], textarea { font-size: var(--font-size); font-family: var(--font-family); } >.ui-grid-sizer { position: absolute; white-space: nowrap; font-weight: bold; visibility: hidden; } >.ui-grid-wrapper { position: relative; >.ui-grid-table { position: absolute; width: 100%; min-width: 100%; margin: 0; border-collapse: collapse; border-spacing: 0; table-layout: fixed; >thead { tr { color: var(--header-fore-color); position: sticky; top: 0; z-index: 2; >th { background-color: var(--header-bg-color); user-select: none; padding: 0; margin: 0; word-wrap: break-word; white-space: normal; position: relative; &.sticky { position: sticky; z-index: 2; } >div { border-bottom: 1px solid var(--header-border-color); line-height: var(--header-line-height); min-height: var(--row-height); display: flex; align-items: center; padding: var(--header-padding); box-sizing: border-box; // overflow-x: hidden; >span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } } >.arrow { width: 0; height: 0; top: 50%; margin-top: calc(0px - var(--arrow-size) / 2); right: calc(var(--arrow-size) / 2); position: absolute; &.asc { border-bottom: var(--arrow-size) solid var(--dark-border-color); } &.desc { border-top: var(--arrow-size) solid var(--dark-border-color); } &.asc, &.desc { border-left: var(--arrow-size) solid transparent; border-right: var(--arrow-size) solid transparent; } } >.filter { width: var(--filter-size); height: var(--filter-size); top: 50%; margin-top: calc(0px - var(--filter-size) / 2); right: calc(var(--arrow-size) * 2 + 4px); position: absolute; display: flex; >svg { width: 100%; height: 100%; fill: var(--color); opacity: .2; transition: opacity .12s ease; &:hover { opacity: .8; } } &.hover>svg { opacity: .8; } &.active>svg { opacity: 1; } } >.spliter { position: absolute; height: 100%; top: 0; right: calc(0px - var(--split-width) /2); width: var(--split-width); cursor: ew-resize; z-index: 1; &::after { content: ''; height: 100%; width: 1px; display: block; margin: 0 auto; transition: background-color .12s ease; } &:hover::after { background-color: var(--split-border-color); } } >.dragger { position: absolute; left: 0; top: 0; min-width: var(--dragger-size); height: 100%; background-color: var(--dragger-bg-color); opacity: var(--dragger-opacity); display: none; } >.dragger-cursor { position: absolute; top: 0; height: 100%; border: 1px solid var(--dragger-cursor-color); box-sizing: border-box; margin-left: 0; opacity: var(--dragger-cursor-opacity); display: none; transition: left .12s ease; &::before { top: -1px; border-top: var(--dragger-cursor-size) solid; } &::after { bottom: -1px; border-bottom: var(--dragger-cursor-size) solid; } &::before, &::after { content: ''; position: absolute; left: var(--dragger-cursor-pos); border-left: var(--dragger-cursor-size) solid transparent; border-right: var(--dragger-cursor-size) solid transparent; } } &.header-filter>div { padding: var(--header-filter-padding); } } } } >tbody { color: var(--cell-fore-color); >.ui-grid-row { line-height: var(--line-height); white-space: nowrap; background-color: var(--row-bg-color); border-bottom: 1px solid var(--cell-border-color); box-sizing: border-box; &:hover { background-color: var(--row-active-bg-color); >td.sticky { background-color: var(--row-active-bg-color); } } &.selected { background-color: var(--row-selected-bg-color); >td.sticky { background-color: var(--row-selected-bg-color); } } >td { padding: 0; &.sticky { position: sticky; z-index: 1; background-color: var(--row-bg-color); } >span { padding: var(--spacing-cell); display: block; overflow: hidden; text-overflow: ellipsis; white-space: pre; } >input[type="text"], >textarea { border: none; box-sizing: border-box; width: 100%; padding: 0; @include outline(); &:disabled { color: var(--text-disabled-color); } } >input[type="text"] { height: var(--row-height); text-indent: var(--text-indent); } >textarea { resize: none; line-height: var(--line-height); display: block; padding: var(--spacing-cell); white-space: nowrap; @include scrollbar(); } .ui-check-wrapper { display: flex; justify-content: center; .ui-check-inner { &, >svg { transition: none; } } } .ui-drop-wrapper { height: var(--row-height); width: 100%; display: flex; flex-direction: column; >.ui-drop-header { border: none; height: 100%; >.ui-drop-text { padding: var(--spacing-cell); } } >.ui-drop-box { top: calc(var(--row-height) + 2px); &.slide-up { top: unset; bottom: calc(var(--row-height) + 2px); } } } .col-icon { display: flex; cursor: pointer; justify-content: center; align-items: center; position: relative; >svg { width: 16px; height: 16px; fill: var(--primary-color); transition: opacity .12s ease; } &:hover>svg { opacity: .4; } &.disabled { cursor: unset; >svg { fill: var(--header-border-color); opacity: unset; } } } } } .ui-grid-hover-holder { box-sizing: border-box; position: absolute; line-height: var(--line-height); padding: var(--spacing-cell); background-color: var(--cell-hover-bg-color); white-space: pre; display: flex; align-items: center; visibility: hidden; opacity: 0; transition: visibility 0s linear .12s, opacity .12s ease; &.active { visibility: visible; opacity: 1; } } } } } >.ui-grid-loading { position: absolute; @include inset(0, 0, 0, 0); visibility: hidden; opacity: 0; transition: visibility 0s linear .12s, opacity .12s ease; background-color: var(--loading-bg-color); display: flex; justify-content: center; align-items: center; z-index: 1; >div { background-color: var(--loading-fore-color); border-radius: var(--loading-border-radius); >svg { width: var(--loading-size); height: var(--loading-size); padding: 20px; animation: loading-spinner 1.2s infinite linear; } } } >.filter-panel { position: absolute; width: 200px; height: 300px; box-shadow: var(--filter-shadow); transition: var(--filter-transition); background-color: var(--bg-color); transform: scaleY(0); transform-origin: top; opacity: 0; display: flex; flex-direction: column; z-index: 3; &.active { transform: scaleY(1); opacity: 1; } >.filter-search-holder { position: relative; margin: 8px 8px 4px; >.filter-search-box { box-sizing: border-box; text-indent: 16px; width: 100%; font-size: var(--font-smaller-size); height: var(--line-height); line-height: var(--line-height); } >svg { position: absolute; width: 12px; height: 12px; top: calc(50% - 6px); left: 4px; fill: var(--color); cursor: text; } } >.filter-item-list { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; position: relative; user-select: none; @include scrollbar(); >.filter-content { position: absolute; width: 100%; } .filter-item { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; padding: var(--filter-item-padding); &:hover { background-color: var(--hover-bg-color); } .ui-check-wrapper { height: var(--filter-line-height); display: flex; .ui-check-inner+* { font-size: var(--font-smaller-size); } } } } >.filter-function { display: flex; justify-content: flex-end; padding: 4px; >button { box-sizing: border-box; margin-right: 10px; min-width: 40px; height: var(--filter-line-height); border: none; background-color: transparent; cursor: pointer; border-radius: 0; transition: background-color .12s ease; @include outline(); &:hover { background-color: var(--hover-bg-color); } } } } } /*@media (prefers-color-scheme: dark) { .ui-grid { --cell-hover-bg-color: yellow; --header-border-color: #525456; --header-bg-color: #050505; --header-fore-color: #fff; --cell-border-color: #0f0f0f; --cell-fore-color: #ccc; --dark-border-color: #999; --split-border-color: #4c4c4c; --dragger-bg-color: #000; --dragger-cursor-color: #ccc; --row-bg-color: #000; --row-active-bg-color: #050505; --row-selected-bg-color: #190d04; --text-disabled-color: gray; } }*/