@lingxiteam/ebe-utils 0.0.22 → 0.0.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/es/index.js +1 -1
- package/lib/h5public/src/components/factory/src/BlockSelect/index.tsx +2 -1
- package/lib/h5public/src/components/factory/src/Card/index.tsx +5 -1
- package/lib/h5public/src/components/factory/src/Carousel/index.tsx +2 -1
- package/lib/h5public/src/components/factory/src/DForm/index.tsx +1 -0
- package/lib/h5public/src/components/factory/src/DformList/FormItem/index.tsx +2 -1
- package/lib/h5public/src/components/factory/src/DformList/List/index.tsx +2 -1
- package/lib/h5public/src/components/factory/src/Donut/Dount.tsx +2 -1
- package/lib/h5public/src/components/factory/src/DynamicList/index.tsx +11 -7
- package/lib/h5public/src/components/factory/src/DynamicTable/Table.tsx +3 -3
- package/lib/h5public/src/components/factory/src/LoadMore/index.tsx +2 -1
- package/lib/h5public/src/components/factory/src/Loop/index.tsx +2 -1
- package/lib/h5public/src/components/factory/src/RemoteComponent/components/ReactRender.tsx +19 -2
- package/lib/h5public/src/components/factory/src/RemoteComponent/constant.ts +35 -0
- package/lib/h5public/src/components/factory/src/RemoteComponent/index.tsx +28 -15
- package/lib/h5public/src/components/factory/src/Selector/LxSelector.tsx +6 -3
- package/lib/h5public/src/components/factory/src/utils/form.ts +2 -0
- package/lib/h5public/src/utils/formUtils.ts +9 -3
- package/lib/h5public/src/utils/messageApi.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/CollapsePanel/index.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/GridView/GridView.tsx +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/LoopList/index.tsx +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/RemoteComponent/components/ReactRender.tsx +12 -2
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +34 -1
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/const.ts +205 -0
- package/lib/pcpublic/src/components/pcfactory/src/Steps/index.tsx +13 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Table.less +1 -0
- package/lib/public/src/utils/LcdpTerminalType.ts +132 -0
- package/lib/public/src/utils/array.ts +31 -1
- package/lib/public/src/utils/compatible.ts +31 -0
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var isArray = function isArray(arr) {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
export var clearAppInfo = function clearAppInfo(appInfo) {
|
|
34
|
-
var includes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['appId', 'appCode', 'appName', 'applicationIcon'];
|
|
34
|
+
var includes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['appId', 'appCode', 'appName', 'applicationIcon', 'updatorId', 'updatedTime'];
|
|
35
35
|
return Object.keys(appInfo || {}).reduce(function (pre, key) {
|
|
36
36
|
if (includes.includes(key)) {
|
|
37
37
|
pre[key] = appInfo[key];
|
|
@@ -100,7 +100,7 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
100
100
|
$$componentItem,
|
|
101
101
|
} = props;
|
|
102
102
|
const {
|
|
103
|
-
MemoRenderer: { renderer, MemoLoopItem },
|
|
103
|
+
MemoRenderer: { renderer, MemoLoopItem, getLoopItemExtraProps },
|
|
104
104
|
getAppFileUrlByFileCode,
|
|
105
105
|
} = getEngineApis();
|
|
106
106
|
const col = columnNum || 1;
|
|
@@ -509,6 +509,7 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
509
509
|
key: item[valueKey] ?? i,
|
|
510
510
|
itemId: item[valueKey] ?? i,
|
|
511
511
|
compId: props.$$componentItem.uid,
|
|
512
|
+
...getLoopItemExtraProps?.(item, i),
|
|
512
513
|
};
|
|
513
514
|
|
|
514
515
|
if (swipe && swipeAction?.length && status !== '3') {
|
|
@@ -80,10 +80,12 @@ const Card = LingxiForwardRef<any, MyCardProps>((props, ref) => {
|
|
|
80
80
|
const renderChildren = () => {
|
|
81
81
|
return React.Children.toArray(children).map((child: any) => {
|
|
82
82
|
if ($$ISNEW) {
|
|
83
|
+
const fStyle = { ...finialStyle };
|
|
84
|
+
delete fStyle.margin;
|
|
83
85
|
return React.cloneElement(child, {
|
|
84
86
|
extendProps: {
|
|
85
87
|
onBodyClick,
|
|
86
|
-
style:
|
|
88
|
+
style: { ...fStyle },
|
|
87
89
|
isContainer: child?.props?.schema?.isContainer,
|
|
88
90
|
...restProps,
|
|
89
91
|
},
|
|
@@ -163,6 +165,7 @@ const Card = LingxiForwardRef<any, MyCardProps>((props, ref) => {
|
|
|
163
165
|
titleLineHeight,
|
|
164
166
|
padding: padding || '12px', // 兼容旧数据
|
|
165
167
|
};
|
|
168
|
+
delete defaultStyle.margin;
|
|
166
169
|
if (props?.cardType === '2') {
|
|
167
170
|
return { ...defaultStyle, border: 'none' };
|
|
168
171
|
}
|
|
@@ -224,6 +227,7 @@ const Card = LingxiForwardRef<any, MyCardProps>((props, ref) => {
|
|
|
224
227
|
},
|
|
225
228
|
viewRef,
|
|
226
229
|
);
|
|
230
|
+
delete restStyle.margin;
|
|
227
231
|
return (
|
|
228
232
|
<AntCard
|
|
229
233
|
className={classNames(
|
|
@@ -57,7 +57,7 @@ const MyCarousel = LingxiForwardRef<any, MyCarouselProps>((props, ref) => {
|
|
|
57
57
|
...restProps
|
|
58
58
|
} = props;
|
|
59
59
|
const { MemoRenderer, px2rem, getLocale } = props.getEngineApis();
|
|
60
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
60
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
61
61
|
|
|
62
62
|
const swiperRef = useRef<any>(null);
|
|
63
63
|
|
|
@@ -399,6 +399,7 @@ const MyCarousel = LingxiForwardRef<any, MyCarouselProps>((props, ref) => {
|
|
|
399
399
|
renderer,
|
|
400
400
|
itemId: `${i}`,
|
|
401
401
|
compId: props.$$componentItem.uid,
|
|
402
|
+
...getLoopItemExtraProps?.(item, i),
|
|
402
403
|
};
|
|
403
404
|
return (
|
|
404
405
|
<Swiper.Item
|
|
@@ -118,7 +118,7 @@ const FormList: FC<FormListProps> = (props) => {
|
|
|
118
118
|
visible,
|
|
119
119
|
} = props;
|
|
120
120
|
const { MemoRenderer, onlySyncValue } = getEngineApis();
|
|
121
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
121
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
122
122
|
const currentItem = value[fieldProps][index];
|
|
123
123
|
|
|
124
124
|
const preCurrentItemRef = useRef(currentItem);
|
|
@@ -187,6 +187,7 @@ const FormList: FC<FormListProps> = (props) => {
|
|
|
187
187
|
},
|
|
188
188
|
itemId: newItem[uniqueField] ?? index,
|
|
189
189
|
compId,
|
|
190
|
+
...getLoopItemExtraProps?.(newItem, index),
|
|
190
191
|
};
|
|
191
192
|
|
|
192
193
|
return <MemoLoopItem {...itemProps} />;
|
|
@@ -41,7 +41,7 @@ const List: FC<ListProps> = ({
|
|
|
41
41
|
compId,
|
|
42
42
|
}) => {
|
|
43
43
|
const { MemoRenderer } = getEngineApis();
|
|
44
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
44
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<>
|
|
@@ -56,6 +56,7 @@ const List: FC<ListProps> = ({
|
|
|
56
56
|
__render__,
|
|
57
57
|
itemId: item[uniqueField] ?? index,
|
|
58
58
|
compId,
|
|
59
|
+
...getLoopItemExtraProps?.(item, index),
|
|
59
60
|
};
|
|
60
61
|
return <MemoLoopItem {...itemProps} />;
|
|
61
62
|
})}
|
|
@@ -28,7 +28,7 @@ const MyDonut: LingXiFC<MyDonutProps> = (props, ref) => {
|
|
|
28
28
|
} = props;
|
|
29
29
|
const { MemoRenderer, sandBoxSafeRun, sandBoxLoadModule } =
|
|
30
30
|
props.getEngineApis();
|
|
31
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
31
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
32
32
|
const { components } = renderer;
|
|
33
33
|
const funcExpExecute = useFuncExpExecute(sandBoxSafeRun);
|
|
34
34
|
const [probackColor, setprobackColor] = useState('');
|
|
@@ -266,6 +266,7 @@ const MyDonut: LingXiFC<MyDonutProps> = (props, ref) => {
|
|
|
266
266
|
renderer,
|
|
267
267
|
compId: $$componentItem.uid,
|
|
268
268
|
itemId: index,
|
|
269
|
+
...getLoopItemExtraProps?.(item, index),
|
|
269
270
|
};
|
|
270
271
|
return (
|
|
271
272
|
<span
|
|
@@ -55,7 +55,6 @@ interface DataRefProps {
|
|
|
55
55
|
refreshing: boolean;
|
|
56
56
|
total: number;
|
|
57
57
|
currentPage: number;
|
|
58
|
-
pageLoad: boolean;
|
|
59
58
|
resolve?: any;
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -92,16 +91,16 @@ const DynamicList = LingxiForwardRef<any, MyDynamicListProps>((props, ref) => {
|
|
|
92
91
|
} = props;
|
|
93
92
|
|
|
94
93
|
const { MemoRenderer, getLocale, dataState } = getEngineApis?.() || {};
|
|
95
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
94
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
96
95
|
const [pageReady, setPageReady] = useState(false);
|
|
97
96
|
const [hasMore, setHasMore] = useState(true);
|
|
98
97
|
const [listData, setListData] = useState<any[]>([]);
|
|
98
|
+
const [pageLoad, setPageLoad] = useState(false);
|
|
99
99
|
const listRef = useRef<any>({});
|
|
100
100
|
const dynamicDataRef = useRef<DataRefProps>({
|
|
101
101
|
total: total || 0,
|
|
102
102
|
refreshing: false,
|
|
103
103
|
currentPage: pageNum,
|
|
104
|
-
pageLoad: false,
|
|
105
104
|
});
|
|
106
105
|
const [isFullOfView, setIsFullOfView] = useState(false);
|
|
107
106
|
const [showFooter, setShowFooter] = useState(false);
|
|
@@ -233,7 +232,8 @@ const DynamicList = LingxiForwardRef<any, MyDynamicListProps>((props, ref) => {
|
|
|
233
232
|
dynamicDataRef.current?.resolve?.();
|
|
234
233
|
if (dataSource) {
|
|
235
234
|
// dynamicListDataChange(dataSource);
|
|
236
|
-
dynamicDataRef.current.pageLoad = false;
|
|
235
|
+
// dynamicDataRef.current.pageLoad = false;
|
|
236
|
+
setPageLoad(false);
|
|
237
237
|
} else {
|
|
238
238
|
setHasMore(false);
|
|
239
239
|
}
|
|
@@ -333,13 +333,16 @@ const DynamicList = LingxiForwardRef<any, MyDynamicListProps>((props, ref) => {
|
|
|
333
333
|
}, []);
|
|
334
334
|
|
|
335
335
|
useEffect(() => {
|
|
336
|
-
|
|
336
|
+
// FIXME: 可能在旧数据存在异常情况,可重点排查这里
|
|
337
|
+
if (dataSource && !pageLoad) {
|
|
338
|
+
// if (dataSource) {
|
|
337
339
|
setPageReady(true);
|
|
338
340
|
dynamicDataRef.current.total = Number(total);
|
|
339
|
-
dynamicDataRef.current.pageLoad = true;
|
|
341
|
+
// dynamicDataRef.current.pageLoad = true;
|
|
342
|
+
setPageLoad(true);
|
|
340
343
|
dynamicListDataChange(dataSource);
|
|
341
344
|
}
|
|
342
|
-
}, [dataSource]);
|
|
345
|
+
}, [dataSource, pageLoad]);
|
|
343
346
|
|
|
344
347
|
const renderColumn = (columnData: any, i: any) => {
|
|
345
348
|
const renderProps = {
|
|
@@ -351,6 +354,7 @@ const DynamicList = LingxiForwardRef<any, MyDynamicListProps>((props, ref) => {
|
|
|
351
354
|
renderer,
|
|
352
355
|
itemId: i,
|
|
353
356
|
compId: props.$$componentItem.uid,
|
|
357
|
+
...getLoopItemExtraProps?.(columnData, i),
|
|
354
358
|
};
|
|
355
359
|
|
|
356
360
|
if (swipe && swipeAction?.length && status !== '3') {
|
|
@@ -34,6 +34,7 @@ export interface MyDynamicTableProps {
|
|
|
34
34
|
fixedRight?: boolean; // 尾列固定
|
|
35
35
|
twoDimension: boolean; // 是否二维表格
|
|
36
36
|
style: any;
|
|
37
|
+
visible: boolean;
|
|
37
38
|
pagination: boolean;
|
|
38
39
|
pageSize?: number;
|
|
39
40
|
pageNum?: number;
|
|
@@ -55,7 +56,6 @@ export interface MyDynamicTableProps {
|
|
|
55
56
|
cell: any,
|
|
56
57
|
cellId: string,
|
|
57
58
|
) => void;
|
|
58
|
-
status: string;
|
|
59
59
|
dataSourceLoading?: boolean;
|
|
60
60
|
className?: string;
|
|
61
61
|
currentData: any[];
|
|
@@ -89,7 +89,7 @@ const DynamicTable = LingxiForwardRef<any, MyDynamicTableProps>(
|
|
|
89
89
|
onPageChange,
|
|
90
90
|
onRowClick,
|
|
91
91
|
onTableCellClick,
|
|
92
|
-
|
|
92
|
+
visible = true,
|
|
93
93
|
// dataSourceLoading = false,
|
|
94
94
|
$$componentItem,
|
|
95
95
|
className,
|
|
@@ -491,7 +491,7 @@ const DynamicTable = LingxiForwardRef<any, MyDynamicTableProps>(
|
|
|
491
491
|
|
|
492
492
|
return (
|
|
493
493
|
<>
|
|
494
|
-
{
|
|
494
|
+
{visible === true && (
|
|
495
495
|
<div className={`${prefixCls} ${className}`} style={style}>
|
|
496
496
|
{showHead && tableTitle && (
|
|
497
497
|
<div className="table-header">{tableTitle}</div>
|
|
@@ -33,7 +33,7 @@ const LoadMore = AppForwardRef<MyListViewProps>((props, ref) => {
|
|
|
33
33
|
} = props;
|
|
34
34
|
|
|
35
35
|
const { MemoRenderer } = props.getEngineApis();
|
|
36
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
36
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
37
37
|
|
|
38
38
|
const loadMoreParamsRef = useRef({});
|
|
39
39
|
const loadMoreRef = useRef<any>(null);
|
|
@@ -51,6 +51,7 @@ const LoadMore = AppForwardRef<MyListViewProps>((props, ref) => {
|
|
|
51
51
|
renderer,
|
|
52
52
|
itemId: i,
|
|
53
53
|
compId: props.$$componentItem.uid,
|
|
54
|
+
...getLoopItemExtraProps?.(columnData, i),
|
|
54
55
|
};
|
|
55
56
|
return (
|
|
56
57
|
<div className={`${prefixCls}-column`} key={i}>
|
|
@@ -33,7 +33,7 @@ const Loop = LingxiForwardRef<any, MyLoopprops>((props, ref) => {
|
|
|
33
33
|
} = props;
|
|
34
34
|
|
|
35
35
|
const { MemoRenderer, getAppFileUrlByFileCode } = props.getEngineApis();
|
|
36
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
36
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
37
37
|
const [dataSource, setDataSource] = useState(
|
|
38
38
|
Array.isArray(myDataSource) ? myDataSource : [],
|
|
39
39
|
);
|
|
@@ -90,6 +90,7 @@ const Loop = LingxiForwardRef<any, MyLoopprops>((props, ref) => {
|
|
|
90
90
|
key: item[uniqueField] ?? i,
|
|
91
91
|
itemId: item[uniqueField] ?? i,
|
|
92
92
|
compId: props.$$componentItem.uid,
|
|
93
|
+
...getLoopItemExtraProps?.(item, i),
|
|
93
94
|
};
|
|
94
95
|
return <MemoLoopItem {...renderProps} />;
|
|
95
96
|
})}
|
|
@@ -2,7 +2,9 @@ import { LingXiFC } from '@lingxiteam/types';
|
|
|
2
2
|
import { createRequires } from '@paciolan/remote-component/dist/createRequires';
|
|
3
3
|
import { createUseRemoteComponent } from '@paciolan/remote-component/dist/hooks/useRemoteComponent';
|
|
4
4
|
import { ErrorBlock } from 'antd-mobile-5';
|
|
5
|
+
import { useContext } from 'react';
|
|
5
6
|
import { useDynamicData } from '../../utils/dynamicUtils/DynamicContext';
|
|
7
|
+
import { DFormContext } from '../../utils/form';
|
|
6
8
|
import { IconFailComp } from '../assets';
|
|
7
9
|
import RemoteCompConfig from '../remote-component.config';
|
|
8
10
|
|
|
@@ -15,17 +17,31 @@ export interface MyRemoteComponentProps {
|
|
|
15
17
|
url?: string;
|
|
16
18
|
customProps: any;
|
|
17
19
|
useRemoteComponent?: any; // 自定义组件调用依赖的模块,可由调用方传入
|
|
20
|
+
forwardRef?: any;
|
|
21
|
+
// 如果在动态容器里面,传入表单的name
|
|
22
|
+
name?: string;
|
|
23
|
+
// 如果在动态容器里面,传入表单fieldName
|
|
24
|
+
fieldName?: string;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
// const prefixCls = 'remoteComponent';
|
|
21
28
|
const RemoteComponent: LingXiFC<MyRemoteComponentProps> = (props) => {
|
|
22
|
-
const {
|
|
29
|
+
const {
|
|
30
|
+
url,
|
|
31
|
+
customProps,
|
|
32
|
+
getEngineApis,
|
|
33
|
+
forwardRef,
|
|
34
|
+
name,
|
|
35
|
+
fieldName,
|
|
36
|
+
...restProps
|
|
37
|
+
} = props;
|
|
23
38
|
|
|
24
39
|
const engineApis = getEngineApis?.() || {};
|
|
25
40
|
|
|
26
41
|
const useRemoteComponentInst = props.useRemoteComponent || useRemoteComponent;
|
|
27
42
|
|
|
28
43
|
const dynamicDataContext = useDynamicData();
|
|
44
|
+
const { formCode } = useContext(DFormContext) || {};
|
|
29
45
|
|
|
30
46
|
const [loading, err, Component] = useRemoteComponentInst(url);
|
|
31
47
|
|
|
@@ -53,7 +69,8 @@ const RemoteComponent: LingXiFC<MyRemoteComponentProps> = (props) => {
|
|
|
53
69
|
<Component
|
|
54
70
|
{...restProps}
|
|
55
71
|
{...customProps}
|
|
56
|
-
$lxApi={{ form: dynamicDataContext.form }}
|
|
72
|
+
$lxApi={{ form: dynamicDataContext.form, formCode, fieldName, name }}
|
|
73
|
+
ref={forwardRef}
|
|
57
74
|
/>
|
|
58
75
|
);
|
|
59
76
|
};
|
|
@@ -2,6 +2,41 @@ import FishRender from './components/FishRender';
|
|
|
2
2
|
import ReactRender from './components/ReactRender';
|
|
3
3
|
import VueRender from './components/VueRender';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 合并方法,支持对象中包含getter方法
|
|
7
|
+
* @param object
|
|
8
|
+
* @param otherArgs
|
|
9
|
+
*/
|
|
10
|
+
export function mergeGetter<
|
|
11
|
+
T extends Record<string, any>,
|
|
12
|
+
S1 extends Record<string, any>,
|
|
13
|
+
S2 extends Record<string, any>,
|
|
14
|
+
>(object: T, source1: S1, ...args: S2[]) {
|
|
15
|
+
const target: Record<string, any> = object || {};
|
|
16
|
+
|
|
17
|
+
// 合并ref 保持getter对象不被转义
|
|
18
|
+
const merge = (o: Record<string, any> = {}) => {
|
|
19
|
+
Object.keys(o).forEach((key) => {
|
|
20
|
+
const descriptor = Object.getOwnPropertyDescriptor(o, key);
|
|
21
|
+
if (descriptor) {
|
|
22
|
+
Object.defineProperty(target, key, descriptor!);
|
|
23
|
+
} else {
|
|
24
|
+
try {
|
|
25
|
+
target[key] = o[key];
|
|
26
|
+
// eslint-disable-next-line no-empty
|
|
27
|
+
} catch {}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const sources: (S1 | S2)[] = [source1, ...args];
|
|
33
|
+
|
|
34
|
+
sources.forEach((source) => {
|
|
35
|
+
merge(source);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return target as any;
|
|
39
|
+
}
|
|
5
40
|
export const RemoteComponentMap = {
|
|
6
41
|
React: ReactRender,
|
|
7
42
|
Vue: VueRender,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
2
|
-
import { useEffect, useImperativeHandle, useState } from 'react';
|
|
2
|
+
import { useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
3
3
|
import { useDeepCompareEffect } from '../utils/ahooks';
|
|
4
|
-
import { RemoteComponentMap } from './constant';
|
|
4
|
+
import { mergeGetter, RemoteComponentMap } from './constant';
|
|
5
5
|
|
|
6
6
|
export interface MyRemoteComponentProps {
|
|
7
7
|
url: string;
|
|
@@ -28,6 +28,8 @@ const RemoteComponent = LingxiForwardRef<any, MyRemoteComponentProps>(
|
|
|
28
28
|
const [remoteUrl, setRemoteUrl] = useState<string>(url || '');
|
|
29
29
|
const engineApis = getEngineApis();
|
|
30
30
|
const [customProps, setProps] = useState<any>(myProps);
|
|
31
|
+
const [myRefs, setMyRefs] = useState<any>();
|
|
32
|
+
const isDid = useRef(false);
|
|
31
33
|
useDeepCompareEffect(() => {
|
|
32
34
|
setProps(myProps);
|
|
33
35
|
}, [myProps]);
|
|
@@ -40,19 +42,24 @@ const RemoteComponent = LingxiForwardRef<any, MyRemoteComponentProps>(
|
|
|
40
42
|
}
|
|
41
43
|
}, [url, fileCode]);
|
|
42
44
|
|
|
43
|
-
useImperativeHandle(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
useImperativeHandle(
|
|
46
|
+
ref,
|
|
47
|
+
() =>
|
|
48
|
+
mergeGetter(myRefs || {}, {
|
|
49
|
+
setCompProps: (params: any) => {
|
|
50
|
+
setProps({ ...customProps, ...params });
|
|
51
|
+
},
|
|
52
|
+
setSrc: (src: string) => {
|
|
53
|
+
if (src.startsWith('http')) {
|
|
54
|
+
setRemoteUrl(src);
|
|
55
|
+
} else {
|
|
56
|
+
// 怀疑是文件id
|
|
57
|
+
setRemoteUrl(engineApis?.getAppFileUrlByFileCode(src));
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
[myRefs],
|
|
62
|
+
);
|
|
56
63
|
|
|
57
64
|
if (!visible) {
|
|
58
65
|
return <></>;
|
|
@@ -66,6 +73,12 @@ const RemoteComponent = LingxiForwardRef<any, MyRemoteComponentProps>(
|
|
|
66
73
|
customProps={customProps}
|
|
67
74
|
url={remoteUrl}
|
|
68
75
|
getEngineApis={getEngineApis}
|
|
76
|
+
forwardRef={(refs: any) => {
|
|
77
|
+
if (refs && isDid.current === false) {
|
|
78
|
+
isDid.current = true;
|
|
79
|
+
setMyRefs(refs);
|
|
80
|
+
}
|
|
81
|
+
}}
|
|
69
82
|
/>
|
|
70
83
|
);
|
|
71
84
|
},
|
|
@@ -52,6 +52,9 @@ const LxSelector = LingxiForwardRef<any, SelectorProps>((props, ref) => {
|
|
|
52
52
|
...restProps
|
|
53
53
|
} = props;
|
|
54
54
|
const { getLocale } = getEngineApis?.() || {};
|
|
55
|
+
const [imgSrc, setImgSrc] = useState<string>();
|
|
56
|
+
const [curValue, setCurValue] = useState<any>([]);
|
|
57
|
+
const [curOptions, setCurOptions] = useState<any[]>([]);
|
|
55
58
|
const imperativeHandle = {
|
|
56
59
|
// eslint-disable-next-line consistent-return
|
|
57
60
|
getSelectedData: () => {
|
|
@@ -124,15 +127,15 @@ const LxSelector = LingxiForwardRef<any, SelectorProps>((props, ref) => {
|
|
|
124
127
|
setCurOptions(newOptions);
|
|
125
128
|
}
|
|
126
129
|
},
|
|
130
|
+
setValue: (v: any) => {
|
|
131
|
+
setCurValue(v);
|
|
132
|
+
},
|
|
127
133
|
};
|
|
128
134
|
|
|
129
135
|
const { getAppFileUrlByFileCode } = getEngineApis();
|
|
130
136
|
|
|
131
137
|
const { isForm, form, disabled, onInputChange, visible, getRules } =
|
|
132
138
|
useFormItem(ref, props as any, imperativeHandle);
|
|
133
|
-
const [imgSrc, setImgSrc] = useState<string>();
|
|
134
|
-
const [curValue, setCurValue] = useState<any>([]);
|
|
135
|
-
const [curOptions, setCurOptions] = useState<any[]>([]);
|
|
136
139
|
const myColumns: any = () => {
|
|
137
140
|
switch (columns) {
|
|
138
141
|
case 'customize':
|
|
@@ -181,14 +181,20 @@ export const getFormsByCompName = (
|
|
|
181
181
|
) => {
|
|
182
182
|
const { refs, renderRefs } = options;
|
|
183
183
|
|
|
184
|
-
Object.keys(refs).forEach((uid) => {
|
|
184
|
+
Object.keys(refs || {}).forEach((uid) => {
|
|
185
185
|
const item = refs[uid];
|
|
186
186
|
if (!item) return;
|
|
187
187
|
if (item.compName === 'DForm') {
|
|
188
188
|
forms.push(item);
|
|
189
189
|
}
|
|
190
190
|
if (['Pageview', 'BOFramer'].includes(item.compName)) {
|
|
191
|
-
getFormsByCompName(
|
|
191
|
+
getFormsByCompName(
|
|
192
|
+
{
|
|
193
|
+
refs: renderRefs.getComRefs(uid),
|
|
194
|
+
renderRefs,
|
|
195
|
+
},
|
|
196
|
+
forms,
|
|
197
|
+
);
|
|
192
198
|
}
|
|
193
199
|
});
|
|
194
200
|
|
|
@@ -219,7 +225,7 @@ export const validateFields = async (
|
|
|
219
225
|
}
|
|
220
226
|
});
|
|
221
227
|
});
|
|
222
|
-
return
|
|
228
|
+
return formValues;
|
|
223
229
|
};
|
|
224
230
|
|
|
225
231
|
// // eslint-disable-next-line max-len
|
|
@@ -110,7 +110,7 @@ const showAlert = ({
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
// 兼容pc端Modal
|
|
113
|
-
const
|
|
113
|
+
const MessageApiModal = {
|
|
114
114
|
success: showAlert,
|
|
115
115
|
info: showAlert,
|
|
116
116
|
warning: showAlert,
|
|
@@ -118,4 +118,4 @@ const Modal = {
|
|
|
118
118
|
confirm: showAlert,
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
export { messageApi,
|
|
121
|
+
export { messageApi, MessageApiModal, Spin };
|
|
@@ -172,12 +172,12 @@ const CollapsePanel = LingxiForwardRef<any, MyCollapsePanelProps>(
|
|
|
172
172
|
props.$$componentItem.uid,
|
|
173
173
|
renderRef,
|
|
174
174
|
);
|
|
175
|
-
}, []);
|
|
175
|
+
}, [children]);
|
|
176
176
|
|
|
177
177
|
useUpdateEffect(() => {
|
|
178
178
|
// 监听需要更新的属性
|
|
179
179
|
childRenderContext.update?.();
|
|
180
|
-
}, [visible]);
|
|
180
|
+
}, [visible, children]);
|
|
181
181
|
|
|
182
182
|
return null;
|
|
183
183
|
},
|
|
@@ -381,7 +381,7 @@ const Form = LingxiForwardRef<any, FormProps>((props, ref) => {
|
|
|
381
381
|
typeof onValuesChange === 'function'
|
|
382
382
|
) {
|
|
383
383
|
if (
|
|
384
|
-
engineApis?.compatConfig
|
|
384
|
+
engineApis?.compatConfig?.cmd?.setFieldsValueToOnValuesChange ===
|
|
385
385
|
true
|
|
386
386
|
) {
|
|
387
387
|
onValuesChange(key, target[key]);
|
|
@@ -232,7 +232,7 @@ const MyGrid = (props: MyGridView) => {
|
|
|
232
232
|
} = props;
|
|
233
233
|
const [values, setValues] = useState(defaultValue);
|
|
234
234
|
const { MemoRenderer } = props.getEngineApis?.();
|
|
235
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
235
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
236
236
|
|
|
237
237
|
useEffect(() => {
|
|
238
238
|
if (value !== undefined) {
|
|
@@ -333,6 +333,7 @@ const MyGrid = (props: MyGridView) => {
|
|
|
333
333
|
item,
|
|
334
334
|
i: index,
|
|
335
335
|
},
|
|
336
|
+
...getLoopItemExtraProps?.(item, index),
|
|
336
337
|
};
|
|
337
338
|
|
|
338
339
|
return (
|
|
@@ -421,7 +421,7 @@ const MyGrid = (props: MyLoopList) => {
|
|
|
421
421
|
}, []);
|
|
422
422
|
|
|
423
423
|
const { MemoRenderer } = props.getEngineApis?.();
|
|
424
|
-
const { MemoLoopItem, renderer } = MemoRenderer;
|
|
424
|
+
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
425
425
|
|
|
426
426
|
return (
|
|
427
427
|
<Row gutter={[vspace, hspace]} style={{ ...backgroundStyle, ...style }}>
|
|
@@ -448,6 +448,7 @@ const MyGrid = (props: MyLoopList) => {
|
|
|
448
448
|
item,
|
|
449
449
|
i: index,
|
|
450
450
|
},
|
|
451
|
+
...getLoopItemExtraProps?.(item, index),
|
|
451
452
|
};
|
|
452
453
|
|
|
453
454
|
return (
|
package/lib/pcpublic/src/components/pcfactory/src/RemoteComponent/components/ReactRender.tsx
CHANGED
|
@@ -16,11 +16,16 @@ export interface MyRemoteComponentProps {
|
|
|
16
16
|
customProps: any;
|
|
17
17
|
useRemoteComponent?: any; // 自定义组件调用依赖的模块,可由调用方传入
|
|
18
18
|
forwardRef?: any;
|
|
19
|
+
// 如果在动态容器里面,传入表单的name
|
|
20
|
+
name?: string;
|
|
21
|
+
// 如果在动态容器里面,传入表单fieldName
|
|
22
|
+
fieldName?: string;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
// const prefixCls = 'remoteComponent';
|
|
22
26
|
const RemoteComponent: LingXiFC<MyRemoteComponentProps> = (props) => {
|
|
23
|
-
const { url, customProps, getEngineApis, ...restProps } =
|
|
27
|
+
const { url, customProps, getEngineApis, name, fieldName, ...restProps } =
|
|
28
|
+
props;
|
|
24
29
|
|
|
25
30
|
const engineApis = getEngineApis?.() || {};
|
|
26
31
|
|
|
@@ -50,7 +55,12 @@ const RemoteComponent: LingXiFC<MyRemoteComponentProps> = (props) => {
|
|
|
50
55
|
<Component
|
|
51
56
|
{...restProps}
|
|
52
57
|
{...customProps}
|
|
53
|
-
$lxApi={{
|
|
58
|
+
$lxApi={{
|
|
59
|
+
form: dynamicDataContext.form,
|
|
60
|
+
formCode: formContext.formCode,
|
|
61
|
+
name,
|
|
62
|
+
fieldName,
|
|
63
|
+
}}
|
|
54
64
|
ref={props.forwardRef}
|
|
55
65
|
/>
|
|
56
66
|
);
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
} from '../utils';
|
|
10
10
|
import { useLocale } from '../utils/hooks/useLocale';
|
|
11
11
|
import { renderRichText } from '../utils/renderReadOnly';
|
|
12
|
+
import { DEFAULT_TOOLBARS, DEFAULT_TOOLBARS_GROUP } from './const';
|
|
12
13
|
|
|
13
14
|
const LcdpUeditorMain: LingXiFC<{ [key: string]: any }> = (props) => {
|
|
14
|
-
const { value, onChange, style, className, rootRef: ref } = props;
|
|
15
|
+
const { value, onChange, style, className, rootRef: ref, funcTypes } = props;
|
|
15
16
|
const editorRef = useRef<ILcdpUeditorInst | null>(null);
|
|
16
17
|
|
|
17
18
|
const engineApis = props.getEngineApis();
|
|
@@ -36,6 +37,36 @@ const LcdpUeditorMain: LingXiFC<{ [key: string]: any }> = (props) => {
|
|
|
36
37
|
[required, name, lang],
|
|
37
38
|
);
|
|
38
39
|
|
|
40
|
+
const toolbars = useMemo(() => {
|
|
41
|
+
if (funcTypes) {
|
|
42
|
+
const { accept = '' } = funcTypes;
|
|
43
|
+
const filterBars: string[] = [];
|
|
44
|
+
const checkBarArrs: string[] = accept
|
|
45
|
+
.split(',')
|
|
46
|
+
.filter((str: string) => str.length);
|
|
47
|
+
if (checkBarArrs.length) {
|
|
48
|
+
DEFAULT_TOOLBARS_GROUP.forEach((rows: string[], index: number) => {
|
|
49
|
+
let curItemCheckNum = 0;
|
|
50
|
+
rows.forEach((str: string) => {
|
|
51
|
+
if (checkBarArrs.includes(str)) {
|
|
52
|
+
if (str !== 'fullscreen') curItemCheckNum += 1;
|
|
53
|
+
filterBars.push(str);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
if (curItemCheckNum && index !== DEFAULT_TOOLBARS_GROUP.length - 1) {
|
|
57
|
+
filterBars.push('|');
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
if (filterBars[filterBars.length - 1] === '|') {
|
|
61
|
+
filterBars.pop();
|
|
62
|
+
}
|
|
63
|
+
return [filterBars];
|
|
64
|
+
}
|
|
65
|
+
return [[]];
|
|
66
|
+
}
|
|
67
|
+
return DEFAULT_TOOLBARS;
|
|
68
|
+
}, [funcTypes]);
|
|
69
|
+
|
|
39
70
|
const getLang = useMemo<any>(() => {
|
|
40
71
|
const langStr = lang.toLowerCase();
|
|
41
72
|
switch (langStr) {
|
|
@@ -72,7 +103,9 @@ const LcdpUeditorMain: LingXiFC<{ [key: string]: any }> = (props) => {
|
|
|
72
103
|
config={{
|
|
73
104
|
imageType: props.imageType,
|
|
74
105
|
height: props.height,
|
|
106
|
+
maximumWords: props.maximumWords,
|
|
75
107
|
}}
|
|
108
|
+
toolbars={toolbars}
|
|
76
109
|
uploadFunction={async (file) => {
|
|
77
110
|
const formData = new FormData();
|
|
78
111
|
formData.append('attach', file, file.name);
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
export const DEFAULT_TOOLBARS_GROUP = [
|
|
2
|
+
[
|
|
3
|
+
'fullscreen', // 全屏
|
|
4
|
+
'source', // 源代码
|
|
5
|
+
],
|
|
6
|
+
[
|
|
7
|
+
'undo', // 撤销
|
|
8
|
+
'redo', // 重做
|
|
9
|
+
],
|
|
10
|
+
[
|
|
11
|
+
'bold', // 加粗
|
|
12
|
+
'italic', // 斜体
|
|
13
|
+
'underline', // 下划线
|
|
14
|
+
'fontborder', // 字符边框
|
|
15
|
+
'strikethrough', // 删除线
|
|
16
|
+
'superscript', // 上标
|
|
17
|
+
'subscript', // 下标
|
|
18
|
+
'removeformat', // 清除格式
|
|
19
|
+
'formatmatch', // 格式刷
|
|
20
|
+
'autotypeset', // 自动排版
|
|
21
|
+
'blockquote', // 引用
|
|
22
|
+
'pasteplain', // 纯文本粘贴模式
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
'forecolor', // 字体颜色
|
|
26
|
+
'backcolor', // 背景色
|
|
27
|
+
'insertorderedlist', // 有序列表
|
|
28
|
+
'insertunorderedlist', // 无序列表
|
|
29
|
+
'selectall', // 全选
|
|
30
|
+
'cleardoc', // 清空文档
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
'rowspacingtop', // 段前距
|
|
34
|
+
'rowspacingbottom', // 段后距
|
|
35
|
+
'lineheight', // 行间距
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
'customstyle', // 自定义标题
|
|
39
|
+
'paragraph', // 段落格式
|
|
40
|
+
'fontfamily', // 字体
|
|
41
|
+
'fontsize', // 字号
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
'directionalityltr', // 从左向右输入
|
|
45
|
+
'directionalityrtl', // 从右向左输入
|
|
46
|
+
'indent', // 首行缩进
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
'justifyleft', // 居左对齐
|
|
50
|
+
'justifycenter', // 居中对齐
|
|
51
|
+
'justifyright',
|
|
52
|
+
'justifyjustify', // 两端对齐
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
'touppercase', // 字母大写
|
|
56
|
+
'tolowercase', // 字母小写
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
'link', // 超链接
|
|
60
|
+
'unlink', // 取消链接
|
|
61
|
+
'anchor', // 锚点
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
'imagenone', // 图片默认
|
|
65
|
+
'imageleft', // 图片左浮动
|
|
66
|
+
'imageright', // 图片右浮动
|
|
67
|
+
'imagecenter', // 图片居中
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
'simpleupload', // 单图上传
|
|
71
|
+
'insertimage', // 多图上传
|
|
72
|
+
'insertvideo', // 视频
|
|
73
|
+
'insertaudio', // 音频
|
|
74
|
+
'attachment', // 附件
|
|
75
|
+
'insertframe', // 插入Iframe
|
|
76
|
+
'insertcode', // 插入代码
|
|
77
|
+
'pagebreak', // 分页
|
|
78
|
+
'background', // 背景
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
'horizontal', // 分隔线
|
|
82
|
+
'date', // 日期
|
|
83
|
+
'time', // 时间
|
|
84
|
+
'spechars', // 特殊字符
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
'inserttable', // 插入表格
|
|
88
|
+
'deletetable', // 删除表格
|
|
89
|
+
'insertparagraphbeforetable', // 表格前插入行
|
|
90
|
+
'insertrow', // 前插入行
|
|
91
|
+
'deleterow', // 删除行
|
|
92
|
+
'insertcol', // 前插入列
|
|
93
|
+
'deletecol', // 删除列
|
|
94
|
+
'mergecells', // 合并多个单元格
|
|
95
|
+
'mergeright', // 右合并单元格
|
|
96
|
+
'mergedown', // 下合并单元格
|
|
97
|
+
'splittocells', // 完全拆分单元格
|
|
98
|
+
'splittorows', // 拆分成行
|
|
99
|
+
'splittocols', // 拆分成列
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
'print', // 打印
|
|
103
|
+
],
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
export const DEFAULT_TOOLBARS = [
|
|
107
|
+
[
|
|
108
|
+
'fullscreen', // 全屏
|
|
109
|
+
'source', // 源代码
|
|
110
|
+
'|',
|
|
111
|
+
'undo', // 撤销
|
|
112
|
+
'redo', // 重做
|
|
113
|
+
'|',
|
|
114
|
+
'bold', // 加粗
|
|
115
|
+
'italic', // 斜体
|
|
116
|
+
'underline', // 下划线
|
|
117
|
+
'fontborder', // 字符边框
|
|
118
|
+
'strikethrough', // 删除线
|
|
119
|
+
'superscript', // 上标
|
|
120
|
+
'subscript', // 下标
|
|
121
|
+
'removeformat', // 清除格式
|
|
122
|
+
'formatmatch', // 格式刷
|
|
123
|
+
'autotypeset', // 自动排版
|
|
124
|
+
'blockquote', // 引用
|
|
125
|
+
'pasteplain', // 纯文本粘贴模式
|
|
126
|
+
'|',
|
|
127
|
+
'forecolor', // 字体颜色
|
|
128
|
+
'backcolor', // 背景色
|
|
129
|
+
'insertorderedlist', // 有序列表
|
|
130
|
+
'insertunorderedlist', // 无序列表
|
|
131
|
+
'selectall', // 全选
|
|
132
|
+
'cleardoc', // 清空文档
|
|
133
|
+
'|',
|
|
134
|
+
'rowspacingtop', // 段前距
|
|
135
|
+
'rowspacingbottom', // 段后距
|
|
136
|
+
'lineheight', // 行间距
|
|
137
|
+
'|',
|
|
138
|
+
'customstyle', // 自定义标题
|
|
139
|
+
'paragraph', // 段落格式
|
|
140
|
+
'fontfamily', // 字体
|
|
141
|
+
'fontsize', // 字号
|
|
142
|
+
'|',
|
|
143
|
+
'directionalityltr', // 从左向右输入
|
|
144
|
+
'directionalityrtl', // 从右向左输入
|
|
145
|
+
'indent', // 首行缩进
|
|
146
|
+
'|',
|
|
147
|
+
'justifyleft', // 居左对齐
|
|
148
|
+
'justifycenter', // 居中对齐
|
|
149
|
+
'justifyright',
|
|
150
|
+
'justifyjustify', // 两端对齐
|
|
151
|
+
'|',
|
|
152
|
+
'touppercase', // 字母大写
|
|
153
|
+
'tolowercase', // 字母小写
|
|
154
|
+
'|',
|
|
155
|
+
'link', // 超链接
|
|
156
|
+
'unlink', // 取消链接
|
|
157
|
+
'anchor', // 锚点
|
|
158
|
+
'|',
|
|
159
|
+
'imagenone', // 图片默认
|
|
160
|
+
'imageleft', // 图片左浮动
|
|
161
|
+
'imagecenter', // 图片居中
|
|
162
|
+
'imageright', // 图片右浮动
|
|
163
|
+
'|',
|
|
164
|
+
'simpleupload', // 单图上传
|
|
165
|
+
'insertimage', // 多图上传
|
|
166
|
+
// "emotion", // 表情
|
|
167
|
+
// "scrawl", // 涂鸦
|
|
168
|
+
'insertvideo', // 视频
|
|
169
|
+
'insertaudio', // 音频
|
|
170
|
+
'attachment', // 附件
|
|
171
|
+
'insertframe', // 插入Iframe
|
|
172
|
+
'insertcode', // 插入代码
|
|
173
|
+
'pagebreak', // 分页
|
|
174
|
+
// "template", // 模板
|
|
175
|
+
'background', // 背景
|
|
176
|
+
// "formula", // 公式
|
|
177
|
+
'|',
|
|
178
|
+
'horizontal', // 分隔线
|
|
179
|
+
'date', // 日期
|
|
180
|
+
'time', // 时间
|
|
181
|
+
'spechars', // 特殊字符
|
|
182
|
+
// "wordimage", // Word图片转存
|
|
183
|
+
'|',
|
|
184
|
+
'inserttable', // 插入表格
|
|
185
|
+
'deletetable', // 删除表格
|
|
186
|
+
'insertparagraphbeforetable', // 表格前插入行
|
|
187
|
+
'insertrow', // 前插入行
|
|
188
|
+
'deleterow', // 删除行
|
|
189
|
+
'insertcol', // 前插入列
|
|
190
|
+
'deletecol', // 删除列
|
|
191
|
+
'mergecells', // 合并多个单元格
|
|
192
|
+
'mergeright', // 右合并单元格
|
|
193
|
+
'mergedown', // 下合并单元格
|
|
194
|
+
'splittocells', // 完全拆分单元格
|
|
195
|
+
'splittorows', // 拆分成行
|
|
196
|
+
'splittocols', // 拆分成列
|
|
197
|
+
'|',
|
|
198
|
+
'print', // 打印
|
|
199
|
+
// "preview", // 预览
|
|
200
|
+
// "searchreplace", // 查询替换
|
|
201
|
+
// "|",
|
|
202
|
+
// "contentimport",
|
|
203
|
+
// "help", // 帮助
|
|
204
|
+
],
|
|
205
|
+
];
|
|
@@ -24,6 +24,7 @@ export interface MyStepsProps {
|
|
|
24
24
|
stepStyle: 'number' | 'icon' | 'dot';
|
|
25
25
|
size: 'small' | 'default';
|
|
26
26
|
iconSetting: IconSettingItem[];
|
|
27
|
+
onClick?: (value: number, obj: any) => void;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
interface IconSettingItem {
|
|
@@ -73,6 +74,7 @@ const MySteps = LingxiForwardRef<any, MyStepsProps>((props, ref) => {
|
|
|
73
74
|
size,
|
|
74
75
|
iconSetting = getDefaultIconSetting(getLocale),
|
|
75
76
|
alias = {},
|
|
77
|
+
onClick,
|
|
76
78
|
...restProps
|
|
77
79
|
} = props;
|
|
78
80
|
const {
|
|
@@ -314,7 +316,17 @@ const MySteps = LingxiForwardRef<any, MyStepsProps>((props, ref) => {
|
|
|
314
316
|
labelPlacement={stepStyle === 'dot' ? 'vertical' : labelPlacement} // 点状标签位置只能在下方
|
|
315
317
|
current={current}
|
|
316
318
|
onChange={(c) => {
|
|
317
|
-
|
|
319
|
+
// 如果配置了点击事件,优先执行点击事件,不更改步骤状态,如果没有点击事件,有值变化回掉事件,更改步骤状态
|
|
320
|
+
if (
|
|
321
|
+
typeof onClick === 'function' &&
|
|
322
|
+
!innerDataSource[c]?.[disabledAlias]
|
|
323
|
+
) {
|
|
324
|
+
onClick(c, innerDataSource[c]);
|
|
325
|
+
// 如果有配置值变化回掉事件,也执行值变化回掉事件,但是不切换步骤状态
|
|
326
|
+
if (typeof onChange === 'function') {
|
|
327
|
+
onChange(c, innerDataSource[c]);
|
|
328
|
+
}
|
|
329
|
+
} else if (onChange && !innerDataSource[c]?.[disabledAlias]) {
|
|
318
330
|
onChange(c, innerDataSource[c]);
|
|
319
331
|
onCurrentChange(c);
|
|
320
332
|
}
|
|
@@ -1258,10 +1258,10 @@ const useColumns = (props: any) => {
|
|
|
1258
1258
|
const isLineNumSet =
|
|
1259
1259
|
c.lineNum && typeof c.lineNum === 'number' && c.lineNum > 0;
|
|
1260
1260
|
if (isLineNumSet) {
|
|
1261
|
-
const lineHeight = size === 'small' ? 16 : 20;
|
|
1261
|
+
// const lineHeight = size === 'small' ? 16 : 20;
|
|
1262
1262
|
controllLineStyle = {
|
|
1263
|
-
lineHeight: `${lineHeight}px`,
|
|
1264
|
-
maxHeight: `${lineHeight * c.lineNum}px`,
|
|
1263
|
+
// lineHeight: `${lineHeight}px`,
|
|
1264
|
+
// maxHeight: `${lineHeight * c.lineNum}px`,
|
|
1265
1265
|
WebkitLineClamp: c.lineNum,
|
|
1266
1266
|
};
|
|
1267
1267
|
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export const PlatformOS = () => {
|
|
2
|
+
const userAgent = window.navigator.userAgent.toLowerCase();
|
|
3
|
+
return {
|
|
4
|
+
get iOS() {
|
|
5
|
+
if (
|
|
6
|
+
userAgent.indexOf('ios') !== -1 ||
|
|
7
|
+
userAgent.indexOf('iphone') !== -1
|
|
8
|
+
) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
},
|
|
13
|
+
get Android() {
|
|
14
|
+
if (userAgent.indexOf('android') !== -1) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
},
|
|
19
|
+
get WeChat() {
|
|
20
|
+
if (userAgent.indexOf('/micromessenger/i') !== -1) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
},
|
|
25
|
+
get Dingtalk() {
|
|
26
|
+
if (userAgent.indexOf('/dingtalk/i') !== -1) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
},
|
|
31
|
+
get Chrome() {
|
|
32
|
+
if (userAgent.indexOf('Chrome') !== -1) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
},
|
|
37
|
+
get Firefox() {
|
|
38
|
+
if (userAgent.indexOf('Firefox') !== -1) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
},
|
|
43
|
+
get Safari() {
|
|
44
|
+
if (userAgent.indexOf('Safari') !== -1) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
},
|
|
49
|
+
get Edge() {
|
|
50
|
+
if (userAgent.indexOf('Edge') !== -1) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
},
|
|
55
|
+
get IE() {
|
|
56
|
+
if (userAgent.indexOf('Trident') !== -1) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
},
|
|
61
|
+
get Name() {
|
|
62
|
+
if (
|
|
63
|
+
userAgent.indexOf('ios') !== -1 ||
|
|
64
|
+
userAgent.indexOf('iphone') !== -1
|
|
65
|
+
) {
|
|
66
|
+
return 'ios';
|
|
67
|
+
}
|
|
68
|
+
if (userAgent.indexOf('android') !== -1) {
|
|
69
|
+
return 'android';
|
|
70
|
+
}
|
|
71
|
+
if (userAgent.indexOf('/micromessenger/i') !== -1) {
|
|
72
|
+
return 'wechat';
|
|
73
|
+
}
|
|
74
|
+
if (userAgent.indexOf('/dingtalk/i') !== -1) {
|
|
75
|
+
return 'dingtalk';
|
|
76
|
+
}
|
|
77
|
+
if (userAgent.indexOf('Chrome') !== -1) {
|
|
78
|
+
return 'chrome';
|
|
79
|
+
}
|
|
80
|
+
if (userAgent.indexOf('Firefox') !== -1) {
|
|
81
|
+
return 'firefox';
|
|
82
|
+
}
|
|
83
|
+
if (userAgent.indexOf('Safari') !== -1) {
|
|
84
|
+
return 'safari';
|
|
85
|
+
}
|
|
86
|
+
if (userAgent.indexOf('Edge') !== -1) {
|
|
87
|
+
return 'edge';
|
|
88
|
+
}
|
|
89
|
+
if (userAgent.indexOf('Trident') !== -1) {
|
|
90
|
+
return 'ie';
|
|
91
|
+
}
|
|
92
|
+
return 'other';
|
|
93
|
+
},
|
|
94
|
+
get isIponeliuHaiping() {
|
|
95
|
+
if (this.iOS) {
|
|
96
|
+
// 获取屏幕高度和宽度
|
|
97
|
+
const screenHeight = window.screen.height;
|
|
98
|
+
const screenWidth = window.screen.width;
|
|
99
|
+
// iPhone X/XS/11 Pro等的分辨率为1125x2436
|
|
100
|
+
// iPhone XR/11的分辨率为828x1792
|
|
101
|
+
// iPhone XS Max/11 Pro Max的分辨率为1242x2688
|
|
102
|
+
if (
|
|
103
|
+
(screenHeight === 812 && screenWidth === 375) || // iPhone X/XS/11 Pro
|
|
104
|
+
(screenHeight === 896 && screenWidth === 414)
|
|
105
|
+
) {
|
|
106
|
+
// iPhone XR/11/11 Pro Max
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const LcdpTerminalType = {
|
|
117
|
+
isIOS: PlatformOS().iOS,
|
|
118
|
+
isAndroid: PlatformOS().Android,
|
|
119
|
+
isIE: PlatformOS().IE,
|
|
120
|
+
isWeChat: PlatformOS().WeChat,
|
|
121
|
+
isChrome: PlatformOS().Chrome,
|
|
122
|
+
isSafari: PlatformOS().Safari,
|
|
123
|
+
isEdge: PlatformOS().Edge,
|
|
124
|
+
isDingtalk: PlatformOS().Dingtalk,
|
|
125
|
+
|
|
126
|
+
Name: PlatformOS().Name,
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 是否是iphone的刘海屏
|
|
130
|
+
*/
|
|
131
|
+
isIphonex: PlatformOS().isIponeliuHaiping,
|
|
132
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { get, isArray, mergeWith, set } from 'lodash';
|
|
1
|
+
import { get, isArray, isPlainObject, mergeWith, set } from 'lodash';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 往数组中添加数据元素
|
|
@@ -142,6 +142,36 @@ const updateObject = (options: {
|
|
|
142
142
|
return newData;
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* 树状结构扁平化成数组对象
|
|
147
|
+
* @param origin
|
|
148
|
+
* @param deepPath
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
export const flattenArr = (
|
|
152
|
+
origin: Record<string, any> | Record<string, any>[],
|
|
153
|
+
deepPath: string,
|
|
154
|
+
) => {
|
|
155
|
+
const target: any = [];
|
|
156
|
+
|
|
157
|
+
const treeLoop = (data?: any) => {
|
|
158
|
+
const arr = get(data, deepPath);
|
|
159
|
+
if (Array.isArray(arr)) {
|
|
160
|
+
target.push(...arr);
|
|
161
|
+
arr.forEach(treeLoop);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
if (Array.isArray(origin)) {
|
|
166
|
+
target.push(...origin);
|
|
167
|
+
origin.forEach(treeLoop);
|
|
168
|
+
} else if (isPlainObject(origin)) {
|
|
169
|
+
treeLoop(origin);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return target;
|
|
173
|
+
};
|
|
174
|
+
|
|
145
175
|
export default {
|
|
146
176
|
remove,
|
|
147
177
|
push,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
visible: (visible: any) => {
|
|
3
|
+
if (typeof visible === 'boolean') {
|
|
4
|
+
return visible;
|
|
5
|
+
}
|
|
6
|
+
if (typeof visible === 'string') {
|
|
7
|
+
// 兼容PC 1是普通,2是隐藏的写法
|
|
8
|
+
if (visible === '1') {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (visible === '2') {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (visible.toLowerCase() === 'false') {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (visible.toLowerCase() === 'true') {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (typeof visible === 'number') {
|
|
22
|
+
if (visible === 1) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (visible === 2 || visible === 0) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
},
|
|
31
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxiteam/ebe-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@babel/parser": "^7.12.12",
|
|
18
18
|
"@babel/traverse": "^7.12.12",
|
|
19
19
|
"@babel/types": "^7.12.12",
|
|
20
|
-
"@lingxiteam/ebe": "0.0.
|
|
20
|
+
"@lingxiteam/ebe": "0.0.24",
|
|
21
21
|
"cac": "^6.7.14",
|
|
22
22
|
"fs-extra": "9.x"
|
|
23
23
|
},
|