@pisell/materials 1.0.321 → 1.0.322

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.
@@ -24,6 +24,7 @@ import { batchExport } from "./components/ExportTable/function";
24
24
  import ImportLog from "./components/ImportLog";
25
25
  import ImportTable from "./components/ImportTable";
26
26
  import { useSharedState } from "../../../../../hooks";
27
+ import { getCurrentLocale } from "../../../../../utils/locale";
27
28
  import { Context } from "../../../model";
28
29
  import "./index.less";
29
30
  var Com = {
@@ -33,6 +34,7 @@ var Com = {
33
34
  import_log: ImportLog
34
35
  };
35
36
  var ExportImport = function ExportImport(_ref) {
37
+ var _context$appHelper, _context$appHelper$ut;
36
38
  var exportImport = _ref.exportImport;
37
39
  var _useState = useState(false),
38
40
  _useState2 = _slicedToArray(_useState, 2),
@@ -59,7 +61,7 @@ var ExportImport = function ExportImport(_ref) {
59
61
  var originResultDataSource = state.originResultDataSource,
60
62
  currentDataSource = state.currentDataSource;
61
63
  var context = useEngineContext();
62
- request.setRequest(context.appHelper.utils.request);
64
+ request.setRequest((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.request);
63
65
  var _items = useMemo(function () {
64
66
  // 将对象转成数组
65
67
  var result = Object.entries(exportImportOptions).map(function (_ref2) {
@@ -74,9 +76,9 @@ var ExportImport = function ExportImport(_ref) {
74
76
  return result;
75
77
  }, []);
76
78
  var Content = useMemo(function () {
77
- if (!value) return null;
78
- return Com[value];
79
- }, [value]);
79
+ var _value = value || defaultOptions.importValue;
80
+ return Com[_value];
81
+ }, [value, defaultOptions.importValue]);
80
82
  var _footer = useMemo(function () {
81
83
  var types = defaultOptions.footerHintTypes;
82
84
  if (types.includes(value)) {
@@ -90,10 +92,12 @@ var ExportImport = function ExportImport(_ref) {
90
92
  var _title = useMemo(function () {
91
93
  if (!value) return null;
92
94
  var types = defaultOptions.okShowButtonTypes;
95
+ var lang = getCurrentLocale();
96
+ var isEn = lang === "en-US" || lang === "en";
93
97
 
94
98
  // 导出导入标题
95
99
  if (types.includes(value) && exportImport !== null && exportImport !== void 0 && exportImport.title) {
96
- return "".concat(exportImportOptions[value]).concat(exportImport.title);
100
+ return "".concat(exportImportOptions[value]).concat(isEn ? " " : "").concat(exportImport.title);
97
101
  }
98
102
  return exportImportOptions[value];
99
103
  }, [value, exportImport === null || exportImport === void 0 ? void 0 : exportImport.title]);
@@ -1,4 +1,4 @@
1
- import { TableProps } from "antd";
2
- import React from "react";
1
+ import { TableProps } from 'antd';
2
+ import React from 'react';
3
3
  declare const BasicTable: (props: TableProps<any>) => React.JSX.Element;
4
4
  export default BasicTable;
@@ -14,13 +14,13 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
14
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
- import { Table, Form } from "antd";
18
- import React, { useState, useMemo, useCallback, useEffect } from "react";
17
+ import { Table, Form } from 'antd';
18
+ import React, { useState, useMemo, useCallback, useEffect } from 'react';
19
19
  import { FormPagination } from "../../Pagination";
20
20
  import { calcFilterSort } from "../Table/utils";
21
21
  import { useSharedState } from "../../../hooks";
22
22
  import { Context } from "../model";
23
- import { isArr } from "@pisell/utils";
23
+ import { isArr } from '@pisell/utils';
24
24
  var BasicTable = function BasicTable(props) {
25
25
  var _pagination$pageSizeO;
26
26
  var dataSource = props.dataSource,
@@ -37,11 +37,11 @@ var BasicTable = function BasicTable(props) {
37
37
  sort = _useState4[0],
38
38
  setSort = _useState4[1];
39
39
  var form = Form.useFormInstance();
40
- var formPagination = Form.useWatch("pagination", form) || {
40
+ var formPagination = Form.useWatch('pagination', form) || {
41
41
  page: 1,
42
42
  size: 10
43
43
  };
44
- var group = Form.useWatch("group_by", {
44
+ var group = Form.useWatch('group_by', {
45
45
  form: form,
46
46
  preserve: true
47
47
  });
@@ -96,22 +96,36 @@ var BasicTable = function BasicTable(props) {
96
96
  var _expandedRowKeys = [];
97
97
  _dataSource === null || _dataSource === void 0 ? void 0 : (_dataSource$list = _dataSource.list) === null || _dataSource$list === void 0 ? void 0 : _dataSource$list.forEach(function (item) {
98
98
  if (item.__is_group) {
99
- _expandedRowKeys.push(item["__rowKey"]);
99
+ _expandedRowKeys.push(item['__rowKey']);
100
100
  }
101
101
  });
102
102
  return _expandedRowKeys;
103
103
  }, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
104
104
  useEffect(function () {
105
105
  dispatch({
106
- type: "setCurrentDataSource",
106
+ type: 'setCurrentDataSource',
107
107
  payload: (_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list) || []
108
108
  });
109
109
  }, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
110
110
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({
111
- key: defaultExpandedRowKeys.join("-")
111
+ key: defaultExpandedRowKeys.join('-')
112
112
  }, other, {
113
113
  // 开启分组条件后关闭行选择功能
114
- rowSelection: isGroup ? false : other === null || other === void 0 ? void 0 : other.rowSelection,
114
+ rowSelection: isGroup ? false : _objectSpread(_objectSpread({}, other === null || other === void 0 ? void 0 : other.rowSelection), {}, {
115
+ getCheckboxProps: function getCheckboxProps() {
116
+ return {
117
+ children:
118
+ /*#__PURE__*/
119
+ // 热区为单元格大小
120
+ React.createElement("div", {
121
+ className: "pisell-lowcode-table-checkbox"
122
+ }),
123
+ onClick: function onClick(e) {
124
+ e.stopPropagation();
125
+ }
126
+ };
127
+ }
128
+ }),
115
129
  virtual: virtual,
116
130
  onChange: function onChange(pagination, filters, sorter) {
117
131
  form.setFieldsValue({
@@ -129,7 +143,7 @@ var BasicTable = function BasicTable(props) {
129
143
  return _objectSpread(_objectSpread({}, (other === null || other === void 0 ? void 0 : (_other$onRow = other.onRow) === null || _other$onRow === void 0 ? void 0 : _other$onRow.call(other, record, index)) || {}), {}, {
130
144
  __is_group: record.__is_group,
131
145
  __is_drag_sort: other.dragSort,
132
- className: record.__is_group ? "pisell-lowcode-table-group-row-wrap" : ""
146
+ className: record.__is_group ? 'pisell-lowcode-table-group-row-wrap' : ''
133
147
  });
134
148
  },
135
149
  expandable: {
@@ -15,6 +15,22 @@
15
15
  margin-top: 12px;
16
16
  }
17
17
  }
18
+
19
+ .pisell-lowcode-table-checkbox{
20
+ position: absolute;
21
+ top: 0;
22
+ left: 0;
23
+ width: 100%;
24
+ height: 100%;
25
+ }
26
+
27
+ .pisell-lowcode-table-tbody{
28
+ .pisell-lowcode-table-selection-column{
29
+ .pisell-lowcode-checkbox{
30
+ left: 8px!important;
31
+ }
32
+ }
33
+ }
18
34
  }
19
35
 
20
36
  .materials-grid-table-wrap {
@@ -29,9 +29,6 @@
29
29
  display: flex;
30
30
  align-items: center;
31
31
  justify-content: center;
32
- position: absolute;
33
- top: 0;
34
- left: 0;
35
32
  }
36
33
  }
37
34
  }
@@ -45,9 +42,6 @@
45
42
  display: flex;
46
43
  align-items: center;
47
44
  justify-content: center;
48
- position: absolute;
49
- top: 0;
50
- left: 0;
51
45
  }
52
46
  }
53
47
 
@@ -132,9 +126,11 @@
132
126
 
133
127
  .pisell-lowcode-table-bordered .pisell-lowcode-table-tbody .pisell-lowcode-table-selection-column {
134
128
  border-left: 1px solid #EAECF0;
129
+ min-width: 46px;
135
130
  }
136
131
 
137
132
  .drag-sort-cell {
133
+ min-width: 40px;
138
134
  .editable-cell-value-wrap {
139
135
  display: flex;
140
136
  align-items: center;
@@ -48,6 +48,7 @@ var import_function = require("./components/ExportTable/function");
48
48
  var import_ImportLog = __toESM(require("./components/ImportLog"));
49
49
  var import_ImportTable = __toESM(require("./components/ImportTable"));
50
50
  var import_hooks = require("../../../../../hooks");
51
+ var import_locale = require("../../../../../utils/locale");
51
52
  var import_model = require("../../../model");
52
53
  var import_index = require("./index.less");
53
54
  var Com = {
@@ -57,6 +58,7 @@ var Com = {
57
58
  import_log: import_ImportLog.default
58
59
  };
59
60
  var ExportImport = ({ exportImport }) => {
61
+ var _a, _b;
60
62
  const [open, setOpen] = (0, import_react.useState)(false);
61
63
  const [file, setFile] = (0, import_react.useState)(null);
62
64
  const [type, setType] = (0, import_react.useState)(import_status.defaultOptions.exportType);
@@ -65,7 +67,7 @@ var ExportImport = ({ exportImport }) => {
65
67
  const { state } = (0, import_hooks.useSharedState)(import_model.Context);
66
68
  const { originResultDataSource, currentDataSource } = state;
67
69
  const context = (0, import_useEngineContext.default)();
68
- import_utils.request.setRequest(context.appHelper.utils.request);
70
+ import_utils.request.setRequest((_b = (_a = context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.request);
69
71
  const _items = (0, import_react.useMemo)(() => {
70
72
  const result = Object.entries(import_status.exportImportOptions).map(([key, value2]) => {
71
73
  return {
@@ -76,10 +78,9 @@ var ExportImport = ({ exportImport }) => {
76
78
  return result;
77
79
  }, []);
78
80
  const Content = (0, import_react.useMemo)(() => {
79
- if (!value)
80
- return null;
81
- return Com[value];
82
- }, [value]);
81
+ const _value = value || import_status.defaultOptions.importValue;
82
+ return Com[_value];
83
+ }, [value, import_status.defaultOptions.importValue]);
83
84
  const _footer = (0, import_react.useMemo)(() => {
84
85
  const types = import_status.defaultOptions.footerHintTypes;
85
86
  if (types.includes(value)) {
@@ -94,8 +95,10 @@ var ExportImport = ({ exportImport }) => {
94
95
  if (!value)
95
96
  return null;
96
97
  const types = import_status.defaultOptions.okShowButtonTypes;
98
+ const lang = (0, import_locale.getCurrentLocale)();
99
+ const isEn = lang === "en-US" || lang === "en";
97
100
  if (types.includes(value) && (exportImport == null ? void 0 : exportImport.title)) {
98
- return `${import_status.exportImportOptions[value]}${exportImport.title}`;
101
+ return `${import_status.exportImportOptions[value]}${isEn ? " " : ""}${exportImport.title}`;
99
102
  }
100
103
  return import_status.exportImportOptions[value];
101
104
  }, [value, exportImport == null ? void 0 : exportImport.title]);
@@ -1,4 +1,4 @@
1
- import { TableProps } from "antd";
2
- import React from "react";
1
+ import { TableProps } from 'antd';
2
+ import React from 'react';
3
3
  declare const BasicTable: (props: TableProps<any>) => React.JSX.Element;
4
4
  export default BasicTable;
@@ -117,7 +117,20 @@ var BasicTable = (props) => {
117
117
  {
118
118
  key: defaultExpandedRowKeys.join("-"),
119
119
  ...other,
120
- rowSelection: isGroup ? false : other == null ? void 0 : other.rowSelection,
120
+ rowSelection: isGroup ? false : {
121
+ ...other == null ? void 0 : other.rowSelection,
122
+ getCheckboxProps: () => {
123
+ return {
124
+ children: (
125
+ // 热区为单元格大小
126
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-table-checkbox" })
127
+ ),
128
+ onClick: (e) => {
129
+ e.stopPropagation();
130
+ }
131
+ };
132
+ }
133
+ },
121
134
  virtual,
122
135
  onChange: (pagination2, filters, sorter) => {
123
136
  form.setFieldsValue({
@@ -15,6 +15,22 @@
15
15
  margin-top: 12px;
16
16
  }
17
17
  }
18
+
19
+ .pisell-lowcode-table-checkbox{
20
+ position: absolute;
21
+ top: 0;
22
+ left: 0;
23
+ width: 100%;
24
+ height: 100%;
25
+ }
26
+
27
+ .pisell-lowcode-table-tbody{
28
+ .pisell-lowcode-table-selection-column{
29
+ .pisell-lowcode-checkbox{
30
+ left: 8px!important;
31
+ }
32
+ }
33
+ }
18
34
  }
19
35
 
20
36
  .materials-grid-table-wrap {
@@ -29,9 +29,6 @@
29
29
  display: flex;
30
30
  align-items: center;
31
31
  justify-content: center;
32
- position: absolute;
33
- top: 0;
34
- left: 0;
35
32
  }
36
33
  }
37
34
  }
@@ -45,9 +42,6 @@
45
42
  display: flex;
46
43
  align-items: center;
47
44
  justify-content: center;
48
- position: absolute;
49
- top: 0;
50
- left: 0;
51
45
  }
52
46
  }
53
47
 
@@ -132,9 +126,11 @@
132
126
 
133
127
  .pisell-lowcode-table-bordered .pisell-lowcode-table-tbody .pisell-lowcode-table-selection-column {
134
128
  border-left: 1px solid #EAECF0;
129
+ min-width: 46px;
135
130
  }
136
131
 
137
132
  .drag-sort-cell {
133
+ min-width: 40px;
138
134
  .editable-cell-value-wrap {
139
135
  display: flex;
140
136
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.321",
3
+ "version": "1.0.322",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -63,8 +63,8 @@
63
63
  "react-virtualized-auto-sizer": "^1.0.20",
64
64
  "crypto-js": "^4.2.0",
65
65
  "@pisell/utils": "1.0.27",
66
- "@pisell/icon": "0.0.10",
67
- "@pisell/date-picker": "1.0.75"
66
+ "@pisell/date-picker": "1.0.75",
67
+ "@pisell/icon": "0.0.10"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "^18.0.0",