@teamix/pro 1.2.19 → 1.2.23
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 +3400 -880
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog.js +10 -24
- package/es/actions/index.d.ts +10 -0
- package/es/actions/index.js +11 -16
- package/es/form/Components/LightFilter/componentMap.js +2 -1
- package/es/form/Components/LightFilter/index.js +16 -4
- package/es/form/Components/LightFilter/index.scss +1 -1
- package/es/form/Components/SelectTable/index.d.ts +24 -0
- package/es/form/Components/SelectTable/index.js +135 -0
- package/es/form/Components/SelectTable/index.scss +28 -0
- package/es/form/Components/SelectTable/table.d.ts +6 -0
- package/es/form/Components/SelectTable/table.js +64 -0
- 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 +203 -257
- package/es/form/ProForm/index.js +12 -9
- 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 +7 -3
- 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 +22 -12
- package/es/table/components/Pagination/index.d.ts +7 -0
- package/es/table/components/Pagination/index.js +245 -0
- package/es/table/components/Pagination/index.scss +50 -0
- package/es/table/components/ToolBar/FilterColumnIcon.js +41 -7
- package/es/table/components/ToolBar/index.scss +17 -6
- package/es/table/index.js +96 -37
- package/es/table/index.scss +7 -1
- package/es/table/typing.d.ts +9 -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/dialog.js +9 -23
- package/lib/actions/index.d.ts +10 -0
- package/lib/actions/index.js +11 -16
- package/lib/form/Components/LightFilter/componentMap.js +2 -1
- package/lib/form/Components/LightFilter/index.js +15 -4
- package/lib/form/Components/LightFilter/index.scss +1 -1
- package/lib/form/Components/SelectTable/index.d.ts +24 -0
- package/lib/form/Components/SelectTable/index.js +157 -0
- package/lib/form/Components/SelectTable/index.scss +28 -0
- package/lib/form/Components/SelectTable/table.d.ts +6 -0
- package/lib/form/Components/SelectTable/table.js +76 -0
- 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 +207 -258
- package/lib/form/ProForm/index.js +11 -9
- 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 +7 -3
- 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 +21 -11
- package/lib/table/components/Pagination/index.d.ts +7 -0
- package/lib/table/components/Pagination/index.js +265 -0
- package/lib/table/components/Pagination/index.scss +50 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.js +40 -6
- package/lib/table/components/ToolBar/index.scss +17 -6
- package/lib/table/index.js +96 -36
- package/lib/table/index.scss +7 -1
- package/lib/table/typing.d.ts +9 -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 +2 -2
package/es/actions/dialog.js
CHANGED
@@ -32,7 +32,7 @@ import classnames from 'classnames';
|
|
32
32
|
import { useHistory } from 'react-router-dom';
|
33
33
|
import { Dialog, Drawer } from '@alicloudfe/components';
|
34
34
|
import PopConfirm from '@teamix/pop-confirm';
|
35
|
-
import { getTargetValue, uuid,
|
35
|
+
import { getTargetValue, uuid, getMessage } from '@teamix/utils';
|
36
36
|
import ProForm, { createForm } from '../form';
|
37
37
|
import { renderProMessage } from '../utils/message';
|
38
38
|
import { eventHandler } from './base';
|
@@ -161,48 +161,34 @@ export function useDialogAction(action, actionContext) {
|
|
161
161
|
while (1) {
|
162
162
|
switch (_context.prev = _context.next) {
|
163
163
|
case 0:
|
164
|
-
if (url) {
|
165
|
-
_context.next = 5;
|
166
|
-
break;
|
167
|
-
}
|
168
|
-
|
169
|
-
if (link) {
|
170
|
-
goToLink(link, history);
|
171
|
-
}
|
172
|
-
|
173
|
-
onFinish && onFinish();
|
174
|
-
resolve(true);
|
175
|
-
return _context.abrupt("return");
|
176
|
-
|
177
|
-
case 5:
|
178
164
|
setLoading(true);
|
179
165
|
footerDescriptionValues = Object.assign({}, footerDescriptionRef === null || footerDescriptionRef === void 0 ? void 0 : (_footerDescriptionRef = footerDescriptionRef.current) === null || _footerDescriptionRef === void 0 ? void 0 : _footerDescriptionRef.values);
|
180
|
-
_context.prev =
|
166
|
+
_context.prev = 2;
|
181
167
|
requestContext = Object.assign({
|
182
168
|
footer: footerDescriptionValues
|
183
169
|
}, context);
|
184
|
-
_context.next =
|
170
|
+
_context.next = 6;
|
185
171
|
return doRequest(action, requestContext, history, footerDescriptionValues);
|
186
172
|
|
187
|
-
case
|
173
|
+
case 6:
|
188
174
|
onFinish && onFinish();
|
189
175
|
resolve(true);
|
190
|
-
_context.next =
|
176
|
+
_context.next = 15;
|
191
177
|
break;
|
192
178
|
|
193
|
-
case
|
194
|
-
_context.prev =
|
195
|
-
_context.t0 = _context["catch"](
|
179
|
+
case 10:
|
180
|
+
_context.prev = 10;
|
181
|
+
_context.t0 = _context["catch"](2);
|
196
182
|
setLoading(false);
|
197
183
|
resolve(false);
|
198
184
|
return _context.abrupt("return");
|
199
185
|
|
200
|
-
case
|
186
|
+
case 15:
|
201
187
|
case "end":
|
202
188
|
return _context.stop();
|
203
189
|
}
|
204
190
|
}
|
205
|
-
}, _callee, null, [[
|
191
|
+
}, _callee, null, [[2, 10]]);
|
206
192
|
}));
|
207
193
|
|
208
194
|
return function (_x) {
|
package/es/actions/index.d.ts
CHANGED
@@ -46,11 +46,21 @@ export interface ProActionMenuButtonProps extends MenuButtonProps {
|
|
46
46
|
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
47
47
|
export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps;
|
48
48
|
export declare type ProActionGroupProps = {
|
49
|
+
/** 操作组类型:按钮、文字按钮 */
|
49
50
|
type?: 'button' | 'text';
|
51
|
+
/** 上下文 */
|
50
52
|
context?: any;
|
53
|
+
/** 操作项配置 */
|
51
54
|
actions: ProActionProps[];
|
55
|
+
/** 操作按钮最长数量,超出后折叠,默认为4 */
|
52
56
|
max?: number;
|
57
|
+
/**
|
58
|
+
* @deprecated 建议使用 more 代替
|
59
|
+
*/
|
53
60
|
moreText?: string;
|
61
|
+
/** 更多按钮的配置,只有在actions数量超过max时才有效 */
|
62
|
+
more?: string | ProActionButtonProps;
|
63
|
+
/** 是否有分割线,只有type="text"时生效,默认有分割线 */
|
54
64
|
divider?: boolean;
|
55
65
|
} & React.HTMLAttributes<HTMLElement>;
|
56
66
|
export declare function ProActionGroup(props: ProActionGroupProps): JSX.Element;
|
package/es/actions/index.js
CHANGED
@@ -5,7 +5,7 @@ var _excluded = ["type"],
|
|
5
5
|
_excluded5 = ["context", "text"],
|
6
6
|
_excluded6 = ["key", "actions"],
|
7
7
|
_excluded7 = ["key", "config"],
|
8
|
-
_excluded8 = ["type", "divider", "max", "moreText", "context", "actions", "className"];
|
8
|
+
_excluded8 = ["type", "divider", "max", "moreText", "more", "context", "actions", "className"];
|
9
9
|
|
10
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
11
11
|
|
@@ -287,25 +287,19 @@ function renderCommonActionButton(button, context, isTypeText) {
|
|
287
287
|
return /*#__PURE__*/React.createElement(ProActionMenuButton, _objectSpread({}, buttonProps));
|
288
288
|
}
|
289
289
|
|
290
|
-
function getDefaultMoreButton(type,
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
if (moreText) {
|
298
|
-
return {
|
299
|
-
label: moreText
|
300
|
-
};
|
301
|
-
}
|
302
|
-
|
303
|
-
return {
|
290
|
+
function getDefaultMoreButton(type, more) {
|
291
|
+
var moreConfig = typeof more === 'string' ? {
|
292
|
+
children: more
|
293
|
+
} : more;
|
294
|
+
var defaultConfig = type === 'button' ? {
|
295
|
+
children: getMessage('more')
|
296
|
+
} : {
|
304
297
|
icon: 'more-line',
|
305
298
|
// iconSize: 'small',
|
306
299
|
autoWidth: false,
|
307
300
|
className: 'teamix-pro-actions-text-menu-btn-no-arrow'
|
308
301
|
};
|
302
|
+
return Object.assign(defaultConfig, moreConfig);
|
309
303
|
}
|
310
304
|
|
311
305
|
var MAX_ACTTIONS = 4;
|
@@ -350,6 +344,7 @@ export function ProActionGroup(props) {
|
|
350
344
|
_props$max = props.max,
|
351
345
|
max = _props$max === void 0 ? MAX_ACTTIONS : _props$max,
|
352
346
|
moreText = props.moreText,
|
347
|
+
more = props.more,
|
353
348
|
context = props.context,
|
354
349
|
_props$actions = props.actions,
|
355
350
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
@@ -362,7 +357,7 @@ export function ProActionGroup(props) {
|
|
362
357
|
}).filter(function (action) {
|
363
358
|
return action.visible !== false;
|
364
359
|
});
|
365
|
-
var formatedActions = formatGroupActions(filteredActions, max, getDefaultMoreButton(type, moreText));
|
360
|
+
var formatedActions = formatGroupActions(filteredActions, max, getDefaultMoreButton(type, more || moreText));
|
366
361
|
return /*#__PURE__*/React.createElement("div", _objectSpread({
|
367
362
|
className: cls('teamix-pro-actions', "teamix-pro-actions-type-".concat(type), className, {
|
368
363
|
'teamix-pro-actions-divider': type === 'button' ? false : divider
|
@@ -23,19 +23,31 @@ import TeamixIcon from '@teamix/icon';
|
|
23
23
|
import cls from 'classnames';
|
24
24
|
import { usePrefixCls } from '@teamix/utils';
|
25
25
|
import { componentMap, inputCategory } from './componentMap';
|
26
|
-
import './index.scss';
|
26
|
+
import './index.scss';
|
27
|
+
|
28
|
+
var formatComponent = function formatComponent(schema) {
|
29
|
+
var _schema$enum;
|
30
|
+
|
31
|
+
var component = schema['x-component'];
|
32
|
+
|
33
|
+
if (component === 'Checkbox' && ((_schema$enum = schema['enum']) === null || _schema$enum === void 0 ? void 0 : _schema$enum.length)) {
|
34
|
+
component = 'CheckboxGroup';
|
35
|
+
}
|
36
|
+
|
37
|
+
return componentMap[component] || component;
|
38
|
+
}; // 主激活区内容
|
39
|
+
|
27
40
|
|
28
41
|
var useMain = function useMain(active) {
|
29
42
|
var schema = useFieldSchema();
|
30
43
|
var main = [];
|
31
44
|
schema.mapProperties(function (schema, name) {
|
32
|
-
// console.log(schema.required); // 添加 *
|
33
45
|
if (schema.name === active) {
|
34
46
|
main.push({
|
35
47
|
name: name,
|
36
48
|
schema: _objectSpread(_objectSpread({}, schema), {}, {
|
37
49
|
title: '',
|
38
|
-
'x-component':
|
50
|
+
'x-component': formatComponent(schema)
|
39
51
|
})
|
40
52
|
});
|
41
53
|
}
|
@@ -94,7 +106,7 @@ var LightFilter = observer(function (props) {
|
|
94
106
|
});
|
95
107
|
var onSelectChange = useCallback(function (value) {
|
96
108
|
setActive(value);
|
97
|
-
onFilterChange && onFilterChange(
|
109
|
+
onFilterChange && onFilterChange(value);
|
98
110
|
}, [onFilterChange]);
|
99
111
|
return /*#__PURE__*/React.createElement("span", {
|
100
112
|
className: cls(prefixCls, "".concat(defaultCls).concat(size), isInputCategory(currentSchema) ? "".concat(prefixCls, "-input-category") : '')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TableProps, ColumnProps } from '@alifd/next/types/table';
|
3
|
+
import './index.scss';
|
4
|
+
declare type ISelectTableFilterOption = boolean | ((optipn: any, kewword: string) => boolean);
|
5
|
+
declare type ISelectTableFilterSort = (optionA: any, optionB: any) => number;
|
6
|
+
export interface ISelectTableColumnProps extends ColumnProps {
|
7
|
+
key: React.ReactText;
|
8
|
+
}
|
9
|
+
export interface ISelectTableProps extends TableProps {
|
10
|
+
mode?: 'multiple' | 'single';
|
11
|
+
dataSource?: any[];
|
12
|
+
optionAsValue?: boolean;
|
13
|
+
showSearch?: boolean;
|
14
|
+
filterOption?: ISelectTableFilterOption;
|
15
|
+
filterSort?: ISelectTableFilterSort;
|
16
|
+
onSearch?: (kekword: string) => void;
|
17
|
+
onChange?: (value: any) => void;
|
18
|
+
value?: any;
|
19
|
+
}
|
20
|
+
declare type ComposedSelectTable = React.FC<ISelectTableProps> & {
|
21
|
+
TableColumn?: React.FC<ISelectTableColumnProps>;
|
22
|
+
};
|
23
|
+
declare const SelectTable: ComposedSelectTable;
|
24
|
+
export default SelectTable;
|
@@ -0,0 +1,135 @@
|
|
1
|
+
var _excluded = ["mode", "dataSource", "optionAsValue", "showSearch", "filterOption", "filterSort", "onSearch", "className", "value", "onChange", "rowSelection"];
|
2
|
+
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
|
+
|
5
|
+
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."); }
|
6
|
+
|
7
|
+
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); }
|
8
|
+
|
9
|
+
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; }
|
10
|
+
|
11
|
+
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; }
|
12
|
+
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
14
|
+
|
15
|
+
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; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
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; }
|
20
|
+
|
21
|
+
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; }
|
22
|
+
|
23
|
+
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; }
|
24
|
+
|
25
|
+
import React, { useEffect, useState } from 'react';
|
26
|
+
import { Table, Search } from '@alicloudfe/components';
|
27
|
+
import { observer, useFieldSchema } from '@formily/react';
|
28
|
+
import cls from 'classnames';
|
29
|
+
import { isArr } from '@formily/shared';
|
30
|
+
import { usePrefixCls } from '@teamix/utils';
|
31
|
+
import './index.scss';
|
32
|
+
|
33
|
+
var useColumns = function useColumns() {
|
34
|
+
var schema = useFieldSchema();
|
35
|
+
var columns = [];
|
36
|
+
schema.mapProperties(function (schema, name) {
|
37
|
+
var _schema$xComponent;
|
38
|
+
|
39
|
+
if (((_schema$xComponent = schema['x-component']) === null || _schema$xComponent === void 0 ? void 0 : _schema$xComponent.indexOf('Column')) > -1) {
|
40
|
+
var props = schema === null || schema === void 0 ? void 0 : schema['x-component-props'];
|
41
|
+
columns.push({
|
42
|
+
name: name,
|
43
|
+
props: _objectSpread(_objectSpread({}, props), {}, {
|
44
|
+
title: (props === null || props === void 0 ? void 0 : props.title) || (schema === null || schema === void 0 ? void 0 : schema.title),
|
45
|
+
dataIndex: (props === null || props === void 0 ? void 0 : props.dataIndex) || name
|
46
|
+
}),
|
47
|
+
schema: schema
|
48
|
+
});
|
49
|
+
}
|
50
|
+
});
|
51
|
+
return columns;
|
52
|
+
};
|
53
|
+
|
54
|
+
var SelectTable = observer(function (props) {
|
55
|
+
var mode = props.mode,
|
56
|
+
dataSource = props.dataSource,
|
57
|
+
optionAsValue = props.optionAsValue,
|
58
|
+
showSearch = props.showSearch,
|
59
|
+
filterOption = props.filterOption,
|
60
|
+
filterSort = props.filterSort,
|
61
|
+
onSearch = props.onSearch,
|
62
|
+
className = props.className,
|
63
|
+
value = props.value,
|
64
|
+
onChange = props.onChange,
|
65
|
+
rowSelection = props.rowSelection,
|
66
|
+
otherTableProps = _objectWithoutProperties(props, _excluded);
|
67
|
+
|
68
|
+
var prefixCls = usePrefixCls('formily-selectTable', props);
|
69
|
+
|
70
|
+
var _useState = useState(),
|
71
|
+
_useState2 = _slicedToArray(_useState, 2),
|
72
|
+
selected = _useState2[0],
|
73
|
+
setSelected = _useState2[1];
|
74
|
+
|
75
|
+
var tabs = useColumns();
|
76
|
+
|
77
|
+
var expandedRowRender = function expandedRowRender(record, index) {
|
78
|
+
var children = isArr(record.children) ? record.children : [];
|
79
|
+
return /*#__PURE__*/React.createElement(Table, {
|
80
|
+
dataSource: children,
|
81
|
+
key: index
|
82
|
+
}, tabs.map(function (_ref, key) {
|
83
|
+
var props = _ref.props;
|
84
|
+
return /*#__PURE__*/React.createElement(Table.Column, _objectSpread({
|
85
|
+
key: key
|
86
|
+
}, props));
|
87
|
+
}));
|
88
|
+
};
|
89
|
+
|
90
|
+
var onInnerChange = function onInnerChange(selectedRowKeys, records) {
|
91
|
+
var outputValue = optionAsValue ? records : selectedRowKeys;
|
92
|
+
outputValue = mode === 'single' ? outputValue[0] : outputValue;
|
93
|
+
onChange && onChange(outputValue);
|
94
|
+
};
|
95
|
+
|
96
|
+
useEffect(function () {
|
97
|
+
var primaryKey = props.primaryKey;
|
98
|
+
var inputValue = mode === 'single' ? [value] : isArr(value) ? value : [];
|
99
|
+
inputValue = optionAsValue ? inputValue.map(function (v) {
|
100
|
+
return v === null || v === void 0 ? void 0 : v[primaryKey];
|
101
|
+
}) : inputValue;
|
102
|
+
setSelected(inputValue);
|
103
|
+
}, [value, mode]);
|
104
|
+
return /*#__PURE__*/React.createElement("div", {
|
105
|
+
className: cls(prefixCls, props.className)
|
106
|
+
}, showSearch ? /*#__PURE__*/React.createElement(Search, {
|
107
|
+
className: "".concat(prefixCls, "-search"),
|
108
|
+
onSearch: console.log
|
109
|
+
}) : null, /*#__PURE__*/React.createElement(Table, _objectSpread({
|
110
|
+
className: "".concat(prefixCls, "-table"),
|
111
|
+
dataSource: dataSource,
|
112
|
+
rowSelection: _objectSpread(_objectSpread({}, rowSelection), {}, {
|
113
|
+
mode: mode,
|
114
|
+
onChange: onInnerChange,
|
115
|
+
selectedRowKeys: selected
|
116
|
+
})
|
117
|
+
}, otherTableProps), tabs.map(function (_ref2, key) {
|
118
|
+
var props = _ref2.props;
|
119
|
+
return /*#__PURE__*/React.createElement(Table.Column, _objectSpread({
|
120
|
+
key: key
|
121
|
+
}, props));
|
122
|
+
})));
|
123
|
+
});
|
124
|
+
|
125
|
+
var TableColumn = function TableColumn(_ref3) {
|
126
|
+
var children = _ref3.children;
|
127
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
128
|
+
};
|
129
|
+
|
130
|
+
SelectTable.TableColumn = TableColumn;
|
131
|
+
SelectTable.defaultProps = {
|
132
|
+
showSearch: false,
|
133
|
+
primaryKey: 'key'
|
134
|
+
};
|
135
|
+
export default SelectTable;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
@import '../../global.scss';
|
2
|
+
|
3
|
+
$selectTable: #{$css-prefix}formily-selectTable;
|
4
|
+
|
5
|
+
.#{$selectTable} {
|
6
|
+
.#{$selectTable}-search {
|
7
|
+
margin-bottom: 8px;
|
8
|
+
}
|
9
|
+
.#{$selectTable}-table {
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
.next-table-row-nochildren {
|
14
|
+
> .next-table-expanded {
|
15
|
+
> * {
|
16
|
+
visibility: hidden;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
.next-table-expanded-row {
|
21
|
+
.next-table-body {
|
22
|
+
> tr:last-child {
|
23
|
+
> td {
|
24
|
+
border-bottom: 0;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,64 @@
|
|
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
|
+
import React from 'React';
|
8
|
+
import { Table as NextTable } from '@alicloudfe/components';
|
9
|
+
import './index.scss';
|
10
|
+
|
11
|
+
var Table = function Table(props) {
|
12
|
+
var onChange = function onChange(selectedRowKeys, records) {
|
13
|
+
console.log(selectedRowKeys);
|
14
|
+
};
|
15
|
+
|
16
|
+
var onSelect = function onSelect() {};
|
17
|
+
|
18
|
+
var onSelectAll = function onSelectAll() {};
|
19
|
+
|
20
|
+
var rowProps = function rowProps(record) {
|
21
|
+
var _record$children;
|
22
|
+
|
23
|
+
if (!(record === null || record === void 0 ? void 0 : (_record$children = record.children) === null || _record$children === void 0 ? void 0 : _record$children.length)) {
|
24
|
+
return {// className: 'next-table-row-nochildren',
|
25
|
+
};
|
26
|
+
}
|
27
|
+
|
28
|
+
return {};
|
29
|
+
};
|
30
|
+
|
31
|
+
var expandedRowRender = function expandedRowRender(record, index) {
|
32
|
+
var children = record.children;
|
33
|
+
|
34
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
35
|
+
return React.createElement(Table, _objectSpread(_objectSpread({}, props), {}, {
|
36
|
+
key: index,
|
37
|
+
dataSource: children,
|
38
|
+
hasHeader: false,
|
39
|
+
hasBorder: false,
|
40
|
+
rowProps: rowProps,
|
41
|
+
rowSelection: {
|
42
|
+
onChange: onChange
|
43
|
+
},
|
44
|
+
expandedRowRender: expandedRowRender,
|
45
|
+
expandedRowIndent: [1, 0]
|
46
|
+
}));
|
47
|
+
}
|
48
|
+
|
49
|
+
return React.createElement(React.Fragment, null);
|
50
|
+
};
|
51
|
+
|
52
|
+
return React.createElement(NextTable, _objectSpread(_objectSpread({}, props), {}, {
|
53
|
+
rowProps: rowProps,
|
54
|
+
rowSelection: {
|
55
|
+
onChange: onChange,
|
56
|
+
onSelectAll: onSelectAll,
|
57
|
+
onSelect: onSelect
|
58
|
+
},
|
59
|
+
expandedRowRender: expandedRowRender,
|
60
|
+
expandedRowIndent: [1, 0]
|
61
|
+
}));
|
62
|
+
};
|
63
|
+
|
64
|
+
export default Table;
|
@@ -0,0 +1,114 @@
|
|
1
|
+
var _excluded = ["schema", "onSubmit", "onReset", "onResetClick", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol"];
|
2
|
+
|
3
|
+
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; }
|
4
|
+
|
5
|
+
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; }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
10
|
+
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
12
|
+
|
13
|
+
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); }
|
14
|
+
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
16
|
+
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
18
|
+
|
19
|
+
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; }
|
20
|
+
|
21
|
+
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; }
|
22
|
+
|
23
|
+
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; }
|
24
|
+
|
25
|
+
import React, { memo, useMemo } from 'react';
|
26
|
+
import cls from 'classnames';
|
27
|
+
import { usePrefixCls, getMessage } from '@teamix/utils';
|
28
|
+
import ProForm from '../ProForm';
|
29
|
+
import { mergeArrayValue } from '../utils';
|
30
|
+
/**
|
31
|
+
* 高级筛选
|
32
|
+
*/
|
33
|
+
|
34
|
+
var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
35
|
+
var schema = props.schema,
|
36
|
+
onSubmit = props.onSubmit,
|
37
|
+
onReset = props.onReset,
|
38
|
+
onResetClick = props.onResetClick,
|
39
|
+
layout = props.layout,
|
40
|
+
labelAlign = props.labelAlign,
|
41
|
+
wrapperAlign = props.wrapperAlign,
|
42
|
+
labelCol = props.labelCol,
|
43
|
+
wrapperCol = props.wrapperCol,
|
44
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
45
|
+
|
46
|
+
var prefixCls = usePrefixCls('', {
|
47
|
+
prefix: 'teamix-pro-form-query-filter-advanced'
|
48
|
+
});
|
49
|
+
var gridSchema = useMemo(function () {
|
50
|
+
return [{
|
51
|
+
name: 'FormGrid',
|
52
|
+
component: 'FormGrid',
|
53
|
+
props: {
|
54
|
+
breakpoints: [480, 720, 990, 1200, Infinity],
|
55
|
+
maxColumns: [1, 2, 3, 3, 4],
|
56
|
+
maxWidth: [480, 360, 330, 330, 300],
|
57
|
+
columnGap: 16,
|
58
|
+
rowGap: 12
|
59
|
+
},
|
60
|
+
children: [].concat(_toConsumableArray(schema), [{
|
61
|
+
component: 'FormGrid.GridColumn',
|
62
|
+
props: {
|
63
|
+
gridSpan: -1
|
64
|
+
},
|
65
|
+
children: [{
|
66
|
+
component: 'FormButtonGroup',
|
67
|
+
props: {
|
68
|
+
align: 'right'
|
69
|
+
},
|
70
|
+
children: [{
|
71
|
+
component: 'Reset',
|
72
|
+
props: {
|
73
|
+
onResetValidateSuccess: onReset,
|
74
|
+
onClick: onResetClick,
|
75
|
+
children: getMessage('reset')
|
76
|
+
}
|
77
|
+
}, {
|
78
|
+
component: 'Submit',
|
79
|
+
props: {
|
80
|
+
style: {
|
81
|
+
marginRight: -8
|
82
|
+
},
|
83
|
+
children: getMessage('search')
|
84
|
+
}
|
85
|
+
}]
|
86
|
+
}]
|
87
|
+
}])
|
88
|
+
}];
|
89
|
+
}, [schema, onReset, onResetClick]);
|
90
|
+
var getTeamixLayout = useMemo(function () {
|
91
|
+
return {
|
92
|
+
breakpoints: [990],
|
93
|
+
layout: mergeArrayValue(['vertical'], layout),
|
94
|
+
labelAlign: mergeArrayValue(['left'], labelAlign),
|
95
|
+
wrapperAlign: mergeArrayValue(['left'], wrapperAlign),
|
96
|
+
labelCol: mergeArrayValue([24], labelCol),
|
97
|
+
wrapperCol: mergeArrayValue([24], wrapperCol)
|
98
|
+
};
|
99
|
+
}, [layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
100
|
+
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread({
|
101
|
+
className: cls(prefixCls, props.className),
|
102
|
+
schema: gridSchema,
|
103
|
+
feedbackLayout: "popover"
|
104
|
+
}, otherProps), getTeamixLayout), {}, {
|
105
|
+
onSubmit: onSubmit
|
106
|
+
}));
|
107
|
+
});
|
108
|
+
AdvancedFilter.defaultProps = {
|
109
|
+
layout: 'horizontal',
|
110
|
+
labelAlign: 'right',
|
111
|
+
labelCol: 6,
|
112
|
+
wrapperCol: 18
|
113
|
+
};
|
114
|
+
export default AdvancedFilter;
|