@pisell/materials 1.0.12 → 1.0.13

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.
Files changed (38) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +5 -5
  11. package/es/components/MultipleContainersSortList/index.d.ts +2 -1
  12. package/es/components/MultipleContainersSortList/index.js +10 -2
  13. package/es/components/MultipleContainersSortList/index.less +6 -0
  14. package/es/components/Pagination/index.js +142 -0
  15. package/{lib/components/table → es/components}/Pagination/index.less +58 -0
  16. package/es/components/table/Actions/Filter/Dropdown/index.js +9 -2
  17. package/es/components/table/Actions/Filter/Dropdown/index.less +2 -0
  18. package/es/components/table/BasicTable/index.d.ts +4 -0
  19. package/es/components/table/BasicTable/index.js +71 -0
  20. package/es/components/table/Table/fields/date/Show/index.js +3 -1
  21. package/es/components/table/Table/index.js +3 -8
  22. package/es/components/table/index.js +6 -5
  23. package/lib/components/MultipleContainersSortList/index.d.ts +2 -1
  24. package/lib/components/MultipleContainersSortList/index.js +15 -3
  25. package/lib/components/MultipleContainersSortList/index.less +6 -0
  26. package/lib/components/{table/Pagination → Pagination}/index.js +58 -3
  27. package/{es/components/table → lib/components}/Pagination/index.less +58 -0
  28. package/lib/components/table/Actions/Filter/Dropdown/index.js +6 -1
  29. package/lib/components/table/Actions/Filter/Dropdown/index.less +2 -0
  30. package/lib/components/table/BasicTable/index.d.ts +4 -0
  31. package/lib/components/table/BasicTable/index.js +74 -0
  32. package/lib/components/table/Table/fields/date/Show/index.js +13 -1
  33. package/lib/components/table/Table/index.js +3 -9
  34. package/lib/components/table/index.js +6 -1
  35. package/package.json +3 -2
  36. package/es/components/table/Pagination/index.js +0 -45
  37. /package/es/components/{table/Pagination → Pagination}/index.d.ts +0 -0
  38. /package/lib/components/{table/Pagination → Pagination}/index.d.ts +0 -0
@@ -148,4 +148,62 @@
148
148
  transform: rotate(180deg);
149
149
  }
150
150
  }
151
+ }
152
+
153
+ .materials-grid-paginator-mini {
154
+ display: flex;
155
+ justify-content: space-between;
156
+ align-items: center;
157
+ overflow: hidden;
158
+ height: 50px;
159
+ width: 100%;
160
+ background-color: #fff;
161
+ border-radius: 0 0 8px 8px;
162
+ border: 1px solid #f0f0f0;
163
+ border-top: none;
164
+ padding: 0 20px;
165
+ margin: 0 !important;
166
+
167
+ .paginator-page-btn {
168
+ padding: 8px;
169
+
170
+ }
171
+
172
+ .materials-grid-paginator-center {
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ gap: 4px;
177
+
178
+ .materials-grid-paginator-center-text {
179
+ color: var(--gray-700, #344054);
180
+ font-size: 14px;
181
+ font-style: normal;
182
+ font-weight: 400;
183
+ }
184
+
185
+ .materials-grid-paginator-center-value {
186
+ color: var(--gray-700, #344054);
187
+ font-size: 14px;
188
+ font-style: normal;
189
+ font-weight: 500;
190
+ }
191
+ }
192
+
193
+ .pisell-lowcode-pagination-prev,
194
+ .pisell-lowcode-pagination-next {
195
+ margin: 0;
196
+ border-radius: 8px;
197
+ border: 1px solid #D0D5DD;
198
+
199
+ .paginator-page-btn-left-icon {
200
+ margin-right: 0;
201
+ }
202
+
203
+ .paginator-page-btn-right-icon {
204
+ margin-left: 0;
205
+ }
206
+
207
+ }
208
+
151
209
  }
@@ -39,10 +39,15 @@ var import_index = require("./index.less");
39
39
  var import_FilterItem = __toESM(require("../FilterItem"));
40
40
  var import_hooks = require("../../../../../hooks");
41
41
  var import_model = require("../../../model");
42
+ var import_antd = require("antd");
42
43
  var titleMap = {
43
44
  quickFilter: "Quick Filter",
44
45
  otherFilter: "Filter"
45
46
  };
47
+ var tooltipMap = {
48
+ quickFilter: "Enable quick filtering directly on the page for convenient filtering operations, with a maximum of three filters allowed.\n",
49
+ otherFilter: "Select filter criteria in the list to perform filtering operations and display corresponding results."
50
+ };
46
51
  var DragItem = import_react.default.forwardRef((props, ref) => {
47
52
  const { attributes, listeners, setActivatorNodeRef, style } = props;
48
53
  return /* @__PURE__ */ import_react.default.createElement(
@@ -83,7 +88,7 @@ var Dropdown = (props) => {
83
88
  });
84
89
  };
85
90
  const renderContainer = (0, import_react.useCallback)(({ children, ref, id }) => {
86
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "filter-dropdown-container-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "filter-dropdown-container-title-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "filter-dropdown-container-title" }, titleMap[id]), /* @__PURE__ */ import_react.default.createElement(import_icon.HelpCircle, { className: "filter-dropdown-container-icon-help" })), /* @__PURE__ */ import_react.default.createElement("div", { ref, className: "filter-dropdown-container-filter-wrap" }, children));
91
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "filter-dropdown-container-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "filter-dropdown-container-title-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "filter-dropdown-container-title" }, titleMap[id]), /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { title: tooltipMap[id] }, /* @__PURE__ */ import_react.default.createElement(import_icon.HelpCircle, { className: "filter-dropdown-container-icon-help" }))), /* @__PURE__ */ import_react.default.createElement("div", { ref, className: "filter-dropdown-container-filter-wrap" }, children));
87
92
  }, []);
88
93
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "filter-dropdown-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "filter-dropdown-wrap-content" }, /* @__PURE__ */ import_react.default.createElement(
89
94
  import_MultipleContainersSortList.default,
@@ -1,5 +1,7 @@
1
1
  .filter-dropdown-wrap {
2
2
  width: 400px;
3
+ max-width: calc(100vw - 24px);
4
+ min-width: 250px;
3
5
  padding: 4px;
4
6
  max-height: 400px;
5
7
  display: flex;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TableProps } from "antd";
3
+ declare const BasicTable: (props: TableProps<any>) => JSX.Element;
4
+ export default BasicTable;
@@ -0,0 +1,74 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/table/BasicTable/index.tsx
30
+ var BasicTable_exports = {};
31
+ __export(BasicTable_exports, {
32
+ default: () => BasicTable_default
33
+ });
34
+ module.exports = __toCommonJS(BasicTable_exports);
35
+ var import_antd = require("antd");
36
+ var import_react = __toESM(require("react"));
37
+ var import_Pagination = __toESM(require("../../Pagination"));
38
+ var BasicTable = (props) => {
39
+ const { dataSource, pagination, ...other } = props;
40
+ const [currentPage, setCurrentPage] = (0, import_react.useState)(1);
41
+ const [pageSize, setPageSize] = (0, import_react.useState)(10);
42
+ const _dataSource = (0, import_react.useMemo)(() => {
43
+ let list = (dataSource == null ? void 0 : dataSource.list) || [];
44
+ let total2 = (dataSource == null ? void 0 : dataSource.total) || 0;
45
+ if (Array.isArray(dataSource)) {
46
+ list = dataSource;
47
+ total2 = list.length;
48
+ }
49
+ list = list.slice((currentPage - 1) * pageSize, currentPage * pageSize);
50
+ return {
51
+ list,
52
+ total: total2
53
+ };
54
+ }, [dataSource, currentPage, pageSize]);
55
+ const total = (0, import_react.useMemo)(() => {
56
+ return (pagination == null ? void 0 : pagination.total) || (_dataSource == null ? void 0 : _dataSource.total) || 0;
57
+ }, [dataSource, pagination]);
58
+ const onPaginationChange = (page, pageSize2) => {
59
+ setCurrentPage(page);
60
+ setPageSize(pageSize2);
61
+ };
62
+ return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Table, { ...other, pagination: false, dataSource: _dataSource == null ? void 0 : _dataSource.list }), /* @__PURE__ */ import_react.default.createElement(
63
+ import_Pagination.default,
64
+ {
65
+ ...pagination,
66
+ current: currentPage,
67
+ pageSize,
68
+ onShowSizeChange: onPaginationChange,
69
+ onChange: onPaginationChange,
70
+ total
71
+ }
72
+ ));
73
+ };
74
+ var BasicTable_default = BasicTable;
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/components/table/Table/fields/date/Show/index.tsx
@@ -22,6 +32,8 @@ __export(Show_exports, {
22
32
  default: () => Show_default
23
33
  });
24
34
  module.exports = __toCommonJS(Show_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("@pisell/utils");
25
37
  var Show = (props) => {
26
38
  const {
27
39
  title,
@@ -32,6 +44,6 @@ var Show = (props) => {
32
44
  handleSave,
33
45
  ...restProps
34
46
  } = props;
35
- return /* @__PURE__ */ React.createElement("div", { className: "" }, record[dataIndex]);
47
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, (0, import_utils.formatDate)(record[dataIndex]));
36
48
  };
37
49
  var Show_default = Show;
@@ -33,15 +33,15 @@ __export(Table_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(Table_exports);
35
35
  var import_hooks = require("../../../hooks");
36
- var import_antd = require("antd");
37
36
  var import_react = __toESM(require("react"));
38
37
  var import_ahooks = require("ahooks");
39
38
  var import_model = require("../model");
40
39
  var import_index = require("./index.less");
40
+ var import_BasicTable = __toESM(require("../BasicTable"));
41
41
  var import_SortRow = __toESM(require("./tableConfig/SortRow"));
42
42
  var import_body = __toESM(require("./tableConfig/body"));
43
43
  var import_header = __toESM(require("./tableConfig/header"));
44
- var import_Pagination = require("../Pagination");
44
+ var import_Pagination = require("../../Pagination");
45
45
  var GridViewTable = ({ tableProps }) => {
46
46
  const responsive = (0, import_hooks.useResponsive)();
47
47
  const { state, dispatch } = (0, import_hooks.useSharedState)(import_model.Context);
@@ -112,12 +112,6 @@ var GridViewTable = ({ tableProps }) => {
112
112
  if (tableProps.pagination === false) {
113
113
  return false;
114
114
  }
115
- if (responsive === "phone") {
116
- return {
117
- ...tableProps.pagination,
118
- size: "small"
119
- };
120
- }
121
115
  return {
122
116
  ...import_Pagination.paginationConfig,
123
117
  ...tableProps.pagination,
@@ -125,7 +119,7 @@ var GridViewTable = ({ tableProps }) => {
125
119
  };
126
120
  }, [responsive, tableProps.pagination]);
127
121
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "materials-grid-table-wrap" }, /* @__PURE__ */ import_react.default.createElement(import_SortRow.default, null, /* @__PURE__ */ import_react.default.createElement(
128
- import_antd.Table,
122
+ import_BasicTable.default,
129
123
  {
130
124
  dataSource,
131
125
  columns,
@@ -71,9 +71,14 @@ var GridView = (0, import_model.Provider)((props) => {
71
71
  });
72
72
  }, [dataSource]);
73
73
  (0, import_react.useEffect)(() => {
74
+ var _a, _b, _c, _d;
74
75
  modal.dispatch({
75
76
  type: "setQuickFilter",
76
- payload: filter.list
77
+ payload: ((_b = (_a = filter == null ? void 0 : filter.list) == null ? void 0 : _a.slice) == null ? void 0 : _b.call(_a, 0, 3)) || []
78
+ });
79
+ modal.dispatch({
80
+ type: "setOtherFilter",
81
+ payload: ((_d = (_c = filter == null ? void 0 : filter.list) == null ? void 0 : _c.slice) == null ? void 0 : _d.call(_c, 3)) || []
77
82
  });
78
83
  }, [filter]);
79
84
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { form, layout: "vertical", onValuesChange }, /* @__PURE__ */ import_react.default.createElement("div", { className: "materials-grid", style }, /* @__PURE__ */ import_react.default.createElement(import_Header.default, { title, buttons }), /* @__PURE__ */ import_react.default.createElement(import_Actions.default, { filter, sort }), /* @__PURE__ */ import_react.default.createElement(import_Summary.default, { summary }), /* @__PURE__ */ import_react.default.createElement(import_Table.default, { tableProps: other })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -23,7 +23,8 @@
23
23
  "@alilc/lowcode-react-renderer": "^1.1.7",
24
24
  "@alilc/lowcode-types": "1.1.7",
25
25
  "@svgr/webpack": "^5.5.0",
26
- "url-loader": "^4.1.1"
26
+ "url-loader": "^4.1.1",
27
+ "@alilc/build-plugin-alt": "^1.3.3"
27
28
  },
28
29
  "publishConfig": {
29
30
  "access": "public"
@@ -1,45 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { useMemo } from "react";
3
- import { ArrowLeft, ArrowRight } from "@pisell/icon";
4
- import { Pagination as OriginPagination } from "antd";
5
- import classNames from "classnames";
6
- import "./index.less";
7
- var itemRender = function itemRender(_, type, originalElement) {
8
- if (type === "prev") {
9
- return /*#__PURE__*/React.createElement("div", {
10
- className: classNames("paginator-page-btn", "left")
11
- }, /*#__PURE__*/React.createElement(ArrowLeft, {
12
- className: "paginator-page-btn-left-icon"
13
- }), /*#__PURE__*/React.createElement("span", {
14
- className: "paginator-page-btn-text"
15
- }, "Previous"));
16
- }
17
- if (type === "next") {
18
- return /*#__PURE__*/React.createElement("div", {
19
- className: classNames("paginator-page-btn", "right")
20
- }, /*#__PURE__*/React.createElement("span", {
21
- className: "paginator-page-btn-text"
22
- }, "Next"), /*#__PURE__*/React.createElement(ArrowRight, {
23
- className: "paginator-page-btn-right-icon"
24
- }));
25
- }
26
- return originalElement;
27
- };
28
- export var paginationConfig = {
29
- className: "materials-grid-paginator",
30
- defaultCurrent: 1,
31
- showTotal: function showTotal(total, range) {
32
- return "Page ".concat(range[0], " of ").concat(range[1]);
33
- },
34
- itemRender: itemRender,
35
- responsive: true,
36
- size: "small"
37
- };
38
- var Pagination = function Pagination(props) {
39
- console.log(props);
40
- var show = useMemo(function () {
41
- return Object.keys(props).length;
42
- }, [props]);
43
- return show ? /*#__PURE__*/React.createElement(OriginPagination, _extends({}, paginationConfig, props)) : null;
44
- };
45
- export default Pagination;