@teamix/pro 1.2.18 → 1.2.19
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/pro.css +1 -1
- package/dist/pro.js +733 -273
- 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 +32 -31
- package/es/actions/index.d.ts +3 -0
- package/es/actions/index.js +10 -0
- 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 +2 -1
- package/es/form/Components/LightFilter/index.d.ts +1 -0
- package/es/form/Components/LightFilter/index.js +19 -13
- package/es/form/Components/LightFilter/index.scss +13 -3
- package/es/form/Filter/index2.js +157 -50
- package/es/form/Filter/index2.scss +3 -0
- package/es/form/ProForm/index.js +3 -2
- package/es/form/typing.d.ts +5 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/ToolBar/FilterColumnIcon.js +1 -1
- package/es/table/index.js +39 -12
- 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 +33 -31
- package/lib/actions/index.d.ts +3 -0
- package/lib/actions/index.js +12 -0
- 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 +4 -3
- package/lib/form/Components/LightFilter/index.d.ts +1 -0
- package/lib/form/Components/LightFilter/index.js +18 -12
- package/lib/form/Components/LightFilter/index.scss +13 -3
- package/lib/form/Filter/index2.js +157 -49
- package/lib/form/Filter/index2.scss +3 -0
- package/lib/form/ProForm/index.js +4 -2
- package/lib/form/typing.d.ts +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/ToolBar/FilterColumnIcon.js +1 -1
- package/lib/table/index.js +39 -12
- package/package.json +2 -2
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) {
|
@@ -243,27 +253,19 @@ function useDialogAction(action, actionContext) {
|
|
243
253
|
key: (0, _utils.uuid)()
|
244
254
|
}, (0, _utils2.addContext)(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
|
245
255
|
|
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);
|
256
|
+
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", {
|
257
|
+
className: "teamix-pro-dialog-before-content"
|
258
|
+
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/_react.default.createElement("div", {
|
259
|
+
className: "teamix-pro-dialog-message"
|
260
|
+
}, (0, _message.renderProMessage)(message, {
|
261
|
+
type: 'notice'
|
262
|
+
})), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
|
263
|
+
className: "teamix-pro-dialog-after-content"
|
264
|
+
}, addContextForReactNode(afterContent, dialogContext)), !isPop && footerDescription && /*#__PURE__*/_react.default.createElement("div", {
|
265
|
+
className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
266
|
+
}, renderDialogFooterDescription(footerDescription)))), _defineProperty(_objectSpread2, "footerAlign", footerAlign), _defineProperty(_objectSpread2, "className", (0, _classnames.default)('teamix-pro-action-dialog', {
|
267
|
+
'has-footer-description': !!footerDescription
|
268
|
+
})), _objectSpread2), containerProps), containerOtherProps);
|
267
269
|
|
268
270
|
var ret = container.show(quickShowProps);
|
269
271
|
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';
|
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"],
|
@@ -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) {
|
@@ -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,11 @@
|
|
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
9
|
Checkbox: 'Select'
|
10
10
|
};
|
11
|
-
|
12
|
-
|
11
|
+
exports.componentMap = componentMap;
|
12
|
+
var inputCategory = ['Input', 'Password', 'TextArea', 'NumberPicker', 'Percent', 'Money'];
|
13
|
+
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
|
|
@@ -53,13 +53,12 @@ var useMain = function useMain(active) {
|
|
53
53
|
var main = [];
|
54
54
|
schema.mapProperties(function (schema, name) {
|
55
55
|
// console.log(schema.required); // 添加 *
|
56
|
-
// console.log(schema);
|
57
56
|
if (schema.name === active) {
|
58
57
|
main.push({
|
59
58
|
name: name,
|
60
59
|
schema: _objectSpread(_objectSpread({}, schema), {}, {
|
61
60
|
title: '',
|
62
|
-
'x-component': _componentMap.
|
61
|
+
'x-component': _componentMap.componentMap[schema['x-component']] || schema['x-component']
|
63
62
|
})
|
64
63
|
});
|
65
64
|
}
|
@@ -78,16 +77,21 @@ var useFilterItems = function useFilterItems() {
|
|
78
77
|
});
|
79
78
|
});
|
80
79
|
return filterItems;
|
80
|
+
}; // 是否输入框类型的组件
|
81
|
+
|
82
|
+
|
83
|
+
var isInputCategory = function isInputCategory(currentSchema) {
|
84
|
+
var component = currentSchema === null || currentSchema === void 0 ? void 0 : currentSchema['x-component'];
|
85
|
+
return _componentMap.inputCategory.includes(component);
|
81
86
|
};
|
82
87
|
|
83
88
|
var LightFilter = (0, _react2.observer)(function (props) {
|
84
|
-
var _filterItems$;
|
89
|
+
var _filterItems$, _main$;
|
85
90
|
|
86
|
-
var field = (0, _react2.useField)();
|
87
|
-
var schema = (0, _react2.useFieldSchema)();
|
88
91
|
var filterItems = useFilterItems();
|
89
92
|
var size = props.size,
|
90
93
|
defaultFilterValue = props.defaultFilterValue,
|
94
|
+
onFilterChange = props.onFilterChange,
|
91
95
|
filterProps = props.filterProps,
|
92
96
|
buttonProps = props.buttonProps;
|
93
97
|
|
@@ -97,6 +101,7 @@ var LightFilter = (0, _react2.observer)(function (props) {
|
|
97
101
|
setActive = _useState2[1];
|
98
102
|
|
99
103
|
var main = useMain(active);
|
104
|
+
var currentSchema = (_main$ = main[0]) === null || _main$ === void 0 ? void 0 : _main$.schema;
|
100
105
|
var defaultCls = (0, _utils.usePrefixCls)();
|
101
106
|
var prefixCls = (0, _utils.usePrefixCls)('', {
|
102
107
|
prefix: 'teamix-pro-form-light-filter'
|
@@ -107,20 +112,21 @@ var LightFilter = (0, _react2.observer)(function (props) {
|
|
107
112
|
return /*#__PURE__*/_react.default.createElement(_react2.RecursionField, {
|
108
113
|
key: key,
|
109
114
|
name: name,
|
110
|
-
schema: schema
|
111
|
-
filterProperties: function filterProperties(schema) {
|
112
|
-
return true;
|
113
|
-
}
|
115
|
+
schema: schema
|
114
116
|
});
|
115
117
|
});
|
118
|
+
var onSelectChange = (0, _react.useCallback)(function (value) {
|
119
|
+
setActive(value);
|
120
|
+
onFilterChange && onFilterChange(currentSchema);
|
121
|
+
}, [onFilterChange]);
|
116
122
|
return /*#__PURE__*/_react.default.createElement("span", {
|
117
|
-
className: (0, _classnames.default)(prefixCls, "".concat(defaultCls).concat(size))
|
123
|
+
className: (0, _classnames.default)(prefixCls, "".concat(defaultCls).concat(size), isInputCategory(currentSchema) ? "".concat(prefixCls, "-input-category") : '')
|
118
124
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
119
125
|
className: "".concat(prefixCls, "-main")
|
120
126
|
}, /*#__PURE__*/_react.default.createElement(_components.Select, _objectSpread(_objectSpread({}, filterProps), {}, {
|
121
127
|
className: (0, _classnames.default)("".concat(prefixCls, "-select"), filterProps === null || filterProps === void 0 ? void 0 : filterProps.className),
|
122
128
|
dataSource: filterItems,
|
123
|
-
onChange:
|
129
|
+
onChange: onSelectChange,
|
124
130
|
value: active
|
125
131
|
})), content), /*#__PURE__*/_react.default.createElement("span", {
|
126
132
|
className: "".concat(prefixCls, "-addonAfter")
|
@@ -18,10 +18,7 @@ $light-filter: #{teamix-pro-form}-light-filter;
|
|
18
18
|
box-sizing: border-box;
|
19
19
|
border: var(--search-normal-normal-border-width, 1px) solid
|
20
20
|
var(--color-line1-2, #d9d9d9);
|
21
|
-
border-right: 0;
|
22
21
|
border-radius: var(--search-normal-corner, 2px);
|
23
|
-
border-top-right-radius: 0;
|
24
|
-
border-bottom-right-radius: 0;
|
25
22
|
// 表单项选择
|
26
23
|
.#{$light-filter}-select {
|
27
24
|
min-width: auto;
|
@@ -44,6 +41,7 @@ $light-filter: #{teamix-pro-form}-light-filter;
|
|
44
41
|
|
45
42
|
// 按钮后缀
|
46
43
|
.#{$light-filter}-addonAfter {
|
44
|
+
display: none;
|
47
45
|
.#{$css-prefix}btn {
|
48
46
|
border-top-left-radius: 0;
|
49
47
|
border-bottom-left-radius: 0;
|
@@ -54,6 +52,18 @@ $light-filter: #{teamix-pro-form}-light-filter;
|
|
54
52
|
}
|
55
53
|
}
|
56
54
|
|
55
|
+
// LightFilter输入类
|
56
|
+
.#{$light-filter}-input-category {
|
57
|
+
.#{$light-filter}-main {
|
58
|
+
border-right: 0;
|
59
|
+
border-top-right-radius: 0;
|
60
|
+
border-bottom-right-radius: 0;
|
61
|
+
}
|
62
|
+
.#{$light-filter}-addonAfter {
|
63
|
+
display: block;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
57
67
|
// LightFilter无边框
|
58
68
|
.#{$form-item-cls}-bordered-none {
|
59
69
|
.#{$form-item-cls}-control {
|