@semcore/data-table 4.50.0 → 4.50.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 +6 -0
- package/lib/cjs/Body.js +6 -4
- package/lib/cjs/Body.js.map +1 -1
- package/lib/cjs/DataTable.js +39 -37
- package/lib/cjs/DataTable.js.map +1 -1
- package/lib/es6/Body.js +6 -4
- package/lib/es6/Body.js.map +1 -1
- package/lib/es6/DataTable.js +39 -37
- package/lib/es6/DataTable.js.map +1 -1
- package/lib/esm/Body.mjs +348 -238
- package/lib/esm/DataTable.mjs +483 -336
- package/lib/esm/Head.mjs +317 -206
- package/lib/esm/index.mjs +6 -6
- package/lib/esm/style/data-table.shadow.css +413 -0
- package/lib/esm/style/scroll-shadows.shadow.css +7 -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 +5 -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/esm/utils.mjs +44 -29
- package/package.json +5 -5
package/lib/esm/DataTable.mjs
CHANGED
|
@@ -1,442 +1,589 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { sstyled
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { Box
|
|
14
|
-
import
|
|
15
|
-
import { callAllEventHandlers
|
|
16
|
-
import
|
|
17
|
-
import { flattenColumns
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import { localizedMessages
|
|
22
|
-
import
|
|
23
|
-
import { hasFocusableIn
|
|
24
|
-
import
|
|
25
|
-
var
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
7
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
11
|
+
import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { Box } from "@semcore/flex-box";
|
|
14
|
+
import syncScroll from "@semcore/utils/lib/syncScroll";
|
|
15
|
+
import { callAllEventHandlers } from "@semcore/utils/lib/assignProps";
|
|
16
|
+
import fire from "@semcore/utils/lib/fire";
|
|
17
|
+
import { flattenColumns } from "./utils.mjs";
|
|
18
|
+
import Head from "./Head.mjs";
|
|
19
|
+
import Body from "./Body.mjs";
|
|
20
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
21
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
22
|
+
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
23
|
+
import { hasFocusableIn, isFocusInside } from "@semcore/utils/lib/use/useFocusLock";
|
|
24
|
+
import focusSourceEnhance from "@semcore/utils/lib/enhances/focusSourceEnhance";
|
|
25
|
+
var _excluded = ["children", "name", "fixed", "resizable", "sortable", "flex", "vBorders", "active"], _excluded2 = ["name", "children"];
|
|
26
|
+
/*!__reshadow-styles__:"./style/data-table.shadow.css"*/
|
|
27
|
+
var style = (
|
|
26
28
|
/*__reshadow_css_start__*/
|
|
27
|
-
(
|
|
29
|
+
(sstyled.insert(
|
|
28
30
|
/*__inner_css_start__*/
|
|
29
|
-
'.___SDataTable_1o36s_gg_,.___SHeadWrapper_1o36s_gg_{position:relative}.___SDataTable_1o36s_gg_.__compact_1o36s_gg_ .___SCell_1o36s_gg_,.___SDataTable_1o36s_gg_.__compact_1o36s_gg_ .___SColumn_1o36s_gg_{padding:var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-2x, 8px)}.___SHeadWrapper_1o36s_gg_.__animationsDisabled_1o36s_gg_ .___SColumn_1o36s_gg_{transition:none}.___SHeadWrapper_1o36s_gg_.__sticky_1o36s_gg_{position:sticky;top:0;z-index:2}.___SHead_1o36s_gg_{display:flex;position:relative;flex-direction:row;min-width:-moz-fit-content;min-width:fit-content;z-index:0}.___SColumn_1o36s_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_1o36s_gg_:focus-visible{outline:0;box-shadow:inset var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SColumn_1o36s_gg_.__hidden_1o36s_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_1o36s_gg_._use_primary_1o36s_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_1o36s_gg_._use_secondary_1o36s_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_1o36s_gg_.__group_1o36s_gg_.__use_1o36s_gg_{display:flex;flex-wrap:wrap;flex-direction:column;align-items:normal;border-bottom:none;padding:0}.___SColumn_1o36s_gg_.__groupHead_1o36s_gg_{justify-content:center;z-index:1;border-bottom:none}.___SColumn_1o36s_gg_.__sortable_1o36s_gg_{cursor:pointer}.___SColumn_1o36s_gg_.__sortable_1o36s_gg_._use_primary_1o36s_gg_:focus{background-color:var(--intergalactic-table-th-primary-cell-hover, #e0e1e9)}@media (hover:hover){.___SColumn_1o36s_gg_.__sortable_1o36s_gg_._use_primary_1o36s_gg_:hover{background-color:var(--intergalactic-table-th-primary-cell-hover, #e0e1e9)}}.___SColumn_1o36s_gg_.__sortable_1o36s_gg_._justifyContent_right_1o36s_gg_:focus .___SSortWrapper_1o36s_gg_{position:absolute;flex-basis:0;right:var(--intergalactic-spacing-3x, 12px)}@media (hover:hover){.___SColumn_1o36s_gg_.__sortable_1o36s_gg_._justifyContent_right_1o36s_gg_:hover .___SSortWrapper_1o36s_gg_{position:absolute;flex-basis:0;right:var(--intergalactic-spacing-3x, 12px)}}.___SColumn_1o36s_gg_.__sortable_1o36s_gg_._justifyContent_right_1o36s_gg_.__active_1o36s_gg_ .___SSortWrapper_1o36s_gg_{position:relative;flex-basis:inherit;right:0}.___SColumn_1o36s_gg_.__sortable_1o36s_gg_.__active_1o36s_gg_ .___SSortWrapper_1o36s_gg_,.___SColumn_1o36s_gg_.__sortable_1o36s_gg_:focus .___SSortWrapper_1o36s_gg_{flex-basis:calc(var(--intergalactic-spacing-1x, 4px) + 16px);opacity:1}@media (hover:hover){.___SColumn_1o36s_gg_.__sortable_1o36s_gg_:hover .___SSortWrapper_1o36s_gg_{flex-basis:calc(var(--intergalactic-spacing-1x, 4px) + 16px);opacity:1}}.___SColumn_1o36s_gg_.__sortable_1o36s_gg_.__active_1o36s_gg_ .___SSortWrapper_1o36s_gg_:before,.___SColumn_1o36s_gg_.__sortable_1o36s_gg_:focus .___SSortIcon_1o36s_gg_,.___SColumn_1o36s_gg_.__sortable_1o36s_gg_:focus .___SSortWrapper_1o36s_gg_:before{display:block;opacity:1}@media (hover:hover){.___SColumn_1o36s_gg_.__sortable_1o36s_gg_:hover .___SSortWrapper_1o36s_gg_:before{display:block;opacity:1}}@media (hover:hover){.___SColumn_1o36s_gg_.__sortable_1o36s_gg_:hover .___SSortIcon_1o36s_gg_{display:block;opacity:1}}.___SColumn_1o36s_gg_._use_primary_1o36s_gg_.__active_1o36s_gg_{background-color:var(--intergalactic-table-th-primary-cell-active, #e0e1e9);width:100%}.___SColumn_1o36s_gg_.__active_1o36s_gg_ .___SSortIcon_1o36s_gg_{display:block;opacity:1}.___SColumn_1o36s_gg_.__resizable_1o36s_gg_{border-right:1px solid transparent}@media (hover:hover){.___SColumn_1o36s_gg_.__resizable_1o36s_gg_:hover:after{border-right-color:var(--intergalactic-border-table-accent, #a9abb6)}}.___SColumn_1o36s_gg_.__resizable_1o36s_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_1o36s_gg_.__fixed_1o36s_gg_{position:sticky;z-index:2}.___SCell_1o36s_gg_.__borderLeft_1o36s_gg_,.___SColumn_1o36s_gg_.__borderLeft_1o36s_gg_{border-left:1px solid var(--intergalactic-border-secondary, #e0e1e9)}.___SCell_1o36s_gg_.__borderRight_1o36s_gg_,.___SColumn_1o36s_gg_.__borderRight_1o36s_gg_{border-right:1px solid var(--intergalactic-border-secondary, #e0e1e9)}.___SSortWrapper_1o36s_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_1o36s_gg_,.___SSortWrapper_1o36s_gg_:before{display:none;position:absolute;right:0;opacity:0;transition:opacity .3s ease}.___SSortWrapper_1o36s_gg_:before{content:"";top:0;width:20px;height:100%}.___SSortIcon_1o36s_gg_{fill:var(--intergalactic-icon-secondary-neutral-hover-active, #878992);top:calc(1em*1.25 - 16px);margin-left:var(--intergalactic-spacing-1x, 4px)}.___SColumn_1o36s_gg_._use_primary_1o36s_gg_ .___SSortWrapper_1o36s_gg_:before{background:linear-gradient(270deg,var(--intergalactic-table-th-primary-cell-hover, #e0e1e9) 67.5%,rgba(224,225,233,0) 105%)}.___SColumn_1o36s_gg_._use_secondary_1o36s_gg_ .___SSortWrapper_1o36s_gg_:before{background:linear-gradient(270deg,var(--intergalactic-table-th-secondary-cell, #ffffff) 67.5%,rgba(255,255,255,0) 105%)}.___SBodyWrapper_1o36s_gg_{position:relative}.___SBody_1o36s_gg_{display:flex;flex-direction:column;position:relative;min-width:-moz-fit-content;min-width:fit-content}.___SRow_1o36s_gg_{display:flex;flex-direction:row;position:relative}.___SRow_1o36s_gg_.__active_1o36s_gg_>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_._theme_muted_1o36s_gg_.__active_1o36s_gg_>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-active, #e6e7ed)}@media (hover:hover){.___SRow_1o36s_gg_ .___SCell_1o36s_gg_:hover+.___SGroupCell_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_:hover>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-hover, #f0f0f4)}}.___SRow_1o36s_gg_._theme_muted_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-unread, #f4f5f9)}@media (hover:hover){.___SRow_1o36s_gg_._theme_muted_1o36s_gg_ .___SCell_1o36s_gg_:hover+.___SGroupCell_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_._theme_muted_1o36s_gg_:hover>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_:hover>.___SCell_1o36s_gg_._theme_muted_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-hover, #f0f0f4)}}.___SRow_1o36s_gg_._theme_info_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-selected, #e9f7ff)}.___SRow_1o36s_gg_._theme_info_1o36s_gg_.__active_1o36s_gg_>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-selected-active, #c4e5fe)}@media (hover:hover){.___SRow_1o36s_gg_._theme_info_1o36s_gg_ .___SCell_1o36s_gg_:hover+.___SGroupCell_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_._theme_info_1o36s_gg_:hover>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_:hover>.___SCell_1o36s_gg_._theme_info_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-selected-hover, #c4e5fe)}}.___SRow_1o36s_gg_._theme_success_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-new, #dbfee8)}.___SRow_1o36s_gg_._theme_success_1o36s_gg_.__active_1o36s_gg_>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-new-active, #9ef2c9)}@media (hover:hover){.___SRow_1o36s_gg_._theme_success_1o36s_gg_ .___SCell_1o36s_gg_:hover+.___SGroupCell_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_._theme_success_1o36s_gg_:hover>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_:hover>.___SCell_1o36s_gg_._theme_success_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-new-hover, #9ef2c9)}}.___SRow_1o36s_gg_._theme_warning_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-warning, #fff3d9)}.___SRow_1o36s_gg_._theme_warning_1o36s_gg_.__active_1o36s_gg_>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-warning-active, #ffdca2)}@media (hover:hover){.___SRow_1o36s_gg_._theme_warning_1o36s_gg_ .___SCell_1o36s_gg_:hover+.___SGroupCell_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_._theme_warning_1o36s_gg_:hover>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_:hover>.___SCell_1o36s_gg_._theme_warning_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-warning-hover, #ffdca2)}}.___SRow_1o36s_gg_._theme_danger_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-critical, #fff0f7)}.___SRow_1o36s_gg_._theme_danger_1o36s_gg_.__active_1o36s_gg_>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_){background-color:var(--intergalactic-table-td-cell-critical-active, #ffd7df)}@media (hover:hover){.___SRow_1o36s_gg_._theme_danger_1o36s_gg_ .___SCell_1o36s_gg_:hover+.___SGroupCell_1o36s_gg_ .___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_._theme_danger_1o36s_gg_:hover>.___SCell_1o36s_gg_:not(.__theme_1o36s_gg_),.___SRow_1o36s_gg_:hover>.___SCell_1o36s_gg_._theme_danger_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-critical-hover, #ffd7df)}}.___SRow_1o36s_gg_.__positioned_1o36s_gg_{position:absolute}.___SBody_1o36s_gg_.__animationsDisabled_1o36s_gg_ .___SCell_1o36s_gg_{transition:none}.___SCell_1o36s_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_1o36s_gg_._use_primary_1o36s_gg_{padding:var(--intergalactic-spacing-3x, 12px);min-height:45px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SCell_1o36s_gg_._use_secondary_1o36s_gg_{padding:var(--intergalactic-spacing-2x, 8px);min-height:37px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SCell_1o36s_gg_.__fixed_1o36s_gg_{position:sticky;z-index:1}.___SCell_1o36s_gg_._theme_muted_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-unread, #f4f5f9)}.___SCell_1o36s_gg_._theme_info_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-selected, #e9f7ff)}.___SCell_1o36s_gg_._theme_success_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-new, #dbfee8)}.___SCell_1o36s_gg_._theme_warning_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-warning, #fff3d9)}.___SCell_1o36s_gg_._theme_danger_1o36s_gg_{background-color:var(--intergalactic-table-td-cell-critical, #fff0f7)}.___SCell_1o36s_gg_:focus-visible:not(.__fixed_1o36s_gg_){position:relative}.___SCell_1o36s_gg_:focus-visible::after{position:absolute;display:block;content:"";top:3px;right:3px;bottom:3px;left:3px;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));pointer-events:none}.___SHeightHold_1o36s_gg_{position:absolute;top:0;width:100%;pointer-events:none;z-index:-1}',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
31
|
+
'.___SDataTable_1471i_gg_,.___SHeadWrapper_1471i_gg_{position:relative}.___SDataTable_1471i_gg_.__compact_1471i_gg_ .___SCell_1471i_gg_,.___SDataTable_1471i_gg_.__compact_1471i_gg_ .___SColumn_1471i_gg_{padding:var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-2x, 8px)}.___SHeadWrapper_1471i_gg_.__animationsDisabled_1471i_gg_ .___SColumn_1471i_gg_{transition:none}.___SHeadWrapper_1471i_gg_.__sticky_1471i_gg_{position:sticky;top:0;z-index:2}.___SHead_1471i_gg_{display:flex;position:relative;flex-direction:row;min-width:-moz-fit-content;min-width:fit-content;z-index:0}.___SColumn_1471i_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_1471i_gg_:focus-visible{outline:0;box-shadow:inset var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SColumn_1471i_gg_.__hidden_1471i_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_1471i_gg_._use_primary_1471i_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_1471i_gg_._use_secondary_1471i_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_1471i_gg_.__group_1471i_gg_.__use_1471i_gg_{display:flex;flex-wrap:wrap;flex-direction:column;align-items:normal;border-bottom:none;padding:0}.___SColumn_1471i_gg_.__groupHead_1471i_gg_{justify-content:center;z-index:1;border-bottom:none}.___SColumn_1471i_gg_.__sortable_1471i_gg_{cursor:pointer}.___SColumn_1471i_gg_.__sortable_1471i_gg_._use_primary_1471i_gg_:focus{background-color:var(--intergalactic-table-th-primary-cell-hover, #e0e1e9)}@media (hover:hover){.___SColumn_1471i_gg_.__sortable_1471i_gg_._use_primary_1471i_gg_:hover{background-color:var(--intergalactic-table-th-primary-cell-hover, #e0e1e9)}}.___SColumn_1471i_gg_.__sortable_1471i_gg_._justifyContent_right_1471i_gg_:focus .___SSortWrapper_1471i_gg_{position:absolute;flex-basis:0;right:var(--intergalactic-spacing-3x, 12px)}@media (hover:hover){.___SColumn_1471i_gg_.__sortable_1471i_gg_._justifyContent_right_1471i_gg_:hover .___SSortWrapper_1471i_gg_{position:absolute;flex-basis:0;right:var(--intergalactic-spacing-3x, 12px)}}.___SColumn_1471i_gg_.__sortable_1471i_gg_._justifyContent_right_1471i_gg_.__active_1471i_gg_ .___SSortWrapper_1471i_gg_{position:relative;flex-basis:inherit;right:0}.___SColumn_1471i_gg_.__sortable_1471i_gg_.__active_1471i_gg_ .___SSortWrapper_1471i_gg_,.___SColumn_1471i_gg_.__sortable_1471i_gg_:focus .___SSortWrapper_1471i_gg_{flex-basis:calc(var(--intergalactic-spacing-1x, 4px) + 16px);opacity:1}@media (hover:hover){.___SColumn_1471i_gg_.__sortable_1471i_gg_:hover .___SSortWrapper_1471i_gg_{flex-basis:calc(var(--intergalactic-spacing-1x, 4px) + 16px);opacity:1}}.___SColumn_1471i_gg_.__sortable_1471i_gg_.__active_1471i_gg_ .___SSortWrapper_1471i_gg_:before,.___SColumn_1471i_gg_.__sortable_1471i_gg_:focus .___SSortIcon_1471i_gg_,.___SColumn_1471i_gg_.__sortable_1471i_gg_:focus .___SSortWrapper_1471i_gg_:before{display:block;opacity:1}@media (hover:hover){.___SColumn_1471i_gg_.__sortable_1471i_gg_:hover .___SSortWrapper_1471i_gg_:before{display:block;opacity:1}}@media (hover:hover){.___SColumn_1471i_gg_.__sortable_1471i_gg_:hover .___SSortIcon_1471i_gg_{display:block;opacity:1}}.___SColumn_1471i_gg_._use_primary_1471i_gg_.__active_1471i_gg_{background-color:var(--intergalactic-table-th-primary-cell-active, #e0e1e9);width:100%}.___SColumn_1471i_gg_.__active_1471i_gg_ .___SSortIcon_1471i_gg_{display:block;opacity:1}.___SColumn_1471i_gg_.__resizable_1471i_gg_{border-right:1px solid transparent}@media (hover:hover){.___SColumn_1471i_gg_.__resizable_1471i_gg_:hover:after{border-right-color:var(--intergalactic-border-table-accent, #a9abb6)}}.___SColumn_1471i_gg_.__resizable_1471i_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_1471i_gg_.__fixed_1471i_gg_{position:sticky;z-index:2}.___SCell_1471i_gg_.__borderLeft_1471i_gg_,.___SColumn_1471i_gg_.__borderLeft_1471i_gg_{border-left:1px solid var(--intergalactic-border-secondary, #e0e1e9)}.___SCell_1471i_gg_.__borderRight_1471i_gg_,.___SColumn_1471i_gg_.__borderRight_1471i_gg_{border-right:1px solid var(--intergalactic-border-secondary, #e0e1e9)}.___SSortWrapper_1471i_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_1471i_gg_,.___SSortWrapper_1471i_gg_:before{display:none;position:absolute;right:0;opacity:0;transition:opacity .3s ease}.___SSortWrapper_1471i_gg_:before{content:"";top:0;width:20px;height:100%}.___SSortIcon_1471i_gg_{fill:var(--intergalactic-icon-secondary-neutral-hover-active, #878992);top:calc(1em*1.25 - 16px);margin-left:var(--intergalactic-spacing-1x, 4px)}.___SColumn_1471i_gg_._use_primary_1471i_gg_ .___SSortWrapper_1471i_gg_:before{background:linear-gradient(270deg,var(--intergalactic-table-th-primary-cell-hover, #e0e1e9) 67.5%,rgba(224,225,233,0) 105%)}.___SColumn_1471i_gg_._use_secondary_1471i_gg_ .___SSortWrapper_1471i_gg_:before{background:linear-gradient(270deg,var(--intergalactic-table-th-secondary-cell, #ffffff) 67.5%,rgba(255,255,255,0) 105%)}.___SBodyWrapper_1471i_gg_{position:relative}.___SBody_1471i_gg_{display:flex;flex-direction:column;position:relative;min-width:-moz-fit-content;min-width:fit-content}.___SRow_1471i_gg_{display:flex;flex-direction:row;position:relative}.___SRow_1471i_gg_.__active_1471i_gg_>.___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_._theme_muted_1471i_gg_.__active_1471i_gg_>.___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-active, #e6e7ed)}@media (hover:hover){.___SRow_1471i_gg_ .___SCell_1471i_gg_:hover+.___SGroupCell_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_:hover>.___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-hover, #f0f0f4)}}.___SRow_1471i_gg_._theme_muted_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-unread, #f4f5f9)}@media (hover:hover){.___SRow_1471i_gg_._theme_muted_1471i_gg_ .___SCell_1471i_gg_:hover+.___SGroupCell_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_._theme_muted_1471i_gg_:hover>.___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_:hover>.___SCell_1471i_gg_._theme_muted_1471i_gg_{background-color:var(--intergalactic-table-td-cell-hover, #f0f0f4)}}.___SRow_1471i_gg_._theme_info_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-selected, #e9f7ff)}.___SRow_1471i_gg_._theme_info_1471i_gg_.__active_1471i_gg_>.___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-selected-active, #c4e5fe)}@media (hover:hover){.___SRow_1471i_gg_._theme_info_1471i_gg_ .___SCell_1471i_gg_:hover+.___SGroupCell_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_._theme_info_1471i_gg_:hover>.___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_:hover>.___SCell_1471i_gg_._theme_info_1471i_gg_{background-color:var(--intergalactic-table-td-cell-selected-hover, #c4e5fe)}}.___SRow_1471i_gg_._theme_success_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-new, #dbfee8)}.___SRow_1471i_gg_._theme_success_1471i_gg_.__active_1471i_gg_>.___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-new-active, #9ef2c9)}@media (hover:hover){.___SRow_1471i_gg_._theme_success_1471i_gg_ .___SCell_1471i_gg_:hover+.___SGroupCell_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_._theme_success_1471i_gg_:hover>.___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_:hover>.___SCell_1471i_gg_._theme_success_1471i_gg_{background-color:var(--intergalactic-table-td-cell-new-hover, #9ef2c9)}}.___SRow_1471i_gg_._theme_warning_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-warning, #fff3d9)}.___SRow_1471i_gg_._theme_warning_1471i_gg_.__active_1471i_gg_>.___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-warning-active, #ffdca2)}@media (hover:hover){.___SRow_1471i_gg_._theme_warning_1471i_gg_ .___SCell_1471i_gg_:hover+.___SGroupCell_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_._theme_warning_1471i_gg_:hover>.___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_:hover>.___SCell_1471i_gg_._theme_warning_1471i_gg_{background-color:var(--intergalactic-table-td-cell-warning-hover, #ffdca2)}}.___SRow_1471i_gg_._theme_danger_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-critical, #fff0f7)}.___SRow_1471i_gg_._theme_danger_1471i_gg_.__active_1471i_gg_>.___SCell_1471i_gg_:not(.__theme_1471i_gg_){background-color:var(--intergalactic-table-td-cell-critical-active, #ffd7df)}@media (hover:hover){.___SRow_1471i_gg_._theme_danger_1471i_gg_ .___SCell_1471i_gg_:hover+.___SGroupCell_1471i_gg_ .___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_._theme_danger_1471i_gg_:hover>.___SCell_1471i_gg_:not(.__theme_1471i_gg_),.___SRow_1471i_gg_:hover>.___SCell_1471i_gg_._theme_danger_1471i_gg_{background-color:var(--intergalactic-table-td-cell-critical-hover, #ffd7df)}}.___SRow_1471i_gg_.__positioned_1471i_gg_{position:absolute}.___SBody_1471i_gg_.__animationsDisabled_1471i_gg_ .___SCell_1471i_gg_{transition:none}.___SCell_1471i_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_1471i_gg_._use_primary_1471i_gg_{padding:var(--intergalactic-spacing-3x, 12px);min-height:45px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SCell_1471i_gg_._use_secondary_1471i_gg_{padding:var(--intergalactic-spacing-2x, 8px);min-height:37px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SCell_1471i_gg_.__fixed_1471i_gg_{position:sticky;z-index:1}.___SCell_1471i_gg_._theme_muted_1471i_gg_{background-color:var(--intergalactic-table-td-cell-unread, #f4f5f9)}.___SCell_1471i_gg_._theme_info_1471i_gg_{background-color:var(--intergalactic-table-td-cell-selected, #e9f7ff)}.___SCell_1471i_gg_._theme_success_1471i_gg_{background-color:var(--intergalactic-table-td-cell-new, #dbfee8)}.___SCell_1471i_gg_._theme_warning_1471i_gg_{background-color:var(--intergalactic-table-td-cell-warning, #fff3d9)}.___SCell_1471i_gg_._theme_danger_1471i_gg_{background-color:var(--intergalactic-table-td-cell-critical, #fff0f7)}.___SCell_1471i_gg_:focus-visible:not(.__fixed_1471i_gg_){position:relative}.___SCell_1471i_gg_:focus-visible::after{position:absolute;display:block;content:"";top:3px;right:3px;bottom:3px;left:3px;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));pointer-events:none}.___SHeightHold_1471i_gg_{position:absolute;top:0;width:100%;pointer-events:none;z-index:-1}',
|
|
32
|
+
/*__inner_css_end__*/
|
|
33
|
+
"1471i_gg_"
|
|
34
|
+
), /*__reshadow_css_end__*/
|
|
35
|
+
{
|
|
36
|
+
"__SDataTable": "___SDataTable_1471i_gg_",
|
|
37
|
+
"__SHeadWrapper": "___SHeadWrapper_1471i_gg_",
|
|
38
|
+
"_sticky": "__sticky_1471i_gg_",
|
|
39
|
+
"__SHead": "___SHead_1471i_gg_",
|
|
40
|
+
"__SColumn": "___SColumn_1471i_gg_",
|
|
41
|
+
"_hidden": "__hidden_1471i_gg_",
|
|
42
|
+
"_use_primary": "_use_primary_1471i_gg_",
|
|
43
|
+
"_use_secondary": "_use_secondary_1471i_gg_",
|
|
44
|
+
"_group": "__group_1471i_gg_",
|
|
45
|
+
"_use": "__use_1471i_gg_",
|
|
46
|
+
"_groupHead": "__groupHead_1471i_gg_",
|
|
47
|
+
"_active": "__active_1471i_gg_",
|
|
48
|
+
"__SSortIcon": "___SSortIcon_1471i_gg_",
|
|
49
|
+
"_fixed": "__fixed_1471i_gg_",
|
|
50
|
+
"_borderLeft": "__borderLeft_1471i_gg_",
|
|
51
|
+
"__SCell": "___SCell_1471i_gg_",
|
|
52
|
+
"_borderRight": "__borderRight_1471i_gg_",
|
|
53
|
+
"__SSortWrapper": "___SSortWrapper_1471i_gg_",
|
|
54
|
+
"__SBodyWrapper": "___SBodyWrapper_1471i_gg_",
|
|
55
|
+
"__SBody": "___SBody_1471i_gg_",
|
|
56
|
+
"__SRow": "___SRow_1471i_gg_",
|
|
57
|
+
"_theme": "__theme_1471i_gg_",
|
|
58
|
+
"__SGroupCell": "___SGroupCell_1471i_gg_",
|
|
59
|
+
"_theme_muted": "_theme_muted_1471i_gg_",
|
|
60
|
+
"_theme_info": "_theme_info_1471i_gg_",
|
|
61
|
+
"_theme_success": "_theme_success_1471i_gg_",
|
|
62
|
+
"_theme_warning": "_theme_warning_1471i_gg_",
|
|
63
|
+
"_theme_danger": "_theme_danger_1471i_gg_",
|
|
64
|
+
"_positioned": "__positioned_1471i_gg_",
|
|
65
|
+
"_animationsDisabled": "__animationsDisabled_1471i_gg_",
|
|
66
|
+
"__SHeightHold": "___SHeightHold_1471i_gg_",
|
|
67
|
+
"_compact": "__compact_1471i_gg_",
|
|
68
|
+
"_sortable": "__sortable_1471i_gg_",
|
|
69
|
+
"_justifyContent_right": "_justifyContent_right_1471i_gg_",
|
|
70
|
+
"_resizable": "__resizable_1471i_gg_"
|
|
67
71
|
})
|
|
68
|
-
)
|
|
72
|
+
);
|
|
73
|
+
var reversedSortDirection = {
|
|
69
74
|
desc: "asc",
|
|
70
75
|
asc: "desc"
|
|
71
|
-
}, d_ = "desc", u_ = Symbol("ROW_GROUP"), f_ = /[:;\W]/g, V = function(b) {
|
|
72
|
-
return "--".concat(b.replace(f_, "_"), "_width");
|
|
73
76
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
var defaultSortDirection = "desc";
|
|
78
|
+
var ROW_GROUP = Symbol("ROW_GROUP");
|
|
79
|
+
var cssVarReg = /[:;\W]/g;
|
|
80
|
+
var createCssVarForWidth = function createCssVarForWidth2(name) {
|
|
81
|
+
return "--".concat(name.replace(cssVarReg, "_"), "_width");
|
|
82
|
+
};
|
|
83
|
+
function setBorderGroupColumns(columns, side) {
|
|
84
|
+
var firstColumn = columns[0];
|
|
85
|
+
var lastColumn = columns[columns.length - 1];
|
|
86
|
+
if (firstColumn && (!side || side === "left")) {
|
|
87
|
+
firstColumn.borderLeft = true;
|
|
88
|
+
if (firstColumn.columns) {
|
|
89
|
+
setBorderGroupColumns(firstColumn.columns, "left");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (lastColumn && (!side || side === "right")) {
|
|
93
|
+
lastColumn.borderRight = true;
|
|
94
|
+
if (lastColumn.columns) {
|
|
95
|
+
setBorderGroupColumns(lastColumn.columns, "right");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
77
98
|
}
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
var
|
|
81
|
-
function
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
99
|
+
var RootDefinitionTable = /* @__PURE__ */ function(_Component) {
|
|
100
|
+
_inherits(RootDefinitionTable2, _Component);
|
|
101
|
+
var _super = _createSuper(RootDefinitionTable2);
|
|
102
|
+
function RootDefinitionTable2(props) {
|
|
103
|
+
var _this;
|
|
104
|
+
_classCallCheck(this, RootDefinitionTable2);
|
|
105
|
+
_this = _super.call(this, props);
|
|
106
|
+
_defineProperty(_assertThisInitialized(_this), "focusedCell", [-1, -1]);
|
|
107
|
+
_defineProperty(_assertThisInitialized(_this), "columns", []);
|
|
108
|
+
_defineProperty(_assertThisInitialized(_this), "tableRef", /* @__PURE__ */ React.createRef());
|
|
109
|
+
_defineProperty(_assertThisInitialized(_this), "scrollBodyRef", null);
|
|
110
|
+
_defineProperty(_assertThisInitialized(_this), "scrollHeadRef", null);
|
|
111
|
+
_defineProperty(_assertThisInitialized(_this), "handlerSortClick", function(name, event) {
|
|
112
|
+
var column = _this.columns.find(function(column2) {
|
|
113
|
+
return column2.name === name;
|
|
86
114
|
});
|
|
87
|
-
return
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
115
|
+
return fire(_assertThisInitialized(_this), "onSortChange", [column.name, column.active ? reversedSortDirection[column.sortDirection] : column.sortDirection], event);
|
|
116
|
+
});
|
|
117
|
+
_defineProperty(_assertThisInitialized(_this), "handlerResize", function() {
|
|
118
|
+
_this.forceUpdate();
|
|
119
|
+
});
|
|
120
|
+
_defineProperty(_assertThisInitialized(_this), "scrollToUp", function() {
|
|
121
|
+
var _this$tableRef, _this$tableRef$curren;
|
|
122
|
+
(_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({
|
|
93
123
|
block: "nearest",
|
|
94
124
|
inline: "nearest",
|
|
95
125
|
behavior: "smooth"
|
|
96
126
|
});
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
127
|
+
});
|
|
128
|
+
_defineProperty(_assertThisInitialized(_this), "hasFocusableInHeader", function() {
|
|
129
|
+
var hasFocusable = _this.columns.some(function(column) {
|
|
130
|
+
var columnElement = column.props.ref.current;
|
|
131
|
+
return column.sortable || columnElement && hasFocusableIn(columnElement);
|
|
101
132
|
});
|
|
102
|
-
return
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
133
|
+
return hasFocusable;
|
|
134
|
+
});
|
|
135
|
+
_defineProperty(_assertThisInitialized(_this), "changeFocusCell", function(rowIndex, colIndex) {
|
|
136
|
+
var _this$tableRef$curren2, _this$tableRef$curren3;
|
|
137
|
+
var hasFocusable = _this.hasFocusableInHeader();
|
|
138
|
+
var maxCol = _this.columns.length - 1;
|
|
139
|
+
var maxRow = _this.totalRows;
|
|
140
|
+
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, '"]'));
|
|
141
|
+
var headerRow = (_this$tableRef$curren3 = _this.tableRef.current) === null || _this$tableRef$curren3 === void 0 ? void 0 : _this$tableRef$curren3.querySelector('[aria-rowindex="1"]');
|
|
142
|
+
var headerCells = headerRow === null || headerRow === void 0 ? void 0 : headerRow.querySelectorAll("[role=columnheader]");
|
|
143
|
+
var currentCell = currentRow === null || currentRow === void 0 ? void 0 : currentRow.querySelectorAll("[role=gridcell]").item(_this.focusedCell[1]);
|
|
144
|
+
var currentHeaderCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(_this.focusedCell[1]);
|
|
145
|
+
var changed = true;
|
|
146
|
+
var newRow = _this.focusedCell[0] + rowIndex;
|
|
147
|
+
var newCol = _this.focusedCell[1] + colIndex;
|
|
148
|
+
if ((hasFocusable && newRow < 0 || !hasFocusable && newRow < 1 || newRow > maxRow) && newRow !== _this.focusedCell[0]) {
|
|
149
|
+
changed = false;
|
|
150
|
+
}
|
|
151
|
+
if ((newCol < 0 || newCol > maxCol) && newCol !== _this.focusedCell[1]) {
|
|
152
|
+
changed = false;
|
|
153
|
+
}
|
|
154
|
+
if (!changed) return;
|
|
155
|
+
_this.focusedCell = [newRow, newCol];
|
|
156
|
+
var row = _this.getRow(newRow);
|
|
157
|
+
var cell = row === null || row === void 0 ? void 0 : row.querySelectorAll("[role=gridcell], [role=columnheader]").item(newCol);
|
|
158
|
+
if (cell instanceof HTMLElement && currentCell !== cell) {
|
|
159
|
+
currentCell === null || currentCell === void 0 ? void 0 : currentCell.setAttribute("inert", "");
|
|
160
|
+
if (currentCell !== currentHeaderCell) {
|
|
161
|
+
currentCell === null || currentCell === void 0 ? void 0 : currentCell.removeAttribute("aria-describedby");
|
|
162
|
+
}
|
|
163
|
+
var headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
|
|
164
|
+
var describedBy = headerCell === null || headerCell === void 0 ? void 0 : headerCell.getAttribute("aria-describedby");
|
|
165
|
+
cell.removeAttribute("inert");
|
|
166
|
+
if (headerCell !== cell && describedBy) {
|
|
167
|
+
cell.setAttribute("aria-describedby", describedBy);
|
|
168
|
+
}
|
|
169
|
+
cell === null || cell === void 0 ? void 0 : cell.focus();
|
|
170
|
+
if (newRow !== 0) {
|
|
171
|
+
currentHeaderCell === null || currentHeaderCell === void 0 ? void 0 : currentHeaderCell.setAttribute("inert", "");
|
|
172
|
+
var _headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
|
|
173
|
+
_headerCell === null || _headerCell === void 0 ? void 0 : _headerCell.removeAttribute("inert");
|
|
174
|
+
}
|
|
175
|
+
} else if (currentCell === cell) {
|
|
176
|
+
_this.changeFocusCell(rowIndex, colIndex);
|
|
117
177
|
}
|
|
118
|
-
})
|
|
178
|
+
});
|
|
179
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function(e) {
|
|
119
180
|
switch (e.key) {
|
|
120
181
|
case "Tab": {
|
|
121
|
-
|
|
182
|
+
_this.setInert(true);
|
|
122
183
|
break;
|
|
123
184
|
}
|
|
124
185
|
case "ArrowLeft": {
|
|
125
|
-
e.preventDefault()
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
_this.changeFocusCell(0, -1);
|
|
126
188
|
break;
|
|
127
189
|
}
|
|
128
190
|
case "ArrowRight": {
|
|
129
|
-
e.preventDefault()
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
_this.changeFocusCell(0, 1);
|
|
130
193
|
break;
|
|
131
194
|
}
|
|
132
195
|
case "ArrowUp": {
|
|
133
|
-
e.preventDefault()
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
_this.changeFocusCell(-1, 0);
|
|
134
198
|
break;
|
|
135
199
|
}
|
|
136
200
|
case "ArrowDown": {
|
|
137
|
-
e.preventDefault()
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
_this.changeFocusCell(1, 0);
|
|
138
203
|
break;
|
|
139
204
|
}
|
|
140
205
|
}
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
206
|
+
});
|
|
207
|
+
_defineProperty(_assertThisInitialized(_this), "initFocusableCell", function() {
|
|
208
|
+
var hasFocusable = _this.hasFocusableInHeader();
|
|
209
|
+
if (hasFocusable) {
|
|
210
|
+
_this.focusedCell = [0, 0];
|
|
211
|
+
} else {
|
|
212
|
+
_this.focusedCell = [1, 0];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
_defineProperty(_assertThisInitialized(_this), "getRow", function(index) {
|
|
216
|
+
var _this$tableRef$curren4, _this$tableRef$curren5;
|
|
217
|
+
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, '"]'));
|
|
218
|
+
});
|
|
219
|
+
_defineProperty(_assertThisInitialized(_this), "handleFocus", function(e) {
|
|
220
|
+
var _this$asProps$focusSo;
|
|
221
|
+
if ((!e.relatedTarget || !isFocusInside(e.currentTarget, e.relatedTarget)) && ((_this$asProps$focusSo = _this.asProps.focusSourceRef) === null || _this$asProps$focusSo === void 0 ? void 0 : _this$asProps$focusSo.current) === "keyboard") {
|
|
222
|
+
var _row2;
|
|
223
|
+
if (_this.focusedCell[0] === -1 && _this.focusedCell[1] === -1) {
|
|
224
|
+
_this.initFocusableCell();
|
|
225
|
+
}
|
|
226
|
+
_this.setInert(true);
|
|
227
|
+
var _row = _this.getRow(_this.focusedCell[0]);
|
|
228
|
+
if (!_row) {
|
|
229
|
+
_this.initFocusableCell();
|
|
230
|
+
_row = _this.getRow(_this.focusedCell[0]);
|
|
231
|
+
}
|
|
232
|
+
var cell = (_row2 = _row) === null || _row2 === void 0 ? void 0 : _row2.querySelectorAll("[role=gridcell], [role=columnheader]").item(_this.focusedCell[1]);
|
|
233
|
+
cell === null || cell === void 0 ? void 0 : cell.removeAttribute("inert");
|
|
234
|
+
cell instanceof HTMLElement && cell.focus();
|
|
235
|
+
e.currentTarget.setAttribute("tabIndex", "-1");
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
_defineProperty(_assertThisInitialized(_this), "handleBlur", function(e) {
|
|
239
|
+
var _this$asProps$focusSo2;
|
|
240
|
+
var relatedTarget = e.relatedTarget;
|
|
241
|
+
var tableElement = _this.tableRef.current;
|
|
242
|
+
if (tableElement && (!relatedTarget || !isFocusInside(tableElement, relatedTarget) || ((_this$asProps$focusSo2 = _this.asProps.focusSourceRef) === null || _this$asProps$focusSo2 === void 0 ? void 0 : _this$asProps$focusSo2.current) !== "keyboard")) {
|
|
243
|
+
_this.setInert(false);
|
|
244
|
+
tableElement.setAttribute("tabIndex", "0");
|
|
156
245
|
}
|
|
157
|
-
}), g(f(_), "handleBlur", function(e) {
|
|
158
|
-
var r, o = e.relatedTarget, a = _.tableRef.current;
|
|
159
|
-
a && (!o || !I(a, o) || ((r = _.asProps.focusSourceRef) === null || r === void 0 ? void 0 : r.current) !== "keyboard") && (_.setInert(!1), a.setAttribute("tabIndex", "0"));
|
|
160
|
-
}), g(f(_), "handleMouseMove", function() {
|
|
161
|
-
_.setInert(!1);
|
|
162
246
|
});
|
|
163
|
-
|
|
164
|
-
|
|
247
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseMove", function() {
|
|
248
|
+
_this.setInert(false);
|
|
249
|
+
});
|
|
250
|
+
var createRef = syncScroll();
|
|
251
|
+
_this.scrollBodyRef = createRef("body");
|
|
252
|
+
_this.scrollHeadRef = createRef("head");
|
|
253
|
+
return _this;
|
|
165
254
|
}
|
|
166
|
-
|
|
255
|
+
_createClass(RootDefinitionTable2, [{
|
|
167
256
|
key: "setVarStyle",
|
|
168
|
-
value: function(
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
257
|
+
value: function setVarStyle(columns) {
|
|
258
|
+
var _this2 = this;
|
|
259
|
+
var animations = columns.flatMap(function(column) {
|
|
260
|
+
var _column$props$ref$cur, _column$props$ref$cur2;
|
|
261
|
+
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);
|
|
262
|
+
}).filter(function(a) {
|
|
263
|
+
return a !== void 0;
|
|
264
|
+
});
|
|
265
|
+
var animationPromise = Promise.resolve();
|
|
266
|
+
if (animations.length > 0) {
|
|
267
|
+
animationPromise = Promise.all(animations.map(function(animation) {
|
|
268
|
+
return animation.finished;
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
animationPromise.then(function() {
|
|
272
|
+
var _iterator = _createForOfIteratorHelper(columns), _step;
|
|
179
273
|
try {
|
|
180
|
-
for (
|
|
181
|
-
var
|
|
182
|
-
if (
|
|
183
|
-
var
|
|
184
|
-
(
|
|
274
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
275
|
+
var column = _step.value;
|
|
276
|
+
if (column.setVar) {
|
|
277
|
+
var _this2$tableRef$curre;
|
|
278
|
+
(_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"));
|
|
185
279
|
}
|
|
186
280
|
}
|
|
187
|
-
} catch (
|
|
188
|
-
|
|
281
|
+
} catch (err) {
|
|
282
|
+
_iterator.e(err);
|
|
189
283
|
} finally {
|
|
190
|
-
|
|
284
|
+
_iterator.f();
|
|
191
285
|
}
|
|
192
|
-
})
|
|
193
|
-
console.error(
|
|
286
|
+
})["catch"](function(err) {
|
|
287
|
+
console.error(err);
|
|
194
288
|
});
|
|
195
289
|
}
|
|
196
290
|
}, {
|
|
197
291
|
key: "childrenToColumns",
|
|
198
|
-
value: function(
|
|
199
|
-
var
|
|
292
|
+
value: function childrenToColumns(children) {
|
|
293
|
+
var _this3 = this;
|
|
294
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
200
295
|
fixed: void 0
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
296
|
+
};
|
|
297
|
+
var sort = this.asProps.sort;
|
|
298
|
+
var columnsChildren = [];
|
|
299
|
+
React.Children.forEach(children, function(child) {
|
|
300
|
+
var _column$props;
|
|
301
|
+
if (!/* @__PURE__ */ React.isValidElement(child)) return;
|
|
302
|
+
if (child.type !== DefinitionTable.Column) return;
|
|
303
|
+
var _ref3 = child.props, children2 = _ref3.children, name = _ref3.name, _ref3$fixed = _ref3.fixed, fixed = _ref3$fixed === void 0 ? options.fixed : _ref3$fixed, resizable = _ref3.resizable, sortable = _ref3.sortable, flex = _ref3.flex, vBorders = _ref3.vBorders, active = _ref3.active, props = _objectWithoutProperties(_ref3, _excluded);
|
|
304
|
+
var lastColumnChildren = columnsChildren[columnsChildren.length - 1];
|
|
305
|
+
var isGroup = !name;
|
|
306
|
+
var columns;
|
|
307
|
+
if (isGroup) {
|
|
308
|
+
columns = _this3.childrenToColumns(children2, {
|
|
309
|
+
fixed
|
|
310
|
+
});
|
|
311
|
+
active = typeof active === "boolean" ? active : columns.some(function(c) {
|
|
312
|
+
return c.active;
|
|
313
|
+
});
|
|
314
|
+
if (vBorders) {
|
|
315
|
+
setBorderGroupColumns(columns);
|
|
218
316
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
})
|
|
317
|
+
name = flattenColumns(columns).map(function(_ref4) {
|
|
318
|
+
var name2 = _ref4.name;
|
|
319
|
+
return name2;
|
|
320
|
+
}).join("/");
|
|
321
|
+
if (!columns.length) return;
|
|
322
|
+
children2 = React.Children.toArray(children2).filter(function(child2) {
|
|
323
|
+
return !(/* @__PURE__ */ React.isValidElement(child2) && child2.type === DefinitionTable.Column);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
var column = _this3.columns.find(function(column2) {
|
|
327
|
+
return column2.name === name;
|
|
328
|
+
});
|
|
329
|
+
var columnChildren = {
|
|
330
|
+
get width() {
|
|
331
|
+
var _this$props$ref$curre;
|
|
332
|
+
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;
|
|
333
|
+
},
|
|
334
|
+
name,
|
|
335
|
+
varWidth: createCssVarForWidth(name),
|
|
336
|
+
setVar: flex !== "inherit",
|
|
337
|
+
fixed,
|
|
338
|
+
resizable,
|
|
339
|
+
active: typeof active === "boolean" ? active : sort[0] === name,
|
|
340
|
+
sortable,
|
|
341
|
+
borderLeft: (lastColumnChildren === null || lastColumnChildren === void 0 ? void 0 : lastColumnChildren.borderRight) === true ? false : vBorders,
|
|
342
|
+
borderRight: vBorders,
|
|
343
|
+
sortDirection: sort[0] === name ? sort[1] : (column === null || column === void 0 ? void 0 : column.sortDirection) || (typeof sortable === "string" ? sortable : defaultSortDirection),
|
|
344
|
+
props: _objectSpread(_objectSpread({
|
|
345
|
+
name,
|
|
346
|
+
flex: flex === "inherit" ? void 0 : flex
|
|
347
|
+
}, props), {}, {
|
|
348
|
+
// @ts-ignore
|
|
349
|
+
forwardRef: child.ref,
|
|
350
|
+
children: children2,
|
|
351
|
+
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()
|
|
352
|
+
}),
|
|
353
|
+
parentColumns: []
|
|
354
|
+
};
|
|
355
|
+
if (columns) {
|
|
356
|
+
columnChildren.columns = columns;
|
|
357
|
+
columns.forEach(function(column2) {
|
|
358
|
+
return column2.parentColumns.unshift(columnChildren);
|
|
359
|
+
});
|
|
250
360
|
}
|
|
251
|
-
|
|
361
|
+
columnsChildren.push(columnChildren);
|
|
362
|
+
});
|
|
363
|
+
return columnsChildren;
|
|
252
364
|
}
|
|
253
365
|
}, {
|
|
254
366
|
key: "getHeadProps",
|
|
255
|
-
value: function(
|
|
256
|
-
var
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
367
|
+
value: function getHeadProps(props) {
|
|
368
|
+
var _this$asProps = this.asProps, use = _this$asProps.use, uid = _this$asProps.uid, getI18nText = _this$asProps.getI18nText;
|
|
369
|
+
var columnsChildren = this.childrenToColumns(props.children);
|
|
370
|
+
this.columns = flattenColumns(columnsChildren);
|
|
371
|
+
return {
|
|
372
|
+
$onSortClick: callAllEventHandlers(this.handlerSortClick, this.scrollToUp),
|
|
373
|
+
columnsChildren,
|
|
374
|
+
use,
|
|
261
375
|
onResize: this.handlerResize,
|
|
262
376
|
$scrollRef: this.scrollHeadRef,
|
|
263
|
-
uid
|
|
264
|
-
getI18nText
|
|
377
|
+
uid,
|
|
378
|
+
getI18nText
|
|
265
379
|
};
|
|
266
380
|
}
|
|
267
381
|
}, {
|
|
268
382
|
key: "getBodyProps",
|
|
269
|
-
value: function(
|
|
270
|
-
var
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
383
|
+
value: function getBodyProps(props) {
|
|
384
|
+
var _this$asProps2 = this.asProps, data = _this$asProps2.data, use = _this$asProps2.use, uniqueKey = _this$asProps2.uniqueKey, uid = _this$asProps2.uid;
|
|
385
|
+
var cellPropsLayers = {};
|
|
386
|
+
var rowPropsLayers = [];
|
|
387
|
+
React.Children.forEach(props.children, function(child) {
|
|
388
|
+
if (/* @__PURE__ */ React.isValidElement(child)) {
|
|
389
|
+
var _ref5 = child.props, name = _ref5.name, children = _ref5.children, other = _objectWithoutProperties(_ref5, _excluded2);
|
|
390
|
+
if (child.type === DefinitionTable.Cell && name) {
|
|
391
|
+
name.split("/").forEach(function(name2) {
|
|
392
|
+
cellPropsLayers[name2] = cellPropsLayers[name2] || [];
|
|
393
|
+
cellPropsLayers[name2].push(_objectSpread(_objectSpread({}, other), {}, {
|
|
394
|
+
childrenPropsGetter: children
|
|
395
|
+
}));
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
if (child.type === DefinitionTable.Row) {
|
|
399
|
+
rowPropsLayers.push(_objectSpread(_objectSpread({}, other), {}, {
|
|
400
|
+
childrenPropsGetter: children
|
|
277
401
|
}));
|
|
278
|
-
}
|
|
279
|
-
childrenPropsGetter: c
|
|
280
|
-
}));
|
|
402
|
+
}
|
|
281
403
|
}
|
|
282
|
-
})
|
|
404
|
+
});
|
|
405
|
+
return {
|
|
283
406
|
columns: this.columns,
|
|
284
|
-
rows: this.dataToRows(
|
|
285
|
-
uniqueKey
|
|
286
|
-
use
|
|
287
|
-
rowPropsLayers
|
|
407
|
+
rows: this.dataToRows(data, cellPropsLayers),
|
|
408
|
+
uniqueKey,
|
|
409
|
+
use,
|
|
410
|
+
rowPropsLayers,
|
|
288
411
|
$scrollRef: this.scrollBodyRef,
|
|
289
|
-
uid
|
|
412
|
+
uid
|
|
290
413
|
};
|
|
291
414
|
}
|
|
292
415
|
}, {
|
|
293
416
|
key: "dataToRows",
|
|
294
|
-
value: function(
|
|
295
|
-
var
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
417
|
+
value: function dataToRows(data, cellPropsLayers) {
|
|
418
|
+
var _this4 = this;
|
|
419
|
+
var parseData = function parseData2(data2, exclude) {
|
|
420
|
+
return data2.map(function(row) {
|
|
421
|
+
var groupByName = {};
|
|
422
|
+
var columnsWithoutRowGroup = {};
|
|
423
|
+
for (var rowKey in row) {
|
|
424
|
+
var columnNames = rowKey.split("/");
|
|
425
|
+
if (columnNames.length >= 2) {
|
|
426
|
+
var _iterator2 = _createForOfIteratorHelper(columnNames), _step2;
|
|
302
427
|
try {
|
|
303
|
-
for (
|
|
304
|
-
var
|
|
305
|
-
|
|
306
|
-
groupedColumns:
|
|
307
|
-
groupData:
|
|
308
|
-
}
|
|
428
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
|
|
429
|
+
var column = _step2.value;
|
|
430
|
+
groupByName[column] = {
|
|
431
|
+
groupedColumns: columnNames,
|
|
432
|
+
groupData: row[rowKey]
|
|
433
|
+
};
|
|
434
|
+
columnsWithoutRowGroup[column] = true;
|
|
309
435
|
}
|
|
310
|
-
} catch (
|
|
311
|
-
|
|
436
|
+
} catch (err) {
|
|
437
|
+
_iterator2.e(err);
|
|
312
438
|
} finally {
|
|
313
|
-
|
|
439
|
+
_iterator2.f();
|
|
314
440
|
}
|
|
315
|
-
} else
|
|
316
|
-
n[w] = !0;
|
|
317
|
-
}
|
|
318
|
-
var S = l[u_] || [], v = Object.fromEntries(S.flatMap(function(t) {
|
|
319
|
-
return Object.keys(t);
|
|
320
|
-
}).flatMap(function(t) {
|
|
321
|
-
return t.split("/");
|
|
322
|
-
}).map(function(t) {
|
|
323
|
-
return [t, !0];
|
|
324
|
-
})), P = !1, h = e.columns.map(function(t) {
|
|
325
|
-
if (u[t.name]) {
|
|
326
|
-
var C = u[t.name], y = C.groupedColumns, H = C.groupData;
|
|
327
|
-
if (y[0] === t.name)
|
|
328
|
-
return {
|
|
329
|
-
name: y.join("/"),
|
|
330
|
-
cssVar: y.map(V),
|
|
331
|
-
fixed: t.fixed,
|
|
332
|
-
data: H,
|
|
333
|
-
cellPropsLayers: i[t.name] || []
|
|
334
|
-
};
|
|
335
441
|
} else {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
442
|
+
columnsWithoutRowGroup[rowKey] = true;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
var rowsGroup = row[ROW_GROUP] || [];
|
|
446
|
+
var rowsGroupedNames = Object.fromEntries(rowsGroup.flatMap(function(subRow) {
|
|
447
|
+
return Object.keys(subRow);
|
|
448
|
+
}).flatMap(function(key) {
|
|
449
|
+
return key.split("/");
|
|
450
|
+
}).map(function(key) {
|
|
451
|
+
return [key, true];
|
|
452
|
+
}));
|
|
453
|
+
var isGroup = false;
|
|
454
|
+
var cells = _this4.columns.map(function(column2) {
|
|
455
|
+
if (groupByName[column2.name]) {
|
|
456
|
+
var _groupByName$column$n = groupByName[column2.name], groupedColumns = _groupByName$column$n.groupedColumns, groupData = _groupByName$column$n.groupData;
|
|
457
|
+
if (groupedColumns[0] === column2.name) {
|
|
347
458
|
return {
|
|
348
|
-
name:
|
|
349
|
-
cssVar:
|
|
350
|
-
fixed:
|
|
351
|
-
data:
|
|
352
|
-
cellPropsLayers:
|
|
459
|
+
name: groupedColumns.join("/"),
|
|
460
|
+
cssVar: groupedColumns.map(createCssVarForWidth),
|
|
461
|
+
fixed: column2.fixed,
|
|
462
|
+
data: groupData,
|
|
463
|
+
cellPropsLayers: cellPropsLayers[column2.name] || []
|
|
353
464
|
};
|
|
465
|
+
}
|
|
466
|
+
} else if (column2.name in row) {
|
|
467
|
+
return {
|
|
468
|
+
name: column2.name,
|
|
469
|
+
cssVar: column2.varWidth,
|
|
470
|
+
fixed: column2.fixed,
|
|
471
|
+
data: row[column2.name],
|
|
472
|
+
cellPropsLayers: cellPropsLayers[column2.name] || []
|
|
473
|
+
};
|
|
474
|
+
} else if (!isGroup && rowsGroupedNames[column2.name]) {
|
|
475
|
+
isGroup = true;
|
|
476
|
+
return parseData2(rowsGroup, _objectSpread(_objectSpread({}, exclude), columnsWithoutRowGroup));
|
|
477
|
+
} else if (!exclude[column2.name] && !rowsGroupedNames[column2.name]) {
|
|
478
|
+
return {
|
|
479
|
+
name: column2.name,
|
|
480
|
+
cssVar: column2.varWidth,
|
|
481
|
+
fixed: column2.fixed,
|
|
482
|
+
data: null,
|
|
483
|
+
cellPropsLayers: cellPropsLayers[column2.name] || []
|
|
484
|
+
};
|
|
354
485
|
}
|
|
355
|
-
}).filter(function(
|
|
356
|
-
return
|
|
357
|
-
}).map(function(
|
|
358
|
-
return
|
|
486
|
+
}).filter(function(column2) {
|
|
487
|
+
return column2;
|
|
488
|
+
}).map(function(column2) {
|
|
489
|
+
return column2;
|
|
359
490
|
});
|
|
360
|
-
|
|
491
|
+
cells.flatRowData = row;
|
|
492
|
+
return cells;
|
|
361
493
|
});
|
|
362
494
|
};
|
|
363
|
-
return
|
|
495
|
+
return parseData(data, {});
|
|
364
496
|
}
|
|
365
497
|
}, {
|
|
366
498
|
key: "componentDidMount",
|
|
367
|
-
value: function() {
|
|
499
|
+
value: function componentDidMount() {
|
|
368
500
|
this.setVarStyle(this.columns);
|
|
369
501
|
}
|
|
370
502
|
}, {
|
|
371
503
|
key: "componentDidUpdate",
|
|
372
|
-
value: function(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
504
|
+
value: function componentDidUpdate(prevProps) {
|
|
505
|
+
this.setVarStyle(this.columns);
|
|
506
|
+
if (prevProps.data !== this.props.data) {
|
|
507
|
+
var focusedRow = this.focusedCell[0];
|
|
508
|
+
var isFocusInHeader = focusedRow === 0 && this.hasFocusableInHeader();
|
|
509
|
+
if (this.tableRef.current && !isFocusInside(this.tableRef.current) && !isFocusInHeader) {
|
|
510
|
+
this.focusedCell = [-1, -1];
|
|
511
|
+
}
|
|
376
512
|
}
|
|
377
513
|
}
|
|
378
514
|
}, {
|
|
379
515
|
key: "totalRows",
|
|
380
|
-
get: function() {
|
|
381
|
-
var
|
|
382
|
-
return
|
|
516
|
+
get: function get() {
|
|
517
|
+
var _this$asProps3 = this.asProps, data = _this$asProps3.data, totalRows = _this$asProps3.totalRows;
|
|
518
|
+
return totalRows !== null && totalRows !== void 0 ? totalRows : (data !== null && data !== void 0 ? data : []).length;
|
|
383
519
|
}
|
|
384
520
|
}, {
|
|
385
521
|
key: "setInert",
|
|
386
|
-
value: function(
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
|
|
522
|
+
value: function setInert(value) {
|
|
523
|
+
var _this$tableRef$curren6;
|
|
524
|
+
var cells = (_this$tableRef$curren6 = this.tableRef.current) === null || _this$tableRef$curren6 === void 0 ? void 0 : _this$tableRef$curren6.querySelectorAll("[role=gridcell], [role=columnheader]");
|
|
525
|
+
cells === null || cells === void 0 ? void 0 : cells.forEach(function(cell) {
|
|
526
|
+
if (value === true) {
|
|
527
|
+
cell.setAttribute("inert", "");
|
|
528
|
+
} else {
|
|
529
|
+
cell.removeAttribute("inert");
|
|
530
|
+
}
|
|
390
531
|
});
|
|
391
532
|
}
|
|
392
533
|
}, {
|
|
393
534
|
key: "render",
|
|
394
|
-
value: function() {
|
|
395
|
-
var
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
535
|
+
value: function render() {
|
|
536
|
+
var _ref = this.asProps, _ref2;
|
|
537
|
+
var SDataTable = Box;
|
|
538
|
+
var _this$asProps4 = this.asProps, Children = _this$asProps4.Children, styles = _this$asProps4.styles;
|
|
539
|
+
return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SDataTable, _ref2.cn("SDataTable", _objectSpread({}, assignProps({
|
|
540
|
+
"__excludeProps": ["data"],
|
|
541
|
+
"ref": this.tableRef,
|
|
542
|
+
"role": "grid",
|
|
543
|
+
"onKeyDown": this.handleKeyDown,
|
|
544
|
+
"onMouseMove": this.handleMouseMove,
|
|
545
|
+
"tabIndex": 0,
|
|
546
|
+
"onFocus": this.handleFocus,
|
|
547
|
+
"onBlur": this.handleBlur,
|
|
405
548
|
"aria-rowcount": this.totalRows,
|
|
406
549
|
"aria-colcount": this.columns.length
|
|
407
|
-
},
|
|
550
|
+
}, _ref))), /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})));
|
|
408
551
|
}
|
|
409
|
-
}])
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
552
|
+
}]);
|
|
553
|
+
return RootDefinitionTable2;
|
|
554
|
+
}(Component);
|
|
555
|
+
_defineProperty(RootDefinitionTable, "displayName", "DefinitionTable");
|
|
556
|
+
_defineProperty(RootDefinitionTable, "style", style);
|
|
557
|
+
_defineProperty(RootDefinitionTable, "enhance", [uniqueIDEnhancement(), i18nEnhance(localizedMessages), focusSourceEnhance()]);
|
|
558
|
+
_defineProperty(RootDefinitionTable, "defaultProps", {
|
|
415
559
|
use: "primary",
|
|
416
560
|
uniqueKey: "id",
|
|
417
561
|
sort: [],
|
|
418
562
|
data: []
|
|
419
563
|
});
|
|
420
|
-
function
|
|
564
|
+
function ComponentDefinition() {
|
|
421
565
|
return null;
|
|
422
566
|
}
|
|
423
|
-
var
|
|
424
|
-
Head
|
|
425
|
-
Body
|
|
426
|
-
Column:
|
|
427
|
-
Cell:
|
|
428
|
-
Row:
|
|
429
|
-
}, {})
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
return
|
|
567
|
+
var DefinitionTable = createComponent(RootDefinitionTable, {
|
|
568
|
+
Head,
|
|
569
|
+
Body,
|
|
570
|
+
Column: ComponentDefinition,
|
|
571
|
+
Cell: ComponentDefinition,
|
|
572
|
+
Row: ComponentDefinition
|
|
573
|
+
}, {});
|
|
574
|
+
var wrapDataTable = function wrapDataTable2(wrapper) {
|
|
575
|
+
return wrapper;
|
|
576
|
+
};
|
|
577
|
+
var wrapDataTableRow = function wrapDataTableRow2(wrapper) {
|
|
578
|
+
return wrapper;
|
|
579
|
+
};
|
|
580
|
+
var wrapDataTableCell = function wrapDataTableCell2(wrapper) {
|
|
581
|
+
return wrapper;
|
|
435
582
|
};
|
|
436
583
|
export {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
584
|
+
ROW_GROUP,
|
|
585
|
+
DefinitionTable as default,
|
|
586
|
+
wrapDataTable,
|
|
587
|
+
wrapDataTableCell,
|
|
588
|
+
wrapDataTableRow
|
|
442
589
|
};
|