@lingxiteam/ebe-utils 0.2.22 → 0.2.24
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/Layout/index.tsx +2 -2
- 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 +6 -4
- 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,12 +1,14 @@
|
|
|
1
|
+
|
|
1
2
|
// @ts-ignore
|
|
2
|
-
import { EngineApisType, LingxiForwardRef } from '@lingxiteam/types';
|
|
3
3
|
import type { ValidationRule } from 'antd/es/form';
|
|
4
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import CommIcon from '../Icon';
|
|
6
6
|
import { handleIsValidIconCfg } from '../Icon/hooks';
|
|
7
|
+
import { EngineApisType, LingxiForwardRef } from '@lingxiteam/types';
|
|
7
8
|
import { FormFields, getFieldsProps, useCommonImperativeHandle } from '../utils';
|
|
8
|
-
import { useLocale } from '../utils/hooks/useLocale';
|
|
9
9
|
import BaseModalSelect from './BaseModalSelect';
|
|
10
|
+
import { useLocale } from '../utils/hooks/useLocale';
|
|
11
|
+
import { get, isEqual } from 'lodash';
|
|
10
12
|
|
|
11
13
|
export interface MyModalSelectProps {
|
|
12
14
|
value?: any;
|
|
@@ -144,11 +146,12 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
144
146
|
...restProps
|
|
145
147
|
} = props;
|
|
146
148
|
|
|
149
|
+
const selectItemsRef = useRef();
|
|
147
150
|
const engineApis = receivedEngineApis || getEngineApis?.() || {};
|
|
148
151
|
const { openModal } = engineApis;
|
|
149
152
|
|
|
150
153
|
const { getLocale } = useLocale(engineApis);
|
|
151
|
-
|
|
154
|
+
|
|
152
155
|
const [options, setOptions] = useState([]);
|
|
153
156
|
const [postfixStyleClsName, setPostfixStyleClsName] = useState<string>('');
|
|
154
157
|
|
|
@@ -165,7 +168,7 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
165
168
|
return false;
|
|
166
169
|
}
|
|
167
170
|
};
|
|
168
|
-
|
|
171
|
+
|
|
169
172
|
const getValueOptions = (datas: any) => {
|
|
170
173
|
const { conField, valField } = modalInfo || {};
|
|
171
174
|
let valArray: any = [];
|
|
@@ -175,10 +178,7 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
175
178
|
if (valueObj instanceof Array) {
|
|
176
179
|
valueObj.forEach((va: any) => {
|
|
177
180
|
if (va[valField] || va.value) {
|
|
178
|
-
const obj = {
|
|
179
|
-
label: va[conField] || va.label,
|
|
180
|
-
value: va[valField] || va.value,
|
|
181
|
-
};
|
|
181
|
+
const obj = { label: va[conField] || va.label, value: va[valField] || va.value };
|
|
182
182
|
valArray.push(obj.value);
|
|
183
183
|
optionParams.push(obj);
|
|
184
184
|
} else if (va) {
|
|
@@ -216,21 +216,39 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
216
216
|
return undefined;
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
+
const resetSelectItems = (val?: string | string[] | null) => {
|
|
220
|
+
try {
|
|
221
|
+
const selectItem: any = selectItemsRef.current;
|
|
222
|
+
|
|
223
|
+
const selectArr = Array.isArray(selectItem) ? selectItem : [selectItem];
|
|
224
|
+
const { valField = 'value' } = modalInfo || {};
|
|
225
|
+
const selectItemsId = selectArr.map(item => get(item, valField));
|
|
226
|
+
|
|
227
|
+
const valsId = Array.isArray(val) ? val : [val];
|
|
228
|
+
|
|
229
|
+
if (!isEqual(selectItemsId, valsId)) {
|
|
230
|
+
selectItemsRef.current = undefined;
|
|
231
|
+
}
|
|
232
|
+
} catch (error) {
|
|
233
|
+
selectItemsRef.current = undefined;
|
|
234
|
+
return val;
|
|
235
|
+
}
|
|
236
|
+
return val;
|
|
237
|
+
};
|
|
238
|
+
|
|
219
239
|
const value = useMemo(() => {
|
|
220
|
-
return handleFormValue(originValue);
|
|
240
|
+
return resetSelectItems(handleFormValue(originValue));
|
|
221
241
|
}, [JSON.stringify(originValue)]);
|
|
222
242
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
disabled,
|
|
226
|
-
readOnly,
|
|
227
|
-
required,
|
|
228
|
-
finalRules: temRules,
|
|
229
|
-
} = useCommonImperativeHandle(ref, props, {
|
|
243
|
+
|
|
244
|
+
const { formFieldsRef, disabled, readOnly, required, finalRules: temRules } = useCommonImperativeHandle(ref, props, {
|
|
230
245
|
clearValue: [],
|
|
231
246
|
get value() {
|
|
232
247
|
return value;
|
|
233
248
|
},
|
|
249
|
+
getModalSelectItem() {
|
|
250
|
+
return selectItemsRef.current;
|
|
251
|
+
},
|
|
234
252
|
});
|
|
235
253
|
|
|
236
254
|
// 设置前后缀样式
|
|
@@ -255,6 +273,7 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
255
273
|
}
|
|
256
274
|
}, [postfixStyle]);
|
|
257
275
|
|
|
276
|
+
|
|
258
277
|
const getAddonAfterBtn = () => {
|
|
259
278
|
const { disabled } = restProps;
|
|
260
279
|
let after = null;
|
|
@@ -262,7 +281,7 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
262
281
|
if (handleIsValidIconCfg(postfixIcon)) {
|
|
263
282
|
after = (
|
|
264
283
|
<CommIcon
|
|
265
|
-
className={disabled ? 'disabled' : ''}
|
|
284
|
+
className={`${disabled ? 'disabled' : ''} postfixIcon`}
|
|
266
285
|
icon={postfixIcon}
|
|
267
286
|
getEngineApis={getEngineApis}
|
|
268
287
|
onClick={disabled || postfix ? null : onIconClick || undefined}
|
|
@@ -276,7 +295,7 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
276
295
|
case 'after':
|
|
277
296
|
after = (
|
|
278
297
|
<span className="postfix" onClick={disabled ? null : onIconClick || undefined}>
|
|
279
|
-
{postfix}
|
|
298
|
+
<span>{postfix}</span>
|
|
280
299
|
{after}
|
|
281
300
|
</span>
|
|
282
301
|
);
|
|
@@ -286,7 +305,7 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
286
305
|
after = (
|
|
287
306
|
<span className="postfix" onClick={disabled ? null : onIconClick || undefined}>
|
|
288
307
|
{after}
|
|
289
|
-
{postfix}
|
|
308
|
+
<span>{postfix}</span>
|
|
290
309
|
</span>
|
|
291
310
|
);
|
|
292
311
|
break;
|
|
@@ -321,19 +340,34 @@ const ModalSelect = LingxiForwardRef<any, MyModalSelectProps>((props, ref) => {
|
|
|
321
340
|
return numReg.test(str);
|
|
322
341
|
};
|
|
323
342
|
|
|
324
|
-
const
|
|
343
|
+
const onChangeHandle = (e: any, opts: any, cbOpts?: any) => {
|
|
344
|
+
// 把弹窗数据转化成res
|
|
345
|
+
const { resField } = modalInfo || {};
|
|
346
|
+
let datas = cbOpts;
|
|
347
|
+
if (typeof resField === 'string') {
|
|
348
|
+
datas = get(cbOpts, resField);
|
|
349
|
+
}
|
|
350
|
+
selectItemsRef.current = datas;
|
|
325
351
|
if (onChange) {
|
|
326
|
-
onChange(e,
|
|
352
|
+
onChange(e, opts, cbOpts);
|
|
327
353
|
}
|
|
328
354
|
};
|
|
329
355
|
|
|
356
|
+
const handleChangeVal = (e: any) => {
|
|
357
|
+
onChangeHandle(e, options);
|
|
358
|
+
};
|
|
359
|
+
|
|
330
360
|
// 弹框回调
|
|
331
361
|
const handleModalOk = (res: any) => {
|
|
332
|
-
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
362
|
+
// 把弹窗数据转化成res
|
|
363
|
+
const { resField } = modalInfo || {};
|
|
364
|
+
let datas = res;
|
|
365
|
+
if (typeof resField === 'string') {
|
|
366
|
+
datas = get(res, resField);
|
|
336
367
|
}
|
|
368
|
+
const { valArray, optionParams } = getValueOptions(datas);
|
|
369
|
+
const modeOpts = mode === 'multiple' ? optionParams : optionParams.filter((v: any) => v?.value === valArray);
|
|
370
|
+
onChangeHandle(valArray, modeOpts, res);
|
|
337
371
|
};
|
|
338
372
|
// 触发弹框弹出
|
|
339
373
|
const handleClickVisible = () => {
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import LcdpUeditor from '@lingxiteam/lcdp-ueditor-react';
|
|
2
|
-
import { ILcdpUeditorInst } from '@lingxiteam/lcdp-ueditor-react/es/type';
|
|
3
|
-
import { LingXiFC } from '@lingxiteam/types';
|
|
4
|
-
import { useMemo, useRef } from 'react';
|
|
5
1
|
import { FormFields, getFieldsProps, useCommonImperativeHandle } from '../utils';
|
|
6
2
|
import { useLocale } from '../utils/hooks/useLocale';
|
|
7
3
|
import { renderRichText } from '../utils/renderReadOnly';
|
|
4
|
+
import LcdpUeditor from '@lingxiteam/lcdp-ueditor-react';
|
|
5
|
+
import { ILcdpUeditorInst } from '@lingxiteam/lcdp-ueditor-react/es/type';
|
|
6
|
+
import { LingXiFC } from '@lingxiteam/types';
|
|
7
|
+
import React, { useMemo, useRef } from 'react';
|
|
8
8
|
import { DEFAULT_TOOLBARS, DEFAULT_TOOLBARS_GROUP } from './const';
|
|
9
|
+
import IdleContainer from '../utils/IdleContainer';
|
|
9
10
|
|
|
10
|
-
const LcdpUeditorMain: LingXiFC<{
|
|
11
|
-
const { value, onChange, style, className, rootRef: ref, funcTypes } = props;
|
|
11
|
+
const LcdpUeditorMain: LingXiFC <{[key: string]: any}> = (props => {
|
|
12
|
+
const { value, onChange, style, className, rootRef: ref, funcTypes, pasteplain = false } = props;
|
|
12
13
|
const editorRef = useRef<ILcdpUeditorInst | null>(null);
|
|
13
14
|
|
|
14
15
|
const engineApis = props.getEngineApis();
|
|
15
16
|
const { getLocale, lang } = useLocale(engineApis);
|
|
16
17
|
|
|
17
18
|
const { disabled, required, readOnly, formFieldsRef } = useCommonImperativeHandle(ref, props, {
|
|
18
|
-
setValue: (val:
|
|
19
|
+
setValue: (val:string) => {
|
|
19
20
|
if (editorRef.current) {
|
|
20
21
|
editorRef.current.setContent(val);
|
|
22
|
+
} else {
|
|
23
|
+
// 编辑器未挂载先设置到value
|
|
24
|
+
onChange(val);
|
|
21
25
|
}
|
|
22
26
|
},
|
|
23
27
|
});
|
|
@@ -71,59 +75,62 @@ const LcdpUeditorMain: LingXiFC<{ [key: string]: any }> = props => {
|
|
|
71
75
|
return 'zh-cn';
|
|
72
76
|
}
|
|
73
77
|
}, [lang]);
|
|
74
|
-
|
|
78
|
+
|
|
75
79
|
return (
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
80
|
+
<IdleContainer>
|
|
81
|
+
<FormFields
|
|
82
|
+
{...getFieldsProps(props)}
|
|
83
|
+
ref={formFieldsRef}
|
|
84
|
+
trigger="onChange"
|
|
85
|
+
required={required}
|
|
86
|
+
disabled={disabled as any}
|
|
87
|
+
readOnly={readOnly}
|
|
88
|
+
rules={finalRules}
|
|
89
|
+
render={renderRichText}
|
|
90
|
+
>
|
|
91
|
+
<LcdpUeditor
|
|
92
|
+
lang={getLang}
|
|
93
|
+
style={style}
|
|
94
|
+
onMount={(inst) => {
|
|
95
|
+
editorRef.current = inst;
|
|
96
|
+
}}
|
|
97
|
+
className={className}
|
|
98
|
+
disabled={disabled}
|
|
99
|
+
value={value}
|
|
100
|
+
onChange={onChange}
|
|
101
|
+
config={{
|
|
102
|
+
imageType: props.imageType,
|
|
103
|
+
height: props.height,
|
|
104
|
+
maximumWords: props.maximumWords,
|
|
105
|
+
pasteplain,
|
|
106
|
+
}}
|
|
107
|
+
toolbars={toolbars}
|
|
108
|
+
uploadFunction={async (file) => {
|
|
109
|
+
const formData = new FormData();
|
|
110
|
+
formData.append('attach', file, file.name);
|
|
111
|
+
const res: any = await engineApis?.service?.uploadFileByFetch(formData);
|
|
112
|
+
if (res?.fileId) {
|
|
113
|
+
const link = engineApis?.getAppFileUrlById(res?.fileId);
|
|
114
|
+
console.log(link, res.fileId);
|
|
115
|
+
return new Promise((resolve, reject) => {
|
|
116
|
+
resolve({
|
|
117
|
+
state: 'SUCCESS',
|
|
118
|
+
url: link,
|
|
119
|
+
title: file.name,
|
|
120
|
+
original: file.name,
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
109
124
|
return new Promise((resolve, reject) => {
|
|
110
125
|
resolve({
|
|
111
|
-
state: '
|
|
112
|
-
url: link,
|
|
113
|
-
title: file.name,
|
|
114
|
-
original: file.name,
|
|
126
|
+
state: 'FAIL',
|
|
115
127
|
});
|
|
116
128
|
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
}}
|
|
124
|
-
/>
|
|
125
|
-
</FormFields>
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
</FormFields>
|
|
132
|
+
</IdleContainer>
|
|
126
133
|
);
|
|
127
|
-
};
|
|
134
|
+
});
|
|
128
135
|
|
|
129
136
|
export default LcdpUeditorMain;
|
|
@@ -3,7 +3,7 @@ import { LingxiForwardRef } from '@lingxiteam/types';
|
|
|
3
3
|
import type { FormItemProps } from 'antd/lib/form';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import React, { CSSProperties, useMemo } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { FormFields, filterHtmlNode, getFieldsProps } from '../utils';
|
|
7
7
|
import { useLocale } from '../utils/hooks/useLocale';
|
|
8
8
|
|
|
9
9
|
export interface MyRichTextEditorProps extends FormItemProps {
|
|
@@ -73,11 +73,7 @@ const BaseRichTextEditor = React.forwardRef((props: BaseRichTextEditorPropsType,
|
|
|
73
73
|
const heightStyle = useMemo(
|
|
74
74
|
() =>
|
|
75
75
|
heightType === 'auto'
|
|
76
|
-
? {
|
|
77
|
-
minHeight: minHeight ? `${minHeight}px` : '',
|
|
78
|
-
maxHeight: maxHeight ? `${maxHeight}px` : '',
|
|
79
|
-
height: 'auto',
|
|
80
|
-
}
|
|
76
|
+
? { minHeight: minHeight ? `${minHeight}px` : '', maxHeight: maxHeight ? `${maxHeight}px` : '', height: 'auto' }
|
|
81
77
|
: { height: height ? `${height}px` : '' },
|
|
82
78
|
[heightType, height, maxHeight, minHeight]
|
|
83
79
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import { useCommonImperativeHandle } from '../utils';
|
|
3
3
|
import RichTextEditorLoad from './loader';
|
|
4
4
|
|
|
@@ -6,15 +6,15 @@ import { LingXiFC } from '@lingxiteam/types';
|
|
|
6
6
|
|
|
7
7
|
export interface RichTextEditorProps {
|
|
8
8
|
height: number;
|
|
9
|
-
rootRef: any
|
|
9
|
+
rootRef: any
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const RichTextEditorMain: LingXiFC<RichTextEditorProps> = props => {
|
|
12
|
+
const RichTextEditorMain: LingXiFC<RichTextEditorProps> = ((props) => {
|
|
13
13
|
const { rootRef: ref } = props;
|
|
14
14
|
const gridViewRef = useRef<any>(null);
|
|
15
15
|
const richTextRef = useRef<any>(null);
|
|
16
16
|
const { disabled, required, readOnly, formFieldsRef } = useCommonImperativeHandle(ref, props, {
|
|
17
|
-
setValue: (val:
|
|
17
|
+
setValue: (val:string) => {
|
|
18
18
|
if (richTextRef.current) {
|
|
19
19
|
richTextRef.current.setHTML(val);
|
|
20
20
|
}
|
|
@@ -35,6 +35,6 @@ const RichTextEditorMain: LingXiFC<RichTextEditorProps> = props => {
|
|
|
35
35
|
richTextRef={richTextRef}
|
|
36
36
|
/>
|
|
37
37
|
);
|
|
38
|
-
};
|
|
38
|
+
});
|
|
39
39
|
|
|
40
40
|
export default RichTextEditorMain;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import LcdpUeditorMain from './LcdpUeditorMain';
|
|
4
3
|
import RichTextEditorMain from './RichTextEditorMain';
|
|
4
|
+
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
5
|
+
import IdleContainer from '../utils/IdleContainer';
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
class RichTextEditor extends React.Component<any, {}> {
|
|
7
9
|
state = {
|
|
@@ -28,6 +30,11 @@ class RichTextEditor extends React.Component<any, {}> {
|
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
|
|
31
34
|
export default LingxiForwardRef<any, any>((props, ref) => {
|
|
32
|
-
return
|
|
35
|
+
return (
|
|
36
|
+
<IdleContainer>
|
|
37
|
+
<RichTextEditor {...props} rootRef={ref} />
|
|
38
|
+
</IdleContainer>
|
|
39
|
+
);
|
|
33
40
|
});
|
|
@@ -2,7 +2,7 @@ import Loadable from 'react-loadable';
|
|
|
2
2
|
import { LoadingComponennt } from '../utils/LoaderHelper';
|
|
3
3
|
|
|
4
4
|
const GanttLoader = Loadable({
|
|
5
|
-
loader: async () => (await import
|
|
5
|
+
loader: async () => (await import/* webpackChunkName: 'pcFactory-RichTextEditor' */('./RichTextEditor')) as unknown as React.ComponentType<any>,
|
|
6
6
|
loading: LoadingComponennt,
|
|
7
7
|
});
|
|
8
8
|
|