UNPKG

vue-virtualized-table-booway

Version:

The second version of implementation of `vue-virtual-table` component, it was inspired from [rc-table](https://github.com/react-component/table) and [ant-table](https://ant.design/components/table), API design is 60%+ consistent. Or you could think I tran

556 lines (471 loc) 11.3 kB
.ant-table.ant-table-middle .ant-table-title, .ant-table.ant-table-middle .ant-table-footer, .ant-table.ant-table-middle .ant-table-thead > tr > th, .ant-table.ant-table-middle .ant-table-tbody > tr > td, .ant-table.ant-table-middle tfoot > tr > th, .ant-table.ant-table-middle tfoot > tr > td { padding: 12px 8px; } .ant-table.ant-table-middle .ant-table-expanded-row-fixed { margin: -12px -8px; } .ant-table.ant-table-middle .ant-table-tbody .ant-table-wrapper:only-child .ant-table { margin: -12px -8px -12px 25px; } .ant-table.ant-table-small .ant-table-title, .ant-table.ant-table-small .ant-table-footer, .ant-table.ant-table-small .ant-table-thead > tr > th, .ant-table.ant-table-small .ant-table-tbody > tr > td, .ant-table.ant-table-small tfoot > tr > th, .ant-table.ant-table-small tfoot > tr > td { padding: 6px; } .ant-table.ant-table-small .ant-table-expanded-row-fixed { margin: -8px; } .ant-table.ant-table-small .ant-table-tbody .ant-table-wrapper:only-child .ant-table { margin: -8px -8px -8px 25px; } .ant-table-small .ant-table-thead > tr > th { background-color: #fafafa; } .ant-table.ant-table-bordered thead > tr > th, .ant-table.ant-table-bordered tbody > tr > td, .ant-table.ant-table-bordered tfoot > tr > th, .ant-table.ant-table-bordered tfoot > tr > td { border-right: 1px solid #f0f0f0; } .ant-table.ant-table-bordered .ant-table-cell-fix-right-first::after { border-right: 1px solid #f0f0f0; } .ant-table.ant-table-bordered table thead > tr:not(:last-child) > th { border-bottom: 1px solid #f0f0f0; } .ant-table.ant-table-bordered .ant-table-container { border: 1px solid #f0f0f0; border-right: 0; border-bottom: 0; } .ant-table.ant-table-bordered .ant-table-expanded-row-fixed { margin: -16px -17px; } .ant-table.ant-table-bordered .ant-table-expanded-row-fixed::after { position: absolute; top: 0; right: 1px; bottom: 0; border-right: 1px solid #f0f0f0; content: ''; } .ant-table.ant-table-bordered.ant-table-scroll-horizontal tr.ant-table-expanded-row > td, .ant-table.ant-table-bordered.ant-table-scroll-horizontal tr.ant-table-placeholder > td { border-right: 0; } .ant-table.ant-table-bordered.ant-table-middle .ant-table-expanded-row-fixed { margin: -12px -9px; } .ant-table.ant-table-bordered.ant-table-small .ant-table-expanded-row-fixed { margin: -8px -9px; } .ant-table.ant-table-bordered .ant-table-footer { border: 1px solid #f0f0f0; border-top: 0; } .ant-table-wrapper { max-width: 100%; } .ant-table-wrapper::before { display: table; content: ''; } .ant-table-wrapper::after { display: table; clear: both; content: ''; } .ant-table { box-sizing: border-box; margin: 0; padding: 0; color: #181818; font-size: 14px; font-variant: tabular-nums; line-height: 1.5715; list-style: none; font-feature-settings: 'tnum'; position: relative; z-index: 0; clear: both; background: #fff; border-radius: 2px; } .ant-table table { width: 100%; text-align: left; border-radius: 2px 2px 0 0; border-collapse: separate; border-spacing: 0; } .ant-table-thead > tr > th, .ant-table-tbody > tr > td, .ant-table tfoot > tr > th, .ant-table tfoot > tr > td { position: relative; padding: 16px; overflow-wrap: break-word; } .ant-table-cell-ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; word-break: keep-all; } .ant-table-cell-ellipsis.ant-table-cell-fix-left-last, .ant-table-cell-ellipsis.ant-table-cell-fix-right-first { overflow: visible; } .ant-table-cell-ellipsis.ant-table-cell-fix-left-last .ant-table-cell-content, .ant-table-cell-ellipsis.ant-table-cell-fix-right-first .ant-table-cell-content { display: block; overflow: hidden; text-overflow: ellipsis; } .ant-table-title { padding: 16px; } .ant-table-footer { padding: 16px; color: rgba(0, 0, 0, 0.85); background: #fafafa; } .ant-table-thead > tr > th { color: rgba(0, 0, 0, 0.85); font-weight: 500; text-align: left; background: #fafafa; border-bottom: 1px solid #f0f0f0; transition: background 0.3s ease; cursor: col-resize; } .ant-table-thead > tr > th[colspan]:not([colspan='1']) { text-align: center; } .ant-table-thead > tr:not(:last-child) > th[colspan] { border-bottom: 0; } .ant-table-tbody > tr > td { border-bottom: 1px solid #f0f0f0; transition: background 0.3s; } .ant-table-tbody > tr.ant-table-row:hover > td { background: #fafafa; } .ant-table-tbody > tr.ant-table-row-selected > td { background: #e6f7ff; border-color: rgba(0, 0, 0, 0.03); } .ant-table-tbody > tr.ant-table-row-selected:hover > td { background: #dcf4ff; } .ant-table-tbody > tr .ant-table-wrapper:only-child .ant-table { margin: -16px -16px -16px 33px; } .ant-table-tbody > tr .ant-table-wrapper:only-child .ant-table td { background: 0 0; } .ant-table-tbody > tr .ant-table-wrapper:only-child .ant-table-tbody > tr:last-child > td { border-bottom: 0; } .ant-table-tbody > tr .ant-table-wrapper:only-child .ant-table-tbody > tr:last-child > td:first-child, .ant-table-tbody > tr .ant-table-wrapper:only-child .ant-table-tbody > tr:last-child > td:last-child { border-radius: 0; } .ant-table tfoot > tr > th, .ant-table tfoot > tr > td { border-bottom: 1px solid #f0f0f0; } .ant-table-selection { position: relative; } .ant-table-expand-icon-col { width: 48px; } .ant-table-row-expand-icon-cell { text-align: center; } .ant-table-row-indent { float: left; height: 1px; } .ant-table-row-expand-icon { color: #1890ff; text-decoration: none; cursor: pointer; transition: color 0.3s; position: relative; display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex; float: left; box-sizing: border-box; width: 17px; height: 17px; padding: 0; color: inherit; line-height: 12px; vertical-align: -2px; background: #fff; border: 1px solid #f0f0f0; border-radius: 2px; outline: none; user-select: none; } .ant-table-row-expand-icon:focus, .ant-table-row-expand-icon:hover { color: #40a9ff; } .ant-table-row-expand-icon:active { color: #096dd9; } .ant-table-row-expand-icon:focus, .ant-table-row-expand-icon:hover, .ant-table-row-expand-icon:active { border-color: currentColor; } .ant-table-row-expand-icon::before, .ant-table-row-expand-icon::after { position: absolute; background: currentColor; content: ''; } .ant-table-row-expand-icon::before { top: 7px; right: 3px; left: 3px; height: 1px; } .ant-table-row-expand-icon::after { top: 3px; bottom: 3px; left: 7px; width: 1px; transform: rotate(90deg); } .ant-table-row-expand-icon-collapsed::before { transform: rotate(-180deg); } .ant-table-row-expand-icon-collapsed::after { transform: rotate(0deg); } .ant-table-row-expand-icon-spaced { background: 0 0; border: 0; } .ant-table-row-expand-icon-spaced::before, .ant-table-row-expand-icon-spaced::after { display: none; content: none; } .ant-table-row-indent + .ant-table-row-expand-icon { margin-top: 2.5005px; margin-right: 8px; } tr.ant-table-expanded-row > td, tr.ant-table-expanded-row:hover > td { background: #fbfbfb; } .ant-table .ant-table-expanded-row-fixed { position: relative; margin: -16px; padding: 16px; } .ant-table-tbody > tr.ant-table-placeholder, .ant-table-tbody .ant-table-cell .ant-table-placeholder { text-align: center; } .ant-table-empty .ant-table-tbody > tr.ant-table-placeholder { color: rgba(0, 0, 0, 0.25); } .ant-table-tbody > tr.ant-table-placeholder:hover > td { background: #fff; } .ant-table-cell-fix-left, .ant-table-cell-fix-right { position: -webkit-sticky !important; position: sticky !important; z-index: 2; background: #fff; } .ant-table-cell-fix-left-first::after, .ant-table-cell-fix-left-last::after { position: absolute; top: 0; right: 0; bottom: -1px; width: 30px; transform: translateX(100%); transition: -webkit-box-shadow 0.3s; transition: box-shadow 0.3s; transition: box-shadow 0.3s, -webkit-box-shadow 0.3s; content: ''; pointer-events: none; } .ant-table-cell-fix-right-first::after, .ant-table-cell-fix-right-last::after { position: absolute; top: 0; bottom: -1px; left: 0; width: 30px; transform: translateX(-100%); transition: -webkit-box-shadow 0.3s; transition: box-shadow 0.3s; transition: box-shadow 0.3s, -webkit-box-shadow 0.3s; content: ''; pointer-events: none; } .ant-table .ant-table-container::before, .ant-table .ant-table-container::after { position: absolute; top: 0; bottom: 0; z-index: 1; width: 30px; transition: -webkit-box-shadow 0.3s; transition: box-shadow 0.3s; transition: box-shadow 0.3s, -webkit-box-shadow 0.3s; content: ''; pointer-events: none; } .ant-table .ant-table-container::before { left: 0; } .ant-table .ant-table-container::after { right: 0; } .ant-table-ping-left:not(.ant-table-has-fix-left) .ant-table-container { position: relative; } .ant-table-ping-left:not(.ant-table-has-fix-left) .ant-table-container::before { box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, 0.15); } .ant-table-ping-left .ant-table-cell-fix-left-first::after, .ant-table-ping-left .ant-table-cell-fix-left-last::after { box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, 0.15); } .ant-table-ping-right:not(.ant-table-has-fix-right) .ant-table-container { position: relative; } .ant-table-ping-right:not(.ant-table-has-fix-right) .ant-table-container::after { box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, 0.15); } .ant-table-ping-right .ant-table-cell-fix-right-first::after, .ant-table-ping-right .ant-table-cell-fix-right-last::after { box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, 0.15); } @media all and (-ms-high-contrast: none) { .ant-table-ping-left .ant-table-cell-fix-left-last::after { box-shadow: none !important; } .ant-table-ping-right .ant-table-cell-fix-right-first::after { -webkit-box-shadow: none !important; box-shadow: none !important; } } .ant-table { } .ant-table-title { border-radius: 2px 2px 0 0; } .ant-table-title + .ant-table-container { border-top-left-radius: 0; border-top-right-radius: 0; } .ant-table-title + .ant-table-container table > thead > tr:first-child th:first-child { border-radius: 0; } .ant-table-title + .ant-table-container table > thead > tr:first-child th:last-child { border-radius: 0; } .ant-table-container { border-top-left-radius: 2px; border-top-right-radius: 2px; } .ant-table-container table > thead > tr:first-child th:first-child { border-top-left-radius: 2px; } .ant-table-container table > thead > tr:first-child th:last-child { border-top-right-radius: 2px; } .ant-table-footer { border-radius: 0 0 2px 2px; } .shuxian-half-down { position: absolute; height: calc(50% - 8.5px); display: block; left: 24.5px; top: calc(50% + 8.5px); border-left: 1px dashed #909399; } .shuxian-all { position: absolute; height: 100%; display: block; left: 24.5px; top: 0; border-left: 1px dashed #909399; } .shuxian-half-up { position: absolute; height: calc(50% - 8.5px); display: block; left: 24.5px; top: 0; border-left: 1px dashed #909399; } .hengxian { position: absolute; width: 16px; display: block; left: 24.5px; top: 50%; border-top: 1px dashed #909399; }