wargerm 0.3.11 → 0.3.14

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { DatePickerProps, RangePickerProps } from 'antd/lib/date-picker';
3
3
  export declare type IndexComponent = React.FC<DatePickerProps> & {
4
4
  RangePicker: React.FC<RangePickerProps>;
5
+ showTime: Object | boolean;
5
6
  };
6
7
  declare const Index: IndexComponent;
7
8
  export default Index;
package/dist/index.esm.js CHANGED
@@ -496,12 +496,7 @@ WInputNumber.defaultProps = {};
496
496
  var WDatePicker = function WDatePicker(props) {
497
497
  var extraProps = _extends({}, props);
498
498
 
499
- return (
500
- /*#__PURE__*/
501
- // <ConfigProvider locale={zhCN}>
502
- React.createElement(_DatePicker, _objectSpread2({}, extraProps)) // </ConfigProvider>
503
-
504
- );
499
+ return /*#__PURE__*/React.createElement(_DatePicker, _objectSpread2({}, extraProps));
505
500
  };
506
501
 
507
502
  WDatePicker.defaultProps = {};
@@ -509,12 +504,7 @@ WDatePicker.defaultProps = {};
509
504
  var RangePicker = function RangePicker(props) {
510
505
  var extraProps = _extends({}, props);
511
506
 
512
- return (
513
- /*#__PURE__*/
514
- // <ConfigProvider locale={zhCN}>
515
- React.createElement(_DatePicker.RangePicker, _objectSpread2({}, extraProps)) // </ConfigProvider>
516
-
517
- );
507
+ return /*#__PURE__*/React.createElement(_DatePicker.RangePicker, _objectSpread2({}, extraProps));
518
508
  };
519
509
 
520
510
  RangePicker.defaultProps = {};
@@ -6417,12 +6407,14 @@ hooks.HTML5_FMT = {
6417
6407
  };
6418
6408
 
6419
6409
  var _excluded$3 = ["defaultValue", "format", "value", "onChange"],
6420
- _excluded2$1 = ["defaultValue", "value", "format", "onChange"];
6410
+ _excluded2$1 = ["defaultValue", "value", "format", "showTime", "onChange"];
6421
6411
 
6422
6412
  var momentValue = function momentValue(value) {
6423
6413
  if (value) {
6424
6414
  return hooks(value);
6425
6415
  }
6416
+
6417
+ return value;
6426
6418
  };
6427
6419
 
6428
6420
  var WDatePicker$1 = function WDatePicker(props) {
@@ -6432,20 +6424,15 @@ var WDatePicker$1 = function WDatePicker(props) {
6432
6424
  _onChange = props.onChange,
6433
6425
  extraProps = _objectWithoutProperties(props, _excluded$3);
6434
6426
 
6435
- return (
6436
- /*#__PURE__*/
6437
- // <ConfigProvider locale={zhCN}>
6438
- React.createElement(_DatePicker, _objectSpread2({
6439
- defaultValue: momentValue(defaultValue),
6440
- value: momentValue(value),
6441
- onChange: function onChange(v) {
6442
- var _momentValue;
6443
-
6444
- (_onChange === null || _onChange === void 0 ? void 0 : _onChange(v, (_momentValue = momentValue(v)) === null || _momentValue === void 0 ? void 0 : _momentValue.format(format || 'YYYY-MM-DD'))) || '';
6445
- }
6446
- }, extraProps)) // </ConfigProvider>
6427
+ return /*#__PURE__*/React.createElement(_DatePicker, _objectSpread2({
6428
+ defaultValue: momentValue(defaultValue),
6429
+ value: momentValue(value),
6430
+ onChange: function onChange(v) {
6431
+ var _momentValue2, _momentValue3;
6447
6432
 
6448
- );
6433
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange((_momentValue2 = momentValue(v)) === null || _momentValue2 === void 0 ? void 0 : _momentValue2.format(format || (extraProps.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD')), (_momentValue3 = momentValue(v)) === null || _momentValue3 === void 0 ? void 0 : _momentValue3.format(format || (extraProps.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD')));
6434
+ }
6435
+ }, extraProps));
6449
6436
  };
6450
6437
 
6451
6438
  WDatePicker$1.defaultProps = {};
@@ -6454,23 +6441,20 @@ var RangePicker$1 = function RangePicker(props) {
6454
6441
  var defaultValue = props.defaultValue,
6455
6442
  value = props.value,
6456
6443
  format = props.format,
6444
+ showTime = props.showTime,
6457
6445
  _onChange2 = props.onChange,
6458
6446
  extraProps = _objectWithoutProperties(props, _excluded2$1);
6459
6447
 
6460
- return (
6461
- /*#__PURE__*/
6462
- // <ConfigProvider locale={zhCN}>
6463
- React.createElement(_DatePicker.RangePicker, _objectSpread2({
6464
- defaultValue: momentValue(defaultValue),
6465
- value: momentValue(value),
6466
- onChange: function onChange(v) {
6467
- var _momentValue2;
6468
-
6469
- (_onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2(v, (_momentValue2 = momentValue(v)) === null || _momentValue2 === void 0 ? void 0 : _momentValue2.format(format || 'YYYY-MM-DD'))) || '';
6470
- }
6471
- }, extraProps)) // </ConfigProvider>
6448
+ return /*#__PURE__*/React.createElement(_DatePicker.RangePicker, _objectSpread2({
6449
+ showTime: showTime,
6450
+ defaultValue: defaultValue ? [momentValue(defaultValue[0]), momentValue(defaultValue[1])] : undefined,
6451
+ value: value ? [momentValue(value[0]), momentValue(value[1])] : undefined,
6452
+ onChange: function onChange(v) {
6453
+ var _momentValue4, _momentValue5, _momentValue6, _momentValue7;
6472
6454
 
6473
- );
6455
+ _onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2([((_momentValue4 = momentValue(v[0])) === null || _momentValue4 === void 0 ? void 0 : _momentValue4.format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))) || '', ((_momentValue5 = momentValue(v[1])) === null || _momentValue5 === void 0 ? void 0 : _momentValue5.format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))) || ''], [((_momentValue6 = momentValue(v[0])) === null || _momentValue6 === void 0 ? void 0 : _momentValue6.format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))) || '', ((_momentValue7 = momentValue(v[1])) === null || _momentValue7 === void 0 ? void 0 : _momentValue7.format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))) || '']);
6456
+ }
6457
+ }, extraProps));
6474
6458
  };
6475
6459
 
6476
6460
  RangePicker$1.defaultProps = {};
@@ -7757,30 +7741,42 @@ var WForm = function WForm(props, ref) {
7757
7741
 
7758
7742
  if (c.valueType && ['date', 'dateTime', 'dateMonth', 'dateYear', 'dateRange', 'dateTimeRange'].includes(c.valueType)) {
7759
7743
  if (c.valueType === 'date' && searchForm[c.dataIndex]) {
7760
- searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format('YYYY-MM-DD');
7744
+ var _c$fieldProps;
7745
+
7746
+ searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format((c === null || c === void 0 ? void 0 : (_c$fieldProps = c.fieldProps) === null || _c$fieldProps === void 0 ? void 0 : _c$fieldProps.format) || 'YYYY-MM-DD');
7761
7747
  }
7762
7748
 
7763
7749
  if (c.valueType === 'dateTime' && searchForm[c.dataIndex]) {
7764
- searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format('YYYY-MM-DD HH:mm:ss');
7750
+ var _c$fieldProps2;
7751
+
7752
+ searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format((c === null || c === void 0 ? void 0 : (_c$fieldProps2 = c.fieldProps) === null || _c$fieldProps2 === void 0 ? void 0 : _c$fieldProps2.format) || 'YYYY-MM-DD HH:mm:ss');
7765
7753
  }
7766
7754
 
7767
7755
  if (c.valueType === 'dateMonth' && searchForm[c.dataIndex]) {
7768
- searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format('YYYY-MM');
7756
+ var _c$fieldProps3;
7757
+
7758
+ searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format((c === null || c === void 0 ? void 0 : (_c$fieldProps3 = c.fieldProps) === null || _c$fieldProps3 === void 0 ? void 0 : _c$fieldProps3.format) || 'YYYY-MM');
7769
7759
  }
7770
7760
 
7771
7761
  if (c.valueType === 'dateYear' && searchForm[c.dataIndex]) {
7772
- searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format('YYYY');
7762
+ var _c$fieldProps4;
7763
+
7764
+ searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format((c === null || c === void 0 ? void 0 : (_c$fieldProps4 = c.fieldProps) === null || _c$fieldProps4 === void 0 ? void 0 : _c$fieldProps4.format) || 'YYYY');
7773
7765
  }
7774
7766
 
7775
7767
  if (c.valueType === 'dateRange' && searchForm[c.dataIndex]) {
7776
7768
  searchForm[c.dataIndex] = searchForm[c.dataIndex].map(function (item) {
7777
- return item && searchForm[c.dataIndex] && hooks(item).format('YYYY-MM-DD');
7769
+ var _c$fieldProps5;
7770
+
7771
+ return item && searchForm[c.dataIndex] && hooks(item).format((c === null || c === void 0 ? void 0 : (_c$fieldProps5 = c.fieldProps) === null || _c$fieldProps5 === void 0 ? void 0 : _c$fieldProps5.format) || 'YYYY-MM-DD');
7778
7772
  });
7779
7773
  }
7780
7774
 
7781
7775
  if (c.valueType === 'dateTimeRange' && searchForm[c.dataIndex]) {
7782
7776
  searchForm[c.dataIndex] = searchForm[c.dataIndex].map(function (item) {
7783
- return item && hooks(item).format('YYYY-MM-DD HH:mm:ss');
7777
+ var _c$fieldProps6;
7778
+
7779
+ return item && hooks(item).format((c === null || c === void 0 ? void 0 : (_c$fieldProps6 = c.fieldProps) === null || _c$fieldProps6 === void 0 ? void 0 : _c$fieldProps6.format) || 'YYYY-MM-DD HH:mm:ss');
7784
7780
  });
7785
7781
  }
7786
7782
  }
package/dist/index.js CHANGED
@@ -530,12 +530,7 @@ WInputNumber.defaultProps = {};
530
530
  var WDatePicker = function WDatePicker(props) {
531
531
  var extraProps = _extends({}, props);
532
532
 
533
- return (
534
- /*#__PURE__*/
535
- // <ConfigProvider locale={zhCN}>
536
- React__default['default'].createElement(_DatePicker__default['default'], _objectSpread2({}, extraProps)) // </ConfigProvider>
537
-
538
- );
533
+ return /*#__PURE__*/React__default['default'].createElement(_DatePicker__default['default'], _objectSpread2({}, extraProps));
539
534
  };
540
535
 
541
536
  WDatePicker.defaultProps = {};
@@ -543,12 +538,7 @@ WDatePicker.defaultProps = {};
543
538
  var RangePicker = function RangePicker(props) {
544
539
  var extraProps = _extends({}, props);
545
540
 
546
- return (
547
- /*#__PURE__*/
548
- // <ConfigProvider locale={zhCN}>
549
- React__default['default'].createElement(_DatePicker__default['default'].RangePicker, _objectSpread2({}, extraProps)) // </ConfigProvider>
550
-
551
- );
541
+ return /*#__PURE__*/React__default['default'].createElement(_DatePicker__default['default'].RangePicker, _objectSpread2({}, extraProps));
552
542
  };
553
543
 
554
544
  RangePicker.defaultProps = {};
@@ -6451,12 +6441,14 @@ hooks.HTML5_FMT = {
6451
6441
  };
6452
6442
 
6453
6443
  var _excluded$3 = ["defaultValue", "format", "value", "onChange"],
6454
- _excluded2$1 = ["defaultValue", "value", "format", "onChange"];
6444
+ _excluded2$1 = ["defaultValue", "value", "format", "showTime", "onChange"];
6455
6445
 
6456
6446
  var momentValue = function momentValue(value) {
6457
6447
  if (value) {
6458
6448
  return hooks(value);
6459
6449
  }
6450
+
6451
+ return value;
6460
6452
  };
6461
6453
 
6462
6454
  var WDatePicker$1 = function WDatePicker(props) {
@@ -6466,20 +6458,15 @@ var WDatePicker$1 = function WDatePicker(props) {
6466
6458
  _onChange = props.onChange,
6467
6459
  extraProps = _objectWithoutProperties(props, _excluded$3);
6468
6460
 
6469
- return (
6470
- /*#__PURE__*/
6471
- // <ConfigProvider locale={zhCN}>
6472
- React__default['default'].createElement(_DatePicker__default['default'], _objectSpread2({
6473
- defaultValue: momentValue(defaultValue),
6474
- value: momentValue(value),
6475
- onChange: function onChange(v) {
6476
- var _momentValue;
6477
-
6478
- (_onChange === null || _onChange === void 0 ? void 0 : _onChange(v, (_momentValue = momentValue(v)) === null || _momentValue === void 0 ? void 0 : _momentValue.format(format || 'YYYY-MM-DD'))) || '';
6479
- }
6480
- }, extraProps)) // </ConfigProvider>
6461
+ return /*#__PURE__*/React__default['default'].createElement(_DatePicker__default['default'], _objectSpread2({
6462
+ defaultValue: momentValue(defaultValue),
6463
+ value: momentValue(value),
6464
+ onChange: function onChange(v) {
6465
+ var _momentValue2, _momentValue3;
6481
6466
 
6482
- );
6467
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange((_momentValue2 = momentValue(v)) === null || _momentValue2 === void 0 ? void 0 : _momentValue2.format(format || (extraProps.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD')), (_momentValue3 = momentValue(v)) === null || _momentValue3 === void 0 ? void 0 : _momentValue3.format(format || (extraProps.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD')));
6468
+ }
6469
+ }, extraProps));
6483
6470
  };
6484
6471
 
6485
6472
  WDatePicker$1.defaultProps = {};
@@ -6488,23 +6475,20 @@ var RangePicker$1 = function RangePicker(props) {
6488
6475
  var defaultValue = props.defaultValue,
6489
6476
  value = props.value,
6490
6477
  format = props.format,
6478
+ showTime = props.showTime,
6491
6479
  _onChange2 = props.onChange,
6492
6480
  extraProps = _objectWithoutProperties(props, _excluded2$1);
6493
6481
 
6494
- return (
6495
- /*#__PURE__*/
6496
- // <ConfigProvider locale={zhCN}>
6497
- React__default['default'].createElement(_DatePicker__default['default'].RangePicker, _objectSpread2({
6498
- defaultValue: momentValue(defaultValue),
6499
- value: momentValue(value),
6500
- onChange: function onChange(v) {
6501
- var _momentValue2;
6502
-
6503
- (_onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2(v, (_momentValue2 = momentValue(v)) === null || _momentValue2 === void 0 ? void 0 : _momentValue2.format(format || 'YYYY-MM-DD'))) || '';
6504
- }
6505
- }, extraProps)) // </ConfigProvider>
6482
+ return /*#__PURE__*/React__default['default'].createElement(_DatePicker__default['default'].RangePicker, _objectSpread2({
6483
+ showTime: showTime,
6484
+ defaultValue: defaultValue ? [momentValue(defaultValue[0]), momentValue(defaultValue[1])] : undefined,
6485
+ value: value ? [momentValue(value[0]), momentValue(value[1])] : undefined,
6486
+ onChange: function onChange(v) {
6487
+ var _momentValue4, _momentValue5, _momentValue6, _momentValue7;
6506
6488
 
6507
- );
6489
+ _onChange2 === null || _onChange2 === void 0 ? void 0 : _onChange2([((_momentValue4 = momentValue(v[0])) === null || _momentValue4 === void 0 ? void 0 : _momentValue4.format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))) || '', ((_momentValue5 = momentValue(v[1])) === null || _momentValue5 === void 0 ? void 0 : _momentValue5.format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))) || ''], [((_momentValue6 = momentValue(v[0])) === null || _momentValue6 === void 0 ? void 0 : _momentValue6.format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))) || '', ((_momentValue7 = momentValue(v[1])) === null || _momentValue7 === void 0 ? void 0 : _momentValue7.format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))) || '']);
6490
+ }
6491
+ }, extraProps));
6508
6492
  };
6509
6493
 
6510
6494
  RangePicker$1.defaultProps = {};
@@ -7791,30 +7775,42 @@ var WForm = function WForm(props, ref) {
7791
7775
 
7792
7776
  if (c.valueType && ['date', 'dateTime', 'dateMonth', 'dateYear', 'dateRange', 'dateTimeRange'].includes(c.valueType)) {
7793
7777
  if (c.valueType === 'date' && searchForm[c.dataIndex]) {
7794
- searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format('YYYY-MM-DD');
7778
+ var _c$fieldProps;
7779
+
7780
+ searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format((c === null || c === void 0 ? void 0 : (_c$fieldProps = c.fieldProps) === null || _c$fieldProps === void 0 ? void 0 : _c$fieldProps.format) || 'YYYY-MM-DD');
7795
7781
  }
7796
7782
 
7797
7783
  if (c.valueType === 'dateTime' && searchForm[c.dataIndex]) {
7798
- searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format('YYYY-MM-DD HH:mm:ss');
7784
+ var _c$fieldProps2;
7785
+
7786
+ searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format((c === null || c === void 0 ? void 0 : (_c$fieldProps2 = c.fieldProps) === null || _c$fieldProps2 === void 0 ? void 0 : _c$fieldProps2.format) || 'YYYY-MM-DD HH:mm:ss');
7799
7787
  }
7800
7788
 
7801
7789
  if (c.valueType === 'dateMonth' && searchForm[c.dataIndex]) {
7802
- searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format('YYYY-MM');
7790
+ var _c$fieldProps3;
7791
+
7792
+ searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format((c === null || c === void 0 ? void 0 : (_c$fieldProps3 = c.fieldProps) === null || _c$fieldProps3 === void 0 ? void 0 : _c$fieldProps3.format) || 'YYYY-MM');
7803
7793
  }
7804
7794
 
7805
7795
  if (c.valueType === 'dateYear' && searchForm[c.dataIndex]) {
7806
- searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format('YYYY');
7796
+ var _c$fieldProps4;
7797
+
7798
+ searchForm[c.dataIndex] = searchForm[c.dataIndex] && hooks(searchForm[c.dataIndex]).format((c === null || c === void 0 ? void 0 : (_c$fieldProps4 = c.fieldProps) === null || _c$fieldProps4 === void 0 ? void 0 : _c$fieldProps4.format) || 'YYYY');
7807
7799
  }
7808
7800
 
7809
7801
  if (c.valueType === 'dateRange' && searchForm[c.dataIndex]) {
7810
7802
  searchForm[c.dataIndex] = searchForm[c.dataIndex].map(function (item) {
7811
- return item && searchForm[c.dataIndex] && hooks(item).format('YYYY-MM-DD');
7803
+ var _c$fieldProps5;
7804
+
7805
+ return item && searchForm[c.dataIndex] && hooks(item).format((c === null || c === void 0 ? void 0 : (_c$fieldProps5 = c.fieldProps) === null || _c$fieldProps5 === void 0 ? void 0 : _c$fieldProps5.format) || 'YYYY-MM-DD');
7812
7806
  });
7813
7807
  }
7814
7808
 
7815
7809
  if (c.valueType === 'dateTimeRange' && searchForm[c.dataIndex]) {
7816
7810
  searchForm[c.dataIndex] = searchForm[c.dataIndex].map(function (item) {
7817
- return item && hooks(item).format('YYYY-MM-DD HH:mm:ss');
7811
+ var _c$fieldProps6;
7812
+
7813
+ return item && hooks(item).format((c === null || c === void 0 ? void 0 : (_c$fieldProps6 = c.fieldProps) === null || _c$fieldProps6 === void 0 ? void 0 : _c$fieldProps6.format) || 'YYYY-MM-DD HH:mm:ss');
7818
7814
  });
7819
7815
  }
7820
7816
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.3.11",
4
+ "version": "0.3.14",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",