@zw-team/react-lib 1.0.1 → 1.0.3

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.
@@ -3,9 +3,9 @@ import { Empty, Table, Typography } from "antd";
3
3
  import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
4
4
  import { isNumeric } from "../../utils/index.js";
5
5
  import { TableHeaderEditBox, TableHeaderPopper } from "../TableHeaderPopper/index.js";
6
+ import "./index.scss";
6
7
  import ResizableTitle from "./ResizableTitle.js";
7
8
  import { useHeaderPopper } from "./useHeaderPopper.js";
8
- import "./index.scss";
9
9
  const BiTableContext = /*#__PURE__*/ createContext(null);
10
10
  const useBiTable = ()=>{
11
11
  const context = useContext(BiTableContext);
@@ -31,6 +31,11 @@ const BiTable = (props)=>{
31
31
  if (TableHeaderEditBoxRef.current && headerPopper && headerPopper.editEnabled && prop) TableHeaderEditBoxRef.current.show(prop);
32
32
  };
33
33
  const formatColumns = useMemo(()=>{
34
+ const headerStyle = headerPopper.editEnabled ? {
35
+ display: 'flex',
36
+ alignItems: 'center',
37
+ justifyContent: 'center'
38
+ } : void 0;
34
39
  const formatFn = (columnData)=>{
35
40
  const column = Object.assign({}, columnData);
36
41
  if ('function' == typeof column.width) column.width = column.width();
@@ -38,11 +43,7 @@ const BiTable = (props)=>{
38
43
  const originalTitle = column.title;
39
44
  column.title = 'function' == typeof originalTitle && null != originalTitle ? (props)=>/*#__PURE__*/ jsxs("div", {
40
45
  onDoubleClick: ()=>handleTableHeaderDbClick(column.dataIndex),
41
- style: {
42
- display: 'flex',
43
- alignItems: 'center',
44
- justifyContent: 'center'
45
- },
46
+ style: headerStyle,
46
47
  children: [
47
48
  originalTitle(props),
48
49
  headerPopperType && /*#__PURE__*/ jsx(TableHeaderPopper, {
@@ -51,11 +52,7 @@ const BiTable = (props)=>{
51
52
  ]
52
53
  }) : /*#__PURE__*/ jsxs("div", {
53
54
  onDoubleClick: ()=>handleTableHeaderDbClick(column.dataIndex),
54
- style: {
55
- display: 'flex',
56
- alignItems: 'center',
57
- justifyContent: 'center'
58
- },
55
+ style: headerStyle,
59
56
  children: [
60
57
  originalTitle,
61
58
  headerPopperType && /*#__PURE__*/ jsx(TableHeaderPopper, {
@@ -68,7 +65,8 @@ const BiTable = (props)=>{
68
65
  };
69
66
  return column.map((col)=>formatFn(col));
70
67
  }, [
71
- column
68
+ column,
69
+ headerPopper.editEnabled
72
70
  ]);
73
71
  const formatSticky = useMemo(()=>stickyTop ? {
74
72
  offsetHeader: stickyTop
@@ -91,7 +89,6 @@ const BiTable = (props)=>{
91
89
  } else for(const key in columnMap)pageData.forEach((item)=>{
92
90
  if (item[key] && isNumeric(item[key])) columnMap[key].val += parseFloat(item[key]);
93
91
  });
94
- console.log(columnMap, 123123123);
95
92
  return /*#__PURE__*/ jsx(Table.Summary, {
96
93
  fixed: true,
97
94
  children: /*#__PURE__*/ jsxs(Table.Summary.Row, {
@@ -140,7 +137,10 @@ const BiTable = (props)=>{
140
137
  }
141
138
  },
142
139
  description: /*#__PURE__*/ jsx("div", {
143
- className: "bi-table-empty"
140
+ className: "bi-table-empty",
141
+ style: loading ? {
142
+ backgroundImage: 'none'
143
+ } : void 0
144
144
  })
145
145
  }),
146
146
  ...locale
@@ -2,7 +2,7 @@ export declare const useHeaderPopper: (moduleName?: string) => {
2
2
  popperData: Record<string, unknown>[];
3
3
  editEnabled: boolean;
4
4
  findPopperData: (prop: string) => Record<string, unknown> | undefined;
5
- savePopperData: (params: any) => Promise<unknown>;
5
+ savePopperData: (params: any) => Promise<any>;
6
6
  delPopperItem: (id: string) => Promise<void>;
7
7
  reload: () => Promise<void>;
8
8
  };
@@ -3,7 +3,7 @@ import request from "../../utils/request/index.js";
3
3
  import { getEnv, getSystem } from "../../utils/tools.js";
4
4
  const useHeaderPopper = (moduleName)=>{
5
5
  const [popperData, setPopperData] = useState([]);
6
- const [editEnabled, setEditEnabled] = useState(true);
6
+ const [editEnabled, setEditEnabled] = useState(false);
7
7
  const system = getSystem() || '';
8
8
  const $BiEnv = getEnv() || '';
9
9
  const getPopperList = useCallback(async ()=>{
@@ -36,31 +36,34 @@ const useHeaderPopper = (moduleName)=>{
36
36
  }, [
37
37
  getPopperList
38
38
  ]);
39
- const savePopperData = useCallback(async (params)=>new Promise((resolve, reject)=>{
40
- if (!editEnabled) return void resolve(true);
41
- const obj = {
42
- module: moduleName,
43
- prop: params.prop,
44
- label: '',
45
- content: params.content,
46
- imgs: params.imgs || []
47
- };
48
- if (params.id) obj.id = params.id;
49
- const mockItem = {
50
- update_time: '2025-12-22 19:37:36',
51
- ...obj
52
- };
53
- console.log(mockItem, '保存的数据');
54
- setPopperData((prev)=>[
55
- ...prev.filter((item)=>item.prop !== params.prop),
56
- mockItem
57
- ]);
58
- resolve(true);
59
- }), [
39
+ const savePopperData = useCallback(async (params)=>{
40
+ if (!editEnabled) return true;
41
+ const obj = {
42
+ module: moduleName,
43
+ prop: params.prop,
44
+ label: '',
45
+ content: params.content,
46
+ imgs: params.imgs || []
47
+ };
48
+ if (params.id) obj.id = params.id;
49
+ const res = await request({
50
+ env: $BiEnv,
51
+ system: 'zq',
52
+ api: '/common/table_head/save',
53
+ data: obj,
54
+ headers: {
55
+ System: system,
56
+ Authkey: ''
57
+ }
58
+ });
59
+ if (1 === res.status_code) await getPopperList();
60
+ return res;
61
+ }, [
60
62
  editEnabled,
61
63
  moduleName,
62
64
  $BiEnv,
63
- system
65
+ system,
66
+ getPopperList
64
67
  ]);
65
68
  const delPopperItem = useCallback(async (id)=>{
66
69
  await request({
@@ -3,6 +3,7 @@ import { Button, Form, Modal, Upload, message } from "antd";
3
3
  import { forwardRef, useImperativeHandle, useState } from "react";
4
4
  import react_quill_new from "react-quill-new";
5
5
  import "react-quill-new/dist/quill.snow.css";
6
+ import { ossUpload } from "../../utils/index.js";
6
7
  import { BiIcon } from "../Icon/index.js";
7
8
  import { useBiTable } from "../Table/Table.js";
8
9
  const EditBox_EditBox = /*#__PURE__*/ forwardRef((props, ref)=>{
@@ -75,18 +76,23 @@ const EditBox_EditBox = /*#__PURE__*/ forwardRef((props, ref)=>{
75
76
  };
76
77
  const handleUpload = async (options)=>{
77
78
  const { file, onSuccess, onError, onProgress } = options;
79
+ const uploadConfig = {
80
+ dir: '/'
81
+ };
78
82
  console.log(options, '上传');
79
83
  try {
80
- setTimeout(()=>{
81
- const result = {
82
- url: URL.createObjectURL(file),
83
- id: Date.now().toString(),
84
- name: file.name
85
- };
86
- onSuccess(result, file);
87
- messageApi.success('上传成功');
88
- setUploadLoading(false);
89
- }, 500);
84
+ const progressCallback = (p)=>{
85
+ onProgress(p);
86
+ setUploadLoading(true);
87
+ if (100 * p === 100) {
88
+ setUploadLoading(false);
89
+ message.success('上传成功');
90
+ }
91
+ };
92
+ message.info('上传中');
93
+ const result = await ossUpload(options.file, uploadConfig, progressCallback);
94
+ if (1 === result.status_code) onSuccess(result.data, file);
95
+ else onError(result.data);
90
96
  } catch (error) {
91
97
  console.log(error, '上传失败');
92
98
  }
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import "./TaskCenter.scss";
4
2
  import { Button, Input, Modal, Popover, Table } from "antd";
3
+ import { useEffect, useState } from "react";
5
4
  import { getEnv, getSystem } from "../../utils/tools.js";
6
5
  import { taskList, taskOption } from "./api.js";
6
+ import "./TaskCenter.scss";
7
7
  const TaskCenter_TaskCenter = ({ userId })=>{
8
8
  const [taskNo, setTaskNo] = useState('');
9
9
  const [searchLoading, setSearchLoading] = useState(false);
@@ -36,7 +36,7 @@ const TaskCenter_TaskCenter = ({ userId })=>{
36
36
  setDataSource(res.data.task_list || []);
37
37
  setPageInfo(res.data.page_info);
38
38
  }
39
- } catch (error) {} finally{
39
+ } catch (_errorr) {} finally{
40
40
  setSearchLoading(false);
41
41
  }
42
42
  };
@@ -143,13 +143,17 @@ const TaskCenter_TaskCenter = ({ userId })=>{
143
143
  },
144
144
  children: [
145
145
  /*#__PURE__*/ jsx("span", {
146
- children: item.field
146
+ dangerouslySetInnerHTML: {
147
+ __html: item.field
148
+ }
147
149
  }),
148
150
  /*#__PURE__*/ jsx("span", {
149
151
  children: ":"
150
152
  }),
151
153
  /*#__PURE__*/ jsx("span", {
152
- children: item.value
154
+ dangerouslySetInnerHTML: {
155
+ __html: item.value
156
+ }
153
157
  })
154
158
  ]
155
159
  }, item.field)
@@ -1,368 +1,11 @@
1
1
  export declare const theme: {
2
- components: {
3
- Button: {
4
- algorithm: boolean;
5
- defaultBorderColor: string;
6
- defaultActiveColor: string;
7
- defaultHoverBorderColor: string;
8
- defaultHoverColor: string;
9
- groupBorderColor: string;
10
- blue1: string;
11
- blue2: string;
12
- blue3: string;
13
- blue5: string;
14
- blue6: string;
15
- blue7: string;
16
- borderColorDisabled: string;
17
- defaultActiveBorderColor: string;
18
- textHoverBg: string;
19
- textTextActiveColor: string;
20
- textTextColor: string;
21
- textTextHoverColor: string;
22
- colorBgContainerDisabled: string;
23
- colorBorder: string;
24
- defaultColor: string;
25
- colorBgSolid: string;
26
- colorBgSolidActive: string;
27
- colorBgSolidHover: string;
28
- colorBgTextActive: string;
29
- contentFontSizeSM: number;
30
- paddingInlineSM: number;
31
- paddingInlineLG: number;
32
- paddingInline: number;
33
- };
34
- Layout: {
35
- headerHeight: number;
36
- headerPadding: string;
37
- triggerHeight: number;
38
- zeroTriggerHeight: number;
39
- zeroTriggerWidth: number;
40
- footerPadding: string;
41
- bodyBg: string;
42
- footerBg: string;
43
- lightTriggerColor: string;
44
- headerColor: string;
45
- };
46
- Breadcrumb: {
47
- iconFontSize: number;
48
- lastItemColor: string;
49
- linkColor: string;
50
- separatorColor: string;
51
- linkHoverColor: string;
52
- separatorMargin: number;
53
- fontHeight: number;
54
- colorBgTextHover: string;
55
- itemColor: string;
56
- };
57
- Dropdown: {
58
- controlPaddingHorizontal: number;
59
- controlItemBgHover: string;
60
- paddingBlock: number;
61
- };
62
- Menu: {
63
- iconSize: number;
64
- itemHeight: number;
65
- itemMarginBlock: number;
66
- itemMarginInline: number;
67
- controlHeightLG: number;
68
- darkItemSelectedBg: string;
69
- horizontalItemHoverColor: string;
70
- horizontalItemSelectedColor: string;
71
- itemActiveBg: string;
72
- itemColor: string;
73
- itemHoverColor: string;
74
- itemDisabledColor: string;
75
- itemHoverBg: string;
76
- itemSelectedBg: string;
77
- itemSelectedColor: string;
78
- subMenuItemSelectedColor: string;
79
- subMenuItemBg: string;
80
- groupTitleColor: string;
81
- colorSplit: string;
82
- };
83
- Cascader: {
84
- optionSelectedBg: string;
85
- optionSelectedColor: string;
86
- colorBgContainerDisabled: string;
87
- colorBorder: string;
88
- controlItemBgHover: string;
89
- };
90
- Transfer: {
91
- colorBgContainerDisabled: string;
92
- colorBorder: string;
93
- controlItemBgHover: string;
94
- itemPaddingBlock: number;
95
- listHeight: number;
96
- listWidth: number;
97
- listWidthLG: number;
98
- };
99
- Table: {
100
- headerBorderRadius: number;
101
- headerColor: string;
102
- rowSelectedBg: string;
103
- rowSelectedHoverBg: string;
104
- bodySortBg: string;
105
- borderColor: string;
106
- footerColor: string;
107
- headerBg: string;
108
- headerFilterHoverBg: string;
109
- footerBg: string;
110
- fixedHeaderSortActiveBg: string;
111
- headerSortActiveBg: string;
112
- headerSortHoverBg: string;
113
- headerSplitColor: string;
114
- rowExpandedBg: string;
115
- rowHoverBg: string;
116
- controlItemBgHover: string;
117
- };
118
- Alert: {
119
- marginXS: number;
120
- marginSM: number;
121
- defaultPadding: string;
122
- };
123
- Notification: {
124
- paddingContentHorizontalLG: number;
125
- paddingLG: number;
126
- paddingMD: number;
127
- colorBgTextHover: string;
128
- colorBgTextActive: string;
129
- };
130
- Divider: {
131
- colorSplit: string;
132
- };
133
- Pagination: {
134
- itemActiveBgDisabled: string;
135
- itemActiveColorDisabled: string;
136
- itemActiveBg: string;
137
- colorBgTextHover: string;
138
- marginXS: number;
139
- marginXXS: number;
140
- paddingXS: number;
141
- paddingXXS: number;
142
- marginSM: number;
143
- colorBgContainerDisabled: string;
144
- colorBgTextActive: string;
145
- colorBorder: string;
146
- };
147
- Steps: {
148
- marginXXS: number;
149
- marginXS: number;
150
- marginSM: number;
151
- marginLG: number;
152
- paddingXXS: number;
153
- paddingXS: number;
154
- paddingSM: number;
155
- paddingLG: number;
156
- controlItemBgHover: string;
157
- };
158
- DatePicker: {
159
- activeBorderColor: string;
160
- cellActiveWithRangeBg: string;
161
- hoverBorderColor: string;
162
- cellRangeBorderColor: string;
163
- cellHoverWithRangeBg: string;
164
- multipleItemColorDisabled: string;
165
- multipleSelectorBgDisabled: string;
166
- cellBgDisabled: string;
167
- cellHoverBg: string;
168
- colorBgContainerDisabled: string;
169
- colorBorder: string;
170
- };
171
- Form: {
172
- labelColor: string;
173
- colorBorder: string;
174
- labelColonMarginInlineEnd: number;
175
- };
176
- Input: {
177
- activeBorderColor: string;
178
- hoverBorderColor: string;
179
- colorBgContainerDisabled: string;
180
- colorBorder: string;
181
- };
182
- InputNumber: {
183
- activeBorderColor: string;
184
- handleHoverColor: string;
185
- hoverBorderColor: string;
186
- handleBorderColor: string;
187
- colorBgContainerDisabled: string;
188
- colorBorder: string;
189
- };
190
- Mentions: {
191
- activeBorderColor: string;
192
- hoverBorderColor: string;
193
- colorBgContainerDisabled: string;
194
- controlItemBgHover: string;
195
- };
196
- Radio: {
197
- buttonSolidCheckedActiveBg: string;
198
- buttonSolidCheckedBg: string;
199
- buttonSolidCheckedHoverBg: string;
200
- buttonColor: string;
201
- colorBgContainerDisabled: string;
202
- };
203
- Select: {
204
- activeBorderColor: string;
205
- hoverBorderColor: string;
206
- optionSelectedBg: string;
207
- activeOutlineColor: string;
208
- optionSelectedColor: string;
209
- colorFillSecondary: string;
210
- paddingXXS: number;
211
- paddingXS: number;
212
- paddingSM: number;
213
- colorBgContainerDisabled: string;
214
- multipleItemBg: string;
215
- multipleItemColorDisabled: string;
216
- optionActiveBg: string;
217
- multipleSelectorBgDisabled: string;
218
- colorBorder: string;
219
- };
220
- Calendar: {
221
- itemActiveBg: string;
222
- controlItemBgHover: string;
223
- };
224
- Card: {
225
- extraColor: string;
226
- colorBorderSecondary: string;
227
- };
228
- Descriptions: {
229
- contentColor: string;
230
- extraColor: string;
231
- titleColor: string;
232
- labelColor: string;
233
- colorSplit: string;
234
- };
235
- Segmented: {
236
- itemHoverColor: string;
237
- itemSelectedColor: string;
238
- trackBg: string;
239
- itemHoverBg: string;
240
- itemActiveBg: string;
241
- itemColor: string;
242
- };
243
- Tabs: {
244
- inkBarColor: string;
245
- itemSelectedColor: string;
246
- itemActiveColor: string;
247
- itemHoverColor: string;
248
- itemColor: string;
249
- cardBg: string;
250
- colorBorderSecondary: string;
251
- controlItemBgHover: string;
252
- };
253
- Tag: {
254
- defaultColor: string;
255
- defaultBg: string;
256
- colorFillSecondary: string;
257
- };
258
- Tree: {
259
- directoryNodeSelectedBg: string;
260
- nodeSelectedBg: string;
261
- nodeHoverBg: string;
262
- nodeHoverColor: string;
263
- controlItemBgHover: string;
264
- controlItemBgActiveDisabled: string;
265
- nodeSelectedColor: string;
266
- };
267
- Modal: {
268
- titleColor: string;
269
- colorBgMask: string;
270
- colorBgTextHover: string;
271
- colorBgTextActive: string;
272
- fontHeight: number;
273
- };
274
- Progress: {
275
- defaultColor: string;
276
- circleTextColor: string;
277
- };
278
- Checkbox: {
279
- colorBgContainerDisabled: string;
280
- colorBorder: string;
281
- };
282
- Slider: {
283
- dotActiveBorderColor: string;
284
- handleColor: string;
285
- trackBg: string;
286
- handleActiveColor: string;
287
- handleActiveOutlineColor: string;
288
- trackHoverBg: string;
289
- };
290
- TreeSelect: {
291
- nodeHoverBg: string;
292
- nodeHoverColor: string;
293
- nodeSelectedBg: string;
294
- nodeSelectedColor: string;
295
- colorBgContainerDisabled: string;
296
- colorBgTextHover: string;
297
- controlItemBgHover: string;
298
- controlItemBgActiveDisabled: string;
299
- };
300
- Upload: {
301
- actionsColor: string;
302
- controlItemBgHover: string;
303
- };
304
- Image: {
305
- colorBgContainerDisabled: string;
306
- colorBgMask: string;
307
- };
308
- Tooltip: {
309
- colorBgSpotlight: string;
310
- paddingXS: number;
311
- paddingSM: number;
312
- };
313
- Drawer: {
314
- colorBgMask: string;
315
- colorBgTextActive: string;
316
- colorBgTextHover: string;
317
- };
318
- Spin: {
319
- colorBgMask: string;
320
- };
321
- Popconfirm: {
322
- marginXS: number;
323
- marginXXS: number;
324
- };
325
- Message: {
326
- marginXS: number;
327
- paddingXS: number;
328
- contentPadding: string;
329
- };
330
- };
331
2
  token: {
332
3
  colorPrimary: string;
333
4
  colorInfo: string;
334
- colorBgLayout: string;
335
- colorText: string;
336
- colorTextSecondary: string;
337
- colorTextTertiary: string;
338
- colorTextQuaternary: string;
339
- colorTextBase: string;
340
- paddingXXS: number;
341
- paddingLG: number;
342
- paddingMD: number;
343
- padding: number;
344
- paddingSM: number;
345
- paddingXS: number;
346
- marginXXS: number;
347
- marginXS: number;
348
- marginSM: number;
349
- margin: number;
350
- marginMD: number;
351
- marginLG: number;
352
- marginXL: number;
353
- marginXXL: number;
354
- paddingXL: number;
355
- borderRadius: number;
356
- borderRadiusLG: number;
357
- borderRadiusSM: number;
358
- borderRadiusXS: number;
359
- colorBorderSecondary: string;
360
- colorBorder: string;
361
- colorFill: string;
362
- colorFillSecondary: string;
363
- colorFillTertiary: string;
364
- colorFillQuaternary: string;
365
- colorBgSpotlight: string;
366
- colorBgMask: string;
5
+ };
6
+ components: {
7
+ Drawer: {
8
+ paddingLG: number;
9
+ };
367
10
  };
368
11
  };