@rainbow-oh/yee-c 0.4.3 → 0.4.5
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/cjs/Button/button.d.ts +1 -1
- package/dist/cjs/CSV/download.d.ts +1 -1
- package/dist/cjs/Carousel/carousel.d.ts +2 -2
- package/dist/cjs/Carousel/carousel.js +9 -2
- package/dist/cjs/Carousel/interface.d.ts +5 -0
- package/dist/cjs/Cascader/cascader.js +53 -62
- package/dist/cjs/Cascader/interface.d.ts +19 -2
- package/dist/cjs/Cascader/node.js +11 -6
- package/dist/cjs/Cascader/search-list.js +2 -1
- package/dist/cjs/Cascader/utils/index.d.ts +58 -14
- package/dist/cjs/Cascader/utils/index.js +57 -73
- package/dist/cjs/Drawer/style/index.less +4 -0
- package/dist/cjs/FloatButton/float-button.d.ts +1 -1
- package/dist/cjs/Form/demo/basic.js +2 -2
- package/dist/cjs/Form/style/index.less +15 -0
- package/dist/cjs/Input/style/index.less +19 -17
- package/dist/cjs/InputNumber/style/index.less +0 -29
- package/dist/cjs/PickerPanel/interface.d.ts +44 -2
- package/dist/cjs/PickerPanel/panels/DatePanel/DateBody.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/DatePanel/DateHeader.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/DatePanel/DateHeader.js +1 -1
- package/dist/cjs/PickerPanel/panels/DatePanel/index.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/DateTimePanel/index.d.ts +7 -1
- package/dist/cjs/PickerPanel/panels/DateTimePanel/index.js +18 -4
- package/dist/cjs/PickerPanel/panels/DecadePanel/DecadeBody.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/DecadePanel/DecadeBody.js +1 -1
- package/dist/cjs/PickerPanel/panels/DecadePanel/DecadeHeader.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/DecadePanel/DecadeHeader.js +1 -1
- package/dist/cjs/PickerPanel/panels/DecadePanel/index.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/DecadePanel/index.js +1 -1
- package/dist/cjs/PickerPanel/panels/Header.d.ts +13 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/MonthBody.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/MonthHeader.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/MonthHeader.js +1 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/index.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/index.js +1 -1
- package/dist/cjs/PickerPanel/panels/PanelBody.d.ts +21 -1
- package/dist/cjs/PickerPanel/panels/PanelBody.js +3 -3
- package/dist/cjs/PickerPanel/panels/QuarterPanel/QuarterBody.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/QuarterPanel/QuarterHeader.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/QuarterPanel/index.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/RangePanel/index.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/RangePanel/index.js +2 -2
- package/dist/cjs/PickerPanel/panels/RangePanel/interface.d.ts +5 -5
- package/dist/cjs/PickerPanel/panels/TimePanel/TimeBody.d.ts +17 -1
- package/dist/cjs/PickerPanel/panels/TimePanel/TimeCell.d.ts +7 -1
- package/dist/cjs/PickerPanel/panels/TimePanel/TimeCell.js +1 -1
- package/dist/cjs/PickerPanel/panels/TimePanel/TimeColumn.d.ts +14 -1
- package/dist/cjs/PickerPanel/panels/TimePanel/TimeColumn.js +1 -1
- package/dist/cjs/PickerPanel/panels/TimePanel/TimeHeader.d.ts +4 -1
- package/dist/cjs/PickerPanel/panels/TimePanel/index.d.ts +9 -1
- package/dist/cjs/PickerPanel/panels/WeekPanel/WeekBody.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/WeekPanel/WeekHeader.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/WeekPanel/index.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/YearPanel/YearBody.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/YearPanel/YearBody.js +2 -2
- package/dist/cjs/PickerPanel/panels/YearPanel/YearHeader.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/YearPanel/YearHeader.js +7 -1
- package/dist/cjs/PickerPanel/panels/YearPanel/index.d.ts +2 -1
- package/dist/cjs/PickerPanel/panels/YearPanel/index.js +1 -1
- package/dist/cjs/PickerPanel/utils/pickerUtils.d.ts +7 -7
- package/dist/cjs/PickerPanel/utils/pickerUtils.js +2 -2
- package/dist/cjs/Popover/style/index.less +1 -0
- package/dist/cjs/Select/interface.d.ts +77 -0
- package/dist/cjs/Select/option.d.ts +2 -1
- package/dist/cjs/Select/option.js +6 -3
- package/dist/cjs/Select/options.d.ts +3 -2
- package/dist/cjs/Select/options.js +53 -47
- package/dist/cjs/Select/select.js +1 -1
- package/dist/cjs/Select/style/index.less +8 -13
- package/dist/cjs/Selector/interface.d.ts +4 -0
- package/dist/cjs/Selector/selector.js +3 -0
- package/dist/cjs/Selector/style/index.less +21 -137
- package/dist/cjs/Table/hooks/useFilter.js +1 -1
- package/dist/cjs/Table/interface.d.ts +4 -0
- package/dist/cjs/Table/style/index.less +2 -0
- package/dist/cjs/Table/theader/filter.js +2 -1
- package/dist/cjs/Tabs/demo/basic.js +8 -1
- package/dist/cjs/Tabs/tabs.js +3 -1
- package/dist/cjs/Tag/demo/checkable.js +1 -0
- package/dist/cjs/Tag/tag.js +1 -1
- package/dist/cjs/TextArea/style/index.less +0 -17
- package/dist/cjs/Trigger/trigger.js +1 -1
- package/dist/cjs/hooks/useEvent.js +4 -1
- package/dist/cjs/style/color.css +1 -1
- package/dist/cjs/style/size.css +11 -2
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +13 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Button/button.d.ts +1 -1
- package/dist/esm/CSV/download.d.ts +1 -1
- package/dist/esm/Carousel/carousel.d.ts +2 -2
- package/dist/esm/Carousel/carousel.js +5 -1
- package/dist/esm/Carousel/interface.d.ts +5 -0
- package/dist/esm/Cascader/cascader.js +49 -56
- package/dist/esm/Cascader/interface.d.ts +19 -2
- package/dist/esm/Cascader/node.js +8 -11
- package/dist/esm/Cascader/search-list.js +2 -1
- package/dist/esm/Cascader/utils/index.d.ts +58 -14
- package/dist/esm/Cascader/utils/index.js +124 -75
- package/dist/esm/Drawer/style/index.less +4 -0
- package/dist/esm/FloatButton/float-button.d.ts +1 -1
- package/dist/esm/Form/demo/basic.js +4 -2
- package/dist/esm/Form/style/index.less +15 -0
- package/dist/esm/Input/style/index.less +19 -17
- package/dist/esm/InputNumber/style/index.less +0 -29
- package/dist/esm/PickerPanel/interface.d.ts +44 -2
- package/dist/esm/PickerPanel/panels/DatePanel/DateBody.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/DatePanel/DateHeader.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/DatePanel/DateHeader.js +1 -1
- package/dist/esm/PickerPanel/panels/DatePanel/index.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/DateTimePanel/index.d.ts +7 -1
- package/dist/esm/PickerPanel/panels/DateTimePanel/index.js +11 -7
- package/dist/esm/PickerPanel/panels/DecadePanel/DecadeBody.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/DecadePanel/DecadeBody.js +2 -1
- package/dist/esm/PickerPanel/panels/DecadePanel/DecadeHeader.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/DecadePanel/DecadeHeader.js +2 -1
- package/dist/esm/PickerPanel/panels/DecadePanel/index.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/DecadePanel/index.js +1 -1
- package/dist/esm/PickerPanel/panels/Header.d.ts +13 -1
- package/dist/esm/PickerPanel/panels/MonthPanel/MonthBody.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/MonthPanel/MonthHeader.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/MonthPanel/MonthHeader.js +2 -1
- package/dist/esm/PickerPanel/panels/MonthPanel/index.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/MonthPanel/index.js +1 -1
- package/dist/esm/PickerPanel/panels/PanelBody.d.ts +21 -1
- package/dist/esm/PickerPanel/panels/PanelBody.js +2 -4
- package/dist/esm/PickerPanel/panels/QuarterPanel/QuarterBody.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/QuarterPanel/QuarterHeader.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/QuarterPanel/index.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/RangePanel/index.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/RangePanel/index.js +2 -2
- package/dist/esm/PickerPanel/panels/RangePanel/interface.d.ts +5 -5
- package/dist/esm/PickerPanel/panels/TimePanel/TimeBody.d.ts +17 -1
- package/dist/esm/PickerPanel/panels/TimePanel/TimeCell.d.ts +7 -1
- package/dist/esm/PickerPanel/panels/TimePanel/TimeCell.js +1 -1
- package/dist/esm/PickerPanel/panels/TimePanel/TimeColumn.d.ts +14 -1
- package/dist/esm/PickerPanel/panels/TimePanel/TimeColumn.js +1 -1
- package/dist/esm/PickerPanel/panels/TimePanel/TimeHeader.d.ts +4 -1
- package/dist/esm/PickerPanel/panels/TimePanel/index.d.ts +9 -1
- package/dist/esm/PickerPanel/panels/WeekPanel/WeekBody.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/WeekPanel/WeekHeader.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/WeekPanel/index.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/YearPanel/YearBody.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/YearPanel/YearBody.js +3 -2
- package/dist/esm/PickerPanel/panels/YearPanel/YearHeader.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/YearPanel/YearHeader.js +2 -1
- package/dist/esm/PickerPanel/panels/YearPanel/index.d.ts +2 -1
- package/dist/esm/PickerPanel/panels/YearPanel/index.js +1 -1
- package/dist/esm/PickerPanel/picker-panel.js +3 -0
- package/dist/esm/PickerPanel/utils/pickerUtils.d.ts +7 -7
- package/dist/esm/PickerPanel/utils/pickerUtils.js +4 -10
- package/dist/esm/Popover/style/index.less +1 -0
- package/dist/esm/Select/interface.d.ts +77 -0
- package/dist/esm/Select/option.d.ts +2 -1
- package/dist/esm/Select/option.js +11 -2
- package/dist/esm/Select/options.d.ts +3 -2
- package/dist/esm/Select/options.js +3 -1
- package/dist/esm/Select/select.js +1 -3
- package/dist/esm/Select/style/index.less +8 -13
- package/dist/esm/Selector/interface.d.ts +4 -0
- package/dist/esm/Selector/selector.js +4 -2
- package/dist/esm/Selector/style/index.less +21 -137
- package/dist/esm/Table/hooks/useFilter.js +1 -1
- package/dist/esm/Table/interface.d.ts +4 -0
- package/dist/esm/Table/style/index.less +2 -0
- package/dist/esm/Table/theader/filter.js +3 -4
- package/dist/esm/Tabs/demo/basic.js +4 -1
- package/dist/esm/Tabs/tabs.js +3 -1
- package/dist/esm/Tag/demo/checkable.js +1 -0
- package/dist/esm/Tag/tag.js +1 -1
- package/dist/esm/TextArea/style/index.less +0 -17
- package/dist/esm/Trigger/trigger.js +1 -1
- package/dist/esm/style/color.css +1 -1
- package/dist/esm/style/size.css +11 -2
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +13 -4
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +2 -2
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +1 -1
- package/src/Carousel/carousel.tsx +14 -3
- package/src/Carousel/interface.ts +6 -0
- package/src/Cascader/cascader.tsx +68 -63
- package/src/Cascader/column.tsx +1 -1
- package/src/Cascader/interface.ts +19 -2
- package/src/Cascader/node.tsx +12 -7
- package/src/Cascader/search-list.tsx +1 -1
- package/src/Cascader/utils/index.ts +130 -68
- package/src/Drawer/style/index.less +4 -0
- package/src/Dropdown/dropdown.tsx +1 -1
- package/src/FloatButton/float-button.tsx +5 -3
- package/src/Form/demo/basic.tsx +2 -2
- package/src/Form/style/index.less +15 -0
- package/src/Input/style/index.less +19 -17
- package/src/InputNumber/style/index.less +0 -29
- package/src/PickerPanel/interface.ts +43 -2
- package/src/PickerPanel/panels/DatePanel/DateBody.tsx +2 -1
- package/src/PickerPanel/panels/DatePanel/DateHeader.tsx +3 -2
- package/src/PickerPanel/panels/DatePanel/index.tsx +2 -1
- package/src/PickerPanel/panels/DateTimePanel/index.tsx +12 -5
- package/src/PickerPanel/panels/DecadePanel/DecadeBody.tsx +3 -2
- package/src/PickerPanel/panels/DecadePanel/DecadeHeader.tsx +3 -2
- package/src/PickerPanel/panels/DecadePanel/index.tsx +3 -2
- package/src/PickerPanel/panels/Header.tsx +14 -1
- package/src/PickerPanel/panels/MonthPanel/MonthBody.tsx +2 -1
- package/src/PickerPanel/panels/MonthPanel/MonthHeader.tsx +3 -2
- package/src/PickerPanel/panels/MonthPanel/index.tsx +3 -2
- package/src/PickerPanel/panels/PanelBody.tsx +27 -5
- package/src/PickerPanel/panels/QuarterPanel/QuarterBody.tsx +2 -1
- package/src/PickerPanel/panels/QuarterPanel/QuarterHeader.tsx +2 -1
- package/src/PickerPanel/panels/QuarterPanel/index.tsx +2 -1
- package/src/PickerPanel/panels/RangePanel/index.tsx +11 -9
- package/src/PickerPanel/panels/RangePanel/interface.ts +5 -5
- package/src/PickerPanel/panels/TimePanel/TimeBody.tsx +21 -5
- package/src/PickerPanel/panels/TimePanel/TimeCell.tsx +9 -2
- package/src/PickerPanel/panels/TimePanel/TimeColumn.tsx +15 -2
- package/src/PickerPanel/panels/TimePanel/TimeHeader.tsx +5 -1
- package/src/PickerPanel/panels/TimePanel/index.tsx +10 -1
- package/src/PickerPanel/panels/WeekPanel/WeekBody.tsx +2 -1
- package/src/PickerPanel/panels/WeekPanel/WeekHeader.tsx +2 -1
- package/src/PickerPanel/panels/WeekPanel/index.tsx +2 -1
- package/src/PickerPanel/panels/YearPanel/YearBody.tsx +4 -3
- package/src/PickerPanel/panels/YearPanel/YearHeader.tsx +9 -3
- package/src/PickerPanel/panels/YearPanel/index.tsx +3 -2
- package/src/PickerPanel/picker-panel.tsx +5 -3
- package/src/PickerPanel/utils/pickerUtils.ts +17 -8
- package/src/Popover/style/index.less +1 -0
- package/src/Select/interface.ts +87 -0
- package/src/Select/option.tsx +13 -4
- package/src/Select/options.tsx +49 -43
- package/src/Select/select.tsx +5 -2
- package/src/Select/style/index.less +8 -13
- package/src/Selector/interface.ts +4 -0
- package/src/Selector/selector.tsx +2 -0
- package/src/Selector/style/index.less +21 -137
- package/src/Splitter/hooks/useMove.ts +2 -2
- package/src/Table/hooks/useFilter.ts +1 -1
- package/src/Table/interface.ts +4 -0
- package/src/Table/style/index.less +2 -0
- package/src/Table/theader/filter.tsx +2 -2
- package/src/Tabs/demo/basic.tsx +7 -1
- package/src/Tabs/tabs.tsx +3 -2
- package/src/Tag/demo/checkable.tsx +1 -0
- package/src/Tag/tag.tsx +1 -1
- package/src/TextArea/style/index.less +0 -17
- package/src/Trigger/trigger.tsx +1 -1
- package/src/hooks/useEvent.ts +7 -4
- package/src/hooks/useMergedState.ts +6 -4
- package/src/style/color.css +1 -1
- package/src/style/size.css +11 -2
- package/src/version.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ButtonProps } from './interface';
|
|
3
3
|
import './style/index.less';
|
|
4
|
-
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<
|
|
4
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
5
5
|
export default Button;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CSVDownloderProps } from './interface';
|
|
3
|
-
declare const Link: React.ForwardRefExoticComponent<CSVDownloderProps & React.RefAttributes<
|
|
3
|
+
declare const Link: React.ForwardRefExoticComponent<CSVDownloderProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
4
4
|
export default Link;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { CarouselProps } from './interface';
|
|
2
|
+
import type { CarouselContextProps, CarouselProps } from './interface';
|
|
3
3
|
import './style/index.less';
|
|
4
|
-
export declare const CarouselCtx: React.Context<
|
|
4
|
+
export declare const CarouselCtx: React.Context<CarouselContextProps>;
|
|
5
5
|
declare const Carousel: React.ForwardRefExoticComponent<CarouselProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
export default Carousel;
|
|
@@ -71,7 +71,11 @@ var import_mergeContextToProps = __toESM(require("../utils/mergeContextToProps")
|
|
|
71
71
|
var import_carousel_item = __toESM(require("./carousel-item"));
|
|
72
72
|
var import_style = require("./style/index.less");
|
|
73
73
|
var DEFAULT_ANIMATION_DURATION = 500;
|
|
74
|
-
var CarouselCtx = import_react.default.createContext({
|
|
74
|
+
var CarouselCtx = import_react.default.createContext({
|
|
75
|
+
prefixCls: "yee-carousel",
|
|
76
|
+
effect: "scrollx",
|
|
77
|
+
current: 1
|
|
78
|
+
});
|
|
75
79
|
var Carousel = import_react.default.forwardRef(
|
|
76
80
|
(baseprops, ref) => {
|
|
77
81
|
const { carousel } = (0, import_react.useContext)(import_Config_Provider.GlobalContext);
|
|
@@ -283,7 +287,10 @@ var Carousel = import_react.default.forwardRef(
|
|
|
283
287
|
};
|
|
284
288
|
const renderFadeChilds = () => {
|
|
285
289
|
return import_react.default.Children.map(children, (child, index) => {
|
|
286
|
-
return import_react.default.cloneElement(
|
|
290
|
+
return import_react.default.cloneElement(
|
|
291
|
+
child,
|
|
292
|
+
{ index }
|
|
293
|
+
);
|
|
287
294
|
});
|
|
288
295
|
};
|
|
289
296
|
const renderWrapedChilds = () => {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export type SemanticDOM = 'dot' | 'prev' | 'next';
|
|
3
|
+
export interface CarouselContextProps {
|
|
4
|
+
prefixCls: string;
|
|
5
|
+
effect: 'fade' | 'scrollx';
|
|
6
|
+
current: number;
|
|
7
|
+
}
|
|
3
8
|
export interface CarouselItemProps {
|
|
4
9
|
index: number;
|
|
5
10
|
style?: React.CSSProperties;
|
|
@@ -88,7 +88,7 @@ var Cascader = (baseprops) => {
|
|
|
88
88
|
options,
|
|
89
89
|
placement = "bottomLeft",
|
|
90
90
|
popupClassName,
|
|
91
|
-
searchable,
|
|
91
|
+
searchable = true,
|
|
92
92
|
fieldNames = {
|
|
93
93
|
label: "label",
|
|
94
94
|
value: "value",
|
|
@@ -149,8 +149,6 @@ var Cascader = (baseprops) => {
|
|
|
149
149
|
currentValue || [],
|
|
150
150
|
flatOptions,
|
|
151
151
|
{
|
|
152
|
-
needNext: true,
|
|
153
|
-
// Set to true to expand to full path
|
|
154
152
|
multiple
|
|
155
153
|
}
|
|
156
154
|
);
|
|
@@ -170,9 +168,9 @@ var Cascader = (baseprops) => {
|
|
|
170
168
|
setSearchValue(value2);
|
|
171
169
|
};
|
|
172
170
|
const onNodeMouseEnter = (item, level) => {
|
|
173
|
-
if (expandTrigger === "hover" &&
|
|
171
|
+
if (expandTrigger === "hover" && !item.isLeaf) {
|
|
174
172
|
const queue = columns.slice(0, level + 1);
|
|
175
|
-
queue.push(item.
|
|
173
|
+
queue.push((0, import_utils.getChildren)(flatOptions, item.uid));
|
|
176
174
|
setColumns(queue);
|
|
177
175
|
setExpandedPath((prev) => [
|
|
178
176
|
...prev.slice(0, level),
|
|
@@ -186,17 +184,17 @@ var Cascader = (baseprops) => {
|
|
|
186
184
|
const traverse = (currentNode, depth) => {
|
|
187
185
|
if (depth > maxDepth)
|
|
188
186
|
return;
|
|
189
|
-
if (
|
|
187
|
+
if (currentNode.isLeaf) {
|
|
190
188
|
paths.push(currentNode.path);
|
|
191
189
|
return;
|
|
192
190
|
}
|
|
193
|
-
const children2 = currentNode.
|
|
191
|
+
const children2 = (0, import_utils.getChildren)(flatOptions, currentNode.uid);
|
|
194
192
|
children2.forEach((child) => traverse(child, depth + 1));
|
|
195
193
|
};
|
|
196
194
|
traverse(node, 0);
|
|
197
195
|
return paths;
|
|
198
196
|
},
|
|
199
|
-
[]
|
|
197
|
+
[flatOptions]
|
|
200
198
|
);
|
|
201
199
|
const onItemClick = (0, import_react.useCallback)(
|
|
202
200
|
(item, checkable = false) => {
|
|
@@ -208,58 +206,48 @@ var Cascader = (baseprops) => {
|
|
|
208
206
|
if (multiple && checkable) {
|
|
209
207
|
const currentValue = mergedValue;
|
|
210
208
|
const isSelected = currentValue.some((v) => (0, import_isEqual.default)(v, item.path));
|
|
211
|
-
if (
|
|
209
|
+
if (!item.isLeaf) {
|
|
212
210
|
const descendantPaths = getAllDescendantPaths(item, 50);
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
);
|
|
219
|
-
});
|
|
211
|
+
let filteredValue = currentValue.filter(
|
|
212
|
+
(v) => !descendantPaths.some(
|
|
213
|
+
(descPath) => (0, import_utils.isSamePrefixPath)(descPath, v)
|
|
214
|
+
)
|
|
215
|
+
);
|
|
220
216
|
if (!isSelected) {
|
|
221
217
|
filteredValue = [...filteredValue, ...descendantPaths];
|
|
222
218
|
}
|
|
223
219
|
newValue = filteredValue;
|
|
224
|
-
newOpts = filteredValue.map(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return nodeMap.get(uid);
|
|
228
|
-
});
|
|
229
|
-
});
|
|
220
|
+
newOpts = filteredValue.map(
|
|
221
|
+
(path) => path.map((_, i) => nodeMap.get((0, import_utils.pathToUid)(path.slice(0, i + 1))))
|
|
222
|
+
);
|
|
230
223
|
} else {
|
|
231
224
|
if (isSelected) {
|
|
232
225
|
newValue = currentValue.filter((v) => !(0, import_isEqual.default)(v, item.path));
|
|
233
226
|
} else {
|
|
234
227
|
newValue = [...currentValue, item.path];
|
|
235
228
|
}
|
|
236
|
-
newOpts = newValue.map(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return nodeMap.get(uid);
|
|
240
|
-
});
|
|
241
|
-
});
|
|
229
|
+
newOpts = newValue.map(
|
|
230
|
+
(path) => path.map((_, i) => nodeMap.get((0, import_utils.pathToUid)(path.slice(0, i + 1))))
|
|
231
|
+
);
|
|
242
232
|
}
|
|
243
233
|
changed = true;
|
|
244
234
|
} else if (shouldSelect) {
|
|
245
235
|
newValue = multiple ? [...mergedValue, item.path] : item.path;
|
|
246
236
|
newOpts = multiple ? [
|
|
247
|
-
...mergedValue.map((
|
|
248
|
-
const vs =
|
|
249
|
-
|
|
250
|
-
|
|
237
|
+
...mergedValue.map((path) => {
|
|
238
|
+
const vs = path;
|
|
239
|
+
return vs.map(
|
|
240
|
+
(_, i) => nodeMap.get((0, import_utils.pathToUid)(vs.slice(0, i + 1)))
|
|
241
|
+
);
|
|
251
242
|
}),
|
|
252
|
-
|
|
253
|
-
item.path.
|
|
254
|
-
|
|
255
|
-
return nodeMap.get(uid);
|
|
256
|
-
})
|
|
257
|
-
]
|
|
243
|
+
item.path.map(
|
|
244
|
+
(_, i) => nodeMap.get((0, import_utils.pathToUid)(item.path.slice(0, i + 1)))
|
|
245
|
+
)
|
|
258
246
|
] : flatOptions.filter((opt) => {
|
|
259
|
-
const
|
|
260
|
-
(_, i) => item.path.slice(0, i + 1)
|
|
247
|
+
const ancestors = item.path.map(
|
|
248
|
+
(_, i) => (0, import_utils.pathToUid)(item.path.slice(0, i + 1))
|
|
261
249
|
);
|
|
262
|
-
return
|
|
250
|
+
return ancestors.includes(opt.uid);
|
|
263
251
|
});
|
|
264
252
|
changed = true;
|
|
265
253
|
} else {
|
|
@@ -304,7 +292,7 @@ var Cascader = (baseprops) => {
|
|
|
304
292
|
if (!mergedValue || mergedValue.length === 0)
|
|
305
293
|
return { options: [], selectedKeys: [] };
|
|
306
294
|
const { fullNode = false, onlyParentNode = false } = props;
|
|
307
|
-
const formatKey = (val) =>
|
|
295
|
+
const formatKey = (val) => (0, import_utils.pathToUid)(val);
|
|
308
296
|
let rawValues = [];
|
|
309
297
|
if (multiple) {
|
|
310
298
|
rawValues = mergedValue;
|
|
@@ -314,28 +302,24 @@ var Cascader = (baseprops) => {
|
|
|
314
302
|
const selectedKeys = multiple ? rawValues.map(formatKey) : rawValues[0] ? [formatKey(rawValues[0])] : [];
|
|
315
303
|
let displayValues = rawValues;
|
|
316
304
|
if (multiple && onlyParentNode) {
|
|
317
|
-
const
|
|
318
|
-
const
|
|
319
|
-
nodeMap.forEach((node
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
(child) => childPathStrs.has(child.path.join("-"))
|
|
305
|
+
const selectedPathKeys = new Set(rawValues.map(import_utils.pathToUid));
|
|
306
|
+
const parentPaths = [];
|
|
307
|
+
nodeMap.forEach((node) => {
|
|
308
|
+
if (!node.isLeaf) {
|
|
309
|
+
const allChildrenSelected = (0, import_utils.getChildren)(flatOptions, node.uid).every(
|
|
310
|
+
(child) => selectedPathKeys.has((0, import_utils.pathToUid)(child.path))
|
|
324
311
|
);
|
|
325
312
|
if (allChildrenSelected) {
|
|
326
|
-
|
|
313
|
+
parentPaths.push(node.path);
|
|
327
314
|
}
|
|
328
315
|
}
|
|
329
316
|
});
|
|
330
|
-
displayValues = rawValues.filter(
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
(parentId) => pathStr.startsWith(parentId + "-")
|
|
334
|
-
);
|
|
335
|
-
});
|
|
317
|
+
displayValues = rawValues.filter(
|
|
318
|
+
(path) => !parentPaths.some((parentPath) => (0, import_utils.isSamePrefixPath)(parentPath, path))
|
|
319
|
+
);
|
|
336
320
|
}
|
|
337
321
|
const displayOptions = displayValues.map((valPath) => {
|
|
338
|
-
var _a2, _b, _c, _d
|
|
322
|
+
var _a2, _b, _c, _d;
|
|
339
323
|
const opts = valPath.map((_, i) => {
|
|
340
324
|
const uid = formatKey(valPath.slice(0, i + 1));
|
|
341
325
|
return nodeMap.get(uid);
|
|
@@ -348,13 +332,13 @@ var Cascader = (baseprops) => {
|
|
|
348
332
|
options: opts
|
|
349
333
|
});
|
|
350
334
|
} else {
|
|
351
|
-
const source = (
|
|
352
|
-
label = (
|
|
335
|
+
const source = (_a2 = opts[opts.length - 1]) == null ? void 0 : _a2.$source;
|
|
336
|
+
label = (_b = source == null ? void 0 : source[optionLabelProp]) != null ? _b : "";
|
|
353
337
|
}
|
|
354
338
|
} else if (fullNode) {
|
|
355
339
|
label = opts.map((opt) => (opt == null ? void 0 : opt.label) || "").join("/");
|
|
356
340
|
} else {
|
|
357
|
-
label = (
|
|
341
|
+
label = (_d = (_c = opts[opts.length - 1]) == null ? void 0 : _c.label) != null ? _d : "";
|
|
358
342
|
}
|
|
359
343
|
return { value: formatKey(valPath), label };
|
|
360
344
|
});
|
|
@@ -363,6 +347,7 @@ var Cascader = (baseprops) => {
|
|
|
363
347
|
multiple,
|
|
364
348
|
mergedValue,
|
|
365
349
|
nodeMap,
|
|
350
|
+
flatOptions,
|
|
366
351
|
optionLabelProp,
|
|
367
352
|
props.fullNode,
|
|
368
353
|
props.onlyParentNode
|
|
@@ -370,13 +355,18 @@ var Cascader = (baseprops) => {
|
|
|
370
355
|
const onVisibleChange = (newVisible) => {
|
|
371
356
|
popupVisible.current = newVisible;
|
|
372
357
|
};
|
|
358
|
+
const handleClear = () => {
|
|
359
|
+
setSearchValue("");
|
|
360
|
+
setMergedValue([]);
|
|
361
|
+
onChange == null ? void 0 : onChange([], []);
|
|
362
|
+
};
|
|
373
363
|
const filteredList = (0, import_react.useMemo)(() => {
|
|
374
364
|
if (!searchValue)
|
|
375
365
|
return [];
|
|
376
366
|
const lowStr = searchValue.toLowerCase();
|
|
377
367
|
const result = [];
|
|
378
368
|
for (const item of flatOptions) {
|
|
379
|
-
const text =
|
|
369
|
+
const text = item.labelPath.join(" / ");
|
|
380
370
|
const textLower = text.toLowerCase();
|
|
381
371
|
if (textLower.includes(lowStr)) {
|
|
382
372
|
const matches = [];
|
|
@@ -413,7 +403,8 @@ var Cascader = (baseprops) => {
|
|
|
413
403
|
searchable,
|
|
414
404
|
mode: multiple ? "multiple" : void 0,
|
|
415
405
|
value: searchValue,
|
|
416
|
-
onSearch: handleSearch
|
|
406
|
+
onSearch: handleSearch,
|
|
407
|
+
onClear: handleClear
|
|
417
408
|
})
|
|
418
409
|
);
|
|
419
410
|
};
|
|
@@ -15,11 +15,27 @@ export type FieldNames = {
|
|
|
15
15
|
value: string;
|
|
16
16
|
children: string;
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Flattened representation of a tree node.
|
|
20
|
+
*
|
|
21
|
+
* Deliberately a concrete type (not `Option & ...`) so that:
|
|
22
|
+
* - `.label` / `.value` / `.isLeaf` resolve to their precise types (an index
|
|
23
|
+
* signature on `Option` would otherwise widen them to `unknown`),
|
|
24
|
+
* - `.children` is a compile error — flattened nodes intentionally do not
|
|
25
|
+
* carry children; use `getChildren(data, uid)` instead.
|
|
26
|
+
* Dynamic/extra-field access should go through `$source` (the raw node).
|
|
27
|
+
*/
|
|
28
|
+
export type FlattenOption = {
|
|
29
|
+
$source: Option;
|
|
30
|
+
label: string;
|
|
31
|
+
value: string | number;
|
|
19
32
|
pid: string;
|
|
20
33
|
uid: string;
|
|
21
34
|
path: Array<string | number>;
|
|
22
|
-
|
|
35
|
+
labelPath: string[];
|
|
36
|
+
level: number;
|
|
37
|
+
isLeaf: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
23
39
|
};
|
|
24
40
|
export type NodeProps = FlattenOption & {
|
|
25
41
|
level: number;
|
|
@@ -87,6 +103,7 @@ export interface CascaderProps extends Omit<SelectorProps, 'options' | 'value' |
|
|
|
87
103
|
multiple?: boolean;
|
|
88
104
|
/**
|
|
89
105
|
* Is it searchable
|
|
106
|
+
* @default true
|
|
90
107
|
*/
|
|
91
108
|
searchable?: boolean;
|
|
92
109
|
/**
|
|
@@ -42,7 +42,7 @@ var import_cascader = require("./cascader");
|
|
|
42
42
|
var import_utils = require("./utils");
|
|
43
43
|
var Node = (props) => {
|
|
44
44
|
var _a;
|
|
45
|
-
const { uid, value, disabled, label,
|
|
45
|
+
const { uid, value, disabled, label, $source, isLeaf, path, level } = props;
|
|
46
46
|
const {
|
|
47
47
|
prefixCls,
|
|
48
48
|
expandedPath,
|
|
@@ -50,10 +50,11 @@ var Node = (props) => {
|
|
|
50
50
|
mergedValue,
|
|
51
51
|
loadData,
|
|
52
52
|
nodeMap,
|
|
53
|
+
flatOptions,
|
|
53
54
|
onNodeMouseEnter,
|
|
54
55
|
onItemClick
|
|
55
56
|
} = (0, import_react.useContext)(import_cascader.CascaderCtx);
|
|
56
|
-
const isParent =
|
|
57
|
+
const isParent = !isLeaf;
|
|
57
58
|
const [load, setLoad] = (0, import_react.useState)(0);
|
|
58
59
|
const checked = (0, import_react.useMemo)(() => {
|
|
59
60
|
return mergedValue ? multiple ? mergedValue.some(
|
|
@@ -70,7 +71,7 @@ var Node = (props) => {
|
|
|
70
71
|
var _a2;
|
|
71
72
|
if (loadData && isLeaf === false) {
|
|
72
73
|
setLoad(1);
|
|
73
|
-
(_a2 = loadData(
|
|
74
|
+
(_a2 = loadData($source)) == null ? void 0 : _a2.then(() => {
|
|
74
75
|
setLoad(2);
|
|
75
76
|
}).catch(() => {
|
|
76
77
|
setLoad(0);
|
|
@@ -94,12 +95,16 @@ var Node = (props) => {
|
|
|
94
95
|
const currentNode = nodeMap.get(uid);
|
|
95
96
|
if (!multiple || !currentNode || !isParent)
|
|
96
97
|
return [false, false];
|
|
97
|
-
return (0, import_utils.isHalfChecked)(
|
|
98
|
-
|
|
98
|
+
return (0, import_utils.isHalfChecked)(
|
|
99
|
+
mergedValue,
|
|
100
|
+
currentNode,
|
|
101
|
+
(0, import_utils.getChildren)(flatOptions, uid)
|
|
102
|
+
);
|
|
103
|
+
}, [nodeMap, uid, mergedValue, flatOptions, isParent, multiple]);
|
|
99
104
|
const clsName = (0, import_clsx.default)(
|
|
100
105
|
`${prefixCls}-menu-item`,
|
|
101
106
|
{
|
|
102
|
-
[`${prefixCls}-menu-item-expand`]:
|
|
107
|
+
[`${prefixCls}-menu-item-expand`]: !isLeaf,
|
|
103
108
|
[`${prefixCls}-menu-item-disabled`]: disabled,
|
|
104
109
|
active: ((_a = expandedPath[level]) == null ? void 0 : _a.key) === uid
|
|
105
110
|
},
|
|
@@ -46,7 +46,8 @@ var renderHighlightText = (matches) => {
|
|
|
46
46
|
var SearchList = (props) => {
|
|
47
47
|
const { prefixCls, items, onClick } = props;
|
|
48
48
|
return /* @__PURE__ */ import_react.default.createElement("ul", { className: `${prefixCls}-filter-menu` }, items.length ? items.map((item) => {
|
|
49
|
-
|
|
49
|
+
var _a;
|
|
50
|
+
const title = ((_a = item.data.$source) == null ? void 0 : _a.title) || item.data.labelPath.join(" / ");
|
|
50
51
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
51
52
|
"li",
|
|
52
53
|
{
|
|
@@ -7,23 +7,58 @@ import { FieldNames, FlattenOption } from '../interface';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function hasChild(data: Record<string, any>, childrenField?: string): any;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Separator used to build a node's `uid` from its value path. A control
|
|
11
|
+
* character is used on purpose so it can never appear inside a user value —
|
|
12
|
+
* this prevents collisions like value `"a-1"` vs path `["a", "1"]` that a plain
|
|
13
|
+
* `'-'` separator would produce.
|
|
14
|
+
*/
|
|
15
|
+
export declare const UID_SEP = "\u0001";
|
|
16
|
+
/**
|
|
17
|
+
* Build the canonical uid for a value path. Use this everywhere a path needs
|
|
18
|
+
* to be turned into a key (nodeMap lookups, selected keys, comparisons) so the
|
|
19
|
+
* format stays consistent with the `uid`/`pid` produced by `flattenOptions`.
|
|
20
|
+
* @param path - The value path
|
|
21
|
+
*/
|
|
22
|
+
export declare const pathToUid: (path: Array<string | number>) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Get the direct flattened children of the node identified by `uid`.
|
|
25
|
+
*
|
|
26
|
+
* Flattened nodes intentionally do not carry a `children` reference (it used to
|
|
27
|
+
* point at the raw, un-flattened subtree and caused type lies). Derive children
|
|
28
|
+
* from the flat list via `pid` instead — single source of truth.
|
|
29
|
+
* @param data - The flattened options data
|
|
30
|
+
* @param uid - The parent node's uid
|
|
31
|
+
*/
|
|
32
|
+
export declare const getChildren: (data: Array<FlattenOption>, uid: string) => FlattenOption[];
|
|
33
|
+
/**
|
|
34
|
+
* Reconstruct cascade columns and the highlight path from a value path.
|
|
35
|
+
*
|
|
36
|
+
* Walks the flattened options level by level, matching each value segment
|
|
37
|
+
* against the correct parent column via `pid` + `value`. Returns:
|
|
38
|
+
* - `queue`: the columns to render (column 0 = root, then each matched
|
|
39
|
+
* node's children column).
|
|
40
|
+
* - `path`: the highlight breadcrumb shaped as `{ key: uid, label }`, so it
|
|
41
|
+
* aligns with `expandedPath[level].key === uid` in the node view.
|
|
42
|
+
*
|
|
43
|
+
* Stops safely at the last valid segment if the value path does not exist in
|
|
44
|
+
* the data source.
|
|
45
|
+
*
|
|
46
|
+
* @param arr - The selected path. In `multiple` mode the value is an array of
|
|
47
|
+
* paths; the first path is used to drive which columns get expanded.
|
|
12
48
|
* @param data - The flattened options data
|
|
13
49
|
* @param options - Optional configuration
|
|
14
|
-
* @returns A tuple of [queue, path]
|
|
50
|
+
* @returns A tuple of `[queue, path]`
|
|
15
51
|
*/
|
|
16
|
-
export declare const changeToView: (arr: Array<string | number
|
|
17
|
-
needNext?: boolean | undefined;
|
|
52
|
+
export declare const changeToView: (arr: Array<string | number> | Array<Array<string | number>>, data: Array<FlattenOption>, options?: {
|
|
18
53
|
multiple?: boolean | undefined;
|
|
19
|
-
} | undefined) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
54
|
+
} | undefined) => [FlattenOption[][], Array<{
|
|
55
|
+
key: string;
|
|
56
|
+
label: string;
|
|
57
|
+
}>];
|
|
23
58
|
/**
|
|
24
|
-
* Format a path
|
|
59
|
+
* Format a value path into a key string. Alias of `pathToUid` so all path→key
|
|
60
|
+
* conversions share one collision-safe format.
|
|
25
61
|
* @param val - The path array
|
|
26
|
-
* @returns A string key joined by '-'
|
|
27
62
|
*/
|
|
28
63
|
export declare const formatKey: (val: Array<string | number>) => string;
|
|
29
64
|
/**
|
|
@@ -37,13 +72,22 @@ export declare const isSamePrefixPath: (prefix: Array<unknown>, target: Array<un
|
|
|
37
72
|
* Determine if a node is fully selected or half selected (indeterminate)
|
|
38
73
|
* @param value - The selected value paths
|
|
39
74
|
* @param item - The flatten option node to check
|
|
75
|
+
* @param children - The node's direct flattened children (derive via `getChildren`)
|
|
40
76
|
* @returns A tuple [checkedAll, indeterminate]
|
|
41
77
|
*/
|
|
42
|
-
export declare function isHalfChecked(value: Array<Array<string | number>>, item: FlattenOption): boolean[];
|
|
78
|
+
export declare function isHalfChecked(value: Array<Array<string | number>>, item: FlattenOption, children: FlattenOption[]): boolean[];
|
|
43
79
|
/**
|
|
44
|
-
* Flatten a tree structure into an array for easier searching and traversal
|
|
80
|
+
* Flatten a tree structure into an array for easier searching and traversal.
|
|
81
|
+
*
|
|
82
|
+
* The flattened nodes intentionally do NOT carry a `children` field — use
|
|
83
|
+
* `getChildren(data, uid)` to read a node's children. `uid`/`pid` are built
|
|
84
|
+
* via `pathToUid` (collision-safe). Includes a depth cap and a cycle guard so
|
|
85
|
+
* malformed input (very deep or self-referencing trees) cannot overflow the
|
|
86
|
+
* stack.
|
|
87
|
+
*
|
|
45
88
|
* @param tree - The tree data to flatten
|
|
46
89
|
* @param fieldNames - Custom field names for label, value, and children
|
|
90
|
+
* @param maxDepth - Maximum nesting depth (default 100)
|
|
47
91
|
* @returns An array of flattened options with additional metadata
|
|
48
92
|
*/
|
|
49
|
-
export declare const flattenOptions: (tree: Array<Record<string, unknown>>, fieldNames
|
|
93
|
+
export declare const flattenOptions: (tree: Array<Record<string, unknown>>, fieldNames?: FieldNames, maxDepth?: number) => FlattenOption[];
|