@lingxiteam/ebe-utils 0.2.22 → 0.2.23
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/lib/h5public/yarn.lock +7 -8
- package/lib/pcpublic/src/components/pcfactory/src/Button/index.tsx +11 -10
- package/lib/pcpublic/src/components/pcfactory/src/Card/CardTitle/index.tsx +31 -24
- package/lib/pcpublic/src/components/pcfactory/src/Card/index.tsx +32 -14
- package/lib/pcpublic/src/components/pcfactory/src/Card/useExtendBtn.tsx +85 -48
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/ChartLine.tsx +24 -6
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/PropsType.ts +31 -5
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/index.tsx +3 -2
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +153 -129
- package/lib/pcpublic/src/components/pcfactory/src/Form/index.tsx +2 -5
- package/lib/pcpublic/src/components/pcfactory/src/Form/useFormStatus.ts +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +15 -3
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/PropsType.ts +4 -3
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/index.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +18 -4
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/PropsType.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/index.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +7 -2
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/index.tsx +60 -26
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +62 -55
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +2 -6
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +5 -5
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/index.tsx +9 -2
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/loader.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Select/index.tsx +145 -66
- package/lib/pcpublic/src/components/pcfactory/src/Select/selectUtils.ts +13 -9
- package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +36 -26
- package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +69 -94
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +12 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +9 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +11 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +11 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +14 -7
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Thumbnail/index.tsx +30 -31
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +89 -41
- package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +25 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/index.tsx +12 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/PopoverWrapper.tsx +220 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +39 -32
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +178 -148
- package/lib/pcpublic/src/components/pcfactory/src/Table/Table.tsx +439 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/TableHead/index.tsx +159 -72
- package/lib/pcpublic/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +12 -20
- package/lib/pcpublic/src/components/pcfactory/src/Table/constant.ts +3 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/index.ts +4 -4
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +32 -28
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +44 -57
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +306 -276
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +9 -6
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +30 -21
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +33 -27
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFilter.tsx +84 -77
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.tsx +33 -16
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +15 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +33 -33
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +13 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useScroll.ts +94 -28
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSelection.ts +108 -99
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSort.ts +8 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +27 -43
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +73 -394
- package/lib/pcpublic/src/components/pcfactory/src/Table/loader.tsx +15 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/event.d.ts +12 -8
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/headerCell.d.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/prop.d.ts +24 -11
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/SequenceId.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/index.ts +90 -82
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/indexedDBHelper.ts +9 -22
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/translate.ts +59 -0
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/Transfer.tsx +644 -0
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/index.tsx +49 -637
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/loader.tsx +11 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeEllipsisIcon.tsx +38 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +34 -35
- package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +213 -149
- package/lib/pcpublic/src/components/pcfactory/src/TreeSelect/index.tsx +47 -43
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/TreeTable.tsx +264 -0
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +52 -191
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/loader.tsx +16 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/index.tsx +34 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/quadrate.tsx +20 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/roundness.tsx +14 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/semicircle.tsx +15 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/verticalLine.tsx +12 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/common.less +17 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +57 -11
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +101 -12
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/ModalSelect.less +6 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Select.less +70 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/ChannelContainer.tsx +20 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/ChildRender.ts +6 -8
- package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +4 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/DummyFormContext.ts +9 -13
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/empty.tsx +5 -17
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/index.tsx +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/Holidays.ts +11 -39
- package/lib/pcpublic/src/components/pcfactory/src/utils/HolidaysFormat.ts +83 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/index.tsx +47 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/scheduler.ts +74 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/LoaderHelper.tsx +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/Spin/index.tsx +8 -7
- package/lib/pcpublic/src/components/pcfactory/src/utils/WithSyncValue.ts +25 -23
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/index.ts +10 -7
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMap.ts +9 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/usePersistFn.ts +17 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSetState.ts +7 -5
- package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +23 -50
- package/lib/pcpublic/src/components/pcfactory/src/utils/constant.ts +53 -57
- package/lib/pcpublic/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +12 -17
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +22 -12
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +50 -19
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +58 -37
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +33 -30
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/common.ts +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/generatorDisabledCallback.ts +121 -113
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +16 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCompState.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDataMask.ts +7 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +3 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +16 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +4 -5
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInit.ts +11 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +3 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useListenState.ts +1 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useLocale.ts +5 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useRules.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/utils/index.ts +10 -10
- package/lib/pcpublic/src/components/pcfactory/src/utils/polyfill.js +29 -31
- package/lib/pcpublic/src/components/pcfactory/src/utils/renderReadOnly.tsx +29 -26
- package/lib/public/public/iconfont.js +1 -0
- package/package.json +2 -2
|
@@ -1,14 +1,29 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useImperativeHandle,
|
|
3
|
+
Children,
|
|
4
|
+
cloneElement,
|
|
5
|
+
useRef,
|
|
6
|
+
useEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import { Form as AntdForm, Row, Col } from 'antd';
|
|
1
11
|
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
2
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
FormProvider,
|
|
14
|
+
FormContextProps,
|
|
15
|
+
getFormItemClassName,
|
|
16
|
+
usePrintMode,
|
|
17
|
+
PrintContainer,
|
|
18
|
+
useDynamicData,
|
|
19
|
+
} from '../utils';
|
|
3
20
|
import type { FormLayout } from 'antd/lib/form/Form';
|
|
4
|
-
import
|
|
5
|
-
import { isEqual } from 'lodash';
|
|
6
|
-
import React, { Children, cloneElement, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
7
|
-
import { FormContextProps, FormProvider, getFormItemClassName, PrintContainer, useDynamicData, usePrintMode } from '../utils';
|
|
8
|
-
import { useCreation } from '../utils/ahooks';
|
|
21
|
+
import WrapperForm from './WrapperForm';
|
|
9
22
|
import useBackgroundStyle from '../View/useBackgroundStyle';
|
|
10
23
|
import { useFormStatus } from './useFormStatus';
|
|
11
|
-
import
|
|
24
|
+
import { isEqual } from 'lodash';
|
|
25
|
+
import { useCreation } from '../utils/ahooks';
|
|
26
|
+
import classNames from 'classnames';
|
|
12
27
|
|
|
13
28
|
const EMPTY_COL = { span: 'none' }; // 避免每次都创建对象造成无用渲染
|
|
14
29
|
const FULL_COL = { span: 24 };
|
|
@@ -37,29 +52,42 @@ export interface FormProps {
|
|
|
37
52
|
* 是否一直展示标题(零代码使用,表单内包裹view然后再包裹表单控件,需要展示标题)
|
|
38
53
|
*/
|
|
39
54
|
isShowTitle?: boolean;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* label是否换行
|
|
58
|
+
*/
|
|
59
|
+
labelWrap?: boolean;
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
const useInit = (cb: () => () => void) => {
|
|
43
63
|
const initialRef = useRef(true);
|
|
44
|
-
const unmountRef = useRef(() => {});
|
|
64
|
+
const unmountRef = useRef(() => { });
|
|
45
65
|
|
|
46
66
|
if (initialRef.current) {
|
|
47
67
|
initialRef.current = false;
|
|
48
68
|
unmountRef.current = cb();
|
|
49
69
|
}
|
|
50
70
|
|
|
51
|
-
useEffect(
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
[unmountRef.current]
|
|
58
|
-
);
|
|
71
|
+
useEffect(() => () => {
|
|
72
|
+
if (typeof unmountRef.current === 'function') {
|
|
73
|
+
unmountRef.current();
|
|
74
|
+
}
|
|
75
|
+
}, [unmountRef.current]);
|
|
59
76
|
};
|
|
60
77
|
|
|
61
78
|
export const ViewFormItem = (props: any) => {
|
|
62
|
-
const {
|
|
79
|
+
const {
|
|
80
|
+
schemaProps,
|
|
81
|
+
selfSpan,
|
|
82
|
+
colSpan,
|
|
83
|
+
getVisible,
|
|
84
|
+
style,
|
|
85
|
+
stateListener,
|
|
86
|
+
isBlank,
|
|
87
|
+
i,
|
|
88
|
+
uid,
|
|
89
|
+
child,
|
|
90
|
+
} = props;
|
|
63
91
|
|
|
64
92
|
const [, setUpdate] = useState(0);
|
|
65
93
|
|
|
@@ -106,7 +134,7 @@ type FormChildrenType = Pick<FormProps, 'colSpan' | 'rowSpace' | 'layout' | 'col
|
|
|
106
134
|
children?: React.ReactNode;
|
|
107
135
|
formRef?: any;
|
|
108
136
|
engineApis?: any;
|
|
109
|
-
}
|
|
137
|
+
}
|
|
110
138
|
export const FormChildren = (props: FormChildrenType) => {
|
|
111
139
|
const { children, colSpan, formRef, rowSpace, layout, colSpace, engineApis } = props;
|
|
112
140
|
|
|
@@ -138,54 +166,53 @@ export const FormChildren = (props: FormChildrenType) => {
|
|
|
138
166
|
return 0;
|
|
139
167
|
}
|
|
140
168
|
const item = comps[curIndex - 1];
|
|
141
|
-
return item.props?.schema?.props?.formItemIndex
|
|
169
|
+
return item.props?.schema?.props?.formItemIndex ?? curIndex;
|
|
142
170
|
};
|
|
143
171
|
Children.forEach(comps, (child, index) => {
|
|
144
172
|
if (!React.isValidElement<any>(child)) {
|
|
145
173
|
components.push(child);
|
|
146
174
|
return;
|
|
147
175
|
}
|
|
148
|
-
|
|
176
|
+
|
|
149
177
|
const { schema } = child.props;
|
|
150
178
|
const { compType, props: schemaProps } = schema || {};
|
|
151
|
-
|
|
179
|
+
|
|
152
180
|
if (compType !== undefined && compType !== 2) {
|
|
153
181
|
const { formItemIndex, hidden, style: childStyle, selfSpan } = schemaProps;
|
|
154
182
|
const { display: customDisplay, visibility: customVisibility } = childStyle || {};
|
|
155
|
-
|
|
183
|
+
|
|
156
184
|
const changeColStyle = () => {
|
|
157
185
|
const colStyle: React.CSSProperties = {};
|
|
158
|
-
|
|
186
|
+
|
|
159
187
|
if (hidden || (customDisplay && customDisplay === 'none')) {
|
|
160
188
|
colStyle.display = 'none';
|
|
161
189
|
}
|
|
162
|
-
|
|
190
|
+
|
|
163
191
|
if (customVisibility) {
|
|
164
192
|
colStyle.visibility = customVisibility;
|
|
165
193
|
}
|
|
166
|
-
|
|
194
|
+
|
|
167
195
|
return colStyle;
|
|
168
196
|
};
|
|
169
197
|
const lastFormIndex = getLastFormIndex(index);
|
|
170
198
|
// 中间间隔组件的个数
|
|
171
|
-
const gap = formItemIndex - lastFormIndex - 1 || 0;
|
|
172
|
-
gap > 0 &&
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
199
|
+
const gap = index === 0 ? formItemIndex : (formItemIndex - lastFormIndex - 1) || 0;
|
|
200
|
+
gap > 0 && new Array(gap).fill(0).forEach((_, i) => {
|
|
201
|
+
components.push(
|
|
202
|
+
<ViewFormItem
|
|
203
|
+
i={i}
|
|
204
|
+
key={`blank-${i}`}
|
|
205
|
+
style={changeColStyle()}
|
|
206
|
+
colSpan={colSpan}
|
|
207
|
+
getVisible={getVisible}
|
|
208
|
+
stateListener={stateListener}
|
|
209
|
+
isBlank
|
|
210
|
+
// child.props.$$componentItem.uid 兼容高代码模式下
|
|
211
|
+
uid={child.props.uid || child.props.$$componentItem.uid}
|
|
212
|
+
/>,
|
|
213
|
+
);
|
|
214
|
+
});
|
|
215
|
+
|
|
189
216
|
components.push(
|
|
190
217
|
<ViewFormItem
|
|
191
218
|
style={changeColStyle()}
|
|
@@ -198,14 +225,14 @@ export const FormChildren = (props: FormChildrenType) => {
|
|
|
198
225
|
uid={child.props.uid || child.props.$$componentItem.uid}
|
|
199
226
|
child={child}
|
|
200
227
|
key={child.key}
|
|
201
|
-
|
|
228
|
+
/>,
|
|
202
229
|
);
|
|
203
230
|
return;
|
|
204
231
|
}
|
|
205
|
-
|
|
232
|
+
|
|
206
233
|
components.push(cloneElement(child, { extendProps: { isFormRootChild: true } } as any));
|
|
207
234
|
});
|
|
208
|
-
|
|
235
|
+
|
|
209
236
|
return components;
|
|
210
237
|
};
|
|
211
238
|
|
|
@@ -255,17 +282,14 @@ const Form = LingxiForwardRef<any, FormProps>((props, ref) => {
|
|
|
255
282
|
// 保存值变化回调,
|
|
256
283
|
const valueChangeFnRef = useRef<(changedValues: any, values: any) => void>();
|
|
257
284
|
|
|
258
|
-
const { backgroundStyle } = useBackgroundStyle({
|
|
259
|
-
engineApis,
|
|
260
|
-
backgroundType,
|
|
261
|
-
mode: 'engine',
|
|
262
|
-
});
|
|
285
|
+
const { backgroundStyle } = useBackgroundStyle({ engineApis, backgroundType, mode: 'engine' });
|
|
263
286
|
|
|
264
287
|
const { run, addListener, removeListener, status } = useFormStatus({
|
|
265
288
|
disabled: props.disabled,
|
|
266
289
|
readonly: props.readOnly,
|
|
267
290
|
});
|
|
268
291
|
|
|
292
|
+
|
|
269
293
|
// 由于需要考虑loop等组件,可能存在多个相同的字段名,自行研发
|
|
270
294
|
const scrollToError = (errorInfo: any) => {
|
|
271
295
|
try {
|
|
@@ -303,90 +327,87 @@ const Form = LingxiForwardRef<any, FormProps>((props, ref) => {
|
|
|
303
327
|
* 需要上传给动态数据容器的表单方法
|
|
304
328
|
*/
|
|
305
329
|
|
|
306
|
-
const formRefHandler = useCreation(
|
|
307
|
-
() => ({
|
|
330
|
+
const formRefHandler = useCreation(() => ({
|
|
308
331
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
332
|
+
/**
|
|
333
|
+
* 校验并滚动到某字段
|
|
334
|
+
*/
|
|
335
|
+
validateFormAndScroll: (errScroll: boolean = true) => {
|
|
336
|
+
return form.validateFields().catch(errorInfo => {
|
|
337
|
+
if (errScroll) {
|
|
338
|
+
scrollToError(errorInfo);
|
|
339
|
+
}
|
|
340
|
+
throw errorInfo;
|
|
341
|
+
});
|
|
342
|
+
},
|
|
320
343
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
344
|
+
/**
|
|
345
|
+
* 滚动到错误的位置
|
|
346
|
+
*/
|
|
347
|
+
scrollToErrorField: (errorInfo: any) => {
|
|
348
|
+
scrollToError(errorInfo);
|
|
349
|
+
},
|
|
327
350
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
351
|
+
/**
|
|
352
|
+
* 获取表单值
|
|
353
|
+
*/
|
|
354
|
+
getFieldsValue: () => {
|
|
355
|
+
return form.getFieldsValue();
|
|
356
|
+
},
|
|
334
357
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
358
|
+
/**
|
|
359
|
+
* 设置表单值
|
|
360
|
+
* @param values
|
|
361
|
+
* @param refs 低代码平台引擎内所有的refs,其他平台不要使用
|
|
362
|
+
*/
|
|
363
|
+
setFieldsValue(values: any, refs: Record<string, any>) {
|
|
364
|
+
const target: any = {};
|
|
365
|
+
const relation: any = formChildRelation.current;
|
|
366
|
+
if (values) {
|
|
367
|
+
Object.keys(values).forEach(key => {
|
|
368
|
+
target[key] = values[key];
|
|
369
|
+
if (typeof patchSetFormsValueFn[key] === 'function') {
|
|
370
|
+
target[key] = patchSetFormsValueFn[key](target[key]);
|
|
371
|
+
}
|
|
372
|
+
if (refs && relation) {
|
|
373
|
+
const relation = formChildRelation.current;
|
|
374
|
+
// @ts-ignore
|
|
375
|
+
const comId = relation?.[key];
|
|
376
|
+
if (comId) {
|
|
377
|
+
refs?.[comId]?.onlySyncValue(target[key]);
|
|
356
378
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
379
|
+
}
|
|
380
|
+
if (!isEqual(form.getFieldValue(key), target[key]) && typeof onValuesChange === 'function') {
|
|
381
|
+
if (engineApis?.compatConfig?.cmd?.setFieldsValueToOnValuesChange === true) {
|
|
382
|
+
onValuesChange(key, target[key]);
|
|
361
383
|
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
form.setFieldsValue(target);
|
|
389
|
+
},
|
|
367
390
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
391
|
+
/**
|
|
392
|
+
* 重置表单值
|
|
393
|
+
*/
|
|
394
|
+
resetFields() {
|
|
395
|
+
form.resetFields();
|
|
396
|
+
},
|
|
374
397
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
[status]
|
|
389
|
-
);
|
|
398
|
+
// 设置禁用状态
|
|
399
|
+
setDisabled: (v: boolean | 'toggle') => {
|
|
400
|
+
run('disabled', v === 'toggle' ? !status.disabled : v);
|
|
401
|
+
},
|
|
402
|
+
// 设置只读状态
|
|
403
|
+
setReadOnly: (v: boolean | 'toggle') => {
|
|
404
|
+
run('readonly', v === 'toggle' ? !status.readonly : v);
|
|
405
|
+
},
|
|
406
|
+
scrollToError,
|
|
407
|
+
// 作为ref标志,表示form已经被渲染了
|
|
408
|
+
has: true,
|
|
409
|
+
form,
|
|
410
|
+
}), [status]);
|
|
390
411
|
|
|
391
412
|
/**
|
|
392
413
|
* 动态数据容器ref上报
|
|
@@ -415,7 +436,7 @@ const Form = LingxiForwardRef<any, FormProps>((props, ref) => {
|
|
|
415
436
|
* @returns
|
|
416
437
|
*/
|
|
417
438
|
getChildRelation: () => formChildRelation.current,
|
|
418
|
-
|
|
439
|
+
|
|
419
440
|
/**
|
|
420
441
|
* 打印模式钩子
|
|
421
442
|
*/
|
|
@@ -453,8 +474,9 @@ const Form = LingxiForwardRef<any, FormProps>((props, ref) => {
|
|
|
453
474
|
colSpace,
|
|
454
475
|
isShowTitle,
|
|
455
476
|
formCode: formCode || $$componentItem?.id,
|
|
477
|
+
labelWrap: props.labelWrap,
|
|
456
478
|
}),
|
|
457
|
-
[form, layout, colSpan, labelCol, wrapperCol, colon, labelAlign, addListener, removeListener]
|
|
479
|
+
[form, layout, colSpan, labelCol, wrapperCol, colon, labelAlign, addListener, removeListener],
|
|
458
480
|
);
|
|
459
481
|
|
|
460
482
|
const formStyle: React.CSSProperties = {
|
|
@@ -476,6 +498,7 @@ const Form = LingxiForwardRef<any, FormProps>((props, ref) => {
|
|
|
476
498
|
layout={layout}
|
|
477
499
|
labelCol={layout === 'horizontal' ? labelCol : EMPTY_COL}
|
|
478
500
|
wrapperCol={layout === 'horizontal' ? wrapperCol : EMPTY_COL}
|
|
501
|
+
labelWrap={props.labelWrap}
|
|
479
502
|
style={formStyle}
|
|
480
503
|
onValuesChange={(changedValues, values) => {
|
|
481
504
|
const keys = Object.keys(changedValues || {});
|
|
@@ -530,6 +553,7 @@ const Form = LingxiForwardRef<any, FormProps>((props, ref) => {
|
|
|
530
553
|
layout={layout}
|
|
531
554
|
labelCol={layout === 'horizontal' ? labelCol : EMPTY_COL}
|
|
532
555
|
wrapperCol={layout === 'horizontal' ? wrapperCol : EMPTY_COL}
|
|
556
|
+
labelWrap={props.labelWrap}
|
|
533
557
|
style={formStyle}
|
|
534
558
|
{...extendProps}
|
|
535
559
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormFields as Item, useForm } from '../utils';
|
|
2
1
|
import Form from './Form';
|
|
2
|
+
import { FormFields as Item, useForm } from '../utils';
|
|
3
3
|
|
|
4
4
|
type FormType = typeof Form;
|
|
5
5
|
|
|
@@ -7,9 +7,6 @@ type FormType = typeof Form;
|
|
|
7
7
|
|
|
8
8
|
(Form as any).useForm = useForm;
|
|
9
9
|
|
|
10
|
-
const formInstance = Form as FormType & {
|
|
11
|
-
Item: typeof Item;
|
|
12
|
-
useForm: typeof useForm;
|
|
13
|
-
};
|
|
10
|
+
const formInstance = Form as FormType & { Item: typeof Item, useForm: typeof useForm };
|
|
14
11
|
|
|
15
12
|
export default formInstance;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { isUndefined } from 'lodash';
|
|
2
1
|
import { useRef } from 'react';
|
|
3
|
-
import { useUpdateEffect } from '../utils/ahooks';
|
|
4
|
-
import { StatusType } from '../utils/formUtils/FormContext';
|
|
5
2
|
import useMonitor from './useMonitor';
|
|
3
|
+
import { StatusType } from '../utils/formUtils/FormContext';
|
|
4
|
+
import { isUndefined } from 'lodash';
|
|
5
|
+
import { useUpdateEffect } from '../utils/ahooks';
|
|
6
6
|
|
|
7
7
|
export type FormStatusType = {
|
|
8
8
|
[key in StatusType]?: unknown;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const useSubscriptionStatus = (options: {
|
|
11
|
+
const useSubscriptionStatus = (options: {
|
|
12
|
+
run: (type: StatusType, v: unknown) => void;
|
|
13
|
+
type: StatusType;
|
|
14
|
+
listened: unknown;
|
|
15
|
+
}) => {
|
|
12
16
|
const { run, type, listened } = options;
|
|
13
17
|
useUpdateEffect(() => {
|
|
14
18
|
if (!isUndefined(listened)) {
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LXPieChartPorps from './PropsType';
|
|
1
3
|
import { LXChart } from '@lingxiteam/charts-common';
|
|
2
4
|
import { LingXiFC } from '@lingxiteam/types';
|
|
5
|
+
import useBackgroundStyle from '../View/useBackgroundStyle';
|
|
3
6
|
import { useHiddenStyle } from '../utils';
|
|
4
7
|
import './index.less';
|
|
5
|
-
import LXPieChartPorps from './PropsType';
|
|
6
8
|
|
|
7
9
|
const LXPieChart: LingXiFC<LXPieChartPorps> = (props, ref) => {
|
|
8
|
-
const { style, visible = true, className } = props;
|
|
10
|
+
const { style, visible = true, className, backgroundType, getEngineApis, $$componentItem } = props;
|
|
9
11
|
const finalStyle = useHiddenStyle(visible, style);
|
|
12
|
+
const { backgroundStyle } = useBackgroundStyle({ backgroundType, engineApis: getEngineApis?.(), appId: $$componentItem?.appId, mode: 'engine' });
|
|
10
13
|
|
|
11
|
-
return
|
|
14
|
+
return (
|
|
15
|
+
<LXChart
|
|
16
|
+
style={{ ...backgroundStyle, ...(finalStyle || {}) }}
|
|
17
|
+
className={className}
|
|
18
|
+
configProps={props}
|
|
19
|
+
isEditMode={false}
|
|
20
|
+
isMobile={false}
|
|
21
|
+
chartType="Pie"
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
12
24
|
};
|
|
13
25
|
|
|
14
26
|
export default LXPieChart;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-disable semi */
|
|
2
|
-
import { PieChartPorps } from '@lingxiteam/charts-common';
|
|
3
2
|
import type { EngineApisType } from '@lingxiteam/types';
|
|
3
|
+
import { PieChartPorps } from '@lingxiteam/charts-common';
|
|
4
4
|
|
|
5
5
|
export default interface LXPieChartPorps extends PieChartPorps {
|
|
6
6
|
visible?: boolean;
|
|
7
7
|
className?: string;
|
|
8
8
|
style?: React.CSSProperties; // 样式
|
|
9
9
|
getEngineApis?: () => EngineApisType;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
backgroundType?: any;
|
|
11
|
+
// eslint-disable-next-line no-extra-semi
|
|
12
|
+
};
|
|
@@ -2,7 +2,7 @@ import Loadable from 'react-loadable';
|
|
|
2
2
|
import { LoadingComponennt } from '../utils/LoaderHelper';
|
|
3
3
|
|
|
4
4
|
const LoadableLXRadarChart = Loadable({
|
|
5
|
-
loader: async () => (await import
|
|
5
|
+
loader: async () => (await import/* webpackChunkName: 'pcFactory-LXPieChart' */('./LXPieChart')) as unknown as React.ComponentType<any>,
|
|
6
6
|
loading: LoadingComponennt,
|
|
7
7
|
});
|
|
8
8
|
|
|
@@ -1,16 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LXRadarChartPorps from './PropsType';
|
|
3
|
+
import { useHiddenStyle } from '../utils';
|
|
1
4
|
import { LXChart } from '@lingxiteam/charts-common';
|
|
2
5
|
import { LingXiFC } from '@lingxiteam/types';
|
|
3
|
-
import { useHiddenStyle } from '../utils';
|
|
4
6
|
import './index.less';
|
|
5
|
-
import
|
|
7
|
+
import useBackgroundStyle from '../View/useBackgroundStyle';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
|
|
6
10
|
|
|
7
11
|
// const prefixCls = 'lXRadarChart';
|
|
8
12
|
|
|
9
13
|
const LXRadarChart: LingXiFC<LXRadarChartPorps> = (props, ref) => {
|
|
10
|
-
const { style, visible = true, className } = props;
|
|
14
|
+
const { style, visible = true, className, backgroundType, getEngineApis, $$componentItem } = props;
|
|
11
15
|
const finalStyle = useHiddenStyle(visible, style);
|
|
16
|
+
const { backgroundStyle } = useBackgroundStyle({ backgroundType, engineApis: getEngineApis?.(), appId: $$componentItem?.appId, mode: 'engine' });
|
|
12
17
|
|
|
13
|
-
return
|
|
18
|
+
return (
|
|
19
|
+
<LXChart
|
|
20
|
+
style={{ ...backgroundStyle, ...finalStyle }}
|
|
21
|
+
className={classNames(className, 'ued-radarChart')}
|
|
22
|
+
configProps={props}
|
|
23
|
+
isEditMode={false}
|
|
24
|
+
isMobile={false}
|
|
25
|
+
chartType="Radar"
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
14
28
|
};
|
|
15
29
|
|
|
16
30
|
export default LXRadarChart;
|
|
@@ -2,7 +2,7 @@ import Loadable from 'react-loadable';
|
|
|
2
2
|
import { LoadingComponennt } from '../utils/LoaderHelper';
|
|
3
3
|
|
|
4
4
|
const LoadableLXRadarChart = Loadable({
|
|
5
|
-
loader: async () => (await import
|
|
5
|
+
loader: async () => (await import/* webpackChunkName: 'pcFactory-LXRadarChart' */('./LXRadarChat')) as unknown as React.ComponentType<any>,
|
|
6
6
|
loading: LoadingComponennt,
|
|
7
7
|
});
|
|
8
8
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
+
import { Select } from 'antd';
|
|
3
4
|
|
|
4
5
|
const BaseModalSelect = (props: any) => {
|
|
5
6
|
const {
|
|
@@ -26,8 +27,12 @@ const BaseModalSelect = (props: any) => {
|
|
|
26
27
|
<span
|
|
27
28
|
className={classnames(className, {
|
|
28
29
|
'pcfactory-input-group-wrapper': true,
|
|
29
|
-
[`pcfactory-input-affix-wrapper-${restProps?.size === 'large' ? 'lg' : 'sm'}`]: [
|
|
30
|
+
[`pcfactory-input-affix-wrapper-${restProps?.size === 'large' ? 'lg' : 'sm'}`]: [
|
|
31
|
+
'large',
|
|
32
|
+
'small',
|
|
33
|
+
].includes(restProps?.size),
|
|
30
34
|
[`${postfixStyleClsName}`]: postfixStyleClsName,
|
|
35
|
+
'pcfactory-input-after-border-right-width': !!postfixStyleClsName,
|
|
31
36
|
})}
|
|
32
37
|
style={restProps?.style}
|
|
33
38
|
onChange={val => {
|