@teamias/rex-pro 0.0.14 → 0.0.16
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.
|
@@ -6,7 +6,7 @@ import { ReactNode, Ref } from 'react';
|
|
|
6
6
|
* FilterForm 组件 - 支持多语言的筛选表单
|
|
7
7
|
* @param T 表单数据类型
|
|
8
8
|
*/
|
|
9
|
-
export declare const FilterForm: <T extends object>({ itemWidth, displayType, form: outForm, formRef: outFormRef, requestFields, requestFieldsUrl, requestFieldsParams, fieldPropsFn, requestOptions, initialValues: outInitialValues, fieldsConfig, actionRef, onInit: outInit, firstTriggerInitEvent, children, ...otherProps }: IFilterFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const FilterForm: <T extends object>({ itemWidth, displayType, form: outForm, formRef: outFormRef, requestFields, requestFieldsUrl, requestFieldsParams, fieldPropsFn, requestOptions, initialValues: outInitialValues, fieldsConfig, actionRef, onInit: outInit, firstTriggerInitEvent, children, buttonExtend, ...otherProps }: IFilterFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export interface IFilterFormProps<T extends object = object> extends Omit<TRawProFormProps<T>, 'form' | 'layout' | 'initialValues' | 'children'>, Omit<IBaseFormProps, 'fields' | 'fieldProps'> {
|
|
11
11
|
/** 配置数据, 优先级高于url的 */
|
|
12
12
|
requestFields?: () => Promise<TFields>;
|
|
@@ -42,6 +42,8 @@ export interface IFilterFormProps<T extends object = object> extends Omit<TRawPr
|
|
|
42
42
|
displayType: IFilterFormProps['displayType'];
|
|
43
43
|
handlerSelectStyle: (fields: TFields) => TFields;
|
|
44
44
|
}) => ReactNode;
|
|
45
|
+
/** 自定义按钮扩展 */
|
|
46
|
+
buttonExtend?: (form: TForm<T>) => ReactNode;
|
|
45
47
|
}
|
|
46
48
|
type TFieldItem = Exclude<IBaseFormProps['fields'], undefined>[number] & {
|
|
47
49
|
/** 是否作为 可控显隐 的表单项 */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["itemWidth", "displayType", "form", "formRef", "requestFields", "requestFieldsUrl", "requestFieldsParams", "fieldPropsFn", "requestOptions", "initialValues", "fieldsConfig", "actionRef", "onInit", "firstTriggerInitEvent", "children"];
|
|
2
|
+
var _excluded = ["itemWidth", "displayType", "form", "formRef", "requestFields", "requestFieldsUrl", "requestFieldsParams", "fieldPropsFn", "requestOptions", "initialValues", "fieldsConfig", "actionRef", "onInit", "firstTriggerInitEvent", "children", "buttonExtend"];
|
|
3
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
4
|
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."); }
|
|
5
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -19,7 +19,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
19
19
|
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; }
|
|
20
20
|
/* eslint-disable no-param-reassign */
|
|
21
21
|
import { ProForm } from '@ant-design/pro-components';
|
|
22
|
-
import { BaseForm, getFieldsDefaultValues, useRequestFields, useRequestFieldsConfig, useRexProConfigProvider, useStateData } from '@teamias/rex-design';
|
|
22
|
+
import { BaseForm, getFieldsDefaultValues, resetFormTouched, useRequestFields, useRequestFieldsConfig, useRexProConfigProvider, useStateData } from '@teamias/rex-design';
|
|
23
23
|
import { Button, Checkbox, Dropdown, Skeleton, Space } from 'antd';
|
|
24
24
|
import { cloneDeep } from 'lodash';
|
|
25
25
|
import { useEffect, useImperativeHandle, useRef } from 'react';
|
|
@@ -50,6 +50,7 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
50
50
|
outInit = _ref.onInit,
|
|
51
51
|
firstTriggerInitEvent = _ref.firstTriggerInitEvent,
|
|
52
52
|
children = _ref.children,
|
|
53
|
+
buttonExtend = _ref.buttonExtend,
|
|
53
54
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
54
55
|
var _useRexProConfigProvi = useRexProConfigProvider(),
|
|
55
56
|
formatMessage = _useRexProConfigProvi.intl.formatMessage;
|
|
@@ -319,6 +320,9 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
319
320
|
htmlType: "submit",
|
|
320
321
|
type: "primary",
|
|
321
322
|
loading: otherProps.loading || state.fetchLoading,
|
|
323
|
+
onClick: function onClick() {
|
|
324
|
+
return resetFormTouched(form.getFieldsValue(true), form);
|
|
325
|
+
},
|
|
322
326
|
children: formatMessage({
|
|
323
327
|
id: 'pro.components.filter-form.search',
|
|
324
328
|
defaultMessage: '查询'
|
|
@@ -336,7 +340,7 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
336
340
|
defaultMessage: '自定义筛选条件'
|
|
337
341
|
})
|
|
338
342
|
})
|
|
339
|
-
})]
|
|
343
|
+
}), buttonExtend === null || buttonExtend === void 0 ? void 0 : buttonExtend(form)]
|
|
340
344
|
});
|
|
341
345
|
}
|
|
342
346
|
},
|
|
@@ -433,6 +433,45 @@ export default (function () {
|
|
|
433
433
|
// formFieldUrl: '/filterFormProps',
|
|
434
434
|
// formFieldParams?: Record<string, unknown>;
|
|
435
435
|
formFieldConfig: [{
|
|
436
|
+
valueType: 'select',
|
|
437
|
+
field: 'org_id',
|
|
438
|
+
label: '部门',
|
|
439
|
+
options: [{
|
|
440
|
+
label: '1',
|
|
441
|
+
value: '1'
|
|
442
|
+
}, {
|
|
443
|
+
label: '2',
|
|
444
|
+
value: '2'
|
|
445
|
+
}, {
|
|
446
|
+
label: '3',
|
|
447
|
+
value: '3'
|
|
448
|
+
}]
|
|
449
|
+
}, {
|
|
450
|
+
valueType: 'select',
|
|
451
|
+
field: 'job_id',
|
|
452
|
+
label: '岗位',
|
|
453
|
+
options: [{
|
|
454
|
+
label: '1',
|
|
455
|
+
value: '1'
|
|
456
|
+
}, {
|
|
457
|
+
label: '2',
|
|
458
|
+
value: '2'
|
|
459
|
+
}, {
|
|
460
|
+
label: '3',
|
|
461
|
+
value: '3'
|
|
462
|
+
}],
|
|
463
|
+
dependenciesV2: [{
|
|
464
|
+
field: 'org_id',
|
|
465
|
+
action: 'show',
|
|
466
|
+
op: 'notEmpty'
|
|
467
|
+
}, {
|
|
468
|
+
field: 'org_id',
|
|
469
|
+
action: 'updateData'
|
|
470
|
+
}, {
|
|
471
|
+
field: 'org_id',
|
|
472
|
+
action: 'clear'
|
|
473
|
+
}]
|
|
474
|
+
}, {
|
|
436
475
|
valueType: 'multipleComponents',
|
|
437
476
|
label: 'multipleComponents',
|
|
438
477
|
compact: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-pro",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@ant-design/icons": "^6.0.0",
|
|
53
53
|
"@ant-design/pro-components": "^2.8.10",
|
|
54
|
-
"@teamias/rex-design": "^0.0.
|
|
54
|
+
"@teamias/rex-design": "^0.0.37",
|
|
55
55
|
"ahooks": "^3.9.0",
|
|
56
56
|
"antd": "^5.26.7",
|
|
57
57
|
"classnames": "^2.5.1",
|