@hi-ui/table 4.0.13 → 4.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/lib/cjs/BaseTable.js +7 -4
- package/lib/cjs/Table.js +19 -6
- package/lib/cjs/TableBody.js +83 -2
- package/lib/cjs/TableCell.js +42 -1
- package/lib/cjs/TableRow.js +42 -2
- package/lib/cjs/_virtual/index.js +18 -0
- package/lib/cjs/_virtual/index2.js +18 -0
- package/lib/cjs/_virtual/react-is.development.js +16 -0
- package/lib/cjs/_virtual/react-is.production.min.js +16 -0
- package/lib/cjs/hooks/use-check.js +28 -4
- package/lib/cjs/hooks/use-col-width.js +37 -8
- package/lib/cjs/hooks/use-pagination.js +51 -9
- package/lib/cjs/node_modules/classnames/index.js +76 -0
- package/lib/cjs/node_modules/rc-resize-observer/es/index.js +236 -0
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +51 -0
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +40 -0
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +77 -0
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +42 -0
- package/lib/cjs/node_modules/rc-util/es/Dom/canUseDom.js +20 -0
- package/lib/cjs/node_modules/rc-util/es/Dom/findDOMNode.js +40 -0
- package/lib/cjs/node_modules/rc-util/es/hooks/useLayoutEffect.js +49 -0
- package/lib/cjs/node_modules/rc-util/es/raf.js +72 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/Filler.js +135 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/Item.js +53 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/List.js +550 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/ScrollBar.js +431 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useChildren.js +60 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +129 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +64 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useHeights.js +182 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +93 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +56 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +154 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/index.js +18 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/CacheMap.js +65 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +85 -0
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/isFirefox.js +27 -0
- package/lib/cjs/node_modules/react-is/cjs/react-is.development.js +208 -0
- package/lib/cjs/node_modules/react-is/cjs/react-is.production.min.js +158 -0
- package/lib/cjs/node_modules/react-is/index.js +26 -0
- package/lib/cjs/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +1127 -0
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/cjs/use-table.js +4 -2
- package/lib/esm/BaseTable.js +24 -21
- package/lib/esm/Table.js +28 -15
- package/lib/esm/TableAdvancedFilter.js +13 -13
- package/lib/esm/TableBody.js +95 -15
- package/lib/esm/TableCell.js +50 -9
- package/lib/esm/TableColumnMenu.js +16 -16
- package/lib/esm/TableEmbedRow.js +4 -4
- package/lib/esm/TableHeader.js +10 -10
- package/lib/esm/TableRow.js +53 -13
- package/lib/esm/TableSettingMenu.js +14 -14
- package/lib/esm/_virtual/index.js +13 -0
- package/lib/esm/_virtual/index2.js +13 -0
- package/lib/esm/_virtual/react-is.development.js +11 -0
- package/lib/esm/_virtual/react-is.production.min.js +11 -0
- package/lib/esm/hooks/use-check.js +32 -8
- package/lib/esm/hooks/use-col-width.js +44 -15
- package/lib/esm/hooks/use-colgroup.js +4 -4
- package/lib/esm/hooks/use-drag.js +2 -2
- package/lib/esm/hooks/use-embed-expand.js +2 -2
- package/lib/esm/hooks/use-pagination.js +51 -10
- package/lib/esm/icons/index.js +5 -5
- package/lib/esm/node_modules/classnames/index.js +69 -0
- package/lib/esm/node_modules/rc-resize-observer/es/index.js +177 -0
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +33 -0
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +23 -0
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +57 -0
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +34 -0
- package/lib/esm/node_modules/rc-util/es/Dom/canUseDom.js +14 -0
- package/lib/esm/node_modules/rc-util/es/Dom/findDOMNode.js +23 -0
- package/lib/esm/node_modules/rc-util/es/hooks/useLayoutEffect.js +17 -0
- package/lib/esm/node_modules/rc-util/es/raf.js +66 -0
- package/lib/esm/node_modules/rc-virtual-list/es/Filler.js +103 -0
- package/lib/esm/node_modules/rc-virtual-list/es/Item.js +23 -0
- package/lib/esm/node_modules/rc-virtual-list/es/List.js +508 -0
- package/lib/esm/node_modules/rc-virtual-list/es/ScrollBar.js +399 -0
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useChildren.js +29 -0
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +98 -0
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +55 -0
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useHeights.js +150 -0
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +85 -0
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +50 -0
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +123 -0
- package/lib/esm/node_modules/rc-virtual-list/es/index.js +11 -0
- package/lib/esm/node_modules/rc-virtual-list/es/utils/CacheMap.js +59 -0
- package/lib/esm/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +80 -0
- package/lib/esm/node_modules/rc-virtual-list/es/utils/isFirefox.js +21 -0
- package/lib/esm/node_modules/react-is/cjs/react-is.development.js +200 -0
- package/lib/esm/node_modules/react-is/cjs/react-is.production.min.js +151 -0
- package/lib/esm/node_modules/react-is/index.js +20 -0
- package/lib/esm/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +1122 -0
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/esm/use-table.js +12 -10
- package/lib/types/Table.d.ts +1 -1
- package/lib/types/TableCell.d.ts +4 -0
- package/lib/types/context.d.ts +2 -0
- package/lib/types/hooks/use-check.d.ts +1 -1
- package/lib/types/hooks/use-col-width.d.ts +2 -1
- package/lib/types/hooks/use-pagination.d.ts +7 -2
- package/lib/types/types.d.ts +7 -3
- package/lib/types/use-table.d.ts +14 -1
- package/package.json +5 -5
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
var css_248z = ".hi-v4-table {-webkit-box-sizing: border-box;box-sizing: border-box;font-size: 14px;position: relative; }.hi-v4-table table {width: 100%;text-align: left;background-color: var(--hi-v4-color-static-white, #fff);border-radius: 2px 2px 0 0;border-spacing: 0;border-collapse: separate;display: table;table-layout: fixed; }.hi-v4-table__wrapper {position: relative;z-index: 0; }.hi-v4-table__switcher.hi-v4-icon-button {color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table__switcher--expanded.hi-v4-icon-button {color: var(--hi-v4-color-primary-400, var(--hi-v4-color-brandblue-400, #4a9eff)); }.hi-v4-table--size-md table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-7, 14px); }.hi-v4-table--size-md table thead > tr > th {padding: var(--hi-v4-spacing-7, 14px); }.hi-v4-table--size-sm table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-5, 10px); }.hi-v4-table--size-sm table thead > tr > th {padding: var(--hi-v4-spacing-5, 10px); }.hi-v4-table--size-lg table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-9, 18px); }.hi-v4-table--size-lg table thead > tr > th {padding: var(--hi-v4-spacing-9, 18px); }.hi-v4-table--bordered table thead > tr > th {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered table td {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered .hi-v4-table-header {border-top: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered .hi-v4-table-body {border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--sticky {position: -webkit-sticky;position: sticky;top: 0; }.hi-v4-table-header {position: relative;-webkit-box-sizing: border-box;box-sizing: border-box;overflow: hidden; }.hi-v4-table-header__resizable {position: relative;background-clip: padding-box; }.hi-v4-table-header__resizable-handle {-webkit-box-sizing: content-box;box-sizing: content-box;position: absolute;width: 2px;height: 100%;bottom: 0;right: 0;border-left: 2px solid var(--hi-v4-color-gray-50, #f5f7fa);cursor: col-resize;z-index: 1; }.hi-v4-table-header__resizable:hover .hi-v4-table-header__resizable-handle {background-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-header-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active[data-sticky] {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-row--hover:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--striped > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--expanded > .hi-v4-table-cell {color: var(--hi-v4-color-gray-800, #1f2937); }.hi-v4-table-row--error > .hi-v4-table-cell {color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }.hi-v4-table-row--highlight > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--dragging > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--drag-top > .hi-v4-table-cell {border-top: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-row--drag-bottom > .hi-v4-table-cell {border-bottom: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-row--avg > .hi-v4-table-cell, .hi-v4-table-row--total > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--avg:hover > .hi-v4-table-cell, .hi-v4-table-row--total:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header .hi-v4-table-header-col, .hi-v4-table-header .hi-v4-table-col {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-body .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-body .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-header .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-body {position: relative;overflow: auto; }.hi-v4-table-header-cell {color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-medium, 500);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8); }.hi-v4-table-header-cell.hi-v4-table__embed-col, .hi-v4-table-header-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px); }.hi-v4-table-cell {word-break: break-word;border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-700, #1f2733);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);background-color: var(--hi-v4-color-static-white, #fff); }.hi-v4-table-cell__indent {display: inline-block;width: 14px;height: 100%;margin-right: var(--hi-v4-spacing-1, 2px); }.hi-v4-table-cell__switcher.hi-v4-icon-button {margin-right: var(--hi-v4-spacing-1, 2px);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table-cell.hi-v4-table__embed-col, .hi-v4-table-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px); }.hi-v4-table-cell.hi-v4-table-cell__col--highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-cell.hi-v4-table-cell__col--hovered-highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-freeze-shadow {position: absolute;top: 0;bottom: 0;z-index: 20;pointer-events: none;overflow: hidden;height: 100%;width: 200px; }.hi-v4-table-freeze-shadow--left {margin-right: 10px;left: 0;-webkit-box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15); }.hi-v4-table-freeze-shadow--right {margin-left: 10px;right: 0;-webkit-box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15); }.hi-v4-table-header-filter-dropdown__trigger.hi-v4-icon-button {margin-left: 4px; }.hi-v4-table-header-filter-dropdown__content {width: 124px;padding: var(--hi-v4-spacing-6, 12px) var(--hi-v4-spacing-4, 8px);font-weight: var(--hi-v4-text-weight-normal, 400); }.hi-v4-table-header-filter-dropdown__item {margin-top: var(--hi-v4-spacing-4, 8px);padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;cursor: pointer;color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem); }.hi-v4-table-header-filter-dropdown__item:first-child {margin-top: 0; }.hi-v4-table-header-filter-dropdown__item:hover {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header-filter-dropdown__item--active {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header-filter-dropdown__item--active:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header-filter-sorter {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;height: 20px;margin-top: 2px;margin-left: 6px; }.hi-v4-table-header-filter-sorter__icon {display: inline-block;height: 8px;cursor: pointer;overflow: hidden;font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table-header-filter-sorter__icon svg {position: relative;top: -5px; }.hi-v4-table-header-filter-sorter__icon--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-header-filter-custom__trigger {margin-left: 6px;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer; }.hi-v4-table-header-filter-custom__content {padding: 12px 8px; }.hi-v4-table-embed-row {position: relative;z-index: 0; }.hi-v4-table-embed-row > td {background-color: var(--hi-v4-color-gray-200, #ebedf0);padding: var(--hi-v4-spacing-10, 20px); }.hi-v4-table-setting {position: absolute;height: 100%;z-index: 11;-webkit-box-sizing: border-box;box-sizing: border-box;right: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);border-bottom: none;border-top: none;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer;font-size: var(--hi-v4-text-size-sm, 0.75rem);width: 18px;background: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-table-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-table-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px); }.hi-v4-table-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-setting-item--dragging .hi-v4-table-setting-item__wrap {opacity: 0.6; }.hi-v4-table-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: '';background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%; }.hi-v4-table-setting-item::after {position: absolute;content: '';z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%; }.hi-v4-table-setting-item::before, .hi-v4-table-setting-item::after {margin-left: -10px;margin-right: -10px; }.hi-v4-table-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px); }.hi-v4-table-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px; }.hi-v4-table-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px); }.hi-v4-table-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px; }.hi-v4-table-pagination {display: -webkit-box;display: -ms-flexbox;display: flex;-ms-flex-wrap: wrap;flex-wrap: wrap;row-gap: 8px;padding: var(--hi-v4-spacing-6, 12px) 0;background-color: var(--hi-v4-color-static-white, #fff); }.hi-v4-table-pagination--placement-left {-webkit-box-pack: start;-ms-flex-pack: start;justify-content: flex-start; }.hi-v4-table-pagination--placement-right {-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-table-pagination--placement-middle {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center; }.hi-v4-table-empty-content td {text-align: center;padding: var(--hi-v4-spacing-12, 24px) 0; }.hi-v4-table--bordered .hi-v4-table-empty-content td {border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8); }";
|
|
15
|
+
var css_248z = ".hi-v4-table {-webkit-box-sizing: border-box;box-sizing: border-box;font-size: 14px;position: relative; }.hi-v4-table table {width: 100%;text-align: left;background-color: var(--hi-v4-color-static-white, #fff);border-radius: 2px 2px 0 0;border-spacing: 0;border-collapse: separate;display: table;table-layout: fixed; }.hi-v4-table__wrapper {position: relative;z-index: 0; }.hi-v4-table__switcher.hi-v4-icon-button {color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table__switcher--expanded.hi-v4-icon-button {color: var(--hi-v4-color-primary-400, var(--hi-v4-color-brandblue-400, #4a9eff)); }.hi-v4-table--size-md table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-7, 14px); }.hi-v4-table--size-md table thead > tr > th {padding: var(--hi-v4-spacing-7, 14px); }.hi-v4-table--size-sm table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-5, 10px); }.hi-v4-table--size-sm table thead > tr > th {padding: var(--hi-v4-spacing-5, 10px); }.hi-v4-table--size-lg table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-9, 18px); }.hi-v4-table--size-lg table thead > tr > th {padding: var(--hi-v4-spacing-9, 18px); }.hi-v4-table--bordered table thead > tr > th {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered table td {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered .hi-v4-table-header {border-top: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--bordered .hi-v4-table-body {border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }.hi-v4-table--sticky {position: -webkit-sticky;position: sticky;top: 0; }.hi-v4-table--virtual {width: 100%;overflow: hidden; }.hi-v4-table--virtual .hi-v4-table-cell {-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-table-header {position: relative;-webkit-box-sizing: border-box;box-sizing: border-box;overflow: hidden; }.hi-v4-table-header__resizable {position: relative;background-clip: padding-box; }.hi-v4-table-header__resizable-handle {-webkit-box-sizing: content-box;box-sizing: content-box;position: absolute;width: 2px;height: 100%;bottom: 0;right: 0;border-left: 2px solid var(--hi-v4-color-gray-50, #f5f7fa);cursor: col-resize;z-index: 1; }.hi-v4-table-header__resizable:hover .hi-v4-table-header__resizable-handle {background-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-header-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active[data-sticky] {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-row--hover:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--striped > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--expanded > .hi-v4-table-cell {color: var(--hi-v4-color-gray-800, #1f2937); }.hi-v4-table-row--error > .hi-v4-table-cell {color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }.hi-v4-table-row--highlight > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--dragging > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-row--drag-top > .hi-v4-table-cell {border-top: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-row--drag-bottom > .hi-v4-table-cell {border-bottom: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-row--avg > .hi-v4-table-cell, .hi-v4-table-row--total > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--avg:hover > .hi-v4-table-cell, .hi-v4-table-row--total:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-row--virtual {display: -webkit-box;display: -ms-flexbox;display: flex; }.hi-v4-table-header .hi-v4-table-header-col, .hi-v4-table-header .hi-v4-table-col {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-body .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-body .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-header .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-table-body {position: relative;overflow: auto; }.hi-v4-table-header-cell {color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-medium, 500);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8); }.hi-v4-table-header-cell.hi-v4-table__embed-col, .hi-v4-table-header-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px); }.hi-v4-table-cell {word-break: break-word;border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-700, #1f2733);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);background-color: var(--hi-v4-color-static-white, #fff); }.hi-v4-table-cell__indent {display: inline-block;width: 14px;height: 100%;margin-right: var(--hi-v4-spacing-1, 2px); }.hi-v4-table-cell__switcher.hi-v4-icon-button {margin-right: var(--hi-v4-spacing-1, 2px);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table-cell.hi-v4-table__embed-col, .hi-v4-table-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px); }.hi-v4-table-cell.hi-v4-table-cell__col--highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-cell.hi-v4-table-cell__col--hovered-highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-freeze-shadow {position: absolute;top: 0;bottom: 0;z-index: 20;pointer-events: none;overflow: hidden;height: 100%;width: 200px; }.hi-v4-table-freeze-shadow--left {margin-right: 10px;left: 0;-webkit-box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15); }.hi-v4-table-freeze-shadow--right {margin-left: 10px;right: 0;-webkit-box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15); }.hi-v4-table-header-filter-dropdown__trigger.hi-v4-icon-button {margin-left: 4px; }.hi-v4-table-header-filter-dropdown__content {width: 124px;padding: var(--hi-v4-spacing-6, 12px) var(--hi-v4-spacing-4, 8px);font-weight: var(--hi-v4-text-weight-normal, 400); }.hi-v4-table-header-filter-dropdown__item {margin-top: var(--hi-v4-spacing-4, 8px);padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;cursor: pointer;color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem); }.hi-v4-table-header-filter-dropdown__item:first-child {margin-top: 0; }.hi-v4-table-header-filter-dropdown__item:hover {background-color: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-header-filter-dropdown__item--active {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header-filter-dropdown__item--active:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-header-filter-sorter {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;height: 20px;margin-top: 2px;margin-left: 6px; }.hi-v4-table-header-filter-sorter__icon {display: inline-block;height: 8px;cursor: pointer;overflow: hidden;font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-table-header-filter-sorter__icon svg {position: relative;top: -5px; }.hi-v4-table-header-filter-sorter__icon--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-table-header-filter-custom__trigger {margin-left: 6px;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer; }.hi-v4-table-header-filter-custom__content {padding: 12px 8px; }.hi-v4-table-embed-row {position: relative;z-index: 0; }.hi-v4-table-embed-row > td {background-color: var(--hi-v4-color-gray-200, #ebedf0);padding: var(--hi-v4-spacing-10, 20px); }.hi-v4-table-setting {position: absolute;height: 100%;z-index: 11;-webkit-box-sizing: border-box;box-sizing: border-box;right: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);border-bottom: none;border-top: none;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer;font-size: var(--hi-v4-text-size-sm, 0.75rem);width: 18px;background: var(--hi-v4-color-gray-50, #f5f7fa); }.hi-v4-table-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-table-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-table-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px); }.hi-v4-table-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-table-setting-item--dragging .hi-v4-table-setting-item__wrap {opacity: 0.6; }.hi-v4-table-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: '';background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%; }.hi-v4-table-setting-item::after {position: absolute;content: '';z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%; }.hi-v4-table-setting-item::before, .hi-v4-table-setting-item::after {margin-left: -10px;margin-right: -10px; }.hi-v4-table-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px); }.hi-v4-table-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px; }.hi-v4-table-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px); }.hi-v4-table-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px; }.hi-v4-table-pagination {display: -webkit-box;display: -ms-flexbox;display: flex;-ms-flex-wrap: wrap;flex-wrap: wrap;row-gap: 8px;padding: var(--hi-v4-spacing-6, 12px) 0;background-color: var(--hi-v4-color-static-white, #fff); }.hi-v4-table-pagination--placement-left {-webkit-box-pack: start;-ms-flex-pack: start;justify-content: flex-start; }.hi-v4-table-pagination--placement-right {-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end; }.hi-v4-table-pagination--placement-middle {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center; }.hi-v4-table-empty-content td {text-align: center;padding: var(--hi-v4-spacing-12, 24px) 0; }.hi-v4-table--bordered .hi-v4-table-empty-content td {border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8); }";
|
|
16
16
|
|
|
17
17
|
var __styleInject__ = require('inject-head-style')["default"];
|
|
18
18
|
|
package/lib/cjs/use-table.js
CHANGED
|
@@ -105,7 +105,8 @@ var useTable = function useTable(_a) {
|
|
|
105
105
|
cellRender = _a.cellRender,
|
|
106
106
|
_a$fieldKey = _a.fieldKey,
|
|
107
107
|
fieldKey = _a$fieldKey === void 0 ? 'key' : _a$fieldKey,
|
|
108
|
-
|
|
108
|
+
virtual = _a.virtual,
|
|
109
|
+
rootProps = tslib.__rest(_a, ["data", "columns", "defaultFixedToColumn", "fixedToColumn", "onFixedToColumn", "scrollWidth", "resizable", "errorRowKeys", "highlightedColKeys", "highlightedRowKeys", "showColHighlight", "showRowHighlight", "highlightRowOnDoubleClick", "defaultExpandedRowKeys", "expandedRowKeys", "onExpand", "defaultExpandAll", "onLoadChildren", "maxHeight", "sticky", "stickyTop", "draggable", "onDragStart", "onDrop", "onDropEnd", "showColMenu", "rowSelection", "cellRender", "fieldKey", "virtual"]);
|
|
109
110
|
/**
|
|
110
111
|
* 获取 key 字段值
|
|
111
112
|
*/
|
|
@@ -211,7 +212,8 @@ var useTable = function useTable(_a) {
|
|
|
211
212
|
var _useColWidth = useColWidth.useColWidth({
|
|
212
213
|
data: data,
|
|
213
214
|
columns: columns,
|
|
214
|
-
resizable: resizable
|
|
215
|
+
resizable: resizable,
|
|
216
|
+
virtual: virtual
|
|
215
217
|
}),
|
|
216
218
|
measureRowElementRef = _useColWidth.measureRowElementRef,
|
|
217
219
|
getColgroupProps = _useColWidth.getColgroupProps,
|
package/lib/esm/BaseTable.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import { __rest } from 'tslib';
|
|
11
|
-
import
|
|
11
|
+
import React__default, { forwardRef } from 'react';
|
|
12
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
13
|
import { __DEV__ } from '@hi-ui/env';
|
|
14
14
|
import { useLocaleContext } from '@hi-ui/core';
|
|
@@ -61,7 +61,8 @@ var BaseTable = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
61
61
|
_a$fixedColumnTrigger = _a.fixedColumnTrigger,
|
|
62
62
|
fixedColumnTrigger = _a$fixedColumnTrigger === void 0 ? 'auto' : _a$fixedColumnTrigger,
|
|
63
63
|
emptyContent = _a.emptyContent,
|
|
64
|
-
|
|
64
|
+
virtual = _a.virtual,
|
|
65
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "columns", "data", "striped", "bordered", "rowExpandable", "defaultExpandedEmbedRowKeys", "expandedEmbedRowKeys", "onEmbedExpand", "expandedRender", "size", "extra", "onRow", "onHeaderRow", "stickyFooter", "stickyFooterBottom", "fixedColumnTrigger", "emptyContent", "virtual"]);
|
|
65
66
|
|
|
66
67
|
var _useEmbedExpand = useEmbedExpand({
|
|
67
68
|
defaultExpandedEmbedRowKeys: defaultExpandedEmbedRowKeys,
|
|
@@ -81,7 +82,7 @@ var BaseTable = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
81
82
|
*/
|
|
82
83
|
|
|
83
84
|
|
|
84
|
-
var getEmbedPanelColumn =
|
|
85
|
+
var getEmbedPanelColumn = React__default.useCallback(function (embedExpandable) {
|
|
85
86
|
var embedPanelColumn = {
|
|
86
87
|
dataKey: EMBED_DATA_KEY,
|
|
87
88
|
title: '',
|
|
@@ -102,14 +103,14 @@ var BaseTable = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
102
103
|
onSwitch: function onSwitch(shouldExpanded) {
|
|
103
104
|
onExpandEmbedRowsChange(rowItem, shouldExpanded);
|
|
104
105
|
},
|
|
105
|
-
expandedIcon: /*#__PURE__*/
|
|
106
|
-
collapsedIcon: /*#__PURE__*/
|
|
106
|
+
expandedIcon: /*#__PURE__*/React__default.createElement(MinusSquareOutlined, null),
|
|
107
|
+
collapsedIcon: /*#__PURE__*/React__default.createElement(PlusSquareOutlined, null)
|
|
107
108
|
});
|
|
108
109
|
}
|
|
109
110
|
};
|
|
110
111
|
return embedPanelColumn;
|
|
111
112
|
}, [prefixCls, isExpandEmbedRows, onExpandEmbedRowsChange, isEmbedLoadingId]);
|
|
112
|
-
var mergedColumns =
|
|
113
|
+
var mergedColumns = React__default.useMemo(function () {
|
|
113
114
|
if (embedExpandable) {
|
|
114
115
|
var embedColumn = getEmbedPanelColumn(embedExpandable);
|
|
115
116
|
return [embedColumn].concat(columns);
|
|
@@ -161,7 +162,8 @@ var BaseTable = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
161
162
|
});
|
|
162
163
|
var providedValue = useTable(Object.assign(Object.assign({}, rest), {
|
|
163
164
|
columns: mergedColumns,
|
|
164
|
-
data: data
|
|
165
|
+
data: data,
|
|
166
|
+
virtual: virtual
|
|
165
167
|
}));
|
|
166
168
|
var rootProps = providedValue.rootProps,
|
|
167
169
|
bordered = providedValue.bordered,
|
|
@@ -175,14 +177,14 @@ var BaseTable = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
175
177
|
var extraHeader = extra && extra.header;
|
|
176
178
|
var extraFooter = extra && extra.footer;
|
|
177
179
|
var alwaysFixedColumn = fixedColumnTrigger === 'always';
|
|
178
|
-
var cls = cx(prefixCls, className, hasBorder && prefixCls + "--bordered", striped && prefixCls + "--striped", size && prefixCls + "--size-" + size);
|
|
179
|
-
return /*#__PURE__*/
|
|
180
|
+
var cls = cx(prefixCls, className, hasBorder && prefixCls + "--bordered", striped && prefixCls + "--striped", size && prefixCls + "--size-" + size, virtual && prefixCls + "--virtual");
|
|
181
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({
|
|
180
182
|
ref: ref,
|
|
181
183
|
role: role,
|
|
182
184
|
className: cls
|
|
183
|
-
}, rootProps), /*#__PURE__*/
|
|
185
|
+
}, rootProps), /*#__PURE__*/React__default.createElement("div", {
|
|
184
186
|
className: prefixCls + "__wrapper"
|
|
185
|
-
}, /*#__PURE__*/
|
|
187
|
+
}, /*#__PURE__*/React__default.createElement(TableProvider, {
|
|
186
188
|
value: Object.assign(Object.assign({}, providedValue), {
|
|
187
189
|
striped: striped,
|
|
188
190
|
onRow: onRow,
|
|
@@ -195,11 +197,12 @@ var BaseTable = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
195
197
|
avgRow: avgRow,
|
|
196
198
|
hasAvgColumn: hasAvgColumn,
|
|
197
199
|
sumRow: sumRow,
|
|
198
|
-
hasSumColumn: hasSumColumn
|
|
200
|
+
hasSumColumn: hasSumColumn,
|
|
201
|
+
virtual: virtual
|
|
199
202
|
})
|
|
200
|
-
}, /*#__PURE__*/
|
|
203
|
+
}, /*#__PURE__*/React__default.createElement("div", Object.assign({}, getTableHeaderProps()), /*#__PURE__*/React__default.createElement(TableHeader, {
|
|
201
204
|
prefixCls: prefixCls + "-header"
|
|
202
|
-
}), extraHeader ? /*#__PURE__*/
|
|
205
|
+
}), extraHeader ? /*#__PURE__*/React__default.createElement("div", {
|
|
203
206
|
style: {
|
|
204
207
|
position: 'absolute',
|
|
205
208
|
right: 0,
|
|
@@ -207,20 +210,20 @@ var BaseTable = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
207
210
|
bottom: 0,
|
|
208
211
|
top: 0
|
|
209
212
|
}
|
|
210
|
-
}, extraHeader) : null), /*#__PURE__*/
|
|
213
|
+
}, extraHeader) : null), /*#__PURE__*/React__default.createElement(TableBody, {
|
|
211
214
|
prefixCls: prefixCls,
|
|
212
215
|
emptyContent: emptyContent
|
|
213
|
-
})), (alwaysFixedColumn || scrollSize.scrollLeft > 0) && leftFrozenColKeys.length > 0 ? /*#__PURE__*/
|
|
216
|
+
})), (alwaysFixedColumn || scrollSize.scrollLeft > 0) && leftFrozenColKeys.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
214
217
|
className: prefixCls + "-freeze-shadow " + prefixCls + "-freeze-shadow--left",
|
|
215
218
|
style: {
|
|
216
219
|
width: leftFixedColumnsWidth + 'px'
|
|
217
220
|
}
|
|
218
|
-
}) : null, (alwaysFixedColumn || scrollSize.scrollRight > 0) && rightFrozenColKeys.length > 0 ? /*#__PURE__*/
|
|
221
|
+
}) : null, (alwaysFixedColumn || scrollSize.scrollRight > 0) && rightFrozenColKeys.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
219
222
|
className: prefixCls + "-freeze-shadow " + prefixCls + "-freeze-shadow--right",
|
|
220
223
|
style: {
|
|
221
224
|
width: rightFixedColumnsWidth + 'px'
|
|
222
225
|
}
|
|
223
|
-
}) : null), /*#__PURE__*/
|
|
226
|
+
}) : null), /*#__PURE__*/React__default.createElement("div", {
|
|
224
227
|
className: prefixCls + "-footer",
|
|
225
228
|
style: stickyFooter ? {
|
|
226
229
|
position: 'sticky',
|
|
@@ -243,19 +246,19 @@ var renderSwitcher = function renderSwitcher(_ref) {
|
|
|
243
246
|
expandedIcon = _ref.expandedIcon,
|
|
244
247
|
collapsedIcon = _ref.collapsedIcon;
|
|
245
248
|
|
|
246
|
-
if ( /*#__PURE__*/
|
|
249
|
+
if ( /*#__PURE__*/React__default.isValidElement(rowExpand)) {
|
|
247
250
|
return rowExpand;
|
|
248
251
|
}
|
|
249
252
|
|
|
250
253
|
if (rowExpand === true) {
|
|
251
254
|
if (loading) {
|
|
252
|
-
return /*#__PURE__*/
|
|
255
|
+
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
253
256
|
className: cx(prefixCls + "__switcher", prefixCls + "__switcher--loading"),
|
|
254
257
|
icon: defaultLoadingIcon
|
|
255
258
|
});
|
|
256
259
|
}
|
|
257
260
|
|
|
258
|
-
return /*#__PURE__*/
|
|
261
|
+
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
259
262
|
tabIndex: -1,
|
|
260
263
|
className: cx(prefixCls + "__switcher", prefixCls + "__switcher--" + (expanded ? 'expanded' : 'collapse')),
|
|
261
264
|
icon: expanded ? expandedIcon : collapsedIcon,
|
package/lib/esm/Table.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import { __rest } from 'tslib';
|
|
11
|
-
import
|
|
11
|
+
import React__default, { forwardRef, useCallback, useMemo, Fragment } from 'react';
|
|
12
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
13
|
import { __DEV__, invariant } from '@hi-ui/env';
|
|
14
14
|
import Pagination from '@hi-ui/pagination';
|
|
@@ -51,7 +51,7 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
51
51
|
_a$standard = _a.standard,
|
|
52
52
|
standard = _a$standard === void 0 ? false : _a$standard,
|
|
53
53
|
_a$loading = _a.loading,
|
|
54
|
-
|
|
54
|
+
loadingProp = _a$loading === void 0 ? false : _a$loading,
|
|
55
55
|
dataSource = _a.dataSource,
|
|
56
56
|
paginationProp = _a.pagination,
|
|
57
57
|
uniqueId = _a.uniqueId,
|
|
@@ -66,7 +66,8 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
66
66
|
extra = _a.extra,
|
|
67
67
|
_a$data = _a.data,
|
|
68
68
|
data = _a$data === void 0 ? DEFAULT_DATA : _a$data,
|
|
69
|
-
|
|
69
|
+
virtual = _a.virtual,
|
|
70
|
+
rest = __rest(_a, ["prefixCls", "standard", "loading", "dataSource", "pagination", "uniqueId", "columns", "hiddenColKeys", "onHiddenColKeysChange", "sortedColKeys", "onSortedColKeysChange", "rowSelection", "fieldKey", "extra", "data", "virtual"]);
|
|
70
71
|
|
|
71
72
|
var tableProps = withDefaultProps(rest, standard ? STANDARD_PRESET : undefined);
|
|
72
73
|
|
|
@@ -118,15 +119,24 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
118
119
|
*/
|
|
119
120
|
|
|
120
121
|
var _useTablePagination = useTablePagination({
|
|
122
|
+
loadingProp: loadingProp,
|
|
121
123
|
pagination: pagination,
|
|
122
124
|
data: data,
|
|
123
125
|
dataSource: dataSource
|
|
124
126
|
}),
|
|
127
|
+
loading = _useTablePagination.loading,
|
|
125
128
|
mergedData = _useTablePagination.mergedData,
|
|
126
129
|
currentPage = _useTablePagination.currentPage,
|
|
127
|
-
trySetCurrentPage = _useTablePagination.trySetCurrentPage
|
|
130
|
+
trySetCurrentPage = _useTablePagination.trySetCurrentPage,
|
|
131
|
+
pageSize = _useTablePagination.pageSize,
|
|
132
|
+
trySetPageSize = _useTablePagination.trySetPageSize,
|
|
133
|
+
total = _useTablePagination.total; // 可能是从 dataSource 中拿到的 total 值,在此更新该值
|
|
128
134
|
|
|
129
135
|
|
|
136
|
+
pagination = Object.assign(Object.assign({}, pagination), {
|
|
137
|
+
total: total
|
|
138
|
+
}); // 优化数据在第一页且数据一页内时,不展示 pagination 配置项
|
|
139
|
+
|
|
130
140
|
var hiddenPagination = !paginationProp || pagination.autoHide && currentPage === 1 && typeof pagination.pageSize === 'number' && typeof pagination.total === 'number' && pagination.total <= pagination.pageSize && data.length <= pagination.pageSize; // 获取 key 字段值
|
|
131
141
|
|
|
132
142
|
var getRowKeyField = useCallback(function (item) {
|
|
@@ -150,7 +160,7 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
150
160
|
}, [mergedData, getRowKeyField]); // ************************ 行多选 ************************ //
|
|
151
161
|
// 自定义设置 checkbox 列宽度
|
|
152
162
|
|
|
153
|
-
var checkboxColWidth =
|
|
163
|
+
var checkboxColWidth = React__default.useMemo(function () {
|
|
154
164
|
return rowSelection && typeof rowSelection.checkboxColWidth === 'number' ? rowSelection.checkboxColWidth : 38;
|
|
155
165
|
}, [rowSelection]); // 预处理 column 支持 多选渲染
|
|
156
166
|
|
|
@@ -167,13 +177,13 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
167
177
|
checkRowIsDisabledCheckbox = _useTableCheck.checkRowIsDisabledCheckbox; // 表格列多选操作区
|
|
168
178
|
|
|
169
179
|
|
|
170
|
-
var getSelectionColumn =
|
|
180
|
+
var getSelectionColumn = React__default.useCallback(function (rowSelection) {
|
|
171
181
|
var renderCell = function renderCell(_, rowItem, rowIndex) {
|
|
172
182
|
var rowKey = getRowKeyField(rowItem);
|
|
173
183
|
var checked = isCheckedRowKey(rowKey);
|
|
174
184
|
var disabledCheckbox = checkRowIsDisabledCheckbox(rowItem);
|
|
175
185
|
return {
|
|
176
|
-
node: /*#__PURE__*/
|
|
186
|
+
node: /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
177
187
|
checked: isCheckedRowKey(rowKey),
|
|
178
188
|
disabled: disabledCheckbox,
|
|
179
189
|
onChange: function onChange(evt) {
|
|
@@ -208,7 +218,7 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
208
218
|
|
|
209
219
|
var renderTitleCell = function renderTitleCell() {
|
|
210
220
|
return {
|
|
211
|
-
node: /*#__PURE__*/
|
|
221
|
+
node: /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
212
222
|
checked: checkedAll,
|
|
213
223
|
indeterminate: semiChecked,
|
|
214
224
|
onChange: tryCheckAllRow
|
|
@@ -228,7 +238,7 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
228
238
|
}
|
|
229
239
|
|
|
230
240
|
if (rowSelection.checkAllOptions.filterIcon) {
|
|
231
|
-
return /*#__PURE__*/
|
|
241
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, node, rowSelection.checkAllOptions.filterIcon);
|
|
232
242
|
}
|
|
233
243
|
}
|
|
234
244
|
|
|
@@ -245,7 +255,7 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
245
255
|
};
|
|
246
256
|
return selectionColumn;
|
|
247
257
|
}, [getRowKeyField, checkedAll, semiChecked, tryCheckAllRow, checkboxColWidth, isCheckedRowKey, onCheckedRowKeysChange, checkRowIsDisabledCheckbox, prefixCls]);
|
|
248
|
-
var mergedColumns =
|
|
258
|
+
var mergedColumns = React__default.useMemo(function () {
|
|
249
259
|
if (rowSelection) {
|
|
250
260
|
var selectionColumn = getSelectionColumn(rowSelection);
|
|
251
261
|
return [selectionColumn].concat(visibleCols);
|
|
@@ -255,15 +265,16 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
255
265
|
}, [rowSelection, getSelectionColumn, visibleCols]); // ************************ loading ************************ //
|
|
256
266
|
|
|
257
267
|
var TableWrapper = loading ? Loading : Fragment;
|
|
258
|
-
return /*#__PURE__*/
|
|
268
|
+
return /*#__PURE__*/React__default.createElement(TableWrapper, null, /*#__PURE__*/React__default.createElement(BaseTable, Object.assign({
|
|
259
269
|
ref: ref
|
|
260
270
|
}, baseTableProps, {
|
|
261
271
|
prefixCls: prefixCls,
|
|
262
272
|
columns: mergedColumns,
|
|
263
273
|
data: mergedData,
|
|
264
274
|
fieldKey: fieldKey,
|
|
275
|
+
virtual: virtual,
|
|
265
276
|
extra: Object.assign({
|
|
266
|
-
header: setting ? /*#__PURE__*/
|
|
277
|
+
header: setting ? /*#__PURE__*/React__default.createElement(TableSettingMenu, {
|
|
267
278
|
prefixCls: prefixCls + "-setting",
|
|
268
279
|
// sort
|
|
269
280
|
sortedCols: sortedCols,
|
|
@@ -276,12 +287,14 @@ var Table = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
276
287
|
cacheHiddenColKeys: cacheHiddenColKeys,
|
|
277
288
|
setCacheHiddenColKeys: setCacheHiddenColKeys
|
|
278
289
|
}) : null,
|
|
279
|
-
footer: hiddenPagination ?
|
|
290
|
+
footer: dataSource || !hiddenPagination ? /*#__PURE__*/React__default.createElement(Pagination, Object.assign({
|
|
280
291
|
className: cx(prefixCls + "-pagination", pagination.placement && prefixCls + "-pagination--placement-" + pagination.placement)
|
|
281
292
|
}, pagination, {
|
|
282
293
|
current: currentPage,
|
|
283
|
-
onChange: trySetCurrentPage
|
|
284
|
-
|
|
294
|
+
onChange: trySetCurrentPage,
|
|
295
|
+
pageSize: pageSize,
|
|
296
|
+
onPageSizeChange: trySetPageSize
|
|
297
|
+
})) : null
|
|
285
298
|
}, extra)
|
|
286
299
|
})));
|
|
287
300
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
import
|
|
10
|
+
import React__default from 'react';
|
|
11
11
|
import { cx } from '@hi-ui/classname';
|
|
12
12
|
import { useTableContext } from './context.js';
|
|
13
13
|
import { TableColumnMenu } from './TableColumnMenu.js';
|
|
@@ -27,20 +27,20 @@ var renderFilter = function renderFilter(_ref) {
|
|
|
27
27
|
sorter = _column$raw.sorter,
|
|
28
28
|
filterIcon = _column$raw.filterIcon,
|
|
29
29
|
selectFilters = _column$raw.selectFilters;
|
|
30
|
-
return [showColMenu && /*#__PURE__*/
|
|
30
|
+
return [showColMenu && /*#__PURE__*/React__default.createElement(TableColumnMenu, {
|
|
31
31
|
prefixCls: prefixCls + "-dropdown",
|
|
32
32
|
key: "0",
|
|
33
33
|
column: column,
|
|
34
34
|
onOpen: onOpen,
|
|
35
35
|
onClose: onClose
|
|
36
|
-
}), sorter && !showColMenu && /*#__PURE__*/
|
|
36
|
+
}), sorter && !showColMenu && /*#__PURE__*/React__default.createElement(SorterMenu, {
|
|
37
37
|
prefixCls: prefixCls + "-sorter",
|
|
38
38
|
key: "1",
|
|
39
39
|
column: column
|
|
40
|
-
}), selectFilters && /*#__PURE__*/
|
|
40
|
+
}), selectFilters && /*#__PURE__*/React__default.createElement(Select, Object.assign({
|
|
41
41
|
prefixCls: prefixCls + "-select",
|
|
42
42
|
key: "2"
|
|
43
|
-
}, selectFilters)), filterIcon && /*#__PURE__*/
|
|
43
|
+
}, selectFilters)), filterIcon && /*#__PURE__*/React__default.createElement(FilterDropdown, {
|
|
44
44
|
prefixCls: prefixCls + "-custom",
|
|
45
45
|
key: "3",
|
|
46
46
|
column: column,
|
|
@@ -62,9 +62,9 @@ var SorterMenu = function SorterMenu(_ref2) {
|
|
|
62
62
|
setActiveSorterColumn = _useTableContext.setActiveSorterColumn,
|
|
63
63
|
setActiveSorterType = _useTableContext.setActiveSorterType;
|
|
64
64
|
|
|
65
|
-
return /*#__PURE__*/
|
|
65
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
66
66
|
className: prefixCls
|
|
67
|
-
}, /*#__PURE__*/
|
|
67
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
68
68
|
className: cx(prefixCls + "__icon", (_cx = {}, _cx[prefixCls + "__icon--active"] = activeSorterType === 'ascend' && activeSorterColumn === columnKey, _cx)),
|
|
69
69
|
onClick: function onClick(e) {
|
|
70
70
|
if (activeSorterType === 'ascend' && activeSorterColumn === columnKey) {
|
|
@@ -75,7 +75,7 @@ var SorterMenu = function SorterMenu(_ref2) {
|
|
|
75
75
|
setActiveSorterColumn(columnKey);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
}, /*#__PURE__*/
|
|
78
|
+
}, /*#__PURE__*/React__default.createElement(CaretUpFilled, null)), /*#__PURE__*/React__default.createElement("span", {
|
|
79
79
|
className: cx(prefixCls + "__icon", (_cx2 = {}, _cx2[prefixCls + "__icon--active"] = activeSorterType === 'descend' && activeSorterColumn === columnKey, _cx2)),
|
|
80
80
|
onClick: function onClick(e) {
|
|
81
81
|
if (activeSorterType === 'descend' && activeSorterColumn === columnKey) {
|
|
@@ -86,7 +86,7 @@ var SorterMenu = function SorterMenu(_ref2) {
|
|
|
86
86
|
setActiveSorterColumn(columnKey);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
}, /*#__PURE__*/
|
|
89
|
+
}, /*#__PURE__*/React__default.createElement(CaretDownFilled, null)));
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
var FilterDropdown = function FilterDropdown(_ref3) {
|
|
@@ -118,15 +118,15 @@ var FilterDropdown = function FilterDropdown(_ref3) {
|
|
|
118
118
|
menuVisible = _useUncontrolledToggl[0],
|
|
119
119
|
menuVisibleAction = _useUncontrolledToggl[1];
|
|
120
120
|
|
|
121
|
-
var _React$useState =
|
|
121
|
+
var _React$useState = React__default.useState(null),
|
|
122
122
|
menuTrigger = _React$useState[0],
|
|
123
123
|
setMenuTrigger = _React$useState[1];
|
|
124
124
|
|
|
125
|
-
return /*#__PURE__*/
|
|
125
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
|
126
126
|
className: prefixCls + "__trigger",
|
|
127
127
|
ref: setMenuTrigger,
|
|
128
128
|
onClick: menuVisibleAction.not
|
|
129
|
-
}, filterIcon), /*#__PURE__*/
|
|
129
|
+
}, filterIcon), /*#__PURE__*/React__default.createElement(Popper, Object.assign({
|
|
130
130
|
className: prefixCls + "__popper",
|
|
131
131
|
// @DesignToken zIndex: `overlay`
|
|
132
132
|
zIndex: 1050
|
|
@@ -134,7 +134,7 @@ var FilterDropdown = function FilterDropdown(_ref3) {
|
|
|
134
134
|
visible: menuVisible,
|
|
135
135
|
attachEl: menuTrigger,
|
|
136
136
|
onClose: menuVisibleAction.off
|
|
137
|
-
}), /*#__PURE__*/
|
|
137
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
138
138
|
className: cx(prefixCls + "__content", filterDropdownClassName),
|
|
139
139
|
style: {
|
|
140
140
|
width: filterDropdownWidth
|
package/lib/esm/TableBody.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
import
|
|
10
|
+
import React__default, { forwardRef, useState, useMemo, useCallback } from 'react';
|
|
11
|
+
import List from './node_modules/rc-virtual-list/es/List.js';
|
|
11
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
12
13
|
import { __DEV__ } from '@hi-ui/env';
|
|
13
14
|
import { useLatestCallback } from '@hi-ui/use-latest';
|
|
@@ -44,7 +45,9 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
44
45
|
hasAvgColumn = _useTableContext.hasAvgColumn,
|
|
45
46
|
avgRow = _useTableContext.avgRow,
|
|
46
47
|
hasSumColumn = _useTableContext.hasSumColumn,
|
|
47
|
-
sumRow = _useTableContext.sumRow
|
|
48
|
+
sumRow = _useTableContext.sumRow,
|
|
49
|
+
colWidths = _useTableContext.colWidths,
|
|
50
|
+
virtual = _useTableContext.virtual;
|
|
48
51
|
|
|
49
52
|
var cls = cx(prefixCls + "-body");
|
|
50
53
|
var getRequiredProps = useLatestCallback(function (id) {
|
|
@@ -57,9 +60,86 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
57
60
|
// focused: focusedId === id,
|
|
58
61
|
|
|
59
62
|
};
|
|
60
|
-
});
|
|
63
|
+
});
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
var _useState = useState(0),
|
|
66
|
+
scrollLeft = _useState[0],
|
|
67
|
+
setScrollLeft = _useState[1]; // 是否使用虚拟滚动
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
var showVirtual = virtual && isArrayNonEmpty(transitionData);
|
|
71
|
+
var rowWidth = useMemo(function () {
|
|
72
|
+
var tmpWidth = 0;
|
|
73
|
+
colWidths.forEach(function (width) {
|
|
74
|
+
return tmpWidth += width;
|
|
75
|
+
});
|
|
76
|
+
return tmpWidth;
|
|
77
|
+
}, [colWidths]);
|
|
78
|
+
var onVirtualContainerScroll = useCallback(function (evt) {
|
|
79
|
+
var _a;
|
|
80
|
+
|
|
81
|
+
setScrollLeft(((_a = scrollBodyElementRef === null || scrollBodyElementRef === void 0 ? void 0 : scrollBodyElementRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) || 0);
|
|
82
|
+
onTableBodyScroll(evt);
|
|
83
|
+
}, [scrollBodyElementRef, onTableBodyScroll]);
|
|
84
|
+
|
|
85
|
+
if (showVirtual) {
|
|
86
|
+
// TODO: avg和summay row的逻辑
|
|
87
|
+
var vMaxHeight = maxHeight || 300;
|
|
88
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
89
|
+
ref: scrollBodyElementRef,
|
|
90
|
+
className: cls,
|
|
91
|
+
onScroll: onVirtualContainerScroll,
|
|
92
|
+
style: {
|
|
93
|
+
maxHeight: maxHeight !== undefined ? maxHeight : undefined,
|
|
94
|
+
// maxHeight 小于 table 实际高度才出现纵向滚动条
|
|
95
|
+
overflowY: maxHeight !== undefined && bodyTableRef.current && bodyTableRef.current.clientHeight > maxHeight ? 'scroll' : undefined,
|
|
96
|
+
// 表格宽度大于div宽度才出现横向滚动条
|
|
97
|
+
overflowX: canScroll ? 'scroll' : undefined
|
|
98
|
+
}
|
|
99
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
100
|
+
ref: measureRowElementRef,
|
|
101
|
+
style: {
|
|
102
|
+
height: 1,
|
|
103
|
+
background: 'transparent'
|
|
104
|
+
}
|
|
105
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
106
|
+
ref: bodyTableRef,
|
|
107
|
+
style: {
|
|
108
|
+
height: 1,
|
|
109
|
+
background: 'transparent',
|
|
110
|
+
width: rowWidth
|
|
111
|
+
}
|
|
112
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
113
|
+
style: {
|
|
114
|
+
width: '100%',
|
|
115
|
+
position: 'sticky',
|
|
116
|
+
left: 0
|
|
117
|
+
}
|
|
118
|
+
}, /*#__PURE__*/React__default.createElement(List, {
|
|
119
|
+
data: transitionData,
|
|
120
|
+
height: vMaxHeight,
|
|
121
|
+
itemHeight: 10,
|
|
122
|
+
itemKey: "id",
|
|
123
|
+
children: function children(row, index) {
|
|
124
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
125
|
+
style: {
|
|
126
|
+
position: 'relative',
|
|
127
|
+
left: -scrollLeft
|
|
128
|
+
}
|
|
129
|
+
}, /*#__PURE__*/React__default.createElement(TableRow // key={depth + index}
|
|
130
|
+
, Object.assign({
|
|
131
|
+
// key={depth + index}
|
|
132
|
+
key: row.id,
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
rowIndex: index,
|
|
135
|
+
rowData: row
|
|
136
|
+
}, getRequiredProps(row.id))));
|
|
137
|
+
}
|
|
138
|
+
})));
|
|
139
|
+
} // 外层增加 div 作为滚动容器
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
63
143
|
ref: scrollBodyElementRef,
|
|
64
144
|
className: cls,
|
|
65
145
|
onScroll: onTableBodyScroll,
|
|
@@ -70,18 +150,18 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
70
150
|
// 表格宽度大于div宽度才出现横向滚动条
|
|
71
151
|
overflowX: canScroll ? 'scroll' : undefined
|
|
72
152
|
}
|
|
73
|
-
}, /*#__PURE__*/
|
|
153
|
+
}, /*#__PURE__*/React__default.createElement("table", {
|
|
74
154
|
ref: bodyTableRef,
|
|
75
155
|
style: {
|
|
76
156
|
width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
|
|
77
157
|
}
|
|
78
|
-
}, /*#__PURE__*/
|
|
79
|
-
return /*#__PURE__*/
|
|
158
|
+
}, /*#__PURE__*/React__default.createElement("colgroup", null, leafColumns.map(function (col, idx) {
|
|
159
|
+
return /*#__PURE__*/React__default.createElement("col", Object.assign({
|
|
80
160
|
key: idx,
|
|
81
161
|
className: prefixCls + "-col"
|
|
82
162
|
}, getColgroupProps(col, idx)));
|
|
83
|
-
})), /*#__PURE__*/
|
|
84
|
-
return /*#__PURE__*/
|
|
163
|
+
})), /*#__PURE__*/React__default.createElement("tbody", null, isArrayNonEmpty(transitionData) ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, transitionData.map(function (row, index) {
|
|
164
|
+
return /*#__PURE__*/React__default.createElement(TableRow, Object.assign({
|
|
85
165
|
ref: index === 0 ? measureRowElementRef : null,
|
|
86
166
|
// key={depth + index}
|
|
87
167
|
key: row.id,
|
|
@@ -89,12 +169,12 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
89
169
|
rowIndex: index,
|
|
90
170
|
rowData: row
|
|
91
171
|
}, getRequiredProps(row.id)));
|
|
92
|
-
}), hasSumColumn ? /*#__PURE__*/
|
|
172
|
+
}), hasSumColumn ? /*#__PURE__*/React__default.createElement(TableRow, {
|
|
93
173
|
key: sumRow.id,
|
|
94
174
|
rowIndex: transitionData.length,
|
|
95
175
|
rowData: sumRow,
|
|
96
176
|
isSumRow: true
|
|
97
|
-
}) : null, hasAvgColumn ? /*#__PURE__*/
|
|
177
|
+
}) : null, hasAvgColumn ? /*#__PURE__*/React__default.createElement(TableRow, {
|
|
98
178
|
key: avgRow.id,
|
|
99
179
|
rowIndex: transitionData.length + 1,
|
|
100
180
|
rowData: avgRow,
|
|
@@ -122,18 +202,18 @@ var renderEmptyContent = function renderEmptyContent(_ref2) {
|
|
|
122
202
|
colSpan = _ref2.colSpan,
|
|
123
203
|
emptyContent = _ref2.emptyContent,
|
|
124
204
|
scrollBodyWidth = _ref2.scrollBodyWidth;
|
|
125
|
-
return /*#__PURE__*/
|
|
205
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
126
206
|
className: className
|
|
127
|
-
}, /*#__PURE__*/
|
|
207
|
+
}, /*#__PURE__*/React__default.createElement("td", {
|
|
128
208
|
colSpan: colSpan
|
|
129
|
-
}, /*#__PURE__*/
|
|
209
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
130
210
|
style: {
|
|
131
211
|
position: 'sticky',
|
|
132
212
|
left: 0,
|
|
133
213
|
width: scrollBodyWidth !== null && scrollBodyWidth !== void 0 ? scrollBodyWidth : '100%',
|
|
134
214
|
overflow: 'hidden'
|
|
135
215
|
}
|
|
136
|
-
}, emptyContent || /*#__PURE__*/
|
|
216
|
+
}, emptyContent || /*#__PURE__*/React__default.createElement(EmptyState, null))));
|
|
137
217
|
};
|
|
138
218
|
|
|
139
219
|
export { TableBody };
|