szld-libs 0.1.9 → 0.2.0
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.
- package/dist/szld-components.es.js +638 -632
- package/dist/szld-components.umd.js +37 -37
- package/es/components/SearchTable/index.d.ts +2 -0
- package/es/components/SearchTable/index.js +8 -2
- package/es/index.js +96 -3
- package/lib/components/SearchTable/index.d.ts +2 -0
- package/lib/components/SearchTable/index.js +8 -2
- package/lib/index.js +94 -1
- package/package.json +1 -1
|
@@ -4,9 +4,11 @@ import { ColumnType } from "antd/es/table";
|
|
|
4
4
|
import { CreateFormProps } from "../CreateForm";
|
|
5
5
|
export interface TableColumnProps<T> extends ColumnType<T> {
|
|
6
6
|
hidden?: boolean;
|
|
7
|
+
width?: number;
|
|
7
8
|
}
|
|
8
9
|
export interface MTableProps<T> extends Omit<TableProps<T>, "columns"> {
|
|
9
10
|
columns?: TableColumnProps<T>[];
|
|
11
|
+
minColumnWidth?: number;
|
|
10
12
|
}
|
|
11
13
|
export interface SearchTableProps<RecordType> {
|
|
12
14
|
searchProps?: CreateFormProps;
|
|
@@ -8,13 +8,19 @@ const classes = {
|
|
|
8
8
|
};
|
|
9
9
|
function SearchTable(props) {
|
|
10
10
|
const { tableProps = {}, searchProps } = props;
|
|
11
|
-
const { columns = [], ...rest } = tableProps;
|
|
11
|
+
const { columns = [], minColumnWidth = 200, ...rest } = tableProps;
|
|
12
12
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
13
|
searchProps && /* @__PURE__ */ jsx(CreateForm, { hiddenTitle: true, ...searchProps, items: searchProps.items }),
|
|
14
14
|
/* @__PURE__ */ jsx(
|
|
15
15
|
Table,
|
|
16
16
|
{
|
|
17
|
-
columns: columns.filter((v) => !v.hidden),
|
|
17
|
+
columns: columns.filter((v) => !v.hidden).map((v) => ({ ...v, width: v.width || minColumnWidth })),
|
|
18
|
+
scroll: {
|
|
19
|
+
x: columns.filter((v) => !v.hidden).reduce(
|
|
20
|
+
(a, b) => a + (typeof b.width === "number" ? b.width : minColumnWidth),
|
|
21
|
+
0
|
|
22
|
+
)
|
|
23
|
+
},
|
|
18
24
|
...rest,
|
|
19
25
|
className: classNames(classes.table, tableProps == null ? void 0 : tableProps.className),
|
|
20
26
|
pagination: typeof (tableProps == null ? void 0 : tableProps.pagination) === "boolean" ? tableProps.pagination : {
|
package/es/index.js
CHANGED
|
@@ -2,11 +2,12 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import ReactDOM from "react-dom/client";
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
|
-
import { UploadFile, showWorkFlow } from "./main";
|
|
6
|
-
import
|
|
5
|
+
import { BackHeader, AuthButton, SearchTable, UploadFile, showWorkFlow } from "./main";
|
|
6
|
+
import CoralButton from "./components/CoralButton";
|
|
7
|
+
import { Form, Space, Input, Button } from "antd";
|
|
7
8
|
import { fileToDataURL, compressionFile } from "./utils/compression-file";
|
|
8
9
|
const Demo = () => {
|
|
9
|
-
Form.useForm();
|
|
10
|
+
const [form] = Form.useForm();
|
|
10
11
|
useState([
|
|
11
12
|
{
|
|
12
13
|
PNOrderNo: 1,
|
|
@@ -141,6 +142,98 @@ const Demo = () => {
|
|
|
141
142
|
setFile2(base64_2);
|
|
142
143
|
};
|
|
143
144
|
return /* @__PURE__ */ jsxs("div", { style: { height: "100vh" }, children: [
|
|
145
|
+
/* @__PURE__ */ jsx(BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsx("span", { children: "副标题" }) }),
|
|
146
|
+
/* @__PURE__ */ jsx(AuthButton, { type: "primary", children: "按钮1" }),
|
|
147
|
+
/* @__PURE__ */ jsx(CoralButton, { PId: 100, auths: [{ PId: 100 }], children: "123" }),
|
|
148
|
+
/* @__PURE__ */ jsx(
|
|
149
|
+
SearchTable,
|
|
150
|
+
{
|
|
151
|
+
searchProps: {
|
|
152
|
+
items: [
|
|
153
|
+
{
|
|
154
|
+
dataIndex: "name",
|
|
155
|
+
valueProps: {
|
|
156
|
+
placeholder: "名称"
|
|
157
|
+
},
|
|
158
|
+
colProps: {
|
|
159
|
+
span: 6
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
valueType: "custom",
|
|
164
|
+
valueProps: {
|
|
165
|
+
children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
166
|
+
/* @__PURE__ */ jsx(Form.Item, { name: "yzm", noStyle: true, children: /* @__PURE__ */ jsx(Input, { placeholder: "请输入验证码" }) }),
|
|
167
|
+
/* @__PURE__ */ jsx(Button, { children: "发送验证码" })
|
|
168
|
+
] })
|
|
169
|
+
},
|
|
170
|
+
colProps: {
|
|
171
|
+
span: 6
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
dataIndex: "mm",
|
|
176
|
+
valueType: "password",
|
|
177
|
+
colProps: {
|
|
178
|
+
span: 6
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
dataIndex: "pic",
|
|
183
|
+
valueType: "upload",
|
|
184
|
+
valueProps: {
|
|
185
|
+
maxCount: 1
|
|
186
|
+
},
|
|
187
|
+
colProps: {
|
|
188
|
+
span: 12
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
dataIndex: "pic2",
|
|
193
|
+
colProps: {
|
|
194
|
+
span: 12
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
dataIndex: "qwe",
|
|
199
|
+
valueProps: {
|
|
200
|
+
placeholder: "name"
|
|
201
|
+
},
|
|
202
|
+
colProps: {
|
|
203
|
+
span: 12
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
dataIndex: "btns",
|
|
208
|
+
valueType: "btns",
|
|
209
|
+
valueProps: [
|
|
210
|
+
{
|
|
211
|
+
btnType: "submit",
|
|
212
|
+
title: "确定",
|
|
213
|
+
type: "primary",
|
|
214
|
+
onClick: (v) => console.log(v)
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
formProps: { wrapperCol: { span: 24 }, form }
|
|
220
|
+
},
|
|
221
|
+
tableProps: {
|
|
222
|
+
minColumnWidth: 100,
|
|
223
|
+
columns: [
|
|
224
|
+
{ dataIndex: "A", title: "A", width: 100 },
|
|
225
|
+
{ dataIndex: "B", title: "B", width: 200 },
|
|
226
|
+
{ dataIndex: "C", title: "C", width: 200 },
|
|
227
|
+
{ dataIndex: "D", title: "D" },
|
|
228
|
+
{ dataIndex: "E", title: "E", width: 150 },
|
|
229
|
+
{ dataIndex: "F", title: "F", width: 150 }
|
|
230
|
+
],
|
|
231
|
+
pagination: false,
|
|
232
|
+
rowKey: "A",
|
|
233
|
+
dataSource: Array(3).fill(0).map((v, i) => ({ A: i + 1 }))
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
),
|
|
144
237
|
/* @__PURE__ */ jsx(Button, { onClick: handleClick, children: "click" }),
|
|
145
238
|
/* @__PURE__ */ jsx(Input, { type: "file", onChange }),
|
|
146
239
|
/* @__PURE__ */ jsx(
|
|
@@ -4,9 +4,11 @@ import { ColumnType } from "antd/es/table";
|
|
|
4
4
|
import { CreateFormProps } from "../CreateForm";
|
|
5
5
|
export interface TableColumnProps<T> extends ColumnType<T> {
|
|
6
6
|
hidden?: boolean;
|
|
7
|
+
width?: number;
|
|
7
8
|
}
|
|
8
9
|
export interface MTableProps<T> extends Omit<TableProps<T>, "columns"> {
|
|
9
10
|
columns?: TableColumnProps<T>[];
|
|
11
|
+
minColumnWidth?: number;
|
|
10
12
|
}
|
|
11
13
|
export interface SearchTableProps<RecordType> {
|
|
12
14
|
searchProps?: CreateFormProps;
|
|
@@ -9,13 +9,19 @@ const classes = {
|
|
|
9
9
|
};
|
|
10
10
|
function SearchTable(props) {
|
|
11
11
|
const { tableProps = {}, searchProps } = props;
|
|
12
|
-
const { columns = [], ...rest } = tableProps;
|
|
12
|
+
const { columns = [], minColumnWidth = 200, ...rest } = tableProps;
|
|
13
13
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14
14
|
searchProps && /* @__PURE__ */ jsxRuntime.jsx(CreateForm, { hiddenTitle: true, ...searchProps, items: searchProps.items }),
|
|
15
15
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16
16
|
antd.Table,
|
|
17
17
|
{
|
|
18
|
-
columns: columns.filter((v) => !v.hidden),
|
|
18
|
+
columns: columns.filter((v) => !v.hidden).map((v) => ({ ...v, width: v.width || minColumnWidth })),
|
|
19
|
+
scroll: {
|
|
20
|
+
x: columns.filter((v) => !v.hidden).reduce(
|
|
21
|
+
(a, b) => a + (typeof b.width === "number" ? b.width : minColumnWidth),
|
|
22
|
+
0
|
|
23
|
+
)
|
|
24
|
+
},
|
|
19
25
|
...rest,
|
|
20
26
|
className: classNames(classes.table, tableProps == null ? void 0 : tableProps.className),
|
|
21
27
|
pagination: typeof (tableProps == null ? void 0 : tableProps.pagination) === "boolean" ? tableProps.pagination : {
|
package/lib/index.js
CHANGED
|
@@ -4,10 +4,11 @@ const react = require("react");
|
|
|
4
4
|
const ReactDOM = require("react-dom/client");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
6
|
const main = require("./main");
|
|
7
|
+
const CoralButton = require("./components/CoralButton");
|
|
7
8
|
const antd = require("antd");
|
|
8
9
|
const compressionFile = require("./utils/compression-file");
|
|
9
10
|
const Demo = () => {
|
|
10
|
-
antd.Form.useForm();
|
|
11
|
+
const [form] = antd.Form.useForm();
|
|
11
12
|
react.useState([
|
|
12
13
|
{
|
|
13
14
|
PNOrderNo: 1,
|
|
@@ -142,6 +143,98 @@ const Demo = () => {
|
|
|
142
143
|
setFile2(base64_2);
|
|
143
144
|
};
|
|
144
145
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh" }, children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "副标题" }) }),
|
|
147
|
+
/* @__PURE__ */ jsxRuntime.jsx(main.AuthButton, { type: "primary", children: "按钮1" }),
|
|
148
|
+
/* @__PURE__ */ jsxRuntime.jsx(CoralButton, { PId: 100, auths: [{ PId: 100 }], children: "123" }),
|
|
149
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
150
|
+
main.SearchTable,
|
|
151
|
+
{
|
|
152
|
+
searchProps: {
|
|
153
|
+
items: [
|
|
154
|
+
{
|
|
155
|
+
dataIndex: "name",
|
|
156
|
+
valueProps: {
|
|
157
|
+
placeholder: "名称"
|
|
158
|
+
},
|
|
159
|
+
colProps: {
|
|
160
|
+
span: 6
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
valueType: "custom",
|
|
165
|
+
valueProps: {
|
|
166
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
|
|
167
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { name: "yzm", noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { placeholder: "请输入验证码" }) }),
|
|
168
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { children: "发送验证码" })
|
|
169
|
+
] })
|
|
170
|
+
},
|
|
171
|
+
colProps: {
|
|
172
|
+
span: 6
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
dataIndex: "mm",
|
|
177
|
+
valueType: "password",
|
|
178
|
+
colProps: {
|
|
179
|
+
span: 6
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
dataIndex: "pic",
|
|
184
|
+
valueType: "upload",
|
|
185
|
+
valueProps: {
|
|
186
|
+
maxCount: 1
|
|
187
|
+
},
|
|
188
|
+
colProps: {
|
|
189
|
+
span: 12
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
dataIndex: "pic2",
|
|
194
|
+
colProps: {
|
|
195
|
+
span: 12
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
dataIndex: "qwe",
|
|
200
|
+
valueProps: {
|
|
201
|
+
placeholder: "name"
|
|
202
|
+
},
|
|
203
|
+
colProps: {
|
|
204
|
+
span: 12
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
dataIndex: "btns",
|
|
209
|
+
valueType: "btns",
|
|
210
|
+
valueProps: [
|
|
211
|
+
{
|
|
212
|
+
btnType: "submit",
|
|
213
|
+
title: "确定",
|
|
214
|
+
type: "primary",
|
|
215
|
+
onClick: (v) => console.log(v)
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
formProps: { wrapperCol: { span: 24 }, form }
|
|
221
|
+
},
|
|
222
|
+
tableProps: {
|
|
223
|
+
minColumnWidth: 100,
|
|
224
|
+
columns: [
|
|
225
|
+
{ dataIndex: "A", title: "A", width: 100 },
|
|
226
|
+
{ dataIndex: "B", title: "B", width: 200 },
|
|
227
|
+
{ dataIndex: "C", title: "C", width: 200 },
|
|
228
|
+
{ dataIndex: "D", title: "D" },
|
|
229
|
+
{ dataIndex: "E", title: "E", width: 150 },
|
|
230
|
+
{ dataIndex: "F", title: "F", width: 150 }
|
|
231
|
+
],
|
|
232
|
+
pagination: false,
|
|
233
|
+
rowKey: "A",
|
|
234
|
+
dataSource: Array(3).fill(0).map((v, i) => ({ A: i + 1 }))
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
),
|
|
145
238
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: handleClick, children: "click" }),
|
|
146
239
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Input, { type: "file", onChange }),
|
|
147
240
|
/* @__PURE__ */ jsxRuntime.jsx(
|