szld-libs 0.2.47 → 0.2.48

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.
@@ -0,0 +1,15 @@
1
+ import { PaginationProps } from 'antd';
2
+ export interface CustomPaginationProps {
3
+ /** 总数文本 */
4
+ totalText?: string;
5
+ /** 单位文本 */
6
+ unitText?: string;
7
+ /** 跳转文本 */
8
+ jumpText?: string;
9
+ /** 页文本 */
10
+ pageText?: string;
11
+ /** pagination属性配置 */
12
+ paginationProps?: PaginationProps;
13
+ }
14
+ declare function CustomPagination(props: CustomPaginationProps): import("react/jsx-runtime").JSX.Element;
15
+ export default CustomPagination;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const antd = require("antd");
4
+ const react = require("react");
5
+ const customPagination = "custom-pagination-module_customPagination_bb6f7";
6
+ const jumpBtns = "custom-pagination-module_jumpBtns_a6c0b";
7
+ const styles = {
8
+ customPagination,
9
+ jumpBtns
10
+ };
11
+ function CustomPagination(props) {
12
+ const { totalText = "共", unitText = "条", jumpText = "跳至", pageText = "页", paginationProps } = props;
13
+ const [inputValue, setInputValue] = react.useState("");
14
+ const pageSize = (paginationProps == null ? void 0 : paginationProps.pageSize) || 10;
15
+ const handleChange = (e) => {
16
+ setInputValue(e.target.value);
17
+ };
18
+ const handleBlur = (e) => {
19
+ var _a;
20
+ setInputValue("");
21
+ if (Number.isNaN(Number(e.target.value))) {
22
+ return;
23
+ }
24
+ (_a = paginationProps == null ? void 0 : paginationProps.onChange) == null ? void 0 : _a.call(paginationProps, Number(e.target.value), pageSize);
25
+ };
26
+ const handleKeyDown = (e) => {
27
+ var _a;
28
+ if (e.key === "Enter") {
29
+ setInputValue("");
30
+ if (Number.isNaN(Number(inputValue))) {
31
+ return;
32
+ }
33
+ (_a = paginationProps == null ? void 0 : paginationProps.onChange) == null ? void 0 : _a.call(paginationProps, Number(inputValue), pageSize);
34
+ }
35
+ };
36
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.customPagination, children: [
37
+ /* @__PURE__ */ jsxRuntime.jsx(
38
+ antd.Pagination,
39
+ {
40
+ showTotal: (total) => `${totalText} ${total} ${unitText}`,
41
+ showSizeChanger: {
42
+ options: [
43
+ { label: `10 ${unitText}/${pageText}`, value: 10 },
44
+ { label: `20 ${unitText}/${pageText}`, value: 20 },
45
+ { label: `50 ${unitText}/${pageText}`, value: 50 },
46
+ { label: `100 ${unitText}/${pageText}`, value: 100 }
47
+ ]
48
+ },
49
+ ...paginationProps
50
+ }
51
+ ),
52
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.jumpBtns, children: [
53
+ jumpText,
54
+ /* @__PURE__ */ jsxRuntime.jsx(
55
+ antd.Input,
56
+ {
57
+ style: { width: "50px", margin: "0 8px" },
58
+ value: inputValue,
59
+ onChange: handleChange,
60
+ onBlur: (e) => handleBlur(e),
61
+ onKeyDown: (e) => handleKeyDown(e)
62
+ }
63
+ ),
64
+ pageText
65
+ ] })
66
+ ] });
67
+ }
68
+ module.exports = CustomPagination;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -7,7 +7,7 @@ export interface TableColumnProps<T> extends ColumnType<T> {
7
7
  /** 宽度 */
8
8
  width?: number | string;
9
9
  /** 最小宽度 */
10
- minWidth?: number | string;
10
+ minWidth?: number;
11
11
  }
12
12
  export interface MTableProps<T> extends Omit<TableProps<T>, 'columns'> {
13
13
  columns?: TableColumnProps<T>[];
@@ -19,6 +19,8 @@ export interface MTableProps<T> extends Omit<TableProps<T>, 'columns'> {
19
19
  tableId?: string;
20
20
  /** 存储key,默认szld_table_cell_width */
21
21
  storageKey?: string;
22
+ /** 表格无数据文案 */
23
+ emptyText?: string;
22
24
  }
23
25
  export interface SearchTableProps<RecordType> {
24
26
  searchProps?: CreateFormProps;
@@ -26,6 +26,7 @@ function SearchTable(props) {
26
26
  resizeable = false,
27
27
  tableId,
28
28
  storageKey = "szld_table_cell_width",
29
+ emptyText,
29
30
  ...rest
30
31
  } = tableProps;
31
32
  const [columns, setColumns] = react.useState(tableProps.columns || []);
@@ -121,6 +122,7 @@ function SearchTable(props) {
121
122
  components,
122
123
  columns,
123
124
  className: classNames(classes.table, tableProps == null ? void 0 : tableProps.className),
125
+ locale: { emptyText: /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { image: antd.Empty.PRESENTED_IMAGE_SIMPLE, description: emptyText }) },
124
126
  pagination: typeof (tableProps == null ? void 0 : tableProps.pagination) === "boolean" ? tableProps.pagination : {
125
127
  showPrevNextJumpers: true,
126
128
  showQuickJumper: true,
@@ -69,7 +69,7 @@ function VirtualTable(props) {
69
69
  columnCount: mergedColumns.length,
70
70
  columnWidth: (index) => {
71
71
  const { width } = mergedColumns[index];
72
- return totalHeight > scroll.y && index === mergedColumns.length - 1 ? width - scrollbarSize - 1 : width;
72
+ return `${totalHeight}` > scroll.y && index === mergedColumns.length - 1 ? width - scrollbarSize - 1 : width;
73
73
  },
74
74
  height: scroll.y,
75
75
  rowCount: rawData.length,
@@ -39,6 +39,13 @@ function useChangePwd(props) {
39
39
  }
40
40
  ];
41
41
  const handleChangePwd = ahooks.useLockFn(async (func, title) => {
42
+ const modalProps = props == null ? void 0 : props.modalProps;
43
+ let width = void 0;
44
+ if (modalProps == null ? void 0 : modalProps.width) {
45
+ if (typeof modalProps.width === "string" || typeof modalProps.width === "number") {
46
+ width = modalProps.width;
47
+ }
48
+ }
42
49
  await modal.confirm({
43
50
  title: title || "修改密码",
44
51
  icon: null,
@@ -57,7 +64,8 @@ function useChangePwd(props) {
57
64
  });
58
65
  });
59
66
  },
60
- ...props == null ? void 0 : props.modalProps
67
+ ...modalProps,
68
+ width
61
69
  });
62
70
  });
63
71
  return { handleChangePwd };
package/lib/index.js CHANGED
@@ -9,6 +9,7 @@ const main = require("./main");
9
9
  let key = "U2FsdGVkX1/dG1NSXNR9hnp3Ech/v6Gh8CDDJxgBm1EPFQel12ySIf84ARXCPwTae7TzwgPvjOyE3S5rAEzl/wAZmId6pbezpFeFcJqxdmIl3FeluYHFxJzQHDETTvrr3G/REvv00kHptOVwg6ecjPH6yk7PNit0sWTBLorROxLxMD8lVDmOA66p7Zp4QnYzqScYJGFbutmfHYXfBRBe1Q2UKummJ798svNY5SIwEwl4spzgyWmhARtuyq4zhysFrj/xODuNDjtwitA6XfX566WcZkj3F+2P+mkYzDYOhXXaomnlybjrZ2hEHfcczQhUfJd89O8PNIuEWo24wjYRgMdKlw5CWSeocFCqV7ZJ/CV/7vNRcaO4awKlFNobLikkwDznxpcX+4UEej+ED+pgfmPQLsKedcfEscStkSAZXaD5pBRTiFU9xGLfDt6seUrEnMBeXkpMIY9j1SZDDK18/G7lSHjDQMZYZP6sfLdBdwY=";
10
10
  const Demo = () => {
11
11
  useConfig(key);
12
+ const [form] = antd.Form.useForm();
12
13
  react.useEffect(() => {
13
14
  }, []);
14
15
  const columns = [
@@ -41,53 +42,188 @@ const Demo = () => {
41
42
  react.useEffect(() => {
42
43
  setSelectedKeys([1, 12, 21]);
43
44
  }, []);
44
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh" }, children: [
45
- /* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "新增系统", isBack: true }),
46
- /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: () => setList(columns), children: "test" }),
47
- /* @__PURE__ */ jsxRuntime.jsx(
48
- "div",
49
- {
50
- style: {
51
- height: "400px",
52
- border: "1px solid #333",
53
- margin: "20px"
45
+ const { handleChangePwd } = main.useChangePwd();
46
+ const typeList = [
47
+ {
48
+ flinfo: "数据",
49
+ children: [
50
+ {
51
+ flinfo: "数据1"
52
+ },
53
+ {
54
+ flinfo: "数据2"
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ flinfo: "表",
60
+ children: [
61
+ {
62
+ flinfo: "表1"
63
+ },
64
+ {
65
+ flinfo: "表2"
66
+ }
67
+ ]
68
+ }
69
+ ];
70
+ const formItems = [
71
+ {
72
+ dataIndex: "asctypeid",
73
+ title: "编号",
74
+ valueType: "inputNumber",
75
+ valueProps: {
76
+ placeholder: "请输入编号",
77
+ controls: false,
78
+ min: 0
79
+ },
80
+ formItemProps: {
81
+ rules: [
82
+ {
83
+ required: true,
84
+ message: "请输入编号"
85
+ }
86
+ ]
87
+ },
88
+ colProps: { span: 11 }
89
+ },
90
+ {
91
+ dataIndex: "asctype",
92
+ title: "归类名",
93
+ valueProps: {
94
+ placeholder: "请输入归类名",
95
+ maxLength: 100,
96
+ allowClear: true
97
+ },
98
+ colProps: { span: 11, offset: 2 },
99
+ formItemProps: {
100
+ rules: [
101
+ {
102
+ required: true,
103
+ message: "请输入归类名"
104
+ },
105
+ { whitespace: true, message: "输入内容不能只有空格" }
106
+ ]
107
+ }
108
+ },
109
+ {
110
+ dataIndex: "tabsortList",
111
+ title: "分类",
112
+ valueType: "cascader",
113
+ valueProps: {
114
+ placeholder: "请选择分类",
115
+ options: typeList,
116
+ changeOnSelect: true,
117
+ fieldNames: {
118
+ label: "flinfo",
119
+ value: "flinfo",
120
+ children: "children"
54
121
  }
122
+ },
123
+ colProps: {
124
+ span: 11
55
125
  }
56
- ),
57
- /* @__PURE__ */ jsxRuntime.jsx(
58
- main.SearchTable,
59
- {
60
- tableProps: {
61
- columns: [
62
- {
63
- dataIndex: "id",
64
- title: "ID"
65
- },
66
- {
67
- dataIndex: "a",
68
- title: "a",
69
- width: 200
70
- },
71
- {
72
- dataIndex: "a2",
73
- title: "a",
74
- width: 200
75
- },
76
- {
77
- dataIndex: "a3",
78
- title: "a",
79
- width: 200
80
- },
81
- {
82
- dataIndex: "a4",
83
- title: "a",
84
- width: 400
126
+ }
127
+ ];
128
+ const totalText = "共@";
129
+ const unitText = "条@";
130
+ const jumpText = "跳至@";
131
+ const pageText = "页@";
132
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
133
+ /* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "页头组件", isBack: true }),
134
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 20, align: "center", children: [
135
+ "1. 测试修改密码hooks",
136
+ /* @__PURE__ */ jsxRuntime.jsx(
137
+ antd.Button,
138
+ {
139
+ onClick: () => handleChangePwd((params) => {
140
+ }),
141
+ children: "修改密码"
142
+ }
143
+ )
144
+ ] }),
145
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
146
+ "2. 测试循环滚动组件",
147
+ /* @__PURE__ */ jsxRuntime.jsx(
148
+ "div",
149
+ {
150
+ style: {
151
+ height: "400px",
152
+ border: "1px solid #333",
153
+ margin: "20px"
154
+ }
155
+ }
156
+ )
157
+ ] }),
158
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
159
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 20, align: "center", style: { marginBottom: 10 }, children: [
160
+ "3. 测试表格组件",
161
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: () => setList(columns), children: "test" })
162
+ ] }),
163
+ /* @__PURE__ */ jsxRuntime.jsx(
164
+ main.SearchTable,
165
+ {
166
+ tableProps: {
167
+ columns: [
168
+ {
169
+ dataIndex: "id",
170
+ title: "ID"
171
+ },
172
+ {
173
+ dataIndex: "a",
174
+ title: "a",
175
+ width: 200
176
+ },
177
+ {
178
+ dataIndex: "a2",
179
+ title: "a",
180
+ width: 200
181
+ },
182
+ {
183
+ dataIndex: "a3",
184
+ title: "a",
185
+ width: 200
186
+ },
187
+ {
188
+ dataIndex: "a4",
189
+ title: "a",
190
+ width: 400
191
+ }
192
+ ],
193
+ dataSource: list,
194
+ resizeable: true,
195
+ rowKey: "id",
196
+ pagination: {
197
+ total: 25,
198
+ current,
199
+ pageSize: 10,
200
+ onChange(page, pageSize) {
201
+ const index = (page - 1) * 10;
202
+ const arr = Array(10).fill(0).map((v, i) => ({ id: i + index }));
203
+ setList(arr);
204
+ setCurrent(page);
205
+ }
85
206
  }
86
- ],
87
- dataSource: list,
88
- resizeable: true,
89
- rowKey: "id",
90
- pagination: {
207
+ }
208
+ }
209
+ )
210
+ ] }),
211
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
212
+ "4. 测试创建表单组件",
213
+ /* @__PURE__ */ jsxRuntime.jsx(
214
+ main.CreateForm,
215
+ {
216
+ items: formItems,
217
+ formProps: { form, wrapperCol: { span: 24 }, style: { width: "60%", marginTop: 10 } }
218
+ }
219
+ )
220
+ ] }),
221
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
222
+ "5. 测试自定义分页组件",
223
+ /* @__PURE__ */ jsxRuntime.jsx(
224
+ main.CustomPagination,
225
+ {
226
+ paginationProps: {
91
227
  total: 25,
92
228
  current,
93
229
  pageSize: 10,
@@ -97,12 +233,16 @@ const Demo = () => {
97
233
  setList(arr);
98
234
  setCurrent(page);
99
235
  }
100
- }
236
+ },
237
+ totalText,
238
+ unitText,
239
+ jumpText,
240
+ pageText
101
241
  }
102
- }
103
- )
242
+ )
243
+ ] })
104
244
  ] });
105
245
  };
106
246
  ReactDOM.createRoot(document.getElementById("root")).render(
107
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(Demo, {}) })
247
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.App, { children: /* @__PURE__ */ jsxRuntime.jsx(Demo, {}) }) })
108
248
  );
package/lib/main.d.ts CHANGED
@@ -7,6 +7,7 @@ import AuthButton from './components/AuthButton';
7
7
  import CoralButton from './components/CoralButton';
8
8
  import LoopSlide from './components/LoopSlide';
9
9
  import showWorkFlow, { WorkFlowNode } from './components/WorkFlowNode';
10
+ import CustomPagination from './components/CustomPagination';
10
11
  import * as download from './utils/download';
11
12
  import * as fileType from './utils/filetype';
12
13
  import * as FormRules from './utils/formRules';
@@ -20,4 +21,4 @@ import useRemember from './hooks/useRemember';
20
21
  import useRowSelection from './hooks/useRowSelection';
21
22
  import AES from './utils/aes';
22
23
  import HmacSHA512 from './utils/hmacSHA512';
23
- export { AES, AuthButton, BackHeader, compressionImage, CoralButton, CreateForm, download, EditTable, fileType, FormRules, HmacSHA512, LoopSlide, SearchTable, showWorkFlow, UploadFile, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, utils, verfyCode, WorkFlowNode, };
24
+ export { AES, AuthButton, BackHeader, compressionImage, CoralButton, CreateForm, download, EditTable, fileType, FormRules, HmacSHA512, LoopSlide, SearchTable, showWorkFlow, UploadFile, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, utils, verfyCode, WorkFlowNode, CustomPagination, };
package/lib/main.js CHANGED
@@ -9,6 +9,7 @@ const AuthButton = require("./components/AuthButton");
9
9
  const CoralButton = require("./components/CoralButton");
10
10
  const LoopSlide = require("./components/LoopSlide");
11
11
  const WorkFlowNode = require("./components/WorkFlowNode");
12
+ const CustomPagination = require("./components/CustomPagination");
12
13
  const download = require("./utils/download");
13
14
  const filetype = require("./utils/filetype");
14
15
  const formRules = require("./utils/formRules");
@@ -56,6 +57,7 @@ Object.defineProperty(exports, "WorkFlowNode", {
56
57
  get: () => WorkFlowNode.WorkFlowNode
57
58
  });
58
59
  exports.showWorkFlow = WorkFlowNode;
60
+ exports.CustomPagination = CustomPagination;
59
61
  exports.download = download__namespace;
60
62
  exports.fileType = filetype__namespace;
61
63
  exports.FormRules = formRules__namespace;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.2.47",
4
+ "version": "0.2.48",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "ahooks": "^3.7.4",
13
- "antd": "^5.15.1",
13
+ "antd": "^5.27.4",
14
14
  "crypto-js": "^4.2.0",
15
15
  "lodash": "^4.17.21",
16
16
  "pako": "^2.1.0",