@zero-library/common 2.2.13 → 2.2.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/dist/index.d.mts CHANGED
@@ -220,6 +220,8 @@ interface LazyComponentProps {
220
220
  type: string;
221
221
  /** 自定义组件映射 */
222
222
  customComponents?: ComponentMapType;
223
+ /** 未知类型时显示的内容,默认为警告提示 */
224
+ unknownContent?: React.ReactNode;
223
225
  /** 其他属性会透传给组件 */
224
226
  [key: string]: any;
225
227
  }
@@ -229,7 +231,7 @@ interface LazyComponentProps {
229
231
  * 使用示例:<LazyComponent type="renderMarkdown" data={{}} loading={true} />
230
232
  * @param props - 组件属性
231
233
  */
232
- declare const _default$g: ({ type, customComponents, ...rest }: LazyComponentProps) => react_jsx_runtime.JSX.Element;
234
+ declare const _default$g: ({ type, customComponents, unknownContent, ...rest }: LazyComponentProps) => string | number | true | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode>;
233
235
 
234
236
  /**
235
237
  * Markdown编辑器组件属性接口
package/dist/index.d.ts CHANGED
@@ -220,6 +220,8 @@ interface LazyComponentProps {
220
220
  type: string;
221
221
  /** 自定义组件映射 */
222
222
  customComponents?: ComponentMapType;
223
+ /** 未知类型时显示的内容,默认为警告提示 */
224
+ unknownContent?: React.ReactNode;
223
225
  /** 其他属性会透传给组件 */
224
226
  [key: string]: any;
225
227
  }
@@ -229,7 +231,7 @@ interface LazyComponentProps {
229
231
  * 使用示例:<LazyComponent type="renderMarkdown" data={{}} loading={true} />
230
232
  * @param props - 组件属性
231
233
  */
232
- declare const _default$g: ({ type, customComponents, ...rest }: LazyComponentProps) => react_jsx_runtime.JSX.Element;
234
+ declare const _default$g: ({ type, customComponents, unknownContent, ...rest }: LazyComponentProps) => string | number | true | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode>;
233
235
 
234
236
  /**
235
237
  * Markdown编辑器组件属性接口
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import Icon, { MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, AudioMutedOutlined, AudioOutlined } from '@ant-design/icons';
3
- import { Spin, message, notification, Modal, Flex, Button, Result, Splitter, Empty, Image, Drawer, Tag, Avatar, Alert, Form, Input } from 'antd';
3
+ import { Spin, message, notification, Modal, Flex, Button, Alert, Skeleton, Typography, Result, Splitter, Empty, Image, Drawer, Tag, Avatar, Form, Input } from 'antd';
4
4
  import classNames from 'classnames';
5
5
  import { renderAsync } from 'docx-preview';
6
6
  import * as React16 from 'react';
@@ -38,7 +38,7 @@ import { Superscript } from '@tiptap/extension-superscript';
38
38
  import { TaskItem } from '@tiptap/extension-task-item';
39
39
  import { TaskList } from '@tiptap/extension-task-list';
40
40
  import { TextAlign } from '@tiptap/extension-text-align';
41
- import { Typography } from '@tiptap/extension-typography';
41
+ import { Typography as Typography$1 } from '@tiptap/extension-typography';
42
42
  import { Underline } from '@tiptap/extension-underline';
43
43
  import { StarterKit } from '@tiptap/starter-kit';
44
44
  import Table from '@tiptap/extension-table';
@@ -1276,10 +1276,15 @@ var VideoPlayer_default = ({ fileUrl }) => {
1276
1276
  "\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 video \u6807\u7B7E\u3002"
1277
1277
  ] });
1278
1278
  };
1279
+
1280
+ // src/components/LazyComponent/styles.module.less
1281
+ var styles_module_default2 = {
1282
+ skeleton: "styles_module_skeleton"
1283
+ };
1279
1284
  var baseComponentMap = {
1280
1285
  // renderMarkdown: () => import('@/components/RenderMarkdown')
1281
1286
  };
1282
- var LazyComponent_default = ({ type, customComponents, ...rest }) => {
1287
+ var LazyComponent_default = ({ type, customComponents, unknownContent, ...rest }) => {
1283
1288
  const componentMap = useMemo(() => {
1284
1289
  return { ...baseComponentMap, ...customComponents };
1285
1290
  }, [customComponents]);
@@ -1287,11 +1292,14 @@ var LazyComponent_default = ({ type, customComponents, ...rest }) => {
1287
1292
  const loader = componentMap[type];
1288
1293
  return loader ? lazy(loader) : null;
1289
1294
  }, [type, componentMap]);
1290
- if (!LazyComponent) return /* @__PURE__ */ jsxs("div", { children: [
1291
- "\u672A\u77E5\u7C7B\u578B\uFF1A",
1292
- type
1293
- ] });
1294
- return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "\u52A0\u8F7D\u4E2D..." }), children: /* @__PURE__ */ jsx(LazyComponent, { ...rest }) });
1295
+ if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsx(Alert, { message: `\u672A\u77E5\u7C7B\u578B\uFF1A${type}`, type: "warning" });
1296
+ return /* @__PURE__ */ jsx(
1297
+ Suspense,
1298
+ {
1299
+ fallback: /* @__PURE__ */ jsx(Skeleton.Node, { active: true, className: styles_module_default2.skeleton, children: /* @__PURE__ */ jsx(Typography.Text, { type: "secondary", children: "\u7EC4\u4EF6\u52A0\u8F7D\u4E2D..." }) }),
1300
+ children: /* @__PURE__ */ jsx(LazyComponent, { ...rest })
1301
+ }
1302
+ );
1295
1303
  };
1296
1304
  var md = MarkdownIt({ html: true, breaks: true }).use(markdownItTaskLists).use(full).use(markdownItFootnote).use(markdownItDefList).use(markdownItKatex);
1297
1305
  md.renderer.rules.link_open = function(tokens, idx, options, env, self) {
@@ -2121,7 +2129,7 @@ var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onC
2121
2129
  };
2122
2130
 
2123
2131
  // src/components/Iframe/styles.module.less
2124
- var styles_module_default2 = {
2132
+ var styles_module_default3 = {
2125
2133
  iframe: "styles_module_iframe"
2126
2134
  };
2127
2135
  var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
@@ -2142,7 +2150,7 @@ var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad
2142
2150
  id,
2143
2151
  ref,
2144
2152
  src: finalSrc,
2145
- className: classNames(styles_module_default2.iframe, className),
2153
+ className: classNames(styles_module_default3.iframe, className),
2146
2154
  onLoad: onHandleLoad,
2147
2155
  allow: "clipboard-write"
2148
2156
  }
@@ -5741,7 +5749,7 @@ var MarkdownEditor_default = ({
5741
5749
  TaskItem.configure({ nested: true }),
5742
5750
  Highlight.configure({ multicolor: true }),
5743
5751
  Image$1,
5744
- Typography,
5752
+ Typography$1,
5745
5753
  Superscript,
5746
5754
  Subscript,
5747
5755
  Selection,