wargerm 0.2.13 → 0.2.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.
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { DatePickerProps, RangePickerProps } from 'antd/lib/date-picker';
3
+ export declare type IndexComponent = React.FC<DatePickerProps> & {
4
+ RangePicker: React.FC<RangePickerProps>;
5
+ };
6
+ declare const Index: IndexComponent;
7
+ export default Index;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { default as Checkbox } from './components/Checkbox';
8
8
  export { default as Radio } from './components/Radio';
9
9
  export { default as Select } from './components/Select';
10
10
  export { default as DatePicker } from './components/DatePicker';
11
+ export { default as WDatePicker } from './components/WDatePicker';
11
12
  export { default as Switch } from './components/Switch';
12
13
  export { default as TreeSelect } from './components/TreeSelect';
13
14
  export { default as WForm } from './components/WForm';
package/dist/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import 'antd/es/dropdown/style';
4
4
  import _Dropdown from 'antd/es/dropdown';
5
5
  import 'antd/es/menu/style';
6
6
  import _Menu from 'antd/es/menu';
7
- import React, { useState, useEffect, useMemo, useRef, useImperativeHandle } from 'react';
7
+ import React, { useState, useEffect, useMemo, useImperativeHandle, useRef } from 'react';
8
8
  import { createFromIconfontCN, SearchOutlined, ReloadOutlined, CloseCircleOutlined, PlusOutlined, EditOutlined, EyeOutlined, ExclamationCircleOutlined, DeleteOutlined } from '@ant-design/icons';
9
9
  import 'antd/es/input/style';
10
10
  import _Input from 'antd/es/input';
@@ -523,39 +523,47 @@ var WSelect = function WSelect(props) {
523
523
  valueEnumList = _useState4[0],
524
524
  setValueEnumList = _useState4[1];
525
525
 
526
- useEffect(function () {
527
- _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
528
- var res, node;
529
- return regeneratorRuntime.wrap(function _callee$(_context) {
530
- while (1) {
531
- switch (_context.prev = _context.next) {
532
- case 0:
533
- if (!request) {
534
- _context.next = 7;
535
- break;
536
- }
526
+ var _useState5 = useState(null),
527
+ _useState6 = _slicedToArray(_useState5, 2),
528
+ resList = _useState6[0],
529
+ setResList = _useState6[1];
537
530
 
538
- _context.next = 3;
539
- return request();
531
+ useEffect(function () {
532
+ if (!resList) {
533
+ _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
534
+ var res, node;
535
+ return regeneratorRuntime.wrap(function _callee$(_context) {
536
+ while (1) {
537
+ switch (_context.prev = _context.next) {
538
+ case 0:
539
+ if (!request) {
540
+ _context.next = 8;
541
+ break;
542
+ }
540
543
 
541
- case 3:
542
- res = _context.sent;
543
- onLoad && onLoad(res);
544
- node = res.map(function (item) {
545
- return /*#__PURE__*/React.createElement(_Select.Option, {
546
- key: item.value,
547
- value: item.value
548
- }, item.label);
549
- });
550
- setChildrenNode(node);
544
+ _context.next = 3;
545
+ return request();
551
546
 
552
- case 7:
553
- case "end":
554
- return _context.stop();
547
+ case 3:
548
+ res = _context.sent;
549
+ setResList(res);
550
+ onLoad && onLoad(res);
551
+ node = res.map(function (item) {
552
+ return /*#__PURE__*/React.createElement(_Select.Option, {
553
+ key: item.value,
554
+ value: item.value
555
+ }, item.label);
556
+ });
557
+ setChildrenNode(node);
558
+
559
+ case 8:
560
+ case "end":
561
+ return _context.stop();
562
+ }
555
563
  }
556
- }
557
- }, _callee);
558
- }))();
564
+ }, _callee);
565
+ }))();
566
+ }
559
567
 
560
568
  var valueEnumNode = [];
561
569
  var options = [];
@@ -585,7 +593,7 @@ var WSelect = function WSelect(props) {
585
593
 
586
594
  onLoad && onLoad(options);
587
595
  setValueEnumList(valueEnumNode);
588
- }, []);
596
+ }, [resList]);
589
597
  return /*#__PURE__*/React.createElement(_Select, _objectSpread2({}, extraProps), request ? childrenNode : valueEnum ? valueEnumList : children);
590
598
  };
591
599
 
@@ -7532,8 +7540,65 @@ Table.defaultProps = {
7532
7540
  rowKey: 'key'
7533
7541
  };
7534
7542
 
7535
- var _excluded$5 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
7536
- var RangePicker$2 = Index$2.RangePicker;
7543
+ var _excluded$5 = ["defaultValue", "format", "value", "onChange"],
7544
+ _excluded2$1 = ["defaultValue", "value", "format", "onChange"];
7545
+
7546
+ var momentValue = function momentValue(value) {
7547
+ if (value) {
7548
+ return hooks(value);
7549
+ }
7550
+ };
7551
+
7552
+ var WDatePicker$1 = function WDatePicker(props) {
7553
+ var defaultValue = props.defaultValue,
7554
+ format = props.format,
7555
+ value = props.value,
7556
+ _onChange = props.onChange,
7557
+ extraProps = _objectWithoutProperties(props, _excluded$5);
7558
+
7559
+ return (
7560
+ /*#__PURE__*/
7561
+ // <ConfigProvider locale={zhCN}>
7562
+ React.createElement(_DatePicker, _objectSpread2({
7563
+ defaultValue: momentValue(defaultValue),
7564
+ value: momentValue(value),
7565
+ onChange: function onChange(v) {
7566
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(v, momentValue(v).format(format || 'YYYY-MM-DD'));
7567
+ }
7568
+ }, extraProps)) // </ConfigProvider>
7569
+
7570
+ );
7571
+ };
7572
+
7573
+ WDatePicker$1.defaultProps = {};
7574
+
7575
+ var RangePicker$2 = function RangePicker(props) {
7576
+ var defaultValue = props.defaultValue,
7577
+ value = props.value,
7578
+ format = props.format,
7579
+ _onChange2 = props.onChange,
7580
+ extraProps = _objectWithoutProperties(props, _excluded2$1);
7581
+
7582
+ return (
7583
+ /*#__PURE__*/
7584
+ // <ConfigProvider locale={zhCN}>
7585
+ React.createElement(_DatePicker.RangePicker, _objectSpread2({
7586
+ defaultValue: momentValue(defaultValue),
7587
+ value: momentValue(value),
7588
+ onChange: function onChange(v) {
7589
+ _onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2(v, momentValue(v).format(format || 'YYYY-MM-DD'));
7590
+ }
7591
+ }, extraProps)) // </ConfigProvider>
7592
+
7593
+ );
7594
+ };
7595
+
7596
+ RangePicker$2.defaultProps = {};
7597
+ var Index$6 = WDatePicker$1;
7598
+ Index$6.RangePicker = RangePicker$2;
7599
+
7600
+ var _excluded$6 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
7601
+ var RangePicker$3 = Index$6.RangePicker;
7537
7602
 
7538
7603
  var WForm = function WForm(props, ref) {
7539
7604
  var columns = props.columns,
@@ -7546,13 +7611,12 @@ var WForm = function WForm(props, ref) {
7546
7611
  onFormChange = props.onFormChange,
7547
7612
  onSubmit = props.onSubmit,
7548
7613
  onReset = props.onReset,
7549
- extraProps = _objectWithoutProperties(props, _excluded$5);
7614
+ extraProps = _objectWithoutProperties(props, _excluded$6);
7550
7615
 
7551
7616
  var _Form$useForm = _Form.useForm(),
7552
7617
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
7553
- form = _Form$useForm2[0];
7618
+ form = _Form$useForm2[0]; // const columnsFieldsRef = useRef<any>({});
7554
7619
 
7555
- var columnsFieldsRef = useRef({});
7556
7620
 
7557
7621
  var _useState = useState({}),
7558
7622
  _useState2 = _slicedToArray(_useState, 2),
@@ -7625,10 +7689,9 @@ var WForm = function WForm(props, ref) {
7625
7689
  placeholder: "\u8BF7\u9009\u62E9",
7626
7690
  disabled: disabled,
7627
7691
  onLoad: function onLoad(opt) {
7628
- if (columnsFieldsRef.current) {
7629
- columnsFieldsRef.current[c.dataIndex] = opt;
7630
- }
7631
-
7692
+ // if (columnsFieldsRef.current) {
7693
+ // columnsFieldsRef.current[c.dataIndex] = opt;
7694
+ // }
7632
7695
  setColumnsFields(function (preColumnsFields) {
7633
7696
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
7634
7697
  });
@@ -7712,7 +7775,7 @@ var WForm = function WForm(props, ref) {
7712
7775
  name: c.dataIndex,
7713
7776
  label: c.title,
7714
7777
  labelCol: _labelCol2
7715
- }), /*#__PURE__*/React.createElement(Index$2, _objectSpread2(_objectSpread2(_objectSpread2({
7778
+ }), /*#__PURE__*/React.createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
7716
7779
  disabled: disabled,
7717
7780
  placeholder: "\u8BF7\u8F93\u5165"
7718
7781
  }, picker), showTime), c.fieldProps))));
@@ -7748,7 +7811,7 @@ var WForm = function WForm(props, ref) {
7748
7811
  name: c.dataIndex,
7749
7812
  label: c.title,
7750
7813
  labelCol: _labelCol3
7751
- }), /*#__PURE__*/React.createElement(RangePicker$2, _objectSpread2(_objectSpread2({
7814
+ }), /*#__PURE__*/React.createElement(RangePicker$3, _objectSpread2(_objectSpread2({
7752
7815
  disabled: disabled
7753
7816
  }, _showTime), c.fieldProps))));
7754
7817
  } else if (c.valueType === 'checkbox') {
@@ -7766,11 +7829,10 @@ var WForm = function WForm(props, ref) {
7766
7829
 
7767
7830
  if (c.options) {
7768
7831
  options = c.options;
7769
- }
7832
+ } // if (columnsFieldsRef.current) {
7833
+ // columnsFieldsRef.current[c.dataIndex] = options;
7834
+ // }
7770
7835
 
7771
- if (columnsFieldsRef.current) {
7772
- columnsFieldsRef.current[c.dataIndex] = options;
7773
- }
7774
7836
 
7775
7837
  setColumnsFields(function (preColumnsFields) {
7776
7838
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, options));
@@ -7816,11 +7878,10 @@ var WForm = function WForm(props, ref) {
7816
7878
  value: _key
7817
7879
  });
7818
7880
  }
7819
- }
7881
+ } // if (columnsFieldsRef.current) {
7882
+ // columnsFieldsRef.current[c.dataIndex] = options;
7883
+ // }
7820
7884
 
7821
- if (columnsFieldsRef.current) {
7822
- columnsFieldsRef.current[c.dataIndex] = _options;
7823
- }
7824
7885
 
7825
7886
  setColumnsFields(function (preColumnsFields) {
7826
7887
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options));
@@ -7880,11 +7941,10 @@ var WForm = function WForm(props, ref) {
7880
7941
  _labelCol6.style = {
7881
7942
  width: search.labelWidth
7882
7943
  };
7883
- }
7944
+ } // if (columnsFieldsRef.current) {
7945
+ // columnsFieldsRef.current[c.dataIndex] = options;
7946
+ // }
7884
7947
 
7885
- if (columnsFieldsRef.current) {
7886
- columnsFieldsRef.current[c.dataIndex] = _options2;
7887
- }
7888
7948
 
7889
7949
  setColumnsFields(function (preColumnsFields) {
7890
7950
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options2));
@@ -7944,8 +8004,8 @@ var WForm = function WForm(props, ref) {
7944
8004
  var baseitem = c.renderFormItem(c, _objectSpread2(_objectSpread2({}, c), {}, {
7945
8005
  formItemProps: c.formItemProps,
7946
8006
  fieldProps: c.fieldProps,
7947
- columnsFields: columnsFields,
7948
- columnsFieldsRef: columnsFieldsRef
8007
+ columnsFields: columnsFields // columnsFieldsRef,
8008
+
7949
8009
  }), form);
7950
8010
  return baseitem ? /*#__PURE__*/React.createElement(_Col, _objectSpread2(_objectSpread2({
7951
8011
  style: {
@@ -8042,7 +8102,7 @@ var WForm = function WForm(props, ref) {
8042
8102
  }, c.fieldProps))));
8043
8103
  }
8044
8104
  });
8045
- }, [changedValues, columns, disabled, columnsFieldsRef, JSON.stringify(form.getFieldsValue())]);
8105
+ }, [changedValues, columns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue())]);
8046
8106
  var filterExtraColumnsForm = useMemo(function () {
8047
8107
  return filterExtraFormColumns.map(function (c) {
8048
8108
  var colProps = {};
@@ -8092,10 +8152,9 @@ var WForm = function WForm(props, ref) {
8092
8152
  placeholder: "\u8BF7\u9009\u62E9",
8093
8153
  disabled: disabled,
8094
8154
  onLoad: function onLoad(opt) {
8095
- if (columnsFieldsRef.current) {
8096
- columnsFieldsRef.current[c.dataIndex] = opt;
8097
- }
8098
-
8155
+ // if (columnsFieldsRef.current) {
8156
+ // columnsFieldsRef.current[c.dataIndex] = opt;
8157
+ // }
8099
8158
  setColumnsFields(function (preColumnsFields) {
8100
8159
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
8101
8160
  });
@@ -8179,7 +8238,7 @@ var WForm = function WForm(props, ref) {
8179
8238
  name: c.dataIndex,
8180
8239
  label: c.title,
8181
8240
  labelCol: _labelCol13
8182
- }), /*#__PURE__*/React.createElement(Index$2, _objectSpread2(_objectSpread2(_objectSpread2({
8241
+ }), /*#__PURE__*/React.createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
8183
8242
  disabled: disabled,
8184
8243
  placeholder: "\u8BF7\u8F93\u5165"
8185
8244
  }, picker), showTime), c.fieldProps))));
@@ -8215,7 +8274,7 @@ var WForm = function WForm(props, ref) {
8215
8274
  name: c.dataIndex,
8216
8275
  label: c.title,
8217
8276
  labelCol: _labelCol14
8218
- }), /*#__PURE__*/React.createElement(RangePicker$2, _objectSpread2(_objectSpread2({
8277
+ }), /*#__PURE__*/React.createElement(RangePicker$3, _objectSpread2(_objectSpread2({
8219
8278
  disabled: disabled
8220
8279
  }, _showTime2), c.fieldProps))));
8221
8280
  } else if (c.valueType === 'checkbox') {
@@ -8233,11 +8292,10 @@ var WForm = function WForm(props, ref) {
8233
8292
 
8234
8293
  if (c.options) {
8235
8294
  options = c.options;
8236
- }
8295
+ } // if (columnsFieldsRef.current) {
8296
+ // columnsFieldsRef.current[c.dataIndex] = options;
8297
+ // }
8237
8298
 
8238
- if (columnsFieldsRef.current) {
8239
- columnsFieldsRef.current[c.dataIndex] = options;
8240
- }
8241
8299
 
8242
8300
  setColumnsFields(function (preColumnsFields) {
8243
8301
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, options));
@@ -8283,11 +8341,10 @@ var WForm = function WForm(props, ref) {
8283
8341
  value: _key3
8284
8342
  });
8285
8343
  }
8286
- }
8344
+ } // if (columnsFieldsRef.current) {
8345
+ // columnsFieldsRef.current[c.dataIndex] = options;
8346
+ // }
8287
8347
 
8288
- if (columnsFieldsRef.current) {
8289
- columnsFieldsRef.current[c.dataIndex] = _options3;
8290
- }
8291
8348
 
8292
8349
  setColumnsFields(function (preColumnsFields) {
8293
8350
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options3));
@@ -8347,11 +8404,10 @@ var WForm = function WForm(props, ref) {
8347
8404
  _labelCol17.style = {
8348
8405
  width: search.labelWidth
8349
8406
  };
8350
- }
8407
+ } // if (columnsFieldsRef.current) {
8408
+ // columnsFieldsRef.current[c.dataIndex] = options;
8409
+ // }
8351
8410
 
8352
- if (columnsFieldsRef.current) {
8353
- columnsFieldsRef.current[c.dataIndex] = _options4;
8354
- }
8355
8411
 
8356
8412
  setColumnsFields(function (preColumnsFields) {
8357
8413
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options4));
@@ -8411,8 +8467,8 @@ var WForm = function WForm(props, ref) {
8411
8467
  var baseitem = c.renderFormItem(c, _objectSpread2(_objectSpread2({}, c), {}, {
8412
8468
  formItemProps: c.formItemProps,
8413
8469
  fieldProps: c.fieldProps,
8414
- columnsFields: columnsFields,
8415
- columnsFieldsRef: columnsFieldsRef
8470
+ columnsFields: columnsFields // columnsFieldsRef,
8471
+
8416
8472
  }), form);
8417
8473
  return baseitem ? /*#__PURE__*/React.createElement(_Col, _objectSpread2(_objectSpread2({
8418
8474
  style: {
@@ -8509,14 +8565,19 @@ var WForm = function WForm(props, ref) {
8509
8565
  }, c.fieldProps))));
8510
8566
  }
8511
8567
  });
8512
- }, [changedValues, extraColumns, disabled, columnsFieldsRef, JSON.stringify(form.getFieldsValue())]);
8568
+ }, [changedValues, extraColumns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue())]);
8513
8569
 
8514
8570
  var handleSearch = function handleSearch(v) {
8515
8571
  var searchForm = form.getFieldsValue();
8516
8572
  filterFormColumns.forEach(function (c) {
8517
8573
  if (c.search && c.search.transform) {
8518
- searchForm = _objectSpread2(_objectSpread2({}, searchForm), c.search.transform(searchForm[c.dataIndex]));
8519
- delete searchForm[c.dataIndex];
8574
+ var transformObj = c.search.transform(searchForm[c.dataIndex]);
8575
+ searchForm = _objectSpread2(_objectSpread2({}, searchForm), transformObj);
8576
+
8577
+ if (!transformObj[c.dataIndex]) {
8578
+ delete searchForm[c.dataIndex];
8579
+ }
8580
+
8520
8581
  return false;
8521
8582
  }
8522
8583
 
@@ -8640,8 +8701,8 @@ var WForm = function WForm(props, ref) {
8640
8701
 
8641
8702
  var WForm$1 = /*#__PURE__*/React.forwardRef(WForm);
8642
8703
 
8643
- var _excluded$6 = ["height", "width", "count", "style", "numberStyle"],
8644
- _excluded2$1 = ["count", "width", "height", "marginRight"];
8704
+ var _excluded$7 = ["height", "width", "count", "style", "numberStyle"],
8705
+ _excluded2$2 = ["count", "width", "height", "marginRight"];
8645
8706
 
8646
8707
  var Number = function Number(_ref) {
8647
8708
  var height = _ref.height,
@@ -8650,7 +8711,7 @@ var Number = function Number(_ref) {
8650
8711
  count = _ref$count === void 0 ? 0 : _ref$count,
8651
8712
  style = _ref.style,
8652
8713
  numberStyle = _ref.numberStyle,
8653
- props = _objectWithoutProperties(_ref, _excluded$6);
8714
+ props = _objectWithoutProperties(_ref, _excluded$7);
8654
8715
 
8655
8716
  // 上次的值
8656
8717
  var _useState = useState(0),
@@ -8770,13 +8831,13 @@ Number.defaultProps = {
8770
8831
  height: 40
8771
8832
  };
8772
8833
 
8773
- var Index$6 = function Index(props) {
8834
+ var Index$7 = function Index(props) {
8774
8835
  var count = props.count,
8775
8836
  width = props.width,
8776
8837
  height = props.height,
8777
8838
  _props$marginRight = props.marginRight,
8778
8839
  marginRight = _props$marginRight === void 0 ? '8px' : _props$marginRight,
8779
- extraProps = _objectWithoutProperties(props, _excluded2$1);
8840
+ extraProps = _objectWithoutProperties(props, _excluded2$2);
8780
8841
 
8781
8842
  var _useState9 = useState([]),
8782
8843
  _useState10 = _slicedToArray(_useState9, 2),
@@ -8807,26 +8868,26 @@ var Index$6 = function Index(props) {
8807
8868
  }));
8808
8869
  };
8809
8870
 
8810
- var _excluded$7 = ["duration"];
8871
+ var _excluded$8 = ["duration"];
8811
8872
 
8812
- var Index$7 = function Index(props) {
8873
+ var Index$8 = function Index(props) {
8813
8874
  var _props$duration = props.duration,
8814
8875
  duration = _props$duration === void 0 ? 2.75 : _props$duration,
8815
- extraProps = _objectWithoutProperties(props, _excluded$7);
8876
+ extraProps = _objectWithoutProperties(props, _excluded$8);
8816
8877
  return /*#__PURE__*/React.createElement(CountUp, _objectSpread2({
8817
8878
  duration: duration
8818
8879
  }, extraProps));
8819
8880
  };
8820
8881
 
8821
- Index$7.defaultProps = {};
8882
+ Index$8.defaultProps = {};
8822
8883
 
8823
- var _excluded$8 = ["list", "render", "partSize"];
8824
- var autoScrollInterval = null;
8884
+ var _excluded$9 = ["list", "render", "partSize"];
8825
8885
 
8826
8886
  function AutoScroll(props) {
8827
8887
  var inner1 = useRef();
8828
8888
  var inner2 = useRef();
8829
8889
  var outer = useRef();
8890
+ var timer = useRef(null);
8830
8891
  useImperativeHandle(props.cref, function () {
8831
8892
  return {
8832
8893
  tryScroll: tryScroll
@@ -8847,8 +8908,8 @@ function AutoScroll(props) {
8847
8908
 
8848
8909
 
8849
8910
  var startScroll = function startScroll() {
8850
- if (!autoScrollInterval) {
8851
- autoScrollInterval = setInterval(function () {
8911
+ if (!timer.current) {
8912
+ timer.current = setInterval(function () {
8852
8913
  // 如果已经滚动到inner1的底部,则重置滚动的位置到inner1的头部
8853
8914
  if (outer.current.scrollTop >= inner1.current.offsetHeight) {
8854
8915
  outer.current.scrollTop = 0; // 触发complete事件
@@ -8868,8 +8929,11 @@ function AutoScroll(props) {
8868
8929
 
8869
8930
 
8870
8931
  var stopScroll = function stopScroll() {
8871
- clearInterval(autoScrollInterval);
8872
- autoScrollInterval = null;
8932
+ if (timer.current) {
8933
+ clearInterval(timer.current);
8934
+ }
8935
+
8936
+ timer.current = null;
8873
8937
  };
8874
8938
 
8875
8939
  useEffect(function () {
@@ -8880,7 +8944,7 @@ function AutoScroll(props) {
8880
8944
  return function () {
8881
8945
  stopScroll();
8882
8946
  };
8883
- }, []);
8947
+ }, [timer]);
8884
8948
  return /*#__PURE__*/React.createElement("div", {
8885
8949
  className: "autoScroll-outer ".concat(props.className),
8886
8950
  ref: outer,
@@ -8896,12 +8960,12 @@ function AutoScroll(props) {
8896
8960
  }));
8897
8961
  }
8898
8962
 
8899
- var Index$8 = function Index(_ref) {
8963
+ var Index$9 = function Index(_ref) {
8900
8964
  var list = _ref.list,
8901
8965
  render = _ref.render,
8902
8966
  _ref$partSize = _ref.partSize,
8903
8967
  partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
8904
- otherProps = _objectWithoutProperties(_ref, _excluded$8);
8968
+ otherProps = _objectWithoutProperties(_ref, _excluded$9);
8905
8969
 
8906
8970
  {
8907
8971
  var _useState = useState([]),
@@ -8978,15 +9042,15 @@ var Index$8 = function Index(_ref) {
8978
9042
  }
8979
9043
  };
8980
9044
 
8981
- var _excluded$9 = ["data", "onClick", "renderItem"];
9045
+ var _excluded$a = ["data", "onClick", "renderItem"];
8982
9046
 
8983
9047
  SwiperCore.use([Pagination, Navigation, Autoplay]);
8984
9048
 
8985
- var Index$9 = function Index(props) {
9049
+ var Index$a = function Index(props) {
8986
9050
  var data = props.data,
8987
9051
  _onClick = props.onClick,
8988
9052
  renderItem = props.renderItem,
8989
- extraProps = _objectWithoutProperties(props, _excluded$9);
9053
+ extraProps = _objectWithoutProperties(props, _excluded$a);
8990
9054
 
8991
9055
  return /*#__PURE__*/React.createElement(Swiper, _objectSpread2({
8992
9056
  onClick: function onClick(swiper, event) {
@@ -9015,7 +9079,7 @@ var Index$9 = function Index(props) {
9015
9079
  }));
9016
9080
  };
9017
9081
 
9018
- Index$9.defaultProps = {};
9082
+ Index$a.defaultProps = {};
9019
9083
 
9020
9084
  function _extends$1() {
9021
9085
  _extends$1 = Object.assign || function (target) {
@@ -9609,7 +9673,7 @@ function createBrowserHistory(props) {
9609
9673
  return history;
9610
9674
  }
9611
9675
 
9612
- var _excluded$a = ["routes", "className"];
9676
+ var _excluded$b = ["routes", "className"];
9613
9677
  var history = createBrowserHistory();
9614
9678
 
9615
9679
  function itemRender(route, params, routes, paths) {
@@ -9624,10 +9688,10 @@ function itemRender(route, params, routes, paths) {
9624
9688
  }, route.breadcrumbName);
9625
9689
  }
9626
9690
 
9627
- var Index$a = function Index(_ref) {
9691
+ var Index$b = function Index(_ref) {
9628
9692
  var routes = _ref.routes,
9629
9693
  className = _ref.className,
9630
- props = _objectWithoutProperties(_ref, _excluded$a);
9694
+ props = _objectWithoutProperties(_ref, _excluded$b);
9631
9695
 
9632
9696
  return /*#__PURE__*/React.createElement(_Breadcrumb, _objectSpread2({
9633
9697
  className: className || 'default',
@@ -9637,9 +9701,9 @@ var Index$a = function Index(_ref) {
9637
9701
  }, props));
9638
9702
  };
9639
9703
 
9640
- var _excluded$b = ["title", "className", "headerTail", "headerCenter"];
9704
+ var _excluded$c = ["title", "className", "headerTail", "headerCenter"];
9641
9705
 
9642
- var Index$b = function Index(_ref) {
9706
+ var Index$c = function Index(_ref) {
9643
9707
  var _classNames;
9644
9708
 
9645
9709
  var title = _ref.title,
@@ -9647,7 +9711,7 @@ var Index$b = function Index(_ref) {
9647
9711
  className = _ref$className === void 0 ? 'default' : _ref$className,
9648
9712
  headerTail = _ref.headerTail,
9649
9713
  headerCenter = _ref.headerCenter,
9650
- props = _objectWithoutProperties(_ref, _excluded$b);
9714
+ props = _objectWithoutProperties(_ref, _excluded$c);
9651
9715
 
9652
9716
  return /*#__PURE__*/React.createElement("div", _objectSpread2({
9653
9717
  className: classnames((_classNames = {}, _defineProperty(_classNames, 'card-container', true), _defineProperty(_classNames, className, true), _classNames))
@@ -9666,7 +9730,7 @@ var Index$b = function Index(_ref) {
9666
9730
  }, props.children))));
9667
9731
  };
9668
9732
 
9669
- Index$b.defaultProps = {};
9733
+ Index$c.defaultProps = {};
9670
9734
 
9671
9735
  var controlShow = function controlShow(f1, f2, value, timer) {
9672
9736
  f1(value);
@@ -9754,7 +9818,7 @@ function DialogModel(props) {
9754
9818
  return renderChildren;
9755
9819
  }
9756
9820
 
9757
- var _excluded$c = ["visible"];
9821
+ var _excluded$d = ["visible"];
9758
9822
 
9759
9823
  var Modal = /*#__PURE__*/function (_React$PureComponent) {
9760
9824
  _inherits(Modal, _React$PureComponent);
@@ -9886,7 +9950,7 @@ Modal.show = function (config) {
9886
9950
  manager.setShow = setShow;
9887
9951
 
9888
9952
  var visible = props.visible,
9889
- trueProps = _objectWithoutProperties(props, _excluded$c);
9953
+ trueProps = _objectWithoutProperties(props, _excluded$d);
9890
9954
 
9891
9955
  useEffect(function () {
9892
9956
  manager.mounted = true;
@@ -9910,7 +9974,7 @@ Modal.hidden = function () {
9910
9974
  ModalContainer[modelSysbol] && ModalContainer[modelSysbol].hidden();
9911
9975
  };
9912
9976
 
9913
- var _excluded$d = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
9977
+ var _excluded$e = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
9914
9978
 
9915
9979
  var ModalForm = function ModalForm(props, ref) {
9916
9980
  var columns = props.columns,
@@ -9924,7 +9988,7 @@ var ModalForm = function ModalForm(props, ref) {
9924
9988
  title = props.title,
9925
9989
  record = props.record,
9926
9990
  onFormChange = props.onFormChange,
9927
- extraProps = _objectWithoutProperties(props, _excluded$d);
9991
+ extraProps = _objectWithoutProperties(props, _excluded$e);
9928
9992
 
9929
9993
  var formRef = useRef(null);
9930
9994
 
@@ -10055,7 +10119,7 @@ var ModalForm = function ModalForm(props, ref) {
10055
10119
 
10056
10120
  var ModalForm$1 = /*#__PURE__*/React.forwardRef(ModalForm);
10057
10121
 
10058
- var _excluded$e = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"];
10122
+ var _excluded$f = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"];
10059
10123
 
10060
10124
  var TabelCard = function TabelCard(props, ref) {
10061
10125
  var columns = props.columns,
@@ -10069,7 +10133,7 @@ var TabelCard = function TabelCard(props, ref) {
10069
10133
  onFormChange = props.onFormChange,
10070
10134
  modalConfig = props.modalConfig,
10071
10135
  optionColumnConfig = props.optionColumnConfig,
10072
- extraProps = _objectWithoutProperties(props, _excluded$e);
10136
+ extraProps = _objectWithoutProperties(props, _excluded$f);
10073
10137
 
10074
10138
  var actionRef = useRef();
10075
10139
  var formRef = useRef(null);
@@ -10391,4 +10455,4 @@ var TabelCard = function TabelCard(props, ref) {
10391
10455
 
10392
10456
  var index$1 = /*#__PURE__*/React.forwardRef(TabelCard);
10393
10457
 
10394
- export { Index$8 as AutoScroll, Index$a as Breadcrumb, WButton as Button, Index$b as Card, Index$4 as Checkbox, Index$7 as CountUp, Index$2 as DatePicker, index as IconFont, Index as Input, WInputNumber as InputNumber, Modal, ModalForm$1 as ModalForm, Index$6 as Number, NumericInput, Index$3 as Radio, Index$1 as Select, Index$9 as Swiper, WSwitch as Switch, index$1 as TabelCard, Table, Index$5 as TreeSelect, WForm$1 as WForm };
10458
+ export { Index$9 as AutoScroll, Index$b as Breadcrumb, WButton as Button, Index$c as Card, Index$4 as Checkbox, Index$8 as CountUp, Index$2 as DatePicker, index as IconFont, Index as Input, WInputNumber as InputNumber, Modal, ModalForm$1 as ModalForm, Index$7 as Number, NumericInput, Index$3 as Radio, Index$1 as Select, Index$a as Swiper, WSwitch as Switch, index$1 as TabelCard, Table, Index$5 as TreeSelect, Index$6 as WDatePicker, WForm$1 as WForm };
package/dist/index.js CHANGED
@@ -556,39 +556,47 @@ var WSelect = function WSelect(props) {
556
556
  valueEnumList = _useState4[0],
557
557
  setValueEnumList = _useState4[1];
558
558
 
559
- React.useEffect(function () {
560
- _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
561
- var res, node;
562
- return regeneratorRuntime.wrap(function _callee$(_context) {
563
- while (1) {
564
- switch (_context.prev = _context.next) {
565
- case 0:
566
- if (!request) {
567
- _context.next = 7;
568
- break;
569
- }
559
+ var _useState5 = React.useState(null),
560
+ _useState6 = _slicedToArray(_useState5, 2),
561
+ resList = _useState6[0],
562
+ setResList = _useState6[1];
570
563
 
571
- _context.next = 3;
572
- return request();
564
+ React.useEffect(function () {
565
+ if (!resList) {
566
+ _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
567
+ var res, node;
568
+ return regeneratorRuntime.wrap(function _callee$(_context) {
569
+ while (1) {
570
+ switch (_context.prev = _context.next) {
571
+ case 0:
572
+ if (!request) {
573
+ _context.next = 8;
574
+ break;
575
+ }
573
576
 
574
- case 3:
575
- res = _context.sent;
576
- onLoad && onLoad(res);
577
- node = res.map(function (item) {
578
- return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'].Option, {
579
- key: item.value,
580
- value: item.value
581
- }, item.label);
582
- });
583
- setChildrenNode(node);
577
+ _context.next = 3;
578
+ return request();
584
579
 
585
- case 7:
586
- case "end":
587
- return _context.stop();
580
+ case 3:
581
+ res = _context.sent;
582
+ setResList(res);
583
+ onLoad && onLoad(res);
584
+ node = res.map(function (item) {
585
+ return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'].Option, {
586
+ key: item.value,
587
+ value: item.value
588
+ }, item.label);
589
+ });
590
+ setChildrenNode(node);
591
+
592
+ case 8:
593
+ case "end":
594
+ return _context.stop();
595
+ }
588
596
  }
589
- }
590
- }, _callee);
591
- }))();
597
+ }, _callee);
598
+ }))();
599
+ }
592
600
 
593
601
  var valueEnumNode = [];
594
602
  var options = [];
@@ -618,7 +626,7 @@ var WSelect = function WSelect(props) {
618
626
 
619
627
  onLoad && onLoad(options);
620
628
  setValueEnumList(valueEnumNode);
621
- }, []);
629
+ }, [resList]);
622
630
  return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'], _objectSpread2({}, extraProps), request ? childrenNode : valueEnum ? valueEnumList : children);
623
631
  };
624
632
 
@@ -7565,8 +7573,65 @@ Table.defaultProps = {
7565
7573
  rowKey: 'key'
7566
7574
  };
7567
7575
 
7568
- var _excluded$5 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
7569
- var RangePicker$2 = Index$2.RangePicker;
7576
+ var _excluded$5 = ["defaultValue", "format", "value", "onChange"],
7577
+ _excluded2$1 = ["defaultValue", "value", "format", "onChange"];
7578
+
7579
+ var momentValue = function momentValue(value) {
7580
+ if (value) {
7581
+ return hooks(value);
7582
+ }
7583
+ };
7584
+
7585
+ var WDatePicker$1 = function WDatePicker(props) {
7586
+ var defaultValue = props.defaultValue,
7587
+ format = props.format,
7588
+ value = props.value,
7589
+ _onChange = props.onChange,
7590
+ extraProps = _objectWithoutProperties(props, _excluded$5);
7591
+
7592
+ return (
7593
+ /*#__PURE__*/
7594
+ // <ConfigProvider locale={zhCN}>
7595
+ React__default['default'].createElement(_DatePicker__default['default'], _objectSpread2({
7596
+ defaultValue: momentValue(defaultValue),
7597
+ value: momentValue(value),
7598
+ onChange: function onChange(v) {
7599
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(v, momentValue(v).format(format || 'YYYY-MM-DD'));
7600
+ }
7601
+ }, extraProps)) // </ConfigProvider>
7602
+
7603
+ );
7604
+ };
7605
+
7606
+ WDatePicker$1.defaultProps = {};
7607
+
7608
+ var RangePicker$2 = function RangePicker(props) {
7609
+ var defaultValue = props.defaultValue,
7610
+ value = props.value,
7611
+ format = props.format,
7612
+ _onChange2 = props.onChange,
7613
+ extraProps = _objectWithoutProperties(props, _excluded2$1);
7614
+
7615
+ return (
7616
+ /*#__PURE__*/
7617
+ // <ConfigProvider locale={zhCN}>
7618
+ React__default['default'].createElement(_DatePicker__default['default'].RangePicker, _objectSpread2({
7619
+ defaultValue: momentValue(defaultValue),
7620
+ value: momentValue(value),
7621
+ onChange: function onChange(v) {
7622
+ _onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2(v, momentValue(v).format(format || 'YYYY-MM-DD'));
7623
+ }
7624
+ }, extraProps)) // </ConfigProvider>
7625
+
7626
+ );
7627
+ };
7628
+
7629
+ RangePicker$2.defaultProps = {};
7630
+ var Index$6 = WDatePicker$1;
7631
+ Index$6.RangePicker = RangePicker$2;
7632
+
7633
+ var _excluded$6 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
7634
+ var RangePicker$3 = Index$6.RangePicker;
7570
7635
 
7571
7636
  var WForm = function WForm(props, ref) {
7572
7637
  var columns = props.columns,
@@ -7579,13 +7644,12 @@ var WForm = function WForm(props, ref) {
7579
7644
  onFormChange = props.onFormChange,
7580
7645
  onSubmit = props.onSubmit,
7581
7646
  onReset = props.onReset,
7582
- extraProps = _objectWithoutProperties(props, _excluded$5);
7647
+ extraProps = _objectWithoutProperties(props, _excluded$6);
7583
7648
 
7584
7649
  var _Form$useForm = _Form__default['default'].useForm(),
7585
7650
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
7586
- form = _Form$useForm2[0];
7651
+ form = _Form$useForm2[0]; // const columnsFieldsRef = useRef<any>({});
7587
7652
 
7588
- var columnsFieldsRef = React.useRef({});
7589
7653
 
7590
7654
  var _useState = React.useState({}),
7591
7655
  _useState2 = _slicedToArray(_useState, 2),
@@ -7658,10 +7722,9 @@ var WForm = function WForm(props, ref) {
7658
7722
  placeholder: "\u8BF7\u9009\u62E9",
7659
7723
  disabled: disabled,
7660
7724
  onLoad: function onLoad(opt) {
7661
- if (columnsFieldsRef.current) {
7662
- columnsFieldsRef.current[c.dataIndex] = opt;
7663
- }
7664
-
7725
+ // if (columnsFieldsRef.current) {
7726
+ // columnsFieldsRef.current[c.dataIndex] = opt;
7727
+ // }
7665
7728
  setColumnsFields(function (preColumnsFields) {
7666
7729
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
7667
7730
  });
@@ -7745,7 +7808,7 @@ var WForm = function WForm(props, ref) {
7745
7808
  name: c.dataIndex,
7746
7809
  label: c.title,
7747
7810
  labelCol: _labelCol2
7748
- }), /*#__PURE__*/React__default['default'].createElement(Index$2, _objectSpread2(_objectSpread2(_objectSpread2({
7811
+ }), /*#__PURE__*/React__default['default'].createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
7749
7812
  disabled: disabled,
7750
7813
  placeholder: "\u8BF7\u8F93\u5165"
7751
7814
  }, picker), showTime), c.fieldProps))));
@@ -7781,7 +7844,7 @@ var WForm = function WForm(props, ref) {
7781
7844
  name: c.dataIndex,
7782
7845
  label: c.title,
7783
7846
  labelCol: _labelCol3
7784
- }), /*#__PURE__*/React__default['default'].createElement(RangePicker$2, _objectSpread2(_objectSpread2({
7847
+ }), /*#__PURE__*/React__default['default'].createElement(RangePicker$3, _objectSpread2(_objectSpread2({
7785
7848
  disabled: disabled
7786
7849
  }, _showTime), c.fieldProps))));
7787
7850
  } else if (c.valueType === 'checkbox') {
@@ -7799,11 +7862,10 @@ var WForm = function WForm(props, ref) {
7799
7862
 
7800
7863
  if (c.options) {
7801
7864
  options = c.options;
7802
- }
7865
+ } // if (columnsFieldsRef.current) {
7866
+ // columnsFieldsRef.current[c.dataIndex] = options;
7867
+ // }
7803
7868
 
7804
- if (columnsFieldsRef.current) {
7805
- columnsFieldsRef.current[c.dataIndex] = options;
7806
- }
7807
7869
 
7808
7870
  setColumnsFields(function (preColumnsFields) {
7809
7871
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, options));
@@ -7849,11 +7911,10 @@ var WForm = function WForm(props, ref) {
7849
7911
  value: _key
7850
7912
  });
7851
7913
  }
7852
- }
7914
+ } // if (columnsFieldsRef.current) {
7915
+ // columnsFieldsRef.current[c.dataIndex] = options;
7916
+ // }
7853
7917
 
7854
- if (columnsFieldsRef.current) {
7855
- columnsFieldsRef.current[c.dataIndex] = _options;
7856
- }
7857
7918
 
7858
7919
  setColumnsFields(function (preColumnsFields) {
7859
7920
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options));
@@ -7913,11 +7974,10 @@ var WForm = function WForm(props, ref) {
7913
7974
  _labelCol6.style = {
7914
7975
  width: search.labelWidth
7915
7976
  };
7916
- }
7977
+ } // if (columnsFieldsRef.current) {
7978
+ // columnsFieldsRef.current[c.dataIndex] = options;
7979
+ // }
7917
7980
 
7918
- if (columnsFieldsRef.current) {
7919
- columnsFieldsRef.current[c.dataIndex] = _options2;
7920
- }
7921
7981
 
7922
7982
  setColumnsFields(function (preColumnsFields) {
7923
7983
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options2));
@@ -7977,8 +8037,8 @@ var WForm = function WForm(props, ref) {
7977
8037
  var baseitem = c.renderFormItem(c, _objectSpread2(_objectSpread2({}, c), {}, {
7978
8038
  formItemProps: c.formItemProps,
7979
8039
  fieldProps: c.fieldProps,
7980
- columnsFields: columnsFields,
7981
- columnsFieldsRef: columnsFieldsRef
8040
+ columnsFields: columnsFields // columnsFieldsRef,
8041
+
7982
8042
  }), form);
7983
8043
  return baseitem ? /*#__PURE__*/React__default['default'].createElement(_Col__default['default'], _objectSpread2(_objectSpread2({
7984
8044
  style: {
@@ -8075,7 +8135,7 @@ var WForm = function WForm(props, ref) {
8075
8135
  }, c.fieldProps))));
8076
8136
  }
8077
8137
  });
8078
- }, [changedValues, columns, disabled, columnsFieldsRef, JSON.stringify(form.getFieldsValue())]);
8138
+ }, [changedValues, columns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue())]);
8079
8139
  var filterExtraColumnsForm = React.useMemo(function () {
8080
8140
  return filterExtraFormColumns.map(function (c) {
8081
8141
  var colProps = {};
@@ -8125,10 +8185,9 @@ var WForm = function WForm(props, ref) {
8125
8185
  placeholder: "\u8BF7\u9009\u62E9",
8126
8186
  disabled: disabled,
8127
8187
  onLoad: function onLoad(opt) {
8128
- if (columnsFieldsRef.current) {
8129
- columnsFieldsRef.current[c.dataIndex] = opt;
8130
- }
8131
-
8188
+ // if (columnsFieldsRef.current) {
8189
+ // columnsFieldsRef.current[c.dataIndex] = opt;
8190
+ // }
8132
8191
  setColumnsFields(function (preColumnsFields) {
8133
8192
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
8134
8193
  });
@@ -8212,7 +8271,7 @@ var WForm = function WForm(props, ref) {
8212
8271
  name: c.dataIndex,
8213
8272
  label: c.title,
8214
8273
  labelCol: _labelCol13
8215
- }), /*#__PURE__*/React__default['default'].createElement(Index$2, _objectSpread2(_objectSpread2(_objectSpread2({
8274
+ }), /*#__PURE__*/React__default['default'].createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
8216
8275
  disabled: disabled,
8217
8276
  placeholder: "\u8BF7\u8F93\u5165"
8218
8277
  }, picker), showTime), c.fieldProps))));
@@ -8248,7 +8307,7 @@ var WForm = function WForm(props, ref) {
8248
8307
  name: c.dataIndex,
8249
8308
  label: c.title,
8250
8309
  labelCol: _labelCol14
8251
- }), /*#__PURE__*/React__default['default'].createElement(RangePicker$2, _objectSpread2(_objectSpread2({
8310
+ }), /*#__PURE__*/React__default['default'].createElement(RangePicker$3, _objectSpread2(_objectSpread2({
8252
8311
  disabled: disabled
8253
8312
  }, _showTime2), c.fieldProps))));
8254
8313
  } else if (c.valueType === 'checkbox') {
@@ -8266,11 +8325,10 @@ var WForm = function WForm(props, ref) {
8266
8325
 
8267
8326
  if (c.options) {
8268
8327
  options = c.options;
8269
- }
8328
+ } // if (columnsFieldsRef.current) {
8329
+ // columnsFieldsRef.current[c.dataIndex] = options;
8330
+ // }
8270
8331
 
8271
- if (columnsFieldsRef.current) {
8272
- columnsFieldsRef.current[c.dataIndex] = options;
8273
- }
8274
8332
 
8275
8333
  setColumnsFields(function (preColumnsFields) {
8276
8334
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, options));
@@ -8316,11 +8374,10 @@ var WForm = function WForm(props, ref) {
8316
8374
  value: _key3
8317
8375
  });
8318
8376
  }
8319
- }
8377
+ } // if (columnsFieldsRef.current) {
8378
+ // columnsFieldsRef.current[c.dataIndex] = options;
8379
+ // }
8320
8380
 
8321
- if (columnsFieldsRef.current) {
8322
- columnsFieldsRef.current[c.dataIndex] = _options3;
8323
- }
8324
8381
 
8325
8382
  setColumnsFields(function (preColumnsFields) {
8326
8383
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options3));
@@ -8380,11 +8437,10 @@ var WForm = function WForm(props, ref) {
8380
8437
  _labelCol17.style = {
8381
8438
  width: search.labelWidth
8382
8439
  };
8383
- }
8440
+ } // if (columnsFieldsRef.current) {
8441
+ // columnsFieldsRef.current[c.dataIndex] = options;
8442
+ // }
8384
8443
 
8385
- if (columnsFieldsRef.current) {
8386
- columnsFieldsRef.current[c.dataIndex] = _options4;
8387
- }
8388
8444
 
8389
8445
  setColumnsFields(function (preColumnsFields) {
8390
8446
  return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options4));
@@ -8444,8 +8500,8 @@ var WForm = function WForm(props, ref) {
8444
8500
  var baseitem = c.renderFormItem(c, _objectSpread2(_objectSpread2({}, c), {}, {
8445
8501
  formItemProps: c.formItemProps,
8446
8502
  fieldProps: c.fieldProps,
8447
- columnsFields: columnsFields,
8448
- columnsFieldsRef: columnsFieldsRef
8503
+ columnsFields: columnsFields // columnsFieldsRef,
8504
+
8449
8505
  }), form);
8450
8506
  return baseitem ? /*#__PURE__*/React__default['default'].createElement(_Col__default['default'], _objectSpread2(_objectSpread2({
8451
8507
  style: {
@@ -8542,14 +8598,19 @@ var WForm = function WForm(props, ref) {
8542
8598
  }, c.fieldProps))));
8543
8599
  }
8544
8600
  });
8545
- }, [changedValues, extraColumns, disabled, columnsFieldsRef, JSON.stringify(form.getFieldsValue())]);
8601
+ }, [changedValues, extraColumns, disabled, JSON.stringify(columnsFields), JSON.stringify(form.getFieldsValue())]);
8546
8602
 
8547
8603
  var handleSearch = function handleSearch(v) {
8548
8604
  var searchForm = form.getFieldsValue();
8549
8605
  filterFormColumns.forEach(function (c) {
8550
8606
  if (c.search && c.search.transform) {
8551
- searchForm = _objectSpread2(_objectSpread2({}, searchForm), c.search.transform(searchForm[c.dataIndex]));
8552
- delete searchForm[c.dataIndex];
8607
+ var transformObj = c.search.transform(searchForm[c.dataIndex]);
8608
+ searchForm = _objectSpread2(_objectSpread2({}, searchForm), transformObj);
8609
+
8610
+ if (!transformObj[c.dataIndex]) {
8611
+ delete searchForm[c.dataIndex];
8612
+ }
8613
+
8553
8614
  return false;
8554
8615
  }
8555
8616
 
@@ -8673,8 +8734,8 @@ var WForm = function WForm(props, ref) {
8673
8734
 
8674
8735
  var WForm$1 = /*#__PURE__*/React__default['default'].forwardRef(WForm);
8675
8736
 
8676
- var _excluded$6 = ["height", "width", "count", "style", "numberStyle"],
8677
- _excluded2$1 = ["count", "width", "height", "marginRight"];
8737
+ var _excluded$7 = ["height", "width", "count", "style", "numberStyle"],
8738
+ _excluded2$2 = ["count", "width", "height", "marginRight"];
8678
8739
 
8679
8740
  var Number = function Number(_ref) {
8680
8741
  var height = _ref.height,
@@ -8683,7 +8744,7 @@ var Number = function Number(_ref) {
8683
8744
  count = _ref$count === void 0 ? 0 : _ref$count,
8684
8745
  style = _ref.style,
8685
8746
  numberStyle = _ref.numberStyle,
8686
- props = _objectWithoutProperties(_ref, _excluded$6);
8747
+ props = _objectWithoutProperties(_ref, _excluded$7);
8687
8748
 
8688
8749
  // 上次的值
8689
8750
  var _useState = React.useState(0),
@@ -8803,13 +8864,13 @@ Number.defaultProps = {
8803
8864
  height: 40
8804
8865
  };
8805
8866
 
8806
- var Index$6 = function Index(props) {
8867
+ var Index$7 = function Index(props) {
8807
8868
  var count = props.count,
8808
8869
  width = props.width,
8809
8870
  height = props.height,
8810
8871
  _props$marginRight = props.marginRight,
8811
8872
  marginRight = _props$marginRight === void 0 ? '8px' : _props$marginRight,
8812
- extraProps = _objectWithoutProperties(props, _excluded2$1);
8873
+ extraProps = _objectWithoutProperties(props, _excluded2$2);
8813
8874
 
8814
8875
  var _useState9 = React.useState([]),
8815
8876
  _useState10 = _slicedToArray(_useState9, 2),
@@ -8840,26 +8901,26 @@ var Index$6 = function Index(props) {
8840
8901
  }));
8841
8902
  };
8842
8903
 
8843
- var _excluded$7 = ["duration"];
8904
+ var _excluded$8 = ["duration"];
8844
8905
 
8845
- var Index$7 = function Index(props) {
8906
+ var Index$8 = function Index(props) {
8846
8907
  var _props$duration = props.duration,
8847
8908
  duration = _props$duration === void 0 ? 2.75 : _props$duration,
8848
- extraProps = _objectWithoutProperties(props, _excluded$7);
8909
+ extraProps = _objectWithoutProperties(props, _excluded$8);
8849
8910
  return /*#__PURE__*/React__default['default'].createElement(CountUp__default['default'], _objectSpread2({
8850
8911
  duration: duration
8851
8912
  }, extraProps));
8852
8913
  };
8853
8914
 
8854
- Index$7.defaultProps = {};
8915
+ Index$8.defaultProps = {};
8855
8916
 
8856
- var _excluded$8 = ["list", "render", "partSize"];
8857
- var autoScrollInterval = null;
8917
+ var _excluded$9 = ["list", "render", "partSize"];
8858
8918
 
8859
8919
  function AutoScroll(props) {
8860
8920
  var inner1 = React.useRef();
8861
8921
  var inner2 = React.useRef();
8862
8922
  var outer = React.useRef();
8923
+ var timer = React.useRef(null);
8863
8924
  React.useImperativeHandle(props.cref, function () {
8864
8925
  return {
8865
8926
  tryScroll: tryScroll
@@ -8880,8 +8941,8 @@ function AutoScroll(props) {
8880
8941
 
8881
8942
 
8882
8943
  var startScroll = function startScroll() {
8883
- if (!autoScrollInterval) {
8884
- autoScrollInterval = setInterval(function () {
8944
+ if (!timer.current) {
8945
+ timer.current = setInterval(function () {
8885
8946
  // 如果已经滚动到inner1的底部,则重置滚动的位置到inner1的头部
8886
8947
  if (outer.current.scrollTop >= inner1.current.offsetHeight) {
8887
8948
  outer.current.scrollTop = 0; // 触发complete事件
@@ -8901,8 +8962,11 @@ function AutoScroll(props) {
8901
8962
 
8902
8963
 
8903
8964
  var stopScroll = function stopScroll() {
8904
- clearInterval(autoScrollInterval);
8905
- autoScrollInterval = null;
8965
+ if (timer.current) {
8966
+ clearInterval(timer.current);
8967
+ }
8968
+
8969
+ timer.current = null;
8906
8970
  };
8907
8971
 
8908
8972
  React.useEffect(function () {
@@ -8913,7 +8977,7 @@ function AutoScroll(props) {
8913
8977
  return function () {
8914
8978
  stopScroll();
8915
8979
  };
8916
- }, []);
8980
+ }, [timer]);
8917
8981
  return /*#__PURE__*/React__default['default'].createElement("div", {
8918
8982
  className: "autoScroll-outer ".concat(props.className),
8919
8983
  ref: outer,
@@ -8929,12 +8993,12 @@ function AutoScroll(props) {
8929
8993
  }));
8930
8994
  }
8931
8995
 
8932
- var Index$8 = function Index(_ref) {
8996
+ var Index$9 = function Index(_ref) {
8933
8997
  var list = _ref.list,
8934
8998
  render = _ref.render,
8935
8999
  _ref$partSize = _ref.partSize,
8936
9000
  partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
8937
- otherProps = _objectWithoutProperties(_ref, _excluded$8);
9001
+ otherProps = _objectWithoutProperties(_ref, _excluded$9);
8938
9002
 
8939
9003
  {
8940
9004
  var _useState = React.useState([]),
@@ -9011,15 +9075,15 @@ var Index$8 = function Index(_ref) {
9011
9075
  }
9012
9076
  };
9013
9077
 
9014
- var _excluded$9 = ["data", "onClick", "renderItem"];
9078
+ var _excluded$a = ["data", "onClick", "renderItem"];
9015
9079
 
9016
9080
  SwiperCore__default['default'].use([SwiperCore.Pagination, SwiperCore.Navigation, SwiperCore.Autoplay]);
9017
9081
 
9018
- var Index$9 = function Index(props) {
9082
+ var Index$a = function Index(props) {
9019
9083
  var data = props.data,
9020
9084
  _onClick = props.onClick,
9021
9085
  renderItem = props.renderItem,
9022
- extraProps = _objectWithoutProperties(props, _excluded$9);
9086
+ extraProps = _objectWithoutProperties(props, _excluded$a);
9023
9087
 
9024
9088
  return /*#__PURE__*/React__default['default'].createElement(react.Swiper, _objectSpread2({
9025
9089
  onClick: function onClick(swiper, event) {
@@ -9048,7 +9112,7 @@ var Index$9 = function Index(props) {
9048
9112
  }));
9049
9113
  };
9050
9114
 
9051
- Index$9.defaultProps = {};
9115
+ Index$a.defaultProps = {};
9052
9116
 
9053
9117
  function _extends$1() {
9054
9118
  _extends$1 = Object.assign || function (target) {
@@ -9642,7 +9706,7 @@ function createBrowserHistory(props) {
9642
9706
  return history;
9643
9707
  }
9644
9708
 
9645
- var _excluded$a = ["routes", "className"];
9709
+ var _excluded$b = ["routes", "className"];
9646
9710
  var history = createBrowserHistory();
9647
9711
 
9648
9712
  function itemRender(route, params, routes, paths) {
@@ -9657,10 +9721,10 @@ function itemRender(route, params, routes, paths) {
9657
9721
  }, route.breadcrumbName);
9658
9722
  }
9659
9723
 
9660
- var Index$a = function Index(_ref) {
9724
+ var Index$b = function Index(_ref) {
9661
9725
  var routes = _ref.routes,
9662
9726
  className = _ref.className,
9663
- props = _objectWithoutProperties(_ref, _excluded$a);
9727
+ props = _objectWithoutProperties(_ref, _excluded$b);
9664
9728
 
9665
9729
  return /*#__PURE__*/React__default['default'].createElement(_Breadcrumb__default['default'], _objectSpread2({
9666
9730
  className: className || 'default',
@@ -9670,9 +9734,9 @@ var Index$a = function Index(_ref) {
9670
9734
  }, props));
9671
9735
  };
9672
9736
 
9673
- var _excluded$b = ["title", "className", "headerTail", "headerCenter"];
9737
+ var _excluded$c = ["title", "className", "headerTail", "headerCenter"];
9674
9738
 
9675
- var Index$b = function Index(_ref) {
9739
+ var Index$c = function Index(_ref) {
9676
9740
  var _classNames;
9677
9741
 
9678
9742
  var title = _ref.title,
@@ -9680,7 +9744,7 @@ var Index$b = function Index(_ref) {
9680
9744
  className = _ref$className === void 0 ? 'default' : _ref$className,
9681
9745
  headerTail = _ref.headerTail,
9682
9746
  headerCenter = _ref.headerCenter,
9683
- props = _objectWithoutProperties(_ref, _excluded$b);
9747
+ props = _objectWithoutProperties(_ref, _excluded$c);
9684
9748
 
9685
9749
  return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2({
9686
9750
  className: classnames__default['default']((_classNames = {}, _defineProperty(_classNames, 'card-container', true), _defineProperty(_classNames, className, true), _classNames))
@@ -9699,7 +9763,7 @@ var Index$b = function Index(_ref) {
9699
9763
  }, props.children))));
9700
9764
  };
9701
9765
 
9702
- Index$b.defaultProps = {};
9766
+ Index$c.defaultProps = {};
9703
9767
 
9704
9768
  var controlShow = function controlShow(f1, f2, value, timer) {
9705
9769
  f1(value);
@@ -9787,7 +9851,7 @@ function DialogModel(props) {
9787
9851
  return renderChildren;
9788
9852
  }
9789
9853
 
9790
- var _excluded$c = ["visible"];
9854
+ var _excluded$d = ["visible"];
9791
9855
 
9792
9856
  var Modal = /*#__PURE__*/function (_React$PureComponent) {
9793
9857
  _inherits(Modal, _React$PureComponent);
@@ -9919,7 +9983,7 @@ Modal.show = function (config) {
9919
9983
  manager.setShow = setShow;
9920
9984
 
9921
9985
  var visible = props.visible,
9922
- trueProps = _objectWithoutProperties(props, _excluded$c);
9986
+ trueProps = _objectWithoutProperties(props, _excluded$d);
9923
9987
 
9924
9988
  React.useEffect(function () {
9925
9989
  manager.mounted = true;
@@ -9943,7 +10007,7 @@ Modal.hidden = function () {
9943
10007
  ModalContainer[modelSysbol] && ModalContainer[modelSysbol].hidden();
9944
10008
  };
9945
10009
 
9946
- var _excluded$d = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
10010
+ var _excluded$e = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
9947
10011
 
9948
10012
  var ModalForm = function ModalForm(props, ref) {
9949
10013
  var columns = props.columns,
@@ -9957,7 +10021,7 @@ var ModalForm = function ModalForm(props, ref) {
9957
10021
  title = props.title,
9958
10022
  record = props.record,
9959
10023
  onFormChange = props.onFormChange,
9960
- extraProps = _objectWithoutProperties(props, _excluded$d);
10024
+ extraProps = _objectWithoutProperties(props, _excluded$e);
9961
10025
 
9962
10026
  var formRef = React.useRef(null);
9963
10027
 
@@ -10088,7 +10152,7 @@ var ModalForm = function ModalForm(props, ref) {
10088
10152
 
10089
10153
  var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
10090
10154
 
10091
- var _excluded$e = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"];
10155
+ var _excluded$f = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"];
10092
10156
 
10093
10157
  var TabelCard = function TabelCard(props, ref) {
10094
10158
  var columns = props.columns,
@@ -10102,7 +10166,7 @@ var TabelCard = function TabelCard(props, ref) {
10102
10166
  onFormChange = props.onFormChange,
10103
10167
  modalConfig = props.modalConfig,
10104
10168
  optionColumnConfig = props.optionColumnConfig,
10105
- extraProps = _objectWithoutProperties(props, _excluded$e);
10169
+ extraProps = _objectWithoutProperties(props, _excluded$f);
10106
10170
 
10107
10171
  var actionRef = React.useRef();
10108
10172
  var formRef = React.useRef(null);
@@ -10424,25 +10488,26 @@ var TabelCard = function TabelCard(props, ref) {
10424
10488
 
10425
10489
  var index$1 = /*#__PURE__*/React__default['default'].forwardRef(TabelCard);
10426
10490
 
10427
- exports.AutoScroll = Index$8;
10428
- exports.Breadcrumb = Index$a;
10491
+ exports.AutoScroll = Index$9;
10492
+ exports.Breadcrumb = Index$b;
10429
10493
  exports.Button = WButton;
10430
- exports.Card = Index$b;
10494
+ exports.Card = Index$c;
10431
10495
  exports.Checkbox = Index$4;
10432
- exports.CountUp = Index$7;
10496
+ exports.CountUp = Index$8;
10433
10497
  exports.DatePicker = Index$2;
10434
10498
  exports.IconFont = index;
10435
10499
  exports.Input = Index;
10436
10500
  exports.InputNumber = WInputNumber;
10437
10501
  exports.Modal = Modal;
10438
10502
  exports.ModalForm = ModalForm$1;
10439
- exports.Number = Index$6;
10503
+ exports.Number = Index$7;
10440
10504
  exports.NumericInput = NumericInput;
10441
10505
  exports.Radio = Index$3;
10442
10506
  exports.Select = Index$1;
10443
- exports.Swiper = Index$9;
10507
+ exports.Swiper = Index$a;
10444
10508
  exports.Switch = WSwitch;
10445
10509
  exports.TabelCard = index$1;
10446
10510
  exports.Table = Table;
10447
10511
  exports.TreeSelect = Index$5;
10512
+ exports.WDatePicker = Index$6;
10448
10513
  exports.WForm = WForm$1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.2.13",
4
+ "version": "0.2.17",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",
@@ -76,4 +76,4 @@
76
76
  "react": "^16.12.0",
77
77
  "yorkie": "^2.0.0"
78
78
  }
79
- }
79
+ }