@teamix/pro 1.1.4 → 1.1.8
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/README.md +97 -0
- package/dist/212.js +2 -2
- package/dist/pro.css +1 -1
- package/dist/pro.js +3147 -1872
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +1 -1
- package/es/actions/dialog-form.d.ts +3 -3
- package/es/actions/dialog-table.d.ts +6 -1
- package/es/actions/dialog-table.js +10 -1
- package/es/actions/drawer-table.d.ts +4 -0
- package/es/actions/drawer-table.js +7 -1
- package/es/actions/index.d.ts +6 -11
- package/es/actions/index.js +41 -21
- package/es/actions/index.scss +1 -1
- package/es/card/index.d.ts +17 -0
- package/es/form/Components/ProField/index.d.ts +8 -0
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +9 -2
- package/es/form/ProForm/index.scss +40 -7
- package/es/form/SchemaForm/adapterType.js +3 -3
- package/es/form/SchemaForm/index.d.ts +2 -2
- package/es/form/SchemaForm/index.js +9 -5
- package/es/form/SchemaForm/initializeArrayCards.js +10 -55
- package/es/form/SchemaForm/initializeArrayCollapse.js +10 -64
- package/es/form/SchemaForm/initializeArrayIcon.js +19 -7
- package/es/form/SchemaForm/initializeArrayItems.js +16 -75
- package/es/form/SchemaForm/initializeArrayTable.js +23 -33
- package/es/form/SchemaForm/initializeFormButton.js +35 -38
- package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormStep.d.ts +4 -2
- package/es/form/SchemaForm/initializeFormStep.js +21 -7
- package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/es/form/SchemaForm/initializeProField.js +3 -3
- package/es/form/SchemaForm/reactions.d.ts +1 -1
- package/es/form/SchemaForm/reactions.js +2 -2
- package/es/form/index.d.ts +17 -9
- package/es/form/index.js +21 -9
- package/es/form/typing.d.ts +13 -22
- package/es/form/warning.js +2 -6
- package/es/index.d.ts +4 -3
- package/es/index.js +4 -3
- package/es/info/components/FormItem/index.js +4 -4
- package/es/info/components/FormItem/index.scss +11 -0
- package/es/info/components/InfoGroup/index.js +37 -6
- package/es/info/components/InfoGroup/index.scss +6 -0
- package/es/info/components/InfoValueItem/index.js +14 -2
- package/es/info/components/baseInfo/index.js +10 -9
- package/es/info/components/headerInfo/index.js +10 -9
- package/es/info/components/tableInfo/index.js +7 -4
- package/es/info/components/tableInfo/index.scss +1 -1
- package/es/info/index.d.ts +1 -0
- package/es/info/index.js +9 -7
- package/es/info/index.scss +4 -0
- package/es/info/typing.d.ts +17 -3
- package/es/info/utils/index.d.ts +11 -2
- package/es/info/utils/index.js +21 -0
- package/es/nocode/configurators/PageHeader.js +49 -43
- package/es/nocode/configurators/ProTable.js +12 -9
- package/es/nocode/configurators/common.d.ts +117 -105
- package/es/nocode/configurators/common.js +38 -34
- package/es/nocode/index.scss +1 -4
- package/es/page-header/index.d.ts +3 -0
- package/es/page-header/index.js +40 -13
- package/es/page-header/index.scss +6 -4
- package/es/table/components/Filter/index.js +8 -16
- package/es/table/components/Layout/index.js +2 -1
- package/es/table/components/Layout/index.scss +1 -1
- package/es/table/components/ToolBar/FilterColumnIcon.js +77 -17
- package/es/table/components/ToolBar/index.scss +10 -0
- package/es/table/index.d.ts +0 -1
- package/es/table/index.js +75 -56
- package/es/table/index.scss +0 -1
- package/es/table/typing.d.ts +3 -1
- package/lib/actions/dialog-form.d.ts +3 -3
- package/lib/actions/dialog-table.d.ts +6 -1
- package/lib/actions/dialog-table.js +20 -1
- package/lib/actions/drawer-table.d.ts +4 -0
- package/lib/actions/drawer-table.js +14 -1
- package/lib/actions/index.d.ts +6 -11
- package/lib/actions/index.js +44 -20
- package/lib/actions/index.scss +1 -1
- package/lib/card/index.d.ts +17 -0
- package/lib/form/Components/ProField/index.d.ts +8 -0
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +10 -2
- package/lib/form/ProForm/index.scss +40 -7
- package/lib/form/SchemaForm/adapterType.js +3 -3
- package/lib/form/SchemaForm/index.d.ts +2 -2
- package/lib/form/SchemaForm/index.js +10 -5
- package/lib/form/SchemaForm/initializeArrayCards.js +10 -54
- package/lib/form/SchemaForm/initializeArrayCollapse.js +10 -63
- package/lib/form/SchemaForm/initializeArrayIcon.js +19 -7
- package/lib/form/SchemaForm/initializeArrayItems.js +16 -74
- package/lib/form/SchemaForm/initializeArrayTable.js +23 -33
- package/lib/form/SchemaForm/initializeFormButton.js +35 -38
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormStep.d.ts +4 -2
- package/lib/form/SchemaForm/initializeFormStep.js +21 -7
- package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/lib/form/SchemaForm/initializeProField.js +3 -3
- package/lib/form/SchemaForm/reactions.d.ts +1 -1
- package/lib/form/SchemaForm/reactions.js +2 -2
- package/lib/form/index.d.ts +17 -9
- package/lib/form/index.js +81 -56
- package/lib/form/typing.d.ts +13 -22
- package/lib/form/warning.js +2 -6
- package/lib/index.d.ts +4 -3
- package/lib/index.js +16 -4
- package/lib/info/components/FormItem/index.js +4 -4
- package/lib/info/components/FormItem/index.scss +11 -0
- package/lib/info/components/InfoGroup/index.js +46 -6
- package/lib/info/components/InfoGroup/index.scss +6 -0
- package/lib/info/components/InfoValueItem/index.js +15 -3
- package/lib/info/components/baseInfo/index.js +10 -9
- package/lib/info/components/headerInfo/index.js +11 -10
- package/lib/info/components/tableInfo/index.js +7 -3
- package/lib/info/components/tableInfo/index.scss +1 -1
- package/lib/info/index.d.ts +1 -0
- package/lib/info/index.js +8 -6
- package/lib/info/index.scss +4 -0
- package/lib/info/typing.d.ts +17 -3
- package/lib/info/utils/index.d.ts +11 -2
- package/lib/info/utils/index.js +31 -0
- package/lib/nocode/configurators/PageHeader.js +49 -43
- package/lib/nocode/configurators/ProTable.js +12 -9
- package/lib/nocode/configurators/common.d.ts +117 -105
- package/lib/nocode/configurators/common.js +38 -34
- package/lib/nocode/index.scss +1 -4
- package/lib/page-header/index.d.ts +3 -0
- package/lib/page-header/index.js +42 -13
- package/lib/page-header/index.scss +6 -4
- package/lib/table/components/Filter/index.js +7 -15
- package/lib/table/components/Layout/index.js +2 -1
- package/lib/table/components/Layout/index.scss +1 -1
- package/lib/table/components/ToolBar/FilterColumnIcon.js +75 -16
- package/lib/table/components/ToolBar/index.scss +10 -0
- package/lib/table/index.d.ts +0 -1
- package/lib/table/index.js +76 -65
- package/lib/table/index.scss +0 -1
- package/lib/table/typing.d.ts +3 -1
- package/package.json +5 -5
@@ -1,13 +1,13 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { IFormProps, IFormSchema } from '../form';
|
3
3
|
import { RequestAction } from './request';
|
4
4
|
import { DialogAction } from './dialog';
|
5
5
|
export interface DialogFormAction extends DialogAction {
|
6
6
|
initialValues?: any;
|
7
7
|
initialRequest?: RequestAction;
|
8
8
|
useFieldValuesForRequest?: boolean;
|
9
|
-
formProps?:
|
10
|
-
schema:
|
9
|
+
formProps?: Omit<IFormProps, 'schema'>;
|
10
|
+
schema: IFormSchema;
|
11
11
|
}
|
12
12
|
export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
|
13
13
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
@@ -1,4 +1,9 @@
|
|
1
1
|
import { DialogAction } from './dialog';
|
2
|
+
import { ProTableProps } from '..';
|
2
3
|
export interface DialogTableAction extends DialogAction {
|
3
|
-
schema:
|
4
|
+
schema: ProTableProps;
|
4
5
|
}
|
6
|
+
export declare function useDialogTableAction(action: DialogTableAction, context?: any): {
|
7
|
+
[x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
|
8
|
+
};
|
9
|
+
export default useDialogTableAction;
|
@@ -1 +1,10 @@
|
|
1
|
-
|
1
|
+
import useDialogAction from './dialog';
|
2
|
+
import { ProTable } from '..';
|
3
|
+
export function useDialogTableAction(action, context) {
|
4
|
+
return useDialogAction(Object.assign({
|
5
|
+
component: ProTable,
|
6
|
+
closeable: true,
|
7
|
+
size: 'medium'
|
8
|
+
}, action), context);
|
9
|
+
}
|
10
|
+
export default useDialogTableAction;
|
@@ -1,2 +1,6 @@
|
|
1
1
|
import { DialogTableAction } from './dialog-table';
|
2
2
|
export declare type DrawerTableAction = DialogTableAction;
|
3
|
+
export declare function useDrawerTableAction(action: DrawerTableAction, context?: any): {
|
4
|
+
[x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
|
5
|
+
};
|
6
|
+
export default useDrawerTableAction;
|
package/es/actions/index.d.ts
CHANGED
@@ -51,26 +51,21 @@ export interface IActionButton extends ButtonProps {
|
|
51
51
|
}
|
52
52
|
export declare const ActionButton: (props: IActionButton) => JSX.Element;
|
53
53
|
export interface IActionMenuButton extends MenuButtonProps {
|
54
|
-
actions:
|
54
|
+
actions: ICommonActionButton[];
|
55
55
|
visible?: any;
|
56
56
|
icon?: string;
|
57
57
|
context?: any;
|
58
58
|
}
|
59
|
-
export
|
60
|
-
|
61
|
-
icon?: string;
|
62
|
-
context?: any;
|
63
|
-
}
|
64
|
-
export declare const ActionMenuButton: (props: IActionGroupMenuButton) => JSX.Element;
|
65
|
-
export declare type CommonActionButton = IActionButton | IActionMenuButton;
|
66
|
-
export declare type CommonActionGroupButton = CommonActionButton | IActionGroupMenuButton;
|
59
|
+
export declare const ActionMenuButton: (props: IActionMenuButton) => JSX.Element;
|
60
|
+
export declare type ICommonActionButton = IActionButton | IActionMenuButton;
|
67
61
|
export declare type ActionGroupProps = {
|
68
62
|
type?: 'button' | 'text';
|
69
63
|
context?: any;
|
70
|
-
actions:
|
64
|
+
actions: ICommonActionButton[];
|
71
65
|
max?: number;
|
72
66
|
moreText?: string;
|
73
67
|
divider?: boolean;
|
74
68
|
} & React.HTMLAttributes<HTMLElement>;
|
75
69
|
export declare function ActionGroup(props: ActionGroupProps): JSX.Element;
|
76
|
-
|
70
|
+
declare const _default: (props: ICommonActionButton) => JSX.Element;
|
71
|
+
export default _default;
|
package/es/actions/index.js
CHANGED
@@ -31,7 +31,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
31
31
|
|
32
32
|
import React from 'react';
|
33
33
|
import cls from 'classnames';
|
34
|
-
import { Button, MenuButton, Divider } from '@alicloudfe/components';
|
34
|
+
import { Button, MenuButton, Menu, Divider } from '@alicloudfe/components';
|
35
35
|
import Icon from '@teamix/icon';
|
36
36
|
import { getTargetValue } from '@teamix/utils';
|
37
37
|
import { useLinkAction } from './link';
|
@@ -42,8 +42,10 @@ import { useDangerConfirmAction } from './danger-confirm';
|
|
42
42
|
import { useNoticeAction } from './notice';
|
43
43
|
import { useErrorAction } from './error';
|
44
44
|
import { useDialogFormAction } from './dialog-form';
|
45
|
+
import { useDialogTableAction } from './dialog-table';
|
45
46
|
import { useDrawerAction } from './drawer';
|
46
47
|
import { useDrawerFormAction } from './drawer-form';
|
48
|
+
import { useDrawerTableAction } from './drawer-table';
|
47
49
|
import './index.scss';
|
48
50
|
var RegistedActions = new Map();
|
49
51
|
export function registerActionHandler(id, extendActionId, defaultConfig) {
|
@@ -92,6 +94,10 @@ export var useAction = function useAction(config, context) {
|
|
92
94
|
return useDialogFormAction(others, context);
|
93
95
|
}
|
94
96
|
|
97
|
+
if (type === 'dialog-table') {
|
98
|
+
return useDialogTableAction(others, context);
|
99
|
+
}
|
100
|
+
|
95
101
|
if (type === 'drawer') {
|
96
102
|
return useDrawerAction(others, context);
|
97
103
|
}
|
@@ -100,6 +106,10 @@ export var useAction = function useAction(config, context) {
|
|
100
106
|
return useDrawerFormAction(others, context);
|
101
107
|
}
|
102
108
|
|
109
|
+
if (type === 'drawer-table') {
|
110
|
+
return useDrawerTableAction(others, context);
|
111
|
+
}
|
112
|
+
|
103
113
|
var registedAction = RegistedActions.get(type);
|
104
114
|
|
105
115
|
if (!registedAction) {
|
@@ -161,9 +171,25 @@ function renderMenuButtonItem(item, key, context) {
|
|
161
171
|
return item.onClick(e, context);
|
162
172
|
}
|
163
173
|
}) : _objectSpread({}, menuItemProps);
|
164
|
-
return /*#__PURE__*/React.createElement(MenuButton.Item, _objectSpread(
|
174
|
+
return /*#__PURE__*/React.createElement(MenuButton.Item, _objectSpread({
|
165
175
|
key: key
|
166
|
-
}), buttonContent(item.children, item.icon));
|
176
|
+
}, buttonProps), buttonContent(item.children, item.icon));
|
177
|
+
}
|
178
|
+
|
179
|
+
function renderCommonActionButtonMenuItem(action, key, context) {
|
180
|
+
// @ts-ignore
|
181
|
+
if (action.actions && action.actions.length) {
|
182
|
+
return /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
183
|
+
key: key,
|
184
|
+
label: // @ts-ignore
|
185
|
+
action.label || action.children
|
186
|
+
}, //@ts-ignore
|
187
|
+
action.actions.map(function (a, j) {
|
188
|
+
return renderCommonActionButtonMenuItem(a, j, context);
|
189
|
+
}));
|
190
|
+
}
|
191
|
+
|
192
|
+
return renderMenuButtonItem(action, key, context);
|
167
193
|
}
|
168
194
|
|
169
195
|
export var ActionMenuButton = function ActionMenuButton(props) {
|
@@ -179,25 +205,16 @@ export var ActionMenuButton = function ActionMenuButton(props) {
|
|
179
205
|
|
180
206
|
return /*#__PURE__*/React.createElement(MenuButton, _objectSpread({
|
181
207
|
popupTriggerType: "hover",
|
208
|
+
menuProps: {
|
209
|
+
mode: 'popup',
|
210
|
+
triggerType: 'hover'
|
211
|
+
},
|
182
212
|
type: type,
|
183
213
|
label: buttonContent(label || children, icon, iconSize)
|
184
|
-
}, others), actions.map(function (
|
185
|
-
|
186
|
-
if (child.actions && child.actions.length) {
|
187
|
-
return [/*#__PURE__*/React.createElement(MenuButton.Divider, null),
|
188
|
-
/*#__PURE__*/
|
189
|
-
// @ts-ignore
|
190
|
-
React.createElement(MenuButton.Group, {
|
191
|
-
label: child.label || child.children
|
192
|
-
}, //@ts-ignore
|
193
|
-
child.actions.map(function (action, j) {
|
194
|
-
return renderMenuButtonItem(action, "".concat(i, "-").concat(j), context);
|
195
|
-
})), /*#__PURE__*/React.createElement(MenuButton.Divider, null), /*#__PURE__*/React.createElement(MenuButton.Divider, null)];
|
196
|
-
}
|
197
|
-
|
198
|
-
return renderMenuButtonItem(child, "".concat(i), context);
|
214
|
+
}, others), actions.map(function (action, i) {
|
215
|
+
return renderCommonActionButtonMenuItem(action, i, context);
|
199
216
|
}));
|
200
|
-
};
|
217
|
+
}; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
|
201
218
|
|
202
219
|
function formatGroupActions(actions, max, moreConfig) {
|
203
220
|
var MAX = max < 1 ? MAX_ACTTIONS : max;
|
@@ -209,7 +226,8 @@ function formatGroupActions(actions, max, moreConfig) {
|
|
209
226
|
return [].concat(_toConsumableArray(actions.slice(0, MAX - 1)), [_objectSpread(_objectSpread({}, moreConfig), {}, {
|
210
227
|
actions: actions.slice(MAX - 1)
|
211
228
|
})]);
|
212
|
-
}
|
229
|
+
} // 渲染一个 button 或者 menu button
|
230
|
+
|
213
231
|
|
214
232
|
function renderCommonActionButton(button, context, isTypeText) {
|
215
233
|
var buttonContext = button.context,
|
@@ -314,4 +332,6 @@ export function ActionGroup(props) {
|
|
314
332
|
}));
|
315
333
|
}));
|
316
334
|
}
|
317
|
-
export default
|
335
|
+
export default (function (props) {
|
336
|
+
return renderCommonActionButton(props);
|
337
|
+
});
|
package/es/actions/index.scss
CHANGED
package/es/card/index.d.ts
CHANGED
@@ -8,22 +8,39 @@ export declare type CardContainerProps = {
|
|
8
8
|
} & React.HTMLAttributes<HTMLElement>;
|
9
9
|
export declare const CardContainer: React.FC<CardContainerProps>;
|
10
10
|
export interface CardProps {
|
11
|
+
/** 内容部分 */
|
11
12
|
children?: React.ReactNode;
|
13
|
+
/**卡片标题 */
|
12
14
|
title?: React.ReactNode;
|
15
|
+
/**卡片副标题 */
|
13
16
|
subTitle?: React.ReactNode;
|
17
|
+
/**额外信息区域,位于卡片右上角,可以配置一些常用轻量操作 */
|
14
18
|
extra?: React.ReactNode | IActionButton[];
|
19
|
+
/**卡片背景图 */
|
15
20
|
image?: string;
|
21
|
+
/**卡片标题下方是否有分割线 */
|
16
22
|
divider?: boolean;
|
23
|
+
/**卡片是否有边框 */
|
17
24
|
bordered?: boolean;
|
25
|
+
/**卡片在hovers时是否有阴影 */
|
18
26
|
hoveredShadow?: boolean;
|
27
|
+
/**卡片是否为紧凑模式,紧凑模式下卡片无内边距 */
|
19
28
|
compacted?: boolean;
|
29
|
+
/**卡片内容是否居中展示 */
|
20
30
|
centered?: boolean;
|
31
|
+
/**加载中状态 */
|
21
32
|
loading?: boolean;
|
33
|
+
/**背景色 */
|
22
34
|
backgroundColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent';
|
35
|
+
/**卡片嵌套使用的模式下,卡片占父卡片内容区域的栅格数量 */
|
23
36
|
col?: number | string;
|
37
|
+
/**卡片 class */
|
24
38
|
className?: string;
|
39
|
+
/**卡片样式 */
|
25
40
|
style?: React.CSSProperties;
|
41
|
+
/**卡片内容 class */
|
26
42
|
contentClassName?: string;
|
43
|
+
/**卡片内容样式 */
|
27
44
|
contentStyle?: React.CSSProperties;
|
28
45
|
}
|
29
46
|
declare const Card: React.FC<CardProps>;
|
@@ -139,6 +139,14 @@ declare const _default: React.ForwardRefExoticComponent<(Partial<import("@teamix
|
|
139
139
|
type: "search";
|
140
140
|
} & {
|
141
141
|
children?: React.ReactNode;
|
142
|
+
}> | Partial<import("@teamix/pro-field/lib/components/FieldTagFilter").IProFieldTagFilter & {
|
143
|
+
type: "tagFilter";
|
144
|
+
} & {
|
145
|
+
children?: React.ReactNode;
|
146
|
+
}> | Partial<import("@teamix/pro-field/lib/components/FieldMenuSelect").IProFieldMenuSelect & {
|
147
|
+
type: "menuSelect";
|
148
|
+
} & {
|
149
|
+
children?: React.ReactNode;
|
142
150
|
}> | Pick<Partial<{
|
143
151
|
[key: string]: any;
|
144
152
|
type: string;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type {
|
2
|
+
import type { IFormProps } from '../typing';
|
3
3
|
import './index.scss';
|
4
|
-
declare const ProForm: React.FC<
|
4
|
+
declare const ProForm: React.FC<IFormProps>;
|
5
5
|
export default ProForm;
|
package/es/form/ProForm/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["form", "initialValues", "schema", "scope", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed"];
|
1
|
+
var _excluded = ["form", "initialValues", "schema", "scope", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "className"];
|
2
2
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
4
4
|
|
@@ -11,6 +11,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
12
|
|
13
13
|
import React, { memo, useEffect, useMemo } from 'react';
|
14
|
+
import cls from 'classnames';
|
14
15
|
import { createForm, onFormValuesChange } from '@formily/core';
|
15
16
|
import { toJS } from '@formily/reactive';
|
16
17
|
import { Form, FormLayout } from '@teamix/formily';
|
@@ -35,11 +36,13 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
35
36
|
onChange = _ref.onChange,
|
36
37
|
onSubmit = _ref.onSubmit,
|
37
38
|
onSubmitFailed = _ref.onSubmitFailed,
|
39
|
+
className = _ref.className,
|
38
40
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
39
41
|
|
40
42
|
var form = useMemo(function () {
|
41
43
|
return outerForm || createForm();
|
42
44
|
}, []);
|
45
|
+
var prefix = 'teamix-pro-form';
|
43
46
|
var getTeamixLayout = useMemo(function () {
|
44
47
|
return breakpoints ? {
|
45
48
|
breakpoints: breakpoints,
|
@@ -83,7 +86,11 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
83
86
|
return outerForm === false ?
|
84
87
|
/*#__PURE__*/
|
85
88
|
// 特殊表单,无需渲染form实例,例如FormDialog等
|
86
|
-
React.createElement(FormLayout, _objectSpread(_objectSpread({
|
89
|
+
React.createElement(FormLayout, _objectSpread(_objectSpread({
|
90
|
+
className: cls(prefix, className)
|
91
|
+
}, otherProps), getTeamixLayout), formChildren) : /*#__PURE__*/React.createElement(Form, _objectSpread(_objectSpread(_objectSpread({
|
92
|
+
className: cls(prefix, className)
|
93
|
+
}, otherProps), getTeamixLayout), {}, {
|
87
94
|
form: form,
|
88
95
|
onAutoSubmit: onSubmit,
|
89
96
|
onAutoSubmitFailed: onSubmitFailed
|
@@ -1,6 +1,13 @@
|
|
1
1
|
@import '~@alifd/next/lib/core/index-noreset.scss';
|
2
2
|
|
3
3
|
$form-item-cls: #{$css-prefix}formily-item;
|
4
|
+
$teamix-pro-form: teamix-pro-form;
|
5
|
+
|
6
|
+
.#{$teamix-pro-form} {
|
7
|
+
.next-affix {
|
8
|
+
top: auto !important; // todo 待pro-page-containe修复后移除
|
9
|
+
}
|
10
|
+
}
|
4
11
|
|
5
12
|
// FormItem 样式重写
|
6
13
|
.#{$form-item-cls} {
|
@@ -37,9 +44,14 @@ $form-item-cls: #{$css-prefix}formily-item;
|
|
37
44
|
> .teamix-pro-field-checkbox,
|
38
45
|
.teamix-pro-field-radio,
|
39
46
|
.teamix-pro-field-switch,
|
40
|
-
.teamix-pro-field-colorradio
|
47
|
+
.teamix-pro-field-colorradio,
|
48
|
+
.teamix-pro-field-range,
|
49
|
+
.#{$css-prefix}btn-text {
|
41
50
|
line-height: var(--form-element-medium-height, 32px);
|
42
51
|
}
|
52
|
+
> .#{$css-prefix}btn-text {
|
53
|
+
width: auto;
|
54
|
+
}
|
43
55
|
}
|
44
56
|
}
|
45
57
|
}
|
@@ -87,15 +99,20 @@ $form-item-cls: #{$css-prefix}formily-item;
|
|
87
99
|
.#{$form-item-cls}-extra {
|
88
100
|
color: var(--color-text1-8, #848484);
|
89
101
|
}
|
102
|
+
.#{$form-item-cls}-error-help {
|
103
|
+
color: var(--color-error-5, #e84738);
|
104
|
+
}
|
90
105
|
|
91
106
|
// 前缀 后缀
|
92
107
|
.#{$form-item-cls}-control {
|
93
108
|
.#{$form-item-cls}-control-content {
|
94
109
|
.#{$form-item-cls}-addon-before {
|
95
110
|
margin-right: 16px;
|
111
|
+
color: var(--color-text1-8, #848484);
|
96
112
|
}
|
97
113
|
.#{$form-item-cls}-addon-after {
|
98
114
|
margin-left: 16px;
|
115
|
+
color: var(--color-text1-8, #848484);
|
99
116
|
}
|
100
117
|
}
|
101
118
|
}
|
@@ -218,14 +235,16 @@ $inset-font-weight-medium: calc(
|
|
218
235
|
}
|
219
236
|
}
|
220
237
|
|
221
|
-
.#{$
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
238
|
+
.#{$teamix-pro-form}-button-affix.#{$css-prefix}affix {
|
239
|
+
left: 0;
|
240
|
+
right: 0;
|
241
|
+
width: 100% !important;
|
242
|
+
height: 56px !important;
|
243
|
+
padding-left: 24px;
|
244
|
+
background: var(--color-fill1-1, #fff) !important;
|
226
245
|
box-shadow: 0 -1px 5px 0 rgba(38, 38, 38, 0.14);
|
227
246
|
.#{$css-prefix}formily-button-group {
|
228
|
-
margin-
|
247
|
+
margin-bottom: 12px;
|
229
248
|
}
|
230
249
|
}
|
231
250
|
|
@@ -246,3 +265,17 @@ $inset-font-weight-medium: calc(
|
|
246
265
|
}
|
247
266
|
}
|
248
267
|
}
|
268
|
+
|
269
|
+
// ArrayItems
|
270
|
+
.#{$css-prefix}formily-array-items {
|
271
|
+
.#{$css-prefix}formily-grid-layout {
|
272
|
+
> div:last-child {
|
273
|
+
display: flex;
|
274
|
+
justify-content: flex-end;
|
275
|
+
align-items: center;
|
276
|
+
}
|
277
|
+
}
|
278
|
+
.#{$css-prefix}formily-array-base-remove {
|
279
|
+
cursor: pointer;
|
280
|
+
}
|
281
|
+
}
|
@@ -29,7 +29,7 @@ var typeMap = (_typeMap = {
|
|
29
29
|
YearPicker: 'string',
|
30
30
|
QuarterPicker: 'string',
|
31
31
|
DateRangePicker: 'array',
|
32
|
-
|
32
|
+
TimeRangePicker: 'array',
|
33
33
|
DateTimeRangePicker: 'array',
|
34
34
|
WeekRangePicker: 'array',
|
35
35
|
MonthRangePicker: 'array',
|
@@ -39,10 +39,10 @@ var typeMap = (_typeMap = {
|
|
39
39
|
Upload: 'object',
|
40
40
|
ColorPicker: 'string',
|
41
41
|
ColorRadio: 'string',
|
42
|
-
ColorSwatches: 'string',
|
43
|
-
ColorTwitter: 'string',
|
44
42
|
IconPicker: 'string',
|
45
43
|
JsonInput: 'object',
|
44
|
+
TagPicker: 'array',
|
45
|
+
Range: 'string',
|
46
46
|
Search: 'array',
|
47
47
|
ArrayCollapse: 'array',
|
48
48
|
ArrayCards: 'array',
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type {
|
3
|
-
declare const _default: React.MemoExoticComponent<({ schema, scope, components }:
|
2
|
+
import type { IFormProps } from '../typing';
|
3
|
+
declare const _default: React.MemoExoticComponent<({ schema, scope, components }: IFormProps) => JSX.Element>;
|
4
4
|
export default _default;
|
@@ -24,6 +24,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
24
24
|
|
25
25
|
import React, { memo, useCallback, useMemo } from 'react';
|
26
26
|
import { createSchemaField } from '@formily/react';
|
27
|
+
import { Affix } from '@alicloudfe/components';
|
27
28
|
import { Upload, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
28
29
|
import ProField from '../Components/ProField';
|
29
30
|
import { EditableDialog, EditableDrawer, EditablePopover } from '../Components/Editable';
|
@@ -55,7 +56,6 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
55
56
|
var SchemaField = useMemo(function () {
|
56
57
|
return createSchemaField({
|
57
58
|
components: {
|
58
|
-
Upload: Upload,
|
59
59
|
ProField: ProField,
|
60
60
|
FormLayout: FormLayout,
|
61
61
|
FormItem: FormItem,
|
@@ -79,7 +79,9 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
79
79
|
EditablePopover: EditablePopover,
|
80
80
|
FormGroup: FormGroup,
|
81
81
|
Search: Search,
|
82
|
-
QueryFilter: QueryFilter
|
82
|
+
QueryFilter: QueryFilter,
|
83
|
+
Upload: Upload,
|
84
|
+
Affix: Affix
|
83
85
|
}
|
84
86
|
});
|
85
87
|
}, []); // 合并schema中request的scope
|
@@ -236,9 +238,10 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
236
238
|
|
237
239
|
var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
|
238
240
|
properties: formatSchema(children)
|
239
|
-
} : {}; // 递归items
|
241
|
+
} : {}; // 递归items(类似子组件,会先由各initialize方法格式化为固定形式,type不同不统一处理)
|
242
|
+
// 例如:[{ name: 'items', type: 'object', children: items }]
|
240
243
|
|
241
|
-
var recursiveItems = items ? formatSchema(items) : {}; // 配置组件属性
|
244
|
+
var recursiveItems = items ? formatSchema([items]) : {}; // 配置组件属性
|
242
245
|
|
243
246
|
schemaProperties[name] = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, otherProps), formatParam), recursiveProperties), recursiveItems);
|
244
247
|
});
|
@@ -249,7 +252,8 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
249
252
|
type: 'object',
|
250
253
|
properties: formatSchema(schema)
|
251
254
|
};
|
252
|
-
}, [formatSchema, schema]);
|
255
|
+
}, [formatSchema, schema]); // console.log(schemaPro);
|
256
|
+
|
253
257
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SchemaField, {
|
254
258
|
schema: schemaPro,
|
255
259
|
components: components,
|
@@ -1,68 +1,23 @@
|
|
1
|
-
var _excluded = ["props", "children", "items"],
|
2
|
-
_excluded2 = ["itemType"];
|
3
|
-
|
4
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
5
|
-
|
6
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
7
|
-
|
8
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
9
2
|
|
10
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
11
4
|
|
12
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
13
6
|
|
14
|
-
var
|
15
|
-
|
16
|
-
}
|
7
|
+
var initializeItems = function initializeItems(items) {
|
8
|
+
if (items) {
|
9
|
+
return _objectSpread(_objectSpread({}, items), {}, {
|
10
|
+
name: 'items'
|
11
|
+
});
|
12
|
+
}
|
17
13
|
|
18
|
-
|
19
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
20
|
-
component: 'ArrayCards.Addition'
|
21
|
-
});
|
22
|
-
};
|
23
|
-
|
24
|
-
var initializeString = function initializeString(items) {
|
25
|
-
return [{
|
26
|
-
name: 'items',
|
27
|
-
children: items.map(function (item) {
|
28
|
-
return initializeChildren(item);
|
29
|
-
})
|
30
|
-
}];
|
31
|
-
};
|
32
|
-
|
33
|
-
var initializeObject = function initializeObject(items) {
|
34
|
-
return [{
|
35
|
-
name: 'items',
|
36
|
-
type: 'object',
|
37
|
-
children: items.map(function (item) {
|
38
|
-
return initializeChildren(item);
|
39
|
-
})
|
40
|
-
}];
|
14
|
+
return items;
|
41
15
|
};
|
42
16
|
|
43
17
|
var initialize = function initialize(item) {
|
44
|
-
var
|
45
|
-
|
46
|
-
|
47
|
-
children = _item$children === void 0 ? [] : _item$children,
|
48
|
-
_item$items = item.items,
|
49
|
-
items = _item$items === void 0 ? [] : _item$items,
|
50
|
-
other = _objectWithoutProperties(item, _excluded);
|
51
|
-
|
52
|
-
var _props$itemType = props.itemType,
|
53
|
-
itemType = _props$itemType === void 0 ? 'string' : _props$itemType,
|
54
|
-
otherProps = _objectWithoutProperties(props, _excluded2);
|
55
|
-
|
56
|
-
var renderItemsMap = {
|
57
|
-
string: initializeString(items),
|
58
|
-
object: initializeObject(items)
|
59
|
-
};
|
60
|
-
return _objectSpread(_objectSpread({}, other), {}, {
|
61
|
-
props: otherProps,
|
62
|
-
children: children.map(function (item) {
|
63
|
-
return initializeAddition(item);
|
64
|
-
}),
|
65
|
-
items: renderItemsMap[itemType]
|
18
|
+
var items = item.items;
|
19
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
20
|
+
items: items ? initializeItems(items) : {}
|
66
21
|
});
|
67
22
|
};
|
68
23
|
|