@teamix/pro 1.2.23 → 1.2.28
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 +129 -129
- package/dist/pro.css +1 -1
- package/dist/pro.js +18109 -15665
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +2 -0
- package/es/actions/dialog.js +4 -3
- package/es/actions/index.d.ts +12 -9
- package/es/actions/index.js +56 -15
- package/es/actions/index.scss +12 -1
- package/es/form/Filter/AdvancedFilter.js +1 -1
- package/es/form/Filter/Layout.d.ts +5 -0
- package/es/form/Filter/Layout.js +82 -0
- package/es/form/Filter/SimpleFilter.js +30 -6
- package/es/form/Filter/index2.d.ts +2 -1
- package/es/form/Filter/index2.js +97 -116
- package/es/form/Filter/index2.scss +16 -45
- package/es/form/Filter/layout.scss +36 -0
- package/es/form/Filter/useSpecialProps.d.ts +6 -0
- package/es/form/Filter/useSpecialProps.js +37 -0
- package/es/form/ProForm/customComponent.d.ts +3 -0
- package/es/form/ProForm/customComponent.js +20 -0
- package/es/form/ProForm/index.scss +5 -6
- package/es/form/ProForm/useFormDisplayValues.js +14 -24
- package/es/form/SchemaForm/adapterType.js +1 -0
- package/es/form/SchemaForm/index.js +8 -6
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.d.ts +1 -1
- package/es/form/SchemaForm/initializeRules.js +3 -3
- package/es/form/fieldTypeMap.js +2 -1
- package/es/form/index.d.ts +4 -2
- package/es/form/index.js +4 -2
- package/es/form/typing.d.ts +25 -1
- package/es/form/utils.d.ts +2 -2
- package/es/form/utils.js +2 -2
- package/es/index.d.ts +5 -2
- package/es/index.js +6 -3
- package/es/info/index.scss +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/HozStepItem/index.js +235 -0
- package/es/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/es/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/VerStepItem/index.js +295 -0
- package/es/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/es/step/ProStepItem/index.d.ts +4 -0
- package/es/step/ProStepItem/index.js +57 -0
- package/es/step/index.d.ts +9 -0
- package/es/step/index.js +101 -0
- package/es/step/typing.d.ts +96 -0
- package/es/step/typing.js +1 -0
- package/es/table/components/Filter/index.js +2 -17
- package/es/table/components/Layout/index.js +63 -167
- package/es/table/components/Layout/index.scss +4 -3
- package/es/table/components/Pagination/index.js +2 -2
- package/es/table/components/Pagination/index.scss +5 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/es/table/components/ToolBar/Fullscreen.js +21 -11
- package/es/table/index.js +82 -104
- package/es/table/index.scss +5 -5
- package/es/table/typing.d.ts +16 -10
- package/es/table/utils/columnRender.js +21 -3
- package/es/table/utils/index.d.ts +7 -0
- package/es/table/utils/index.js +36 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/lib/actions/dialog.js +4 -3
- package/lib/actions/index.d.ts +12 -9
- package/lib/actions/index.js +56 -15
- package/lib/actions/index.scss +12 -1
- package/lib/form/Filter/AdvancedFilter.js +1 -1
- package/lib/form/Filter/Layout.d.ts +5 -0
- package/lib/form/Filter/Layout.js +102 -0
- package/lib/form/Filter/SimpleFilter.js +29 -4
- package/lib/form/Filter/index2.d.ts +2 -1
- package/lib/form/Filter/index2.js +101 -114
- package/lib/form/Filter/index2.scss +16 -45
- package/lib/form/Filter/layout.scss +36 -0
- package/lib/form/Filter/useSpecialProps.d.ts +6 -0
- package/lib/form/Filter/useSpecialProps.js +46 -0
- package/lib/form/ProForm/customComponent.d.ts +3 -0
- package/lib/form/ProForm/customComponent.js +28 -0
- package/lib/form/ProForm/index.scss +5 -6
- package/lib/form/ProForm/useFormDisplayValues.js +17 -24
- package/lib/form/SchemaForm/adapterType.js +1 -0
- package/lib/form/SchemaForm/index.js +8 -6
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRequest.js +2 -2
- package/lib/form/SchemaForm/initializeRules.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRules.js +3 -3
- package/lib/form/fieldTypeMap.js +2 -1
- package/lib/form/index.d.ts +4 -2
- package/lib/form/index.js +19 -1
- package/lib/form/typing.d.ts +25 -1
- package/lib/form/utils.d.ts +2 -2
- package/lib/form/utils.js +2 -2
- package/lib/index.d.ts +5 -2
- package/lib/index.js +35 -3
- package/lib/info/index.scss +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.js +258 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.js +315 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/lib/step/ProStepItem/index.d.ts +4 -0
- package/lib/step/ProStepItem/index.js +69 -0
- package/lib/step/index.d.ts +9 -0
- package/lib/step/index.js +124 -0
- package/lib/step/typing.d.ts +96 -0
- package/lib/step/typing.js +5 -0
- package/lib/table/components/Filter/index.js +2 -17
- package/lib/table/components/Layout/index.js +61 -167
- package/lib/table/components/Layout/index.scss +4 -3
- package/lib/table/components/Pagination/index.js +2 -2
- package/lib/table/components/Pagination/index.scss +5 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/lib/table/components/ToolBar/Fullscreen.js +22 -11
- package/lib/table/index.js +78 -101
- package/lib/table/index.scss +5 -5
- package/lib/table/typing.d.ts +16 -10
- package/lib/table/utils/columnRender.js +21 -3
- package/lib/table/utils/index.d.ts +7 -0
- package/lib/table/utils/index.js +38 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/package.json +4 -4
package/es/actions/dialog.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
1
|
+
var _excluded = ["trigger", "url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
2
2
|
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
3
3
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -81,7 +81,8 @@ export function useDialogAction(action, actionContext) {
|
|
81
81
|
var onActionStart = function onActionStart(context, e) {
|
82
82
|
var _objectSpread2;
|
83
83
|
|
84
|
-
var
|
84
|
+
var trigger = action.trigger,
|
85
|
+
url = action.url,
|
85
86
|
method = action.method,
|
86
87
|
params = action.params,
|
87
88
|
data = action.data,
|
@@ -228,7 +229,7 @@ export function useDialogAction(action, actionContext) {
|
|
228
229
|
})), _objectSpread2), containerProps), containerOtherProps);
|
229
230
|
|
230
231
|
var ret = container.show(quickShowProps);
|
231
|
-
store.hide = ret.hide;
|
232
|
+
store.hide = ret ? ret.hide || ret.close : function () {};
|
232
233
|
};
|
233
234
|
|
234
235
|
return _objectSpread({}, eventHandler(action, actionContext, onActionStart));
|
package/es/actions/index.d.ts
CHANGED
@@ -26,25 +26,28 @@ export declare type ProActionConfig = ({
|
|
26
26
|
} & LinkAction);
|
27
27
|
export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
|
28
28
|
export declare function useAction(config?: ProActionConfig, context?: any): any;
|
29
|
-
export interface ProActionButtonProps extends ButtonProps {
|
30
|
-
key?: string | number;
|
29
|
+
export interface ProActionButtonProps extends ProActionCommonProps, ButtonProps {
|
31
30
|
config?: ProActionConfig;
|
32
|
-
visible?: any;
|
33
31
|
disabled?: any;
|
34
32
|
icon?: string;
|
35
|
-
context?: any;
|
36
33
|
onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
|
37
34
|
}
|
38
35
|
export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
|
39
|
-
export interface
|
36
|
+
export interface ProActionCommonProps {
|
40
37
|
key?: string | number;
|
41
|
-
actions: ProActionProps[];
|
42
38
|
visible?: any;
|
43
|
-
icon?: string;
|
44
39
|
context?: any;
|
45
40
|
}
|
41
|
+
export interface ProActionMenuButtonProps extends ProActionCommonProps, Omit<MenuButtonProps, 'visible'> {
|
42
|
+
actions: ProActionProps[];
|
43
|
+
icon?: string;
|
44
|
+
noArrow?: boolean;
|
45
|
+
}
|
46
46
|
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
47
|
-
export
|
47
|
+
export interface ProActionDividerProps extends ProActionCommonProps {
|
48
|
+
type: 'divider';
|
49
|
+
}
|
50
|
+
export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps | ProActionDividerProps;
|
48
51
|
export declare type ProActionGroupProps = {
|
49
52
|
/** 操作组类型:按钮、文字按钮 */
|
50
53
|
type?: 'button' | 'text';
|
@@ -59,7 +62,7 @@ export declare type ProActionGroupProps = {
|
|
59
62
|
*/
|
60
63
|
moreText?: string;
|
61
64
|
/** 更多按钮的配置,只有在actions数量超过max时才有效 */
|
62
|
-
more?: string |
|
65
|
+
more?: string | Omit<ProActionMenuButtonProps, 'actions'>;
|
63
66
|
/** 是否有分割线,只有type="text"时生效,默认有分割线 */
|
64
67
|
divider?: boolean;
|
65
68
|
} & React.HTMLAttributes<HTMLElement>;
|
package/es/actions/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
var _excluded = ["type"],
|
2
2
|
_excluded2 = ["config", "icon", "iconSize", "type", "context", "children", "visible", "onClick"],
|
3
3
|
_excluded3 = ["loading"],
|
4
|
-
_excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type"],
|
4
|
+
_excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type", "className", "noArrow"],
|
5
5
|
_excluded5 = ["context", "text"],
|
6
6
|
_excluded6 = ["key", "actions"],
|
7
7
|
_excluded7 = ["key", "config"],
|
@@ -209,6 +209,12 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
|
|
209
209
|
};
|
210
210
|
|
211
211
|
function renderCommonActionButtonMenuItem(action, key, context) {
|
212
|
+
if (action.type === 'divider') {
|
213
|
+
return /*#__PURE__*/React.createElement(Menu.Divider, {
|
214
|
+
key: key
|
215
|
+
});
|
216
|
+
}
|
217
|
+
|
212
218
|
var menuBtn = action;
|
213
219
|
|
214
220
|
if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
|
@@ -236,6 +242,8 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
236
242
|
context = props.context,
|
237
243
|
_props$type2 = props.type,
|
238
244
|
type = _props$type2 === void 0 ? 'primary' : _props$type2,
|
245
|
+
className = props.className,
|
246
|
+
noArrow = props.noArrow,
|
239
247
|
others = _objectWithoutProperties(props, _excluded4);
|
240
248
|
|
241
249
|
return /*#__PURE__*/React.createElement(MenuButton, _objectSpread({
|
@@ -249,28 +257,52 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
249
257
|
v2: true
|
250
258
|
},
|
251
259
|
type: type,
|
252
|
-
label: buttonContent(label || children, icon, iconSize, context)
|
260
|
+
label: buttonContent(label || children, icon, iconSize, context),
|
261
|
+
className: cls(className, {
|
262
|
+
'teamix-pro-actions-text-menu-btn-no-arrow': noArrow
|
263
|
+
})
|
253
264
|
}, others), actions.map(function (action, i) {
|
254
265
|
return renderCommonActionButtonMenuItem(action, action.key || i, context);
|
255
266
|
}));
|
256
|
-
}; //
|
267
|
+
}; // 超出 max,则折叠起来
|
257
268
|
|
258
|
-
function
|
259
|
-
|
260
|
-
|
261
|
-
if (actions.length <= MAX) {
|
269
|
+
function foldExtraActions(actions, max, moreConfig) {
|
270
|
+
if (actions.length <= max) {
|
262
271
|
return actions;
|
263
272
|
}
|
264
273
|
|
265
|
-
return [].concat(_toConsumableArray(actions.slice(0,
|
274
|
+
return [].concat(_toConsumableArray(actions.slice(0, max - 1)), [_objectSpread(_objectSpread({
|
266
275
|
key: '__teamix_pro_action_group_more_btn'
|
267
276
|
}, moreConfig), {}, {
|
268
|
-
actions: actions.slice(
|
277
|
+
actions: actions.slice(max - 1)
|
269
278
|
})]);
|
279
|
+
} // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
|
280
|
+
// divider 不计数
|
281
|
+
|
282
|
+
|
283
|
+
function formatGroupActions(actions, max, moreConfig) {
|
284
|
+
var MAX = max < 1 ? MAX_ACTTIONS : max;
|
285
|
+
var count = 0;
|
286
|
+
var index = 0;
|
287
|
+
|
288
|
+
for (; index < actions.length && count < MAX; index++) {
|
289
|
+
if (actions[index].type !== 'divider') {
|
290
|
+
count += 1;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
return foldExtraActions(actions, Math.max(index, MAX), moreConfig);
|
270
295
|
} // 渲染一个 button 或者 menu button
|
271
296
|
|
272
297
|
|
273
298
|
function renderCommonActionButton(button, context, isTypeText) {
|
299
|
+
if (button.type === 'divider') {
|
300
|
+
return /*#__PURE__*/React.createElement(Divider, {
|
301
|
+
key: button.key,
|
302
|
+
direction: "ver"
|
303
|
+
});
|
304
|
+
}
|
305
|
+
|
274
306
|
var buttonContext = button.context,
|
275
307
|
text = button.text,
|
276
308
|
others = _objectWithoutProperties(button, _excluded5);
|
@@ -288,18 +320,27 @@ function renderCommonActionButton(button, context, isTypeText) {
|
|
288
320
|
}
|
289
321
|
|
290
322
|
function getDefaultMoreButton(type, more) {
|
291
|
-
var moreConfig = typeof more === 'string' ? {
|
292
|
-
children: more
|
293
|
-
} : more;
|
294
323
|
var defaultConfig = type === 'button' ? {
|
295
324
|
children: getMessage('more')
|
296
325
|
} : {
|
297
326
|
icon: 'more-line',
|
298
|
-
// iconSize: 'small',
|
299
327
|
autoWidth: false,
|
300
|
-
|
328
|
+
noArrow: true
|
301
329
|
};
|
302
|
-
|
330
|
+
|
331
|
+
if (!more) {
|
332
|
+
return defaultConfig;
|
333
|
+
}
|
334
|
+
|
335
|
+
var moreConfig = typeof more === 'string' ? {
|
336
|
+
children: more
|
337
|
+
} : more;
|
338
|
+
|
339
|
+
if (type === 'button') {
|
340
|
+
return Object.assign(defaultConfig, moreConfig);
|
341
|
+
}
|
342
|
+
|
343
|
+
return moreConfig;
|
303
344
|
}
|
304
345
|
|
305
346
|
var MAX_ACTTIONS = 4;
|
package/es/actions/index.scss
CHANGED
@@ -2,12 +2,23 @@
|
|
2
2
|
display: flex;
|
3
3
|
align-items: center;
|
4
4
|
flex-wrap: wrap;
|
5
|
+
|
6
|
+
& > .next-divider {
|
7
|
+
& + .next-divider {
|
8
|
+
display: none;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
5
12
|
&.teamix-pro-actions-type-button {
|
6
13
|
& > button {
|
7
14
|
&:not(:last-child) {
|
8
15
|
margin-right: var(--s-2);
|
9
16
|
}
|
10
17
|
}
|
18
|
+
& > .next-divider {
|
19
|
+
margin-left: 0;
|
20
|
+
margin-right: var(--s-2);
|
21
|
+
}
|
11
22
|
}
|
12
23
|
|
13
24
|
&.teamix-pro-actions-type-text:not(.teamix-pro-actions-divider) {
|
@@ -109,4 +120,4 @@
|
|
109
120
|
}
|
110
121
|
}
|
111
122
|
}
|
112
|
-
}
|
123
|
+
}
|
@@ -53,7 +53,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
53
53
|
props: {
|
54
54
|
breakpoints: [480, 720, 990, 1200, Infinity],
|
55
55
|
maxColumns: [1, 2, 3, 3, 4],
|
56
|
-
maxWidth: [480, 360, 330,
|
56
|
+
maxWidth: [480, 360, 330, 400],
|
57
57
|
columnGap: 16,
|
58
58
|
rowGap: 12
|
59
59
|
},
|
@@ -0,0 +1,82 @@
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
2
|
+
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
|
+
|
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; }
|
6
|
+
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
8
|
+
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
10
|
+
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
12
|
+
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
14
|
+
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
16
|
+
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
18
|
+
|
19
|
+
import React, { useCallback, useState } from 'react';
|
20
|
+
import cls from 'classnames';
|
21
|
+
import { Button, Badge } from '@alicloudfe/components';
|
22
|
+
import TeamixIcon from '@teamix/icon';
|
23
|
+
import { usePrefixCls, getMessage, isValid } from '@teamix/utils';
|
24
|
+
import './layout.scss';
|
25
|
+
|
26
|
+
var QueryFilterLayout = function QueryFilterLayout(_ref) {
|
27
|
+
var className = _ref.className,
|
28
|
+
addonBefore = _ref.addonBefore,
|
29
|
+
addonAfter = _ref.addonAfter,
|
30
|
+
inlineContent = _ref.inlineContent,
|
31
|
+
panelContent = _ref.panelContent,
|
32
|
+
count = _ref.count,
|
33
|
+
expand = _ref.expand,
|
34
|
+
onExpand = _ref.onExpand,
|
35
|
+
children = _ref.children;
|
36
|
+
var prefixCls = usePrefixCls('', {
|
37
|
+
prefix: 'teamix-pro-form-query-filter-layout'
|
38
|
+
});
|
39
|
+
|
40
|
+
var _useState = useState(!!expand),
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
42
|
+
visible = _useState2[0],
|
43
|
+
setVisible = _useState2[1];
|
44
|
+
|
45
|
+
var onClick = useCallback(function () {
|
46
|
+
setVisible(!visible);
|
47
|
+
onExpand === null || onExpand === void 0 ? void 0 : onExpand(!visible);
|
48
|
+
}, [visible]);
|
49
|
+
return /*#__PURE__*/React.createElement("div", {
|
50
|
+
className: cls(prefixCls, className)
|
51
|
+
}, /*#__PURE__*/React.createElement("div", {
|
52
|
+
className: "".concat(prefixCls, "-inline")
|
53
|
+
}, /*#__PURE__*/React.createElement("div", {
|
54
|
+
className: "".concat(prefixCls, "-left")
|
55
|
+
}, addonBefore ? /*#__PURE__*/React.createElement("div", {
|
56
|
+
className: "".concat(prefixCls, "-addonBefore")
|
57
|
+
}, addonBefore) : null, inlineContent, isValid(panelContent) ? /*#__PURE__*/React.createElement("div", {
|
58
|
+
className: "".concat(prefixCls, "-toggle")
|
59
|
+
}, /*#__PURE__*/React.createElement(Badge, {
|
60
|
+
count: count,
|
61
|
+
style: _objectSpread({
|
62
|
+
backgroundColor: 'var(--color-brand1-6, #0064c8)',
|
63
|
+
color: 'var(--color-white, #fff)'
|
64
|
+
}, visible ? {
|
65
|
+
display: 'none'
|
66
|
+
} : {})
|
67
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
68
|
+
onClick: onClick
|
69
|
+
}, visible ? /*#__PURE__*/React.createElement(TeamixIcon, {
|
70
|
+
type: "up-line"
|
71
|
+
}) : /*#__PURE__*/React.createElement(TeamixIcon, {
|
72
|
+
type: "filter-line"
|
73
|
+
}), getMessage('advancedFilter')))) : null), addonAfter ? /*#__PURE__*/React.createElement("div", {
|
74
|
+
className: "".concat(prefixCls, "-addonAfter")
|
75
|
+
}, addonAfter) : null), /*#__PURE__*/React.createElement("div", {
|
76
|
+
className: cls("".concat(prefixCls, "-panel"), visible && isValid(panelContent) ? '' : "".concat(prefixCls, "-panel-hidden"))
|
77
|
+
}, panelContent), /*#__PURE__*/React.createElement("div", {
|
78
|
+
className: "".concat(prefixCls, "-children")
|
79
|
+
}, children));
|
80
|
+
};
|
81
|
+
|
82
|
+
export { QueryFilterLayout };
|
@@ -10,14 +10,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
10
10
|
|
11
11
|
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; }
|
12
12
|
|
13
|
-
import React, { memo, useMemo } from 'react';
|
13
|
+
import React, { memo, useCallback, useMemo, useRef } from 'react';
|
14
14
|
import cls from 'classnames';
|
15
15
|
import { usePrefixCls } from '@teamix/utils';
|
16
|
-
import ProForm from '../ProForm';
|
16
|
+
import ProForm from '../ProForm'; // 初始化Search组件,内置部分属性
|
17
17
|
|
18
18
|
var initializeSearch = function initializeSearch(schema) {
|
19
|
-
|
19
|
+
var searchName;
|
20
|
+
var initializedSchema = schema.map(function (item) {
|
20
21
|
if (item.component === 'Search') {
|
22
|
+
searchName = item.name;
|
21
23
|
return _objectSpread(_objectSpread({}, item), {}, {
|
22
24
|
decoratorProps: _objectSpread(_objectSpread({}, item.decoratorProps), {}, {
|
23
25
|
inset: false
|
@@ -30,6 +32,10 @@ var initializeSearch = function initializeSearch(schema) {
|
|
30
32
|
|
31
33
|
return item;
|
32
34
|
});
|
35
|
+
return {
|
36
|
+
searchName: searchName,
|
37
|
+
initializedSchema: initializedSchema
|
38
|
+
};
|
33
39
|
};
|
34
40
|
/**
|
35
41
|
* 简单筛选
|
@@ -37,6 +43,8 @@ var initializeSearch = function initializeSearch(schema) {
|
|
37
43
|
|
38
44
|
|
39
45
|
var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
46
|
+
var searchValue = useRef(undefined);
|
47
|
+
|
40
48
|
var schema = props.schema,
|
41
49
|
onChange = props.onChange,
|
42
50
|
onSubmit = props.onSubmit,
|
@@ -45,13 +53,18 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
|
45
53
|
var prefixCls = usePrefixCls('', {
|
46
54
|
prefix: 'teamix-pro-form-query-filter-simple'
|
47
55
|
});
|
56
|
+
|
57
|
+
var _initializeSearch = initializeSearch(schema),
|
58
|
+
searchName = _initializeSearch.searchName,
|
59
|
+
initializedSchema = _initializeSearch.initializedSchema;
|
60
|
+
|
48
61
|
var simpleSchema = useMemo(function () {
|
49
62
|
return [{
|
50
63
|
component: 'FormFlex',
|
51
64
|
props: {
|
52
65
|
size: 8
|
53
66
|
},
|
54
|
-
children:
|
67
|
+
children: initializedSchema
|
55
68
|
}, {
|
56
69
|
component: 'Submit',
|
57
70
|
props: {
|
@@ -60,7 +73,18 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
|
60
73
|
}
|
61
74
|
}
|
62
75
|
}];
|
63
|
-
}, [
|
76
|
+
}, [initializedSchema]);
|
77
|
+
var onInnerChange = useCallback(function (values, value, name) {
|
78
|
+
// 处理Search组件,Select切换时不触发onChange
|
79
|
+
if (searchName === name) {
|
80
|
+
if (searchValue.current !== value[1]) {
|
81
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(values, name, value);
|
82
|
+
searchValue.current = value[1];
|
83
|
+
}
|
84
|
+
} else {
|
85
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(values, name, value);
|
86
|
+
}
|
87
|
+
}, [searchName, searchValue.current]);
|
64
88
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({}, otherProps), {}, {
|
65
89
|
className: cls(prefixCls, props.className),
|
66
90
|
schema: simpleSchema,
|
@@ -68,7 +92,7 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
|
68
92
|
breakpoints: [],
|
69
93
|
inset: true,
|
70
94
|
onSubmit: onSubmit,
|
71
|
-
onChange:
|
95
|
+
onChange: onInnerChange
|
72
96
|
}));
|
73
97
|
});
|
74
98
|
export default SimpleFilter;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { QueryFilterLayout } from './Layout';
|
2
3
|
import type { QueryFilterProps } from '../typing';
|
3
4
|
import './index2.scss';
|
4
5
|
/**
|
5
6
|
* 查询筛选
|
6
7
|
*/
|
7
8
|
declare const QueryFilter: React.FC<QueryFilterProps>;
|
8
|
-
export { QueryFilter };
|
9
|
+
export { QueryFilter, QueryFilterLayout };
|