@zat-design/sisyphus-react 4.5.8-beta.6 → 4.5.9-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/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProEditTable/components/RenderField/index.js +74 -62
- package/es/ProEditTable/index.js +66 -36
- package/es/ProEditTable/propsType.d.ts +4 -4
- package/es/ProEditTable/utils/useShouldUpdateForTable.d.ts +4 -0
- package/es/ProEditTable/utils/useShouldUpdateForTable.js +16 -4
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +4 -2
- package/es/ProLayout/components/TabsManager/components/TabsHeader.js +1 -0
- package/es/ProLayout/components/TabsManager/style/index.less +1 -2
- package/es/ProLayout/index.js +22 -2
- package/es/ProLayout/style/index.less +2 -3
- package/es/ProTable/components/EditableCell/EditIcon.js +5 -8
- package/es/ProTable/components/EditableCell/index.js +3 -2
- package/es/ProTable/style/index.less +26 -0
- package/es/ProTreeModal/components/Trigger.js +18 -14
- package/es/ProTreeModal/index.js +199 -187
- package/es/ProTreeModal/style/index.less +25 -1
- package/package.json +1 -1
- package/es/ProTable/components/EditableCell/index.less +0 -29
- package/es/assets/edit.svg +0 -1
package/es/ProLayout/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import headerBg from "../assets/header_bg.png";
|
|
|
17
17
|
// 全局上下文
|
|
18
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
19
|
export const LayoutContext = /*#__PURE__*/createContext(undefined);
|
|
20
|
+
const TABS_HEADER_MEASURE_SELECTOR = '[data-pro-layout-tabs-measure="true"]';
|
|
20
21
|
const ProLayout = props => {
|
|
21
22
|
const {
|
|
22
23
|
children,
|
|
@@ -94,26 +95,45 @@ const ProLayout = props => {
|
|
|
94
95
|
useLayoutEffect(() => {
|
|
95
96
|
const noticeEl = notice && !isIframePure ? noticeElRef.current : null;
|
|
96
97
|
const visibleTabsBarEl = isTabsLayout && hasTabs && !isIframePure ? tabsBarEl : null;
|
|
98
|
+
const visibleTabsHeaderEl = visibleTabsBarEl?.querySelector(TABS_HEADER_MEASURE_SELECTOR);
|
|
97
99
|
let active = true;
|
|
100
|
+
let animationFrameId;
|
|
98
101
|
const measureStickyElements = () => {
|
|
99
102
|
if (!active) return;
|
|
100
103
|
const nextHeights = {
|
|
101
104
|
notice: noticeEl?.getBoundingClientRect().height ?? 0,
|
|
102
|
-
tabsBar:
|
|
105
|
+
tabsBar: visibleTabsHeaderEl?.getBoundingClientRect().height ?? 0
|
|
103
106
|
};
|
|
104
107
|
setStickyHeights(currentHeights => currentHeights.notice === nextHeights.notice && currentHeights.tabsBar === nextHeights.tabsBar ? currentHeights : nextHeights);
|
|
105
108
|
};
|
|
106
109
|
measureStickyElements();
|
|
107
|
-
|
|
110
|
+
if (typeof window.requestAnimationFrame === 'function') {
|
|
111
|
+
animationFrameId = window.requestAnimationFrame(measureStickyElements);
|
|
112
|
+
}
|
|
113
|
+
const handleTabsTransitionEnd = event => {
|
|
114
|
+
if (event.target === visibleTabsBarEl && event.propertyName === 'grid-template-rows') {
|
|
115
|
+
measureStickyElements();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
visibleTabsBarEl?.addEventListener('transitionend', handleTabsTransitionEnd);
|
|
119
|
+
const observedElements = [noticeEl, visibleTabsHeaderEl].filter(element => element !== null && element !== undefined);
|
|
108
120
|
if (observedElements.length === 0 || typeof ResizeObserver === 'undefined') {
|
|
109
121
|
return () => {
|
|
110
122
|
active = false;
|
|
123
|
+
if (animationFrameId !== undefined) {
|
|
124
|
+
window.cancelAnimationFrame(animationFrameId);
|
|
125
|
+
}
|
|
126
|
+
visibleTabsBarEl?.removeEventListener('transitionend', handleTabsTransitionEnd);
|
|
111
127
|
};
|
|
112
128
|
}
|
|
113
129
|
const resizeObserver = new ResizeObserver(measureStickyElements);
|
|
114
130
|
observedElements.forEach(element => resizeObserver.observe(element));
|
|
115
131
|
return () => {
|
|
116
132
|
active = false;
|
|
133
|
+
if (animationFrameId !== undefined) {
|
|
134
|
+
window.cancelAnimationFrame(animationFrameId);
|
|
135
|
+
}
|
|
136
|
+
visibleTabsBarEl?.removeEventListener('transitionend', handleTabsTransitionEnd);
|
|
117
137
|
resizeObserver.disconnect();
|
|
118
138
|
};
|
|
119
139
|
}, [hasTabs, isIframePure, isTabsLayout, notice, tabsBarEl]);
|
|
@@ -388,11 +388,10 @@
|
|
|
388
388
|
|
|
389
389
|
.pro-layout-tabs-content {
|
|
390
390
|
> .tab-pane {
|
|
391
|
-
// ProStep 以 ProHeader
|
|
392
|
-
// ProStep
|
|
391
|
+
// ProStep 以 ProHeader 开头时,仅去掉 tabs 内容区的顶部留白。
|
|
392
|
+
// 保留右侧内边距,让 ProStep wrapper 继续为贴右步骤条预留 16px 间距。
|
|
393
393
|
> .pro-step-wrapper:has(> .pro-header:first-child) {
|
|
394
394
|
margin-top: calc(-1px - var(--zaui-space-size-md, 16px));
|
|
395
|
-
margin-right: calc(-1px - var(--zaui-space-size-md, 16px));
|
|
396
395
|
}
|
|
397
396
|
|
|
398
397
|
> .pro-header.pro-header-no-describe:first-child {
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { EditOutlined } from '@ant-design/icons';
|
|
2
|
+
import classNames from 'classnames';
|
|
1
3
|
import React from 'react';
|
|
2
|
-
import ProIcon from "../../../ProIcon";
|
|
3
|
-
import editSvg from "../../../assets/edit.svg";
|
|
4
|
-
import styles from "./index.less";
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
5
|
const EditIcon = ({
|
|
7
6
|
onClick
|
|
8
7
|
}) => {
|
|
8
|
+
const cls = classNames('pro-table-editable-cell-edit-icon');
|
|
9
9
|
return /*#__PURE__*/_jsx("span", {
|
|
10
|
-
className:
|
|
10
|
+
className: cls,
|
|
11
11
|
onClick: onClick,
|
|
12
|
-
children: /*#__PURE__*/_jsx(
|
|
13
|
-
src: editSvg,
|
|
14
|
-
size: "20px"
|
|
15
|
-
})
|
|
12
|
+
children: /*#__PURE__*/_jsx(EditOutlined, {})
|
|
16
13
|
});
|
|
17
14
|
};
|
|
18
15
|
export default EditIcon;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _isEqual from "lodash/isEqual";
|
|
2
2
|
import React, { useState, useRef } from 'react';
|
|
3
3
|
import { Form } from 'antd';
|
|
4
|
+
import classNames from 'classnames';
|
|
4
5
|
import * as componentMap from "../../../ProForm/components";
|
|
5
6
|
import EditIcon from "./EditIcon";
|
|
6
|
-
import styles from "./index.less";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const InternalCell = ({
|
|
9
9
|
value,
|
|
@@ -29,6 +29,7 @@ const InternalCell = ({
|
|
|
29
29
|
...restFieldProps
|
|
30
30
|
} = fieldProps;
|
|
31
31
|
const Component = componentMap[type] ?? componentMap.Input;
|
|
32
|
+
const wrapperClassName = classNames('pro-table-editable-cell-wrapper');
|
|
32
33
|
const handleEditIconClick = () => {
|
|
33
34
|
snapshotRef.current = value;
|
|
34
35
|
form.setFieldValue(fieldName, value);
|
|
@@ -57,7 +58,7 @@ const InternalCell = ({
|
|
|
57
58
|
};
|
|
58
59
|
if (!editing) {
|
|
59
60
|
return /*#__PURE__*/_jsxs("span", {
|
|
60
|
-
className:
|
|
61
|
+
className: wrapperClassName,
|
|
61
62
|
children: [/*#__PURE__*/_jsx("span", {
|
|
62
63
|
children: displayContent ?? '-'
|
|
63
64
|
}), /*#__PURE__*/_jsx(EditIcon, {
|
|
@@ -624,6 +624,32 @@
|
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
+
|
|
628
|
+
.pro-table-editable-cell-wrapper {
|
|
629
|
+
display: flex;
|
|
630
|
+
align-items: center;
|
|
631
|
+
width: 100%;
|
|
632
|
+
justify-content: space-between;
|
|
633
|
+
gap: 4px;
|
|
634
|
+
white-space: nowrap;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.pro-table-editable-cell-edit-icon {
|
|
638
|
+
display: inline-flex;
|
|
639
|
+
align-items: center;
|
|
640
|
+
color: #d8d8d8;
|
|
641
|
+
cursor: pointer;
|
|
642
|
+
visibility: hidden;
|
|
643
|
+
flex-shrink: 0;
|
|
644
|
+
|
|
645
|
+
&:hover {
|
|
646
|
+
color: var(--zaui-brand, #006aff);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
td:hover .pro-table-editable-cell-edit-icon {
|
|
651
|
+
visibility: visible;
|
|
652
|
+
}
|
|
627
653
|
}
|
|
628
654
|
|
|
629
655
|
.@{ant-prefix}-dropdown-placement-bottomLeft {
|
|
@@ -26,11 +26,13 @@ function Trigger(props) {
|
|
|
26
26
|
const {
|
|
27
27
|
disabled: appointDisabled
|
|
28
28
|
} = appointProps || {};
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const [beforeDisabled, afterDisabled] = Array.isArray(disabled) ? disabled : [
|
|
32
|
-
const [allDisabled, specifyDisabled] = Array.isArray(appointDisabled) ? appointDisabled : [
|
|
33
|
-
const [
|
|
29
|
+
const normalizedAppointDisabled = appointDisabled || false;
|
|
30
|
+
const normalizedDisabled = disabled || false;
|
|
31
|
+
const [beforeDisabled, afterDisabled] = Array.isArray(disabled) ? disabled : [normalizedDisabled, normalizedDisabled];
|
|
32
|
+
const [allDisabled, specifyDisabled] = Array.isArray(appointDisabled) ? appointDisabled : [normalizedAppointDisabled, normalizedAppointDisabled];
|
|
33
|
+
const [{
|
|
34
|
+
mode
|
|
35
|
+
}, setState] = useSetState({
|
|
34
36
|
mode: 'appoint'
|
|
35
37
|
});
|
|
36
38
|
useEffect(() => {
|
|
@@ -45,17 +47,17 @@ function Trigger(props) {
|
|
|
45
47
|
}
|
|
46
48
|
}, [allValue, value, appoint, checkAll]);
|
|
47
49
|
const onIconClick = () => {
|
|
48
|
-
if (appoint &&
|
|
50
|
+
if (appoint && mode === 'all') {
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
handleClick();
|
|
52
54
|
};
|
|
53
55
|
const viewIconClassName = classNames('pro-tree-modal-view-svg', {
|
|
54
|
-
'pro-tree-modal-view-svg-active': !!isView && checkedValues.length > 0 &&
|
|
55
|
-
'pro-tree-modal-view-svg-not-allowed': appoint &&
|
|
56
|
+
'pro-tree-modal-view-svg-active': !!isView && checkedValues.length > 0 && mode !== 'all' && !afterDisabled,
|
|
57
|
+
'pro-tree-modal-view-svg-not-allowed': appoint && mode === 'all'
|
|
56
58
|
});
|
|
57
59
|
const addonAfterClassName = classNames('pro-enum-input-addonAfter', {
|
|
58
|
-
'pro-enum-input-addonAfter-not-allowed': appoint &&
|
|
60
|
+
'pro-enum-input-addonAfter-not-allowed': appoint && mode === 'all',
|
|
59
61
|
'trigger-no-hover': afterDisabled
|
|
60
62
|
});
|
|
61
63
|
if (isView) {
|
|
@@ -63,7 +65,8 @@ function Trigger(props) {
|
|
|
63
65
|
return /*#__PURE__*/_jsxs("div", {
|
|
64
66
|
className: "pro-tree-modal-isView",
|
|
65
67
|
children: [/*#__PURE__*/_jsx("div", {
|
|
66
|
-
|
|
68
|
+
className: "pro-tree-modal-isView-value",
|
|
69
|
+
children: !hasValue ? '-' : mode === 'all' ? formatMessage(locale?.ProTreeModal.checkAll1, {
|
|
67
70
|
all: label
|
|
68
71
|
}) : formatMessage(locale?.ProTreeModal?.checkNumber, {
|
|
69
72
|
num: checkedValues.length
|
|
@@ -92,6 +95,7 @@ function Trigger(props) {
|
|
|
92
95
|
if (appoint) {
|
|
93
96
|
return /*#__PURE__*/_jsxs(Space.Compact, {
|
|
94
97
|
block: true,
|
|
98
|
+
className: "pro-tree-modal-appoint-compact",
|
|
95
99
|
style: {
|
|
96
100
|
...triggerStyle
|
|
97
101
|
},
|
|
@@ -102,7 +106,7 @@ function Trigger(props) {
|
|
|
102
106
|
disabled: beforeDisabled,
|
|
103
107
|
className: classNames(disabled ? 'trigger-no-hover' : '', appoint ? 'pro-tree-modal-input-appoint' : ''),
|
|
104
108
|
defaultValue: "appoint",
|
|
105
|
-
value:
|
|
109
|
+
value: mode,
|
|
106
110
|
onChange: onAppointChange,
|
|
107
111
|
options: [{
|
|
108
112
|
value: 'all',
|
|
@@ -125,17 +129,17 @@ function Trigger(props) {
|
|
|
125
129
|
const inputProps = {
|
|
126
130
|
className: classNames(afterDisabled ? 'trigger-no-hover' : '', appoint ? 'pro-tree-modal-input-appoint' : ''),
|
|
127
131
|
onClick: handleClick,
|
|
128
|
-
value: checkedValues.length === 0 ? null :
|
|
132
|
+
value: checkedValues.length === 0 ? null : mode === 'all' ? formatMessage(locale?.ProTreeModal.checkAll1, {
|
|
129
133
|
all: label
|
|
130
134
|
}) : formatMessage(locale?.ProTreeModal?.checkNumber, {
|
|
131
135
|
num: checkedValues.length
|
|
132
136
|
}),
|
|
133
137
|
placeholder: locale?.ProTreeModal?.select,
|
|
134
|
-
disabled: afterDisabled ||
|
|
138
|
+
disabled: afterDisabled || mode === 'all'
|
|
135
139
|
};
|
|
136
140
|
|
|
137
141
|
// 如果 mode === 'all',不显示 addonAfter,直接返回 Input
|
|
138
|
-
if (
|
|
142
|
+
if (mode === 'all') {
|
|
139
143
|
return /*#__PURE__*/_jsx(TriggerComponent, {
|
|
140
144
|
children: /*#__PURE__*/_jsx(Input, {
|
|
141
145
|
...inputProps,
|