fan-standard-comp 4.1.0 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fan-standard-comp.min.css +1 -1
- package/dist/fan-standard-comp.min.js +1 -1
- package/es/ButtonGroup/index.d.ts +1 -0
- package/es/ButtonGroup/styles/index.js +3 -1
- package/es/FormComp/FieldComponent/ExtensionField.d.ts +3 -0
- package/es/FormComp/FieldComponent/ExtensionField.js +18 -0
- package/es/FormComp/FieldComponent/index.d.ts +10 -1
- package/es/FormComp/FieldComponent/index.js +123 -56
- package/es/FormComp/RenderItemGroup/index.js +38 -16
- package/es/FormComp/RenderItemGroup/style/index.js +6 -0
- package/es/NavLeafScroll/Main.js +2 -2
- package/es/RefactorTree/index.d.ts +1 -0
- package/es/RefactorTree/index.js +4 -2
- package/es/StandardDragModal/ChangeStandardModal.js +1 -1
- package/es/StandardFilter/index.js +12 -9
- package/es/StandardFilter/style/FilterStyle.js +13 -4
- package/es/StandardFilter/style/index.less +9 -2
- package/es/StandardForm/StepForm.js +1 -1
- package/es/StandardModal/index.js +1 -1
- package/es/StandardTable/index.d.ts +3 -2
- package/es/StandardTable/index.js +15 -8
- package/es/StandardTable/style/index.js +5 -0
- package/es/StandardTablePro/index.d.ts +9 -0
- package/es/StandardTablePro/index.js +147 -0
- package/es/StandardTablePro/style/index.d.ts +6 -0
- package/es/StandardTablePro/style/index.js +28 -0
- package/es/data/city.data.d.ts +20 -0
- package/es/data/city.data.js +10199 -0
- package/es/data/common.use.d.ts +29 -0
- package/es/data/common.use.js +30 -0
- package/es/data/general.config.d.ts +32 -0
- package/es/data/general.config.js +34 -1
- package/es/data/index.d.ts +3 -1
- package/es/data/index.js +3 -1
- package/es/theme/utils/genStyleHook.js +3 -1
- package/es/utils/ValueFormat.js +3 -3
- package/es/utils/fileConvert.d.ts +17 -0
- package/es/utils/fileConvert.js +100 -0
- package/es/utils/getParentNodes.d.ts +21 -14
- package/es/utils/getParentNodes.js +39 -11
- package/es/utils/index.d.ts +20 -1
- package/es/utils/index.js +74 -3
- package/es/utils/regExp.d.ts +10 -0
- package/es/utils/regExp.js +13 -2
- package/es/utils/response.d.ts +17 -0
- package/es/utils/response.js +40 -0
- package/es/utils/urlUtils.d.ts +10 -6
- package/es/utils/urlUtils.js +21 -32
- package/lib/ButtonGroup/index.d.ts +1 -0
- package/lib/ButtonGroup/styles/index.js +3 -1
- package/lib/FormComp/FieldComponent/ExtensionField.d.ts +3 -0
- package/lib/FormComp/FieldComponent/ExtensionField.js +27 -0
- package/lib/FormComp/FieldComponent/index.d.ts +10 -1
- package/lib/FormComp/FieldComponent/index.js +122 -56
- package/lib/FormComp/RenderItemGroup/index.js +38 -16
- package/lib/FormComp/RenderItemGroup/style/index.js +6 -0
- package/lib/NavLeafScroll/Main.js +2 -2
- package/lib/RefactorTree/index.d.ts +1 -0
- package/lib/RefactorTree/index.js +4 -2
- package/lib/StandardDragModal/ChangeStandardModal.js +1 -1
- package/lib/StandardFilter/index.js +12 -9
- package/lib/StandardFilter/style/FilterStyle.js +13 -4
- package/lib/StandardFilter/style/index.less +9 -2
- package/lib/StandardForm/StepForm.js +1 -1
- package/lib/StandardModal/index.js +1 -1
- package/lib/StandardTable/index.d.ts +3 -2
- package/lib/StandardTable/index.js +15 -8
- package/lib/StandardTable/style/index.js +5 -0
- package/lib/StandardTablePro/index.d.ts +9 -0
- package/lib/StandardTablePro/index.js +155 -0
- package/lib/StandardTablePro/style/index.d.ts +6 -0
- package/lib/StandardTablePro/style/index.js +34 -0
- package/lib/data/city.data.d.ts +20 -0
- package/lib/data/city.data.js +10205 -0
- package/lib/data/common.use.d.ts +29 -0
- package/lib/data/common.use.js +36 -0
- package/lib/data/general.config.d.ts +32 -0
- package/lib/data/general.config.js +34 -1
- package/lib/data/index.d.ts +3 -1
- package/lib/data/index.js +14 -0
- package/lib/theme/utils/genStyleHook.js +3 -1
- package/lib/utils/ValueFormat.js +3 -3
- package/lib/utils/fileConvert.d.ts +17 -0
- package/lib/utils/fileConvert.js +108 -0
- package/lib/utils/getParentNodes.d.ts +21 -14
- package/lib/utils/getParentNodes.js +40 -12
- package/lib/utils/index.d.ts +20 -1
- package/lib/utils/index.js +101 -5
- package/lib/utils/regExp.d.ts +10 -0
- package/lib/utils/regExp.js +13 -2
- package/lib/utils/response.d.ts +17 -0
- package/lib/utils/response.js +44 -0
- package/lib/utils/urlUtils.d.ts +10 -6
- package/lib/utils/urlUtils.js +22 -34
- package/package.json +4 -4
- package/es/utils/transferFile.d.ts +0 -4
- package/es/utils/transferFile.js +0 -56
- package/lib/utils/transferFile.d.ts +0 -4
- package/lib/utils/transferFile.js +0 -63
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import { message } from 'antd';
|
|
3
|
+
import { commonUse } from "../data";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description 接口返回异常提示语
|
|
7
|
+
* @params {String或Object} type 指操作的类型:
|
|
8
|
+
* @value {String} 值有 删除:'delete' 修改:'update' 新增:'create'
|
|
9
|
+
* @value {Object} { success: 'xxx成功提示语'}
|
|
10
|
+
*
|
|
11
|
+
* @params {Object} res 接口返回数据
|
|
12
|
+
* @params {Function} callback 事件回调
|
|
13
|
+
* */
|
|
14
|
+
var responseControl = function responseControl(type, res, callback) {
|
|
15
|
+
if (res.code == '200') {
|
|
16
|
+
if (typeof type === 'string') {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
message.success(commonUse.responseMsg[type].success);
|
|
19
|
+
} else if (_typeof(type) === 'object') {
|
|
20
|
+
message.success(type.success);
|
|
21
|
+
} else {
|
|
22
|
+
message.success('操作成功');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
26
|
+
callback && callback(res);
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @description 接口返回正常回调判断
|
|
30
|
+
* @params {Object} res 接口返回数据
|
|
31
|
+
* @params {Function} callback 事件回调
|
|
32
|
+
* */
|
|
33
|
+
var responseQuery = function responseQuery(res, callback) {
|
|
34
|
+
if (res.code == '200') {
|
|
35
|
+
// 调用回调
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
37
|
+
callback && callback(res);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export { responseControl, responseQuery };
|
package/es/utils/urlUtils.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* */
|
|
4
|
-
export declare const getUrlSearch: (href: any) => {};
|
|
5
|
-
/**
|
|
2
|
+
* 跳转外链、iframe 地址支持带参
|
|
6
3
|
* 获取url的search,并有条件:`^{变量名}`的条件取本地存储的数据 // 参数格式:^{变量名} 变量名支持数字、字母、下划线
|
|
7
4
|
* 根据url上的参数变量,重新调整跳转链接
|
|
5
|
+
* @param {string} href 地址
|
|
6
|
+
*
|
|
7
|
+
* @result {string} 完整的url地址
|
|
8
8
|
* */
|
|
9
|
-
export declare const getJumpUrlBySearch: (href:
|
|
9
|
+
export declare const getJumpUrlBySearch: (href: string) => string | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* 是否是完整的URL
|
|
12
12
|
*
|
|
13
13
|
* */
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const isHttpUrl: (path: string) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 是否是完整的URL
|
|
17
|
+
* */
|
|
18
|
+
export declare const isUrl: (path: string) => boolean;
|
package/es/utils/urlUtils.js
CHANGED
|
@@ -1,41 +1,19 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
1
|
+
// @ts-nocheck 文件忽略(添加到该文件的首行)
|
|
2
2
|
import { parse } from "qs";
|
|
3
|
-
/**
|
|
4
|
-
* 获取url的search,并有条件:`^{变量名}`的条件取本地存储的数据 // 参数格式:^{变量名} 变量名支持数字、字母、下划线
|
|
5
|
-
* */
|
|
6
|
-
export var getUrlSearch = function getUrlSearch(href) {
|
|
7
|
-
var searchKeys = {};
|
|
8
|
-
if (isUrl(href)) {
|
|
9
|
-
var url = new URL(href);
|
|
10
|
-
searchKeys = parse(url.search, {
|
|
11
|
-
ignoreQueryPrefix: true // 去除第一个字符'?'
|
|
12
|
-
});
|
|
13
|
-
} else {
|
|
14
|
-
searchKeys = parse(href.split('?')[1], {
|
|
15
|
-
ignoreQueryPrefix: true // 去除第一个字符'?'
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
// 有带参数,取本地的数据
|
|
19
|
-
Object.keys(searchKeys).forEach(function (item) {
|
|
20
|
-
var _searchKeys$item;
|
|
21
|
-
// 取变量名对应本地的值
|
|
22
|
-
if (((_searchKeys$item = searchKeys[item]) === null || _searchKeys$item === void 0 ? void 0 : _searchKeys$item.indexOf('^{')) !== -1) {
|
|
23
|
-
// 清除"^{"与"}"取当前的
|
|
24
|
-
var keyParam = searchKeys[item].replace('^{', '').substring(0, searchKeys[item].replace('^{', '').lastIndexOf('}'));
|
|
25
|
-
searchKeys[item] = localStorage.getItem(keyParam) || undefined;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return searchKeys;
|
|
29
|
-
};
|
|
30
3
|
|
|
31
4
|
/**
|
|
5
|
+
* 跳转外链、iframe 地址支持带参
|
|
32
6
|
* 获取url的search,并有条件:`^{变量名}`的条件取本地存储的数据 // 参数格式:^{变量名} 变量名支持数字、字母、下划线
|
|
33
7
|
* 根据url上的参数变量,重新调整跳转链接
|
|
8
|
+
* @param {string} href 地址
|
|
9
|
+
*
|
|
10
|
+
* @result {string} 完整的url地址
|
|
34
11
|
* */
|
|
35
12
|
export var getJumpUrlBySearch = function getJumpUrlBySearch(href) {
|
|
36
13
|
var searchKeys = {};
|
|
37
14
|
var getPath;
|
|
38
|
-
if (
|
|
15
|
+
if (!href) return;
|
|
16
|
+
if (isHttpUrl(href)) {
|
|
39
17
|
var url = new URL(href);
|
|
40
18
|
searchKeys = parse(url.search, {
|
|
41
19
|
ignoreQueryPrefix: true // 去除第一个字符'?'
|
|
@@ -49,9 +27,9 @@ export var getJumpUrlBySearch = function getJumpUrlBySearch(href) {
|
|
|
49
27
|
}
|
|
50
28
|
// 有带参数,取本地的数据,然后拼接给地址
|
|
51
29
|
Object.keys(searchKeys).forEach(function (item, index) {
|
|
52
|
-
var _searchKeys$
|
|
30
|
+
var _searchKeys$item;
|
|
53
31
|
// 取变量名
|
|
54
|
-
if (((_searchKeys$
|
|
32
|
+
if (((_searchKeys$item = searchKeys[item]) === null || _searchKeys$item === void 0 ? void 0 : _searchKeys$item.indexOf('^{')) !== -1) {
|
|
55
33
|
// 清除"^{"与"}"取当前的
|
|
56
34
|
var keyParam = searchKeys[item].replace('^{', '').substring(0, searchKeys[item].replace('^{', '').lastIndexOf('}'));
|
|
57
35
|
searchKeys[item] = localStorage.getItem(keyParam) || '';
|
|
@@ -60,11 +38,12 @@ export var getJumpUrlBySearch = function getJumpUrlBySearch(href) {
|
|
|
60
38
|
});
|
|
61
39
|
return getPath;
|
|
62
40
|
};
|
|
41
|
+
|
|
63
42
|
/**
|
|
64
43
|
* 是否是完整的URL
|
|
65
44
|
*
|
|
66
45
|
* */
|
|
67
|
-
export var
|
|
46
|
+
export var isHttpUrl = function isHttpUrl(path) {
|
|
68
47
|
if (!path.startsWith('http')) {
|
|
69
48
|
return false;
|
|
70
49
|
}
|
|
@@ -74,4 +53,14 @@ export var isUrl = function isUrl(path) {
|
|
|
74
53
|
} catch (error) {
|
|
75
54
|
return false;
|
|
76
55
|
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/* eslint no-useless-escape:0 import/prefer-default-export:0 */
|
|
59
|
+
var reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 是否是完整的URL
|
|
63
|
+
* */
|
|
64
|
+
export var isUrl = function isUrl(path) {
|
|
65
|
+
return reg.test(path);
|
|
77
66
|
};
|
|
@@ -53,8 +53,10 @@ var SpecButtonGroupStyleFunc = function SpecButtonGroupStyleFunc(prefix) {
|
|
|
53
53
|
});
|
|
54
54
|
var prefixCls = ".".concat(prefix);
|
|
55
55
|
return [_defineProperty({}, prefixCls, _objectSpread({
|
|
56
|
-
display: 'inline-block',
|
|
56
|
+
// display: 'inline-block',
|
|
57
|
+
display: 'inline-flex',
|
|
57
58
|
verticalAlign: 'middle',
|
|
59
|
+
flexWrap: 'wrap',
|
|
58
60
|
alignItems: 'center',
|
|
59
61
|
'> *': {
|
|
60
62
|
marginLeft: token.marginSM,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ConfigContext = require("../../ConfigContext");
|
|
10
|
+
var _excluded = ["type", "extendType"];
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
var ExtensionField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
16
|
+
var InitFanContext = (0, _react.useContext)(_ConfigContext.FanContext);
|
|
17
|
+
var providerConfig = InitFanContext['Field'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
18
|
+
var type = props.type,
|
|
19
|
+
extendType = props.extendType,
|
|
20
|
+
fieldProps = _objectWithoutProperties(props, _excluded);
|
|
21
|
+
var MatchType = ((providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.extendComponents) || []).find(function (tItem) {
|
|
22
|
+
return tItem.extendType === extendType;
|
|
23
|
+
});
|
|
24
|
+
var MatchTypeComponent = (MatchType === null || MatchType === void 0 ? void 0 : MatchType.component) || null;
|
|
25
|
+
return typeof MatchTypeComponent === 'function' ? /*#__PURE__*/_react.default.createElement(MatchTypeComponent, fieldProps) : MatchTypeComponent;
|
|
26
|
+
});
|
|
27
|
+
var _default = exports.default = ExtensionField;
|
|
@@ -8,10 +8,16 @@ interface OptionNameProps {
|
|
|
8
8
|
children?: string;
|
|
9
9
|
[k: string]: any;
|
|
10
10
|
}
|
|
11
|
+
export interface FieldExtendsTypeType {
|
|
12
|
+
type: string;
|
|
13
|
+
component: (cProps: any) => React.ReactNode | React.ReactNode | any;
|
|
14
|
+
[k: string]: any;
|
|
15
|
+
}
|
|
11
16
|
export interface FieldComponentProps {
|
|
12
17
|
label?: any;
|
|
13
18
|
type?: string;
|
|
14
19
|
filedName?: string;
|
|
20
|
+
fieldName?: string;
|
|
15
21
|
value?: any;
|
|
16
22
|
protoConfig?: any;
|
|
17
23
|
onChange?: (value?: any, option?: any) => void | any;
|
|
@@ -33,6 +39,9 @@ export interface FieldComponentProps {
|
|
|
33
39
|
value: string;
|
|
34
40
|
}[];
|
|
35
41
|
rules?: any;
|
|
42
|
+
defaultStyle?: React.CSSProperties;
|
|
43
|
+
extendComponents?: FieldExtendsTypeType[];
|
|
44
|
+
[k: string]: any;
|
|
36
45
|
}
|
|
37
|
-
declare const FieldComponent: React.ForwardRefExoticComponent<FieldComponentProps & React.RefAttributes<unknown>>;
|
|
46
|
+
declare const FieldComponent: React.ForwardRefExoticComponent<Omit<FieldComponentProps, "ref"> & React.RefAttributes<unknown>>;
|
|
38
47
|
export default FieldComponent;
|
|
@@ -12,6 +12,7 @@ var _RefactorTreeSelect = _interopRequireDefault(require("./RefactorTreeSelect")
|
|
|
12
12
|
var _setReadonlyValues = require("./setReadonlyValues");
|
|
13
13
|
var _TitleNode = _interopRequireDefault(require("./TitleNode"));
|
|
14
14
|
var _ReUpload = _interopRequireDefault(require("./ReUpload"));
|
|
15
|
+
var _ExtensionField = _interopRequireDefault(require("./ExtensionField"));
|
|
15
16
|
var _ConfigContext = require("../../ConfigContext");
|
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -30,42 +31,50 @@ var TextArea = _antd.Input.TextArea,
|
|
|
30
31
|
var Option = _antd.Select.Option;
|
|
31
32
|
var RangePicker = _antd.DatePicker.RangePicker;
|
|
32
33
|
// 表单组件类型
|
|
34
|
+
// @ts-ignore
|
|
33
35
|
var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
var InitFanContext = (0, _react.useContext)(_ConfigContext.FanContext);
|
|
37
|
+
var providerConfig = InitFanContext['Field'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
38
|
+
var _providerConfig$props = _objectSpread(_objectSpread({}, providerConfig), props),
|
|
39
|
+
type = _providerConfig$props.type,
|
|
40
|
+
_onChange = _providerConfig$props.onChange,
|
|
41
|
+
value = _providerConfig$props.value,
|
|
42
|
+
style = _providerConfig$props.style,
|
|
43
|
+
placeholder = _providerConfig$props.placeholder,
|
|
44
|
+
protoConfig = _providerConfig$props.protoConfig,
|
|
45
|
+
_providerConfig$props2 = _providerConfig$props.treeData,
|
|
46
|
+
treeData = _providerConfig$props2 === void 0 ? [] : _providerConfig$props2,
|
|
47
|
+
filedName = _providerConfig$props.filedName,
|
|
48
|
+
fieldName = _providerConfig$props.fieldName,
|
|
49
|
+
_providerConfig$props3 = _providerConfig$props.selectOptionName,
|
|
50
|
+
selectOptionName = _providerConfig$props3 === void 0 ? {
|
|
45
51
|
value: 'value',
|
|
46
52
|
label: 'label',
|
|
47
53
|
disabled: 'disabled',
|
|
48
54
|
title: 'title'
|
|
49
|
-
} :
|
|
50
|
-
|
|
51
|
-
treeOptionName =
|
|
55
|
+
} : _providerConfig$props3,
|
|
56
|
+
_providerConfig$props4 = _providerConfig$props.treeOptionName,
|
|
57
|
+
treeOptionName = _providerConfig$props4 === void 0 ? {
|
|
52
58
|
title: 'title',
|
|
53
59
|
value: 'value',
|
|
54
60
|
children: 'children',
|
|
55
61
|
disabled: 'disabled'
|
|
56
|
-
} :
|
|
57
|
-
|
|
58
|
-
fieldStatus =
|
|
59
|
-
|
|
60
|
-
size =
|
|
61
|
-
showFullLevel = props.showFullLevel,
|
|
62
|
-
separator = props.separator,
|
|
63
|
-
disabledFields = props.disabledFields,
|
|
64
|
-
selectOptionRender = props.selectOptionRender,
|
|
65
|
-
render = props.render
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
} : _providerConfig$props4,
|
|
63
|
+
_providerConfig$props5 = _providerConfig$props.fieldStatus,
|
|
64
|
+
fieldStatus = _providerConfig$props5 === void 0 ? 'default' : _providerConfig$props5,
|
|
65
|
+
_providerConfig$props6 = _providerConfig$props.size,
|
|
66
|
+
size = _providerConfig$props6 === void 0 ? 'middle' : _providerConfig$props6,
|
|
67
|
+
showFullLevel = _providerConfig$props.showFullLevel,
|
|
68
|
+
separator = _providerConfig$props.separator,
|
|
69
|
+
disabledFields = _providerConfig$props.disabledFields,
|
|
70
|
+
selectOptionRender = _providerConfig$props.selectOptionRender,
|
|
71
|
+
render = _providerConfig$props.render,
|
|
72
|
+
_providerConfig$props7 = _providerConfig$props.defaultStyle,
|
|
73
|
+
defaultStyle = _providerConfig$props7 === void 0 ? {} : _providerConfig$props7,
|
|
74
|
+
extendConfig = _providerConfig$props.extendConfig;
|
|
75
|
+
var _providerConfig$props8 = _objectSpread(_objectSpread({}, providerConfig), props),
|
|
76
|
+
selectOptions = _providerConfig$props8.selectOptions;
|
|
77
|
+
var providerProtoConfig = (InitFanContext === null || InitFanContext === void 0 ? void 0 : InitFanContext[type || '']) || {}; // 使用上下文(全局配置)设置控件扩展的配置项
|
|
69
78
|
var compContent;
|
|
70
79
|
if (selectOptionName && selectOptions) {
|
|
71
80
|
// 将传值的数据进行转换
|
|
@@ -85,12 +94,12 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
85
94
|
render: render,
|
|
86
95
|
size: size,
|
|
87
96
|
ref: ref
|
|
88
|
-
},
|
|
97
|
+
}, providerProtoConfig), protoConfig);
|
|
89
98
|
if (fieldStatus === 'disabled') {
|
|
90
99
|
defaultProps.disabled = true;
|
|
91
100
|
}
|
|
92
101
|
var sortLimitRule = {}; // 排序字段长度限制
|
|
93
|
-
if (filedName === 'sorts' || filedName === 'sort' || filedName === 'indexSort' || filedName === 'sorta' || filedName === 'categorySort') {
|
|
102
|
+
if (filedName === 'sorts' || filedName === 'sort' || filedName === 'indexSort' || filedName === 'sorta' || filedName === 'categorySort' || fieldName === 'sorts' || fieldName === 'sort' || fieldName === 'indexSort' || fieldName === 'sorta' || fieldName === 'categorySort') {
|
|
94
103
|
sortLimitRule = {
|
|
95
104
|
min: 0,
|
|
96
105
|
max: 999999999,
|
|
@@ -99,6 +108,7 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
99
108
|
}
|
|
100
109
|
// 设置纯展示模式下的“下拉树”控件返回值
|
|
101
110
|
var viewOnly = fieldStatus === 'viewOnly'; // 是否纯展示
|
|
111
|
+
|
|
102
112
|
switch (type) {
|
|
103
113
|
case 'input':
|
|
104
114
|
compContent = viewOnly ? value || '-' : /*#__PURE__*/_react.default.createElement(_antd.Input, _extends({
|
|
@@ -112,27 +122,33 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
112
122
|
evt.preventDefault(); // 禁止默认行为
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
|
-
}, defaultProps
|
|
125
|
+
}, defaultProps, {
|
|
126
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
127
|
+
}));
|
|
116
128
|
break;
|
|
117
129
|
case 'password':
|
|
118
130
|
compContent = viewOnly ? value ? "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF" : '-' : /*#__PURE__*/_react.default.createElement(Password, _extends({
|
|
119
131
|
autoComplete: "off",
|
|
120
132
|
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入',
|
|
121
133
|
maxLength: defaultProps.maxLength || 50
|
|
122
|
-
}, defaultProps
|
|
134
|
+
}, defaultProps, {
|
|
135
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
136
|
+
}));
|
|
123
137
|
break;
|
|
124
138
|
case 'textarea':
|
|
125
139
|
compContent = viewOnly ? value || '-' : /*#__PURE__*/_react.default.createElement(TextArea, _extends({
|
|
126
140
|
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入',
|
|
127
141
|
maxLength: defaultProps.maxLength || 500,
|
|
128
142
|
title: fieldStatus === 'disabled' || defaultProps.disabled ? value : null
|
|
129
|
-
}, defaultProps
|
|
143
|
+
}, defaultProps, {
|
|
144
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
145
|
+
}));
|
|
130
146
|
break;
|
|
131
147
|
case 'inputNumber':
|
|
132
148
|
compContent = viewOnly ? value || 0 : /*#__PURE__*/_react.default.createElement(_antd.InputNumber, _extends({
|
|
133
149
|
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入数字'
|
|
134
150
|
}, sortLimitRule, defaultProps, {
|
|
135
|
-
style: _objectSpread({
|
|
151
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), {}, {
|
|
136
152
|
width: '120px'
|
|
137
153
|
}, defaultProps.style)
|
|
138
154
|
}));
|
|
@@ -171,7 +187,9 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
171
187
|
return (defaultProps === null || defaultProps === void 0 || (_defaultProps$optionR = defaultProps.optionRender) === null || _defaultProps$optionR === void 0 ? void 0 : _defaultProps$optionR.call(defaultProps, _objectSpread(_objectSpread({}, option.data), option), info)) || (selectOptionRender === null || selectOptionRender === void 0 ? void 0 : selectOptionRender(_objectSpread(_objectSpread({}, option.data), option), info)) || option.label;
|
|
172
188
|
}
|
|
173
189
|
}, defaultProps, {
|
|
190
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
174
191
|
// onChange返回参数:累加当前选中包括其他字段值的数据
|
|
192
|
+
,
|
|
175
193
|
onChange: function onChange(value, Option) {
|
|
176
194
|
return _onChange && _onChange(value, resetResultOption(Option));
|
|
177
195
|
} // 数据为对象
|
|
@@ -188,7 +206,9 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
188
206
|
protoTreeNode: protoConfig && protoConfig.TreeNode || {},
|
|
189
207
|
fieldStatus: fieldStatus,
|
|
190
208
|
disabledFields: disabledFields
|
|
191
|
-
}, defaultProps
|
|
209
|
+
}, defaultProps, {
|
|
210
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
211
|
+
}));
|
|
192
212
|
break;
|
|
193
213
|
case 'checkbox':
|
|
194
214
|
delete defaultProps.ref;
|
|
@@ -198,7 +218,7 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
198
218
|
defaultProps: defaultProps,
|
|
199
219
|
separator: separator
|
|
200
220
|
}) : /*#__PURE__*/_react.default.createElement(_antd.Checkbox.Group, _extends({}, defaultProps, {
|
|
201
|
-
style: _objectSpread({
|
|
221
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), {}, {
|
|
202
222
|
width: 'auto'
|
|
203
223
|
}, defaultProps.style)
|
|
204
224
|
}), selectOptions && selectOptions.map(function (val, index) {
|
|
@@ -230,7 +250,7 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
230
250
|
});
|
|
231
251
|
})
|
|
232
252
|
}, defaultProps, {
|
|
233
|
-
style: _objectSpread({
|
|
253
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), {}, {
|
|
234
254
|
width: 'auto'
|
|
235
255
|
}, defaultProps.style)
|
|
236
256
|
}));
|
|
@@ -244,9 +264,9 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
244
264
|
showTime: defaultProps.showTime || type === 'dateTimePicker',
|
|
245
265
|
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择'
|
|
246
266
|
}, defaultProps, {
|
|
247
|
-
style: _objectSpread({
|
|
248
|
-
|
|
249
|
-
}, defaultProps.style)
|
|
267
|
+
style: _objectSpread(_objectSpread({
|
|
268
|
+
width: 'auto'
|
|
269
|
+
}, defaultStyle), defaultProps.style)
|
|
250
270
|
}));
|
|
251
271
|
break;
|
|
252
272
|
case 'rangePicker':
|
|
@@ -259,9 +279,8 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
259
279
|
showTime: defaultProps.showTime || type === 'rangeTimePicker',
|
|
260
280
|
allowEmpty: true
|
|
261
281
|
}, defaultProps, {
|
|
262
|
-
style:
|
|
263
|
-
|
|
264
|
-
}, defaultProps.style)
|
|
282
|
+
// style={{ width: type === 'rangeTimePicker' ? 'auto' : '100%', ...defaultStyle,...defaultProps.style }}
|
|
283
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
265
284
|
}));
|
|
266
285
|
break;
|
|
267
286
|
case 'timePicker':
|
|
@@ -270,9 +289,7 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
270
289
|
type: type,
|
|
271
290
|
protoConfig: protoConfig
|
|
272
291
|
}) : /*#__PURE__*/_react.default.createElement(_antd.TimePicker, _extends({}, defaultProps, {
|
|
273
|
-
style: _objectSpread(_objectSpread({
|
|
274
|
-
'minWidth': 'auto'
|
|
275
|
-
}, defaultProps.style), {}, {
|
|
292
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, defaultStyle), defaultProps.style), {}, {
|
|
276
293
|
width: 'auto'
|
|
277
294
|
})
|
|
278
295
|
}));
|
|
@@ -286,11 +303,7 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
286
303
|
}) : /*#__PURE__*/_react.default.createElement(_antd.TimePicker.RangePicker, _extends({
|
|
287
304
|
allowEmpty: true
|
|
288
305
|
}, defaultProps, {
|
|
289
|
-
style: _objectSpread(_objectSpread({
|
|
290
|
-
'minWidth': 'auto'
|
|
291
|
-
}, defaultProps.style), {}, {
|
|
292
|
-
width: 'auto'
|
|
293
|
-
})
|
|
306
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
294
307
|
}));
|
|
295
308
|
break;
|
|
296
309
|
case 'upload':
|
|
@@ -324,7 +337,9 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
324
337
|
allowClear: true,
|
|
325
338
|
fieldNames: (defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.fieldNames) || selectOptionName,
|
|
326
339
|
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择'
|
|
327
|
-
}, defaultProps
|
|
340
|
+
}, defaultProps, {
|
|
341
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
342
|
+
}));
|
|
328
343
|
break;
|
|
329
344
|
case 'switch':
|
|
330
345
|
compContent = /*#__PURE__*/_react.default.createElement(_antd.Switch, _extends({}, defaultProps, {
|
|
@@ -338,7 +353,7 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
338
353
|
break;
|
|
339
354
|
case 'slider':
|
|
340
355
|
compContent = viewOnly ? value : /*#__PURE__*/_react.default.createElement(_antd.Slider, _extends({}, defaultProps, {
|
|
341
|
-
style: _objectSpread({}, defaultProps.style)
|
|
356
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
342
357
|
}));
|
|
343
358
|
break;
|
|
344
359
|
case 'mentions':
|
|
@@ -349,20 +364,71 @@ var FieldComponent = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
349
364
|
label: selectOptionRender ? selectOptionRender(val) : val.label
|
|
350
365
|
});
|
|
351
366
|
})
|
|
352
|
-
}, defaultProps
|
|
367
|
+
}, defaultProps, {
|
|
368
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
369
|
+
}));
|
|
353
370
|
break;
|
|
354
371
|
case 'rate':
|
|
355
372
|
compContent = /*#__PURE__*/_react.default.createElement(_antd.Rate, _extends({
|
|
356
373
|
disabled: viewOnly || defaultProps.disabled
|
|
357
|
-
}, defaultProps
|
|
374
|
+
}, defaultProps, {
|
|
375
|
+
style: _objectSpread(_objectSpread({}, defaultStyle), {}, {
|
|
376
|
+
width: 'auto'
|
|
377
|
+
}, defaultProps.style)
|
|
378
|
+
}));
|
|
358
379
|
break;
|
|
359
380
|
case 'custom':
|
|
360
381
|
compContent = defaultProps.render && defaultProps.render(props) || defaultProps.customRender && defaultProps.customRender(props) || null;
|
|
361
382
|
break;
|
|
383
|
+
// case 'extends':
|
|
384
|
+
// compContent = <ExtensionField {...props} {...defaultProps}/>
|
|
385
|
+
// break;
|
|
362
386
|
default:
|
|
363
|
-
|
|
387
|
+
// 扩展组件
|
|
388
|
+
if (((providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.extendComponents) || []).some(function (tItem) {
|
|
389
|
+
return tItem.extendType === props.type;
|
|
390
|
+
})) {
|
|
391
|
+
compContent = /*#__PURE__*/_react.default.createElement(_ExtensionField.default, _extends({}, props, defaultProps, {
|
|
392
|
+
extendType: type
|
|
393
|
+
}));
|
|
394
|
+
// const MatchType = (extendComponents || []).find((tItem: FieldExtendsTypeType) => tItem.extendType === type)
|
|
395
|
+
// const MatchTypeComponent = MatchType?.component
|
|
396
|
+
// // const { type, ...fieldProps } = { ...props }
|
|
397
|
+
// console.log('fieldProps', props, defaultProps)
|
|
398
|
+
// return typeof MatchTypeComponent === 'function'
|
|
399
|
+
// ? <MatchTypeComponent ref={ref} fieldProps={props} proptoConfig={protoConfig} extendConfig={Object.assign(extendConfig || {}, MatchType?.extendConfig || {})}/>
|
|
400
|
+
// : MatchTypeComponent
|
|
401
|
+
//
|
|
402
|
+
// const MatchType = (providerConfig?.extendComponents || []).find((tItem: FieldExtendsTypeType) => tItem.extendType === props.type)
|
|
403
|
+
// const MatchTypeComponent = MatchType?.component
|
|
404
|
+
// const { type, ...fieldProps } = props
|
|
405
|
+
// compContent = typeof MatchTypeComponent === 'function'
|
|
406
|
+
// ? <MatchTypeComponent {...fieldProps}/>
|
|
407
|
+
// : MatchTypeComponent
|
|
408
|
+
} else {
|
|
409
|
+
compContent = value;
|
|
410
|
+
}
|
|
364
411
|
break;
|
|
365
412
|
}
|
|
366
413
|
return compContent;
|
|
367
414
|
});
|
|
368
|
-
var _default = exports.default = FieldComponent;
|
|
415
|
+
var _default = exports.default = FieldComponent; //
|
|
416
|
+
// // 高阶组件
|
|
417
|
+
// const withLibraryInjection = (LibraryComponent) => (WrappedComponent) => {
|
|
418
|
+
// return class InjectedComponent extends React.Component {
|
|
419
|
+
// render() {
|
|
420
|
+
// return (
|
|
421
|
+
// <>
|
|
422
|
+
// <LibraryComponent {...this.props} children={<WrappedComponent {...this.props} />}/>
|
|
423
|
+
// </>
|
|
424
|
+
// );
|
|
425
|
+
// }
|
|
426
|
+
// };
|
|
427
|
+
// };
|
|
428
|
+
//
|
|
429
|
+
//
|
|
430
|
+
// // 应用HOC
|
|
431
|
+
// const MyComponentWithLibrary = withLibraryInjection(FieldComponent)(ExtensionField);
|
|
432
|
+
//
|
|
433
|
+
//
|
|
434
|
+
// export default MyComponentWithLibrary
|