@teamias/rex-design 0.0.1
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/components/action-buttons/action-buttons.d.ts +2 -0
- package/dist/components/action-buttons/action-buttons.js +182 -0
- package/dist/components/action-buttons/demo/index.d.ts +2 -0
- package/dist/components/action-buttons/demo/index.js +69 -0
- package/dist/components/action-buttons/index.d.ts +3 -0
- package/dist/components/action-buttons/index.js +3 -0
- package/dist/components/action-buttons/modules/handlerFilter.d.ts +2 -0
- package/dist/components/action-buttons/modules/handlerFilter.js +62 -0
- package/dist/components/action-buttons/types.d.ts +96 -0
- package/dist/components/action-buttons/types.js +3 -0
- package/dist/components/base-form/base-form.d.ts +3 -0
- package/dist/components/base-form/base-form.js +260 -0
- package/dist/components/base-form/demo/index.d.ts +4 -0
- package/dist/components/base-form/demo/index.js +515 -0
- package/dist/components/base-form/index.d.ts +4 -0
- package/dist/components/base-form/index.js +4 -0
- package/dist/components/base-form/locales/en-US.json +21 -0
- package/dist/components/base-form/locales/zh-CN.json +21 -0
- package/dist/components/base-form/locales.index.d.ts +42 -0
- package/dist/components/base-form/locales.index.js +4 -0
- package/dist/components/base-form/modules/dependencyUtils.d.ts +13 -0
- package/dist/components/base-form/modules/dependencyUtils.js +43 -0
- package/dist/components/base-form/modules/handlerData.d.ts +8 -0
- package/dist/components/base-form/modules/handlerData.js +59 -0
- package/dist/components/base-form/modules/renderComponentNode.d.ts +11 -0
- package/dist/components/base-form/modules/renderComponentNode.js +607 -0
- package/dist/components/base-form/modules/valuesToFields.d.ts +10 -0
- package/dist/components/base-form/modules/valuesToFields.js +18 -0
- package/dist/components/base-form/style/index.d.ts +3 -0
- package/dist/components/base-form/style/index.js +8 -0
- package/dist/components/base-form/types.d.ts +181 -0
- package/dist/components/base-form/types.js +10 -0
- package/dist/components/base-list-table/base-list-table.d.ts +33 -0
- package/dist/components/base-list-table/base-list-table.js +292 -0
- package/dist/components/base-list-table/demo/BasicBaseListTable.d.ts +2 -0
- package/dist/components/base-list-table/demo/BasicBaseListTable.js +1469 -0
- package/dist/components/base-list-table/demo/NoData.d.ts +2 -0
- package/dist/components/base-list-table/demo/NoData.js +55 -0
- package/dist/components/base-list-table/demo/TableMaxRowCount.d.ts +2 -0
- package/dist/components/base-list-table/demo/TableMaxRowCount.js +1696 -0
- package/dist/components/base-list-table/demo/VirtualDemo.d.ts +2 -0
- package/dist/components/base-list-table/demo/VirtualDemo.js +548 -0
- package/dist/components/base-list-table/index.d.ts +1 -0
- package/dist/components/base-list-table/index.js +1 -0
- package/dist/components/base-list-table/style/index.d.ts +5 -0
- package/dist/components/base-list-table/style/index.js +17 -0
- package/dist/components/base-table/base-table.d.ts +51 -0
- package/dist/components/base-table/base-table.js +291 -0
- package/dist/components/base-table/components/BaseTableRow.d.ts +1 -0
- package/dist/components/base-table/components/BaseTableRow.js +129 -0
- package/dist/components/base-table/demo/BaseTableAll.d.ts +2 -0
- package/dist/components/base-table/demo/BaseTableAll.js +66 -0
- package/dist/components/base-table/demo/BaseTableBasic.d.ts +2 -0
- package/dist/components/base-table/demo/BaseTableBasic.js +58 -0
- package/dist/components/base-table/demo/BaseTableIndex.d.ts +2 -0
- package/dist/components/base-table/demo/BaseTableIndex.js +57 -0
- package/dist/components/base-table/demo/BaseTableRowSelect.d.ts +2 -0
- package/dist/components/base-table/demo/BaseTableRowSelect.js +45 -0
- package/dist/components/base-table/demo/tableData.d.ts +332 -0
- package/dist/components/base-table/demo/tableData.js +293 -0
- package/dist/components/base-table/index.d.ts +1 -0
- package/dist/components/base-table/index.js +1 -0
- package/dist/components/base-table/style/index.d.ts +3 -0
- package/dist/components/base-table/style/index.js +9 -0
- package/dist/components/data-cell/data-cell.d.ts +3 -0
- package/dist/components/data-cell/data-cell.js +17 -0
- package/dist/components/data-cell/demo/index.d.ts +2 -0
- package/dist/components/data-cell/demo/index.js +332 -0
- package/dist/components/data-cell/index.d.ts +2 -0
- package/dist/components/data-cell/index.js +2 -0
- package/dist/components/data-cell/modules/cellItemMap.d.ts +3 -0
- package/dist/components/data-cell/modules/cellItemMap.js +374 -0
- package/dist/components/data-cell/style/index.d.ts +7 -0
- package/dist/components/data-cell/style/index.js +23 -0
- package/dist/components/data-cell/types.d.ts +192 -0
- package/dist/components/data-cell/types.js +1 -0
- package/dist/components/icons/assets/icon-park--arrow-up.svg +7 -0
- package/dist/components/icons/assets/index.d.ts +4 -0
- package/dist/components/icons/assets/index.js +9 -0
- package/dist/components/icons/assets/svg-spinners--blocks-shuffle-3.svg +21 -0
- package/dist/components/icons/demo/index.d.ts +2 -0
- package/dist/components/icons/demo/index.js +43 -0
- package/dist/components/icons/icons.d.ts +39 -0
- package/dist/components/icons/icons.js +251 -0
- package/dist/components/icons/index.d.ts +1 -0
- package/dist/components/icons/index.js +1 -0
- package/dist/components/icons/style/index.d.ts +2 -0
- package/dist/components/icons/style/index.js +5 -0
- package/dist/components/media-viewer/demo/index.d.ts +2 -0
- package/dist/components/media-viewer/demo/index.js +23 -0
- package/dist/components/media-viewer/index.d.ts +1 -0
- package/dist/components/media-viewer/index.js +1 -0
- package/dist/components/media-viewer/media-viewer.d.ts +48 -0
- package/dist/components/media-viewer/media-viewer.js +119 -0
- package/dist/components/media-viewer/style/index.d.ts +6 -0
- package/dist/components/media-viewer/style/index.js +31 -0
- package/dist/hooks/request-fields-container/demo/index.d.ts +2 -0
- package/dist/hooks/request-fields-container/demo/index.js +36 -0
- package/dist/hooks/request-fields-container/index.d.ts +4 -0
- package/dist/hooks/request-fields-container/index.js +3 -0
- package/dist/hooks/request-fields-container/request-fields-container-context-provider.d.ts +22 -0
- package/dist/hooks/request-fields-container/request-fields-container-context-provider.js +134 -0
- package/dist/hooks/request-fields-container/request-fields-container-context.d.ts +39 -0
- package/dist/hooks/request-fields-container/request-fields-container-context.js +5 -0
- package/dist/hooks/request-fields-container/request-fields-container-hoc.d.ts +4 -0
- package/dist/hooks/request-fields-container/request-fields-container-hoc.js +31 -0
- package/dist/hooks/request-fields-container/use-request-fields-container.d.ts +22 -0
- package/dist/hooks/request-fields-container/use-request-fields-container.js +131 -0
- package/dist/hooks/rex-pro-config-provider/demo/index.d.ts +2 -0
- package/dist/hooks/rex-pro-config-provider/demo/index.js +61 -0
- package/dist/hooks/rex-pro-config-provider/index.d.ts +2 -0
- package/dist/hooks/rex-pro-config-provider/index.js +2 -0
- package/dist/hooks/rex-pro-config-provider/rex-pro-config-context.d.ts +27 -0
- package/dist/hooks/rex-pro-config-provider/rex-pro-config-context.js +33 -0
- package/dist/hooks/rex-pro-config-provider/rex-pro-config-provider.d.ts +6 -0
- package/dist/hooks/rex-pro-config-provider/rex-pro-config-provider.js +24 -0
- package/dist/hooks/rex-pro-config-provider/use-rex-pro-config-provider.d.ts +2 -0
- package/dist/hooks/rex-pro-config-provider/use-rex-pro-config-provider.js +11 -0
- package/dist/hooks/use-state-data/demo/index.d.ts +2 -0
- package/dist/hooks/use-state-data/demo/index.js +135 -0
- package/dist/hooks/use-state-data/index.d.ts +1 -0
- package/dist/hooks/use-state-data/index.js +1 -0
- package/dist/hooks/use-state-data/use-state-data.d.ts +11 -0
- package/dist/hooks/use-state-data/use-state-data.js +64 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/types/svg.d.ts +4 -0
- package/dist/utils/locales/en-US.json +13 -0
- package/dist/utils/locales/index.d.ts +26 -0
- package/dist/utils/locales/index.js +4 -0
- package/dist/utils/locales/zh-CN.json +13 -0
- package/package.json +90 -0
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
var _excluded = ["valueType", "label", "defaultValue", "childWidths", "fieldProps", "formItemProps"],
|
|
2
|
+
_excluded2 = ["formItemProps", "fieldProps"],
|
|
3
|
+
_excluded3 = ["formItemProps", "fieldProps", "name"],
|
|
4
|
+
_excluded4 = ["formItemProps", "fieldProps"],
|
|
5
|
+
_excluded5 = ["formItemProps", "fieldProps"],
|
|
6
|
+
_excluded6 = ["formItemProps", "fieldProps"],
|
|
7
|
+
_excluded7 = ["keyWords"],
|
|
8
|
+
_excluded8 = ["keyWords"];
|
|
9
|
+
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; }
|
|
10
|
+
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); } }
|
|
11
|
+
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); }); }; }
|
|
12
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
+
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); }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
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; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
18
|
+
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); }
|
|
19
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
+
/* eslint-disable import/no-cycle */
|
|
22
|
+
import { ProFormCascader, ProFormCheckbox, ProFormDatePicker, ProFormDateRangePicker, ProFormDependency, ProFormDigit, ProFormDigitRange, ProFormFieldSet, ProFormItem, ProFormItemRender, ProFormRadio, ProFormSelect, ProFormSwitch, ProFormText, ProFormTextArea, ProFormTreeSelect } from "@ant-design/pro-components";
|
|
23
|
+
import classNames from "classnames";
|
|
24
|
+
import dayjs from 'dayjs';
|
|
25
|
+
import React from "react";
|
|
26
|
+
import { BaseForm } from "../base-form";
|
|
27
|
+
import { getFieldsDefaultValues } from "./handlerData";
|
|
28
|
+
var getWidth = function getWidth(val) {
|
|
29
|
+
return {
|
|
30
|
+
width: val,
|
|
31
|
+
minWidth: val,
|
|
32
|
+
maxWidth: val
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** 获取前缀 */
|
|
37
|
+
var getPlaceholderPrefix = function getPlaceholderPrefix(type, formatMessage) {
|
|
38
|
+
if (['checkboxGroup', 'radioGroup', 'checkbox', 'inputNumberRange'].includes(type)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
if (['input', 'selectDim', 'inputNumber', 'selectInput'].includes(type)) {
|
|
42
|
+
return formatMessage({
|
|
43
|
+
id: 'bit.data-entry.base-form.placeholder.input',
|
|
44
|
+
defaultMessage: '请输入'
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return formatMessage({
|
|
48
|
+
id: 'bit.data-entry.base-form.placeholder.select',
|
|
49
|
+
defaultMessage: '请选择'
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** 获取控件最小宽度 */
|
|
54
|
+
var getValueTypeMinWidth = function getValueTypeMinWidth(type) {
|
|
55
|
+
if (['selectDateRange', 'dateRange'].includes(type)) {
|
|
56
|
+
// return 312;
|
|
57
|
+
}
|
|
58
|
+
if (['inputNumberRange', 'selectRadio'].includes(type)) {
|
|
59
|
+
// return 200;
|
|
60
|
+
}
|
|
61
|
+
return 100;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** 渲染组件项 */
|
|
65
|
+
export var renderComponentNode = function renderComponentNode(outConfig, values, form) {
|
|
66
|
+
var fields = outConfig.fields,
|
|
67
|
+
keyStr = outConfig.keyStr,
|
|
68
|
+
item = outConfig.item,
|
|
69
|
+
_outConfig$item = outConfig.item,
|
|
70
|
+
valueType = _outConfig$item.valueType,
|
|
71
|
+
label = _outConfig$item.label,
|
|
72
|
+
defaultValue = _outConfig$item.defaultValue,
|
|
73
|
+
_outConfig$item$child = _outConfig$item.childWidths,
|
|
74
|
+
childWidths = _outConfig$item$child === void 0 ? [] : _outConfig$item$child,
|
|
75
|
+
rawFieldProps = _outConfig$item.fieldProps,
|
|
76
|
+
rawFormItemProps = _outConfig$item.formItemProps,
|
|
77
|
+
otherProps = _objectWithoutProperties(_outConfig$item, _excluded),
|
|
78
|
+
requestOptions = outConfig.requestOptions,
|
|
79
|
+
itemWidth = outConfig.itemWidth,
|
|
80
|
+
inlineLabel = outConfig.inlineLabel,
|
|
81
|
+
labelWidth = outConfig.labelWidth,
|
|
82
|
+
itemMarginBottom = outConfig.itemMarginBottom,
|
|
83
|
+
formatMessage = outConfig.formatMessage;
|
|
84
|
+
var placeholderPrefix = getPlaceholderPrefix(valueType, formatMessage);
|
|
85
|
+
var inlineLabelStatus = inlineLabel && typeof placeholderPrefix === 'string';
|
|
86
|
+
var getMergeConfig = function getMergeConfig(localConfig) {
|
|
87
|
+
var _otherProps$labelWidt, _otherProps$itemWidth;
|
|
88
|
+
var defaultInject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
89
|
+
/** 公共属性 */
|
|
90
|
+
var commonProps = {
|
|
91
|
+
name: fields[0],
|
|
92
|
+
label: inlineLabelStatus ? undefined : label,
|
|
93
|
+
placeholder: label && inlineLabelStatus ? "".concat(placeholderPrefix).concat(label) : placeholderPrefix
|
|
94
|
+
};
|
|
95
|
+
var config = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultInject ? commonProps : {}), localConfig), defaultInject ? otherProps : {}), {}, {
|
|
96
|
+
fieldProps: _objectSpread(_objectSpread({}, 'fieldProps' in localConfig && _typeof(localConfig.fieldProps) === 'object' ? localConfig.fieldProps : {}), defaultInject ? rawFieldProps : {})
|
|
97
|
+
}, defaultInject ? {
|
|
98
|
+
formItemProps: _objectSpread(_objectSpread({}, rawFormItemProps), {}, {
|
|
99
|
+
className: 'base-form-item',
|
|
100
|
+
style: _objectSpread(_objectSpread({
|
|
101
|
+
// 本地配置 > 接口配置 > 全局配置
|
|
102
|
+
marginBottom: itemMarginBottom,
|
|
103
|
+
minWidth: getValueTypeMinWidth(valueType)
|
|
104
|
+
}, {
|
|
105
|
+
'--label-width': (_otherProps$labelWidt = otherProps.labelWidth) !== null && _otherProps$labelWidt !== void 0 ? _otherProps$labelWidt : labelWidth,
|
|
106
|
+
'--item-width': (_otherProps$itemWidth = otherProps.itemWidth) !== null && _otherProps$itemWidth !== void 0 ? _otherProps$itemWidth : itemWidth
|
|
107
|
+
}), rawFormItemProps === null || rawFormItemProps === void 0 ? void 0 : rawFormItemProps.style)
|
|
108
|
+
})
|
|
109
|
+
} : {});
|
|
110
|
+
return config;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** 动态组件注入参数 */
|
|
114
|
+
var dynamicCom = function dynamicCom(Com, localConfig) {
|
|
115
|
+
var defaultInject = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
116
|
+
// & {name: string | string[]}
|
|
117
|
+
var InlineCom = Com;
|
|
118
|
+
var config = getMergeConfig(localConfig, defaultInject);
|
|
119
|
+
|
|
120
|
+
// console.log(config);
|
|
121
|
+
return /*#__PURE__*/React.createElement(InlineCom, _extends({}, config, {
|
|
122
|
+
key: defaultInject ? keyStr : undefined
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
if (valueType === 'custom') {
|
|
126
|
+
var _getMergeConfig = getMergeConfig({
|
|
127
|
+
name: keyStr
|
|
128
|
+
}),
|
|
129
|
+
formItemProps = _getMergeConfig.formItemProps,
|
|
130
|
+
fieldProps = _getMergeConfig.fieldProps,
|
|
131
|
+
otherConfigProps = _objectWithoutProperties(_getMergeConfig, _excluded2);
|
|
132
|
+
return /*#__PURE__*/React.createElement(ProFormItemRender, _extends({
|
|
133
|
+
name: keyStr
|
|
134
|
+
}, otherConfigProps, formItemProps, {
|
|
135
|
+
key: keyStr
|
|
136
|
+
}), function (customItemProps) {
|
|
137
|
+
return otherProps === null || otherProps === void 0 ? void 0 : otherProps.render(customItemProps, form);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (valueType === 'multipleComponents') {
|
|
141
|
+
var _inlineItem$subItems$, _inlineItem$subItems;
|
|
142
|
+
var _getMergeConfig2 = getMergeConfig({
|
|
143
|
+
name: keyStr
|
|
144
|
+
}),
|
|
145
|
+
_formItemProps = _getMergeConfig2.formItemProps,
|
|
146
|
+
_fieldProps = _getMergeConfig2.fieldProps,
|
|
147
|
+
name = _getMergeConfig2.name,
|
|
148
|
+
_otherConfigProps = _objectWithoutProperties(_getMergeConfig2, _excluded3);
|
|
149
|
+
var inlineItem = item;
|
|
150
|
+
return /*#__PURE__*/React.createElement(ProFormItem, _extends({}, _otherConfigProps, _formItemProps, {
|
|
151
|
+
// style={{
|
|
152
|
+
// ...formItemProps?.style,
|
|
153
|
+
// marginBottom: 0,
|
|
154
|
+
// }}
|
|
155
|
+
key: keyStr
|
|
156
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: classNames("base-form-field-multiple-group", {
|
|
158
|
+
compact: inlineItem.compact
|
|
159
|
+
})
|
|
160
|
+
}, /*#__PURE__*/React.createElement(BaseForm, _extends({}, outConfig.rawAllProps, {
|
|
161
|
+
itemWidth: "".concat(100 / ((_inlineItem$subItems$ = (_inlineItem$subItems = inlineItem.subItems) === null || _inlineItem$subItems === void 0 ? void 0 : _inlineItem$subItems.length) !== null && _inlineItem$subItems$ !== void 0 ? _inlineItem$subItems$ : 1), "%"),
|
|
162
|
+
fields: inlineItem.subItems,
|
|
163
|
+
itemMarginBottom: 0
|
|
164
|
+
}))));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// 特殊包裹过的, 废弃
|
|
168
|
+
// eslint-disable-next-line no-lone-blocks
|
|
169
|
+
{
|
|
170
|
+
if (valueType === 'selectInput') {
|
|
171
|
+
var _childWidths$;
|
|
172
|
+
var _getMergeConfig3 = getMergeConfig({
|
|
173
|
+
name: keyStr
|
|
174
|
+
}),
|
|
175
|
+
_formItemProps2 = _getMergeConfig3.formItemProps,
|
|
176
|
+
_fieldProps2 = _getMergeConfig3.fieldProps,
|
|
177
|
+
_otherConfigProps2 = _objectWithoutProperties(_getMergeConfig3, _excluded4);
|
|
178
|
+
return /*#__PURE__*/React.createElement(ProFormItem, _extends({}, _formItemProps2, {
|
|
179
|
+
style: _objectSpread(_objectSpread({}, _formItemProps2.style), {}, {
|
|
180
|
+
marginBottom: 0
|
|
181
|
+
}),
|
|
182
|
+
key: keyStr
|
|
183
|
+
}), /*#__PURE__*/React.createElement(ProFormFieldSet, _extends({}, _otherConfigProps2, {
|
|
184
|
+
type: "group",
|
|
185
|
+
space: {
|
|
186
|
+
className: 'base-form-field-group'
|
|
187
|
+
},
|
|
188
|
+
transform: function transform(value) {
|
|
189
|
+
return _defineProperty(_defineProperty({}, fields[0], value[0]), fields[1], value[1]);
|
|
190
|
+
}
|
|
191
|
+
}), dynamicCom(ProFormSelect, {
|
|
192
|
+
style: getWidth((_childWidths$ = childWidths[0]) !== null && _childWidths$ !== void 0 ? _childWidths$ : 100),
|
|
193
|
+
options: item.options,
|
|
194
|
+
allowClear: false,
|
|
195
|
+
showSearch: true
|
|
196
|
+
}, false), dynamicCom(ProFormText, {}, true)));
|
|
197
|
+
}
|
|
198
|
+
if (valueType === 'selectDateRange') {
|
|
199
|
+
var _childWidths$2;
|
|
200
|
+
var _getMergeConfig4 = getMergeConfig({
|
|
201
|
+
name: keyStr
|
|
202
|
+
}),
|
|
203
|
+
_formItemProps3 = _getMergeConfig4.formItemProps,
|
|
204
|
+
_fieldProps3 = _getMergeConfig4.fieldProps,
|
|
205
|
+
_otherConfigProps3 = _objectWithoutProperties(_getMergeConfig4, _excluded5);
|
|
206
|
+
return /*#__PURE__*/React.createElement(ProFormItem, _extends({}, _formItemProps3, {
|
|
207
|
+
style: _objectSpread(_objectSpread({}, _formItemProps3.style), {}, {
|
|
208
|
+
marginBottom: 0
|
|
209
|
+
}),
|
|
210
|
+
key: keyStr
|
|
211
|
+
}), /*#__PURE__*/React.createElement(ProFormFieldSet, _extends({}, _otherConfigProps3, {
|
|
212
|
+
type: "group",
|
|
213
|
+
space: {
|
|
214
|
+
className: 'base-form-field-group'
|
|
215
|
+
},
|
|
216
|
+
convertValue: function convertValue(value) {
|
|
217
|
+
// console.log(value);
|
|
218
|
+
// const val = value?.slice();
|
|
219
|
+
return [value === null || value === void 0 ? void 0 : value[0], typeof (value === null || value === void 0 ? void 0 : value[1]) === 'string' ? [value === null || value === void 0 ? void 0 : value[1], value === null || value === void 0 ? void 0 : value[2]] : value === null || value === void 0 ? void 0 : value[1]
|
|
220
|
+
// Array.isArray(value?.[1]) ? value?.[1].flat() : value?.[1],
|
|
221
|
+
// value?.[2]
|
|
222
|
+
];
|
|
223
|
+
},
|
|
224
|
+
transform: function transform(value) {
|
|
225
|
+
var _newValue$, _newValue$2;
|
|
226
|
+
var newValue = typeof (value === null || value === void 0 ? void 0 : value[1]) === 'string' ? [dayjs(value === null || value === void 0 ? void 0 : value[1]), dayjs(value === null || value === void 0 ? void 0 : value[2])] : (value === null || value === void 0 ? void 0 : value[1]) || [];
|
|
227
|
+
return _defineProperty(_defineProperty(_defineProperty({}, fields[0], value[0]), fields[1], (_newValue$ = newValue[0]) === null || _newValue$ === void 0 ? void 0 : _newValue$.format('YYYY-MM-DD')), fields[2], (_newValue$2 = newValue[1]) === null || _newValue$2 === void 0 ? void 0 : _newValue$2.format('YYYY-MM-DD'));
|
|
228
|
+
}
|
|
229
|
+
}), dynamicCom(ProFormSelect, {
|
|
230
|
+
style: getWidth((_childWidths$2 = childWidths[0]) !== null && _childWidths$2 !== void 0 ? _childWidths$2 : 100),
|
|
231
|
+
// name: fields[0],
|
|
232
|
+
options: item.options,
|
|
233
|
+
allowClear: false,
|
|
234
|
+
showSearch: true,
|
|
235
|
+
ignoreFormItem: true
|
|
236
|
+
}, false), dynamicCom(ProFormDateRangePicker, {
|
|
237
|
+
ignoreFormItem: true,
|
|
238
|
+
placeholder: [formatMessage({
|
|
239
|
+
id: 'bit.data-entry.base-form.placeholder.date-range.start',
|
|
240
|
+
defaultMessage: '开始时间'
|
|
241
|
+
}), formatMessage({
|
|
242
|
+
id: 'bit.data-entry.base-form.placeholder.date-range.end',
|
|
243
|
+
defaultMessage: '结束时间'
|
|
244
|
+
})]
|
|
245
|
+
}, true)));
|
|
246
|
+
}
|
|
247
|
+
if (valueType === 'selectRadio') {
|
|
248
|
+
var _getMergeConfig5 = getMergeConfig({
|
|
249
|
+
name: keyStr
|
|
250
|
+
}),
|
|
251
|
+
_formItemProps4 = _getMergeConfig5.formItemProps,
|
|
252
|
+
_fieldProps4 = _getMergeConfig5.fieldProps,
|
|
253
|
+
_otherConfigProps4 = _objectWithoutProperties(_getMergeConfig5, _excluded6);
|
|
254
|
+
return /*#__PURE__*/React.createElement(ProFormItem, _extends({}, _formItemProps4, {
|
|
255
|
+
style: _objectSpread(_objectSpread({}, _formItemProps4.style), {}, {
|
|
256
|
+
marginBottom: 0
|
|
257
|
+
}),
|
|
258
|
+
key: keyStr
|
|
259
|
+
}), /*#__PURE__*/React.createElement(ProFormFieldSet, _extends({}, _otherConfigProps4, {
|
|
260
|
+
type: "group",
|
|
261
|
+
space: {
|
|
262
|
+
className: 'base-form-field-group'
|
|
263
|
+
},
|
|
264
|
+
transform: function transform(value) {
|
|
265
|
+
return _defineProperty(_defineProperty({}, fields[0], value[0]), fields[1], value[1]);
|
|
266
|
+
}
|
|
267
|
+
}), dynamicCom(ProFormSelect, {
|
|
268
|
+
style: {
|
|
269
|
+
flex: 1
|
|
270
|
+
},
|
|
271
|
+
options: item.options,
|
|
272
|
+
allowClear: false,
|
|
273
|
+
showSearch: true
|
|
274
|
+
}, true), dynamicCom(ProFormSelect, {
|
|
275
|
+
style: {
|
|
276
|
+
flex: 1
|
|
277
|
+
},
|
|
278
|
+
options: [{
|
|
279
|
+
label: '是',
|
|
280
|
+
value: 1
|
|
281
|
+
}, {
|
|
282
|
+
label: '否',
|
|
283
|
+
value: 2
|
|
284
|
+
}],
|
|
285
|
+
allowClear: true,
|
|
286
|
+
showSearch: true
|
|
287
|
+
}, false)));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// 简易
|
|
292
|
+
// eslint-disable-next-line no-lone-blocks
|
|
293
|
+
{
|
|
294
|
+
if (valueType === 'checkbox') {
|
|
295
|
+
return dynamicCom(ProFormCheckbox, {
|
|
296
|
+
name: keyStr,
|
|
297
|
+
initialValue: defaultValue
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (valueType === 'switch') {
|
|
301
|
+
return dynamicCom(ProFormSwitch, {
|
|
302
|
+
name: keyStr,
|
|
303
|
+
initialValue: defaultValue
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (valueType === 'datePicker') {
|
|
307
|
+
return dynamicCom(ProFormDatePicker, {
|
|
308
|
+
name: keyStr,
|
|
309
|
+
initialValue: defaultValue
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
if (valueType === 'input') {
|
|
313
|
+
return dynamicCom(ProFormText, {
|
|
314
|
+
name: keyStr,
|
|
315
|
+
initialValue: defaultValue
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
if (valueType === 'select') {
|
|
319
|
+
return dynamicCom(ProFormSelect, {
|
|
320
|
+
mode: item.multiple ? 'multiple' : 'single',
|
|
321
|
+
showSearch: true,
|
|
322
|
+
fieldProps: {
|
|
323
|
+
maxTagCount: 'responsive'
|
|
324
|
+
},
|
|
325
|
+
debounceTime: 300,
|
|
326
|
+
name: keyStr,
|
|
327
|
+
options: item.api ? undefined : item.options,
|
|
328
|
+
params: item.api ? _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams) : undefined,
|
|
329
|
+
initialValue: defaultValue,
|
|
330
|
+
request: function () {
|
|
331
|
+
if (!item.api) return undefined;
|
|
332
|
+
var map = {};
|
|
333
|
+
return /*#__PURE__*/function () {
|
|
334
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
|
|
335
|
+
var keyWords, params, key, res;
|
|
336
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
337
|
+
while (1) switch (_context.prev = _context.next) {
|
|
338
|
+
case 0:
|
|
339
|
+
keyWords = _ref4.keyWords, params = _objectWithoutProperties(_ref4, _excluded7);
|
|
340
|
+
key = JSON.stringify(params || '');
|
|
341
|
+
if (!map[key]) {
|
|
342
|
+
_context.next = 4;
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
return _context.abrupt("return", map[key]);
|
|
346
|
+
case 4:
|
|
347
|
+
_context.next = 6;
|
|
348
|
+
return requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions(item.api, params, item);
|
|
349
|
+
case 6:
|
|
350
|
+
_context.t0 = _context.sent;
|
|
351
|
+
if (_context.t0) {
|
|
352
|
+
_context.next = 9;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
_context.t0 = [];
|
|
356
|
+
case 9:
|
|
357
|
+
res = _context.t0;
|
|
358
|
+
map[key] = res;
|
|
359
|
+
return _context.abrupt("return", res);
|
|
360
|
+
case 12:
|
|
361
|
+
case "end":
|
|
362
|
+
return _context.stop();
|
|
363
|
+
}
|
|
364
|
+
}, _callee);
|
|
365
|
+
}));
|
|
366
|
+
return function (_x) {
|
|
367
|
+
return _ref5.apply(this, arguments);
|
|
368
|
+
};
|
|
369
|
+
}();
|
|
370
|
+
}()
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
if (valueType === 'selectDim') {
|
|
374
|
+
var paramsProp = _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams);
|
|
375
|
+
// console.log(1111, params);
|
|
376
|
+
|
|
377
|
+
return /*#__PURE__*/React.createElement(ProFormDependency, {
|
|
378
|
+
name: [keyStr],
|
|
379
|
+
key: keyStr
|
|
380
|
+
}, function (dependData) {
|
|
381
|
+
// console.log(2222, dependData);
|
|
382
|
+
|
|
383
|
+
return dynamicCom(ProFormSelect, {
|
|
384
|
+
showSearch: true,
|
|
385
|
+
debounceTime: 300,
|
|
386
|
+
fieldProps: {
|
|
387
|
+
maxTagCount: 'responsive'
|
|
388
|
+
},
|
|
389
|
+
mode: item.multiple ? 'multiple' : 'single',
|
|
390
|
+
params: paramsProp,
|
|
391
|
+
name: keyStr,
|
|
392
|
+
initialValue: defaultValue,
|
|
393
|
+
request: function () {
|
|
394
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
395
|
+
var _params$keyWords, keyWords, restParams, newParams;
|
|
396
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
397
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
398
|
+
case 0:
|
|
399
|
+
// 拆分参数,keyWords 为搜索关键字,其余为接口参数
|
|
400
|
+
_params$keyWords = params.keyWords, keyWords = _params$keyWords === void 0 ? '' : _params$keyWords, restParams = _objectWithoutProperties(params, _excluded8);
|
|
401
|
+
newParams = restParams; // 如果配置了 apiSearchValueKey,则将依赖数据 dependData[keyStr] 赋值到对应参数
|
|
402
|
+
if (typeof item.apiSearchValueKey === 'string') {
|
|
403
|
+
newParams[item.apiSearchValueKey] = dependData[keyStr] || undefined;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// 处理搜索关键字参数的传递方式
|
|
407
|
+
if (item.apiSearchKey === false) {
|
|
408
|
+
// 配置为 false,默认传 keyWords 字段
|
|
409
|
+
newParams.keyWords = keyWords || undefined;
|
|
410
|
+
} else if (typeof item.apiSearchKey === 'string') {
|
|
411
|
+
// 配置为字符串,按指定字段名传递
|
|
412
|
+
newParams[item.apiSearchKey] = keyWords || undefined;
|
|
413
|
+
} else {
|
|
414
|
+
// 未配置,默认传 keyWords 和 keyStr 字段
|
|
415
|
+
newParams.keyWords = keyWords || undefined;
|
|
416
|
+
newParams[keyStr] = keyWords || undefined;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// 发起接口请求,返回选项数据
|
|
420
|
+
return _context2.abrupt("return", (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions(item.api, newParams, item)) || []);
|
|
421
|
+
case 5:
|
|
422
|
+
case "end":
|
|
423
|
+
return _context2.stop();
|
|
424
|
+
}
|
|
425
|
+
}, _callee2);
|
|
426
|
+
}));
|
|
427
|
+
function request(_x2) {
|
|
428
|
+
return _request.apply(this, arguments);
|
|
429
|
+
}
|
|
430
|
+
return request;
|
|
431
|
+
}()
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
if (valueType === 'dateRange') {
|
|
436
|
+
var initialValues = getFieldsDefaultValues([item]);
|
|
437
|
+
return dynamicCom(ProFormDateRangePicker, {
|
|
438
|
+
name: keyStr,
|
|
439
|
+
placeholder: [formatMessage({
|
|
440
|
+
id: 'bit.data-entry.base-form.placeholder.date-range.start',
|
|
441
|
+
defaultMessage: '开始时间'
|
|
442
|
+
}), formatMessage({
|
|
443
|
+
id: 'bit.data-entry.base-form.placeholder.date-range.end',
|
|
444
|
+
defaultMessage: '结束时间'
|
|
445
|
+
})],
|
|
446
|
+
initialValue: initialValues[keyStr],
|
|
447
|
+
transform: function transform(value) {
|
|
448
|
+
// console.log(value, arg);
|
|
449
|
+
return _defineProperty(_defineProperty({}, fields[0], value[0]), fields[1], value[1]);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
if (valueType === 'cascader') {
|
|
454
|
+
return dynamicCom(ProFormCascader, {
|
|
455
|
+
fieldProps: {
|
|
456
|
+
showSearch: true,
|
|
457
|
+
options: item.api ? undefined : item.options,
|
|
458
|
+
multiple: item.multiple,
|
|
459
|
+
maxTagCount: 'responsive',
|
|
460
|
+
fieldNames: {
|
|
461
|
+
label: 'label',
|
|
462
|
+
value: 'value',
|
|
463
|
+
children: 'children'
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
initialValue: defaultValue,
|
|
467
|
+
params: item.api ? _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams) : undefined,
|
|
468
|
+
name: keyStr,
|
|
469
|
+
request: item.api ? ( /*#__PURE__*/function () {
|
|
470
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
471
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
472
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
473
|
+
case 0:
|
|
474
|
+
return _context3.abrupt("return", (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions(item.api, params, item)) || []);
|
|
475
|
+
case 1:
|
|
476
|
+
case "end":
|
|
477
|
+
return _context3.stop();
|
|
478
|
+
}
|
|
479
|
+
}, _callee3);
|
|
480
|
+
}));
|
|
481
|
+
return function (_x3) {
|
|
482
|
+
return _ref7.apply(this, arguments);
|
|
483
|
+
};
|
|
484
|
+
}()) : undefined
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
if (valueType === 'treeSelect') {
|
|
488
|
+
return dynamicCom(ProFormTreeSelect, {
|
|
489
|
+
fieldProps: {
|
|
490
|
+
showSearch: true,
|
|
491
|
+
treeData: item.api ? undefined : item.options,
|
|
492
|
+
multiple: item.multiple,
|
|
493
|
+
treeCheckable: item.multiple,
|
|
494
|
+
maxTagCount: 'responsive',
|
|
495
|
+
fieldNames: {
|
|
496
|
+
label: 'label',
|
|
497
|
+
value: 'value',
|
|
498
|
+
children: 'children'
|
|
499
|
+
},
|
|
500
|
+
treeNodeFilterProp: 'label'
|
|
501
|
+
},
|
|
502
|
+
initialValue: defaultValue,
|
|
503
|
+
params: item.api ? _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams) : undefined,
|
|
504
|
+
name: keyStr,
|
|
505
|
+
request: item.api ? ( /*#__PURE__*/function () {
|
|
506
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
507
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
508
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
509
|
+
case 0:
|
|
510
|
+
return _context4.abrupt("return", (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions(item.api, params, item)) || []);
|
|
511
|
+
case 1:
|
|
512
|
+
case "end":
|
|
513
|
+
return _context4.stop();
|
|
514
|
+
}
|
|
515
|
+
}, _callee4);
|
|
516
|
+
}));
|
|
517
|
+
return function (_x4) {
|
|
518
|
+
return _ref8.apply(this, arguments);
|
|
519
|
+
};
|
|
520
|
+
}()) : undefined
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
if (valueType === 'checkboxGroup') {
|
|
524
|
+
return dynamicCom(ProFormCheckbox.Group, {
|
|
525
|
+
options: item.api ? undefined : item.options,
|
|
526
|
+
params: item.api ? _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams) : undefined,
|
|
527
|
+
layout: 'horizontal',
|
|
528
|
+
initialValue: defaultValue,
|
|
529
|
+
name: keyStr,
|
|
530
|
+
request: item.api ? ( /*#__PURE__*/function () {
|
|
531
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
532
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
533
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
534
|
+
case 0:
|
|
535
|
+
return _context5.abrupt("return", (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions(item.api, params, item)) || []);
|
|
536
|
+
case 1:
|
|
537
|
+
case "end":
|
|
538
|
+
return _context5.stop();
|
|
539
|
+
}
|
|
540
|
+
}, _callee5);
|
|
541
|
+
}));
|
|
542
|
+
return function (_x5) {
|
|
543
|
+
return _ref9.apply(this, arguments);
|
|
544
|
+
};
|
|
545
|
+
}()) : undefined
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
if (valueType === 'radioGroup') {
|
|
549
|
+
return dynamicCom(ProFormRadio.Group, {
|
|
550
|
+
options: item.api ? undefined : item.options,
|
|
551
|
+
params: item.api ? _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams) : undefined,
|
|
552
|
+
layout: 'horizontal',
|
|
553
|
+
initialValue: defaultValue,
|
|
554
|
+
name: keyStr,
|
|
555
|
+
request: item.api ? ( /*#__PURE__*/function () {
|
|
556
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
557
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
558
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
559
|
+
case 0:
|
|
560
|
+
return _context6.abrupt("return", (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions(item.api, params, item)) || []);
|
|
561
|
+
case 1:
|
|
562
|
+
case "end":
|
|
563
|
+
return _context6.stop();
|
|
564
|
+
}
|
|
565
|
+
}, _callee6);
|
|
566
|
+
}));
|
|
567
|
+
return function (_x6) {
|
|
568
|
+
return _ref10.apply(this, arguments);
|
|
569
|
+
};
|
|
570
|
+
}()) : undefined
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
if (valueType === 'inputNumber') {
|
|
574
|
+
return dynamicCom(ProFormDigit, {
|
|
575
|
+
initialValue: defaultValue,
|
|
576
|
+
name: keyStr
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
if (valueType === 'inputNumberRange') {
|
|
580
|
+
return dynamicCom(ProFormDigitRange, {
|
|
581
|
+
initialValue: defaultValue,
|
|
582
|
+
name: keyStr,
|
|
583
|
+
transform: function transform(inrValues) {
|
|
584
|
+
return _defineProperty(_defineProperty({}, fields[0], inrValues[0]), fields[1], inrValues[1]);
|
|
585
|
+
},
|
|
586
|
+
placeholder: [formatMessage({
|
|
587
|
+
id: 'bit.data-entry.base-form.placeholder.input-number-range.min',
|
|
588
|
+
defaultMessage: '最小值'
|
|
589
|
+
}), formatMessage({
|
|
590
|
+
id: 'bit.data-entry.base-form.placeholder.input-number-range.max',
|
|
591
|
+
defaultMessage: '最大值'
|
|
592
|
+
})]
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
if (valueType === 'textArea') {
|
|
596
|
+
return dynamicCom(ProFormTextArea, {
|
|
597
|
+
initialValue: defaultValue,
|
|
598
|
+
name: keyStr
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
console.error("valueType: ".concat(valueType, " ").concat(formatMessage({
|
|
603
|
+
id: 'bit.data-entry.base-form.value-type-match-error',
|
|
604
|
+
defaultMessage: '匹配不到'
|
|
605
|
+
})));
|
|
606
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
607
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* - 为了解决使用 setFieldsValue 时候, 依赖项影响, 导致值情况的问题
|
|
3
|
+
* - 把对象转成 FieldData[], 通过 setFields 进行赋值, 来解决值清空问题
|
|
4
|
+
* - 关键点在 FieldData['touched'] 这个字段为 false
|
|
5
|
+
*/
|
|
6
|
+
export declare const valuesToFields: (data?: Record<string, unknown>) => {
|
|
7
|
+
name: (string | number)[];
|
|
8
|
+
touched: boolean;
|
|
9
|
+
value: unknown;
|
|
10
|
+
}[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { get, keys } from 'radash';
|
|
2
|
+
/**
|
|
3
|
+
* - 为了解决使用 setFieldsValue 时候, 依赖项影响, 导致值情况的问题
|
|
4
|
+
* - 把对象转成 FieldData[], 通过 setFields 进行赋值, 来解决值清空问题
|
|
5
|
+
* - 关键点在 FieldData['touched'] 这个字段为 false
|
|
6
|
+
*/
|
|
7
|
+
export var valuesToFields = function valuesToFields(data) {
|
|
8
|
+
if (!data) return [];
|
|
9
|
+
return keys(data).map(function (key) {
|
|
10
|
+
return {
|
|
11
|
+
name: key.split('.').map(function (k) {
|
|
12
|
+
return Number.isNaN(+k) ? k : +k;
|
|
13
|
+
}),
|
|
14
|
+
touched: false,
|
|
15
|
+
value: get(data, key)
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const BaseFormStyle: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & object>;
|
|
3
|
+
export declare const SetingtabsStyle: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & object>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'styled-components';
|
|
2
|
+
var compactArr = ['ant-input-outlined', 'ant-select-selector', 'ant-picker', 'ant-input-number-outlined'];
|
|
3
|
+
export var BaseFormStyle = createGlobalStyle([".base-form-field-group{display:flex !important;}.base-form-field-multiple-group{display:flex;width:100%;gap:8px;}.base-form-field-multiple-group.compact{gap:0;", "{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:transparent;}", "{border-top-right-radius:0;border-bottom-right-radius:0;}}.base-form-item{width:var(--item-width);.ant-form-item-label:has(label[title]){width:var(--label-width);}.ant-picker{width:100%;}.ant-space-compact{width:100%;}}"], compactArr.map(function (str) {
|
|
4
|
+
return "> div:not(:first-child) .".concat(str);
|
|
5
|
+
}).join(','), compactArr.map(function (str) {
|
|
6
|
+
return "> div:not(:last-child) .".concat(str);
|
|
7
|
+
}).join(','));
|
|
8
|
+
export var SetingtabsStyle = createGlobalStyle([".ant-tabs-content-holder{height:600px;overflow:auto;}.setting-container{padding:16px;}::-webkit-scrollbar{width:6px;background-color:#f5f5f5;}::-webkit-scrollbar-thumb{background-color:#888;border-radius:3px;}"]);
|