beer-assembly-biz 1.1.2-alpha.6 → 1.1.2-alpha.8

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
2
  import { css } from '@emotion/css';
3
- import { Breadcrumb, Button, Dropdown, Input, message, Modal, Popconfirm, Space, Spin, Typography } from 'antd';
3
+ import { Breadcrumb, Button, Dropdown, Input, message, Modal, Popconfirm, Space, Spin, theme, Typography } from 'antd';
4
4
  import ElementUtils from 'beer-network/elementUtils';
5
5
  import Flux from 'beer-assembly/Flux';
6
6
  import { CloudDownloadOutlined, CopyOutlined, DeleteOutlined, ExclamationCircleFilled, HighlightOutlined, RightCircleOutlined, ScissorOutlined } from '@ant-design/icons';
@@ -11,6 +11,7 @@ import IconMedia from './icon/media.png';
11
11
  export class MediaModals {
12
12
  static useMedia(request) {
13
13
  const [messageApi, contextHolder] = message.useMessage();
14
+ const { token } = theme.useToken();
14
15
  const [isOpenModal, setIsOpenModal] = useState(false);
15
16
  const [isOpenMoveModal, setIsOpenMoveModal] = useState(false);
16
17
  const [isOpenRenameModal, setIsOpenRenameModal] = useState(false);
@@ -336,7 +337,7 @@ export class MediaModals {
336
337
  React.createElement(Space, null,
337
338
  React.createElement(Button, { type: "primary", onClick: () => onPutFile(), size: "small", style: {
338
339
  height: 24,
339
- fontSize: 12
340
+ fontSize: token.fontSize - 1
340
341
  }, loading: isLoading }, "\u4E0A\u4F20\u6587\u4EF6"),
341
342
  React.createElement(Popconfirm, { title: "\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0", description: React.createElement(Input, { value: selectName, onChange: (e) => setSelectName(e.currentTarget.value) }), onCancel: () => setSelectName(''), onConfirm: () => onCreateDirectory(selectName), okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88" },
342
343
  React.createElement(Button, { size: "small", style: {
@@ -1,7 +1,8 @@
1
1
  import React, { CSSProperties, FC } from 'react';
2
2
  import type { ComponentToken as MenuComponentToken } from 'antd/es/menu/style';
3
3
  export declare type MenusItem = {
4
- key: string;
4
+ key?: string;
5
+ value?: string;
5
6
  label: string | React.ReactNode;
6
7
  children: MenusItem[];
7
8
  };
@@ -10,6 +11,7 @@ export declare type SubMenusProps = {
10
11
  token?: MenuComponentToken | undefined;
11
12
  gap?: number | undefined;
12
13
  height?: number | string | undefined;
14
+ width?: number | undefined;
13
15
  padding?: number | string | undefined;
14
16
  styles?: {
15
17
  menus?: CSSProperties | undefined;
@@ -17,7 +19,7 @@ export declare type SubMenusProps = {
17
19
  };
18
20
  header?: React.ReactNode | undefined;
19
21
  children?: React.ReactNode | undefined;
20
- defaultValue?: string | undefined;
22
+ value?: string | undefined;
21
23
  onChange?: (key: string) => void;
22
24
  };
23
25
  export declare const Component: FC<SubMenusProps>;
@@ -1,6 +1,13 @@
1
- import React from 'react';
2
- import { ConfigProvider, Menu, Space } from 'antd';
1
+ import React, { useEffect, useState } from 'react';
2
+ import { ConfigProvider, Menu } from 'antd';
3
3
  export const Component = (props) => {
4
+ const [selectKeys, setSelectKeys] = useState([]);
5
+ useEffect(() => {
6
+ if (props?.value === undefined) {
7
+ return;
8
+ }
9
+ setSelectKeys([props.value]);
10
+ }, [props?.value]);
4
11
  return React.createElement(React.Fragment, null,
5
12
  React.createElement(ConfigProvider, { theme: {
6
13
  components: {
@@ -19,11 +26,14 @@ export const Component = (props) => {
19
26
  }
20
27
  }
21
28
  } },
22
- React.createElement(Space, { style: {
23
- alignItems: 'flex-start'
24
- }, size: props?.gap },
29
+ React.createElement("div", { style: {
30
+ display: 'flex',
31
+ gap: `${props?.gap || 12}px`,
32
+ alignItems: 'flex-start',
33
+ width: '100%'
34
+ } },
25
35
  React.createElement("div", { style: {
26
- width: 200,
36
+ width: props?.width || 200,
27
37
  backgroundColor: '#fff',
28
38
  height: props?.height || '100vh',
29
39
  userSelect: 'none',
@@ -39,8 +49,16 @@ export const Component = (props) => {
39
49
  React.createElement(Menu, { style: {
40
50
  height: '100%'
41
51
  }, onClick: (e) => {
52
+ setSelectKeys([e.key]);
42
53
  props?.onChange?.(e.key);
43
- }, subMenuCloseDelay: 0, defaultSelectedKeys: props?.defaultValue === undefined ? undefined : [props?.defaultValue], mode: "inline", inlineIndent: 16, items: props?.items })),
44
- React.createElement("div", { style: { padding: props?.padding, ...(props?.styles?.body || {}) } }, props?.children))));
54
+ }, subMenuCloseDelay: 0, selectedKeys: selectKeys, mode: "inline", inlineIndent: 16, items: props?.items })),
55
+ React.createElement("div", { style: {
56
+ width: `calc(100% - ${(props?.width || 200) + (props?.gap || 12) + (props?.gap || 12)}px)`,
57
+ marginRight: (props?.gap || 12),
58
+ height: '100%',
59
+ padding: props?.padding || '12px 0',
60
+ ...(props?.styles?.body || {}),
61
+ overflow: 'auto'
62
+ } }, props?.children))));
45
63
  };
46
64
  export default Component;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "beer-assembly-biz",
3
3
  "private": false,
4
- "version": "1.1.2-alpha.6",
4
+ "version": "1.1.2-alpha.8",
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"