@canlooks/can-ui 0.0.52 → 0.0.53
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.
|
@@ -58,7 +58,13 @@ curdProps, ...props }) => {
|
|
|
58
58
|
innerOpen.current && setFormValue(activeRow);
|
|
59
59
|
}, [innerOpen.current]); // 依赖innerOpen而不依赖activeRow的原因是,有可能连续两次打开的activeRow是相同的
|
|
60
60
|
const renderedFormItems = (0, react_2.useMemo)(() => {
|
|
61
|
-
return (0, utils_1.columnsToFormItem)(columns, activeRow)?.map(
|
|
61
|
+
return (0, utils_1.columnsToFormItem)(columns, activeRow)?.map(col => {
|
|
62
|
+
if ((0, react_2.isValidElement)(col)) {
|
|
63
|
+
return col;
|
|
64
|
+
}
|
|
65
|
+
const { key, ...p } = col;
|
|
66
|
+
return (0, react_1.createElement)(form_1.FormItem, { ...p, key: key });
|
|
67
|
+
});
|
|
62
68
|
}, [columns, activeRow]);
|
|
63
69
|
/**
|
|
64
70
|
* ----------------------------------------------------------------
|
package/dist/cjs/utils/curd.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { CurdColumn, CurdFormItemProps, CurdProps } from '../components/curd';
|
|
2
3
|
import { ColumnType, RowType } from '../components/dataGrid';
|
|
3
4
|
import { Id, Obj } from '../types';
|
|
@@ -6,13 +7,13 @@ import { FormValue } from '../components/form';
|
|
|
6
7
|
* 将Curd的Columns转换为FilterItem
|
|
7
8
|
* @param columns
|
|
8
9
|
*/
|
|
9
|
-
export declare function columnsToFilterItem(columns?: (CurdColumn<any> | symbol)[]): CurdFormItemProps[] | undefined;
|
|
10
|
+
export declare function columnsToFilterItem(columns?: (CurdColumn<any> | symbol)[]): (ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | CurdFormItemProps)[] | undefined;
|
|
10
11
|
/**
|
|
11
12
|
* 将Curd的Columns转换为FormItem
|
|
12
13
|
* @param columns
|
|
13
14
|
* @param row
|
|
14
15
|
*/
|
|
15
|
-
export declare function columnsToFormItem(columns?: (CurdColumn<any> | symbol)[], row?: Obj): CurdFormItemProps[] | undefined;
|
|
16
|
+
export declare function columnsToFormItem(columns?: (CurdColumn<any> | symbol)[], row?: Obj): (ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | CurdFormItemProps)[] | undefined;
|
|
16
17
|
/**
|
|
17
18
|
* 统一处理Columns
|
|
18
19
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { createElement as _createElement } from "@emotion/react";
|
|
3
|
-
import { memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { memo, useEffect, useImperativeHandle, useMemo, useRef, useState, isValidElement } from 'react';
|
|
4
4
|
import { Dialog } from '../dialog';
|
|
5
5
|
import { Form, FormItem } from '../form';
|
|
6
6
|
import { Curd } from './curd';
|
|
@@ -55,7 +55,13 @@ curdProps, ...props }) => {
|
|
|
55
55
|
innerOpen.current && setFormValue(activeRow);
|
|
56
56
|
}, [innerOpen.current]); // 依赖innerOpen而不依赖activeRow的原因是,有可能连续两次打开的activeRow是相同的
|
|
57
57
|
const renderedFormItems = useMemo(() => {
|
|
58
|
-
return columnsToFormItem(columns, activeRow)?.map(
|
|
58
|
+
return columnsToFormItem(columns, activeRow)?.map(col => {
|
|
59
|
+
if (isValidElement(col)) {
|
|
60
|
+
return col;
|
|
61
|
+
}
|
|
62
|
+
const { key, ...p } = col;
|
|
63
|
+
return _createElement(FormItem, { ...p, key: key });
|
|
64
|
+
});
|
|
59
65
|
}, [columns, activeRow]);
|
|
60
66
|
/**
|
|
61
67
|
* ----------------------------------------------------------------
|
package/dist/esm/utils/curd.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { CurdColumn, CurdFormItemProps, CurdProps } from '../components/curd';
|
|
2
3
|
import { ColumnType, RowType } from '../components/dataGrid';
|
|
3
4
|
import { Id, Obj } from '../types';
|
|
@@ -6,13 +7,13 @@ import { FormValue } from '../components/form';
|
|
|
6
7
|
* 将Curd的Columns转换为FilterItem
|
|
7
8
|
* @param columns
|
|
8
9
|
*/
|
|
9
|
-
export declare function columnsToFilterItem(columns?: (CurdColumn<any> | symbol)[]): CurdFormItemProps[] | undefined;
|
|
10
|
+
export declare function columnsToFilterItem(columns?: (CurdColumn<any> | symbol)[]): (ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | CurdFormItemProps)[] | undefined;
|
|
10
11
|
/**
|
|
11
12
|
* 将Curd的Columns转换为FormItem
|
|
12
13
|
* @param columns
|
|
13
14
|
* @param row
|
|
14
15
|
*/
|
|
15
|
-
export declare function columnsToFormItem(columns?: (CurdColumn<any> | symbol)[], row?: Obj): CurdFormItemProps[] | undefined;
|
|
16
|
+
export declare function columnsToFormItem(columns?: (CurdColumn<any> | symbol)[], row?: Obj): (ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | CurdFormItemProps)[] | undefined;
|
|
16
17
|
/**
|
|
17
18
|
* 统一处理Columns
|
|
18
19
|
*/
|