@hw-component/form 1.9.36 → 1.9.39

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/Basic.js CHANGED
@@ -50,13 +50,15 @@ var Basic = (function (_ref) {
50
50
  _itemData$itemProps = itemData.itemProps,
51
51
  itemProps = _itemData$itemProps === void 0 ? {} : _itemData$itemProps,
52
52
  itemColon = itemData.colon,
53
- configItemSpan = itemData.itemSpan;
53
+ configItemSpan = itemData.itemSpan,
54
+ nameKey = itemData.nameKey;
54
55
  var defaultItemProps = _objectSpread(_objectSpread({
55
56
  onPressEnter: dismissOnPressEnter ? undefined : defaultOnPressEnter
56
57
  }, formItemProps), itemProps);
58
+ var key = name || nameKey;
57
59
  return /*#__PURE__*/createElement(Item, _objectSpread(_objectSpread({}, itemData), {}, {
58
60
  labelAlign: labelAlign,
59
- key: name || index,
61
+ key: key || index,
60
62
  style: style,
61
63
  itemProps: defaultItemProps,
62
64
  hideLabel: hideLabel,
@@ -53,6 +53,7 @@ export interface HItemProps extends Omit<FormItemProps, "name" | "labelAlign" |
53
53
  label?: React.ReactNode | HelperModal;
54
54
  hidden?: boolean | HideModal;
55
55
  rowWrapper?: boolean;
56
+ nameKey?: string;
56
57
  }
57
58
  interface InfoRequestOp extends BaseOptions<any, any> {
58
59
  request: PromiseFnResult;
@@ -2,12 +2,14 @@ import type { SwitchProps } from "antd";
2
2
  import React from "react";
3
3
  import type { ValueSwitchMapModal } from "../modal";
4
4
  import type { addFormatItemModal } from "../Form/modal";
5
+ import { PromiseFnResult } from "../modal";
5
6
  export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
6
7
  valueMap?: ValueSwitchMapModal;
7
8
  value?: any;
8
9
  onChange?: (val: any) => void;
9
10
  beforeText?: React.ReactNode;
10
11
  addFormat?: (format: Record<string, addFormatItemModal>) => void;
12
+ request?: PromiseFnResult;
11
13
  }
12
14
  declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
13
15
  export default _default;
@@ -1,13 +1,16 @@
1
1
  // welcome to hoo hoo hoo
2
2
  import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
+ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
3
4
  import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
+ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
4
6
  import { jsxs, jsx } from 'react/jsx-runtime';
5
7
  import { Switch } from 'antd';
6
8
  import { useMemo } from 'react';
7
9
  import { useMatchConfigProps, useClassName } from '../hooks/index.js';
8
10
  import HFormConnect from '../Form/HFormConnect.js';
11
+ import { useRequest } from 'ahooks';
9
12
 
10
- var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat", "style"];
13
+ var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat", "style", "request"];
11
14
  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; }
12
15
  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; }
13
16
  var Index = function Index(_ref) {
@@ -22,6 +25,7 @@ var Index = function Index(_ref) {
22
25
  beforeText = _ref.beforeText,
23
26
  addFormat = _ref.addFormat,
24
27
  style = _ref.style,
28
+ request = _ref.request,
25
29
  props = _objectWithoutProperties(_ref, _excluded);
26
30
  var _useMatchConfigProps = useMatchConfigProps({
27
31
  valueSwitchMap: propsValueSwitchMap
@@ -31,14 +35,38 @@ var Index = function Index(_ref) {
31
35
  var switchClassName = useClassName("hw-switch");
32
36
  var switchBefore = useClassName("hw-switch-before");
33
37
  var switchAfter = useClassName("hw-switch-after");
38
+ var _useRequest = useRequest(/*#__PURE__*/function () {
39
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(val) {
40
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
41
+ while (1) switch (_context.prev = _context.next) {
42
+ case 0:
43
+ _context.next = 2;
44
+ return request === null || request === void 0 ? void 0 : request(val);
45
+ case 2:
46
+ onChange === null || onChange === void 0 || onChange(val);
47
+ case 3:
48
+ case "end":
49
+ return _context.stop();
50
+ }
51
+ }, _callee);
52
+ }));
53
+ return function (_x) {
54
+ return _ref2.apply(this, arguments);
55
+ };
56
+ }(), {
57
+ manual: true
58
+ }),
59
+ run = _useRequest.run,
60
+ loading = _useRequest.loading;
34
61
  var swChecked = useMemo(function () {
35
62
  var open = valueSwitchMap.open;
36
63
  return value === open;
37
64
  }, [value]);
38
65
  var change = function change(checked) {
39
- var subVal = valueSwitchMap.close;
40
- if (checked) {
41
- subVal = valueSwitchMap.open;
66
+ var subVal = checked ? valueSwitchMap.open : valueSwitchMap.close;
67
+ if (request) {
68
+ run(subVal);
69
+ return;
42
70
  }
43
71
  onChange === null || onChange === void 0 || onChange(subVal);
44
72
  };
@@ -69,6 +97,7 @@ var Index = function Index(_ref) {
69
97
  children: beforeText
70
98
  }), jsx(Switch, _objectSpread({
71
99
  checked: swChecked,
100
+ loading: loading,
72
101
  checkedChildren: checkedChildren,
73
102
  unCheckedChildren: unCheckedChildren,
74
103
  onChange: change
@@ -31,6 +31,9 @@ var TypeEle = (function (_ref2) {
31
31
  return jsx("audio", {
32
32
  autoPlay: true,
33
33
  controls: true,
34
+ style: {
35
+ width: "100%"
36
+ },
34
37
  onPlay: onReady,
35
38
  onError: onError,
36
39
  children: jsx("source", {
package/lib/Form/Basic.js CHANGED
@@ -53,13 +53,15 @@ var Basic = (function (_ref) {
53
53
  _itemData$itemProps = itemData.itemProps,
54
54
  itemProps = _itemData$itemProps === void 0 ? {} : _itemData$itemProps,
55
55
  itemColon = itemData.colon,
56
- configItemSpan = itemData.itemSpan;
56
+ configItemSpan = itemData.itemSpan,
57
+ nameKey = itemData.nameKey;
57
58
  var defaultItemProps = _objectSpread(_objectSpread({
58
59
  onPressEnter: dismissOnPressEnter ? undefined : defaultOnPressEnter
59
60
  }, formItemProps), itemProps);
61
+ var key = name || nameKey;
60
62
  return /*#__PURE__*/React.createElement(index$1.default, _objectSpread(_objectSpread({}, itemData), {}, {
61
63
  labelAlign: labelAlign,
62
- key: name || index,
64
+ key: key || index,
63
65
  style: style,
64
66
  itemProps: defaultItemProps,
65
67
  hideLabel: hideLabel,
@@ -53,6 +53,7 @@ export interface HItemProps extends Omit<FormItemProps, "name" | "labelAlign" |
53
53
  label?: React.ReactNode | HelperModal;
54
54
  hidden?: boolean | HideModal;
55
55
  rowWrapper?: boolean;
56
+ nameKey?: string;
56
57
  }
57
58
  interface InfoRequestOp extends BaseOptions<any, any> {
58
59
  request: PromiseFnResult;
@@ -2,12 +2,14 @@ import type { SwitchProps } from "antd";
2
2
  import React from "react";
3
3
  import type { ValueSwitchMapModal } from "../modal";
4
4
  import type { addFormatItemModal } from "../Form/modal";
5
+ import { PromiseFnResult } from "../modal";
5
6
  export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
6
7
  valueMap?: ValueSwitchMapModal;
7
8
  value?: any;
8
9
  onChange?: (val: any) => void;
9
10
  beforeText?: React.ReactNode;
10
11
  addFormat?: (format: Record<string, addFormatItemModal>) => void;
12
+ request?: PromiseFnResult;
11
13
  }
12
14
  declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
13
15
  export default _default;
@@ -3,14 +3,17 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
6
7
  var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
8
+ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
7
9
  var jsxRuntime = require('react/jsx-runtime');
8
10
  var antd = require('antd');
9
11
  var React = require('react');
10
12
  var index = require('../hooks/index.js');
11
13
  var HFormConnect = require('../Form/HFormConnect.js');
14
+ var ahooks = require('ahooks');
12
15
 
13
- var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat", "style"];
16
+ var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat", "style", "request"];
14
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; }
15
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; }
16
19
  var Index = function Index(_ref) {
@@ -25,6 +28,7 @@ var Index = function Index(_ref) {
25
28
  beforeText = _ref.beforeText,
26
29
  addFormat = _ref.addFormat,
27
30
  style = _ref.style,
31
+ request = _ref.request,
28
32
  props = _objectWithoutProperties(_ref, _excluded);
29
33
  var _useMatchConfigProps = index.useMatchConfigProps({
30
34
  valueSwitchMap: propsValueSwitchMap
@@ -34,14 +38,38 @@ var Index = function Index(_ref) {
34
38
  var switchClassName = index.useClassName("hw-switch");
35
39
  var switchBefore = index.useClassName("hw-switch-before");
36
40
  var switchAfter = index.useClassName("hw-switch-after");
41
+ var _useRequest = ahooks.useRequest(/*#__PURE__*/function () {
42
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(val) {
43
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
44
+ while (1) switch (_context.prev = _context.next) {
45
+ case 0:
46
+ _context.next = 2;
47
+ return request === null || request === void 0 ? void 0 : request(val);
48
+ case 2:
49
+ onChange === null || onChange === void 0 || onChange(val);
50
+ case 3:
51
+ case "end":
52
+ return _context.stop();
53
+ }
54
+ }, _callee);
55
+ }));
56
+ return function (_x) {
57
+ return _ref2.apply(this, arguments);
58
+ };
59
+ }(), {
60
+ manual: true
61
+ }),
62
+ run = _useRequest.run,
63
+ loading = _useRequest.loading;
37
64
  var swChecked = React.useMemo(function () {
38
65
  var open = valueSwitchMap.open;
39
66
  return value === open;
40
67
  }, [value]);
41
68
  var change = function change(checked) {
42
- var subVal = valueSwitchMap.close;
43
- if (checked) {
44
- subVal = valueSwitchMap.open;
69
+ var subVal = checked ? valueSwitchMap.open : valueSwitchMap.close;
70
+ if (request) {
71
+ run(subVal);
72
+ return;
45
73
  }
46
74
  onChange === null || onChange === void 0 || onChange(subVal);
47
75
  };
@@ -72,6 +100,7 @@ var Index = function Index(_ref) {
72
100
  children: beforeText
73
101
  }), jsxRuntime.jsx(antd.Switch, _objectSpread({
74
102
  checked: swChecked,
103
+ loading: loading,
75
104
  checkedChildren: checkedChildren,
76
105
  unCheckedChildren: unCheckedChildren,
77
106
  onChange: change
@@ -34,6 +34,9 @@ var TypeEle = (function (_ref2) {
34
34
  return jsxRuntime.jsx("audio", {
35
35
  autoPlay: true,
36
36
  controls: true,
37
+ style: {
38
+ width: "100%"
39
+ },
37
40
  onPlay: onReady,
38
41
  onError: onError,
39
42
  children: jsxRuntime.jsx("source", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.36",
3
+ "version": "1.9.39",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,18 +46,19 @@ export default ({
46
46
  itemProps = {},
47
47
  colon: itemColon,
48
48
  itemSpan: configItemSpan,
49
+ nameKey,
49
50
  } = itemData;
50
51
  const defaultItemProps = {
51
52
  onPressEnter: dismissOnPressEnter ? undefined : defaultOnPressEnter,
52
53
  ...formItemProps,
53
54
  ...itemProps,
54
55
  };
55
-
56
+ const key=name||nameKey;
56
57
  return (
57
58
  <Item
58
59
  {...itemData}
59
60
  labelAlign={labelAlign}
60
- key={name || index}
61
+ key={key || index}
61
62
  style={style}
62
63
  itemProps={defaultItemProps as ItemPropsType}
63
64
  hideLabel={hideLabel}
@@ -100,6 +100,7 @@ export interface HItemProps
100
100
  label?: React.ReactNode | HelperModal;
101
101
  hidden?: boolean | HideModal;
102
102
  rowWrapper?: boolean;
103
+ nameKey?:string;
103
104
  }
104
105
  interface InfoRequestOp extends BaseOptions<any,any> {
105
106
  request:PromiseFnResult;
@@ -5,6 +5,8 @@ import { useClassName, useMatchConfigProps } from "../hooks";
5
5
  import type { ValueSwitchMapModal } from "../modal";
6
6
  import type { addFormatItemModal } from "../Form/modal";
7
7
  import HFormConnect from "../Form/HFormConnect";
8
+ import {PromiseFnResult} from "../modal";
9
+ import {useRequest} from "ahooks";
8
10
 
9
11
  export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
10
12
  valueMap?: ValueSwitchMapModal;
@@ -12,6 +14,7 @@ export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
12
14
  onChange?: (val: any) => void;
13
15
  beforeText?: React.ReactNode;
14
16
  addFormat?: (format: Record<string, addFormatItemModal>) => void;
17
+ request?:PromiseFnResult
15
18
  }
16
19
  const Index: React.FC<HSwitchProps> = ({
17
20
  value,
@@ -23,6 +26,7 @@ const Index: React.FC<HSwitchProps> = ({
23
26
  beforeText,
24
27
  addFormat,
25
28
  style,
29
+ request,
26
30
  ...props
27
31
  }) => {
28
32
  const { valueSwitchMap = {} } = useMatchConfigProps({
@@ -31,15 +35,19 @@ const Index: React.FC<HSwitchProps> = ({
31
35
  const switchClassName = useClassName("hw-switch");
32
36
  const switchBefore = useClassName("hw-switch-before");
33
37
  const switchAfter = useClassName("hw-switch-after");
34
-
38
+ const {run,loading}=useRequest(async (val)=>{
39
+ await request?.(val);
40
+ onChange?.(val);
41
+ },{manual:true});
35
42
  const swChecked = useMemo(() => {
36
43
  const { open } = valueSwitchMap;
37
44
  return value === open;
38
45
  }, [value]);
39
46
  const change = (checked) => {
40
- let subVal = valueSwitchMap.close;
41
- if (checked) {
42
- subVal = valueSwitchMap.open;
47
+ const subVal = checked?valueSwitchMap.open:valueSwitchMap.close;
48
+ if (request){
49
+ run(subVal);
50
+ return;
43
51
  }
44
52
  onChange?.(subVal);
45
53
  };
@@ -69,6 +77,7 @@ const Index: React.FC<HSwitchProps> = ({
69
77
  {beforeText && <span className={switchBefore}>{beforeText}</span>}
70
78
  <Switch
71
79
  checked={swChecked}
80
+ loading={loading}
72
81
  checkedChildren={checkedChildren}
73
82
  unCheckedChildren={unCheckedChildren}
74
83
  onChange={change}
@@ -24,7 +24,7 @@ export default ({ mediaType, url, onReady, onError }: TypeEleProps) => {
24
24
 
25
25
  if (mediaType === MediaTypeEnum.audio) {
26
26
  return (
27
- <audio autoPlay controls onPlay={onReady} onError={onError}>
27
+ <audio autoPlay controls style={{width:"100%"}} onPlay={onReady} onError={onError}>
28
28
  <source src={url} />
29
29
  </audio>
30
30
  );
@@ -103,7 +103,7 @@ const Index = ({
103
103
  }}
104
104
  />
105
105
  {inputHelper && <Text type={"secondary"}>{inputHelper}</Text>}
106
- <Upload {...upProps} ref={ref} value={value} onChange={onChange} />
106
+ <Upload {...upProps} ref={ref} value={value} onChange={onChange}/>
107
107
  {load && (
108
108
  <div style={{ display: "none" }}>
109
109
  <TypeEle
@@ -82,7 +82,15 @@ const formData = (options) => {
82
82
  addonAfter: "后面",
83
83
  },
84
84
  },
85
-
85
+ {
86
+ label:"时间",
87
+ name:"time",
88
+ type:'datePicker',
89
+ itemProps: {
90
+ picker: 'month',
91
+ placeholder: '请选择月份',
92
+ },
93
+ }
86
94
  ];
87
95
  };
88
96
  function Ttta({ form }) {
@@ -12,95 +12,95 @@ const Test = (props) => {
12
12
  return <HUrlUpload {...props} />;
13
13
  };
14
14
  const data = [
15
- {
16
- label: "输入框",
17
- name: "name",
18
- hideLabel: true,
19
- rules: [
20
- () => {
21
- return {
22
- required: true,
23
- };
24
- },
25
- ],
26
- },
27
- {
28
- label: "数字",
29
- name: "sz",
30
- type: "inputNumber",
31
- rules: [{ required: true }],
32
- },
33
- {
34
- label: "下拉输入框",
35
- name: "selectInput",
36
- type: "selectInput",
37
- rules: [{ required: true }],
38
- itemProps: {
39
- valueName: {
40
- select: "op",
41
- input: "opInput",
42
- },
43
- selectProps: {
44
- options: [{ label: "测试", value: 1 }],
45
- },
46
- },
47
- },
48
- {
49
- label: "按钮输入框",
50
- name: "buttonInput",
51
- type: "buttonInput",
52
- children: "点击",
53
- rules: [{ required: true }],
54
- },
55
- {
56
- label: "选择",
57
- name: "checkboxGroup",
58
- type: "checkboxGroup",
59
- rules: [{ required: true }],
60
- helper: "帮助我",
61
- options: [
62
- { label: "选择1", value: "check1" },
63
- { label: "选择2", value: "check2" },
64
- ],
65
- },
66
- {
67
- label: "开关",
68
- name: "switch",
69
- type: "switch",
70
- rules: [{ required: true }],
71
- },
72
- {
73
- label: "时间",
74
- name: "datePicker",
75
- type: "datePicker",
76
- hover: "时间选择",
77
- helper: "帮助我",
78
- rules: [{ required: true }],
79
- },
80
- {
81
- label: "时间段",
82
- name: "rangePicker",
83
- type: "rangePicker",
84
- helper: "帮助我",
85
- rules: [{ required: true }],
86
- itemProps: {
87
- valueMap: {
88
- start: "testStart",
89
- end: "testEnd",
90
- },
91
- },
92
- },
93
- {
94
- label: "时分秒",
95
- name: "timePicker",
96
- type: "timePicker",
97
- rules: [{ required: true }],
98
- itemProps: {
99
- subProvider: () => {
100
- console.log("fff");
101
- },
102
- },
103
- },
15
+ // {
16
+ // label: "输入框",
17
+ // name: "name",
18
+ // hideLabel: true,
19
+ // rules: [
20
+ // () => {
21
+ // return {
22
+ // required: true,
23
+ // };
24
+ // },
25
+ // ],
26
+ // },
27
+ // {
28
+ // label: "数字",
29
+ // name: "sz",
30
+ // type: "inputNumber",
31
+ // rules: [{ required: true }],
32
+ // },
33
+ // {
34
+ // label: "下拉输入框",
35
+ // name: "selectInput",
36
+ // type: "selectInput",
37
+ // rules: [{ required: true }],
38
+ // itemProps: {
39
+ // valueName: {
40
+ // select: "op",
41
+ // input: "opInput",
42
+ // },
43
+ // selectProps: {
44
+ // options: [{ label: "测试", value: 1 }],
45
+ // },
46
+ // },
47
+ // },
48
+ // {
49
+ // label: "按钮输入框",
50
+ // name: "buttonInput",
51
+ // type: "buttonInput",
52
+ // children: "点击",
53
+ // rules: [{ required: true }],
54
+ // },
55
+ // {
56
+ // label: "选择",
57
+ // name: "checkboxGroup",
58
+ // type: "checkboxGroup",
59
+ // rules: [{ required: true }],
60
+ // helper: "帮助我",
61
+ // options: [
62
+ // { label: "选择1", value: "check1" },
63
+ // { label: "选择2", value: "check2" },
64
+ // ],
65
+ // },
66
+ // {
67
+ // label: "开关",
68
+ // name: "switch",
69
+ // type: "switch",
70
+ // rules: [{ required: true }],
71
+ // },
72
+ // {
73
+ // label: "时间",
74
+ // name: "datePicker",
75
+ // type: "datePicker",
76
+ // hover: "时间选择",
77
+ // helper: "帮助我",
78
+ // rules: [{ required: true }],
79
+ // },
80
+ // {
81
+ // label: "时间段",
82
+ // name: "rangePicker",
83
+ // type: "rangePicker",
84
+ // helper: "帮助我",
85
+ // rules: [{ required: true }],
86
+ // itemProps: {
87
+ // valueMap: {
88
+ // start: "testStart",
89
+ // end: "testEnd",
90
+ // },
91
+ // },
92
+ // },
93
+ // {
94
+ // label: "时分秒",
95
+ // name: "timePicker",
96
+ // type: "timePicker",
97
+ // rules: [{ required: true }],
98
+ // itemProps: {
99
+ // subProvider: () => {
100
+ // console.log("fff");
101
+ // },
102
+ // },
103
+ // },
104
104
  {
105
105
  label: "文件",
106
106
  name: "upload",
@@ -110,38 +110,36 @@ const data = [
110
110
  {
111
111
  label: "地址文件",
112
112
  name: "urlUpload",
113
- render: () => {
114
- return <Test />;
115
- },
116
- },
117
- {
118
- label: "下拉框",
119
- name: "select",
120
- type: "select",
121
- dispatch: {
122
- fnKey: "reload",
123
- dependencies: ["selectInput", "sz"],
124
- manual: false,
125
- },
126
- itemProps: {
127
- request: (params = {}, values) => {
128
- const { label = "123", value = 1 } = params;
129
- return Promise.resolve([{ label, value }]);
130
- },
131
- showSearch: true,
132
- },
133
- rules: [{ required: true }],
134
- },
135
- {
136
- label: "验证码",
137
- type: "verificationCodeInput",
138
- name: "verificationCodeInput",
139
- itemProps: {
140
- request: () => {
141
- return Promise.resolve({ code: 200 });
142
- },
143
- },
113
+ type: "urlUpload",
144
114
  },
115
+ // {
116
+ // label: "下拉框",
117
+ // name: "select",
118
+ // type: "select",
119
+ // dispatch: {
120
+ // fnKey: "reload",
121
+ // dependencies: ["selectInput", "sz"],
122
+ // manual: false,
123
+ // },
124
+ // itemProps: {
125
+ // request: (params = {}, values) => {
126
+ // const { label = "123", value = 1 } = params;
127
+ // return Promise.resolve([{ label, value }]);
128
+ // },
129
+ // showSearch: true,
130
+ // },
131
+ // rules: [{ required: true }],
132
+ // },
133
+ // {
134
+ // label: "验证码",
135
+ // type: "verificationCodeInput",
136
+ // name: "verificationCodeInput",
137
+ // itemProps: {
138
+ // request: () => {
139
+ // return Promise.resolve({ code: 200 });
140
+ // },
141
+ // },
142
+ // },
145
143
  ];
146
144
  let num = 0;
147
145
  const Test1 = ({ formNode }) => {
@@ -163,12 +161,6 @@ export default () => {
163
161
  onClick={() => {
164
162
  num++;
165
163
  modalForm.show({
166
- params: {
167
- name: num,
168
- },
169
- initialValues: {
170
- urlUpload: "ffff",
171
- },
172
164
  });
173
165
  }}
174
166
  >
@@ -200,6 +192,9 @@ export default () => {
200
192
  <HModalForm
201
193
  configData={data}
202
194
  labelWidth={88}
195
+ infoRequest={()=>{
196
+ console.log("infoRequest")
197
+ }}
203
198
  labelAlign={"left"}
204
199
  request={(values, params) => {
205
200
  console.log(values, params);
@@ -1,6 +1,15 @@
1
1
  import { Space } from "antd";
2
2
  import { HSwitch } from "../../components";
3
+ import {useState} from "react";
4
+ const req=()=>{
5
+ return new Promise((resolve, reject)=>{
6
+ setTimeout(()=>{
7
+ resolve({})
8
+ },2000)
9
+ })
10
+ }
3
11
  export default () => {
12
+ const [val,setVal]=useState();
4
13
  return (
5
14
  <Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
6
15
  <HSwitch
@@ -16,12 +25,11 @@ export default () => {
16
25
  </HSwitch>
17
26
 
18
27
  <HSwitch
19
- value={1}
28
+ value={val}
20
29
  beforeText="开关"
21
30
  valueMap={{ open: 1, close: 0 }}
22
- onChange={(val) => {
23
- console.log(val);
24
- }}
31
+ onChange={setVal}
32
+ request={req}
25
33
  >
26
34
  手机设备发送微信红包
27
35
  </HSwitch>
@@ -21,6 +21,7 @@ export default () => {
21
21
  onChange={setFiles}
22
22
  multiple={true}
23
23
  maxCount={3}
24
+
24
25
  maxSize={Number.MAX_SAFE_INTEGER}
25
26
  />
26
27
  <HUpload
@@ -32,7 +33,7 @@ export default () => {
32
33
  }}
33
34
  onChange={setFiles1}
34
35
  />
35
- <HUrlUpload inputHelper="测试" />
36
+ <HUrlUpload inputHelper="测试" mediaType={MediaTypeEnum.video} value={files} onChange={setFiles}/>
36
37
  </Space>
37
38
  );
38
39
  };