@rockshin/tao-ui 0.0.7 → 0.0.9
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/components/input/input.d.ts +2 -2
- package/dist/components/input/input.js +32 -29
- package/dist/components/input-number/input-number.d.ts +22 -0
- package/dist/components/input-number/input-number.js +104 -0
- package/dist/components/table/table.css +36 -11
- package/dist/components/table/table.d.ts +17 -5
- package/dist/components/table/table.js +296 -324
- package/dist/components/tag/tag.css +5 -8
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/number-input/index.d.ts +1 -2
- package/dist/number-input/index.js +1 -1
- package/dist/number-input/number-input.d.ts +9 -2
- package/dist/number-input/number-input.js +3 -2
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
|
|
3
3
|
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
4
4
|
import './input.css';
|
|
@@ -12,4 +12,4 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
12
12
|
classNames?: SemanticClassNames<InputSemanticPart>;
|
|
13
13
|
styles?: SemanticStyles<InputSemanticPart>;
|
|
14
14
|
}
|
|
15
|
-
export declare
|
|
15
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
3
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
4
5
|
import { cx } from "../../utils/semantic.js";
|
|
5
6
|
import "./input.css";
|
|
6
|
-
|
|
7
|
-
const $ = c(
|
|
7
|
+
const input_Input = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
8
|
+
const $ = c(42);
|
|
8
9
|
let className;
|
|
9
10
|
let classNames;
|
|
10
11
|
let disabled;
|
|
@@ -84,36 +85,38 @@ function Input(t0) {
|
|
|
84
85
|
const t8 = styles?.input;
|
|
85
86
|
const t9 = error || void 0;
|
|
86
87
|
let t10;
|
|
87
|
-
if ($[22] !==
|
|
88
|
+
if ($[22] !== ref || $[23] !== resolvedDisabled || $[24] !== rest || $[25] !== t7 || $[26] !== t8 || $[27] !== t9) {
|
|
88
89
|
t10 = /*#__PURE__*/ jsx("input", {
|
|
89
90
|
...rest,
|
|
91
|
+
ref: ref,
|
|
90
92
|
className: t7,
|
|
91
93
|
style: t8,
|
|
92
94
|
disabled: resolvedDisabled,
|
|
93
95
|
"aria-invalid": t9
|
|
94
96
|
});
|
|
95
|
-
$[22] =
|
|
96
|
-
$[23] =
|
|
97
|
-
$[24] =
|
|
98
|
-
$[25] =
|
|
99
|
-
$[26] =
|
|
100
|
-
$[27] =
|
|
101
|
-
|
|
97
|
+
$[22] = ref;
|
|
98
|
+
$[23] = resolvedDisabled;
|
|
99
|
+
$[24] = rest;
|
|
100
|
+
$[25] = t7;
|
|
101
|
+
$[26] = t8;
|
|
102
|
+
$[27] = t9;
|
|
103
|
+
$[28] = t10;
|
|
104
|
+
} else t10 = $[28];
|
|
102
105
|
let t11;
|
|
103
|
-
if ($[
|
|
106
|
+
if ($[29] !== classNames?.suffix || $[30] !== styles?.suffix || $[31] !== suffix) {
|
|
104
107
|
t11 = null != suffix && /*#__PURE__*/ jsx("span", {
|
|
105
108
|
className: classNames?.suffix,
|
|
106
109
|
style: styles?.suffix,
|
|
107
110
|
"data-tao-suffix": "",
|
|
108
111
|
children: suffix
|
|
109
112
|
});
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
} else t11 = $[
|
|
113
|
+
$[29] = classNames?.suffix;
|
|
114
|
+
$[30] = styles?.suffix;
|
|
115
|
+
$[31] = suffix;
|
|
116
|
+
$[32] = t11;
|
|
117
|
+
} else t11 = $[32];
|
|
115
118
|
let t12;
|
|
116
|
-
if ($[
|
|
119
|
+
if ($[33] !== resolvedSize || $[34] !== resolvedVariant || $[35] !== t10 || $[36] !== t11 || $[37] !== t2 || $[38] !== t4 || $[39] !== t5 || $[40] !== t6) {
|
|
117
120
|
t12 = /*#__PURE__*/ jsxs("div", {
|
|
118
121
|
className: t2,
|
|
119
122
|
style: t4,
|
|
@@ -128,16 +131,16 @@ function Input(t0) {
|
|
|
128
131
|
t11
|
|
129
132
|
]
|
|
130
133
|
});
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
} else t12 = $[
|
|
134
|
+
$[33] = resolvedSize;
|
|
135
|
+
$[34] = resolvedVariant;
|
|
136
|
+
$[35] = t10;
|
|
137
|
+
$[36] = t11;
|
|
138
|
+
$[37] = t2;
|
|
139
|
+
$[38] = t4;
|
|
140
|
+
$[39] = t5;
|
|
141
|
+
$[40] = t6;
|
|
142
|
+
$[41] = t12;
|
|
143
|
+
} else t12 = $[41];
|
|
141
144
|
return t12;
|
|
142
|
-
}
|
|
143
|
-
export { Input };
|
|
145
|
+
});
|
|
146
|
+
export { input_Input as Input };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type UseNumberInputOptions } from '../../number-input/use-number-input';
|
|
3
|
+
import type { TaoSize, TaoVariant } from '../../provider/tao-provider';
|
|
4
|
+
import type { SemanticClassNames, SemanticStyles } from '../../utils/semantic';
|
|
5
|
+
import { type InputSemanticPart } from '../input/input';
|
|
6
|
+
export type InputNumberSemanticPart = InputSemanticPart;
|
|
7
|
+
export interface InputNumberProps extends UseNumberInputOptions {
|
|
8
|
+
prefix?: ReactNode;
|
|
9
|
+
suffix?: ReactNode;
|
|
10
|
+
size?: TaoSize;
|
|
11
|
+
variant?: TaoVariant;
|
|
12
|
+
error?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
id?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
classNames?: SemanticClassNames<InputNumberSemanticPart>;
|
|
20
|
+
styles?: SemanticStyles<InputNumberSemanticPart>;
|
|
21
|
+
}
|
|
22
|
+
export declare function InputNumber({ prefix, suffix, size, variant, error, disabled, placeholder, id, name, 'aria-label': ariaLabel, className, classNames, styles, ...hookOptions }: InputNumberProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useNumberInput } from "../../number-input/use-number-input.js";
|
|
4
|
+
import { Input } from "../input/input.js";
|
|
5
|
+
function InputNumber(t0) {
|
|
6
|
+
const $ = c(34);
|
|
7
|
+
let ariaLabel;
|
|
8
|
+
let className;
|
|
9
|
+
let classNames;
|
|
10
|
+
let disabled;
|
|
11
|
+
let error;
|
|
12
|
+
let hookOptions;
|
|
13
|
+
let id;
|
|
14
|
+
let name;
|
|
15
|
+
let placeholder;
|
|
16
|
+
let prefix;
|
|
17
|
+
let size;
|
|
18
|
+
let styles;
|
|
19
|
+
let suffix;
|
|
20
|
+
let variant;
|
|
21
|
+
if ($[0] !== t0) {
|
|
22
|
+
({ prefix, suffix, size, variant, error, disabled, placeholder, id, name, "aria-label": ariaLabel, className, classNames, styles, ...hookOptions } = t0);
|
|
23
|
+
$[0] = t0;
|
|
24
|
+
$[1] = ariaLabel;
|
|
25
|
+
$[2] = className;
|
|
26
|
+
$[3] = classNames;
|
|
27
|
+
$[4] = disabled;
|
|
28
|
+
$[5] = error;
|
|
29
|
+
$[6] = hookOptions;
|
|
30
|
+
$[7] = id;
|
|
31
|
+
$[8] = name;
|
|
32
|
+
$[9] = placeholder;
|
|
33
|
+
$[10] = prefix;
|
|
34
|
+
$[11] = size;
|
|
35
|
+
$[12] = styles;
|
|
36
|
+
$[13] = suffix;
|
|
37
|
+
$[14] = variant;
|
|
38
|
+
} else {
|
|
39
|
+
ariaLabel = $[1];
|
|
40
|
+
className = $[2];
|
|
41
|
+
classNames = $[3];
|
|
42
|
+
disabled = $[4];
|
|
43
|
+
error = $[5];
|
|
44
|
+
hookOptions = $[6];
|
|
45
|
+
id = $[7];
|
|
46
|
+
name = $[8];
|
|
47
|
+
placeholder = $[9];
|
|
48
|
+
prefix = $[10];
|
|
49
|
+
size = $[11];
|
|
50
|
+
styles = $[12];
|
|
51
|
+
suffix = $[13];
|
|
52
|
+
variant = $[14];
|
|
53
|
+
}
|
|
54
|
+
const { inputProps } = useNumberInput(hookOptions);
|
|
55
|
+
let inputRest;
|
|
56
|
+
let ref;
|
|
57
|
+
if ($[15] !== inputProps) {
|
|
58
|
+
({ ref, ...inputRest } = inputProps);
|
|
59
|
+
$[15] = inputProps;
|
|
60
|
+
$[16] = inputRest;
|
|
61
|
+
$[17] = ref;
|
|
62
|
+
} else {
|
|
63
|
+
inputRest = $[16];
|
|
64
|
+
ref = $[17];
|
|
65
|
+
}
|
|
66
|
+
let t1;
|
|
67
|
+
if ($[18] !== ariaLabel || $[19] !== className || $[20] !== classNames || $[21] !== disabled || $[22] !== error || $[23] !== id || $[24] !== inputRest || $[25] !== name || $[26] !== placeholder || $[27] !== prefix || $[28] !== ref || $[29] !== size || $[30] !== styles || $[31] !== suffix || $[32] !== variant) {
|
|
68
|
+
t1 = /*#__PURE__*/ jsx(Input, {
|
|
69
|
+
ref: ref,
|
|
70
|
+
prefix: prefix,
|
|
71
|
+
suffix: suffix,
|
|
72
|
+
size: size,
|
|
73
|
+
variant: variant,
|
|
74
|
+
error: error,
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
placeholder: placeholder,
|
|
77
|
+
id: id,
|
|
78
|
+
name: name,
|
|
79
|
+
"aria-label": ariaLabel,
|
|
80
|
+
className: className,
|
|
81
|
+
classNames: classNames,
|
|
82
|
+
styles: styles,
|
|
83
|
+
...inputRest
|
|
84
|
+
});
|
|
85
|
+
$[18] = ariaLabel;
|
|
86
|
+
$[19] = className;
|
|
87
|
+
$[20] = classNames;
|
|
88
|
+
$[21] = disabled;
|
|
89
|
+
$[22] = error;
|
|
90
|
+
$[23] = id;
|
|
91
|
+
$[24] = inputRest;
|
|
92
|
+
$[25] = name;
|
|
93
|
+
$[26] = placeholder;
|
|
94
|
+
$[27] = prefix;
|
|
95
|
+
$[28] = ref;
|
|
96
|
+
$[29] = size;
|
|
97
|
+
$[30] = styles;
|
|
98
|
+
$[31] = suffix;
|
|
99
|
+
$[32] = variant;
|
|
100
|
+
$[33] = t1;
|
|
101
|
+
} else t1 = $[33];
|
|
102
|
+
return t1;
|
|
103
|
+
}
|
|
104
|
+
export { InputNumber };
|
|
@@ -9,6 +9,19 @@
|
|
|
9
9
|
--tao-table-row-selected-hover-bg: oklch(0% 0 0 / .07);
|
|
10
10
|
--tao-table-border-color: var(--tao-color-border-secondary);
|
|
11
11
|
--tao-table-frame-radius: var(--tao-radius-md);
|
|
12
|
+
--tao-table-cell-padding-block: var(--tao-padding-sm);
|
|
13
|
+
--tao-table-cell-padding-inline: var(--tao-padding);
|
|
14
|
+
--tao-table-cell-font-size: var(--tao-font-size-base);
|
|
15
|
+
--tao-table-cell-line-height: var(--tao-line-height);
|
|
16
|
+
--tao-table-header-cell-padding-block: var(--tao-table-cell-padding-block);
|
|
17
|
+
--tao-table-header-cell-padding-inline: var(--tao-table-cell-padding-inline);
|
|
18
|
+
--tao-table-header-font-size: var(--tao-table-cell-font-size);
|
|
19
|
+
--tao-table-header-font-weight: var(--tao-font-weight-medium);
|
|
20
|
+
--tao-table-header-letter-spacing: normal;
|
|
21
|
+
--tao-table-header-text-transform: none;
|
|
22
|
+
--tao-table-empty-padding-block: var(--tao-padding-xl);
|
|
23
|
+
--tao-table-empty-padding-inline: var(--tao-padding);
|
|
24
|
+
--tao-table-empty-color: var(--tao-color-text-tertiary);
|
|
12
25
|
position: relative;
|
|
13
26
|
}
|
|
14
27
|
|
|
@@ -53,7 +66,10 @@
|
|
|
53
66
|
}
|
|
54
67
|
|
|
55
68
|
[data-tao-table-cell] {
|
|
56
|
-
padding: var(--tao-
|
|
69
|
+
padding: var(--tao-table-cell-padding-block)
|
|
70
|
+
var(--tao-table-cell-padding-inline);
|
|
71
|
+
font-size: var(--tao-table-cell-font-size);
|
|
72
|
+
line-height: var(--tao-table-cell-line-height);
|
|
57
73
|
text-align: left;
|
|
58
74
|
border-bottom: var(--tao-line-width) solid var(--tao-table-border-color);
|
|
59
75
|
background: var(--tao-table-cell-bg);
|
|
@@ -76,14 +92,19 @@
|
|
|
76
92
|
}
|
|
77
93
|
|
|
78
94
|
[data-tao-table-thead] [data-tao-table-cell] {
|
|
79
|
-
|
|
95
|
+
padding: var(--tao-table-header-cell-padding-block)
|
|
96
|
+
var(--tao-table-header-cell-padding-inline);
|
|
97
|
+
font-size: var(--tao-table-header-font-size);
|
|
98
|
+
font-weight: var(--tao-table-header-font-weight);
|
|
99
|
+
letter-spacing: var(--tao-table-header-letter-spacing);
|
|
100
|
+
text-transform: var(--tao-table-header-text-transform);
|
|
80
101
|
color: var(--tao-table-header-color);
|
|
81
102
|
background: var(--tao-table-header-bg);
|
|
82
103
|
white-space: nowrap;
|
|
83
104
|
}
|
|
84
105
|
|
|
85
106
|
[data-tao-table-wrapper][data-tao-variant="modern"] [data-tao-table-thead] [data-tao-table-cell] {
|
|
86
|
-
font-size: var(--tao-font-size-sm);
|
|
107
|
+
--tao-table-header-font-size: var(--tao-font-size-sm);
|
|
87
108
|
}
|
|
88
109
|
|
|
89
110
|
[data-tao-table-header-content] {
|
|
@@ -276,8 +297,9 @@
|
|
|
276
297
|
|
|
277
298
|
[data-tao-table-empty] {
|
|
278
299
|
text-align: center;
|
|
279
|
-
padding: var(--tao-
|
|
280
|
-
|
|
300
|
+
padding: var(--tao-table-empty-padding-block)
|
|
301
|
+
var(--tao-table-empty-padding-inline);
|
|
302
|
+
color: var(--tao-table-empty-color);
|
|
281
303
|
}
|
|
282
304
|
|
|
283
305
|
[data-tao-table-loading] {
|
|
@@ -330,18 +352,21 @@
|
|
|
330
352
|
}
|
|
331
353
|
|
|
332
354
|
[data-tao-table-wrapper][data-tao-size="small"] [data-tao-table-cell] {
|
|
333
|
-
|
|
334
|
-
|
|
355
|
+
--tao-table-cell-padding-block: var(--tao-padding-xxs);
|
|
356
|
+
--tao-table-cell-padding-inline: var(--tao-padding-xs);
|
|
357
|
+
--tao-table-cell-font-size: var(--tao-font-size-sm);
|
|
335
358
|
}
|
|
336
359
|
|
|
337
360
|
[data-tao-table-wrapper][data-tao-size="medium"] [data-tao-table-cell] {
|
|
338
|
-
|
|
339
|
-
|
|
361
|
+
--tao-table-cell-padding-block: var(--tao-padding-sm);
|
|
362
|
+
--tao-table-cell-padding-inline: var(--tao-padding);
|
|
363
|
+
--tao-table-cell-font-size: var(--tao-font-size-base);
|
|
340
364
|
}
|
|
341
365
|
|
|
342
366
|
[data-tao-table-wrapper][data-tao-size="large"] [data-tao-table-cell] {
|
|
343
|
-
|
|
344
|
-
|
|
367
|
+
--tao-table-cell-padding-block: var(--tao-padding);
|
|
368
|
+
--tao-table-cell-padding-inline: var(--tao-padding-md);
|
|
369
|
+
--tao-table-cell-font-size: var(--tao-font-size-base);
|
|
345
370
|
}
|
|
346
371
|
|
|
347
372
|
[data-tao-table-pagination] {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type CSSProperties, type HTMLAttributes, type ReactNode, type TdHTMLAttributes, type ThHTMLAttributes } from 'react';
|
|
2
2
|
import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
|
|
3
3
|
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
4
4
|
import './table.css';
|
|
5
|
-
export type TableSemanticPart = 'root' | 'header.cell' | 'body.row' | 'body.cell' | 'pagination';
|
|
5
|
+
export type TableSemanticPart = 'root' | 'scroll' | 'table' | 'header.wrapper' | 'header.row' | 'header.cell' | 'header.content' | 'header.title' | 'body.row' | 'body.cell' | 'selection.cell' | 'empty' | 'pagination';
|
|
6
6
|
export type TableVariant = TaoVariant | 'modern';
|
|
7
7
|
export type SortOrder = 'ascend' | 'descend' | null;
|
|
8
8
|
export interface TableFilterItem {
|
|
@@ -18,6 +18,8 @@ export interface TableColumn<T = any> {
|
|
|
18
18
|
align?: 'left' | 'center' | 'right';
|
|
19
19
|
fixed?: 'left' | 'right';
|
|
20
20
|
ellipsis?: boolean;
|
|
21
|
+
onCell?: (record: T, index: number) => TdHTMLAttributes<HTMLTableCellElement>;
|
|
22
|
+
onHeaderCell?: (column: TableColumn<T>) => ThHTMLAttributes<HTMLTableCellElement>;
|
|
21
23
|
sorter?: ((a: T, b: T) => number) | boolean;
|
|
22
24
|
sortOrder?: SortOrder;
|
|
23
25
|
defaultSortOrder?: SortOrder;
|
|
@@ -50,6 +52,11 @@ export interface SorterResult<T = any> {
|
|
|
50
52
|
order: SortOrder;
|
|
51
53
|
field?: string;
|
|
52
54
|
}
|
|
55
|
+
export type TableSemanticInfo<T = any> = {
|
|
56
|
+
props: TableProps<T>;
|
|
57
|
+
};
|
|
58
|
+
export type TableSemanticClassNames<T = any> = SemanticClassNames<TableSemanticPart> | ((info: TableSemanticInfo<T>) => SemanticClassNames<TableSemanticPart>);
|
|
59
|
+
export type TableSemanticStyles<T = any> = SemanticStyles<TableSemanticPart> | ((info: TableSemanticInfo<T>) => SemanticStyles<TableSemanticPart>);
|
|
53
60
|
export interface TableProps<T = any> {
|
|
54
61
|
columns: TableColumn<T>[];
|
|
55
62
|
dataSource: T[];
|
|
@@ -64,6 +71,10 @@ export interface TableProps<T = any> {
|
|
|
64
71
|
x?: number | string;
|
|
65
72
|
};
|
|
66
73
|
rowSelection?: TableRowSelection<T>;
|
|
74
|
+
rowClassName?: string | ((record: T, index: number) => string);
|
|
75
|
+
rowStyle?: CSSProperties | ((record: T, index: number) => CSSProperties);
|
|
76
|
+
onRow?: (record: T, index: number) => HTMLAttributes<HTMLTableRowElement>;
|
|
77
|
+
onHeaderRow?: (columns: TableColumn<T>[], index: number) => HTMLAttributes<HTMLTableRowElement>;
|
|
67
78
|
size?: TaoSize;
|
|
68
79
|
/**
|
|
69
80
|
* 表面风格。
|
|
@@ -84,7 +95,8 @@ export interface TableProps<T = any> {
|
|
|
84
95
|
emptyText?: ReactNode;
|
|
85
96
|
bordered?: boolean;
|
|
86
97
|
className?: string;
|
|
87
|
-
|
|
88
|
-
|
|
98
|
+
style?: CSSProperties;
|
|
99
|
+
classNames?: TableSemanticClassNames<T>;
|
|
100
|
+
styles?: TableSemanticStyles<T>;
|
|
89
101
|
}
|
|
90
|
-
export declare function Table<T = any>({ columns, dataSource, rowKey, loading, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground, emptyText, bordered, className, classNames, styles, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
102
|
+
export declare function Table<T = any>({ columns, dataSource, rowKey, loading, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground, emptyText, bordered, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement, useEffect, useRef, useState } from "react";
|
|
2
3
|
import { c as compiler_runtime_c } from "react/compiler-runtime";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
5
|
import { cx } from "../../utils/semantic.js";
|
|
6
6
|
import { Pagination } from "../pagination/pagination.js";
|
|
@@ -16,6 +16,22 @@ function getCellValue(record, dataIndex) {
|
|
|
16
16
|
if (!dataIndex) return;
|
|
17
17
|
return record[dataIndex];
|
|
18
18
|
}
|
|
19
|
+
function resolveSemanticClassNames(classNames, props) {
|
|
20
|
+
return 'function' == typeof classNames ? classNames({
|
|
21
|
+
props
|
|
22
|
+
}) : classNames ?? {};
|
|
23
|
+
}
|
|
24
|
+
function resolveSemanticStyles(styles, props) {
|
|
25
|
+
return 'function' == typeof styles ? styles({
|
|
26
|
+
props
|
|
27
|
+
}) : styles ?? {};
|
|
28
|
+
}
|
|
29
|
+
function resolveRowClassName(rowClassName, record, index) {
|
|
30
|
+
return 'function' == typeof rowClassName ? rowClassName(record, index) : rowClassName;
|
|
31
|
+
}
|
|
32
|
+
function resolveRowStyle(rowStyle, record, index) {
|
|
33
|
+
return 'function' == typeof rowStyle ? rowStyle(record, index) : rowStyle;
|
|
34
|
+
}
|
|
19
35
|
function SortIcon(t0) {
|
|
20
36
|
const $ = compiler_runtime_c(10);
|
|
21
37
|
const { order } = t0;
|
|
@@ -289,8 +305,8 @@ function FilterDropdown(t0) {
|
|
|
289
305
|
return t9;
|
|
290
306
|
}
|
|
291
307
|
function Table(t0) {
|
|
292
|
-
const $ = compiler_runtime_c(
|
|
293
|
-
const { columns, dataSource, rowKey, loading: t1, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground: t2, emptyText: t3, bordered: t4, className, classNames, styles } = t0;
|
|
308
|
+
const $ = compiler_runtime_c(96);
|
|
309
|
+
const { columns, dataSource, rowKey, loading: t1, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground: t2, emptyText: t3, bordered: t4, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow } = t0;
|
|
294
310
|
const loading = void 0 === t1 ? false : t1;
|
|
295
311
|
const headerBackground = void 0 === t2 ? true : t2;
|
|
296
312
|
const emptyText = void 0 === t3 ? "No Data" : t3;
|
|
@@ -299,6 +315,31 @@ function Table(t0) {
|
|
|
299
315
|
const resolvedSize = size ?? ctx.size;
|
|
300
316
|
const resolvedVariant = variant ?? ("outlined" === ctx.variant ? "modern" : ctx.variant);
|
|
301
317
|
const showBorder = "outlined" === resolvedVariant || "modern" === resolvedVariant || bordered && "borderless" !== resolvedVariant;
|
|
318
|
+
const semanticProps = {
|
|
319
|
+
columns,
|
|
320
|
+
dataSource,
|
|
321
|
+
rowKey,
|
|
322
|
+
loading,
|
|
323
|
+
pagination: paginationProp,
|
|
324
|
+
onChange,
|
|
325
|
+
scroll,
|
|
326
|
+
rowSelection,
|
|
327
|
+
rowClassName,
|
|
328
|
+
rowStyle,
|
|
329
|
+
onRow,
|
|
330
|
+
onHeaderRow,
|
|
331
|
+
size,
|
|
332
|
+
variant,
|
|
333
|
+
headerBackground,
|
|
334
|
+
emptyText,
|
|
335
|
+
bordered,
|
|
336
|
+
className,
|
|
337
|
+
style,
|
|
338
|
+
classNames,
|
|
339
|
+
styles
|
|
340
|
+
};
|
|
341
|
+
const resolvedClassNames = resolveSemanticClassNames(classNames, semanticProps);
|
|
342
|
+
const resolvedStyles = resolveSemanticStyles(styles, semanticProps);
|
|
302
343
|
let defaultSortCol;
|
|
303
344
|
let t5;
|
|
304
345
|
let t6;
|
|
@@ -665,307 +706,123 @@ function Table(t0) {
|
|
|
665
706
|
$[74] = t24;
|
|
666
707
|
} else t24 = $[74];
|
|
667
708
|
const getResolvedSortOrder = t24;
|
|
709
|
+
const tableStyle = scroll?.x ? {
|
|
710
|
+
minWidth: "number" == typeof scroll.x ? `${scroll.x}px` : scroll.x
|
|
711
|
+
} : {};
|
|
668
712
|
let t25;
|
|
669
|
-
if ($[75] !==
|
|
670
|
-
t25 =
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
$[
|
|
674
|
-
$[
|
|
675
|
-
|
|
676
|
-
|
|
713
|
+
if ($[75] !== paginatedData || $[76] !== rowKey || $[77] !== rowSelection || $[78] !== selectedKeys) {
|
|
714
|
+
t25 = paginatedData.length > 0 && paginatedData.filter((r_3)=>!rowSelection?.getCheckboxProps?.(r_3)?.disabled).every((r_4)=>selectedKeys.includes(getRowKey(r_4, rowKey)));
|
|
715
|
+
$[75] = paginatedData;
|
|
716
|
+
$[76] = rowKey;
|
|
717
|
+
$[77] = rowSelection;
|
|
718
|
+
$[78] = selectedKeys;
|
|
719
|
+
$[79] = t25;
|
|
720
|
+
} else t25 = $[79];
|
|
721
|
+
const isAllSelected = t25;
|
|
722
|
+
const isIndeterminate = !isAllSelected && selectedKeys.length > 0;
|
|
677
723
|
let t26;
|
|
678
|
-
if ($[
|
|
679
|
-
t26 =
|
|
680
|
-
$[
|
|
681
|
-
$[78] = rowKey;
|
|
682
|
-
$[79] = rowSelection;
|
|
683
|
-
$[80] = selectedKeys;
|
|
724
|
+
if ($[80] !== loading) {
|
|
725
|
+
t26 = loading && /*#__PURE__*/ jsx(LoadingSpinner, {});
|
|
726
|
+
$[80] = loading;
|
|
684
727
|
$[81] = t26;
|
|
685
728
|
} else t26 = $[81];
|
|
686
|
-
const
|
|
687
|
-
const
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
const t29 = scroll?.x ? scrollState : void 0;
|
|
691
|
-
const t30 = classNames?.root;
|
|
692
|
-
let t31;
|
|
693
|
-
if ($[82] !== className || $[83] !== t30) {
|
|
694
|
-
t31 = cx(t30, className);
|
|
695
|
-
$[82] = className;
|
|
696
|
-
$[83] = t30;
|
|
697
|
-
$[84] = t31;
|
|
698
|
-
} else t31 = $[84];
|
|
699
|
-
const t32 = styles?.root;
|
|
700
|
-
const t33 = scroll?.x ? handleScroll : void 0;
|
|
701
|
-
let t34;
|
|
702
|
-
if ($[85] !== loading) {
|
|
703
|
-
t34 = loading && /*#__PURE__*/ jsx(LoadingSpinner, {});
|
|
704
|
-
$[85] = loading;
|
|
705
|
-
$[86] = t34;
|
|
706
|
-
} else t34 = $[86];
|
|
707
|
-
let t35;
|
|
708
|
-
if ($[87] !== handleSelectAll || $[88] !== isAllSelected || $[89] !== isIndeterminate || $[90] !== rowSelection || $[91] !== selectionColWidth || $[92] !== selectionType || $[93] !== stickyPositions) {
|
|
709
|
-
t35 = rowSelection && /*#__PURE__*/ jsx("th", {
|
|
729
|
+
const headerRowProps = onHeaderRow?.(columns, 0) ?? {};
|
|
730
|
+
const t27 = "";
|
|
731
|
+
const t28 = 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
|
|
732
|
+
children: /*#__PURE__*/ jsx("td", {
|
|
710
733
|
"data-tao-table-cell": "",
|
|
711
|
-
"data-tao-table-
|
|
712
|
-
|
|
734
|
+
"data-tao-table-empty": "",
|
|
735
|
+
colSpan: columns.length + (rowSelection ? 1 : 0),
|
|
736
|
+
className: resolvedClassNames.empty,
|
|
737
|
+
style: resolvedStyles.empty,
|
|
738
|
+
children: emptyText
|
|
739
|
+
})
|
|
740
|
+
}) : paginatedData.map((record_1, rowIdx)=>{
|
|
741
|
+
const key_6 = getRowKey(record_1, rowKey);
|
|
742
|
+
const isSelected = selectedKeys.includes(key_6);
|
|
743
|
+
const checkboxProps = rowSelection?.getCheckboxProps?.(record_1);
|
|
744
|
+
const rowProps = onRow?.(record_1, rowIdx) ?? {};
|
|
745
|
+
return /*#__PURE__*/ createElement("tr", {
|
|
746
|
+
...rowProps,
|
|
747
|
+
key: key_6,
|
|
748
|
+
"data-tao-table-row": "",
|
|
749
|
+
"data-tao-selected": isSelected || void 0,
|
|
750
|
+
className: cx(resolvedClassNames["body.row"], resolveRowClassName(rowClassName, record_1, rowIdx), rowProps.className),
|
|
713
751
|
style: {
|
|
714
|
-
|
|
715
|
-
...
|
|
716
|
-
|
|
717
|
-
left: stickyPositions.__selection__.left,
|
|
718
|
-
zIndex: 2
|
|
719
|
-
} : {}
|
|
752
|
+
...resolvedStyles["body.row"],
|
|
753
|
+
...resolveRowStyle(rowStyle, record_1, rowIdx),
|
|
754
|
+
...rowProps.style
|
|
720
755
|
},
|
|
721
|
-
children:
|
|
722
|
-
|
|
723
|
-
checked: isAllSelected,
|
|
724
|
-
ref: (el_0)=>{
|
|
725
|
-
if (el_0) el_0.indeterminate = isIndeterminate;
|
|
726
|
-
},
|
|
727
|
-
onChange: (e)=>handleSelectAll(e.target.checked),
|
|
728
|
-
"data-tao-table-checkbox": ""
|
|
729
|
-
})
|
|
730
|
-
});
|
|
731
|
-
$[87] = handleSelectAll;
|
|
732
|
-
$[88] = isAllSelected;
|
|
733
|
-
$[89] = isIndeterminate;
|
|
734
|
-
$[90] = rowSelection;
|
|
735
|
-
$[91] = selectionColWidth;
|
|
736
|
-
$[92] = selectionType;
|
|
737
|
-
$[93] = stickyPositions;
|
|
738
|
-
$[94] = t35;
|
|
739
|
-
} else t35 = $[94];
|
|
740
|
-
let t36;
|
|
741
|
-
if ($[95] !== classNames || $[96] !== columns || $[97] !== filterValues || $[98] !== getResolvedSortOrder || $[99] !== handleFilter || $[100] !== handleSort || $[101] !== scroll?.x || $[102] !== stickyPositions || $[103] !== styles) {
|
|
742
|
-
let t37;
|
|
743
|
-
if ($[105] !== classNames || $[106] !== filterValues || $[107] !== getResolvedSortOrder || $[108] !== handleFilter || $[109] !== handleSort || $[110] !== scroll?.x || $[111] !== stickyPositions || $[112] !== styles) {
|
|
744
|
-
t37 = (col_9, i_6)=>{
|
|
745
|
-
const colKey_2 = getColKey(col_9, i_6);
|
|
746
|
-
const hasSorter = !!col_9.sorter;
|
|
747
|
-
const hasFilter = !!(col_9.filters && col_9.filters.length > 0);
|
|
748
|
-
const resolvedOrder = getResolvedSortOrder(col_9, colKey_2);
|
|
749
|
-
const controlledFilterValues = col_9.filteredValue;
|
|
750
|
-
const activeFilterValues = controlledFilterValues ?? filterValues[colKey_2] ?? [];
|
|
751
|
-
const stickyPos = stickyPositions[colKey_2];
|
|
752
|
-
const isFixed = !!col_9.fixed && !!scroll?.x;
|
|
753
|
-
return /*#__PURE__*/ jsx("th", {
|
|
756
|
+
children: [
|
|
757
|
+
rowSelection && /*#__PURE__*/ jsx("td", {
|
|
754
758
|
"data-tao-table-cell": "",
|
|
755
|
-
"data-tao-table-
|
|
756
|
-
"data-tao-
|
|
757
|
-
|
|
758
|
-
className: classNames?.["header.cell"],
|
|
759
|
+
"data-tao-table-selection-cell": "",
|
|
760
|
+
"data-tao-fixed": "left",
|
|
761
|
+
className: resolvedClassNames["selection.cell"],
|
|
759
762
|
style: {
|
|
760
|
-
|
|
761
|
-
...isFixed && stickyPos ? {
|
|
763
|
+
...stickyPositions.__selection__ ? {
|
|
762
764
|
position: "sticky",
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
} : {},
|
|
766
|
-
...void 0 !== stickyPos.right ? {
|
|
767
|
-
right: stickyPos.right
|
|
768
|
-
} : {},
|
|
769
|
-
zIndex: 2
|
|
765
|
+
left: stickyPositions.__selection__.left,
|
|
766
|
+
zIndex: 1
|
|
770
767
|
} : {},
|
|
771
|
-
...
|
|
768
|
+
...resolvedStyles["selection.cell"]
|
|
772
769
|
},
|
|
773
|
-
children: /*#__PURE__*/
|
|
774
|
-
"
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
onClick: hasSorter ? ()=>handleSort(colKey_2, col_9) : void 0,
|
|
780
|
-
role: hasSorter ? "button" : void 0,
|
|
781
|
-
tabIndex: hasSorter ? 0 : void 0,
|
|
782
|
-
onKeyDown: hasSorter ? (e_0)=>{
|
|
783
|
-
if ("Enter" === e_0.key || " " === e_0.key) {
|
|
784
|
-
e_0.preventDefault();
|
|
785
|
-
handleSort(colKey_2, col_9);
|
|
786
|
-
}
|
|
787
|
-
} : void 0,
|
|
788
|
-
children: [
|
|
789
|
-
col_9.title,
|
|
790
|
-
hasSorter && /*#__PURE__*/ jsx(SortIcon, {
|
|
791
|
-
order: resolvedOrder
|
|
792
|
-
})
|
|
793
|
-
]
|
|
794
|
-
}),
|
|
795
|
-
hasFilter && /*#__PURE__*/ jsx(FilterDropdown, {
|
|
796
|
-
filters: col_9.filters,
|
|
797
|
-
activeValues: activeFilterValues,
|
|
798
|
-
onSelect: (vals_0)=>handleFilter(colKey_2, vals_0)
|
|
799
|
-
})
|
|
800
|
-
]
|
|
770
|
+
children: /*#__PURE__*/ jsx("input", {
|
|
771
|
+
type: "radio" === selectionType ? "radio" : "checkbox",
|
|
772
|
+
checked: isSelected,
|
|
773
|
+
disabled: checkboxProps?.disabled,
|
|
774
|
+
onChange: ()=>handleSelectRow(key_6, record_1),
|
|
775
|
+
"data-tao-table-checkbox": ""
|
|
801
776
|
})
|
|
802
|
-
},
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
$[113] = t37;
|
|
813
|
-
} else t37 = $[113];
|
|
814
|
-
t36 = columns.map(t37);
|
|
815
|
-
$[95] = classNames;
|
|
816
|
-
$[96] = columns;
|
|
817
|
-
$[97] = filterValues;
|
|
818
|
-
$[98] = getResolvedSortOrder;
|
|
819
|
-
$[99] = handleFilter;
|
|
820
|
-
$[100] = handleSort;
|
|
821
|
-
$[101] = scroll?.x;
|
|
822
|
-
$[102] = stickyPositions;
|
|
823
|
-
$[103] = styles;
|
|
824
|
-
$[104] = t36;
|
|
825
|
-
} else t36 = $[104];
|
|
826
|
-
let t37;
|
|
827
|
-
if ($[114] !== t35 || $[115] !== t36) {
|
|
828
|
-
t37 = /*#__PURE__*/ jsx("thead", {
|
|
829
|
-
"data-tao-table-thead": "",
|
|
830
|
-
children: /*#__PURE__*/ jsxs("tr", {
|
|
831
|
-
children: [
|
|
832
|
-
t35,
|
|
833
|
-
t36
|
|
834
|
-
]
|
|
835
|
-
})
|
|
836
|
-
});
|
|
837
|
-
$[114] = t35;
|
|
838
|
-
$[115] = t36;
|
|
839
|
-
$[116] = t37;
|
|
840
|
-
} else t37 = $[116];
|
|
841
|
-
let t38;
|
|
842
|
-
if ($[117] !== classNames || $[118] !== columns || $[119] !== emptyText || $[120] !== handleSelectRow || $[121] !== paginatedData || $[122] !== rowKey || $[123] !== rowSelection || $[124] !== scroll?.x || $[125] !== selectedKeys || $[126] !== selectionType || $[127] !== stickyPositions || $[128] !== styles) {
|
|
843
|
-
t38 = 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
|
|
844
|
-
children: /*#__PURE__*/ jsx("td", {
|
|
845
|
-
"data-tao-table-cell": "",
|
|
846
|
-
"data-tao-table-empty": "",
|
|
847
|
-
colSpan: columns.length + (rowSelection ? 1 : 0),
|
|
848
|
-
children: emptyText
|
|
849
|
-
})
|
|
850
|
-
}) : paginatedData.map((record_1, rowIdx)=>{
|
|
851
|
-
const key_6 = getRowKey(record_1, rowKey);
|
|
852
|
-
const isSelected = selectedKeys.includes(key_6);
|
|
853
|
-
const checkboxProps = rowSelection?.getCheckboxProps?.(record_1);
|
|
854
|
-
return /*#__PURE__*/ jsxs("tr", {
|
|
855
|
-
"data-tao-table-row": "",
|
|
856
|
-
"data-tao-selected": isSelected || void 0,
|
|
857
|
-
className: classNames?.["body.row"],
|
|
858
|
-
style: styles?.["body.row"],
|
|
859
|
-
children: [
|
|
860
|
-
rowSelection && /*#__PURE__*/ jsx("td", {
|
|
777
|
+
}),
|
|
778
|
+
columns.map((col_10, colIdx_1)=>{
|
|
779
|
+
const colKey_3 = getColKey(col_10, colIdx_1);
|
|
780
|
+
const value = getCellValue(record_1, col_10.dataIndex);
|
|
781
|
+
const stickyPos_0 = stickyPositions[colKey_3];
|
|
782
|
+
const isFixed_0 = !!col_10.fixed && !!scroll?.x;
|
|
783
|
+
const cellProps = col_10.onCell?.(record_1, rowIdx) ?? {};
|
|
784
|
+
return /*#__PURE__*/ createElement("td", {
|
|
785
|
+
...cellProps,
|
|
786
|
+
key: colKey_3,
|
|
861
787
|
"data-tao-table-cell": "",
|
|
862
|
-
"data-tao-
|
|
863
|
-
"data-tao-
|
|
788
|
+
"data-tao-align": col_10.align,
|
|
789
|
+
"data-tao-ellipsis": col_10.ellipsis || void 0,
|
|
790
|
+
"data-tao-fixed": isFixed_0 ? col_10.fixed : void 0,
|
|
791
|
+
className: cx(resolvedClassNames["body.cell"], cellProps.className),
|
|
864
792
|
style: {
|
|
865
|
-
...
|
|
793
|
+
...resolvedStyles["body.cell"],
|
|
794
|
+
...isFixed_0 && stickyPos_0 ? {
|
|
866
795
|
position: "sticky",
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
} : {}
|
|
870
|
-
},
|
|
871
|
-
children: /*#__PURE__*/ jsx("input", {
|
|
872
|
-
type: "radio" === selectionType ? "radio" : "checkbox",
|
|
873
|
-
checked: isSelected,
|
|
874
|
-
disabled: checkboxProps?.disabled,
|
|
875
|
-
onChange: ()=>handleSelectRow(key_6, record_1),
|
|
876
|
-
"data-tao-table-checkbox": ""
|
|
877
|
-
})
|
|
878
|
-
}),
|
|
879
|
-
columns.map((col_10, colIdx_1)=>{
|
|
880
|
-
const colKey_3 = getColKey(col_10, colIdx_1);
|
|
881
|
-
const value = getCellValue(record_1, col_10.dataIndex);
|
|
882
|
-
const stickyPos_0 = stickyPositions[colKey_3];
|
|
883
|
-
const isFixed_0 = !!col_10.fixed && !!scroll?.x;
|
|
884
|
-
return /*#__PURE__*/ jsx("td", {
|
|
885
|
-
"data-tao-table-cell": "",
|
|
886
|
-
"data-tao-align": col_10.align,
|
|
887
|
-
"data-tao-ellipsis": col_10.ellipsis || void 0,
|
|
888
|
-
"data-tao-fixed": isFixed_0 ? col_10.fixed : void 0,
|
|
889
|
-
className: classNames?.["body.cell"],
|
|
890
|
-
style: {
|
|
891
|
-
...isFixed_0 && stickyPos_0 ? {
|
|
892
|
-
position: "sticky",
|
|
893
|
-
...void 0 !== stickyPos_0.left ? {
|
|
894
|
-
left: stickyPos_0.left
|
|
895
|
-
} : {},
|
|
896
|
-
...void 0 !== stickyPos_0.right ? {
|
|
897
|
-
right: stickyPos_0.right
|
|
898
|
-
} : {},
|
|
899
|
-
zIndex: 1
|
|
796
|
+
...void 0 !== stickyPos_0.left ? {
|
|
797
|
+
left: stickyPos_0.left
|
|
900
798
|
} : {},
|
|
901
|
-
...
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
$[118] = columns;
|
|
911
|
-
$[119] = emptyText;
|
|
912
|
-
$[120] = handleSelectRow;
|
|
913
|
-
$[121] = paginatedData;
|
|
914
|
-
$[122] = rowKey;
|
|
915
|
-
$[123] = rowSelection;
|
|
916
|
-
$[124] = scroll?.x;
|
|
917
|
-
$[125] = selectedKeys;
|
|
918
|
-
$[126] = selectionType;
|
|
919
|
-
$[127] = stickyPositions;
|
|
920
|
-
$[128] = styles;
|
|
921
|
-
$[129] = t38;
|
|
922
|
-
} else t38 = $[129];
|
|
923
|
-
let t39;
|
|
924
|
-
if ($[130] !== t38) {
|
|
925
|
-
t39 = /*#__PURE__*/ jsx("tbody", {
|
|
926
|
-
"data-tao-table-tbody": "",
|
|
927
|
-
children: t38
|
|
928
|
-
});
|
|
929
|
-
$[130] = t38;
|
|
930
|
-
$[131] = t39;
|
|
931
|
-
} else t39 = $[131];
|
|
932
|
-
let t40;
|
|
933
|
-
if ($[132] !== t37 || $[133] !== t39 || $[134] !== tableStyle) {
|
|
934
|
-
t40 = /*#__PURE__*/ jsxs("table", {
|
|
935
|
-
"data-tao-table": "",
|
|
936
|
-
style: tableStyle,
|
|
937
|
-
children: [
|
|
938
|
-
t37,
|
|
939
|
-
t39
|
|
799
|
+
...void 0 !== stickyPos_0.right ? {
|
|
800
|
+
right: stickyPos_0.right
|
|
801
|
+
} : {},
|
|
802
|
+
zIndex: 1
|
|
803
|
+
} : {},
|
|
804
|
+
...cellProps.style
|
|
805
|
+
}
|
|
806
|
+
}, col_10.render ? col_10.render(value, record_1, rowIdx) : value);
|
|
807
|
+
})
|
|
940
808
|
]
|
|
941
809
|
});
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
if ($[136] !== t33 || $[137] !== t34 || $[138] !== t40) {
|
|
949
|
-
t41 = /*#__PURE__*/ jsxs("div", {
|
|
950
|
-
"data-tao-table-scroll": "",
|
|
951
|
-
ref: scrollRef,
|
|
952
|
-
onScroll: t33,
|
|
953
|
-
children: [
|
|
954
|
-
t34,
|
|
955
|
-
t40
|
|
956
|
-
]
|
|
810
|
+
});
|
|
811
|
+
let t29;
|
|
812
|
+
if ($[82] !== t28) {
|
|
813
|
+
t29 = /*#__PURE__*/ jsx("tbody", {
|
|
814
|
+
"data-tao-table-tbody": t27,
|
|
815
|
+
children: t28
|
|
957
816
|
});
|
|
958
|
-
$[
|
|
959
|
-
$[
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
if ($[140] !== classNames?.pagination || $[141] !== currentPage || $[142] !== handlePageChange || $[143] !== hasPagination || $[144] !== pageSize || $[145] !== paginationConfig?.pageSizeOptions || $[146] !== paginationConfig?.showSizeChanger || $[147] !== paginationConfig?.showTotal || $[148] !== resolvedSize || $[149] !== styles?.pagination || $[150] !== totalForPagination) {
|
|
965
|
-
t42 = hasPagination && totalForPagination > 0 && /*#__PURE__*/ jsx("div", {
|
|
817
|
+
$[82] = t28;
|
|
818
|
+
$[83] = t29;
|
|
819
|
+
} else t29 = $[83];
|
|
820
|
+
let t30;
|
|
821
|
+
if ($[84] !== currentPage || $[85] !== handlePageChange || $[86] !== hasPagination || $[87] !== pageSize || $[88] !== paginationConfig?.pageSizeOptions || $[89] !== paginationConfig?.showSizeChanger || $[90] !== paginationConfig?.showTotal || $[91] !== resolvedClassNames || $[92] !== resolvedSize || $[93] !== resolvedStyles || $[94] !== totalForPagination) {
|
|
822
|
+
t30 = hasPagination && totalForPagination > 0 && /*#__PURE__*/ jsx("div", {
|
|
966
823
|
"data-tao-table-pagination": "",
|
|
967
|
-
className:
|
|
968
|
-
style:
|
|
824
|
+
className: resolvedClassNames.pagination,
|
|
825
|
+
style: resolvedStyles.pagination,
|
|
969
826
|
children: /*#__PURE__*/ jsx(Pagination, {
|
|
970
827
|
current: currentPage,
|
|
971
828
|
pageSize: pageSize,
|
|
@@ -977,47 +834,162 @@ function Table(t0) {
|
|
|
977
834
|
showTotal: paginationConfig?.showTotal
|
|
978
835
|
})
|
|
979
836
|
});
|
|
980
|
-
$[
|
|
981
|
-
$[
|
|
982
|
-
$[
|
|
983
|
-
$[
|
|
984
|
-
$[
|
|
985
|
-
$[
|
|
986
|
-
$[
|
|
987
|
-
$[
|
|
988
|
-
$[
|
|
989
|
-
$[
|
|
990
|
-
$[
|
|
991
|
-
$[
|
|
992
|
-
} else
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
style
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
837
|
+
$[84] = currentPage;
|
|
838
|
+
$[85] = handlePageChange;
|
|
839
|
+
$[86] = hasPagination;
|
|
840
|
+
$[87] = pageSize;
|
|
841
|
+
$[88] = paginationConfig?.pageSizeOptions;
|
|
842
|
+
$[89] = paginationConfig?.showSizeChanger;
|
|
843
|
+
$[90] = paginationConfig?.showTotal;
|
|
844
|
+
$[91] = resolvedClassNames;
|
|
845
|
+
$[92] = resolvedSize;
|
|
846
|
+
$[93] = resolvedStyles;
|
|
847
|
+
$[94] = totalForPagination;
|
|
848
|
+
$[95] = t30;
|
|
849
|
+
} else t30 = $[95];
|
|
850
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
851
|
+
"data-tao-table-wrapper": "",
|
|
852
|
+
"data-tao-size": resolvedSize,
|
|
853
|
+
"data-tao-variant": resolvedVariant,
|
|
854
|
+
"data-tao-header-bg": headerBackground ? void 0 : "off",
|
|
855
|
+
"data-tao-bordered": showBorder || void 0,
|
|
856
|
+
"data-tao-scroll-state": scroll?.x ? scrollState : void 0,
|
|
857
|
+
className: cx(resolvedClassNames.root, className),
|
|
858
|
+
style: {
|
|
859
|
+
...resolvedStyles.root,
|
|
860
|
+
...style
|
|
861
|
+
},
|
|
862
|
+
children: [
|
|
863
|
+
/*#__PURE__*/ jsxs("div", {
|
|
864
|
+
"data-tao-table-scroll": "",
|
|
865
|
+
ref: scrollRef,
|
|
866
|
+
onScroll: scroll?.x ? handleScroll : void 0,
|
|
867
|
+
className: resolvedClassNames.scroll,
|
|
868
|
+
style: resolvedStyles.scroll,
|
|
869
|
+
children: [
|
|
870
|
+
t26,
|
|
871
|
+
/*#__PURE__*/ jsxs("table", {
|
|
872
|
+
"data-tao-table": "",
|
|
873
|
+
className: resolvedClassNames.table,
|
|
874
|
+
style: {
|
|
875
|
+
...tableStyle,
|
|
876
|
+
...resolvedStyles.table
|
|
877
|
+
},
|
|
878
|
+
children: [
|
|
879
|
+
/*#__PURE__*/ jsx("thead", {
|
|
880
|
+
"data-tao-table-thead": "",
|
|
881
|
+
className: resolvedClassNames["header.wrapper"],
|
|
882
|
+
style: resolvedStyles["header.wrapper"],
|
|
883
|
+
children: /*#__PURE__*/ jsxs("tr", {
|
|
884
|
+
...headerRowProps,
|
|
885
|
+
className: cx(resolvedClassNames["header.row"], headerRowProps.className),
|
|
886
|
+
style: {
|
|
887
|
+
...resolvedStyles["header.row"],
|
|
888
|
+
...headerRowProps.style
|
|
889
|
+
},
|
|
890
|
+
children: [
|
|
891
|
+
rowSelection && /*#__PURE__*/ jsx("th", {
|
|
892
|
+
"data-tao-table-cell": "",
|
|
893
|
+
"data-tao-table-selection-cell": "",
|
|
894
|
+
"data-tao-fixed": "left",
|
|
895
|
+
className: resolvedClassNames["selection.cell"],
|
|
896
|
+
style: {
|
|
897
|
+
width: selectionColWidth,
|
|
898
|
+
...stickyPositions.__selection__ ? {
|
|
899
|
+
position: "sticky",
|
|
900
|
+
left: stickyPositions.__selection__.left,
|
|
901
|
+
zIndex: 2
|
|
902
|
+
} : {},
|
|
903
|
+
...resolvedStyles["selection.cell"]
|
|
904
|
+
},
|
|
905
|
+
children: "checkbox" === selectionType && /*#__PURE__*/ jsx("input", {
|
|
906
|
+
type: "checkbox",
|
|
907
|
+
checked: isAllSelected,
|
|
908
|
+
ref: (el_0)=>{
|
|
909
|
+
if (el_0) el_0.indeterminate = isIndeterminate;
|
|
910
|
+
},
|
|
911
|
+
onChange: (e)=>handleSelectAll(e.target.checked),
|
|
912
|
+
"data-tao-table-checkbox": ""
|
|
913
|
+
})
|
|
914
|
+
}),
|
|
915
|
+
columns.map((col_9, i_6)=>{
|
|
916
|
+
const colKey_2 = getColKey(col_9, i_6);
|
|
917
|
+
const hasSorter = !!col_9.sorter;
|
|
918
|
+
const hasFilter = !!(col_9.filters && col_9.filters.length > 0);
|
|
919
|
+
const resolvedOrder = getResolvedSortOrder(col_9, colKey_2);
|
|
920
|
+
const controlledFilterValues = col_9.filteredValue;
|
|
921
|
+
const activeFilterValues = controlledFilterValues ?? filterValues[colKey_2] ?? [];
|
|
922
|
+
const stickyPos = stickyPositions[colKey_2];
|
|
923
|
+
const isFixed = !!col_9.fixed && !!scroll?.x;
|
|
924
|
+
const headerCellProps = col_9.onHeaderCell?.(col_9) ?? {};
|
|
925
|
+
return /*#__PURE__*/ createElement("th", {
|
|
926
|
+
...headerCellProps,
|
|
927
|
+
key: colKey_2,
|
|
928
|
+
"data-tao-table-cell": "",
|
|
929
|
+
"data-tao-table-header": "",
|
|
930
|
+
"data-tao-align": col_9.align,
|
|
931
|
+
"data-tao-fixed": isFixed ? col_9.fixed : void 0,
|
|
932
|
+
className: cx(resolvedClassNames["header.cell"], headerCellProps.className),
|
|
933
|
+
style: {
|
|
934
|
+
...resolvedStyles["header.cell"],
|
|
935
|
+
width: col_9.width,
|
|
936
|
+
...isFixed && stickyPos ? {
|
|
937
|
+
position: "sticky",
|
|
938
|
+
...void 0 !== stickyPos.left ? {
|
|
939
|
+
left: stickyPos.left
|
|
940
|
+
} : {},
|
|
941
|
+
...void 0 !== stickyPos.right ? {
|
|
942
|
+
right: stickyPos.right
|
|
943
|
+
} : {},
|
|
944
|
+
zIndex: 2
|
|
945
|
+
} : {},
|
|
946
|
+
...headerCellProps.style
|
|
947
|
+
}
|
|
948
|
+
}, /*#__PURE__*/ jsxs("div", {
|
|
949
|
+
"data-tao-table-header-content": "",
|
|
950
|
+
className: resolvedClassNames["header.content"],
|
|
951
|
+
style: resolvedStyles["header.content"],
|
|
952
|
+
children: [
|
|
953
|
+
/*#__PURE__*/ jsxs("span", {
|
|
954
|
+
"data-tao-table-header-title": "",
|
|
955
|
+
"data-tao-sortable": hasSorter || void 0,
|
|
956
|
+
className: resolvedClassNames["header.title"],
|
|
957
|
+
style: resolvedStyles["header.title"],
|
|
958
|
+
onClick: hasSorter ? ()=>handleSort(colKey_2, col_9) : void 0,
|
|
959
|
+
role: hasSorter ? "button" : void 0,
|
|
960
|
+
tabIndex: hasSorter ? 0 : void 0,
|
|
961
|
+
onKeyDown: hasSorter ? (e_0)=>{
|
|
962
|
+
if ("Enter" === e_0.key || " " === e_0.key) {
|
|
963
|
+
e_0.preventDefault();
|
|
964
|
+
handleSort(colKey_2, col_9);
|
|
965
|
+
}
|
|
966
|
+
} : void 0,
|
|
967
|
+
children: [
|
|
968
|
+
col_9.title,
|
|
969
|
+
hasSorter && /*#__PURE__*/ jsx(SortIcon, {
|
|
970
|
+
order: resolvedOrder
|
|
971
|
+
})
|
|
972
|
+
]
|
|
973
|
+
}),
|
|
974
|
+
hasFilter && /*#__PURE__*/ jsx(FilterDropdown, {
|
|
975
|
+
filters: col_9.filters,
|
|
976
|
+
activeValues: activeFilterValues,
|
|
977
|
+
onSelect: (vals_0)=>handleFilter(colKey_2, vals_0)
|
|
978
|
+
})
|
|
979
|
+
]
|
|
980
|
+
}));
|
|
981
|
+
})
|
|
982
|
+
]
|
|
983
|
+
})
|
|
984
|
+
}),
|
|
985
|
+
t29
|
|
986
|
+
]
|
|
987
|
+
})
|
|
988
|
+
]
|
|
989
|
+
}),
|
|
990
|
+
t30
|
|
991
|
+
]
|
|
992
|
+
});
|
|
1021
993
|
}
|
|
1022
994
|
function _temp(c) {
|
|
1023
995
|
return c.defaultSortOrder;
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
font-family: var(--tao-font-family);
|
|
8
8
|
font-size: var(--tao-font-size-xs);
|
|
9
9
|
font-weight: var(--tao-font-weight-strong);
|
|
10
|
-
line-height: var(--tao-line-height-sm);
|
|
11
10
|
border-radius: var(--tao-radius-md);
|
|
12
11
|
border: var(--tao-line-width) solid transparent;
|
|
13
12
|
white-space: nowrap;
|
|
@@ -22,9 +21,10 @@
|
|
|
22
21
|
opacity var(--tao-motion-duration-fast) var(--tao-motion-ease-out);
|
|
23
22
|
justify-content: center;
|
|
24
23
|
align-items: center;
|
|
25
|
-
gap:
|
|
24
|
+
gap: 4px;
|
|
26
25
|
padding-block: 0;
|
|
27
26
|
padding-inline: 8px;
|
|
27
|
+
line-height: 1;
|
|
28
28
|
display: inline-flex;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -33,20 +33,17 @@
|
|
|
33
33
|
justify-content: center;
|
|
34
34
|
align-items: center;
|
|
35
35
|
font-size: 12px;
|
|
36
|
-
line-height:
|
|
36
|
+
line-height: 1;
|
|
37
37
|
display: inline-flex;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
[data-tao-tag-content] {
|
|
41
|
-
line-height: inherit;
|
|
42
41
|
align-items: center;
|
|
42
|
+
gap: inherit;
|
|
43
|
+
line-height: 1;
|
|
43
44
|
display: inline-flex;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
[data-tao-tag]:not([data-tao-closable]) [data-tao-tag-content] {
|
|
47
|
-
transform: translateY(-.03em);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
47
|
[data-tao-tag-close] {
|
|
51
48
|
cursor: pointer;
|
|
52
49
|
border-radius: var(--tao-radius-full);
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { FormActions, type FormActionsProps, type FormActionsSemanticPart, } fro
|
|
|
13
13
|
export { FormField, type FormFieldProps, type FormFieldSemanticPart, } from "./components/form-field/form-field";
|
|
14
14
|
export { FormSection, type FormSectionProps, type FormSectionSemanticPart, } from "./components/form-section/form-section";
|
|
15
15
|
export { Input, type InputProps, type InputSemanticPart, } from "./components/input/input";
|
|
16
|
+
export { InputNumber, type InputNumberProps, type InputNumberSemanticPart, } from "./components/input-number/input-number";
|
|
16
17
|
export { type ConfirmType, Modal, type ModalFooterRender, type ModalFuncProps, type ModalFuncReturn, type ModalHookApi, type ModalProps, type ModalSemanticPart, } from "./components/modal";
|
|
17
18
|
export { Pagination, type PaginationProps, type PaginationSemanticPart, } from "./components/pagination/pagination";
|
|
18
19
|
export { Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, type RadioSemanticPart, } from "./components/radio/radio";
|
|
@@ -27,6 +28,6 @@ export { CheckableTag, type CheckableTagProps, Tag, type TagColor, type TagProps
|
|
|
27
28
|
export { type AutoSizeOptions, Textarea, type TextareaProps, type TextareaSemanticPart, } from "./components/textarea/textarea";
|
|
28
29
|
export { FormLayout, type FormLayoutProps, } from "./layouts/form-layout/form-layout";
|
|
29
30
|
export { Stack, type StackProps } from "./layouts/stack/stack";
|
|
30
|
-
export { type FormatOptions, NumberInput, type NumberInputProps, type PadDecimalsOnBlur, type UseNumberInputOptions, type UseNumberInputReturn, useNumberInput, } from "./number-input";
|
|
31
|
+
export { type FormatOptions, HeadlessInputNumber, type HeadlessInputNumberProps, NumberInput, type NumberInputProps, type PadDecimalsOnBlur, type UseNumberInputOptions, type UseNumberInputReturn, useNumberInput, } from "./number-input";
|
|
31
32
|
export { TaoPortalScope, TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoThemeConfig, type TaoVariant, useTaoConfig, } from "./provider/tao-provider";
|
|
32
33
|
export { cx, type SemanticClassNames, type SemanticStyles, } from "./utils/semantic";
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { FormActions } from "./components/form-actions/form-actions.js";
|
|
|
13
13
|
export { FormField } from "./components/form-field/form-field.js";
|
|
14
14
|
export { FormSection } from "./components/form-section/form-section.js";
|
|
15
15
|
export { Input } from "./components/input/input.js";
|
|
16
|
+
export { InputNumber } from "./components/input-number/input-number.js";
|
|
16
17
|
export { Modal } from "./components/modal/index.js";
|
|
17
18
|
export { Pagination } from "./components/pagination/pagination.js";
|
|
18
19
|
export { Radio, RadioGroup } from "./components/radio/radio.js";
|
|
@@ -27,6 +28,6 @@ export { CheckableTag, Tag } from "./components/tag/tag.js";
|
|
|
27
28
|
export { Textarea } from "./components/textarea/textarea.js";
|
|
28
29
|
export { FormLayout } from "./layouts/form-layout/form-layout.js";
|
|
29
30
|
export { Stack } from "./layouts/stack/stack.js";
|
|
30
|
-
export { NumberInput, useNumberInput } from "./number-input/index.js";
|
|
31
|
+
export { HeadlessInputNumber, NumberInput, useNumberInput } from "./number-input/index.js";
|
|
31
32
|
export { TaoPortalScope, TaoProvider, useTaoConfig } from "./provider/tao-provider.js";
|
|
32
33
|
export { cx } from "./utils/semantic.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export { NumberInput } from './number-input';
|
|
1
|
+
export { HeadlessInputNumber, type HeadlessInputNumberProps, NumberInput, type NumberInputProps, } from './number-input';
|
|
3
2
|
export type { FormatOptions, PadDecimalsOnBlur } from './types';
|
|
4
3
|
export type { UseNumberInputOptions, UseNumberInputReturn, } from './use-number-input';
|
|
5
4
|
export { useNumberInput } from './use-number-input';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { NumberInput } from "./number-input.js";
|
|
1
|
+
export { HeadlessInputNumber, NumberInput } from "./number-input.js";
|
|
2
2
|
export { useNumberInput } from "./use-number-input.js";
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { type UseNumberInputOptions } from './use-number-input';
|
|
3
|
-
export interface
|
|
3
|
+
export interface HeadlessInputNumberProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'min' | 'max' | 'prefix'>, UseNumberInputOptions {
|
|
4
4
|
prefix?: ReactNode;
|
|
5
5
|
suffix?: ReactNode;
|
|
6
6
|
containerClassName?: string;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function HeadlessInputNumber(props: HeadlessInputNumberProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Renamed to `HeadlessInputNumber` to avoid confusion with the
|
|
12
|
+
* styled `InputNumber`. This alias will be removed in a future release.
|
|
13
|
+
*/
|
|
14
|
+
export declare const NumberInput: typeof HeadlessInputNumber;
|
|
15
|
+
/** @deprecated Use `HeadlessInputNumberProps`. */
|
|
16
|
+
export type NumberInputProps = HeadlessInputNumberProps;
|
|
@@ -15,7 +15,7 @@ const HOOK_KEYS = [
|
|
|
15
15
|
'min',
|
|
16
16
|
'max'
|
|
17
17
|
];
|
|
18
|
-
function
|
|
18
|
+
function HeadlessInputNumber(props) {
|
|
19
19
|
const $ = c(20);
|
|
20
20
|
let className;
|
|
21
21
|
let containerClassName;
|
|
@@ -98,4 +98,5 @@ function NumberInput(props) {
|
|
|
98
98
|
} else t3 = $[19];
|
|
99
99
|
return t3;
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
const NumberInput = HeadlessInputNumber;
|
|
102
|
+
export { HeadlessInputNumber, NumberInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockshin/tao-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A modern React 19 component library with semantic DOM customization and OKLCH-based theming.",
|
|
6
6
|
"keywords": [
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"doc:build": "rspress build",
|
|
46
46
|
"doc:preview": "rspress preview",
|
|
47
47
|
"format": "biome format --write",
|
|
48
|
+
"release": "bun scripts/release.mjs",
|
|
48
49
|
"storybook": "storybook dev",
|
|
49
50
|
"test": "rstest",
|
|
50
51
|
"test:watch": "rstest --watch"
|