@hw-component/form 1.9.88 → 1.9.90

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.
Files changed (40) hide show
  1. package/.eslintcache +1 -1
  2. package/es/Form/config.d.ts +5 -0
  3. package/es/Form/config.js +3 -1
  4. package/es/Form/hooks/useHForm.js +3 -0
  5. package/es/Form/modal.d.ts +1 -0
  6. package/es/Select/TagSelect/Content.d.ts +1 -1
  7. package/es/Select/TagSelect/hooks.d.ts +2 -2
  8. package/es/TDPicker/TimeRangePicker.d.ts +8 -0
  9. package/es/TDPicker/TimeRangePicker.js +74 -0
  10. package/es/TDPicker/modal.d.ts +9 -0
  11. package/es/index.css +1 -4
  12. package/es/index.d.ts +5 -0
  13. package/es/index.js +2 -1
  14. package/lib/Form/config.d.ts +5 -0
  15. package/lib/Form/config.js +3 -1
  16. package/lib/Form/hooks/useHForm.js +3 -0
  17. package/lib/Form/modal.d.ts +1 -0
  18. package/lib/Select/TagSelect/Content.d.ts +1 -1
  19. package/lib/Select/TagSelect/hooks.d.ts +2 -2
  20. package/lib/TDPicker/TimeRangePicker.d.ts +8 -0
  21. package/lib/TDPicker/TimeRangePicker.js +77 -0
  22. package/lib/TDPicker/modal.d.ts +9 -0
  23. package/lib/index.css +1 -4
  24. package/lib/index.d.ts +5 -0
  25. package/lib/index.js +2 -0
  26. package/package.json +1 -1
  27. package/src/components/Form/config.ts +5 -2
  28. package/src/components/Form/hooks/useHForm.ts +3 -0
  29. package/src/components/Form/index.less +0 -6
  30. package/src/components/Form/modal.ts +1 -0
  31. package/src/components/Select/TagSelect/Content.tsx +71 -43
  32. package/src/components/Select/TagSelect/hooks.ts +102 -93
  33. package/src/components/Select/TagSelect/index.tsx +94 -68
  34. package/src/components/Select/index.less +3 -4
  35. package/src/components/Select/modal.ts +8 -8
  36. package/src/components/TDPicker/TimeRangePicker.tsx +51 -0
  37. package/src/components/TDPicker/modal.ts +10 -0
  38. package/src/components/index.tsx +2 -0
  39. package/src/pages/Form/index.tsx +21 -16
  40. package/src/pages/Select/index.tsx +34 -32
@@ -177,6 +177,9 @@ var useHForm = (function () {
177
177
  var newValue = formatValuesFn(values);
178
178
  form.setFieldsValue(newValue);
179
179
  },
180
+ setSourceFieldsValue: function setSourceFieldsValue(values) {
181
+ form.setFieldsValue(values);
182
+ },
180
183
  validateFields: function validateFields(nameList) {
181
184
  return new Promise(function (resolve, reject) {
182
185
  form.validateFields(nameList).then(function (value) {
@@ -153,6 +153,7 @@ export interface HFormInstance extends FormInstance {
153
153
  clearFormat: (name: string) => void;
154
154
  inited: boolean;
155
155
  resetFormStatus: VoidFunction;
156
+ setSourceFieldsValue: (values: Record<string, any>) => void;
156
157
  }
157
158
  export interface ConnectConfigModal {
158
159
  format?: Record<string, addFormatItemModal>;
@@ -3,5 +3,5 @@ interface IContentProps extends HTagSelectProps {
3
3
  error?: Error;
4
4
  reload: VoidFunction;
5
5
  }
6
- declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload }: IContentProps) => JSX.Element;
6
+ declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload, }: IContentProps) => JSX.Element;
7
7
  export default _default;
@@ -4,11 +4,11 @@ export declare const useTagControl: ({ value, options, title }: HTagSelectProps)
4
4
  checked: boolean | undefined;
5
5
  indeterminate: boolean | undefined;
6
6
  };
7
- export declare const useChangeControl: ({ options, value, onChange, fieldNames }: HTagSelectProps) => {
7
+ export declare const useChangeControl: ({ options, value, onChange, fieldNames, }: HTagSelectProps) => {
8
8
  change: (val: any) => void;
9
9
  allCheck: (e: any) => void | undefined;
10
10
  };
11
- export declare const useCollapseControl: ({ visible, defaultVisible, onVisibleChange }: HTagSelectProps) => {
11
+ export declare const useCollapseControl: ({ visible, defaultVisible, onVisibleChange, }: HTagSelectProps) => {
12
12
  activeKey: string[];
13
13
  onChange: (keys: any) => void;
14
14
  };
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { HItemProps } from "@/components/Form/modal";
3
+ declare const _default: {
4
+ Component: React.ForwardRefExoticComponent<import("@/components/Form/modal").HFormItemProps & React.RefAttributes<any>>;
5
+ placeholder: ({ label }: HItemProps) => string[];
6
+ requiredErrMsg: ({ label }: HItemProps) => string;
7
+ };
8
+ export default _default;
@@ -0,0 +1,74 @@
1
+ // welcome to hoo hoo hoo
2
+ import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
3
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
4
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
+ import { jsx } from 'react/jsx-runtime';
6
+ import { TimePicker } from 'antd';
7
+ import HFormConnect from '../Form/HFormConnect.js';
8
+ import moment from 'moment';
9
+
10
+ var _excluded = ["value", "format", "addFormat", "valueMap", "onChange", "order"];
11
+ 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
+ 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
+ var HTimePicker = function HTimePicker(_ref) {
14
+ var value = _ref.value,
15
+ _ref$format = _ref.format,
16
+ format = _ref$format === void 0 ? "HH:mm:ss" : _ref$format,
17
+ addFormat = _ref.addFormat,
18
+ _ref$valueMap = _ref.valueMap,
19
+ valueMap = _ref$valueMap === void 0 ? {} : _ref$valueMap,
20
+ onChange = _ref.onChange,
21
+ _ref$order = _ref.order,
22
+ order = _ref$order === void 0 ? false : _ref$order,
23
+ props = _objectWithoutProperties(_ref, _excluded);
24
+ var _valueMap$start = valueMap.start,
25
+ start = _valueMap$start === void 0 ? "startTime" : _valueMap$start,
26
+ _valueMap$end = valueMap.end,
27
+ end = _valueMap$end === void 0 ? "endTime" : _valueMap$end;
28
+ addFormat === null || addFormat === void 0 || addFormat({
29
+ float: {
30
+ inputValue: function inputValue(item, initValue) {
31
+ var initStart = initValue[start],
32
+ initEnd = initValue[end];
33
+ var name = item.name;
34
+ if (initStart && initEnd) {
35
+ return _defineProperty({}, name, [moment(initStart, format), moment(initEnd, format)]);
36
+ }
37
+ return _defineProperty({}, name, []);
38
+ },
39
+ outputValue: function outputValue(item, _outputValue) {
40
+ var _item$name = item.name,
41
+ valueName = _item$name === void 0 ? "" : _item$name;
42
+ var itemVal = _outputValue[valueName];
43
+ var _ref4 = itemVal || [],
44
+ _ref5 = _slicedToArray(_ref4, 2),
45
+ startVal = _ref5[0],
46
+ endVal = _ref5[1];
47
+ return _defineProperty(_defineProperty({}, start, startVal === null || startVal === void 0 ? void 0 : startVal.format(format)), end, endVal === null || endVal === void 0 ? void 0 : endVal.format(format));
48
+ }
49
+ }
50
+ });
51
+ return jsx(TimePicker.RangePicker, _objectSpread({
52
+ value: value,
53
+ onChange: onChange,
54
+ order: order,
55
+ style: {
56
+ width: '100%'
57
+ }
58
+ }, props));
59
+ };
60
+ var Index = HFormConnect(HTimePicker);
61
+ var HTimeRangePicker = {
62
+ Component: Index,
63
+ placeholder: function placeholder(_ref7) {
64
+ var label = _ref7.label;
65
+ return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
66
+ },
67
+ requiredErrMsg: function requiredErrMsg(_ref8) {
68
+ var label = _ref8.label;
69
+ return "\u8BF7\u9009\u62E9".concat(label);
70
+ }
71
+ };
72
+
73
+ export { HTimeRangePicker as default };
74
+ // powered by hdj
@@ -6,6 +6,7 @@ import type { TimePickerProps } from "antd";
6
6
  import type { DurationInputArg2 } from "moment";
7
7
  import type { DateRangePickerValueMapModal } from "../modal";
8
8
  import type { addFormatItemModal } from "../Form/modal";
9
+ import { TimeRangePickerProps } from "antd/lib/time-picker";
9
10
  interface DisabledDateFnModal<T = Moment | undefined> {
10
11
  (currentDate: Moment, value: T): boolean;
11
12
  }
@@ -35,4 +36,12 @@ export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "fo
35
36
  disabledDate?: DisabledDateFnModal;
36
37
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
37
38
  }
39
+ export interface HTimeRangePickerProps extends Omit<TimeRangePickerProps, "format"> {
40
+ valueMap?: {
41
+ start: string;
42
+ end: string;
43
+ };
44
+ format?: string;
45
+ addFormat?: (config: Record<string, addFormatItemModal>) => void;
46
+ }
38
47
  export {};
package/es/index.css CHANGED
@@ -46,7 +46,7 @@
46
46
  width: 100%;
47
47
  }
48
48
  .ant-hw-tag-select .ant-collapse-content-box {
49
- padding: 0px 40px !important;
49
+ padding: 0 40px !important;
50
50
  }
51
51
  .ant-hw-tag-select .ant-hw-tag-select {
52
52
  cursor: pointer;
@@ -179,9 +179,6 @@
179
179
  display: -ms-flexbox;
180
180
  display: flex;
181
181
  }
182
- .ant-hw-tag-select .ant-hw-tag-item {
183
- cursor: pointer;
184
- }
185
182
  .ant-hw-input-group .ant-hw-input-group-disabled {
186
183
  background-color: #f5f5f5;
187
184
  }
package/es/index.d.ts CHANGED
@@ -32,3 +32,8 @@ export declare const HTrimInput: import("react").ForwardRefExoticComponent<impor
32
32
  export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
33
33
  export declare const HInputNumberGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
34
34
  export declare const HTagSelect: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
35
+ export declare const HTimeRangePicker: {
36
+ Component: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
37
+ placeholder: ({ label }: import("./Form/modal").HItemProps) => string[];
38
+ requiredErrMsg: ({ label }: import("./Form/modal").HItemProps) => string;
39
+ };
package/es/index.js CHANGED
@@ -37,6 +37,7 @@ var HTrimInput = componentConfig.trimInput;
37
37
  var HTrimTextArea = componentConfig.trimTextArea;
38
38
  var HInputNumberGroup = componentConfig.inputNumberGroup.Component;
39
39
  var HTagSelect = componentConfig.tagSelect;
40
+ var HTimeRangePicker = componentConfig.timeRangePicker;
40
41
 
41
- export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HInputNumberGroup, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HRichEditor, HSelect, HSelectInput, HSwitch, HTagSelect, HTextArea, HTimePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
42
+ export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HInputNumberGroup, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HRichEditor, HSelect, HSelectInput, HSwitch, HTagSelect, HTextArea, HTimePicker, HTimeRangePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
42
43
  // powered by hdj
@@ -39,5 +39,10 @@ declare const componentConfig: {
39
39
  text: ({ value, addonBefore, addonAfter, size, ...props }: import("../Text").HFormTextProps) => JSX.Element;
40
40
  richEditor: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
41
41
  tagSelect: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
42
+ timeRangePicker: {
43
+ Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
44
+ placeholder: ({ label }: import("./modal").HItemProps) => string[];
45
+ requiredErrMsg: ({ label }: import("./modal").HItemProps) => string;
46
+ };
42
47
  };
43
48
  export default componentConfig;
@@ -28,6 +28,7 @@ var InputNumberGroup = require('../Input/InputNumberGroup.js');
28
28
  var index$e = require('../Text/index.js');
29
29
  var index$f = require('../RichEditor/index.js');
30
30
  var index$g = require('../Select/TagSelect/index.js');
31
+ var TimeRangePicker = require('../TDPicker/TimeRangePicker.js');
31
32
 
32
33
  var placeholderConfig = {
33
34
  inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea", "richEditor"],
@@ -59,7 +60,8 @@ var componentConfig = {
59
60
  treeSelect: TreeSelect.default,
60
61
  text: index$e.default,
61
62
  richEditor: index$f.default,
62
- tagSelect: index$g.default
63
+ tagSelect: index$g.default,
64
+ timeRangePicker: TimeRangePicker.default
63
65
  };
64
66
 
65
67
  exports.default = componentConfig;
@@ -180,6 +180,9 @@ var useHForm = (function () {
180
180
  var newValue = formatValuesFn(values);
181
181
  form.setFieldsValue(newValue);
182
182
  },
183
+ setSourceFieldsValue: function setSourceFieldsValue(values) {
184
+ form.setFieldsValue(values);
185
+ },
183
186
  validateFields: function validateFields(nameList) {
184
187
  return new Promise(function (resolve, reject) {
185
188
  form.validateFields(nameList).then(function (value) {
@@ -153,6 +153,7 @@ export interface HFormInstance extends FormInstance {
153
153
  clearFormat: (name: string) => void;
154
154
  inited: boolean;
155
155
  resetFormStatus: VoidFunction;
156
+ setSourceFieldsValue: (values: Record<string, any>) => void;
156
157
  }
157
158
  export interface ConnectConfigModal {
158
159
  format?: Record<string, addFormatItemModal>;
@@ -3,5 +3,5 @@ interface IContentProps extends HTagSelectProps {
3
3
  error?: Error;
4
4
  reload: VoidFunction;
5
5
  }
6
- declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload }: IContentProps) => JSX.Element;
6
+ declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload, }: IContentProps) => JSX.Element;
7
7
  export default _default;
@@ -4,11 +4,11 @@ export declare const useTagControl: ({ value, options, title }: HTagSelectProps)
4
4
  checked: boolean | undefined;
5
5
  indeterminate: boolean | undefined;
6
6
  };
7
- export declare const useChangeControl: ({ options, value, onChange, fieldNames }: HTagSelectProps) => {
7
+ export declare const useChangeControl: ({ options, value, onChange, fieldNames, }: HTagSelectProps) => {
8
8
  change: (val: any) => void;
9
9
  allCheck: (e: any) => void | undefined;
10
10
  };
11
- export declare const useCollapseControl: ({ visible, defaultVisible, onVisibleChange }: HTagSelectProps) => {
11
+ export declare const useCollapseControl: ({ visible, defaultVisible, onVisibleChange, }: HTagSelectProps) => {
12
12
  activeKey: string[];
13
13
  onChange: (keys: any) => void;
14
14
  };
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { HItemProps } from "@/components/Form/modal";
3
+ declare const _default: {
4
+ Component: React.ForwardRefExoticComponent<import("@/components/Form/modal").HFormItemProps & React.RefAttributes<any>>;
5
+ placeholder: ({ label }: HItemProps) => string[];
6
+ requiredErrMsg: ({ label }: HItemProps) => string;
7
+ };
8
+ export default _default;
@@ -0,0 +1,77 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
6
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
7
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+ var antd = require('antd');
10
+ var HFormConnect = require('../Form/HFormConnect.js');
11
+ var moment = require('moment');
12
+
13
+ var _excluded = ["value", "format", "addFormat", "valueMap", "onChange", "order"];
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; }
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; }
16
+ var HTimePicker = function HTimePicker(_ref) {
17
+ var value = _ref.value,
18
+ _ref$format = _ref.format,
19
+ format = _ref$format === void 0 ? "HH:mm:ss" : _ref$format,
20
+ addFormat = _ref.addFormat,
21
+ _ref$valueMap = _ref.valueMap,
22
+ valueMap = _ref$valueMap === void 0 ? {} : _ref$valueMap,
23
+ onChange = _ref.onChange,
24
+ _ref$order = _ref.order,
25
+ order = _ref$order === void 0 ? false : _ref$order,
26
+ props = _objectWithoutProperties(_ref, _excluded);
27
+ var _valueMap$start = valueMap.start,
28
+ start = _valueMap$start === void 0 ? "startTime" : _valueMap$start,
29
+ _valueMap$end = valueMap.end,
30
+ end = _valueMap$end === void 0 ? "endTime" : _valueMap$end;
31
+ addFormat === null || addFormat === void 0 || addFormat({
32
+ float: {
33
+ inputValue: function inputValue(item, initValue) {
34
+ var initStart = initValue[start],
35
+ initEnd = initValue[end];
36
+ var name = item.name;
37
+ if (initStart && initEnd) {
38
+ return _defineProperty({}, name, [moment(initStart, format), moment(initEnd, format)]);
39
+ }
40
+ return _defineProperty({}, name, []);
41
+ },
42
+ outputValue: function outputValue(item, _outputValue) {
43
+ var _item$name = item.name,
44
+ valueName = _item$name === void 0 ? "" : _item$name;
45
+ var itemVal = _outputValue[valueName];
46
+ var _ref4 = itemVal || [],
47
+ _ref5 = _slicedToArray(_ref4, 2),
48
+ startVal = _ref5[0],
49
+ endVal = _ref5[1];
50
+ return _defineProperty(_defineProperty({}, start, startVal === null || startVal === void 0 ? void 0 : startVal.format(format)), end, endVal === null || endVal === void 0 ? void 0 : endVal.format(format));
51
+ }
52
+ }
53
+ });
54
+ return jsxRuntime.jsx(antd.TimePicker.RangePicker, _objectSpread({
55
+ value: value,
56
+ onChange: onChange,
57
+ order: order,
58
+ style: {
59
+ width: '100%'
60
+ }
61
+ }, props));
62
+ };
63
+ var Index = HFormConnect.default(HTimePicker);
64
+ var HTimeRangePicker = {
65
+ Component: Index,
66
+ placeholder: function placeholder(_ref7) {
67
+ var label = _ref7.label;
68
+ return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
69
+ },
70
+ requiredErrMsg: function requiredErrMsg(_ref8) {
71
+ var label = _ref8.label;
72
+ return "\u8BF7\u9009\u62E9".concat(label);
73
+ }
74
+ };
75
+
76
+ exports.default = HTimeRangePicker;
77
+ // powered by h
@@ -6,6 +6,7 @@ import type { TimePickerProps } from "antd";
6
6
  import type { DurationInputArg2 } from "moment";
7
7
  import type { DateRangePickerValueMapModal } from "../modal";
8
8
  import type { addFormatItemModal } from "../Form/modal";
9
+ import { TimeRangePickerProps } from "antd/lib/time-picker";
9
10
  interface DisabledDateFnModal<T = Moment | undefined> {
10
11
  (currentDate: Moment, value: T): boolean;
11
12
  }
@@ -35,4 +36,12 @@ export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "fo
35
36
  disabledDate?: DisabledDateFnModal;
36
37
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
37
38
  }
39
+ export interface HTimeRangePickerProps extends Omit<TimeRangePickerProps, "format"> {
40
+ valueMap?: {
41
+ start: string;
42
+ end: string;
43
+ };
44
+ format?: string;
45
+ addFormat?: (config: Record<string, addFormatItemModal>) => void;
46
+ }
38
47
  export {};
package/lib/index.css CHANGED
@@ -46,7 +46,7 @@
46
46
  width: 100%;
47
47
  }
48
48
  .ant-hw-tag-select .ant-collapse-content-box {
49
- padding: 0px 40px !important;
49
+ padding: 0 40px !important;
50
50
  }
51
51
  .ant-hw-tag-select .ant-hw-tag-select {
52
52
  cursor: pointer;
@@ -179,9 +179,6 @@
179
179
  display: -ms-flexbox;
180
180
  display: flex;
181
181
  }
182
- .ant-hw-tag-select .ant-hw-tag-item {
183
- cursor: pointer;
184
- }
185
182
  .ant-hw-input-group .ant-hw-input-group-disabled {
186
183
  background-color: #f5f5f5;
187
184
  }
package/lib/index.d.ts CHANGED
@@ -32,3 +32,8 @@ export declare const HTrimInput: import("react").ForwardRefExoticComponent<impor
32
32
  export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
33
33
  export declare const HInputNumberGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
34
34
  export declare const HTagSelect: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
35
+ export declare const HTimeRangePicker: {
36
+ Component: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
37
+ placeholder: ({ label }: import("./Form/modal").HItemProps) => string[];
38
+ requiredErrMsg: ({ label }: import("./Form/modal").HItemProps) => string;
39
+ };
package/lib/index.js CHANGED
@@ -38,6 +38,7 @@ var HTrimInput = config.default.trimInput;
38
38
  var HTrimTextArea = config.default.trimTextArea;
39
39
  var HInputNumberGroup = config.default.inputNumberGroup.Component;
40
40
  var HTagSelect = config.default.tagSelect;
41
+ var HTimeRangePicker = config.default.timeRangePicker;
41
42
 
42
43
  exports.HForm = index.default;
43
44
  exports.useHForm = useHForm.default;
@@ -67,6 +68,7 @@ exports.HSwitch = HSwitch;
67
68
  exports.HTagSelect = HTagSelect;
68
69
  exports.HTextArea = HTextArea;
69
70
  exports.HTimePicker = HTimePicker;
71
+ exports.HTimeRangePicker = HTimeRangePicker;
70
72
  exports.HTrimInput = HTrimInput;
71
73
  exports.HTrimTextArea = HTrimTextArea;
72
74
  exports.HUpload = HUpload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.88",
3
+ "version": "1.9.90",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,9 @@ import TrimTextArea from "../TextArea/TrimTextArea";
23
23
  import HInputNumberGroup from "../Input/InputNumberGroup";
24
24
  import HText from "../Text";
25
25
  import HRichEditor from "../RichEditor";
26
- import HTagSelect from '../Select/TagSelect';
26
+ import HTagSelect from "../Select/TagSelect";
27
+ import HTimeRangePicker from "../TDPicker/TimeRangePicker";
28
+
27
29
  export const placeholderConfig = {
28
30
  inputType: [
29
31
  "input",
@@ -70,7 +72,8 @@ const componentConfig = {
70
72
  treeSelect: HTreeSelect,
71
73
  text: HText,
72
74
  richEditor: HRichEditor,
73
- tagSelect:HTagSelect
75
+ tagSelect: HTagSelect,
76
+ timeRangePicker: HTimeRangePicker,
74
77
  };
75
78
 
76
79
  export default componentConfig;
@@ -160,6 +160,9 @@ export default () => {
160
160
  const newValue = formatValuesFn(values);
161
161
  form.setFieldsValue(newValue);
162
162
  },
163
+ setSourceFieldsValue(values){
164
+ form.setFieldsValue(values);
165
+ },
163
166
  validateFields(nameList) {
164
167
  return new Promise((resolve, reject) => {
165
168
  form
@@ -102,9 +102,3 @@
102
102
  display: flex;
103
103
  }
104
104
  }
105
-
106
- .@{ant-prefix}-hw-tag-select{
107
- .@{ant-prefix}-hw-tag-item{
108
- cursor: pointer;
109
- }
110
- }
@@ -212,6 +212,7 @@ export interface HFormInstance extends FormInstance {
212
212
  clearFormat: (name: string) => void;
213
213
  inited: boolean;
214
214
  resetFormStatus: VoidFunction;
215
+ setSourceFieldsValue:( values: Record<string, any>)=>void;
215
216
  }
216
217
 
217
218
  export interface ConnectConfigModal {
@@ -1,50 +1,78 @@
1
- import {HTagSelectProps} from "../modal";
2
- import {useClassName} from "@/components/hooks";
3
- import {Row, Skeleton, Space, Tag,Empty} from "antd";
1
+ import { HTagSelectProps } from "../modal";
2
+ import { useClassName } from "@/components/hooks";
3
+ import { Row, Skeleton, Space, Tag, Empty } from "antd";
4
4
  import React from "react";
5
- import {useChangeControl} from "./hooks";
5
+ import { useChangeControl } from "./hooks";
6
6
  import NotFoundContent from "../components/NotFoundContent";
7
7
 
8
- const ItemOption=({options,value,onChange,fieldNames}:HTagSelectProps)=>{
9
- const tagClassName = useClassName("hw-tag-item");
10
- const {label:labelKey="label",value:valueKey="value"}=fieldNames||{};
11
- const {change}=useChangeControl({options,value,onChange,fieldNames});
12
- return <Row gutter={[0,8]}>
13
- {options?.map((item)=>{
14
- const {[labelKey]:label,[valueKey]:itemVal}=item;
15
- const index=value?.indexOf(itemVal);
16
- const checkedTag=index!==-1;
17
- return <Tag color={checkedTag?"processing":undefined}
18
- className={tagClassName}
19
- key={itemVal}
20
- onClick={()=>{
21
- change(itemVal);
22
- }}
23
- >
24
- {label}
25
- </Tag>
26
- })}
8
+ const ItemOption = ({
9
+ options,
10
+ value,
11
+ onChange,
12
+ fieldNames,
13
+ }: HTagSelectProps) => {
14
+ const tagClassName = useClassName("hw-tag-item");
15
+ const { label: labelKey = "label", value: valueKey = "value" } =
16
+ fieldNames || {};
17
+ const { change } = useChangeControl({ options, value, onChange, fieldNames });
18
+ return (
19
+ <Row gutter={[0, 8]}>
20
+ {options?.map((item) => {
21
+ const { [labelKey]: label, [valueKey]: itemVal } = item;
22
+ const index = value?.indexOf(itemVal);
23
+ const checkedTag = index !== -1;
24
+ return (
25
+ <Tag
26
+ color={checkedTag ? "processing" : undefined}
27
+ className={tagClassName}
28
+ key={itemVal}
29
+ onClick={() => {
30
+ change(itemVal);
31
+ }}
32
+ >
33
+ {label}
34
+ </Tag>
35
+ );
36
+ })}
27
37
  </Row>
28
- }
38
+ );
39
+ };
29
40
 
30
- interface IContentProps extends HTagSelectProps{
31
- error?:Error;
32
- reload:VoidFunction;
41
+ interface IContentProps extends HTagSelectProps {
42
+ error?: Error;
43
+ reload: VoidFunction;
33
44
  }
34
45
 
35
- export default ({loading,value,options,onChange,fieldNames,error,reload}:IContentProps)=>{
36
- const len=options?.length||0;
37
- if (loading&&len===0){
38
- return <Space direction={"vertical"} style={{width:"100%"}}>
39
- <Skeleton.Button active size={"small"} block />
40
- <Skeleton.Button active size={"small"} block />
41
- </Space>
42
- }
43
- if (error && len === 0) {
44
- return <NotFoundContent error={error} reload={reload}/>;
45
- }
46
- if (len===0){
47
- return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
48
- }
49
- return <ItemOption options={options} value={value} onChange={onChange} fieldNames={fieldNames}/>
50
- }
46
+ export default ({
47
+ loading,
48
+ value,
49
+ options,
50
+ onChange,
51
+ fieldNames,
52
+ error,
53
+ reload,
54
+ }: IContentProps) => {
55
+ const len = options?.length || 0;
56
+ if (loading && len === 0) {
57
+ return (
58
+ <Space direction={"vertical"} style={{ width: "100%" }}>
59
+ <Skeleton.Button active size={"small"} block />
60
+ <Skeleton.Button active size={"small"} block />
61
+ </Space>
62
+ );
63
+ }
64
+ if (error && len === 0) {
65
+ return <NotFoundContent error={error} reload={reload} />;
66
+ }
67
+ if (len === 0) {
68
+ return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
69
+ }
70
+ return (
71
+ <ItemOption
72
+ options={options}
73
+ value={value}
74
+ onChange={onChange}
75
+ fieldNames={fieldNames}
76
+ />
77
+ );
78
+ };