@chaoswise/ui 3.0.14 → 3.0.16

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 (137) hide show
  1. package/lib/Ace/diff.js +1 -0
  2. package/lib/Antd5/_util/scrollTo.js +3 -3
  3. package/lib/Antd5/anchor/Anchor.js +3 -3
  4. package/lib/Antd5/breadcrumb/style/index.js +1 -1
  5. package/lib/Antd5/date-picker/style/token.js +1 -1
  6. package/lib/Antd5/dropdown/style/index.js +1 -1
  7. package/lib/Antd5/slider/style/index.js +2 -2
  8. package/lib/Antd5/table/hooks/useFilter/FilterDropdown.js +6 -6
  9. package/lib/Antd5/table/hooks/useFilter/index.js +3 -3
  10. package/lib/Antd5/table/hooks/useLazyKVMap.js +3 -3
  11. package/lib/Antd5/table/hooks/useSelection.js +3 -3
  12. package/lib/Antd5/theme/useToken.js +4 -3
  13. package/lib/Antd5/tree/style/index.js +7 -6
  14. package/lib/Badge/index.js +1 -1
  15. package/lib/BasicLayout/style/sider.js +3 -4
  16. package/lib/CWCascader/rc-cascader/utils/warningPropsUtil.js +3 -3
  17. package/lib/CWColorPicker/SketchPicker/components/common/ColorWrap.js +1 -1
  18. package/lib/CWColorPicker/SketchPicker/components/common/Hue.js +1 -1
  19. package/lib/CWColorPicker/SketchPicker/components/common/Raised.js +1 -1
  20. package/lib/CWColorPicker/SketchPicker/components/common/Saturation.js +1 -1
  21. package/lib/CWColorPicker/SketchPicker/components/sketch/index.js +1 -1
  22. package/lib/CWColorPicker/SketchPicker/helpers/color.js +1 -1
  23. package/lib/CWRangePicker/Refresh/index.style.js +10 -5
  24. package/lib/CWRangePicker/index.js +2 -2
  25. package/lib/CWRangePicker/index.style.js +0 -6
  26. package/lib/CWTree/index.js +3 -3
  27. package/lib/CWTree/utils/index.js +4 -3
  28. package/lib/Collapse/index.js +1 -1
  29. package/lib/ConfigProvider/ConfigProvider.js +7 -4
  30. package/lib/ConfigProvider/customTheme.js +1 -22
  31. package/lib/ConfigProvider/customToken.js +0 -1
  32. package/lib/DateRangePicker/index.js +2 -0
  33. package/lib/Documentation/Tocify.js +1 -1
  34. package/lib/Drawer/index.js +1 -1
  35. package/lib/EchartsArea/index.js +2 -2
  36. package/lib/EchartsBar/index.js +2 -2
  37. package/lib/EchartsBarRow/index.js +0 -2
  38. package/lib/EchartsBase/index.js +14 -14
  39. package/lib/EchartsLine/index.js +2 -2
  40. package/lib/EchartsPie/index.js +2 -3
  41. package/lib/EchartsRing/index.js +2 -2
  42. package/lib/Empty/index.js +1 -1
  43. package/lib/FilterDropDown/DragList.js +2 -1
  44. package/lib/Flow/BasicLayout/Chain.js +3 -3
  45. package/lib/Flow/BasicLayout/util.js +3 -3
  46. package/lib/Form/FormItem.js +3 -1
  47. package/lib/Form/hook/useForm3.js +3 -3
  48. package/lib/Form/index.js +1 -1
  49. package/lib/Formily/FieldList/index.js +43 -0
  50. package/lib/Formily/Form/index.js +2 -0
  51. package/lib/Formily/FormButtonGroup/index.js +2 -0
  52. package/lib/Formily/FormItem/index.js +90 -0
  53. package/lib/Formily/FormItem/items/Checkbox.js +13 -0
  54. package/lib/Formily/FormItem/items/DatePicker.js +121 -0
  55. package/lib/Formily/FormItem/items/Input.js +13 -0
  56. package/lib/Formily/FormItem/items/NumberPicker.js +9 -0
  57. package/lib/Formily/FormItem/items/Password.js +70 -0
  58. package/lib/Formily/FormItem/items/Radio.js +13 -0
  59. package/lib/Formily/FormItem/items/Range.js +82 -0
  60. package/lib/Formily/FormItem/items/Rating.js +8 -0
  61. package/lib/Formily/FormItem/items/Select.js +8 -0
  62. package/lib/Formily/FormItem/items/Switch.js +9 -0
  63. package/lib/Formily/FormItem/items/Tansfer.js +9 -0
  64. package/lib/Formily/FormItem/items/TimePicker.js +44 -0
  65. package/lib/Formily/FormItem/items/Upload.js +260 -0
  66. package/lib/Formily/FormItem/items/formItemWrapper.js +17 -0
  67. package/lib/Formily/FormItem/items/shared.js +140 -0
  68. package/lib/Formily/FormPath/index.js +2 -0
  69. package/lib/Formily/MegaLayout/index.js +24 -0
  70. package/lib/Formily/Reset/index.js +2 -0
  71. package/lib/Formily/Submit/index.js +2 -0
  72. package/lib/Formily/context.js +3 -0
  73. package/lib/Formily/formily/index.js +22 -0
  74. package/lib/Formily/index.js +5 -0
  75. package/lib/Formily/subscribeFields/index.js +46 -0
  76. package/lib/Header/UserSetting/utils.js +5 -4
  77. package/lib/Joyride/List.js +3 -3
  78. package/lib/Joyride/index.js +3 -3
  79. package/lib/Modal/Modal.js +1 -1
  80. package/lib/Modal/index.js +1 -1
  81. package/lib/Pagination/index.js +1 -1
  82. package/lib/QuickTransfer/index.js +5 -5
  83. package/lib/QuickTransfer/utils.js +32 -23
  84. package/lib/RangePicker/components/ExtraQuickSelect.js +51 -0
  85. package/lib/RangePicker/components/ExtraTimeFooter.js +71 -0
  86. package/lib/RangePicker/index.js +469 -2
  87. package/lib/RangePicker/index.style.js +110 -0
  88. package/lib/RangePicker/utils/index.js +171 -0
  89. package/lib/ScrollLoad/index.js +7 -2
  90. package/lib/SiderMenu/index.js +14 -14
  91. package/lib/SingleSpa/system/systemjs-css.js +3 -3
  92. package/lib/ThemeProvider/main.js +1 -0
  93. package/lib/TimeRangeSlider/Refresh/index.js +163 -0
  94. package/lib/TimeRangeSlider/TimeRangeSliderCmp/assets/Limit.js +126 -0
  95. package/lib/TimeRangeSlider/TimeRangeSliderCmp/assets/Limit.svg +50 -0
  96. package/lib/TimeRangeSlider/TimeRangeSliderCmp/assets/LimitAreaSvg.js +110 -0
  97. package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/BottomSlider/BottomPlaceholder.js +99 -0
  98. package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/BottomSlider/BottomTimeDateProcess.js +36 -0
  99. package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/BottomSlider/index.js +56 -0
  100. package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/TopSlider/TopDateProcess.js +32 -0
  101. package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/TopSlider/TopPlaceholder.js +54 -0
  102. package/lib/TimeRangeSlider/TimeRangeSliderCmp/components/TopSlider/index.js +47 -0
  103. package/lib/TimeRangeSlider/TimeRangeSliderCmp/hooks/useHover.js +31 -0
  104. package/lib/TimeRangeSlider/TimeRangeSliderCmp/hooks/useMouse.js +410 -0
  105. package/lib/TimeRangeSlider/TimeRangeSliderCmp/index.js +72 -0
  106. package/lib/TimeRangeSlider/TimeRangeSliderCmp/utils/index.js +255 -0
  107. package/lib/TimeRangeSlider/TimeSpan/index.js +93 -0
  108. package/lib/TimeRangeSlider/assets/Calendar.js +15 -0
  109. package/lib/TimeRangeSlider/assets/Calendar2.js +15 -0
  110. package/lib/TimeRangeSlider/assets/Recover.js +18 -0
  111. package/lib/TimeRangeSlider/assets/Refresh1.js +14 -0
  112. package/lib/TimeRangeSlider/assets/Refresh2.js +14 -0
  113. package/lib/TimeRangeSlider/assets/Refresh3.js +14 -0
  114. package/lib/TimeRangeSlider/assets/live.js +19 -0
  115. package/lib/TimeRangeSlider/assets/more.js +23 -0
  116. package/lib/TimeRangeSlider/index.js +562 -0
  117. package/lib/TimeRangeSlider/locale/en_US.js +31 -0
  118. package/lib/TimeRangeSlider/locale/index.js +11 -0
  119. package/lib/TimeRangeSlider/locale/zh_CN.js +31 -0
  120. package/lib/TimeRangeSlider/locale/zh_TW.js +31 -0
  121. package/lib/TimeRangeSlider/styles/index.style.js +64 -0
  122. package/lib/TimeRangeSlider/styles/refresh.style.js +38 -0
  123. package/lib/TimeRangeSlider/styles/timeRangeSliderBottom.style.js +125 -0
  124. package/lib/TimeRangeSlider/styles/timeRangeSliderTop.style.js +81 -0
  125. package/lib/TimeRangeSlider/styles/timeSpan.style.js +22 -0
  126. package/lib/TimeRangeSlider/utils/index.js +737 -0
  127. package/lib/UniversalLayout/index.js +4 -4
  128. package/lib/antd-style/factories/createThemeProvider/AntdProvider.js +5 -1
  129. package/lib/antd-style/functions/extractStaticStyle.js +1 -1
  130. package/lib/antd-style/hooks/useAntdToken.js +1 -1
  131. package/lib/antd-style/hooks/useResponsive.js +1 -1
  132. package/lib/antd-style/utils/css.js +3 -2
  133. package/lib/locales/en_US.json +1 -1
  134. package/lib/locales/zh_CN.json +1 -1
  135. package/lib/locales/zh_TW.json +1 -1
  136. package/lib/useLocale/index.js +20 -0
  137. package/package.json +5 -1
@@ -0,0 +1,121 @@
1
+ import _DatePicker from "@chaoswise/ui/lib/DatePicker";
2
+ var __extends = this && this.__extends || function () {
3
+ var _extendStatics = function extendStatics(d, b) {
4
+ _extendStatics = Object.setPrototypeOf || {
5
+ __proto__: []
6
+ } instanceof Array && function (d, b) {
7
+ d.__proto__ = b;
8
+ } || function (d, b) {
9
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
10
+ };
11
+ return _extendStatics(d, b);
12
+ };
13
+ return function (d, b) {
14
+ _extendStatics(d, b);
15
+ function __() {
16
+ this.constructor = d;
17
+ }
18
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19
+ };
20
+ }();
21
+ var __assign = this && this.__assign || function () {
22
+ __assign = Object.assign || function (t) {
23
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
24
+ s = arguments[i];
25
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
26
+ }
27
+ return t;
28
+ };
29
+ return __assign.apply(this, arguments);
30
+ };
31
+ import React from 'react';
32
+ import { connect } from '@formily/react-schema-renderer';
33
+ import moment from 'moment';
34
+ import formItemWrapper from './formItemWrapper';
35
+ var WrapperedAntdDatePicker = formItemWrapper(_DatePicker);
36
+ import { mapStyledProps, mapTextComponent, compose, isStr, isArr } from './shared';
37
+ var YearPicker = function (_super) {
38
+ __extends(YearPicker, _super);
39
+ function YearPicker() {
40
+ return _super !== null && _super.apply(this, arguments) || this;
41
+ }
42
+ YearPicker.prototype.render = function () {
43
+ return /*#__PURE__*/React.createElement(WrapperedAntdDatePicker, __assign({}, this.props, {
44
+ picker: 'year'
45
+ }));
46
+ };
47
+ return YearPicker;
48
+ }(React.Component);
49
+ var transformMoment = function transformMoment(value, format) {
50
+ if (format === void 0) {
51
+ format = 'YYYY-MM-DD HH:mm:ss';
52
+ }
53
+ if (value === '') return undefined;
54
+ return value && value.format ? value.format(format) : value;
55
+ };
56
+ var mapMomentValue = function mapMomentValue(props, fieldProps) {
57
+ var value = props.value,
58
+ _a = props.showTime,
59
+ showTime = _a === void 0 ? false : _a,
60
+ format = props.format;
61
+ if (!fieldProps.editable) return props;
62
+ try {
63
+ if (isStr(value) && value) {
64
+ props.value = moment(value, format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'));
65
+ } else if (isArr(value) && value.length) {
66
+ props.value = value.map(function (item) {
67
+ return item && moment(item, format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD')) || '';
68
+ });
69
+ }
70
+ } catch (e) {
71
+ throw new Error(e);
72
+ }
73
+ return props;
74
+ };
75
+ export var DatePicker = connect({
76
+ getValueFromEvent: function getValueFromEvent(_, value) {
77
+ var props = this.props || {};
78
+ return transformMoment(value, props.format || (props.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'));
79
+ },
80
+ getProps: compose(mapStyledProps, mapMomentValue),
81
+ getComponent: mapTextComponent
82
+ })(formItemWrapper(_DatePicker));
83
+ DatePicker.RangePicker = connect({
84
+ getValueFromEvent: function getValueFromEvent(_, _a) {
85
+ var startDate = _a[0],
86
+ endDate = _a[1];
87
+ var props = this.props || {};
88
+ var format = props.format || (props.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD');
89
+ return [transformMoment(startDate, format), transformMoment(endDate, format)];
90
+ },
91
+ getProps: compose(mapStyledProps, mapMomentValue),
92
+ getComponent: mapTextComponent
93
+ })(formItemWrapper(_DatePicker.RangePicker));
94
+ DatePicker.MonthPicker = connect({
95
+ getValueFromEvent: function getValueFromEvent(_, value) {
96
+ return transformMoment(value);
97
+ },
98
+ getProps: compose(mapStyledProps, mapMomentValue),
99
+ getComponent: mapTextComponent
100
+ })(formItemWrapper(_DatePicker.MonthPicker));
101
+ DatePicker.WeekPicker = connect({
102
+ getValueFromEvent: function getValueFromEvent(_, value) {
103
+ return transformMoment(value, 'gggg-wo');
104
+ },
105
+ getProps: compose(mapStyledProps, function (props) {
106
+ if (isStr(props.value) && props.value) {
107
+ var parsed = props.value.match(/\D*(\d+)\D*(\d+)\D*/) || ['', '', ''];
108
+ props.value = moment(parsed[1], 'YYYY').add(parsed[2] - 1, 'weeks');
109
+ }
110
+ return props;
111
+ }),
112
+ getComponent: mapTextComponent
113
+ })(formItemWrapper(_DatePicker.WeekPicker));
114
+ DatePicker.YearPicker = connect({
115
+ getValueFromEvent: function getValueFromEvent(_, value) {
116
+ return transformMoment(value, 'YYYY');
117
+ },
118
+ getProps: compose(mapStyledProps, mapMomentValue),
119
+ getComponent: mapTextComponent
120
+ })(YearPicker);
121
+ export default DatePicker;
@@ -0,0 +1,13 @@
1
+ import _Input from "@chaoswise/ui/lib/Input";
2
+ import { connect } from '@formily/react-schema-renderer';
3
+ import formItemWrapper from './formItemWrapper';
4
+ import { acceptEnum, mapStyledProps, mapTextComponent } from '@formily/antd-components/esm/shared';
5
+ export var Input = connect({
6
+ getProps: mapStyledProps,
7
+ getComponent: mapTextComponent
8
+ })(acceptEnum(formItemWrapper(_Input)));
9
+ Input.TextArea = connect({
10
+ getProps: mapStyledProps,
11
+ getComponent: mapTextComponent
12
+ })(acceptEnum(formItemWrapper(_Input.TextArea)));
13
+ export default Input;
@@ -0,0 +1,9 @@
1
+ import _InputNumber from "@chaoswise/ui/lib/InputNumber";
2
+ import { connect } from '@formily/react-schema-renderer';
3
+ import { acceptEnum, mapStyledProps, mapTextComponent } from './shared';
4
+ import formItemWrapper from './formItemWrapper';
5
+ export var NumberPicker = connect({
6
+ getProps: mapStyledProps,
7
+ getComponent: mapTextComponent
8
+ })(acceptEnum(formItemWrapper(_InputNumber)));
9
+ export default NumberPicker;
@@ -0,0 +1,70 @@
1
+ import _Input from "@chaoswise/ui/lib/Input";
2
+ var __makeTemplateObject = this && this.__makeTemplateObject || function (cooked, raw) {
3
+ if (Object.defineProperty) {
4
+ Object.defineProperty(cooked, "raw", {
5
+ value: raw
6
+ });
7
+ } else {
8
+ cooked.raw = raw;
9
+ }
10
+ return cooked;
11
+ };
12
+ var __assign = this && this.__assign || function () {
13
+ __assign = Object.assign || function (t) {
14
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
15
+ s = arguments[i];
16
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
17
+ }
18
+ return t;
19
+ };
20
+ return __assign.apply(this, arguments);
21
+ };
22
+ var __rest = this && this.__rest || function (s, e) {
23
+ var t = {};
24
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
25
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
27
+ }
28
+ return t;
29
+ };
30
+ import React from 'react';
31
+ import { connect } from '@formily/react-schema-renderer';
32
+ import { PasswordStrength } from '@formily/react-shared-components';
33
+ import styled from 'styled-components';
34
+ import { mapStyledProps } from './shared';
35
+ import formItemWrapper from './formItemWrapper';
36
+ var InputPassword = formItemWrapper(_Input.Password);
37
+ export var Password = connect({
38
+ getProps: mapStyledProps
39
+ })(styled(function (props) {
40
+ var value = props.value,
41
+ className = props.className,
42
+ checkStrength = props.checkStrength,
43
+ others = __rest(props, ["value", "className", "checkStrength"]);
44
+ return /*#__PURE__*/React.createElement("span", {
45
+ className: className
46
+ }, /*#__PURE__*/React.createElement(InputPassword, __assign({}, others, {
47
+ value: value
48
+ })), checkStrength && ( /*#__PURE__*/React.createElement(PasswordStrength, {
49
+ value: String(value)
50
+ }, function (score) {
51
+ return /*#__PURE__*/React.createElement("div", {
52
+ className: "password-strength-wrapper"
53
+ }, /*#__PURE__*/React.createElement("div", {
54
+ className: "div-1 div"
55
+ }), /*#__PURE__*/React.createElement("div", {
56
+ className: "div-2 div"
57
+ }), /*#__PURE__*/React.createElement("div", {
58
+ className: "div-3 div"
59
+ }), /*#__PURE__*/React.createElement("div", {
60
+ className: "div-4 div"
61
+ }), /*#__PURE__*/React.createElement("div", {
62
+ className: "password-strength-bar",
63
+ style: {
64
+ clipPath: "polygon(0 0," + score + "% 0," + score + "% 100%,0 100%)"
65
+ }
66
+ }));
67
+ })));
68
+ })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .password-strength-wrapper {\n background: #e0e0e0;\n margin-bottom: 3px;\n position: relative;\n .div {\n position: absolute;\n z-index: 1;\n height: 8px;\n top: 0;\n background: #fff;\n width: 1px;\n transform: translate(-50%, 0);\n }\n .div-1 {\n left: 20%;\n }\n .div-2 {\n left: 40%;\n }\n .div-3 {\n left: 60%;\n }\n .div-4 {\n left: 80%;\n }\n .password-strength-bar {\n position: relative;\n background-image: -webkit-linear-gradient(left, #ff5500, #ff9300);\n transition: all 0.35s ease-in-out;\n height: 8px;\n width: 100%;\n margin-top: 5px;\n }\n }\n"], ["\n .password-strength-wrapper {\n background: #e0e0e0;\n margin-bottom: 3px;\n position: relative;\n .div {\n position: absolute;\n z-index: 1;\n height: 8px;\n top: 0;\n background: #fff;\n width: 1px;\n transform: translate(-50%, 0);\n }\n .div-1 {\n left: 20%;\n }\n .div-2 {\n left: 40%;\n }\n .div-3 {\n left: 60%;\n }\n .div-4 {\n left: 80%;\n }\n .password-strength-bar {\n position: relative;\n background-image: -webkit-linear-gradient(left, #ff5500, #ff9300);\n transition: all 0.35s ease-in-out;\n height: 8px;\n width: 100%;\n margin-top: 5px;\n }\n }\n"]))));
69
+ export default Password;
70
+ var templateObject_1;
@@ -0,0 +1,13 @@
1
+ import _Radio from "@chaoswise/ui/lib/Radio";
2
+ import { connect } from '@formily/react-schema-renderer';
3
+ import { transformDataSourceKey, mapStyledProps, mapTextComponent } from './shared';
4
+ import formItemWrapper from './formItemWrapper';
5
+ export var Radio = connect({
6
+ valueName: 'checked',
7
+ getProps: mapStyledProps
8
+ })(formItemWrapper(_Radio));
9
+ Radio.Group = connect({
10
+ getProps: mapStyledProps,
11
+ getComponent: mapTextComponent
12
+ })(transformDataSourceKey(formItemWrapper(_Radio.Group), 'options'));
13
+ export default Radio;
@@ -0,0 +1,82 @@
1
+ import _Slider from "@chaoswise/ui/lib/Slider";
2
+ var __extends = this && this.__extends || function () {
3
+ var _extendStatics = function extendStatics(d, b) {
4
+ _extendStatics = Object.setPrototypeOf || {
5
+ __proto__: []
6
+ } instanceof Array && function (d, b) {
7
+ d.__proto__ = b;
8
+ } || function (d, b) {
9
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
10
+ };
11
+ return _extendStatics(d, b);
12
+ };
13
+ return function (d, b) {
14
+ _extendStatics(d, b);
15
+ function __() {
16
+ this.constructor = d;
17
+ }
18
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19
+ };
20
+ }();
21
+ var __assign = this && this.__assign || function () {
22
+ __assign = Object.assign || function (t) {
23
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
24
+ s = arguments[i];
25
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
26
+ }
27
+ return t;
28
+ };
29
+ return __assign.apply(this, arguments);
30
+ };
31
+ var __rest = this && this.__rest || function (s, e) {
32
+ var t = {};
33
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
34
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
35
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
36
+ }
37
+ return t;
38
+ };
39
+ import React from 'react';
40
+ import { connect } from '@formily/react-schema-renderer';
41
+ import { mapStyledProps } from './shared';
42
+ import formItemWrapper from './formItemWrapper';
43
+ var WrapperSlider = formItemWrapper(_Slider);
44
+ export var Range = connect({
45
+ defaultProps: {
46
+ style: {
47
+ width: 320
48
+ }
49
+ },
50
+ getProps: mapStyledProps
51
+ })(function (_super) {
52
+ __extends(Component, _super);
53
+ function Component() {
54
+ return _super !== null && _super.apply(this, arguments) || this;
55
+ }
56
+ Component.prototype.render = function () {
57
+ var _a = this.props,
58
+ onChange = _a.onChange,
59
+ value = _a.value,
60
+ min = _a.min,
61
+ max = _a.max,
62
+ marks = _a.marks,
63
+ rest = __rest(_a, ["onChange", "value", "min", "max", "marks"]);
64
+ var newMarks = {};
65
+ if (Array.isArray(marks)) {
66
+ marks.forEach(function (mark) {
67
+ newMarks[mark] = mark;
68
+ });
69
+ } else {
70
+ newMarks = marks;
71
+ }
72
+ return /*#__PURE__*/React.createElement(WrapperSlider, __assign({}, rest, {
73
+ onChange: onChange,
74
+ value: value,
75
+ min: min,
76
+ max: max,
77
+ marks: newMarks
78
+ }));
79
+ };
80
+ return Component;
81
+ }(React.Component));
82
+ export default Range;
@@ -0,0 +1,8 @@
1
+ import _Rate from "@chaoswise/ui/lib/Rate";
2
+ import { connect } from '@formily/react-schema-renderer';
3
+ import { mapStyledProps } from './shared';
4
+ import formItemWrapper from './formItemWrapper';
5
+ export var Rating = connect({
6
+ getProps: mapStyledProps
7
+ })(formItemWrapper(_Rate));
8
+ export default Rating;
@@ -0,0 +1,8 @@
1
+ import { connect } from '@formily/react-schema-renderer';
2
+ import { Select as AntdSelect, mapStyledProps, mapTextComponent } from './shared';
3
+ import formItemWrapper from './formItemWrapper';
4
+ export var Select = connect({
5
+ getProps: mapStyledProps,
6
+ getComponent: mapTextComponent
7
+ })(formItemWrapper(AntdSelect));
8
+ export default Select;
@@ -0,0 +1,9 @@
1
+ import _Switch from "@chaoswise/ui/lib/Switch";
2
+ import { connect } from '@formily/react-schema-renderer';
3
+ import { acceptEnum, mapStyledProps } from './shared';
4
+ import formItemWrapper from './formItemWrapper';
5
+ export var Switch = connect({
6
+ valueName: 'checked',
7
+ getProps: mapStyledProps
8
+ })(acceptEnum(formItemWrapper(_Switch)));
9
+ export default Switch;
@@ -0,0 +1,9 @@
1
+ import _Transfer from "@chaoswise/ui/lib/Transfer";
2
+ import { connect } from '@formily/react-schema-renderer';
3
+ import { mapStyledProps } from './shared';
4
+ import formItemWrapper from './formItemWrapper';
5
+ export var Transfer = connect({
6
+ getProps: mapStyledProps,
7
+ valueName: 'targetKeys'
8
+ })(formItemWrapper(_Transfer));
9
+ export default Transfer;
@@ -0,0 +1,44 @@
1
+ import _TimePicker from "@chaoswise/ui/lib/TimePicker";
2
+ import { connect } from '@formily/react-schema-renderer';
3
+ import moment from 'moment';
4
+ import { mapStyledProps, mapTextComponent, compose, isStr, isArr } from './shared';
5
+ import formItemWrapper from './formItemWrapper';
6
+ var transformMoment = function transformMoment(value) {
7
+ if (value === '') return undefined;
8
+ return value;
9
+ };
10
+ var mapMomentValue = function mapMomentValue(props, fieldProps) {
11
+ var value = props.value,
12
+ _a = props.format,
13
+ format = _a === void 0 ? 'HH:mm:ss' : _a;
14
+ if (!fieldProps.editable) return props;
15
+ try {
16
+ if (isStr(value) && value) {
17
+ props.value = moment(value, format);
18
+ } else if (isArr(value) && value.length) {
19
+ props.value = value.map(function (item) {
20
+ return item && moment(item, format) || '';
21
+ });
22
+ }
23
+ } catch (e) {
24
+ throw new Error(e);
25
+ }
26
+ return props;
27
+ };
28
+ export var TimePicker = connect({
29
+ getValueFromEvent: function getValueFromEvent(_, value) {
30
+ return transformMoment(value);
31
+ },
32
+ getProps: compose(mapStyledProps, mapMomentValue),
33
+ getComponent: mapTextComponent
34
+ })(formItemWrapper(_TimePicker));
35
+ TimePicker.RangePicker = connect({
36
+ getValueFromEvent: function getValueFromEvent(_, _a) {
37
+ var startDate = _a[0],
38
+ endDate = _a[1];
39
+ return [transformMoment(startDate), transformMoment(endDate)];
40
+ },
41
+ getProps: compose(mapStyledProps, mapMomentValue),
42
+ getComponent: mapTextComponent
43
+ })(formItemWrapper(_TimePicker.RangePicker));
44
+ export default TimePicker;
@@ -0,0 +1,260 @@
1
+ import _Button from "@chaoswise/ui/lib/Button";
2
+ import _Upload from "@chaoswise/ui/lib/Upload";
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var __makeTemplateObject = this && this.__makeTemplateObject || function (cooked, raw) {
5
+ if (Object.defineProperty) {
6
+ Object.defineProperty(cooked, "raw", {
7
+ value: raw
8
+ });
9
+ } else {
10
+ cooked.raw = raw;
11
+ }
12
+ return cooked;
13
+ };
14
+ var __extends = this && this.__extends || function () {
15
+ var _extendStatics = function extendStatics(d, b) {
16
+ _extendStatics = Object.setPrototypeOf || {
17
+ __proto__: []
18
+ } instanceof Array && function (d, b) {
19
+ d.__proto__ = b;
20
+ } || function (d, b) {
21
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
22
+ };
23
+ return _extendStatics(d, b);
24
+ };
25
+ return function (d, b) {
26
+ _extendStatics(d, b);
27
+ function __() {
28
+ this.constructor = d;
29
+ }
30
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31
+ };
32
+ }();
33
+ var __assign = this && this.__assign || function () {
34
+ __assign = Object.assign || function (t) {
35
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
36
+ s = arguments[i];
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
38
+ }
39
+ return t;
40
+ };
41
+ return __assign.apply(this, arguments);
42
+ };
43
+ var __rest = this && this.__rest || function (s, e) {
44
+ var t = {};
45
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
46
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
47
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
48
+ }
49
+ return t;
50
+ };
51
+ var __spreadArrays = this && this.__spreadArrays || function () {
52
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
53
+ for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
54
+ return r;
55
+ };
56
+ var _a;
57
+ import React from 'react';
58
+ import { connect } from '@formily/react-schema-renderer';
59
+ import styled from 'styled-components';
60
+ import { toArr, isArr, isEqual, mapStyledProps } from './shared';
61
+ import { LoadingOutlined, PlusOutlined, UploadOutlined, InboxOutlined } from '@ant-design/icons';
62
+ import formItemWrapper from './formItemWrapper';
63
+ var UploadDragger = formItemWrapper(_Upload.Dragger);
64
+ var AntdUpload = formItemWrapper(_Upload);
65
+ var exts = [{
66
+ ext: /\.docx?$/i,
67
+ icon: '//img.alicdn.com/tfs/TB1n8jfr1uSBuNjy1XcXXcYjFXa-200-200.png'
68
+ }, {
69
+ ext: /\.pptx?$/i,
70
+ icon: '//img.alicdn.com/tfs/TB1ItgWr_tYBeNjy1XdXXXXyVXa-200-200.png'
71
+ }, {
72
+ ext: /\.jpe?g$/i,
73
+ icon: '//img.alicdn.com/tfs/TB1wrT5r9BYBeNjy0FeXXbnmFXa-200-200.png'
74
+ }, {
75
+ ext: /\.pdf$/i,
76
+ icon: '//img.alicdn.com/tfs/TB1GwD8r9BYBeNjy0FeXXbnmFXa-200-200.png'
77
+ }, {
78
+ ext: /\.png$/i,
79
+ icon: '//img.alicdn.com/tfs/TB1BHT5r9BYBeNjy0FeXXbnmFXa-200-200.png'
80
+ }, {
81
+ ext: /\.eps$/i,
82
+ icon: '//img.alicdn.com/tfs/TB1G_iGrVOWBuNjy0FiXXXFxVXa-200-200.png'
83
+ }, {
84
+ ext: /\.ai$/i,
85
+ icon: '//img.alicdn.com/tfs/TB1B2cVr_tYBeNjy1XdXXXXyVXa-200-200.png'
86
+ }, {
87
+ ext: /\.gif$/i,
88
+ icon: '//img.alicdn.com/tfs/TB1DTiGrVOWBuNjy0FiXXXFxVXa-200-200.png'
89
+ }, {
90
+ ext: /\.svg$/i,
91
+ icon: '//img.alicdn.com/tfs/TB1uUm9rY9YBuNjy0FgXXcxcXXa-200-200.png'
92
+ }, {
93
+ ext: /\.xlsx?$/i,
94
+ icon: '//img.alicdn.com/tfs/TB1any1r1OSBuNjy0FdXXbDnVXa-200-200.png'
95
+ }, {
96
+ ext: /\.psd?$/i,
97
+ icon: '//img.alicdn.com/tfs/TB1_nu1r1OSBuNjy0FdXXbDnVXa-200-200.png'
98
+ }, {
99
+ ext: /\.(wav|aif|aiff|au|mp1|mp2|mp3|ra|rm|ram|mid|rmi)$/i,
100
+ icon: '//img.alicdn.com/tfs/TB1jPvwr49YBuNjy0FfXXXIsVXa-200-200.png'
101
+ }, {
102
+ ext: /\.(avi|wmv|mpg|mpeg|vob|dat|3gp|mp4|mkv|rm|rmvb|mov|flv)$/i,
103
+ icon: '//img.alicdn.com/tfs/TB1FrT5r9BYBeNjy0FeXXbnmFXa-200-200.png'
104
+ }, {
105
+ ext: /\.(zip|rar|arj|z|gz|iso|jar|ace|tar|uue|dmg|pkg|lzh|cab)$/i,
106
+ icon: '//img.alicdn.com/tfs/TB10jmfr29TBuNjy0FcXXbeiFXa-200-200.png'
107
+ }, {
108
+ ext: /\.[^.]+$/i,
109
+ icon: '//img.alicdn.com/tfs/TB10.R4r3mTBuNjy1XbXXaMrVXa-200-200.png'
110
+ }];
111
+ var UploadPlaceholder = styled(function (props) {
112
+ return /*#__PURE__*/React.createElement("div", null, props.loading ? /*#__PURE__*/React.createElement(LoadingOutlined, null) : /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
113
+ className: 'ant-upload-text'
114
+ }, "\u4E0A\u4F20"));
115
+ })(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
116
+ var testOpts = function testOpts(ext, options) {
117
+ if (options && isArr(options.include)) {
118
+ return options.include.some(function (url) {
119
+ return ext.test(url);
120
+ });
121
+ }
122
+ if (options && isArr(options.exclude)) {
123
+ return !options.exclude.some(function (url) {
124
+ return ext.test(url);
125
+ });
126
+ }
127
+ return true;
128
+ };
129
+ var getImageByUrl = function getImageByUrl(url, options) {
130
+ for (var i = 0; i < exts.length; i++) {
131
+ if (exts[i].ext.test(url) && testOpts(exts[i].ext, options)) {
132
+ return exts[i].icon || url;
133
+ }
134
+ }
135
+ return url;
136
+ };
137
+ var normalizeFileList = function normalizeFileList(fileList) {
138
+ if (fileList && fileList.length) {
139
+ return fileList.map(function (file) {
140
+ return __assign(__assign({
141
+ uid: file.uid,
142
+ status: file.status,
143
+ name: file.name,
144
+ url: file.downloadURL || file.imgURL || file.url
145
+ }, file.response), {
146
+ thumbUrl: file.imgURL || getImageByUrl(file.downloadURL || file.url, {
147
+ exclude: ['.png', '.jpg', '.jpeg', '.gif']
148
+ })
149
+ });
150
+ });
151
+ }
152
+ return [];
153
+ };
154
+ var shallowClone = function shallowClone(val) {
155
+ var result = isArr(val) ? __spreadArrays(val) : _typeof(val) === 'object' ? __assign({}, val) : val;
156
+ if (isArr(result)) {
157
+ result = result.map(function (item) {
158
+ return __assign(__assign({}, item), {
159
+ uid: item.uid || Math.random().toFixed(16).slice(2, 10)
160
+ });
161
+ });
162
+ }
163
+ return result;
164
+ };
165
+ export var Upload = connect({
166
+ getProps: mapStyledProps
167
+ })((_a = function (_super) {
168
+ __extends(Uploader, _super);
169
+ function Uploader(props) {
170
+ var _this = _super.call(this, props) || this;
171
+ _this.onRemoveHandler = function (file) {
172
+ var value = _this.state.value;
173
+ var fileList = [];
174
+ value.forEach(function (item) {
175
+ if (item.uid !== file.uid) {
176
+ fileList.push(item);
177
+ }
178
+ });
179
+ _this.props.onChange(fileList);
180
+ };
181
+ _this.onChangeHandler = function (_a) {
182
+ var fileList = _a.fileList;
183
+ var onChange = _this.props.onChange;
184
+ fileList = toArr(fileList);
185
+ if (fileList.every(function (file) {
186
+ if (file.status === 'done' || file.imgURL || file.downloadURL || file.url || file.thumbUrl) return true;
187
+ if (file.response) {
188
+ if (file.response.imgURL || file.response.downloadURL || file.response.url || file.response.thumbUrl) return true;
189
+ }
190
+ return false;
191
+ }) && fileList.length) {
192
+ fileList = normalizeFileList(fileList);
193
+ _this.setState({
194
+ value: fileList
195
+ }, function () {
196
+ onChange(fileList.length > 0 ? fileList : undefined);
197
+ });
198
+ } else {
199
+ _this.setState({
200
+ value: fileList
201
+ });
202
+ }
203
+ };
204
+ _this.state = {
205
+ value: shallowClone(toArr(props.value))
206
+ };
207
+ return _this;
208
+ }
209
+ Uploader.prototype.componentDidUpdate = function (preProps) {
210
+ if (this.props.value && !isEqual(this.props.value, preProps.value)) {
211
+ this.setState({
212
+ value: shallowClone(this.props.value)
213
+ });
214
+ }
215
+ };
216
+ Uploader.prototype.render = function () {
217
+ var _a = this.props,
218
+ listType = _a.listType,
219
+ locale = _a.locale,
220
+ onChange = _a.onChange,
221
+ value = _a.value,
222
+ others = __rest(_a, ["listType", "locale", "onChange", "value"]);
223
+ if (listType.indexOf('card') > -1) {
224
+ return /*#__PURE__*/React.createElement(AntdUpload, __assign({}, others, {
225
+ fileList: this.state.value,
226
+ onChange: this.onChangeHandler,
227
+ onRemove: this.onRemoveHandler,
228
+ listType: 'picture-card'
229
+ }), /*#__PURE__*/React.createElement(UploadPlaceholder, null));
230
+ }
231
+ if (listType.indexOf('dragger') > -1) {
232
+ return /*#__PURE__*/React.createElement(UploadDragger, __assign({}, others, {
233
+ fileList: this.state.value,
234
+ onChange: this.onChangeHandler,
235
+ onRemove: this.onRemoveHandler,
236
+ listType: listType.indexOf('image') > -1 ? 'picture' : 'text'
237
+ }), /*#__PURE__*/React.createElement("p", {
238
+ className: 'ant-upload-drag-icon'
239
+ }, /*#__PURE__*/React.createElement(InboxOutlined, null)), /*#__PURE__*/React.createElement("p", {
240
+ className: 'ant-upload-text'
241
+ }, "\u62D6\u62FD\u4E0A\u4F20"));
242
+ }
243
+ return /*#__PURE__*/React.createElement(AntdUpload, __assign({}, others, {
244
+ fileList: this.state.value,
245
+ onChange: this.onChangeHandler,
246
+ onRemove: this.onRemoveHandler,
247
+ listType: listType
248
+ }), /*#__PURE__*/React.createElement(_Button, {
249
+ // style: { margin: '0 0 10px' }
250
+ }, /*#__PURE__*/React.createElement(UploadOutlined, null), locale && locale.uploadText || '上传文件'));
251
+ };
252
+ return Uploader;
253
+ }(React.Component), _a.defaultProps = {
254
+ action: 'https://www.easy-mock.com/mock/5b713974309d0d7d107a74a3/alifd/upload',
255
+ listType: 'text',
256
+ multiple: true,
257
+ className: 'antd-uploader'
258
+ }, _a));
259
+ export default Upload;
260
+ var templateObject_1;
@@ -0,0 +1,17 @@
1
+ import _FormItemWrapper from "@chaoswise/ui/lib/FormItemWrapper";
2
+ var _excluded = ["iconOption"];
3
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
5
+ import React from 'react';
6
+ var formItemWrapper = function formItemWrapper(Com) {
7
+ var Wrapper = function Wrapper(_ref) {
8
+ var _ref$iconOption = _ref.iconOption,
9
+ iconOption = _ref$iconOption === void 0 ? {} : _ref$iconOption,
10
+ props = _objectWithoutProperties(_ref, _excluded);
11
+ return /*#__PURE__*/React.createElement(_FormItemWrapper, {
12
+ iconOption: iconOption
13
+ }, /*#__PURE__*/React.createElement(Com, props));
14
+ };
15
+ return Wrapper;
16
+ };
17
+ export default formItemWrapper;