@zat-design/sisyphus-react 3.9.5 → 3.9.6-beta.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/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
- package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
- package/coverage/lcov-report/src/.umi/core/index.html +206 -0
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
- package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
- package/coverage/lcov-report/src/.umi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
- package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
- package/dist/index.esm.css +51 -6
- package/dist/less.esm.css +51 -6
- package/es/FormsProvider/index.d.ts +15 -0
- package/es/FormsProvider/index.js +32 -0
- package/es/ProConfigProvider/index.d.ts +0 -1
- package/es/ProConfigProvider/index.js +0 -5
- package/es/ProEditTable/utils/diffOriginal.js +11 -8
- package/es/ProForm/components/render/Render.js +4 -4
- package/es/ProForm/index.js +12 -38
- package/es/ProForm/style/index.less +1 -0
- package/es/ProForm/utils/diffOriginal.js +14 -19
- package/es/ProForm/utils/useForm.d.ts +4 -3
- package/es/ProForm/utils/useForm.js +12 -3
- package/es/ProLayout/components/ProHeader/PropTypes.d.ts +8 -0
- package/es/ProLayout/components/ProHeader/index.js +94 -28
- package/es/ProLayout/components/ProHeader/style/index.less +51 -6
- package/es/ProLayout/components/ProHeader/utils/index.d.ts +5 -0
- package/es/ProLayout/components/ProHeader/utils/index.js +14 -0
- package/es/ProLayout/style/index.less +1 -1
- package/es/ProSelect/index.js +1 -1
- package/es/ProTreeModal/components/Trigger.js +4 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/utils/index.d.ts +4 -1
- package/es/utils/index.js +4 -1
- package/lib/FormsProvider/index.d.ts +15 -0
- package/lib/FormsProvider/index.js +39 -0
- package/lib/ProConfigProvider/index.d.ts +0 -1
- package/lib/ProConfigProvider/index.js +0 -6
- package/lib/ProEditTable/utils/diffOriginal.js +11 -8
- package/lib/ProForm/components/render/Render.js +4 -4
- package/lib/ProForm/index.js +11 -37
- package/lib/ProForm/style/index.less +1 -0
- package/lib/ProForm/utils/diffOriginal.js +14 -19
- package/lib/ProForm/utils/useForm.d.ts +4 -3
- package/lib/ProForm/utils/useForm.js +12 -3
- package/lib/ProLayout/components/ProHeader/PropTypes.d.ts +8 -0
- package/lib/ProLayout/components/ProHeader/index.js +90 -24
- package/lib/ProLayout/components/ProHeader/style/index.less +51 -6
- package/lib/ProLayout/components/ProHeader/utils/index.d.ts +5 -0
- package/lib/ProLayout/components/ProHeader/utils/index.js +20 -0
- package/lib/ProLayout/style/index.less +1 -1
- package/lib/ProSelect/index.js +1 -1
- package/lib/ProTreeModal/components/Trigger.js +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +8 -0
- package/lib/utils/index.d.ts +4 -1
- package/lib/utils/index.js +4 -1
- package/package.json +1 -1
package/es/ProForm/index.js
CHANGED
@@ -2,13 +2,13 @@ import "antd/es/row/style";
|
|
2
2
|
import _Row from "antd/es/row";
|
3
3
|
import "antd/es/form/style";
|
4
4
|
import _Form from "antd/es/form";
|
5
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
5
6
|
import "antd/es/col/style";
|
6
7
|
import _Col from "antd/es/col";
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
8
9
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
9
10
|
import "antd/es/space/style";
|
10
11
|
import _Space from "antd/es/space";
|
11
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
14
14
|
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize"];
|
@@ -19,14 +19,15 @@ import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
19
19
|
import { isObject, merge, omit } from 'lodash';
|
20
20
|
import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
21
21
|
import RenderFields from './components/render/RenderFields';
|
22
|
-
import { useProConfig
|
22
|
+
import { useProConfig } from '../ProConfigProvider';
|
23
23
|
import { getLayout, splitNameStr, useControlled, initialValuesToNames, filterInternalFields } from './utils/index';
|
24
24
|
import { useForm } from './utils/useForm';
|
25
25
|
import { useFieldProps } from './utils/useFieldProps';
|
26
26
|
import locale from '../locale';
|
27
27
|
import useWatch from './utils/useWatch';
|
28
|
+
import FormsProvider, { useContextForms, useForms } from '../FormsProvider';
|
28
29
|
var ProForm = function ProForm(props, ref) {
|
29
|
-
var
|
30
|
+
var _localStorage, _ref;
|
30
31
|
var _props$mode = props.mode,
|
31
32
|
mode = _props$mode === void 0 ? 'search' : _props$mode,
|
32
33
|
span = props.span,
|
@@ -69,14 +70,11 @@ var ProForm = function ProForm(props, ref) {
|
|
69
70
|
_props$optimize = props.optimize,
|
70
71
|
optimize = _props$optimize === void 0 ? false : _props$optimize,
|
71
72
|
otherProps = _objectWithoutProperties(props, _excluded);
|
72
|
-
var
|
73
|
-
|
74
|
-
dispatch = _useProConfig.dispatch;
|
75
|
-
var config = state.ProForm,
|
76
|
-
forms = state.forms;
|
77
|
-
var _useForm = useForm((_forms$formKey = forms[formKey]) !== null && _forms$formKey !== void 0 ? _forms$formKey : originForm, {
|
73
|
+
var config = useProConfig('ProForm');
|
74
|
+
var _useForm = useForm(originForm, {
|
78
75
|
scrollToError: scrollToError,
|
79
|
-
optimize: optimize
|
76
|
+
optimize: optimize,
|
77
|
+
formKey: formKey
|
80
78
|
}),
|
81
79
|
_useForm2 = _slicedToArray(_useForm, 1),
|
82
80
|
form = _useForm2[0];
|
@@ -87,33 +85,6 @@ var ProForm = function ProForm(props, ref) {
|
|
87
85
|
_useControlled2 = _slicedToArray(_useControlled, 2),
|
88
86
|
openState = _useControlled2[0],
|
89
87
|
setOpenState = _useControlled2[1];
|
90
|
-
// 把表单实例存入表单组
|
91
|
-
useMemo(function () {
|
92
|
-
if (formKey && forms[formKey] !== form) {
|
93
|
-
forms[formKey] = form;
|
94
|
-
// fix: Cannot update a component (`ProConfigProvider`) while rendering a different component (`ForwardRef(ProForm)`).
|
95
|
-
setTimeout(function () {
|
96
|
-
dispatch({
|
97
|
-
type: 'set',
|
98
|
-
payload: {
|
99
|
-
forms: _objectSpread({}, forms)
|
100
|
-
}
|
101
|
-
});
|
102
|
-
}, 300);
|
103
|
-
}
|
104
|
-
// 销毁
|
105
|
-
return function () {
|
106
|
-
if (formKey && forms[formKey]) {
|
107
|
-
delete forms[formKey];
|
108
|
-
dispatch({
|
109
|
-
type: 'set',
|
110
|
-
payload: {
|
111
|
-
forms: _objectSpread({}, forms)
|
112
|
-
}
|
113
|
-
});
|
114
|
-
}
|
115
|
-
};
|
116
|
-
}, [formKey, form]);
|
117
88
|
var _getLayout = getLayout({
|
118
89
|
span: span,
|
119
90
|
form: form
|
@@ -310,7 +281,10 @@ export var ProFormProvider = function ProFormProvider(props) {
|
|
310
281
|
};
|
311
282
|
ProFormForward.Provider = ProFormProvider; // 包装Provider
|
312
283
|
ProFormForward.useFieldProps = useFieldProps; // 获取每个字段的其他参数 -otherProps
|
313
|
-
|
284
|
+
// 表单实例共享
|
285
|
+
ProFormForward.FormsProvider = FormsProvider; // 表单实例共享Provider
|
286
|
+
ProFormForward.useForms = useForms; // 获取上下文中的共享的表单实例map
|
287
|
+
ProFormForward.useContextForms = useContextForms; // 获取上下文中的共享的表单实例map
|
314
288
|
// 内置组合
|
315
289
|
ProFormForward.ProCascader = ProCascader;
|
316
290
|
ProFormForward.ProCombination = ProCombination;
|
@@ -3,7 +3,13 @@ import { isEmpty } from '../../utils';
|
|
3
3
|
// 过滤对象中undefined字段
|
4
4
|
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
5
5
|
var filterObject = function filterObject(data) {
|
6
|
-
if (!isObject(data) ||
|
6
|
+
if (!isObject(data) || data === null) return data;
|
7
|
+
// ['1', undefined] ['1', ''] 视为相等
|
8
|
+
if (Array.isArray(data)) {
|
9
|
+
return data.map(function (item) {
|
10
|
+
return isEmpty(item) ? null : item;
|
11
|
+
});
|
12
|
+
}
|
7
13
|
var resData = {};
|
8
14
|
Object.keys(data).forEach(function (key) {
|
9
15
|
if (!isEmpty(data[key])) {
|
@@ -31,22 +37,11 @@ export var diffOriginal = function diffOriginal(params) {
|
|
31
37
|
}
|
32
38
|
var _value = filterObject(value);
|
33
39
|
var _originalValue = filterObject(originalValue);
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
42
|
-
return isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
43
|
-
}
|
44
|
-
return true;
|
45
|
-
});
|
46
|
-
return isSame ? 'same' : 'changed';
|
47
|
-
}
|
48
|
-
if (!isEmpty(_originalValue) || !isEmpty(_value)) {
|
49
|
-
return isEqual(_value, _originalValue) ? 'same' : 'changed';
|
50
|
-
}
|
51
|
-
return 'same';
|
40
|
+
var isEmptyVal = isEmpty(_value);
|
41
|
+
var isEmptyOrg = isEmpty(_originalValue);
|
42
|
+
// 都为空视为相等
|
43
|
+
if (isEmptyOrg && isEmptyVal) return 'same';
|
44
|
+
// 如果原始值为空 且当前有值的话 视为新增
|
45
|
+
if (isEmptyOrg && !isEmptyVal) return 'add';
|
46
|
+
return isEqual(_value, _originalValue) ? 'same' : 'changed';
|
52
47
|
};
|
@@ -1,15 +1,16 @@
|
|
1
1
|
import { FormInstance } from 'antd';
|
2
2
|
import { NamePath } from 'antd/es/form/interface';
|
3
3
|
import { ValuedNotifyInfo } from 'rc-field-form/es/interface';
|
4
|
-
type ModifiedFormInstance<T> = FormInstance<T> & {
|
4
|
+
export type ModifiedFormInstance<T> = FormInstance<T> & {
|
5
5
|
isModified?: boolean;
|
6
6
|
/** 默认清空设置值的报错状态 */
|
7
7
|
setFieldValue: (name: NamePath, value: any, info?: ValuedNotifyInfo) => void;
|
8
|
+
formKey?: string;
|
8
9
|
_init?: boolean;
|
9
10
|
};
|
10
|
-
interface FormInstanceOption {
|
11
|
+
export interface FormInstanceOption {
|
11
12
|
scrollToError?: boolean;
|
12
13
|
optimize?: boolean;
|
14
|
+
formKey?: string;
|
13
15
|
}
|
14
16
|
export declare const useForm: <T>(originForm?: FormInstanceOption | ModifiedFormInstance<T>, options?: FormInstanceOption) => [ModifiedFormInstance<T>];
|
15
|
-
export {};
|
@@ -5,22 +5,31 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
5
|
import "antd/es/form/style";
|
6
6
|
import _Form from "antd/es/form";
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
8
|
+
import { useContext } from 'react';
|
8
9
|
import { filterInternalFields } from './index';
|
9
10
|
import { handleScrollToError } from '../../ProEditTable/utils/tools';
|
11
|
+
import { FormsContext } from '../../FormsProvider';
|
10
12
|
export var useForm = function useForm(originForm, options) {
|
11
13
|
// 如果没有form实例可以直接把options放在第一个参数位置
|
12
14
|
// @ts-ignore
|
13
15
|
var _originForm = (originForm === null || originForm === void 0 ? void 0 : originForm._init) ? originForm : undefined;
|
14
16
|
var _options =
|
15
17
|
// @ts-ignore
|
16
|
-
options || originForm && !(originForm === null || originForm === void 0 ? void 0 : originForm._init) ? originForm : undefined;
|
18
|
+
options || (originForm && !(originForm === null || originForm === void 0 ? void 0 : originForm._init) ? originForm : undefined);
|
17
19
|
var _ref = _options || {},
|
18
20
|
_ref$scrollToError = _ref.scrollToError,
|
19
21
|
scrollToError = _ref$scrollToError === void 0 ? true : _ref$scrollToError,
|
20
|
-
optimize = _ref.optimize
|
21
|
-
|
22
|
+
optimize = _ref.optimize,
|
23
|
+
formKey = _ref.formKey;
|
24
|
+
// formKey全局共享逻辑
|
25
|
+
var forms = useContext(FormsContext);
|
26
|
+
var _Form$useForm = _Form.useForm(forms[formKey] || _originForm),
|
22
27
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
23
28
|
form = _Form$useForm2[0];
|
29
|
+
if (formKey && forms[formKey] !== form) {
|
30
|
+
forms[formKey] = form;
|
31
|
+
form.formKey = formKey;
|
32
|
+
}
|
24
33
|
var getFieldsValue = form.getFieldsValue,
|
25
34
|
validateFields = form.validateFields,
|
26
35
|
isModified = form.isModified,
|
@@ -26,6 +26,14 @@ export interface DescribeColumnsProps {
|
|
26
26
|
show?: boolean;
|
27
27
|
link?: string;
|
28
28
|
tag?: string | React.ReactNode | (string | React.ReactNode)[];
|
29
|
+
width?: string | number;
|
30
|
+
/** 多值配置 */
|
31
|
+
items?: {
|
32
|
+
copyable?: boolean;
|
33
|
+
value: string | React.ReactNode;
|
34
|
+
link?: string;
|
35
|
+
tag?: string | React.ReactNode | (string | React.ReactNode)[];
|
36
|
+
}[];
|
29
37
|
}
|
30
38
|
export interface ProHeaderProps {
|
31
39
|
title?: string | React.ReactNode;
|
@@ -2,29 +2,30 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import "antd/es/modal/style";
|
3
3
|
import _Modal from "antd/es/modal";
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
5
|
-
import "antd/es/tooltip/style";
|
6
|
-
import _Tooltip from "antd/es/tooltip";
|
7
5
|
import "antd/es/breadcrumb/style";
|
8
6
|
import _Breadcrumb from "antd/es/breadcrumb";
|
9
7
|
import "antd/es/divider/style";
|
10
8
|
import _Divider from "antd/es/divider";
|
9
|
+
import "antd/es/tooltip/style";
|
10
|
+
import _Tooltip from "antd/es/tooltip";
|
11
11
|
import "antd/es/space/style";
|
12
12
|
import _Space from "antd/es/space";
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
15
15
|
/* eslint-disable react/no-array-index-key */
|
16
16
|
|
17
|
-
import { memo, useEffect, useState } from 'react';
|
17
|
+
import { memo, useEffect, useState, useRef } from 'react';
|
18
18
|
import { tools } from '@zat-design/utils';
|
19
19
|
import classnames from 'classnames';
|
20
20
|
import moment from 'moment';
|
21
|
-
import { useToggle } from 'ahooks';
|
21
|
+
import { useToggle, useSize } from 'ahooks';
|
22
22
|
import { isFunction, isEmpty, isNumber, isString } from 'lodash';
|
23
23
|
import { ReactSVG } from 'react-svg';
|
24
24
|
import foldSvg from '../../../assets/arrow.svg';
|
25
25
|
import { Copy, ProBackBtn } from './components';
|
26
26
|
import getEnumLabel from '../../../ProEnum/utils/getEnumLabel';
|
27
27
|
import locale from '../../../locale';
|
28
|
+
import { checkDescribeItemsHidden } from './utils';
|
28
29
|
var formatAmount = tools.formatAmount;
|
29
30
|
var ProHeader = function ProHeader(props) {
|
30
31
|
var _props$breadcrumbList = props.breadcrumbList,
|
@@ -64,6 +65,8 @@ var ProHeader = function ProHeader(props) {
|
|
64
65
|
_useToggle2 = _slicedToArray(_useToggle, 2),
|
65
66
|
fold = _useToggle2[0],
|
66
67
|
toggle = _useToggle2[1].toggle;
|
68
|
+
var ref = useRef(null);
|
69
|
+
var size = useSize(ref);
|
67
70
|
var _title = title;
|
68
71
|
// 面包屑配置数据源
|
69
72
|
var _breadcrumbColumns = breadcrumbColumns || breadcrumbList;
|
@@ -94,7 +97,11 @@ var ProHeader = function ProHeader(props) {
|
|
94
97
|
return null;
|
95
98
|
}
|
96
99
|
return _jsx("ul", {
|
97
|
-
className:
|
100
|
+
className: classnames({
|
101
|
+
'pro-header-describe': true,
|
102
|
+
'pro-header-describe-open': fold,
|
103
|
+
'pro-header-describe-hidden': !fold
|
104
|
+
}),
|
98
105
|
children: describeData.map(function (item, index) {
|
99
106
|
var value = item.value,
|
100
107
|
copyable = item.copyable,
|
@@ -102,20 +109,20 @@ var ProHeader = function ProHeader(props) {
|
|
102
109
|
show = _item$show === void 0 ? true : _item$show,
|
103
110
|
tag = item.tag,
|
104
111
|
label = item.label,
|
105
|
-
link = item.link
|
112
|
+
link = item.link,
|
113
|
+
_item$items = item.items,
|
114
|
+
items = _item$items === void 0 ? [] : _item$items,
|
115
|
+
width = item.width;
|
106
116
|
// show为false直接隐藏¸
|
107
117
|
if (show === false || !show) {
|
108
118
|
return null;
|
109
119
|
}
|
110
120
|
var onlyTag = tag && !label && !value;
|
111
|
-
var
|
112
|
-
|
113
|
-
});
|
114
|
-
var tagRender = function tagRender() {
|
115
|
-
if (Array.isArray(tag) && tag.length) {
|
121
|
+
var tagRender = function tagRender(parmas) {
|
122
|
+
if (Array.isArray(parmas === null || parmas === void 0 ? void 0 : parmas.tag) && (parmas === null || parmas === void 0 ? void 0 : parmas.tag.length)) {
|
116
123
|
return _jsx(_Space, {
|
117
124
|
size: 4,
|
118
|
-
children: tag.map(function (tagItem, index) {
|
125
|
+
children: parmas.tag.map(function (tagItem, index) {
|
119
126
|
return _jsx("div", {
|
120
127
|
className: "pro-header-tag",
|
121
128
|
children: tagItem
|
@@ -123,32 +130,91 @@ var ProHeader = function ProHeader(props) {
|
|
123
130
|
})
|
124
131
|
});
|
125
132
|
}
|
126
|
-
return tag ? _jsx("div", {
|
133
|
+
return (parmas === null || parmas === void 0 ? void 0 : parmas.tag) ? _jsx("div", {
|
127
134
|
className: "pro-header-tag",
|
128
|
-
children: tag
|
135
|
+
children: parmas === null || parmas === void 0 ? void 0 : parmas.tag
|
129
136
|
}) : null;
|
130
137
|
};
|
131
|
-
|
138
|
+
/** 单行渲染 */
|
139
|
+
var valueRender = function valueRender(parmas) {
|
132
140
|
return _jsxs(_Space, {
|
133
141
|
size: 4,
|
134
|
-
align: tag ? 'baseline' : 'center',
|
135
|
-
children: [link ? _jsx("a", {
|
136
|
-
href: link,
|
142
|
+
align: (parmas === null || parmas === void 0 ? void 0 : parmas.tag) ? 'baseline' : 'center',
|
143
|
+
children: [(parmas === null || parmas === void 0 ? void 0 : parmas.link) ? _jsx("a", {
|
144
|
+
href: parmas.link,
|
137
145
|
rel: "noopener noreferrer",
|
138
146
|
target: "_blank",
|
139
|
-
children: value
|
140
|
-
}) : value, copyable && isString(value) ? _jsx(Copy, {
|
141
|
-
text: value
|
142
|
-
}) : null, tagRender(
|
147
|
+
children: parmas === null || parmas === void 0 ? void 0 : parmas.value
|
148
|
+
}) : parmas === null || parmas === void 0 ? void 0 : parmas.value, (parmas === null || parmas === void 0 ? void 0 : parmas.copyable) && isString(parmas === null || parmas === void 0 ? void 0 : parmas.value) ? _jsx(Copy, {
|
149
|
+
text: parmas.value
|
150
|
+
}) : null, tagRender({
|
151
|
+
tag: parmas === null || parmas === void 0 ? void 0 : parmas.tag
|
152
|
+
})]
|
143
153
|
});
|
144
154
|
};
|
145
|
-
|
155
|
+
/** 多行渲染 */
|
156
|
+
var itemsRender = function itemsRender() {
|
157
|
+
// items配置是否超长,超长配置... + tip 提示
|
158
|
+
var itemsHidden = checkDescribeItemsHidden(ref === null || ref === void 0 ? void 0 : ref.current);
|
159
|
+
var result = _jsxs("div", {
|
160
|
+
ref: ref,
|
161
|
+
className: classnames({
|
162
|
+
'pro-header-describe-items': true,
|
163
|
+
'pro-header-describe-items-more': items.length >= 2
|
164
|
+
}),
|
165
|
+
children: [(items === null || items === void 0 ? void 0 : items.length) > 3 ? "\u5171".concat(items === null || items === void 0 ? void 0 : items.length, "\u4E2A\uFF0C") : null, items.map(function (item, index) {
|
166
|
+
return _jsxs("span", {
|
167
|
+
children: [valueRender(item), (items === null || items === void 0 ? void 0 : items.length) !== index + 1 ? ' 、' : null]
|
168
|
+
}, index);
|
169
|
+
}), itemsHidden ? _jsx("span", {
|
170
|
+
className: "pro-header-describe-items-omit",
|
171
|
+
children: "..."
|
172
|
+
}) : null]
|
173
|
+
});
|
174
|
+
if (itemsHidden) {
|
175
|
+
var tipResult = _jsx(_Fragment, {
|
176
|
+
children: items.map(function (item, index) {
|
177
|
+
return _jsx("p", {
|
178
|
+
className: "pro-header-describe-items-tip-value",
|
179
|
+
children: valueRender(item)
|
180
|
+
}, index);
|
181
|
+
})
|
182
|
+
});
|
183
|
+
return _jsx(_Tooltip, {
|
184
|
+
placement: "bottomLeft",
|
185
|
+
overlayClassName: "pro-header-describe-items-tip",
|
186
|
+
title: tipResult,
|
187
|
+
children: result
|
188
|
+
});
|
189
|
+
}
|
190
|
+
return result;
|
191
|
+
};
|
192
|
+
var tagCls = classnames({
|
193
|
+
'pro-header-only-tag': onlyTag,
|
194
|
+
'pro-header-describe-items-calc': isString(width) ? width.includes('calc') : false
|
195
|
+
});
|
196
|
+
return _jsx("li", {
|
146
197
|
className: tagCls,
|
147
|
-
|
148
|
-
|
149
|
-
}
|
150
|
-
|
151
|
-
|
198
|
+
style: {
|
199
|
+
width: width
|
200
|
+
},
|
201
|
+
children: _jsxs(_Space, {
|
202
|
+
size: 4,
|
203
|
+
children: [label ? _jsx("span", {
|
204
|
+
className: "pro-header-describe-label",
|
205
|
+
children: label
|
206
|
+
}) : null, _jsx("span", {
|
207
|
+
className: "pro-header-describe-value",
|
208
|
+
children: (items === null || items === void 0 ? void 0 : items.length) ? itemsRender() : _jsx("span", {
|
209
|
+
children: valueRender({
|
210
|
+
value: value,
|
211
|
+
copyable: copyable,
|
212
|
+
tag: tag,
|
213
|
+
link: link
|
214
|
+
})
|
215
|
+
})
|
216
|
+
})]
|
217
|
+
})
|
152
218
|
}, index);
|
153
219
|
})
|
154
220
|
});
|
@@ -3,7 +3,7 @@
|
|
3
3
|
@import '../components/ProBackBtn/style/index';
|
4
4
|
|
5
5
|
.pro-header {
|
6
|
-
padding:
|
6
|
+
padding: 10px 0 0 0 !important;
|
7
7
|
background-color: var(--zaui-base-bg, #ffffff);
|
8
8
|
box-shadow: 2px 3px 8px 0px rgba(0, 55, 93, 0.1);
|
9
9
|
|
@@ -46,9 +46,48 @@
|
|
46
46
|
}
|
47
47
|
|
48
48
|
.pro-header-describe {
|
49
|
+
transition: height 0.2s ease-in-out;
|
49
50
|
a {
|
50
51
|
color: var(--zaui-link, #006aff);
|
51
52
|
}
|
53
|
+
.pro-header-describe-items-calc{
|
54
|
+
position: relative;
|
55
|
+
}
|
56
|
+
&.pro-header-describe-hidden {
|
57
|
+
height: 0;
|
58
|
+
padding: 0;
|
59
|
+
overflow: hidden;
|
60
|
+
border: 0;
|
61
|
+
}
|
62
|
+
.@{ant-prefix}-space {
|
63
|
+
.pro-header-describe-label {
|
64
|
+
font-weight: normal;
|
65
|
+
}
|
66
|
+
.pro-header-describe-value{
|
67
|
+
font-weight: 600;
|
68
|
+
.@{ant-prefix}-space-item{
|
69
|
+
font-weight: 600;
|
70
|
+
}
|
71
|
+
.pro-header-describe-items{
|
72
|
+
span:first-child{
|
73
|
+
margin-right: 2px;
|
74
|
+
}
|
75
|
+
.pro-header-describe-items-omit{
|
76
|
+
position: absolute;
|
77
|
+
right: 0;
|
78
|
+
background: #fff;
|
79
|
+
}
|
80
|
+
&.pro-header-describe-items-more{
|
81
|
+
.pro-header-tag{
|
82
|
+
padding: 0;
|
83
|
+
background: #fff;
|
84
|
+
color: #333 ;
|
85
|
+
}
|
86
|
+
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
52
91
|
}
|
53
92
|
|
54
93
|
.pro-header-copy {
|
@@ -334,8 +373,10 @@
|
|
334
373
|
font-size: var(--zaui-font-size, 14px);
|
335
374
|
|
336
375
|
li {
|
337
|
-
|
338
|
-
|
376
|
+
flex: 0 0 auto;
|
377
|
+
white-space: nowrap;
|
378
|
+
overflow: hidden;
|
379
|
+
text-overflow: ellipsis;
|
339
380
|
&.pro-header-only-tag {
|
340
381
|
margin-left: var(--zaui-space-size-sm, 8px);
|
341
382
|
|
@@ -344,9 +385,6 @@
|
|
344
385
|
}
|
345
386
|
}
|
346
387
|
|
347
|
-
&:first-child {
|
348
|
-
margin-left: 0;
|
349
|
-
}
|
350
388
|
|
351
389
|
span {
|
352
390
|
color: #0a0a0a;
|
@@ -369,6 +407,13 @@
|
|
369
407
|
}
|
370
408
|
}
|
371
409
|
|
410
|
+
.pro-header-describe-items-tip{
|
411
|
+
max-width: 600px;
|
412
|
+
.pro-header-describe-items-tip-value{
|
413
|
+
margin-bottom: var(--zaui-space-size-sm, 8px);
|
414
|
+
}
|
415
|
+
}
|
416
|
+
|
372
417
|
@media (max-width: 1366px) {
|
373
418
|
.pro-header-describe {
|
374
419
|
li span:last-child {
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* 检查描述dom是否部分隐藏
|
3
|
+
* @param ele dom节点
|
4
|
+
*/
|
5
|
+
export var checkDescribeItemsHidden = function checkDescribeItemsHidden(ele) {
|
6
|
+
var childElement = ele;
|
7
|
+
if (!childElement) {
|
8
|
+
return false;
|
9
|
+
}
|
10
|
+
var element = childElement.parentNode.parentNode.parentNode.parentNode;
|
11
|
+
var itemsScrollWidth = element.scrollWidth;
|
12
|
+
var itemsClientWidth = element.clientWidth;
|
13
|
+
return itemsScrollWidth > itemsClientWidth;
|
14
|
+
};
|
package/es/ProSelect/index.js
CHANGED
@@ -296,7 +296,7 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
296
296
|
showArrow: true,
|
297
297
|
loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
|
298
298
|
onChange: handleChange,
|
299
|
-
optionLabelProp
|
299
|
+
// optionLabelProp={otherProps?.isDiffChange ? 'label' : 'children'} // 解决warning报错,添加默认值
|
300
300
|
// optionLabelProp="label" // 解决warning报错,添加默认值
|
301
301
|
showSearch: true,
|
302
302
|
filterOption: isFunction(_onSearch) ? false : function (input, option) {
|
package/es/index.d.ts
CHANGED
@@ -17,6 +17,7 @@ export { default as ProIcon } from './ProIcon';
|
|
17
17
|
export { default as ProDownload } from './ProDownload';
|
18
18
|
export { default as ProWaterMark } from './ProWaterMark';
|
19
19
|
export { default as ProConfigProvider } from './ProConfigProvider';
|
20
|
+
export { default as FormsProvider } from './FormsProvider';
|
20
21
|
export { default as ProUpload } from './ProUpload';
|
21
22
|
export { default as ProThemeTools } from './ProThemeTools';
|
22
23
|
export { default as ProAction } from './ProAction';
|
package/es/index.js
CHANGED
@@ -22,6 +22,7 @@ export { default as ProIcon } from './ProIcon';
|
|
22
22
|
export { default as ProDownload } from './ProDownload';
|
23
23
|
export { default as ProWaterMark } from './ProWaterMark';
|
24
24
|
export { default as ProConfigProvider } from './ProConfigProvider';
|
25
|
+
export { default as FormsProvider } from './FormsProvider';
|
25
26
|
export { default as ProUpload } from './ProUpload';
|
26
27
|
export { default as ProThemeTools } from './ProThemeTools';
|
27
28
|
export { default as ProAction } from './ProAction';
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
2
|
import { useEffect, useState } from 'react';
|
3
3
|
var EMPTY_VALUE = [undefined, null, ''];
|
4
|
-
/**
|
4
|
+
/**
|
5
|
+
* 判断一个值是否是空值
|
6
|
+
* 空值 或者 仅包含空值的数组视为空
|
7
|
+
*/
|
5
8
|
export var isEmpty = function isEmpty(value, emptyValue) {
|
6
9
|
if (emptyValue) {
|
7
10
|
EMPTY_VALUE.push(emptyValue);
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ModifiedFormInstance } from '../ProForm/utils/useForm';
|
3
|
+
type Forms = Record<string, ModifiedFormInstance<any>>;
|
4
|
+
export declare const FormsContext: React.Context<Forms>;
|
5
|
+
/**
|
6
|
+
* @param formKey 表单实例key
|
7
|
+
* @param formIst form实例, 如果传了会把传入的实例存入全局
|
8
|
+
* @returns 没有入参: 返回表单实例但是不存入全局
|
9
|
+
* 有formKey: 取全局中的表单实例返回, 如果不存在则创建后返回
|
10
|
+
*/
|
11
|
+
export declare const useForms: () => Forms;
|
12
|
+
/** 获取所有表单实例 */
|
13
|
+
export declare const useContextForms: () => Forms;
|
14
|
+
declare const FormsProvider: React.FC;
|
15
|
+
export default FormsProvider;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.useForms = exports.useContextForms = exports.default = exports.FormsContext = void 0;
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
10
|
+
var FormsContext = exports.FormsContext = /*#__PURE__*/_react.default.createContext({});
|
11
|
+
/**
|
12
|
+
* @param formKey 表单实例key
|
13
|
+
* @param formIst form实例, 如果传了会把传入的实例存入全局
|
14
|
+
* @returns 没有入参: 返回表单实例但是不存入全局
|
15
|
+
* 有formKey: 取全局中的表单实例返回, 如果不存在则创建后返回
|
16
|
+
*/
|
17
|
+
var useForms = exports.useForms = function useForms() {
|
18
|
+
var forms = (0, _react.useContext)(FormsContext);
|
19
|
+
return forms;
|
20
|
+
};
|
21
|
+
/** 获取所有表单实例 */
|
22
|
+
var useContextForms = exports.useContextForms = function useContextForms() {
|
23
|
+
var forms = (0, _react.useContext)(FormsContext);
|
24
|
+
return forms;
|
25
|
+
};
|
26
|
+
var FormsProvider = function FormsProvider(props) {
|
27
|
+
var formsRef = (0, _react.useRef)({});
|
28
|
+
(0, _react.useEffect)(function () {
|
29
|
+
// 销毁
|
30
|
+
return function () {
|
31
|
+
formsRef.current = {};
|
32
|
+
};
|
33
|
+
}, []);
|
34
|
+
return (0, _jsxRuntime.jsx)(FormsContext.Provider, {
|
35
|
+
value: formsRef.current,
|
36
|
+
children: props.children
|
37
|
+
});
|
38
|
+
};
|
39
|
+
var _default = exports.default = FormsProvider;
|