wargerm 0.2.14 → 0.2.18

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
@@ -523,6 +523,11 @@ var WSelect = function WSelect(props) {
523
523
  valueEnumList = _useState4[0],
524
524
  setValueEnumList = _useState4[1];
525
525
 
526
+ var _useState5 = useState(null),
527
+ _useState6 = _slicedToArray(_useState5, 2),
528
+ resList = _useState6[0],
529
+ setResList = _useState6[1];
530
+
526
531
  useEffect(function () {
527
532
  _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
528
533
  var res, node;
@@ -531,7 +536,7 @@ var WSelect = function WSelect(props) {
531
536
  switch (_context.prev = _context.next) {
532
537
  case 0:
533
538
  if (!request) {
534
- _context.next = 7;
539
+ _context.next = 8;
535
540
  break;
536
541
  }
537
542
 
@@ -540,6 +545,7 @@ var WSelect = function WSelect(props) {
540
545
 
541
546
  case 3:
542
547
  res = _context.sent;
548
+ setResList(res);
543
549
  onLoad && onLoad(res);
544
550
  node = res.map(function (item) {
545
551
  return /*#__PURE__*/React.createElement(_Select.Option, {
@@ -549,7 +555,7 @@ var WSelect = function WSelect(props) {
549
555
  });
550
556
  setChildrenNode(node);
551
557
 
552
- case 7:
558
+ case 8:
553
559
  case "end":
554
560
  return _context.stop();
555
561
  }
@@ -585,7 +591,7 @@ var WSelect = function WSelect(props) {
585
591
 
586
592
  onLoad && onLoad(options);
587
593
  setValueEnumList(valueEnumNode);
588
- }, []);
594
+ }, [JSON.stringify(resList)]);
589
595
  return /*#__PURE__*/React.createElement(_Select, _objectSpread2({}, extraProps), request ? childrenNode : valueEnum ? valueEnumList : children);
590
596
  };
591
597
 
@@ -7532,8 +7538,65 @@ Table.defaultProps = {
7532
7538
  rowKey: 'key'
7533
7539
  };
7534
7540
 
7535
- var _excluded$5 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
7536
- var RangePicker$2 = Index$2.RangePicker;
7541
+ var _excluded$5 = ["defaultValue", "format", "value", "onChange"],
7542
+ _excluded2$1 = ["defaultValue", "value", "format", "onChange"];
7543
+
7544
+ var momentValue = function momentValue(value) {
7545
+ if (value) {
7546
+ return hooks(value);
7547
+ }
7548
+ };
7549
+
7550
+ var WDatePicker$1 = function WDatePicker(props) {
7551
+ var defaultValue = props.defaultValue,
7552
+ format = props.format,
7553
+ value = props.value,
7554
+ _onChange = props.onChange,
7555
+ extraProps = _objectWithoutProperties(props, _excluded$5);
7556
+
7557
+ return (
7558
+ /*#__PURE__*/
7559
+ // <ConfigProvider locale={zhCN}>
7560
+ React.createElement(_DatePicker, _objectSpread2({
7561
+ defaultValue: momentValue(defaultValue),
7562
+ value: momentValue(value),
7563
+ onChange: function onChange(v) {
7564
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(v, momentValue(v).format(format || 'YYYY-MM-DD'));
7565
+ }
7566
+ }, extraProps)) // </ConfigProvider>
7567
+
7568
+ );
7569
+ };
7570
+
7571
+ WDatePicker$1.defaultProps = {};
7572
+
7573
+ var RangePicker$2 = function RangePicker(props) {
7574
+ var defaultValue = props.defaultValue,
7575
+ value = props.value,
7576
+ format = props.format,
7577
+ _onChange2 = props.onChange,
7578
+ extraProps = _objectWithoutProperties(props, _excluded2$1);
7579
+
7580
+ return (
7581
+ /*#__PURE__*/
7582
+ // <ConfigProvider locale={zhCN}>
7583
+ React.createElement(_DatePicker.RangePicker, _objectSpread2({
7584
+ defaultValue: momentValue(defaultValue),
7585
+ value: momentValue(value),
7586
+ onChange: function onChange(v) {
7587
+ _onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2(v, momentValue(v).format(format || 'YYYY-MM-DD'));
7588
+ }
7589
+ }, extraProps)) // </ConfigProvider>
7590
+
7591
+ );
7592
+ };
7593
+
7594
+ RangePicker$2.defaultProps = {};
7595
+ var Index$6 = WDatePicker$1;
7596
+ Index$6.RangePicker = RangePicker$2;
7597
+
7598
+ var _excluded$6 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
7599
+ var RangePicker$3 = Index$6.RangePicker;
7537
7600
 
7538
7601
  var WForm = function WForm(props, ref) {
7539
7602
  var columns = props.columns,
@@ -7546,7 +7609,7 @@ var WForm = function WForm(props, ref) {
7546
7609
  onFormChange = props.onFormChange,
7547
7610
  onSubmit = props.onSubmit,
7548
7611
  onReset = props.onReset,
7549
- extraProps = _objectWithoutProperties(props, _excluded$5);
7612
+ extraProps = _objectWithoutProperties(props, _excluded$6);
7550
7613
 
7551
7614
  var _Form$useForm = _Form.useForm(),
7552
7615
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
@@ -7710,7 +7773,7 @@ var WForm = function WForm(props, ref) {
7710
7773
  name: c.dataIndex,
7711
7774
  label: c.title,
7712
7775
  labelCol: _labelCol2
7713
- }), /*#__PURE__*/React.createElement(Index$2, _objectSpread2(_objectSpread2(_objectSpread2({
7776
+ }), /*#__PURE__*/React.createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
7714
7777
  disabled: disabled,
7715
7778
  placeholder: "\u8BF7\u8F93\u5165"
7716
7779
  }, picker), showTime), c.fieldProps))));
@@ -7746,7 +7809,7 @@ var WForm = function WForm(props, ref) {
7746
7809
  name: c.dataIndex,
7747
7810
  label: c.title,
7748
7811
  labelCol: _labelCol3
7749
- }), /*#__PURE__*/React.createElement(RangePicker$2, _objectSpread2(_objectSpread2({
7812
+ }), /*#__PURE__*/React.createElement(RangePicker$3, _objectSpread2(_objectSpread2({
7750
7813
  disabled: disabled
7751
7814
  }, _showTime), c.fieldProps))));
7752
7815
  } else if (c.valueType === 'checkbox') {
@@ -8173,7 +8236,7 @@ var WForm = function WForm(props, ref) {
8173
8236
  name: c.dataIndex,
8174
8237
  label: c.title,
8175
8238
  labelCol: _labelCol13
8176
- }), /*#__PURE__*/React.createElement(Index$2, _objectSpread2(_objectSpread2(_objectSpread2({
8239
+ }), /*#__PURE__*/React.createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
8177
8240
  disabled: disabled,
8178
8241
  placeholder: "\u8BF7\u8F93\u5165"
8179
8242
  }, picker), showTime), c.fieldProps))));
@@ -8209,7 +8272,7 @@ var WForm = function WForm(props, ref) {
8209
8272
  name: c.dataIndex,
8210
8273
  label: c.title,
8211
8274
  labelCol: _labelCol14
8212
- }), /*#__PURE__*/React.createElement(RangePicker$2, _objectSpread2(_objectSpread2({
8275
+ }), /*#__PURE__*/React.createElement(RangePicker$3, _objectSpread2(_objectSpread2({
8213
8276
  disabled: disabled
8214
8277
  }, _showTime2), c.fieldProps))));
8215
8278
  } else if (c.valueType === 'checkbox') {
@@ -8506,8 +8569,13 @@ var WForm = function WForm(props, ref) {
8506
8569
  var searchForm = form.getFieldsValue();
8507
8570
  filterFormColumns.forEach(function (c) {
8508
8571
  if (c.search && c.search.transform) {
8509
- searchForm = _objectSpread2(_objectSpread2({}, searchForm), c.search.transform(searchForm[c.dataIndex]));
8510
- delete searchForm[c.dataIndex];
8572
+ var transformObj = c.search.transform(searchForm[c.dataIndex]);
8573
+ searchForm = _objectSpread2(_objectSpread2({}, searchForm), transformObj);
8574
+
8575
+ if (!transformObj[c.dataIndex]) {
8576
+ delete searchForm[c.dataIndex];
8577
+ }
8578
+
8511
8579
  return false;
8512
8580
  }
8513
8581
 
@@ -8631,8 +8699,8 @@ var WForm = function WForm(props, ref) {
8631
8699
 
8632
8700
  var WForm$1 = /*#__PURE__*/React.forwardRef(WForm);
8633
8701
 
8634
- var _excluded$6 = ["height", "width", "count", "style", "numberStyle"],
8635
- _excluded2$1 = ["count", "width", "height", "marginRight"];
8702
+ var _excluded$7 = ["height", "width", "count", "style", "numberStyle"],
8703
+ _excluded2$2 = ["count", "width", "height", "marginRight"];
8636
8704
 
8637
8705
  var Number = function Number(_ref) {
8638
8706
  var height = _ref.height,
@@ -8641,7 +8709,7 @@ var Number = function Number(_ref) {
8641
8709
  count = _ref$count === void 0 ? 0 : _ref$count,
8642
8710
  style = _ref.style,
8643
8711
  numberStyle = _ref.numberStyle,
8644
- props = _objectWithoutProperties(_ref, _excluded$6);
8712
+ props = _objectWithoutProperties(_ref, _excluded$7);
8645
8713
 
8646
8714
  // 上次的值
8647
8715
  var _useState = useState(0),
@@ -8761,13 +8829,13 @@ Number.defaultProps = {
8761
8829
  height: 40
8762
8830
  };
8763
8831
 
8764
- var Index$6 = function Index(props) {
8832
+ var Index$7 = function Index(props) {
8765
8833
  var count = props.count,
8766
8834
  width = props.width,
8767
8835
  height = props.height,
8768
8836
  _props$marginRight = props.marginRight,
8769
8837
  marginRight = _props$marginRight === void 0 ? '8px' : _props$marginRight,
8770
- extraProps = _objectWithoutProperties(props, _excluded2$1);
8838
+ extraProps = _objectWithoutProperties(props, _excluded2$2);
8771
8839
 
8772
8840
  var _useState9 = useState([]),
8773
8841
  _useState10 = _slicedToArray(_useState9, 2),
@@ -8798,26 +8866,26 @@ var Index$6 = function Index(props) {
8798
8866
  }));
8799
8867
  };
8800
8868
 
8801
- var _excluded$7 = ["duration"];
8869
+ var _excluded$8 = ["duration"];
8802
8870
 
8803
- var Index$7 = function Index(props) {
8871
+ var Index$8 = function Index(props) {
8804
8872
  var _props$duration = props.duration,
8805
8873
  duration = _props$duration === void 0 ? 2.75 : _props$duration,
8806
- extraProps = _objectWithoutProperties(props, _excluded$7);
8874
+ extraProps = _objectWithoutProperties(props, _excluded$8);
8807
8875
  return /*#__PURE__*/React.createElement(CountUp, _objectSpread2({
8808
8876
  duration: duration
8809
8877
  }, extraProps));
8810
8878
  };
8811
8879
 
8812
- Index$7.defaultProps = {};
8880
+ Index$8.defaultProps = {};
8813
8881
 
8814
- var _excluded$8 = ["list", "render", "partSize"];
8815
- var autoScrollInterval = null;
8882
+ var _excluded$9 = ["list", "render", "partSize"];
8816
8883
 
8817
8884
  function AutoScroll(props) {
8818
8885
  var inner1 = useRef();
8819
8886
  var inner2 = useRef();
8820
8887
  var outer = useRef();
8888
+ var timer = useRef(null);
8821
8889
  useImperativeHandle(props.cref, function () {
8822
8890
  return {
8823
8891
  tryScroll: tryScroll
@@ -8838,8 +8906,8 @@ function AutoScroll(props) {
8838
8906
 
8839
8907
 
8840
8908
  var startScroll = function startScroll() {
8841
- if (!autoScrollInterval) {
8842
- autoScrollInterval = setInterval(function () {
8909
+ if (!timer.current) {
8910
+ timer.current = setInterval(function () {
8843
8911
  // 如果已经滚动到inner1的底部,则重置滚动的位置到inner1的头部
8844
8912
  if (outer.current.scrollTop >= inner1.current.offsetHeight) {
8845
8913
  outer.current.scrollTop = 0; // 触发complete事件
@@ -8859,8 +8927,11 @@ function AutoScroll(props) {
8859
8927
 
8860
8928
 
8861
8929
  var stopScroll = function stopScroll() {
8862
- clearInterval(autoScrollInterval);
8863
- autoScrollInterval = null;
8930
+ if (timer.current) {
8931
+ clearInterval(timer.current);
8932
+ }
8933
+
8934
+ timer.current = null;
8864
8935
  };
8865
8936
 
8866
8937
  useEffect(function () {
@@ -8871,7 +8942,7 @@ function AutoScroll(props) {
8871
8942
  return function () {
8872
8943
  stopScroll();
8873
8944
  };
8874
- }, []);
8945
+ }, [timer]);
8875
8946
  return /*#__PURE__*/React.createElement("div", {
8876
8947
  className: "autoScroll-outer ".concat(props.className),
8877
8948
  ref: outer,
@@ -8887,12 +8958,12 @@ function AutoScroll(props) {
8887
8958
  }));
8888
8959
  }
8889
8960
 
8890
- var Index$8 = function Index(_ref) {
8961
+ var Index$9 = function Index(_ref) {
8891
8962
  var list = _ref.list,
8892
8963
  render = _ref.render,
8893
8964
  _ref$partSize = _ref.partSize,
8894
8965
  partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
8895
- otherProps = _objectWithoutProperties(_ref, _excluded$8);
8966
+ otherProps = _objectWithoutProperties(_ref, _excluded$9);
8896
8967
 
8897
8968
  {
8898
8969
  var _useState = useState([]),
@@ -8969,15 +9040,15 @@ var Index$8 = function Index(_ref) {
8969
9040
  }
8970
9041
  };
8971
9042
 
8972
- var _excluded$9 = ["data", "onClick", "renderItem"];
9043
+ var _excluded$a = ["data", "onClick", "renderItem"];
8973
9044
 
8974
9045
  SwiperCore.use([Pagination, Navigation, Autoplay]);
8975
9046
 
8976
- var Index$9 = function Index(props) {
9047
+ var Index$a = function Index(props) {
8977
9048
  var data = props.data,
8978
9049
  _onClick = props.onClick,
8979
9050
  renderItem = props.renderItem,
8980
- extraProps = _objectWithoutProperties(props, _excluded$9);
9051
+ extraProps = _objectWithoutProperties(props, _excluded$a);
8981
9052
 
8982
9053
  return /*#__PURE__*/React.createElement(Swiper, _objectSpread2({
8983
9054
  onClick: function onClick(swiper, event) {
@@ -9006,7 +9077,7 @@ var Index$9 = function Index(props) {
9006
9077
  }));
9007
9078
  };
9008
9079
 
9009
- Index$9.defaultProps = {};
9080
+ Index$a.defaultProps = {};
9010
9081
 
9011
9082
  function _extends$1() {
9012
9083
  _extends$1 = Object.assign || function (target) {
@@ -9600,7 +9671,7 @@ function createBrowserHistory(props) {
9600
9671
  return history;
9601
9672
  }
9602
9673
 
9603
- var _excluded$a = ["routes", "className"];
9674
+ var _excluded$b = ["routes", "className"];
9604
9675
  var history = createBrowserHistory();
9605
9676
 
9606
9677
  function itemRender(route, params, routes, paths) {
@@ -9615,10 +9686,10 @@ function itemRender(route, params, routes, paths) {
9615
9686
  }, route.breadcrumbName);
9616
9687
  }
9617
9688
 
9618
- var Index$a = function Index(_ref) {
9689
+ var Index$b = function Index(_ref) {
9619
9690
  var routes = _ref.routes,
9620
9691
  className = _ref.className,
9621
- props = _objectWithoutProperties(_ref, _excluded$a);
9692
+ props = _objectWithoutProperties(_ref, _excluded$b);
9622
9693
 
9623
9694
  return /*#__PURE__*/React.createElement(_Breadcrumb, _objectSpread2({
9624
9695
  className: className || 'default',
@@ -9628,9 +9699,9 @@ var Index$a = function Index(_ref) {
9628
9699
  }, props));
9629
9700
  };
9630
9701
 
9631
- var _excluded$b = ["title", "className", "headerTail", "headerCenter"];
9702
+ var _excluded$c = ["title", "className", "headerTail", "headerCenter"];
9632
9703
 
9633
- var Index$b = function Index(_ref) {
9704
+ var Index$c = function Index(_ref) {
9634
9705
  var _classNames;
9635
9706
 
9636
9707
  var title = _ref.title,
@@ -9638,7 +9709,7 @@ var Index$b = function Index(_ref) {
9638
9709
  className = _ref$className === void 0 ? 'default' : _ref$className,
9639
9710
  headerTail = _ref.headerTail,
9640
9711
  headerCenter = _ref.headerCenter,
9641
- props = _objectWithoutProperties(_ref, _excluded$b);
9712
+ props = _objectWithoutProperties(_ref, _excluded$c);
9642
9713
 
9643
9714
  return /*#__PURE__*/React.createElement("div", _objectSpread2({
9644
9715
  className: classnames((_classNames = {}, _defineProperty(_classNames, 'card-container', true), _defineProperty(_classNames, className, true), _classNames))
@@ -9657,7 +9728,7 @@ var Index$b = function Index(_ref) {
9657
9728
  }, props.children))));
9658
9729
  };
9659
9730
 
9660
- Index$b.defaultProps = {};
9731
+ Index$c.defaultProps = {};
9661
9732
 
9662
9733
  var controlShow = function controlShow(f1, f2, value, timer) {
9663
9734
  f1(value);
@@ -9745,7 +9816,7 @@ function DialogModel(props) {
9745
9816
  return renderChildren;
9746
9817
  }
9747
9818
 
9748
- var _excluded$c = ["visible"];
9819
+ var _excluded$d = ["visible"];
9749
9820
 
9750
9821
  var Modal = /*#__PURE__*/function (_React$PureComponent) {
9751
9822
  _inherits(Modal, _React$PureComponent);
@@ -9877,7 +9948,7 @@ Modal.show = function (config) {
9877
9948
  manager.setShow = setShow;
9878
9949
 
9879
9950
  var visible = props.visible,
9880
- trueProps = _objectWithoutProperties(props, _excluded$c);
9951
+ trueProps = _objectWithoutProperties(props, _excluded$d);
9881
9952
 
9882
9953
  useEffect(function () {
9883
9954
  manager.mounted = true;
@@ -9901,7 +9972,7 @@ Modal.hidden = function () {
9901
9972
  ModalContainer[modelSysbol] && ModalContainer[modelSysbol].hidden();
9902
9973
  };
9903
9974
 
9904
- var _excluded$d = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
9975
+ var _excluded$e = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
9905
9976
 
9906
9977
  var ModalForm = function ModalForm(props, ref) {
9907
9978
  var columns = props.columns,
@@ -9915,7 +9986,7 @@ var ModalForm = function ModalForm(props, ref) {
9915
9986
  title = props.title,
9916
9987
  record = props.record,
9917
9988
  onFormChange = props.onFormChange,
9918
- extraProps = _objectWithoutProperties(props, _excluded$d);
9989
+ extraProps = _objectWithoutProperties(props, _excluded$e);
9919
9990
 
9920
9991
  var formRef = useRef(null);
9921
9992
 
@@ -10046,7 +10117,7 @@ var ModalForm = function ModalForm(props, ref) {
10046
10117
 
10047
10118
  var ModalForm$1 = /*#__PURE__*/React.forwardRef(ModalForm);
10048
10119
 
10049
- var _excluded$e = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"];
10120
+ var _excluded$f = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"];
10050
10121
 
10051
10122
  var TabelCard = function TabelCard(props, ref) {
10052
10123
  var columns = props.columns,
@@ -10060,7 +10131,7 @@ var TabelCard = function TabelCard(props, ref) {
10060
10131
  onFormChange = props.onFormChange,
10061
10132
  modalConfig = props.modalConfig,
10062
10133
  optionColumnConfig = props.optionColumnConfig,
10063
- extraProps = _objectWithoutProperties(props, _excluded$e);
10134
+ extraProps = _objectWithoutProperties(props, _excluded$f);
10064
10135
 
10065
10136
  var actionRef = useRef();
10066
10137
  var formRef = useRef(null);
@@ -10382,4 +10453,4 @@ var TabelCard = function TabelCard(props, ref) {
10382
10453
 
10383
10454
  var index$1 = /*#__PURE__*/React.forwardRef(TabelCard);
10384
10455
 
10385
- 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 };
10456
+ 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,6 +556,11 @@ var WSelect = function WSelect(props) {
556
556
  valueEnumList = _useState4[0],
557
557
  setValueEnumList = _useState4[1];
558
558
 
559
+ var _useState5 = React.useState(null),
560
+ _useState6 = _slicedToArray(_useState5, 2),
561
+ resList = _useState6[0],
562
+ setResList = _useState6[1];
563
+
559
564
  React.useEffect(function () {
560
565
  _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
561
566
  var res, node;
@@ -564,7 +569,7 @@ var WSelect = function WSelect(props) {
564
569
  switch (_context.prev = _context.next) {
565
570
  case 0:
566
571
  if (!request) {
567
- _context.next = 7;
572
+ _context.next = 8;
568
573
  break;
569
574
  }
570
575
 
@@ -573,6 +578,7 @@ var WSelect = function WSelect(props) {
573
578
 
574
579
  case 3:
575
580
  res = _context.sent;
581
+ setResList(res);
576
582
  onLoad && onLoad(res);
577
583
  node = res.map(function (item) {
578
584
  return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'].Option, {
@@ -582,7 +588,7 @@ var WSelect = function WSelect(props) {
582
588
  });
583
589
  setChildrenNode(node);
584
590
 
585
- case 7:
591
+ case 8:
586
592
  case "end":
587
593
  return _context.stop();
588
594
  }
@@ -618,7 +624,7 @@ var WSelect = function WSelect(props) {
618
624
 
619
625
  onLoad && onLoad(options);
620
626
  setValueEnumList(valueEnumNode);
621
- }, []);
627
+ }, [JSON.stringify(resList)]);
622
628
  return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'], _objectSpread2({}, extraProps), request ? childrenNode : valueEnum ? valueEnumList : children);
623
629
  };
624
630
 
@@ -7565,8 +7571,65 @@ Table.defaultProps = {
7565
7571
  rowKey: 'key'
7566
7572
  };
7567
7573
 
7568
- var _excluded$5 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
7569
- var RangePicker$2 = Index$2.RangePicker;
7574
+ var _excluded$5 = ["defaultValue", "format", "value", "onChange"],
7575
+ _excluded2$1 = ["defaultValue", "value", "format", "onChange"];
7576
+
7577
+ var momentValue = function momentValue(value) {
7578
+ if (value) {
7579
+ return hooks(value);
7580
+ }
7581
+ };
7582
+
7583
+ var WDatePicker$1 = function WDatePicker(props) {
7584
+ var defaultValue = props.defaultValue,
7585
+ format = props.format,
7586
+ value = props.value,
7587
+ _onChange = props.onChange,
7588
+ extraProps = _objectWithoutProperties(props, _excluded$5);
7589
+
7590
+ return (
7591
+ /*#__PURE__*/
7592
+ // <ConfigProvider locale={zhCN}>
7593
+ React__default['default'].createElement(_DatePicker__default['default'], _objectSpread2({
7594
+ defaultValue: momentValue(defaultValue),
7595
+ value: momentValue(value),
7596
+ onChange: function onChange(v) {
7597
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(v, momentValue(v).format(format || 'YYYY-MM-DD'));
7598
+ }
7599
+ }, extraProps)) // </ConfigProvider>
7600
+
7601
+ );
7602
+ };
7603
+
7604
+ WDatePicker$1.defaultProps = {};
7605
+
7606
+ var RangePicker$2 = function RangePicker(props) {
7607
+ var defaultValue = props.defaultValue,
7608
+ value = props.value,
7609
+ format = props.format,
7610
+ _onChange2 = props.onChange,
7611
+ extraProps = _objectWithoutProperties(props, _excluded2$1);
7612
+
7613
+ return (
7614
+ /*#__PURE__*/
7615
+ // <ConfigProvider locale={zhCN}>
7616
+ React__default['default'].createElement(_DatePicker__default['default'].RangePicker, _objectSpread2({
7617
+ defaultValue: momentValue(defaultValue),
7618
+ value: momentValue(value),
7619
+ onChange: function onChange(v) {
7620
+ _onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2(v, momentValue(v).format(format || 'YYYY-MM-DD'));
7621
+ }
7622
+ }, extraProps)) // </ConfigProvider>
7623
+
7624
+ );
7625
+ };
7626
+
7627
+ RangePicker$2.defaultProps = {};
7628
+ var Index$6 = WDatePicker$1;
7629
+ Index$6.RangePicker = RangePicker$2;
7630
+
7631
+ var _excluded$6 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
7632
+ var RangePicker$3 = Index$6.RangePicker;
7570
7633
 
7571
7634
  var WForm = function WForm(props, ref) {
7572
7635
  var columns = props.columns,
@@ -7579,7 +7642,7 @@ var WForm = function WForm(props, ref) {
7579
7642
  onFormChange = props.onFormChange,
7580
7643
  onSubmit = props.onSubmit,
7581
7644
  onReset = props.onReset,
7582
- extraProps = _objectWithoutProperties(props, _excluded$5);
7645
+ extraProps = _objectWithoutProperties(props, _excluded$6);
7583
7646
 
7584
7647
  var _Form$useForm = _Form__default['default'].useForm(),
7585
7648
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
@@ -7743,7 +7806,7 @@ var WForm = function WForm(props, ref) {
7743
7806
  name: c.dataIndex,
7744
7807
  label: c.title,
7745
7808
  labelCol: _labelCol2
7746
- }), /*#__PURE__*/React__default['default'].createElement(Index$2, _objectSpread2(_objectSpread2(_objectSpread2({
7809
+ }), /*#__PURE__*/React__default['default'].createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
7747
7810
  disabled: disabled,
7748
7811
  placeholder: "\u8BF7\u8F93\u5165"
7749
7812
  }, picker), showTime), c.fieldProps))));
@@ -7779,7 +7842,7 @@ var WForm = function WForm(props, ref) {
7779
7842
  name: c.dataIndex,
7780
7843
  label: c.title,
7781
7844
  labelCol: _labelCol3
7782
- }), /*#__PURE__*/React__default['default'].createElement(RangePicker$2, _objectSpread2(_objectSpread2({
7845
+ }), /*#__PURE__*/React__default['default'].createElement(RangePicker$3, _objectSpread2(_objectSpread2({
7783
7846
  disabled: disabled
7784
7847
  }, _showTime), c.fieldProps))));
7785
7848
  } else if (c.valueType === 'checkbox') {
@@ -8206,7 +8269,7 @@ var WForm = function WForm(props, ref) {
8206
8269
  name: c.dataIndex,
8207
8270
  label: c.title,
8208
8271
  labelCol: _labelCol13
8209
- }), /*#__PURE__*/React__default['default'].createElement(Index$2, _objectSpread2(_objectSpread2(_objectSpread2({
8272
+ }), /*#__PURE__*/React__default['default'].createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
8210
8273
  disabled: disabled,
8211
8274
  placeholder: "\u8BF7\u8F93\u5165"
8212
8275
  }, picker), showTime), c.fieldProps))));
@@ -8242,7 +8305,7 @@ var WForm = function WForm(props, ref) {
8242
8305
  name: c.dataIndex,
8243
8306
  label: c.title,
8244
8307
  labelCol: _labelCol14
8245
- }), /*#__PURE__*/React__default['default'].createElement(RangePicker$2, _objectSpread2(_objectSpread2({
8308
+ }), /*#__PURE__*/React__default['default'].createElement(RangePicker$3, _objectSpread2(_objectSpread2({
8246
8309
  disabled: disabled
8247
8310
  }, _showTime2), c.fieldProps))));
8248
8311
  } else if (c.valueType === 'checkbox') {
@@ -8539,8 +8602,13 @@ var WForm = function WForm(props, ref) {
8539
8602
  var searchForm = form.getFieldsValue();
8540
8603
  filterFormColumns.forEach(function (c) {
8541
8604
  if (c.search && c.search.transform) {
8542
- searchForm = _objectSpread2(_objectSpread2({}, searchForm), c.search.transform(searchForm[c.dataIndex]));
8543
- delete searchForm[c.dataIndex];
8605
+ var transformObj = c.search.transform(searchForm[c.dataIndex]);
8606
+ searchForm = _objectSpread2(_objectSpread2({}, searchForm), transformObj);
8607
+
8608
+ if (!transformObj[c.dataIndex]) {
8609
+ delete searchForm[c.dataIndex];
8610
+ }
8611
+
8544
8612
  return false;
8545
8613
  }
8546
8614
 
@@ -8664,8 +8732,8 @@ var WForm = function WForm(props, ref) {
8664
8732
 
8665
8733
  var WForm$1 = /*#__PURE__*/React__default['default'].forwardRef(WForm);
8666
8734
 
8667
- var _excluded$6 = ["height", "width", "count", "style", "numberStyle"],
8668
- _excluded2$1 = ["count", "width", "height", "marginRight"];
8735
+ var _excluded$7 = ["height", "width", "count", "style", "numberStyle"],
8736
+ _excluded2$2 = ["count", "width", "height", "marginRight"];
8669
8737
 
8670
8738
  var Number = function Number(_ref) {
8671
8739
  var height = _ref.height,
@@ -8674,7 +8742,7 @@ var Number = function Number(_ref) {
8674
8742
  count = _ref$count === void 0 ? 0 : _ref$count,
8675
8743
  style = _ref.style,
8676
8744
  numberStyle = _ref.numberStyle,
8677
- props = _objectWithoutProperties(_ref, _excluded$6);
8745
+ props = _objectWithoutProperties(_ref, _excluded$7);
8678
8746
 
8679
8747
  // 上次的值
8680
8748
  var _useState = React.useState(0),
@@ -8794,13 +8862,13 @@ Number.defaultProps = {
8794
8862
  height: 40
8795
8863
  };
8796
8864
 
8797
- var Index$6 = function Index(props) {
8865
+ var Index$7 = function Index(props) {
8798
8866
  var count = props.count,
8799
8867
  width = props.width,
8800
8868
  height = props.height,
8801
8869
  _props$marginRight = props.marginRight,
8802
8870
  marginRight = _props$marginRight === void 0 ? '8px' : _props$marginRight,
8803
- extraProps = _objectWithoutProperties(props, _excluded2$1);
8871
+ extraProps = _objectWithoutProperties(props, _excluded2$2);
8804
8872
 
8805
8873
  var _useState9 = React.useState([]),
8806
8874
  _useState10 = _slicedToArray(_useState9, 2),
@@ -8831,26 +8899,26 @@ var Index$6 = function Index(props) {
8831
8899
  }));
8832
8900
  };
8833
8901
 
8834
- var _excluded$7 = ["duration"];
8902
+ var _excluded$8 = ["duration"];
8835
8903
 
8836
- var Index$7 = function Index(props) {
8904
+ var Index$8 = function Index(props) {
8837
8905
  var _props$duration = props.duration,
8838
8906
  duration = _props$duration === void 0 ? 2.75 : _props$duration,
8839
- extraProps = _objectWithoutProperties(props, _excluded$7);
8907
+ extraProps = _objectWithoutProperties(props, _excluded$8);
8840
8908
  return /*#__PURE__*/React__default['default'].createElement(CountUp__default['default'], _objectSpread2({
8841
8909
  duration: duration
8842
8910
  }, extraProps));
8843
8911
  };
8844
8912
 
8845
- Index$7.defaultProps = {};
8913
+ Index$8.defaultProps = {};
8846
8914
 
8847
- var _excluded$8 = ["list", "render", "partSize"];
8848
- var autoScrollInterval = null;
8915
+ var _excluded$9 = ["list", "render", "partSize"];
8849
8916
 
8850
8917
  function AutoScroll(props) {
8851
8918
  var inner1 = React.useRef();
8852
8919
  var inner2 = React.useRef();
8853
8920
  var outer = React.useRef();
8921
+ var timer = React.useRef(null);
8854
8922
  React.useImperativeHandle(props.cref, function () {
8855
8923
  return {
8856
8924
  tryScroll: tryScroll
@@ -8871,8 +8939,8 @@ function AutoScroll(props) {
8871
8939
 
8872
8940
 
8873
8941
  var startScroll = function startScroll() {
8874
- if (!autoScrollInterval) {
8875
- autoScrollInterval = setInterval(function () {
8942
+ if (!timer.current) {
8943
+ timer.current = setInterval(function () {
8876
8944
  // 如果已经滚动到inner1的底部,则重置滚动的位置到inner1的头部
8877
8945
  if (outer.current.scrollTop >= inner1.current.offsetHeight) {
8878
8946
  outer.current.scrollTop = 0; // 触发complete事件
@@ -8892,8 +8960,11 @@ function AutoScroll(props) {
8892
8960
 
8893
8961
 
8894
8962
  var stopScroll = function stopScroll() {
8895
- clearInterval(autoScrollInterval);
8896
- autoScrollInterval = null;
8963
+ if (timer.current) {
8964
+ clearInterval(timer.current);
8965
+ }
8966
+
8967
+ timer.current = null;
8897
8968
  };
8898
8969
 
8899
8970
  React.useEffect(function () {
@@ -8904,7 +8975,7 @@ function AutoScroll(props) {
8904
8975
  return function () {
8905
8976
  stopScroll();
8906
8977
  };
8907
- }, []);
8978
+ }, [timer]);
8908
8979
  return /*#__PURE__*/React__default['default'].createElement("div", {
8909
8980
  className: "autoScroll-outer ".concat(props.className),
8910
8981
  ref: outer,
@@ -8920,12 +8991,12 @@ function AutoScroll(props) {
8920
8991
  }));
8921
8992
  }
8922
8993
 
8923
- var Index$8 = function Index(_ref) {
8994
+ var Index$9 = function Index(_ref) {
8924
8995
  var list = _ref.list,
8925
8996
  render = _ref.render,
8926
8997
  _ref$partSize = _ref.partSize,
8927
8998
  partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
8928
- otherProps = _objectWithoutProperties(_ref, _excluded$8);
8999
+ otherProps = _objectWithoutProperties(_ref, _excluded$9);
8929
9000
 
8930
9001
  {
8931
9002
  var _useState = React.useState([]),
@@ -9002,15 +9073,15 @@ var Index$8 = function Index(_ref) {
9002
9073
  }
9003
9074
  };
9004
9075
 
9005
- var _excluded$9 = ["data", "onClick", "renderItem"];
9076
+ var _excluded$a = ["data", "onClick", "renderItem"];
9006
9077
 
9007
9078
  SwiperCore__default['default'].use([SwiperCore.Pagination, SwiperCore.Navigation, SwiperCore.Autoplay]);
9008
9079
 
9009
- var Index$9 = function Index(props) {
9080
+ var Index$a = function Index(props) {
9010
9081
  var data = props.data,
9011
9082
  _onClick = props.onClick,
9012
9083
  renderItem = props.renderItem,
9013
- extraProps = _objectWithoutProperties(props, _excluded$9);
9084
+ extraProps = _objectWithoutProperties(props, _excluded$a);
9014
9085
 
9015
9086
  return /*#__PURE__*/React__default['default'].createElement(react.Swiper, _objectSpread2({
9016
9087
  onClick: function onClick(swiper, event) {
@@ -9039,7 +9110,7 @@ var Index$9 = function Index(props) {
9039
9110
  }));
9040
9111
  };
9041
9112
 
9042
- Index$9.defaultProps = {};
9113
+ Index$a.defaultProps = {};
9043
9114
 
9044
9115
  function _extends$1() {
9045
9116
  _extends$1 = Object.assign || function (target) {
@@ -9633,7 +9704,7 @@ function createBrowserHistory(props) {
9633
9704
  return history;
9634
9705
  }
9635
9706
 
9636
- var _excluded$a = ["routes", "className"];
9707
+ var _excluded$b = ["routes", "className"];
9637
9708
  var history = createBrowserHistory();
9638
9709
 
9639
9710
  function itemRender(route, params, routes, paths) {
@@ -9648,10 +9719,10 @@ function itemRender(route, params, routes, paths) {
9648
9719
  }, route.breadcrumbName);
9649
9720
  }
9650
9721
 
9651
- var Index$a = function Index(_ref) {
9722
+ var Index$b = function Index(_ref) {
9652
9723
  var routes = _ref.routes,
9653
9724
  className = _ref.className,
9654
- props = _objectWithoutProperties(_ref, _excluded$a);
9725
+ props = _objectWithoutProperties(_ref, _excluded$b);
9655
9726
 
9656
9727
  return /*#__PURE__*/React__default['default'].createElement(_Breadcrumb__default['default'], _objectSpread2({
9657
9728
  className: className || 'default',
@@ -9661,9 +9732,9 @@ var Index$a = function Index(_ref) {
9661
9732
  }, props));
9662
9733
  };
9663
9734
 
9664
- var _excluded$b = ["title", "className", "headerTail", "headerCenter"];
9735
+ var _excluded$c = ["title", "className", "headerTail", "headerCenter"];
9665
9736
 
9666
- var Index$b = function Index(_ref) {
9737
+ var Index$c = function Index(_ref) {
9667
9738
  var _classNames;
9668
9739
 
9669
9740
  var title = _ref.title,
@@ -9671,7 +9742,7 @@ var Index$b = function Index(_ref) {
9671
9742
  className = _ref$className === void 0 ? 'default' : _ref$className,
9672
9743
  headerTail = _ref.headerTail,
9673
9744
  headerCenter = _ref.headerCenter,
9674
- props = _objectWithoutProperties(_ref, _excluded$b);
9745
+ props = _objectWithoutProperties(_ref, _excluded$c);
9675
9746
 
9676
9747
  return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2({
9677
9748
  className: classnames__default['default']((_classNames = {}, _defineProperty(_classNames, 'card-container', true), _defineProperty(_classNames, className, true), _classNames))
@@ -9690,7 +9761,7 @@ var Index$b = function Index(_ref) {
9690
9761
  }, props.children))));
9691
9762
  };
9692
9763
 
9693
- Index$b.defaultProps = {};
9764
+ Index$c.defaultProps = {};
9694
9765
 
9695
9766
  var controlShow = function controlShow(f1, f2, value, timer) {
9696
9767
  f1(value);
@@ -9778,7 +9849,7 @@ function DialogModel(props) {
9778
9849
  return renderChildren;
9779
9850
  }
9780
9851
 
9781
- var _excluded$c = ["visible"];
9852
+ var _excluded$d = ["visible"];
9782
9853
 
9783
9854
  var Modal = /*#__PURE__*/function (_React$PureComponent) {
9784
9855
  _inherits(Modal, _React$PureComponent);
@@ -9910,7 +9981,7 @@ Modal.show = function (config) {
9910
9981
  manager.setShow = setShow;
9911
9982
 
9912
9983
  var visible = props.visible,
9913
- trueProps = _objectWithoutProperties(props, _excluded$c);
9984
+ trueProps = _objectWithoutProperties(props, _excluded$d);
9914
9985
 
9915
9986
  React.useEffect(function () {
9916
9987
  manager.mounted = true;
@@ -9934,7 +10005,7 @@ Modal.hidden = function () {
9934
10005
  ModalContainer[modelSysbol] && ModalContainer[modelSysbol].hidden();
9935
10006
  };
9936
10007
 
9937
- var _excluded$d = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
10008
+ var _excluded$e = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
9938
10009
 
9939
10010
  var ModalForm = function ModalForm(props, ref) {
9940
10011
  var columns = props.columns,
@@ -9948,7 +10019,7 @@ var ModalForm = function ModalForm(props, ref) {
9948
10019
  title = props.title,
9949
10020
  record = props.record,
9950
10021
  onFormChange = props.onFormChange,
9951
- extraProps = _objectWithoutProperties(props, _excluded$d);
10022
+ extraProps = _objectWithoutProperties(props, _excluded$e);
9952
10023
 
9953
10024
  var formRef = React.useRef(null);
9954
10025
 
@@ -10079,7 +10150,7 @@ var ModalForm = function ModalForm(props, ref) {
10079
10150
 
10080
10151
  var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
10081
10152
 
10082
- var _excluded$e = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"];
10153
+ var _excluded$f = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"];
10083
10154
 
10084
10155
  var TabelCard = function TabelCard(props, ref) {
10085
10156
  var columns = props.columns,
@@ -10093,7 +10164,7 @@ var TabelCard = function TabelCard(props, ref) {
10093
10164
  onFormChange = props.onFormChange,
10094
10165
  modalConfig = props.modalConfig,
10095
10166
  optionColumnConfig = props.optionColumnConfig,
10096
- extraProps = _objectWithoutProperties(props, _excluded$e);
10167
+ extraProps = _objectWithoutProperties(props, _excluded$f);
10097
10168
 
10098
10169
  var actionRef = React.useRef();
10099
10170
  var formRef = React.useRef(null);
@@ -10415,25 +10486,26 @@ var TabelCard = function TabelCard(props, ref) {
10415
10486
 
10416
10487
  var index$1 = /*#__PURE__*/React__default['default'].forwardRef(TabelCard);
10417
10488
 
10418
- exports.AutoScroll = Index$8;
10419
- exports.Breadcrumb = Index$a;
10489
+ exports.AutoScroll = Index$9;
10490
+ exports.Breadcrumb = Index$b;
10420
10491
  exports.Button = WButton;
10421
- exports.Card = Index$b;
10492
+ exports.Card = Index$c;
10422
10493
  exports.Checkbox = Index$4;
10423
- exports.CountUp = Index$7;
10494
+ exports.CountUp = Index$8;
10424
10495
  exports.DatePicker = Index$2;
10425
10496
  exports.IconFont = index;
10426
10497
  exports.Input = Index;
10427
10498
  exports.InputNumber = WInputNumber;
10428
10499
  exports.Modal = Modal;
10429
10500
  exports.ModalForm = ModalForm$1;
10430
- exports.Number = Index$6;
10501
+ exports.Number = Index$7;
10431
10502
  exports.NumericInput = NumericInput;
10432
10503
  exports.Radio = Index$3;
10433
10504
  exports.Select = Index$1;
10434
- exports.Swiper = Index$9;
10505
+ exports.Swiper = Index$a;
10435
10506
  exports.Switch = WSwitch;
10436
10507
  exports.TabelCard = index$1;
10437
10508
  exports.Table = Table;
10438
10509
  exports.TreeSelect = Index$5;
10510
+ exports.WDatePicker = Index$6;
10439
10511
  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.14",
4
+ "version": "0.2.18",
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
+ }