wargerm 0.2.25 → 0.2.29

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.
@@ -11,8 +11,9 @@ export interface ColumnProps {
11
11
  hideInSearch?: boolean;
12
12
  search?: {
13
13
  transform?: (value: any) => Record<string, any>;
14
+ transformSetForm?: (value: any) => Record<string, any>;
14
15
  };
15
- valueType?: 'text' | 'textarea' | 'inputNumber' | 'select' | 'treeSelect' | 'date' | 'dateTime' | 'dateMonth' | 'dateYear' | 'dateRange' | 'dateTimeRange' | 'checkbox' | 'radio' | 'radioButton' | 'switch' | 'digit' | 'cascader' | 'image';
16
+ valueType?: 'text' | 'textarea' | 'inputNumber' | 'select' | 'treeSelect' | 'date' | 'dateTime' | 'dateMonth' | 'dateYear' | 'dateRange' | 'dateTimeRange' | 'checkbox' | 'radio' | 'radioButton' | 'switch' | 'digit' | 'cascader';
16
17
  valueEnum?: Record<string, any>;
17
18
  options?: Record<string, any>[];
18
19
  fieldProps?: Record<string, any>;
@@ -38,6 +39,7 @@ export interface Isearch {
38
39
  filterType?: 'query' | 'light';
39
40
  searchText?: string;
40
41
  resetText?: string;
42
+ hideResetBtn?: boolean;
41
43
  submitText?: string;
42
44
  hideSubmit?: boolean;
43
45
  transform?: (value: any) => any;
package/dist/index.css CHANGED
@@ -210,7 +210,7 @@
210
210
  justify-content: center;
211
211
  position: relative;
212
212
  z-index: 2;
213
- height: 32px;
213
+ min-height: 32px;
214
214
  }
215
215
  .container .tbody {
216
216
  overflow: auto;
@@ -220,7 +220,7 @@
220
220
  .container .tbody .tr {
221
221
  padding-left: 6px;
222
222
  width: 100%;
223
- height: 32px;
223
+ min-height: 32px;
224
224
  display: flex;
225
225
  margin-bottom: 17px;
226
226
  position: relative;
@@ -426,7 +426,7 @@
426
426
  justify-content: center;
427
427
  position: relative;
428
428
  z-index: 2;
429
- height: 32px;
429
+ min-height: 32px;
430
430
  }
431
431
  [data-prefers-color='light'] .container .tbody {
432
432
  overflow: auto;
@@ -436,7 +436,7 @@
436
436
  [data-prefers-color='light'] .container .tbody .tr {
437
437
  padding-left: 6px;
438
438
  width: 100%;
439
- height: 32px;
439
+ min-height: 32px;
440
440
  display: flex;
441
441
  margin-bottom: 17px;
442
442
  position: relative;
@@ -515,12 +515,12 @@
515
515
  margin-top: 8px;
516
516
  }
517
517
  .w-frame-box-table.container .tbody .frame {
518
- height: 28px;
518
+ min-height: 28px;
519
519
  margin-bottom: 8px;
520
520
  border: none;
521
521
  }
522
522
  .w-frame-box-table.container .tbody .frame .tr {
523
- height: 28px;
523
+ min-height: 28px;
524
524
  margin-bottom: 0;
525
525
  background: rgba(16, 97, 139, 0.1);
526
526
  }
@@ -1780,7 +1780,6 @@ button.swiper-pagination-bullet {
1780
1780
 
1781
1781
  .frame {
1782
1782
  width: 40px;
1783
- height: 40px;
1784
1783
  background: rgba(15, 72, 114, 0.1);
1785
1784
  border: 1px solid rgba(156, 208, 239, 0.4);
1786
1785
  position: relative;
@@ -210,7 +210,7 @@
210
210
  justify-content: center;
211
211
  position: relative;
212
212
  z-index: 2;
213
- height: 32px;
213
+ min-height: 32px;
214
214
  }
215
215
  .container .tbody {
216
216
  overflow: auto;
@@ -220,7 +220,7 @@
220
220
  .container .tbody .tr {
221
221
  padding-left: 6px;
222
222
  width: 100%;
223
- height: 32px;
223
+ min-height: 32px;
224
224
  display: flex;
225
225
  margin-bottom: 17px;
226
226
  position: relative;
@@ -426,7 +426,7 @@
426
426
  justify-content: center;
427
427
  position: relative;
428
428
  z-index: 2;
429
- height: 32px;
429
+ min-height: 32px;
430
430
  }
431
431
  [data-prefers-color='light'] .container .tbody {
432
432
  overflow: auto;
@@ -436,7 +436,7 @@
436
436
  [data-prefers-color='light'] .container .tbody .tr {
437
437
  padding-left: 6px;
438
438
  width: 100%;
439
- height: 32px;
439
+ min-height: 32px;
440
440
  display: flex;
441
441
  margin-bottom: 17px;
442
442
  position: relative;
@@ -515,12 +515,12 @@
515
515
  margin-top: 8px;
516
516
  }
517
517
  .w-frame-box-table.container .tbody .frame {
518
- height: 28px;
518
+ min-height: 28px;
519
519
  margin-bottom: 8px;
520
520
  border: none;
521
521
  }
522
522
  .w-frame-box-table.container .tbody .frame .tr {
523
- height: 28px;
523
+ min-height: 28px;
524
524
  margin-bottom: 0;
525
525
  background: rgba(16, 97, 139, 0.1);
526
526
  }
@@ -1780,7 +1780,6 @@ button.swiper-pagination-bullet {
1780
1780
 
1781
1781
  .frame {
1782
1782
  width: 40px;
1783
- height: 40px;
1784
1783
  background: rgba(15, 72, 114, 0.1);
1785
1784
  border: 1px solid rgba(156, 208, 239, 0.4);
1786
1785
  position: relative;
package/dist/index.esm.js CHANGED
@@ -8767,7 +8767,21 @@ var WForm = function WForm(props, ref) {
8767
8767
  };
8768
8768
 
8769
8769
  var setFieldsValue = function setFieldsValue(record) {
8770
- form.setFieldsValue(record);
8770
+ var setFieldsValues = _objectSpread2({}, record);
8771
+
8772
+ filterFormColumns.forEach(function (c) {
8773
+ if (c.search && c.search.transformSetForm) {
8774
+ var transformObj = c.search.transformSetForm(setFieldsValues[c.dataIndex]);
8775
+ setFieldsValues = _objectSpread2(_objectSpread2({}, setFieldsValues), transformObj);
8776
+
8777
+ if (!transformObj[c.dataIndex]) {
8778
+ delete setFieldsValues[c.dataIndex];
8779
+ }
8780
+
8781
+ return false;
8782
+ }
8783
+ });
8784
+ form.setFieldsValue(setFieldsValues);
8771
8785
  };
8772
8786
 
8773
8787
  useImperativeHandle(ref, function () {
@@ -8781,7 +8795,8 @@ var WForm = function WForm(props, ref) {
8781
8795
  });
8782
8796
  return /*#__PURE__*/React.createElement(_Form, _objectSpread2({
8783
8797
  style: {
8784
- marginBottom: '20px'
8798
+ marginBottom: '20px',
8799
+ width: '100%'
8785
8800
  },
8786
8801
  onFinish: handleSearch,
8787
8802
  onValuesChange: function onValuesChange(changedValues, allValues) {
@@ -8789,9 +8804,7 @@ var WForm = function WForm(props, ref) {
8789
8804
  setchangedValues(changedValues);
8790
8805
  },
8791
8806
  form: form
8792
- }, extraProps), /*#__PURE__*/React.createElement(_Row, null, filterForm), /*#__PURE__*/React.createElement(_Row, null, filterExtraColumnsForm), search && search.hideSubmit ? null : /*#__PURE__*/React.createElement(_Row, {
8793
- justify: "end"
8794
- }, /*#__PURE__*/React.createElement(_Col, {
8807
+ }, extraProps), /*#__PURE__*/React.createElement(_Row, null, filterForm, filterExtraColumnsForm, search && search.hideSubmit ? null : /*#__PURE__*/React.createElement(_Col, {
8795
8808
  style: {
8796
8809
  paddingLeft: '12px',
8797
8810
  paddingRight: '12px'
@@ -8807,14 +8820,14 @@ var WForm = function WForm(props, ref) {
8807
8820
  },
8808
8821
  htmlType: "submit",
8809
8822
  icon: /*#__PURE__*/React.createElement(SearchOutlined, null)
8810
- }, search && search.searchText ? search.searchText : '提交'), /*#__PURE__*/React.createElement(WButton, {
8823
+ }, search && search.searchText ? search.searchText : '提交')].concat(_toConsumableArray(search.hideResetBtn ? [] : [/*#__PURE__*/React.createElement(WButton, {
8811
8824
  type: "primary",
8812
8825
  style: {
8813
8826
  marginRight: '20px'
8814
8827
  },
8815
8828
  onClick: handleRest,
8816
8829
  icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
8817
- }, search && search.resetText ? search.resetText : '重置')]), !search ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WButton, {
8830
+ }, search && search.resetText ? search.resetText : '重置')]))), !search ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WButton, {
8818
8831
  type: "primary",
8819
8832
  style: {
8820
8833
  marginRight: '20px'
@@ -8835,14 +8848,14 @@ var WForm = function WForm(props, ref) {
8835
8848
  },
8836
8849
  htmlType: "submit",
8837
8850
  icon: /*#__PURE__*/React.createElement(SearchOutlined, null)
8838
- }, "\u63D0\u4EA4"), /*#__PURE__*/React.createElement(WButton, {
8851
+ }, search && search.searchText ? search.searchText : '提交'), search.hideResetBtn ? null : /*#__PURE__*/React.createElement(WButton, {
8839
8852
  type: "primary",
8840
8853
  style: {
8841
8854
  marginRight: '20px'
8842
8855
  },
8843
8856
  icon: /*#__PURE__*/React.createElement(ReloadOutlined, null),
8844
8857
  onClick: handleRest
8845
- }, "\u91CD\u7F6E")) : null)))));
8858
+ }, search && search.resetText ? search.resetText : '重置')) : null)))));
8846
8859
  };
8847
8860
 
8848
8861
  var WForm$1 = /*#__PURE__*/React.forwardRef(WForm);
package/dist/index.js CHANGED
@@ -8801,7 +8801,21 @@ var WForm = function WForm(props, ref) {
8801
8801
  };
8802
8802
 
8803
8803
  var setFieldsValue = function setFieldsValue(record) {
8804
- form.setFieldsValue(record);
8804
+ var setFieldsValues = _objectSpread2({}, record);
8805
+
8806
+ filterFormColumns.forEach(function (c) {
8807
+ if (c.search && c.search.transformSetForm) {
8808
+ var transformObj = c.search.transformSetForm(setFieldsValues[c.dataIndex]);
8809
+ setFieldsValues = _objectSpread2(_objectSpread2({}, setFieldsValues), transformObj);
8810
+
8811
+ if (!transformObj[c.dataIndex]) {
8812
+ delete setFieldsValues[c.dataIndex];
8813
+ }
8814
+
8815
+ return false;
8816
+ }
8817
+ });
8818
+ form.setFieldsValue(setFieldsValues);
8805
8819
  };
8806
8820
 
8807
8821
  React.useImperativeHandle(ref, function () {
@@ -8815,7 +8829,8 @@ var WForm = function WForm(props, ref) {
8815
8829
  });
8816
8830
  return /*#__PURE__*/React__default['default'].createElement(_Form__default['default'], _objectSpread2({
8817
8831
  style: {
8818
- marginBottom: '20px'
8832
+ marginBottom: '20px',
8833
+ width: '100%'
8819
8834
  },
8820
8835
  onFinish: handleSearch,
8821
8836
  onValuesChange: function onValuesChange(changedValues, allValues) {
@@ -8823,9 +8838,7 @@ var WForm = function WForm(props, ref) {
8823
8838
  setchangedValues(changedValues);
8824
8839
  },
8825
8840
  form: form
8826
- }, extraProps), /*#__PURE__*/React__default['default'].createElement(_Row__default['default'], null, filterForm), /*#__PURE__*/React__default['default'].createElement(_Row__default['default'], null, filterExtraColumnsForm), search && search.hideSubmit ? null : /*#__PURE__*/React__default['default'].createElement(_Row__default['default'], {
8827
- justify: "end"
8828
- }, /*#__PURE__*/React__default['default'].createElement(_Col__default['default'], {
8841
+ }, extraProps), /*#__PURE__*/React__default['default'].createElement(_Row__default['default'], null, filterForm, filterExtraColumnsForm, search && search.hideSubmit ? null : /*#__PURE__*/React__default['default'].createElement(_Col__default['default'], {
8829
8842
  style: {
8830
8843
  paddingLeft: '12px',
8831
8844
  paddingRight: '12px'
@@ -8841,14 +8854,14 @@ var WForm = function WForm(props, ref) {
8841
8854
  },
8842
8855
  htmlType: "submit",
8843
8856
  icon: /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null)
8844
- }, search && search.searchText ? search.searchText : '提交'), /*#__PURE__*/React__default['default'].createElement(WButton, {
8857
+ }, search && search.searchText ? search.searchText : '提交')].concat(_toConsumableArray(search.hideResetBtn ? [] : [/*#__PURE__*/React__default['default'].createElement(WButton, {
8845
8858
  type: "primary",
8846
8859
  style: {
8847
8860
  marginRight: '20px'
8848
8861
  },
8849
8862
  onClick: handleRest,
8850
8863
  icon: /*#__PURE__*/React__default['default'].createElement(icons.ReloadOutlined, null)
8851
- }, search && search.resetText ? search.resetText : '重置')]), !search ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(WButton, {
8864
+ }, search && search.resetText ? search.resetText : '重置')]))), !search ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(WButton, {
8852
8865
  type: "primary",
8853
8866
  style: {
8854
8867
  marginRight: '20px'
@@ -8869,14 +8882,14 @@ var WForm = function WForm(props, ref) {
8869
8882
  },
8870
8883
  htmlType: "submit",
8871
8884
  icon: /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null)
8872
- }, "\u63D0\u4EA4"), /*#__PURE__*/React__default['default'].createElement(WButton, {
8885
+ }, search && search.searchText ? search.searchText : '提交'), search.hideResetBtn ? null : /*#__PURE__*/React__default['default'].createElement(WButton, {
8873
8886
  type: "primary",
8874
8887
  style: {
8875
8888
  marginRight: '20px'
8876
8889
  },
8877
8890
  icon: /*#__PURE__*/React__default['default'].createElement(icons.ReloadOutlined, null),
8878
8891
  onClick: handleRest
8879
- }, "\u91CD\u7F6E")) : null)))));
8892
+ }, search && search.resetText ? search.resetText : '重置')) : null)))));
8880
8893
  };
8881
8894
 
8882
8895
  var WForm$1 = /*#__PURE__*/React__default['default'].forwardRef(WForm);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.2.25",
4
+ "version": "0.2.29",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",