@pisell/materials 1.0.320 → 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 {
@@ -1,6 +1,6 @@
1
- import type { FormInstance } from "antd/es/form";
2
- import React from "react";
3
- import "./index.less";
1
+ import type { FormInstance } from 'antd/es/form';
2
+ import React from 'react';
3
+ import './index.less';
4
4
  export declare const EditableContext: React.Context<FormInstance<any> | null>;
5
5
  interface Item {
6
6
  key: string;
@@ -10,7 +10,7 @@ interface Item {
10
10
  }
11
11
  export interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
12
12
  index: number;
13
- "data-row-key": string;
13
+ 'data-row-key': string;
14
14
  __is_group?: boolean;
15
15
  __table_group_field?: string;
16
16
  __is_drag_sort?: boolean;
@@ -15,12 +15,12 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  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; }
17
17
  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; }
18
- import { Form, Tooltip } from "antd";
19
- import { useSortable } from "@dnd-kit/sortable";
20
- import { CSS } from "@dnd-kit/utilities";
21
- import { MenuOutlined } from "@ant-design/icons";
22
- import classNames from "classnames";
23
- import React, { useMemo } from "react";
18
+ import { Form, Tooltip } from 'antd';
19
+ import { useSortable } from '@dnd-kit/sortable';
20
+ import { CSS } from '@dnd-kit/utilities';
21
+ import { MenuOutlined } from '@ant-design/icons';
22
+ import classNames from 'classnames';
23
+ import React, { useMemo } from 'react';
24
24
  import CellProvider from "./CellProvider";
25
25
  import { getText } from "../../../../../locales";
26
26
  import "./index.less";
@@ -35,9 +35,9 @@ var EditableRow = function EditableRow(_ref) {
35
35
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
36
36
  form = _Form$useForm2[0];
37
37
  var parentForm = Form.useFormInstance();
38
- var order_by = Form.useWatch("order_by", parentForm);
38
+ var order_by = Form.useWatch('order_by', parentForm);
39
39
  var _useSortable = useSortable({
40
- id: props["data-row-key"]
40
+ id: props['data-row-key']
41
41
  }),
42
42
  attributes = _useSortable.attributes,
43
43
  listeners = _useSortable.listeners,
@@ -52,7 +52,7 @@ var EditableRow = function EditableRow(_ref) {
52
52
  })),
53
53
  transition: transition
54
54
  }, isDragging && __is_drag_sort ? {
55
- position: "relative",
55
+ position: 'relative',
56
56
  zIndex: 9999
57
57
  } : {});
58
58
  var cells = useMemo(function () {
@@ -60,20 +60,14 @@ var EditableRow = function EditableRow(_ref) {
60
60
  return children;
61
61
  }
62
62
  return React.Children.map(children, function (child) {
63
- if (child.key === "__sort") {
63
+ if (child.key === '__sort') {
64
64
  var handleIcon = order_by ? /*#__PURE__*/React.createElement(Tooltip, {
65
- title: getText("table-column-drag-sort-disabled-tip")
65
+ title: getText('table-column-drag-sort-disabled-tip')
66
66
  }, /*#__PURE__*/React.createElement(MenuOutlined, {
67
- style: {
68
- touchAction: "none",
69
- cursor: "move"
70
- }
67
+ className: "pisell-lowcode-menu-out-lined-icon"
71
68
  })) : /*#__PURE__*/React.createElement(MenuOutlined, _extends({
72
69
  ref: setActivatorNodeRef,
73
- style: {
74
- touchAction: "none",
75
- cursor: "move"
76
- }
70
+ className: "pisell-lowcode-menu-out-lined-icon"
77
71
  }, listeners));
78
72
  return /*#__PURE__*/React.cloneElement(child, {
79
73
  children: handleIcon
@@ -108,7 +102,7 @@ var EditableCell = function EditableCell(props) {
108
102
  render = props.render,
109
103
  restProps = _objectWithoutProperties(props, _excluded2);
110
104
  return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
111
- className: classNames(restProps.className, "ant-table-cell", "materials-grid-table-cell")
105
+ className: classNames(restProps.className, 'ant-table-cell', 'materials-grid-table-cell')
112
106
  }), /*#__PURE__*/React.createElement(CellProvider, props));
113
107
  };
114
108
  export default {
@@ -3,6 +3,19 @@
3
3
  height: 100%;
4
4
  }
5
5
 
6
+ .pisell-lowcode-menu-out-lined-icon{
7
+ position: absolute;
8
+ top: 0;
9
+ left: 0;
10
+ width: 100%;
11
+ height: 100%;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ cursor: move;
16
+ touch-action: none;
17
+ }
18
+
6
19
  .materials-grid-table-cell {
7
20
  padding: 12px;
8
21
  }
@@ -126,9 +126,11 @@
126
126
 
127
127
  .pisell-lowcode-table-bordered .pisell-lowcode-table-tbody .pisell-lowcode-table-selection-column {
128
128
  border-left: 1px solid #EAECF0;
129
+ min-width: 46px;
129
130
  }
130
131
 
131
132
  .drag-sort-cell {
133
+ min-width: 40px;
132
134
  .editable-cell-value-wrap {
133
135
  display: flex;
134
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 {
@@ -1,6 +1,6 @@
1
- import type { FormInstance } from "antd/es/form";
2
- import React from "react";
3
- import "./index.less";
1
+ import type { FormInstance } from 'antd/es/form';
2
+ import React from 'react';
3
+ import './index.less';
4
4
  export declare const EditableContext: React.Context<FormInstance<any> | null>;
5
5
  interface Item {
6
6
  key: string;
@@ -10,7 +10,7 @@ interface Item {
10
10
  }
11
11
  export interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
12
12
  index: number;
13
- "data-row-key": string;
13
+ 'data-row-key': string;
14
14
  __is_group?: boolean;
15
15
  __table_group_field?: string;
16
16
  __is_drag_sort?: boolean;
@@ -80,11 +80,11 @@ var EditableRow = ({
80
80
  }
81
81
  return import_react.default.Children.map(children, (child) => {
82
82
  if (child.key === "__sort") {
83
- const handleIcon = order_by ? /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { title: (0, import_locales.getText)("table-column-drag-sort-disabled-tip") }, /* @__PURE__ */ import_react.default.createElement(import_icons.MenuOutlined, { style: { touchAction: "none", cursor: "move" } })) : /* @__PURE__ */ import_react.default.createElement(
83
+ const handleIcon = order_by ? /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { title: (0, import_locales.getText)("table-column-drag-sort-disabled-tip") }, /* @__PURE__ */ import_react.default.createElement(import_icons.MenuOutlined, { className: "pisell-lowcode-menu-out-lined-icon" })) : /* @__PURE__ */ import_react.default.createElement(
84
84
  import_icons.MenuOutlined,
85
85
  {
86
86
  ref: setActivatorNodeRef,
87
- style: { touchAction: "none", cursor: "move" },
87
+ className: "pisell-lowcode-menu-out-lined-icon",
88
88
  ...listeners
89
89
  }
90
90
  );
@@ -3,6 +3,19 @@
3
3
  height: 100%;
4
4
  }
5
5
 
6
+ .pisell-lowcode-menu-out-lined-icon{
7
+ position: absolute;
8
+ top: 0;
9
+ left: 0;
10
+ width: 100%;
11
+ height: 100%;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ cursor: move;
16
+ touch-action: none;
17
+ }
18
+
6
19
  .materials-grid-table-cell {
7
20
  padding: 12px;
8
21
  }
@@ -126,9 +126,11 @@
126
126
 
127
127
  .pisell-lowcode-table-bordered .pisell-lowcode-table-tbody .pisell-lowcode-table-selection-column {
128
128
  border-left: 1px solid #EAECF0;
129
+ min-width: 46px;
129
130
  }
130
131
 
131
132
  .drag-sort-cell {
133
+ min-width: 40px;
132
134
  .editable-cell-value-wrap {
133
135
  display: flex;
134
136
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.320",
3
+ "version": "1.0.322",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -62,9 +62,9 @@
62
62
  "react-window": "^1.8.10",
63
63
  "react-virtualized-auto-sizer": "^1.0.20",
64
64
  "crypto-js": "^4.2.0",
65
- "@pisell/icon": "0.0.10",
66
65
  "@pisell/utils": "1.0.27",
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",