@teamias/rex-pro 0.0.15 → 0.0.17

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); }
@@ -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;
@@ -339,7 +340,7 @@ export var FilterForm = function FilterForm(_ref) {
339
340
  defaultMessage: '自定义筛选条件'
340
341
  })
341
342
  })
342
- })]
343
+ }), buttonExtend === null || buttonExtend === void 0 ? void 0 : buttonExtend(form)]
343
344
  });
344
345
  }
345
346
  },
@@ -157,6 +157,16 @@ export default (function () {
157
157
  props: {
158
158
  value: '0 / 0'
159
159
  }
160
+ }, {
161
+ type: 'link',
162
+ props: {
163
+ label: 'lz20251215001',
164
+ action: 'custom',
165
+ urlMode: 'custom',
166
+ url: '/query/demand/regular-detail/859029010458562561',
167
+ urlTarget: '_self',
168
+ actionType: 'url'
169
+ }
160
170
  }],
161
171
  goods_sales: [{
162
172
  type: 'text',
@@ -19,6 +19,7 @@ import { BaseListTable, BaseTable, useRequestFieldsConfig, useRexProConfigProvid
19
19
  import { Card, Pagination, Skeleton, Space } from 'antd';
20
20
  import { cloneDeep } from 'lodash';
21
21
  import React, { useImperativeHandle, useRef } from 'react';
22
+ import { Navigate } from 'react-router';
22
23
  import { ActionButtons } from "./components/ActionButtons";
23
24
  import { TableActionButtonGroup, ToolbarBox, Wrapper } from "./style";
24
25
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -416,6 +417,48 @@ export var RexProTable = function RexProTable(props) {
416
417
  });
417
418
  }
418
419
  return /*#__PURE__*/_jsx(InlineRexProTable, _objectSpread(_objectSpread({}, props), {}, {
420
+ tableProps: _objectSpread(_objectSpread({}, props.tableProps), {}, {
421
+ onDataCellClickV2: function onDataCellClickV2(topConfig) {
422
+ var _props$tableProps, _props$tableProps$onD;
423
+ // 主要兼容 来自低代码的数据源
424
+ var item = topConfig.item,
425
+ subItem = topConfig.subItem;
426
+ var handleLink = function handleLink(target, url) {
427
+ if (target === '_blank') {
428
+ window.open(url, target);
429
+ } else {
430
+ try {
431
+ Navigate({
432
+ to: url,
433
+ replace: false
434
+ });
435
+ } catch (error) {
436
+ window.location.href = url;
437
+ }
438
+ }
439
+ };
440
+ if (item.type === 'link' || item.type === 'icon') {
441
+ var itemProps = item.props;
442
+ var urlTarget = (itemProps === null || itemProps === void 0 ? void 0 : itemProps.urlTarget) || '_blank';
443
+ var lowCodeActionType = itemProps.actionType;
444
+ var lowCodeUrl = itemProps.url;
445
+ if (lowCodeActionType === 'url' && lowCodeUrl) {
446
+ handleLink(urlTarget, lowCodeUrl);
447
+ return;
448
+ }
449
+ }
450
+ if (subItem && 'action' in subItem) {
451
+ var _urlTarget = (subItem === null || subItem === void 0 ? void 0 : subItem.urlTarget) || '_blank';
452
+ var url = subItem.url;
453
+ var _lowCodeActionType = subItem.actionType;
454
+ if (_lowCodeActionType === 'url' && url) {
455
+ handleLink(_urlTarget, url);
456
+ return;
457
+ }
458
+ }
459
+ (_props$tableProps = props.tableProps) === null || _props$tableProps === void 0 || (_props$tableProps$onD = _props$tableProps.onDataCellClickV2) === null || _props$tableProps$onD === void 0 || _props$tableProps$onD.call(_props$tableProps, topConfig);
460
+ }
461
+ }),
419
462
  reload: reload
420
463
  }));
421
464
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamias/rex-pro",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -59,6 +59,7 @@
59
59
  "lodash": "^4.17.21",
60
60
  "radash": "^12.1.1",
61
61
  "react-intl": "^7.1.11",
62
+ "react-router": "6",
62
63
  "styled-components": "^6.1.19"
63
64
  },
64
65
  "devDependencies": {
@@ -90,7 +91,8 @@
90
91
  "antd": ">=5.0.0",
91
92
  "react": ">=16.9.0",
92
93
  "react-dom": ">=16.9.0",
93
- "react-intl": ">=3.0.0"
94
+ "react-intl": ">=3.0.0",
95
+ "react-router": ">=6"
94
96
  },
95
97
  "packageManager": "pnpm@9.15.9",
96
98
  "publishConfig": {