@zat-design/sisyphus-react 3.6.5 → 3.6.6-beta.3
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/es/ProEditTable/components/RcTable/BaseTable.d.ts +6 -0
- package/es/ProEditTable/components/RcTable/BaseTable.js +75 -0
- package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +7 -0
- package/es/ProEditTable/components/RcTable/DraggableTable.js +90 -0
- package/es/ProEditTable/components/RcTable/VirtualTable.d.ts +6 -0
- package/es/ProEditTable/components/RcTable/VirtualTable.js +166 -0
- package/es/ProEditTable/components/RcTable/index.d.ts +6 -0
- package/es/ProEditTable/components/RcTable/index.js +6 -0
- package/es/ProEditTable/components/RenderField/index.js +65 -45
- package/es/ProEditTable/index.js +32 -55
- package/es/ProEditTable/propsType.d.ts +6 -0
- package/es/ProEditTable/utils/index.js +1 -1
- package/es/ProForm/components/base/InputNumber/index.js +20 -11
- package/es/ProForm/index.d.ts +3 -2
- package/es/ProForm/index.js +3 -17
- package/es/ProForm/utils/useShouldUpdate.js +9 -1
- package/es/ProForm/utils/useWatch.d.ts +7 -0
- package/es/ProForm/utils/useWatch.js +77 -0
- package/es/ProTable/utils.js +1 -1
- package/es/ProTree/components/ProTreeSelect/index.js +15 -4
- package/lib/ProEditTable/components/RcTable/BaseTable.d.ts +6 -0
- package/lib/ProEditTable/components/RcTable/BaseTable.js +81 -0
- package/lib/ProEditTable/components/RcTable/DraggableTable.d.ts +7 -0
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +96 -0
- package/lib/ProEditTable/components/RcTable/VirtualTable.d.ts +6 -0
- package/lib/ProEditTable/components/RcTable/VirtualTable.js +172 -0
- package/lib/ProEditTable/components/RcTable/index.d.ts +6 -0
- package/lib/ProEditTable/components/RcTable/index.js +27 -0
- package/lib/ProEditTable/components/RenderField/index.js +65 -45
- package/lib/ProEditTable/index.js +31 -52
- package/lib/ProEditTable/propsType.d.ts +6 -0
- package/lib/ProEditTable/utils/index.js +1 -1
- package/lib/ProForm/components/base/InputNumber/index.js +20 -11
- package/lib/ProForm/index.d.ts +3 -2
- package/lib/ProForm/index.js +2 -16
- package/lib/ProForm/utils/useShouldUpdate.js +9 -1
- package/lib/ProForm/utils/useWatch.d.ts +7 -0
- package/lib/ProForm/utils/useWatch.js +87 -0
- package/lib/ProTable/utils.js +1 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +15 -4
- package/package.json +5 -3
    
        package/es/ProEditTable/index.js
    CHANGED
    
    | @@ -1,7 +1,5 @@ | |
| 1 1 | 
             
            import "antd/es/affix/style";
         | 
| 2 2 | 
             
            import _Affix from "antd/es/affix";
         | 
| 3 | 
            -
            import "antd/es/table/style";
         | 
| 4 | 
            -
            import _Table from "antd/es/table";
         | 
| 5 3 | 
             
            import _typeof from "@babel/runtime/helpers/esm/typeof";
         | 
| 6 4 | 
             
            import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
         | 
| 7 5 | 
             
            import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
         | 
| @@ -11,7 +9,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | |
| 11 9 | 
             
            import "antd/es/form/style";
         | 
| 12 10 | 
             
            import _Form from "antd/es/form";
         | 
| 13 11 | 
             
            import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
         | 
| 14 | 
            -
            var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
         | 
| 12 | 
            +
            var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
         | 
| 15 13 | 
             
            import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
         | 
| 16 14 | 
             
            import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
         | 
| 17 15 | 
             
            import { get, isArray, isBoolean } from 'lodash';
         | 
| @@ -19,12 +17,13 @@ import { useDeepCompareEffect, useLocalStorageState, useSetState } from 'ahooks' | |
| 19 17 | 
             
            import classnames from 'classnames';
         | 
| 20 18 | 
             
            import { transformColumns } from './utils';
         | 
| 21 19 | 
             
            import { getRandom, getNamePath } from './utils/tools';
         | 
| 22 | 
            -
            import {  | 
| 20 | 
            +
            import { Validator, Summary, RenderToolbar } from './components';
         | 
| 23 21 | 
             
            import ProForm from '../ProForm';
         | 
| 24 22 | 
             
            import Empty from '../assets/empty.png';
         | 
| 25 23 | 
             
            import locale, { formatMessage } from '../locale';
         | 
| 24 | 
            +
            import { BaseTable, DraggableTable, VirtualTable } from './components/RcTable';
         | 
| 26 25 | 
             
            var ProEditTable = function ProEditTable(_ref, ref) {
         | 
| 27 | 
            -
              var _resetProps$id, _resetProps$id$split, _themeConfig$data2 | 
| 26 | 
            +
              var _resetProps$id, _resetProps$id$split, _themeConfig$data2;
         | 
| 28 27 | 
             
              var value = _ref.value,
         | 
| 29 28 | 
             
                onChange = _ref.onChange,
         | 
| 30 29 | 
             
                onDrag = _ref.onDrag,
         | 
| @@ -34,6 +33,7 @@ var ProEditTable = function ProEditTable(_ref, ref) { | |
| 34 33 | 
             
                mode = _ref.mode,
         | 
| 35 34 | 
             
                stripe = _ref.stripe,
         | 
| 36 35 | 
             
                draggable = _ref.draggable,
         | 
| 36 | 
            +
                virtual = _ref.virtual,
         | 
| 37 37 | 
             
                disabled = _ref.disabled,
         | 
| 38 38 | 
             
                insertType = _ref.insertType,
         | 
| 39 39 | 
             
                emptyBtnText = _ref.emptyBtnText,
         | 
| @@ -326,62 +326,38 @@ var ProEditTable = function ProEditTable(_ref, ref) { | |
| 326 326 | 
             
                  rowSelection: renderRowSelection()
         | 
| 327 327 | 
             
                });
         | 
| 328 328 | 
             
              } : summary;
         | 
| 329 | 
            +
              var TableComponent = draggable ? DraggableTable : virtual ? VirtualTable : BaseTable;
         | 
| 329 330 | 
             
              return _jsxs(_Fragment, {
         | 
| 330 331 | 
             
                children: [_jsxs(_ConfigProvider, {
         | 
| 331 332 | 
             
                  renderEmpty: (value === null || value === void 0 ? void 0 : value.length) ? undefined : empty,
         | 
| 332 | 
            -
                  children: [ | 
| 333 | 
            -
                     | 
| 334 | 
            -
             | 
| 335 | 
            -
             | 
| 336 | 
            -
             | 
| 337 | 
            -
                     | 
| 338 | 
            -
                     | 
| 339 | 
            -
                       | 
| 340 | 
            -
                       | 
| 341 | 
            -
             | 
| 342 | 
            -
                      ref: tableRef,
         | 
| 333 | 
            +
                  children: [_jsx(TableComponent, _objectSpread(_objectSpread({}, resetProps), {}, {
         | 
| 334 | 
            +
                    draggableProps: {
         | 
| 335 | 
            +
                      onChange: onChange,
         | 
| 336 | 
            +
                      onDrag: onDrag,
         | 
| 337 | 
            +
                      draggable: draggable
         | 
| 338 | 
            +
                    },
         | 
| 339 | 
            +
                    tableProps: {
         | 
| 340 | 
            +
                      value: value,
         | 
| 341 | 
            +
                      headerRender: headerRender,
         | 
| 342 | 
            +
                      tableRef: tableRef,
         | 
| 343 343 | 
             
                      className: _className,
         | 
| 344 | 
            -
                      dataSource: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value : undefined,
         | 
| 345 344 | 
             
                      columns: _columns,
         | 
| 346 | 
            -
                       | 
| 345 | 
            +
                      renderRowSelection: renderRowSelection,
         | 
| 347 346 | 
             
                      rowClassName: _rowClassName,
         | 
| 348 | 
            -
                       | 
| 349 | 
            -
             | 
| 350 | 
            -
             | 
| 351 | 
            -
             | 
| 352 | 
            -
                       | 
| 353 | 
            -
                       | 
| 354 | 
            -
             | 
| 355 | 
            -
             | 
| 356 | 
            -
             | 
| 357 | 
            -
             | 
| 358 | 
            -
             | 
| 359 | 
            -
             | 
| 360 | 
            -
             | 
| 361 | 
            -
             | 
| 362 | 
            -
                      pagination: pagination ? _objectSpread({
         | 
| 363 | 
            -
                        current: page.pageNum,
         | 
| 364 | 
            -
                        pageSize: page.pageSize,
         | 
| 365 | 
            -
                        showSizeChanger: false,
         | 
| 366 | 
            -
                        showQuickJumper: true,
         | 
| 367 | 
            -
                        total: value === null || value === void 0 ? void 0 : value.length,
         | 
| 368 | 
            -
                        showTotal: function showTotal(total) {
         | 
| 369 | 
            -
                          var _locale$ProEditTable;
         | 
| 370 | 
            -
                          if (!total) return;
         | 
| 371 | 
            -
                          return formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProEditTable = locale.ProEditTable) === null || _locale$ProEditTable === void 0 ? void 0 : _locale$ProEditTable.total, {
         | 
| 372 | 
            -
                            total: total
         | 
| 373 | 
            -
                          });
         | 
| 374 | 
            -
                        },
         | 
| 375 | 
            -
                        onChange: handlePageChange
         | 
| 376 | 
            -
                      }, pagination) : false,
         | 
| 377 | 
            -
                      rowKey: "rowKey",
         | 
| 378 | 
            -
                      scroll: {
         | 
| 379 | 
            -
                        x: scroll === null || scroll === void 0 ? void 0 : scroll.x,
         | 
| 380 | 
            -
                        y: (value === null || value === void 0 ? void 0 : value.length) ? scroll === null || scroll === void 0 ? void 0 : scroll.y : undefined
         | 
| 381 | 
            -
                      },
         | 
| 382 | 
            -
                      summary: _summary
         | 
| 383 | 
            -
                    }))]
         | 
| 384 | 
            -
                  }), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? _jsx(_Affix, _objectSpread(_objectSpread({
         | 
| 347 | 
            +
                      disabled: disabled,
         | 
| 348 | 
            +
                      virtualKey: virtualKey,
         | 
| 349 | 
            +
                      editingKeys: editingKeys,
         | 
| 350 | 
            +
                      isHideCheckBox: isHideCheckBox,
         | 
| 351 | 
            +
                      rowDraggable: rowDraggable,
         | 
| 352 | 
            +
                      pagination: pagination,
         | 
| 353 | 
            +
                      scroll: scroll,
         | 
| 354 | 
            +
                      summary: _summary,
         | 
| 355 | 
            +
                      page: page,
         | 
| 356 | 
            +
                      formatMessage: formatMessage,
         | 
| 357 | 
            +
                      locale: locale,
         | 
| 358 | 
            +
                      handlePageChange: handlePageChange
         | 
| 359 | 
            +
                    }
         | 
| 360 | 
            +
                  })), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? _jsx(_Affix, _objectSpread(_objectSpread({
         | 
| 385 361 | 
             
                    ref: affixRef
         | 
| 386 362 | 
             
                  }, _toolbarSticky), {}, {
         | 
| 387 363 | 
             
                    children: _jsx("div", {
         | 
| @@ -414,6 +390,7 @@ ForwardProEditTable.defaultProps = { | |
| 414 390 | 
             
              toolbarProps: [],
         | 
| 415 391 | 
             
              disabled: false,
         | 
| 416 392 | 
             
              draggable: false,
         | 
| 393 | 
            +
              virtual: false,
         | 
| 417 394 | 
             
              stripe: true,
         | 
| 418 395 | 
             
              emptyBtnText: locale.ProEditTable.clickAdd,
         | 
| 419 396 | 
             
              onlyOneLineMsg: locale.ProEditTable.onlyOneLineMsg,
         | 
| @@ -100,6 +100,7 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro | |
| 100 100 | 
             
                hiddenNames?: NamePath[] | NamePath[][];
         | 
| 101 101 | 
             
                rules?: ProRule[] | RulesFn<T>;
         | 
| 102 102 | 
             
                confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps | void>;
         | 
| 103 | 
            +
                validateTrigger?: string | string[];
         | 
| 103 104 | 
             
                [key: string]: any;
         | 
| 104 105 | 
             
            }
         | 
| 105 106 | 
             
            export type ProEditTableColumnsProps<K = any> = ProColumnsProps & ColumnPropsMap<K, 'ProEditTable'>;
         | 
| @@ -191,6 +192,11 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang | |
| 191 192 | 
             
                 * @default           -
         | 
| 192 193 | 
             
                 */
         | 
| 193 194 | 
             
                draggable?: boolean;
         | 
| 195 | 
            +
                /**
         | 
| 196 | 
            +
               * @description       是否开启虚拟列表(scroll,x,y必须为固定值)
         | 
| 197 | 
            +
               * @default           -
         | 
| 198 | 
            +
               */
         | 
| 199 | 
            +
                virtual?: boolean;
         | 
| 194 200 | 
             
                /**
         | 
| 195 201 | 
             
                 * @description       空列表状态时,自定义添加按钮
         | 
| 196 202 | 
             
                 * @default          点击添加
         | 
| @@ -121,7 +121,7 @@ var getActionColumn = function getActionColumn(config) { | |
| 121 121 | 
             
                        case 20:
         | 
| 122 122 | 
             
                          result = _context.sent;
         | 
| 123 123 | 
             
                        case 21:
         | 
| 124 | 
            -
                          if (result && type !== 'custom') {
         | 
| 124 | 
            +
                          if (result !== false && type !== 'custom') {
         | 
| 125 125 | 
             
                            actions[type](_objectSpread(_objectSpread({}, config), {}, {
         | 
| 126 126 | 
             
                              rowName: [].concat(_toConsumableArray(name), [index]),
         | 
| 127 127 | 
             
                              virtualRowName: rowName,
         | 
| @@ -35,6 +35,7 @@ var limitNumber = function limitNumber(num, _ref) { | |
| 35 35 | 
             
              return num;
         | 
| 36 36 | 
             
            };
         | 
| 37 37 | 
             
            var InputNumber = function InputNumber(props) {
         | 
| 38 | 
            +
              var _props$precision4;
         | 
| 38 39 | 
             
              var placeholder = props.placeholder,
         | 
| 39 40 | 
             
                className = props.className,
         | 
| 40 41 | 
             
                otherProps = props.otherProps,
         | 
| @@ -55,28 +56,33 @@ var InputNumber = function InputNumber(props) { | |
| 55 56 | 
             
              var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
         | 
| 56 57 | 
             
              var valueProps = {};
         | 
| 57 58 | 
             
              var formatter = function formatter(value) {
         | 
| 59 | 
            +
                var _props$precision;
         | 
| 58 60 | 
             
                if (value === '') return '';
         | 
| 59 61 | 
             
                var num = Number(value);
         | 
| 60 62 | 
             
                if (Number.isNaN(num)) {
         | 
| 61 63 | 
             
                  return value;
         | 
| 62 64 | 
             
                }
         | 
| 63 65 | 
             
                var val = num.toLocaleString('en-US', {
         | 
| 64 | 
            -
                  maximumFractionDigits: (props === null || props === void 0 ? void 0 : props.precision)  | 
| 66 | 
            +
                  maximumFractionDigits: (_props$precision = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision !== void 0 ? _props$precision : 2
         | 
| 65 67 | 
             
                });
         | 
| 66 68 | 
             
                if (!activateRef.current) {
         | 
| 69 | 
            +
                  var _props$precision2;
         | 
| 67 70 | 
             
                  var _val$split = val.split('.'),
         | 
| 68 71 | 
             
                    _val$split2 = _slicedToArray(_val$split, 2),
         | 
| 69 72 | 
             
                    int = _val$split2[0],
         | 
| 70 73 | 
             
                    _val$split2$ = _val$split2[1],
         | 
| 71 74 | 
             
                    float = _val$split2$ === void 0 ? '' : _val$split2$;
         | 
| 72 | 
            -
                   | 
| 75 | 
            +
                  if ((props === null || props === void 0 ? void 0 : props.precision) === 0) {
         | 
| 76 | 
            +
                    return int;
         | 
| 77 | 
            +
                  }
         | 
| 78 | 
            +
                  return "".concat(int, ".").concat(float.padEnd((_props$precision2 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision2 !== void 0 ? _props$precision2 : 2, '0'));
         | 
| 73 79 | 
             
                }
         | 
| 74 80 | 
             
                return val;
         | 
| 75 81 | 
             
              };
         | 
| 76 82 | 
             
              var _parser = function parser(value, precision) {
         | 
| 77 | 
            -
                var num = Number(value.replace(/[\s,]+/g, ''));
         | 
| 78 83 | 
             
                if (value === '') return value;
         | 
| 79 | 
            -
                 | 
| 84 | 
            +
                var num = Number(value.replace(/[\s,]+/g, ''));
         | 
| 85 | 
            +
                return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : value : num.toFixed(precision);
         | 
| 80 86 | 
             
              };
         | 
| 81 87 | 
             
              if (valueType) {
         | 
| 82 88 | 
             
                switch (valueType) {
         | 
| @@ -88,8 +94,10 @@ var InputNumber = function InputNumber(props) { | |
| 88 94 | 
             
                    valueProps = {
         | 
| 89 95 | 
             
                      formatter: formatter,
         | 
| 90 96 | 
             
                      parser: function parser(val) {
         | 
| 91 | 
            -
                         | 
| 92 | 
            -
             | 
| 97 | 
            +
                        var _props$precision3;
         | 
| 98 | 
            +
                        return _parser(val, (_props$precision3 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision3 !== void 0 ? _props$precision3 : 2);
         | 
| 99 | 
            +
                      },
         | 
| 100 | 
            +
                      precision: (_props$precision4 = props === null || props === void 0 ? void 0 : props.precision) !== null && _props$precision4 !== void 0 ? _props$precision4 : 2
         | 
| 93 101 | 
             
                    };
         | 
| 94 102 | 
             
                    break;
         | 
| 95 103 | 
             
                  // 百分比
         | 
| @@ -177,7 +185,7 @@ var InputNumber = function InputNumber(props) { | |
| 177 185 | 
             
                      var originValue = calc(Number(value), '/', 100);
         | 
| 178 186 | 
             
                      // 获取真实数据的小数位数
         | 
| 179 187 | 
             
                      var decimalDigits = getDecimalDigits(originValue);
         | 
| 180 | 
            -
                      if (decimalDigits > (precision  | 
| 188 | 
            +
                      if (decimalDigits > (precision !== null && precision !== void 0 ? precision : 4)) {
         | 
| 181 189 | 
             
                        return _jsx(Container, {
         | 
| 182 190 | 
             
                          viewEmpty: viewEmpty,
         | 
| 183 191 | 
             
                          children: value
         | 
| @@ -195,7 +203,7 @@ var InputNumber = function InputNumber(props) { | |
| 195 203 | 
             
                      var _originValue = calc(Number(value), '/', 1000);
         | 
| 196 204 | 
             
                      // 获取真实数据的小数位数
         | 
| 197 205 | 
             
                      var _decimalDigits = getDecimalDigits(_originValue);
         | 
| 198 | 
            -
                      if (_decimalDigits > (precision  | 
| 206 | 
            +
                      if (_decimalDigits > (precision !== null && precision !== void 0 ? precision : 5)) {
         | 
| 199 207 | 
             
                        return _jsx(Container, {
         | 
| 200 208 | 
             
                          viewEmpty: viewEmpty,
         | 
| 201 209 | 
             
                          children: value
         | 
| @@ -212,7 +220,7 @@ var InputNumber = function InputNumber(props) { | |
| 212 220 | 
             
                  case 'thousandth':
         | 
| 213 221 | 
             
                    return _jsx(Container, {
         | 
| 214 222 | 
             
                      viewEmpty: viewEmpty,
         | 
| 215 | 
            -
                      children: tools.formatAmount(value, precision  | 
| 223 | 
            +
                      children: tools.formatAmount(value, precision !== null && precision !== void 0 ? precision : 2)
         | 
| 216 224 | 
             
                    });
         | 
| 217 225 | 
             
                  // CNY千分位
         | 
| 218 226 | 
             
                  case 'thousandthCNY':
         | 
| @@ -232,7 +240,7 @@ var InputNumber = function InputNumber(props) { | |
| 232 240 | 
             
              }
         | 
| 233 241 | 
             
              // 失去焦点时处理数字,
         | 
| 234 242 | 
             
              var handleBlur = function handleBlur(e) {
         | 
| 235 | 
            -
                var _e$target, _e$target2;
         | 
| 243 | 
            +
                var _e$target, _props$precision5, _valueProps3, _e$target2;
         | 
| 236 244 | 
             
                activateRef.current = false;
         | 
| 237 245 | 
             
                var value = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value;
         | 
| 238 246 | 
             
                if (_max !== undefined && value > _max) {
         | 
| @@ -241,7 +249,8 @@ var InputNumber = function InputNumber(props) { | |
| 241 249 | 
             
                if (_min !== undefined && value < _min) {
         | 
| 242 250 | 
             
                  value = _min;
         | 
| 243 251 | 
             
                }
         | 
| 244 | 
            -
                value = _parser(String(value), props.precision);
         | 
| 252 | 
            +
                value = _parser(String(value), (_props$precision5 = props.precision) !== null && _props$precision5 !== void 0 ? _props$precision5 : (_valueProps3 = valueProps) === null || _valueProps3 === void 0 ? void 0 : _valueProps3.precision);
         | 
| 253 | 
            +
                rest === null || rest === void 0 ? void 0 : rest.onChange(value);
         | 
| 245 254 | 
             
                var limit = {
         | 
| 246 255 | 
             
                  min: Number(_min),
         | 
| 247 256 | 
             
                  max: Number(_max)
         | 
    
        package/es/ProForm/index.d.ts
    CHANGED
    
    | @@ -1,11 +1,12 @@ | |
| 1 | 
            -
            import {  | 
| 1 | 
            +
            import { FormInstance } from 'antd';
         | 
| 2 2 | 
             
            import React, { ForwardRefRenderFunction } from 'react';
         | 
| 3 3 | 
             
            import { FormProviderProps } from 'antd/es/form/context';
         | 
| 4 4 | 
             
            import { ProFormProps } from './propsType';
         | 
| 5 5 | 
             
            import { useForm } from './utils/useForm';
         | 
| 6 | 
            +
            import useWatch from './utils/useWatch';
         | 
| 6 7 | 
             
            interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormProps<T>> {
         | 
| 7 8 | 
             
                useForm: typeof useForm;
         | 
| 8 | 
            -
                useWatch: typeof  | 
| 9 | 
            +
                useWatch: typeof useWatch;
         | 
| 9 10 | 
             
                [key: string]: any;
         | 
| 10 11 | 
             
            }
         | 
| 11 12 | 
             
            declare const ProFormForward: IProForm;
         | 
    
        package/es/ProForm/index.js
    CHANGED
    
    | @@ -16,7 +16,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | |
| 16 16 | 
             
            import { DoubleLeftOutlined } from '@ant-design/icons';
         | 
| 17 17 | 
             
            import classnames from 'classnames';
         | 
| 18 18 | 
             
            import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
         | 
| 19 | 
            -
            import { isObject,  | 
| 19 | 
            +
            import { isObject, merge } from 'lodash';
         | 
| 20 20 | 
             
            import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
         | 
| 21 21 | 
             
            import RenderFields from './components/render/RenderFields';
         | 
| 22 22 | 
             
            import { useProConfig, useContextForms } from '../ProConfigProvider';
         | 
| @@ -24,6 +24,7 @@ import { getLayout, splitNameStr, useControlled, initialValuesToNames, filterInt | |
| 24 24 | 
             
            import { useForm } from './utils/useForm';
         | 
| 25 25 | 
             
            import { useFieldProps } from './utils/useFieldProps';
         | 
| 26 26 | 
             
            import locale from '../locale';
         | 
| 27 | 
            +
            import useWatch from './utils/useWatch';
         | 
| 27 28 | 
             
            var ProForm = function ProForm(props, ref) {
         | 
| 28 29 | 
             
              var _forms$formKey, _localStorage, _ref;
         | 
| 29 30 | 
             
              var _props$mode = props.mode,
         | 
| @@ -273,22 +274,7 @@ var ProForm = function ProForm(props, ref) { | |
| 273 274 | 
             
            // @ts-ignore
         | 
| 274 275 | 
             
            var ProFormForward = /*#__PURE__*/forwardRef(ProForm);
         | 
| 275 276 | 
             
            ProFormForward.useForm = useForm;
         | 
| 276 | 
            -
            ProFormForward.useWatch =  | 
| 277 | 
            -
              if (isString(watchValue)) {
         | 
| 278 | 
            -
                var watchValues = [watchValue];
         | 
| 279 | 
            -
                watchValues.forEach(function (item) {
         | 
| 280 | 
            -
                  _Form.useWatch(item, form);
         | 
| 281 | 
            -
                });
         | 
| 282 | 
            -
                return form.getFieldsValue(watchValues);
         | 
| 283 | 
            -
              }
         | 
| 284 | 
            -
              if (watchValue.length) {
         | 
| 285 | 
            -
                watchValue.forEach(function (item) {
         | 
| 286 | 
            -
                  _Form.useWatch(item, form);
         | 
| 287 | 
            -
                });
         | 
| 288 | 
            -
                return form.getFieldsValue(watchValue);
         | 
| 289 | 
            -
              }
         | 
| 290 | 
            -
              return _Form.useWatch([], form);
         | 
| 291 | 
            -
            };
         | 
| 277 | 
            +
            ProFormForward.useWatch = useWatch;
         | 
| 292 278 | 
             
            export var ProFormProvider = function ProFormProvider(props) {
         | 
| 293 279 | 
             
              var onFormChange = props.onFormChange,
         | 
| 294 280 | 
             
                onFormFinish = props.onFormFinish,
         | 
| @@ -22,6 +22,7 @@ var useShouldUpdate = function useShouldUpdate(props) { | |
| 22 22 | 
             
                names = formItemProps.names,
         | 
| 23 23 | 
             
                dependencies = formItemProps.dependencies;
         | 
| 24 24 | 
             
              var timerRef = useRef();
         | 
| 25 | 
            +
              var needClear = useRef(); // 是否需要执行清值操作
         | 
| 25 26 | 
             
              var showRef = useRef();
         | 
| 26 27 | 
             
              var disabledRef = useRef();
         | 
| 27 28 | 
             
              var requiredRef = useRef();
         | 
| @@ -158,17 +159,24 @@ var useShouldUpdate = function useShouldUpdate(props) { | |
| 158 159 | 
             
                  }) : fieldProps;
         | 
| 159 160 | 
             
                  // 清值防抖  多次刷新时以最后一次为准
         | 
| 160 161 | 
             
                  if (clearNotShow !== false && (name || names)) {
         | 
| 162 | 
            +
                    // 当show为其他变为false的时候记录一次需要清值
         | 
| 163 | 
            +
                    if (_show !== showRef.current && _show === false) {
         | 
| 164 | 
            +
                      needClear.current = true;
         | 
| 165 | 
            +
                    }
         | 
| 161 166 | 
             
                    if (_show === false) {
         | 
| 162 167 | 
             
                      clearTimeout(timerRef.current);
         | 
| 163 168 | 
             
                      timerRef.current = setTimeout(function () {
         | 
| 169 | 
            +
                        if (needClear.current !== true) return;
         | 
| 164 170 | 
             
                        if (Array.isArray(names)) {
         | 
| 165 171 | 
             
                          form.resetFields(names);
         | 
| 166 172 | 
             
                        } else {
         | 
| 167 173 | 
             
                          var clearName = formItemProps.namePath ? formItemProps.namePath.slice(0, -1).concat(formItemProps.name) : formItemProps.name;
         | 
| 168 174 | 
             
                          form.resetFields([clearName]);
         | 
| 169 175 | 
             
                        }
         | 
| 170 | 
            -
             | 
| 176 | 
            +
                        needClear.current = false;
         | 
| 177 | 
            +
                      }, 300);
         | 
| 171 178 | 
             
                    } else {
         | 
| 179 | 
            +
                      needClear.current = false;
         | 
| 172 180 | 
             
                      clearTimeout(timerRef.current);
         | 
| 173 181 | 
             
                    }
         | 
| 174 182 | 
             
                  }
         | 
| @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            import { InternalNamePath, FormInstance, NamePath } from 'rc-field-form/es/interface';
         | 
| 2 | 
            +
            export declare function toArray<T>(value?: T | T[] | null): T[];
         | 
| 3 | 
            +
            export declare function getNamePath(path: NamePath | null): InternalNamePath;
         | 
| 4 | 
            +
            export declare function stringify(value: any): string | number;
         | 
| 5 | 
            +
            declare function useWatch(dependencies: string, form?: FormInstance, wait?: number): any;
         | 
| 6 | 
            +
            declare function useWatch(dependencies: NamePath[], form?: FormInstance, wait?: number): any[];
         | 
| 7 | 
            +
            export default useWatch;
         | 
| @@ -0,0 +1,77 @@ | |
| 1 | 
            +
            import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
         | 
| 2 | 
            +
            import { debounce } from 'lodash';
         | 
| 3 | 
            +
            import { HOOK_MARK } from 'rc-field-form/es/FieldContext';
         | 
| 4 | 
            +
            import warning from 'rc-util/lib/warning';
         | 
| 5 | 
            +
            import { useState, useEffect, useRef, useMemo } from 'react';
         | 
| 6 | 
            +
            export function toArray(value) {
         | 
| 7 | 
            +
              if (value === undefined || value === null) {
         | 
| 8 | 
            +
                return [];
         | 
| 9 | 
            +
              }
         | 
| 10 | 
            +
              return Array.isArray(value) ? value : [value];
         | 
| 11 | 
            +
            }
         | 
| 12 | 
            +
            export function getNamePath(path) {
         | 
| 13 | 
            +
              return toArray(path);
         | 
| 14 | 
            +
            }
         | 
| 15 | 
            +
            export function stringify(value) {
         | 
| 16 | 
            +
              try {
         | 
| 17 | 
            +
                return JSON.stringify(value);
         | 
| 18 | 
            +
              } catch (err) {
         | 
| 19 | 
            +
                return Math.random();
         | 
| 20 | 
            +
              }
         | 
| 21 | 
            +
            }
         | 
| 22 | 
            +
            // 创建之后namepath就不可变
         | 
| 23 | 
            +
            var useWatchWarning = process.env.NODE_ENV !== 'production' ? function (namePath) {
         | 
| 24 | 
            +
              var fullyStr = JSON.stringify(namePath);
         | 
| 25 | 
            +
              var nameStrRef = useRef(fullyStr);
         | 
| 26 | 
            +
              warning(nameStrRef.current === fullyStr, '`useWatch` is not support dynamic `namePath`. Please provide static instead.');
         | 
| 27 | 
            +
            } : function () {};
         | 
| 28 | 
            +
            function useWatch(dependencies, form, wait) {
         | 
| 29 | 
            +
              var isSingle = typeof dependencies === 'string';
         | 
| 30 | 
            +
              var _useState = useState({}),
         | 
| 31 | 
            +
                _useState2 = _slicedToArray(_useState, 2),
         | 
| 32 | 
            +
                value = _useState2[0],
         | 
| 33 | 
            +
                setValue = _useState2[1];
         | 
| 34 | 
            +
              var valueStr = useMemo(function () {
         | 
| 35 | 
            +
                return stringify(value);
         | 
| 36 | 
            +
              }, [value]);
         | 
| 37 | 
            +
              var valueStrRef = useRef(valueStr);
         | 
| 38 | 
            +
              valueStrRef.current = valueStr;
         | 
| 39 | 
            +
              var formInstance = form;
         | 
| 40 | 
            +
              var isValidForm = formInstance && formInstance._init;
         | 
| 41 | 
            +
              var _dependencies = isSingle ? [dependencies] : dependencies;
         | 
| 42 | 
            +
              var namePaths = _dependencies === null || _dependencies === void 0 ? void 0 : _dependencies.map(function (item) {
         | 
| 43 | 
            +
                return getNamePath(item);
         | 
| 44 | 
            +
              });
         | 
| 45 | 
            +
              var namePathsRef = useRef(namePaths);
         | 
| 46 | 
            +
              namePathsRef.current = namePaths;
         | 
| 47 | 
            +
              useWatchWarning(namePaths);
         | 
| 48 | 
            +
              useEffect(function () {
         | 
| 49 | 
            +
                if (!isValidForm) return;
         | 
| 50 | 
            +
                var getFieldsValue = formInstance.getFieldsValue,
         | 
| 51 | 
            +
                  getInternalHooks = formInstance.getInternalHooks;
         | 
| 52 | 
            +
                var _getInternalHooks = getInternalHooks(HOOK_MARK),
         | 
| 53 | 
            +
                  registerWatch = _getInternalHooks.registerWatch;
         | 
| 54 | 
            +
                var callback = function callback() {
         | 
| 55 | 
            +
                  var newValue = getFieldsValue(_dependencies);
         | 
| 56 | 
            +
                  var nextValueStr = stringify(newValue);
         | 
| 57 | 
            +
                  // Compare stringify in case it's nest object
         | 
| 58 | 
            +
                  if (valueStrRef.current !== nextValueStr) {
         | 
| 59 | 
            +
                    valueStrRef.current = nextValueStr;
         | 
| 60 | 
            +
                    setValue(getFieldsValue(_dependencies));
         | 
| 61 | 
            +
                  }
         | 
| 62 | 
            +
                };
         | 
| 63 | 
            +
                // 增加防抖
         | 
| 64 | 
            +
                if (wait) {
         | 
| 65 | 
            +
                  callback = debounce(callback, wait);
         | 
| 66 | 
            +
                }
         | 
| 67 | 
            +
                var cancelRegister = registerWatch(callback);
         | 
| 68 | 
            +
                var initialValue = getFieldsValue(_dependencies);
         | 
| 69 | 
            +
                setValue(initialValue);
         | 
| 70 | 
            +
                return cancelRegister;
         | 
| 71 | 
            +
              },
         | 
| 72 | 
            +
              // We do not need re-register since namePath content is the same
         | 
| 73 | 
            +
              // eslint-disable-next-line react-hooks/exhaustive-deps
         | 
| 74 | 
            +
              [isValidForm]);
         | 
| 75 | 
            +
              return value;
         | 
| 76 | 
            +
            }
         | 
| 77 | 
            +
            export default useWatch;
         | 
    
        package/es/ProTable/utils.js
    CHANGED
    
    | @@ -105,7 +105,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO | |
| 105 105 | 
             
              if (['percentage', 'permillage'].includes(valueType)) {
         | 
| 106 106 | 
             
                column.render = function (value, record, index) {
         | 
| 107 107 | 
             
                  var multiple = valueType === 'percentage' ? 100 : 1000;
         | 
| 108 | 
            -
                  var realValue = tools.calc(Number(value), '*', multiple);
         | 
| 108 | 
            +
                  var realValue = tools.calc(Number(value !== null && value !== void 0 ? value : 0), '*', multiple);
         | 
| 109 109 | 
             
                  var renderValue = getDecimalDigits(value) > valueTypePrecision ? realValue : realValue.toFixed(valueTypePrecision);
         | 
| 110 110 | 
             
                  var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
         | 
| 111 111 | 
             
                  var originalRealValue = tools.calc(Number(originalValue || null), '*', multiple);
         | 
| @@ -355,9 +355,9 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) { | |
| 355 355 | 
             
                    }
         | 
| 356 356 | 
             
                    // 迭代完子节点向上回溯,如果有匹配到得子节点,那么加入当前节点得孩子对象上,否则加入得是空数组
         | 
| 357 357 | 
             
                    item.children = currentNodeChild;
         | 
| 358 | 
            -
                    // let tag = false;
         | 
| 359 358 | 
             
                    // 判断节点title是否包含关键字 如果有,那么直接进行下一循环
         | 
| 360 | 
            -
                     | 
| 359 | 
            +
                    // @ts-ignore
         | 
| 360 | 
            +
                    if (item[label].indexOf(keyWord) > -1 && (selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode) !== 'treeSelect') {
         | 
| 361 361 | 
             
                      var regExp = new RegExp(keyWord);
         | 
| 362 362 | 
             
                      item[label] = item[label].replace(regExp, "<span class=\"highlight-search-text\">".concat(keyWord, "</span>"));
         | 
| 363 363 | 
             
                    }
         | 
| @@ -419,11 +419,22 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) { | |
| 419 419 | 
             
              }
         | 
| 420 420 | 
             
              var handleChange = function handleChange(newVal, label, extra) {
         | 
| 421 421 | 
             
                // newVal回来得一定是label、value
         | 
| 422 | 
            +
                var _selectList = selectList.map(function (item) {
         | 
| 423 | 
            +
                  var label = item.label;
         | 
| 424 | 
            +
                  var _label = label;
         | 
| 425 | 
            +
                  if (label) {
         | 
| 426 | 
            +
                    var regex = /<span class="highlight-search-text">(.*?)<\/span>/g;
         | 
| 427 | 
            +
                    _label = item[label] = label === null || label === void 0 ? void 0 : label.replace(regex, '$1');
         | 
| 428 | 
            +
                  }
         | 
| 429 | 
            +
                  return _objectSpread(_objectSpread({}, item), {}, {
         | 
| 430 | 
            +
                    label: _label
         | 
| 431 | 
            +
                  });
         | 
| 432 | 
            +
                });
         | 
| 422 433 | 
             
                var result = newVal;
         | 
| 423 434 | 
             
                if (props === null || props === void 0 ? void 0 : props.labelInValue) {
         | 
| 424 | 
            -
                  result = getLabelByValue( | 
| 435 | 
            +
                  result = getLabelByValue(_selectList, newVal);
         | 
| 425 436 | 
             
                }
         | 
| 426 | 
            -
                var options = findTreeNode( | 
| 437 | 
            +
                var options = findTreeNode(_selectList, extra === null || extra === void 0 ? void 0 : extra.triggerValue);
         | 
| 427 438 | 
             
                onChange && onChange(result, options, extra);
         | 
| 428 439 | 
             
                // 重置搜索
         | 
| 429 440 | 
             
                showSearch && searchTreeEvent('');
         | 
| @@ -0,0 +1,81 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
         | 
| 4 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 5 | 
            +
              value: true
         | 
| 6 | 
            +
            });
         | 
| 7 | 
            +
            exports.default = void 0;
         | 
| 8 | 
            +
            var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
         | 
| 9 | 
            +
            var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
         | 
| 10 | 
            +
            var _jsxRuntime = require("react/jsx-runtime");
         | 
| 11 | 
            +
            var _antd = require("antd");
         | 
| 12 | 
            +
            var _react = require("react");
         | 
| 13 | 
            +
            var _excluded = ["tableProps"];
         | 
| 14 | 
            +
            var BaseTable = function BaseTable(_ref) {
         | 
| 15 | 
            +
              var _value$;
         | 
| 16 | 
            +
              var tableProps = _ref.tableProps,
         | 
| 17 | 
            +
                resetProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
         | 
| 18 | 
            +
              var value = tableProps.value,
         | 
| 19 | 
            +
                headerRender = tableProps.headerRender,
         | 
| 20 | 
            +
                tableRef = tableProps.tableRef,
         | 
| 21 | 
            +
                className = tableProps.className,
         | 
| 22 | 
            +
                columns = tableProps.columns,
         | 
| 23 | 
            +
                renderRowSelection = tableProps.renderRowSelection,
         | 
| 24 | 
            +
                rowClassName = tableProps.rowClassName,
         | 
| 25 | 
            +
                disabled = tableProps.disabled,
         | 
| 26 | 
            +
                virtualKey = tableProps.virtualKey,
         | 
| 27 | 
            +
                editingKeys = tableProps.editingKeys,
         | 
| 28 | 
            +
                isHideCheckBox = tableProps.isHideCheckBox,
         | 
| 29 | 
            +
                rowDraggable = tableProps.rowDraggable,
         | 
| 30 | 
            +
                pagination = tableProps.pagination,
         | 
| 31 | 
            +
                scroll = tableProps.scroll,
         | 
| 32 | 
            +
                summary = tableProps.summary,
         | 
| 33 | 
            +
                page = tableProps.page,
         | 
| 34 | 
            +
                formatMessage = tableProps.formatMessage,
         | 
| 35 | 
            +
                locale = tableProps.locale,
         | 
| 36 | 
            +
                handlePageChange = tableProps.handlePageChange;
         | 
| 37 | 
            +
              return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
         | 
| 38 | 
            +
                children: [headerRender ? (0, _jsxRuntime.jsx)("div", {
         | 
| 39 | 
            +
                  className: "pro-edit-table-header",
         | 
| 40 | 
            +
                  children: typeof headerRender === 'function' ? headerRender() : headerRender
         | 
| 41 | 
            +
                }) : null, (0, _jsxRuntime.jsx)(_antd.Table, (0, _objectSpread2.default)((0, _objectSpread2.default)({
         | 
| 42 | 
            +
                  ref: tableRef,
         | 
| 43 | 
            +
                  className: className,
         | 
| 44 | 
            +
                  dataSource: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value : undefined,
         | 
| 45 | 
            +
                  columns: columns,
         | 
| 46 | 
            +
                  rowSelection: renderRowSelection(),
         | 
| 47 | 
            +
                  rowClassName: rowClassName,
         | 
| 48 | 
            +
                  onRow: function onRow() {
         | 
| 49 | 
            +
                    return {
         | 
| 50 | 
            +
                      disabled: disabled || virtualKey && !!editingKeys.length,
         | 
| 51 | 
            +
                      'data-hide': isHideCheckBox,
         | 
| 52 | 
            +
                      onClick: function onClick() {},
         | 
| 53 | 
            +
                      rowDraggable: rowDraggable
         | 
| 54 | 
            +
                    };
         | 
| 55 | 
            +
                  }
         | 
| 56 | 
            +
                }, resetProps), {}, {
         | 
| 57 | 
            +
                  pagination: pagination ? (0, _objectSpread2.default)({
         | 
| 58 | 
            +
                    current: page.pageNum,
         | 
| 59 | 
            +
                    pageSize: page.pageSize,
         | 
| 60 | 
            +
                    showSizeChanger: false,
         | 
| 61 | 
            +
                    showQuickJumper: true,
         | 
| 62 | 
            +
                    total: value === null || value === void 0 ? void 0 : value.length,
         | 
| 63 | 
            +
                    showTotal: function showTotal(total) {
         | 
| 64 | 
            +
                      var _locale$ProEditTable;
         | 
| 65 | 
            +
                      if (!total) return;
         | 
| 66 | 
            +
                      return formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProEditTable = locale.ProEditTable) === null || _locale$ProEditTable === void 0 ? void 0 : _locale$ProEditTable.total, {
         | 
| 67 | 
            +
                        total: total
         | 
| 68 | 
            +
                      });
         | 
| 69 | 
            +
                    },
         | 
| 70 | 
            +
                    onChange: handlePageChange
         | 
| 71 | 
            +
                  }, pagination) : false,
         | 
| 72 | 
            +
                  rowKey: "rowKey",
         | 
| 73 | 
            +
                  scroll: {
         | 
| 74 | 
            +
                    x: scroll === null || scroll === void 0 ? void 0 : scroll.x,
         | 
| 75 | 
            +
                    y: (value === null || value === void 0 ? void 0 : value.length) ? scroll === null || scroll === void 0 ? void 0 : scroll.y : undefined
         | 
| 76 | 
            +
                  },
         | 
| 77 | 
            +
                  summary: summary
         | 
| 78 | 
            +
                }))]
         | 
| 79 | 
            +
              });
         | 
| 80 | 
            +
            };
         | 
| 81 | 
            +
            var _default = exports.default = /*#__PURE__*/(0, _react.memo)(BaseTable);
         |