musae 1.3.0 → 1.3.1-beta.2
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/dist/__test__/table.test.d.ts +1 -0
- package/dist/components/search/search.cjs +3 -1
- package/dist/components/search/search.d.ts +1 -0
- package/dist/components/search/search.mjs +3 -1
- package/dist/components/sheet/sheet.cjs +13 -3
- package/dist/components/sheet/sheet.d.ts +1 -1
- package/dist/components/sheet/sheet.mjs +13 -3
- package/dist/components/side-sheet/__test__/index.test.d.ts +1 -0
- package/dist/components/side-sheet/context.cjs +15 -0
- package/dist/components/side-sheet/context.d.ts +11 -0
- package/dist/components/side-sheet/context.mjs +13 -0
- package/dist/components/side-sheet/index.d.ts +2 -0
- package/dist/components/side-sheet/side-sheet.cjs +140 -0
- package/dist/components/side-sheet/side-sheet.d.ts +16 -0
- package/dist/components/side-sheet/side-sheet.mjs +136 -0
- package/dist/components/side-sheet/styles.cjs +106 -0
- package/dist/components/side-sheet/styles.d.ts +83 -0
- package/dist/components/side-sheet/styles.mjs +104 -0
- package/dist/components/table/body.cjs +11 -20
- package/dist/components/table/body.mjs +12 -21
- package/dist/components/table/context.cjs +6 -1
- package/dist/components/table/context.d.ts +4 -0
- package/dist/components/table/context.mjs +6 -2
- package/dist/components/table/header/cell.cjs +7 -23
- package/dist/components/table/header/cell.mjs +7 -23
- package/dist/components/table/header/header.cjs +3 -31
- package/dist/components/table/header/header.mjs +4 -32
- package/dist/components/table/hooks.cjs +31 -9
- package/dist/components/table/hooks.d.ts +3 -2
- package/dist/components/table/hooks.mjs +31 -9
- package/dist/components/table/styles.cjs +99 -0
- package/dist/components/table/styles.d.ts +84 -0
- package/dist/components/table/styles.mjs +95 -0
- package/dist/components/table/table.cjs +49 -7
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.mjs +51 -9
- package/dist/components/theme/theme.cjs +31 -0
- package/dist/components/theme/theme.mjs +31 -1
- package/dist/components/theme/tokens.stylex.d.ts +7 -0
- package/dist/components/typography/body.cjs +31 -0
- package/dist/components/typography/body.d.ts +8 -0
- package/dist/components/typography/body.mjs +27 -0
- package/dist/components/typography/context.cjs +15 -0
- package/dist/components/typography/context.d.ts +11 -0
- package/dist/components/typography/context.mjs +13 -0
- package/dist/components/typography/display.cjs +31 -0
- package/dist/components/typography/display.d.ts +8 -0
- package/dist/components/typography/display.mjs +27 -0
- package/dist/components/typography/headline.cjs +31 -0
- package/dist/components/typography/headline.d.ts +8 -0
- package/dist/components/typography/headline.mjs +27 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/label.cjs +31 -0
- package/dist/components/typography/label.d.ts +8 -0
- package/dist/components/typography/label.mjs +27 -0
- package/dist/components/typography/title.cjs +31 -0
- package/dist/components/typography/title.d.ts +8 -0
- package/dist/components/typography/title.mjs +27 -0
- package/dist/components/typography/typography.cjs +24 -0
- package/dist/components/typography/typography.d.ts +14 -0
- package/dist/components/typography/typography.mjs +15 -0
- package/dist/index.cjs +4 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/styles.css +54 -0
- package/dist/types/search.d.ts +6 -0
- package/dist/types/sheet.d.ts +6 -0
- package/dist/types/side-sheet.d.ts +90 -0
- package/dist/types/table.d.ts +17 -0
- package/dist/types/typography.d.ts +15 -0
- package/package.json +2 -2
- package/dist/components/drawer/context.cjs +0 -14
- package/dist/components/drawer/context.d.ts +0 -10
- package/dist/components/drawer/context.mjs +0 -12
- package/dist/components/drawer/drawer.cjs +0 -92
- package/dist/components/drawer/drawer.d.ts +0 -9
- package/dist/components/drawer/drawer.mjs +0 -88
- package/dist/components/drawer/index.d.ts +0 -2
- package/dist/types/drawer.d.ts +0 -74
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type ColumnDef, type DeepValue, type DeepKeys } from "@tanstack/react-table";
|
|
2
2
|
import type { Column, ContextValue, SortDescriptor } from "../../types/table";
|
|
3
|
-
import type
|
|
3
|
+
import { type CLASS_NAMES } from "./context";
|
|
4
4
|
/**
|
|
5
5
|
* @description
|
|
6
6
|
* use columns
|
|
7
7
|
*/
|
|
8
|
-
export declare const useColumns: <T>({ columns }: {
|
|
8
|
+
export declare const useColumns: <T>({ columns, expandable, }: {
|
|
9
9
|
columns: Column<T>[];
|
|
10
|
+
expandable?: boolean;
|
|
10
11
|
}) => ColumnDef<T, DeepValue<T, DeepKeys<T>>>[];
|
|
11
12
|
/**
|
|
12
13
|
* @author murukal
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
3
|
import { createColumnHelper } from '@tanstack/react-table';
|
|
3
4
|
import React, { useRef, useMemo } from 'react';
|
|
4
5
|
import Cell from './header/cell.mjs';
|
|
5
6
|
import { useControlledState, useEvent } from '@aiszlab/relax';
|
|
7
|
+
import { EXPAND_COLUMN_ID } from './context.mjs';
|
|
8
|
+
import { Button } from '../button/button.mjs';
|
|
9
|
+
import IconExpandLess from '../icon/icons/navigation/expand-less.mjs';
|
|
10
|
+
import IconExpandMore from '../icon/icons/navigation/expand-more.mjs';
|
|
6
11
|
|
|
7
12
|
/**
|
|
8
13
|
* @description
|
|
9
14
|
* use columns
|
|
10
15
|
*/
|
|
11
16
|
var useColumns = function useColumns(_ref) {
|
|
12
|
-
var columns = _ref.columns
|
|
17
|
+
var columns = _ref.columns,
|
|
18
|
+
_ref$expandable = _ref.expandable,
|
|
19
|
+
expandable = _ref$expandable === void 0 ? false : _ref$expandable;
|
|
13
20
|
var helper = useRef(createColumnHelper());
|
|
14
21
|
return useMemo(function () {
|
|
15
|
-
|
|
22
|
+
var dataColumns = columns.map(function (_ref2, index) {
|
|
16
23
|
var _ref3;
|
|
17
24
|
var key = _ref2.key,
|
|
18
25
|
render = _ref2.render,
|
|
@@ -39,19 +46,34 @@ var useColumns = function useColumns(_ref) {
|
|
|
39
46
|
}
|
|
40
47
|
});
|
|
41
48
|
});
|
|
42
|
-
|
|
49
|
+
if (!expandable) return dataColumns;
|
|
50
|
+
return [helper.current.display({
|
|
51
|
+
id: EXPAND_COLUMN_ID,
|
|
52
|
+
header: null,
|
|
53
|
+
cell: function cell(_ref4) {
|
|
54
|
+
var row = _ref4.row;
|
|
55
|
+
return row.getCanExpand() ? (/*#__PURE__*/React.createElement(Button, {
|
|
56
|
+
variant: "text",
|
|
57
|
+
size: "small",
|
|
58
|
+
"aria-label": row.getIsExpanded() ? "收起" : "展开",
|
|
59
|
+
"aria-expanded": row.getIsExpanded(),
|
|
60
|
+
onClick: row.getToggleExpandedHandler()
|
|
61
|
+
}, row.getIsExpanded() ? /*#__PURE__*/React.createElement(IconExpandLess, null) : /*#__PURE__*/React.createElement(IconExpandMore, null))) : null;
|
|
62
|
+
}
|
|
63
|
+
})].concat(_toConsumableArray(dataColumns));
|
|
64
|
+
}, [columns, expandable]);
|
|
43
65
|
};
|
|
44
66
|
/**
|
|
45
67
|
* @author murukal
|
|
46
68
|
* @description
|
|
47
69
|
* for context value
|
|
48
70
|
*/
|
|
49
|
-
var useContextValue = function useContextValue(
|
|
50
|
-
var _table =
|
|
51
|
-
bordered =
|
|
52
|
-
_sortDescriptor =
|
|
53
|
-
_onSortChange =
|
|
54
|
-
classNames =
|
|
71
|
+
var useContextValue = function useContextValue(_ref5) {
|
|
72
|
+
var _table = _ref5.table,
|
|
73
|
+
bordered = _ref5.bordered,
|
|
74
|
+
_sortDescriptor = _ref5.sortDescriptor,
|
|
75
|
+
_onSortChange = _ref5.onSortChange,
|
|
76
|
+
classNames = _ref5.classNames;
|
|
55
77
|
var _useControlledState = useControlledState(_sortDescriptor),
|
|
56
78
|
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
57
79
|
sortDescriptor = _useControlledState2[0],
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var styles = {
|
|
6
|
+
table: {
|
|
7
|
+
"default": {
|
|
8
|
+
kzqmXN: "musaex-h8yej3",
|
|
9
|
+
kLvRdT: "musaex-1mwwwfo",
|
|
10
|
+
$$css: true
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
bodyCell: {
|
|
14
|
+
"default": {
|
|
15
|
+
kjGldf: "musaex-aafj1c",
|
|
16
|
+
kEafiO: "musaex-1ndz9a0",
|
|
17
|
+
kg3NbH: "musaex-1g3a7fl",
|
|
18
|
+
k8WAf4: "musaex-s7sbuz",
|
|
19
|
+
kVAM5u: "musaex-axmpxa",
|
|
20
|
+
ksu8eU: "musaex-1y0btm7",
|
|
21
|
+
kt9PQ7: "musaex-d1xpcx",
|
|
22
|
+
$$css: true
|
|
23
|
+
},
|
|
24
|
+
bordered: {
|
|
25
|
+
kjGldf: "musaex-imutj9",
|
|
26
|
+
$$css: true
|
|
27
|
+
},
|
|
28
|
+
child: {
|
|
29
|
+
kZCmMZ: "musaex-1sznsej",
|
|
30
|
+
$$css: true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
headerCell: {
|
|
34
|
+
"default": {
|
|
35
|
+
kMzoRj: "musaex-k59kd",
|
|
36
|
+
kWkggS: "musaex-k7eln3",
|
|
37
|
+
kVAM5u: "musaex-axmpxa",
|
|
38
|
+
k9WMMc: "musaex-1yc453h",
|
|
39
|
+
kVAEAm: "musaex-1n2onr6",
|
|
40
|
+
kg3NbH: "musaex-1g3a7fl",
|
|
41
|
+
k8WAf4: "musaex-s7sbuz",
|
|
42
|
+
ksu8eU: "musaex-1y0btm7",
|
|
43
|
+
kt9PQ7: "musaex-d1xpcx",
|
|
44
|
+
$$css: true
|
|
45
|
+
},
|
|
46
|
+
unbordered: {
|
|
47
|
+
kI9HWG: "musaex-x7gz8e",
|
|
48
|
+
ko2eyy: "musaex-no41pc",
|
|
49
|
+
kqR9dF: "musaex-1o8gf8",
|
|
50
|
+
kpPfZE: "musaex-1rvbi93",
|
|
51
|
+
kOSWPn: "musaex-8l2ero",
|
|
52
|
+
kQUujV: "musaex-11jkr13",
|
|
53
|
+
knGBE: "musaex-1kmnipp",
|
|
54
|
+
kpnlHG: "musaex-192i3sz",
|
|
55
|
+
$$css: true
|
|
56
|
+
},
|
|
57
|
+
bordered: {
|
|
58
|
+
kMzoRj: "musaex-1iyq3db",
|
|
59
|
+
$$css: true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
headerContent: {
|
|
63
|
+
"default": {
|
|
64
|
+
k1xSpc: "musaex-78zum5",
|
|
65
|
+
kjj79g: "musaex-1qughib",
|
|
66
|
+
kGNEyG: "musaex-6s0dn4",
|
|
67
|
+
$$css: true
|
|
68
|
+
},
|
|
69
|
+
handlers: {
|
|
70
|
+
k1xSpc: "musaex-3nfvp2",
|
|
71
|
+
kXwgrk: "musaex-1q0g3np",
|
|
72
|
+
kOIVth: "musaex-15wobh7",
|
|
73
|
+
kMwMTN: "musaex-14kusyn",
|
|
74
|
+
kfSwDN: "musaex-87ps6o",
|
|
75
|
+
$$css: true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
sort: {
|
|
79
|
+
"default": {
|
|
80
|
+
kVAEAm: "musaex-1n2onr6",
|
|
81
|
+
kkrTdU: "musaex-1ypdohk",
|
|
82
|
+
$$css: true
|
|
83
|
+
},
|
|
84
|
+
half: {
|
|
85
|
+
kVAEAm: "musaex-10l6tqk",
|
|
86
|
+
k87sOh: "musaex-13vifvy",
|
|
87
|
+
kLqNvP: "musaex-1o0tod",
|
|
88
|
+
kZKoxP: "musaex-11g3na9",
|
|
89
|
+
kVQacm: "musaex-b3r6kr",
|
|
90
|
+
$$css: true
|
|
91
|
+
},
|
|
92
|
+
checked: {
|
|
93
|
+
kMwMTN: "musaex-14qql8p",
|
|
94
|
+
$$css: true
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
exports.default = styles;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
declare const styles: {
|
|
2
|
+
table: Readonly<{
|
|
3
|
+
readonly default: Readonly<{
|
|
4
|
+
readonly width: import("@stylexjs/stylex").StyleXClassNameFor<"width", "100%">;
|
|
5
|
+
readonly borderCollapse: import("@stylexjs/stylex").StyleXClassNameFor<"borderCollapse", "collapse">;
|
|
6
|
+
}>;
|
|
7
|
+
}>;
|
|
8
|
+
bodyCell: Readonly<{
|
|
9
|
+
readonly default: Readonly<{
|
|
10
|
+
readonly borderInlineWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderInlineWidth", string>;
|
|
11
|
+
readonly borderBlockStartWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderBlockStartWidth", string>;
|
|
12
|
+
readonly paddingInline: import("@stylexjs/stylex").StyleXClassNameFor<"paddingInline", string>;
|
|
13
|
+
readonly paddingBlock: import("@stylexjs/stylex").StyleXClassNameFor<"paddingBlock", string>;
|
|
14
|
+
readonly borderColor: import("@stylexjs/stylex").StyleXClassNameFor<"borderColor", "var(--color-outline-variant)">;
|
|
15
|
+
readonly borderStyle: import("@stylexjs/stylex").StyleXClassNameFor<"borderStyle", "solid">;
|
|
16
|
+
readonly borderBlockEndWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderBlockEndWidth", string>;
|
|
17
|
+
}>;
|
|
18
|
+
readonly bordered: Readonly<{
|
|
19
|
+
readonly borderInlineWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderInlineWidth", string>;
|
|
20
|
+
}>;
|
|
21
|
+
readonly child: Readonly<{
|
|
22
|
+
readonly paddingInlineStart: import("@stylexjs/stylex").StyleXClassNameFor<"paddingInlineStart", `calc(var(--depth) * ${import("@stylexjs/stylex").StyleXVar<string>})`>;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
headerCell: Readonly<{
|
|
26
|
+
readonly default: Readonly<{
|
|
27
|
+
readonly borderWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderWidth", string>;
|
|
28
|
+
readonly backgroundColor: import("@stylexjs/stylex").StyleXClassNameFor<"backgroundColor", "var(--color-surface)">;
|
|
29
|
+
readonly borderColor: import("@stylexjs/stylex").StyleXClassNameFor<"borderColor", "var(--color-outline-variant)">;
|
|
30
|
+
readonly textAlign: import("@stylexjs/stylex").StyleXClassNameFor<"textAlign", "start">;
|
|
31
|
+
readonly position: import("@stylexjs/stylex").StyleXClassNameFor<"position", "relative">;
|
|
32
|
+
readonly paddingInline: import("@stylexjs/stylex").StyleXClassNameFor<"paddingInline", string>;
|
|
33
|
+
readonly paddingBlock: import("@stylexjs/stylex").StyleXClassNameFor<"paddingBlock", string>;
|
|
34
|
+
readonly borderStyle: import("@stylexjs/stylex").StyleXClassNameFor<"borderStyle", "solid">;
|
|
35
|
+
readonly borderBottomWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderBottomWidth", string>;
|
|
36
|
+
}>;
|
|
37
|
+
readonly unbordered: Readonly<{
|
|
38
|
+
readonly ":not(:last-of-type)::after": import("@stylexjs/stylex").StyleXClassNameFor<":not(:last-of-type)::after", {
|
|
39
|
+
readonly content: "\"\"";
|
|
40
|
+
readonly position: "absolute";
|
|
41
|
+
readonly top: "50%";
|
|
42
|
+
readonly width: import("@stylexjs/stylex").StyleXVar<string>;
|
|
43
|
+
readonly height: import("@stylexjs/stylex").StyleXVar<string>;
|
|
44
|
+
readonly backgroundColor: "var(--color-outline-variant)";
|
|
45
|
+
readonly transform: "translateY(-50%)";
|
|
46
|
+
readonly insetInlineEnd: 0;
|
|
47
|
+
}>;
|
|
48
|
+
}>;
|
|
49
|
+
readonly bordered: Readonly<{
|
|
50
|
+
readonly borderWidth: import("@stylexjs/stylex").StyleXClassNameFor<"borderWidth", string>;
|
|
51
|
+
}>;
|
|
52
|
+
}>;
|
|
53
|
+
headerContent: Readonly<{
|
|
54
|
+
readonly default: Readonly<{
|
|
55
|
+
readonly display: import("@stylexjs/stylex").StyleXClassNameFor<"display", "flex">;
|
|
56
|
+
readonly justifyContent: import("@stylexjs/stylex").StyleXClassNameFor<"justifyContent", "space-between">;
|
|
57
|
+
readonly alignItems: import("@stylexjs/stylex").StyleXClassNameFor<"alignItems", "center">;
|
|
58
|
+
}>;
|
|
59
|
+
readonly handlers: Readonly<{
|
|
60
|
+
readonly display: import("@stylexjs/stylex").StyleXClassNameFor<"display", "inline-flex">;
|
|
61
|
+
readonly flexDirection: import("@stylexjs/stylex").StyleXClassNameFor<"flexDirection", "row">;
|
|
62
|
+
readonly gap: import("@stylexjs/stylex").StyleXClassNameFor<"gap", string>;
|
|
63
|
+
readonly color: import("@stylexjs/stylex").StyleXClassNameFor<"color", "var(--color-surface-container-highest)">;
|
|
64
|
+
readonly userSelect: import("@stylexjs/stylex").StyleXClassNameFor<"userSelect", "none">;
|
|
65
|
+
}>;
|
|
66
|
+
}>;
|
|
67
|
+
sort: Readonly<{
|
|
68
|
+
readonly default: Readonly<{
|
|
69
|
+
readonly position: import("@stylexjs/stylex").StyleXClassNameFor<"position", "relative">;
|
|
70
|
+
readonly cursor: import("@stylexjs/stylex").StyleXClassNameFor<"cursor", "pointer">;
|
|
71
|
+
}>;
|
|
72
|
+
readonly half: Readonly<{
|
|
73
|
+
readonly position: import("@stylexjs/stylex").StyleXClassNameFor<"position", "absolute">;
|
|
74
|
+
readonly insetBlockStart: import("@stylexjs/stylex").StyleXClassNameFor<"insetBlockStart", 0>;
|
|
75
|
+
readonly insetInlineStart: import("@stylexjs/stylex").StyleXClassNameFor<"insetInlineStart", 0>;
|
|
76
|
+
readonly height: import("@stylexjs/stylex").StyleXClassNameFor<"height", string>;
|
|
77
|
+
readonly overflow: import("@stylexjs/stylex").StyleXClassNameFor<"overflow", "hidden">;
|
|
78
|
+
}>;
|
|
79
|
+
readonly checked: Readonly<{
|
|
80
|
+
readonly color: import("@stylexjs/stylex").StyleXClassNameFor<"color", "var(--color-primary)">;
|
|
81
|
+
}>;
|
|
82
|
+
}>;
|
|
83
|
+
};
|
|
84
|
+
export default styles;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
table: {
|
|
3
|
+
"default": {
|
|
4
|
+
kzqmXN: "musaex-h8yej3",
|
|
5
|
+
kLvRdT: "musaex-1mwwwfo",
|
|
6
|
+
$$css: true
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
bodyCell: {
|
|
10
|
+
"default": {
|
|
11
|
+
kjGldf: "musaex-aafj1c",
|
|
12
|
+
kEafiO: "musaex-1ndz9a0",
|
|
13
|
+
kg3NbH: "musaex-1g3a7fl",
|
|
14
|
+
k8WAf4: "musaex-s7sbuz",
|
|
15
|
+
kVAM5u: "musaex-axmpxa",
|
|
16
|
+
ksu8eU: "musaex-1y0btm7",
|
|
17
|
+
kt9PQ7: "musaex-d1xpcx",
|
|
18
|
+
$$css: true
|
|
19
|
+
},
|
|
20
|
+
bordered: {
|
|
21
|
+
kjGldf: "musaex-imutj9",
|
|
22
|
+
$$css: true
|
|
23
|
+
},
|
|
24
|
+
child: {
|
|
25
|
+
kZCmMZ: "musaex-1sznsej",
|
|
26
|
+
$$css: true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
headerCell: {
|
|
30
|
+
"default": {
|
|
31
|
+
kMzoRj: "musaex-k59kd",
|
|
32
|
+
kWkggS: "musaex-k7eln3",
|
|
33
|
+
kVAM5u: "musaex-axmpxa",
|
|
34
|
+
k9WMMc: "musaex-1yc453h",
|
|
35
|
+
kVAEAm: "musaex-1n2onr6",
|
|
36
|
+
kg3NbH: "musaex-1g3a7fl",
|
|
37
|
+
k8WAf4: "musaex-s7sbuz",
|
|
38
|
+
ksu8eU: "musaex-1y0btm7",
|
|
39
|
+
kt9PQ7: "musaex-d1xpcx",
|
|
40
|
+
$$css: true
|
|
41
|
+
},
|
|
42
|
+
unbordered: {
|
|
43
|
+
kI9HWG: "musaex-x7gz8e",
|
|
44
|
+
ko2eyy: "musaex-no41pc",
|
|
45
|
+
kqR9dF: "musaex-1o8gf8",
|
|
46
|
+
kpPfZE: "musaex-1rvbi93",
|
|
47
|
+
kOSWPn: "musaex-8l2ero",
|
|
48
|
+
kQUujV: "musaex-11jkr13",
|
|
49
|
+
knGBE: "musaex-1kmnipp",
|
|
50
|
+
kpnlHG: "musaex-192i3sz",
|
|
51
|
+
$$css: true
|
|
52
|
+
},
|
|
53
|
+
bordered: {
|
|
54
|
+
kMzoRj: "musaex-1iyq3db",
|
|
55
|
+
$$css: true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
headerContent: {
|
|
59
|
+
"default": {
|
|
60
|
+
k1xSpc: "musaex-78zum5",
|
|
61
|
+
kjj79g: "musaex-1qughib",
|
|
62
|
+
kGNEyG: "musaex-6s0dn4",
|
|
63
|
+
$$css: true
|
|
64
|
+
},
|
|
65
|
+
handlers: {
|
|
66
|
+
k1xSpc: "musaex-3nfvp2",
|
|
67
|
+
kXwgrk: "musaex-1q0g3np",
|
|
68
|
+
kOIVth: "musaex-15wobh7",
|
|
69
|
+
kMwMTN: "musaex-14kusyn",
|
|
70
|
+
kfSwDN: "musaex-87ps6o",
|
|
71
|
+
$$css: true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
sort: {
|
|
75
|
+
"default": {
|
|
76
|
+
kVAEAm: "musaex-1n2onr6",
|
|
77
|
+
kkrTdU: "musaex-1ypdohk",
|
|
78
|
+
$$css: true
|
|
79
|
+
},
|
|
80
|
+
half: {
|
|
81
|
+
kVAEAm: "musaex-10l6tqk",
|
|
82
|
+
k87sOh: "musaex-13vifvy",
|
|
83
|
+
kLqNvP: "musaex-1o0tod",
|
|
84
|
+
kZKoxP: "musaex-11g3na9",
|
|
85
|
+
kVQacm: "musaex-b3r6kr",
|
|
86
|
+
$$css: true
|
|
87
|
+
},
|
|
88
|
+
checked: {
|
|
89
|
+
kMwMTN: "musaex-14qql8p",
|
|
90
|
+
$$css: true
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { styles as default };
|
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
6
7
|
var reactTable = require('@tanstack/react-table');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var hooks = require('./hooks.cjs');
|
|
9
10
|
var header = require('./header/header.cjs');
|
|
10
11
|
var context = require('./context.cjs');
|
|
11
12
|
var body = require('./body.cjs');
|
|
13
|
+
var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
|
|
12
14
|
var className = require('@aiszlab/relax/class-name');
|
|
13
15
|
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
14
16
|
var loading = require('../loading/loading.cjs');
|
|
17
|
+
var styles = require('./styles.cjs');
|
|
18
|
+
var relax = require('@aiszlab/relax');
|
|
15
19
|
|
|
16
20
|
var Table = function Table(_ref) {
|
|
17
21
|
var _ref$bordered = _ref.bordered,
|
|
@@ -25,16 +29,56 @@ var Table = function Table(_ref) {
|
|
|
25
29
|
className$1 = _ref.className,
|
|
26
30
|
style = _ref.style,
|
|
27
31
|
_ref$loading = _ref.loading,
|
|
28
|
-
loading$1 = _ref$loading === void 0 ? false : _ref$loading
|
|
32
|
+
loading$1 = _ref$loading === void 0 ? false : _ref$loading,
|
|
33
|
+
_ref$expandable = _ref.expandable,
|
|
34
|
+
expandable = _ref$expandable === void 0 ? false : _ref$expandable,
|
|
35
|
+
expandedKeys = _ref.expandedKeys,
|
|
36
|
+
_ref$defaultExpandedK = _ref.defaultExpandedKeys,
|
|
37
|
+
defaultExpandedKeys = _ref$defaultExpandedK === void 0 ? [] : _ref$defaultExpandedK,
|
|
38
|
+
onExpandedKeysChange = _ref.onExpandedKeysChange,
|
|
39
|
+
rowKey = _ref.rowKey;
|
|
29
40
|
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
30
41
|
var columns = hooks.useColumns({
|
|
31
|
-
columns: _columns
|
|
42
|
+
columns: _columns,
|
|
43
|
+
expandable: expandable
|
|
32
44
|
});
|
|
33
|
-
var
|
|
45
|
+
var _useState = React.useState(function () {
|
|
46
|
+
return Object.fromEntries(defaultExpandedKeys.map(function (key) {
|
|
47
|
+
return [String(key), true];
|
|
48
|
+
}));
|
|
49
|
+
}),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
uncontrolledExpanded = _useState2[0],
|
|
52
|
+
setUncontrolledExpanded = _useState2[1];
|
|
53
|
+
var expanded = React.useMemo(function () {
|
|
54
|
+
return relax.isUndefined(expandedKeys) ? uncontrolledExpanded : Object.fromEntries(expandedKeys.map(function (key) {
|
|
55
|
+
return [String(key), true];
|
|
56
|
+
}));
|
|
57
|
+
}, [expandedKeys, uncontrolledExpanded]);
|
|
58
|
+
var table = reactTable.useReactTable(_objectSpread(_objectSpread({
|
|
34
59
|
columns: columns,
|
|
35
60
|
data: dataSource,
|
|
36
61
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
37
|
-
}
|
|
62
|
+
}, expandable && {
|
|
63
|
+
getSubRows: function getSubRows(record) {
|
|
64
|
+
return record.children;
|
|
65
|
+
},
|
|
66
|
+
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
|
67
|
+
state: {
|
|
68
|
+
expanded: expanded
|
|
69
|
+
},
|
|
70
|
+
onExpandedChange: function onExpandedChange(updater) {
|
|
71
|
+
var next = relax.isFunction(updater) ? updater(expanded) : updater;
|
|
72
|
+
if (relax.isUndefined(expandedKeys)) setUncontrolledExpanded(next);
|
|
73
|
+
onExpandedKeysChange === null || onExpandedKeysChange === void 0 || onExpandedKeysChange(next === true ? table.getRowModel().flatRows.map(function (row) {
|
|
74
|
+
return row.id;
|
|
75
|
+
}) : Object.keys(next));
|
|
76
|
+
}
|
|
77
|
+
}), rowKey && {
|
|
78
|
+
getRowId: function getRowId(record, index, parent) {
|
|
79
|
+
return String(relax.isFunction(rowKey) ? rowKey(record, index, parent === null || parent === void 0 ? void 0 : parent.original) : record[rowKey]);
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
38
82
|
var contextValue = hooks.useContextValue({
|
|
39
83
|
table: table,
|
|
40
84
|
bordered: bordered,
|
|
@@ -42,9 +86,7 @@ var Table = function Table(_ref) {
|
|
|
42
86
|
onSortChange: onSortChange,
|
|
43
87
|
classNames: classNames
|
|
44
88
|
});
|
|
45
|
-
var styled =
|
|
46
|
-
className: "musaex-h8yej3 musaex-1mwwwfo"
|
|
47
|
-
};
|
|
89
|
+
var styled = stylex.props(styles.default.table["default"]);
|
|
48
90
|
return /*#__PURE__*/React.createElement(context.Context.Provider, {
|
|
49
91
|
value: contextValue
|
|
50
92
|
}, /*#__PURE__*/React.createElement(loading.default, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { TableProps } from "../../types/table";
|
|
3
|
-
declare const Table: <T>({ bordered, dataSource, columns: _columns, sortDescriptor, onSortChange, className, style, loading, }: TableProps<T>) => React.JSX.Element;
|
|
3
|
+
declare const Table: <T>({ bordered, dataSource, columns: _columns, sortDescriptor, onSortChange, className, style, loading, expandable, expandedKeys, defaultExpandedKeys, onExpandedKeysChange, rowKey, }: TableProps<T>) => React.JSX.Element;
|
|
4
4
|
export default Table;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import { useReactTable, getCoreRowModel, getExpandedRowModel } from '@tanstack/react-table';
|
|
4
|
+
import React, { useState, useMemo } from 'react';
|
|
4
5
|
import { useColumns, useContextValue } from './hooks.mjs';
|
|
5
6
|
import Header from './header/header.mjs';
|
|
6
7
|
import { Context, CLASS_NAMES } from './context.mjs';
|
|
7
8
|
import Body from './body.mjs';
|
|
9
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
8
10
|
import { stringify } from '@aiszlab/relax/class-name';
|
|
9
11
|
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
10
12
|
import Loading from '../loading/loading.mjs';
|
|
13
|
+
import styles from './styles.mjs';
|
|
14
|
+
import { isUndefined, isFunction } from '@aiszlab/relax';
|
|
11
15
|
|
|
12
16
|
var Table = function Table(_ref) {
|
|
13
17
|
var _ref$bordered = _ref.bordered,
|
|
@@ -21,16 +25,56 @@ var Table = function Table(_ref) {
|
|
|
21
25
|
className = _ref.className,
|
|
22
26
|
style = _ref.style,
|
|
23
27
|
_ref$loading = _ref.loading,
|
|
24
|
-
loading = _ref$loading === void 0 ? false : _ref$loading
|
|
28
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
29
|
+
_ref$expandable = _ref.expandable,
|
|
30
|
+
expandable = _ref$expandable === void 0 ? false : _ref$expandable,
|
|
31
|
+
expandedKeys = _ref.expandedKeys,
|
|
32
|
+
_ref$defaultExpandedK = _ref.defaultExpandedKeys,
|
|
33
|
+
defaultExpandedKeys = _ref$defaultExpandedK === void 0 ? [] : _ref$defaultExpandedK,
|
|
34
|
+
onExpandedKeysChange = _ref.onExpandedKeysChange,
|
|
35
|
+
rowKey = _ref.rowKey;
|
|
25
36
|
var classNames = useClassNames(CLASS_NAMES);
|
|
26
37
|
var columns = useColumns({
|
|
27
|
-
columns: _columns
|
|
38
|
+
columns: _columns,
|
|
39
|
+
expandable: expandable
|
|
28
40
|
});
|
|
29
|
-
var
|
|
41
|
+
var _useState = useState(function () {
|
|
42
|
+
return Object.fromEntries(defaultExpandedKeys.map(function (key) {
|
|
43
|
+
return [String(key), true];
|
|
44
|
+
}));
|
|
45
|
+
}),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
uncontrolledExpanded = _useState2[0],
|
|
48
|
+
setUncontrolledExpanded = _useState2[1];
|
|
49
|
+
var expanded = useMemo(function () {
|
|
50
|
+
return isUndefined(expandedKeys) ? uncontrolledExpanded : Object.fromEntries(expandedKeys.map(function (key) {
|
|
51
|
+
return [String(key), true];
|
|
52
|
+
}));
|
|
53
|
+
}, [expandedKeys, uncontrolledExpanded]);
|
|
54
|
+
var table = useReactTable(_objectSpread(_objectSpread({
|
|
30
55
|
columns: columns,
|
|
31
56
|
data: dataSource,
|
|
32
57
|
getCoreRowModel: getCoreRowModel()
|
|
33
|
-
}
|
|
58
|
+
}, expandable && {
|
|
59
|
+
getSubRows: function getSubRows(record) {
|
|
60
|
+
return record.children;
|
|
61
|
+
},
|
|
62
|
+
getExpandedRowModel: getExpandedRowModel(),
|
|
63
|
+
state: {
|
|
64
|
+
expanded: expanded
|
|
65
|
+
},
|
|
66
|
+
onExpandedChange: function onExpandedChange(updater) {
|
|
67
|
+
var next = isFunction(updater) ? updater(expanded) : updater;
|
|
68
|
+
if (isUndefined(expandedKeys)) setUncontrolledExpanded(next);
|
|
69
|
+
onExpandedKeysChange === null || onExpandedKeysChange === void 0 || onExpandedKeysChange(next === true ? table.getRowModel().flatRows.map(function (row) {
|
|
70
|
+
return row.id;
|
|
71
|
+
}) : Object.keys(next));
|
|
72
|
+
}
|
|
73
|
+
}), rowKey && {
|
|
74
|
+
getRowId: function getRowId(record, index, parent) {
|
|
75
|
+
return String(isFunction(rowKey) ? rowKey(record, index, parent === null || parent === void 0 ? void 0 : parent.original) : record[rowKey]);
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
34
78
|
var contextValue = useContextValue({
|
|
35
79
|
table: table,
|
|
36
80
|
bordered: bordered,
|
|
@@ -38,9 +82,7 @@ var Table = function Table(_ref) {
|
|
|
38
82
|
onSortChange: onSortChange,
|
|
39
83
|
classNames: classNames
|
|
40
84
|
});
|
|
41
|
-
var styled =
|
|
42
|
-
className: "musaex-h8yej3 musaex-1mwwwfo"
|
|
43
|
-
};
|
|
85
|
+
var styled = props(styles.table["default"]);
|
|
44
86
|
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
45
87
|
value: contextValue
|
|
46
88
|
}, /*#__PURE__*/React.createElement(Loading, {
|
|
@@ -4,6 +4,29 @@
|
|
|
4
4
|
* @description
|
|
5
5
|
* typography - display
|
|
6
6
|
*/
|
|
7
|
+
var $display = {
|
|
8
|
+
small: {
|
|
9
|
+
kGuDYH: "musaex-qozcyj",
|
|
10
|
+
k63SB2: "musaex-o1l8bm",
|
|
11
|
+
kLWn49: "musaex-bzal7z",
|
|
12
|
+
kb6lSQ: "musaex-1jcmgtk",
|
|
13
|
+
$$css: true
|
|
14
|
+
},
|
|
15
|
+
medium: {
|
|
16
|
+
kGuDYH: "musaex-ujqvrl",
|
|
17
|
+
k63SB2: "musaex-o1l8bm",
|
|
18
|
+
kLWn49: "musaex-5agonf",
|
|
19
|
+
kb6lSQ: "musaex-1jcmgtk",
|
|
20
|
+
$$css: true
|
|
21
|
+
},
|
|
22
|
+
large: {
|
|
23
|
+
kGuDYH: "musaex-8p9s6c",
|
|
24
|
+
k63SB2: "musaex-o1l8bm",
|
|
25
|
+
kLWn49: "musaex-1kke7aa",
|
|
26
|
+
kb6lSQ: "musaex-1i67g9q",
|
|
27
|
+
$$css: true
|
|
28
|
+
}
|
|
29
|
+
};
|
|
7
30
|
/**
|
|
8
31
|
* @description
|
|
9
32
|
* typography - headline
|
|
@@ -36,6 +59,13 @@ var $headline = {
|
|
|
36
59
|
* typography - title
|
|
37
60
|
*/
|
|
38
61
|
var $title = {
|
|
62
|
+
small: {
|
|
63
|
+
kGuDYH: "musaex-if65rj",
|
|
64
|
+
k63SB2: "musaex-o1l8bm",
|
|
65
|
+
kLWn49: "musaex-1fc57z9",
|
|
66
|
+
kb6lSQ: "musaex-19d5yem",
|
|
67
|
+
$$css: true
|
|
68
|
+
},
|
|
39
69
|
medium: {
|
|
40
70
|
kGuDYH: "musaex-1j61zf2",
|
|
41
71
|
k63SB2: "musaex-o1l8bm",
|
|
@@ -117,6 +147,7 @@ var $scrollbar = {
|
|
|
117
147
|
};
|
|
118
148
|
|
|
119
149
|
exports.$body = $body;
|
|
150
|
+
exports.$display = $display;
|
|
120
151
|
exports.$headline = $headline;
|
|
121
152
|
exports.$label = $label;
|
|
122
153
|
exports.$scrollbar = $scrollbar;
|
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
* @description
|
|
3
3
|
* typography - display
|
|
4
4
|
*/
|
|
5
|
+
var $display = {
|
|
6
|
+
small: {
|
|
7
|
+
kGuDYH: "musaex-qozcyj",
|
|
8
|
+
k63SB2: "musaex-o1l8bm",
|
|
9
|
+
kLWn49: "musaex-bzal7z",
|
|
10
|
+
kb6lSQ: "musaex-1jcmgtk",
|
|
11
|
+
$$css: true
|
|
12
|
+
},
|
|
13
|
+
medium: {
|
|
14
|
+
kGuDYH: "musaex-ujqvrl",
|
|
15
|
+
k63SB2: "musaex-o1l8bm",
|
|
16
|
+
kLWn49: "musaex-5agonf",
|
|
17
|
+
kb6lSQ: "musaex-1jcmgtk",
|
|
18
|
+
$$css: true
|
|
19
|
+
},
|
|
20
|
+
large: {
|
|
21
|
+
kGuDYH: "musaex-8p9s6c",
|
|
22
|
+
k63SB2: "musaex-o1l8bm",
|
|
23
|
+
kLWn49: "musaex-1kke7aa",
|
|
24
|
+
kb6lSQ: "musaex-1i67g9q",
|
|
25
|
+
$$css: true
|
|
26
|
+
}
|
|
27
|
+
};
|
|
5
28
|
/**
|
|
6
29
|
* @description
|
|
7
30
|
* typography - headline
|
|
@@ -34,6 +57,13 @@ var $headline = {
|
|
|
34
57
|
* typography - title
|
|
35
58
|
*/
|
|
36
59
|
var $title = {
|
|
60
|
+
small: {
|
|
61
|
+
kGuDYH: "musaex-if65rj",
|
|
62
|
+
k63SB2: "musaex-o1l8bm",
|
|
63
|
+
kLWn49: "musaex-1fc57z9",
|
|
64
|
+
kb6lSQ: "musaex-19d5yem",
|
|
65
|
+
$$css: true
|
|
66
|
+
},
|
|
37
67
|
medium: {
|
|
38
68
|
kGuDYH: "musaex-1j61zf2",
|
|
39
69
|
k63SB2: "musaex-o1l8bm",
|
|
@@ -114,4 +144,4 @@ var $scrollbar = {
|
|
|
114
144
|
}
|
|
115
145
|
};
|
|
116
146
|
|
|
117
|
-
export { $body, $headline, $label, $scrollbar, $title };
|
|
147
|
+
export { $body, $display, $headline, $label, $scrollbar, $title };
|
|
@@ -148,3 +148,10 @@ export declare const duration: import("@stylexjs/stylex").VarGroup<Readonly<{
|
|
|
148
148
|
long: string;
|
|
149
149
|
longest: string;
|
|
150
150
|
}>, symbol>;
|
|
151
|
+
/**
|
|
152
|
+
* @zh 响应式断点。`mobile` 匹配宽度 < 905px 的视口。
|
|
153
|
+
* @en Responsive breakpoints. `mobile` matches viewports narrower than 905px.
|
|
154
|
+
*/
|
|
155
|
+
export declare const breakpoints: {
|
|
156
|
+
mobile: string;
|
|
157
|
+
};
|