@semcore/data-table 16.0.0-prerelease.2 → 16.0.0-prerelease.21
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 +25 -1
- package/lib/cjs/components/Body/Body.js +439 -0
- package/lib/cjs/components/Body/Body.js.map +1 -0
- package/lib/cjs/components/Body/Body.types.js +2 -0
- package/lib/cjs/components/Body/Body.types.js.map +1 -0
- package/lib/cjs/components/Body/Cell.js +195 -0
- package/lib/cjs/components/Body/Cell.js.map +1 -0
- package/lib/cjs/components/Body/Cell.types.js +2 -0
- package/lib/cjs/components/Body/Cell.types.js.map +1 -0
- package/lib/cjs/components/Body/MergedCells.js +29 -0
- package/lib/cjs/components/Body/MergedCells.js.map +1 -0
- package/lib/cjs/components/Body/Row.js +252 -0
- package/lib/cjs/components/Body/Row.js.map +1 -0
- package/lib/cjs/components/Body/Row.types.js +4 -0
- package/lib/cjs/components/Body/Row.types.js.map +1 -0
- package/lib/cjs/components/Body/style.shadow.css +263 -0
- package/lib/cjs/components/DataTable/DataTable.js +1025 -0
- package/lib/cjs/components/DataTable/DataTable.js.map +1 -0
- package/lib/cjs/{types.js → components/DataTable/DataTable.types.js} +1 -1
- package/lib/cjs/components/DataTable/DataTable.types.js.map +1 -0
- package/lib/cjs/components/DataTable/dataTable.shadow.css +17 -0
- package/lib/cjs/components/Head/Column.js +311 -0
- package/lib/cjs/components/Head/Column.js.map +1 -0
- package/lib/cjs/components/Head/Column.types.js +2 -0
- package/lib/cjs/components/Head/Column.types.js.map +1 -0
- package/lib/cjs/components/Head/Group.js +116 -0
- package/lib/cjs/components/Head/Group.js.map +1 -0
- package/lib/cjs/components/Head/Group.type.js +2 -0
- package/lib/cjs/components/Head/Group.type.js.map +1 -0
- package/lib/cjs/components/Head/Head.js +207 -0
- package/lib/cjs/components/Head/Head.js.map +1 -0
- package/lib/cjs/components/Head/Head.types.js +2 -0
- package/lib/cjs/components/Head/Head.types.js.map +1 -0
- package/lib/cjs/components/Head/style.shadow.css +180 -0
- package/lib/cjs/index.js +25 -15
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/scroll-shadows.shadow.css +45 -5
- package/lib/cjs/translations/en.json +6 -1
- package/lib/es6/components/Body/Body.js +432 -0
- package/lib/es6/components/Body/Body.js.map +1 -0
- package/lib/es6/components/Body/Body.types.js +2 -0
- package/lib/es6/components/Body/Body.types.js.map +1 -0
- package/lib/es6/components/Body/Cell.js +188 -0
- package/lib/es6/components/Body/Cell.js.map +1 -0
- package/lib/es6/components/Body/Cell.types.js +2 -0
- package/lib/es6/components/Body/Cell.types.js.map +1 -0
- package/lib/es6/components/Body/MergedCells.js +20 -0
- package/lib/es6/components/Body/MergedCells.js.map +1 -0
- package/lib/es6/components/Body/Row.js +245 -0
- package/lib/es6/components/Body/Row.js.map +1 -0
- package/lib/es6/components/Body/Row.types.js +2 -0
- package/lib/es6/components/Body/Row.types.js.map +1 -0
- package/lib/es6/components/Body/style.shadow.css +263 -0
- package/lib/es6/components/DataTable/DataTable.js +1013 -0
- package/lib/es6/components/DataTable/DataTable.js.map +1 -0
- package/lib/es6/components/DataTable/DataTable.types.js +2 -0
- package/lib/es6/components/DataTable/DataTable.types.js.map +1 -0
- package/lib/es6/components/DataTable/dataTable.shadow.css +17 -0
- package/lib/es6/components/Head/Column.js +304 -0
- package/lib/es6/components/Head/Column.js.map +1 -0
- package/lib/es6/components/Head/Column.types.js +2 -0
- package/lib/es6/components/Head/Column.types.js.map +1 -0
- package/lib/es6/components/Head/Group.js +109 -0
- package/lib/es6/components/Head/Group.js.map +1 -0
- package/lib/es6/components/Head/Group.type.js +2 -0
- package/lib/es6/components/Head/Group.type.js.map +1 -0
- package/lib/es6/components/Head/Head.js +201 -0
- package/lib/es6/components/Head/Head.js.map +1 -0
- package/lib/es6/components/Head/Head.types.js +2 -0
- package/lib/es6/components/Head/Head.types.js.map +1 -0
- package/lib/es6/components/Head/style.shadow.css +180 -0
- package/lib/es6/index.js +5 -2
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/scroll-shadows.shadow.css +45 -5
- package/lib/es6/translations/en.json +6 -1
- package/lib/esm/components/Body/Body.mjs +394 -0
- package/lib/esm/components/Body/Cell.mjs +186 -0
- package/lib/esm/components/Body/MergedCells.mjs +23 -0
- package/lib/esm/components/Body/Row.mjs +224 -0
- package/lib/esm/components/Body/style.shadow.css +263 -0
- package/lib/esm/components/DataTable/DataTable.mjs +944 -0
- package/lib/esm/components/DataTable/dataTable.shadow.css +17 -0
- package/lib/esm/components/Head/Column.mjs +296 -0
- package/lib/esm/components/Head/Group.mjs +103 -0
- package/lib/esm/components/Head/Head.mjs +181 -0
- package/lib/esm/components/Head/style.shadow.css +180 -0
- package/lib/esm/index.mjs +9 -6
- package/lib/esm/style/scroll-shadows.shadow.css +47 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +5 -4
- package/lib/esm/translations/en.json.mjs +10 -4
- package/lib/esm/translations/es.json.mjs +5 -4
- package/lib/esm/translations/fr.json.mjs +5 -4
- package/lib/esm/translations/it.json.mjs +5 -4
- package/lib/esm/translations/ja.json.mjs +5 -4
- package/lib/esm/translations/ko.json.mjs +5 -4
- package/lib/esm/translations/nl.json.mjs +5 -4
- package/lib/esm/translations/pl.json.mjs +5 -4
- package/lib/esm/translations/pt.json.mjs +5 -4
- package/lib/esm/translations/sv.json.mjs +5 -4
- package/lib/esm/translations/tr.json.mjs +5 -4
- package/lib/esm/translations/vi.json.mjs +5 -4
- package/lib/esm/translations/zh.json.mjs +5 -4
- package/lib/types/components/Body/Body.d.ts +8 -0
- package/lib/types/components/Body/Body.types.d.ts +57 -0
- package/lib/types/components/Body/Cell.d.ts +3 -0
- package/lib/types/components/Body/Cell.types.d.ts +20 -0
- package/lib/types/components/Body/MergedCells.d.ts +14 -0
- package/lib/types/components/Body/Row.d.ts +3 -0
- package/lib/types/components/Body/Row.types.d.ts +43 -0
- package/lib/types/components/DataTable/DataTable.d.ts +13 -0
- package/lib/types/components/DataTable/DataTable.types.d.ts +125 -0
- package/lib/types/components/Head/Column.d.ts +30 -0
- package/lib/types/components/Head/Column.types.d.ts +71 -0
- package/lib/types/components/Head/Group.d.ts +15 -0
- package/lib/types/components/Head/Group.type.d.ts +16 -0
- package/lib/types/components/Head/Head.d.ts +98 -0
- package/lib/types/components/Head/Head.types.d.ts +40 -0
- package/lib/types/index.d.ts +10 -2
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +5 -0
- package/package.json +11 -6
- package/vite.config.ts +0 -3
- package/lib/cjs/Body.js +0 -475
- package/lib/cjs/Body.js.map +0 -1
- package/lib/cjs/DataTable.js +0 -622
- package/lib/cjs/DataTable.js.map +0 -1
- package/lib/cjs/Head.js +0 -399
- package/lib/cjs/Head.js.map +0 -1
- package/lib/cjs/style/data-table.shadow.css +0 -394
- package/lib/cjs/types.js.map +0 -1
- package/lib/cjs/utils.js +0 -57
- package/lib/cjs/utils.js.map +0 -1
- package/lib/es6/Body.js +0 -468
- package/lib/es6/Body.js.map +0 -1
- package/lib/es6/DataTable.js +0 -614
- package/lib/es6/DataTable.js.map +0 -1
- package/lib/es6/Head.js +0 -391
- package/lib/es6/Head.js.map +0 -1
- package/lib/es6/style/data-table.shadow.css +0 -394
- package/lib/es6/types.js +0 -2
- package/lib/es6/types.js.map +0 -1
- package/lib/es6/utils.js +0 -48
- package/lib/es6/utils.js.map +0 -1
- package/lib/esm/Body.mjs +0 -320
- package/lib/esm/DataTable.mjs +0 -439
- package/lib/esm/Head.mjs +0 -258
- package/lib/esm/utils.mjs +0 -37
- package/lib/types/Body.d.ts +0 -61
- package/lib/types/DataTable.d.ts +0 -205
- package/lib/types/Head.d.ts +0 -45
- package/lib/types/types.d.ts +0 -73
- package/lib/types/utils.d.ts +0 -4
package/lib/es6/DataTable.js
DELETED
|
@@ -1,614 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
import { sstyled as _sstyled } from "@semcore/core";
|
|
11
|
-
import { assignProps as _assignProps } from "@semcore/core";
|
|
12
|
-
var _excluded = ["children", "name", "fixed", "resizable", "sortable", "flex", "vBorders", "active"],
|
|
13
|
-
_excluded2 = ["name", "children"];
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import { createComponent, Component, Root, sstyled, lastInteraction } from '@semcore/core';
|
|
16
|
-
import { Box } from '@semcore/flex-box';
|
|
17
|
-
import syncScroll from '@semcore/core/lib/utils/syncScroll';
|
|
18
|
-
import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
|
|
19
|
-
import fire from '@semcore/core/lib/utils/fire';
|
|
20
|
-
import { flattenColumns } from './utils';
|
|
21
|
-
import Head from './Head';
|
|
22
|
-
import Body from './Body';
|
|
23
|
-
import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
24
|
-
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
25
|
-
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
26
|
-
/*__reshadow-styles__:"./style/data-table.shadow.css"*/
|
|
27
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SDataTable_zohi4_gg_,.___SHeadWrapper_zohi4_gg_{position:relative}.___SDataTable_zohi4_gg_.__compact_zohi4_gg_ .___SCell_zohi4_gg_,.___SDataTable_zohi4_gg_.__compact_zohi4_gg_ .___SColumn_zohi4_gg_{padding:var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-2x, 8px)}.___SHeadWrapper_zohi4_gg_.__animationsDisabled_zohi4_gg_ .___SColumn_zohi4_gg_{transition:none}.___SHeadWrapper_zohi4_gg_.__sticky_zohi4_gg_{position:sticky;top:0;z-index:2}.___SHead_zohi4_gg_{display:flex;position:relative;flex-direction:row;min-width:-moz-fit-content;min-width:fit-content;z-index:0}.___SColumn_zohi4_gg_{display:flex;align-items:flex-start;flex-grow:1;font-size:var(--intergalactic-fs-100, 12px);line-height:var(--intergalactic-lh-100, 133%);color:var(--intergalactic-text-primary, #191b23);box-sizing:border-box;position:relative;transition:width calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out,min-width calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out,max-width calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out}.___SColumn_zohi4_gg_.__hidden_zohi4_gg_{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border-width:0!important}.___SColumn_zohi4_gg_._use_primary_zohi4_gg_{padding:var(--intergalactic-spacing-3x, 12px);border-bottom:1px solid var(--intergalactic-border-secondary, #e0e1e9);background-color:var(--intergalactic-table-th-primary-cell, #f4f5f9)}.___SColumn_zohi4_gg_._use_secondary_zohi4_gg_{padding:var(--intergalactic-spacing-2x, 8px);border-bottom:1px solid var(--intergalactic-border-table-accent, #a9abb6);background-color:var(--intergalactic-table-th-secondary-cell, #ffffff)}.___SColumn_zohi4_gg_.__group_zohi4_gg_.__use_zohi4_gg_{display:flex;flex-wrap:wrap;flex-direction:column;align-items:normal;border-bottom:none;padding:0}.___SColumn_zohi4_gg_.__groupHead_zohi4_gg_{justify-content:center;z-index:1;border-bottom:none}.___SColumn_zohi4_gg_.__sortable_zohi4_gg_{cursor:pointer}.___SColumn_zohi4_gg_.__sortable_zohi4_gg_._use_primary_zohi4_gg_:focus{background-color:var(--intergalactic-table-th-primary-cell-hover, #e0e1e9)}@media (hover:hover){.___SColumn_zohi4_gg_.__sortable_zohi4_gg_._use_primary_zohi4_gg_:hover{background-color:var(--intergalactic-table-th-primary-cell-hover, #e0e1e9)}}.___SColumn_zohi4_gg_.__sortable_zohi4_gg_._justifyContent_right_zohi4_gg_:focus .___SSortWrapper_zohi4_gg_{position:absolute;flex-basis:0;right:var(--intergalactic-spacing-3x, 12px)}@media (hover:hover){.___SColumn_zohi4_gg_.__sortable_zohi4_gg_._justifyContent_right_zohi4_gg_:hover .___SSortWrapper_zohi4_gg_{position:absolute;flex-basis:0;right:var(--intergalactic-spacing-3x, 12px)}}.___SColumn_zohi4_gg_.__sortable_zohi4_gg_._justifyContent_right_zohi4_gg_.__active_zohi4_gg_ .___SSortWrapper_zohi4_gg_{position:relative;flex-basis:inherit;right:0}.___SColumn_zohi4_gg_.__sortable_zohi4_gg_.__active_zohi4_gg_ .___SSortWrapper_zohi4_gg_,.___SColumn_zohi4_gg_.__sortable_zohi4_gg_:focus .___SSortWrapper_zohi4_gg_{flex-basis:calc(var(--intergalactic-spacing-1x, 4px) + 16px);opacity:1}@media (hover:hover){.___SColumn_zohi4_gg_.__sortable_zohi4_gg_:hover .___SSortWrapper_zohi4_gg_{flex-basis:calc(var(--intergalactic-spacing-1x, 4px) + 16px);opacity:1}}.___SColumn_zohi4_gg_.__sortable_zohi4_gg_.__active_zohi4_gg_ .___SSortWrapper_zohi4_gg_:before,.___SColumn_zohi4_gg_.__sortable_zohi4_gg_:focus .___SSortIcon_zohi4_gg_,.___SColumn_zohi4_gg_.__sortable_zohi4_gg_:focus .___SSortWrapper_zohi4_gg_:before{display:block;opacity:1}@media (hover:hover){.___SColumn_zohi4_gg_.__sortable_zohi4_gg_:hover .___SSortWrapper_zohi4_gg_:before{display:block;opacity:1}}@media (hover:hover){.___SColumn_zohi4_gg_.__sortable_zohi4_gg_:hover .___SSortIcon_zohi4_gg_{display:block;opacity:1}}.___SColumn_zohi4_gg_._use_primary_zohi4_gg_.__active_zohi4_gg_{background-color:var(--intergalactic-table-th-primary-cell-active, #e0e1e9);width:100%}.___SColumn_zohi4_gg_.__active_zohi4_gg_ .___SSortIcon_zohi4_gg_{display:block;opacity:1}.___SColumn_zohi4_gg_.__resizable_zohi4_gg_{border-right:1px solid transparent}@media (hover:hover){.___SColumn_zohi4_gg_.__resizable_zohi4_gg_:hover:after{border-right-color:var(--intergalactic-border-table-accent, #a9abb6)}}.___SColumn_zohi4_gg_.__resizable_zohi4_gg_:after{content:\"\";position:absolute;bottom:0;right:-1px;height:100%;width:5px;background:0 0;cursor:col-resize;border-right:1px solid transparent}.___SColumn_zohi4_gg_.__fixed_zohi4_gg_{position:sticky;z-index:2}.___SCell_zohi4_gg_.__borderLeft_zohi4_gg_,.___SColumn_zohi4_gg_.__borderLeft_zohi4_gg_{border-left:1px solid var(--intergalactic-border-secondary, #e0e1e9)}.___SCell_zohi4_gg_.__borderRight_zohi4_gg_,.___SColumn_zohi4_gg_.__borderRight_zohi4_gg_{border-right:1px solid var(--intergalactic-border-secondary, #e0e1e9)}.___SSortWrapper_zohi4_gg_{flex-shrink:1;position:relative;flex-basis:0;min-height:16px;opacity:0;transition:all calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out}.___SSortIcon_zohi4_gg_,.___SSortWrapper_zohi4_gg_:before{display:none;position:absolute;right:0;opacity:0;transition:opacity .3s ease}.___SSortWrapper_zohi4_gg_:before{content:\"\";top:0;width:20px;height:100%}.___SSortIcon_zohi4_gg_{fill:var(--intergalactic-icon-secondary-neutral-hover-active, #878992);top:calc(1em*1.25 - 16px);margin-left:var(--intergalactic-spacing-1x, 4px)}.___SColumn_zohi4_gg_._use_primary_zohi4_gg_ .___SSortWrapper_zohi4_gg_:before{background:linear-gradient(270deg,var(--intergalactic-table-th-primary-cell-hover, #e0e1e9) 67.5%,rgba(224,225,233,0) 105%)}.___SColumn_zohi4_gg_._use_secondary_zohi4_gg_ .___SSortWrapper_zohi4_gg_:before{background:linear-gradient(270deg,var(--intergalactic-table-th-secondary-cell, #ffffff) 67.5%,rgba(255,255,255,0) 105%)}.___SBodyWrapper_zohi4_gg_{position:relative}.___SBody_zohi4_gg_{display:flex;flex-direction:column;position:relative;min-width:-moz-fit-content;min-width:fit-content}.___SRow_zohi4_gg_{display:flex;flex-direction:row;position:relative}.___SRow_zohi4_gg_.__active_zohi4_gg_>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_._theme_muted_zohi4_gg_.__active_zohi4_gg_>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-active, #e6e7ed)}@media (hover:hover){.___SRow_zohi4_gg_ .___SCell_zohi4_gg_:hover+.___SGroupCell_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_:hover>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-hover, #f0f0f4)}}.___SRow_zohi4_gg_._theme_muted_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-unread, #f4f5f9)}@media (hover:hover){.___SRow_zohi4_gg_._theme_muted_zohi4_gg_ .___SCell_zohi4_gg_:hover+.___SGroupCell_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_._theme_muted_zohi4_gg_:hover>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_:hover>.___SCell_zohi4_gg_._theme_muted_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-hover, #f0f0f4)}}.___SRow_zohi4_gg_._theme_info_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-selected, #e9f7ff)}.___SRow_zohi4_gg_._theme_info_zohi4_gg_.__active_zohi4_gg_>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-selected-active, #c4e5fe)}@media (hover:hover){.___SRow_zohi4_gg_._theme_info_zohi4_gg_ .___SCell_zohi4_gg_:hover+.___SGroupCell_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_._theme_info_zohi4_gg_:hover>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_:hover>.___SCell_zohi4_gg_._theme_info_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-selected-hover, #c4e5fe)}}.___SRow_zohi4_gg_._theme_success_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-new, #dbfee8)}.___SRow_zohi4_gg_._theme_success_zohi4_gg_.__active_zohi4_gg_>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-new-active, #9ef2c9)}@media (hover:hover){.___SRow_zohi4_gg_._theme_success_zohi4_gg_ .___SCell_zohi4_gg_:hover+.___SGroupCell_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_._theme_success_zohi4_gg_:hover>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_:hover>.___SCell_zohi4_gg_._theme_success_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-new-hover, #9ef2c9)}}.___SRow_zohi4_gg_._theme_warning_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-warning, #fff3d9)}.___SRow_zohi4_gg_._theme_warning_zohi4_gg_.__active_zohi4_gg_>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-warning-active, #ffdca2)}@media (hover:hover){.___SRow_zohi4_gg_._theme_warning_zohi4_gg_ .___SCell_zohi4_gg_:hover+.___SGroupCell_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_._theme_warning_zohi4_gg_:hover>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_:hover>.___SCell_zohi4_gg_._theme_warning_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-warning-hover, #ffdca2)}}.___SRow_zohi4_gg_._theme_danger_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-critical, #fff0f7)}.___SRow_zohi4_gg_._theme_danger_zohi4_gg_.__active_zohi4_gg_>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_){background-color:var(--intergalactic-table-td-cell-critical-active, #ffd7df)}@media (hover:hover){.___SRow_zohi4_gg_._theme_danger_zohi4_gg_ .___SCell_zohi4_gg_:hover+.___SGroupCell_zohi4_gg_ .___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_._theme_danger_zohi4_gg_:hover>.___SCell_zohi4_gg_:not(.__theme_zohi4_gg_),.___SRow_zohi4_gg_:hover>.___SCell_zohi4_gg_._theme_danger_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-critical-hover, #ffd7df)}}.___SRow_zohi4_gg_.__positioned_zohi4_gg_{position:absolute}.___SBody_zohi4_gg_.__animationsDisabled_zohi4_gg_ .___SCell_zohi4_gg_{transition:none}.___SCell_zohi4_gg_{display:flex;flex:1;flex-basis:auto;font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);color:var(--intergalactic-text-primary, #191b23);box-sizing:border-box;border-bottom:1px solid var(--intergalactic-border-secondary, #e0e1e9);overflow:hidden;white-space:nowrap;font-feature-settings:\"tnum\";font-variant-numeric:tabular-nums;transition:width calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out;outline:0}.___SCell_zohi4_gg_._use_primary_zohi4_gg_{padding:var(--intergalactic-spacing-3x, 12px);min-height:45px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SCell_zohi4_gg_._use_secondary_zohi4_gg_{padding:var(--intergalactic-spacing-2x, 8px);min-height:37px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SCell_zohi4_gg_.__fixed_zohi4_gg_{position:sticky;z-index:1}.___SCell_zohi4_gg_._theme_muted_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-unread, #f4f5f9)}.___SCell_zohi4_gg_._theme_info_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-selected, #e9f7ff)}.___SCell_zohi4_gg_._theme_success_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-new, #dbfee8)}.___SCell_zohi4_gg_._theme_warning_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-warning, #fff3d9)}.___SCell_zohi4_gg_._theme_danger_zohi4_gg_{background-color:var(--intergalactic-table-td-cell-critical, #fff0f7)}.___SHeightHold_zohi4_gg_{position:absolute;top:0;width:100%;pointer-events:none;z-index:-1}" /*__inner_css_end__*/, "zohi4_gg_") /*__reshadow_css_end__*/, {
|
|
28
|
-
"__SDataTable": "___SDataTable_zohi4_gg_",
|
|
29
|
-
"__SHeadWrapper": "___SHeadWrapper_zohi4_gg_",
|
|
30
|
-
"_sticky": "__sticky_zohi4_gg_",
|
|
31
|
-
"__SHead": "___SHead_zohi4_gg_",
|
|
32
|
-
"__SColumn": "___SColumn_zohi4_gg_",
|
|
33
|
-
"_hidden": "__hidden_zohi4_gg_",
|
|
34
|
-
"_use_primary": "_use_primary_zohi4_gg_",
|
|
35
|
-
"_use_secondary": "_use_secondary_zohi4_gg_",
|
|
36
|
-
"_group": "__group_zohi4_gg_",
|
|
37
|
-
"_use": "__use_zohi4_gg_",
|
|
38
|
-
"_groupHead": "__groupHead_zohi4_gg_",
|
|
39
|
-
"_active": "__active_zohi4_gg_",
|
|
40
|
-
"__SSortIcon": "___SSortIcon_zohi4_gg_",
|
|
41
|
-
"_fixed": "__fixed_zohi4_gg_",
|
|
42
|
-
"_borderLeft": "__borderLeft_zohi4_gg_",
|
|
43
|
-
"__SCell": "___SCell_zohi4_gg_",
|
|
44
|
-
"_borderRight": "__borderRight_zohi4_gg_",
|
|
45
|
-
"__SSortWrapper": "___SSortWrapper_zohi4_gg_",
|
|
46
|
-
"__SBodyWrapper": "___SBodyWrapper_zohi4_gg_",
|
|
47
|
-
"__SBody": "___SBody_zohi4_gg_",
|
|
48
|
-
"__SRow": "___SRow_zohi4_gg_",
|
|
49
|
-
"_theme": "__theme_zohi4_gg_",
|
|
50
|
-
"__SGroupCell": "___SGroupCell_zohi4_gg_",
|
|
51
|
-
"_theme_muted": "_theme_muted_zohi4_gg_",
|
|
52
|
-
"_theme_info": "_theme_info_zohi4_gg_",
|
|
53
|
-
"_theme_success": "_theme_success_zohi4_gg_",
|
|
54
|
-
"_theme_warning": "_theme_warning_zohi4_gg_",
|
|
55
|
-
"_theme_danger": "_theme_danger_zohi4_gg_",
|
|
56
|
-
"_positioned": "__positioned_zohi4_gg_",
|
|
57
|
-
"_animationsDisabled": "__animationsDisabled_zohi4_gg_",
|
|
58
|
-
"__SHeightHold": "___SHeightHold_zohi4_gg_",
|
|
59
|
-
"_compact": "__compact_zohi4_gg_",
|
|
60
|
-
"_sortable": "__sortable_zohi4_gg_",
|
|
61
|
-
"_justifyContent_right": "_justifyContent_right_zohi4_gg_",
|
|
62
|
-
"_resizable": "__resizable_zohi4_gg_"
|
|
63
|
-
});
|
|
64
|
-
import { isFocusInside } from '@semcore/core/lib/utils/use/useFocusLock';
|
|
65
|
-
import { hasFocusableIn } from '@semcore/core/lib/utils/use/useFocusLock';
|
|
66
|
-
var reversedSortDirection = {
|
|
67
|
-
desc: 'asc',
|
|
68
|
-
asc: 'desc'
|
|
69
|
-
};
|
|
70
|
-
var defaultSortDirection = 'desc';
|
|
71
|
-
var ROW_GROUP = Symbol('ROW_GROUP');
|
|
72
|
-
var cssVarReg = /[:;\W]/g;
|
|
73
|
-
var createCssVarForWidth = function createCssVarForWidth(name) {
|
|
74
|
-
return "--".concat(name.replace(cssVarReg, '_'), "_width");
|
|
75
|
-
};
|
|
76
|
-
function setBorderGroupColumns(columns, side) {
|
|
77
|
-
var firstColumn = columns[0];
|
|
78
|
-
var lastColumn = columns[columns.length - 1];
|
|
79
|
-
if (firstColumn && (!side || side === 'left')) {
|
|
80
|
-
firstColumn.borderLeft = true;
|
|
81
|
-
if (firstColumn.columns) {
|
|
82
|
-
setBorderGroupColumns(firstColumn.columns, 'left');
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (lastColumn && (!side || side === 'right')) {
|
|
86
|
-
lastColumn.borderRight = true;
|
|
87
|
-
if (lastColumn.columns) {
|
|
88
|
-
setBorderGroupColumns(lastColumn.columns, 'right');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
var RootDefinitionTable = /*#__PURE__*/function (_Component) {
|
|
93
|
-
_inherits(RootDefinitionTable, _Component);
|
|
94
|
-
var _super = _createSuper(RootDefinitionTable);
|
|
95
|
-
function RootDefinitionTable(props) {
|
|
96
|
-
var _this;
|
|
97
|
-
_classCallCheck(this, RootDefinitionTable);
|
|
98
|
-
_this = _super.call(this, props);
|
|
99
|
-
_defineProperty(_assertThisInitialized(_this), "focusedCell", [-1, -1]);
|
|
100
|
-
_defineProperty(_assertThisInitialized(_this), "columns", []);
|
|
101
|
-
_defineProperty(_assertThisInitialized(_this), "tableRef", /*#__PURE__*/React.createRef());
|
|
102
|
-
_defineProperty(_assertThisInitialized(_this), "scrollBodyRef", null);
|
|
103
|
-
_defineProperty(_assertThisInitialized(_this), "scrollHeadRef", null);
|
|
104
|
-
_defineProperty(_assertThisInitialized(_this), "handlerSortClick", function (name, event) {
|
|
105
|
-
var column = _this.columns.find(function (column) {
|
|
106
|
-
return column.name === name;
|
|
107
|
-
});
|
|
108
|
-
return fire(_assertThisInitialized(_this), 'onSortChange', [column.name, column.active ? reversedSortDirection[column.sortDirection] : column.sortDirection], event);
|
|
109
|
-
});
|
|
110
|
-
_defineProperty(_assertThisInitialized(_this), "handlerResize", function () {
|
|
111
|
-
_this.forceUpdate();
|
|
112
|
-
});
|
|
113
|
-
_defineProperty(_assertThisInitialized(_this), "scrollToUp", function () {
|
|
114
|
-
var _this$tableRef, _this$tableRef$curren;
|
|
115
|
-
(_this$tableRef = _this.tableRef) === null || _this$tableRef === void 0 ? void 0 : (_this$tableRef$curren = _this$tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.scrollIntoView({
|
|
116
|
-
block: 'nearest',
|
|
117
|
-
inline: 'nearest',
|
|
118
|
-
behavior: 'smooth'
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
_defineProperty(_assertThisInitialized(_this), "hasFocusableInHeader", function () {
|
|
122
|
-
var hasFocusable = _this.columns.some(function (column) {
|
|
123
|
-
var columnElement = column.props.ref.current;
|
|
124
|
-
return column.sortable || columnElement && hasFocusableIn(columnElement);
|
|
125
|
-
});
|
|
126
|
-
return hasFocusable;
|
|
127
|
-
});
|
|
128
|
-
_defineProperty(_assertThisInitialized(_this), "changeFocusCell", function (rowIndex, colIndex) {
|
|
129
|
-
var _this$tableRef$curren2, _this$tableRef$curren3;
|
|
130
|
-
var hasFocusable = _this.hasFocusableInHeader();
|
|
131
|
-
var maxCol = _this.columns.length - 1;
|
|
132
|
-
var maxRow = _this.totalRows;
|
|
133
|
-
var currentRow = (_this$tableRef$curren2 = _this.tableRef.current) === null || _this$tableRef$curren2 === void 0 ? void 0 : _this$tableRef$curren2.querySelector("[aria-rowindex=\"".concat(_this.focusedCell[0] + 1, "\"]"));
|
|
134
|
-
var headerRow = (_this$tableRef$curren3 = _this.tableRef.current) === null || _this$tableRef$curren3 === void 0 ? void 0 : _this$tableRef$curren3.querySelector('[aria-rowindex="1"]');
|
|
135
|
-
var headerCells = headerRow === null || headerRow === void 0 ? void 0 : headerRow.querySelectorAll('[role=columnheader]');
|
|
136
|
-
var currentCell = currentRow === null || currentRow === void 0 ? void 0 : currentRow.querySelectorAll('[role=gridcell]').item(_this.focusedCell[1]);
|
|
137
|
-
var currentHeaderCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(_this.focusedCell[1]);
|
|
138
|
-
var changed = true;
|
|
139
|
-
var newRow = _this.focusedCell[0] + rowIndex;
|
|
140
|
-
var newCol = _this.focusedCell[1] + colIndex;
|
|
141
|
-
if ((hasFocusable && newRow < 0 || !hasFocusable && newRow < 1 || newRow > maxRow) && newRow !== _this.focusedCell[0]) {
|
|
142
|
-
changed = false;
|
|
143
|
-
}
|
|
144
|
-
if ((newCol < 0 || newCol > maxCol) && newCol !== _this.focusedCell[1]) {
|
|
145
|
-
changed = false;
|
|
146
|
-
}
|
|
147
|
-
if (!changed) return;
|
|
148
|
-
_this.focusedCell = [newRow, newCol];
|
|
149
|
-
var row = _this.getRow(newRow);
|
|
150
|
-
var cell = row === null || row === void 0 ? void 0 : row.querySelectorAll('[role=gridcell], [role=columnheader]').item(newCol);
|
|
151
|
-
if (cell instanceof HTMLElement && currentCell !== cell) {
|
|
152
|
-
currentCell === null || currentCell === void 0 ? void 0 : currentCell.setAttribute('inert', '');
|
|
153
|
-
if (currentCell !== currentHeaderCell) {
|
|
154
|
-
currentCell === null || currentCell === void 0 ? void 0 : currentCell.removeAttribute('aria-describedby');
|
|
155
|
-
}
|
|
156
|
-
var headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
|
|
157
|
-
var describedBy = headerCell === null || headerCell === void 0 ? void 0 : headerCell.getAttribute('aria-describedby');
|
|
158
|
-
cell.removeAttribute('inert');
|
|
159
|
-
if (headerCell !== cell && describedBy) {
|
|
160
|
-
cell.setAttribute('aria-describedby', describedBy);
|
|
161
|
-
}
|
|
162
|
-
cell === null || cell === void 0 ? void 0 : cell.focus();
|
|
163
|
-
if (newRow !== 0) {
|
|
164
|
-
currentHeaderCell === null || currentHeaderCell === void 0 ? void 0 : currentHeaderCell.setAttribute('inert', '');
|
|
165
|
-
var _headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
|
|
166
|
-
_headerCell === null || _headerCell === void 0 ? void 0 : _headerCell.removeAttribute('inert');
|
|
167
|
-
}
|
|
168
|
-
} else if (currentCell === cell) {
|
|
169
|
-
_this.changeFocusCell(rowIndex, colIndex);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
|
|
173
|
-
switch (e.key) {
|
|
174
|
-
case 'Tab':
|
|
175
|
-
{
|
|
176
|
-
_this.setInert(true);
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
case 'ArrowLeft':
|
|
180
|
-
{
|
|
181
|
-
e.preventDefault();
|
|
182
|
-
_this.changeFocusCell(0, -1);
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
case 'ArrowRight':
|
|
186
|
-
{
|
|
187
|
-
e.preventDefault();
|
|
188
|
-
_this.changeFocusCell(0, 1);
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
case 'ArrowUp':
|
|
192
|
-
{
|
|
193
|
-
e.preventDefault();
|
|
194
|
-
_this.changeFocusCell(-1, 0);
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
case 'ArrowDown':
|
|
198
|
-
{
|
|
199
|
-
e.preventDefault();
|
|
200
|
-
_this.changeFocusCell(1, 0);
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
_defineProperty(_assertThisInitialized(_this), "initFocusableCell", function () {
|
|
206
|
-
var hasFocusable = _this.hasFocusableInHeader();
|
|
207
|
-
if (hasFocusable) {
|
|
208
|
-
_this.focusedCell = [0, 0];
|
|
209
|
-
} else {
|
|
210
|
-
_this.focusedCell = [1, 0];
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
_defineProperty(_assertThisInitialized(_this), "getRow", function (index) {
|
|
214
|
-
var _this$tableRef$curren4, _this$tableRef$curren5;
|
|
215
|
-
return index === 0 ? (_this$tableRef$curren4 = _this.tableRef.current) === null || _this$tableRef$curren4 === void 0 ? void 0 : _this$tableRef$curren4.querySelector('[role=row]') : (_this$tableRef$curren5 = _this.tableRef.current) === null || _this$tableRef$curren5 === void 0 ? void 0 : _this$tableRef$curren5.querySelector("[aria-rowindex=\"".concat(index + 1, "\"]"));
|
|
216
|
-
});
|
|
217
|
-
_defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
|
|
218
|
-
if ((!e.relatedTarget || !isFocusInside(e.currentTarget, e.relatedTarget)) && lastInteraction.isKeyboard()) {
|
|
219
|
-
var _row2;
|
|
220
|
-
if (_this.focusedCell[0] === -1 && _this.focusedCell[1] === -1) {
|
|
221
|
-
_this.initFocusableCell();
|
|
222
|
-
}
|
|
223
|
-
_this.setInert(true);
|
|
224
|
-
var _row = _this.getRow(_this.focusedCell[0]);
|
|
225
|
-
if (!_row) {
|
|
226
|
-
_this.initFocusableCell();
|
|
227
|
-
_row = _this.getRow(_this.focusedCell[0]);
|
|
228
|
-
}
|
|
229
|
-
var cell = (_row2 = _row) === null || _row2 === void 0 ? void 0 : _row2.querySelectorAll('[role=gridcell], [role=columnheader]').item(_this.focusedCell[1]);
|
|
230
|
-
cell === null || cell === void 0 ? void 0 : cell.removeAttribute('inert');
|
|
231
|
-
cell instanceof HTMLElement && cell.focus();
|
|
232
|
-
e.currentTarget.setAttribute('tabIndex', '-1');
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
_defineProperty(_assertThisInitialized(_this), "handleBlur", function (e) {
|
|
236
|
-
var relatedTarget = e.relatedTarget;
|
|
237
|
-
var tableElement = _this.tableRef.current;
|
|
238
|
-
if (tableElement && (!relatedTarget || !isFocusInside(tableElement, relatedTarget) || !lastInteraction.isKeyboard())) {
|
|
239
|
-
_this.setInert(false);
|
|
240
|
-
tableElement.setAttribute('tabIndex', '0');
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
_defineProperty(_assertThisInitialized(_this), "handleMouseMove", function () {
|
|
244
|
-
_this.setInert(false);
|
|
245
|
-
});
|
|
246
|
-
var createRef = syncScroll();
|
|
247
|
-
// first create body ref for master scroll
|
|
248
|
-
_this.scrollBodyRef = createRef('body');
|
|
249
|
-
_this.scrollHeadRef = createRef('head');
|
|
250
|
-
return _this;
|
|
251
|
-
}
|
|
252
|
-
_createClass(RootDefinitionTable, [{
|
|
253
|
-
key: "setVarStyle",
|
|
254
|
-
value: function setVarStyle(columns) {
|
|
255
|
-
var _this2 = this;
|
|
256
|
-
var animations = columns.flatMap(function (column) {
|
|
257
|
-
var _column$props$ref$cur, _column$props$ref$cur2;
|
|
258
|
-
return (_column$props$ref$cur = column.props.ref.current) === null || _column$props$ref$cur === void 0 ? void 0 : (_column$props$ref$cur2 = _column$props$ref$cur.getAnimations) === null || _column$props$ref$cur2 === void 0 ? void 0 : _column$props$ref$cur2.call(_column$props$ref$cur);
|
|
259
|
-
}).filter(function (a) {
|
|
260
|
-
return a !== undefined;
|
|
261
|
-
});
|
|
262
|
-
var animationPromise = Promise.resolve();
|
|
263
|
-
if (animations.length > 0) {
|
|
264
|
-
animationPromise = Promise.all(animations.map(function (animation) {
|
|
265
|
-
return animation.finished;
|
|
266
|
-
}));
|
|
267
|
-
}
|
|
268
|
-
animationPromise.then(function () {
|
|
269
|
-
var _iterator = _createForOfIteratorHelper(columns),
|
|
270
|
-
_step;
|
|
271
|
-
try {
|
|
272
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
273
|
-
var column = _step.value;
|
|
274
|
-
if (column.setVar) {
|
|
275
|
-
var _this2$tableRef$curre;
|
|
276
|
-
(_this2$tableRef$curre = _this2.tableRef.current) === null || _this2$tableRef$curre === void 0 ? void 0 : _this2$tableRef$curre.style.setProperty(column.varWidth, "".concat(column.width, "px"));
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
} catch (err) {
|
|
280
|
-
_iterator.e(err);
|
|
281
|
-
} finally {
|
|
282
|
-
_iterator.f();
|
|
283
|
-
}
|
|
284
|
-
})["catch"](function (err) {
|
|
285
|
-
console.error(err);
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
}, {
|
|
289
|
-
key: "childrenToColumns",
|
|
290
|
-
value: function childrenToColumns(children) {
|
|
291
|
-
var _this3 = this;
|
|
292
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
293
|
-
fixed: undefined
|
|
294
|
-
};
|
|
295
|
-
var sort = this.asProps.sort;
|
|
296
|
-
var columnsChildren = [];
|
|
297
|
-
React.Children.forEach(children, function (child) {
|
|
298
|
-
var _column$props;
|
|
299
|
-
if (! /*#__PURE__*/React.isValidElement(child)) return;
|
|
300
|
-
if (child.type !== DefinitionTable.Column) return;
|
|
301
|
-
var _ref3 = child.props,
|
|
302
|
-
children = _ref3.children,
|
|
303
|
-
name = _ref3.name,
|
|
304
|
-
_ref3$fixed = _ref3.fixed,
|
|
305
|
-
fixed = _ref3$fixed === void 0 ? options.fixed : _ref3$fixed,
|
|
306
|
-
resizable = _ref3.resizable,
|
|
307
|
-
sortable = _ref3.sortable,
|
|
308
|
-
flex = _ref3.flex,
|
|
309
|
-
vBorders = _ref3.vBorders,
|
|
310
|
-
active = _ref3.active,
|
|
311
|
-
props = _objectWithoutProperties(_ref3, _excluded);
|
|
312
|
-
var lastColumnChildren = columnsChildren[columnsChildren.length - 1];
|
|
313
|
-
var isGroup = !name;
|
|
314
|
-
var columns;
|
|
315
|
-
if (isGroup) {
|
|
316
|
-
columns = _this3.childrenToColumns(children, {
|
|
317
|
-
fixed: fixed
|
|
318
|
-
});
|
|
319
|
-
active = typeof active === 'boolean' ? active : columns.some(function (c) {
|
|
320
|
-
return c.active;
|
|
321
|
-
});
|
|
322
|
-
if (vBorders) {
|
|
323
|
-
setBorderGroupColumns(columns);
|
|
324
|
-
}
|
|
325
|
-
name = flattenColumns(columns).map(function (_ref4) {
|
|
326
|
-
var name = _ref4.name;
|
|
327
|
-
return name;
|
|
328
|
-
}).join('/');
|
|
329
|
-
if (!columns.length) return;
|
|
330
|
-
children = React.Children.toArray(children).filter(function (child) {
|
|
331
|
-
return !( /*#__PURE__*/React.isValidElement(child) && child.type === DefinitionTable.Column);
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
var column = _this3.columns.find(function (column) {
|
|
335
|
-
return column.name === name;
|
|
336
|
-
});
|
|
337
|
-
var columnChildren = {
|
|
338
|
-
get width() {
|
|
339
|
-
var _this$props$ref$curre;
|
|
340
|
-
// @ts-ignore
|
|
341
|
-
return ((_this$props$ref$curre = this.props.ref.current) === null || _this$props$ref$curre === void 0 ? void 0 : _this$props$ref$curre.getBoundingClientRect().width) || 0;
|
|
342
|
-
},
|
|
343
|
-
name: name,
|
|
344
|
-
varWidth: createCssVarForWidth(name),
|
|
345
|
-
setVar: flex !== 'inherit',
|
|
346
|
-
fixed: fixed,
|
|
347
|
-
resizable: resizable,
|
|
348
|
-
active: typeof active === 'boolean' ? active : sort[0] === name,
|
|
349
|
-
sortable: sortable,
|
|
350
|
-
borderLeft: (lastColumnChildren === null || lastColumnChildren === void 0 ? void 0 : lastColumnChildren.borderRight) === true ? false : vBorders,
|
|
351
|
-
borderRight: vBorders,
|
|
352
|
-
sortDirection: sort[0] === name ? sort[1] : (column === null || column === void 0 ? void 0 : column.sortDirection) || (typeof sortable === 'string' ? sortable : defaultSortDirection),
|
|
353
|
-
props: _objectSpread(_objectSpread({
|
|
354
|
-
name: name,
|
|
355
|
-
flex: flex === 'inherit' ? undefined : flex
|
|
356
|
-
}, props), {}, {
|
|
357
|
-
// @ts-ignore
|
|
358
|
-
forwardRef: child.ref,
|
|
359
|
-
children: children,
|
|
360
|
-
ref: (column === null || column === void 0 ? void 0 : (_column$props = column.props) === null || _column$props === void 0 ? void 0 : _column$props.ref) || /*#__PURE__*/React.createRef()
|
|
361
|
-
}),
|
|
362
|
-
parentColumns: []
|
|
363
|
-
};
|
|
364
|
-
if (columns) {
|
|
365
|
-
columnChildren.columns = columns;
|
|
366
|
-
columns.forEach(function (column) {
|
|
367
|
-
return column.parentColumns.unshift(columnChildren);
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
columnsChildren.push(columnChildren);
|
|
371
|
-
});
|
|
372
|
-
return columnsChildren;
|
|
373
|
-
}
|
|
374
|
-
}, {
|
|
375
|
-
key: "getHeadProps",
|
|
376
|
-
value: function getHeadProps(props) {
|
|
377
|
-
var _this$asProps = this.asProps,
|
|
378
|
-
use = _this$asProps.use,
|
|
379
|
-
uid = _this$asProps.uid,
|
|
380
|
-
getI18nText = _this$asProps.getI18nText;
|
|
381
|
-
var columnsChildren = this.childrenToColumns(props.children);
|
|
382
|
-
this.columns = flattenColumns(columnsChildren);
|
|
383
|
-
return {
|
|
384
|
-
$onSortClick: callAllEventHandlers(this.handlerSortClick, this.scrollToUp),
|
|
385
|
-
columnsChildren: columnsChildren,
|
|
386
|
-
use: use,
|
|
387
|
-
onResize: this.handlerResize,
|
|
388
|
-
$scrollRef: this.scrollHeadRef,
|
|
389
|
-
uid: uid,
|
|
390
|
-
getI18nText: getI18nText
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
}, {
|
|
394
|
-
key: "getBodyProps",
|
|
395
|
-
value: function getBodyProps(props) {
|
|
396
|
-
var _this$asProps2 = this.asProps,
|
|
397
|
-
data = _this$asProps2.data,
|
|
398
|
-
use = _this$asProps2.use,
|
|
399
|
-
uniqueKey = _this$asProps2.uniqueKey,
|
|
400
|
-
uid = _this$asProps2.uid;
|
|
401
|
-
var cellPropsLayers = {};
|
|
402
|
-
var rowPropsLayers = [];
|
|
403
|
-
React.Children.forEach(props.children, function (child) {
|
|
404
|
-
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
405
|
-
var _ref5 = child.props,
|
|
406
|
-
name = _ref5.name,
|
|
407
|
-
children = _ref5.children,
|
|
408
|
-
other = _objectWithoutProperties(_ref5, _excluded2);
|
|
409
|
-
if (child.type === DefinitionTable.Cell && name) {
|
|
410
|
-
name.split('/').forEach(function (name) {
|
|
411
|
-
cellPropsLayers[name] = cellPropsLayers[name] || [];
|
|
412
|
-
cellPropsLayers[name].push(_objectSpread(_objectSpread({}, other), {}, {
|
|
413
|
-
childrenPropsGetter: children
|
|
414
|
-
}));
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
if (child.type === DefinitionTable.Row) {
|
|
418
|
-
rowPropsLayers.push(_objectSpread(_objectSpread({}, other), {}, {
|
|
419
|
-
childrenPropsGetter: children
|
|
420
|
-
}));
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
return {
|
|
425
|
-
columns: this.columns,
|
|
426
|
-
rows: this.dataToRows(data, cellPropsLayers),
|
|
427
|
-
uniqueKey: uniqueKey,
|
|
428
|
-
use: use,
|
|
429
|
-
rowPropsLayers: rowPropsLayers,
|
|
430
|
-
$scrollRef: this.scrollBodyRef,
|
|
431
|
-
uid: uid
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
}, {
|
|
435
|
-
key: "dataToRows",
|
|
436
|
-
value: function dataToRows(data, cellPropsLayers) {
|
|
437
|
-
var _this4 = this;
|
|
438
|
-
var parseData = function parseData(data, exclude) {
|
|
439
|
-
return data.map(function (row) {
|
|
440
|
-
var groupByName = {};
|
|
441
|
-
var columnsWithoutRowGroup = {};
|
|
442
|
-
for (var rowKey in row) {
|
|
443
|
-
var columnNames = rowKey.split('/');
|
|
444
|
-
if (columnNames.length >= 2) {
|
|
445
|
-
var _iterator2 = _createForOfIteratorHelper(columnNames),
|
|
446
|
-
_step2;
|
|
447
|
-
try {
|
|
448
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
449
|
-
var column = _step2.value;
|
|
450
|
-
groupByName[column] = {
|
|
451
|
-
groupedColumns: columnNames,
|
|
452
|
-
groupData: row[rowKey]
|
|
453
|
-
};
|
|
454
|
-
columnsWithoutRowGroup[column] = true;
|
|
455
|
-
}
|
|
456
|
-
} catch (err) {
|
|
457
|
-
_iterator2.e(err);
|
|
458
|
-
} finally {
|
|
459
|
-
_iterator2.f();
|
|
460
|
-
}
|
|
461
|
-
} else {
|
|
462
|
-
columnsWithoutRowGroup[rowKey] = true;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
var rowsGroup = row[ROW_GROUP] || [];
|
|
466
|
-
var rowsGroupedNames = Object.fromEntries(rowsGroup.flatMap(function (subRow) {
|
|
467
|
-
return Object.keys(subRow);
|
|
468
|
-
}).flatMap(function (key) {
|
|
469
|
-
return key.split('/');
|
|
470
|
-
}).map(function (key) {
|
|
471
|
-
return [key, true];
|
|
472
|
-
}));
|
|
473
|
-
var isGroup = false;
|
|
474
|
-
var cells = _this4.columns.map(function (column) {
|
|
475
|
-
if (groupByName[column.name]) {
|
|
476
|
-
var _groupByName$column$n = groupByName[column.name],
|
|
477
|
-
groupedColumns = _groupByName$column$n.groupedColumns,
|
|
478
|
-
groupData = _groupByName$column$n.groupData;
|
|
479
|
-
if (groupedColumns[0] === column.name) {
|
|
480
|
-
return {
|
|
481
|
-
name: groupedColumns.join('/'),
|
|
482
|
-
cssVar: groupedColumns.map(createCssVarForWidth),
|
|
483
|
-
fixed: column.fixed,
|
|
484
|
-
data: groupData,
|
|
485
|
-
cellPropsLayers: cellPropsLayers[column.name] || []
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
} else if (column.name in row) {
|
|
489
|
-
return {
|
|
490
|
-
name: column.name,
|
|
491
|
-
cssVar: column.varWidth,
|
|
492
|
-
fixed: column.fixed,
|
|
493
|
-
data: row[column.name],
|
|
494
|
-
cellPropsLayers: cellPropsLayers[column.name] || []
|
|
495
|
-
};
|
|
496
|
-
} else if (!isGroup && rowsGroupedNames[column.name]) {
|
|
497
|
-
// TODO: make it work not only with first group
|
|
498
|
-
isGroup = true;
|
|
499
|
-
return parseData(rowsGroup, _objectSpread(_objectSpread({}, exclude), columnsWithoutRowGroup));
|
|
500
|
-
} else if (!exclude[column.name] && !rowsGroupedNames[column.name]) {
|
|
501
|
-
// add empty cell if it is not present in data
|
|
502
|
-
return {
|
|
503
|
-
name: column.name,
|
|
504
|
-
cssVar: column.varWidth,
|
|
505
|
-
fixed: column.fixed,
|
|
506
|
-
data: null,
|
|
507
|
-
cellPropsLayers: cellPropsLayers[column.name] || []
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
}).filter(function (column) {
|
|
511
|
-
return column;
|
|
512
|
-
}).map(function (column) {
|
|
513
|
-
return column;
|
|
514
|
-
});
|
|
515
|
-
cells.flatRowData = row;
|
|
516
|
-
return cells;
|
|
517
|
-
});
|
|
518
|
-
};
|
|
519
|
-
return parseData(data, {});
|
|
520
|
-
}
|
|
521
|
-
}, {
|
|
522
|
-
key: "componentDidMount",
|
|
523
|
-
value: function componentDidMount() {
|
|
524
|
-
this.setVarStyle(this.columns);
|
|
525
|
-
}
|
|
526
|
-
}, {
|
|
527
|
-
key: "componentDidUpdate",
|
|
528
|
-
value: function componentDidUpdate(prevProps) {
|
|
529
|
-
this.setVarStyle(this.columns);
|
|
530
|
-
if (prevProps.data !== this.props.data) {
|
|
531
|
-
var focusedRow = this.focusedCell[0];
|
|
532
|
-
var isFocusInHeader = focusedRow === 0 && this.hasFocusableInHeader();
|
|
533
|
-
if (this.tableRef.current && !isFocusInside(this.tableRef.current) && !isFocusInHeader) {
|
|
534
|
-
this.focusedCell = [-1, -1];
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}, {
|
|
539
|
-
key: "totalRows",
|
|
540
|
-
get: function get() {
|
|
541
|
-
var _this$asProps3 = this.asProps,
|
|
542
|
-
data = _this$asProps3.data,
|
|
543
|
-
totalRows = _this$asProps3.totalRows;
|
|
544
|
-
return totalRows !== null && totalRows !== void 0 ? totalRows : (data !== null && data !== void 0 ? data : []).length;
|
|
545
|
-
}
|
|
546
|
-
}, {
|
|
547
|
-
key: "setInert",
|
|
548
|
-
value: function setInert(value) {
|
|
549
|
-
var _this$tableRef$curren6;
|
|
550
|
-
var cells = (_this$tableRef$curren6 = this.tableRef.current) === null || _this$tableRef$curren6 === void 0 ? void 0 : _this$tableRef$curren6.querySelectorAll('[role=gridcell], [role=columnheader]');
|
|
551
|
-
cells === null || cells === void 0 ? void 0 : cells.forEach(function (cell) {
|
|
552
|
-
if (value === true) {
|
|
553
|
-
cell.setAttribute('inert', '');
|
|
554
|
-
} else {
|
|
555
|
-
cell.removeAttribute('inert');
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
}, {
|
|
560
|
-
key: "render",
|
|
561
|
-
value: function render() {
|
|
562
|
-
var _ref = this.asProps,
|
|
563
|
-
_ref2;
|
|
564
|
-
var SDataTable = Box;
|
|
565
|
-
var _this$asProps4 = this.asProps,
|
|
566
|
-
Children = _this$asProps4.Children,
|
|
567
|
-
styles = _this$asProps4.styles;
|
|
568
|
-
return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(SDataTable, _ref2.cn("SDataTable", _objectSpread({}, _assignProps({
|
|
569
|
-
"__excludeProps": ['data'],
|
|
570
|
-
"ref": this.tableRef,
|
|
571
|
-
"role": 'grid',
|
|
572
|
-
"onKeyDown": this.handleKeyDown,
|
|
573
|
-
"onMouseMove": this.handleMouseMove,
|
|
574
|
-
"tabIndex": 0,
|
|
575
|
-
"onFocus": this.handleFocus,
|
|
576
|
-
"onBlur": this.handleBlur,
|
|
577
|
-
"aria-rowcount": this.totalRows,
|
|
578
|
-
"aria-colcount": this.columns.length
|
|
579
|
-
}, _ref))), /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})));
|
|
580
|
-
}
|
|
581
|
-
}]);
|
|
582
|
-
return RootDefinitionTable;
|
|
583
|
-
}(Component);
|
|
584
|
-
_defineProperty(RootDefinitionTable, "displayName", 'DefinitionTable');
|
|
585
|
-
_defineProperty(RootDefinitionTable, "style", style);
|
|
586
|
-
_defineProperty(RootDefinitionTable, "enhance", [uniqueIDEnhancement(), i18nEnhance(localizedMessages)]);
|
|
587
|
-
_defineProperty(RootDefinitionTable, "defaultProps", {
|
|
588
|
-
use: 'primary',
|
|
589
|
-
uniqueKey: 'id',
|
|
590
|
-
sort: [],
|
|
591
|
-
data: []
|
|
592
|
-
});
|
|
593
|
-
function ComponentDefinition() {
|
|
594
|
-
return null;
|
|
595
|
-
}
|
|
596
|
-
var DefinitionTable = createComponent(RootDefinitionTable, {
|
|
597
|
-
Head: Head,
|
|
598
|
-
Body: Body,
|
|
599
|
-
Column: ComponentDefinition,
|
|
600
|
-
Cell: ComponentDefinition,
|
|
601
|
-
Row: ComponentDefinition
|
|
602
|
-
}, {});
|
|
603
|
-
export { ROW_GROUP };
|
|
604
|
-
export default DefinitionTable;
|
|
605
|
-
export var wrapDataTable = function wrapDataTable(wrapper) {
|
|
606
|
-
return wrapper;
|
|
607
|
-
};
|
|
608
|
-
export var wrapDataTableRow = function wrapDataTableRow(wrapper) {
|
|
609
|
-
return wrapper;
|
|
610
|
-
};
|
|
611
|
-
export var wrapDataTableCell = function wrapDataTableCell(wrapper) {
|
|
612
|
-
return wrapper;
|
|
613
|
-
};
|
|
614
|
-
//# sourceMappingURL=DataTable.js.map
|