mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
refactor(data-table): new theme
This commit is contained in:
parent
a8eb0eeaef
commit
42ea0c76e0
@ -2,14 +2,14 @@
|
|||||||
<div
|
<div
|
||||||
class="n-data-table"
|
class="n-data-table"
|
||||||
:class="{
|
:class="{
|
||||||
[`n-${mergedTheme}-theme`]: mergedTheme,
|
|
||||||
'n-data-table--bordered': bordered,
|
'n-data-table--bordered': bordered,
|
||||||
'n-data-table--single-line': singleLine,
|
'n-data-table--single-line': singleLine,
|
||||||
'n-data-table--single-column': singleColumn,
|
'n-data-table--single-column': singleColumn,
|
||||||
[`n-data-table--${size}-size`]: true
|
[`n-data-table--${size}-size`]: true
|
||||||
}"
|
}"
|
||||||
|
:style="cssVars"
|
||||||
>
|
>
|
||||||
<n-spin :show="loading" :theme="mergedTheme">
|
<n-spin :show="loading" :theme="'light'">
|
||||||
<div class="n-data-table-wrapper">
|
<div class="n-data-table-wrapper">
|
||||||
<base-table
|
<base-table
|
||||||
ref="mainTableRef"
|
ref="mainTableRef"
|
||||||
@ -30,13 +30,13 @@
|
|||||||
'n-data-table-empty--hide': loading
|
'n-data-table-empty--hide': loading
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<n-empty :theme="mergedTheme" />
|
<n-empty :theme="'light'" />
|
||||||
</div>
|
</div>
|
||||||
</base-table>
|
</base-table>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="pagination" class="n-data-table__pagination">
|
<div v-if="pagination" class="n-data-table__pagination">
|
||||||
<n-pagination
|
<n-pagination
|
||||||
:theme="mergedTheme"
|
:theme="'light'"
|
||||||
:page="mergedPagination.page"
|
:page="mergedPagination.page"
|
||||||
:page-count="mergedPagination.pageCount"
|
:page-count="mergedPagination.pageCount"
|
||||||
:page-size="mergedPagination.pageSize"
|
:page-size="mergedPagination.pageSize"
|
||||||
@ -54,16 +54,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { nextFrame } from 'seemly'
|
import { nextFrame } from 'seemly'
|
||||||
import { configurable, themeable, withCssr, locale } from '../../_mixins'
|
import { isPlainObject } from 'lodash-es'
|
||||||
import { setCheckStatusOfRow, createRowKey } from './utils'
|
import { locale, useTheme } from '../../_mixins'
|
||||||
import BaseTable from './BaseTable.vue'
|
import BaseTable from './BaseTable.vue'
|
||||||
import { NEmpty } from '../../empty'
|
import { NEmpty } from '../../empty'
|
||||||
import { NPagination } from '../../pagination'
|
import { NPagination } from '../../pagination'
|
||||||
import { isPlainObject } from 'lodash-es'
|
import { warn, call, formatLength, createKey } from '../../_utils'
|
||||||
import styles from './styles'
|
import { dataTableLight } from '../styles'
|
||||||
import { warn, call, formatLength } from '../../_utils'
|
import { setCheckStatusOfRow, createRowKey } from './utils'
|
||||||
|
import style from './styles/index.cssr.js'
|
||||||
|
|
||||||
function createShallowClonedObject (object) {
|
function createShallowClonedObject (object) {
|
||||||
if (!object) return object
|
if (!object) return object
|
||||||
@ -124,7 +125,7 @@ export default {
|
|||||||
NEmpty,
|
NEmpty,
|
||||||
NPagination
|
NPagination
|
||||||
},
|
},
|
||||||
mixins: [configurable, themeable, withCssr(styles), locale('DataTable')],
|
mixins: [locale('DataTable')],
|
||||||
provide () {
|
provide () {
|
||||||
return {
|
return {
|
||||||
NDataTable: this
|
NDataTable: this
|
||||||
@ -292,9 +293,71 @@ export default {
|
|||||||
default: undefined
|
default: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup () {
|
setup (props) {
|
||||||
|
const themeRef = useTheme(
|
||||||
|
'DataTable',
|
||||||
|
'DataTable',
|
||||||
|
style,
|
||||||
|
dataTableLight,
|
||||||
|
props
|
||||||
|
)
|
||||||
return {
|
return {
|
||||||
mainTableRef: ref(null)
|
mainTableRef: ref(null),
|
||||||
|
cssVars: computed(() => {
|
||||||
|
const { size } = props
|
||||||
|
const {
|
||||||
|
common: { cubicBezierEaseInOut },
|
||||||
|
self: {
|
||||||
|
borderColor,
|
||||||
|
tdColorHover,
|
||||||
|
thColor,
|
||||||
|
thColorHover,
|
||||||
|
tdColor,
|
||||||
|
tdTextColor,
|
||||||
|
thTextColor,
|
||||||
|
thFontWeight,
|
||||||
|
thButtonColorHover,
|
||||||
|
thIconColor,
|
||||||
|
thIconColorActive,
|
||||||
|
filterSize,
|
||||||
|
borderRadius,
|
||||||
|
lineHeight,
|
||||||
|
tdColorModal,
|
||||||
|
thColorModal,
|
||||||
|
borderColorModal,
|
||||||
|
thColorHoverModal,
|
||||||
|
tdColorHoverModal,
|
||||||
|
[createKey('fontSize', size)]: fontSize,
|
||||||
|
[createKey('thPadding', size)]: thPadding,
|
||||||
|
[createKey('tdPadding', size)]: tdPadding
|
||||||
|
}
|
||||||
|
} = themeRef.value
|
||||||
|
return {
|
||||||
|
'--font-size': fontSize,
|
||||||
|
'--th-padding': thPadding,
|
||||||
|
'--td-padding': tdPadding,
|
||||||
|
'--bezier': cubicBezierEaseInOut,
|
||||||
|
'--border-radius': borderRadius,
|
||||||
|
'--line-height': lineHeight,
|
||||||
|
'--border-color': borderColor,
|
||||||
|
'--border-color-modal': borderColorModal,
|
||||||
|
'--th-color': thColor,
|
||||||
|
'--th-color-hover': thColorHover,
|
||||||
|
'--th-color-modal': thColorModal,
|
||||||
|
'--th-color-hover-modal': thColorHoverModal,
|
||||||
|
'--td-color': tdColor,
|
||||||
|
'--td-color-hover': tdColorHover,
|
||||||
|
'--td-color-modal': tdColorModal,
|
||||||
|
'--td-color-hover-modal': tdColorHoverModal,
|
||||||
|
'--th-text-color': thTextColor,
|
||||||
|
'--td-text-color': tdTextColor,
|
||||||
|
'--th-font-weight': thFontWeight,
|
||||||
|
'--th-button-color-hover': thButtonColorHover,
|
||||||
|
'--th-icon-color': thIconColor,
|
||||||
|
'--th-icon-color-active': thIconColorActive,
|
||||||
|
'--filter-size': filterSize
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<n-popover
|
<n-popover
|
||||||
v-model:show="showPopover"
|
v-model:show="showPopover"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
:theme="NDataTable.mergedTheme"
|
:theme="'light'"
|
||||||
:padded="false"
|
:padded="false"
|
||||||
>
|
>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
:render="mergedRenderFilter"
|
:render="mergedRenderFilter"
|
||||||
:active="active"
|
:active="active"
|
||||||
:show="showPopover"
|
:show="showPopover"
|
||||||
:theme="NDataTable.mergedTheme"
|
:theme="'light'"
|
||||||
@click.stop
|
@click.stop
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
>
|
>
|
||||||
<n-checkbox-group
|
<n-checkbox-group
|
||||||
v-if="multiple"
|
v-if="multiple"
|
||||||
:theme="theme"
|
:theme="'light'"
|
||||||
:value="cachedValue"
|
:value="cachedValue"
|
||||||
class="n-data-table-filter-menu__group"
|
class="n-data-table-filter-menu__group"
|
||||||
@update:value="handleChange"
|
@update:value="handleChange"
|
||||||
@ -22,7 +22,7 @@
|
|||||||
</n-checkbox-group>
|
</n-checkbox-group>
|
||||||
<n-radio-group
|
<n-radio-group
|
||||||
v-else
|
v-else
|
||||||
:theme="theme"
|
:theme="'light'"
|
||||||
:name="radioGroupName"
|
:name="radioGroupName"
|
||||||
class="n-data-table-filter-menu__group"
|
class="n-data-table-filter-menu__group"
|
||||||
:value="radioGroupValue"
|
:value="radioGroupValue"
|
||||||
@ -37,13 +37,13 @@
|
|||||||
</n-radio>
|
</n-radio>
|
||||||
</n-radio-group>
|
</n-radio-group>
|
||||||
</n-scrollbar>
|
</n-scrollbar>
|
||||||
<n-divider :theme="theme" />
|
<n-divider :theme="'light'" />
|
||||||
<div class="n-data-table-filter-menu__action">
|
<div class="n-data-table-filter-menu__action">
|
||||||
<n-button size="tiny" :theme="theme" @click="handleCancelClick">
|
<n-button size="tiny" :theme="'light'" @click="handleCancelClick">
|
||||||
{{ NDataTable.locale.clear }}
|
{{ NDataTable.locale.clear }}
|
||||||
</n-button>
|
</n-button>
|
||||||
<n-button
|
<n-button
|
||||||
:theme="theme"
|
:theme="'light'"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="tiny"
|
size="tiny"
|
||||||
@click="handleConfirmClick"
|
@click="handleConfirmClick"
|
||||||
@ -131,9 +131,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
theme () {
|
|
||||||
return this.NDataTable.mergedTheme
|
|
||||||
},
|
|
||||||
radioGroupValue () {
|
radioGroupValue () {
|
||||||
const cachedValue = this.cachedValue
|
const cachedValue = this.cachedValue
|
||||||
if (this.multiple || shouldUseArrayInSingleMode(this.column)) {
|
if (this.multiple || shouldUseArrayInSingleMode(this.column)) {
|
||||||
|
@ -12,10 +12,6 @@ export default {
|
|||||||
show: {
|
show: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
|
||||||
theme: {
|
|
||||||
type: String,
|
|
||||||
default: undefined
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render () {
|
render () {
|
||||||
|
@ -13,10 +13,6 @@ export default {
|
|||||||
// asc, desc
|
// asc, desc
|
||||||
type: [String, Boolean],
|
type: [String, Boolean],
|
||||||
default: undefined
|
default: undefined
|
||||||
},
|
|
||||||
theme: {
|
|
||||||
type: String,
|
|
||||||
default: undefined
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render () {
|
render () {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
:render="mergedRenderSorter"
|
:render="mergedRenderSorter"
|
||||||
:order="mergedSortOrder"
|
:order="mergedSortOrder"
|
||||||
:active="active"
|
:active="active"
|
||||||
:theme="NDataTable.mergedTheme"
|
:theme="'light'"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-else
|
v-else
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<n-scrollbar
|
<n-scrollbar
|
||||||
ref="scrollbarRef"
|
ref="scrollbarRef"
|
||||||
class="n-data-table-base-table-body"
|
class="n-data-table-base-table-body"
|
||||||
:theme="NDataTable.mergedTheme"
|
:theme="'light'"
|
||||||
:content-style="{
|
:content-style="{
|
||||||
minWidth: formatedScrollX
|
minWidth: formatedScrollX
|
||||||
}"
|
}"
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div :style="headerStyle" class="n-data-table-base-table-header">
|
||||||
:class="{
|
|
||||||
[`n-${theme}-theme`]: theme
|
|
||||||
}"
|
|
||||||
:style="headerStyle"
|
|
||||||
class="n-data-table-base-table-header"
|
|
||||||
>
|
|
||||||
<table
|
<table
|
||||||
ref="body"
|
ref="body"
|
||||||
class="n-data-table-table"
|
class="n-data-table-table"
|
||||||
@ -164,9 +158,6 @@ export default {
|
|||||||
currentPage () {
|
currentPage () {
|
||||||
return (this.pagination && this.pagination.page) || null
|
return (this.pagination && this.pagination.page) || null
|
||||||
},
|
},
|
||||||
theme () {
|
|
||||||
return this.NDataTable.mergedTheme
|
|
||||||
},
|
|
||||||
checkboxIndererminate () {
|
checkboxIndererminate () {
|
||||||
return this.NDataTable.someRowsChecked
|
return this.NDataTable.someRowsChecked
|
||||||
},
|
},
|
||||||
|
460
src/data-table/src/styles/index.cssr.js
Normal file
460
src/data-table/src/styles/index.cssr.js
Normal file
@ -0,0 +1,460 @@
|
|||||||
|
import { c, cB, cE, cM, cNotM, insideModal } from '../../../_utils/cssr'
|
||||||
|
|
||||||
|
const fixedColumnStyle = createFixedColumnStyle()
|
||||||
|
|
||||||
|
// vars:
|
||||||
|
// --font-size
|
||||||
|
// --th-padding
|
||||||
|
// --td-padding
|
||||||
|
// --bezier
|
||||||
|
// --border-radius
|
||||||
|
// --line-height
|
||||||
|
// --border-color
|
||||||
|
// --border-color-modal
|
||||||
|
// --th-color
|
||||||
|
// --th-color-hover
|
||||||
|
// --th-color-modal
|
||||||
|
// --th-color-hover-modal
|
||||||
|
// --td-color
|
||||||
|
// --td-color-hover
|
||||||
|
// --td-color-modal
|
||||||
|
// --td-color-hover-modal
|
||||||
|
// --th-text-color
|
||||||
|
// --td-text-color
|
||||||
|
// --th-font-weight
|
||||||
|
// --th-button-color-hover
|
||||||
|
// --th-icon-color
|
||||||
|
// --th-icon-color-active
|
||||||
|
// --filter-size
|
||||||
|
export default c([
|
||||||
|
cB('data-table', {
|
||||||
|
width: '100%',
|
||||||
|
fontSize: 'var(--font-size)'
|
||||||
|
}, [
|
||||||
|
cB('data-table-th', {
|
||||||
|
padding: 'var(--th-padding)'
|
||||||
|
}),
|
||||||
|
cB('data-table-td', {
|
||||||
|
padding: 'var(--td-padding)'
|
||||||
|
}),
|
||||||
|
cB('data-table-empty', `
|
||||||
|
margin: 16px 0 14px 0;
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-shrink: 0;
|
||||||
|
opacity: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: opacity .3s var(--bezier);
|
||||||
|
`, [
|
||||||
|
cM('hide', {
|
||||||
|
opacity: 0
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
cE('pagination', `
|
||||||
|
margin-top: 12px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
`),
|
||||||
|
cB('data-table-wrapper', `
|
||||||
|
position: relative;
|
||||||
|
transition: border-color .3s var(--bezier);
|
||||||
|
border-top-left-radius: var(--border-radius);
|
||||||
|
border-top-right-radius: var(--border-radius);
|
||||||
|
overflow: hidden;
|
||||||
|
line-height: var(--line-height);
|
||||||
|
`),
|
||||||
|
cM('single-column', [
|
||||||
|
cB('data-table-wrapper', [
|
||||||
|
cB('data-table-table', [
|
||||||
|
cB('data-table-tr', [
|
||||||
|
cB('data-table-td', {
|
||||||
|
borderBottom: '0 solid var(--border-color)'
|
||||||
|
}, [
|
||||||
|
c('&::after, &::before', {
|
||||||
|
bottom: '0 !important'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cNotM('single-line', [
|
||||||
|
cB('data-table-wrapper', [
|
||||||
|
cB('data-table-table', [
|
||||||
|
cB('data-table-th', {
|
||||||
|
borderRight: '1px solid var(--border-color)'
|
||||||
|
}, [
|
||||||
|
cB('&:last-child', {
|
||||||
|
borderRight: '0 solid var(--border-color)'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
cB('data-table-td', {
|
||||||
|
borderRight: '1px solid var(--border-color)'
|
||||||
|
}, [
|
||||||
|
cB('&:last-child', {
|
||||||
|
borderRight: '0 solid var(--border-color)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cM('bordered', [
|
||||||
|
cB('data-table-wrapper', {
|
||||||
|
overflow: 'hidden',
|
||||||
|
border: '1px solid var(--border-color)',
|
||||||
|
borderBottomLeftRadius: 'var(--border-radius)',
|
||||||
|
borderBottomRightRadius: 'var(--border-radius)'
|
||||||
|
}, [
|
||||||
|
cB('data-table-table', [
|
||||||
|
cB('data-table-tr', [
|
||||||
|
c('&:last-child', [
|
||||||
|
cB('data-table-td', {
|
||||||
|
borderBottom: '0 solid var(--border-color)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('data-table-base-table', [
|
||||||
|
cB('scrollbar', [
|
||||||
|
cB('scrollbar-content', {
|
||||||
|
overflow: 'visible'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('data-table-table', `
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
width: 100%;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
table-layout: fixed;
|
||||||
|
transition: background-color .3s var(--bezier);
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
background-color: var(--td-color)
|
||||||
|
`, [
|
||||||
|
cB('data-table-thead', {
|
||||||
|
transition: 'background-color .3s var(--bezier)',
|
||||||
|
backgroundColor: 'var(--th-color)'
|
||||||
|
}),
|
||||||
|
cB('data-table-tr', {
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
backgroundClip: 'padding-box',
|
||||||
|
transition: 'background-color .3s var(--bezier)'
|
||||||
|
}, [
|
||||||
|
c('&:last-child', [
|
||||||
|
cB('data-table-td', [
|
||||||
|
c('&::after', {
|
||||||
|
bottom: '0 !important'
|
||||||
|
}),
|
||||||
|
c('&::before', {
|
||||||
|
bottom: '0 !important'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
c('&:hover', {
|
||||||
|
backgroundColor: 'var(--td-color-hover)'
|
||||||
|
}, [
|
||||||
|
cB('data-table-td', {
|
||||||
|
backgroundColor: 'var(--td-color-hover)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('data-table-th', {
|
||||||
|
position: 'relative',
|
||||||
|
textAlign: 'start',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
backgroundColor: 'var(--th-color)',
|
||||||
|
borderColor: 'var(--border-color)',
|
||||||
|
color: 'var(--th-text-color)',
|
||||||
|
transition: `
|
||||||
|
border-color .3s var(--bezier),
|
||||||
|
color .3s var(--bezier),
|
||||||
|
background-color .3s var(--bezier);
|
||||||
|
`,
|
||||||
|
fontWeight: 'var(--th-font-weight)'
|
||||||
|
}, [
|
||||||
|
cM('filterable', {
|
||||||
|
paddingRight: '36px'
|
||||||
|
}),
|
||||||
|
cM('selection', {
|
||||||
|
lineHeight: 0
|
||||||
|
}),
|
||||||
|
cM('ellipsis', `
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
max-width: 100%;
|
||||||
|
`),
|
||||||
|
cM('sortable', {
|
||||||
|
cursor: 'pointer'
|
||||||
|
}, [
|
||||||
|
cE('ellipsis', {
|
||||||
|
maxWidth: 'calc(100% - 18px)'
|
||||||
|
}),
|
||||||
|
c('&:hover', {
|
||||||
|
backgroundColor: 'var(--th-color-hover)'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
fixedColumnStyle
|
||||||
|
]),
|
||||||
|
cB('data-table-td', `
|
||||||
|
text-align: start;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: none;
|
||||||
|
background-color: var(--td-color);
|
||||||
|
color: var(--td-text-color);
|
||||||
|
border-bottom: 1px solid var(--border-color);
|
||||||
|
transition:
|
||||||
|
box-shadow .3s var(--bezier),
|
||||||
|
background-color .3s var(--bezier),
|
||||||
|
border-color .3s var(--bezier),
|
||||||
|
color .3s var(--bezier);
|
||||||
|
`, [
|
||||||
|
cM('ellipsis', `
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
`),
|
||||||
|
cM('selection', {
|
||||||
|
lineHeight: 0
|
||||||
|
}),
|
||||||
|
fixedColumnStyle
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('data-table-base-table-header', {
|
||||||
|
flexShrink: 0,
|
||||||
|
transition: 'border-color .3s var(--bezier)',
|
||||||
|
scrollbarWidth: 'none'
|
||||||
|
}, [
|
||||||
|
c('&::-webkit-scrollbar', {
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
}),
|
||||||
|
cB('data-table-table', {
|
||||||
|
borderBottom: '1px solid var(--border-color)',
|
||||||
|
transition: 'border-color .3s var(--bezier)'
|
||||||
|
}),
|
||||||
|
cB('data-table-th', [
|
||||||
|
cB('data-table-sorter', {
|
||||||
|
height: '14px',
|
||||||
|
width: '14px',
|
||||||
|
marginLeft: '4px',
|
||||||
|
position: 'relative',
|
||||||
|
display: 'inline-flex',
|
||||||
|
verticalAlign: '-0.2em',
|
||||||
|
color: 'var(--th-icon-color)',
|
||||||
|
transition: `
|
||||||
|
transform .3s var(--bezier),
|
||||||
|
color .3s var(--bezier)
|
||||||
|
`
|
||||||
|
}, [
|
||||||
|
cM('desc', {
|
||||||
|
transform: 'rotate(0)'
|
||||||
|
}),
|
||||||
|
cM('asc', {
|
||||||
|
transform: 'rotate(-180deg)'
|
||||||
|
}),
|
||||||
|
cM('asc, desc', {
|
||||||
|
color: 'var(--th-icon-color-active)'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
cB('data-table-filter', `
|
||||||
|
position: absolute;
|
||||||
|
z-index: auto;
|
||||||
|
right: 0;
|
||||||
|
width: 36px;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
transition: background-color .3s var(--bezier);
|
||||||
|
`, [
|
||||||
|
c('&:hover', {
|
||||||
|
backgroundColor: 'var(--th-button-color-hover)'
|
||||||
|
}),
|
||||||
|
cB('icon', {
|
||||||
|
fontSize: 'var(--filter-size)',
|
||||||
|
color: 'var(--th-icon-color)',
|
||||||
|
transition: 'color .3s var(--bezier)'
|
||||||
|
}),
|
||||||
|
cM('show', {
|
||||||
|
backgroundColor: 'var(--th-button-color-hover)'
|
||||||
|
}),
|
||||||
|
cM('active', {
|
||||||
|
backgroundColor: 'var(--th-button-color-hover)'
|
||||||
|
}, [
|
||||||
|
cB('icon', {
|
||||||
|
color: 'var(--th-icon-color-active)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('data-table-filter-menu', [
|
||||||
|
cB('scrollbar', {
|
||||||
|
maxHeight: '240px'
|
||||||
|
}),
|
||||||
|
cE('group', {
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
padding: '12px 12px 0 12px'
|
||||||
|
}, [
|
||||||
|
cB('checkbox', {
|
||||||
|
marginBottom: '12px',
|
||||||
|
marginRight: 0
|
||||||
|
}),
|
||||||
|
cB('radio', {
|
||||||
|
marginBottom: '12px',
|
||||||
|
marginRight: 0
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
cE('action', {
|
||||||
|
padding: '8px 12px',
|
||||||
|
display: 'flex',
|
||||||
|
flexWrap: 'nowrap',
|
||||||
|
justifyContent: 'space-evenly'
|
||||||
|
}, [
|
||||||
|
cB('button', [
|
||||||
|
c('&:not(:last-child)', {
|
||||||
|
marginRight: '8px'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('divider', {
|
||||||
|
margin: '0!important'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
createStyleInsideModal()
|
||||||
|
])
|
||||||
|
|
||||||
|
function createStyleInsideModal () {
|
||||||
|
return insideModal(cB('data-table', [
|
||||||
|
cB('data-table-table', {
|
||||||
|
backgroundColor: 'var(--td-color-modal)'
|
||||||
|
}, [
|
||||||
|
cB('data-table-thead', {
|
||||||
|
backgroundColor: 'var(--th-color-modal)'
|
||||||
|
}),
|
||||||
|
cB('data-table-th', {
|
||||||
|
borderColor: 'var(--border-color-modal)',
|
||||||
|
backgroundColor: 'var(--th-color-modal)'
|
||||||
|
}, [
|
||||||
|
cM('sortable', [
|
||||||
|
c('&:hover', {
|
||||||
|
backgroundColor: 'var(--th-color-hover-modal)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('data-table-tr', [
|
||||||
|
c('&:hover', {
|
||||||
|
backgroundColor: 'var(--td-color-hover-modal)'
|
||||||
|
}, [
|
||||||
|
cB('data-table-td', {
|
||||||
|
backgroundColor: 'var(--td-color-hover-modal)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('data-table-td', {
|
||||||
|
borderColor: 'var(--border-color-modal)',
|
||||||
|
backgroundColor: 'var(--td-color-modal)'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
cNotM('single-line', [
|
||||||
|
cB('data-table-wrapper', [
|
||||||
|
cB('data-table-table', [
|
||||||
|
cB('data-table-th', {
|
||||||
|
borderRight: '1px solid var(--border-color-modal)'
|
||||||
|
}, [
|
||||||
|
c('&:last-child', {
|
||||||
|
borderRight: '0 solid var(--border-color-modal)'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
cB('data-table-td', {
|
||||||
|
borderRight: '1px solid var(--border-color-modal)'
|
||||||
|
}, [
|
||||||
|
c('&:last-child', {
|
||||||
|
borderRight: '0 solid var(--border-color-modal)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cM('bordered', [
|
||||||
|
cB('data-table-wrapper', {
|
||||||
|
border: '1px solid var(--border-color-modal)'
|
||||||
|
}, [
|
||||||
|
cB('data-table-table', [
|
||||||
|
cB('data-table-tr', [
|
||||||
|
c('&:last-child', [
|
||||||
|
cB('data-table-td', {
|
||||||
|
borderBottom: '0 solid var(--border-color-modal)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
cB('data-table-base-table-header', [
|
||||||
|
cB('data-table-table', {
|
||||||
|
borderBottom: '1px solid var(--border-color-modal)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]))
|
||||||
|
}
|
||||||
|
|
||||||
|
function createFixedColumnStyle () {
|
||||||
|
return [
|
||||||
|
cM('fixed-left', {
|
||||||
|
left: 0,
|
||||||
|
position: 'sticky',
|
||||||
|
zIndex: 2
|
||||||
|
}, [
|
||||||
|
c('&::after', `
|
||||||
|
pointer-events: none;
|
||||||
|
content: "";
|
||||||
|
width: 36px;
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: -1px;
|
||||||
|
transition: box-shadow .2s var(--bezier);
|
||||||
|
right: -36px;
|
||||||
|
`)
|
||||||
|
]),
|
||||||
|
cM('fixed-right', {
|
||||||
|
right: 0,
|
||||||
|
position: 'sticky',
|
||||||
|
zIndex: 1
|
||||||
|
}, [
|
||||||
|
c('&::before', `
|
||||||
|
pointer-events: none;
|
||||||
|
content: "";
|
||||||
|
width: 36px;
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: -1px;
|
||||||
|
transition: box-shadow .2s var(--bezier);
|
||||||
|
left: -36px;
|
||||||
|
`)
|
||||||
|
]),
|
||||||
|
cM('shadow-before', [
|
||||||
|
c('&::before', {
|
||||||
|
boxShadow: 'inset -12px 0 8px -12px rgba(0, 0, 0, .18)'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
cM('shadow-after', [
|
||||||
|
c('&::after', {
|
||||||
|
boxShadow: 'inset 12px 0 8px -12px rgba(0, 0, 0, .18)'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
import themedBaseStyle from './themed-base.cssr.js'
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
key: 'mergedTheme',
|
|
||||||
watch: ['mergedTheme'],
|
|
||||||
CNode: themedBaseStyle
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,506 +0,0 @@
|
|||||||
import { c, cTB, cB, cE, cM, cNotM, insideModal, createKey } from '../../../_utils/cssr'
|
|
||||||
|
|
||||||
export default c([
|
|
||||||
({ props }) => {
|
|
||||||
const {
|
|
||||||
$global: { cubicBezierEaseInOut },
|
|
||||||
$local: {
|
|
||||||
borderColor,
|
|
||||||
tdColorHover,
|
|
||||||
thColor,
|
|
||||||
thColorHover,
|
|
||||||
tdColor,
|
|
||||||
tdTextColor,
|
|
||||||
thTextColor,
|
|
||||||
thFontWeight,
|
|
||||||
thButtonColorHover,
|
|
||||||
thButtonIconColor,
|
|
||||||
thButtonIconColorActive,
|
|
||||||
fixedColumnBoxShadowColor,
|
|
||||||
filterSize,
|
|
||||||
borderRadius,
|
|
||||||
lineHeight
|
|
||||||
}
|
|
||||||
} = props
|
|
||||||
const fixedColumnStyle = createFixedColumnStyle({ cubicBezierEaseInOut, fixedColumnBoxShadowColor })
|
|
||||||
return [
|
|
||||||
cTB('data-table', {
|
|
||||||
width: '100%'
|
|
||||||
}, [
|
|
||||||
['small', 'medium', 'large'].map(size => {
|
|
||||||
return createSizeStyle(size, props)
|
|
||||||
}),
|
|
||||||
cB('data-table-empty', {
|
|
||||||
raw: `
|
|
||||||
margin: 16px 0 14px 0;
|
|
||||||
flex-grow: 1;
|
|
||||||
flex-shrink: 0;
|
|
||||||
opacity: 1;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
transition: opacity .3s ${cubicBezierEaseInOut};
|
|
||||||
`
|
|
||||||
}, [
|
|
||||||
cM('hide', {
|
|
||||||
opacity: 0
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cE('pagination', {
|
|
||||||
raw: `
|
|
||||||
margin-top: 12px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
`
|
|
||||||
}),
|
|
||||||
cB('data-table-wrapper', {
|
|
||||||
raw: `
|
|
||||||
position: relative;
|
|
||||||
transition: border-color .3s ${cubicBezierEaseInOut};
|
|
||||||
border-top-left-radius: ${borderRadius};
|
|
||||||
border-top-right-radius: ${borderRadius};
|
|
||||||
overflow: hidden;
|
|
||||||
line-height: ${lineHeight};
|
|
||||||
`
|
|
||||||
}),
|
|
||||||
cM('single-column', [
|
|
||||||
cB('data-table-wrapper', [
|
|
||||||
cB('data-table-table', [
|
|
||||||
cB('data-table-tr', [
|
|
||||||
cB('data-table-td', {
|
|
||||||
borderBottom: `0 solid ${borderColor}`
|
|
||||||
}, [
|
|
||||||
c('&::after, &::before', {
|
|
||||||
bottom: '0 !important'
|
|
||||||
})
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cNotM('single-line', [
|
|
||||||
cB('data-table-wrapper', [
|
|
||||||
cB('data-table-table', [
|
|
||||||
cB('data-table-th', {
|
|
||||||
borderRight: `1px solid ${borderColor}`
|
|
||||||
}, [
|
|
||||||
cB('&:last-child', {
|
|
||||||
borderRight: `0 solid ${borderColor}`
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cB('data-table-td', {
|
|
||||||
borderRight: `1px solid ${borderColor}`
|
|
||||||
}, [
|
|
||||||
cB('&:last-child', {
|
|
||||||
borderRight: `0 solid ${borderColor}`
|
|
||||||
})
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cM('bordered', [
|
|
||||||
cB('data-table-wrapper', {
|
|
||||||
overflow: 'hidden',
|
|
||||||
border: `1px solid ${borderColor}`,
|
|
||||||
borderBottomLeftRadius: borderRadius,
|
|
||||||
borderBottomRightRadius: borderRadius
|
|
||||||
}, [
|
|
||||||
cB('data-table-table', [
|
|
||||||
cB('data-table-tr', [
|
|
||||||
c('&:last-child', [
|
|
||||||
cB('data-table-td', {
|
|
||||||
borderBottom: `0 solid ${borderColor}`
|
|
||||||
})
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('data-table-base-table', [
|
|
||||||
cB('scrollbar', [
|
|
||||||
cB('scrollbar-content', {
|
|
||||||
overflow: 'visible'
|
|
||||||
})
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('data-table-table', {
|
|
||||||
raw: `
|
|
||||||
font-variant-numeric: tabular-nums;
|
|
||||||
width: 100%;
|
|
||||||
word-wrap: break-word;
|
|
||||||
word-break: break-all;
|
|
||||||
table-layout: fixed;
|
|
||||||
transition: background-color .3s ${cubicBezierEaseInOut};
|
|
||||||
border-collapse: separate;
|
|
||||||
border-spacing: 0;
|
|
||||||
background-color: ${tdColor}
|
|
||||||
`
|
|
||||||
}, [
|
|
||||||
cB('data-table-thead', {
|
|
||||||
transition: `background-color .3s ${cubicBezierEaseInOut}`,
|
|
||||||
backgroundColor: thColor
|
|
||||||
}),
|
|
||||||
cB('data-table-tr', {
|
|
||||||
boxSizing: 'border-box',
|
|
||||||
backgroundClip: 'padding-box',
|
|
||||||
transition: `background-color .3s ${cubicBezierEaseInOut}`
|
|
||||||
}, [
|
|
||||||
c('&:last-child', [
|
|
||||||
cB('data-table-td', [
|
|
||||||
c('&::after', {
|
|
||||||
bottom: '0 !important'
|
|
||||||
}),
|
|
||||||
c('&::before', {
|
|
||||||
bottom: '0 !important'
|
|
||||||
})
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
c('&:hover', {
|
|
||||||
backgroundColor: tdColorHover
|
|
||||||
}, [
|
|
||||||
cB('data-table-td', {
|
|
||||||
backgroundColor: tdColorHover
|
|
||||||
})
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('data-table-th', {
|
|
||||||
position: 'relative',
|
|
||||||
textAlign: 'start',
|
|
||||||
boxSizing: 'border-box',
|
|
||||||
backgroundColor: thColor,
|
|
||||||
borderColor: borderColor,
|
|
||||||
color: thTextColor,
|
|
||||||
transition: `
|
|
||||||
border-color .3s ${cubicBezierEaseInOut},
|
|
||||||
color .3s ${cubicBezierEaseInOut},
|
|
||||||
background-color .3s ${cubicBezierEaseInOut};
|
|
||||||
`,
|
|
||||||
fontWeight: thFontWeight
|
|
||||||
}, [
|
|
||||||
cM('filterable', {
|
|
||||||
paddingRight: '36px'
|
|
||||||
}),
|
|
||||||
cM('selection', {
|
|
||||||
lineHeight: 0
|
|
||||||
}),
|
|
||||||
cM('ellipsis', {
|
|
||||||
raw: `
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
max-width: 100%;
|
|
||||||
`
|
|
||||||
}),
|
|
||||||
cM('sortable', {
|
|
||||||
cursor: 'pointer'
|
|
||||||
}, [
|
|
||||||
cE('ellipsis', {
|
|
||||||
maxWidth: 'calc(100% - 18px)'
|
|
||||||
}),
|
|
||||||
c('&:hover', {
|
|
||||||
backgroundColor: thColorHover
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
fixedColumnStyle
|
|
||||||
]),
|
|
||||||
cB('data-table-td', {
|
|
||||||
raw: `
|
|
||||||
text-align: start;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: none;
|
|
||||||
background-color: ${tdColor};
|
|
||||||
color: ${tdTextColor};
|
|
||||||
border-bottom: 1px solid ${borderColor};
|
|
||||||
transition:
|
|
||||||
box-shadow .3s ${cubicBezierEaseInOut},
|
|
||||||
background-color .3s ${cubicBezierEaseInOut},
|
|
||||||
border-color .3s ${cubicBezierEaseInOut},
|
|
||||||
color .3s ${cubicBezierEaseInOut};
|
|
||||||
`
|
|
||||||
}, [
|
|
||||||
cM('ellipsis', {
|
|
||||||
raw: `
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
`
|
|
||||||
}),
|
|
||||||
cM('selection', {
|
|
||||||
lineHeight: 0
|
|
||||||
}),
|
|
||||||
fixedColumnStyle
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('data-table-base-table-header', {
|
|
||||||
flexShrink: 0,
|
|
||||||
transition: `border-color .3s ${cubicBezierEaseInOut}`,
|
|
||||||
scrollbarWidth: 'none'
|
|
||||||
}, [
|
|
||||||
c('&::-webkit-scrollbar', {
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
}),
|
|
||||||
cB('data-table-table', {
|
|
||||||
borderBottom: `1px solid ${borderColor}`,
|
|
||||||
transition: `border-color .3s ${cubicBezierEaseInOut}`
|
|
||||||
}),
|
|
||||||
cB('data-table-th', [
|
|
||||||
cB('data-table-sorter', {
|
|
||||||
height: '14px',
|
|
||||||
width: '14px',
|
|
||||||
marginLeft: '4px',
|
|
||||||
position: 'relative',
|
|
||||||
display: 'inline-flex',
|
|
||||||
verticalAlign: '-0.2em',
|
|
||||||
color: thButtonIconColor,
|
|
||||||
transition: `
|
|
||||||
transform .3s ${cubicBezierEaseInOut},
|
|
||||||
color .3s ${cubicBezierEaseInOut}
|
|
||||||
`
|
|
||||||
}, [
|
|
||||||
cM('desc', {
|
|
||||||
transform: 'rotate(0)'
|
|
||||||
}),
|
|
||||||
cM('asc', {
|
|
||||||
transform: 'rotate(-180deg)'
|
|
||||||
}),
|
|
||||||
cM('asc, desc', {
|
|
||||||
color: thButtonIconColorActive
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cB('data-table-filter', {
|
|
||||||
raw: `
|
|
||||||
position: absolute;
|
|
||||||
z-index: auto;
|
|
||||||
right: 0;
|
|
||||||
width: 36px;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
transition: background-color .3s ${cubicBezierEaseInOut};
|
|
||||||
`
|
|
||||||
}, [
|
|
||||||
c('&:hover', {
|
|
||||||
backgroundColor: thButtonColorHover
|
|
||||||
}),
|
|
||||||
cB('icon', {
|
|
||||||
fontSize: filterSize,
|
|
||||||
color: thButtonIconColor,
|
|
||||||
transition: `color .3s ${cubicBezierEaseInOut}`
|
|
||||||
}),
|
|
||||||
cM('show', {
|
|
||||||
backgroundColor: thButtonColorHover
|
|
||||||
}),
|
|
||||||
cM('active', {
|
|
||||||
backgroundColor: thButtonColorHover
|
|
||||||
}, [
|
|
||||||
cB('icon', {
|
|
||||||
color: thButtonIconColorActive
|
|
||||||
})
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('data-table-filter-menu', [
|
|
||||||
cB('scrollbar', {
|
|
||||||
maxHeight: '240px'
|
|
||||||
}),
|
|
||||||
cE('group', {
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
padding: '12px 12px 0 12px'
|
|
||||||
}, [
|
|
||||||
cB('checkbox', {
|
|
||||||
marginBottom: '12px',
|
|
||||||
marginRight: 0
|
|
||||||
}),
|
|
||||||
cB('radio', {
|
|
||||||
marginBottom: '12px',
|
|
||||||
marginRight: 0
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cE('action', {
|
|
||||||
padding: '8px 12px',
|
|
||||||
display: 'flex',
|
|
||||||
flexWrap: 'nowrap',
|
|
||||||
justifyContent: 'space-evenly'
|
|
||||||
}, [
|
|
||||||
cB('button', [
|
|
||||||
c('&:not(:last-child)', {
|
|
||||||
marginRight: '8px'
|
|
||||||
})
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('divider', {
|
|
||||||
margin: '0!important'
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
createStyleInsideModal(props)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
function createStyleInsideModal (props) {
|
|
||||||
const {
|
|
||||||
$local: {
|
|
||||||
tdColorModal,
|
|
||||||
thColorModal,
|
|
||||||
borderColorModal,
|
|
||||||
thColorHoverModal,
|
|
||||||
tdColorHoverModal
|
|
||||||
}
|
|
||||||
} = props
|
|
||||||
return insideModal(cTB('data-table', [
|
|
||||||
cB('data-table-table', {
|
|
||||||
backgroundColor: tdColorModal
|
|
||||||
}, [
|
|
||||||
cB('data-table-thead', {
|
|
||||||
backgroundColor: thColorModal
|
|
||||||
}),
|
|
||||||
cB('data-table-th', {
|
|
||||||
borderColor: borderColorModal,
|
|
||||||
backgroundColor: thColorModal
|
|
||||||
}, [
|
|
||||||
cM('sortable', [
|
|
||||||
c('&:hover', {
|
|
||||||
backgroundColor: thColorHoverModal
|
|
||||||
})
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('data-table-tr', [
|
|
||||||
c('&:hover', {
|
|
||||||
backgroundColor: tdColorHoverModal
|
|
||||||
}, [
|
|
||||||
cB('data-table-td', {
|
|
||||||
backgroundColor: tdColorHoverModal
|
|
||||||
})
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('data-table-td', {
|
|
||||||
borderColor: borderColorModal,
|
|
||||||
backgroundColor: tdColorModal
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cNotM('single-line', [
|
|
||||||
cB('data-table-wrapper', [
|
|
||||||
cB('data-table-table', [
|
|
||||||
cB('data-table-th', {
|
|
||||||
borderRight: `1px solid ${borderColorModal}`
|
|
||||||
}, [
|
|
||||||
c('&:last-child', {
|
|
||||||
borderRight: `0 solid ${borderColorModal}`
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cB('data-table-td', {
|
|
||||||
borderRight: `1px solid ${borderColorModal}`
|
|
||||||
}, [
|
|
||||||
c('&:last-child', {
|
|
||||||
borderRight: `0 solid ${borderColorModal}`
|
|
||||||
})
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cM('bordered', [
|
|
||||||
cB('data-table-wrapper', {
|
|
||||||
border: `1px solid ${borderColorModal}`
|
|
||||||
}, [
|
|
||||||
cB('data-table-table', [
|
|
||||||
cB('data-table-tr', [
|
|
||||||
c('&:last-child', [
|
|
||||||
cB('data-table-td', {
|
|
||||||
borderBottom: `0 solid ${borderColorModal}`
|
|
||||||
})
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
cB('data-table-base-table-header', [
|
|
||||||
cB('data-table-table', {
|
|
||||||
borderBottom: `1px solid ${borderColorModal}`
|
|
||||||
})
|
|
||||||
])
|
|
||||||
]))
|
|
||||||
}
|
|
||||||
|
|
||||||
function createFixedColumnStyle ({
|
|
||||||
cubicBezierEaseInOut
|
|
||||||
}) {
|
|
||||||
return [
|
|
||||||
cM('fixed-left', {
|
|
||||||
left: 0,
|
|
||||||
position: 'sticky',
|
|
||||||
zIndex: 2
|
|
||||||
}, [
|
|
||||||
c('&::after', {
|
|
||||||
raw: `
|
|
||||||
pointer-events: none;
|
|
||||||
content: "";
|
|
||||||
width: 36px;
|
|
||||||
display: inline-block;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: -1px;
|
|
||||||
transition: box-shadow .2s ${cubicBezierEaseInOut};
|
|
||||||
right: -36px;
|
|
||||||
`
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cM('fixed-right', {
|
|
||||||
right: 0,
|
|
||||||
position: 'sticky',
|
|
||||||
zIndex: 1
|
|
||||||
}, [
|
|
||||||
c('&::before', {
|
|
||||||
raw: `
|
|
||||||
pointer-events: none;
|
|
||||||
content: "";
|
|
||||||
width: 36px;
|
|
||||||
display: inline-block;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: -1px;
|
|
||||||
transition: box-shadow .2s ${cubicBezierEaseInOut};
|
|
||||||
left: -36px;
|
|
||||||
`
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cM('shadow-before', [
|
|
||||||
c('&::before', {
|
|
||||||
boxShadow: 'inset -12px 0 8px -12px rgba(0, 0, 0, .18)'
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
cM('shadow-after', [
|
|
||||||
c('&::after', {
|
|
||||||
boxShadow: 'inset 12px 0 8px -12px rgba(0, 0, 0, .18)'
|
|
||||||
})
|
|
||||||
])
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
function createSizeStyle (size, props) {
|
|
||||||
const {
|
|
||||||
$local: {
|
|
||||||
[createKey('fontSize', size)]: fontSize,
|
|
||||||
[createKey('thPadding', size)]: thPadding,
|
|
||||||
[createKey('tdPadding', size)]: tdPadding
|
|
||||||
}
|
|
||||||
} = props
|
|
||||||
return cM(`${size}-size`, {
|
|
||||||
fontSize: fontSize
|
|
||||||
}, [
|
|
||||||
cB('data-table-th', {
|
|
||||||
padding: thPadding
|
|
||||||
}),
|
|
||||||
cB('data-table-td', {
|
|
||||||
padding: tdPadding
|
|
||||||
})
|
|
||||||
])
|
|
||||||
}
|
|
@ -1,7 +1,5 @@
|
|||||||
import create from '../../_styles/utils/create-component-base'
|
|
||||||
import { composite } from 'seemly'
|
import { composite } from 'seemly'
|
||||||
import commonVariables from './_common'
|
import commonVariables from './_common'
|
||||||
import { baseDark } from '../../_styles/base'
|
|
||||||
import { iconDark } from '../../icon/styles'
|
import { iconDark } from '../../icon/styles'
|
||||||
import { buttonDark } from '../../button/styles'
|
import { buttonDark } from '../../button/styles'
|
||||||
import { checkboxDark } from '../../checkbox/styles'
|
import { checkboxDark } from '../../checkbox/styles'
|
||||||
@ -9,21 +7,20 @@ import { radioDark } from '../../radio/styles'
|
|||||||
import { paginationDark } from '../../pagination/styles'
|
import { paginationDark } from '../../pagination/styles'
|
||||||
import { scrollbarDark } from '../../scrollbar/styles'
|
import { scrollbarDark } from '../../scrollbar/styles'
|
||||||
import { dividerDark } from '../../divider/styles'
|
import { dividerDark } from '../../divider/styles'
|
||||||
|
import { commonDark } from '../../_styles/new-common'
|
||||||
|
|
||||||
export default create({
|
export default {
|
||||||
theme: 'dark',
|
common: commonDark,
|
||||||
name: 'DataTable',
|
peers: {
|
||||||
peer: [
|
Icon: iconDark,
|
||||||
baseDark,
|
Button: buttonDark,
|
||||||
iconDark,
|
Checkbox: checkboxDark,
|
||||||
buttonDark,
|
Radio: radioDark,
|
||||||
checkboxDark,
|
Pagination: paginationDark,
|
||||||
radioDark,
|
Scrolllbar: scrollbarDark,
|
||||||
paginationDark,
|
Divider: dividerDark
|
||||||
scrollbarDark,
|
},
|
||||||
dividerDark
|
self (vars) {
|
||||||
],
|
|
||||||
getLocalVars (vars) {
|
|
||||||
const {
|
const {
|
||||||
cardColor,
|
cardColor,
|
||||||
modalColor,
|
modalColor,
|
||||||
@ -60,8 +57,8 @@ export default create({
|
|||||||
thTextColor: textColor1Overlay,
|
thTextColor: textColor1Overlay,
|
||||||
thFontWeight: fontWeightStrong,
|
thFontWeight: fontWeightStrong,
|
||||||
thButtonColorHover: tableColorHoverOverlay,
|
thButtonColorHover: tableColorHoverOverlay,
|
||||||
thButtonIconColor: iconColorOverlay,
|
thIconColor: iconColorOverlay,
|
||||||
thButtonIconColorActive: primaryColor,
|
thIconColorActive: primaryColor,
|
||||||
// modal
|
// modal
|
||||||
borderColorModal: composite(modalColor, dividerColorOverlay),
|
borderColorModal: composite(modalColor, dividerColorOverlay),
|
||||||
tdColorHoverModal: composite(modalColor, tableColorHoverOverlay),
|
tdColorHoverModal: composite(modalColor, tableColorHoverOverlay),
|
||||||
@ -73,4 +70,4 @@ export default create({
|
|||||||
tdColorModal: modalColor
|
tdColorModal: modalColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import create from '../../_styles/utils/create-component-base'
|
|
||||||
import { composite } from 'seemly'
|
import { composite } from 'seemly'
|
||||||
import commonVariables from './_common'
|
import commonVariables from './_common'
|
||||||
import { baseLight } from '../../_styles/base'
|
|
||||||
import { iconLight } from '../../icon/styles'
|
import { iconLight } from '../../icon/styles'
|
||||||
import { buttonLight } from '../../button/styles'
|
import { buttonLight } from '../../button/styles'
|
||||||
import { checkboxLight } from '../../checkbox/styles'
|
import { checkboxLight } from '../../checkbox/styles'
|
||||||
@ -9,21 +7,20 @@ import { radioLight } from '../../radio/styles'
|
|||||||
import { paginationLight } from '../../pagination/styles'
|
import { paginationLight } from '../../pagination/styles'
|
||||||
import { scrollbarLight } from '../../scrollbar/styles'
|
import { scrollbarLight } from '../../scrollbar/styles'
|
||||||
import { dividerLight } from '../../divider/styles'
|
import { dividerLight } from '../../divider/styles'
|
||||||
|
import { commonLight } from '../../_styles/new-common'
|
||||||
|
|
||||||
export default create({
|
export default {
|
||||||
theme: 'light',
|
common: commonLight,
|
||||||
name: 'DataTable',
|
peers: {
|
||||||
peer: [
|
Icon: iconLight,
|
||||||
baseLight,
|
Button: buttonLight,
|
||||||
iconLight,
|
Checkbox: checkboxLight,
|
||||||
buttonLight,
|
Radio: radioLight,
|
||||||
checkboxLight,
|
Pagination: paginationLight,
|
||||||
radioLight,
|
Scrollbar: scrollbarLight,
|
||||||
paginationLight,
|
Divider: dividerLight
|
||||||
scrollbarLight,
|
},
|
||||||
dividerLight
|
self (vars) {
|
||||||
],
|
|
||||||
getLocalVars (vars) {
|
|
||||||
const {
|
const {
|
||||||
cardColor,
|
cardColor,
|
||||||
modalColor,
|
modalColor,
|
||||||
@ -60,8 +57,8 @@ export default create({
|
|||||||
thTextColor: textColor1,
|
thTextColor: textColor1,
|
||||||
thFontWeight: fontWeightStrong,
|
thFontWeight: fontWeightStrong,
|
||||||
thButtonColorHover: tableColorHoverOverlay,
|
thButtonColorHover: tableColorHoverOverlay,
|
||||||
thButtonIconColor: iconColorOverlay,
|
thIconColor: iconColorOverlay,
|
||||||
thButtonIconColorActive: primaryColor,
|
thIconColorActive: primaryColor,
|
||||||
// modal
|
// modal
|
||||||
borderColorModal: composite(modalColor, dividerColorOverlay),
|
borderColorModal: composite(modalColor, dividerColorOverlay),
|
||||||
tdColorHoverModal: composite(modalColor, tableColorHoverOverlay),
|
tdColorHoverModal: composite(modalColor, tableColorHoverOverlay),
|
||||||
@ -73,4 +70,4 @@ export default create({
|
|||||||
tdColorModal: modalColor
|
tdColorModal: modalColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
@ -31,7 +31,7 @@ export { baseDark, baseLight } from './_styles/base'
|
|||||||
// export { checkboxDark, checkboxLight } from './checkbox/styles'
|
// export { checkboxDark, checkboxLight } from './checkbox/styles'
|
||||||
// export { codeDark, codeLight } from './code/styles'
|
// export { codeDark, codeLight } from './code/styles'
|
||||||
// export { collapseDark, collapseLight } from './collapse/styles'
|
// export { collapseDark, collapseLight } from './collapse/styles'
|
||||||
export { dataTableDark, dataTableLight } from './data-table/styles'
|
// export { dataTableDark, dataTableLight } from './data-table/styles'
|
||||||
export { datePickerDark, datePickerLight } from './date-picker/styles'
|
export { datePickerDark, datePickerLight } from './date-picker/styles'
|
||||||
export { descriptionsDark, descriptionsLight } from './descriptions/styles'
|
export { descriptionsDark, descriptionsLight } from './descriptions/styles'
|
||||||
export { dialogDark, dialogLight } from './dialog/styles'
|
export { dialogDark, dialogLight } from './dialog/styles'
|
||||||
|
@ -14,6 +14,7 @@ import { cascaderDark } from './cascader/styles'
|
|||||||
import { checkboxDark } from './checkbox/styles'
|
import { checkboxDark } from './checkbox/styles'
|
||||||
import { codeDark } from './code/styles'
|
import { codeDark } from './code/styles'
|
||||||
import { collapseDark } from './collapse/styles'
|
import { collapseDark } from './collapse/styles'
|
||||||
|
import { dataTableDark } from './data-table/styles'
|
||||||
|
|
||||||
export const darkTheme = {
|
export const darkTheme = {
|
||||||
common: commonDark,
|
common: commonDark,
|
||||||
@ -31,5 +32,6 @@ export const darkTheme = {
|
|||||||
Checkbox: checkboxDark,
|
Checkbox: checkboxDark,
|
||||||
Code: codeDark,
|
Code: codeDark,
|
||||||
Collapse: collapseDark,
|
Collapse: collapseDark,
|
||||||
|
DataTable: dataTableDark,
|
||||||
Divider: dividerDark
|
Divider: dividerDark
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user