beer-assembly-biz 1.1.3-alpha.8 → 1.1.5-beta.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.
@@ -1,422 +0,0 @@
1
- "use strict";
2
- // import React, { FC, ReactNode, useRef, useState } from 'react';
3
- // import { ActionType, ProTable } from '@ant-design/pro-components';
4
- // import { App, Button, ConfigProvider, Divider, Input, message, Popconfirm, Space, theme, Typography } from 'antd';
5
- // import { css } from '@emotion/css';
6
- // import { QuestionCircleOutlined } from '@ant-design/icons';
7
- // import ElementUtils from 'beer-network/elementUtils';
8
- // import { Config } from './config';
9
- // import NetDiskDirectory, { DirectorySelectProps } from './DirectorySelect';
10
- // import FileNavigation from './FileNavigation';
11
- // import MIME from './mime';
12
- // import IconDirectory from './icon/directory.svg';
13
- //
14
- // const { Text } = Typography;
15
- //
16
- // export declare type FileItem = {
17
- // id: string
18
- // icon: ReactNode
19
- // name: string
20
- // size: string
21
- // type: 'FILE' | 'DIRECTORY',
22
- // typeName: string
23
- // createTime?: string | undefined
24
- // updateTime?: string | undefined
25
- // }
26
- // export declare type RootPath = {
27
- // id: string
28
- // title: string
29
- // }
30
- // export declare type FileItemTableProps = {
31
- // request?: {
32
- // getItems?: (params?: { parentId: string } | undefined) => Promise<FileItem[]>
33
- // uploadFile?: (parentId: string, file: File) => Promise<boolean>
34
- // getFileLink?: (fileId: string) => Promise<string | undefined>
35
- // createDirectory?: (parentId: string, name: string) => Promise<boolean>
36
- // rename?: (fileId: string, name: string) => Promise<boolean>
37
- // remove?: (fileId: string[]) => Promise<boolean>
38
- // move?: (fileIdList: string[], targetId: string) => Promise<boolean>
39
- // } | undefined
40
- // directoryProps?: DirectorySelectProps | undefined,
41
- // uploadSize?: number | undefined
42
- // uploadFormat?: string[] | undefined
43
- // uploadFormatMessage?: string | ReactNode | undefined
44
- // };
45
- // const Component: FC<FileItemTableProps> = (props) => {
46
- // const { token } = theme.useToken();
47
- // const tableRef = useRef<ActionType>();
48
- // const [loading, setLoading] = useState(false);
49
- // const [uploadLoading, setUploadLoading] = useState(false);
50
- // const [directoryName, setDirectoryName] = useState('');
51
- // const [newName, setNewName] = useState('');
52
- // const [directoryModal, setDirectoryModal] = useState(false);
53
- // const [selectItemList, setSelectItemList] = useState([] as string[]);
54
- // const [rootPaths, setRootPaths] = useState([{
55
- // id: '',
56
- // title: '根目录'
57
- // }] as RootPath[]);
58
- // const columns = [
59
- // {
60
- // title: '文件名称',
61
- // dataIndex: 'name',
62
- // key: 'name',
63
- // tooltip: <span style={{ fontSize: token.fontSize - 1 }}>双击文件(目录)名称打开</span>,
64
- // render: (_text: any, record: any) => (
65
- // <div style={{
66
- // display: 'flex',
67
- // alignItems: 'center',
68
- // cursor: 'pointer'
69
- // }}>
70
- // {record.icon}
71
- // <div style={{
72
- // width: '100%',
73
- // flex: 1
74
- // }}>
75
- // <Text
76
- // style={{
77
- // width: 510,
78
- // fontSize: token.fontSize
79
- // }}
80
- // ellipsis={{ tooltip: record.name }}>
81
- // <span className={css`
82
- // &:hover {
83
- // text-decoration: underline;
84
- // }
85
- // `} onDoubleClick={() => onOpen(record.id, record.type, record.name)}>
86
- // {record.name}
87
- // </span>
88
- // </Text>
89
- // </div>
90
- // </div>
91
- // )
92
- // },
93
- // {
94
- // title: '文件类型',
95
- // dataIndex: 'type',
96
- // width: 100,
97
- // key: 'type',
98
- // render: (_: any, record: any) => (
99
- // <>
100
- // {record.typeName}
101
- // </>
102
- // )
103
- // },
104
- // {
105
- // title: '大小',
106
- // width: 90,
107
- // dataIndex: 'size',
108
- // key: 'size'
109
- // },
110
- // {
111
- // title: '修改时间',
112
- // dataIndex: 'updateTime',
113
- // width: 165,
114
- // key: 'updateTime'
115
- // }
116
- // ];
117
- //
118
- // const requestTable = async (params: {}): Promise<any> => {
119
- // setLoading(true);
120
- // const result = await props?.request?.getItems?.({
121
- // ...params,
122
- // parentId: rootPaths[rootPaths.length - 1]?.id || ''
123
- // });
124
- // setLoading(false);
125
- // return {
126
- // success: true,
127
- // total: 20,
128
- // data: result?.map(it => {
129
- // if (it.type === 'DIRECTORY') {
130
- // it.icon = <div style={{
131
- // minWidth: 18,
132
- // minHeight: 18,
133
- // marginRight: 6,
134
- // overflow: 'hidden',
135
- // display: 'flex'
136
- // }}>
137
- // <img src={IconDirectory} style={{
138
- // width: 18,
139
- // display: 'block',
140
- // alignItems: 'center'
141
- // }} alt=""/>
142
- // </div>;
143
- // } else {
144
- // const [typeName, icon] = MIME.parse(it.name) || [];
145
- // it.typeName = typeName;
146
- // it.icon = <div style={{
147
- // minWidth: 20,
148
- // minHeight: 20,
149
- // marginRight: 4,
150
- // overflow: 'hidden',
151
- // display: 'flex'
152
- // }}>
153
- // <img src={icon} style={{
154
- // width: 20,
155
- // display: 'block',
156
- // alignItems: 'center'
157
- // }} alt=""/>
158
- // </div>;
159
- // }
160
- // it.size = MIME.formatBytes(Number(it.size));
161
- // return it;
162
- // })
163
- // };
164
- // };
165
- // const onUploadFile = async () => {
166
- // const files = await ElementUtils.selectFile(true);
167
- // if (files === null) {
168
- // return;
169
- // }
170
- // setUploadLoading(true);
171
- // try {
172
- // for (const file of files) {
173
- // if (props?.uploadFormat !== undefined) {
174
- // const fileName = file.name;
175
- // const fileExtension = fileName.split('.')
176
- // ?.pop()
177
- // ?.toLowerCase() || '';
178
- // if (!props.uploadFormat?.includes(fileExtension)) {
179
- // message.error(props?.uploadFormatMessage || `抱歉,文件${file.name}格式不受支持`);
180
- // continue;
181
- // }
182
- // }
183
- // // 文件大小限制
184
- // const limitSize = (props?.uploadSize || 15);
185
- // if (file.size > limitSize * 1024 * 1024) {
186
- // message.error(`抱歉,文件大小超过了限制,请上传小于${limitSize}Mb 的文件`);
187
- // continue;
188
- // }
189
- // message.info(`准备上传文件:${file.name}`);
190
- // setLoading(true);
191
- // // eslint-disable-next-line no-await-in-loop
192
- // const result = await props?.request?.uploadFile?.(rootPaths[rootPaths.length - 1]?.id || '', file);
193
- // setLoading(false);
194
- // if (result !== undefined && result) {
195
- // message.success('您已成功上传文件!');
196
- // tableRef?.current?.reload();
197
- // }
198
- // }
199
- // } finally {
200
- // setUploadLoading(false);
201
- // }
202
- // };
203
- // const onSwitchPath = async (_id: string, index: number) => {
204
- // tableRef?.current?.clearSelected?.();
205
- // setRootPaths(rootPaths.slice(0, index + 1));
206
- // return tableRef?.current?.reload();
207
- // };
208
- // const onOpen = async (fileId: string, type: 'FILE' | 'DIRECTORY', name: string) => {
209
- // if (type === 'FILE') {
210
- // setLoading(true);
211
- // const link = await props?.request?.getFileLink?.(fileId);
212
- // setLoading(false);
213
- // if (link === undefined) {
214
- // return;
215
- // }
216
- // message.info('正在打开文件' + name);
217
- // window.open(link);
218
- // }
219
- // if (type === 'DIRECTORY') {
220
- // setLoading(true);
221
- // setRootPaths([...rootPaths, {
222
- // id: fileId,
223
- // title: name
224
- // }]);
225
- // tableRef?.current?.clearSelected?.();
226
- // await tableRef?.current?.reload();
227
- // setLoading(false);
228
- // }
229
- // };
230
- // const onConfirmCreateDirectory = async () => {
231
- // setLoading(true);
232
- // const result = await props?.request?.createDirectory?.(rootPaths[rootPaths.length - 1]?.id || '', directoryName);
233
- // setLoading(false);
234
- // if (result !== undefined && result) {
235
- // message.success('新目录已成功创建!');
236
- // tableRef?.current?.reload();
237
- // }
238
- // };
239
- // const onConfirmRemove = async (fileIdList: string[]) => {
240
- // setLoading(true);
241
- // const result = await props?.request?.remove?.(fileIdList);
242
- // setLoading(false);
243
- // if (result !== undefined && result) {
244
- // message.success('所有选定的项目已成功删除。');
245
- // tableRef?.current?.clearSelected?.();
246
- // tableRef?.current?.reload();
247
- // }
248
- // };
249
- // const onConfirmRename = async (fileId: string) => {
250
- // setLoading(true);
251
- // const result = await props?.request?.rename?.(fileId, newName);
252
- // setLoading(false);
253
- // if (result !== undefined && result) {
254
- // message.success('名字已成功更改!');
255
- // tableRef?.current?.clearSelected?.();
256
- // tableRef?.current?.reload();
257
- // }
258
- // };
259
- // const onConfirmMove = async (targetId: string) => {
260
- // if (selectItemList.length <= 0) {
261
- // return;
262
- // }
263
- // const result = await props?.request?.move?.(selectItemList, targetId);
264
- // if (result !== undefined && result) {
265
- // message.success('文件或目录移动成功!');
266
- // tableRef?.current?.clearSelected?.();
267
- // tableRef?.current?.reload();
268
- // }
269
- // };
270
- // return <>
271
- // <App>
272
- // <ConfigProvider theme={{
273
- // token: {
274
- // fontSize: token.fontSize
275
- // },
276
- // components: {
277
- // Table: {
278
- // motion: false,
279
- // headerColor: '#333',
280
- // rowHoverBg: '#f5f6f7',
281
- // rowSelectedBg: '#f4f5f6',
282
- // rowSelectedHoverBg: '#e6e7e8'
283
- // },
284
- // Button: {
285
- // fontSize: token.fontSize + 1
286
- // }
287
- // }
288
- // }}>
289
- // <ProTable<FileItem>
290
- // className={css`
291
- // user-select: none;
292
- //
293
- // .ant-pro-table-list-toolbar-container {
294
- // padding: 4px 0 10px 0;
295
- // }
296
- //
297
- // .ant-pro-table-list-toolbar-right {
298
- // flex: 0;
299
- // padding-left: 10px;
300
- // }
301
- //
302
- // .ant-table-thead {
303
- // & .ant-table-cell {
304
- // font-size: 13px;
305
- // padding: 5px !important;
306
- // }
307
- // }
308
- //
309
- // .ant-table-tbody {
310
- // & .ant-table-cell {
311
- // font-size: 13px;
312
- // padding: 5px !important;
313
- // }
314
- // }
315
- //
316
- // .ant-table-body {
317
- // min-height: 380px;
318
- // }
319
- // `}
320
- // actionRef={tableRef}
321
- // loading={loading}
322
- // columns={columns}
323
- // scroll={{
324
- // x: true,
325
- // y: 380
326
- // }}
327
- // rowSelection={{
328
- // selections: false
329
- // }}
330
- // request={requestTable}
331
- // size="small"
332
- // rowKey="id"
333
- // search={false}
334
- // options={false}
335
- // pagination={false}
336
- // headerTitle={<>
337
- // <FileNavigation paths={rootPaths} onSwitchPath={onSwitchPath}/>
338
- // </>}
339
- // tableAlertRender={({
340
- // selectedRowKeys,
341
- // selectedRows,
342
- // onCleanSelected
343
- // }) => {
344
- // return (
345
- // <>
346
- // <span style={{ fontWeight: 600 }}>已选 {selectedRowKeys.length} 项</span>
347
- // <Space size={2} style={{ marginInlineStart: 12 }}>
348
- // <a onClick={onCleanSelected}>
349
- // 取消选择
350
- // </a>
351
- // {selectedRowKeys.length === 1 ? <>
352
- // <Divider type="vertical" style={{ background: '#ddd' }}/>
353
- // <Popconfirm
354
- // placement="bottom"
355
- // title={<span style={{ fontSize: token.fontSize }}>请输入重命名名称</span>}
356
- // onConfirm={() => onConfirmRename(selectedRows[0]?.id)}
357
- // description={<div style={{ padding: '2px' }}>
358
- // <Input placeholder="请输入名称" style={{ fontSize: token.fontSize }} maxLength={230} value={newName} onChange={(e) => setNewName(e.target.value)}/>
359
- // </div>}>
360
- // <a onClick={() => setNewName(selectedRows[0]?.name)}>
361
- // 重命名{selectedRows[0].type === 'FILE' ? '文件' : '目录'}
362
- // </a>
363
- // </Popconfirm>
364
- // </> : undefined}
365
- // </Space>
366
- // </>
367
- // );
368
- // }}
369
- // tableAlertOptionRender={({
370
- // selectedRowKeys,
371
- // selectedRows
372
- // }) => {
373
- // return (
374
- // <Space size={16}>
375
- // <a onClick={() => {
376
- // setDirectoryModal(true);
377
- // setSelectItemList(selectedRowKeys.map(it => it.toString()));
378
- // }}>移动文件</a>
379
- // <Popconfirm
380
- // icon={<QuestionCircleOutlined style={{ color: Config.colors.danger }}/>}
381
- // title={<span style={{
382
- // fontSize: token.fontSize
383
- // }}>确认删除</span>}
384
- // onConfirm={() => onConfirmRemove(selectedRows.map(it => it.id))}
385
- // description={<span style={{ fontSize: token.fontSize }}>您确定要<span style={{
386
- // color: Config.colors.danger,
387
- // fontWeight: 500
388
- // }}>批量删除</span>这{selectedRows.length}个吗?</span>}>
389
- // <a style={{ color: Config.colors.danger }}>批量删除</a>
390
- // </Popconfirm>
391
- // </Space>
392
- // );
393
- // }}
394
- // toolBarRender={() => [<>
395
- // <Space size={5}>
396
- // <Popconfirm
397
- // placement="bottom"
398
- // title={<span style={{ fontSize: token.fontSize }}>请输入目录名称</span>}
399
- // onConfirm={onConfirmCreateDirectory}
400
- // description={<div style={{ padding: '2px' }}>
401
- // <Input placeholder="请输入目录名称" style={{ fontSize: token.fontSize }} maxLength={230} value={directoryName} onChange={(e) => setDirectoryName(e.target.value)}/>
402
- // </div>}>
403
- // <Button type="dashed" onClick={() => setDirectoryName('')}>新建目录</Button>
404
- // </Popconfirm>
405
- // <Divider type="vertical" style={{ background: '#ccc' }}></Divider>
406
- // <Button type="primary" onClick={onUploadFile} loading={uploadLoading}>上传文件</Button>
407
- // </Space>
408
- // </>]}
409
- // />
410
- // <NetDiskDirectory
411
- // {...(props?.directoryProps || {})}
412
- // open={directoryModal}
413
- // onOk={async (directoryId) => {
414
- // await onConfirmMove(directoryId);
415
- // setDirectoryModal(false);
416
- // }}
417
- // onCancel={() => setDirectoryModal(false)}/>
418
- // </ConfigProvider>
419
- // </App>
420
- // </>;
421
- // };
422
- // export default Component;
File without changes
@@ -1,43 +0,0 @@
1
- "use strict";
2
- // import React, { CSSProperties, FC } from 'react';
3
- // import { Breadcrumb, theme, Typography } from 'antd';
4
- //
5
- // const { Text } = Typography;
6
- // export declare type NavigationPath = {
7
- // id: string
8
- // title: string
9
- // }
10
- // export declare type FileItemProps = {
11
- // paths: NavigationPath[]
12
- // onSwitchPath?: (id: string, index: number) => Promise<void> | undefined
13
- // style?: CSSProperties
14
- // };
15
- // const App: FC<FileItemProps> = (props) => {
16
- // const { token } = theme.useToken();
17
- // return <>
18
- // <Breadcrumb style={{
19
- // fontSize: token.fontSize,
20
- // fontWeight: 'normal',
21
- // marginLeft: 5,
22
- // ...props?.style
23
- // }} items={props?.paths?.map((it, index) => {
24
- // return {
25
- // ...it,
26
- // title: <>
27
- // {index === (props?.paths || []).length - 1 ? <Text style={{
28
- // maxWidth: 80,
29
- // fontSize: token.fontSize,
30
- // fontWeight: 500
31
- // }} ellipsis={true}>{it.title}</Text> : <a onClick={() => props?.onSwitchPath?.(it.id, index)}>
32
- // <Text style={{
33
- // maxWidth: 80,
34
- // fontSize: token.fontSize,
35
- // color: '#999'
36
- // }} ellipsis={true}>{it.title}</Text>
37
- // </a>}
38
- // </>
39
- // } as never;
40
- // })}/>
41
- // </>;
42
- // };
43
- // export default App;
File without changes
@@ -1,36 +0,0 @@
1
- "use strict";
2
- // import React, { FC, useEffect, useState } from 'react';
3
- // import { Modal } from 'antd';
4
- // import FileItemTable, { FileItemTableProps } from './FileItemTable';
5
- // import IconDiskLogo from './icon/cpwechat_disk.svg';
6
- //
7
- // export declare type NetDiskProps = {
8
- // open: boolean
9
- // tableProps?: FileItemTableProps | undefined
10
- // onCancel?: () => void | undefined
11
- // };
12
- // const App: FC<NetDiskProps> = (props) => {
13
- // const [modal, setModal] = useState(false);
14
- // useEffect(() => {
15
- // setModal(props.open);
16
- // }, [props.open]);
17
- // return <>
18
- // <Modal open={modal} title={<div style={{
19
- // userSelect: 'none',
20
- // padding: '20px 0 8px 30px',
21
- // borderBottom: '1px solid #eee'
22
- // }}>
23
- // <img src={IconDiskLogo} style={{
24
- // height: 22
25
- // }} alt=""/>
26
- // </div>} width={1000} maskClosable={false} onCancel={() => props?.onCancel?.()} footer={false} styles={{
27
- // content: { padding: '0 0 2px 0' },
28
- // body: {
29
- // overflowY: 'auto'
30
- // }
31
- // }} keyboard={false}>
32
- // <FileItemTable {...props.tableProps}/>
33
- // </Modal>
34
- // </>;
35
- // };
36
- // export default App;
File without changes
@@ -1,40 +0,0 @@
1
- "use strict";
2
- // import React, { ReactNode, useState } from 'react';
3
- // import NetDisk from 'beer-assembly/NetDisk';
4
- // import { FileItemTableProps } from 'beer-assembly/FileItemTable';
5
- // import { DirectorySelectProps } from 'beer-assembly/DirectorySelect';
6
- //
7
- // export type Handler<T> = {
8
- // ok: (callback: (params: T) => Promise<boolean>, args?: {}, initialValues?: {}) => void
9
- // }
10
- // type FileItemTableRequest = NonNullable<FileItemTableProps['request']>;
11
- // type DirectoryRequest = NonNullable<DirectorySelectProps['request']>;
12
- // export type NetDiskRequest = FileItemTableRequest & {
13
- // directory: DirectoryRequest
14
- // };
15
- //
16
- // export class NetDiskModals {
17
- // public static useNetDisk(netDiskRequest: NetDiskRequest, fileFormat?: string[], errorMessage?: ReactNode): [Handler<boolean>, ReactNode] {
18
- // const [isOpenModal, setIsOpenModal] = useState(false);
19
- // const handler: Handler<boolean> = {
20
- // ok: (_callback: (params: boolean) => Promise<boolean>) => {
21
- // setIsOpenModal(true);
22
- // }
23
- // };
24
- // return [handler, <>
25
- // <NetDisk open={isOpenModal} onCancel={() => setIsOpenModal(false)} tableProps={{
26
- // request: {
27
- // ...netDiskRequest
28
- // },
29
- // directoryProps: {
30
- // request: {
31
- // ...netDiskRequest.directory
32
- // }
33
- // },
34
- // uploadFormat: fileFormat || ['xls', 'xlsx', 'doc', 'docx', 'pdf'],
35
- // uploadSize: 20,
36
- // uploadFormatMessage: errorMessage || <>抱歉,文件格式不受支持,请上传<span style={{ fontWeight: 500 }}>文档文件</span></>
37
- // }}/>
38
- // </>];
39
- // }
40
- // }