@semcore/data-table 16.0.0-prerelease.4 → 16.0.0-prerelease.7

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.
@@ -1,439 +1,582 @@
1
- import T from "@babel/runtime/helpers/esm/objectSpread2";
2
- import B from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import E from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
4
- import L from "@babel/runtime/helpers/esm/classCallCheck";
5
- import U from "@babel/runtime/helpers/esm/createClass";
6
- import u from "@babel/runtime/helpers/esm/assertThisInitialized";
7
- import O from "@babel/runtime/helpers/esm/inherits";
8
- import K from "@babel/runtime/helpers/esm/createSuper";
9
- import h from "@babel/runtime/helpers/esm/defineProperty";
10
- import { sstyled as q, createComponent as J, lastInteraction as G, assignProps as N, Component as Q } from "@semcore/core";
11
- import k from "react";
12
- import { Box as X } from "@semcore/flex-box";
13
- import Y from "@semcore/core/lib/utils/syncScroll";
14
- import { callAllEventHandlers as Z } from "@semcore/core/lib/utils/assignProps";
15
- import __ from "@semcore/core/lib/utils/fire";
16
- import { flattenColumns as V } from "./utils.mjs";
17
- import e_ from "./Head.mjs";
18
- import o_ from "./Body.mjs";
19
- import r_ from "@semcore/core/lib/utils/uniqueID";
20
- import { localizedMessages as i_ } from "./translations/__intergalactic-dynamic-locales.mjs";
21
- import t_ from "@semcore/core/lib/utils/enhances/i18nEnhance";
22
- import { hasFocusableIn as a_, isFocusInside as $ } from "@semcore/core/lib/utils/use/useFocusLock";
23
- var l_ = ["children", "name", "fixed", "resizable", "sortable", "flex", "vBorders", "active"], n_ = ["name", "children"], g_ = (
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, createComponent, lastInteraction, assignProps, Component } from "@semcore/core";
11
+ import React from "react";
12
+ import { Box } from "@semcore/flex-box";
13
+ import syncScroll from "@semcore/core/lib/utils/syncScroll";
14
+ import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
15
+ import fire from "@semcore/core/lib/utils/fire";
16
+ import { flattenColumns } from "./utils.mjs";
17
+ import Head from "./Head.mjs";
18
+ import Body from "./Body.mjs";
19
+ import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
20
+ import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
21
+ import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
22
+ import { hasFocusableIn, isFocusInside } from "@semcore/core/lib/utils/use/useFocusLock";
23
+ var _excluded = ["children", "name", "fixed", "resizable", "sortable", "flex", "vBorders", "active"], _excluded2 = ["name", "children"];
24
+ var style = (
24
25
  /*__reshadow_css_start__*/
25
- (q.insert(
26
+ (sstyled.insert(
26
27
  /*__inner_css_start__*/
27
28
  '.___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}',
28
29
  "zohi4_gg_"
29
30
  ), {
30
- __SDataTable: "___SDataTable_zohi4_gg_",
31
- __SHeadWrapper: "___SHeadWrapper_zohi4_gg_",
32
- _sticky: "__sticky_zohi4_gg_",
33
- __SHead: "___SHead_zohi4_gg_",
34
- __SColumn: "___SColumn_zohi4_gg_",
35
- _hidden: "__hidden_zohi4_gg_",
36
- _use_primary: "_use_primary_zohi4_gg_",
37
- _use_secondary: "_use_secondary_zohi4_gg_",
38
- _group: "__group_zohi4_gg_",
39
- _use: "__use_zohi4_gg_",
40
- _groupHead: "__groupHead_zohi4_gg_",
41
- _active: "__active_zohi4_gg_",
42
- __SSortIcon: "___SSortIcon_zohi4_gg_",
43
- _fixed: "__fixed_zohi4_gg_",
44
- _borderLeft: "__borderLeft_zohi4_gg_",
45
- __SCell: "___SCell_zohi4_gg_",
46
- _borderRight: "__borderRight_zohi4_gg_",
47
- __SSortWrapper: "___SSortWrapper_zohi4_gg_",
48
- __SBodyWrapper: "___SBodyWrapper_zohi4_gg_",
49
- __SBody: "___SBody_zohi4_gg_",
50
- __SRow: "___SRow_zohi4_gg_",
51
- _theme: "__theme_zohi4_gg_",
52
- __SGroupCell: "___SGroupCell_zohi4_gg_",
53
- _theme_muted: "_theme_muted_zohi4_gg_",
54
- _theme_info: "_theme_info_zohi4_gg_",
55
- _theme_success: "_theme_success_zohi4_gg_",
56
- _theme_warning: "_theme_warning_zohi4_gg_",
57
- _theme_danger: "_theme_danger_zohi4_gg_",
58
- _positioned: "__positioned_zohi4_gg_",
59
- _animationsDisabled: "__animationsDisabled_zohi4_gg_",
60
- __SHeightHold: "___SHeightHold_zohi4_gg_",
61
- _compact: "__compact_zohi4_gg_",
62
- _sortable: "__sortable_zohi4_gg_",
63
- _justifyContent_right: "_justifyContent_right_zohi4_gg_",
64
- _resizable: "__resizable_zohi4_gg_"
31
+ "__SDataTable": "___SDataTable_zohi4_gg_",
32
+ "__SHeadWrapper": "___SHeadWrapper_zohi4_gg_",
33
+ "_sticky": "__sticky_zohi4_gg_",
34
+ "__SHead": "___SHead_zohi4_gg_",
35
+ "__SColumn": "___SColumn_zohi4_gg_",
36
+ "_hidden": "__hidden_zohi4_gg_",
37
+ "_use_primary": "_use_primary_zohi4_gg_",
38
+ "_use_secondary": "_use_secondary_zohi4_gg_",
39
+ "_group": "__group_zohi4_gg_",
40
+ "_use": "__use_zohi4_gg_",
41
+ "_groupHead": "__groupHead_zohi4_gg_",
42
+ "_active": "__active_zohi4_gg_",
43
+ "__SSortIcon": "___SSortIcon_zohi4_gg_",
44
+ "_fixed": "__fixed_zohi4_gg_",
45
+ "_borderLeft": "__borderLeft_zohi4_gg_",
46
+ "__SCell": "___SCell_zohi4_gg_",
47
+ "_borderRight": "__borderRight_zohi4_gg_",
48
+ "__SSortWrapper": "___SSortWrapper_zohi4_gg_",
49
+ "__SBodyWrapper": "___SBodyWrapper_zohi4_gg_",
50
+ "__SBody": "___SBody_zohi4_gg_",
51
+ "__SRow": "___SRow_zohi4_gg_",
52
+ "_theme": "__theme_zohi4_gg_",
53
+ "__SGroupCell": "___SGroupCell_zohi4_gg_",
54
+ "_theme_muted": "_theme_muted_zohi4_gg_",
55
+ "_theme_info": "_theme_info_zohi4_gg_",
56
+ "_theme_success": "_theme_success_zohi4_gg_",
57
+ "_theme_warning": "_theme_warning_zohi4_gg_",
58
+ "_theme_danger": "_theme_danger_zohi4_gg_",
59
+ "_positioned": "__positioned_zohi4_gg_",
60
+ "_animationsDisabled": "__animationsDisabled_zohi4_gg_",
61
+ "__SHeightHold": "___SHeightHold_zohi4_gg_",
62
+ "_compact": "__compact_zohi4_gg_",
63
+ "_sortable": "__sortable_zohi4_gg_",
64
+ "_justifyContent_right": "_justifyContent_right_zohi4_gg_",
65
+ "_resizable": "__resizable_zohi4_gg_"
65
66
  })
66
- ), h_ = {
67
+ );
68
+ var reversedSortDirection = {
67
69
  desc: "asc",
68
70
  asc: "desc"
69
- }, c_ = "desc", s_ = Symbol("ROW_GROUP"), d_ = /[:;\W]/g, M = function(z) {
70
- return "--".concat(z.replace(d_, "_"), "_width");
71
71
  };
72
- function F(D, z) {
73
- var x = D[0], f = D[D.length - 1];
74
- x && (!z || z === "left") && (x.borderLeft = !0, x.columns && F(x.columns, "left")), f && (!z || z === "right") && (f.borderRight = !0, f.columns && F(f.columns, "right"));
72
+ var defaultSortDirection = "desc";
73
+ var ROW_GROUP = Symbol("ROW_GROUP");
74
+ var cssVarReg = /[:;\W]/g;
75
+ var createCssVarForWidth = function createCssVarForWidth2(name) {
76
+ return "--".concat(name.replace(cssVarReg, "_"), "_width");
77
+ };
78
+ function setBorderGroupColumns(columns, side) {
79
+ var firstColumn = columns[0];
80
+ var lastColumn = columns[columns.length - 1];
81
+ if (firstColumn && (!side || side === "left")) {
82
+ firstColumn.borderLeft = true;
83
+ if (firstColumn.columns) {
84
+ setBorderGroupColumns(firstColumn.columns, "left");
85
+ }
86
+ }
87
+ if (lastColumn && (!side || side === "right")) {
88
+ lastColumn.borderRight = true;
89
+ if (lastColumn.columns) {
90
+ setBorderGroupColumns(lastColumn.columns, "right");
91
+ }
92
+ }
75
93
  }
76
- var P = /* @__PURE__ */ function(D) {
77
- O(x, D);
78
- var z = K(x);
79
- function x(f) {
80
- var _;
81
- L(this, x), _ = z.call(this, f), h(u(_), "focusedCell", [-1, -1]), h(u(_), "columns", []), h(u(_), "tableRef", /* @__PURE__ */ k.createRef()), h(u(_), "scrollBodyRef", null), h(u(_), "scrollHeadRef", null), h(u(_), "handlerSortClick", function(e, r) {
82
- var o = _.columns.find(function(a) {
83
- return a.name === e;
94
+ var RootDefinitionTable = /* @__PURE__ */ function(_Component) {
95
+ _inherits(RootDefinitionTable2, _Component);
96
+ var _super = _createSuper(RootDefinitionTable2);
97
+ function RootDefinitionTable2(props) {
98
+ var _this;
99
+ _classCallCheck(this, RootDefinitionTable2);
100
+ _this = _super.call(this, props);
101
+ _defineProperty(_assertThisInitialized(_this), "focusedCell", [-1, -1]);
102
+ _defineProperty(_assertThisInitialized(_this), "columns", []);
103
+ _defineProperty(_assertThisInitialized(_this), "tableRef", /* @__PURE__ */ React.createRef());
104
+ _defineProperty(_assertThisInitialized(_this), "scrollBodyRef", null);
105
+ _defineProperty(_assertThisInitialized(_this), "scrollHeadRef", null);
106
+ _defineProperty(_assertThisInitialized(_this), "handlerSortClick", function(name, event) {
107
+ var column = _this.columns.find(function(column2) {
108
+ return column2.name === name;
84
109
  });
85
- return __(u(_), "onSortChange", [o.name, o.active ? h_[o.sortDirection] : o.sortDirection], r);
86
- }), h(u(_), "handlerResize", function() {
87
- _.forceUpdate();
88
- }), h(u(_), "scrollToUp", function() {
89
- var e, r;
90
- (e = _.tableRef) === null || e === void 0 || (r = e.current) === null || r === void 0 || r.scrollIntoView({
110
+ return fire(_assertThisInitialized(_this), "onSortChange", [column.name, column.active ? reversedSortDirection[column.sortDirection] : column.sortDirection], event);
111
+ });
112
+ _defineProperty(_assertThisInitialized(_this), "handlerResize", function() {
113
+ _this.forceUpdate();
114
+ });
115
+ _defineProperty(_assertThisInitialized(_this), "scrollToUp", function() {
116
+ var _this$tableRef, _this$tableRef$curren;
117
+ (_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({
91
118
  block: "nearest",
92
119
  inline: "nearest",
93
120
  behavior: "smooth"
94
121
  });
95
- }), h(u(_), "hasFocusableInHeader", function() {
96
- var e = _.columns.some(function(r) {
97
- var o = r.props.ref.current;
98
- return r.sortable || o && a_(o);
122
+ });
123
+ _defineProperty(_assertThisInitialized(_this), "hasFocusableInHeader", function() {
124
+ var hasFocusable = _this.columns.some(function(column) {
125
+ var columnElement = column.props.ref.current;
126
+ return column.sortable || columnElement && hasFocusableIn(columnElement);
99
127
  });
100
- return e;
101
- }), h(u(_), "changeFocusCell", function(e, r) {
102
- var o, a, n = _.hasFocusableInHeader(), l = _.columns.length - 1, d = _.totalRows, g = (o = _.tableRef.current) === null || o === void 0 ? void 0 : o.querySelector('[aria-rowindex="'.concat(_.focusedCell[0] + 1, '"]')), w = (a = _.tableRef.current) === null || a === void 0 ? void 0 : a.querySelector('[aria-rowindex="1"]'), c = w == null ? void 0 : w.querySelectorAll("[role=columnheader]"), s = g == null ? void 0 : g.querySelectorAll("[role=gridcell]").item(_.focusedCell[1]), m = c == null ? void 0 : c.item(_.focusedCell[1]), R = !0, b = _.focusedCell[0] + e, v = _.focusedCell[1] + r;
103
- if ((n && b < 0 || !n && b < 1 || b > d) && b !== _.focusedCell[0] && (R = !1), (v < 0 || v > l) && v !== _.focusedCell[1] && (R = !1), !!R) {
104
- _.focusedCell = [b, v];
105
- var W = _.getRow(b), p = W == null ? void 0 : W.querySelectorAll("[role=gridcell], [role=columnheader]").item(v);
106
- if (p instanceof HTMLElement && s !== p) {
107
- s == null || s.setAttribute("inert", ""), s !== m && (s == null || s.removeAttribute("aria-describedby"));
108
- var i = c == null ? void 0 : c.item(v), S = i == null ? void 0 : i.getAttribute("aria-describedby");
109
- if (p.removeAttribute("inert"), i !== p && S && p.setAttribute("aria-describedby", S), p == null || p.focus(), b !== 0) {
110
- m == null || m.setAttribute("inert", "");
111
- var C = c == null ? void 0 : c.item(v);
112
- C == null || C.removeAttribute("inert");
113
- }
114
- } else s === p && _.changeFocusCell(e, r);
128
+ return hasFocusable;
129
+ });
130
+ _defineProperty(_assertThisInitialized(_this), "changeFocusCell", function(rowIndex, colIndex) {
131
+ var _this$tableRef$curren2, _this$tableRef$curren3;
132
+ var hasFocusable = _this.hasFocusableInHeader();
133
+ var maxCol = _this.columns.length - 1;
134
+ var maxRow = _this.totalRows;
135
+ 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, '"]'));
136
+ var headerRow = (_this$tableRef$curren3 = _this.tableRef.current) === null || _this$tableRef$curren3 === void 0 ? void 0 : _this$tableRef$curren3.querySelector('[aria-rowindex="1"]');
137
+ var headerCells = headerRow === null || headerRow === void 0 ? void 0 : headerRow.querySelectorAll("[role=columnheader]");
138
+ var currentCell = currentRow === null || currentRow === void 0 ? void 0 : currentRow.querySelectorAll("[role=gridcell]").item(_this.focusedCell[1]);
139
+ var currentHeaderCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(_this.focusedCell[1]);
140
+ var changed = true;
141
+ var newRow = _this.focusedCell[0] + rowIndex;
142
+ var newCol = _this.focusedCell[1] + colIndex;
143
+ if ((hasFocusable && newRow < 0 || !hasFocusable && newRow < 1 || newRow > maxRow) && newRow !== _this.focusedCell[0]) {
144
+ changed = false;
145
+ }
146
+ if ((newCol < 0 || newCol > maxCol) && newCol !== _this.focusedCell[1]) {
147
+ changed = false;
148
+ }
149
+ if (!changed) return;
150
+ _this.focusedCell = [newRow, newCol];
151
+ var row = _this.getRow(newRow);
152
+ var cell = row === null || row === void 0 ? void 0 : row.querySelectorAll("[role=gridcell], [role=columnheader]").item(newCol);
153
+ if (cell instanceof HTMLElement && currentCell !== cell) {
154
+ currentCell === null || currentCell === void 0 ? void 0 : currentCell.setAttribute("inert", "");
155
+ if (currentCell !== currentHeaderCell) {
156
+ currentCell === null || currentCell === void 0 ? void 0 : currentCell.removeAttribute("aria-describedby");
157
+ }
158
+ var headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
159
+ var describedBy = headerCell === null || headerCell === void 0 ? void 0 : headerCell.getAttribute("aria-describedby");
160
+ cell.removeAttribute("inert");
161
+ if (headerCell !== cell && describedBy) {
162
+ cell.setAttribute("aria-describedby", describedBy);
163
+ }
164
+ cell === null || cell === void 0 ? void 0 : cell.focus();
165
+ if (newRow !== 0) {
166
+ currentHeaderCell === null || currentHeaderCell === void 0 ? void 0 : currentHeaderCell.setAttribute("inert", "");
167
+ var _headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
168
+ _headerCell === null || _headerCell === void 0 ? void 0 : _headerCell.removeAttribute("inert");
169
+ }
170
+ } else if (currentCell === cell) {
171
+ _this.changeFocusCell(rowIndex, colIndex);
115
172
  }
116
- }), h(u(_), "handleKeyDown", function(e) {
173
+ });
174
+ _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function(e) {
117
175
  switch (e.key) {
118
176
  case "Tab": {
119
- _.setInert(!0);
177
+ _this.setInert(true);
120
178
  break;
121
179
  }
122
180
  case "ArrowLeft": {
123
- e.preventDefault(), _.changeFocusCell(0, -1);
181
+ e.preventDefault();
182
+ _this.changeFocusCell(0, -1);
124
183
  break;
125
184
  }
126
185
  case "ArrowRight": {
127
- e.preventDefault(), _.changeFocusCell(0, 1);
186
+ e.preventDefault();
187
+ _this.changeFocusCell(0, 1);
128
188
  break;
129
189
  }
130
190
  case "ArrowUp": {
131
- e.preventDefault(), _.changeFocusCell(-1, 0);
191
+ e.preventDefault();
192
+ _this.changeFocusCell(-1, 0);
132
193
  break;
133
194
  }
134
195
  case "ArrowDown": {
135
- e.preventDefault(), _.changeFocusCell(1, 0);
196
+ e.preventDefault();
197
+ _this.changeFocusCell(1, 0);
136
198
  break;
137
199
  }
138
200
  }
139
- }), h(u(_), "initFocusableCell", function() {
140
- var e = _.hasFocusableInHeader();
141
- e ? _.focusedCell = [0, 0] : _.focusedCell = [1, 0];
142
- }), h(u(_), "getRow", function(e) {
143
- var r, o;
144
- return e === 0 ? (r = _.tableRef.current) === null || r === void 0 ? void 0 : r.querySelector("[role=row]") : (o = _.tableRef.current) === null || o === void 0 ? void 0 : o.querySelector('[aria-rowindex="'.concat(e + 1, '"]'));
145
- }), h(u(_), "handleFocus", function(e) {
146
- if ((!e.relatedTarget || !$(e.currentTarget, e.relatedTarget)) && G.isKeyboard()) {
147
- var r;
148
- _.focusedCell[0] === -1 && _.focusedCell[1] === -1 && _.initFocusableCell(), _.setInert(!0);
149
- var o = _.getRow(_.focusedCell[0]);
150
- o || (_.initFocusableCell(), o = _.getRow(_.focusedCell[0]));
151
- var a = (r = o) === null || r === void 0 ? void 0 : r.querySelectorAll("[role=gridcell], [role=columnheader]").item(_.focusedCell[1]);
152
- a == null || a.removeAttribute("inert"), a instanceof HTMLElement && a.focus(), e.currentTarget.setAttribute("tabIndex", "-1");
201
+ });
202
+ _defineProperty(_assertThisInitialized(_this), "initFocusableCell", function() {
203
+ var hasFocusable = _this.hasFocusableInHeader();
204
+ if (hasFocusable) {
205
+ _this.focusedCell = [0, 0];
206
+ } else {
207
+ _this.focusedCell = [1, 0];
208
+ }
209
+ });
210
+ _defineProperty(_assertThisInitialized(_this), "getRow", function(index) {
211
+ var _this$tableRef$curren4, _this$tableRef$curren5;
212
+ 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, '"]'));
213
+ });
214
+ _defineProperty(_assertThisInitialized(_this), "handleFocus", function(e) {
215
+ if ((!e.relatedTarget || !isFocusInside(e.currentTarget, e.relatedTarget)) && lastInteraction.isKeyboard()) {
216
+ var _row2;
217
+ if (_this.focusedCell[0] === -1 && _this.focusedCell[1] === -1) {
218
+ _this.initFocusableCell();
219
+ }
220
+ _this.setInert(true);
221
+ var _row = _this.getRow(_this.focusedCell[0]);
222
+ if (!_row) {
223
+ _this.initFocusableCell();
224
+ _row = _this.getRow(_this.focusedCell[0]);
225
+ }
226
+ var cell = (_row2 = _row) === null || _row2 === void 0 ? void 0 : _row2.querySelectorAll("[role=gridcell], [role=columnheader]").item(_this.focusedCell[1]);
227
+ cell === null || cell === void 0 ? void 0 : cell.removeAttribute("inert");
228
+ cell instanceof HTMLElement && cell.focus();
229
+ e.currentTarget.setAttribute("tabIndex", "-1");
230
+ }
231
+ });
232
+ _defineProperty(_assertThisInitialized(_this), "handleBlur", function(e) {
233
+ var relatedTarget = e.relatedTarget;
234
+ var tableElement = _this.tableRef.current;
235
+ if (tableElement && (!relatedTarget || !isFocusInside(tableElement, relatedTarget) || !lastInteraction.isKeyboard())) {
236
+ _this.setInert(false);
237
+ tableElement.setAttribute("tabIndex", "0");
153
238
  }
154
- }), h(u(_), "handleBlur", function(e) {
155
- var r = e.relatedTarget, o = _.tableRef.current;
156
- o && (!r || !$(o, r) || !G.isKeyboard()) && (_.setInert(!1), o.setAttribute("tabIndex", "0"));
157
- }), h(u(_), "handleMouseMove", function() {
158
- _.setInert(!1);
159
239
  });
160
- var t = Y();
161
- return _.scrollBodyRef = t("body"), _.scrollHeadRef = t("head"), _;
240
+ _defineProperty(_assertThisInitialized(_this), "handleMouseMove", function() {
241
+ _this.setInert(false);
242
+ });
243
+ var createRef = syncScroll();
244
+ _this.scrollBodyRef = createRef("body");
245
+ _this.scrollHeadRef = createRef("head");
246
+ return _this;
162
247
  }
163
- return U(x, [{
248
+ _createClass(RootDefinitionTable2, [{
164
249
  key: "setVarStyle",
165
- value: function(_) {
166
- var t = this, e = _.flatMap(function(o) {
167
- var a, n;
168
- return (a = o.props.ref.current) === null || a === void 0 || (n = a.getAnimations) === null || n === void 0 ? void 0 : n.call(a);
169
- }).filter(function(o) {
170
- return o !== void 0;
171
- }), r = Promise.resolve();
172
- e.length > 0 && (r = Promise.all(e.map(function(o) {
173
- return o.finished;
174
- }))), r.then(function() {
175
- var o = E(_), a;
250
+ value: function setVarStyle(columns) {
251
+ var _this2 = this;
252
+ var animations = columns.flatMap(function(column) {
253
+ var _column$props$ref$cur, _column$props$ref$cur2;
254
+ 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);
255
+ }).filter(function(a) {
256
+ return a !== void 0;
257
+ });
258
+ var animationPromise = Promise.resolve();
259
+ if (animations.length > 0) {
260
+ animationPromise = Promise.all(animations.map(function(animation) {
261
+ return animation.finished;
262
+ }));
263
+ }
264
+ animationPromise.then(function() {
265
+ var _iterator = _createForOfIteratorHelper(columns), _step;
176
266
  try {
177
- for (o.s(); !(a = o.n()).done; ) {
178
- var n = a.value;
179
- if (n.setVar) {
180
- var l;
181
- (l = t.tableRef.current) === null || l === void 0 || l.style.setProperty(n.varWidth, "".concat(n.width, "px"));
267
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
268
+ var column = _step.value;
269
+ if (column.setVar) {
270
+ var _this2$tableRef$curre;
271
+ (_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"));
182
272
  }
183
273
  }
184
- } catch (d) {
185
- o.e(d);
274
+ } catch (err) {
275
+ _iterator.e(err);
186
276
  } finally {
187
- o.f();
277
+ _iterator.f();
188
278
  }
189
- }).catch(function(o) {
190
- console.error(o);
279
+ })["catch"](function(err) {
280
+ console.error(err);
191
281
  });
192
282
  }
193
283
  }, {
194
284
  key: "childrenToColumns",
195
- value: function(_) {
196
- var t = this, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
285
+ value: function childrenToColumns(children) {
286
+ var _this3 = this;
287
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
197
288
  fixed: void 0
198
- }, r = this.asProps.sort, o = [];
199
- return k.Children.forEach(_, function(a) {
200
- var n;
201
- if (/* @__PURE__ */ k.isValidElement(a) && a.type === I.Column) {
202
- var l = a.props, d = l.children, g = l.name, w = l.fixed, c = w === void 0 ? e.fixed : w, s = l.resizable, m = l.sortable, R = l.flex, b = l.vBorders, v = l.active, W = B(l, l_), p = o[o.length - 1], i = !g, S;
203
- if (i) {
204
- if (S = t.childrenToColumns(d, {
205
- fixed: c
206
- }), v = typeof v == "boolean" ? v : S.some(function(y) {
207
- return y.active;
208
- }), b && F(S), g = V(S).map(function(y) {
209
- var j = y.name;
210
- return j;
211
- }).join("/"), !S.length) return;
212
- d = k.Children.toArray(d).filter(function(y) {
213
- return !(/* @__PURE__ */ k.isValidElement(y) && y.type === I.Column);
214
- });
289
+ };
290
+ var sort = this.asProps.sort;
291
+ var columnsChildren = [];
292
+ React.Children.forEach(children, function(child) {
293
+ var _column$props;
294
+ if (!/* @__PURE__ */ React.isValidElement(child)) return;
295
+ if (child.type !== DefinitionTable.Column) return;
296
+ 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);
297
+ var lastColumnChildren = columnsChildren[columnsChildren.length - 1];
298
+ var isGroup = !name;
299
+ var columns;
300
+ if (isGroup) {
301
+ columns = _this3.childrenToColumns(children2, {
302
+ fixed
303
+ });
304
+ active = typeof active === "boolean" ? active : columns.some(function(c) {
305
+ return c.active;
306
+ });
307
+ if (vBorders) {
308
+ setBorderGroupColumns(columns);
215
309
  }
216
- var C = t.columns.find(function(y) {
217
- return y.name === g;
218
- }), H = {
219
- get width() {
220
- var y;
221
- return ((y = this.props.ref.current) === null || y === void 0 ? void 0 : y.getBoundingClientRect().width) || 0;
222
- },
223
- name: g,
224
- varWidth: M(g),
225
- setVar: R !== "inherit",
226
- fixed: c,
227
- resizable: s,
228
- active: typeof v == "boolean" ? v : r[0] === g,
229
- sortable: m,
230
- borderLeft: (p == null ? void 0 : p.borderRight) === !0 ? !1 : b,
231
- borderRight: b,
232
- sortDirection: r[0] === g ? r[1] : (C == null ? void 0 : C.sortDirection) || (typeof m == "string" ? m : c_),
233
- props: T(T({
234
- name: g,
235
- flex: R === "inherit" ? void 0 : R
236
- }, W), {}, {
237
- // @ts-ignore
238
- forwardRef: a.ref,
239
- children: d,
240
- ref: (C == null || (n = C.props) === null || n === void 0 ? void 0 : n.ref) || /* @__PURE__ */ k.createRef()
241
- }),
242
- parentColumns: []
243
- };
244
- S && (H.columns = S, S.forEach(function(y) {
245
- return y.parentColumns.unshift(H);
246
- })), o.push(H);
310
+ name = flattenColumns(columns).map(function(_ref4) {
311
+ var name2 = _ref4.name;
312
+ return name2;
313
+ }).join("/");
314
+ if (!columns.length) return;
315
+ children2 = React.Children.toArray(children2).filter(function(child2) {
316
+ return !(/* @__PURE__ */ React.isValidElement(child2) && child2.type === DefinitionTable.Column);
317
+ });
318
+ }
319
+ var column = _this3.columns.find(function(column2) {
320
+ return column2.name === name;
321
+ });
322
+ var columnChildren = {
323
+ get width() {
324
+ var _this$props$ref$curre;
325
+ 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;
326
+ },
327
+ name,
328
+ varWidth: createCssVarForWidth(name),
329
+ setVar: flex !== "inherit",
330
+ fixed,
331
+ resizable,
332
+ active: typeof active === "boolean" ? active : sort[0] === name,
333
+ sortable,
334
+ borderLeft: (lastColumnChildren === null || lastColumnChildren === void 0 ? void 0 : lastColumnChildren.borderRight) === true ? false : vBorders,
335
+ borderRight: vBorders,
336
+ sortDirection: sort[0] === name ? sort[1] : (column === null || column === void 0 ? void 0 : column.sortDirection) || (typeof sortable === "string" ? sortable : defaultSortDirection),
337
+ props: _objectSpread(_objectSpread({
338
+ name,
339
+ flex: flex === "inherit" ? void 0 : flex
340
+ }, props), {}, {
341
+ // @ts-ignore
342
+ forwardRef: child.ref,
343
+ children: children2,
344
+ 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()
345
+ }),
346
+ parentColumns: []
347
+ };
348
+ if (columns) {
349
+ columnChildren.columns = columns;
350
+ columns.forEach(function(column2) {
351
+ return column2.parentColumns.unshift(columnChildren);
352
+ });
247
353
  }
248
- }), o;
354
+ columnsChildren.push(columnChildren);
355
+ });
356
+ return columnsChildren;
249
357
  }
250
358
  }, {
251
359
  key: "getHeadProps",
252
- value: function(_) {
253
- var t = this.asProps, e = t.use, r = t.uid, o = t.getI18nText, a = this.childrenToColumns(_.children);
254
- return this.columns = V(a), {
255
- $onSortClick: Z(this.handlerSortClick, this.scrollToUp),
256
- columnsChildren: a,
257
- use: e,
360
+ value: function getHeadProps(props) {
361
+ var _this$asProps = this.asProps, use = _this$asProps.use, uid = _this$asProps.uid, getI18nText = _this$asProps.getI18nText;
362
+ var columnsChildren = this.childrenToColumns(props.children);
363
+ this.columns = flattenColumns(columnsChildren);
364
+ return {
365
+ $onSortClick: callAllEventHandlers(this.handlerSortClick, this.scrollToUp),
366
+ columnsChildren,
367
+ use,
258
368
  onResize: this.handlerResize,
259
369
  $scrollRef: this.scrollHeadRef,
260
- uid: r,
261
- getI18nText: o
370
+ uid,
371
+ getI18nText
262
372
  };
263
373
  }
264
374
  }, {
265
375
  key: "getBodyProps",
266
- value: function(_) {
267
- var t = this.asProps, e = t.data, r = t.use, o = t.uniqueKey, a = t.uid, n = {}, l = [];
268
- return k.Children.forEach(_.children, function(d) {
269
- if (/* @__PURE__ */ k.isValidElement(d)) {
270
- var g = d.props, w = g.name, c = g.children, s = B(g, n_);
271
- d.type === I.Cell && w && w.split("/").forEach(function(m) {
272
- n[m] = n[m] || [], n[m].push(T(T({}, s), {}, {
273
- childrenPropsGetter: c
376
+ value: function getBodyProps(props) {
377
+ var _this$asProps2 = this.asProps, data = _this$asProps2.data, use = _this$asProps2.use, uniqueKey = _this$asProps2.uniqueKey, uid = _this$asProps2.uid;
378
+ var cellPropsLayers = {};
379
+ var rowPropsLayers = [];
380
+ React.Children.forEach(props.children, function(child) {
381
+ if (/* @__PURE__ */ React.isValidElement(child)) {
382
+ var _ref5 = child.props, name = _ref5.name, children = _ref5.children, other = _objectWithoutProperties(_ref5, _excluded2);
383
+ if (child.type === DefinitionTable.Cell && name) {
384
+ name.split("/").forEach(function(name2) {
385
+ cellPropsLayers[name2] = cellPropsLayers[name2] || [];
386
+ cellPropsLayers[name2].push(_objectSpread(_objectSpread({}, other), {}, {
387
+ childrenPropsGetter: children
388
+ }));
389
+ });
390
+ }
391
+ if (child.type === DefinitionTable.Row) {
392
+ rowPropsLayers.push(_objectSpread(_objectSpread({}, other), {}, {
393
+ childrenPropsGetter: children
274
394
  }));
275
- }), d.type === I.Row && l.push(T(T({}, s), {}, {
276
- childrenPropsGetter: c
277
- }));
395
+ }
278
396
  }
279
- }), {
397
+ });
398
+ return {
280
399
  columns: this.columns,
281
- rows: this.dataToRows(e, n),
282
- uniqueKey: o,
283
- use: r,
284
- rowPropsLayers: l,
400
+ rows: this.dataToRows(data, cellPropsLayers),
401
+ uniqueKey,
402
+ use,
403
+ rowPropsLayers,
285
404
  $scrollRef: this.scrollBodyRef,
286
- uid: a
405
+ uid
287
406
  };
288
407
  }
289
408
  }, {
290
409
  key: "dataToRows",
291
- value: function(_, t) {
292
- var e = this, r = function o(a, n) {
293
- return a.map(function(l) {
294
- var d = {}, g = {};
295
- for (var w in l) {
296
- var c = w.split("/");
297
- if (c.length >= 2) {
298
- var s = E(c), m;
410
+ value: function dataToRows(data, cellPropsLayers) {
411
+ var _this4 = this;
412
+ var parseData = function parseData2(data2, exclude) {
413
+ return data2.map(function(row) {
414
+ var groupByName = {};
415
+ var columnsWithoutRowGroup = {};
416
+ for (var rowKey in row) {
417
+ var columnNames = rowKey.split("/");
418
+ if (columnNames.length >= 2) {
419
+ var _iterator2 = _createForOfIteratorHelper(columnNames), _step2;
299
420
  try {
300
- for (s.s(); !(m = s.n()).done; ) {
301
- var R = m.value;
302
- d[R] = {
303
- groupedColumns: c,
304
- groupData: l[w]
305
- }, g[R] = !0;
421
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
422
+ var column = _step2.value;
423
+ groupByName[column] = {
424
+ groupedColumns: columnNames,
425
+ groupData: row[rowKey]
426
+ };
427
+ columnsWithoutRowGroup[column] = true;
306
428
  }
307
- } catch (i) {
308
- s.e(i);
429
+ } catch (err) {
430
+ _iterator2.e(err);
309
431
  } finally {
310
- s.f();
432
+ _iterator2.f();
311
433
  }
312
- } else
313
- g[w] = !0;
314
- }
315
- var b = l[s_] || [], v = Object.fromEntries(b.flatMap(function(i) {
316
- return Object.keys(i);
317
- }).flatMap(function(i) {
318
- return i.split("/");
319
- }).map(function(i) {
320
- return [i, !0];
321
- })), W = !1, p = e.columns.map(function(i) {
322
- if (d[i.name]) {
323
- var S = d[i.name], C = S.groupedColumns, H = S.groupData;
324
- if (C[0] === i.name)
325
- return {
326
- name: C.join("/"),
327
- cssVar: C.map(M),
328
- fixed: i.fixed,
329
- data: H,
330
- cellPropsLayers: t[i.name] || []
331
- };
332
434
  } else {
333
- if (i.name in l)
334
- return {
335
- name: i.name,
336
- cssVar: i.varWidth,
337
- fixed: i.fixed,
338
- data: l[i.name],
339
- cellPropsLayers: t[i.name] || []
340
- };
341
- if (!W && v[i.name])
342
- return W = !0, o(b, T(T({}, n), g));
343
- if (!n[i.name] && !v[i.name])
435
+ columnsWithoutRowGroup[rowKey] = true;
436
+ }
437
+ }
438
+ var rowsGroup = row[ROW_GROUP] || [];
439
+ var rowsGroupedNames = Object.fromEntries(rowsGroup.flatMap(function(subRow) {
440
+ return Object.keys(subRow);
441
+ }).flatMap(function(key) {
442
+ return key.split("/");
443
+ }).map(function(key) {
444
+ return [key, true];
445
+ }));
446
+ var isGroup = false;
447
+ var cells = _this4.columns.map(function(column2) {
448
+ if (groupByName[column2.name]) {
449
+ var _groupByName$column$n = groupByName[column2.name], groupedColumns = _groupByName$column$n.groupedColumns, groupData = _groupByName$column$n.groupData;
450
+ if (groupedColumns[0] === column2.name) {
344
451
  return {
345
- name: i.name,
346
- cssVar: i.varWidth,
347
- fixed: i.fixed,
348
- data: null,
349
- cellPropsLayers: t[i.name] || []
452
+ name: groupedColumns.join("/"),
453
+ cssVar: groupedColumns.map(createCssVarForWidth),
454
+ fixed: column2.fixed,
455
+ data: groupData,
456
+ cellPropsLayers: cellPropsLayers[column2.name] || []
350
457
  };
458
+ }
459
+ } else if (column2.name in row) {
460
+ return {
461
+ name: column2.name,
462
+ cssVar: column2.varWidth,
463
+ fixed: column2.fixed,
464
+ data: row[column2.name],
465
+ cellPropsLayers: cellPropsLayers[column2.name] || []
466
+ };
467
+ } else if (!isGroup && rowsGroupedNames[column2.name]) {
468
+ isGroup = true;
469
+ return parseData2(rowsGroup, _objectSpread(_objectSpread({}, exclude), columnsWithoutRowGroup));
470
+ } else if (!exclude[column2.name] && !rowsGroupedNames[column2.name]) {
471
+ return {
472
+ name: column2.name,
473
+ cssVar: column2.varWidth,
474
+ fixed: column2.fixed,
475
+ data: null,
476
+ cellPropsLayers: cellPropsLayers[column2.name] || []
477
+ };
351
478
  }
352
- }).filter(function(i) {
353
- return i;
354
- }).map(function(i) {
355
- return i;
479
+ }).filter(function(column2) {
480
+ return column2;
481
+ }).map(function(column2) {
482
+ return column2;
356
483
  });
357
- return p.flatRowData = l, p;
484
+ cells.flatRowData = row;
485
+ return cells;
358
486
  });
359
487
  };
360
- return r(_, {});
488
+ return parseData(data, {});
361
489
  }
362
490
  }, {
363
491
  key: "componentDidMount",
364
- value: function() {
492
+ value: function componentDidMount() {
365
493
  this.setVarStyle(this.columns);
366
494
  }
367
495
  }, {
368
496
  key: "componentDidUpdate",
369
- value: function(_) {
370
- if (this.setVarStyle(this.columns), _.data !== this.props.data) {
371
- var t = this.focusedCell[0], e = t === 0 && this.hasFocusableInHeader();
372
- this.tableRef.current && !$(this.tableRef.current) && !e && (this.focusedCell = [-1, -1]);
497
+ value: function componentDidUpdate(prevProps) {
498
+ this.setVarStyle(this.columns);
499
+ if (prevProps.data !== this.props.data) {
500
+ var focusedRow = this.focusedCell[0];
501
+ var isFocusInHeader = focusedRow === 0 && this.hasFocusableInHeader();
502
+ if (this.tableRef.current && !isFocusInside(this.tableRef.current) && !isFocusInHeader) {
503
+ this.focusedCell = [-1, -1];
504
+ }
373
505
  }
374
506
  }
375
507
  }, {
376
508
  key: "totalRows",
377
- get: function() {
378
- var _ = this.asProps, t = _.data, e = _.totalRows;
379
- return e ?? (t ?? []).length;
509
+ get: function get() {
510
+ var _this$asProps3 = this.asProps, data = _this$asProps3.data, totalRows = _this$asProps3.totalRows;
511
+ return totalRows !== null && totalRows !== void 0 ? totalRows : (data !== null && data !== void 0 ? data : []).length;
380
512
  }
381
513
  }, {
382
514
  key: "setInert",
383
- value: function(_) {
384
- var t, e = (t = this.tableRef.current) === null || t === void 0 ? void 0 : t.querySelectorAll("[role=gridcell], [role=columnheader]");
385
- e == null || e.forEach(function(r) {
386
- _ === !0 ? r.setAttribute("inert", "") : r.removeAttribute("inert");
515
+ value: function setInert(value) {
516
+ var _this$tableRef$curren6;
517
+ var cells = (_this$tableRef$curren6 = this.tableRef.current) === null || _this$tableRef$curren6 === void 0 ? void 0 : _this$tableRef$curren6.querySelectorAll("[role=gridcell], [role=columnheader]");
518
+ cells === null || cells === void 0 ? void 0 : cells.forEach(function(cell) {
519
+ if (value === true) {
520
+ cell.setAttribute("inert", "");
521
+ } else {
522
+ cell.removeAttribute("inert");
523
+ }
387
524
  });
388
525
  }
389
526
  }, {
390
527
  key: "render",
391
- value: function() {
392
- var _ = this.asProps, t, e = X, r = this.asProps, o = r.Children, a = r.styles;
393
- return t = q(a), /* @__PURE__ */ k.createElement(e, t.cn("SDataTable", T({}, N({
394
- __excludeProps: ["data"],
395
- ref: this.tableRef,
396
- role: "grid",
397
- onKeyDown: this.handleKeyDown,
398
- onMouseMove: this.handleMouseMove,
399
- tabIndex: 0,
400
- onFocus: this.handleFocus,
401
- onBlur: this.handleBlur,
528
+ value: function render() {
529
+ var _ref = this.asProps, _ref2;
530
+ var SDataTable = Box;
531
+ var _this$asProps4 = this.asProps, Children = _this$asProps4.Children, styles = _this$asProps4.styles;
532
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SDataTable, _ref2.cn("SDataTable", _objectSpread({}, assignProps({
533
+ "__excludeProps": ["data"],
534
+ "ref": this.tableRef,
535
+ "role": "grid",
536
+ "onKeyDown": this.handleKeyDown,
537
+ "onMouseMove": this.handleMouseMove,
538
+ "tabIndex": 0,
539
+ "onFocus": this.handleFocus,
540
+ "onBlur": this.handleBlur,
402
541
  "aria-rowcount": this.totalRows,
403
542
  "aria-colcount": this.columns.length
404
- }, _))), /* @__PURE__ */ k.createElement(o, t.cn("Children", {})));
543
+ }, _ref))), /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})));
405
544
  }
406
- }]), x;
407
- }(Q);
408
- h(P, "displayName", "DefinitionTable");
409
- h(P, "style", g_);
410
- h(P, "enhance", [r_(), t_(i_)]);
411
- h(P, "defaultProps", {
545
+ }]);
546
+ return RootDefinitionTable2;
547
+ }(Component);
548
+ _defineProperty(RootDefinitionTable, "displayName", "DefinitionTable");
549
+ _defineProperty(RootDefinitionTable, "style", style);
550
+ _defineProperty(RootDefinitionTable, "enhance", [uniqueIDEnhancement(), i18nEnhance(localizedMessages)]);
551
+ _defineProperty(RootDefinitionTable, "defaultProps", {
412
552
  use: "primary",
413
553
  uniqueKey: "id",
414
554
  sort: [],
415
555
  data: []
416
556
  });
417
- function A() {
557
+ function ComponentDefinition() {
418
558
  return null;
419
559
  }
420
- var I = J(P, {
421
- Head: e_,
422
- Body: o_,
423
- Column: A,
424
- Cell: A,
425
- Row: A
426
- }, {}), F_ = function(z) {
427
- return z;
428
- }, B_ = function(z) {
429
- return z;
430
- }, E_ = function(z) {
431
- return z;
560
+ var DefinitionTable = createComponent(RootDefinitionTable, {
561
+ Head,
562
+ Body,
563
+ Column: ComponentDefinition,
564
+ Cell: ComponentDefinition,
565
+ Row: ComponentDefinition
566
+ }, {});
567
+ var wrapDataTable = function wrapDataTable2(wrapper) {
568
+ return wrapper;
569
+ };
570
+ var wrapDataTableRow = function wrapDataTableRow2(wrapper) {
571
+ return wrapper;
572
+ };
573
+ var wrapDataTableCell = function wrapDataTableCell2(wrapper) {
574
+ return wrapper;
432
575
  };
433
576
  export {
434
- s_ as ROW_GROUP,
435
- I as default,
436
- F_ as wrapDataTable,
437
- E_ as wrapDataTableCell,
438
- B_ as wrapDataTableRow
577
+ ROW_GROUP,
578
+ DefinitionTable as default,
579
+ wrapDataTable,
580
+ wrapDataTableCell,
581
+ wrapDataTableRow
439
582
  };