beer-assembly-biz 1.1.1-alpha.13 → 1.1.1-alpha.14
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/MediaModals.d.ts +28 -0
- package/MediaModals.js +9 -7
- package/package.json +1 -1
package/MediaModals.d.ts
CHANGED
|
@@ -1 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DirectorySelectProps } from 'beer-assembly/DirectorySelect';
|
|
3
|
+
export type Handler<T> = {
|
|
4
|
+
ok: (callback: (params: T) => void) => void;
|
|
5
|
+
};
|
|
6
|
+
type DirectoryRequest = NonNullable<DirectorySelectProps['request']>;
|
|
7
|
+
export declare type MediaItem = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
type: 'DIRECTORY' | 'FILE';
|
|
11
|
+
url: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type RequestParams = {
|
|
14
|
+
/**
|
|
15
|
+
* 获取列表数据.
|
|
16
|
+
* @param parentId 父类ID.
|
|
17
|
+
*/
|
|
18
|
+
requestList: (parentId: string) => Promise<MediaItem[]>;
|
|
19
|
+
rename: (id: string, name: string) => Promise<Boolean>;
|
|
20
|
+
copy: (id: string) => Promise<Boolean>;
|
|
21
|
+
move: (moveId: string, targetId: string) => Promise<Boolean>;
|
|
22
|
+
remove: (id: string) => Promise<Boolean>;
|
|
23
|
+
} & {
|
|
24
|
+
directory: DirectoryRequest;
|
|
25
|
+
};
|
|
26
|
+
export declare class MediaModals {
|
|
27
|
+
static useMedia(request?: RequestParams): [Handler<string[]>, ReactNode];
|
|
28
|
+
}
|
|
1
29
|
export {};
|
package/MediaModals.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Breadcrumb, Dropdown, Input, Modal, Space, Typography } from 'antd';
|
|
|
4
4
|
import { CopyOutlined, DeleteOutlined, ExclamationCircleFilled, HighlightOutlined, RightCircleOutlined, ScissorOutlined } from '@ant-design/icons';
|
|
5
5
|
import DirectorySelect from 'beer-assembly/DirectorySelect';
|
|
6
6
|
import IconDirectory from './icon/directory.svg';
|
|
7
|
-
class MediaModals {
|
|
7
|
+
export class MediaModals {
|
|
8
8
|
static useMedia(request) {
|
|
9
9
|
const [isOpenModal, setIsOpenModal] = useState(true);
|
|
10
10
|
const [isOpenMoveModal, setIsOpenMoveModal] = useState(false);
|
|
@@ -160,11 +160,13 @@ class MediaModals {
|
|
|
160
160
|
items: menusItems
|
|
161
161
|
}, trigger: ['contextMenu'] }, element) : element;
|
|
162
162
|
};
|
|
163
|
-
const handler =
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
callbackRef
|
|
163
|
+
const handler = {
|
|
164
|
+
ok: (callback) => {
|
|
165
|
+
setPath(getPaths());
|
|
166
|
+
setIsOpenModal(true);
|
|
167
|
+
if (callbackRef !== undefined) {
|
|
168
|
+
callbackRef.current = callback;
|
|
169
|
+
}
|
|
168
170
|
}
|
|
169
171
|
};
|
|
170
172
|
useEffect(() => {
|
|
@@ -224,6 +226,6 @@ class MediaModals {
|
|
|
224
226
|
color: '#faad14'
|
|
225
227
|
} }),
|
|
226
228
|
"\u662F\u5426\u786E\u8BA4\u5220\u9664\u76EE\u5F55?"), width: 400, open: isOpenConfirmModal, onOk: () => onConfirmRemove(), onCancel: () => setIsOpenConfirmModal(false), okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88" }, "\u5220\u9664\u64CD\u4F5C\u4E0D\u80FD\u56DE\u590D\uFF0C\u786E\u5B9A\u8981\u5220\u9664\u9009\u4E2D\u7684\u6587\u4EF6\u6216\u6587\u4EF6\u5939\u5417\uFF1F"),
|
|
227
|
-
React.createElement(DirectorySelect, { open: isOpenMoveModal, onOk: (value) => onConfirmMove(value) }))];
|
|
229
|
+
React.createElement(DirectorySelect, { open: isOpenMoveModal, request: request?.directory, onOk: (value) => onConfirmMove(value) }))];
|
|
228
230
|
}
|
|
229
231
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beer-assembly-biz",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.1.1-alpha.
|
|
4
|
+
"version": "1.1.1-alpha.14",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"pub-w": "tsc && copy package.json .\\dist\\package.json && npm publish ./dist",
|
|
7
7
|
"pub-m": "tsc && cp -a src/icon ./dist && cp -a src/fonts ./dist && cp -a src/images ./dist && cp package.json ./dist/package.json && npm publish ./dist"
|