@hw-component/form 1.9.41 → 1.9.43
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/Form/HFormConnect.js +9 -10
- package/es/Form/config.d.ts +2 -5
- package/es/Form/config.js +3 -1
- package/es/Input/InputNumberGroup.js +1 -1
- package/es/Select/TreeSelect.d.ts +2 -2
- package/es/Select/index.js +65 -48
- package/es/Select/modal.d.ts +2 -0
- package/es/Text/index.d.ts +3 -0
- package/es/Text/index.js +13 -0
- package/es/index.css +59 -24
- package/lib/Form/HFormConnect.js +9 -10
- package/lib/Form/config.d.ts +2 -5
- package/lib/Form/config.js +3 -1
- package/lib/Input/InputNumberGroup.js +1 -1
- package/lib/Select/TreeSelect.d.ts +2 -2
- package/lib/Select/index.js +64 -47
- package/lib/Select/modal.d.ts +2 -0
- package/lib/Text/index.d.ts +3 -0
- package/lib/Text/index.js +16 -0
- package/lib/index.css +59 -24
- package/package.json +1 -1
- package/src/components/CheckboxGroup/index.tsx +3 -3
- package/src/components/Form/HFormConnect.tsx +9 -10
- package/src/components/Form/config.ts +2 -0
- package/src/components/Input/InputNumberGroup.tsx +5 -5
- package/src/components/Input/SelectInput.tsx +2 -2
- package/src/components/Input/TrimInput.tsx +3 -3
- package/src/components/Input/index.less +10 -20
- package/src/components/Select/TreeSelect.tsx +2 -2
- package/src/components/Select/index.less +35 -0
- package/src/components/Select/index.tsx +76 -61
- package/src/components/Select/modal.ts +2 -0
- package/src/components/Switch/index.tsx +3 -3
- package/src/components/TDPicker/RangePicker.tsx +2 -2
- package/src/components/Text/index.tsx +6 -0
- package/src/components/TextArea/TrimTextArea.tsx +3 -3
- package/src/components/Upload/index.tsx +4 -4
- package/src/components/styles/index.less +14 -0
- package/src/pages/Form/index.tsx +67 -32
- package/src/pages/Select/index.tsx +1 -0
package/es/Form/HFormConnect.js
CHANGED
|
@@ -37,29 +37,28 @@ var HFormConnect = (function (component) {
|
|
|
37
37
|
form = _useFormContext.form,
|
|
38
38
|
_useFormContext$value = _useFormContext.valueType,
|
|
39
39
|
valueType = _useFormContext$value === void 0 ? "float" : _useFormContext$value;
|
|
40
|
+
var name = props.name;
|
|
41
|
+
var relName = Array.isArray(name) ? name.join(".") : name;
|
|
40
42
|
useEffect(function () {
|
|
41
|
-
|
|
42
|
-
if (!name) {
|
|
43
|
+
if (!relName) {
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
|
-
form === null || form === void 0 || form.addFormat(
|
|
46
|
+
form === null || form === void 0 || form.addFormat(relName, formatMaker(props, format[valueType]));
|
|
46
47
|
}, [valueType, props]);
|
|
47
48
|
var addFormat = function addFormat(aFormat) {
|
|
48
|
-
|
|
49
|
-
if (!name) {
|
|
49
|
+
if (!relName) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
form === null || form === void 0 || form.addFormat(
|
|
52
|
+
form === null || form === void 0 || form.addFormat(relName, formatMaker(props, aFormat[valueType]));
|
|
53
53
|
};
|
|
54
54
|
var addDispatchListener = function addDispatchListener(key, fn) {
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
if (!name) {
|
|
55
|
+
var dispatch = props.dispatch;
|
|
56
|
+
if (!relName) {
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
form === null || form === void 0 || form.addDispatchListener({
|
|
61
60
|
key: key,
|
|
62
|
-
name:
|
|
61
|
+
name: relName,
|
|
63
62
|
dispatch: dispatch
|
|
64
63
|
}, fn);
|
|
65
64
|
};
|
package/es/Form/config.d.ts
CHANGED
|
@@ -35,10 +35,7 @@ declare const componentConfig: {
|
|
|
35
35
|
Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
36
36
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
37
37
|
};
|
|
38
|
-
treeSelect: ({ request,
|
|
39
|
-
|
|
40
|
-
request: any;
|
|
41
|
-
options: any;
|
|
42
|
-
}) => JSX.Element;
|
|
38
|
+
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
39
|
+
text: ({ value }: import("antd").FormItemProps) => JSX.Element;
|
|
43
40
|
};
|
|
44
41
|
export default componentConfig;
|
package/es/Form/config.js
CHANGED
|
@@ -22,6 +22,7 @@ import VerificationCodeInput from '../Input/VerificationCodeInput/index.js';
|
|
|
22
22
|
import TrimInput from '../Input/TrimInput.js';
|
|
23
23
|
import TrimTextArea from '../TextArea/TrimTextArea.js';
|
|
24
24
|
import HInputNumberGroup from '../Input/InputNumberGroup.js';
|
|
25
|
+
import HText from '../Text/index.js';
|
|
25
26
|
|
|
26
27
|
var placeholderConfig = {
|
|
27
28
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea"],
|
|
@@ -50,7 +51,8 @@ var componentConfig = {
|
|
|
50
51
|
trimInput: TrimInput,
|
|
51
52
|
trimTextArea: TrimTextArea,
|
|
52
53
|
inputNumberGroup: HInputNumberGroup,
|
|
53
|
-
treeSelect: HTreeSelect
|
|
54
|
+
treeSelect: HTreeSelect,
|
|
55
|
+
text: HText
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
export { componentConfig as default, placeholderConfig };
|
|
@@ -26,7 +26,7 @@ var Addon = function Addon(_ref) {
|
|
|
26
26
|
var children = _ref.children,
|
|
27
27
|
value = _ref.value,
|
|
28
28
|
onChange = _ref.onChange;
|
|
29
|
-
var addonClassname = useClassName(["hw-
|
|
29
|
+
var addonClassname = useClassName(["hw-addon"]);
|
|
30
30
|
if (!children) {
|
|
31
31
|
return jsx(Fragment, {});
|
|
32
32
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TreeSelectProps } from "antd/lib/tree-select";
|
|
2
2
|
import { PromiseFnResult } from "../modal";
|
|
3
|
-
interface
|
|
3
|
+
export interface HTreeSelectProps extends TreeSelectProps {
|
|
4
4
|
request?: PromiseFnResult;
|
|
5
5
|
onlyCheckChild?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }:
|
|
7
|
+
declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: HTreeSelectProps) => JSX.Element;
|
|
8
8
|
export default _default;
|
package/es/Select/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
2
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
import { createElement } from 'react';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
import { Select } from 'antd';
|
|
7
7
|
import { useFilterOption, useSelectReq } from './hooks/norHooks.js';
|
|
8
8
|
import { useValueChange } from './hooks/changeHooks.js';
|
|
9
9
|
import { defaultModeConfig, defaultSelectConfig } from './defaultConfig.js';
|
|
10
10
|
import Index$1 from './components/DropdownComponent.js';
|
|
11
11
|
import Index$2 from './components/AllSelect.js';
|
|
12
|
-
import { useMatchConfigProps, useChangeOptions } from '../hooks/index.js';
|
|
12
|
+
import { useMatchConfigProps, useChangeOptions, useClassName } from '../hooks/index.js';
|
|
13
13
|
import HFormConnect from '../Form/HFormConnect.js';
|
|
14
14
|
|
|
15
|
-
var _excluded = ["style", "mode", "options", "modeConfig", "value", "onChange", "fieldNames", "request", "manual", "optionLabelProp", "filterProvider", "optionFilterProp", "serviceSearch", "onSearch", "filterOption", "showSearch", "labelInValue", "noMatchItemRender", "allSelect", "addDispatchListener", "addFormat", "dispatch", "isList", "onPopupScroll"],
|
|
15
|
+
var _excluded = ["style", "mode", "options", "modeConfig", "value", "onChange", "fieldNames", "request", "manual", "optionLabelProp", "filterProvider", "optionFilterProp", "serviceSearch", "onSearch", "filterOption", "showSearch", "labelInValue", "noMatchItemRender", "allSelect", "addDispatchListener", "addFormat", "dispatch", "isList", "onPopupScroll", "addonBefore", "addonAfter"],
|
|
16
16
|
_excluded2 = ["value", "label"];
|
|
17
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -49,6 +49,8 @@ var Index = function Index(_ref) {
|
|
|
49
49
|
var dispatch = _ref.dispatch,
|
|
50
50
|
isList = _ref.isList,
|
|
51
51
|
propsOnPopupScroll = _ref.onPopupScroll,
|
|
52
|
+
addonBefore = _ref.addonBefore,
|
|
53
|
+
addonAfter = _ref.addonAfter,
|
|
52
54
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
53
55
|
var _ref2 = (modeConfig === null || modeConfig === void 0 ? void 0 : modeConfig[mode || ""]) || {},
|
|
54
56
|
icon = _ref2.icon,
|
|
@@ -84,6 +86,12 @@ var Index = function Index(_ref) {
|
|
|
84
86
|
options: resultData,
|
|
85
87
|
fieldNames: fieldNames
|
|
86
88
|
});
|
|
89
|
+
var boxClassName = useClassName("hw-select-box");
|
|
90
|
+
var addonBeforeClassName = useClassName("hw-group-addon-before");
|
|
91
|
+
var addonBeforeBoxClassName = useClassName("hw-select-box-addon-before");
|
|
92
|
+
var addonAfterClassName = useClassName("hw-group-addon-after");
|
|
93
|
+
var addonAfterBoxClassName = useClassName("hw-select-box-addon-after");
|
|
94
|
+
var addonClassname = useClassName(["hw-addon"]);
|
|
87
95
|
var _useValueChange = useValueChange({
|
|
88
96
|
labelInValue: labelInValue,
|
|
89
97
|
onChange: onChange,
|
|
@@ -96,53 +104,62 @@ var Index = function Index(_ref) {
|
|
|
96
104
|
val = _useValueChange.val,
|
|
97
105
|
change = _useValueChange.change;
|
|
98
106
|
addDispatchListener === null || addDispatchListener === void 0 || addDispatchListener("reload", reload);
|
|
99
|
-
return
|
|
107
|
+
return jsxs("div", {
|
|
108
|
+
className: "".concat(boxClassName, " ").concat(addonBefore ? addonBeforeBoxClassName : "", " ").concat(addonAfter ? addonAfterBoxClassName : ""),
|
|
100
109
|
style: style,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
children: [addonBefore && jsx("div", {
|
|
111
|
+
className: "".concat(addonClassname, " ").concat(addonBeforeClassName),
|
|
112
|
+
children: addonBefore
|
|
113
|
+
}), jsx(Select, _objectSpread(_objectSpread({
|
|
114
|
+
mode: mode,
|
|
115
|
+
loading: loading,
|
|
116
|
+
value: val,
|
|
117
|
+
onSearch: onSearch,
|
|
118
|
+
onChange: change,
|
|
119
|
+
dropdownRender: function dropdownRender(node) {
|
|
120
|
+
return jsx(Index$1, {
|
|
121
|
+
loading: loading,
|
|
122
|
+
reload: run,
|
|
123
|
+
error: error,
|
|
114
124
|
options: data,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
125
|
+
children: jsx(Index$2, {
|
|
126
|
+
allSelect: allSelect,
|
|
127
|
+
options: data,
|
|
128
|
+
mode: mode,
|
|
129
|
+
value: val,
|
|
130
|
+
onChange: change,
|
|
131
|
+
fieldNames: fieldNames,
|
|
132
|
+
children: node
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
optionLabelProp: optionLabelProp,
|
|
137
|
+
menuItemSelectedIcon: icon,
|
|
138
|
+
optionFilterProp: optionFilterProp,
|
|
139
|
+
filterOption: selfFilterOption,
|
|
140
|
+
showSearch: mathShowSearch,
|
|
141
|
+
labelInValue: true,
|
|
142
|
+
onPopupScroll: propsOnPopupScroll || onPopupScroll
|
|
143
|
+
}, props), {}, {
|
|
144
|
+
children: data === null || data === void 0 ? void 0 : data.map(function (item) {
|
|
145
|
+
var optionValue = item.value,
|
|
146
|
+
label = item.label,
|
|
147
|
+
oItem = _objectWithoutProperties(item, _excluded2);
|
|
148
|
+
var filterKey = filterProvider || "label";
|
|
149
|
+
var result = typeof filterProvider === "function" ? filterProvider === null || filterProvider === void 0 ? void 0 : filterProvider(item) : item[filterKey];
|
|
150
|
+
var filter = _defineProperty({}, optionFilterProp, result);
|
|
151
|
+
return /*#__PURE__*/createElement(Option, _objectSpread(_objectSpread({}, oItem), {}, {
|
|
152
|
+
value: optionValue,
|
|
153
|
+
key: optionValue,
|
|
154
|
+
label: label,
|
|
155
|
+
mode: mode
|
|
156
|
+
}, filter), render ? render(item, val) : label);
|
|
157
|
+
})
|
|
158
|
+
})), addonAfter && jsx("div", {
|
|
159
|
+
className: "".concat(addonClassname, " ").concat(addonAfterClassName),
|
|
160
|
+
children: addonAfter
|
|
161
|
+
})]
|
|
162
|
+
});
|
|
146
163
|
};
|
|
147
164
|
var HSelect = HFormConnect(Index);
|
|
148
165
|
|
package/es/Select/modal.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface HSelectProps extends Omit<SelectProps, "options" | "placeholder
|
|
|
36
36
|
placeholder?: string;
|
|
37
37
|
dispatch?: DispatchModal;
|
|
38
38
|
isList?: boolean;
|
|
39
|
+
addonBefore?: React.ReactNode;
|
|
40
|
+
addonAfter?: React.ReactNode;
|
|
39
41
|
}
|
|
40
42
|
export interface FilterDataModal {
|
|
41
43
|
value: any;
|
package/es/Text/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Typography } from 'antd';
|
|
4
|
+
|
|
5
|
+
var HText = (function (_ref) {
|
|
6
|
+
var value = _ref.value;
|
|
7
|
+
return jsx(Typography.Text, {
|
|
8
|
+
children: value
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { HText as default };
|
|
13
|
+
// powered by hdj
|
package/es/index.css
CHANGED
|
@@ -7,6 +7,41 @@
|
|
|
7
7
|
.ant-hw-all-check-box .ant-select-item-option:not( .ant-select-item-option-selected):hover {
|
|
8
8
|
background-color: #f5f5f5;
|
|
9
9
|
}
|
|
10
|
+
.ant-hw-select-box {
|
|
11
|
+
display: -webkit-box;
|
|
12
|
+
display: -webkit-flex;
|
|
13
|
+
display: -ms-flexbox;
|
|
14
|
+
display: flex;
|
|
15
|
+
-webkit-box-orient: horizontal;
|
|
16
|
+
-webkit-box-direction: normal;
|
|
17
|
+
-webkit-flex-direction: row;
|
|
18
|
+
-ms-flex-direction: row;
|
|
19
|
+
flex-direction: row;
|
|
20
|
+
}
|
|
21
|
+
.ant-hw-select-box .ant-hw-group-addon-before {
|
|
22
|
+
border-bottom-left-radius: 2px;
|
|
23
|
+
border-top-left-radius: 2px;
|
|
24
|
+
border-right: 0px;
|
|
25
|
+
}
|
|
26
|
+
.ant-hw-select-box .ant-select {
|
|
27
|
+
-webkit-box-flex: 1;
|
|
28
|
+
-webkit-flex: 1;
|
|
29
|
+
-ms-flex: 1;
|
|
30
|
+
flex: 1;
|
|
31
|
+
}
|
|
32
|
+
.ant-hw-select-box .ant-hw-group-addon-after {
|
|
33
|
+
border-bottom-right-radius: 2px;
|
|
34
|
+
border-top-right-radius: 2px;
|
|
35
|
+
border-left: 0px;
|
|
36
|
+
}
|
|
37
|
+
.ant-hw-select-box-addon-before .ant-select .ant-select-selector {
|
|
38
|
+
border-bottom-left-radius: 0px !important;
|
|
39
|
+
border-top-left-radius: 0px !important;
|
|
40
|
+
}
|
|
41
|
+
.ant-hw-select-box-addon-after .ant-select .ant-select-selector {
|
|
42
|
+
border-bottom-right-radius: 0px !important;
|
|
43
|
+
border-top-right-radius: 0px !important;
|
|
44
|
+
}
|
|
10
45
|
.ant-hw-form-item-colon:after {
|
|
11
46
|
position: relative;
|
|
12
47
|
top: -0.5px;
|
|
@@ -125,17 +160,6 @@
|
|
|
125
160
|
.ant-hw-form-form-item .ant-form-item-label {
|
|
126
161
|
overflow: visible;
|
|
127
162
|
}
|
|
128
|
-
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
129
|
-
border-color: #ff4d4f !important;
|
|
130
|
-
}
|
|
131
|
-
.ant-form-item-has-error .ant-hw-input-group-active {
|
|
132
|
-
border-color: #ff4d4f !important;
|
|
133
|
-
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
|
|
134
|
-
}
|
|
135
|
-
.ant-form-item-has-error .ant-hw-input-group-addon {
|
|
136
|
-
color: #ff4d4f;
|
|
137
|
-
border-color: #ff4d4f !important;
|
|
138
|
-
}
|
|
139
163
|
.ant-hw-input-group {
|
|
140
164
|
display: -webkit-box !important;
|
|
141
165
|
display: -webkit-flex !important;
|
|
@@ -201,19 +225,6 @@
|
|
|
201
225
|
border-color: #40a9ff;
|
|
202
226
|
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
203
227
|
}
|
|
204
|
-
.ant-hw-input-group .ant-hw-input-group-addon {
|
|
205
|
-
display: -webkit-box !important;
|
|
206
|
-
display: -webkit-flex !important;
|
|
207
|
-
display: -ms-flexbox !important;
|
|
208
|
-
display: flex !important;
|
|
209
|
-
-webkit-box-align: center;
|
|
210
|
-
-webkit-align-items: center;
|
|
211
|
-
-ms-flex-align: center;
|
|
212
|
-
align-items: center;
|
|
213
|
-
padding: 0 11px;
|
|
214
|
-
background-color: #fafafa;
|
|
215
|
-
border: 1px solid #d9d9d9;
|
|
216
|
-
}
|
|
217
228
|
.ant-hw-color-box {
|
|
218
229
|
width: 22px;
|
|
219
230
|
height: 22px;
|
|
@@ -223,6 +234,13 @@
|
|
|
223
234
|
.ant-hw-color-input-picker {
|
|
224
235
|
box-shadow: 0 0 0 0 !important;
|
|
225
236
|
}
|
|
237
|
+
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
238
|
+
border-color: #ff4d4f !important;
|
|
239
|
+
}
|
|
240
|
+
.ant-form-item-has-error .ant-hw-input-group-active {
|
|
241
|
+
border-color: #ff4d4f !important;
|
|
242
|
+
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
|
|
243
|
+
}
|
|
226
244
|
.ant-hw-switch {
|
|
227
245
|
display: -webkit-box;
|
|
228
246
|
display: -webkit-flex;
|
|
@@ -244,3 +262,20 @@
|
|
|
244
262
|
.ant-hw-switch .ant-hw-switch-after {
|
|
245
263
|
margin-left: 4px;
|
|
246
264
|
}
|
|
265
|
+
.ant-hw-addon {
|
|
266
|
+
display: -webkit-box !important;
|
|
267
|
+
display: -webkit-flex !important;
|
|
268
|
+
display: -ms-flexbox !important;
|
|
269
|
+
display: flex !important;
|
|
270
|
+
-webkit-box-align: center;
|
|
271
|
+
-webkit-align-items: center;
|
|
272
|
+
-ms-flex-align: center;
|
|
273
|
+
align-items: center;
|
|
274
|
+
padding: 0 11px;
|
|
275
|
+
background-color: #fafafa;
|
|
276
|
+
border: 1px solid #d9d9d9;
|
|
277
|
+
}
|
|
278
|
+
.ant-form-item-has-error .ant-hw-addon {
|
|
279
|
+
color: #ff4d4f;
|
|
280
|
+
border-color: #ff4d4f !important;
|
|
281
|
+
}
|
package/lib/Form/HFormConnect.js
CHANGED
|
@@ -40,29 +40,28 @@ var HFormConnect = (function (component) {
|
|
|
40
40
|
form = _useFormContext.form,
|
|
41
41
|
_useFormContext$value = _useFormContext.valueType,
|
|
42
42
|
valueType = _useFormContext$value === void 0 ? "float" : _useFormContext$value;
|
|
43
|
+
var name = props.name;
|
|
44
|
+
var relName = Array.isArray(name) ? name.join(".") : name;
|
|
43
45
|
React.useEffect(function () {
|
|
44
|
-
|
|
45
|
-
if (!name) {
|
|
46
|
+
if (!relName) {
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
form === null || form === void 0 || form.addFormat(
|
|
49
|
+
form === null || form === void 0 || form.addFormat(relName, formatMaker(props, format[valueType]));
|
|
49
50
|
}, [valueType, props]);
|
|
50
51
|
var addFormat = function addFormat(aFormat) {
|
|
51
|
-
|
|
52
|
-
if (!name) {
|
|
52
|
+
if (!relName) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
form === null || form === void 0 || form.addFormat(
|
|
55
|
+
form === null || form === void 0 || form.addFormat(relName, formatMaker(props, aFormat[valueType]));
|
|
56
56
|
};
|
|
57
57
|
var addDispatchListener = function addDispatchListener(key, fn) {
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
if (!name) {
|
|
58
|
+
var dispatch = props.dispatch;
|
|
59
|
+
if (!relName) {
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
62
|
form === null || form === void 0 || form.addDispatchListener({
|
|
64
63
|
key: key,
|
|
65
|
-
name:
|
|
64
|
+
name: relName,
|
|
66
65
|
dispatch: dispatch
|
|
67
66
|
}, fn);
|
|
68
67
|
};
|
package/lib/Form/config.d.ts
CHANGED
|
@@ -35,10 +35,7 @@ declare const componentConfig: {
|
|
|
35
35
|
Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
36
36
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
37
37
|
};
|
|
38
|
-
treeSelect: ({ request,
|
|
39
|
-
|
|
40
|
-
request: any;
|
|
41
|
-
options: any;
|
|
42
|
-
}) => JSX.Element;
|
|
38
|
+
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
39
|
+
text: ({ value }: import("antd").FormItemProps) => JSX.Element;
|
|
43
40
|
};
|
|
44
41
|
export default componentConfig;
|
package/lib/Form/config.js
CHANGED
|
@@ -25,6 +25,7 @@ var index$d = require('../Input/VerificationCodeInput/index.js');
|
|
|
25
25
|
var TrimInput = require('../Input/TrimInput.js');
|
|
26
26
|
var TrimTextArea = require('../TextArea/TrimTextArea.js');
|
|
27
27
|
var InputNumberGroup = require('../Input/InputNumberGroup.js');
|
|
28
|
+
var index$e = require('../Text/index.js');
|
|
28
29
|
|
|
29
30
|
var placeholderConfig = {
|
|
30
31
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea"],
|
|
@@ -53,7 +54,8 @@ var componentConfig = {
|
|
|
53
54
|
trimInput: TrimInput.default,
|
|
54
55
|
trimTextArea: TrimTextArea.default,
|
|
55
56
|
inputNumberGroup: InputNumberGroup.default,
|
|
56
|
-
treeSelect: TreeSelect.default
|
|
57
|
+
treeSelect: TreeSelect.default,
|
|
58
|
+
text: index$e.default
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
exports.default = componentConfig;
|
|
@@ -29,7 +29,7 @@ var Addon = function Addon(_ref) {
|
|
|
29
29
|
var children = _ref.children,
|
|
30
30
|
value = _ref.value,
|
|
31
31
|
onChange = _ref.onChange;
|
|
32
|
-
var addonClassname = index.useClassName(["hw-
|
|
32
|
+
var addonClassname = index.useClassName(["hw-addon"]);
|
|
33
33
|
if (!children) {
|
|
34
34
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
35
35
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TreeSelectProps } from "antd/lib/tree-select";
|
|
2
2
|
import { PromiseFnResult } from "../modal";
|
|
3
|
-
interface
|
|
3
|
+
export interface HTreeSelectProps extends TreeSelectProps {
|
|
4
4
|
request?: PromiseFnResult;
|
|
5
5
|
onlyCheckChild?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }:
|
|
7
|
+
declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: HTreeSelectProps) => JSX.Element;
|
|
8
8
|
export default _default;
|
package/lib/Select/index.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
6
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
8
7
|
var React = require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var antd = require('antd');
|
|
10
10
|
var norHooks = require('./hooks/norHooks.js');
|
|
11
11
|
var changeHooks = require('./hooks/changeHooks.js');
|
|
@@ -15,7 +15,7 @@ var AllSelect = require('./components/AllSelect.js');
|
|
|
15
15
|
var index = require('../hooks/index.js');
|
|
16
16
|
var HFormConnect = require('../Form/HFormConnect.js');
|
|
17
17
|
|
|
18
|
-
var _excluded = ["style", "mode", "options", "modeConfig", "value", "onChange", "fieldNames", "request", "manual", "optionLabelProp", "filterProvider", "optionFilterProp", "serviceSearch", "onSearch", "filterOption", "showSearch", "labelInValue", "noMatchItemRender", "allSelect", "addDispatchListener", "addFormat", "dispatch", "isList", "onPopupScroll"],
|
|
18
|
+
var _excluded = ["style", "mode", "options", "modeConfig", "value", "onChange", "fieldNames", "request", "manual", "optionLabelProp", "filterProvider", "optionFilterProp", "serviceSearch", "onSearch", "filterOption", "showSearch", "labelInValue", "noMatchItemRender", "allSelect", "addDispatchListener", "addFormat", "dispatch", "isList", "onPopupScroll", "addonBefore", "addonAfter"],
|
|
19
19
|
_excluded2 = ["value", "label"];
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -52,6 +52,8 @@ var Index = function Index(_ref) {
|
|
|
52
52
|
var dispatch = _ref.dispatch,
|
|
53
53
|
isList = _ref.isList,
|
|
54
54
|
propsOnPopupScroll = _ref.onPopupScroll,
|
|
55
|
+
addonBefore = _ref.addonBefore,
|
|
56
|
+
addonAfter = _ref.addonAfter,
|
|
55
57
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
56
58
|
var _ref2 = (modeConfig === null || modeConfig === void 0 ? void 0 : modeConfig[mode || ""]) || {},
|
|
57
59
|
icon = _ref2.icon,
|
|
@@ -87,6 +89,12 @@ var Index = function Index(_ref) {
|
|
|
87
89
|
options: resultData,
|
|
88
90
|
fieldNames: fieldNames
|
|
89
91
|
});
|
|
92
|
+
var boxClassName = index.useClassName("hw-select-box");
|
|
93
|
+
var addonBeforeClassName = index.useClassName("hw-group-addon-before");
|
|
94
|
+
var addonBeforeBoxClassName = index.useClassName("hw-select-box-addon-before");
|
|
95
|
+
var addonAfterClassName = index.useClassName("hw-group-addon-after");
|
|
96
|
+
var addonAfterBoxClassName = index.useClassName("hw-select-box-addon-after");
|
|
97
|
+
var addonClassname = index.useClassName(["hw-addon"]);
|
|
90
98
|
var _useValueChange = changeHooks.useValueChange({
|
|
91
99
|
labelInValue: labelInValue,
|
|
92
100
|
onChange: onChange,
|
|
@@ -99,53 +107,62 @@ var Index = function Index(_ref) {
|
|
|
99
107
|
val = _useValueChange.val,
|
|
100
108
|
change = _useValueChange.change;
|
|
101
109
|
addDispatchListener === null || addDispatchListener === void 0 || addDispatchListener("reload", reload);
|
|
102
|
-
return jsxRuntime.
|
|
110
|
+
return jsxRuntime.jsxs("div", {
|
|
111
|
+
className: "".concat(boxClassName, " ").concat(addonBefore ? addonBeforeBoxClassName : "", " ").concat(addonAfter ? addonAfterBoxClassName : ""),
|
|
103
112
|
style: style,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
children: [addonBefore && jsxRuntime.jsx("div", {
|
|
114
|
+
className: "".concat(addonClassname, " ").concat(addonBeforeClassName),
|
|
115
|
+
children: addonBefore
|
|
116
|
+
}), jsxRuntime.jsx(antd.Select, _objectSpread(_objectSpread({
|
|
117
|
+
mode: mode,
|
|
118
|
+
loading: loading,
|
|
119
|
+
value: val,
|
|
120
|
+
onSearch: onSearch,
|
|
121
|
+
onChange: change,
|
|
122
|
+
dropdownRender: function dropdownRender(node) {
|
|
123
|
+
return jsxRuntime.jsx(DropdownComponent.default, {
|
|
124
|
+
loading: loading,
|
|
125
|
+
reload: run,
|
|
126
|
+
error: error,
|
|
117
127
|
options: data,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
128
|
+
children: jsxRuntime.jsx(AllSelect.default, {
|
|
129
|
+
allSelect: allSelect,
|
|
130
|
+
options: data,
|
|
131
|
+
mode: mode,
|
|
132
|
+
value: val,
|
|
133
|
+
onChange: change,
|
|
134
|
+
fieldNames: fieldNames,
|
|
135
|
+
children: node
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
optionLabelProp: optionLabelProp,
|
|
140
|
+
menuItemSelectedIcon: icon,
|
|
141
|
+
optionFilterProp: optionFilterProp,
|
|
142
|
+
filterOption: selfFilterOption,
|
|
143
|
+
showSearch: mathShowSearch,
|
|
144
|
+
labelInValue: true,
|
|
145
|
+
onPopupScroll: propsOnPopupScroll || onPopupScroll
|
|
146
|
+
}, props), {}, {
|
|
147
|
+
children: data === null || data === void 0 ? void 0 : data.map(function (item) {
|
|
148
|
+
var optionValue = item.value,
|
|
149
|
+
label = item.label,
|
|
150
|
+
oItem = _objectWithoutProperties(item, _excluded2);
|
|
151
|
+
var filterKey = filterProvider || "label";
|
|
152
|
+
var result = typeof filterProvider === "function" ? filterProvider === null || filterProvider === void 0 ? void 0 : filterProvider(item) : item[filterKey];
|
|
153
|
+
var filter = _defineProperty({}, optionFilterProp, result);
|
|
154
|
+
return /*#__PURE__*/React.createElement(Option, _objectSpread(_objectSpread({}, oItem), {}, {
|
|
155
|
+
value: optionValue,
|
|
156
|
+
key: optionValue,
|
|
157
|
+
label: label,
|
|
158
|
+
mode: mode
|
|
159
|
+
}, filter), render ? render(item, val) : label);
|
|
160
|
+
})
|
|
161
|
+
})), addonAfter && jsxRuntime.jsx("div", {
|
|
162
|
+
className: "".concat(addonClassname, " ").concat(addonAfterClassName),
|
|
163
|
+
children: addonAfter
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
149
166
|
};
|
|
150
167
|
var HSelect = HFormConnect.default(Index);
|
|
151
168
|
|
package/lib/Select/modal.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface HSelectProps extends Omit<SelectProps, "options" | "placeholder
|
|
|
36
36
|
placeholder?: string;
|
|
37
37
|
dispatch?: DispatchModal;
|
|
38
38
|
isList?: boolean;
|
|
39
|
+
addonBefore?: React.ReactNode;
|
|
40
|
+
addonAfter?: React.ReactNode;
|
|
39
41
|
}
|
|
40
42
|
export interface FilterDataModal {
|
|
41
43
|
value: any;
|