@bit-sun/business-component 4.2.0-alpha.6.8 → 4.2.5-per-alpha.1

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.
Files changed (85) hide show
  1. package/.umirc.ts +14 -10
  2. package/dist/components/Business/AddSelectBusiness/index.d.ts +3 -4
  3. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -2
  4. package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +1 -2
  5. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
  6. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
  7. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
  8. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +1 -2
  9. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +1 -2
  10. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
  11. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +1 -2
  12. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +1 -2
  13. package/dist/components/Business/BsLayouts/index.d.ts +1 -1
  14. package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +19 -8
  15. package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -2
  16. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +9 -17
  17. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +14 -15
  18. package/dist/components/Business/CommodityEntry/index.d.ts +1 -2
  19. package/dist/components/Business/CommonAlert/index.d.ts +1 -2
  20. package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
  21. package/dist/components/Business/DetailPageWrapper/index.d.ts +11 -12
  22. package/dist/components/Business/HomePageWrapper/index.d.ts +1 -2
  23. package/dist/components/Business/ItemPropertySelector/index.d.ts +1 -2
  24. package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +1 -2
  25. package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +1 -2
  26. package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +1 -2
  27. package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +1 -2
  28. package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +1 -2
  29. package/dist/components/Business/PropertyModal/index.d.ts +1 -2
  30. package/dist/components/Business/PropertyModal/propertyGroup.d.ts +1 -1
  31. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  32. package/dist/components/Business/StateFlow/index.d.ts +1 -2
  33. package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
  34. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +6 -6
  35. package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +1 -2
  36. package/dist/components/Business/columnSettingTable/index.d.ts +3 -3
  37. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +3 -3
  38. package/dist/components/Business/columnSettingTable/utils.d.ts +1 -2
  39. package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
  40. package/dist/components/Common/ParagraphCopier/index.d.ts +1 -1
  41. package/dist/components/Common/Section/index.d.ts +1 -1
  42. package/dist/components/Functional/AddSelect/index.d.ts +1 -2
  43. package/dist/components/Functional/AuthButton/index.d.ts +1 -2
  44. package/dist/components/Functional/DataImport/index.d.ts +4 -4
  45. package/dist/components/Functional/DataValidation/index.d.ts +5 -5
  46. package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -2
  47. package/dist/components/Functional/QueryMutipleInput/index.d.ts +1 -2
  48. package/dist/components/Functional/QueryMutipleSelect/index.d.ts +1 -2
  49. package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
  50. package/dist/components/Functional/SearchSelect/utils.d.ts +2 -3
  51. package/dist/components/Functional/TreeSearchSelect/index.d.ts +1 -2
  52. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +1 -1
  53. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +1 -2
  54. package/dist/components/Solution/RuleComponent/Formula.d.ts +1 -2
  55. package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +1 -2
  56. package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +1 -2
  57. package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +1 -2
  58. package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
  59. package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
  60. package/dist/index.d.ts +0 -1
  61. package/dist/index.esm.js +2298 -1646
  62. package/dist/index.js +2290 -1640
  63. package/dist/plugin/TableColumnSetting/index.d.ts +5 -5
  64. package/dist/utils/TableUtils.d.ts +18 -19
  65. package/dist/utils/luckysheetLoader.d.ts +21 -0
  66. package/dist/utils/utils.d.ts +0 -41
  67. package/package.json +1 -1
  68. package/src/components/Business/BsLayouts/index.tsx +485 -129
  69. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +144 -4
  70. package/src/components/Business/BsSulaQueryTable/index.md +120 -0
  71. package/src/components/Business/BsSulaQueryTable/index.tsx +236 -22
  72. package/src/components/Business/BsSulaQueryTable/setting.tsx +232 -17
  73. package/src/components/Business/DetailPageWrapper/index.tsx +30 -27
  74. package/src/components/Business/HomePageWrapper/index.tsx +10 -8
  75. package/src/components/Business/SearchSelect/BusinessUtils.tsx +27 -214
  76. package/src/components/Business/columnSettingTable/index.tsx +6 -7
  77. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +22 -23
  78. package/src/components/Functional/DataImport/index.tsx +76 -3
  79. package/src/components/Functional/DataValidation/index.tsx +81 -3
  80. package/src/index.ts +0 -2
  81. package/src/utils/luckysheetLoader.ts +164 -0
  82. package/src/utils/utils.ts +1 -41
  83. package/dist/components/Business/SystemLog/index.d.ts +0 -78
  84. package/src/components/Business/SystemLog/index.md +0 -37
  85. package/src/components/Business/SystemLog/index.tsx +0 -87
@@ -17,7 +17,8 @@ import {
17
17
  Menu,
18
18
  Tooltip,
19
19
  message,
20
- Upload
20
+ Upload,
21
+ Spin
21
22
  } from 'antd';
22
23
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
23
24
  import {
@@ -31,6 +32,7 @@ import './index.less';
31
32
  import _, { ceil, isNumber } from "lodash"
32
33
  import { judgeIsRequestError } from '@/utils/requestUtils';
33
34
  import { readerXlsxToList } from '@/utils/xlsxUtil';
35
+ import { loadLuckysheet } from '@/utils/luckysheetLoader';
34
36
 
35
37
  // const luckysheet = window.luckysheet;
36
38
 
@@ -154,6 +156,9 @@ class DataValidation extends React.Component {
154
156
  items: [...itemsTemp],
155
157
  resultData: [],
156
158
  errorListCheck: false,
159
+ luckysheetLoading: false,
160
+ luckysheetLoadError: null,
161
+ luckysheetReady: false,
157
162
  };
158
163
  }
159
164
 
@@ -387,9 +392,38 @@ class DataValidation extends React.Component {
387
392
  };
388
393
  };
389
394
 
390
- componentDidMount() {
395
+ async componentDidMount() {
391
396
  this.props.onRef(this);
392
- luckysheet.create(this.setConfig([]));
397
+
398
+ try {
399
+ // 开始加载 luckysheet
400
+ this.setState({ luckysheetLoading: true, luckysheetLoadError: null });
401
+
402
+ // 动态加载 luckysheet 资源
403
+ await loadLuckysheet();
404
+
405
+ // 更新 luckysheet 引用
406
+ luckysheet = window.luckysheet || window.top.luckysheet;
407
+
408
+ if (!luckysheet) {
409
+ throw new Error('Luckysheet 加载失败,请检查网络连接');
410
+ }
411
+
412
+ // 初始化 luckysheet
413
+ luckysheet.create(this.setConfig([]));
414
+
415
+ this.setState({
416
+ luckysheetLoading: false,
417
+ luckysheetReady: true
418
+ });
419
+
420
+ } catch (error) {
421
+ console.error('DataValidation 组件初始化失败:', error);
422
+ this.setState({
423
+ luckysheetLoading: false,
424
+ luckysheetLoadError: error.message || '加载失败'
425
+ });
426
+ }
393
427
  }
394
428
 
395
429
  componentWillUnmount() {
@@ -878,6 +912,50 @@ customSort = (a, b) => {
878
912
  </div>
879
913
 
880
914
  <div style={{ position: 'relative', height: '400px' }}>
915
+ {this.state.luckysheetLoading && (
916
+ <div style={{
917
+ position: 'absolute',
918
+ top: 0,
919
+ left: 0,
920
+ right: 0,
921
+ bottom: 0,
922
+ display: 'flex',
923
+ alignItems: 'center',
924
+ justifyContent: 'center',
925
+ backgroundColor: 'rgba(255, 255, 255, 0.8)',
926
+ zIndex: 1000
927
+ }}>
928
+ <Spin size="large" tip="正在加载 Luckysheet..." />
929
+ </div>
930
+ )}
931
+ {this.state.luckysheetLoadError && (
932
+ <div style={{
933
+ position: 'absolute',
934
+ top: 0,
935
+ left: 0,
936
+ right: 0,
937
+ bottom: 0,
938
+ display: 'flex',
939
+ alignItems: 'center',
940
+ justifyContent: 'center',
941
+ backgroundColor: 'rgba(255, 255, 255, 0.9)',
942
+ zIndex: 1000,
943
+ flexDirection: 'column'
944
+ }}>
945
+ <div style={{ color: 'red', marginBottom: 16 }}>
946
+ 加载失败: {this.state.luckysheetLoadError}
947
+ </div>
948
+ <Button
949
+ type="primary"
950
+ onClick={() => {
951
+ this.setState({ luckysheetLoadError: null });
952
+ this.componentDidMount();
953
+ }}
954
+ >
955
+ 重新加载
956
+ </Button>
957
+ </div>
958
+ )}
881
959
  <div id="luckysheet" style={luckyCss}></div>
882
960
  </div>
883
961
  {!this.props.notValid && !!totalSummary.total && <div className="sheet_table_footer">
package/src/index.ts CHANGED
@@ -48,5 +48,3 @@ export { default as RuleSetter} from './components/Solution/RuleSetter';
48
48
  export { default as ExtendedCollapse } from './components/Common/ExtendedCollapse';
49
49
  export { default as Section } from './components/Common/Section';
50
50
  export { default as ParagraphCopier } from './components/Common/ParagraphCopier';
51
-
52
- export { default as SystemLog } from './components/Business/SystemLog';
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Luckysheet 动态加载器
3
+ * 实现按需加载 luckysheet 的 CSS 和 JS 资源
4
+ */
5
+
6
+ interface LoaderCache {
7
+ loaded: boolean;
8
+ loading: Promise<void> | null;
9
+ }
10
+
11
+ const cache: LoaderCache = {
12
+ loaded: false,
13
+ loading: null
14
+ };
15
+
16
+ // Luckysheet 资源配置
17
+ const LUCKYSHEET_RESOURCES = {
18
+ css: [
19
+ 'https://bitsun-website.oss-cn-shanghai.aliyuncs.com/cdn/dist/plugins/css/pluginsCss.css',
20
+ 'https://bitsun-website.oss-cn-shanghai.aliyuncs.com/cdn/dist/plugins/plugins.css',
21
+ 'https://bitsun-website.oss-cn-shanghai.aliyuncs.com/cdn/dist/css/luckysheet.css',
22
+ 'https://bitsun-website.oss-cn-shanghai.aliyuncs.com/cdn/dist/assets/iconfont/iconfont.css'
23
+ ],
24
+ js: [
25
+ 'https://bitsun-website.oss-cn-shanghai.aliyuncs.com/cdn/dist/plugins/js/plugin.js',
26
+ 'https://bitsun-website.oss-cn-shanghai.aliyuncs.com/cdn/dist/luckysheet.umd.js'
27
+ ]
28
+ };
29
+
30
+ /**
31
+ * 动态加载 CSS 文件
32
+ * @param url CSS 文件 URL
33
+ * @returns Promise
34
+ */
35
+ function loadCSS(url: string): Promise<void> {
36
+ return new Promise((resolve, reject) => {
37
+ // 检查是否已经加载过该 CSS
38
+ const existingLink = document.querySelector(`link[href="${url}"]`);
39
+ if (existingLink) {
40
+ resolve();
41
+ return;
42
+ }
43
+
44
+ const link = document.createElement('link');
45
+ link.rel = 'stylesheet';
46
+ link.type = 'text/css';
47
+ link.href = url;
48
+
49
+ link.onload = () => resolve();
50
+ link.onerror = () => reject(new Error(`Failed to load CSS: ${url}`));
51
+
52
+ document.head.appendChild(link);
53
+ });
54
+ }
55
+
56
+ /**
57
+ * 动态加载 JS 文件
58
+ * @param url JS 文件 URL
59
+ * @returns Promise
60
+ */
61
+ function loadJS(url: string): Promise<void> {
62
+ return new Promise((resolve, reject) => {
63
+ // 检查是否已经加载过该 JS
64
+ const existingScript = document.querySelector(`script[src="${url}"]`);
65
+ if (existingScript) {
66
+ resolve();
67
+ return;
68
+ }
69
+
70
+ const script = document.createElement('script');
71
+ script.type = 'text/javascript';
72
+ script.src = url;
73
+
74
+ script.onload = () => resolve();
75
+ script.onerror = () => reject(new Error(`Failed to load JS: ${url}`));
76
+
77
+ document.head.appendChild(script);
78
+ });
79
+ }
80
+
81
+ /**
82
+ * 检查 luckysheet 是否可用
83
+ * @returns boolean
84
+ */
85
+ function isLuckysheetAvailable(): boolean {
86
+ return typeof window !== 'undefined' &&
87
+ (window as any).luckysheet !== undefined;
88
+ }
89
+
90
+ /**
91
+ * 动态加载 Luckysheet 资源
92
+ * @returns Promise<void>
93
+ */
94
+ export async function loadLuckysheet(): Promise<void> {
95
+ // 如果已经加载完成,直接返回
96
+ if (cache.loaded && isLuckysheetAvailable()) {
97
+ return Promise.resolve();
98
+ }
99
+
100
+ // 如果正在加载中,返回正在进行的 Promise
101
+ if (cache.loading) {
102
+ return cache.loading;
103
+ }
104
+
105
+ // 开始加载
106
+ cache.loading = (async () => {
107
+ try {
108
+ console.log('开始动态加载 Luckysheet 资源...');
109
+
110
+ // 并行加载所有 CSS 文件
111
+ const cssPromises = LUCKYSHEET_RESOURCES.css.map(url => loadCSS(url));
112
+ await Promise.all(cssPromises);
113
+ console.log('Luckysheet CSS 文件加载完成');
114
+
115
+ // 顺序加载 JS 文件(保证依赖顺序)
116
+ for (const url of LUCKYSHEET_RESOURCES.js) {
117
+ await loadJS(url);
118
+ }
119
+ console.log('Luckysheet JS 文件加载完成');
120
+
121
+ // 等待 luckysheet 对象可用
122
+ let retryCount = 0;
123
+ const maxRetries = 50; // 最多等待 5 秒
124
+
125
+ while (!isLuckysheetAvailable() && retryCount < maxRetries) {
126
+ await new Promise(resolve => setTimeout(resolve, 100));
127
+ retryCount++;
128
+ }
129
+
130
+ if (!isLuckysheetAvailable()) {
131
+ throw new Error('Luckysheet 加载超时,请检查网络连接');
132
+ }
133
+
134
+ cache.loaded = true;
135
+ console.log('Luckysheet 动态加载完成');
136
+
137
+ } catch (error) {
138
+ console.error('Luckysheet 加载失败:', error);
139
+ cache.loading = null; // 重置加载状态,允许重试
140
+ throw error;
141
+ }
142
+ })();
143
+
144
+ return cache.loading;
145
+ }
146
+
147
+ /**
148
+ * 重置加载状态(用于测试或强制重新加载)
149
+ */
150
+ export function resetLuckysheetLoader(): void {
151
+ cache.loaded = false;
152
+ cache.loading = null;
153
+ }
154
+
155
+ /**
156
+ * 获取加载状态
157
+ * @returns 加载状态信息
158
+ */
159
+ export function getLuckysheetLoadStatus(): { loaded: boolean; loading: boolean } {
160
+ return {
161
+ loaded: cache.loaded,
162
+ loading: cache.loading !== null
163
+ };
164
+ }
@@ -267,44 +267,4 @@ export const handleConvertResponse = (items: any, total: number): object => {
267
267
 
268
268
  export const noEmptyArray = (targetObj: any) => {
269
269
  return Array.isArray(targetObj) && targetObj.length !== 0;
270
- };
271
-
272
- export const formContainerAndItemLayout = (type: string, title: any, name: string) => {
273
- return type === 'form' ? {
274
- container: {
275
- type: 'card',
276
- props: {
277
- title,
278
- id: Math.random(),
279
- level: 1,
280
- name
281
- },
282
- },
283
- itemLayout: {
284
- span: 8, // span表示每项所占的栅格数
285
- labelCol: {
286
- span: 8,
287
- },
288
- wrapperCol: {
289
- span: 18,
290
- },
291
- },
292
- } : {
293
- container: {
294
- type: 'card',
295
- props: {
296
- title,
297
- id: Math.random(),
298
- level: 1,
299
- bordered: null,
300
- isWhiteCard: true,
301
- name
302
- },
303
- },
304
- itemLayout: {
305
- wrapperCol: {
306
- span: 0,
307
- },
308
- },
309
- }
310
- }
270
+ };
@@ -1,78 +0,0 @@
1
- declare const SystemLog: ({ modeType, code, containerName, renderLogRef, extraParams, }: {
2
- modeType: string;
3
- code: any;
4
- containerName: string;
5
- renderLogRef: object;
6
- extraParams?: object | undefined;
7
- }) => {
8
- initialVisible: boolean;
9
- fields: {
10
- name: string;
11
- label: boolean;
12
- itemLayout: {
13
- span: number;
14
- labelCol: {
15
- span: number;
16
- };
17
- wrapperCol: {
18
- span: number;
19
- };
20
- };
21
- field: (ctx: any) => any;
22
- }[];
23
- container: {
24
- type: string;
25
- props: {
26
- title: any;
27
- id: number;
28
- level: number;
29
- name: string;
30
- bordered?: undefined;
31
- isWhiteCard?: undefined;
32
- };
33
- };
34
- itemLayout: {
35
- span: number;
36
- labelCol: {
37
- span: number;
38
- };
39
- wrapperCol: {
40
- span: number;
41
- };
42
- };
43
- } | {
44
- initialVisible: boolean;
45
- fields: {
46
- name: string;
47
- label: boolean;
48
- itemLayout: {
49
- span: number;
50
- labelCol: {
51
- span: number;
52
- };
53
- wrapperCol: {
54
- span: number;
55
- };
56
- };
57
- field: (ctx: any) => any;
58
- }[];
59
- container: {
60
- type: string;
61
- props: {
62
- title: any;
63
- id: number;
64
- level: number;
65
- bordered: null;
66
- isWhiteCard: boolean;
67
- name: string;
68
- };
69
- };
70
- itemLayout: {
71
- wrapperCol: {
72
- span: number;
73
- };
74
- span?: undefined;
75
- labelCol?: undefined;
76
- };
77
- };
78
- export default SystemLog;
@@ -1,37 +0,0 @@
1
- ---
2
- nav:
3
- title: '组件'
4
- order: 1
5
- group:
6
- title: 业务组件
7
- order: 1
8
- title: 日志组件
9
- order: 1
10
- ---
11
-
12
- # SystemLog
13
-
14
-
15
- ## 日志业务组件
16
-
17
- ```tsx
18
- import React, { useState } from 'react';
19
- import { SystemLog } from '../../../index.ts';
20
-
21
- export default () => {
22
- const [modeType, setModeType] = useState('view');
23
- const renderLogRef = useRef<any>();
24
-
25
- return {
26
- fields: [
27
- SystemLog({
28
- modeType,
29
- code: '123',
30
- containerName: 'Test_Log_Info',
31
- renderLogRef,
32
- extraParams: {},
33
- })
34
- ],
35
- };
36
- };
37
- ```
@@ -1,87 +0,0 @@
1
- import { handleCommonTimeRender } from '@/utils/TableUtils';
2
- import { formContainerAndItemLayout, handleConvertResponse } from '@/utils/utils';
3
- import { Table as BsTable } from 'bssula';
4
- import React from 'react';
5
-
6
- //操作日志
7
- const SystemLog = ({
8
- modeType,
9
- code,
10
- containerName,
11
- renderLogRef = {},
12
- extraParams = {},
13
- }: {
14
- modeType: string,
15
- code: any
16
- containerName: string,
17
- renderLogRef: object,
18
- extraParams?: object,
19
- }) => {
20
- return {
21
- ...formContainerAndItemLayout('table', '操作日志', containerName),
22
- initialVisible: modeType != 'create',
23
- fields: [
24
- {
25
- name: 'table',
26
- label: false,
27
- itemLayout: {
28
- span: 24,
29
- labelCol: {
30
- span: 0,
31
- },
32
- wrapperCol: {
33
- span: 24,
34
- },
35
- },
36
- field: (ctx: any) => {
37
- return code && <BsTable
38
- remoteDataSource={{
39
- url: `/oms-ops/logInfo?qp-businessCode-eq=${code}`,
40
- convertParams: ({ params }: any) => {
41
- return {
42
- pageSize: params.pageSize,
43
- currentPage: params.current,
44
- ...extraParams,
45
- };
46
- },
47
- converter: ({ data }: any) => {
48
- return {
49
- ...handleConvertResponse(data.list, data.total || data.totalCount),
50
- };
51
- },
52
- }}
53
- columns={[
54
- {
55
- title: '操作人',
56
- dataIndex: 'handlerName',
57
- },
58
- {
59
- title: '操作名称',
60
- dataIndex: 'handlerType',
61
- },
62
- {
63
- title: '操作时间',
64
- dataIndex: 'handlerTime',
65
- render: ({ text }: { text: any }) => handleCommonTimeRender(text)
66
- },
67
- {
68
- title: '操作内容',
69
- dataIndex: 'logcontent',
70
- },
71
- ]}
72
- style={{ width: '100%', marginTop: '-16px', padding: '0px' }}
73
- rowKey="id"
74
- scroll={{ x: 'max-content' }}
75
- pagination={{
76
- showTotal: (total: any) => `共 ${total} 条`,
77
- showQuickJumper: true,
78
- hideOnSinglePage: true,
79
- }}
80
- ref={renderLogRef}
81
- />
82
- },
83
- },
84
- ],
85
- }
86
- }
87
- export default SystemLog