@zw-team/react-lib 1.0.5-beta.3 → 1.0.5-beta.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.
@@ -22,6 +22,7 @@ class AccessReport_AccessReport {
22
22
  this.baseUrl = resolveBaseUrl(getServiceURL(void 0, env), mainOrigin);
23
23
  }
24
24
  report(router, page) {
25
+ if ('ark' === this.systemName) return;
25
26
  const params = {
26
27
  system: this.systemName,
27
28
  login_device: this.browserType(),
@@ -36,8 +36,8 @@ const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ..
36
36
  js_cookie.set('$BiEnv', contextValue.env);
37
37
  js_cookie.set('$BiSystem', contextValue.system);
38
38
  initProdEnvWarning(contextValue.env || 'production', contextValue.showProdEnvWarning);
39
- loadSvg(contextValue.system, contextValue.env || 'production', contextValue.mainOrigin);
40
- if (contextValue.needIcon) loadIcon(contextValue.env || 'production', (data)=>{
39
+ if ('ark' !== contextValue.system) loadSvg(contextValue.system, contextValue.env || 'production', contextValue.mainOrigin);
40
+ if (contextValue.needIcon && 'ark' !== contextValue.system) loadIcon(contextValue.env || 'production', (data)=>{
41
41
  updateConfig({
42
42
  iconList: data.data,
43
43
  iconInit: true
@@ -17,6 +17,7 @@
17
17
  justify-content: flex-end;
18
18
  flex-shrink: 0;
19
19
  margin: 0;
20
+ line-height: 16px;
20
21
  max-height: 32px;
21
22
  overflow: hidden;
22
23
  }
@@ -45,6 +46,27 @@
45
46
  width: 100%;
46
47
  }
47
48
 
49
+ .search-item .search-label-select > .ant-select.ant-select-outlined {
50
+ position: relative;
51
+ border-top-right-radius: 0;
52
+ border-bottom-right-radius: 0;
53
+ }
54
+
55
+ .search-item .search-label-select:focus-within {
56
+ z-index: 1;
57
+ }
58
+
59
+ .search-item .search-label-select + .search-item-content .ant-input,
60
+ .search-item
61
+ .search-label-select
62
+ + .search-item-content
63
+ .ant-input-affix-wrapper,
64
+ .search-item .search-label-select + .search-item-content .ant-select-selector,
65
+ .search-item .search-label-select + .search-item-content .ant-picker {
66
+ border-start-start-radius: 0;
67
+ border-end-start-radius: 0;
68
+ }
69
+
48
70
  .search-item-button {
49
71
  width: 100%;
50
72
  flex-shrink: 0;
@@ -56,6 +78,10 @@
56
78
  padding-left: 96px;
57
79
  }
58
80
 
81
+ .search-item-button .search-item-content > * {
82
+ width: auto;
83
+ }
84
+
59
85
  .search-form .search-item:last-child {
60
86
  width: 100%;
61
87
  padding-bottom: 0;
@@ -36,7 +36,7 @@ const LogDetail = (props)=>{
36
36
  isRichText(item) ? /*#__PURE__*/ jsx("div", {
37
37
  className: "operates-info",
38
38
  children: /*#__PURE__*/ jsx(Button, {
39
- type: 'text',
39
+ type: 'link',
40
40
  size: "middle",
41
41
  className: "new",
42
42
  onClick: ()=>handleRichTextLog(item),
@@ -51,7 +51,7 @@ const LogDetail = (props)=>{
51
51
  }),
52
52
  /*#__PURE__*/ jsx("img", {
53
53
  style: {
54
- display: item.old ? 'block' : 'none'
54
+ display: item.old ? void 0 : 'none'
55
55
  },
56
56
  src: arrowImg
57
57
  }),
@@ -14,6 +14,7 @@
14
14
  align-items: center;
15
15
 
16
16
  img {
17
+ display: inline-block;
17
18
  width: 14px;
18
19
  height: 7px;
19
20
  margin: 0 10px;
@@ -24,4 +25,4 @@
24
25
  flex-shrink: 0;
25
26
  }
26
27
  }
27
- }
28
+ }
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
1
  import type { LogProps } from '../types';
3
2
  import './Log.scss';
4
- declare const BiLog: React.ForwardRefExoticComponent<Omit<LogProps, "ref"> & React.RefAttributes<any>>;
3
+ declare const BiLog: import("react").ForwardRefExoticComponent<Omit<LogProps, "ref"> & import("react").RefAttributes<any>>;
5
4
  export default BiLog;
@@ -8,15 +8,17 @@ import { BiForm } from "../../Form/index.js";
8
8
  import { BiFormItem } from "../../FormItem/index.js";
9
9
  import { BiTable } from "../../Table/index.js";
10
10
  import { useConfig } from "../../ConfigProvider/ConfigContext.js";
11
- import request from "../../../utils/request/index.js";
11
+ import request, { SystemType } from "../../../utils/request/index.js";
12
12
  import { useLogTableColumns } from "./useLogTableColumns.js";
13
13
  import "./Log.scss";
14
+ import { BiSearchBlock } from "../../SearchBlock/index.js";
14
15
  const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
15
- const { logId = '', logModel = '', BiLogDialog = false, ...restProps } = props;
16
+ const { logId = '', logModel = '', BiLogDialog = false, className = '' } = props;
16
17
  const { contextValue } = useConfig();
17
18
  const env = contextValue.env || 'production';
18
19
  const system = contextValue.system;
19
20
  const mainOrigin = contextValue.mainOrigin;
21
+ const businessRequest = contextValue.request;
20
22
  const drawerModel = Boolean(logId && logModel);
21
23
  const [tableLoading, setTableLoading] = useState(false);
22
24
  const [tableData, setTableData] = useState([]);
@@ -25,7 +27,6 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
25
27
  const [lastItemId, setLastItemId] = useState('');
26
28
  const [currentApi, setCurrentApi] = useState('/log/getSummary');
27
29
  const [showHistoryBtn, setShowHistoryBtn] = useState(true);
28
- const [tableColums, setTableColums] = useState([]);
29
30
  const contentRef = useRef(null);
30
31
  const [optionsList, setOptionsList] = useState({
31
32
  model: [],
@@ -188,15 +189,16 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
188
189
  };
189
190
  const { drawerTableColums, defaultTableColums } = useLogTableColumns(showMore, fomartOperates, optionsList.model);
190
191
  const initOptions = ()=>{
191
- request({
192
+ const optionsRequest = businessRequest ? businessRequest({
193
+ url: '/systemlog/options',
194
+ method: 'post'
195
+ }) : request({
192
196
  env,
193
- system: 'logcenter',
197
+ system: SystemType.ZHANGQUAN,
194
198
  api: '/systemlog/options',
195
- data: {
196
- system
197
- },
198
199
  mainOrigin
199
- }).then((res)=>{
200
+ });
201
+ optionsRequest.then((res)=>{
200
202
  if (1 === res.status_code) setOptionsList({
201
203
  model: res.data.model,
202
204
  operate_name: res.data.operate_name
@@ -204,155 +206,144 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
204
206
  });
205
207
  };
206
208
  const handlerOpen = ()=>{
207
- if (drawerModel) {
208
- setFormData((prev)=>({
209
- ...prev,
210
- id: logId,
211
- model: [
212
- logModel
213
- ],
214
- object_type: 'id',
215
- operate_time: []
216
- }));
217
- setTableColums(drawerTableColums);
218
- }
209
+ if (drawerModel) setFormData((prev)=>({
210
+ ...prev,
211
+ id: logId,
212
+ model: [
213
+ logModel
214
+ ],
215
+ object_type: 'id',
216
+ operate_time: []
217
+ }));
219
218
  clickSearch();
220
219
  };
221
220
  useImperativeHandle(ref, ()=>({
222
221
  handlerOpen
223
222
  }));
224
223
  useEffect(()=>{
225
- if (drawerModel) setTableColums(drawerTableColums);
226
- else {
227
- setTableColums(defaultTableColums);
224
+ if (!drawerModel) {
228
225
  initOptions();
229
226
  clickSearch();
230
227
  }
231
228
  }, []);
229
+ const tableColums = drawerModel ? drawerTableColums : defaultTableColums;
232
230
  return /*#__PURE__*/ jsxs("div", {
233
231
  ref: contentRef,
234
- className: "content-outer bi-log-table",
232
+ className: `content-outer bi-log-table ${className}`.trim(),
235
233
  children: [
236
- !drawerModel && /*#__PURE__*/ jsx("div", {
237
- className: "block-box search-block-box",
238
- children: /*#__PURE__*/ jsx("div", {
239
- className: "block-content",
240
- children: /*#__PURE__*/ jsxs(BiForm, {
241
- children: [
242
- /*#__PURE__*/ jsx(BiFormItem, {
243
- label: "模块",
244
- children: /*#__PURE__*/ jsx(Select, {
245
- value: formData.model,
246
- onChange: (e)=>handleChangeForm('model', e),
247
- allowClear: true,
248
- mode: "multiple",
249
- placeholder: "请输入",
250
- showSearch: true,
251
- filterOption: true,
252
- options: optionsList.model,
253
- style: {
254
- width: '100%'
255
- },
256
- fieldNames: {
234
+ !drawerModel && /*#__PURE__*/ jsx(BiSearchBlock, {
235
+ children: /*#__PURE__*/ jsxs(BiForm, {
236
+ children: [
237
+ /*#__PURE__*/ jsx(BiFormItem, {
238
+ label: "模块",
239
+ children: /*#__PURE__*/ jsx(Select, {
240
+ value: formData.model,
241
+ onChange: (e)=>handleChangeForm('model', e),
242
+ allowClear: true,
243
+ mode: "multiple",
244
+ placeholder: "请输入",
245
+ showSearch: true,
246
+ filterOption: true,
247
+ maxTagCount: 1,
248
+ options: optionsList.model,
249
+ style: {
250
+ width: '100%'
251
+ },
252
+ fieldNames: {
253
+ value: 'id'
254
+ }
255
+ })
256
+ }),
257
+ /*#__PURE__*/ jsx(BiFormItem, {
258
+ label: "操作",
259
+ children: /*#__PURE__*/ jsx(Select, {
260
+ value: formData.operate_name,
261
+ onChange: (e)=>handleChangeForm('operate_name', e),
262
+ allowClear: true,
263
+ mode: "multiple",
264
+ placeholder: "请输入",
265
+ showSearch: true,
266
+ filterOption: true,
267
+ maxTagCount: 1,
268
+ options: optionsList.operate_name,
269
+ style: {
270
+ width: '100%'
271
+ },
272
+ fieldNames: {
273
+ value: 'id'
274
+ }
275
+ })
276
+ }),
277
+ /*#__PURE__*/ jsx(BiFormItem, {
278
+ label: "操作人",
279
+ children: /*#__PURE__*/ jsx(Input, {
280
+ value: formData.operator,
281
+ onChange: (e)=>handleChangeForm('operator', e.target.value),
282
+ placeholder: "请输入内容",
283
+ allowClear: true
284
+ })
285
+ }),
286
+ /*#__PURE__*/ jsx(BiFormItem, {
287
+ label: /*#__PURE__*/ jsx(Select, {
288
+ value: formData.object_type,
289
+ onChange: (e)=>handleChangeForm('object_type', e),
290
+ placeholder: "请选择",
291
+ options: [
292
+ {
293
+ label: '对象ID',
257
294
  value: 'id'
258
- }
259
- })
260
- }),
261
- /*#__PURE__*/ jsx(BiFormItem, {
262
- label: "操作",
263
- children: /*#__PURE__*/ jsx(Select, {
264
- value: formData.operate_name,
265
- onChange: (e)=>handleChangeForm('operate_name', e),
266
- allowClear: true,
267
- mode: "multiple",
268
- placeholder: "请输入",
269
- showSearch: true,
270
- filterOption: true,
271
- options: optionsList.operate_name,
272
- style: {
273
- width: '100%'
274
295
  },
275
- fieldNames: {
276
- value: 'id'
296
+ {
297
+ label: '对象名称',
298
+ value: 'name'
277
299
  }
278
- })
279
- }),
280
- /*#__PURE__*/ jsx(BiFormItem, {
281
- label: "操作人",
282
- children: /*#__PURE__*/ jsx(Input, {
283
- value: formData.operator,
284
- onChange: (e)=>handleChangeForm('operator', e.target.value),
285
- placeholder: "请输入内容",
286
- allowClear: true
287
- })
300
+ ]
288
301
  }),
289
- /*#__PURE__*/ jsx(BiFormItem, {
290
- label: /*#__PURE__*/ jsx(Select, {
291
- value: formData.object_type,
292
- onChange: (e)=>handleChangeForm('object_type', e),
293
- placeholder: "请选择",
294
- options: [
295
- {
296
- label: '对象ID',
297
- value: 'id'
298
- },
299
- {
300
- label: '对象名称',
301
- value: 'name'
302
- }
303
- ],
304
- styles: {
305
- root: {
306
- borderRadius: '4px 0 0 4px'
307
- }
308
- }
302
+ children: /*#__PURE__*/ jsx(Input, {
303
+ value: formData.id,
304
+ onChange: (e)=>handleChangeForm('id', e.target.value),
305
+ placeholder: "请输入内容",
306
+ allowClear: true
307
+ })
308
+ }),
309
+ /*#__PURE__*/ jsx(BiFormItem, {
310
+ label: "操作日期",
311
+ children: /*#__PURE__*/ jsx(BiDatePicker, {
312
+ isRange: true,
313
+ value: formData.operate_time,
314
+ showTime: {
315
+ defaultOpenValue: [
316
+ dayjs('00:00:00', 'HH:mm:ss'),
317
+ dayjs('23:59:59', 'HH:mm:ss')
318
+ ]
319
+ },
320
+ format: 'YYYY-MM-DD HH:mm:ss',
321
+ placeholder: [
322
+ '开始日期',
323
+ '结束日期'
324
+ ],
325
+ onChange: (e)=>handleChangeForm('operate_time', e)
326
+ })
327
+ }),
328
+ /*#__PURE__*/ jsxs(BiFormItem, {
329
+ button: true,
330
+ children: [
331
+ /*#__PURE__*/ jsx(Button, {
332
+ type: "primary",
333
+ loading: tableLoading,
334
+ onClick: clickSearch,
335
+ children: "查询"
309
336
  }),
310
- children: /*#__PURE__*/ jsx(Input, {
311
- value: formData.id,
312
- onChange: (e)=>handleChangeForm('id', e.target.value),
313
- placeholder: "请输入内容",
314
- allowClear: true
315
- })
316
- }),
317
- /*#__PURE__*/ jsx(BiFormItem, {
318
- label: "操作日期",
319
- children: /*#__PURE__*/ jsx(BiDatePicker, {
320
- isRange: true,
321
- value: formData.operate_time,
322
- showTime: {
323
- defaultOpenValue: [
324
- dayjs('00:00:00', 'HH:mm:ss'),
325
- dayjs('23:59:59', 'HH:mm:ss')
326
- ]
337
+ /*#__PURE__*/ jsx(Button, {
338
+ onClick: reset,
339
+ style: {
340
+ marginLeft: '10px'
327
341
  },
328
- format: 'YYYY-MM-DD HH:mm:ss',
329
- placeholder: [
330
- '开始日期',
331
- '结束日期'
332
- ],
333
- onChange: (e)=>handleChangeForm('operate_time', e)
342
+ children: "重置"
334
343
  })
335
- }),
336
- /*#__PURE__*/ jsxs(BiFormItem, {
337
- button: true,
338
- children: [
339
- /*#__PURE__*/ jsx(Button, {
340
- type: "primary",
341
- loading: tableLoading,
342
- onClick: clickSearch,
343
- children: "查询"
344
- }),
345
- /*#__PURE__*/ jsx(Button, {
346
- onClick: reset,
347
- style: {
348
- marginLeft: '10px'
349
- },
350
- children: "重置"
351
- })
352
- ]
353
- })
354
- ]
355
- })
344
+ ]
345
+ })
346
+ ]
356
347
  })
357
348
  }),
358
349
  /*#__PURE__*/ jsxs(BiBlock, {
@@ -372,7 +363,7 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
372
363
  type: "link",
373
364
  loading: loadingMore,
374
365
  onClick: loadNext,
375
- children: '/log/getSummary' === currentApi ? '查询更多' : '查看历史'
366
+ children: loadingMore ? '加载中...' : '/log/getSummary' === currentApi ? '查询更多' : '查看历史'
376
367
  })
377
368
  })
378
369
  ]
@@ -11,6 +11,7 @@
11
11
  }
12
12
 
13
13
  .content-table {
14
+ box-sizing: border-box;
14
15
  width: 100%;
15
16
  padding: 15px;
16
17
  }
@@ -22,8 +23,7 @@
22
23
  }
23
24
  .log-table {
24
25
  border-radius: 0;
25
- padding-top: 20px;
26
- .cell {
26
+ .ant-table-cell {
27
27
  p,
28
28
  div {
29
29
  margin: 0;
@@ -38,7 +38,7 @@ const useLogTableColumns = (showMoreFn, fomartOperates, modelOptions = [])=>{
38
38
  /*#__PURE__*/ jsx("div", {
39
39
  className: 'log-more',
40
40
  children: /*#__PURE__*/ jsxs(Button, {
41
- type: 'text',
41
+ type: 'link',
42
42
  onClick: ()=>{
43
43
  showMoreFn(row);
44
44
  },
@@ -123,7 +123,7 @@ const useLogTableColumns = (showMoreFn, fomartOperates, modelOptions = [])=>{
123
123
  /*#__PURE__*/ jsx("div", {
124
124
  className: 'log-more',
125
125
  children: /*#__PURE__*/ jsxs(Button, {
126
- type: 'text',
126
+ type: 'link',
127
127
  onClick: ()=>{
128
128
  showMoreFn(row);
129
129
  },
@@ -1,5 +1,6 @@
1
1
  export interface LogProps {
2
2
  logId?: string | number;
3
3
  logModel?: string;
4
+ className?: string;
4
5
  [key: string]: any;
5
6
  }
@@ -1,13 +1,16 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import "./logbutton.css";
3
3
  import { Button } from "antd";
4
+ import { useBiLog } from "../LogDialog/index.js";
4
5
  const LogButton = ({ type = 'text', logId = '', logModel = '', className, onLog })=>{
6
+ const { openDrawer } = useBiLog();
5
7
  const handleLog = ()=>{
6
8
  const payload = {
7
9
  id: logId,
8
10
  model: logModel
9
11
  };
10
- if (onLog) onLog(payload);
12
+ openDrawer(payload);
13
+ onLog?.(payload);
11
14
  };
12
15
  return /*#__PURE__*/ jsx("div", {
13
16
  className: [
@@ -15,10 +18,8 @@ const LogButton = ({ type = 'text', logId = '', logModel = '', className, onLog
15
18
  className
16
19
  ].filter(Boolean).join(' '),
17
20
  children: 'button' === type ? /*#__PURE__*/ jsx(Button, {
18
- type: "text",
19
- className: "a-button",
21
+ type: "link",
20
22
  onClick: handleLog,
21
- block: true,
22
23
  children: "日志"
23
24
  }) : /*#__PURE__*/ jsx("span", {
24
25
  onClick: handleLog,
@@ -2,7 +2,6 @@
2
2
  display: block;
3
3
  }
4
4
 
5
- .bi-log-button .a-button,
6
5
  .bi-log-button span {
7
6
  width: 100%;
8
7
  text-align: left;
@@ -1,10 +1,11 @@
1
1
  export interface LogButtonProps {
2
2
  type?: 'button' | 'text';
3
- logId?: string;
3
+ logId?: string | number;
4
4
  logModel?: string;
5
5
  className?: string;
6
+ /** 日志 Drawer 打开后的附加回调。 */
6
7
  onLog?: (payload: {
7
- id: string;
8
+ id: string | number;
8
9
  model: string;
9
10
  }) => void;
10
11
  }
@@ -1,3 +1,4 @@
1
+ import type { BiLogDialogConfig } from './types';
1
2
  interface BiLogReturn {
2
3
  close: () => void;
3
4
  }
@@ -5,9 +6,10 @@ declare class BiLogManager {
5
6
  private static instance;
6
7
  private constructor();
7
8
  static getInstance(): BiLogManager;
8
- openDrawer({ logId, logModel, }: {
9
- logId?: string;
9
+ openDrawer({ logId, logModel, configContext, }: {
10
+ logId?: string | number;
10
11
  logModel?: string;
12
+ configContext?: BiLogDialogConfig['configContext'];
11
13
  }): BiLogReturn;
12
14
  openRichText({ newContent, oldContent, }: {
13
15
  newContent?: string;
@@ -16,8 +18,8 @@ declare class BiLogManager {
16
18
  closeAll(): void;
17
19
  }
18
20
  export declare const useBiLog: () => {
19
- openDrawer: ({ id, model }: {
20
- id?: string;
21
+ openDrawer: ({ id, model, }: {
22
+ id?: string | number;
21
23
  model?: string;
22
24
  }) => BiLogReturn;
23
25
  openRichText: ({ newContent, oldContent, }: {
@@ -1,5 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { createRoot } from "react-dom/client";
3
+ import { useConfig } from "../ConfigProvider/ConfigContext.js";
3
4
  import LogDialog from "./LogDialog.js";
4
5
  const activeInstances = [];
5
6
  const createPopupInstance = (config)=>{
@@ -32,10 +33,11 @@ class BiLogManager {
32
33
  if (!BiLogManager.instance) BiLogManager.instance = new BiLogManager();
33
34
  return BiLogManager.instance;
34
35
  }
35
- openDrawer({ logId = '', logModel = '' }) {
36
+ openDrawer({ logId = '', logModel = '', configContext }) {
36
37
  const config = {
37
38
  logId,
38
- logModel
39
+ logModel,
40
+ configContext
39
41
  };
40
42
  return createPopupInstance(config);
41
43
  }
@@ -61,10 +63,13 @@ class BiLogManager {
61
63
  }
62
64
  }
63
65
  const biLogManager = BiLogManager.getInstance();
64
- const useBiLog = ()=>({
66
+ const useBiLog = ()=>{
67
+ const configContext = useConfig();
68
+ return {
65
69
  openDrawer: ({ id = '', model = '' })=>biLogManager.openDrawer({
66
70
  logId: id,
67
- logModel: model
71
+ logModel: model,
72
+ configContext
68
73
  }),
69
74
  openRichText: ({ newContent = '', oldContent = '' })=>biLogManager.openRichText({
70
75
  newContent,
@@ -73,6 +78,7 @@ const useBiLog = ()=>({
73
78
  closeAll: ()=>{
74
79
  biLogManager.closeAll();
75
80
  }
76
- });
81
+ };
82
+ };
77
83
  const LogDialog_BiLogManager = BiLogManager;
78
84
  export { LogDialog_BiLogManager as default, useBiLog };
@@ -1,19 +1,64 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { ConfigProvider, Drawer, Modal } from "antd";
3
- import { useRef, useState } from "react";
3
+ import { useEffect, useRef, useState } from "react";
4
4
  import { theme } from "../../config/theme/index.js";
5
+ import { ConfigContext, defaultConfig } from "../ConfigProvider/ConfigContext.js";
5
6
  import { BiLog } from "../Log/index.js";
6
7
  import "./LogDialog.scss";
8
+ const bodyScrollLocks = new WeakMap();
9
+ const getOutermostAccessibleBody = ()=>{
10
+ let currentWindow = window;
11
+ try {
12
+ while(currentWindow.parent !== currentWindow){
13
+ currentWindow.parent.document.body;
14
+ currentWindow = currentWindow.parent;
15
+ }
16
+ } catch {}
17
+ return currentWindow.document.body;
18
+ };
19
+ const lockBodyScroll = (body)=>{
20
+ const currentLock = bodyScrollLocks.get(body);
21
+ if (currentLock) {
22
+ currentLock.count += 1;
23
+ return;
24
+ }
25
+ bodyScrollLocks.set(body, {
26
+ count: 1,
27
+ overflow: body.style.overflow
28
+ });
29
+ body.style.overflow = 'hidden';
30
+ };
31
+ const unlockBodyScroll = (body)=>{
32
+ const currentLock = bodyScrollLocks.get(body);
33
+ if (!currentLock) return;
34
+ currentLock.count -= 1;
35
+ if (currentLock.count > 0) return;
36
+ body.style.overflow = currentLock.overflow;
37
+ bodyScrollLocks.delete(body);
38
+ };
7
39
  const BiLogDialog = ({ config, onClose })=>{
8
- const { logId = '', logModel = '', richTextData = '' } = config;
40
+ const { logId = '', logModel = '', richTextData = '', configContext = defaultConfig } = config;
9
41
  const [drawerVisible, setDrawerVisible] = useState(!!logId);
10
42
  const [dialogVisible, setDialogVisible] = useState(!!richTextData);
11
- const [dialogData, setDialogData] = useState(config.richTextData || {
43
+ const [dialogData] = useState(config.richTextData || {
12
44
  new: '',
13
45
  old: ''
14
46
  });
15
47
  const [arrowImg] = useState('https://wanxiaomeng-1255977238.file.myqcloud.com/bi-element-ui/Log/arrow.png');
16
48
  const biLogRef = useRef(null);
49
+ useEffect(()=>{
50
+ if (!drawerVisible) return;
51
+ const bodies = Array.from(new Set([
52
+ document.body,
53
+ getOutermostAccessibleBody()
54
+ ]));
55
+ bodies.forEach(lockBodyScroll);
56
+ return ()=>{
57
+ bodies.forEach(unlockBodyScroll);
58
+ };
59
+ }, [
60
+ drawerVisible
61
+ ]);
17
62
  const onCloseDrawer = ()=>{
18
63
  setDrawerVisible(false);
19
64
  onClose();
@@ -25,81 +70,95 @@ const BiLogDialog = ({ config, onClose })=>{
25
70
  setDialogVisible(false);
26
71
  onClose();
27
72
  };
28
- return /*#__PURE__*/ jsxs(ConfigProvider, {
29
- theme: theme,
30
- children: [
31
- /*#__PURE__*/ jsx(Drawer, {
32
- title: "日志",
33
- size: 900,
34
- className: "bi-log-drawer",
35
- closable: {
36
- disabled: true,
37
- placement: 'end'
38
- },
39
- onClose: onCloseDrawer,
40
- afterOpenChange: onOpenDrawer,
41
- open: drawerVisible,
42
- children: /*#__PURE__*/ jsx(BiLog, {
43
- ref: biLogRef,
44
- logId: logId,
45
- logModel: logModel,
46
- BiLogDialog: 1
47
- })
48
- }),
49
- /*#__PURE__*/ jsxs(Modal, {
50
- title: "详情",
51
- width: 1354,
52
- footer: null,
53
- onCancel: handleDialogClose,
54
- open: dialogVisible,
55
- styles: {
56
- container: {
57
- height: 'calc(100vh - 160px)',
58
- maxWidth: '80%'
73
+ return /*#__PURE__*/ jsx(ConfigContext.Provider, {
74
+ value: configContext,
75
+ children: /*#__PURE__*/ jsxs(ConfigProvider, {
76
+ theme: theme,
77
+ children: [
78
+ /*#__PURE__*/ jsx(Drawer, {
79
+ title: "日志",
80
+ size: 900,
81
+ className: "bi-log-drawer",
82
+ closable: {
83
+ disabled: true,
84
+ placement: 'end'
59
85
  },
60
- body: {
61
- height: 'calc(100vh - 160px - 56px)',
62
- padding: '0'
63
- }
64
- },
65
- children: [
66
- /*#__PURE__*/ jsxs("div", {
67
- className: "bi-log-rich-text-box",
68
- children: [
69
- /*#__PURE__*/ jsx("div", {
70
- style: {
71
- display: dialogData.old ? 'block' : 'none'
72
- },
73
- className: "bi-log-rich-text-item old",
74
- children: /*#__PURE__*/ jsx("div", {
75
- dangerouslySetInnerHTML: {
76
- __html: dialogData.old || ''
77
- }
78
- })
79
- }),
80
- /*#__PURE__*/ jsx("div", {
81
- className: "bi-log-rich-text-item new",
82
- children: /*#__PURE__*/ jsx("div", {
83
- dangerouslySetInnerHTML: {
84
- __html: dialogData.new || ''
85
- }
86
+ onClose: onCloseDrawer,
87
+ afterOpenChange: onOpenDrawer,
88
+ open: drawerVisible,
89
+ styles: {
90
+ header: {
91
+ boxSizing: 'border-box',
92
+ flex: '0 0 50px',
93
+ height: 50,
94
+ padding: '0 20px'
95
+ },
96
+ body: {
97
+ padding: 0
98
+ }
99
+ },
100
+ children: /*#__PURE__*/ jsx(BiLog, {
101
+ ref: biLogRef,
102
+ logId: logId,
103
+ logModel: logModel,
104
+ BiLogDialog: 1
105
+ })
106
+ }),
107
+ /*#__PURE__*/ jsxs(Modal, {
108
+ title: "详情",
109
+ width: 1354,
110
+ footer: null,
111
+ onCancel: handleDialogClose,
112
+ open: dialogVisible,
113
+ styles: {
114
+ container: {
115
+ height: 'calc(100vh - 160px)',
116
+ maxWidth: '80%'
117
+ },
118
+ body: {
119
+ height: 'calc(100vh - 160px - 56px)',
120
+ padding: '0'
121
+ }
122
+ },
123
+ children: [
124
+ /*#__PURE__*/ jsxs("div", {
125
+ className: "bi-log-rich-text-box",
126
+ children: [
127
+ /*#__PURE__*/ jsx("div", {
128
+ style: {
129
+ display: dialogData.old ? 'block' : 'none'
130
+ },
131
+ className: "bi-log-rich-text-item old",
132
+ children: /*#__PURE__*/ jsx("div", {
133
+ dangerouslySetInnerHTML: {
134
+ __html: dialogData.old || ''
135
+ }
136
+ })
137
+ }),
138
+ /*#__PURE__*/ jsx("div", {
139
+ className: "bi-log-rich-text-item new",
140
+ children: /*#__PURE__*/ jsx("div", {
141
+ dangerouslySetInnerHTML: {
142
+ __html: dialogData.new || ''
143
+ }
144
+ })
86
145
  })
146
+ ]
147
+ }),
148
+ /*#__PURE__*/ jsx("div", {
149
+ style: {
150
+ display: dialogData.old ? 'block' : 'none'
151
+ },
152
+ className: "arrow",
153
+ children: /*#__PURE__*/ jsx("img", {
154
+ src: arrowImg,
155
+ alt: ''
87
156
  })
88
- ]
89
- }),
90
- /*#__PURE__*/ jsx("div", {
91
- style: {
92
- display: dialogData.old ? 'block' : 'none'
93
- },
94
- className: "arrow",
95
- children: /*#__PURE__*/ jsx("img", {
96
- src: arrowImg,
97
- alt: ''
98
157
  })
99
- })
100
- ]
101
- })
102
- ]
158
+ ]
159
+ })
160
+ ]
161
+ })
103
162
  });
104
163
  };
105
164
  const LogDialog = BiLogDialog;
@@ -1,3 +1,12 @@
1
+ .bi-log-drawer {
2
+ .ant-drawer-header {
3
+ box-sizing: border-box;
4
+ flex: 0 0 50px;
5
+ height: 50px;
6
+ padding: 0 20px;
7
+ }
8
+ }
9
+
1
10
  .bi-log-rich-text-box {
2
11
  height: calc(100vh - 160px - 56px);
3
12
  display: flex;
@@ -26,4 +35,4 @@
26
35
  width: 100%;
27
36
  height: 100%;
28
37
  }
29
- }
38
+ }
@@ -1,6 +1,8 @@
1
+ import type { ConfigProviderValue } from '../ConfigProvider';
1
2
  export interface BiLogDialogConfig {
2
- logId?: string;
3
+ logId?: string | number;
3
4
  logModel?: string;
5
+ configContext?: ConfigProviderValue;
4
6
  richTextData?: {
5
7
  new: string;
6
8
  old: string;
@@ -18,7 +18,7 @@ const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, systemLink =
18
18
  const [downloadStatus, setDownloadStatus] = useState(false);
19
19
  const isMounted = useRef(true);
20
20
  const WebSocketInit = useCallback(async ()=>{
21
- if (!isMounted.current) return;
21
+ if (!isMounted.current || 'ark' === system) return;
22
22
  try {
23
23
  const res = await request({
24
24
  env,
@@ -135,7 +135,7 @@ const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, systemLink =
135
135
  systemLink && /*#__PURE__*/ jsx("div", {
136
136
  className: "divider"
137
137
  }),
138
- systemLink && /*#__PURE__*/ jsx(BiSystemLink, {})
138
+ systemLink && 'ark' !== system && /*#__PURE__*/ jsx(BiSystemLink, {})
139
139
  ]
140
140
  });
141
141
  };
@@ -1,7 +1,7 @@
1
1
  const theme = {
2
2
  token: {
3
- colorPrimary: "#00bf8a",
4
- colorInfo: "#00bf8a"
3
+ colorPrimary: '#00bf8a',
4
+ colorInfo: '#00bf8a'
5
5
  },
6
6
  components: {
7
7
  Drawer: {
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@zw-team/react-lib",
3
+ "version": "1.0.5-beta.5",
4
+ "description": "zw-team 业务组件库,基于 React + Ant Design,提供通用组件、Hooks 与工具函数",
5
+ "keywords": [
6
+ "react",
7
+ "antd",
8
+ "components",
9
+ "hooks",
10
+ "utils",
11
+ "zw-team"
12
+ ],
13
+ "author": "zw-team",
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "http://git.wozhangwan.com/frontend/react-components.git"
18
+ },
19
+ "homepage": "http://git.wozhangwan.com/frontend/react-components",
20
+ "type": "module",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./index.d.ts",
24
+ "import": "./index.js"
25
+ },
26
+ "./components": {
27
+ "types": "./components/index.d.ts",
28
+ "import": "./components/index.js"
29
+ },
30
+ "./hooks": {
31
+ "types": "./hooks/index.d.ts",
32
+ "import": "./hooks/index.js"
33
+ },
34
+ "./utils": {
35
+ "types": "./utils/index.d.ts",
36
+ "import": "./utils/index.js"
37
+ },
38
+ "./config": {
39
+ "types": "./config/index.d.ts",
40
+ "import": "./config/index.js"
41
+ }
42
+ },
43
+ "types": "./index.d.ts",
44
+ "engines": {
45
+ "node": ">=20.0.0"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public",
49
+ "registry": "https://registry.npmjs.org"
50
+ },
51
+ "sideEffects": [
52
+ "**/*.css",
53
+ "**/*.scss"
54
+ ],
55
+ "dependencies": {
56
+ "@braintree/event-emitter": "2.0.2",
57
+ "ali-oss": "^6.23.0",
58
+ "js-cookie": "^3.0.5",
59
+ "md5": "^2.3.0",
60
+ "react-infinite-scroller": "^1.2.6",
61
+ "react-quill-new": "^3.7.0",
62
+ "react-resizable": "^3.0.5",
63
+ "sortablejs": "^1.15.6"
64
+ },
65
+ "peerDependencies": {
66
+ "@ant-design/icons": ">=6.1.0",
67
+ "antd": ">=6.0.0",
68
+ "axios": ">=1.0.0",
69
+ "dayjs": ">=1.11.0",
70
+ "react": ">=18.0.0",
71
+ "react-dom": ">=18.0.0",
72
+ "zustand": ">=5.0.0"
73
+ }
74
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zw-team/react-lib",
3
- "version": "1.0.5-beta.3",
3
+ "version": "1.0.5-beta.5",
4
4
  "description": "zw-team 业务组件库,基于 React + Ant Design,提供通用组件、Hooks 与工具函数",
5
5
  "keywords": [
6
6
  "react",
@@ -56,7 +56,7 @@
56
56
  "**/*.scss"
57
57
  ],
58
58
  "scripts": {
59
- "build": "rslib build",
59
+ "build": "rslib build && node scripts/write-dist-package.mjs",
60
60
  "build:storybook": "storybook build",
61
61
  "check": "biome check --write",
62
62
  "dev": "rslib build --watch",