@hsu-react/ui 0.0.8 → 0.0.10
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/es/components/Chart/Bar/index.d.ts +5 -1
- package/es/components/Chart/Bar/index.js +84 -9
- package/es/components/Chart/Line/index.d.ts +5 -1
- package/es/components/Chart/Line/index.js +84 -9
- package/es/components/Chart/_utils/autoSmooth.d.ts +2 -0
- package/es/components/Chart/_utils/autoSmooth.js +12 -2
- package/es/components/Chart/_utils/cartesian.d.ts +11 -0
- package/es/components/Chart/_utils/cartesian.js +19 -0
- package/es/components/Chart/chartUtils/chartTooltipFormatter.d.ts +2 -0
- package/es/components/Chart/chartUtils/chartTooltipFormatter.js +13 -3
- package/es/components/Chart/chartUtils/index.d.ts +5 -2
- package/es/components/Chart/chartUtils/index.js +3 -1
- package/es/components/Chart/chartUtils/useDataZoomWindow.d.ts +19 -0
- package/es/components/Chart/chartUtils/useDataZoomWindow.js +37 -0
- package/es/components/Chart/chartUtils/useLegendSelection.d.ts +14 -0
- package/es/components/Chart/chartUtils/useLegendSelection.js +35 -0
- package/es/components/FormItem/ItemContainer/index.d.ts +2 -0
- package/es/components/FormItem/ItemContainer/index.js +4 -15
- package/es/components/Modal/index.module.scss +1 -0
- package/es/components/Panel/ListPanel/ListModalPanel/index.js +33 -5
- package/es/components/Panel/ListPanel/ListModalPanel/index.module.scss +17 -2
- package/es/components/Panel/ListPanel/index.module.scss +11 -12
- package/es/components/Search/{_components → SearchAdvanced/_components}/AdvancedFiltersDrawer/index.d.ts +3 -3
- package/es/components/Search/{_components → SearchAdvanced/_components}/AdvancedFiltersDrawer/index.js +3 -3
- package/es/components/Search/SearchAdvanced/index.js +26 -148
- package/es/components/Search/SearchCard/index.js +1 -1
- package/es/components/Search/{_components → SearchCollapsible/_components}/CollapseToggle/index.js +2 -2
- package/es/components/Search/SearchCollapsible/index.js +17 -138
- package/es/components/Search/SearchWithFilter/index.js +4 -143
- package/es/components/Search/SearchWithMore/index.js +11 -142
- package/es/components/Search/_components/FilterDropdown/index.js +5 -6
- package/es/components/Search/_components/SearchBase/index.d.ts +32 -0
- package/es/components/Search/_components/SearchBase/index.js +185 -0
- package/es/components/Search/_hooks/useSearchCommon.js +5 -11
- package/es/components/Search/_hooks/useSearchExpand.js +4 -13
- package/es/components/Search/_utils/calculateButtonGroupAndColumnWidth.js +3 -10
- package/es/components/Search/_utils/calculateVisibleItems.js +4 -5
- package/es/components/Search/_utils/index.d.ts +2 -0
- package/es/components/Search/_utils/index.js +3 -1
- package/es/components/Search/_utils/measureButtonGroupWidth.d.ts +6 -0
- package/es/components/Search/_utils/measureButtonGroupWidth.js +18 -0
- package/es/components/Search/_utils/shouldDisplayExtraItem.d.ts +11 -0
- package/es/components/Search/_utils/shouldDisplayExtraItem.js +13 -0
- package/es/components/Search/index.d.ts +4 -0
- package/es/components/Search/index.js +6 -133
- package/es/components/Table/_hooks/useTableColumns.js +11 -0
- package/lib/components/Chart/Bar/index.d.ts +5 -1
- package/lib/components/Chart/Bar/index.js +68 -4
- package/lib/components/Chart/Line/index.d.ts +5 -1
- package/lib/components/Chart/Line/index.js +68 -4
- package/lib/components/Chart/_utils/autoSmooth.d.ts +2 -0
- package/lib/components/Chart/_utils/autoSmooth.js +11 -1
- package/lib/components/Chart/_utils/cartesian.d.ts +11 -0
- package/lib/components/Chart/_utils/cartesian.js +21 -1
- package/lib/components/Chart/chartUtils/chartTooltipFormatter.d.ts +2 -0
- package/lib/components/Chart/chartUtils/chartTooltipFormatter.js +5 -3
- package/lib/components/Chart/chartUtils/index.d.ts +5 -2
- package/lib/components/Chart/chartUtils/index.js +14 -0
- package/lib/components/Chart/chartUtils/useDataZoomWindow.d.ts +19 -0
- package/lib/components/Chart/chartUtils/useDataZoomWindow.js +31 -0
- package/lib/components/Chart/chartUtils/useLegendSelection.d.ts +14 -0
- package/lib/components/Chart/chartUtils/useLegendSelection.js +26 -0
- package/lib/components/FormItem/ItemContainer/index.d.ts +2 -0
- package/lib/components/FormItem/ItemContainer/index.js +2 -5
- package/lib/components/Modal/index.module.scss +1 -0
- package/lib/components/Panel/ListPanel/ListModalPanel/index.js +21 -2
- package/lib/components/Panel/ListPanel/ListModalPanel/index.module.scss +17 -2
- package/lib/components/Panel/ListPanel/index.module.scss +11 -12
- package/lib/components/Search/{_components → SearchAdvanced/_components}/AdvancedFiltersDrawer/index.d.ts +3 -3
- package/lib/components/Search/{_components → SearchAdvanced/_components}/AdvancedFiltersDrawer/index.js +3 -3
- package/lib/components/Search/SearchAdvanced/index.js +19 -134
- package/lib/components/Search/SearchCard/index.js +1 -1
- package/lib/components/Search/{_components → SearchCollapsible/_components}/CollapseToggle/index.js +2 -2
- package/lib/components/Search/SearchCollapsible/index.js +12 -124
- package/lib/components/Search/SearchWithFilter/index.js +5 -129
- package/lib/components/Search/SearchWithMore/index.js +7 -126
- package/lib/components/Search/_components/FilterDropdown/index.js +5 -6
- package/lib/components/Search/_components/SearchBase/index.d.ts +32 -0
- package/lib/components/Search/_components/SearchBase/index.js +169 -0
- package/lib/components/Search/_hooks/useSearchCommon.js +4 -6
- package/lib/components/Search/_hooks/useSearchExpand.js +2 -13
- package/lib/components/Search/_utils/calculateButtonGroupAndColumnWidth.js +2 -10
- package/lib/components/Search/_utils/calculateVisibleItems.js +3 -5
- package/lib/components/Search/_utils/index.d.ts +2 -0
- package/lib/components/Search/_utils/index.js +15 -1
- package/lib/components/Search/_utils/measureButtonGroupWidth.d.ts +6 -0
- package/lib/components/Search/_utils/measureButtonGroupWidth.js +24 -0
- package/lib/components/Search/_utils/shouldDisplayExtraItem.d.ts +11 -0
- package/lib/components/Search/_utils/shouldDisplayExtraItem.js +19 -0
- package/lib/components/Search/index.d.ts +4 -0
- package/lib/components/Search/index.js +8 -119
- package/lib/components/Table/_hooks/useTableColumns.js +11 -0
- package/package.json +1 -1
- package/src/components/Chart/Bar/index.tsx +132 -2
- package/src/components/Chart/Line/index.tsx +132 -2
- package/src/components/Chart/_utils/autoSmooth.ts +181 -164
- package/src/components/Chart/_utils/cartesian.ts +28 -0
- package/src/components/Chart/chartUtils/chartTooltipFormatter.ts +11 -2
- package/src/components/Chart/chartUtils/index.ts +53 -37
- package/src/components/Chart/chartUtils/useDataZoomWindow.ts +61 -0
- package/src/components/Chart/chartUtils/useLegendSelection.ts +35 -0
- package/src/components/FormItem/ItemContainer/index.tsx +4 -7
- package/src/components/Modal/index.module.scss +1 -0
- package/src/components/Panel/ListPanel/ListModalPanel/index.module.scss +17 -2
- package/src/components/Panel/ListPanel/ListModalPanel/index.tsx +261 -233
- package/src/components/Panel/ListPanel/index.module.scss +11 -12
- package/src/components/Search/{_components → SearchAdvanced/_components}/AdvancedFiltersDrawer/index.tsx +6 -6
- package/src/components/Search/SearchAdvanced/index.tsx +25 -164
- package/src/components/Search/SearchCard/index.tsx +1 -1
- package/src/components/Search/{_components → SearchCollapsible/_components}/CollapseToggle/index.tsx +2 -2
- package/src/components/Search/SearchCollapsible/index.tsx +13 -162
- package/src/components/Search/SearchWithFilter/index.tsx +2 -164
- package/src/components/Search/SearchWithMore/index.tsx +9 -161
- package/src/components/Search/_components/FilterDropdown/index.tsx +5 -6
- package/src/components/Search/_components/SearchBase/index.tsx +224 -0
- package/src/components/Search/_hooks/useSearchCommon.ts +10 -13
- package/src/components/Search/_hooks/useSearchExpand.ts +3 -13
- package/src/components/Search/_utils/calculateButtonGroupAndColumnWidth.ts +2 -10
- package/src/components/Search/_utils/calculateVisibleItems.ts +10 -11
- package/src/components/Search/_utils/index.ts +2 -0
- package/src/components/Search/_utils/measureButtonGroupWidth.ts +23 -0
- package/src/components/Search/_utils/shouldDisplayExtraItem.ts +23 -0
- package/src/components/Search/index.tsx +7 -153
- package/src/components/Table/_hooks/useTableColumns.tsx +17 -0
- /package/es/components/Search/{_components → SearchCollapsible/_components}/CollapseToggle/index.d.ts +0 -0
- /package/lib/components/Search/{_components → SearchCollapsible/_components}/CollapseToggle/index.d.ts +0 -0
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
|
|
88
88
|
width: 100%;
|
|
89
89
|
min-height: 0px;
|
|
90
|
-
padding:
|
|
90
|
+
padding: 10px;
|
|
91
91
|
|
|
92
92
|
background: var(--cf-surface);
|
|
93
93
|
|
|
@@ -102,23 +102,22 @@
|
|
|
102
102
|
align-items: center;
|
|
103
103
|
justify-content: space-between;
|
|
104
104
|
column-gap: 10px;
|
|
105
|
+
}
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
// 页面级页签:无底色容器,页签拆成独立圆角块、块间留空;
|
|
108
|
+
// margin/radius 需 !important 压过 TabBar 内部的连体分段样式(负 margin + 首尾切角)
|
|
109
|
+
.headerTabBar {
|
|
110
|
+
column-gap: 4px;
|
|
107
111
|
|
|
108
|
-
|
|
112
|
+
> div {
|
|
113
|
+
margin-left: 0 !important;
|
|
114
|
+
border-radius: 6px !important;
|
|
109
115
|
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
background: var(--cf-surface);
|
|
117
|
+
}
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
&.hasHeaderTabBar {
|
|
115
|
-
.search {
|
|
116
|
-
padding: 10px;
|
|
117
|
-
margin-top: -10px;
|
|
118
|
-
|
|
119
|
-
border-radius: 0px 0px 8px 8px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
121
|
&:not(:has(.search)) {
|
|
123
122
|
.headerTabBarContainer {
|
|
124
123
|
border-radius: 8px;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { FormInstance } from "antd";
|
|
3
|
-
import { FormItemProps } from "
|
|
4
|
-
import { DrawerFormProps } from "
|
|
5
|
-
import type useLabelWidth from "
|
|
3
|
+
import { FormItemProps } from "../../../../FormItem";
|
|
4
|
+
import { DrawerFormProps } from "../../../../Form/DrawerForm";
|
|
5
|
+
import type useLabelWidth from "../../../../../hooks/useLabelWidth";
|
|
6
6
|
interface AdvancedFiltersDrawerProps {
|
|
7
7
|
expand: boolean;
|
|
8
8
|
setExpand: (expand: boolean) => void;
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.AdvancedFiltersDrawer = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _Form = _interopRequireDefault(require("
|
|
8
|
+
var _Form = _interopRequireDefault(require("../../../../Form"));
|
|
9
9
|
var _icons = require("@ant-design/icons");
|
|
10
|
-
var _Icon = _interopRequireDefault(require("
|
|
11
|
-
var _indexModule = _interopRequireDefault(require("
|
|
10
|
+
var _Icon = _interopRequireDefault(require("../../../../Icon"));
|
|
11
|
+
var _indexModule = _interopRequireDefault(require("../../../index.module.scss"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
const AdvancedFiltersDrawer = ({
|
|
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
8
|
-
var _antd = require("antd");
|
|
9
|
-
var _FormItem = _interopRequireDefault(require("../../FormItem"));
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
9
|
var _indexModule = _interopRequireDefault(require("../index.module.scss"));
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var _SearchButtons = require("../_components/SearchButtons");
|
|
15
|
-
var _FilterDropdown = require("../_components/FilterDropdown");
|
|
16
|
-
var _ExpandButton = require("../_components/ExpandButton");
|
|
17
|
-
var _AdvancedFiltersDrawer = require("../_components/AdvancedFiltersDrawer");
|
|
10
|
+
var _SearchBase = _interopRequireDefault(require("../_components/SearchBase"));
|
|
11
|
+
var _AdvancedFiltersDrawer = require("./_components/AdvancedFiltersDrawer");
|
|
18
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
14
|
/**
|
|
23
15
|
* 高级筛选模式的 Search 组件
|
|
24
16
|
* - 不显示标签(label)
|
|
@@ -27,136 +19,29 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
27
19
|
*/
|
|
28
20
|
const SearchAdvanced = props => {
|
|
29
21
|
const {
|
|
30
|
-
searchItems = [],
|
|
31
|
-
moreSearchItems = [],
|
|
32
22
|
className,
|
|
33
|
-
onSearch,
|
|
34
|
-
onReset,
|
|
35
|
-
externalForm,
|
|
36
|
-
hasPermi,
|
|
37
|
-
columnNum = 4,
|
|
38
|
-
beforeButtonGroup,
|
|
39
|
-
affterButtonGroup,
|
|
40
|
-
searchData,
|
|
41
23
|
advancedFiltersProps,
|
|
42
24
|
setFilter,
|
|
43
25
|
minLabelWidth,
|
|
44
|
-
|
|
45
|
-
onExpandChange,
|
|
46
|
-
autoAdaptWidth = true,
|
|
47
|
-
baseWidth,
|
|
48
|
-
onValuesChange,
|
|
49
|
-
searchDisabled = false,
|
|
50
|
-
showAllSearchItems = false,
|
|
51
|
-
searchText,
|
|
52
|
-
resetText,
|
|
53
|
-
onFilterChange,
|
|
54
|
-
columnOffsetWidth = 0
|
|
26
|
+
...rest
|
|
55
27
|
} = props;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
toggleExpand,
|
|
69
|
-
showExpandButton,
|
|
70
|
-
onSearchClick,
|
|
71
|
-
onResetClick,
|
|
72
|
-
shouldRender,
|
|
73
|
-
permitted
|
|
74
|
-
} = (0, _hooks.useSearchCommon)({
|
|
75
|
-
form,
|
|
76
|
-
searchItems,
|
|
77
|
-
moreSearchItems,
|
|
78
|
-
searchData,
|
|
79
|
-
hasPermi,
|
|
80
|
-
beforeButtonGroup,
|
|
81
|
-
affterButtonGroup,
|
|
82
|
-
columnNum,
|
|
83
|
-
autoAdaptWidth,
|
|
84
|
-
defaultExpanded,
|
|
85
|
-
onExpandChange,
|
|
86
|
-
showAllSearchItems,
|
|
87
|
-
minLabelWidth,
|
|
88
|
-
baseWidth,
|
|
89
|
-
onSearch,
|
|
90
|
-
onReset,
|
|
91
|
-
columnOffsetWidth
|
|
92
|
-
});
|
|
93
|
-
if (!shouldRender) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
97
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
98
|
-
ref: containerRef,
|
|
99
|
-
className: (0, _classnames.default)(_indexModule.default.Search, className, {
|
|
100
|
-
[_indexModule.default.advancedFilters]: true
|
|
101
|
-
}),
|
|
102
|
-
style: {
|
|
103
|
-
"--column-number": totalColumnNum,
|
|
104
|
-
"--column-offset-width": `${columnOffsetWidth}px`
|
|
105
|
-
},
|
|
106
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
107
|
-
className: (0, _classnames.default)(_indexModule.default.searchOption, _indexModule.default[expand.toString()]),
|
|
108
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Form, {
|
|
109
|
-
form: form,
|
|
110
|
-
className: (0, _classnames.default)(_indexModule.default.option, cls),
|
|
111
|
-
onValuesChange: onValuesChange,
|
|
112
|
-
children: [permitted && currentSearchItems?.map(item => {
|
|
113
|
-
return /*#__PURE__*/(0, _react.createElement)(_FormItem.default, {
|
|
114
|
-
...item,
|
|
115
|
-
key: item.name,
|
|
116
|
-
className: (0, _classnames.default)(_indexModule.default.item, item.className, {
|
|
117
|
-
[_indexModule.default.unFill]: item.width !== undefined
|
|
118
|
-
}),
|
|
119
|
-
label: undefined,
|
|
120
|
-
labelWidth: undefined
|
|
121
|
-
});
|
|
122
|
-
}), (beforeButtonGroup?.length || affterButtonGroup?.length || permitted) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.ButtonGroup, {
|
|
123
|
-
beforeButtonGroup: beforeButtonGroup,
|
|
124
|
-
affterButtonGroup: affterButtonGroup,
|
|
125
|
-
expandButton: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandButton.ExpandButton, {
|
|
126
|
-
expand: expand,
|
|
127
|
-
toggleExpand: toggleExpand,
|
|
128
|
-
advancedFilters: true,
|
|
129
|
-
showExpandButton: showExpandButton,
|
|
130
|
-
showAllSearchItems: showAllSearchItems || !!moreSearchItems?.length
|
|
131
|
-
}),
|
|
132
|
-
permitted: permitted,
|
|
133
|
-
ref: buttonGroupRef,
|
|
134
|
-
children: [currentSearchItems.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchButtons.SearchButtons, {
|
|
135
|
-
onSearch: onSearchClick,
|
|
136
|
-
onReset: onResetClick,
|
|
137
|
-
searchDisabled: searchDisabled,
|
|
138
|
-
searchText: searchText,
|
|
139
|
-
resetText: resetText
|
|
140
|
-
}), setFilter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FilterDropdown.FilterDropdown, {
|
|
141
|
-
searchItems: processedSearchItems,
|
|
142
|
-
originalSearchItems: searchItems,
|
|
143
|
-
setSearchItems: setSearchItems,
|
|
144
|
-
onFilterChange: onFilterChange
|
|
145
|
-
})]
|
|
146
|
-
})]
|
|
147
|
-
})
|
|
148
|
-
})
|
|
149
|
-
}), permitted && setExpand && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AdvancedFiltersDrawer.AdvancedFiltersDrawer, {
|
|
150
|
-
expand: expand,
|
|
151
|
-
setExpand: setExpand,
|
|
152
|
-
searchItems: processedSearchItems,
|
|
153
|
-
form: form,
|
|
154
|
-
getLabelWidth: getLabelWidth,
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchBase.default, {
|
|
29
|
+
...rest,
|
|
30
|
+
minLabelWidth: minLabelWidth,
|
|
31
|
+
advancedFilters: true,
|
|
32
|
+
showFilter: !!setFilter,
|
|
33
|
+
className: (0, _classnames.default)(className, _indexModule.default.advancedFilters),
|
|
34
|
+
renderOutside: ctx => ctx.setExpand && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AdvancedFiltersDrawer.AdvancedFiltersDrawer, {
|
|
35
|
+
expand: ctx.expand,
|
|
36
|
+
setExpand: ctx.setExpand,
|
|
37
|
+
searchItems: ctx.processedSearchItems,
|
|
38
|
+
form: ctx.form,
|
|
39
|
+
getLabelWidth: ctx.getLabelWidth,
|
|
155
40
|
minLabelWidth: minLabelWidth,
|
|
156
|
-
onSearchClick: onSearchClick,
|
|
157
|
-
onResetClick: onResetClick,
|
|
41
|
+
onSearchClick: ctx.onSearchClick,
|
|
42
|
+
onResetClick: ctx.onResetClick,
|
|
158
43
|
advancedFiltersProps: advancedFiltersProps
|
|
159
|
-
})
|
|
44
|
+
})
|
|
160
45
|
});
|
|
161
46
|
};
|
|
162
47
|
var _default = exports.default = SearchAdvanced;
|
|
@@ -71,7 +71,7 @@ const SearchCard = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
71
71
|
}),
|
|
72
72
|
style: {
|
|
73
73
|
"--searchCard-column-gap": `${gap}px`,
|
|
74
|
-
"
|
|
74
|
+
"--searchCard-padding-left-right": `${padding}px`
|
|
75
75
|
},
|
|
76
76
|
children: [showSearchBox && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchBox.SearchBox, {
|
|
77
77
|
value: internalValue,
|
package/lib/components/Search/{_components → SearchCollapsible/_components}/CollapseToggle/index.js
RENAMED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CollapseToggle = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _Icon = _interopRequireDefault(require("
|
|
8
|
+
var _Icon = _interopRequireDefault(require("../../../../Icon"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _indexModule = _interopRequireDefault(require("
|
|
10
|
+
var _indexModule = _interopRequireDefault(require("../../../index.module.scss"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
const CollapseToggle = ({
|
|
@@ -5,16 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _antd = require("antd");
|
|
9
|
-
var _FormItem = _interopRequireDefault(require("../../FormItem"));
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
9
|
var _indexModule = _interopRequireDefault(require("../index.module.scss"));
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var _SearchButtons = require("../_components/SearchButtons");
|
|
15
|
-
var _FilterDropdown = require("../_components/FilterDropdown");
|
|
16
|
-
var _ExpandButton = require("../_components/ExpandButton");
|
|
17
|
-
var _CollapseToggle = require("../_components/CollapseToggle");
|
|
10
|
+
var _SearchBase = _interopRequireDefault(require("../_components/SearchBase"));
|
|
11
|
+
var _CollapseToggle = require("./_components/CollapseToggle");
|
|
18
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -27,70 +21,15 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
27
21
|
*/
|
|
28
22
|
const SearchCollapsible = props => {
|
|
29
23
|
const {
|
|
30
|
-
searchItems = [],
|
|
31
|
-
moreSearchItems = [],
|
|
32
24
|
className,
|
|
33
|
-
onSearch,
|
|
34
|
-
onReset,
|
|
35
|
-
externalForm,
|
|
36
|
-
hasPermi,
|
|
37
|
-
columnNum = 4,
|
|
38
|
-
beforeButtonGroup,
|
|
39
|
-
affterButtonGroup,
|
|
40
|
-
searchData,
|
|
41
|
-
setFilter,
|
|
42
|
-
minLabelWidth,
|
|
43
25
|
defaultExpanded = false,
|
|
44
26
|
onCollapseToggle,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
baseWidth,
|
|
48
|
-
onValuesChange,
|
|
49
|
-
searchDisabled = false,
|
|
50
|
-
showAllSearchItems = false,
|
|
51
|
-
searchText,
|
|
52
|
-
resetText,
|
|
53
|
-
onFilterChange,
|
|
54
|
-
columnOffsetWidth = 0
|
|
27
|
+
setFilter,
|
|
28
|
+
...rest
|
|
55
29
|
} = props;
|
|
56
|
-
|
|
30
|
+
|
|
57
31
|
// collapse 的语义是反的,所以需要取反 defaultExpanded
|
|
58
32
|
const [collapse, setCollapse] = (0, _react.useState)(!defaultExpanded);
|
|
59
|
-
const {
|
|
60
|
-
containerRef,
|
|
61
|
-
buttonGroupRef,
|
|
62
|
-
cls,
|
|
63
|
-
getLabelWidth,
|
|
64
|
-
processedSearchItems,
|
|
65
|
-
setSearchItems,
|
|
66
|
-
currentSearchItems,
|
|
67
|
-
totalColumnNum,
|
|
68
|
-
expand,
|
|
69
|
-
toggleExpand,
|
|
70
|
-
showExpandButton,
|
|
71
|
-
onSearchClick,
|
|
72
|
-
onResetClick,
|
|
73
|
-
shouldRender,
|
|
74
|
-
permitted
|
|
75
|
-
} = (0, _hooks.useSearchCommon)({
|
|
76
|
-
form,
|
|
77
|
-
searchItems,
|
|
78
|
-
moreSearchItems,
|
|
79
|
-
searchData,
|
|
80
|
-
hasPermi,
|
|
81
|
-
beforeButtonGroup,
|
|
82
|
-
affterButtonGroup,
|
|
83
|
-
columnNum,
|
|
84
|
-
autoAdaptWidth,
|
|
85
|
-
defaultExpanded,
|
|
86
|
-
onExpandChange,
|
|
87
|
-
showAllSearchItems,
|
|
88
|
-
minLabelWidth,
|
|
89
|
-
baseWidth,
|
|
90
|
-
onSearch,
|
|
91
|
-
onReset,
|
|
92
|
-
columnOffsetWidth
|
|
93
|
-
});
|
|
94
33
|
|
|
95
34
|
// 处理折叠切换
|
|
96
35
|
const handleCollapseToggle = (0, _react.useCallback)(() => {
|
|
@@ -100,68 +39,17 @@ const SearchCollapsible = props => {
|
|
|
100
39
|
return newCollapse;
|
|
101
40
|
});
|
|
102
41
|
}, [onCollapseToggle]);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
className: (0, _classnames.default)(_indexModule.default.Search, className, {
|
|
109
|
-
[_indexModule.default.collapseExpand]: true,
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchBase.default, {
|
|
43
|
+
...rest,
|
|
44
|
+
defaultExpanded: defaultExpanded,
|
|
45
|
+
showFilter: !!setFilter,
|
|
46
|
+
className: (0, _classnames.default)(className, _indexModule.default.collapseExpand, {
|
|
110
47
|
[_indexModule.default.collapse]: collapse
|
|
111
48
|
}),
|
|
112
|
-
|
|
113
|
-
"--column-number": totalColumnNum,
|
|
114
|
-
"--column-offset-width": `${columnOffsetWidth}px`
|
|
115
|
-
},
|
|
116
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
117
|
-
className: (0, _classnames.default)(_indexModule.default.searchOption, _indexModule.default[expand.toString()]),
|
|
118
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Form, {
|
|
119
|
-
form: form,
|
|
120
|
-
className: (0, _classnames.default)(_indexModule.default.option, cls),
|
|
121
|
-
onValuesChange: onValuesChange,
|
|
122
|
-
children: [permitted && currentSearchItems?.map((item, idx) => {
|
|
123
|
-
// 计算同一列的项(用于计算标签宽度)
|
|
124
|
-
const visibleCurrentItems = currentSearchItems.filter(i => i.visible !== false);
|
|
125
|
-
const columnIndex = idx % totalColumnNum;
|
|
126
|
-
const sameColumnItems = visibleCurrentItems.filter((_, _idx) => _idx % totalColumnNum === columnIndex);
|
|
127
|
-
return /*#__PURE__*/(0, _react.createElement)(_FormItem.default, {
|
|
128
|
-
...item,
|
|
129
|
-
key: item.name,
|
|
130
|
-
className: (0, _classnames.default)(_indexModule.default.item, item.className, {
|
|
131
|
-
[_indexModule.default.unFill]: item.width !== undefined
|
|
132
|
-
}),
|
|
133
|
-
labelWidth: item.width !== undefined ? undefined : getLabelWidth(sameColumnItems, undefined, minLabelWidth)
|
|
134
|
-
});
|
|
135
|
-
}), (beforeButtonGroup?.length || affterButtonGroup?.length || permitted) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.ButtonGroup, {
|
|
136
|
-
beforeButtonGroup: beforeButtonGroup,
|
|
137
|
-
affterButtonGroup: affterButtonGroup,
|
|
138
|
-
expandButton: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandButton.ExpandButton, {
|
|
139
|
-
expand: expand,
|
|
140
|
-
toggleExpand: toggleExpand,
|
|
141
|
-
advancedFilters: false,
|
|
142
|
-
showExpandButton: showExpandButton,
|
|
143
|
-
showAllSearchItems: showAllSearchItems || !!moreSearchItems?.length
|
|
144
|
-
}),
|
|
145
|
-
permitted: permitted,
|
|
146
|
-
ref: buttonGroupRef,
|
|
147
|
-
children: [currentSearchItems.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchButtons.SearchButtons, {
|
|
148
|
-
onSearch: onSearchClick,
|
|
149
|
-
onReset: onResetClick,
|
|
150
|
-
searchDisabled: searchDisabled,
|
|
151
|
-
searchText: searchText,
|
|
152
|
-
resetText: resetText
|
|
153
|
-
}), setFilter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FilterDropdown.FilterDropdown, {
|
|
154
|
-
searchItems: processedSearchItems,
|
|
155
|
-
originalSearchItems: searchItems,
|
|
156
|
-
setSearchItems: setSearchItems,
|
|
157
|
-
onFilterChange: onFilterChange
|
|
158
|
-
})]
|
|
159
|
-
})]
|
|
160
|
-
})
|
|
161
|
-
}), permitted && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapseToggle.CollapseToggle, {
|
|
49
|
+
afterForm: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapseToggle.CollapseToggle, {
|
|
162
50
|
collapse: collapse,
|
|
163
51
|
onToggle: handleCollapseToggle
|
|
164
|
-
})
|
|
52
|
+
})
|
|
165
53
|
});
|
|
166
54
|
};
|
|
167
55
|
var _default = exports.default = SearchCollapsible;
|
|
@@ -4,20 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
8
|
-
var
|
|
9
|
-
var _FormItem = _interopRequireDefault(require("../../FormItem"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _indexModule = _interopRequireDefault(require("../index.module.scss"));
|
|
12
|
-
var _hooks = require("../_hooks");
|
|
13
|
-
var _ButtonGroup = require("../_components/ButtonGroup");
|
|
14
|
-
var _SearchButtons = require("../_components/SearchButtons");
|
|
15
|
-
var _FilterDropdown = require("../_components/FilterDropdown");
|
|
16
|
-
var _ExpandButton = require("../_components/ExpandButton");
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _SearchBase = _interopRequireDefault(require("../_components/SearchBase"));
|
|
17
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
11
|
/**
|
|
22
12
|
* 带筛选器设置的 Search 组件
|
|
23
13
|
* - 提供下拉菜单,允许用户动态选择显示哪些搜索项
|
|
@@ -25,123 +15,9 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
25
15
|
* - 提供更灵活的搜索体验
|
|
26
16
|
*/
|
|
27
17
|
const SearchWithFilter = props => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className,
|
|
32
|
-
onSearch,
|
|
33
|
-
onReset,
|
|
34
|
-
externalForm,
|
|
35
|
-
hasPermi,
|
|
36
|
-
columnNum = 4,
|
|
37
|
-
beforeButtonGroup,
|
|
38
|
-
affterButtonGroup,
|
|
39
|
-
searchData,
|
|
40
|
-
minLabelWidth,
|
|
41
|
-
defaultExpanded = false,
|
|
42
|
-
onExpandChange,
|
|
43
|
-
autoAdaptWidth = true,
|
|
44
|
-
baseWidth,
|
|
45
|
-
onValuesChange,
|
|
46
|
-
searchDisabled = false,
|
|
47
|
-
showAllSearchItems = false,
|
|
48
|
-
searchText,
|
|
49
|
-
resetText,
|
|
50
|
-
onFilterChange,
|
|
51
|
-
columnOffsetWidth = 0
|
|
52
|
-
} = props;
|
|
53
|
-
const [form] = _antd.Form.useForm(externalForm);
|
|
54
|
-
const {
|
|
55
|
-
containerRef,
|
|
56
|
-
buttonGroupRef,
|
|
57
|
-
cls,
|
|
58
|
-
getLabelWidth,
|
|
59
|
-
processedSearchItems,
|
|
60
|
-
setSearchItems,
|
|
61
|
-
currentSearchItems,
|
|
62
|
-
totalColumnNum,
|
|
63
|
-
expand,
|
|
64
|
-
toggleExpand,
|
|
65
|
-
showExpandButton,
|
|
66
|
-
onSearchClick,
|
|
67
|
-
onResetClick,
|
|
68
|
-
shouldRender,
|
|
69
|
-
permitted
|
|
70
|
-
} = (0, _hooks.useSearchCommon)({
|
|
71
|
-
form,
|
|
72
|
-
searchItems,
|
|
73
|
-
moreSearchItems,
|
|
74
|
-
searchData,
|
|
75
|
-
hasPermi,
|
|
76
|
-
beforeButtonGroup,
|
|
77
|
-
affterButtonGroup,
|
|
78
|
-
columnNum,
|
|
79
|
-
autoAdaptWidth,
|
|
80
|
-
defaultExpanded,
|
|
81
|
-
onExpandChange,
|
|
82
|
-
showAllSearchItems,
|
|
83
|
-
minLabelWidth,
|
|
84
|
-
baseWidth,
|
|
85
|
-
onSearch,
|
|
86
|
-
onReset,
|
|
87
|
-
columnOffsetWidth
|
|
88
|
-
});
|
|
89
|
-
if (!shouldRender) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
93
|
-
ref: containerRef,
|
|
94
|
-
className: (0, _classnames.default)(_indexModule.default.Search, className),
|
|
95
|
-
style: {
|
|
96
|
-
"--column-number": totalColumnNum,
|
|
97
|
-
"--column-offset-width": `${columnOffsetWidth}px`
|
|
98
|
-
},
|
|
99
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
100
|
-
className: (0, _classnames.default)(_indexModule.default.searchOption, _indexModule.default[expand.toString()]),
|
|
101
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Form, {
|
|
102
|
-
form: form,
|
|
103
|
-
className: (0, _classnames.default)(_indexModule.default.option, cls),
|
|
104
|
-
onValuesChange: onValuesChange,
|
|
105
|
-
children: [permitted && currentSearchItems?.map((item, idx) => {
|
|
106
|
-
// 计算同一列的项(用于计算标签宽度)
|
|
107
|
-
const visibleCurrentItems = currentSearchItems.filter(i => i.visible !== false);
|
|
108
|
-
const columnIndex = idx % totalColumnNum;
|
|
109
|
-
const sameColumnItems = visibleCurrentItems.filter((_, _idx) => _idx % totalColumnNum === columnIndex);
|
|
110
|
-
return /*#__PURE__*/(0, _react.createElement)(_FormItem.default, {
|
|
111
|
-
...item,
|
|
112
|
-
key: item.name,
|
|
113
|
-
className: (0, _classnames.default)(_indexModule.default.item, item.className, {
|
|
114
|
-
[_indexModule.default.unFill]: item.width !== undefined
|
|
115
|
-
}),
|
|
116
|
-
labelWidth: item.width !== undefined ? undefined : getLabelWidth(sameColumnItems, undefined, minLabelWidth)
|
|
117
|
-
});
|
|
118
|
-
}), (beforeButtonGroup?.length || affterButtonGroup?.length || permitted) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.ButtonGroup, {
|
|
119
|
-
beforeButtonGroup: beforeButtonGroup,
|
|
120
|
-
affterButtonGroup: affterButtonGroup,
|
|
121
|
-
expandButton: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandButton.ExpandButton, {
|
|
122
|
-
expand: expand,
|
|
123
|
-
toggleExpand: toggleExpand,
|
|
124
|
-
advancedFilters: false,
|
|
125
|
-
showExpandButton: showExpandButton,
|
|
126
|
-
showAllSearchItems: showAllSearchItems || !!moreSearchItems?.length
|
|
127
|
-
}),
|
|
128
|
-
permitted: permitted,
|
|
129
|
-
ref: buttonGroupRef,
|
|
130
|
-
children: [currentSearchItems.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchButtons.SearchButtons, {
|
|
131
|
-
onSearch: onSearchClick,
|
|
132
|
-
onReset: onResetClick,
|
|
133
|
-
searchDisabled: searchDisabled,
|
|
134
|
-
searchText: searchText,
|
|
135
|
-
resetText: resetText
|
|
136
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FilterDropdown.FilterDropdown, {
|
|
137
|
-
searchItems: processedSearchItems,
|
|
138
|
-
originalSearchItems: searchItems,
|
|
139
|
-
setSearchItems: setSearchItems,
|
|
140
|
-
onFilterChange: onFilterChange
|
|
141
|
-
})]
|
|
142
|
-
})]
|
|
143
|
-
})
|
|
144
|
-
})
|
|
18
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchBase.default, {
|
|
19
|
+
...props,
|
|
20
|
+
showFilter: true
|
|
145
21
|
});
|
|
146
22
|
};
|
|
147
23
|
var _default = exports.default = SearchWithFilter;
|