@cloudbase/weda-ui 3.10.0 → 3.10.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.
@@ -2,8 +2,8 @@
2
2
  declare const OPERATION_NODE_STATUS: readonly [{
3
3
  readonly name: "start";
4
4
  readonly code: 1;
5
- readonly theme: any;
6
- readonly text: any;
5
+ readonly theme: "default";
6
+ readonly text: "提交";
7
7
  }, {
8
8
  readonly name: "pass";
9
9
  readonly code: 2;
@@ -79,15 +79,20 @@ declare const OPERATION_NODE_STATUS: readonly [{
79
79
  readonly code: 16;
80
80
  readonly theme: any;
81
81
  readonly text: any;
82
+ }, {
83
+ readonly name: "delete_draft";
84
+ readonly code: 24;
85
+ readonly theme: "error";
86
+ readonly text: "删除草稿";
82
87
  }];
83
88
  /** 操作节点状态相关映射关系转换 */
84
89
  declare const
85
90
  /** 状态码-状态名称映射 */
86
- CODE_NAME_MAPPING: Record<number, "stop" | "drop" | "end" | "start" | "down" | "pending" | "revoke" | "cc" | "pass" | "turn" | "trans" | "countersign" | "skip_pass" | "skip_down" | "handled" | "handling">,
91
+ CODE_NAME_MAPPING: Record<number, "stop" | "drop" | "end" | "start" | "down" | "pending" | "revoke" | "cc" | "pass" | "turn" | "trans" | "countersign" | "skip_pass" | "skip_down" | "handled" | "handling" | "delete_draft">,
87
92
  /** 状态名称-状态码映射 */
88
- NAME_CODE_MAPPING: Record<"CC" | "REVOKE" | "STOP" | "DROP" | "END" | "START" | "DOWN" | "PENDING" | "PASS" | "TURN" | "TRANS" | "COUNTERSIGN" | "SKIP_PASS" | "SKIP_DOWN" | "HANDLED" | "HANDLING", number>,
93
+ NAME_CODE_MAPPING: Record<"CC" | "REVOKE" | "STOP" | "DROP" | "END" | "START" | "DOWN" | "PENDING" | "PASS" | "TURN" | "TRANS" | "COUNTERSIGN" | "SKIP_PASS" | "SKIP_DOWN" | "HANDLED" | "HANDLING" | "DELETE_DRAFT", number>,
89
94
  /** 状态名称映射 */
90
- NAME_MAPPING: Record<"CC" | "REVOKE" | "STOP" | "DROP" | "END" | "START" | "DOWN" | "PENDING" | "PASS" | "TURN" | "TRANS" | "COUNTERSIGN" | "SKIP_PASS" | "SKIP_DOWN" | "HANDLED" | "HANDLING", "stop" | "drop" | "end" | "start" | "down" | "pending" | "revoke" | "cc" | "pass" | "turn" | "trans" | "countersign" | "skip_pass" | "skip_down" | "handled" | "handling">,
95
+ NAME_MAPPING: Record<"CC" | "REVOKE" | "STOP" | "DROP" | "END" | "START" | "DOWN" | "PENDING" | "PASS" | "TURN" | "TRANS" | "COUNTERSIGN" | "SKIP_PASS" | "SKIP_DOWN" | "HANDLED" | "HANDLING" | "DELETE_DRAFT", "stop" | "drop" | "end" | "start" | "down" | "pending" | "revoke" | "cc" | "pass" | "turn" | "trans" | "countersign" | "skip_pass" | "skip_down" | "handled" | "handling" | "delete_draft">,
91
96
  /** 状态名称-状态文本信息映射 */
92
97
  NAME_TEXT_MAPPING: Record<string, {
93
98
  theme: string;
@@ -1,6 +1,6 @@
1
1
  /** 操作节点状态相关常量 */
2
2
  const OPERATION_NODE_STATUS = [
3
- { name: 'start', code: 1, theme: null, text: null },
3
+ { name: 'start', code: 1, theme: 'default', text: '提交' },
4
4
  { name: 'pass', code: 2, theme: 'success', text: '审批通过' },
5
5
  { name: 'down', code: 3, theme: 'error', text: '驳回' },
6
6
  { name: 'turn', code: 4, theme: 'primary', text: '已转办' },
@@ -15,7 +15,8 @@ const OPERATION_NODE_STATUS = [
15
15
  { name: 'handled', code: 13, theme: 'success', text: '已处理' },
16
16
  { name: 'handling', code: 14, theme: 'warning', text: '待处理' },
17
17
  { name: 'cc', code: 15, theme: null, text: null },
18
- { name: 'drop', code: 16, theme: null, text: null }, // 作废
18
+ { name: 'drop', code: 16, theme: null, text: null },
19
+ { name: 'delete_draft', code: 24, theme: 'error', text: '删除草稿' }, // 作废
19
20
  ];
20
21
  /** 操作节点状态相关映射关系转换 */
21
22
  const {
@@ -35,7 +35,7 @@ export default function ModelFlowProcess(props) {
35
35
  }
36
36
  /** 渲染状态标签 */
37
37
  function renderStatusTag(status) {
38
- if ([NAME_MAPPING.START, NAME_MAPPING.END, NAME_MAPPING.CC].includes(status))
38
+ if ([NAME_MAPPING.END, NAME_MAPPING.CC].includes(status))
39
39
  return null;
40
40
  const { theme, text } = (NAME_TEXT_MAPPING === null || NAME_TEXT_MAPPING === void 0 ? void 0 : NAME_TEXT_MAPPING[status]) || {};
41
41
  if (!text)
@@ -11,6 +11,7 @@ interface TempFileProps {
11
11
  }
12
12
  export declare function UploaderPCInner(props: PropsType): JSX.Element;
13
13
  export interface TcbImageProps {
14
+ fileID?: string;
14
15
  tempFile?: TempFileProps;
15
16
  isZoom?: boolean;
16
17
  onError?: (e: unknown) => void;
@@ -132,11 +132,11 @@ export function UploaderPCInner(props) {
132
132
  className: `_weda-fn-upload-result__item _weda-fn-upload-result__item--upload ${imgTypeCls}`, children: [imgTypeCls, _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] })] }) })))] })] }) }));
133
133
  }
134
134
  export const TcbImage = (props) => {
135
- const { tempFile, isZoom, imgTypeCls, preivewIcon, actions, ...rest } = props;
135
+ const { fileID, tempFile = { progress: 100, loading: false, realUrl: null, tempUrl: null }, isZoom, imgTypeCls, preivewIcon, actions, ...rest } = props;
136
136
  const { progress, loading, realUrl, tempUrl } = tempFile;
137
- const fileID = realUrl !== null && realUrl !== void 0 ? realUrl : tempUrl;
137
+ const fileCloudID = (realUrl !== null && realUrl !== void 0 ? realUrl : tempUrl) || fileID;
138
138
  const [isError, setIsError] = React.useState(false);
139
- const { data: src, error: requestError } = useTempUrl(fileID);
139
+ const { data: src, error: requestError } = useTempUrl(fileCloudID);
140
140
  const encodeSrc = encodeConvert(src);
141
141
  const renderImg = () => {
142
142
  if (isError || requestError)
@@ -146,12 +146,12 @@ export const TcbImage = (props) => {
146
146
  return (_jsxs(_Fragment, { children: [_jsx("img", { "data-testid": "uploaderpc_imgStyle", className: `${CLASS_PREFIX}__image ${imgTypeCls}`, ...rest, src: encodeURI(encodeSrc), onError: (e) => {
147
147
  setIsError(true);
148
148
  (props === null || props === void 0 ? void 0 : props.onError) && props.onError(e);
149
- } }, fileID), loading && (_jsxs("div", { className: "_weda-fn-upload-result__status loading_bac", children: [_jsx(Icon, { type: "loading" }), _jsxs("div", { className: "wedatea2td-mt-1n wedatea2td-fz-reset", children: [progress, "%"] })] }))] }));
149
+ } }), loading && (_jsxs("div", { className: "_weda-fn-upload-result__status loading_bac", children: [_jsx(Icon, { type: "loading" }), _jsxs("div", { className: "wedatea2td-mt-1n wedatea2td-fz-reset", children: [progress, "%"] })] }))] }));
150
150
  };
151
151
  if (!isZoom)
152
152
  return renderImg();
153
153
  const previewProps = {
154
- key: fileID,
154
+ key: fileCloudID,
155
155
  'data-testid': 'uploaderpc_imgStyle',
156
156
  className: `${CLASS_PREFIX}__image ${imgTypeCls}`,
157
157
  ...rest,
@@ -77,7 +77,7 @@ export function useUploader(props) {
77
77
  },
78
78
  onUploadFinish: (item) => {
79
79
  var _a;
80
- (_a = events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: item.realUrl, file: item.file });
80
+ (_a = events === null || events === void 0 ? void 0 : events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: item.realUrl, file: item.file });
81
81
  setUploading(false);
82
82
  setTempFile((allTempFile) => allTempFile.map((i) => (i.key === item.key ? { ...i, ...item } : i)));
83
83
  },
@@ -3,4 +3,4 @@ import type { DataType } from '../../../configs/components/wd-layout';
3
3
  import './style';
4
4
  export interface WdLayoutProps extends CommonPropsType, DataType {
5
5
  }
6
- export declare const WdLayout: ({ headerLeftSlot, headerRightSlot, contentSlot, style, template, className, }: WdLayoutProps) => JSX.Element;
6
+ export declare const WdLayout: ({ headerLeftSlot, headerRightSlot, contentSlot, style, template, className, enableHeaderSlot, enableContentSlot, }: WdLayoutProps) => JSX.Element;
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useConfig } from '../../utils/config-context';
3
3
  import { usePlatform } from '../../utils/platform';
4
4
  import './style';
5
- export const WdLayout = ({ headerLeftSlot, headerRightSlot, contentSlot, style, template = 'white', className, }) => {
5
+ export const WdLayout = ({ headerLeftSlot, headerRightSlot, contentSlot, style, template = 'white', className, enableHeaderSlot = true, enableContentSlot = true, }) => {
6
6
  // 样式
7
7
  const { classPrefix } = useConfig();
8
8
  const platform = usePlatform();
9
9
  const isH5 = platform === 'h5';
10
- return (_jsxs("div", { className: `${isH5 ? `${classPrefix}-h5-layout-root` : `${classPrefix}-pc-layout-root`} ${classPrefix}-layout-root ${className} ${template}`, "data-testid": "wd-layout-test", style: style, children: [_jsxs("div", { className: `${classPrefix}-layout__header ${template}`, "data-testid": "wd-layout-header-test", children: [_jsx("div", { className: `${classPrefix}-layout__header-item ${classPrefix}-layout__header-item-left`, "data-testid": "wd-layout-header-left-test", children: headerLeftSlot }), _jsx("div", { className: `${classPrefix}-layout__header-item ${classPrefix}-layout__header-item-right`, "data-testid": "wd-layout-header-right-test", children: headerRightSlot })] }), _jsx("div", { className: `${classPrefix}-layout__body ${template}`, "data-testid": "wd-layout-body-test", children: contentSlot })] }));
10
+ return (_jsxs("div", { className: `${isH5 ? `${classPrefix}-h5-layout-root` : `${classPrefix}-pc-layout-root`} ${classPrefix}-layout-root ${className} ${template}`, "data-testid": "wd-layout-test", style: style, children: [enableHeaderSlot && (_jsxs("div", { className: `${classPrefix}-layout__header ${template}`, "data-testid": "wd-layout-header-test", children: [_jsx("div", { className: `${classPrefix}-layout__header-item ${classPrefix}-layout__header-item-left`, "data-testid": "wd-layout-header-left-test", children: headerLeftSlot }), _jsx("div", { className: `${classPrefix}-layout__header-item ${classPrefix}-layout__header-item-right`, "data-testid": "wd-layout-header-right-test", children: headerRightSlot })] })), enableContentSlot && (_jsx("div", { className: `${classPrefix}-layout__body ${template}`, "data-testid": "wd-layout-body-test", children: contentSlot }))] }));
11
11
  };
@@ -114,5 +114,5 @@ export const WdMarkdown = forwardRef(function WdMarkdown({ value = '', options,
114
114
  updateMarkdownInstance: ({ markdownInstance }) => setMdInstance(markdownInstance),
115
115
  };
116
116
  }, [value, mdInstance], ref);
117
- return (_jsx("div", { ref: markdownRef, className: cls, style: style, id: id, children: mdInstance && (_jsx("div", { dangerouslySetInnerHTML: { __html: displayValue } })) }));
117
+ return (_jsx("div", { ref: markdownRef, className: cls, style: style, id: id, children: displayValue && (_jsx("div", { dangerouslySetInnerHTML: { __html: displayValue } })) }));
118
118
  });
@@ -5,5 +5,5 @@ import { slotDiv } from '../utils';
5
5
  import { WdMenuList } from '../../index';
6
6
  export const PlantMenu = forwardRef(function PlantMenu(props, ref) {
7
7
  const { classPrefix } = useConfig();
8
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `${classPrefix}-menulayout-header ${classPrefix}-menulayout-header--plant`, children: [_jsx("div", { className: `${classPrefix}-menulayout-header__logo-wrap is-not-content`, children: slotDiv(props.headSlot) }), _jsx("div", { className: `${classPrefix}-menulayout-header__right-wrap is-not-content`, children: slotDiv(props.headRightSlot, { justifyContent: 'flex-end' }) })] }), _jsxs("div", { className: `${classPrefix}-menulayout-body ${classPrefix}-menulayout-body--plant`, children: [_jsxs("div", { className: `${classPrefix}-menulayout-body__left`, children: [_jsx("div", { className: `${classPrefix}-menulayout-body__left-menu ${classPrefix}-menulayout__menu`, children: _jsx(WdMenuList, { ...props, className: "", id: "", style: {}, ref: ref }) }), _jsx("div", { className: `${classPrefix}-menulayout-body__left-slot is-not-content ${classPrefix}-menulayout-body__footer`, children: slotDiv(props.footerSlot) })] }), _jsx("div", { className: `${classPrefix}-menulayout-body__content ${classPrefix}-menulayout__body`, children: props.contentSlot })] })] }));
8
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `${classPrefix}-menulayout-header ${classPrefix}-menulayout-header--plant`, children: [_jsx("div", { className: `${classPrefix}-menulayout-header__logo-wrap`, children: slotDiv(props.headSlot) }), _jsx("div", { className: `${classPrefix}-menulayout-header__right-wrap `, children: slotDiv(props.headRightSlot, { justifyContent: 'flex-end' }) })] }), _jsxs("div", { className: `${classPrefix}-menulayout-body ${classPrefix}-menulayout-body--plant`, children: [_jsxs("div", { className: `${classPrefix}-menulayout-body__left`, children: [_jsx("div", { className: `${classPrefix}-menulayout-body__left-menu ${classPrefix}-menulayout__menu`, children: _jsx(WdMenuList, { ...props, className: "", id: "", style: {}, ref: ref }) }), _jsx("div", { className: `${classPrefix}-menulayout-body__left-slot is-not-content ${classPrefix}-menulayout-body__footer`, children: slotDiv(props.footerSlot) })] }), _jsx("div", { className: `${classPrefix}-menulayout-body__content ${classPrefix}-menulayout__body`, children: props.contentSlot })] })] }));
9
9
  });
@@ -30,6 +30,8 @@ export const CommonMenuList = forwardRef(function CommonMenuList(props, ref) {
30
30
  if (key || !item) {
31
31
  selectItem = findSelectItem(menuData || [], key);
32
32
  }
33
+ if (!selectItem)
34
+ return;
33
35
  if ((selectItem === null || selectItem === void 0 ? void 0 : selectItem.key) && selected === (selectItem === null || selectItem === void 0 ? void 0 : selectItem.key))
34
36
  return;
35
37
  setSelected(selectItem === null || selectItem === void 0 ? void 0 : selectItem.key);
@@ -43,7 +45,11 @@ export const CommonMenuList = forwardRef(function CommonMenuList(props, ref) {
43
45
  }, [setSelectedInfo]);
44
46
  useEffect(() => {
45
47
  setSelectedInfo();
46
- }, [setSelectedInfo]);
48
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ }, [menuData]);
50
+ useEffect(() => {
51
+ props.selectedMenuKey && setSelected(props.selectedMenuKey);
52
+ }, [props.selectedMenuKey]);
47
53
  // 默认展开状态变化后删掉之前的状态缓存
48
54
  useEffect(() => {
49
55
  const status = JSON.parse(JSON.stringify(openStatus));
@@ -32,6 +32,8 @@ export const HorizontalMenuList = forwardRef(function HorizontalMenuList(props,
32
32
  if (key || !item) {
33
33
  selectItem = findSelectItem(menuData || [], key);
34
34
  }
35
+ if (!selectItem)
36
+ return;
35
37
  if ((selectItem === null || selectItem === void 0 ? void 0 : selectItem.key) && selected === (selectItem === null || selectItem === void 0 ? void 0 : selectItem.key))
36
38
  return;
37
39
  setSelected(selectItem === null || selectItem === void 0 ? void 0 : selectItem.key);
@@ -72,7 +74,11 @@ export const HorizontalMenuList = forwardRef(function HorizontalMenuList(props,
72
74
  }, [platform, navWrapRef, getMenuOffset]);
73
75
  useEffect(() => {
74
76
  setSelectedInfo();
75
- }, [setSelectedInfo]);
77
+ // eslint-disable-next-line react-hooks/exhaustive-deps
78
+ }, [menuData]);
79
+ useEffect(() => {
80
+ props.selectedMenuKey && setSelected(props.selectedMenuKey);
81
+ }, [props.selectedMenuKey]);
76
82
  const getIconShow = (item, selectedKey) => {
77
83
  var _a;
78
84
  if (!item.iconUrl && !item.selectedIconPath && !item.iconPath)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/weda-ui",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index",
6
6
  "miniprogram": "mpdist",