@fle-ui/plus-table 1.2.22-beta.0 → 1.2.22
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/es/FormSearch/FormRender.d.ts +31 -0
- package/es/FormSearch/FormRender.js +208 -0
- package/es/FormSearch/index.d.ts +44 -0
- package/es/FormSearch/index.js +186 -0
- package/es/FormSearch/index.less +59 -0
- package/es/components/icon/index.d.ts +3 -0
- package/es/components/icon/index.js +7 -0
- package/es/index.d.ts +82 -0
- package/es/index.js +493 -0
- package/es/index.less +107 -0
- package/es/json/columnKeys.d.ts +15 -0
- package/es/json/columnKeys.js +198 -0
- package/es/utils/api.d.ts +9 -0
- package/es/utils/api.js +9 -0
- package/es/utils/common.d.ts +27 -0
- package/es/utils/common.js +36 -0
- package/es/utils/options.d.ts +25 -0
- package/es/utils/options.js +95 -0
- package/es/utils/request.d.ts +26 -0
- package/es/utils/request.js +176 -0
- package/es/utils/serviceEnv.d.ts +6 -0
- package/es/utils/serviceEnv.js +12 -0
- package/lib/FormSearch/FormRender.d.ts +31 -0
- package/lib/FormSearch/FormRender.js +214 -0
- package/lib/FormSearch/index.d.ts +44 -0
- package/lib/FormSearch/index.js +193 -0
- package/lib/FormSearch/index.less +59 -0
- package/lib/components/icon/index.d.ts +3 -0
- package/lib/components/icon/index.js +13 -0
- package/lib/index.d.ts +82 -0
- package/lib/index.js +497 -0
- package/lib/index.less +107 -0
- package/lib/json/columnKeys.d.ts +15 -0
- package/lib/json/columnKeys.js +204 -0
- package/lib/utils/api.d.ts +9 -0
- package/lib/utils/api.js +15 -0
- package/lib/utils/common.d.ts +27 -0
- package/lib/utils/common.js +44 -0
- package/lib/utils/options.d.ts +25 -0
- package/lib/utils/options.js +101 -0
- package/lib/utils/request.d.ts +26 -0
- package/lib/utils/request.js +180 -0
- package/lib/utils/serviceEnv.d.ts +6 -0
- package/lib/utils/serviceEnv.js +18 -0
- package/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { BaseQueryFilterProps, ProFormInstance, ProFormProps } from '@ant-design/pro-form';
|
|
2
|
+
import type { ProSchemaComponentTypes } from '@ant-design/pro-utils';
|
|
3
|
+
import type { FormItemProps } from 'antd';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { ActionType, ProColumns, ProTableProps } from '@ant-design/pro-components';
|
|
6
|
+
export type SearchConfig = BaseQueryFilterProps & {
|
|
7
|
+
filterType?: 'query' | 'light';
|
|
8
|
+
};
|
|
9
|
+
export type TableFormItem<T, U = any> = {
|
|
10
|
+
onSubmit?: (value: T, firstLoad: boolean) => void;
|
|
11
|
+
onReset?: (value: T) => void;
|
|
12
|
+
form?: Omit<ProFormProps, 'form'>;
|
|
13
|
+
type?: ProSchemaComponentTypes;
|
|
14
|
+
dateFormatter?: ProTableProps<T, U, any>['dateFormatter'];
|
|
15
|
+
search?: false | SearchConfig;
|
|
16
|
+
columns: ProColumns<U, any>[];
|
|
17
|
+
formRef: React.MutableRefObject<ProFormInstance | undefined>;
|
|
18
|
+
submitButtonLoading?: boolean;
|
|
19
|
+
manualRequest?: boolean;
|
|
20
|
+
bordered?: boolean;
|
|
21
|
+
action: React.MutableRefObject<ActionType | undefined>;
|
|
22
|
+
ghost?: boolean;
|
|
23
|
+
} & Omit<FormItemProps, 'children' | 'onReset'>;
|
|
24
|
+
/**
|
|
25
|
+
* 这里会把 列配置转化为 form 表单
|
|
26
|
+
*
|
|
27
|
+
* @param param0
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
declare const FormRender: <T, U = any>({ onSubmit, formRef, dateFormatter, type, columns, action, ghost, manualRequest, onReset, submitButtonLoading, search: searchConfig, form: formConfig, bordered, }: TableFormItem<T, U>) => React.JSX.Element;
|
|
31
|
+
export default FormRender;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import "antd/es/table/style";
|
|
2
|
+
import _Table from "antd/es/table";
|
|
3
|
+
import "antd/es/config-provider/style";
|
|
4
|
+
import _ConfigProvider from "antd/es/config-provider";
|
|
5
|
+
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); }
|
|
6
|
+
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); }
|
|
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 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 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 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 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; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
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); }
|
|
15
|
+
import { BetaSchemaForm } from '@ant-design/pro-form';
|
|
16
|
+
import { ProProvider } from '@ant-design/pro-provider';
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import omit from 'omit.js';
|
|
19
|
+
import React, { useContext, useMemo } from 'react';
|
|
20
|
+
function toLowerLine(str) {
|
|
21
|
+
var temp = str.replace(/[A-Z]/g, function (match) {
|
|
22
|
+
return "-".concat(match.toLowerCase());
|
|
23
|
+
});
|
|
24
|
+
if (temp.startsWith('-')) {
|
|
25
|
+
// 如果首字母是大写,执行replace时会多一个_,这里需要去掉
|
|
26
|
+
temp = temp.slice(1);
|
|
27
|
+
}
|
|
28
|
+
return temp;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 获取当前选择的 Form Layout 配置
|
|
32
|
+
*
|
|
33
|
+
* @param isForm
|
|
34
|
+
* @param searchConfig
|
|
35
|
+
* @returns LightFilter | QueryFilter | ProForm
|
|
36
|
+
*/
|
|
37
|
+
var getFormCompetent = function getFormCompetent(isForm, searchConfig) {
|
|
38
|
+
if (!isForm && searchConfig !== false) {
|
|
39
|
+
if ((searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.filterType) === 'light') {
|
|
40
|
+
return 'LightFilter';
|
|
41
|
+
}
|
|
42
|
+
return 'QueryFilter';
|
|
43
|
+
}
|
|
44
|
+
return 'Form';
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* 获取需要传给相应表单的props
|
|
48
|
+
*
|
|
49
|
+
* @param searchConfig
|
|
50
|
+
* @param name
|
|
51
|
+
*/
|
|
52
|
+
var getFromProps = function getFromProps(isForm, searchConfig, name) {
|
|
53
|
+
if (!isForm && name === 'LightFilter') {
|
|
54
|
+
// 传给 lightFilter 的问题
|
|
55
|
+
return omit(_objectSpread({}, searchConfig), ['labelWidth', 'defaultCollapsed', 'filterType']);
|
|
56
|
+
}
|
|
57
|
+
if (!isForm) {
|
|
58
|
+
// 传给 QueryFilter 的配置
|
|
59
|
+
return omit(_objectSpread({
|
|
60
|
+
labelWidth: searchConfig ? searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.labelWidth : undefined,
|
|
61
|
+
defaultCollapsed: true
|
|
62
|
+
}, searchConfig), ['filterType']);
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* 从formConfig中获取传给相应表单的配置
|
|
68
|
+
*
|
|
69
|
+
* @param isForm
|
|
70
|
+
* @param formConfig
|
|
71
|
+
*/
|
|
72
|
+
var getFormConfigs = function getFormConfigs(isForm, formConfig) {
|
|
73
|
+
if (isForm) {
|
|
74
|
+
// 传给Form的配置
|
|
75
|
+
return omit(formConfig, ['ignoreRules']);
|
|
76
|
+
}
|
|
77
|
+
// 传给Filter的配置
|
|
78
|
+
return _objectSpread({
|
|
79
|
+
ignoreRules: true
|
|
80
|
+
}, formConfig);
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 这里会把 列配置转化为 form 表单
|
|
84
|
+
*
|
|
85
|
+
* @param param0
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
88
|
+
var FormRender = function FormRender(_ref) {
|
|
89
|
+
var onSubmit = _ref.onSubmit,
|
|
90
|
+
formRef = _ref.formRef,
|
|
91
|
+
_ref$dateFormatter = _ref.dateFormatter,
|
|
92
|
+
dateFormatter = _ref$dateFormatter === void 0 ? 'string' : _ref$dateFormatter,
|
|
93
|
+
type = _ref.type,
|
|
94
|
+
columns = _ref.columns,
|
|
95
|
+
action = _ref.action,
|
|
96
|
+
ghost = _ref.ghost,
|
|
97
|
+
manualRequest = _ref.manualRequest,
|
|
98
|
+
_onReset = _ref.onReset,
|
|
99
|
+
submitButtonLoading = _ref.submitButtonLoading,
|
|
100
|
+
searchConfig = _ref.search,
|
|
101
|
+
formConfig = _ref.form,
|
|
102
|
+
bordered = _ref.bordered;
|
|
103
|
+
var _useContext = useContext(ProProvider),
|
|
104
|
+
hashId = _useContext.hashId;
|
|
105
|
+
var isForm = type === 'form';
|
|
106
|
+
/** 提交表单,根据两种模式不同,方法不相同 */
|
|
107
|
+
var submit = /*#__PURE__*/function () {
|
|
108
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values, firstLoad) {
|
|
109
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
110
|
+
while (1) switch (_context.prev = _context.next) {
|
|
111
|
+
case 0:
|
|
112
|
+
if (onSubmit) {
|
|
113
|
+
onSubmit(values, firstLoad);
|
|
114
|
+
}
|
|
115
|
+
case 1:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context.stop();
|
|
118
|
+
}
|
|
119
|
+
}, _callee);
|
|
120
|
+
}));
|
|
121
|
+
return function submit(_x, _x2) {
|
|
122
|
+
return _ref2.apply(this, arguments);
|
|
123
|
+
};
|
|
124
|
+
}();
|
|
125
|
+
var _useContext2 = useContext(_ConfigProvider.ConfigContext),
|
|
126
|
+
getPrefixCls = _useContext2.getPrefixCls;
|
|
127
|
+
var columnsList = useMemo(function () {
|
|
128
|
+
return columns.filter(function (item) {
|
|
129
|
+
if (item === _Table.EXPAND_COLUMN || item === _Table.SELECTION_COLUMN) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if ((item.hideInSearch || item.search === false) && type !== 'form') {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
if (type === 'form' && item.hideInForm) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}).map(function (item) {
|
|
140
|
+
var _item$dataIndex;
|
|
141
|
+
var finalValueType = !item.valueType || ['textarea', 'jsonCode', 'code'].includes(item === null || item === void 0 ? void 0 : item.valueType) && type === 'table' ? 'text' : item === null || item === void 0 ? void 0 : item.valueType;
|
|
142
|
+
var columnKey = (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : (_item$dataIndex = item.dataIndex) === null || _item$dataIndex === void 0 ? void 0 : _item$dataIndex.toString());
|
|
143
|
+
return _objectSpread(_objectSpread(_objectSpread({}, item), {}, {
|
|
144
|
+
width: undefined
|
|
145
|
+
}, item.search ? item.search : {}), {}, {
|
|
146
|
+
valueType: finalValueType,
|
|
147
|
+
proFieldProps: _objectSpread(_objectSpread({}, item.proFieldProps), {}, {
|
|
148
|
+
proFieldKey: columnKey ? "table-field-".concat(columnKey) : undefined
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}, [columns, type]);
|
|
153
|
+
var className = getPrefixCls('pro-table-search');
|
|
154
|
+
var formClassName = getPrefixCls('pro-table-form');
|
|
155
|
+
var competentName = useMemo(function () {
|
|
156
|
+
return getFormCompetent(isForm, searchConfig);
|
|
157
|
+
}, [searchConfig, isForm]);
|
|
158
|
+
// 传给每个表单的配置,理论上大家都需要
|
|
159
|
+
var loadingProps = useMemo(function () {
|
|
160
|
+
return {
|
|
161
|
+
submitter: {
|
|
162
|
+
submitButtonProps: {
|
|
163
|
+
loading: submitButtonLoading
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}, [submitButtonLoading]);
|
|
168
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
className: classNames(hashId, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, getPrefixCls('pro-card'), true), "".concat(getPrefixCls('pro-card'), "-border"), !!bordered), "".concat(getPrefixCls('pro-card'), "-bordered"), !!bordered), "".concat(getPrefixCls('pro-card'), "-ghost"), !!ghost), className, true), formClassName, isForm), getPrefixCls("pro-table-search-".concat(toLowerLine(competentName))), true), "".concat(className, "-ghost"), ghost), searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.className, searchConfig !== false && (searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.className)))
|
|
170
|
+
}, /*#__PURE__*/React.createElement(BetaSchemaForm, _extends({
|
|
171
|
+
layoutType: competentName,
|
|
172
|
+
columns: columnsList,
|
|
173
|
+
type: type
|
|
174
|
+
}, loadingProps, getFromProps(isForm, searchConfig, competentName), getFormConfigs(isForm, formConfig || {}), {
|
|
175
|
+
formRef: formRef,
|
|
176
|
+
action: action,
|
|
177
|
+
dateFormatter: dateFormatter,
|
|
178
|
+
onInit: function onInit(values, form) {
|
|
179
|
+
formRef.current = form;
|
|
180
|
+
// 触发一个 submit,之所以这里触发是为了保证 value 都被 format了
|
|
181
|
+
if (type !== 'form') {
|
|
182
|
+
var _action$current, _action$current2, _action$current2$setP;
|
|
183
|
+
// 修改 pageSize,变成从 url 中获取的
|
|
184
|
+
var pageInfo = (_action$current = action.current) === null || _action$current === void 0 ? void 0 : _action$current.pageInfo;
|
|
185
|
+
// 从 values 里获取是因为有时候要从 url中获取的 pageSize。
|
|
186
|
+
var _values$current = values.current,
|
|
187
|
+
current = _values$current === void 0 ? pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.current : _values$current,
|
|
188
|
+
_values$pageSize = values.pageSize,
|
|
189
|
+
pageSize = _values$pageSize === void 0 ? pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.pageSize : _values$pageSize;
|
|
190
|
+
(_action$current2 = action.current) === null || _action$current2 === void 0 ? void 0 : (_action$current2$setP = _action$current2.setPageInfo) === null || _action$current2$setP === void 0 ? void 0 : _action$current2$setP.call(_action$current2, _objectSpread(_objectSpread({}, pageInfo), {}, {
|
|
191
|
+
current: parseInt(current, 10),
|
|
192
|
+
pageSize: parseInt(pageSize, 10)
|
|
193
|
+
}));
|
|
194
|
+
/** 如果是手动模式不需要提交 */
|
|
195
|
+
if (manualRequest) return;
|
|
196
|
+
submit(values, true);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
onReset: function onReset(values) {
|
|
200
|
+
_onReset === null || _onReset === void 0 ? void 0 : _onReset(values);
|
|
201
|
+
},
|
|
202
|
+
onFinish: function onFinish(values) {
|
|
203
|
+
submit(values, false);
|
|
204
|
+
},
|
|
205
|
+
initialValues: formConfig === null || formConfig === void 0 ? void 0 : formConfig.initialValues
|
|
206
|
+
})));
|
|
207
|
+
};
|
|
208
|
+
export default FormRender;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { TablePaginationConfig } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ActionType, ProTableProps } from '@ant-design/pro-components';
|
|
4
|
+
export type Bordered = boolean | {
|
|
5
|
+
search?: boolean;
|
|
6
|
+
table?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type BaseFormProps<T, U> = {
|
|
9
|
+
pagination?: TablePaginationConfig | false;
|
|
10
|
+
beforeSearchSubmit?: (params: Partial<U>) => any;
|
|
11
|
+
action: React.MutableRefObject<ActionType | undefined>;
|
|
12
|
+
onSubmit?: (params: U) => void;
|
|
13
|
+
onReset?: () => void;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
onFormSearchSubmit: (params: U) => void;
|
|
16
|
+
columns: ProTableProps<T, U, any>['columns'];
|
|
17
|
+
dateFormatter: ProTableProps<T, U, any>['dateFormatter'];
|
|
18
|
+
formRef: ProTableProps<T, U, any>['formRef'];
|
|
19
|
+
type: ProTableProps<T, U, any>['type'];
|
|
20
|
+
cardBordered: ProTableProps<T, U, any>['cardBordered'];
|
|
21
|
+
form: ProTableProps<T, U, any>['form'];
|
|
22
|
+
search: ProTableProps<T, U, any>['search'];
|
|
23
|
+
manualRequest: ProTableProps<T, U, any>['manualRequest'];
|
|
24
|
+
changeValue: Function;
|
|
25
|
+
};
|
|
26
|
+
declare class FormSearch<T, U> extends React.Component<BaseFormProps<T, U> & {
|
|
27
|
+
ghost?: boolean;
|
|
28
|
+
}> {
|
|
29
|
+
/** 查询表单相关的配置 */
|
|
30
|
+
onSubmit: (value: U, firstLoad: boolean) => void;
|
|
31
|
+
onReset: (value: Partial<U>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* 只 Diff 需要用的 props,能减少 5 次左右的render
|
|
34
|
+
*
|
|
35
|
+
* @param next
|
|
36
|
+
* @see 因为 hooks 每次的 setFormSearch 都是新的,所以每次都触发 render
|
|
37
|
+
* @see action 也是同样的原因
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
isEqual: (next: BaseFormProps<T, U>) => boolean;
|
|
41
|
+
shouldComponentUpdate: (next: BaseFormProps<T, U>) => boolean;
|
|
42
|
+
render: () => React.JSX.Element;
|
|
43
|
+
}
|
|
44
|
+
export default FormSearch;
|
|
@@ -0,0 +1,186 @@
|
|
|
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 _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
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); }
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
12
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
+
import { isDeepEqualReact, omitUndefined } from '@ant-design/pro-utils';
|
|
18
|
+
import omit from 'omit.js';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import FormRender from './FormRender';
|
|
21
|
+
var isBordered = function isBordered(borderType, border) {
|
|
22
|
+
if (border === undefined) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (typeof border === 'boolean') {
|
|
26
|
+
return border;
|
|
27
|
+
}
|
|
28
|
+
return border[borderType];
|
|
29
|
+
};
|
|
30
|
+
var FormSearch = /*#__PURE__*/function (_React$Component) {
|
|
31
|
+
function FormSearch() {
|
|
32
|
+
var _this;
|
|
33
|
+
_classCallCheck(this, FormSearch);
|
|
34
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
|
+
args[_key] = arguments[_key];
|
|
36
|
+
}
|
|
37
|
+
_this = _callSuper(this, FormSearch, [].concat(args));
|
|
38
|
+
/** 查询表单相关的配置 */
|
|
39
|
+
_this.onSubmit = function (value, firstLoad) {
|
|
40
|
+
var _this$props = _this.props,
|
|
41
|
+
pagination = _this$props.pagination,
|
|
42
|
+
_this$props$beforeSea = _this$props.beforeSearchSubmit,
|
|
43
|
+
beforeSearchSubmit = _this$props$beforeSea === void 0 ? function (searchParams) {
|
|
44
|
+
return searchParams;
|
|
45
|
+
} : _this$props$beforeSea,
|
|
46
|
+
action = _this$props.action,
|
|
47
|
+
onSubmit = _this$props.onSubmit,
|
|
48
|
+
onFormSearchSubmit = _this$props.onFormSearchSubmit;
|
|
49
|
+
// 只传入 pagination 中的 current 和 pageSize 参数
|
|
50
|
+
var pageInfo = pagination ? omitUndefined({
|
|
51
|
+
current: pagination.current,
|
|
52
|
+
pageSize: pagination.pageSize
|
|
53
|
+
}) : {};
|
|
54
|
+
var submitParams = _objectSpread(_objectSpread({}, value), {}, {
|
|
55
|
+
_timestamp: Date.now()
|
|
56
|
+
}, pageInfo);
|
|
57
|
+
var omitParams = omit(beforeSearchSubmit(submitParams), Object.keys(pageInfo));
|
|
58
|
+
onFormSearchSubmit(omitParams);
|
|
59
|
+
if (!firstLoad) {
|
|
60
|
+
var _action$current, _action$current$setPa;
|
|
61
|
+
// back first page
|
|
62
|
+
(_action$current = action.current) === null || _action$current === void 0 ? void 0 : (_action$current$setPa = _action$current.setPageInfo) === null || _action$current$setPa === void 0 ? void 0 : _action$current$setPa.call(_action$current, {
|
|
63
|
+
current: 1
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// 不是第一次提交就不触发,第一次提交是 js 触发的
|
|
67
|
+
// 为了解决 https://github.com/ant-design/pro-components/issues/579
|
|
68
|
+
if (onSubmit && !firstLoad) {
|
|
69
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(value);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
_this.onReset = function (value) {
|
|
73
|
+
var _action$current2, _action$current2$setP;
|
|
74
|
+
var _this$props2 = _this.props,
|
|
75
|
+
pagination = _this$props2.pagination,
|
|
76
|
+
_this$props2$beforeSe = _this$props2.beforeSearchSubmit,
|
|
77
|
+
beforeSearchSubmit = _this$props2$beforeSe === void 0 ? function (searchParams) {
|
|
78
|
+
return searchParams;
|
|
79
|
+
} : _this$props2$beforeSe,
|
|
80
|
+
action = _this$props2.action,
|
|
81
|
+
onFormSearchSubmit = _this$props2.onFormSearchSubmit,
|
|
82
|
+
onReset = _this$props2.onReset;
|
|
83
|
+
var pageInfo = pagination ? omitUndefined({
|
|
84
|
+
current: pagination.current,
|
|
85
|
+
pageSize: pagination.pageSize
|
|
86
|
+
}) : {};
|
|
87
|
+
var omitParams = omit(beforeSearchSubmit(_objectSpread(_objectSpread({}, value), pageInfo)), Object.keys(pageInfo));
|
|
88
|
+
onFormSearchSubmit(omitParams);
|
|
89
|
+
// back first page
|
|
90
|
+
(_action$current2 = action.current) === null || _action$current2 === void 0 ? void 0 : (_action$current2$setP = _action$current2.setPageInfo) === null || _action$current2$setP === void 0 ? void 0 : _action$current2$setP.call(_action$current2, {
|
|
91
|
+
current: 1
|
|
92
|
+
});
|
|
93
|
+
onReset === null || onReset === void 0 ? void 0 : onReset();
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* 只 Diff 需要用的 props,能减少 5 次左右的render
|
|
97
|
+
*
|
|
98
|
+
* @param next
|
|
99
|
+
* @see 因为 hooks 每次的 setFormSearch 都是新的,所以每次都触发 render
|
|
100
|
+
* @see action 也是同样的原因
|
|
101
|
+
* @returns
|
|
102
|
+
*/
|
|
103
|
+
_this.isEqual = function (next) {
|
|
104
|
+
var _this$props3 = _this.props,
|
|
105
|
+
columns = _this$props3.columns,
|
|
106
|
+
loading = _this$props3.loading,
|
|
107
|
+
formRef = _this$props3.formRef,
|
|
108
|
+
type = _this$props3.type,
|
|
109
|
+
cardBordered = _this$props3.cardBordered,
|
|
110
|
+
dateFormatter = _this$props3.dateFormatter,
|
|
111
|
+
form = _this$props3.form,
|
|
112
|
+
search = _this$props3.search,
|
|
113
|
+
manualRequest = _this$props3.manualRequest;
|
|
114
|
+
var diffProps = {
|
|
115
|
+
columns: columns,
|
|
116
|
+
loading: loading,
|
|
117
|
+
formRef: formRef,
|
|
118
|
+
type: type,
|
|
119
|
+
cardBordered: cardBordered,
|
|
120
|
+
dateFormatter: dateFormatter,
|
|
121
|
+
form: form,
|
|
122
|
+
search: search,
|
|
123
|
+
manualRequest: manualRequest
|
|
124
|
+
};
|
|
125
|
+
return !isDeepEqualReact(diffProps, {
|
|
126
|
+
columns: next.columns,
|
|
127
|
+
formRef: next.formRef,
|
|
128
|
+
loading: next.loading,
|
|
129
|
+
type: next.type,
|
|
130
|
+
cardBordered: next.cardBordered,
|
|
131
|
+
dateFormatter: next.dateFormatter,
|
|
132
|
+
form: next.form,
|
|
133
|
+
search: next.search,
|
|
134
|
+
manualRequest: next.manualRequest
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
_this.shouldComponentUpdate = function (next) {
|
|
138
|
+
return _this.isEqual(next);
|
|
139
|
+
};
|
|
140
|
+
_this.render = function () {
|
|
141
|
+
var _this$props4 = _this.props,
|
|
142
|
+
columns = _this$props4.columns,
|
|
143
|
+
loading = _this$props4.loading,
|
|
144
|
+
formRef = _this$props4.formRef,
|
|
145
|
+
type = _this$props4.type,
|
|
146
|
+
action = _this$props4.action,
|
|
147
|
+
cardBordered = _this$props4.cardBordered,
|
|
148
|
+
dateFormatter = _this$props4.dateFormatter,
|
|
149
|
+
form = _this$props4.form,
|
|
150
|
+
search = _this$props4.search,
|
|
151
|
+
pagination = _this$props4.pagination,
|
|
152
|
+
ghost = _this$props4.ghost,
|
|
153
|
+
manualRequest = _this$props4.manualRequest;
|
|
154
|
+
var pageInfo = pagination ? omitUndefined({
|
|
155
|
+
current: pagination.current,
|
|
156
|
+
pageSize: pagination.pageSize
|
|
157
|
+
}) : {};
|
|
158
|
+
return /*#__PURE__*/React.createElement(FormRender, {
|
|
159
|
+
submitButtonLoading: loading,
|
|
160
|
+
columns: columns,
|
|
161
|
+
type: type,
|
|
162
|
+
ghost: ghost,
|
|
163
|
+
formRef: formRef,
|
|
164
|
+
onSubmit: _this.onSubmit,
|
|
165
|
+
manualRequest: manualRequest,
|
|
166
|
+
onReset: _this.onReset,
|
|
167
|
+
dateFormatter: dateFormatter,
|
|
168
|
+
search: search,
|
|
169
|
+
form: _objectSpread(_objectSpread({
|
|
170
|
+
onValuesChange: function onValuesChange(changeValue, allValue) {
|
|
171
|
+
_this.props.changeValue(changeValue, allValue);
|
|
172
|
+
},
|
|
173
|
+
autoFocusFirstInput: false
|
|
174
|
+
}, form), {}, {
|
|
175
|
+
extraUrlParams: _objectSpread(_objectSpread({}, pageInfo), form === null || form === void 0 ? void 0 : form.extraUrlParams)
|
|
176
|
+
}),
|
|
177
|
+
action: action,
|
|
178
|
+
bordered: isBordered('search', cardBordered)
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
return _this;
|
|
182
|
+
}
|
|
183
|
+
_inherits(FormSearch, _React$Component);
|
|
184
|
+
return _createClass(FormSearch);
|
|
185
|
+
}(React.Component);
|
|
186
|
+
export default FormSearch;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.search-drawer {
|
|
2
|
+
// 搜索栏内部样式复写
|
|
3
|
+
::-webkit-scrollbar {
|
|
4
|
+
width: 2px;
|
|
5
|
+
}
|
|
6
|
+
// .ant-tree-checkbox-checked
|
|
7
|
+
// .ant-tree-checkbox-disabled
|
|
8
|
+
// pointer-events: none;
|
|
9
|
+
.ant-pro-query-filter-row {
|
|
10
|
+
row-gap: 12px;
|
|
11
|
+
}
|
|
12
|
+
.ant-pro-table-search {
|
|
13
|
+
padding: 0;
|
|
14
|
+
.ant-form-item-control {
|
|
15
|
+
width: auto;
|
|
16
|
+
}
|
|
17
|
+
.ant-pro-table-search-query-filter {
|
|
18
|
+
border: none;
|
|
19
|
+
}
|
|
20
|
+
.ant-pro-query-filter {
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
padding: 0;
|
|
23
|
+
.ant-row {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
.ant-form-item-label {
|
|
27
|
+
width: 86px;
|
|
28
|
+
line-height: 34px;
|
|
29
|
+
text-align: right;
|
|
30
|
+
label {
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.ant-form-item-control {
|
|
35
|
+
width: 240px;
|
|
36
|
+
.ant-form-item-control-input {
|
|
37
|
+
width: 240px;
|
|
38
|
+
}
|
|
39
|
+
.ant-picker {
|
|
40
|
+
min-width: 240px !important;
|
|
41
|
+
width: 240px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
.page_plustable__body {
|
|
49
|
+
// 为了复写pagecontainer的样式
|
|
50
|
+
background-color: #fff;
|
|
51
|
+
transition: all ease 0.3s;
|
|
52
|
+
// margin: 16px;
|
|
53
|
+
// padding: 16px;
|
|
54
|
+
height: 100%;
|
|
55
|
+
width: 100%;
|
|
56
|
+
&.turn-left {
|
|
57
|
+
width: calc(100% - 356px);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createFromIconfontCN } from '@ant-design/icons';
|
|
2
|
+
/* 采用iconfont Symbol模式
|
|
3
|
+
每次更新icon后,记得复制最新的地址哦~ */
|
|
4
|
+
var Icon = createFromIconfontCN({
|
|
5
|
+
scriptUrl: ['//at.alicdn.com/t/c/font_3161758_5bzjjx85uxv.js', '//at.alicdn.com/t/font_2562875_b3aduyabrj.js']
|
|
6
|
+
});
|
|
7
|
+
export default Icon;
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import type { ProColumns, ActionType } from '@ant-design/pro-components';
|
|
3
|
+
import type { InputProps } from 'antd';
|
|
4
|
+
import './FormSearch/index.less';
|
|
5
|
+
interface PlusColumns extends ProColumns {
|
|
6
|
+
baseSearch?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type { PlusColumns };
|
|
9
|
+
export type settingsColumns = {
|
|
10
|
+
[key: string]: {
|
|
11
|
+
hideInTable?: boolean;
|
|
12
|
+
show?: boolean;
|
|
13
|
+
title: string;
|
|
14
|
+
field: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
fixed?: 'left' | 'right';
|
|
17
|
+
sort?: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type OptionsFunctionType = (e: React.MouseEvent<HTMLSpanElement>, action?: ActionType) => void;
|
|
21
|
+
type OptionsType = OptionsFunctionType | boolean;
|
|
22
|
+
type SettingOptionType = {
|
|
23
|
+
draggable?: boolean;
|
|
24
|
+
checkable?: boolean;
|
|
25
|
+
showListItemOption?: boolean;
|
|
26
|
+
checkedReset?: boolean;
|
|
27
|
+
listsHeight?: number;
|
|
28
|
+
extra?: React.ReactNode;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
settingIcon?: React.ReactNode;
|
|
31
|
+
};
|
|
32
|
+
interface SearchProps extends InputProps {
|
|
33
|
+
inputPrefixCls?: string;
|
|
34
|
+
onSearch?: (value: string, event?: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLInputElement>, info?: {
|
|
35
|
+
source?: 'clear' | 'input';
|
|
36
|
+
}) => void;
|
|
37
|
+
enterButton?: React.ReactNode;
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
}
|
|
40
|
+
type OptionSearchProps = Omit<SearchProps, 'onSearch'> & {
|
|
41
|
+
/** 如果 onSearch 返回一个false,直接拦截请求 */
|
|
42
|
+
onSearch?: (keyword: string) => Promise<boolean | undefined> | boolean | undefined;
|
|
43
|
+
};
|
|
44
|
+
export type optionsConfig = {
|
|
45
|
+
density?: boolean;
|
|
46
|
+
fullScreen?: OptionsType;
|
|
47
|
+
reload?: OptionsType;
|
|
48
|
+
setting?: boolean | SettingOptionType;
|
|
49
|
+
search?: (OptionSearchProps & {
|
|
50
|
+
name?: string;
|
|
51
|
+
}) | boolean;
|
|
52
|
+
reloadIcon?: React.ReactNode;
|
|
53
|
+
densityIcon?: React.ReactNode;
|
|
54
|
+
};
|
|
55
|
+
type PlusProps = {
|
|
56
|
+
action?: Array<'advancedFilter' | 'columnSetting' | 'viewInvisibleData'>;
|
|
57
|
+
columns: PlusColumns[];
|
|
58
|
+
request?: any;
|
|
59
|
+
top?: number;
|
|
60
|
+
fetchSetting?: () => Promise<settingsColumns>;
|
|
61
|
+
updateSetting?: (params: any) => Promise<settingsColumns>;
|
|
62
|
+
resetSetting?: () => Promise<settingsColumns>;
|
|
63
|
+
showDefaultSetting?: boolean;
|
|
64
|
+
defaultColumnsState?: {
|
|
65
|
+
[key: string]: {
|
|
66
|
+
show: boolean;
|
|
67
|
+
fixed: 'left' | 'right' | undefined;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
headerTitle?: ReactElement;
|
|
71
|
+
hasShowFull?: boolean;
|
|
72
|
+
pagination?: {
|
|
73
|
+
pageSize?: number;
|
|
74
|
+
current?: number;
|
|
75
|
+
};
|
|
76
|
+
actionRef: any;
|
|
77
|
+
formRef?: any;
|
|
78
|
+
options?: optionsConfig;
|
|
79
|
+
[key: string | symbol]: any;
|
|
80
|
+
};
|
|
81
|
+
declare const PlusTable: React.ForwardRefExoticComponent<Omit<PlusProps, "ref"> & React.RefAttributes<unknown>>;
|
|
82
|
+
export default PlusTable;
|