@teamix/pro 1.2.18 → 1.2.22
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/dist/212.js +49 -49
- package/dist/pro.css +1 -1
- package/dist/pro.js +3581 -990
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/base.d.ts +2 -1
- package/es/actions/base.js +1 -1
- package/es/actions/danger-pop-confirm.d.ts +5 -0
- package/es/actions/danger-pop-confirm.js +10 -0
- package/es/actions/dialog.d.ts +1 -1
- package/es/actions/dialog.js +42 -55
- package/es/actions/index.d.ts +13 -0
- package/es/actions/index.js +21 -16
- package/es/actions/pop-confirm.d.ts +9 -0
- package/es/actions/pop-confirm.js +9 -0
- package/es/form/Components/LightFilter/componentMap.d.ts +2 -1
- package/es/form/Components/LightFilter/componentMap.js +4 -2
- package/es/form/Components/LightFilter/index.d.ts +1 -0
- package/es/form/Components/LightFilter/index.js +34 -16
- package/es/form/Components/LightFilter/index.scss +14 -4
- package/es/form/Filter/AdvancedFilter.d.ts +7 -0
- package/es/form/Filter/AdvancedFilter.js +114 -0
- package/es/form/Filter/LightFilter.d.ts +7 -0
- package/es/form/Filter/LightFilter.js +79 -0
- package/es/form/Filter/SimpleFilter.d.ts +7 -0
- package/es/form/Filter/SimpleFilter.js +74 -0
- package/es/form/Filter/index2.js +288 -235
- package/es/form/Filter/index2.scss +3 -0
- package/es/form/ProForm/index.js +11 -7
- package/es/form/ProForm/index.scss +40 -6
- package/es/form/ProForm/useFormDisplayValues.js +4 -2
- package/es/form/SchemaForm/index.js +16 -10
- package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +4 -9
- package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.js +4 -10
- package/es/form/SchemaForm/initializeRules.d.ts +7 -1
- package/es/form/SchemaForm/initializeRules.js +9 -13
- package/es/form/SchemaForm/reactions.d.ts +5 -5
- package/es/form/SchemaForm/reactions.js +27 -29
- package/es/form/global.scss +1 -0
- package/es/form/typing.d.ts +11 -2
- package/es/form/utils.d.ts +8 -7
- package/es/form/utils.js +5 -4
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/Filter/index.js +1 -0
- package/es/table/components/Layout/index.js +21 -12
- package/es/table/components/Pagination/index.d.ts +4 -0
- package/es/table/components/Pagination/index.js +154 -0
- package/es/table/components/Pagination/index.scss +22 -0
- package/es/table/components/ToolBar/FilterColumnIcon.js +42 -8
- package/es/table/components/ToolBar/index.scss +17 -6
- package/es/table/index.js +118 -34
- package/es/table/index.scss +7 -1
- package/es/table/typing.d.ts +6 -2
- package/es/table/utils/columnRender.js +2 -1
- package/es/table/utils/index.d.ts +7 -0
- package/es/table/utils/index.js +38 -4
- package/lib/actions/base.d.ts +2 -1
- package/lib/actions/base.js +1 -1
- package/lib/actions/danger-pop-confirm.d.ts +5 -0
- package/lib/actions/danger-pop-confirm.js +22 -0
- package/lib/actions/dialog.d.ts +1 -1
- package/lib/actions/dialog.js +42 -54
- package/lib/actions/index.d.ts +13 -0
- package/lib/actions/index.js +23 -16
- package/lib/actions/pop-confirm.d.ts +9 -0
- package/lib/actions/pop-confirm.js +23 -0
- package/lib/form/Components/LightFilter/componentMap.d.ts +2 -1
- package/lib/form/Components/LightFilter/componentMap.js +6 -4
- package/lib/form/Components/LightFilter/index.d.ts +1 -0
- package/lib/form/Components/LightFilter/index.js +31 -14
- package/lib/form/Components/LightFilter/index.scss +14 -4
- package/lib/form/Filter/AdvancedFilter.d.ts +7 -0
- package/lib/form/Filter/AdvancedFilter.js +134 -0
- package/lib/form/Filter/LightFilter.d.ts +7 -0
- package/lib/form/Filter/LightFilter.js +99 -0
- package/lib/form/Filter/SimpleFilter.d.ts +7 -0
- package/lib/form/Filter/SimpleFilter.js +93 -0
- package/lib/form/Filter/index2.js +291 -234
- package/lib/form/Filter/index2.scss +3 -0
- package/lib/form/ProForm/index.js +10 -6
- package/lib/form/ProForm/index.scss +40 -6
- package/lib/form/ProForm/useFormDisplayValues.js +3 -1
- package/lib/form/SchemaForm/index.js +16 -9
- package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +4 -11
- package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +4 -11
- package/lib/form/SchemaForm/initializeRules.d.ts +7 -1
- package/lib/form/SchemaForm/initializeRules.js +9 -16
- package/lib/form/SchemaForm/reactions.d.ts +5 -5
- package/lib/form/SchemaForm/reactions.js +29 -31
- package/lib/form/global.scss +1 -0
- package/lib/form/typing.d.ts +11 -2
- package/lib/form/utils.d.ts +8 -7
- package/lib/form/utils.js +6 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/Layout/index.js +20 -11
- package/lib/table/components/Pagination/index.d.ts +4 -0
- package/lib/table/components/Pagination/index.js +174 -0
- package/lib/table/components/Pagination/index.scss +22 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.js +41 -7
- package/lib/table/components/ToolBar/index.scss +17 -6
- package/lib/table/index.js +115 -32
- package/lib/table/index.scss +7 -1
- package/lib/table/typing.d.ts +6 -2
- package/lib/table/utils/columnRender.js +2 -1
- package/lib/table/utils/index.d.ts +7 -0
- package/lib/table/utils/index.js +46 -4
- package/package.json +3 -3
package/es/table/typing.d.ts
CHANGED
@@ -12,7 +12,7 @@ import React from 'react';
|
|
12
12
|
import type { Form as FormType } from '@formily/core';
|
13
13
|
declare type IFieldRenderProps = keyof ProFieldRenderProps;
|
14
14
|
/** 列record函数 */
|
15
|
-
declare type ProTableCellFunProp = (value: any, index: number, record: any) => any;
|
15
|
+
declare type ProTableCellFunProp = (value: any, index: number, record: any, ...others: any) => any;
|
16
16
|
declare type ITableCellRender = {
|
17
17
|
[key in IFieldRenderProps]?: ProFieldRenderProps[key] | ProTableCellFunProp;
|
18
18
|
} | ((...other: any) => React.ReactNode);
|
@@ -146,7 +146,7 @@ export declare type ProTableActionType = {
|
|
146
146
|
/** 全屏展示 */
|
147
147
|
fullScreen?: () => boolean;
|
148
148
|
/** 设置显示列 */
|
149
|
-
setColumn?: (newColumns: ProColumnProps[]) => void;
|
149
|
+
setColumn?: (newColumns: ProColumnProps[], update?: boolean) => void;
|
150
150
|
/** 设置表格大小 */
|
151
151
|
setSize?: (mode: 'small' | 'medium') => void;
|
152
152
|
/** 刷新表格 */
|
@@ -220,6 +220,8 @@ export declare type ProTableDataFilterProps = {
|
|
220
220
|
searchUndefined?: boolean;
|
221
221
|
/** 搜索时是否传入值为空字符串的参数,默认不传 */
|
222
222
|
searchEmptyString?: boolean;
|
223
|
+
/** 自定义内容 */
|
224
|
+
content?: React.ReactNode;
|
223
225
|
} & IFilterProps;
|
224
226
|
export declare type dataFilterProps = ProTableDataFilterProps;
|
225
227
|
export declare type ProTableTopAreaProps = {
|
@@ -235,6 +237,8 @@ export declare type ProTableTopAreaProps = {
|
|
235
237
|
dataFilter?: ProTableDataFilterProps;
|
236
238
|
/** 数据过滤区 form 表单模型 */
|
237
239
|
dataFilterForm?: FormType;
|
240
|
+
/** 排序、筛选列展示状态 */
|
241
|
+
filterColumnType?: 'dialog' | 'dropdown' | 'auto';
|
238
242
|
};
|
239
243
|
/** 单个工具栏 */
|
240
244
|
export declare type ProTableToolBarItem = React.ReactNode | 'refresh' | 'density' | 'filterColumn' | 'fullscreen';
|
@@ -204,7 +204,8 @@ var processRenderFunction = function processRenderFunction() {
|
|
204
204
|
var value = arguments.length > 1 ? arguments[1] : undefined;
|
205
205
|
var index = arguments.length > 2 ? arguments[2] : undefined;
|
206
206
|
var record = arguments.length > 3 ? arguments[3] : undefined;
|
207
|
-
|
207
|
+
// 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
|
208
|
+
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick'];
|
208
209
|
return Object.fromEntries(Object.entries(render).map(function (_ref3) {
|
209
210
|
var _ref4 = _slicedToArray(_ref3, 2),
|
210
211
|
k = _ref4[0],
|
@@ -1,4 +1,11 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ProTableActionType } from '../typing';
|
3
|
+
export declare function initActionRef(): void;
|
4
|
+
/** table 组件内监听 不对外暴露 */
|
5
|
+
export declare function on(fun: any, key: string): void;
|
6
|
+
/** table 组件内销毁监听 不对外暴露 */
|
7
|
+
export declare function off(key: string): void;
|
8
|
+
/** table 组件内触发事件 不对外暴露 */
|
9
|
+
export declare function emit(key: string, ...args: any): void;
|
3
10
|
export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
4
11
|
export declare function cloneDeep<T>(obj: T): T;
|
package/es/table/utils/index.js
CHANGED
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
16
16
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
18
18
|
|
19
|
-
import cloneDeepLodash from 'lodash.clonedeep'; // 组件内全局状态
|
19
|
+
import cloneDeepLodash from 'lodash.clonedeep'; // 组件内全局状态 每次初始化 ActionRef 会重新深拷贝对象
|
20
20
|
|
21
21
|
var state = {
|
22
22
|
fullScreenState: false,
|
@@ -24,12 +24,16 @@ var state = {
|
|
24
24
|
filterColumns: []
|
25
25
|
};
|
26
26
|
|
27
|
-
var _initState = cloneDeepLodash(state); //
|
27
|
+
var _initState = cloneDeepLodash(state); // state监听事件 每次初始化 ActionRef 会重新深拷贝对象
|
28
28
|
|
29
29
|
|
30
30
|
var callback = {
|
31
31
|
fullScreenState: {}
|
32
|
-
};
|
32
|
+
};
|
33
|
+
var initCallback = cloneDeepLodash(callback); // 所有 ProTable 组件公用一套组件内事件转发机制
|
34
|
+
|
35
|
+
var tableCallback = {}; // 组件内监听事件
|
36
|
+
// 组件内对全局状态的更改
|
33
37
|
|
34
38
|
var mutations = {
|
35
39
|
getState: function getState() {
|
@@ -129,8 +133,38 @@ var useOn = function useOn(state) {
|
|
129
133
|
}
|
130
134
|
});
|
131
135
|
}
|
132
|
-
};
|
136
|
+
}; // 初始化 actionRef
|
137
|
+
|
138
|
+
|
139
|
+
export function initActionRef() {
|
140
|
+
state = cloneDeepLodash(_initState);
|
141
|
+
callback = cloneDeepLodash(initCallback);
|
142
|
+
}
|
143
|
+
/** table 组件内监听 不对外暴露 */
|
144
|
+
|
145
|
+
export function on(fun, key) {
|
146
|
+
tableCallback[key] = fun;
|
147
|
+
}
|
148
|
+
/** table 组件内销毁监听 不对外暴露 */
|
133
149
|
|
150
|
+
export function off(key) {
|
151
|
+
if (tableCallback[key]) {
|
152
|
+
delete tableCallback[key];
|
153
|
+
}
|
154
|
+
}
|
155
|
+
/** table 组件内触发事件 不对外暴露 */
|
156
|
+
|
157
|
+
export function emit(key) {
|
158
|
+
var fun = tableCallback[key];
|
159
|
+
|
160
|
+
if (fun) {
|
161
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
162
|
+
args[_key2 - 1] = arguments[_key2];
|
163
|
+
}
|
164
|
+
|
165
|
+
fun.apply(void 0, args);
|
166
|
+
}
|
167
|
+
}
|
134
168
|
export function useActionType(ref, action) {
|
135
169
|
// 合并自定义事件
|
136
170
|
var userAction = _objectSpread(_objectSpread({}, action), mutations);
|
package/lib/actions/base.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="react" />
|
1
2
|
import { MaybePromise } from '@teamix/utils';
|
2
3
|
export interface BaseAction {
|
3
4
|
/** 事件触发方式,默认是 onClick */
|
@@ -17,7 +18,7 @@ export interface BaseAction {
|
|
17
18
|
/** 事件开始执行完毕的回调函数 */
|
18
19
|
onFinish?: (params?: any) => any;
|
19
20
|
}
|
20
|
-
export declare function eventHandler(action: BaseAction, actionContext: any, onTrigger: (context: any) => void): {
|
21
|
+
export declare function eventHandler(action: BaseAction, actionContext: any, onTrigger: (context: any, e: React.MouseEvent<HTMLElement>) => void): {
|
21
22
|
[x: string]: (e: React.MouseEvent<HTMLElement>) => Promise<void>;
|
22
23
|
};
|
23
24
|
export default eventHandler;
|
package/lib/actions/base.js
CHANGED
@@ -65,7 +65,7 @@ function eventHandler(action, actionContext, onTrigger) {
|
|
65
65
|
return _context.abrupt("return");
|
66
66
|
|
67
67
|
case 14:
|
68
|
-
onTrigger(Object.assign({}, beforeActionContext, actionContext));
|
68
|
+
onTrigger(Object.assign({}, beforeActionContext, actionContext), e);
|
69
69
|
(_action$onTrigger = action.onTrigger) === null || _action$onTrigger === void 0 ? void 0 : _action$onTrigger.call(action);
|
70
70
|
|
71
71
|
case 16:
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { PopConfirmAction } from './pop-confirm';
|
2
|
+
export declare function useDangerPopConfirmAction(action: PopConfirmAction, context?: any): {
|
3
|
+
[x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
4
|
+
};
|
5
|
+
export default useDangerPopConfirmAction;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
exports.useDangerPopConfirmAction = useDangerPopConfirmAction;
|
8
|
+
|
9
|
+
var _utils = require("@teamix/utils");
|
10
|
+
|
11
|
+
var _dialog = require("./dialog");
|
12
|
+
|
13
|
+
function useDangerPopConfirmAction(action, context) {
|
14
|
+
return (0, _dialog.useDialogAction)((0, _utils.deepMerge)({
|
15
|
+
dialogType: 'pop',
|
16
|
+
popType: 'danger',
|
17
|
+
align: 'br'
|
18
|
+
}, action), context);
|
19
|
+
}
|
20
|
+
|
21
|
+
var _default = useDangerPopConfirmAction;
|
22
|
+
exports.default = _default;
|
package/lib/actions/dialog.d.ts
CHANGED
@@ -8,7 +8,7 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
|
|
8
8
|
/** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
|
9
9
|
url?: string;
|
10
10
|
/** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
|
11
|
-
dialogType?: 'dialog' | 'drawer';
|
11
|
+
dialogType?: 'dialog' | 'drawer' | 'pop';
|
12
12
|
/** 弹窗快捷调用类型 */
|
13
13
|
dialogQuickShowType?: 'alert' | 'confirm';
|
14
14
|
/** 弹窗消息类型 */
|
package/lib/actions/dialog.js
CHANGED
@@ -16,6 +16,8 @@ var _reactRouterDom = require("react-router-dom");
|
|
16
16
|
|
17
17
|
var _components = require("@alicloudfe/components");
|
18
18
|
|
19
|
+
var _popConfirm = _interopRequireDefault(require("@teamix/pop-confirm"));
|
20
|
+
|
19
21
|
var _utils = require("@teamix/utils");
|
20
22
|
|
21
23
|
var _form = _interopRequireWildcard(require("../form"));
|
@@ -29,7 +31,7 @@ var _request = require("./request");
|
|
29
31
|
var _utils2 = require("./utils");
|
30
32
|
|
31
33
|
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
32
|
-
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
34
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
33
35
|
|
34
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35
37
|
|
@@ -102,7 +104,9 @@ function useDialogAction(action, actionContext) {
|
|
102
104
|
var footerDescriptionRef = (0, _react.useRef)();
|
103
105
|
var history = (0, _reactRouterDom.useHistory)();
|
104
106
|
|
105
|
-
var onActionStart = function onActionStart(context) {
|
107
|
+
var onActionStart = function onActionStart(context, e) {
|
108
|
+
var _objectSpread2;
|
109
|
+
|
106
110
|
var url = action.url,
|
107
111
|
method = action.method,
|
108
112
|
params = action.params,
|
@@ -126,6 +130,7 @@ function useDialogAction(action, actionContext) {
|
|
126
130
|
dialogQuickShowType = _getTargetValue.dialogQuickShowType,
|
127
131
|
_getTargetValue$messa = _getTargetValue.messageType,
|
128
132
|
messageType = _getTargetValue$messa === void 0 ? 'notice' : _getTargetValue$messa,
|
133
|
+
popType = _getTargetValue.popType,
|
129
134
|
beforeRequest = _getTargetValue.beforeRequest,
|
130
135
|
onTrigger = _getTargetValue.onTrigger,
|
131
136
|
link = _getTargetValue.link,
|
@@ -135,20 +140,25 @@ function useDialogAction(action, actionContext) {
|
|
135
140
|
footerDescription = _getTargetValue.footerDescription,
|
136
141
|
footerAlign = _getTargetValue.footerAlign,
|
137
142
|
className = _getTargetValue.className,
|
138
|
-
|
143
|
+
containerOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
139
144
|
|
140
145
|
var isDrawer = dialogType === 'drawer';
|
141
|
-
var
|
142
|
-
var
|
146
|
+
var isPop = dialogType === 'pop';
|
147
|
+
var container = isDrawer ? _components.Drawer : isPop ? _popConfirm.default : _components.Dialog;
|
148
|
+
var containerProps = isDrawer ? {
|
149
|
+
okText: (0, _utils.getMessage)('ok'),
|
150
|
+
cancelText: (0, _utils.getMessage)('cancel'),
|
151
|
+
closeable: !loading
|
152
|
+
} : isPop ? {
|
153
|
+
type: popType,
|
154
|
+
trigger: e.currentTarget
|
155
|
+
} : {
|
143
156
|
type: dialogQuickShowType,
|
144
157
|
messageProps: {
|
145
158
|
type: messageType
|
146
|
-
}
|
159
|
+
},
|
160
|
+
closeable: !loading
|
147
161
|
};
|
148
|
-
var containerOtherProps = isDrawer ? {
|
149
|
-
okText: (0, _utils.getMessage)('ok'),
|
150
|
-
cancelText: (0, _utils.getMessage)('cancel')
|
151
|
-
} : dialogOnlyProps;
|
152
162
|
|
153
163
|
var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
|
154
164
|
if (footer instanceof Array || footer.component) {
|
@@ -177,48 +187,34 @@ function useDialogAction(action, actionContext) {
|
|
177
187
|
while (1) {
|
178
188
|
switch (_context.prev = _context.next) {
|
179
189
|
case 0:
|
180
|
-
if (url) {
|
181
|
-
_context.next = 5;
|
182
|
-
break;
|
183
|
-
}
|
184
|
-
|
185
|
-
if (link) {
|
186
|
-
(0, _utils.goToLink)(link, history);
|
187
|
-
}
|
188
|
-
|
189
|
-
onFinish && onFinish();
|
190
|
-
resolve(true);
|
191
|
-
return _context.abrupt("return");
|
192
|
-
|
193
|
-
case 5:
|
194
190
|
setLoading(true);
|
195
191
|
footerDescriptionValues = Object.assign({}, footerDescriptionRef === null || footerDescriptionRef === void 0 ? void 0 : (_footerDescriptionRef = footerDescriptionRef.current) === null || _footerDescriptionRef === void 0 ? void 0 : _footerDescriptionRef.values);
|
196
|
-
_context.prev =
|
192
|
+
_context.prev = 2;
|
197
193
|
requestContext = Object.assign({
|
198
194
|
footer: footerDescriptionValues
|
199
195
|
}, context);
|
200
|
-
_context.next =
|
196
|
+
_context.next = 6;
|
201
197
|
return (0, _request.doRequest)(action, requestContext, history, footerDescriptionValues);
|
202
198
|
|
203
|
-
case
|
199
|
+
case 6:
|
204
200
|
onFinish && onFinish();
|
205
201
|
resolve(true);
|
206
|
-
_context.next =
|
202
|
+
_context.next = 15;
|
207
203
|
break;
|
208
204
|
|
209
|
-
case
|
210
|
-
_context.prev =
|
211
|
-
_context.t0 = _context["catch"](
|
205
|
+
case 10:
|
206
|
+
_context.prev = 10;
|
207
|
+
_context.t0 = _context["catch"](2);
|
212
208
|
setLoading(false);
|
213
209
|
resolve(false);
|
214
210
|
return _context.abrupt("return");
|
215
211
|
|
216
|
-
case
|
212
|
+
case 15:
|
217
213
|
case "end":
|
218
214
|
return _context.stop();
|
219
215
|
}
|
220
216
|
}
|
221
|
-
}, _callee, null, [[
|
217
|
+
}, _callee, null, [[2, 10]]);
|
222
218
|
}));
|
223
219
|
|
224
220
|
return function (_x) {
|
@@ -243,27 +239,19 @@ function useDialogAction(action, actionContext) {
|
|
243
239
|
key: (0, _utils.uuid)()
|
244
240
|
}, (0, _utils2.addContext)(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
|
245
241
|
|
246
|
-
var quickShowProps = _objectSpread(_objectSpread({
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
260
|
-
}, renderDialogFooterDescription(footerDescription))),
|
261
|
-
closeable: !loading,
|
262
|
-
footerAlign: footerAlign,
|
263
|
-
className: (0, _classnames.default)('teamix-pro-action-dialog', {
|
264
|
-
'has-footer-description': !!footerDescription
|
265
|
-
})
|
266
|
-
}, containerOtherProps), containerProps);
|
242
|
+
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "title", addContextForReactNode(title, dialogContext)), _defineProperty(_objectSpread2, "content", /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, beforeContent && /*#__PURE__*/_react.default.createElement("div", {
|
243
|
+
className: "teamix-pro-dialog-before-content"
|
244
|
+
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/_react.default.createElement("div", {
|
245
|
+
className: "teamix-pro-dialog-message"
|
246
|
+
}, (0, _message.renderProMessage)(message, {
|
247
|
+
type: 'notice'
|
248
|
+
})), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
|
249
|
+
className: "teamix-pro-dialog-after-content"
|
250
|
+
}, addContextForReactNode(afterContent, dialogContext)), !isPop && footerDescription && /*#__PURE__*/_react.default.createElement("div", {
|
251
|
+
className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
252
|
+
}, renderDialogFooterDescription(footerDescription)))), _defineProperty(_objectSpread2, "footerAlign", footerAlign), _defineProperty(_objectSpread2, "className", (0, _classnames.default)('teamix-pro-action-dialog', {
|
253
|
+
'has-footer-description': !!footerDescription
|
254
|
+
})), _objectSpread2), containerProps), containerOtherProps);
|
267
255
|
|
268
256
|
var ret = container.show(quickShowProps);
|
269
257
|
store.hide = ret.hide;
|
package/lib/actions/index.d.ts
CHANGED
@@ -7,6 +7,7 @@ import { DialogAction } from './dialog';
|
|
7
7
|
import { DialogFormAction } from './dialog-form';
|
8
8
|
import { DialogTableAction } from './dialog-table';
|
9
9
|
import { DialogInfoAction } from './dialog-info';
|
10
|
+
import { PopConfirmAction } from './pop-confirm';
|
10
11
|
import './index.scss';
|
11
12
|
export declare type ProActionConfig = ({
|
12
13
|
type: 'dialog-form' | 'drawer-form';
|
@@ -15,6 +16,8 @@ export declare type ProActionConfig = ({
|
|
15
16
|
} & DialogTableAction) | ({
|
16
17
|
type: 'dialog-info' | 'drawer-info';
|
17
18
|
} & DialogInfoAction) | ({
|
19
|
+
type: 'pop-confirm' | 'danger-pop-confirm';
|
20
|
+
} & PopConfirmAction) | ({
|
18
21
|
type: 'dialog' | 'drawer' | 'confirm' | 'danger-confirm' | 'notice' | 'error';
|
19
22
|
} & DialogAction) | ({
|
20
23
|
type: 'request';
|
@@ -43,11 +46,21 @@ export interface ProActionMenuButtonProps extends MenuButtonProps {
|
|
43
46
|
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
44
47
|
export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps;
|
45
48
|
export declare type ProActionGroupProps = {
|
49
|
+
/** 操作组类型:按钮、文字按钮 */
|
46
50
|
type?: 'button' | 'text';
|
51
|
+
/** 上下文 */
|
47
52
|
context?: any;
|
53
|
+
/** 操作项配置 */
|
48
54
|
actions: ProActionProps[];
|
55
|
+
/** 操作按钮最长数量,超出后折叠,默认为4 */
|
49
56
|
max?: number;
|
57
|
+
/**
|
58
|
+
* @deprecated 建议使用 more 代替
|
59
|
+
*/
|
50
60
|
moreText?: string;
|
61
|
+
/** 更多按钮的配置,只有在actions数量超过max时才有效 */
|
62
|
+
more?: string | ProActionButtonProps;
|
63
|
+
/** 是否有分割线,只有type="text"时生效,默认有分割线 */
|
51
64
|
divider?: boolean;
|
52
65
|
} & React.HTMLAttributes<HTMLElement>;
|
53
66
|
export declare function ProActionGroup(props: ProActionGroupProps): JSX.Element;
|
package/lib/actions/index.js
CHANGED
@@ -47,6 +47,10 @@ var _drawerTable = require("./drawer-table");
|
|
47
47
|
|
48
48
|
var _drawerInfo = require("./drawer-info");
|
49
49
|
|
50
|
+
var _popConfirm = require("./pop-confirm");
|
51
|
+
|
52
|
+
var _dangerPopConfirm = require("./danger-pop-confirm");
|
53
|
+
|
50
54
|
require("./index.scss");
|
51
55
|
|
52
56
|
var _excluded = ["type"],
|
@@ -56,7 +60,7 @@ var _excluded = ["type"],
|
|
56
60
|
_excluded5 = ["context", "text"],
|
57
61
|
_excluded6 = ["key", "actions"],
|
58
62
|
_excluded7 = ["key", "config"],
|
59
|
-
_excluded8 = ["type", "divider", "max", "moreText", "context", "actions", "className"];
|
63
|
+
_excluded8 = ["type", "divider", "max", "moreText", "more", "context", "actions", "className"];
|
60
64
|
|
61
65
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
62
66
|
|
@@ -155,6 +159,14 @@ function useAction(config, context) {
|
|
155
159
|
return (0, _drawerInfo.useDrawerInfoAction)(others, context);
|
156
160
|
}
|
157
161
|
|
162
|
+
if (type === 'pop-confirm') {
|
163
|
+
return (0, _popConfirm.usePopConfirmAction)(others, context);
|
164
|
+
}
|
165
|
+
|
166
|
+
if (type === 'danger-pop-confirm') {
|
167
|
+
return (0, _dangerPopConfirm.useDangerPopConfirmAction)(others, context);
|
168
|
+
}
|
169
|
+
|
158
170
|
var registedAction = RegistedActions.get(type);
|
159
171
|
|
160
172
|
if (!registedAction) {
|
@@ -317,25 +329,19 @@ function renderCommonActionButton(button, context, isTypeText) {
|
|
317
329
|
return /*#__PURE__*/_react.default.createElement(ProActionMenuButton, _objectSpread({}, buttonProps));
|
318
330
|
}
|
319
331
|
|
320
|
-
function getDefaultMoreButton(type,
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
if (moreText) {
|
328
|
-
return {
|
329
|
-
label: moreText
|
330
|
-
};
|
331
|
-
}
|
332
|
-
|
333
|
-
return {
|
332
|
+
function getDefaultMoreButton(type, more) {
|
333
|
+
var moreConfig = typeof more === 'string' ? {
|
334
|
+
children: more
|
335
|
+
} : more;
|
336
|
+
var defaultConfig = type === 'button' ? {
|
337
|
+
children: (0, _utils.getMessage)('more')
|
338
|
+
} : {
|
334
339
|
icon: 'more-line',
|
335
340
|
// iconSize: 'small',
|
336
341
|
autoWidth: false,
|
337
342
|
className: 'teamix-pro-actions-text-menu-btn-no-arrow'
|
338
343
|
};
|
344
|
+
return Object.assign(defaultConfig, moreConfig);
|
339
345
|
}
|
340
346
|
|
341
347
|
var MAX_ACTTIONS = 4;
|
@@ -380,6 +386,7 @@ function ProActionGroup(props) {
|
|
380
386
|
_props$max = props.max,
|
381
387
|
max = _props$max === void 0 ? MAX_ACTTIONS : _props$max,
|
382
388
|
moreText = props.moreText,
|
389
|
+
more = props.more,
|
383
390
|
context = props.context,
|
384
391
|
_props$actions = props.actions,
|
385
392
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
@@ -392,7 +399,7 @@ function ProActionGroup(props) {
|
|
392
399
|
}).filter(function (action) {
|
393
400
|
return action.visible !== false;
|
394
401
|
});
|
395
|
-
var formatedActions = formatGroupActions(filteredActions, max, getDefaultMoreButton(type, moreText));
|
402
|
+
var formatedActions = formatGroupActions(filteredActions, max, getDefaultMoreButton(type, more || moreText));
|
396
403
|
return /*#__PURE__*/_react.default.createElement("div", _objectSpread({
|
397
404
|
className: (0, _classnames.default)('teamix-pro-actions', "teamix-pro-actions-type-".concat(type), className, {
|
398
405
|
'teamix-pro-actions-divider': type === 'button' ? false : divider
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { IPopConfirmProps } from '@teamix/pop-confirm';
|
2
|
+
import { DialogAction } from './dialog';
|
3
|
+
export declare type PopConfirmAction = DialogAction & Omit<IPopConfirmProps, 'type' | 'trigger'> & {
|
4
|
+
popType?: IPopConfirmProps['type'];
|
5
|
+
};
|
6
|
+
export declare function usePopConfirmAction(action: PopConfirmAction, context?: any): {
|
7
|
+
[x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
8
|
+
};
|
9
|
+
export default usePopConfirmAction;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
exports.usePopConfirmAction = usePopConfirmAction;
|
8
|
+
|
9
|
+
var _utils = require("@teamix/utils");
|
10
|
+
|
11
|
+
var _dialog = _interopRequireDefault(require("./dialog"));
|
12
|
+
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
|
15
|
+
function usePopConfirmAction(action, context) {
|
16
|
+
return (0, _dialog.default)((0, _utils.deepMerge)({
|
17
|
+
dialogType: 'pop',
|
18
|
+
align: 'br'
|
19
|
+
}, action), context);
|
20
|
+
}
|
21
|
+
|
22
|
+
var _default = usePopConfirmAction;
|
23
|
+
exports.default = _default;
|
@@ -3,10 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.inputCategory = exports.componentMap = void 0;
|
7
7
|
var componentMap = {
|
8
8
|
Radio: 'Select',
|
9
|
-
Checkbox: 'Select'
|
9
|
+
Checkbox: 'Select',
|
10
|
+
CheckboxGroup: 'MultipleSelect'
|
10
11
|
};
|
11
|
-
|
12
|
-
|
12
|
+
exports.componentMap = componentMap;
|
13
|
+
var inputCategory = ['Input', 'Password', 'TextArea', 'NumberPicker', 'Percent', 'Money'];
|
14
|
+
exports.inputCategory = inputCategory;
|
@@ -19,7 +19,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
19
|
|
20
20
|
var _utils = require("@teamix/utils");
|
21
21
|
|
22
|
-
var _componentMap =
|
22
|
+
var _componentMap = require("./componentMap");
|
23
23
|
|
24
24
|
require("./index.scss");
|
25
25
|
|
@@ -47,19 +47,29 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
47
47
|
|
48
48
|
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; }
|
49
49
|
|
50
|
-
|
50
|
+
var formatComponent = function formatComponent(schema) {
|
51
|
+
var _schema$enum;
|
52
|
+
|
53
|
+
var component = schema['x-component'];
|
54
|
+
|
55
|
+
if (component === 'Checkbox' && ((_schema$enum = schema['enum']) === null || _schema$enum === void 0 ? void 0 : _schema$enum.length)) {
|
56
|
+
component = 'CheckboxGroup';
|
57
|
+
}
|
58
|
+
|
59
|
+
return _componentMap.componentMap[component] || component;
|
60
|
+
}; // 主激活区内容
|
61
|
+
|
62
|
+
|
51
63
|
var useMain = function useMain(active) {
|
52
64
|
var schema = (0, _react2.useFieldSchema)();
|
53
65
|
var main = [];
|
54
66
|
schema.mapProperties(function (schema, name) {
|
55
|
-
// console.log(schema.required); // 添加 *
|
56
|
-
// console.log(schema);
|
57
67
|
if (schema.name === active) {
|
58
68
|
main.push({
|
59
69
|
name: name,
|
60
70
|
schema: _objectSpread(_objectSpread({}, schema), {}, {
|
61
71
|
title: '',
|
62
|
-
'x-component':
|
72
|
+
'x-component': formatComponent(schema)
|
63
73
|
})
|
64
74
|
});
|
65
75
|
}
|
@@ -78,16 +88,21 @@ var useFilterItems = function useFilterItems() {
|
|
78
88
|
});
|
79
89
|
});
|
80
90
|
return filterItems;
|
91
|
+
}; // 是否输入框类型的组件
|
92
|
+
|
93
|
+
|
94
|
+
var isInputCategory = function isInputCategory(currentSchema) {
|
95
|
+
var component = currentSchema === null || currentSchema === void 0 ? void 0 : currentSchema['x-component'];
|
96
|
+
return _componentMap.inputCategory.includes(component);
|
81
97
|
};
|
82
98
|
|
83
99
|
var LightFilter = (0, _react2.observer)(function (props) {
|
84
|
-
var _filterItems$;
|
100
|
+
var _filterItems$, _main$;
|
85
101
|
|
86
|
-
var field = (0, _react2.useField)();
|
87
|
-
var schema = (0, _react2.useFieldSchema)();
|
88
102
|
var filterItems = useFilterItems();
|
89
103
|
var size = props.size,
|
90
104
|
defaultFilterValue = props.defaultFilterValue,
|
105
|
+
onFilterChange = props.onFilterChange,
|
91
106
|
filterProps = props.filterProps,
|
92
107
|
buttonProps = props.buttonProps;
|
93
108
|
|
@@ -97,6 +112,7 @@ var LightFilter = (0, _react2.observer)(function (props) {
|
|
97
112
|
setActive = _useState2[1];
|
98
113
|
|
99
114
|
var main = useMain(active);
|
115
|
+
var currentSchema = (_main$ = main[0]) === null || _main$ === void 0 ? void 0 : _main$.schema;
|
100
116
|
var defaultCls = (0, _utils.usePrefixCls)();
|
101
117
|
var prefixCls = (0, _utils.usePrefixCls)('', {
|
102
118
|
prefix: 'teamix-pro-form-light-filter'
|
@@ -107,20 +123,21 @@ var LightFilter = (0, _react2.observer)(function (props) {
|
|
107
123
|
return /*#__PURE__*/_react.default.createElement(_react2.RecursionField, {
|
108
124
|
key: key,
|
109
125
|
name: name,
|
110
|
-
schema: schema
|
111
|
-
filterProperties: function filterProperties(schema) {
|
112
|
-
return true;
|
113
|
-
}
|
126
|
+
schema: schema
|
114
127
|
});
|
115
128
|
});
|
129
|
+
var onSelectChange = (0, _react.useCallback)(function (value) {
|
130
|
+
setActive(value);
|
131
|
+
onFilterChange && onFilterChange(value);
|
132
|
+
}, [onFilterChange]);
|
116
133
|
return /*#__PURE__*/_react.default.createElement("span", {
|
117
|
-
className: (0, _classnames.default)(prefixCls, "".concat(defaultCls).concat(size))
|
134
|
+
className: (0, _classnames.default)(prefixCls, "".concat(defaultCls).concat(size), isInputCategory(currentSchema) ? "".concat(prefixCls, "-input-category") : '')
|
118
135
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
119
136
|
className: "".concat(prefixCls, "-main")
|
120
137
|
}, /*#__PURE__*/_react.default.createElement(_components.Select, _objectSpread(_objectSpread({}, filterProps), {}, {
|
121
138
|
className: (0, _classnames.default)("".concat(prefixCls, "-select"), filterProps === null || filterProps === void 0 ? void 0 : filterProps.className),
|
122
139
|
dataSource: filterItems,
|
123
|
-
onChange:
|
140
|
+
onChange: onSelectChange,
|
124
141
|
value: active
|
125
142
|
})), content), /*#__PURE__*/_react.default.createElement("span", {
|
126
143
|
className: "".concat(prefixCls, "-addonAfter")
|