szld-libs 0.2.3 → 0.2.5

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/lib/index.js CHANGED
@@ -4,12 +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");
8
7
  const antd = require("antd");
9
- const compressionFile = require("./utils/compression-file");
8
+ require("./utils/compression-file");
10
9
  const Demo = () => {
11
- const [form] = antd.Form.useForm();
12
- react.useState([
10
+ antd.Form.useForm();
11
+ const [list, setList] = react.useState([
13
12
  {
14
13
  PNOrderNo: 1,
15
14
  PNName: "未分配",
@@ -29,6 +28,40 @@ const Demo = () => {
29
28
  Remark: ""
30
29
  }
31
30
  ]);
31
+ const columns = [
32
+ {
33
+ dataIndex: "PNOrderNo",
34
+ title: "序号",
35
+ width: 80
36
+ },
37
+ {
38
+ dataIndex: "PNName",
39
+ title: "节点名称"
40
+ },
41
+ {
42
+ dataIndex: "PlanFinishDate",
43
+ title: "预计完成时间",
44
+ editable: true,
45
+ width: 400,
46
+ type: "datePicker",
47
+ valueProps: {
48
+ placeholder: "请输入内容"
49
+ }
50
+ },
51
+ {
52
+ dataIndex: "Remark",
53
+ title: "备注",
54
+ editable: true,
55
+ type: "textarea",
56
+ width: 400,
57
+ valueProps: {
58
+ placeholder: "请输入内容",
59
+ autoSize: {
60
+ minRows: 3
61
+ }
62
+ }
63
+ }
64
+ ];
32
65
  react.useState(
33
66
  Array.from({ length: 1e5 }, (_, key) => ({
34
67
  key,
@@ -37,8 +70,8 @@ const Demo = () => {
37
70
  }))
38
71
  );
39
72
  react.useState(false);
40
- const [file, setFile] = react.useState("");
41
- const [file2, setFile2] = react.useState("");
73
+ react.useState("");
74
+ react.useState("");
42
75
  react.useState([
43
76
  {
44
77
  uid: "-1",
@@ -59,195 +92,21 @@ const Demo = () => {
59
92
  url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
60
93
  }
61
94
  ]);
62
- const handleClick = () => {
63
- main.showWorkFlow({
64
- data: Array(10).fill(0).map((v, index) => ({
65
- id: String(index),
66
- PNName: String(index),
67
- Remark: index,
68
- IsLatest: 2
69
- })),
70
- rowKey: (row) => row.id,
71
- current: "5",
72
- currentIndex: 5,
73
- wrapClassName: "confirmWrapper",
74
- renderContent: selfWorlflowItem
75
- });
76
- };
77
- const selfWorlflowItem = (item, index, currentIndex) => {
78
- let i = 0;
79
- if (index < currentIndex) {
80
- i = 1;
81
- } else if (index === currentIndex) {
82
- i = Number(item.IsLatest) === 2 ? 2 : 3;
95
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100vh" }, children: /* @__PURE__ */ jsxRuntime.jsx(
96
+ main.EditTable,
97
+ {
98
+ columns,
99
+ rowKey: "PNOrderNo",
100
+ onChange: (row) => {
101
+ const index = list.findIndex((v) => v.PNOrderNo === row.PNOrderNo);
102
+ const arr = [...list];
103
+ arr[index] = row;
104
+ setList(arr);
105
+ },
106
+ dataSource: list,
107
+ pagination: false
83
108
  }
84
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
85
- /* @__PURE__ */ jsxRuntime.jsx(
86
- "div",
87
- {
88
- style: {
89
- fontSize: "16px",
90
- color: ["#666", "#333", "#FF0000", "#1864ff"][i],
91
- fontWeight: 400,
92
- marginBottom: "8px"
93
- },
94
- children: item.PNName
95
- }
96
- ),
97
- /* @__PURE__ */ jsxRuntime.jsx(
98
- "div",
99
- {
100
- style: {
101
- display: "flex",
102
- alignItems: "center",
103
- gap: "20px",
104
- fontSize: "14px",
105
- color: "#666"
106
- },
107
- children: item.UpdateTime ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#333", fontWeight: "bold" }, children: [
108
- "实际完成时间: ",
109
- item.UpdateTime
110
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
111
- "预计完成时间: ",
112
- item.PlanFinishDate || "暂无"
113
- ] })
114
- }
115
- ),
116
- item.Remark && /* @__PURE__ */ jsxRuntime.jsx(
117
- "div",
118
- {
119
- style: {
120
- marginTop: "10px",
121
- background: "#ffffff",
122
- border: "4px solid #fafafa",
123
- borderRadius: "2px",
124
- fontSize: "14px",
125
- fontWeight: 400,
126
- color: "#666",
127
- padding: "20px",
128
- wordBreak: "break-all"
129
- },
130
- children: item.Remark
131
- }
132
- )
133
- ] });
134
- };
135
- const onChange = async (e) => {
136
- console.log(e);
137
- const file3 = e.target.files[0];
138
- const base64 = await compressionFile.fileToDataURL(file3);
139
- setFile(base64);
140
- const newFile = await compressionFile.compressionFile(file3, "image/jpeg", 0.2);
141
- console.log(newFile);
142
- const base64_2 = await compressionFile.fileToDataURL(newFile);
143
- setFile2(base64_2);
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
- ),
238
- /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: handleClick, children: "click" }),
239
- /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { type: "file", onChange }),
240
- /* @__PURE__ */ jsxRuntime.jsx(
241
- main.UploadFile,
242
- {
243
- compression: { type: "image/jpeg", quality: 0.2, limit: 300 },
244
- maxSize: 100,
245
- onChange: (info) => console.log(info)
246
- }
247
- ),
248
- /* @__PURE__ */ jsxRuntime.jsx("img", { src: file, style: { width: 400 } }),
249
- /* @__PURE__ */ jsxRuntime.jsx("img", { src: file2, style: { width: 400 } })
250
- ] });
109
+ ) });
251
110
  };
252
111
  ReactDOM.createRoot(document.getElementById("root")).render(
253
112
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(Demo, {}) })
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.2.3",
4
+ "version": "0.2.5",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "clean": "rimraf lib es dist",
9
- "build": "npm run clean && vite build",
10
- "preview": "vite preview"
9
+ "build": "npm run clean && vite build"
11
10
  },
12
11
  "dependencies": {
13
12
  "ahooks": "^3.7.4",