@teamias/rex-design 0.0.24 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/base-form/components/ProFormDateRangePickerV2.d.ts +19 -0
- package/dist/components/base-form/components/ProFormDateRangePickerV2.js +202 -0
- package/dist/components/base-form/components/ProFormDigitRangeV2.d.ts +31 -0
- package/dist/components/base-form/components/ProFormDigitRangeV2.js +228 -0
- package/dist/components/base-form/components/RenderText.d.ts +7 -0
- package/dist/components/base-form/components/RenderText.js +9 -0
- package/dist/components/base-form/components/ResetView.d.ts +5 -0
- package/dist/components/base-form/components/ResetView.js +15 -0
- package/dist/components/base-form/demo/BaseFormBasicTest.js +3 -2
- package/dist/components/base-form/demo/BaseFormCustomContent.js +6 -3
- package/dist/components/base-form/demo/BaseProFormDateRangePickerV2.d.ts +2 -0
- package/dist/components/base-form/demo/BaseProFormDateRangePickerV2.js +50 -0
- package/dist/components/base-form/demo/BaseProFormDigitRangeV2.d.ts +2 -0
- package/dist/components/base-form/demo/BaseProFormDigitRangeV2.js +59 -0
- package/dist/components/base-form/demo/index.js +7 -2
- package/dist/components/base-form/modules/renderComponentNode.js +34 -0
- package/dist/components/base-form/types.d.ts +6 -2
- package/dist/components/upload-plus/demo/index.js +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DatePicker, Form, GetProps } from 'antd';
|
|
2
|
+
import { Dayjs } from 'dayjs';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
export declare const ProFormDateRangePickerV2: FC<IProFormDateRangePickerV2Props>;
|
|
5
|
+
interface IProFormDateRangePickerV2Props {
|
|
6
|
+
name?: [string | string[], string | string[]];
|
|
7
|
+
placeholder?: [string, string];
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
formItemProps?: GetProps<typeof Form.Item>;
|
|
10
|
+
fieldProps?: GetProps<typeof DatePicker.RangePicker>;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
dataFormat?: string;
|
|
13
|
+
allowClear?: boolean;
|
|
14
|
+
initialValue?: number | [
|
|
15
|
+
string | number | Dayjs | undefined,
|
|
16
|
+
string | number | Dayjs | undefined
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import ProForm, { ProFormDependency, ProFormText } from '@ant-design/pro-form';
|
|
17
|
+
import { EditOrReadOnlyContext } from '@ant-design/pro-form/es/BaseForm/EditOrReadOnlyContext';
|
|
18
|
+
import { DatePicker, Form } from 'antd';
|
|
19
|
+
import dayjs from 'dayjs';
|
|
20
|
+
import { get } from 'radash';
|
|
21
|
+
import { useContext, useMemo, useState } from 'react';
|
|
22
|
+
import { ResetView } from "./ResetView";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
25
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
export var ProFormDateRangePickerV2 = function ProFormDateRangePickerV2(_ref) {
|
|
27
|
+
var name = _ref.name,
|
|
28
|
+
placeholder = _ref.placeholder,
|
|
29
|
+
label = _ref.label,
|
|
30
|
+
formItemProps = _ref.formItemProps,
|
|
31
|
+
fieldProps = _ref.fieldProps,
|
|
32
|
+
required = _ref.required,
|
|
33
|
+
initialValue = _ref.initialValue,
|
|
34
|
+
_ref$dataFormat = _ref.dataFormat,
|
|
35
|
+
outsideDataFormat = _ref$dataFormat === void 0 ? 'YYYY-MM-DD' : _ref$dataFormat,
|
|
36
|
+
_ref$allowClear = _ref.allowClear,
|
|
37
|
+
allowClear = _ref$allowClear === void 0 ? true : _ref$allowClear;
|
|
38
|
+
var form = ProForm.useFormInstance();
|
|
39
|
+
var context = useContext(EditOrReadOnlyContext);
|
|
40
|
+
var formReadonly = context.mode === 'read';
|
|
41
|
+
var dataFormat = (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.format) || outsideDataFormat;
|
|
42
|
+
|
|
43
|
+
// 校验状态
|
|
44
|
+
var _useState = useState(''),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
validateStatus = _useState2[0],
|
|
47
|
+
setValidateStatus = _useState2[1];
|
|
48
|
+
var _useState3 = useState(''),
|
|
49
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
50
|
+
help = _useState4[0],
|
|
51
|
+
setHelp = _useState4[1];
|
|
52
|
+
|
|
53
|
+
// 获取字段名
|
|
54
|
+
var _useMemo = useMemo(function () {
|
|
55
|
+
return name || [undefined, undefined];
|
|
56
|
+
}, [name]),
|
|
57
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
58
|
+
startFieldName = _useMemo2[0],
|
|
59
|
+
endFieldName = _useMemo2[1];
|
|
60
|
+
var _useMemo3 = useMemo(function () {
|
|
61
|
+
var arr = [];
|
|
62
|
+
if (typeof initialValue === 'number') {
|
|
63
|
+
// 时间范围类型根据 initialValue 为数值的时候, 根据正负实现 当天距离之前或之后
|
|
64
|
+
var n = initialValue;
|
|
65
|
+
if (n > 0) {
|
|
66
|
+
// 今天到未来 n 天
|
|
67
|
+
arr.push(dayjs().startOf('day'), dayjs().add(n, 'day').endOf('day'));
|
|
68
|
+
} else if (n < 0) {
|
|
69
|
+
// 过去 n 天到今天
|
|
70
|
+
arr.push(dayjs().add(n, 'day').startOf('day'), dayjs().endOf('day'));
|
|
71
|
+
} else {
|
|
72
|
+
// n = 0,只有今天
|
|
73
|
+
arr.push(dayjs().startOf('day'), dayjs().endOf('day'));
|
|
74
|
+
}
|
|
75
|
+
} else if (Array.isArray(initialValue)) {
|
|
76
|
+
arr.push(initialValue[0] ? dayjs(initialValue[0]) : undefined, initialValue[1] ? dayjs(initialValue[1]) : undefined);
|
|
77
|
+
}
|
|
78
|
+
return arr.map(function (ii) {
|
|
79
|
+
return ii === null || ii === void 0 ? void 0 : ii.format(dataFormat);
|
|
80
|
+
});
|
|
81
|
+
// return arr;
|
|
82
|
+
}, [initialValue]),
|
|
83
|
+
_useMemo4 = _slicedToArray(_useMemo3, 2),
|
|
84
|
+
initialStartValue = _useMemo4[0],
|
|
85
|
+
initialEndValue = _useMemo4[1];
|
|
86
|
+
|
|
87
|
+
// 生成校验规则
|
|
88
|
+
var validateRules = useMemo(function () {
|
|
89
|
+
if (!required) return undefined;
|
|
90
|
+
return [{
|
|
91
|
+
validator: function () {
|
|
92
|
+
var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
93
|
+
var startValue, endValue;
|
|
94
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
95
|
+
while (1) switch (_context.prev = _context.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
startValue = form.getFieldValue(startFieldName);
|
|
98
|
+
endValue = form.getFieldValue(endFieldName);
|
|
99
|
+
if (!(!startValue || !endValue)) {
|
|
100
|
+
_context.next = 7;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
setValidateStatus('error');
|
|
104
|
+
setHelp(!startValue && !endValue ? "\u8BF7\u9009\u62E9".concat(label || '') : '');
|
|
105
|
+
form.setFields([{
|
|
106
|
+
name: startFieldName,
|
|
107
|
+
errors: !startValue ? ["\u8BF7\u9009\u62E9".concat(label || '')] : []
|
|
108
|
+
}, {
|
|
109
|
+
name: endFieldName,
|
|
110
|
+
errors: !endValue ? ["\u8BF7\u9009\u62E9".concat(label || '')] : []
|
|
111
|
+
}]);
|
|
112
|
+
return _context.abrupt("return", Promise.reject(new Error("\u8BF7\u9009\u62E9".concat(label || ''))));
|
|
113
|
+
case 7:
|
|
114
|
+
setValidateStatus('');
|
|
115
|
+
setHelp('');
|
|
116
|
+
form.setFields([{
|
|
117
|
+
name: startFieldName
|
|
118
|
+
}, {
|
|
119
|
+
name: endFieldName
|
|
120
|
+
}]);
|
|
121
|
+
return _context.abrupt("return", Promise.resolve());
|
|
122
|
+
case 11:
|
|
123
|
+
case "end":
|
|
124
|
+
return _context.stop();
|
|
125
|
+
}
|
|
126
|
+
}, _callee);
|
|
127
|
+
}));
|
|
128
|
+
function validator() {
|
|
129
|
+
return _validator.apply(this, arguments);
|
|
130
|
+
}
|
|
131
|
+
return validator;
|
|
132
|
+
}()
|
|
133
|
+
}];
|
|
134
|
+
}, [required, startFieldName, endFieldName, form]);
|
|
135
|
+
var getKey = function getKey(key) {
|
|
136
|
+
if (Array.isArray(key)) {
|
|
137
|
+
return key.join('.');
|
|
138
|
+
}
|
|
139
|
+
return key || '';
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// console.log(initialStartValue, initialEndValue);
|
|
143
|
+
|
|
144
|
+
return /*#__PURE__*/_jsxs(Form.Item, _objectSpread(_objectSpread({
|
|
145
|
+
label: label,
|
|
146
|
+
required: required,
|
|
147
|
+
validateStatus: validateStatus,
|
|
148
|
+
help: help
|
|
149
|
+
}, formItemProps), {}, {
|
|
150
|
+
children: [/*#__PURE__*/_jsx(ProFormText, {
|
|
151
|
+
hidden: true,
|
|
152
|
+
initialValue: initialStartValue,
|
|
153
|
+
name: startFieldName,
|
|
154
|
+
rules: validateRules
|
|
155
|
+
}), /*#__PURE__*/_jsx(ProFormText, {
|
|
156
|
+
hidden: true,
|
|
157
|
+
initialValue: initialEndValue,
|
|
158
|
+
name: endFieldName,
|
|
159
|
+
rules: validateRules
|
|
160
|
+
}), /*#__PURE__*/_jsx(ProFormDependency, {
|
|
161
|
+
name: [startFieldName, endFieldName],
|
|
162
|
+
children: function children(data) {
|
|
163
|
+
var startValue = get(data, getKey(startFieldName));
|
|
164
|
+
var endValue = get(data, getKey(endFieldName));
|
|
165
|
+
if (formReadonly) {
|
|
166
|
+
return /*#__PURE__*/_jsx("span", {
|
|
167
|
+
children: startValue && endValue ? "".concat(startValue, " ~ ").concat(endValue) : '-'
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
171
|
+
children: [/*#__PURE__*/_jsx(ResetView, {
|
|
172
|
+
data: data,
|
|
173
|
+
onReset: function onReset() {
|
|
174
|
+
if (!form.getFieldsError([startFieldName, endFieldName]).map(function (ii) {
|
|
175
|
+
return ii.errors;
|
|
176
|
+
}).flat().length && validateStatus !== '') {
|
|
177
|
+
setValidateStatus('');
|
|
178
|
+
setHelp('');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}), /*#__PURE__*/_jsx(DatePicker.RangePicker, _objectSpread(_objectSpread({
|
|
182
|
+
placeholder: placeholder,
|
|
183
|
+
format: dataFormat,
|
|
184
|
+
allowClear: allowClear
|
|
185
|
+
}, fieldProps), {}, {
|
|
186
|
+
style: _objectSpread({
|
|
187
|
+
width: '100%'
|
|
188
|
+
}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style),
|
|
189
|
+
value: startValue && endValue ? [dayjs(startValue), dayjs(endValue)] : undefined,
|
|
190
|
+
onChange: function onChange(dates, dateStrings) {
|
|
191
|
+
form.setFieldValue(startFieldName, dateStrings[0] || undefined);
|
|
192
|
+
form.setFieldValue(endFieldName, dateStrings[1] || undefined);
|
|
193
|
+
setTimeout(function () {
|
|
194
|
+
validateRules === null || validateRules === void 0 || validateRules[0].validator().catch(function () {});
|
|
195
|
+
}, 0);
|
|
196
|
+
}
|
|
197
|
+
}))]
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
})]
|
|
201
|
+
}));
|
|
202
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Form, GetProps, InputNumber } from 'antd';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
export declare const ProFormDigitRangeV2: FC<IProFormDigitRangeV2Props>;
|
|
4
|
+
interface IProFormDigitRangeV2Props {
|
|
5
|
+
name?: [string | string[], string | string[]];
|
|
6
|
+
placeholder?: [string, string];
|
|
7
|
+
label?: React.ReactNode;
|
|
8
|
+
formItemProps?: GetProps<typeof Form.Item>;
|
|
9
|
+
fieldProps?: GetProps<typeof InputNumber>;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
initialValue?: [number | undefined, number | undefined];
|
|
12
|
+
/**
|
|
13
|
+
* 必填模式
|
|
14
|
+
* - both: 两边都必填
|
|
15
|
+
* - either: 至少填一边
|
|
16
|
+
* @default 'both'
|
|
17
|
+
*/
|
|
18
|
+
requiredMode?: 'both' | 'either';
|
|
19
|
+
/**
|
|
20
|
+
* 自动交换最小值和最大值
|
|
21
|
+
* - 当最小值大于最大值时,自动交换两者的值
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
autoSwap?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 小数精度
|
|
27
|
+
* - 设置数值的小数位数
|
|
28
|
+
*/
|
|
29
|
+
precision?: number;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import { ProForm, ProFormDependency } from '@ant-design/pro-components';
|
|
17
|
+
import { EditOrReadOnlyContext } from '@ant-design/pro-form/es/BaseForm/EditOrReadOnlyContext';
|
|
18
|
+
import { Form, Input, InputNumber, Space } from 'antd';
|
|
19
|
+
import { useCallback, useContext, useMemo, useState } from 'react';
|
|
20
|
+
import { RenderText } from "./RenderText";
|
|
21
|
+
import { ResetView } from "./ResetView";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
export var ProFormDigitRangeV2 = function ProFormDigitRangeV2(_ref) {
|
|
25
|
+
var name = _ref.name,
|
|
26
|
+
placeholder = _ref.placeholder,
|
|
27
|
+
label = _ref.label,
|
|
28
|
+
formItemProps = _ref.formItemProps,
|
|
29
|
+
fieldProps = _ref.fieldProps,
|
|
30
|
+
_ref$autoSwap = _ref.autoSwap,
|
|
31
|
+
autoSwap = _ref$autoSwap === void 0 ? true : _ref$autoSwap,
|
|
32
|
+
precision = _ref.precision,
|
|
33
|
+
required = _ref.required,
|
|
34
|
+
_ref$requiredMode = _ref.requiredMode,
|
|
35
|
+
requiredMode = _ref$requiredMode === void 0 ? 'both' : _ref$requiredMode,
|
|
36
|
+
initialValue = _ref.initialValue;
|
|
37
|
+
var form = ProForm.useFormInstance();
|
|
38
|
+
var context = useContext(EditOrReadOnlyContext);
|
|
39
|
+
var formReadonly = context.mode === 'read';
|
|
40
|
+
|
|
41
|
+
// 校验状态
|
|
42
|
+
var _useState = useState(''),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
validateStatus = _useState2[0],
|
|
45
|
+
setValidateStatus = _useState2[1];
|
|
46
|
+
var _useState3 = useState(''),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
help = _useState4[0],
|
|
49
|
+
setHelp = _useState4[1];
|
|
50
|
+
|
|
51
|
+
// 获取字段名
|
|
52
|
+
var _useMemo = useMemo(function () {
|
|
53
|
+
return name || [undefined, undefined];
|
|
54
|
+
}, [name]),
|
|
55
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
56
|
+
minFieldName = _useMemo2[0],
|
|
57
|
+
maxFieldName = _useMemo2[1];
|
|
58
|
+
|
|
59
|
+
// 生成校验规则
|
|
60
|
+
var validateRules = useMemo(function () {
|
|
61
|
+
if (!required) return undefined;
|
|
62
|
+
return [{
|
|
63
|
+
validator: function () {
|
|
64
|
+
var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
65
|
+
var minValue, maxValue;
|
|
66
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
67
|
+
while (1) switch (_context.prev = _context.next) {
|
|
68
|
+
case 0:
|
|
69
|
+
minValue = form.getFieldValue(minFieldName);
|
|
70
|
+
maxValue = form.getFieldValue(maxFieldName);
|
|
71
|
+
if (!(requiredMode === 'both')) {
|
|
72
|
+
_context.next = 9;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
if (!(minValue === null || minValue === undefined || minValue === '' || maxValue === null || maxValue === undefined || maxValue === '')) {
|
|
76
|
+
_context.next = 7;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
setValidateStatus('error');
|
|
80
|
+
setHelp((minValue === null || minValue === undefined || minValue === '') && (maxValue === null || maxValue === undefined || maxValue === '') ? "\u8BF7\u8F93\u5165".concat(label || '数值范围') : minValue === null || minValue === undefined || minValue === '' ? '请输入最小值' : '请输入最大值');
|
|
81
|
+
return _context.abrupt("return", Promise.reject(new Error("\u8BF7\u8F93\u5165".concat(label || '数值范围'))));
|
|
82
|
+
case 7:
|
|
83
|
+
_context.next = 13;
|
|
84
|
+
break;
|
|
85
|
+
case 9:
|
|
86
|
+
if (!((minValue === null || minValue === undefined || minValue === '') && (maxValue === null || maxValue === undefined || maxValue === ''))) {
|
|
87
|
+
_context.next = 13;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
setValidateStatus('error');
|
|
91
|
+
setHelp('请至少输入一个值');
|
|
92
|
+
return _context.abrupt("return", Promise.reject(new Error('请至少输入一个值')));
|
|
93
|
+
case 13:
|
|
94
|
+
setValidateStatus('');
|
|
95
|
+
setHelp('');
|
|
96
|
+
return _context.abrupt("return", Promise.resolve());
|
|
97
|
+
case 16:
|
|
98
|
+
case "end":
|
|
99
|
+
return _context.stop();
|
|
100
|
+
}
|
|
101
|
+
}, _callee);
|
|
102
|
+
}));
|
|
103
|
+
function validator() {
|
|
104
|
+
return _validator.apply(this, arguments);
|
|
105
|
+
}
|
|
106
|
+
return validator;
|
|
107
|
+
}()
|
|
108
|
+
}];
|
|
109
|
+
}, [required, requiredMode, minFieldName, maxFieldName, form, label]);
|
|
110
|
+
|
|
111
|
+
// 处理最小值失去焦点
|
|
112
|
+
var handleMinBlur = useCallback(function () {
|
|
113
|
+
if (!autoSwap || !minFieldName || !maxFieldName) return;
|
|
114
|
+
|
|
115
|
+
// 使用 setTimeout 等待 InputNumber 完成内部的 min/max 校验
|
|
116
|
+
setTimeout(function () {
|
|
117
|
+
// 获取表单中的实际值
|
|
118
|
+
var actualMinValue = form.getFieldValue(minFieldName);
|
|
119
|
+
var maxValue = form.getFieldValue(maxFieldName);
|
|
120
|
+
if (actualMinValue !== null && actualMinValue !== undefined && maxValue !== null && maxValue !== undefined && actualMinValue > maxValue) {
|
|
121
|
+
form.setFieldValue(minFieldName, maxValue);
|
|
122
|
+
form.setFieldValue(maxFieldName, actualMinValue);
|
|
123
|
+
}
|
|
124
|
+
}, 0);
|
|
125
|
+
}, [autoSwap, minFieldName, maxFieldName, form]);
|
|
126
|
+
|
|
127
|
+
// 处理最大值失去焦点
|
|
128
|
+
var handleMaxBlur = useCallback(function () {
|
|
129
|
+
if (!autoSwap || !minFieldName || !maxFieldName) return;
|
|
130
|
+
|
|
131
|
+
// 使用 setTimeout 等待 InputNumber 完成内部的 min/max 校验
|
|
132
|
+
setTimeout(function () {
|
|
133
|
+
// 获取表单中的实际值
|
|
134
|
+
var minValue = form.getFieldValue(minFieldName);
|
|
135
|
+
var actualMaxValue = form.getFieldValue(maxFieldName);
|
|
136
|
+
if (minValue !== null && minValue !== undefined && actualMaxValue !== null && actualMaxValue !== undefined && actualMaxValue < minValue) {
|
|
137
|
+
form.setFieldValue(minFieldName, actualMaxValue);
|
|
138
|
+
form.setFieldValue(maxFieldName, minValue);
|
|
139
|
+
}
|
|
140
|
+
}, 0);
|
|
141
|
+
}, [autoSwap, minFieldName, maxFieldName, form]);
|
|
142
|
+
return /*#__PURE__*/_jsxs(Form.Item, _objectSpread(_objectSpread({
|
|
143
|
+
label: label,
|
|
144
|
+
required: required,
|
|
145
|
+
validateStatus: validateStatus,
|
|
146
|
+
help: help
|
|
147
|
+
}, formItemProps), {}, {
|
|
148
|
+
children: [/*#__PURE__*/_jsx(ProFormDependency, {
|
|
149
|
+
name: [minFieldName, maxFieldName],
|
|
150
|
+
children: function children(data) {
|
|
151
|
+
return /*#__PURE__*/_jsx(ResetView, {
|
|
152
|
+
data: data,
|
|
153
|
+
onReset: function onReset() {
|
|
154
|
+
if (!form.getFieldsError([minFieldName, maxFieldName]).map(function (ii) {
|
|
155
|
+
return ii.errors;
|
|
156
|
+
}).flat().length && validateStatus !== '') {
|
|
157
|
+
setValidateStatus('');
|
|
158
|
+
setHelp('');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}), /*#__PURE__*/_jsxs(Space.Compact, {
|
|
164
|
+
style: {
|
|
165
|
+
width: '100%'
|
|
166
|
+
},
|
|
167
|
+
children: [/*#__PURE__*/_jsx(Form.Item, {
|
|
168
|
+
noStyle: true,
|
|
169
|
+
name: minFieldName,
|
|
170
|
+
initialValue: initialValue === null || initialValue === void 0 ? void 0 : initialValue[0],
|
|
171
|
+
rules: validateRules,
|
|
172
|
+
validateStatus: validateStatus,
|
|
173
|
+
children: formReadonly ? /*#__PURE__*/_jsx(RenderText, {}) : /*#__PURE__*/_jsx(InputNumber, _objectSpread(_objectSpread({
|
|
174
|
+
placeholder: (placeholder === null || placeholder === void 0 ? void 0 : placeholder[0]) || '最小值',
|
|
175
|
+
precision: precision,
|
|
176
|
+
readOnly: formReadonly
|
|
177
|
+
}, fieldProps), {}, {
|
|
178
|
+
style: _objectSpread({
|
|
179
|
+
flex: 1
|
|
180
|
+
}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style),
|
|
181
|
+
onBlur: handleMinBlur,
|
|
182
|
+
onChange: function onChange() {
|
|
183
|
+
setTimeout(function () {
|
|
184
|
+
validateRules === null || validateRules === void 0 || validateRules[0].validator().catch(function () {});
|
|
185
|
+
}, 0);
|
|
186
|
+
}
|
|
187
|
+
}))
|
|
188
|
+
}), formReadonly ? /*#__PURE__*/_jsx(RenderText, {
|
|
189
|
+
value: "~",
|
|
190
|
+
style: {
|
|
191
|
+
padding: '0 4px'
|
|
192
|
+
}
|
|
193
|
+
}) : /*#__PURE__*/_jsx(Input, {
|
|
194
|
+
style: {
|
|
195
|
+
width: 30,
|
|
196
|
+
borderInlineStart: 0,
|
|
197
|
+
borderInlineEnd: 0,
|
|
198
|
+
pointerEvents: 'none',
|
|
199
|
+
textAlign: 'center'
|
|
200
|
+
},
|
|
201
|
+
placeholder: "~",
|
|
202
|
+
disabled: true,
|
|
203
|
+
readOnly: true
|
|
204
|
+
}), /*#__PURE__*/_jsx(Form.Item, {
|
|
205
|
+
noStyle: true,
|
|
206
|
+
name: maxFieldName,
|
|
207
|
+
initialValue: initialValue === null || initialValue === void 0 ? void 0 : initialValue[1],
|
|
208
|
+
rules: validateRules,
|
|
209
|
+
validateStatus: validateStatus,
|
|
210
|
+
children: formReadonly ? /*#__PURE__*/_jsx(RenderText, {}) : /*#__PURE__*/_jsx(InputNumber, _objectSpread(_objectSpread({
|
|
211
|
+
placeholder: (placeholder === null || placeholder === void 0 ? void 0 : placeholder[1]) || '最大值',
|
|
212
|
+
precision: precision,
|
|
213
|
+
readOnly: formReadonly
|
|
214
|
+
}, fieldProps), {}, {
|
|
215
|
+
style: _objectSpread({
|
|
216
|
+
flex: 1
|
|
217
|
+
}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style),
|
|
218
|
+
onBlur: handleMaxBlur,
|
|
219
|
+
onChange: function onChange() {
|
|
220
|
+
setTimeout(function () {
|
|
221
|
+
validateRules === null || validateRules === void 0 || validateRules[0].validator().catch(function () {});
|
|
222
|
+
}, 0);
|
|
223
|
+
}
|
|
224
|
+
}))
|
|
225
|
+
})]
|
|
226
|
+
})]
|
|
227
|
+
}));
|
|
228
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export var RenderText = function RenderText(_ref) {
|
|
3
|
+
var value = _ref.value,
|
|
4
|
+
style = _ref.style;
|
|
5
|
+
return /*#__PURE__*/_jsx("span", {
|
|
6
|
+
style: style,
|
|
7
|
+
children: value !== null && value !== void 0 ? value : '-'
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useDebounceEffect } from 'ahooks';
|
|
2
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export var ResetView = function ResetView(_ref) {
|
|
5
|
+
var data = _ref.data,
|
|
6
|
+
onReset = _ref.onReset;
|
|
7
|
+
useDebounceEffect(function () {
|
|
8
|
+
onReset();
|
|
9
|
+
}, [data], {
|
|
10
|
+
wait: 0,
|
|
11
|
+
trailing: true,
|
|
12
|
+
leading: false
|
|
13
|
+
});
|
|
14
|
+
return /*#__PURE__*/_jsx(_Fragment, {});
|
|
15
|
+
};
|
|
@@ -95,8 +95,9 @@ export default (function () {
|
|
|
95
95
|
field: ['select-false']
|
|
96
96
|
}]
|
|
97
97
|
}, {
|
|
98
|
-
valueType: '
|
|
99
|
-
field: ['start', 'end']
|
|
98
|
+
valueType: 'dateRangeV2',
|
|
99
|
+
field: ['start', 'end'],
|
|
100
|
+
required: true
|
|
100
101
|
// defaultValue: 1,
|
|
101
102
|
}];
|
|
102
103
|
var initialValues = dataToInitialValues({
|
|
@@ -14,7 +14,10 @@ import { getFieldsDefaultValues } from "../modules/handlerData";
|
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
export default (function () {
|
|
17
|
-
|
|
17
|
+
// const t: Exclude<
|
|
18
|
+
// GetProps<typeof BaseForm>['fields'],
|
|
19
|
+
// undefined
|
|
20
|
+
// >[number]['valueType'] = 'hidden';
|
|
18
21
|
var _useStateData = useStateData(function () {
|
|
19
22
|
return {
|
|
20
23
|
fields: [{
|
|
@@ -36,8 +39,8 @@ export default (function () {
|
|
|
36
39
|
colon: false
|
|
37
40
|
}
|
|
38
41
|
}, {
|
|
39
|
-
valueType: '
|
|
40
|
-
field: ['www.multipleComponents
|
|
42
|
+
valueType: 'inputNumberRangeV2',
|
|
43
|
+
field: ['www.multipleComponents.input', 'www.multipleComponents.input2']
|
|
41
44
|
}]
|
|
42
45
|
}],
|
|
43
46
|
initialValues: {},
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { RexProConfigProvider } from "../../../context";
|
|
2
|
+
import { ProForm, ProFormText } from '@ant-design/pro-components';
|
|
3
|
+
import { createIntl } from 'react-intl';
|
|
4
|
+
import { ProFormDateRangePickerV2 } from "../components/ProFormDateRangePickerV2";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export default (function () {
|
|
8
|
+
return /*#__PURE__*/_jsx(RexProConfigProvider, {
|
|
9
|
+
value: {
|
|
10
|
+
intl: createIntl({
|
|
11
|
+
locale: 'en-US',
|
|
12
|
+
messages: {}
|
|
13
|
+
})
|
|
14
|
+
// apiClient: (api, params) => {
|
|
15
|
+
// return fetch(api, {method: 'post', body: JSON.stringify(params)}).then((res) => ({data: []}));
|
|
16
|
+
// },
|
|
17
|
+
},
|
|
18
|
+
children: /*#__PURE__*/_jsxs(ProForm, {
|
|
19
|
+
initialValues: {
|
|
20
|
+
data: {
|
|
21
|
+
// min: 2,
|
|
22
|
+
// max: 1111,
|
|
23
|
+
}
|
|
24
|
+
// testName: 'qweqwe',
|
|
25
|
+
}
|
|
26
|
+
// size="small"
|
|
27
|
+
// disabled
|
|
28
|
+
// readonly
|
|
29
|
+
,
|
|
30
|
+
layout: "horizontal",
|
|
31
|
+
onFinish: function onFinish(values) {
|
|
32
|
+
console.log(values);
|
|
33
|
+
},
|
|
34
|
+
children: [/*#__PURE__*/_jsx(ProFormDateRangePickerV2, {
|
|
35
|
+
required: true,
|
|
36
|
+
label: "\u65E5\u671F\u8303\u56F4",
|
|
37
|
+
name: [['data', 'start'], ['data', 'end']]
|
|
38
|
+
// initialValue={-30}
|
|
39
|
+
// dataFormat="YYYY-MM-DD"
|
|
40
|
+
}), /*#__PURE__*/_jsx(ProFormText, {
|
|
41
|
+
required: true,
|
|
42
|
+
rules: [{
|
|
43
|
+
required: true
|
|
44
|
+
}],
|
|
45
|
+
label: "\u6D4B\u8BD5\u6587\u672C",
|
|
46
|
+
name: "testName"
|
|
47
|
+
})]
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { RexProConfigProvider } from "../../../context";
|
|
2
|
+
import { ProForm, ProFormText } from '@ant-design/pro-components';
|
|
3
|
+
import { createIntl } from 'react-intl';
|
|
4
|
+
import { ProFormDigitRangeV2 } from "../components/ProFormDigitRangeV2";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export default (function () {
|
|
8
|
+
return /*#__PURE__*/_jsx(RexProConfigProvider, {
|
|
9
|
+
value: {
|
|
10
|
+
intl: createIntl({
|
|
11
|
+
locale: 'en-US',
|
|
12
|
+
messages: {}
|
|
13
|
+
})
|
|
14
|
+
// apiClient: (api, params) => {
|
|
15
|
+
// return fetch(api, {method: 'post', body: JSON.stringify(params)}).then((res) => ({data: []}));
|
|
16
|
+
// },
|
|
17
|
+
},
|
|
18
|
+
children: /*#__PURE__*/_jsxs(ProForm, {
|
|
19
|
+
initialValues: {
|
|
20
|
+
data: {
|
|
21
|
+
// min: 2,
|
|
22
|
+
// max: 1111,
|
|
23
|
+
},
|
|
24
|
+
testName: 'qweqwe'
|
|
25
|
+
}
|
|
26
|
+
// size="small"
|
|
27
|
+
// disabled
|
|
28
|
+
// readonly
|
|
29
|
+
,
|
|
30
|
+
layout: "horizontal",
|
|
31
|
+
onFinish: function onFinish(values) {
|
|
32
|
+
console.log(values);
|
|
33
|
+
},
|
|
34
|
+
children: [/*#__PURE__*/_jsx(ProFormDigitRangeV2, {
|
|
35
|
+
required: true,
|
|
36
|
+
label: "\u6570\u5B57\u8303\u56F4",
|
|
37
|
+
name: [['data', 'min'], ['data', 'max']],
|
|
38
|
+
initialValue: [undefined, 3]
|
|
39
|
+
// formItemProps={{
|
|
40
|
+
// style: {
|
|
41
|
+
// margin: 0,
|
|
42
|
+
// },
|
|
43
|
+
// }}
|
|
44
|
+
,
|
|
45
|
+
fieldProps: {
|
|
46
|
+
min: 0,
|
|
47
|
+
max: 1000
|
|
48
|
+
}
|
|
49
|
+
}), /*#__PURE__*/_jsx(ProFormText, {
|
|
50
|
+
required: true,
|
|
51
|
+
rules: [{
|
|
52
|
+
required: true
|
|
53
|
+
}],
|
|
54
|
+
label: "\u6D4B\u8BD5\u6587\u672C",
|
|
55
|
+
name: "testName"
|
|
56
|
+
})]
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -137,10 +137,15 @@ export default (function () {
|
|
|
137
137
|
b: 2
|
|
138
138
|
}
|
|
139
139
|
}, {
|
|
140
|
-
valueType: '
|
|
140
|
+
valueType: 'dateRangeV2',
|
|
141
141
|
field: ['dateRange-start', 'dateRange-end'],
|
|
142
142
|
label: 'dateRange',
|
|
143
|
-
defaultValue: -29
|
|
143
|
+
defaultValue: -29,
|
|
144
|
+
required: true,
|
|
145
|
+
fieldProps: {
|
|
146
|
+
showTime: true,
|
|
147
|
+
format: 'YYYY/MM/DD HH:mm:ss'
|
|
148
|
+
}
|
|
144
149
|
}, {
|
|
145
150
|
valueType: 'cascader',
|
|
146
151
|
field: 'cascader',
|
|
@@ -21,6 +21,8 @@ import { ProFormCascader, ProFormCheckbox, ProFormDatePicker, ProFormDateRangePi
|
|
|
21
21
|
import classNames from 'classnames';
|
|
22
22
|
import dayjs from 'dayjs';
|
|
23
23
|
import { BaseForm } from "../base-form";
|
|
24
|
+
import { ProFormDateRangePickerV2 } from "../components/ProFormDateRangePickerV2";
|
|
25
|
+
import { ProFormDigitRangeV2 } from "../components/ProFormDigitRangeV2";
|
|
24
26
|
import { getFieldsDefaultValues } from "./handlerData";
|
|
25
27
|
import { createElement as _createElement } from "react";
|
|
26
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -460,6 +462,20 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
460
462
|
}
|
|
461
463
|
});
|
|
462
464
|
}
|
|
465
|
+
if (valueType === 'dateRangeV2') {
|
|
466
|
+
// const initialValues = getFieldsDefaultValues([item]);
|
|
467
|
+
return dynamicCom(ProFormDateRangePickerV2, {
|
|
468
|
+
name: [splitKeyStr(fields[0]), splitKeyStr(fields[1])],
|
|
469
|
+
placeholder: [formatMessage({
|
|
470
|
+
id: 'rex.components.base-form.placeholder.date-range.start',
|
|
471
|
+
defaultMessage: '开始时间'
|
|
472
|
+
}), formatMessage({
|
|
473
|
+
id: 'rex.components.base-form.placeholder.date-range.end',
|
|
474
|
+
defaultMessage: '结束时间'
|
|
475
|
+
})],
|
|
476
|
+
initialValue: defaultValue
|
|
477
|
+
});
|
|
478
|
+
}
|
|
463
479
|
if (valueType === 'cascader') {
|
|
464
480
|
return dynamicCom(ProFormCascader, {
|
|
465
481
|
fieldProps: {
|
|
@@ -602,6 +618,24 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
602
618
|
})]
|
|
603
619
|
});
|
|
604
620
|
}
|
|
621
|
+
if (valueType === 'inputNumberRangeV2') {
|
|
622
|
+
return dynamicCom(ProFormDigitRangeV2, {
|
|
623
|
+
initialValue: defaultValue,
|
|
624
|
+
// name: keyStr as [string, string],
|
|
625
|
+
name: [splitKeyStr(fields[0]), splitKeyStr(fields[1])],
|
|
626
|
+
// transform: (inrValues: Array<number | undefined>) => ({
|
|
627
|
+
// [fields[0]]: inrValues[0],
|
|
628
|
+
// [fields[1]]: inrValues[1],
|
|
629
|
+
// }),
|
|
630
|
+
placeholder: [formatMessage({
|
|
631
|
+
id: 'rex.components.base-form.placeholder.input-number-range.min',
|
|
632
|
+
defaultMessage: '最小值'
|
|
633
|
+
}), formatMessage({
|
|
634
|
+
id: 'rex.components.base-form.placeholder.input-number-range.max',
|
|
635
|
+
defaultMessage: '最大值'
|
|
636
|
+
})]
|
|
637
|
+
});
|
|
638
|
+
}
|
|
605
639
|
if (valueType === 'textArea') {
|
|
606
640
|
return dynamicCom(ProFormTextArea, {
|
|
607
641
|
initialValue: defaultValue,
|
|
@@ -2,10 +2,12 @@ import { ProForm, ProFormCascader, ProFormCheckbox, ProFormDatePicker, ProFormDa
|
|
|
2
2
|
import { TButtonFilterItem } from "../..";
|
|
3
3
|
import { Form, GetProps } from 'antd';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
+
import { ProFormDateRangePickerV2 } from './components/ProFormDateRangePickerV2';
|
|
6
|
+
import { ProFormDigitRangeV2 } from './components/ProFormDigitRangeV2';
|
|
5
7
|
/** 组件props */
|
|
6
8
|
export interface IBaseFormProps {
|
|
7
9
|
/** 字段配置 */
|
|
8
|
-
fields?: Array<TInputProps | TDateRangeProps | TSelectProps | TSelectInputProps | TSelectDimProps | TCustomProps | TSelectDateRangeProps | TCascaderProps | TTreeSelectProps | TCheckboxProps | TCheckboxGroupProps | TRadioGroupProps | TInputNumberProps | TInputNumberRangeProps | TTextAreaProps | TSelectRadioProps | TMultipleComponentsProps | TSwitchProps | TDatePickerProps | THiddenProps>;
|
|
10
|
+
fields?: Array<TInputProps | TDateRangeProps | TSelectProps | TSelectInputProps | TSelectDimProps | TCustomProps | TSelectDateRangeProps | TCascaderProps | TTreeSelectProps | TCheckboxProps | TCheckboxGroupProps | TRadioGroupProps | TInputNumberProps | TInputNumberRangeProps | TTextAreaProps | TSelectRadioProps | TMultipleComponentsProps | TSwitchProps | TDatePickerProps | THiddenProps | TInputNumberRangeV2Props | TDateRangeV2Props>;
|
|
9
11
|
/** 字段对应的本地代码配置 */
|
|
10
12
|
fieldProps?: Record<string, Exclude<IBaseFormProps['fields'], undefined>[number]>;
|
|
11
13
|
/**
|
|
@@ -29,6 +31,7 @@ export type TInputProps = IBaseFormFieldItem<'input'> & Omit<GetProps<typeof Pro
|
|
|
29
31
|
export type TSelectProps = IBaseFormFieldItem<'select'> & Omit<GetProps<typeof ProFormSelect>, TOmitComponentItemType>;
|
|
30
32
|
export type TSelectDimProps = IBaseFormFieldItem<'selectDim'> & Omit<GetProps<typeof ProFormSelect>, TOmitComponentItemType>;
|
|
31
33
|
export type TDateRangeProps = IBaseFormFieldItem<'dateRange'> & Omit<GetProps<typeof ProFormDateRangePicker>, TOmitComponentItemType>;
|
|
34
|
+
export type TDateRangeV2Props = IBaseFormFieldItem<'dateRangeV2'> & Omit<GetProps<typeof ProFormDateRangePickerV2>, TOmitComponentItemType>;
|
|
32
35
|
export type TCascaderProps = IBaseFormFieldItem<'cascader'> & Omit<GetProps<typeof ProFormCascader>, TOmitComponentItemType>;
|
|
33
36
|
export type TTreeSelectProps = IBaseFormFieldItem<'treeSelect'> & Omit<GetProps<typeof ProFormTreeSelect>, TOmitComponentItemType>;
|
|
34
37
|
export type TCheckboxProps = IBaseFormFieldItem<'checkbox'> & Omit<GetProps<typeof ProFormCheckbox>, TOmitComponentItemType>;
|
|
@@ -36,6 +39,7 @@ export type TCheckboxGroupProps = IBaseFormFieldItem<'checkboxGroup'> & Omit<Get
|
|
|
36
39
|
export type TRadioGroupProps = IBaseFormFieldItem<'radioGroup'> & Omit<GetProps<typeof ProFormRadio>, TOmitComponentItemType>;
|
|
37
40
|
export type TInputNumberProps = IBaseFormFieldItem<'inputNumber'> & Omit<GetProps<typeof ProFormDigit>, TOmitComponentItemType>;
|
|
38
41
|
export type TInputNumberRangeProps = IBaseFormFieldItem<'inputNumberRange'> & Omit<GetProps<typeof ProFormDigitRange>, TOmitComponentItemType>;
|
|
42
|
+
export type TInputNumberRangeV2Props = IBaseFormFieldItem<'inputNumberRangeV2'> & Omit<GetProps<typeof ProFormDigitRangeV2>, TOmitComponentItemType>;
|
|
39
43
|
export type TTextAreaProps = IBaseFormFieldItem<'textArea'> & Omit<GetProps<typeof ProFormTextArea>, TOmitComponentItemType>;
|
|
40
44
|
export type TSelectRadioProps = IBaseFormFieldItem<'selectRadio'> & Omit<GetProps<typeof ProFormSelect>, TOmitComponentItemType>;
|
|
41
45
|
export type TSwitchProps = IBaseFormFieldItem<'switch'> & Omit<GetProps<typeof ProFormSwitch>, TOmitComponentItemType>;
|
|
@@ -178,5 +182,5 @@ export type TValueType = 'input'
|
|
|
178
182
|
* @desc 下拉框+输入框
|
|
179
183
|
* @deprecated 建议使用 multipleComponents 进行组合
|
|
180
184
|
*/
|
|
181
|
-
| 'selectInput' | 'selectDim' | 'dateRange' | 'selectDateRange' | 'cascader' | 'treeSelect' | 'checkbox' | 'checkboxGroup' | 'radioGroup' | 'inputNumber' | 'inputNumberRange' | 'textArea' | 'selectRadio' | 'multipleComponents' | 'switch' | 'datePicker' | 'hidden' | 'upload' | 'table' | 'custom';
|
|
185
|
+
| 'selectInput' | 'selectDim' | 'dateRange' | 'dateRangeV2' | 'selectDateRange' | 'cascader' | 'treeSelect' | 'checkbox' | 'checkboxGroup' | 'radioGroup' | 'inputNumber' | 'inputNumberRange' | 'inputNumberRangeV2' | 'textArea' | 'selectRadio' | 'multipleComponents' | 'switch' | 'datePicker' | 'hidden' | 'upload' | 'table' | 'custom';
|
|
182
186
|
export {};
|
|
@@ -5,11 +5,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { RexProConfigProvider } from "../../../context";
|
|
8
|
+
import { UploadPlus } from "../../..";
|
|
8
9
|
import { Card, message } from 'antd';
|
|
9
10
|
import enUS from 'antd/es/calendar/locale/en_US';
|
|
10
11
|
import { crush } from 'radash';
|
|
11
12
|
import { createIntl } from 'react-intl';
|
|
12
|
-
import { UploadPlus } from "../../..";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
export default (function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@ant-design/icons": "^6.0.0",
|
|
52
52
|
"@ant-design/pro-components": "^2.8.10",
|
|
53
|
+
"@ant-design/pro-form": "^2.32.0",
|
|
53
54
|
"@iconify/react": "^6.0.0",
|
|
54
55
|
"@tiptap/core": "^2.12.0",
|
|
55
56
|
"@tiptap/extension-bullet-list": "2.12.0",
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
"peerDependencies": {
|
|
103
104
|
"@ant-design/icons": ">=5.0.0",
|
|
104
105
|
"@ant-design/pro-components": ">=2.0.0",
|
|
106
|
+
"@ant-design/pro-form": ">=2.0.0",
|
|
105
107
|
"antd": ">=5.0.0",
|
|
106
108
|
"react": ">=16.9.0",
|
|
107
109
|
"react-dom": ">=16.9.0",
|