@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
@@ -20,7 +20,6 @@ interface ConfigContext {
|
|
20
20
|
export declare const ProConfigContext: React.Context<ConfigContext>;
|
21
21
|
export declare function useProConfig(): ConfigContext;
|
22
22
|
export declare function useProConfig(name: keyof ConfigContext['state']): ConfigContext['state'][keyof ConfigContext['state']];
|
23
|
-
export declare function useContextForms(): Record<string, FormInstance<any>>;
|
24
23
|
type ActionsType = 'set' | 'setProEnum' | 'setProEnumDic' | 'setWithLocal';
|
25
24
|
interface Actions {
|
26
25
|
type: ActionsType;
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
7
7
|
});
|
8
8
|
exports.default = exports.ProConfigProvider = exports.ProConfigContext = void 0;
|
9
|
-
exports.useContextForms = useContextForms;
|
10
9
|
exports.useProConfig = useProConfig;
|
11
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
12
11
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
@@ -44,11 +43,6 @@ function useProConfig(name) {
|
|
44
43
|
var config = (0, _react.useContext)(ProConfigContext);
|
45
44
|
return name ? config.state[name] : config;
|
46
45
|
}
|
47
|
-
function useContextForms() {
|
48
|
-
var _config$state;
|
49
|
-
var config = (0, _react.useContext)(ProConfigContext);
|
50
|
-
return (_config$state = config.state) === null || _config$state === void 0 ? void 0 : _config$state.forms;
|
51
|
-
}
|
52
46
|
var antdLangMap = {
|
53
47
|
'zh-CN': _zh_CN.default,
|
54
48
|
'en-US': _en_US.default // en-US
|
@@ -52,14 +52,17 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
52
52
|
return 'add';
|
53
53
|
}
|
54
54
|
if (Array.isArray(_originalValue)) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
55
|
+
if ((_originalValue === null || _originalValue === void 0 ? void 0 : _originalValue.length) === (_value === null || _value === void 0 ? void 0 : _value.length)) {
|
56
|
+
var isSame = _originalValue.every(function (valueItem, index) {
|
57
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
58
|
+
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
59
|
+
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
60
|
+
}
|
61
|
+
return true;
|
62
|
+
});
|
63
|
+
return isSame ? 'same' : 'changed';
|
64
|
+
}
|
65
|
+
return 'changed';
|
63
66
|
}
|
64
67
|
if (!isEmpty(_originalValue) || !isEmpty(_value)) {
|
65
68
|
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
@@ -409,7 +409,10 @@ var Render = function Render(props) {
|
|
409
409
|
if (type === 'FormList') {
|
410
410
|
lastComponentProps.disabled = lastDisabled;
|
411
411
|
var lessMode = lastComponentProps.mode === 'less';
|
412
|
-
|
412
|
+
colProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, colProps), {}, {
|
413
|
+
span: lessMode ? colProps.span : 24 // 默认占一行
|
414
|
+
});
|
415
|
+
return (0, _jsxRuntime.jsx)(_antd.Form.List, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
413
416
|
name: _otherFormItemProps.name
|
414
417
|
}, (0, _lodash.omit)(_otherFormItemProps, ['rules'])), {}, {
|
415
418
|
children: function children(fields, operation, meta) {
|
@@ -421,9 +424,6 @@ var Render = function Render(props) {
|
|
421
424
|
}));
|
422
425
|
}
|
423
426
|
}));
|
424
|
-
colProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, colProps), {}, {
|
425
|
-
span: lessMode ? colProps.span : 24 // 默认占一行
|
426
|
-
});
|
427
427
|
}
|
428
428
|
// 默认占据一行
|
429
429
|
if (['ProCollapse', 'Container'].includes(type)) {
|
package/lib/ProForm/index.js
CHANGED
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
7
7
|
});
|
8
8
|
exports.default = exports.ProFormProvider = void 0;
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
10
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
11
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
13
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -25,9 +25,10 @@ var _useForm3 = require("./utils/useForm");
|
|
25
25
|
var _useFieldProps = require("./utils/useFieldProps");
|
26
26
|
var _locale = _interopRequireDefault(require("../locale"));
|
27
27
|
var _useWatch = _interopRequireDefault(require("./utils/useWatch"));
|
28
|
+
var _FormsProvider = _interopRequireWildcard(require("../FormsProvider"));
|
28
29
|
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"];
|
29
30
|
var ProForm = function ProForm(props, ref) {
|
30
|
-
var
|
31
|
+
var _localStorage, _ref;
|
31
32
|
var _props$mode = props.mode,
|
32
33
|
mode = _props$mode === void 0 ? 'search' : _props$mode,
|
33
34
|
span = props.span,
|
@@ -70,14 +71,11 @@ var ProForm = function ProForm(props, ref) {
|
|
70
71
|
_props$optimize = props.optimize,
|
71
72
|
optimize = _props$optimize === void 0 ? false : _props$optimize,
|
72
73
|
otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
73
|
-
var
|
74
|
-
|
75
|
-
dispatch = _useProConfig.dispatch;
|
76
|
-
var config = state.ProForm,
|
77
|
-
forms = state.forms;
|
78
|
-
var _useForm = (0, _useForm3.useForm)((_forms$formKey = forms[formKey]) !== null && _forms$formKey !== void 0 ? _forms$formKey : originForm, {
|
74
|
+
var config = (0, _ProConfigProvider.useProConfig)('ProForm');
|
75
|
+
var _useForm = (0, _useForm3.useForm)(originForm, {
|
79
76
|
scrollToError: scrollToError,
|
80
|
-
optimize: optimize
|
77
|
+
optimize: optimize,
|
78
|
+
formKey: formKey
|
81
79
|
}),
|
82
80
|
_useForm2 = (0, _slicedToArray2.default)(_useForm, 1),
|
83
81
|
form = _useForm2[0];
|
@@ -88,33 +86,6 @@ var ProForm = function ProForm(props, ref) {
|
|
88
86
|
_useControlled2 = (0, _slicedToArray2.default)(_useControlled, 2),
|
89
87
|
openState = _useControlled2[0],
|
90
88
|
setOpenState = _useControlled2[1];
|
91
|
-
// 把表单实例存入表单组
|
92
|
-
(0, _react.useMemo)(function () {
|
93
|
-
if (formKey && forms[formKey] !== form) {
|
94
|
-
forms[formKey] = form;
|
95
|
-
// fix: Cannot update a component (`ProConfigProvider`) while rendering a different component (`ForwardRef(ProForm)`).
|
96
|
-
setTimeout(function () {
|
97
|
-
dispatch({
|
98
|
-
type: 'set',
|
99
|
-
payload: {
|
100
|
-
forms: (0, _objectSpread2.default)({}, forms)
|
101
|
-
}
|
102
|
-
});
|
103
|
-
}, 300);
|
104
|
-
}
|
105
|
-
// 销毁
|
106
|
-
return function () {
|
107
|
-
if (formKey && forms[formKey]) {
|
108
|
-
delete forms[formKey];
|
109
|
-
dispatch({
|
110
|
-
type: 'set',
|
111
|
-
payload: {
|
112
|
-
forms: (0, _objectSpread2.default)({}, forms)
|
113
|
-
}
|
114
|
-
});
|
115
|
-
}
|
116
|
-
};
|
117
|
-
}, [formKey, form]);
|
118
89
|
var _getLayout = (0, _index.getLayout)({
|
119
90
|
span: span,
|
120
91
|
form: form
|
@@ -311,7 +282,10 @@ var ProFormProvider = exports.ProFormProvider = function ProFormProvider(props)
|
|
311
282
|
};
|
312
283
|
ProFormForward.Provider = ProFormProvider; // 包装Provider
|
313
284
|
ProFormForward.useFieldProps = _useFieldProps.useFieldProps; // 获取每个字段的其他参数 -otherProps
|
314
|
-
|
285
|
+
// 表单实例共享
|
286
|
+
ProFormForward.FormsProvider = _FormsProvider.default; // 表单实例共享Provider
|
287
|
+
ProFormForward.useForms = _FormsProvider.useForms; // 获取上下文中的共享的表单实例map
|
288
|
+
ProFormForward.useContextForms = _FormsProvider.useContextForms; // 获取上下文中的共享的表单实例map
|
315
289
|
// 内置组合
|
316
290
|
ProFormForward.ProCascader = _components.ProCascader;
|
317
291
|
ProFormForward.ProCombination = _components.ProCombination;
|
@@ -9,7 +9,13 @@ var _utils = require("../../utils");
|
|
9
9
|
// 过滤对象中undefined字段
|
10
10
|
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
11
11
|
var filterObject = function filterObject(data) {
|
12
|
-
if (!(0, _lodash.isObject)(data) ||
|
12
|
+
if (!(0, _lodash.isObject)(data) || data === null) return data;
|
13
|
+
// ['1', undefined] ['1', ''] 视为相等
|
14
|
+
if (Array.isArray(data)) {
|
15
|
+
return data.map(function (item) {
|
16
|
+
return (0, _utils.isEmpty)(item) ? null : item;
|
17
|
+
});
|
18
|
+
}
|
13
19
|
var resData = {};
|
14
20
|
Object.keys(data).forEach(function (key) {
|
15
21
|
if (!(0, _utils.isEmpty)(data[key])) {
|
@@ -37,22 +43,11 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
37
43
|
}
|
38
44
|
var _value = filterObject(value);
|
39
45
|
var _originalValue = filterObject(originalValue);
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
if (!(0, _utils.isEmpty)(value === null || value === void 0 ? void 0 : value[index]) || !(0, _utils.isEmpty)(valueItem)) {
|
48
|
-
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
49
|
-
}
|
50
|
-
return true;
|
51
|
-
});
|
52
|
-
return isSame ? 'same' : 'changed';
|
53
|
-
}
|
54
|
-
if (!(0, _utils.isEmpty)(_originalValue) || !(0, _utils.isEmpty)(_value)) {
|
55
|
-
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
56
|
-
}
|
57
|
-
return 'same';
|
46
|
+
var isEmptyVal = (0, _utils.isEmpty)(_value);
|
47
|
+
var isEmptyOrg = (0, _utils.isEmpty)(_originalValue);
|
48
|
+
// 都为空视为相等
|
49
|
+
if (isEmptyOrg && isEmptyVal) return 'same';
|
50
|
+
// 如果原始值为空 且当前有值的话 视为新增
|
51
|
+
if (isEmptyOrg && !isEmptyVal) return 'add';
|
52
|
+
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
58
53
|
};
|
@@ -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 {};
|
@@ -11,22 +11,31 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
13
13
|
var _antd = require("antd");
|
14
|
+
var _react = require("react");
|
14
15
|
var _index = require("./index");
|
15
16
|
var _tools = require("../../ProEditTable/utils/tools");
|
17
|
+
var _FormsProvider = require("../../FormsProvider");
|
16
18
|
var useForm = exports.useForm = function useForm(originForm, options) {
|
17
19
|
// 如果没有form实例可以直接把options放在第一个参数位置
|
18
20
|
// @ts-ignore
|
19
21
|
var _originForm = (originForm === null || originForm === void 0 ? void 0 : originForm._init) ? originForm : undefined;
|
20
22
|
var _options =
|
21
23
|
// @ts-ignore
|
22
|
-
options || originForm && !(originForm === null || originForm === void 0 ? void 0 : originForm._init) ? originForm : undefined;
|
24
|
+
options || (originForm && !(originForm === null || originForm === void 0 ? void 0 : originForm._init) ? originForm : undefined);
|
23
25
|
var _ref = _options || {},
|
24
26
|
_ref$scrollToError = _ref.scrollToError,
|
25
27
|
scrollToError = _ref$scrollToError === void 0 ? true : _ref$scrollToError,
|
26
|
-
optimize = _ref.optimize
|
27
|
-
|
28
|
+
optimize = _ref.optimize,
|
29
|
+
formKey = _ref.formKey;
|
30
|
+
// formKey全局共享逻辑
|
31
|
+
var forms = (0, _react.useContext)(_FormsProvider.FormsContext);
|
32
|
+
var _Form$useForm = _antd.Form.useForm(forms[formKey] || _originForm),
|
28
33
|
_Form$useForm2 = (0, _slicedToArray2.default)(_Form$useForm, 1),
|
29
34
|
form = _Form$useForm2[0];
|
35
|
+
if (formKey && forms[formKey] !== form) {
|
36
|
+
forms[formKey] = form;
|
37
|
+
form.formKey = formKey;
|
38
|
+
}
|
30
39
|
var getFieldsValue = form.getFieldsValue,
|
31
40
|
validateFields = form.validateFields,
|
32
41
|
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;
|
@@ -21,6 +21,7 @@ var _arrow = _interopRequireDefault(require("../../../assets/arrow.svg"));
|
|
21
21
|
var _components = require("./components");
|
22
22
|
var _getEnumLabel = _interopRequireDefault(require("../../../ProEnum/utils/getEnumLabel"));
|
23
23
|
var _locale = _interopRequireDefault(require("../../../locale"));
|
24
|
+
var _utils2 = require("./utils");
|
24
25
|
/* eslint-disable react/no-array-index-key */
|
25
26
|
|
26
27
|
var formatAmount = _utils.tools.formatAmount;
|
@@ -62,6 +63,8 @@ var ProHeader = function ProHeader(props) {
|
|
62
63
|
_useToggle2 = (0, _slicedToArray2.default)(_useToggle, 2),
|
63
64
|
fold = _useToggle2[0],
|
64
65
|
toggle = _useToggle2[1].toggle;
|
66
|
+
var ref = (0, _react.useRef)(null);
|
67
|
+
var size = (0, _ahooks.useSize)(ref);
|
65
68
|
var _title = title;
|
66
69
|
// 面包屑配置数据源
|
67
70
|
var _breadcrumbColumns = breadcrumbColumns || breadcrumbList;
|
@@ -92,7 +95,11 @@ var ProHeader = function ProHeader(props) {
|
|
92
95
|
return null;
|
93
96
|
}
|
94
97
|
return (0, _jsxRuntime.jsx)("ul", {
|
95
|
-
className:
|
98
|
+
className: (0, _classnames2.default)({
|
99
|
+
'pro-header-describe': true,
|
100
|
+
'pro-header-describe-open': fold,
|
101
|
+
'pro-header-describe-hidden': !fold
|
102
|
+
}),
|
96
103
|
children: describeData.map(function (item, index) {
|
97
104
|
var value = item.value,
|
98
105
|
copyable = item.copyable,
|
@@ -100,20 +107,20 @@ var ProHeader = function ProHeader(props) {
|
|
100
107
|
show = _item$show === void 0 ? true : _item$show,
|
101
108
|
tag = item.tag,
|
102
109
|
label = item.label,
|
103
|
-
link = item.link
|
110
|
+
link = item.link,
|
111
|
+
_item$items = item.items,
|
112
|
+
items = _item$items === void 0 ? [] : _item$items,
|
113
|
+
width = item.width;
|
104
114
|
// show为false直接隐藏¸
|
105
115
|
if (show === false || !show) {
|
106
116
|
return null;
|
107
117
|
}
|
108
118
|
var onlyTag = tag && !label && !value;
|
109
|
-
var
|
110
|
-
|
111
|
-
});
|
112
|
-
var tagRender = function tagRender() {
|
113
|
-
if (Array.isArray(tag) && tag.length) {
|
119
|
+
var tagRender = function tagRender(parmas) {
|
120
|
+
if (Array.isArray(parmas === null || parmas === void 0 ? void 0 : parmas.tag) && (parmas === null || parmas === void 0 ? void 0 : parmas.tag.length)) {
|
114
121
|
return (0, _jsxRuntime.jsx)(_antd.Space, {
|
115
122
|
size: 4,
|
116
|
-
children: tag.map(function (tagItem, index) {
|
123
|
+
children: parmas.tag.map(function (tagItem, index) {
|
117
124
|
return (0, _jsxRuntime.jsx)("div", {
|
118
125
|
className: "pro-header-tag",
|
119
126
|
children: tagItem
|
@@ -121,32 +128,91 @@ var ProHeader = function ProHeader(props) {
|
|
121
128
|
})
|
122
129
|
});
|
123
130
|
}
|
124
|
-
return tag ? (0, _jsxRuntime.jsx)("div", {
|
131
|
+
return (parmas === null || parmas === void 0 ? void 0 : parmas.tag) ? (0, _jsxRuntime.jsx)("div", {
|
125
132
|
className: "pro-header-tag",
|
126
|
-
children: tag
|
133
|
+
children: parmas === null || parmas === void 0 ? void 0 : parmas.tag
|
127
134
|
}) : null;
|
128
135
|
};
|
129
|
-
|
136
|
+
/** 单行渲染 */
|
137
|
+
var valueRender = function valueRender(parmas) {
|
130
138
|
return (0, _jsxRuntime.jsxs)(_antd.Space, {
|
131
139
|
size: 4,
|
132
|
-
align: tag ? 'baseline' : 'center',
|
133
|
-
children: [link ? (0, _jsxRuntime.jsx)("a", {
|
134
|
-
href: link,
|
140
|
+
align: (parmas === null || parmas === void 0 ? void 0 : parmas.tag) ? 'baseline' : 'center',
|
141
|
+
children: [(parmas === null || parmas === void 0 ? void 0 : parmas.link) ? (0, _jsxRuntime.jsx)("a", {
|
142
|
+
href: parmas.link,
|
135
143
|
rel: "noopener noreferrer",
|
136
144
|
target: "_blank",
|
137
|
-
children: value
|
138
|
-
}) : value, copyable && (0, _lodash.isString)(value) ? (0, _jsxRuntime.jsx)(_components.Copy, {
|
139
|
-
text: value
|
140
|
-
}) : null, tagRender(
|
145
|
+
children: parmas === null || parmas === void 0 ? void 0 : parmas.value
|
146
|
+
}) : parmas === null || parmas === void 0 ? void 0 : parmas.value, (parmas === null || parmas === void 0 ? void 0 : parmas.copyable) && (0, _lodash.isString)(parmas === null || parmas === void 0 ? void 0 : parmas.value) ? (0, _jsxRuntime.jsx)(_components.Copy, {
|
147
|
+
text: parmas.value
|
148
|
+
}) : null, tagRender({
|
149
|
+
tag: parmas === null || parmas === void 0 ? void 0 : parmas.tag
|
150
|
+
})]
|
151
|
+
});
|
152
|
+
};
|
153
|
+
/** 多行渲染 */
|
154
|
+
var itemsRender = function itemsRender() {
|
155
|
+
// items配置是否超长,超长配置... + tip 提示
|
156
|
+
var itemsHidden = (0, _utils2.checkDescribeItemsHidden)(ref === null || ref === void 0 ? void 0 : ref.current);
|
157
|
+
var result = (0, _jsxRuntime.jsxs)("div", {
|
158
|
+
ref: ref,
|
159
|
+
className: (0, _classnames2.default)({
|
160
|
+
'pro-header-describe-items': true,
|
161
|
+
'pro-header-describe-items-more': items.length >= 2
|
162
|
+
}),
|
163
|
+
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) {
|
164
|
+
return (0, _jsxRuntime.jsxs)("span", {
|
165
|
+
children: [valueRender(item), (items === null || items === void 0 ? void 0 : items.length) !== index + 1 ? ' 、' : null]
|
166
|
+
}, index);
|
167
|
+
}), itemsHidden ? (0, _jsxRuntime.jsx)("span", {
|
168
|
+
className: "pro-header-describe-items-omit",
|
169
|
+
children: "..."
|
170
|
+
}) : null]
|
141
171
|
});
|
172
|
+
if (itemsHidden) {
|
173
|
+
var tipResult = (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
174
|
+
children: items.map(function (item, index) {
|
175
|
+
return (0, _jsxRuntime.jsx)("p", {
|
176
|
+
className: "pro-header-describe-items-tip-value",
|
177
|
+
children: valueRender(item)
|
178
|
+
}, index);
|
179
|
+
})
|
180
|
+
});
|
181
|
+
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
182
|
+
placement: "bottomLeft",
|
183
|
+
overlayClassName: "pro-header-describe-items-tip",
|
184
|
+
title: tipResult,
|
185
|
+
children: result
|
186
|
+
});
|
187
|
+
}
|
188
|
+
return result;
|
142
189
|
};
|
143
|
-
|
190
|
+
var tagCls = (0, _classnames2.default)({
|
191
|
+
'pro-header-only-tag': onlyTag,
|
192
|
+
'pro-header-describe-items-calc': (0, _lodash.isString)(width) ? width.includes('calc') : false
|
193
|
+
});
|
194
|
+
return (0, _jsxRuntime.jsx)("li", {
|
144
195
|
className: tagCls,
|
145
|
-
|
146
|
-
|
147
|
-
}
|
148
|
-
|
149
|
-
|
196
|
+
style: {
|
197
|
+
width: width
|
198
|
+
},
|
199
|
+
children: (0, _jsxRuntime.jsxs)(_antd.Space, {
|
200
|
+
size: 4,
|
201
|
+
children: [label ? (0, _jsxRuntime.jsx)("span", {
|
202
|
+
className: "pro-header-describe-label",
|
203
|
+
children: label
|
204
|
+
}) : null, (0, _jsxRuntime.jsx)("span", {
|
205
|
+
className: "pro-header-describe-value",
|
206
|
+
children: (items === null || items === void 0 ? void 0 : items.length) ? itemsRender() : (0, _jsxRuntime.jsx)("span", {
|
207
|
+
children: valueRender({
|
208
|
+
value: value,
|
209
|
+
copyable: copyable,
|
210
|
+
tag: tag,
|
211
|
+
link: link
|
212
|
+
})
|
213
|
+
})
|
214
|
+
})]
|
215
|
+
})
|
150
216
|
}, index);
|
151
217
|
})
|
152
218
|
});
|
@@ -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,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.checkDescribeItemsHidden = void 0;
|
7
|
+
/**
|
8
|
+
* 检查描述dom是否部分隐藏
|
9
|
+
* @param ele dom节点
|
10
|
+
*/
|
11
|
+
var checkDescribeItemsHidden = exports.checkDescribeItemsHidden = function checkDescribeItemsHidden(ele) {
|
12
|
+
var childElement = ele;
|
13
|
+
if (!childElement) {
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
var element = childElement.parentNode.parentNode.parentNode.parentNode;
|
17
|
+
var itemsScrollWidth = element.scrollWidth;
|
18
|
+
var itemsClientWidth = element.clientWidth;
|
19
|
+
return itemsScrollWidth > itemsClientWidth;
|
20
|
+
};
|
package/lib/ProSelect/index.js
CHANGED
@@ -297,7 +297,7 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
|
|
297
297
|
showArrow: true,
|
298
298
|
loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
|
299
299
|
onChange: handleChange,
|
300
|
-
optionLabelProp
|
300
|
+
// optionLabelProp={otherProps?.isDiffChange ? 'label' : 'children'} // 解决warning报错,添加默认值
|
301
301
|
// optionLabelProp="label" // 解决warning报错,添加默认值
|
302
302
|
showSearch: true,
|
303
303
|
filterOption: (0, _lodash.isFunction)(_onSearch) ? false : function (input, option) {
|
package/lib/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/lib/index.js
CHANGED
@@ -22,6 +22,7 @@ var _exportNames = {
|
|
22
22
|
ProDownload: true,
|
23
23
|
ProWaterMark: true,
|
24
24
|
ProConfigProvider: true,
|
25
|
+
FormsProvider: true,
|
25
26
|
ProUpload: true,
|
26
27
|
ProThemeTools: true,
|
27
28
|
ProAction: true,
|
@@ -29,6 +30,12 @@ var _exportNames = {
|
|
29
30
|
ProEditableTable: true,
|
30
31
|
ProCertValidity: true
|
31
32
|
};
|
33
|
+
Object.defineProperty(exports, "FormsProvider", {
|
34
|
+
enumerable: true,
|
35
|
+
get: function get() {
|
36
|
+
return _FormsProvider.default;
|
37
|
+
}
|
38
|
+
});
|
32
39
|
Object.defineProperty(exports, "ProAction", {
|
33
40
|
enumerable: true,
|
34
41
|
get: function get() {
|
@@ -211,6 +218,7 @@ Object.keys(_ProConfigProvider).forEach(function (key) {
|
|
211
218
|
}
|
212
219
|
});
|
213
220
|
});
|
221
|
+
var _FormsProvider = _interopRequireDefault(require("./FormsProvider"));
|
214
222
|
var _ProUpload = _interopRequireDefault(require("./ProUpload"));
|
215
223
|
var _ProThemeTools = _interopRequireDefault(require("./ProThemeTools"));
|
216
224
|
var _ProAction = _interopRequireDefault(require("./ProAction"));
|