@hw-component/form 0.0.5-beta-v6 → 0.0.5-beta-v7

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 (144) hide show
  1. package/es/Form/config.d.ts +2 -2
  2. package/es/index.d.ts +1 -26
  3. package/es/index.js +4 -30
  4. package/lib/Form/config.d.ts +2 -2
  5. package/lib/index.d.ts +1 -26
  6. package/lib/index.js +4 -53
  7. package/package.json +1 -1
  8. package/src/components/index.tsx +3 -30
  9. package/es/CheckboxGroup/CheckBox/index.js +0 -42
  10. package/es/CheckboxGroup/hooks.js +0 -120
  11. package/es/CheckboxGroup/index.js +0 -93
  12. package/es/DialogForm/DrawerForm/Footer.js +0 -27
  13. package/es/DialogForm/DrawerForm/Title.js +0 -21
  14. package/es/DialogForm/DrawerForm/index.js +0 -137
  15. package/es/DialogForm/ModalForm.js +0 -118
  16. package/es/DialogForm/hooks.js +0 -148
  17. package/es/Form/Context/FormConfigProvider.js +0 -48
  18. package/es/Form/Context/index.js +0 -11
  19. package/es/Form/FormItem/BasicItem.js +0 -92
  20. package/es/Form/FormItem/Helper.js +0 -26
  21. package/es/Form/FormItem/RegularFormItem.js +0 -24
  22. package/es/Form/FormItem/UpFormItem.js +0 -42
  23. package/es/Form/FormItem/hooks.js +0 -38
  24. package/es/Form/FormItem/index.js +0 -21
  25. package/es/Form/HFormConnect.js +0 -68
  26. package/es/Form/InitSet.js +0 -16
  27. package/es/Form/Label.js +0 -49
  28. package/es/Form/config.js +0 -45
  29. package/es/Form/hooks/index.js +0 -157
  30. package/es/Form/hooks/useDefaultRender.js +0 -48
  31. package/es/Form/hooks/useHForm.js +0 -193
  32. package/es/Form/hooks/useInitConfigData.js +0 -169
  33. package/es/Form/index.js +0 -102
  34. package/es/Input/ButtonInput.js +0 -94
  35. package/es/Input/ColorInput/Picker.js +0 -22
  36. package/es/Input/ColorInput/data.js +0 -5
  37. package/es/Input/ColorInput/index.js +0 -94
  38. package/es/Input/InputNumber.js +0 -29
  39. package/es/Input/SelectInput.js +0 -95
  40. package/es/Input/defaultConfig.js +0 -11
  41. package/es/Input/index.js +0 -23
  42. package/es/PageHandler/ErrorComponent.js +0 -38
  43. package/es/PageHandler/LoadingComponent.js +0 -19
  44. package/es/PageHandler/index.js +0 -26
  45. package/es/RadioGroup/index.js +0 -58
  46. package/es/Select/components/AllSelect.js +0 -55
  47. package/es/Select/components/CheckBoxOption.js +0 -16
  48. package/es/Select/components/DropdownComponent.js +0 -44
  49. package/es/Select/components/NoFindItem.js +0 -14
  50. package/es/Select/components/NotFoundContent.js +0 -43
  51. package/es/Select/defaultConfig.js +0 -32
  52. package/es/Select/hooks/changeHooks.js +0 -196
  53. package/es/Select/hooks/norHooks.js +0 -118
  54. package/es/Select/index.js +0 -149
  55. package/es/Select/utils.js +0 -37
  56. package/es/Submit/index.js +0 -54
  57. package/es/Switch/index.js +0 -59
  58. package/es/TDPicker/RangePicker.js +0 -125
  59. package/es/TDPicker/TimePicker.js +0 -44
  60. package/es/TDPicker/hooks.js +0 -132
  61. package/es/TDPicker/index.js +0 -47
  62. package/es/TextArea/index.js +0 -30
  63. package/es/Upload/Btn.js +0 -36
  64. package/es/Upload/MediaTypeEle/TypeEle.js +0 -42
  65. package/es/Upload/MediaTypeEle/index.js +0 -36
  66. package/es/Upload/Preview/index.js +0 -22
  67. package/es/Upload/UrlUpload/index.js +0 -133
  68. package/es/Upload/enums.js +0 -10
  69. package/es/Upload/hooks/change.js +0 -107
  70. package/es/Upload/hooks/customRequest.js +0 -131
  71. package/es/Upload/hooks/propsMaker.js +0 -36
  72. package/es/Upload/index.js +0 -145
  73. package/es/Upload/util.js +0 -34
  74. package/es/config.js +0 -65
  75. package/es/hooks/index.js +0 -74
  76. package/es/index.css +0 -44
  77. package/lib/CheckboxGroup/CheckBox/index.js +0 -45
  78. package/lib/CheckboxGroup/hooks.js +0 -121
  79. package/lib/CheckboxGroup/index.js +0 -96
  80. package/lib/DialogForm/DrawerForm/Footer.js +0 -30
  81. package/lib/DialogForm/DrawerForm/Title.js +0 -24
  82. package/lib/DialogForm/DrawerForm/index.js +0 -140
  83. package/lib/DialogForm/ModalForm.js +0 -121
  84. package/lib/DialogForm/hooks.js +0 -152
  85. package/lib/Form/Context/FormConfigProvider.js +0 -52
  86. package/lib/Form/Context/index.js +0 -14
  87. package/lib/Form/FormItem/BasicItem.js +0 -95
  88. package/lib/Form/FormItem/Helper.js +0 -29
  89. package/lib/Form/FormItem/RegularFormItem.js +0 -27
  90. package/lib/Form/FormItem/UpFormItem.js +0 -45
  91. package/lib/Form/FormItem/hooks.js +0 -41
  92. package/lib/Form/FormItem/index.js +0 -24
  93. package/lib/Form/HFormConnect.js +0 -71
  94. package/lib/Form/InitSet.js +0 -19
  95. package/lib/Form/Label.js +0 -52
  96. package/lib/Form/config.js +0 -49
  97. package/lib/Form/hooks/index.js +0 -161
  98. package/lib/Form/hooks/useDefaultRender.js +0 -49
  99. package/lib/Form/hooks/useHForm.js +0 -196
  100. package/lib/Form/hooks/useInitConfigData.js +0 -172
  101. package/lib/Form/index.js +0 -105
  102. package/lib/Input/ButtonInput.js +0 -97
  103. package/lib/Input/ColorInput/Picker.js +0 -25
  104. package/lib/Input/ColorInput/data.js +0 -6
  105. package/lib/Input/ColorInput/index.js +0 -97
  106. package/lib/Input/InputNumber.js +0 -32
  107. package/lib/Input/SelectInput.js +0 -99
  108. package/lib/Input/defaultConfig.js +0 -13
  109. package/lib/Input/index.js +0 -26
  110. package/lib/PageHandler/ErrorComponent.js +0 -41
  111. package/lib/PageHandler/LoadingComponent.js +0 -22
  112. package/lib/PageHandler/index.js +0 -29
  113. package/lib/RadioGroup/index.js +0 -61
  114. package/lib/Select/components/AllSelect.js +0 -58
  115. package/lib/Select/components/CheckBoxOption.js +0 -19
  116. package/lib/Select/components/DropdownComponent.js +0 -47
  117. package/lib/Select/components/NoFindItem.js +0 -17
  118. package/lib/Select/components/NotFoundContent.js +0 -46
  119. package/lib/Select/defaultConfig.js +0 -34
  120. package/lib/Select/hooks/changeHooks.js +0 -197
  121. package/lib/Select/hooks/norHooks.js +0 -120
  122. package/lib/Select/index.js +0 -152
  123. package/lib/Select/utils.js +0 -39
  124. package/lib/Submit/index.js +0 -57
  125. package/lib/Switch/index.js +0 -62
  126. package/lib/TDPicker/RangePicker.js +0 -128
  127. package/lib/TDPicker/TimePicker.js +0 -47
  128. package/lib/TDPicker/hooks.js +0 -139
  129. package/lib/TDPicker/index.js +0 -50
  130. package/lib/TextArea/index.js +0 -33
  131. package/lib/Upload/Btn.js +0 -39
  132. package/lib/Upload/MediaTypeEle/TypeEle.js +0 -45
  133. package/lib/Upload/MediaTypeEle/index.js +0 -39
  134. package/lib/Upload/Preview/index.js +0 -25
  135. package/lib/Upload/UrlUpload/index.js +0 -136
  136. package/lib/Upload/enums.js +0 -9
  137. package/lib/Upload/hooks/change.js +0 -108
  138. package/lib/Upload/hooks/customRequest.js +0 -132
  139. package/lib/Upload/hooks/propsMaker.js +0 -37
  140. package/lib/Upload/index.js +0 -148
  141. package/lib/Upload/util.js +0 -38
  142. package/lib/config.js +0 -66
  143. package/lib/hooks/index.js +0 -77
  144. package/lib/index.css +0 -44
@@ -1,145 +0,0 @@
1
- // welcome to hoo hoo hoo
2
- import 'core-js/modules/es.object.keys.js';
3
- import 'core-js/modules/es.symbol.js';
4
- import 'core-js/modules/es.array.filter.js';
5
- import 'core-js/modules/es.object.to-string.js';
6
- import 'core-js/modules/es.object.get-own-property-descriptor.js';
7
- import 'core-js/modules/web.dom-collections.for-each.js';
8
- import 'core-js/modules/es.object.get-own-property-descriptors.js';
9
- import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
10
- import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
11
- import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
12
- import 'core-js/modules/es.number.constructor.js';
13
- import 'core-js/modules/es.function.name.js';
14
- import 'core-js/modules/es.array.map.js';
15
- import { jsxs, jsx } from 'react/jsx-runtime';
16
- import React, { useState, useImperativeHandle, useMemo } from 'react';
17
- import { useProps } from './hooks/propsMaker.js';
18
- import Preview from './Preview/index.js';
19
- import { useChange } from './hooks/change.js';
20
- import { Upload } from 'antd';
21
- import Btn from './Btn.js';
22
- import HFormConnect from '../Form/HFormConnect.js';
23
-
24
- var _excluded = ["value", "onChange", "listType", "exFiles", "maxCount", "maxRowNum", "onPreview", "request", "maxSize", "addFormat"];
25
- 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; }
26
- 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; }
27
- var Index = function Index(_ref, ref) {
28
- var _ref$value = _ref.value,
29
- value = _ref$value === void 0 ? [] : _ref$value,
30
- onChange = _ref.onChange,
31
- _ref$listType = _ref.listType,
32
- listType = _ref$listType === void 0 ? "picture-card" : _ref$listType,
33
- exFiles = _ref.exFiles,
34
- _ref$maxCount = _ref.maxCount,
35
- maxCount = _ref$maxCount === void 0 ? 1 : _ref$maxCount,
36
- _ref$maxRowNum = _ref.maxRowNum,
37
- maxRowNum = _ref$maxRowNum === void 0 ? 3 : _ref$maxRowNum,
38
- onPreview = _ref.onPreview,
39
- request = _ref.request,
40
- maxSize = _ref.maxSize,
41
- addFormat = _ref.addFormat,
42
- props = _objectWithoutProperties(_ref, _excluded);
43
- var matchProps = useProps({
44
- request: request,
45
- exFiles: exFiles,
46
- maxSize: maxSize
47
- });
48
- var _useState = useState({}),
49
- _useState2 = _slicedToArray(_useState, 2),
50
- previewModal = _useState2[0],
51
- setPreviewModal = _useState2[1];
52
- var change = useChange(_objectSpread(_objectSpread({}, matchProps), {}, {
53
- value: value,
54
- maxCount: maxCount,
55
- onChange: onChange
56
- }));
57
- useImperativeHandle(ref, function () {
58
- return {
59
- change: change
60
- };
61
- });
62
- var contentStyle = useMemo(function () {
63
- if (listType !== "picture-card") {
64
- return {};
65
- }
66
- return {
67
- width: 112 * maxRowNum,
68
- maxWidth: "100%"
69
- };
70
- }, [maxRowNum, listType]);
71
- var preview = function preview(file) {
72
- if (onPreview) {
73
- onPreview(file);
74
- return;
75
- }
76
- setPreviewModal({
77
- visible: true,
78
- file: file
79
- });
80
- };
81
- var maxNum = maxCount === 1 ? maxCount : Number.MAX_VALUE;
82
- var visible = previewModal.visible,
83
- previewFile = previewModal.file;
84
- addFormat === null || addFormat === void 0 || addFormat({
85
- float: {
86
- inputValue: function inputValue(item, initValue) {
87
- var _item$name = item.name,
88
- name = _item$name === void 0 ? "" : _item$name;
89
- var initFileList = initValue[name] || [];
90
- var relInitFileList = typeof initFileList === "string" ? [initFileList] : initFileList;
91
- var fileList = relInitFileList.map(function (url, index) {
92
- return {
93
- name: url,
94
- response: {
95
- url: url
96
- },
97
- status: "done",
98
- uid: "init-".concat(index),
99
- thumbUrl: url
100
- };
101
- });
102
- return _defineProperty({}, name, fileList);
103
- },
104
- outputValue: function outputValue(item, _outputValue) {
105
- var _item$name2 = item.name,
106
- valueName = _item$name2 === void 0 ? "" : _item$name2;
107
- var _outputValue$valueNam = _outputValue[valueName],
108
- itemVal = _outputValue$valueNam === void 0 ? [] : _outputValue$valueNam;
109
- var urls = itemVal.map(function (fileItem) {
110
- return fileItem.response.url;
111
- });
112
- return _defineProperty({}, valueName, maxCount === 1 ? urls[0] : urls);
113
- }
114
- }
115
- });
116
- return jsxs("div", {
117
- style: contentStyle,
118
- children: [jsx(Upload, _objectSpread(_objectSpread({
119
- listType: listType,
120
- maxCount: maxNum,
121
- fileList: value,
122
- onPreview: preview,
123
- onChange: change,
124
- beforeUpload: function beforeUpload() {
125
- return false;
126
- }
127
- }, props), {}, {
128
- children: jsx(Btn, {
129
- value: value,
130
- maxCount: maxCount,
131
- listType: listType
132
- })
133
- })), jsx(Preview, {
134
- visible: visible,
135
- file: previewFile,
136
- onCancel: function onCancel() {
137
- setPreviewModal({});
138
- }
139
- })]
140
- });
141
- };
142
- var HUpload = HFormConnect( /*#__PURE__*/React.forwardRef(Index));
143
-
144
- export { HUpload as default };
145
- // powered by hdj
package/es/Upload/util.js DELETED
@@ -1,34 +0,0 @@
1
- // welcome to hoo hoo hoo
2
- import 'core-js/modules/es.function.name.js';
3
- import 'core-js/modules/es.object.to-string.js';
4
- import 'core-js/modules/es.promise.js';
5
-
6
- var getFileExt = function getFileExt(file) {
7
- var name = file.name;
8
- var index = name.lastIndexOf(".");
9
- return name.substring(index + 1).toUpperCase();
10
- };
11
- var checkFileType = function checkFileType(file) {
12
- var exFiles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
13
- var exName = getFileExt(file);
14
- return exFiles.indexOf(exName) !== -1;
15
- };
16
- var checkFileSize = function checkFileSize(file) {
17
- var maxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
18
- var _file$size = file.size,
19
- size = _file$size === void 0 ? 0 : _file$size;
20
- return size <= maxSize;
21
- };
22
- var fileToBase64 = function fileToBase64(file) {
23
- return new Promise(function (resolve) {
24
- var reader = new FileReader();
25
- reader.readAsDataURL(file === null || file === void 0 ? void 0 : file.originFileObj);
26
- reader.onload = function (e) {
27
- var _e$target;
28
- resolve((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result);
29
- };
30
- });
31
- };
32
-
33
- export { checkFileSize, checkFileType, fileToBase64, getFileExt };
34
- // powered by hdj
package/es/config.js DELETED
@@ -1,65 +0,0 @@
1
- // welcome to hoo hoo hoo
2
- import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
3
- import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
4
- import moment from 'moment';
5
- import { fileToBase64 } from './Upload/util.js';
6
-
7
- var baseConfig = {
8
- fieldNames: {
9
- label: "label",
10
- value: "value"
11
- },
12
- valueCheckMap: {
13
- checked: 1,
14
- noChecked: 0
15
- },
16
- valueSwitchMap: {
17
- open: 1,
18
- close: 0
19
- },
20
- valueRangePickerValueMap: {
21
- start: function start(name) {
22
- return "".concat(name, "StartTime");
23
- },
24
- end: function end(name) {
25
- return "".concat(name, "EndTime");
26
- }
27
- },
28
- dateRanges: {
29
- 最近三天: [moment().subtract(2, "days").startOf("days"), moment()],
30
- 最近七天: [moment().subtract(6, "days").startOf("days"), moment()],
31
- 最近三十天: [moment().subtract(29, "days").startOf("days"), moment()]
32
- },
33
- uploadProps: {
34
- exFiles: ["JPG", "PNG", "JPEG", "GIF"],
35
- request: function () {
36
- var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
37
- var url;
38
- return _regeneratorRuntime.wrap(function _callee$(_context) {
39
- while (1) switch (_context.prev = _context.next) {
40
- case 0:
41
- _context.next = 2;
42
- return fileToBase64(file);
43
- case 2:
44
- url = _context.sent;
45
- return _context.abrupt("return", {
46
- url: url
47
- });
48
- case 4:
49
- case "end":
50
- return _context.stop();
51
- }
52
- }, _callee);
53
- }));
54
- function request(_x) {
55
- return _request.apply(this, arguments);
56
- }
57
- return request;
58
- }(),
59
- maxSize: 1024 * 1024 * 1.8
60
- },
61
- defaultComponent: {}
62
- };
63
-
64
- export { baseConfig };
65
- // powered by hdj
package/es/hooks/index.js DELETED
@@ -1,74 +0,0 @@
1
- // welcome to hoo hoo hoo
2
- import _typeof from '@babel/runtime-corejs3/helpers/typeof';
3
- import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
4
- import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
- import 'core-js/modules/es.array.map.js';
6
- import 'core-js/modules/es.array.concat.js';
7
- import 'core-js/modules/es.array.join.js';
8
- import 'core-js/modules/es.object.keys.js';
9
- import 'core-js/modules/es.object.to-string.js';
10
- import 'core-js/modules/web.dom-collections.for-each.js';
11
- import 'core-js/modules/es.symbol.to-primitive.js';
12
- import 'core-js/modules/es.date.to-primitive.js';
13
- import 'core-js/modules/es.symbol.js';
14
- import 'core-js/modules/es.symbol.description.js';
15
- import 'core-js/modules/es.number.constructor.js';
16
- import 'core-js/modules/es.array.filter.js';
17
- import 'core-js/modules/es.object.get-own-property-descriptor.js';
18
- import 'core-js/modules/es.object.get-own-property-descriptors.js';
19
- import { useMemo, useContext } from 'react';
20
- import { ConfigContext } from 'antd/es/config-provider';
21
- import { useFormConfigContext } from '../Form/Context/FormConfigProvider.js';
22
-
23
- 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; }
24
- 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; }
25
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
26
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
27
- var useChangeOptions = function useChangeOptions(_ref) {
28
- var options = _ref.options,
29
- _ref$fieldNames = _ref.fieldNames,
30
- fieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames;
31
- return useMemo(function () {
32
- return options === null || options === void 0 ? void 0 : options.map(function (item) {
33
- var _fieldNames$label = fieldNames.label,
34
- label = _fieldNames$label === void 0 ? "" : _fieldNames$label,
35
- _fieldNames$value = fieldNames.value,
36
- value = _fieldNames$value === void 0 ? "" : _fieldNames$value;
37
- var relLabel = item[label],
38
- relVal = item[value],
39
- oItem = _objectWithoutProperties(item, [label, value].map(_toPropertyKey));
40
- return _objectSpread(_objectSpread({}, oItem), {}, {
41
- label: relLabel,
42
- value: relVal
43
- });
44
- });
45
- }, [options]);
46
- };
47
- var useClassName = function useClassName(className) {
48
- var config = useContext(ConfigContext);
49
- return useMemo(function () {
50
- if (Array.isArray(className)) {
51
- var classNames = className.map(function (item) {
52
- return "".concat(config.getPrefixCls(), "-").concat(item);
53
- });
54
- return classNames.join(" ");
55
- }
56
- return "".concat(config.getPrefixCls(), "-").concat(className);
57
- }, [className]);
58
- };
59
- var useMatchConfigProps = function useMatchConfigProps(matchProps) {
60
- var globalConfig = useFormConfigContext();
61
- var keys = Object.keys(matchProps);
62
- var resultMatchProps = {};
63
- keys.forEach(function (key) {
64
- if (!matchProps[key]) {
65
- resultMatchProps[key] = globalConfig[key];
66
- return;
67
- }
68
- resultMatchProps[key] = matchProps[key];
69
- });
70
- return resultMatchProps;
71
- };
72
-
73
- export { useChangeOptions, useClassName, useMatchConfigProps };
74
- // powered by hdj
package/es/index.css DELETED
@@ -1,44 +0,0 @@
1
- .ant-hw-all-check-box .ant-select-item-option-active:not( .ant-select-item-option-disabled) {
2
- background-color: transparent;
3
- }
4
- .ant-hw-all-check-box .ant-select-item-option-selected:not( .ant-select-item-option-disabled) {
5
- background-color: #e6f7ff;
6
- }
7
- .ant-hw-all-check-box .ant-select-item-option:not( .ant-select-item-option-selected):hover {
8
- background-color: #f5f5f5;
9
- }
10
- .ant-hw-form-item-colon:after {
11
- position: relative;
12
- top: -0.5px;
13
- margin: 0 0 0 2px;
14
- content: ":";
15
- }
16
- .ant-hw-form-item-required:before {
17
- display: inline-block;
18
- margin-right: 4px;
19
- color: #ff4d4f;
20
- font-size: 14px;
21
- font-family: SimSun, sans-serif;
22
- line-height: 1;
23
- content: "*";
24
- }
25
- .ant-hw-form-base-item {
26
- display: -webkit-box;
27
- display: -webkit-flex;
28
- display: -ms-flexbox;
29
- display: flex;
30
- -webkit-box-align: center;
31
- -webkit-align-items: center;
32
- -ms-flex-align: center;
33
- align-items: center;
34
- min-height: 32px;
35
- }
36
- .ant-hw-color-box {
37
- width: 22px;
38
- height: 22px;
39
- border-radius: 4px;
40
- cursor: pointer;
41
- }
42
- .ant-hw-color-input-picker {
43
- box-shadow: 0 0 0 0 !important;
44
- }
@@ -1,45 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var antd = require('antd');
7
- var React = require('react');
8
- var index = require('../../hooks/index.js');
9
-
10
- var Index = function Index(_ref) {
11
- var value = _ref.value,
12
- onChange = _ref.onChange,
13
- children = _ref.children,
14
- propsValueCheckMap = _ref.valueMap;
15
- var _useMatchConfigProps = index.useMatchConfigProps({
16
- valueCheckMap: propsValueCheckMap
17
- }),
18
- _useMatchConfigProps$ = _useMatchConfigProps.valueCheckMap,
19
- valueCheckMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
20
- var checkedVal = React.useMemo(function () {
21
- var checked = valueCheckMap.checked;
22
- if (value === checked) {
23
- return true;
24
- }
25
- return false;
26
- }, [value]);
27
- var change = function change(e) {
28
- var checked = valueCheckMap.checked,
29
- noChecked = valueCheckMap.noChecked;
30
- var val = e.target.checked;
31
- var subVal = checked;
32
- if (!val) {
33
- subVal = noChecked;
34
- }
35
- onChange === null || onChange === void 0 || onChange(subVal);
36
- };
37
- return jsxRuntime.jsx(antd.Checkbox, {
38
- checked: checkedVal,
39
- onChange: change,
40
- children: children
41
- });
42
- };
43
-
44
- exports.default = Index;
45
- // powered by h
@@ -1,121 +0,0 @@
1
- 'use strict';
2
-
3
- require('core-js/modules/es.symbol.js');
4
- require('core-js/modules/es.object.get-own-property-descriptor.js');
5
- require('core-js/modules/es.object.get-own-property-descriptors.js');
6
- var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
7
- var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
8
- require('core-js/modules/es.object.to-string.js');
9
- require('core-js/modules/web.dom-collections.for-each.js');
10
- require('core-js/modules/es.object.keys.js');
11
- require('core-js/modules/es.array.filter.js');
12
- var React = require('react');
13
-
14
- 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; }
15
- 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; }
16
- var changValProvider = function changValProvider(_ref) {
17
- var value = _ref.value,
18
- options = _ref.options,
19
- _ref$valueMap = _ref.valueMap,
20
- valueMap = _ref$valueMap === void 0 ? {} : _ref$valueMap;
21
- var newVal = _objectSpread({}, value);
22
- var checked = valueMap.checked,
23
- noChecked = valueMap.noChecked;
24
- options === null || options === void 0 || options.forEach(function (item) {
25
- var itemVal = item.value;
26
- if (newVal[itemVal] !== checked) {
27
- newVal[itemVal] = noChecked;
28
- }
29
- });
30
- return newVal;
31
- };
32
- var useValueProvider = function useValueProvider(_ref2) {
33
- var value = _ref2.value,
34
- _ref2$valueMap = _ref2.valueMap,
35
- valueMap = _ref2$valueMap === void 0 ? {} : _ref2$valueMap,
36
- _ref2$keyInValue = _ref2.keyInValue,
37
- keyInValue = _ref2$keyInValue === void 0 ? true : _ref2$keyInValue,
38
- onChange = _ref2.onChange,
39
- options = _ref2.options;
40
- var _useState = React.useState({}),
41
- _useState2 = _slicedToArray(_useState, 2),
42
- val = _useState2[0],
43
- setVal = _useState2[1];
44
- var oldValueCheckMap = React.useMemo(function () {
45
- return {
46
- valueMap: valueMap
47
- };
48
- }, []);
49
- React.useEffect(function () {
50
- setVal(function (oldVal) {
51
- return changValProvider({
52
- value: oldVal,
53
- options: options,
54
- valueMap: oldValueCheckMap.valueMap
55
- });
56
- });
57
- }, [options]);
58
- React.useEffect(function () {
59
- var oldChecked = oldValueCheckMap.valueMap.checked;
60
- var checked = valueMap.checked,
61
- noChecked = valueMap.noChecked;
62
- setVal(function (oldVal) {
63
- var newVal = _objectSpread({}, oldVal);
64
- var keys = Object.keys(newVal);
65
- keys.forEach(function (key) {
66
- if (newVal[key] === oldChecked) {
67
- newVal[key] = checked;
68
- return;
69
- }
70
- newVal[key] = noChecked;
71
- });
72
- oldValueCheckMap.valueMap = valueMap;
73
- return newVal;
74
- });
75
- }, [valueMap]);
76
- React.useEffect(function () {
77
- var checked = oldValueCheckMap.valueMap.checked;
78
- if (!value) {
79
- return;
80
- }
81
- if (!Array.isArray(value)) {
82
- setVal(value);
83
- return;
84
- }
85
- setVal(function (oldVal) {
86
- var newVal = _objectSpread({}, oldVal);
87
- value.forEach(function (itemVal) {
88
- newVal[itemVal] = checked;
89
- });
90
- return newVal;
91
- });
92
- }, [value]);
93
- var change = function change(key, changeVal) {
94
- var checked = valueMap.checked,
95
- noChecked = valueMap.noChecked;
96
- var newVal = _objectSpread({}, val);
97
- newVal[key] = noChecked;
98
- if (changeVal === checked) {
99
- newVal[key] = checked;
100
- }
101
- if (!onChange) {
102
- setVal(newVal);
103
- return;
104
- }
105
- if (keyInValue) {
106
- onChange(newVal);
107
- return;
108
- }
109
- var subVal = Object.keys(newVal).filter(function (valKey) {
110
- return newVal[valKey] === checked;
111
- });
112
- onChange(subVal);
113
- };
114
- return {
115
- val: val,
116
- change: change
117
- };
118
- };
119
-
120
- exports.useValueProvider = useValueProvider;
121
- // powered by h
@@ -1,96 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
- require('core-js/modules/es.function.name.js');
7
- require('core-js/modules/es.array.map.js');
8
- require('core-js/modules/es.object.to-string.js');
9
- require('core-js/modules/web.dom-collections.for-each.js');
10
- require('core-js/modules/es.object.keys.js');
11
- require('core-js/modules/es.symbol.js');
12
- require('core-js/modules/es.array.filter.js');
13
- require('core-js/modules/es.object.get-own-property-descriptor.js');
14
- require('core-js/modules/es.object.get-own-property-descriptors.js');
15
- var jsxRuntime = require('react/jsx-runtime');
16
- var antd = require('antd');
17
- var hooks = require('./hooks.js');
18
- var index$1 = require('./CheckBox/index.js');
19
- var index = require('../hooks/index.js');
20
- var HFormConnect = require('../Form/HFormConnect.js');
21
-
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; }
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; }
24
- var Index = function Index(_ref) {
25
- var options = _ref.options,
26
- fieldNames = _ref.fieldNames,
27
- onChange = _ref.onChange,
28
- valueMap = _ref.valueMap,
29
- value = _ref.value,
30
- disabled = _ref.disabled,
31
- _ref$keyInValue = _ref.keyInValue,
32
- keyInValue = _ref$keyInValue === void 0 ? true : _ref$keyInValue,
33
- addFormat = _ref.addFormat;
34
- var _useMatchConfigProps = index.useMatchConfigProps({
35
- fieldNames: fieldNames,
36
- valueCheckMap: valueMap
37
- }),
38
- resultValueCheckMap = _useMatchConfigProps.valueCheckMap,
39
- resultFieldNames = _useMatchConfigProps.fieldNames;
40
- var checkOptions = index.useChangeOptions({
41
- options: options,
42
- fieldNames: resultFieldNames
43
- });
44
- var _useValueProvider = hooks.useValueProvider({
45
- options: checkOptions,
46
- onChange: onChange,
47
- valueMap: resultValueCheckMap,
48
- keyInValue: keyInValue,
49
- value: value
50
- }),
51
- val = _useValueProvider.val,
52
- change = _useValueProvider.change;
53
- addFormat === null || addFormat === void 0 || addFormat({
54
- float: {
55
- inputValue: function inputValue(item, initValue) {
56
- var _item$name = item.name,
57
- name = _item$name === void 0 ? "" : _item$name;
58
- var keys = checkOptions === null || checkOptions === void 0 ? void 0 : checkOptions.map(function (optItem) {
59
- return optItem.value;
60
- });
61
- var resultObj = {};
62
- keys === null || keys === void 0 || keys.forEach(function (key) {
63
- resultObj[key] = initValue[key];
64
- });
65
- return _defineProperty({}, name, resultObj);
66
- },
67
- outputValue: function outputValue(item, _outputValue) {
68
- var _item$name2 = item.name,
69
- name = _item$name2 === void 0 ? "" : _item$name2;
70
- var _outputValue$name = _outputValue[name],
71
- itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
72
- return _objectSpread({}, itemVal);
73
- }
74
- }
75
- });
76
- return jsxRuntime.jsx(antd.Space, {
77
- children: checkOptions === null || checkOptions === void 0 ? void 0 : checkOptions.map(function (item) {
78
- var label = item.label,
79
- itemVal = item.value;
80
- var checked = val[itemVal];
81
- return jsxRuntime.jsx(index$1.default, {
82
- value: checked,
83
- onChange: function onChange(changeVal) {
84
- change(itemVal, changeVal);
85
- },
86
- valueMap: valueMap,
87
- disabled: disabled,
88
- children: label
89
- }, itemVal);
90
- })
91
- });
92
- };
93
- var HCheckboxGroup = HFormConnect.default(Index);
94
-
95
- exports.default = HCheckboxGroup;
96
- // powered by h
@@ -1,30 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var antd = require('antd');
7
-
8
- var Footer = (function (_ref) {
9
- var onCancel = _ref.onCancel,
10
- onOk = _ref.onOk,
11
- confirmLoading = _ref.confirmLoading;
12
- return jsxRuntime.jsx(antd.Row, {
13
- justify: "end",
14
- children: jsxRuntime.jsxs(antd.Space, {
15
- size: "middle",
16
- children: [jsxRuntime.jsx(antd.Button, {
17
- onClick: onCancel,
18
- children: "\u5173\u95ED"
19
- }), jsxRuntime.jsx(antd.Button, {
20
- type: "primary",
21
- onClick: onOk,
22
- loading: confirmLoading,
23
- children: "\u786E\u5B9A"
24
- })]
25
- })
26
- });
27
- });
28
-
29
- exports.default = Footer;
30
- // powered by h
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var antd = require('antd');
7
- var icons = require('@ant-design/icons');
8
-
9
- var Title = (function (_ref) {
10
- var title = _ref.title,
11
- closable = _ref.closable,
12
- onCancel = _ref.onCancel;
13
- return jsxRuntime.jsxs(antd.Row, {
14
- justify: "space-between",
15
- children: [jsxRuntime.jsx("div", {
16
- children: title
17
- }), closable && jsxRuntime.jsx(icons.CloseOutlined, {
18
- onClick: onCancel
19
- })]
20
- });
21
- });
22
-
23
- exports.default = Title;
24
- // powered by h