ls-pro-common 1.0.57 → 1.0.60

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.
@@ -46,7 +46,13 @@ var _excluded = ["current", "pageSize"];
46
46
  function useSingle(inParam) {
47
47
  var _usePermission = (0, _usePermission2.default)(),
48
48
  resourceId = _usePermission.resourceId,
49
- checkRight = _usePermission.checkRight;
49
+ checkRight = _usePermission.checkRight,
50
+ canAdd = _usePermission.canAdd,
51
+ canEdit = _usePermission.canEdit,
52
+ canDelete = _usePermission.canDelete,
53
+ canAudit = _usePermission.canAudit,
54
+ canImport = _usePermission.canImport,
55
+ canExport = _usePermission.canExport;
50
56
 
51
57
  var service = inParam.service,
52
58
  toolConfig = inParam.toolConfig,
@@ -603,7 +609,7 @@ function useSingle(inParam) {
603
609
 
604
610
  case 19:
605
611
  result = _context6.sent;
606
- result.data = result.rows;
612
+ result.data = result.rows || [];
607
613
  result.success = true;
608
614
  return _context6.abrupt("return", result);
609
615
 
@@ -650,7 +656,7 @@ function useSingle(inParam) {
650
656
  case 6:
651
657
  _context7.prev = 6;
652
658
  _context7.next = 9;
653
- return (0, _http.httpPost)(url, param);
659
+ return (0, _http.httpPost)(url, param, true, false);
654
660
 
655
661
  case 9:
656
662
  result = _context7.sent;
@@ -733,21 +739,21 @@ function useSingle(inParam) {
733
739
  }, [auditStatus, statusField, selectedRows]); // 处理内置 table 按钮,新增,编辑,删除,审核,导入,导出
734
740
 
735
741
  var tableTools = (0, _react.useMemo)(function () {
736
- return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && checkRight(2) ? /*#__PURE__*/_react.default.createElement(_button.default, {
742
+ return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && canAdd ? /*#__PURE__*/_react.default.createElement(_button.default, {
737
743
  key: "add",
738
744
  onClick: function onClick() {
739
745
  return onAdd(null);
740
746
  },
741
747
  disabled: btnDisabled('add'),
742
748
  icon: /*#__PURE__*/_react.default.createElement(_icons.PlusCircleOutlined, null)
743
- }, "\u65B0\u589E") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.edit) && checkRight(4) ? /*#__PURE__*/_react.default.createElement(_button.default, {
749
+ }, "\u65B0\u589E") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.edit) && canEdit ? /*#__PURE__*/_react.default.createElement(_button.default, {
744
750
  key: "edit",
745
751
  disabled: btnDisabled('edit'),
746
752
  onClick: function onClick() {
747
753
  return onEdit(null);
748
754
  },
749
755
  icon: /*#__PURE__*/_react.default.createElement(_icons.EditOutlined, null)
750
- }, "\u7F16\u8F91") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.remove) && (checkRight(8) || checkRight(32)) ? /*#__PURE__*/_react.default.createElement(_button.default, {
756
+ }, "\u7F16\u8F91") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.remove) && canDelete ? /*#__PURE__*/_react.default.createElement(_button.default, {
751
757
  key: "remove",
752
758
  onClick: function onClick() {
753
759
  return onRemove(null);
@@ -755,14 +761,14 @@ function useSingle(inParam) {
755
761
  danger: true,
756
762
  disabled: btnDisabled('remove'),
757
763
  icon: /*#__PURE__*/_react.default.createElement(_icons.DeleteOutlined, null)
758
- }, "\u5220\u9664") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.audit) && checkRight(64) ? /*#__PURE__*/_react.default.createElement(_button.default, {
764
+ }, "\u5220\u9664") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.audit) && canAudit ? /*#__PURE__*/_react.default.createElement(_button.default, {
759
765
  key: "audit",
760
766
  onClick: function onClick() {
761
767
  return onAudit(null);
762
768
  },
763
769
  disabled: btnDisabled('audit'),
764
- icon: /*#__PURE__*/_react.default.createElement(_icons.CheckOutlined, null)
765
- }, "\u5BA1\u6838") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) && checkRight(128) ? /*#__PURE__*/_react.default.createElement(_button.default, {
770
+ icon: /*#__PURE__*/_react.default.createElement(_icons.AuditOutlined, null)
771
+ }, "\u5BA1\u6838") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) && canImport ? /*#__PURE__*/_react.default.createElement(_button.default, {
766
772
  key: "import",
767
773
  onClick: function onClick() {
768
774
  var _tableRef$current2, _tableRef$current2$sh;
@@ -771,7 +777,7 @@ function useSingle(inParam) {
771
777
  },
772
778
  disabled: btnDisabled('import'),
773
779
  icon: /*#__PURE__*/_react.default.createElement(_icons.ImportOutlined, null)
774
- }, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) && checkRight(256) ? /*#__PURE__*/_react.default.createElement(_button.default, {
780
+ }, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) && canExport ? /*#__PURE__*/_react.default.createElement(_button.default, {
775
781
  key: "export",
776
782
  onClick: function onClick() {
777
783
  var _tableRef$current3, _tableRef$current3$sh;
@@ -781,7 +787,7 @@ function useSingle(inParam) {
781
787
  disabled: btnDisabled('export'),
782
788
  icon: /*#__PURE__*/_react.default.createElement(_icons.ExportOutlined, null)
783
789
  }, "\u5BFC\u51FA") : false].filter(function (o) {
784
- return o !== false;
790
+ return Boolean;
785
791
  });
786
792
  }, [selectedRows]);
787
793
  return {
@@ -107,7 +107,7 @@ export declare const reLogin: () => void;
107
107
  * @param endSuffix
108
108
  * @returns
109
109
  */
110
- export declare const rangeToSearch: (values: any, startField: string, endField: string, endSuffix?: string) => any;
110
+ export declare const rangeToSearch: (values: any, startField: string, endField: string, endSuffix?: string, startSuffex?: string) => any;
111
111
  /** @name 状态列表 */
112
112
  export declare const statusList: {
113
113
  value: number;
@@ -174,3 +174,9 @@ export declare const getLoginName: () => string | undefined;
174
174
  export declare const getCompanyId: () => string | undefined;
175
175
  /** @name 微前端原生路径 */
176
176
  export declare const appPath: (path?: string) => any;
177
+ /**
178
+ * 深度复制对象
179
+ * @param obj
180
+ * @returns
181
+ */
182
+ export declare const deepClone: (obj: any) => any;
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "dateFormat", {
12
12
  return _lsProTable.dateFormat;
13
13
  }
14
14
  });
15
- exports.getLoginName = exports.getCookie = exports.getCompanyId = exports.getCache = exports.formatMoney = exports.formatDate = void 0;
15
+ exports.getLoginName = exports.getCookie = exports.getCompanyId = exports.getCache = exports.formatMoney = exports.formatDate = exports.deepClone = void 0;
16
16
  Object.defineProperty(exports, "getResourceProps", {
17
17
  enumerable: true,
18
18
  get: function get() {
@@ -361,8 +361,9 @@ exports.reLogin = reLogin;
361
361
 
362
362
  var rangeToSearch = function rangeToSearch(values, startField, endField) {
363
363
  var endSuffix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
364
+ var startSuffex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
364
365
  var data = {};
365
- Array.isArray(values) && values[0] && (data[startField] = values[0]);
366
+ Array.isArray(values) && values[0] && (data[startField] = values[0] + startSuffex);
366
367
  Array.isArray(values) && values[1] && (data[endField] = values[1] + endSuffix);
367
368
  return data;
368
369
  };
@@ -605,5 +606,34 @@ var appPath = function appPath() {
605
606
 
606
607
  return path ? path : './';
607
608
  };
609
+ /**
610
+ * 深度复制对象
611
+ * @param obj
612
+ * @returns
613
+ */
614
+
615
+
616
+ exports.appPath = appPath;
617
+
618
+ var deepClone = function deepClone(obj) {
619
+ var otype = Object.prototype.toString.call(obj);
620
+ var target = obj;
621
+
622
+ if (otype === '[object Array]') {
623
+ target = [];
624
+
625
+ for (var i = 0; i < obj.length; i++) {
626
+ target.push(deepClone(obj[i]));
627
+ }
628
+ } else if (otype === '[object Object]') {
629
+ target = {};
630
+
631
+ for (var key in obj) {
632
+ target[key] = deepClone(obj[key]);
633
+ }
634
+ }
635
+
636
+ return target;
637
+ };
608
638
 
609
- exports.appPath = appPath;
639
+ exports.deepClone = deepClone;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "1.0.57",
3
+ "version": "1.0.60",
4
4
  "description": "ls-pro-common",
5
5
  "keywords": [
6
6
  "antd",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@ant-design/icons": "^4.3.0",
31
- "ls-pro-table": "2.62.42",
31
+ "ls-pro-table": "2.62.44",
32
32
  "ls-pro-form": "1.52.29",
33
33
  "@babel/runtime": "^7.16.3",
34
34
  "classnames": "^2.2.6",