@vtx/components 4.0.0-beta.57 → 4.0.0-beta.59

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.
@@ -107,6 +107,7 @@ var VtxExport = function VtxExport(props) {
107
107
  var status = false;
108
108
  document.body.appendChild(div);
109
109
  downloadFile(downloadURL, {
110
+ timeout: timeout,
110
111
  data: postData,
111
112
  extraHeader: headers,
112
113
  success: function success() {
@@ -12,6 +12,7 @@ import PropTypes from 'prop-types';
12
12
  import { ConfigProvider, Tooltip, Col, Form } from 'antd';
13
13
  import classnames from 'classnames';
14
14
  import { StoreCtx } from "./context";
15
+ import { useIntl } from "../vtx-provider";
15
16
 
16
17
  // 24 栅格
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -19,6 +20,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
19
20
  var SPAN = 24;
20
21
  export default function FormItem(props) {
21
22
  var _rest$rules;
23
+ var intl = useIntl();
22
24
  var _useContext = useContext(ConfigProvider.ConfigContext),
23
25
  getPrefixCls = _useContext.getPrefixCls;
24
26
  var prefixCls = getPrefixCls('', 'vtx-form-layout-item');
@@ -59,33 +61,34 @@ export default function FormItem(props) {
59
61
  }
60
62
  });
61
63
  var initPlaceholder = function initPlaceholder(placeholder, label, type) {
64
+ console.log('label, placeholder', placeholder, type === null || type === void 0 ? void 0 : type.displayName);
62
65
  if (placeholder) {
63
66
  return placeholder;
64
67
  }
65
- if (typeof label === 'string') {
66
- if (['Input', 'InputNumber', 'VtxInput', 'TextArea', 'VtxEditor'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
67
- // return '请输入' + label
68
- return '请输入';
69
- }
70
- if (['Select', 'VtxColorPicker', 'VtxSelect', 'VtxCombogrid', 'VtxTreeSelect', 'VtxZtreeSelect', 'VtxSearchMapInput'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
71
- // return '请选择' + label
72
- return '请选择';
73
- }
74
- if (['DatePicker', 'RangePicker', 'TimePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
75
- return undefined;
76
- }
68
+ if (['Input', 'InputNumber', 'VtxInput', 'TextArea', 'VtxEditor'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
69
+ // return '请输入' + label
70
+ return intl.getMessage('tableForm.inputPlaceholder', '请输入');
71
+ }
72
+ if (['Select', 'VtxColorPicker', 'VtxSelect', 'VtxCombogrid', 'VtxTreeSelect', 'VtxZtreeSelect', 'VtxSearchMapInput'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
73
+ // return '请选择' + label
74
+ return intl.getMessage('tableForm.selectPlaceholder', '请选择');
75
+ }
76
+ if (['DatePicker', 'RangePicker', 'TimePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
77
+ return undefined;
77
78
  }
78
79
  return null;
79
80
  };
80
81
  var renderItem = function renderItem(child) {
81
82
  if ( /*#__PURE__*/isValidElement(child)) {
82
83
  var _child$props;
83
- return /*#__PURE__*/React.cloneElement(child, {
84
+ console.log('initPlaceholder', child, label);
85
+ return /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
84
86
  placeholder: initPlaceholder(child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.placeholder, label, child === null || child === void 0 ? void 0 : child.type)
85
- });
87
+ }));
86
88
  }
87
89
  return child;
88
90
  };
91
+ console.log('disableHtmlFor', disableHtmlFor, props.children);
89
92
  return /*#__PURE__*/_jsx(Col, {
90
93
  span: SPAN * weights / cols,
91
94
  className: "".concat(prefixCls, "-col"),
@@ -26,6 +26,7 @@ import { VtxProvider, useIntl } from "../vtx-provider";
26
26
  import { jsx as _jsx } from "react/jsx-runtime";
27
27
  import { jsxs as _jsxs } from "react/jsx-runtime";
28
28
  var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
29
+ var _props$options;
29
30
  var intl = useIntl();
30
31
  var _useState = useState(0),
31
32
  _useState2 = _slicedToArray(_useState, 2),
@@ -92,7 +93,15 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
92
93
  };
93
94
  }
94
95
  }, [mode]);
95
- var newChildren = props.children ? Array.isArray(props.children) ? props.children : [props.children] : [];
96
+ console.log(props.options, props.children);
97
+ var newChildren = props.children ? Array.isArray(props.children) ? props.children : [props.children] : ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
98
+ return _objectSpread(_objectSpread({}, v), {}, {
99
+ key: v.value,
100
+ props: {
101
+ children: v.label
102
+ }
103
+ });
104
+ })) || [];
96
105
  var getContent = function getContent() {
97
106
  var child = {};
98
107
  newChildren.forEach(function (item) {
@@ -114,6 +114,7 @@ var VtxExport = exports.VtxExport = function VtxExport(props) {
114
114
  var status = false;
115
115
  document.body.appendChild(div);
116
116
  (0, _downloadFile.default)(downloadURL, {
117
+ timeout: timeout,
117
118
  data: postData,
118
119
  extraHeader: headers,
119
120
  success: function success() {
@@ -10,6 +10,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _antd = require("antd");
11
11
  var _classnames7 = _interopRequireDefault(require("classnames"));
12
12
  var _context = require("./context");
13
+ var _vtxProvider = require("../vtx-provider");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  var _excluded = ["weights", "label", "inline", "hideTooltip", "disableHtmlFor", "tooltip", "hidden", "nameExtra"]; // 24 栅格
15
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -25,6 +26,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
25
26
  var SPAN = 24;
26
27
  function FormItem(props) {
27
28
  var _rest$rules;
29
+ var intl = (0, _vtxProvider.useIntl)();
28
30
  var _useContext = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext),
29
31
  getPrefixCls = _useContext.getPrefixCls;
30
32
  var prefixCls = getPrefixCls('', 'vtx-form-layout-item');
@@ -65,33 +67,34 @@ function FormItem(props) {
65
67
  }
66
68
  });
67
69
  var initPlaceholder = function initPlaceholder(placeholder, label, type) {
70
+ console.log('label, placeholder', placeholder, type === null || type === void 0 ? void 0 : type.displayName);
68
71
  if (placeholder) {
69
72
  return placeholder;
70
73
  }
71
- if (typeof label === 'string') {
72
- if (['Input', 'InputNumber', 'VtxInput', 'TextArea', 'VtxEditor'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
73
- // return '请输入' + label
74
- return '请输入';
75
- }
76
- if (['Select', 'VtxColorPicker', 'VtxSelect', 'VtxCombogrid', 'VtxTreeSelect', 'VtxZtreeSelect', 'VtxSearchMapInput'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
77
- // return '请选择' + label
78
- return '请选择';
79
- }
80
- if (['DatePicker', 'RangePicker', 'TimePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
81
- return undefined;
82
- }
74
+ if (['Input', 'InputNumber', 'VtxInput', 'TextArea', 'VtxEditor'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
75
+ // return '请输入' + label
76
+ return intl.getMessage('tableForm.inputPlaceholder', '请输入');
77
+ }
78
+ if (['Select', 'VtxColorPicker', 'VtxSelect', 'VtxCombogrid', 'VtxTreeSelect', 'VtxZtreeSelect', 'VtxSearchMapInput'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
79
+ // return '请选择' + label
80
+ return intl.getMessage('tableForm.selectPlaceholder', '请选择');
81
+ }
82
+ if (['DatePicker', 'RangePicker', 'TimePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
83
+ return undefined;
83
84
  }
84
85
  return null;
85
86
  };
86
87
  var renderItem = function renderItem(child) {
87
88
  if ( /*#__PURE__*/(0, _react.isValidElement)(child)) {
88
89
  var _child$props;
89
- return /*#__PURE__*/_react.default.cloneElement(child, {
90
+ console.log('initPlaceholder', child, label);
91
+ return /*#__PURE__*/_react.default.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
90
92
  placeholder: initPlaceholder(child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.placeholder, label, child === null || child === void 0 ? void 0 : child.type)
91
- });
93
+ }));
92
94
  }
93
95
  return child;
94
96
  };
97
+ console.log('disableHtmlFor', disableHtmlFor, props.children);
95
98
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Col, {
96
99
  span: SPAN * weights / cols,
97
100
  className: "".concat(prefixCls, "-col"),
@@ -34,6 +34,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
34
34
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
35
35
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
36
36
  var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
37
+ var _props$options;
37
38
  var intl = (0, _vtxProvider.useIntl)();
38
39
  var _useState = (0, _react.useState)(0),
39
40
  _useState2 = _slicedToArray(_useState, 2),
@@ -100,7 +101,15 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
100
101
  };
101
102
  }
102
103
  }, [mode]);
103
- var newChildren = props.children ? Array.isArray(props.children) ? props.children : [props.children] : [];
104
+ console.log(props.options, props.children);
105
+ var newChildren = props.children ? Array.isArray(props.children) ? props.children : [props.children] : ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
106
+ return _objectSpread(_objectSpread({}, v), {}, {
107
+ key: v.value,
108
+ props: {
109
+ children: v.label
110
+ }
111
+ });
112
+ })) || [];
104
113
  var getContent = function getContent() {
105
114
  var child = {};
106
115
  newChildren.forEach(function (item) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/components",
3
- "version": "4.0.0-beta.57",
3
+ "version": "4.0.0-beta.59",
4
4
  "description": "React components for Vortex",
5
5
  "keywords": [
6
6
  "react",