wargerm 0.3.3 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css CHANGED
@@ -208,6 +208,7 @@
208
208
  display: flex;
209
209
  align-items: center;
210
210
  justify-content: center;
211
+ text-align: center;
211
212
  position: relative;
212
213
  z-index: 2;
213
214
  min-height: 32px;
@@ -259,6 +260,7 @@
259
260
  display: flex;
260
261
  align-items: center;
261
262
  justify-content: center;
263
+ text-align: center;
262
264
  position: relative;
263
265
  z-index: 2;
264
266
  }
@@ -208,6 +208,7 @@
208
208
  display: flex;
209
209
  align-items: center;
210
210
  justify-content: center;
211
+ text-align: center;
211
212
  position: relative;
212
213
  z-index: 2;
213
214
  min-height: 32px;
@@ -259,6 +260,7 @@
259
260
  display: flex;
260
261
  align-items: center;
261
262
  justify-content: center;
263
+ text-align: center;
262
264
  position: relative;
263
265
  z-index: 2;
264
266
  }
package/dist/index.esm.js CHANGED
@@ -737,7 +737,7 @@ var WSelect = function WSelect(props) {
737
737
 
738
738
  onLoad && onLoad(options);
739
739
  setValueEnumList(valueEnumNode);
740
- }, [JSON.stringify(resList)]);
740
+ }, [JSON.stringify(resList), request]);
741
741
  return /*#__PURE__*/React.createElement(_Select, _objectSpread2({}, extraProps), request ? childrenNode : valueEnum ? valueEnumList : children);
742
742
  };
743
743
 
@@ -7891,7 +7891,7 @@ var WForm$1 = /*#__PURE__*/React.forwardRef(WForm);
7891
7891
 
7892
7892
  var _excluded$7 = ["columns", "dataSource", "request", "onLoad", "params", "onSubmit", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination", "search", "frameBoxTable", "frameBoxDirection", "formRef", "none"];
7893
7893
  function Table(_ref) {
7894
- var _formSearchRef$curren3, _classnames2;
7894
+ var _formSearchRef$curren4, _classnames2;
7895
7895
 
7896
7896
  var columns = _ref.columns,
7897
7897
  tableList = _ref.dataSource,
@@ -7973,13 +7973,15 @@ function Table(_ref) {
7973
7973
  if (formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren = formSearchRef.current) === null || _formSearchRef$curren === void 0 ? void 0 : _formSearchRef$curren.columnsFields) {
7974
7974
  var _formSearchRef$curren2;
7975
7975
 
7976
- if (formRef === null || formRef === void 0 ? void 0 : formRef.current) {
7977
- formRef.current = formSearchRef === null || formSearchRef === void 0 ? void 0 : formSearchRef.current;
7978
- }
7979
-
7980
7976
  setColumnsFields(formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren2 = formSearchRef.current) === null || _formSearchRef$curren2 === void 0 ? void 0 : _formSearchRef$curren2.columnsFields);
7981
7977
  }
7982
- }, [JSON.stringify(formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren3 = formSearchRef.current) === null || _formSearchRef$curren3 === void 0 ? void 0 : _formSearchRef$curren3.columnsFields)]);
7978
+
7979
+ if ((formSearchRef === null || formSearchRef === void 0 ? void 0 : formSearchRef.current) && formRef) {
7980
+ var _formSearchRef$curren3;
7981
+
7982
+ formRef.current = formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren3 = formSearchRef.current) === null || _formSearchRef$curren3 === void 0 ? void 0 : _formSearchRef$curren3.form;
7983
+ }
7984
+ }, [JSON.stringify(formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren4 = formSearchRef.current) === null || _formSearchRef$curren4 === void 0 ? void 0 : _formSearchRef$curren4.columnsFields), formRef, formSearchRef]);
7983
7985
 
7984
7986
  var flattenColumns = function flattenColumns(columns) {
7985
7987
  var arr = columns.reduce(function (pre, cur) {
@@ -7992,12 +7994,16 @@ function Table(_ref) {
7992
7994
  return arr;
7993
7995
  };
7994
7996
 
7995
- var filterFormColumns = flattenColumns(columns).filter(function (c) {
7996
- return !c.hideInSearch;
7997
- });
7998
- var filterColumns = flattenColumns(columns).filter(function (c) {
7999
- return !c.hideInTable;
8000
- });
7997
+ var filterFormColumns = useMemo(function () {
7998
+ return flattenColumns(columns).filter(function (c) {
7999
+ return !c.hideInSearch;
8000
+ });
8001
+ }, [columns]);
8002
+ var filterColumns = useMemo(function () {
8003
+ return flattenColumns(columns).filter(function (c) {
8004
+ return !c.hideInTable;
8005
+ });
8006
+ }, [columns]);
8001
8007
  var renderTh = useMemo(function () {
8002
8008
  var renderThFc = function renderThFc(columns, parentHeight, isChild) {
8003
8009
  var showColumns = columns.filter(function (c) {
@@ -8204,18 +8210,23 @@ function Table(_ref) {
8204
8210
  dataSource = _useState10[0],
8205
8211
  setDataSource = _useState10[1];
8206
8212
 
8207
- var _useState11 = useState({}),
8213
+ var _useState11 = useState(0),
8208
8214
  _useState12 = _slicedToArray(_useState11, 2),
8209
- pageParams = _useState12[0],
8210
- setPageParams = _useState12[1];
8215
+ total = _useState12[0],
8216
+ setTotal = _useState12[1];
8211
8217
 
8212
- var _useState13 = useState(false),
8218
+ var _useState13 = useState({}),
8213
8219
  _useState14 = _slicedToArray(_useState13, 2),
8214
- loading = _useState14[0],
8215
- setLoading = _useState14[1];
8220
+ pageParams = _useState14[0],
8221
+ setPageParams = _useState14[1];
8222
+
8223
+ var _useState15 = useState(false),
8224
+ _useState16 = _slicedToArray(_useState15, 2),
8225
+ loading = _useState16[0],
8226
+ setLoading = _useState16[1];
8216
8227
 
8217
- var _useState15 = useState({
8218
- total: dataSource.length,
8228
+ var _useState17 = useState({
8229
+ total: total,
8219
8230
  pageSize: 20,
8220
8231
  size: 'small',
8221
8232
  current: 1,
@@ -8230,9 +8241,9 @@ function Table(_ref) {
8230
8241
  });
8231
8242
  }
8232
8243
  }),
8233
- _useState16 = _slicedToArray(_useState15, 2),
8234
- paginationParams = _useState16[0],
8235
- setpaginationParams = _useState16[1];
8244
+ _useState18 = _slicedToArray(_useState17, 2),
8245
+ paginationParams = _useState18[0],
8246
+ setpaginationParams = _useState18[1];
8236
8247
 
8237
8248
  useEffect(function () {
8238
8249
  _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
@@ -8242,7 +8253,7 @@ function Table(_ref) {
8242
8253
  switch (_context.prev = _context.next) {
8243
8254
  case 0:
8244
8255
  if (!request) {
8245
- _context.next = 14;
8256
+ _context.next = 15;
8246
8257
  break;
8247
8258
  }
8248
8259
 
@@ -8263,15 +8274,16 @@ function Table(_ref) {
8263
8274
  setLoading(false);
8264
8275
  onLoad && onLoad(res.data);
8265
8276
  setDataSource(res.data);
8277
+ setTotal(res.total || 0);
8266
8278
  setpaginationParams(function (c) {
8267
8279
  return _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
8268
8280
  total: res.total || res.data.length
8269
8281
  }, pagination), requestParams);
8270
8282
  });
8271
- _context.next = 15;
8283
+ _context.next = 16;
8272
8284
  break;
8273
8285
 
8274
- case 14:
8286
+ case 15:
8275
8287
  setpaginationParams(function (c) {
8276
8288
  var obj = _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
8277
8289
  total: tableList && tableList.length || 0
@@ -8283,7 +8295,7 @@ function Table(_ref) {
8283
8295
  return obj;
8284
8296
  });
8285
8297
 
8286
- case 15:
8298
+ case 16:
8287
8299
  case "end":
8288
8300
  return _context.stop();
8289
8301
  }
@@ -9836,19 +9848,19 @@ var Modal$1 = /*#__PURE__*/function (_React$PureComponent) {
9836
9848
  display: 'flex'
9837
9849
  }
9838
9850
  }, /*#__PURE__*/React.createElement(WButton, {
9839
- className: "okbtn",
9851
+ className: "concellbtn",
9840
9852
  onClick: function onClick(e) {
9841
- onOk && onOk(e);
9853
+ onCancel && onCancel(e);
9842
9854
  }
9843
- }, okText || '确定'), /*#__PURE__*/React.createElement(WButton, {
9844
- className: "concellbtn",
9855
+ }, cancelText || '取消'), /*#__PURE__*/React.createElement(WButton, {
9856
+ className: "okbtn",
9845
9857
  style: {
9846
9858
  marginLeft: '10px'
9847
9859
  },
9848
9860
  onClick: function onClick(e) {
9849
- onCancel && onCancel(e);
9861
+ onOk && onOk(e);
9850
9862
  }
9851
- }, cancelText || '取消')));
9863
+ }, okText || '确定')));
9852
9864
  };
9853
9865
 
9854
9866
  _this.renderTop = function () {
package/dist/index.js CHANGED
@@ -771,7 +771,7 @@ var WSelect = function WSelect(props) {
771
771
 
772
772
  onLoad && onLoad(options);
773
773
  setValueEnumList(valueEnumNode);
774
- }, [JSON.stringify(resList)]);
774
+ }, [JSON.stringify(resList), request]);
775
775
  return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'], _objectSpread2({}, extraProps), request ? childrenNode : valueEnum ? valueEnumList : children);
776
776
  };
777
777
 
@@ -7925,7 +7925,7 @@ var WForm$1 = /*#__PURE__*/React__default['default'].forwardRef(WForm);
7925
7925
 
7926
7926
  var _excluded$7 = ["columns", "dataSource", "request", "onLoad", "params", "onSubmit", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination", "search", "frameBoxTable", "frameBoxDirection", "formRef", "none"];
7927
7927
  function Table(_ref) {
7928
- var _formSearchRef$curren3, _classnames2;
7928
+ var _formSearchRef$curren4, _classnames2;
7929
7929
 
7930
7930
  var columns = _ref.columns,
7931
7931
  tableList = _ref.dataSource,
@@ -8007,13 +8007,15 @@ function Table(_ref) {
8007
8007
  if (formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren = formSearchRef.current) === null || _formSearchRef$curren === void 0 ? void 0 : _formSearchRef$curren.columnsFields) {
8008
8008
  var _formSearchRef$curren2;
8009
8009
 
8010
- if (formRef === null || formRef === void 0 ? void 0 : formRef.current) {
8011
- formRef.current = formSearchRef === null || formSearchRef === void 0 ? void 0 : formSearchRef.current;
8012
- }
8013
-
8014
8010
  setColumnsFields(formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren2 = formSearchRef.current) === null || _formSearchRef$curren2 === void 0 ? void 0 : _formSearchRef$curren2.columnsFields);
8015
8011
  }
8016
- }, [JSON.stringify(formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren3 = formSearchRef.current) === null || _formSearchRef$curren3 === void 0 ? void 0 : _formSearchRef$curren3.columnsFields)]);
8012
+
8013
+ if ((formSearchRef === null || formSearchRef === void 0 ? void 0 : formSearchRef.current) && formRef) {
8014
+ var _formSearchRef$curren3;
8015
+
8016
+ formRef.current = formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren3 = formSearchRef.current) === null || _formSearchRef$curren3 === void 0 ? void 0 : _formSearchRef$curren3.form;
8017
+ }
8018
+ }, [JSON.stringify(formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren4 = formSearchRef.current) === null || _formSearchRef$curren4 === void 0 ? void 0 : _formSearchRef$curren4.columnsFields), formRef, formSearchRef]);
8017
8019
 
8018
8020
  var flattenColumns = function flattenColumns(columns) {
8019
8021
  var arr = columns.reduce(function (pre, cur) {
@@ -8026,12 +8028,16 @@ function Table(_ref) {
8026
8028
  return arr;
8027
8029
  };
8028
8030
 
8029
- var filterFormColumns = flattenColumns(columns).filter(function (c) {
8030
- return !c.hideInSearch;
8031
- });
8032
- var filterColumns = flattenColumns(columns).filter(function (c) {
8033
- return !c.hideInTable;
8034
- });
8031
+ var filterFormColumns = React.useMemo(function () {
8032
+ return flattenColumns(columns).filter(function (c) {
8033
+ return !c.hideInSearch;
8034
+ });
8035
+ }, [columns]);
8036
+ var filterColumns = React.useMemo(function () {
8037
+ return flattenColumns(columns).filter(function (c) {
8038
+ return !c.hideInTable;
8039
+ });
8040
+ }, [columns]);
8035
8041
  var renderTh = React.useMemo(function () {
8036
8042
  var renderThFc = function renderThFc(columns, parentHeight, isChild) {
8037
8043
  var showColumns = columns.filter(function (c) {
@@ -8238,18 +8244,23 @@ function Table(_ref) {
8238
8244
  dataSource = _useState10[0],
8239
8245
  setDataSource = _useState10[1];
8240
8246
 
8241
- var _useState11 = React.useState({}),
8247
+ var _useState11 = React.useState(0),
8242
8248
  _useState12 = _slicedToArray(_useState11, 2),
8243
- pageParams = _useState12[0],
8244
- setPageParams = _useState12[1];
8249
+ total = _useState12[0],
8250
+ setTotal = _useState12[1];
8245
8251
 
8246
- var _useState13 = React.useState(false),
8252
+ var _useState13 = React.useState({}),
8247
8253
  _useState14 = _slicedToArray(_useState13, 2),
8248
- loading = _useState14[0],
8249
- setLoading = _useState14[1];
8254
+ pageParams = _useState14[0],
8255
+ setPageParams = _useState14[1];
8256
+
8257
+ var _useState15 = React.useState(false),
8258
+ _useState16 = _slicedToArray(_useState15, 2),
8259
+ loading = _useState16[0],
8260
+ setLoading = _useState16[1];
8250
8261
 
8251
- var _useState15 = React.useState({
8252
- total: dataSource.length,
8262
+ var _useState17 = React.useState({
8263
+ total: total,
8253
8264
  pageSize: 20,
8254
8265
  size: 'small',
8255
8266
  current: 1,
@@ -8264,9 +8275,9 @@ function Table(_ref) {
8264
8275
  });
8265
8276
  }
8266
8277
  }),
8267
- _useState16 = _slicedToArray(_useState15, 2),
8268
- paginationParams = _useState16[0],
8269
- setpaginationParams = _useState16[1];
8278
+ _useState18 = _slicedToArray(_useState17, 2),
8279
+ paginationParams = _useState18[0],
8280
+ setpaginationParams = _useState18[1];
8270
8281
 
8271
8282
  React.useEffect(function () {
8272
8283
  _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
@@ -8276,7 +8287,7 @@ function Table(_ref) {
8276
8287
  switch (_context.prev = _context.next) {
8277
8288
  case 0:
8278
8289
  if (!request) {
8279
- _context.next = 14;
8290
+ _context.next = 15;
8280
8291
  break;
8281
8292
  }
8282
8293
 
@@ -8297,15 +8308,16 @@ function Table(_ref) {
8297
8308
  setLoading(false);
8298
8309
  onLoad && onLoad(res.data);
8299
8310
  setDataSource(res.data);
8311
+ setTotal(res.total || 0);
8300
8312
  setpaginationParams(function (c) {
8301
8313
  return _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
8302
8314
  total: res.total || res.data.length
8303
8315
  }, pagination), requestParams);
8304
8316
  });
8305
- _context.next = 15;
8317
+ _context.next = 16;
8306
8318
  break;
8307
8319
 
8308
- case 14:
8320
+ case 15:
8309
8321
  setpaginationParams(function (c) {
8310
8322
  var obj = _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
8311
8323
  total: tableList && tableList.length || 0
@@ -8317,7 +8329,7 @@ function Table(_ref) {
8317
8329
  return obj;
8318
8330
  });
8319
8331
 
8320
- case 15:
8332
+ case 16:
8321
8333
  case "end":
8322
8334
  return _context.stop();
8323
8335
  }
@@ -9870,19 +9882,19 @@ var Modal$1 = /*#__PURE__*/function (_React$PureComponent) {
9870
9882
  display: 'flex'
9871
9883
  }
9872
9884
  }, /*#__PURE__*/React__default['default'].createElement(WButton, {
9873
- className: "okbtn",
9885
+ className: "concellbtn",
9874
9886
  onClick: function onClick(e) {
9875
- onOk && onOk(e);
9887
+ onCancel && onCancel(e);
9876
9888
  }
9877
- }, okText || '确定'), /*#__PURE__*/React__default['default'].createElement(WButton, {
9878
- className: "concellbtn",
9889
+ }, cancelText || '取消'), /*#__PURE__*/React__default['default'].createElement(WButton, {
9890
+ className: "okbtn",
9879
9891
  style: {
9880
9892
  marginLeft: '10px'
9881
9893
  },
9882
9894
  onClick: function onClick(e) {
9883
- onCancel && onCancel(e);
9895
+ onOk && onOk(e);
9884
9896
  }
9885
- }, cancelText || '取消')));
9897
+ }, okText || '确定')));
9886
9898
  };
9887
9899
 
9888
9900
  _this.renderTop = function () {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.3.3",
4
+ "version": "0.3.7",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",