react-kui 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/kui-components.json +7 -7
- package/es/_virtual/_rolldown/runtime.js +1 -1
- package/es/affix/index.js +1 -1
- package/es/alert/index.js +1 -1
- package/es/anchor/anchor-context.js +1 -1
- package/es/anchor/anchor-link.js +1 -1
- package/es/anchor/anchor.js +1 -1
- package/es/auto-complete/index.js +1 -1
- package/es/avatar/avatar-group-context.js +1 -1
- package/es/avatar/avatar-group.js +1 -1
- package/es/avatar/avatar.js +1 -1
- package/es/back-top/index.js +1 -1
- package/es/badge/index.js +1 -1
- package/es/base/teleport.js +1 -1
- package/es/base/transition-props.js +1 -1
- package/es/base/transition.js +1 -1
- package/es/breadcrumb/breadcrumb-context.js +1 -1
- package/es/breadcrumb/breadcrumb-item.js +1 -1
- package/es/breadcrumb/breadcrumb.js +1 -1
- package/es/button/button-group-context.js +1 -1
- package/es/button/button-group.js +1 -1
- package/es/button/button.js +1 -1
- package/es/calendar/index.js +1 -1
- package/es/card/index.js +1 -1
- package/es/carousel/carousel-context.js +1 -1
- package/es/carousel/carousel-item.js +1 -1
- package/es/carousel/carousel.js +1 -1
- package/es/carousel/drag.js +1 -1
- package/es/cascader/index.js +1 -1
- package/es/check-card/check-card-group.js +1 -1
- package/es/check-card/check-card.js +1 -1
- package/es/check-card/context.js +1 -1
- package/es/checkbox/checkbox-group-context.js +1 -1
- package/es/checkbox/checkbox-group.js +1 -1
- package/es/checkbox/checkbox.js +1 -1
- package/es/checkbox/index.js +1 -1
- package/es/collapse/collapse-panel.js +1 -1
- package/es/collapse/collapse.js +1 -1
- package/es/color-picker/alpha.js +1 -1
- package/es/color-picker/hue.js +1 -1
- package/es/color-picker/index.js +1 -1
- package/es/color-picker/mode.js +1 -1
- package/es/color-picker/paint.js +1 -1
- package/es/color-picker/presets.js +1 -1
- package/es/components.js +1 -1
- package/es/config/config-context.js +1 -1
- package/es/config/context.js +1 -1
- package/es/config/index.js +1 -1
- package/es/config/popup-host.js +1 -1
- package/es/config/size-context.js +1 -1
- package/es/config/use-config-appearance.js +1 -1
- package/es/const/var.js +1 -1
- package/es/date-picker/index.js +1 -1
- package/es/descriptions/descriptions-item.js +1 -1
- package/es/descriptions/descriptions.js +1 -1
- package/es/divider/index.js +1 -1
- package/es/drawer/index.js +1 -1
- package/es/dropdown/dropdown-button.js +1 -1
- package/es/dropdown/dropdown-context.js +1 -1
- package/es/dropdown/dropdown.js +1 -1
- package/es/dropdown/trigger.js +1 -1
- package/es/empty/index.js +1 -1
- package/es/feature-card/index.js +1 -1
- package/es/feedback-panel/index.js +1 -1
- package/es/flame-wrap/index.js +1 -1
- package/es/flame-wrap/types.js +1 -1
- package/es/flex/index.js +1 -1
- package/es/form/field-context.js +1 -1
- package/es/form/form-context.js +1 -1
- package/es/form/form-item.js +1 -1
- package/es/form/form.js +1 -1
- package/es/form/utils.js +1 -1
- package/es/grid/grid-item.js +1 -1
- package/es/grid/grid.js +1 -1
- package/es/grid/useBreakpoint.js +1 -1
- package/es/icon/index.js +1 -1
- package/es/image/group.js +1 -1
- package/es/image/image-group-context.js +1 -1
- package/es/image/image.js +1 -1
- package/es/image/instance.js +1 -1
- package/es/image/preview.js +1 -1
- package/es/image/utils.js +1 -1
- package/es/index.js +1 -1
- package/es/input/index.js +1 -1
- package/es/input/input-base.js +1 -1
- package/es/input/input-box.js +1 -1
- package/es/input/input-group.js +1 -1
- package/es/input/input.js +1 -1
- package/es/input/textarea.js +1 -1
- package/es/input-number/index.js +1 -1
- package/es/input-otp/index.js +1 -1
- package/es/input-tag/index.js +1 -1
- package/es/kanban/index.js +1 -1
- package/es/layout/index.js +1 -1
- package/es/layout/layout-context.js +1 -1
- package/es/list-panel/index.js +1 -1
- package/es/loading/index.js +1 -1
- package/es/loading/loading-bar.js +1 -1
- package/es/locale/de.js +1 -1
- package/es/locale/el.js +1 -1
- package/es/locale/en.js +1 -1
- package/es/locale/fr.js +1 -1
- package/es/locale/it.js +1 -1
- package/es/locale/ja.js +1 -1
- package/es/locale/ko.js +1 -1
- package/es/locale/ru.js +1 -1
- package/es/locale/th.js +1 -1
- package/es/locale/uk.js +1 -1
- package/es/locale/vi.js +1 -1
- package/es/locale/zh-CN.js +1 -1
- package/es/locale/zh-TW.js +1 -1
- package/es/mentions/index.js +1 -1
- package/es/menu/menu-context.js +1 -1
- package/es/menu/menu-divider.js +1 -1
- package/es/menu/menu-group.js +1 -1
- package/es/menu/menu-item.js +1 -1
- package/es/menu/menu-keyboard.js +1 -1
- package/es/menu/menu.js +1 -1
- package/es/menu/recursive-menu.js +1 -1
- package/es/menu/sub-menu.js +1 -1
- package/es/message/index.js +1 -1
- package/es/modal/api.js +1 -1
- package/es/modal/modal.js +1 -1
- package/es/modal/toast.js +1 -1
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +1 -1
- package/es/notice/container.js +1 -1
- package/es/notice/content.js +1 -1
- package/es/notice/index.js +1 -1
- package/es/notice/instance.js +1 -1
- package/es/page/index.js +1 -1
- package/es/page/responsive.js +1 -1
- package/es/page-header/index.js +1 -1
- package/es/popconfirm/index.js +1 -1
- package/es/poptip/index.js +1 -1
- package/es/popup/index.js +1 -1
- package/es/popup/layers.js +1 -1
- package/es/progress/index.js +1 -1
- package/es/qrcode/index.js +1 -1
- package/es/radio/radio-button.js +1 -1
- package/es/radio/radio-group-context.js +1 -1
- package/es/radio/radio-group.js +1 -1
- package/es/radio/radio.js +1 -1
- package/es/rate/index.js +1 -1
- package/es/rate/star.js +1 -1
- package/es/result/index.js +1 -1
- package/es/ripple/index.js +1 -1
- package/es/ripple/types.js +1 -1
- package/es/row-col/col.js +1 -1
- package/es/row-col/row.js +1 -1
- package/es/segmented/index.js +110 -90
- package/es/select/option.js +1 -1
- package/es/select/select.js +1 -1
- package/es/skeleton/skeleton-avatar.js +1 -1
- package/es/skeleton/skeleton-button.js +1 -1
- package/es/skeleton/skeleton-image.js +1 -1
- package/es/skeleton/skeleton-text.js +1 -1
- package/es/skeleton/skeleton.js +1 -1
- package/es/skeleton/use-skeleton-loading.js +1 -1
- package/es/slider/index.js +1 -1
- package/es/slider/thumb.js +1 -1
- package/es/space/index.js +1 -1
- package/es/spin/index.js +1 -1
- package/es/splitter/splitter-panel.js +1 -1
- package/es/splitter/splitter.js +1 -1
- package/es/stat-card/countup.js +1 -1
- package/es/stat-card/rollup.js +1 -1
- package/es/stat-card/stat-card.js +1 -1
- package/es/stat-card/stat-number.js +1 -1
- package/es/stat-card/utils/countup.js +1 -1
- package/es/stat-card/utils/odometer.js +1 -1
- package/es/stat-card/utils/stat-item-key.js +1 -1
- package/es/steps/index.js +1 -1
- package/es/switch/index.js +1 -1
- package/es/table/column-setting.js +1 -1
- package/es/table/index.js +18 -7
- package/es/table/utils.js +2 -3
- package/es/tabs/tab-panel.js +1 -1
- package/es/tabs/tabs.js +1 -1
- package/es/tag/index.js +1 -1
- package/es/time-line/timeline-item.js +1 -1
- package/es/time-line/timeline.js +1 -1
- package/es/tooltip/index.js +1 -1
- package/es/tour/index.js +1 -1
- package/es/transfer/index.js +1 -1
- package/es/tree/index.js +1 -1
- package/es/tree/utils.js +1 -1
- package/es/tree-select/index.js +1 -1
- package/es/typography/index.js +1 -1
- package/es/upload/file-list.js +1 -1
- package/es/upload/index.js +1 -1
- package/es/upload/picture-sort.js +1 -1
- package/es/upload/selector.js +1 -1
- package/es/utils/checked.js +1 -1
- package/es/utils/color.js +1 -1
- package/es/utils/css.js +1 -1
- package/es/utils/focus.js +1 -1
- package/es/utils/number.js +1 -1
- package/es/utils/overlay-order.js +1 -1
- package/es/utils/overlay-stack.js +1 -1
- package/es/utils/placement.js +1 -1
- package/es/utils/popup.js +1 -1
- package/es/utils/promise.js +1 -1
- package/es/utils/react-node.js +1 -1
- package/es/utils/selection-tags.js +1 -1
- package/es/utils/share.js +1 -1
- package/es/utils/theme.js +1 -1
- package/es/utils/transition.js +1 -1
- package/es/utils/use-value.js +1 -1
- package/es/virtual-list/index.js +1 -1
- package/es/virtual-list/range.js +1 -1
- package/es/watermark/index.js +1 -1
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +1 -1
- package/lib/locale/el.cjs +1 -1
- package/lib/locale/en.cjs +1 -1
- package/lib/locale/fr.cjs +1 -1
- package/lib/locale/it.cjs +1 -1
- package/lib/locale/ja.cjs +1 -1
- package/lib/locale/ko.cjs +1 -1
- package/lib/locale/ru.cjs +1 -1
- package/lib/locale/th.cjs +1 -1
- package/lib/locale/uk.cjs +1 -1
- package/lib/locale/vi.cjs +1 -1
- package/lib/locale/zh-CN.cjs +1 -1
- package/lib/locale/zh-TW.cjs +1 -1
- package/package.json +1 -1
- package/style/base.css +1 -1
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/theme.css +1 -1
- package/types/segmented/index.d.cts +2 -1
- package/types/segmented/index.d.ts +2 -1
package/es/segmented/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.2.
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -15,8 +15,13 @@ import clsx from "clsx";
|
|
|
15
15
|
import { useEffect, useRef, useState } from "react";
|
|
16
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
17
|
//#region components/segmented/index.tsx
|
|
18
|
+
var isOptionObject = (option) => typeof option === "object" && option !== null;
|
|
19
|
+
var normalizeOptions = (options) => options.map((option) => isOptionObject(option) ? option : {
|
|
20
|
+
label: option,
|
|
21
|
+
value: option
|
|
22
|
+
});
|
|
18
23
|
var Segmented = (t0) => {
|
|
19
|
-
const $ = c(
|
|
24
|
+
const $ = c(50);
|
|
20
25
|
let className;
|
|
21
26
|
let onChange;
|
|
22
27
|
let onKeyDown;
|
|
@@ -78,64 +83,73 @@ var Segmented = (t0) => {
|
|
|
78
83
|
const itemRefs = useRef(t6);
|
|
79
84
|
const [innerValue, setInnerValue] = useValue(value, _temp);
|
|
80
85
|
const currentValue = innerValue;
|
|
86
|
+
const items = normalizeOptions(options);
|
|
81
87
|
let t7;
|
|
82
|
-
if ($[15]
|
|
83
|
-
t7 =
|
|
84
|
-
$[15] =
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
if ($[15] !== currentValue) {
|
|
89
|
+
t7 = (item) => item.value === currentValue;
|
|
90
|
+
$[15] = currentValue;
|
|
91
|
+
$[16] = t7;
|
|
92
|
+
} else t7 = $[16];
|
|
93
|
+
const selectedItem = items.find(t7);
|
|
94
|
+
const focusValue = selectedItem && !selectedItem.disabled ? selectedItem.value : items.find(_temp2)?.value;
|
|
95
|
+
let t8;
|
|
96
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
97
|
+
t8 = {};
|
|
98
|
+
$[17] = t8;
|
|
99
|
+
} else t8 = $[17];
|
|
100
|
+
const [indicatorStyle, setIndicatorStyle] = useState(t8);
|
|
87
101
|
const [ready, setReady] = useState(false);
|
|
88
102
|
const vertical = direction === "vertical";
|
|
89
|
-
let
|
|
90
|
-
if ($[
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
if (!
|
|
103
|
+
let t9;
|
|
104
|
+
if ($[18] !== currentValue || $[19] !== vertical) {
|
|
105
|
+
t9 = () => {
|
|
106
|
+
const item_1 = currentValue === void 0 ? void 0 : itemRefs.current.get(currentValue);
|
|
107
|
+
if (!item_1) {
|
|
94
108
|
setReady(false);
|
|
95
109
|
setIndicatorStyle({});
|
|
96
110
|
return;
|
|
97
111
|
}
|
|
98
112
|
setIndicatorStyle(vertical ? {
|
|
99
|
-
height:
|
|
100
|
-
top:
|
|
113
|
+
height: item_1.offsetHeight,
|
|
114
|
+
top: item_1.offsetTop
|
|
101
115
|
} : {
|
|
102
|
-
width:
|
|
103
|
-
left:
|
|
116
|
+
width: item_1.offsetWidth,
|
|
117
|
+
left: item_1.offsetLeft
|
|
104
118
|
});
|
|
105
119
|
requestAnimationFrame(() => setReady(true));
|
|
106
120
|
};
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
} else
|
|
111
|
-
const updateIndicator =
|
|
112
|
-
let
|
|
113
|
-
if ($[
|
|
114
|
-
|
|
121
|
+
$[18] = currentValue;
|
|
122
|
+
$[19] = vertical;
|
|
123
|
+
$[20] = t9;
|
|
124
|
+
} else t9 = $[20];
|
|
125
|
+
const updateIndicator = t9;
|
|
126
|
+
let t10;
|
|
127
|
+
if ($[21] !== updateIndicator) {
|
|
128
|
+
t10 = () => {
|
|
115
129
|
updateIndicator();
|
|
116
130
|
const observer = new ResizeObserver(updateIndicator);
|
|
117
131
|
if (rootRef.current) observer.observe(rootRef.current);
|
|
118
132
|
return () => observer.disconnect();
|
|
119
133
|
};
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
} else
|
|
123
|
-
useEffect(
|
|
124
|
-
let
|
|
125
|
-
if ($[
|
|
126
|
-
|
|
134
|
+
$[21] = updateIndicator;
|
|
135
|
+
$[22] = t10;
|
|
136
|
+
} else t10 = $[22];
|
|
137
|
+
useEffect(t10, [options, updateIndicator]);
|
|
138
|
+
let t11;
|
|
139
|
+
if ($[23] !== currentValue || $[24] !== disabled || $[25] !== onChange || $[26] !== readOnly || $[27] !== setInnerValue) {
|
|
140
|
+
t11 = (option) => {
|
|
127
141
|
if (disabled || readOnly || option.disabled || option.value === currentValue) return;
|
|
128
142
|
setInnerValue(option.value);
|
|
129
143
|
onChange?.(option.value);
|
|
130
144
|
};
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
} else
|
|
138
|
-
const select =
|
|
145
|
+
$[23] = currentValue;
|
|
146
|
+
$[24] = disabled;
|
|
147
|
+
$[25] = onChange;
|
|
148
|
+
$[26] = readOnly;
|
|
149
|
+
$[27] = setInnerValue;
|
|
150
|
+
$[28] = t11;
|
|
151
|
+
} else t11 = $[28];
|
|
152
|
+
const select = t11;
|
|
139
153
|
const move = (event) => {
|
|
140
154
|
onKeyDown?.(event);
|
|
141
155
|
if (event.defaultPrevented || ![
|
|
@@ -146,7 +160,7 @@ var Segmented = (t0) => {
|
|
|
146
160
|
"Home",
|
|
147
161
|
"End"
|
|
148
162
|
].includes(event.key)) return;
|
|
149
|
-
const available =
|
|
163
|
+
const available = items.filter(_temp3);
|
|
150
164
|
if (!available.length || disabled || readOnly) return;
|
|
151
165
|
event.preventDefault();
|
|
152
166
|
const current = available.findIndex((option_1) => option_1.value === currentValue);
|
|
@@ -156,27 +170,28 @@ var Segmented = (t0) => {
|
|
|
156
170
|
requestAnimationFrame(() => itemRefs.current.get(next_0.value)?.focus());
|
|
157
171
|
}
|
|
158
172
|
};
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
let
|
|
162
|
-
if ($[
|
|
163
|
-
|
|
173
|
+
const t12 = `k-segmented-${size}`;
|
|
174
|
+
const t13 = `k-segmented-${shape}`;
|
|
175
|
+
let t14;
|
|
176
|
+
if ($[29] !== block || $[30] !== className || $[31] !== disabled || $[32] !== t12 || $[33] !== t13 || $[34] !== vertical) {
|
|
177
|
+
t14 = clsx("k-segmented", t12, t13, {
|
|
164
178
|
"k-segmented-block": block,
|
|
165
179
|
"k-segmented-vertical": vertical,
|
|
166
180
|
"k-segmented-disabled": disabled
|
|
167
181
|
}, className);
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[31] = t12;
|
|
173
|
-
$[32] = vertical;
|
|
182
|
+
$[29] = block;
|
|
183
|
+
$[30] = className;
|
|
184
|
+
$[31] = disabled;
|
|
185
|
+
$[32] = t12;
|
|
174
186
|
$[33] = t13;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
const
|
|
187
|
+
$[34] = vertical;
|
|
188
|
+
$[35] = t14;
|
|
189
|
+
} else t14 = $[35];
|
|
190
|
+
const t15 = "radiogroup";
|
|
191
|
+
const t16 = vertical ? "vertical" : "horizontal";
|
|
192
|
+
const t17 = disabled || void 0;
|
|
193
|
+
const t18 = readOnly || void 0;
|
|
194
|
+
const t19 = items.map((option_2) => /* @__PURE__ */ jsxs("button", {
|
|
180
195
|
ref: (node) => {
|
|
181
196
|
if (node) itemRefs.current.set(option_2.value, node);
|
|
182
197
|
else itemRefs.current.delete(option_2.value);
|
|
@@ -186,54 +201,59 @@ var Segmented = (t0) => {
|
|
|
186
201
|
role: "radio",
|
|
187
202
|
"aria-checked": option_2.value === currentValue,
|
|
188
203
|
disabled: disabled || option_2.disabled,
|
|
189
|
-
tabIndex: option_2.value ===
|
|
204
|
+
tabIndex: option_2.value === focusValue ? 0 : -1,
|
|
190
205
|
onClick: () => select(option_2),
|
|
191
206
|
children: [option_2.icon && /* @__PURE__ */ jsx(Icon, { type: option_2.icon }), /* @__PURE__ */ jsx("span", { children: renderLabel?.(option_2, option_2.value === currentValue) ?? option_2.label ?? option_2.value })]
|
|
192
207
|
}, option_2.value));
|
|
193
|
-
let
|
|
194
|
-
if ($[
|
|
195
|
-
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
} else
|
|
199
|
-
let
|
|
200
|
-
if ($[
|
|
201
|
-
|
|
202
|
-
className:
|
|
208
|
+
let t20;
|
|
209
|
+
if ($[36] !== ready) {
|
|
210
|
+
t20 = clsx("k-segmented-indicator", { "is-ready": ready });
|
|
211
|
+
$[36] = ready;
|
|
212
|
+
$[37] = t20;
|
|
213
|
+
} else t20 = $[37];
|
|
214
|
+
let t21;
|
|
215
|
+
if ($[38] !== indicatorStyle || $[39] !== t20) {
|
|
216
|
+
t21 = /* @__PURE__ */ jsx("span", {
|
|
217
|
+
className: t20,
|
|
203
218
|
style: indicatorStyle
|
|
204
219
|
});
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
} else
|
|
209
|
-
let
|
|
210
|
-
if ($[
|
|
211
|
-
|
|
220
|
+
$[38] = indicatorStyle;
|
|
221
|
+
$[39] = t20;
|
|
222
|
+
$[40] = t21;
|
|
223
|
+
} else t21 = $[40];
|
|
224
|
+
let t22;
|
|
225
|
+
if ($[41] !== move || $[42] !== rest || $[43] !== t14 || $[44] !== t16 || $[45] !== t17 || $[46] !== t18 || $[47] !== t19 || $[48] !== t21) {
|
|
226
|
+
t22 = /* @__PURE__ */ jsxs("div", {
|
|
212
227
|
...rest,
|
|
213
228
|
ref: rootRef,
|
|
214
|
-
className:
|
|
215
|
-
role:
|
|
216
|
-
"aria-
|
|
217
|
-
"aria-
|
|
229
|
+
className: t14,
|
|
230
|
+
role: t15,
|
|
231
|
+
"aria-orientation": t16,
|
|
232
|
+
"aria-disabled": t17,
|
|
233
|
+
"aria-readonly": t18,
|
|
218
234
|
onKeyDown: move,
|
|
219
|
-
children: [
|
|
235
|
+
children: [t19, t21]
|
|
220
236
|
});
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
|
|
230
|
-
|
|
237
|
+
$[41] = move;
|
|
238
|
+
$[42] = rest;
|
|
239
|
+
$[43] = t14;
|
|
240
|
+
$[44] = t16;
|
|
241
|
+
$[45] = t17;
|
|
242
|
+
$[46] = t18;
|
|
243
|
+
$[47] = t19;
|
|
244
|
+
$[48] = t21;
|
|
245
|
+
$[49] = t22;
|
|
246
|
+
} else t22 = $[49];
|
|
247
|
+
return t22;
|
|
231
248
|
};
|
|
232
249
|
var segmented_default = createFormFieldComponent(Segmented);
|
|
233
250
|
function _temp(next) {
|
|
234
251
|
return next;
|
|
235
252
|
}
|
|
236
|
-
function _temp2(
|
|
253
|
+
function _temp2(item_0) {
|
|
254
|
+
return !item_0.disabled;
|
|
255
|
+
}
|
|
256
|
+
function _temp3(option_0) {
|
|
237
257
|
return !option_0.disabled;
|
|
238
258
|
}
|
|
239
259
|
//#endregion
|
package/es/select/option.js
CHANGED
package/es/select/select.js
CHANGED
package/es/skeleton/skeleton.js
CHANGED
package/es/slider/index.js
CHANGED
package/es/slider/thumb.js
CHANGED
package/es/space/index.js
CHANGED
package/es/spin/index.js
CHANGED
package/es/splitter/splitter.js
CHANGED
package/es/stat-card/countup.js
CHANGED
package/es/stat-card/rollup.js
CHANGED
package/es/steps/index.js
CHANGED
package/es/switch/index.js
CHANGED
package/es/table/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.2.
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -20,7 +20,7 @@ import { compareSortValues, countColumnLeaves, flattenColumns, flattenTreeData,
|
|
|
20
20
|
import { TableColumnSetting } from "./column-setting.js";
|
|
21
21
|
import { c } from "react/compiler-runtime";
|
|
22
22
|
import clsx from "clsx";
|
|
23
|
-
import { useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
23
|
+
import { isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
24
24
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25
25
|
import { flushSync } from "react-dom";
|
|
26
26
|
//#region components/table/index.tsx
|
|
@@ -155,6 +155,17 @@ var EllipsisCell = (t0) => {
|
|
|
155
155
|
return t8;
|
|
156
156
|
};
|
|
157
157
|
/**
|
|
158
|
+
* 单元格原始值的渲染兜底,与 kui-vue 同口径(vue 的渲染器会把对象子节点转成文本:普通对象与
|
|
159
|
+
* `Date` 调 `String()`,数组逐项展开)。React 遇到同样的对象会直接抛
|
|
160
|
+
* "Objects are not valid as a React child" 把整张表打崩,所以先在这一层转掉。
|
|
161
|
+
* React 元素原样保留,数组继续按子节点序列交给 React(`[1, 2]` 两边都渲染成 "12")。
|
|
162
|
+
*/
|
|
163
|
+
var renderRawValue = (value) => {
|
|
164
|
+
if (Array.isArray(value)) return value.map(renderRawValue);
|
|
165
|
+
if (value !== null && typeof value === "object" && !isValidElement(value)) return String(value);
|
|
166
|
+
return value;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
158
169
|
* 行展开状态。`expandedKeys` 提供时完全受控;否则 `expandAllRows` 决定初始是否全部展开,
|
|
159
170
|
* 并且此后 `data` 变化只补“新出现的父行”(见 `mergeExpandAllRows`),
|
|
160
171
|
* 用户手动展开或折叠过的行不会被异步到达的数据覆盖。
|
|
@@ -414,7 +425,7 @@ function Table({ data = EMPTY_DATA, columns = EMPTY_COLUMNS, ellipsis: tableElli
|
|
|
414
425
|
]);
|
|
415
426
|
const fixedClass = (column_4, index_2, colSpan = 1) => clsx({
|
|
416
427
|
"k-table-cell-fix-left": column_4.fixed === "left",
|
|
417
|
-
"k-table-cell-fix-left-last": column_4.fixed === "left" && leaves[index_2 +
|
|
428
|
+
"k-table-cell-fix-left-last": column_4.fixed === "left" && leaves[index_2 + colSpan]?.fixed !== "left",
|
|
418
429
|
"k-table-cell-fix-right": column_4.fixed === "right",
|
|
419
430
|
"k-table-cell-fix-right-first": column_4.fixed === "right" && leaves[index_2 - 1]?.fixed !== "right",
|
|
420
431
|
"k-table-cell-sorter": column_4.sorter,
|
|
@@ -638,7 +649,7 @@ function Table({ data = EMPTY_DATA, columns = EMPTY_COLUMNS, ellipsis: tableElli
|
|
|
638
649
|
const thead = /* @__PURE__ */ jsx("thead", { children: headerInfo.rows.map((row_5, rowIndex) => /* @__PURE__ */ jsxs("tr", { children: [checkable && rowIndex === 0 && /* @__PURE__ */ jsx("th", {
|
|
639
650
|
rowSpan: headerInfo.maxDepth,
|
|
640
651
|
className: clsx("k-table-cell-fix-left", {
|
|
641
|
-
"k-table-cell-fix-left-last": ping.left,
|
|
652
|
+
"k-table-cell-fix-left-last": ping.left && leaves[0]?.fixed !== "left",
|
|
642
653
|
"k-table-cell-last-column": !leaves.length
|
|
643
654
|
}),
|
|
644
655
|
style: { left: 0 },
|
|
@@ -707,7 +718,7 @@ function Table({ data = EMPTY_DATA, columns = EMPTY_COLUMNS, ellipsis: tableElli
|
|
|
707
718
|
},
|
|
708
719
|
children: [checkable && /* @__PURE__ */ jsx("td", {
|
|
709
720
|
className: clsx("k-table-cell-fix-left", {
|
|
710
|
-
"k-table-cell-fix-left-last": ping.left,
|
|
721
|
+
"k-table-cell-fix-left-last": ping.left && leaves[0]?.fixed !== "left",
|
|
711
722
|
"k-table-cell-last-column": !leaves.length
|
|
712
723
|
}),
|
|
713
724
|
style: {
|
|
@@ -728,7 +739,7 @@ function Table({ data = EMPTY_DATA, columns = EMPTY_COLUMNS, ellipsis: tableElli
|
|
|
728
739
|
};
|
|
729
740
|
if (!cell_2.show) return null;
|
|
730
741
|
const value = getRecordValue(record_6, column_11.key);
|
|
731
|
-
const content = column_11.render?.(value, record_6, rowIndex_0, column_11) ?? value;
|
|
742
|
+
const content = column_11.render?.(value, record_6, rowIndex_0, column_11) ?? renderRawValue(value);
|
|
732
743
|
const ellipsis = cellEllipsis.get(column_11.key);
|
|
733
744
|
return /* @__PURE__ */ jsx("td", {
|
|
734
745
|
"aria-labelledby": splitHeader ? headCellIds.get(column_11.key) : void 0,
|
|
@@ -816,7 +827,7 @@ function Table({ data = EMPTY_DATA, columns = EMPTY_COLUMNS, ellipsis: tableElli
|
|
|
816
827
|
ref: bodyRef,
|
|
817
828
|
style: {
|
|
818
829
|
overflowY: scroll.y ? "scroll" : "auto",
|
|
819
|
-
overflowX:
|
|
830
|
+
overflowX: "auto",
|
|
820
831
|
maxHeight: scroll.y
|
|
821
832
|
},
|
|
822
833
|
onScroll: handleScroll,
|
package/es/table/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.2.
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -109,8 +109,7 @@ var getSyntheticRowKey = (record) => {
|
|
|
109
109
|
* 本函数与上面的 `getSyntheticRowKey` 在两个仓库里是逐字节相同的副本,改一边必须同步另一边。
|
|
110
110
|
*/
|
|
111
111
|
var resolveRowKey = (record, rowKey) => {
|
|
112
|
-
|
|
113
|
-
const value = getRecordValue(record, rowKey);
|
|
112
|
+
const value = typeof rowKey === "function" ? rowKey(record) : getRecordValue(record, rowKey);
|
|
114
113
|
return typeof value === "string" || typeof value === "number" ? value : getSyntheticRowKey(record);
|
|
115
114
|
};
|
|
116
115
|
var flattenTreeData = ({ data, childrenColumnName, expandedKeys, getKey, sortRecords = (records) => records }) => {
|
package/es/tabs/tab-panel.js
CHANGED
package/es/tabs/tabs.js
CHANGED
package/es/tag/index.js
CHANGED
package/es/time-line/timeline.js
CHANGED
package/es/tooltip/index.js
CHANGED
package/es/tour/index.js
CHANGED
package/es/transfer/index.js
CHANGED
package/es/tree/index.js
CHANGED
package/es/tree/utils.js
CHANGED