@hw-component/form 0.0.8-beta-v7 → 0.0.8-beta-v9
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/CheckboxGroup/modal.d.ts +1 -0
- package/es/DialogForm/modal.d.ts +1 -1
- package/es/Form/config.d.ts +7 -5
- package/es/Form/config.js +11 -7
- package/es/Input/TrimInput.d.ts +3 -0
- package/es/Input/TrimInput.js +43 -0
- package/es/Input/VerificationCodeInput.d.ts +3 -3
- package/es/Input/VerificationCodeInput.js +2 -2
- package/es/Input/modal.d.ts +2 -0
- package/es/Submit/components.d.ts +6 -0
- package/es/Submit/components.js +70 -0
- package/es/Submit/hooks.d.ts +5 -0
- package/es/Submit/hooks.js +28 -0
- package/es/Submit/index.d.ts +4 -1
- package/es/Submit/index.js +24 -28
- package/es/Switch/index.d.ts +4 -2
- package/es/Switch/index.js +28 -4
- package/es/TextArea/TrimTextArea.d.ts +3 -0
- package/es/TextArea/TrimTextArea.js +43 -0
- package/es/index.d.ts +8 -6
- package/es/index.js +3 -1
- package/lib/CheckboxGroup/modal.d.ts +1 -0
- package/lib/DialogForm/modal.d.ts +1 -1
- package/lib/Form/config.d.ts +7 -5
- package/lib/Form/config.js +6 -2
- package/lib/Input/TrimInput.d.ts +3 -0
- package/lib/Input/TrimInput.js +46 -0
- package/lib/Input/VerificationCodeInput.d.ts +3 -3
- package/lib/Input/VerificationCodeInput.js +2 -2
- package/lib/Input/modal.d.ts +2 -0
- package/lib/Submit/components.d.ts +6 -0
- package/lib/Submit/components.js +71 -0
- package/lib/Submit/hooks.d.ts +5 -0
- package/lib/Submit/hooks.js +29 -0
- package/lib/Submit/index.d.ts +4 -1
- package/lib/Submit/index.js +22 -26
- package/lib/Switch/index.d.ts +4 -2
- package/lib/Switch/index.js +28 -4
- package/lib/TextArea/TrimTextArea.d.ts +3 -0
- package/lib/TextArea/TrimTextArea.js +46 -0
- package/lib/index.d.ts +8 -6
- package/lib/index.js +4 -0
- package/package.json +1 -1
- package/src/components/CheckboxGroup/modal.ts +1 -0
- package/src/components/DialogForm/DrawerForm/index.tsx +5 -3
- package/src/components/DialogForm/ModalForm.tsx +5 -3
- package/src/components/DialogForm/modal.ts +5 -2
- package/src/components/Form/config.ts +8 -3
- package/src/components/Input/TrimInput.tsx +26 -0
- package/src/components/Input/VerificationCodeInput.tsx +4 -4
- package/src/components/Input/modal.ts +2 -0
- package/src/components/Submit/components.tsx +57 -0
- package/src/components/Submit/hooks.ts +31 -0
- package/src/components/Submit/index.tsx +12 -25
- package/src/components/Switch/index.tsx +27 -1
- package/src/components/TextArea/TrimTextArea.tsx +30 -0
- package/src/components/index.tsx +5 -0
- package/src/pages/Form/index.tsx +70 -0
- package/src/pages/ModalForm/index.tsx +7 -5
package/lib/Form/config.d.ts
CHANGED
|
@@ -11,21 +11,23 @@ declare const componentConfig: {
|
|
|
11
11
|
checkboxGroup: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
12
12
|
checkBox: import("react").FC<import("../CheckboxGroup/modal").HCheckboxProps>;
|
|
13
13
|
radioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("../RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
14
|
-
switch: import("react").
|
|
15
|
-
datePicker: import("react").
|
|
14
|
+
switch: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
15
|
+
datePicker: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
16
16
|
rangePicker: {
|
|
17
17
|
Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
18
18
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
19
19
|
requiredErrMsg: ({ label }: import("./modal").HItemProps) => string;
|
|
20
20
|
};
|
|
21
|
-
timePicker: (
|
|
21
|
+
timePicker: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
22
22
|
input: ({ copy, value, addonAfter, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
23
23
|
upload: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
24
24
|
urlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("../Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
25
|
-
submit: ({
|
|
25
|
+
submit: ({ position, reset, extraList, ...props }: import("../Submit").ISubmitProps) => JSX.Element;
|
|
26
26
|
textArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
27
27
|
colorInput: ({ value, onChange, defaultColor, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
28
28
|
cascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("../Cascader").HCascaderProps) => JSX.Element;
|
|
29
|
-
verificationCodeInput: () => JSX.Element;
|
|
29
|
+
verificationCodeInput: ({ value, request, form, onChange, ...props }: import("../Input/VerificationCodeInput").HVerificationCodeInputProps) => JSX.Element;
|
|
30
|
+
trimInput: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
31
|
+
trimTextArea: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
30
32
|
};
|
|
31
33
|
export default componentConfig;
|
package/lib/Form/config.js
CHANGED
|
@@ -21,9 +21,11 @@ var index$a = require('../TextArea/index.js');
|
|
|
21
21
|
var index$b = require('../Input/ColorInput/index.js');
|
|
22
22
|
var index$c = require('../Cascader/index.js');
|
|
23
23
|
var VerificationCodeInput = require('../Input/VerificationCodeInput.js');
|
|
24
|
+
var TrimInput = require('../Input/TrimInput.js');
|
|
25
|
+
var TrimTextArea = require('../TextArea/TrimTextArea.js');
|
|
24
26
|
|
|
25
27
|
var placeholderConfig = {
|
|
26
|
-
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput"],
|
|
28
|
+
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", ""],
|
|
27
29
|
selectType: ["select", "datePicker", "timePicker", "colorInput"]
|
|
28
30
|
};
|
|
29
31
|
var componentConfig = {
|
|
@@ -45,7 +47,9 @@ var componentConfig = {
|
|
|
45
47
|
textArea: index$a.default,
|
|
46
48
|
colorInput: index$b.default,
|
|
47
49
|
cascader: index$c.default,
|
|
48
|
-
verificationCodeInput: VerificationCodeInput.default
|
|
50
|
+
verificationCodeInput: VerificationCodeInput.default,
|
|
51
|
+
trimInput: TrimInput.default,
|
|
52
|
+
trimTextArea: TrimTextArea.default
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
exports.default = componentConfig;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/es.function.name.js');
|
|
8
|
+
require('core-js/modules/es.string.trim.js');
|
|
9
|
+
require('core-js/modules/es.object.keys.js');
|
|
10
|
+
require('core-js/modules/es.symbol.js');
|
|
11
|
+
require('core-js/modules/es.array.filter.js');
|
|
12
|
+
require('core-js/modules/es.object.to-string.js');
|
|
13
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
14
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
15
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
16
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
17
|
+
var index = require('./index.js');
|
|
18
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
19
|
+
|
|
20
|
+
var _excluded = ["addFormat"];
|
|
21
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
var Index = function Index(_ref) {
|
|
24
|
+
var addFormat = _ref.addFormat,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
27
|
+
float: {
|
|
28
|
+
inputValue: function inputValue(item, initValue) {
|
|
29
|
+
var _item$name = item.name,
|
|
30
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
31
|
+
return _defineProperty({}, valueName, initValue[valueName]);
|
|
32
|
+
},
|
|
33
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
34
|
+
var _item$name2 = item.name,
|
|
35
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
36
|
+
var itemVal = _outputValue[name];
|
|
37
|
+
return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return jsxRuntime.jsx(index.default, _objectSpread({}, props));
|
|
42
|
+
};
|
|
43
|
+
var TrimInput = HFormConnect.default(Index);
|
|
44
|
+
|
|
45
|
+
exports.default = TrimInput;
|
|
46
|
+
// powered by h
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { HFormInstance } from "
|
|
1
|
+
import type { HFormInstance } from "../Form/modal";
|
|
2
2
|
import type { InputProps } from "antd";
|
|
3
|
-
interface
|
|
3
|
+
export interface HVerificationCodeInputProps extends Omit<InputProps, "form"> {
|
|
4
4
|
request?: (value: any) => Promise<any>;
|
|
5
5
|
form?: HFormInstance;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: ({ value, request, form, onChange, ...props }:
|
|
7
|
+
declare const _default: ({ value, request, form, onChange, ...props }: HVerificationCodeInputProps) => JSX.Element;
|
|
8
8
|
export default _default;
|
|
@@ -23,7 +23,7 @@ var ahooks = require('ahooks');
|
|
|
23
23
|
var _excluded = ["value", "request", "form", "onChange"];
|
|
24
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
25
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
|
-
var
|
|
26
|
+
var VerificationCodeInput = (function (_ref) {
|
|
27
27
|
var value = _ref.value,
|
|
28
28
|
request = _ref.request,
|
|
29
29
|
form = _ref.form,
|
|
@@ -109,5 +109,5 @@ var HVerificationCodeInput = (function (_ref) {
|
|
|
109
109
|
}));
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
exports.default =
|
|
112
|
+
exports.default = VerificationCodeInput;
|
|
113
113
|
// powered by h
|
package/lib/Input/modal.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface HInputProps<V = any> extends Omit<InputProps, "onChange" | "val
|
|
|
9
9
|
value?: V;
|
|
10
10
|
defaultColor?: string;
|
|
11
11
|
copy?: boolean;
|
|
12
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
12
13
|
}
|
|
13
14
|
interface ValueNameModal {
|
|
14
15
|
input?: string;
|
|
@@ -21,6 +22,7 @@ export interface HSelectInputProps extends Omit<HInputProps, "value" | "onChange
|
|
|
21
22
|
valueName?: ValueNameModal;
|
|
22
23
|
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
23
24
|
addDispatchListener?: AddDispatchListenerFn;
|
|
25
|
+
subParams?: (formatValue: Record<string, any>) => any;
|
|
24
26
|
}
|
|
25
27
|
export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
|
|
26
28
|
onClick: (value: string | readonly string[] | number | undefined, onChange?: (val: any) => void) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ISubmitProps, SubmitBarExtraType } from "@/components/Submit/index";
|
|
2
|
+
interface ControlFooterProps extends ISubmitProps {
|
|
3
|
+
action: SubmitBarExtraType;
|
|
4
|
+
}
|
|
5
|
+
export declare const ControlFooter: ({ action, ...props }: ControlFooterProps) => JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/es.object.keys.js');
|
|
4
|
+
require('core-js/modules/es.symbol.js');
|
|
5
|
+
require('core-js/modules/es.array.filter.js');
|
|
6
|
+
require('core-js/modules/es.object.to-string.js');
|
|
7
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
8
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
9
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
11
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
12
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
+
var antd = require('antd');
|
|
14
|
+
var index = require('../Form/Context/index.js');
|
|
15
|
+
var React = require('react');
|
|
16
|
+
|
|
17
|
+
var _excluded = ["form"],
|
|
18
|
+
_excluded2 = ["type", "form", "text", "loading"],
|
|
19
|
+
_excluded3 = ["action"];
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
+
function ResetBtn(_ref) {
|
|
23
|
+
var form = _ref.form,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
return jsxRuntime.jsx(antd.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
26
|
+
onClick: function onClick() {
|
|
27
|
+
form.resetFields();
|
|
28
|
+
},
|
|
29
|
+
children: "\u91CD\u7F6E"
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
function SubBtn(_ref2) {
|
|
33
|
+
var _ref2$type = _ref2.type,
|
|
34
|
+
type = _ref2$type === void 0 ? "primary" : _ref2$type,
|
|
35
|
+
form = _ref2.form,
|
|
36
|
+
_ref2$text = _ref2.text,
|
|
37
|
+
text = _ref2$text === void 0 ? "提交" : _ref2$text,
|
|
38
|
+
loading = _ref2.loading,
|
|
39
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
40
|
+
var _useFormContext = index.useFormContext(),
|
|
41
|
+
_useFormContext$loadi = _useFormContext.loading,
|
|
42
|
+
formSubLoading = _useFormContext$loadi === void 0 ? loading : _useFormContext$loadi;
|
|
43
|
+
return jsxRuntime.jsx(antd.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
44
|
+
type: type,
|
|
45
|
+
onClick: form.submit,
|
|
46
|
+
loading: formSubLoading,
|
|
47
|
+
children: text
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
var ControlFooter = function ControlFooter(_ref3) {
|
|
51
|
+
var action = _ref3.action,
|
|
52
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
53
|
+
var form = props.form;
|
|
54
|
+
if (action === "reset") {
|
|
55
|
+
return jsxRuntime.jsx(ResetBtn, _objectSpread({}, props));
|
|
56
|
+
}
|
|
57
|
+
if (action === "submit") {
|
|
58
|
+
return jsxRuntime.jsx(SubBtn, _objectSpread({}, props));
|
|
59
|
+
}
|
|
60
|
+
if (typeof action === "string") {
|
|
61
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
62
|
+
children: action
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return /*#__PURE__*/React.cloneElement(action, {
|
|
66
|
+
form: form
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.ControlFooter = ControlFooter;
|
|
71
|
+
// powered by h
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/es.array.map.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
var getBarComKeyList = function getBarComKeyList(extraList) {
|
|
7
|
+
return extraList.map(function (item, index) {
|
|
8
|
+
return {
|
|
9
|
+
action: item,
|
|
10
|
+
key: "".concat(index)
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var useBarSortList = function useBarSortList(props) {
|
|
15
|
+
var extraList = props.extraList,
|
|
16
|
+
_props$reset = props.reset,
|
|
17
|
+
reset = _props$reset === void 0 ? false : _props$reset;
|
|
18
|
+
var list = React.useMemo(function () {
|
|
19
|
+
if (!extraList) {
|
|
20
|
+
var defaultList = reset ? ["reset", "submit"] : ["submit"];
|
|
21
|
+
return getBarComKeyList(defaultList);
|
|
22
|
+
}
|
|
23
|
+
return getBarComKeyList(extraList);
|
|
24
|
+
}, [extraList, reset]);
|
|
25
|
+
return list;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.useBarSortList = useBarSortList;
|
|
29
|
+
// powered by h
|
package/lib/Submit/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { ButtonProps, FormInstance } from "antd/es";
|
|
3
|
+
export type SubmitBarExtraType = "submit" | "reset" | React.ReactDOM;
|
|
2
4
|
export interface ISubmitProps extends Omit<ButtonProps, "form"> {
|
|
3
5
|
text?: string;
|
|
4
6
|
form: FormInstance;
|
|
5
7
|
reset?: boolean;
|
|
6
8
|
position?: "start" | "end";
|
|
9
|
+
extraList?: SubmitBarExtraType[];
|
|
7
10
|
}
|
|
8
|
-
declare const _default: ({
|
|
11
|
+
declare const _default: ({ position, reset, extraList, ...props }: ISubmitProps) => JSX.Element;
|
|
9
12
|
export default _default;
|
package/lib/Submit/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/es.array.map.js');
|
|
5
8
|
require('core-js/modules/es.object.keys.js');
|
|
6
9
|
require('core-js/modules/es.symbol.js');
|
|
7
10
|
require('core-js/modules/es.array.filter.js');
|
|
@@ -9,46 +12,39 @@ require('core-js/modules/es.object.to-string.js');
|
|
|
9
12
|
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
10
13
|
require('core-js/modules/web.dom-collections.for-each.js');
|
|
11
14
|
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
12
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
|
-
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
14
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
+
var React = require('react');
|
|
15
17
|
var antd = require('antd');
|
|
16
|
-
var
|
|
18
|
+
var hooks = require('./hooks.js');
|
|
19
|
+
var components = require('./components.js');
|
|
17
20
|
|
|
18
|
-
var _excluded = ["
|
|
21
|
+
var _excluded = ["position", "reset", "extraList"];
|
|
19
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
24
|
var HSubmit = (function (_ref) {
|
|
22
|
-
var _ref$
|
|
23
|
-
text = _ref$text === void 0 ? "提交" : _ref$text,
|
|
24
|
-
_ref$type = _ref.type,
|
|
25
|
-
type = _ref$type === void 0 ? "primary" : _ref$type,
|
|
26
|
-
form = _ref.form,
|
|
27
|
-
loading = _ref.loading,
|
|
28
|
-
_ref$position = _ref.position,
|
|
25
|
+
var _ref$position = _ref.position,
|
|
29
26
|
position = _ref$position === void 0 ? "start" : _ref$position,
|
|
30
27
|
reset = _ref.reset,
|
|
28
|
+
extraList = _ref.extraList,
|
|
31
29
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
var barList = hooks.useBarSortList({
|
|
31
|
+
reset: reset,
|
|
32
|
+
extraList: extraList
|
|
33
|
+
});
|
|
35
34
|
return jsxRuntime.jsx(antd.Row, {
|
|
36
35
|
justify: position,
|
|
37
36
|
style: {
|
|
38
37
|
width: "100%"
|
|
39
38
|
},
|
|
40
|
-
children: jsxRuntime.
|
|
41
|
-
children:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
loading: formSubLoading,
|
|
50
|
-
children: text
|
|
51
|
-
}))]
|
|
39
|
+
children: jsxRuntime.jsx(antd.Space, {
|
|
40
|
+
children: barList === null || barList === void 0 ? void 0 : barList.map(function (_ref2) {
|
|
41
|
+
var action = _ref2.action,
|
|
42
|
+
key = _ref2.key;
|
|
43
|
+
return /*#__PURE__*/React.createElement(components.ControlFooter, _objectSpread(_objectSpread({}, props), {}, {
|
|
44
|
+
key: key,
|
|
45
|
+
action: action
|
|
46
|
+
}));
|
|
47
|
+
})
|
|
52
48
|
})
|
|
53
49
|
});
|
|
54
50
|
});
|
package/lib/Switch/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { SwitchProps } from "antd";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ValueSwitchMapModal } from "../modal";
|
|
4
|
+
import type { addFormatItemModal } from "../Form/modal";
|
|
4
5
|
export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
|
|
5
6
|
valueMap?: ValueSwitchMapModal;
|
|
6
7
|
value?: any;
|
|
7
8
|
onChange?: (val: any) => void;
|
|
8
9
|
beforeText?: React.ReactNode;
|
|
10
|
+
addFormat?: (format: Record<string, addFormatItemModal>) => void;
|
|
9
11
|
}
|
|
10
|
-
declare const
|
|
11
|
-
export default
|
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
13
|
+
export default _default;
|
package/lib/Switch/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/es.function.name.js');
|
|
5
8
|
require('core-js/modules/es.object.keys.js');
|
|
6
9
|
require('core-js/modules/es.symbol.js');
|
|
7
10
|
require('core-js/modules/es.array.filter.js');
|
|
@@ -9,14 +12,13 @@ require('core-js/modules/es.object.to-string.js');
|
|
|
9
12
|
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
10
13
|
require('core-js/modules/web.dom-collections.for-each.js');
|
|
11
14
|
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
12
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
|
-
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
14
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
16
|
var antd = require('antd');
|
|
16
17
|
var React = require('react');
|
|
17
18
|
var index = require('../hooks/index.js');
|
|
19
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
18
20
|
|
|
19
|
-
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText"];
|
|
21
|
+
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat"];
|
|
20
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
24
|
var Index = function Index(_ref) {
|
|
@@ -29,6 +31,7 @@ var Index = function Index(_ref) {
|
|
|
29
31
|
_ref$checkedChildren = _ref.checkedChildren,
|
|
30
32
|
checkedChildren = _ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
|
|
31
33
|
beforeText = _ref.beforeText,
|
|
34
|
+
addFormat = _ref.addFormat,
|
|
32
35
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
36
|
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
34
37
|
valueSwitchMap: propsValueSwitchMap
|
|
@@ -46,6 +49,26 @@ var Index = function Index(_ref) {
|
|
|
46
49
|
}
|
|
47
50
|
onChange === null || onChange === void 0 || onChange(subVal);
|
|
48
51
|
};
|
|
52
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
53
|
+
float: {
|
|
54
|
+
inputValue: function inputValue(item, initValue) {
|
|
55
|
+
var close = valueSwitchMap.close;
|
|
56
|
+
var _item$name = item.name,
|
|
57
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
58
|
+
var val = initValue[valueName];
|
|
59
|
+
if (typeof val === "undefined" || val === null) {
|
|
60
|
+
val = close;
|
|
61
|
+
}
|
|
62
|
+
console.log(val, "");
|
|
63
|
+
return _defineProperty({}, valueName, val);
|
|
64
|
+
},
|
|
65
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
66
|
+
var _item$name2 = item.name,
|
|
67
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
68
|
+
return _defineProperty({}, name, _outputValue[name]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
49
72
|
return jsxRuntime.jsxs(antd.Space, {
|
|
50
73
|
children: [beforeText, jsxRuntime.jsx(antd.Switch, _objectSpread({
|
|
51
74
|
checked: swChecked,
|
|
@@ -57,6 +80,7 @@ var Index = function Index(_ref) {
|
|
|
57
80
|
})]
|
|
58
81
|
});
|
|
59
82
|
};
|
|
83
|
+
var HSwitch = HFormConnect.default(Index);
|
|
60
84
|
|
|
61
|
-
exports.default =
|
|
85
|
+
exports.default = HSwitch;
|
|
62
86
|
// powered by h
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/es.function.name.js');
|
|
8
|
+
require('core-js/modules/es.string.trim.js');
|
|
9
|
+
require('core-js/modules/es.object.keys.js');
|
|
10
|
+
require('core-js/modules/es.symbol.js');
|
|
11
|
+
require('core-js/modules/es.array.filter.js');
|
|
12
|
+
require('core-js/modules/es.object.to-string.js');
|
|
13
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
14
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
15
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
16
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
17
|
+
var index = require('./index.js');
|
|
18
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
19
|
+
|
|
20
|
+
var _excluded = ["addFormat"];
|
|
21
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
var Index = function Index(_ref) {
|
|
24
|
+
var addFormat = _ref.addFormat,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
27
|
+
float: {
|
|
28
|
+
inputValue: function inputValue(item, initValue) {
|
|
29
|
+
var _item$name = item.name,
|
|
30
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
31
|
+
return _defineProperty({}, valueName, initValue[valueName]);
|
|
32
|
+
},
|
|
33
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
34
|
+
var _item$name2 = item.name,
|
|
35
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
36
|
+
var itemVal = _outputValue[name];
|
|
37
|
+
return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return jsxRuntime.jsx(index.default, _objectSpread({}, props));
|
|
42
|
+
};
|
|
43
|
+
var TrimTextArea = HFormConnect.default(Index);
|
|
44
|
+
|
|
45
|
+
exports.default = TrimTextArea;
|
|
46
|
+
// powered by h
|
package/lib/index.d.ts
CHANGED
|
@@ -12,17 +12,19 @@ export declare const HUpload: import("react").ForwardRefExoticComponent<import("
|
|
|
12
12
|
export declare const HUrlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("./Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
13
13
|
export declare const HButtonInput: import("react").FC<import("./Input/modal").HButtonInputProps>;
|
|
14
14
|
export declare const HCheckBox: import("react").FC<import("./CheckboxGroup/modal").HCheckboxProps>;
|
|
15
|
-
export declare const HSwitch: import("react").
|
|
15
|
+
export declare const HSwitch: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
16
16
|
export declare const HCheckboxGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
17
|
-
export declare const HDatePicker: import("react").
|
|
17
|
+
export declare const HDatePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
18
18
|
export declare const HRangePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
19
19
|
export declare const HRadioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("./RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
20
|
-
export declare const HTimePicker: (
|
|
20
|
+
export declare const HTimePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
21
21
|
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps<string | number>) => JSX.Element;
|
|
22
22
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
23
23
|
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
24
24
|
export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
25
|
-
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
|
-
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
25
|
+
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, contentRender, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
|
+
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, contentRender, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
27
27
|
export declare const HCascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("./Cascader").HCascaderProps) => JSX.Element;
|
|
28
|
-
export declare const HVerificationCodeInput: () => JSX.Element;
|
|
28
|
+
export declare const HVerificationCodeInput: ({ value, request, form, onChange, ...props }: import("./Input/VerificationCodeInput").HVerificationCodeInputProps) => JSX.Element;
|
|
29
|
+
export declare const HTrimInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
30
|
+
export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,8 @@ var HModalForm = ModalForm.default;
|
|
|
31
31
|
var HDrawerForm = index$2.default;
|
|
32
32
|
var HCascader = config.default.cascader;
|
|
33
33
|
var HVerificationCodeInput = config.default.verificationCodeInput;
|
|
34
|
+
var HTrimInput = config.default.trimInput;
|
|
35
|
+
var HTrimTextArea = config.default.trimTextArea;
|
|
34
36
|
|
|
35
37
|
exports.HForm = index.default;
|
|
36
38
|
exports.useHForm = useHForm.default;
|
|
@@ -55,6 +57,8 @@ exports.HSelectInput = HSelectInput;
|
|
|
55
57
|
exports.HSwitch = HSwitch;
|
|
56
58
|
exports.HTextArea = HTextArea;
|
|
57
59
|
exports.HTimePicker = HTimePicker;
|
|
60
|
+
exports.HTrimInput = HTrimInput;
|
|
61
|
+
exports.HTrimTextArea = HTrimTextArea;
|
|
58
62
|
exports.HUpload = HUpload;
|
|
59
63
|
exports.HUrlUpload = HUrlUpload;
|
|
60
64
|
exports.HVerificationCodeInput = HVerificationCodeInput;
|
package/package.json
CHANGED
|
@@ -12,4 +12,5 @@ export interface HCheckboxProps
|
|
|
12
12
|
value?: Record<string, any> | any[];
|
|
13
13
|
onChange?: (value: Record<string, any> | any[]) => void;
|
|
14
14
|
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
15
|
+
subParams?: (formatValue: Record<string, any>, sourceValue: any[]) => any;
|
|
15
16
|
}
|
|
@@ -72,7 +72,8 @@ export default ({
|
|
|
72
72
|
)
|
|
73
73
|
);
|
|
74
74
|
};
|
|
75
|
-
const node
|
|
75
|
+
const node = (
|
|
76
|
+
<HForm
|
|
76
77
|
configData={modalFormData}
|
|
77
78
|
initialValues={initValue}
|
|
78
79
|
onValuesChange={onValuesChange}
|
|
@@ -89,7 +90,8 @@ export default ({
|
|
|
89
90
|
}}
|
|
90
91
|
infoRequest={infoRequest}
|
|
91
92
|
labelWidth={labelWidth}
|
|
92
|
-
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
93
95
|
return (
|
|
94
96
|
<Drawer
|
|
95
97
|
visible={modalVisible}
|
|
@@ -101,7 +103,7 @@ export default ({
|
|
|
101
103
|
footer={footerComponent()}
|
|
102
104
|
>
|
|
103
105
|
<FormConfigProvider {...providerConfig}>
|
|
104
|
-
{contentRender?contentRender(node,currentForm):node}
|
|
106
|
+
{contentRender ? contentRender(node, currentForm) : node}
|
|
105
107
|
</FormConfigProvider>
|
|
106
108
|
</Drawer>
|
|
107
109
|
);
|
|
@@ -48,7 +48,8 @@ export default ({
|
|
|
48
48
|
setModalVisible(false);
|
|
49
49
|
};
|
|
50
50
|
const { loading, run } = useSub({ request, onFinish });
|
|
51
|
-
const node
|
|
51
|
+
const node = (
|
|
52
|
+
<HForm
|
|
52
53
|
configData={modalFormData}
|
|
53
54
|
initialValues={initValue}
|
|
54
55
|
onValuesChange={onValuesChange}
|
|
@@ -64,7 +65,8 @@ export default ({
|
|
|
64
65
|
params={formParams}
|
|
65
66
|
form={currentForm}
|
|
66
67
|
infoRequest={infoRequest}
|
|
67
|
-
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
68
70
|
return (
|
|
69
71
|
<Modal
|
|
70
72
|
title={modalTitle}
|
|
@@ -82,7 +84,7 @@ export default ({
|
|
|
82
84
|
destroyOnClose={true}
|
|
83
85
|
>
|
|
84
86
|
<FormConfigProvider {...providerConfig}>
|
|
85
|
-
{contentRender?contentRender?.(node, currentForm):node}
|
|
87
|
+
{contentRender ? contentRender?.(node, currentForm) : node}
|
|
86
88
|
</FormConfigProvider>
|
|
87
89
|
</Modal>
|
|
88
90
|
);
|