@alifd/chat 0.2.0 → 0.3.0-beta.0

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.
Files changed (156) hide show
  1. package/es/HTMLRenderer/index.d.ts +4 -0
  2. package/es/HTMLRenderer/index.js +138 -0
  3. package/es/HTMLRenderer/index.less +194 -0
  4. package/es/HTMLRenderer/main.scss +233 -0
  5. package/es/HTMLRenderer/style.d.ts +1 -0
  6. package/es/HTMLRenderer/style.js +1 -0
  7. package/es/HTMLRenderer/types.d.ts +46 -0
  8. package/es/HTMLRenderer/types.js +1 -0
  9. package/es/ImagePreview/index.d.ts +13 -0
  10. package/es/ImagePreview/index.js +72 -0
  11. package/es/ImagePreview/main.scss +15 -0
  12. package/es/ImagePreview/style.d.ts +1 -0
  13. package/es/ImagePreview/style.js +1 -0
  14. package/es/ImagePreview/types.d.ts +31 -0
  15. package/es/ImagePreview/types.js +1 -0
  16. package/es/balloon/index.d.ts +7 -0
  17. package/es/balloon/index.js +7 -0
  18. package/es/balloon/style.d.ts +1 -0
  19. package/es/balloon/style.js +1 -0
  20. package/es/balloon/types.d.ts +219 -0
  21. package/es/balloon/types.js +1 -0
  22. package/es/card-loading/index.d.ts +11 -0
  23. package/es/card-loading/index.js +18 -0
  24. package/es/card-loading/main.scss +5 -0
  25. package/es/card-loading/style.d.ts +2 -0
  26. package/es/card-loading/style.js +2 -0
  27. package/es/card-loading/types.d.ts +10 -0
  28. package/es/card-loading/types.js +1 -0
  29. package/es/feedback/types.d.ts +8 -0
  30. package/es/float-button/hooks/useAutoHide.d.ts +0 -1
  31. package/es/float-button/hooks/useDragable.d.ts +0 -1
  32. package/es/float-button/index.d.ts +0 -1
  33. package/es/icon/index.d.ts +12 -0
  34. package/es/icon/index.js +21 -0
  35. package/es/icon/main.scss +1 -0
  36. package/es/icon/style.d.ts +2 -0
  37. package/es/icon/style.js +2 -0
  38. package/es/icon/types.d.ts +43 -0
  39. package/es/icon/types.js +1 -0
  40. package/es/index.d.ts +8 -0
  41. package/es/index.js +9 -1
  42. package/es/input/index.d.ts +1 -2
  43. package/es/list/index.d.ts +8 -0
  44. package/es/list/index.js +8 -0
  45. package/es/list/style.d.ts +1 -0
  46. package/es/list/style.js +1 -0
  47. package/es/list/types.d.ts +93 -0
  48. package/es/list/types.js +1 -0
  49. package/es/markdown/index.d.ts +6 -0
  50. package/es/markdown/index.js +138 -0
  51. package/es/markdown/main.scss +153 -0
  52. package/es/markdown/style.d.ts +3 -0
  53. package/es/markdown/style.js +3 -0
  54. package/es/markdown/types.d.ts +21 -0
  55. package/es/markdown/types.js +1 -0
  56. package/es/message/index.d.ts +75 -0
  57. package/es/message/index.js +30 -0
  58. package/es/message/main.scss +2 -0
  59. package/es/message/style.d.ts +2 -0
  60. package/es/message/style.js +2 -0
  61. package/es/message/types.d.ts +195 -0
  62. package/es/message/types.js +1 -0
  63. package/es/person-picker/index.d.ts +377 -2
  64. package/es/person-picker/index.js +3 -3
  65. package/es/tab/main.scss +2 -3
  66. package/es/tag/index.d.ts +20 -20
  67. package/es/tag/index.js +2 -2
  68. package/es/tag/main.scss +1 -1
  69. package/es/utils/func.d.ts +1 -0
  70. package/es/utils/func.js +9 -0
  71. package/lib/HTMLRenderer/index.d.ts +4 -0
  72. package/lib/HTMLRenderer/index.js +141 -0
  73. package/lib/HTMLRenderer/index.less +194 -0
  74. package/lib/HTMLRenderer/main.scss +233 -0
  75. package/lib/HTMLRenderer/style.d.ts +1 -0
  76. package/lib/HTMLRenderer/style.js +3 -0
  77. package/lib/HTMLRenderer/types.d.ts +46 -0
  78. package/lib/HTMLRenderer/types.js +2 -0
  79. package/lib/ImagePreview/index.d.ts +13 -0
  80. package/lib/ImagePreview/index.js +75 -0
  81. package/lib/ImagePreview/main.scss +15 -0
  82. package/lib/ImagePreview/style.d.ts +1 -0
  83. package/lib/ImagePreview/style.js +3 -0
  84. package/lib/ImagePreview/types.d.ts +31 -0
  85. package/lib/ImagePreview/types.js +2 -0
  86. package/lib/balloon/index.d.ts +7 -0
  87. package/lib/balloon/index.js +11 -0
  88. package/lib/balloon/style.d.ts +1 -0
  89. package/lib/balloon/style.js +3 -0
  90. package/lib/balloon/types.d.ts +219 -0
  91. package/lib/balloon/types.js +2 -0
  92. package/lib/card/view/card.js +2 -3
  93. package/lib/card-loading/index.d.ts +11 -0
  94. package/lib/card-loading/index.js +21 -0
  95. package/lib/card-loading/main.scss +5 -0
  96. package/lib/card-loading/style.d.ts +2 -0
  97. package/lib/card-loading/style.js +4 -0
  98. package/lib/card-loading/types.d.ts +10 -0
  99. package/lib/card-loading/types.js +2 -0
  100. package/lib/feedback/types.d.ts +8 -0
  101. package/lib/float-button/hooks/useAutoAlign.js +1 -2
  102. package/lib/float-button/hooks/useAutoHide.d.ts +0 -1
  103. package/lib/float-button/hooks/useAutoHide.js +1 -2
  104. package/lib/float-button/hooks/useDragable.d.ts +0 -1
  105. package/lib/float-button/hooks/useDragable.js +1 -2
  106. package/lib/float-button/hooks/useNestleEdge.js +1 -2
  107. package/lib/float-button/hooks/useTriggerType.js +1 -2
  108. package/lib/float-button/index.d.ts +0 -1
  109. package/lib/float-button/util.js +4 -5
  110. package/lib/float-button/view/balloon.js +1 -2
  111. package/lib/float-button/view/drawer.js +1 -2
  112. package/lib/float-button/view/inner-drawer.js +1 -2
  113. package/lib/icon/index.d.ts +12 -0
  114. package/lib/icon/index.js +23 -0
  115. package/lib/icon/main.scss +1 -0
  116. package/lib/icon/style.d.ts +2 -0
  117. package/lib/icon/style.js +4 -0
  118. package/lib/icon/types.d.ts +43 -0
  119. package/lib/icon/types.js +2 -0
  120. package/lib/index.d.ts +8 -0
  121. package/lib/index.js +30 -16
  122. package/lib/input/index.d.ts +1 -2
  123. package/lib/list/index.d.ts +8 -0
  124. package/lib/list/index.js +12 -0
  125. package/lib/list/style.d.ts +1 -0
  126. package/lib/list/style.js +3 -0
  127. package/lib/list/types.d.ts +93 -0
  128. package/lib/list/types.js +2 -0
  129. package/lib/markdown/index.d.ts +6 -0
  130. package/lib/markdown/index.js +141 -0
  131. package/lib/markdown/main.scss +153 -0
  132. package/lib/markdown/style.d.ts +3 -0
  133. package/lib/markdown/style.js +5 -0
  134. package/lib/markdown/types.d.ts +21 -0
  135. package/lib/markdown/types.js +2 -0
  136. package/lib/message/index.d.ts +75 -0
  137. package/lib/message/index.js +32 -0
  138. package/lib/message/main.scss +2 -0
  139. package/lib/message/style.d.ts +2 -0
  140. package/lib/message/style.js +4 -0
  141. package/lib/message/types.d.ts +195 -0
  142. package/lib/message/types.js +2 -0
  143. package/lib/person-picker/index.d.ts +377 -2
  144. package/lib/person-picker/index.js +3 -3
  145. package/lib/tab/main.scss +2 -3
  146. package/lib/tag/index.d.ts +20 -20
  147. package/lib/tag/index.js +2 -2
  148. package/lib/tag/main.scss +1 -1
  149. package/lib/utils/common.js +1 -2
  150. package/lib/utils/dingtalk.js +3 -4
  151. package/lib/utils/func.d.ts +1 -0
  152. package/lib/utils/func.js +12 -3
  153. package/lib/utils/hooks/useControlable.js +1 -2
  154. package/lib/utils/hooks/useDebounce.js +1 -2
  155. package/lib/utils/hooks/useThrottle.js +1 -2
  156. package/package.json +127 -5
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InnerDrawer = void 0;
3
+ exports.InnerDrawer = InnerDrawer;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const react_dom_1 = tslib_1.__importDefault(require("react-dom"));
@@ -201,7 +201,6 @@ function InnerDrawer({ className, prefix, target, children, trigger, triggerType
201
201
  react_1.default.createElement(next_1.Icon, { className: `${cls}-header-close-icon`, type: "close", size: 12 })))),
202
202
  react_1.default.createElement("div", { className: `${cls}-body` }, showPane ? children : null))), mountTarget)));
203
203
  }
204
- exports.InnerDrawer = InnerDrawer;
205
204
  function FloatButtonByInnerDrawer(props) {
206
205
  const { width, title, target, drawerClassName, cache = false, beforeOpen, afterOpen, beforeClose, afterClose } = props, rests = tslib_1.__rest(props, ["width", "title", "target", "drawerClassName", "cache", "beforeOpen", "afterOpen", "beforeClose", "afterClose"]);
207
206
  return (react_1.default.createElement(float_button_1.default, Object.assign({}, rests, { _renderView: (prefix, { trigger, triggerType, visible, onVisibleChange, showClose, children }) => {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @component 标签
3
+ * @en Icon
4
+ * @type 通用 - General
5
+ * @remarks 同 Next Icon - Same as Next.Icon
6
+ * @when Icon
7
+ */
8
+ import React from 'react';
9
+ import type { IconProps } from '@alifd/next/types/icon';
10
+ export * from './types';
11
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<IconProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<IconProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/icon/icon").default>>, "key" | keyof IconProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<IconProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/icon/icon").default>, {}>;
12
+ export default _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * @component 标签
4
+ * @en Icon
5
+ * @type 通用 - General
6
+ * @remarks 同 Next Icon - Same as Next.Icon
7
+ * @when Icon
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const tslib_1 = require("tslib");
11
+ const react_1 = tslib_1.__importStar(require("react"));
12
+ const next_1 = require("@alifd/next");
13
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
14
+ const utils_1 = require("../utils");
15
+ const Icon = (0, react_1.forwardRef)((_a, ref) => {
16
+ var { className, size = 'small' } = _a, props = tslib_1.__rest(_a, ["className", "size"]);
17
+ return (react_1.default.createElement(next_1.Icon, Object.assign({}, props, { ref: ref, className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}icon`, className), size: size })));
18
+ });
19
+ const IconWithSub = (0, utils_1.assignSubComponent)(Icon, {
20
+ displayName: 'Icon',
21
+ });
22
+ tslib_1.__exportStar(require("./types"), exports);
23
+ exports.default = next_1.ConfigProvider.config(IconWithSub);
@@ -0,0 +1 @@
1
+ @import "../core/variables.scss";
@@ -0,0 +1,2 @@
1
+ import '@alifd/next/lib/button/style2';
2
+ import './main.scss';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("@alifd/next/lib/button/style2");
4
+ require("./main.scss");
@@ -0,0 +1,43 @@
1
+ import type * as React from 'react';
2
+ import { type CommonProps } from '@alifd/next';
3
+ export interface IconSvgProps extends React.SVGAttributes<SVGSVGElement>, CommonProps {
4
+ /**
5
+ * 指定显示哪种图标
6
+ * @en Type of icon
7
+ */
8
+ type?: string;
9
+ /**
10
+ * 指定图标大小
11
+ * @en Size of icon
12
+ * @defaultValue 'medium'
13
+ */
14
+ size?: number | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'inherit';
15
+ }
16
+ /**
17
+ * @api Icon
18
+ */
19
+ export interface IconProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
20
+ /**
21
+ * 指定显示哪种图标
22
+ * @en Type of icon
23
+ */
24
+ type?: string;
25
+ /**
26
+ * 指定图标大小
27
+ * @en Size of icon
28
+ * @defaultValue 'medium'
29
+ */
30
+ size?: number | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'inherit';
31
+ }
32
+ export interface IconOptions {
33
+ /**
34
+ * 如果页面上已经有同 id 的标签,那么不会再加载这个图标库
35
+ * @en If there is already a tag with the same ID on the page, the icon library will not be loaded again
36
+ */
37
+ scriptUrl: string;
38
+ /**
39
+ * extra common props of icon-font
40
+ * @skip
41
+ */
42
+ extraCommonProps?: React.SVGAttributes<SVGSVGElement>;
43
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/index.d.ts CHANGED
@@ -9,4 +9,12 @@ export { default as Input } from './input';
9
9
  export { default as DatePicker } from './date-picker';
10
10
  export { default as TimePicker } from './time-picker';
11
11
  export { default as PersonPicker } from './person-picker';
12
+ export { default as Message } from './message';
13
+ export { default as Icon } from './icon';
14
+ export { default as Balloon } from './balloon';
15
+ export { default as List } from './list';
16
+ export { default as ImagePreview } from './ImagePreview';
17
+ export { default as HTMLRenderer } from './HTMLRenderer';
18
+ export { default as Markdown } from './markdown';
19
+ export { default as CardLoading } from './card-loading';
12
20
  export declare const version: string;
package/lib/index.js CHANGED
@@ -1,29 +1,43 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.version = exports.PersonPicker = exports.TimePicker = exports.DatePicker = exports.Input = exports.Tab = exports.Tag = exports.Text = exports.FloatButton = exports.Feedback = exports.Card = exports.Button = void 0;
3
+ exports.version = exports.CardLoading = exports.Markdown = exports.HTMLRenderer = exports.ImagePreview = exports.List = exports.Balloon = exports.Icon = exports.Message = exports.PersonPicker = exports.TimePicker = exports.DatePicker = exports.Input = exports.Tab = exports.Tag = exports.Text = exports.FloatButton = exports.Feedback = exports.Card = exports.Button = void 0;
4
+ const tslib_1 = require("tslib");
7
5
  var button_1 = require("./button");
8
- Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return __importDefault(button_1).default; } });
6
+ Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return tslib_1.__importDefault(button_1).default; } });
9
7
  var card_1 = require("./card");
10
- Object.defineProperty(exports, "Card", { enumerable: true, get: function () { return __importDefault(card_1).default; } });
8
+ Object.defineProperty(exports, "Card", { enumerable: true, get: function () { return tslib_1.__importDefault(card_1).default; } });
11
9
  var feedback_1 = require("./feedback");
12
- Object.defineProperty(exports, "Feedback", { enumerable: true, get: function () { return __importDefault(feedback_1).default; } });
10
+ Object.defineProperty(exports, "Feedback", { enumerable: true, get: function () { return tslib_1.__importDefault(feedback_1).default; } });
13
11
  var float_button_1 = require("./float-button");
14
- Object.defineProperty(exports, "FloatButton", { enumerable: true, get: function () { return __importDefault(float_button_1).default; } });
12
+ Object.defineProperty(exports, "FloatButton", { enumerable: true, get: function () { return tslib_1.__importDefault(float_button_1).default; } });
15
13
  var text_1 = require("./text");
16
- Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return __importDefault(text_1).default; } });
14
+ Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return tslib_1.__importDefault(text_1).default; } });
17
15
  var tag_1 = require("./tag");
18
- Object.defineProperty(exports, "Tag", { enumerable: true, get: function () { return __importDefault(tag_1).default; } });
16
+ Object.defineProperty(exports, "Tag", { enumerable: true, get: function () { return tslib_1.__importDefault(tag_1).default; } });
19
17
  var tab_1 = require("./tab");
20
- Object.defineProperty(exports, "Tab", { enumerable: true, get: function () { return __importDefault(tab_1).default; } });
18
+ Object.defineProperty(exports, "Tab", { enumerable: true, get: function () { return tslib_1.__importDefault(tab_1).default; } });
21
19
  var input_1 = require("./input");
22
- Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return __importDefault(input_1).default; } });
20
+ Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return tslib_1.__importDefault(input_1).default; } });
23
21
  var date_picker_1 = require("./date-picker");
24
- Object.defineProperty(exports, "DatePicker", { enumerable: true, get: function () { return __importDefault(date_picker_1).default; } });
22
+ Object.defineProperty(exports, "DatePicker", { enumerable: true, get: function () { return tslib_1.__importDefault(date_picker_1).default; } });
25
23
  var time_picker_1 = require("./time-picker");
26
- Object.defineProperty(exports, "TimePicker", { enumerable: true, get: function () { return __importDefault(time_picker_1).default; } });
24
+ Object.defineProperty(exports, "TimePicker", { enumerable: true, get: function () { return tslib_1.__importDefault(time_picker_1).default; } });
27
25
  var person_picker_1 = require("./person-picker");
28
- Object.defineProperty(exports, "PersonPicker", { enumerable: true, get: function () { return __importDefault(person_picker_1).default; } });
29
- exports.version = '0.2.0';
26
+ Object.defineProperty(exports, "PersonPicker", { enumerable: true, get: function () { return tslib_1.__importDefault(person_picker_1).default; } });
27
+ var message_1 = require("./message");
28
+ Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return tslib_1.__importDefault(message_1).default; } });
29
+ var icon_1 = require("./icon");
30
+ Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return tslib_1.__importDefault(icon_1).default; } });
31
+ var balloon_1 = require("./balloon");
32
+ Object.defineProperty(exports, "Balloon", { enumerable: true, get: function () { return tslib_1.__importDefault(balloon_1).default; } });
33
+ var list_1 = require("./list");
34
+ Object.defineProperty(exports, "List", { enumerable: true, get: function () { return tslib_1.__importDefault(list_1).default; } });
35
+ var ImagePreview_1 = require("./ImagePreview");
36
+ Object.defineProperty(exports, "ImagePreview", { enumerable: true, get: function () { return tslib_1.__importDefault(ImagePreview_1).default; } });
37
+ var HTMLRenderer_1 = require("./HTMLRenderer");
38
+ Object.defineProperty(exports, "HTMLRenderer", { enumerable: true, get: function () { return tslib_1.__importDefault(HTMLRenderer_1).default; } });
39
+ var markdown_1 = require("./markdown");
40
+ Object.defineProperty(exports, "Markdown", { enumerable: true, get: function () { return tslib_1.__importDefault(markdown_1).default; } });
41
+ var card_loading_1 = require("./card-loading");
42
+ Object.defineProperty(exports, "CardLoading", { enumerable: true, get: function () { return tslib_1.__importDefault(card_loading_1).default; } });
43
+ exports.version = '0.3.0-beta.0';
@@ -18,7 +18,6 @@
18
18
  * | SPACE | Trigger the onClick event |
19
19
  */
20
20
  import React from 'react';
21
- import { Input as NextInput } from '@alifd/next';
22
21
  export * from './types';
23
- declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<Pick<any, string | number | symbol> & React.RefAttributes<NextInput>, string | number | symbol> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextInput, {}>;
22
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<Pick<any, string | number | symbol> & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/input").InputProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>> & Pick<import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>, "focus" | "getInputNode">>, string | number | symbol> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/input").InputProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>> & Pick<import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>, "focus" | "getInputNode">, {}>;
24
23
  export default _default;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @component 列表
3
+ * @en List
4
+ * * @remarks 同 Next List,列表组件。- Same as Next List component.
5
+ * @type 通用 - General
6
+ * @when 最基础的列表展示,可承载文字、列表、图片、段落。
7
+ */
8
+ export { List as default } from '@alifd/next';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * @component 列表
4
+ * @en List
5
+ * * @remarks 同 Next List,列表组件。- Same as Next List component.
6
+ * @type 通用 - General
7
+ * @when 最基础的列表展示,可承载文字、列表、图片、段落。
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.default = void 0;
11
+ var next_1 = require("@alifd/next");
12
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return next_1.List; } });
@@ -0,0 +1 @@
1
+ import '@alifd/next/lib/list/style2';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("@alifd/next/lib/list/style2");
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import type { ReactElement, ReactNode } from 'react';
3
+ import type { LoadingProps } from '@alifd/next/types/loading';
4
+ import { type CommonProps } from '@alifd/next';
5
+ type HTMLAttributesWeak = Omit<React.HTMLAttributes<HTMLElement>, 'title'>;
6
+ /**
7
+ * @api List
8
+ */
9
+ export interface ListProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
10
+ /**
11
+ * 列表头部
12
+ * @en List header
13
+ */
14
+ header?: ReactNode;
15
+ /**
16
+ * 列表尾部
17
+ * @en List footer
18
+ */
19
+ footer?: ReactNode;
20
+ /**
21
+ * 列表尺寸
22
+ * @en List size
23
+ * @defaultValue 'medium'
24
+ */
25
+ size?: 'medium' | 'small';
26
+ /**
27
+ * 是否显示分割线
28
+ * @en Whether to show the divider
29
+ * @defaultValue true
30
+ */
31
+ divider?: boolean;
32
+ /**
33
+ * children
34
+ */
35
+ children?: ReactNode;
36
+ /**
37
+ * 列表项数据源
38
+ * @en List item data source
39
+ */
40
+ dataSource?: unknown[];
41
+ /**
42
+ * 当使用 dataSource 时,可以用 renderItem 自定义渲染列表项
43
+ * @param current - 当前遍历的项 - The current item
44
+ * @param index - 当前遍历的项的索引 - The index of the current item
45
+ * @returns - 自定义渲染的 ReactElement - The ReactElement be customized
46
+ */
47
+ renderItem?: (current: unknown, index: number) => ReactElement;
48
+ /**
49
+ * loading 状态控制
50
+ * @en Loading state control
51
+ * @defaultValue false
52
+ */
53
+ loading?: boolean;
54
+ /**
55
+ * 自定义 Loading 组件
56
+ * @en Custom Loading component
57
+ * @param props - 透传 props - Pass through props
58
+ * @returns - 自定义的 Loading 组件 - Custom Loading component
59
+ * @remarks 请务必透传 props, 使用方式:loadingComponent=\{props =\> \<Loading \{...props\}/\>\}
60
+ */
61
+ loadingComponent?: (props: LoadingProps) => ReactElement;
62
+ /**
63
+ * 当列表为空时显示的内容
64
+ * @en The content displayed when the list is empty
65
+ */
66
+ emptyContent?: ReactNode;
67
+ }
68
+ /**
69
+ * @api List.Item
70
+ */
71
+ export interface ListItemProps extends HTMLAttributesWeak, CommonProps {
72
+ /**
73
+ * 列表元素的标题
74
+ * @en The title of the list item
75
+ */
76
+ title?: ReactNode;
77
+ /**
78
+ * 列表元素的描述内容
79
+ * @en The description of the list item
80
+ */
81
+ description?: ReactNode;
82
+ /**
83
+ * 列表元素的头像 / 图标 / 图片内容
84
+ * @en The avatar / icon / image content of the list item
85
+ */
86
+ media?: ReactNode;
87
+ /**
88
+ * 额外内容
89
+ * @en Extra content
90
+ */
91
+ extra?: ReactNode;
92
+ }
93
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { MarkdownProps } from './types';
3
+ import 'highlight.js/styles/github.css';
4
+ export * from './types';
5
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<MarkdownProps & React.RefAttributes<HTMLDivElement>, "key" | keyof MarkdownProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, HTMLDivElement, {}>;
6
+ export default _default;
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
6
+ const markdown_it_1 = tslib_1.__importDefault(require("markdown-it"));
7
+ const HTMLRenderer_1 = tslib_1.__importDefault(require("../HTMLRenderer"));
8
+ const next_1 = require("@alifd/next");
9
+ const utils_1 = require("../utils");
10
+ const dingtalk_im_emoji_1 = require("@ali/dingtalk-im-emoji");
11
+ const highlight_js_1 = tslib_1.__importDefault(require("highlight.js")); // 引入 highlight.js
12
+ require("highlight.js/styles/github.css"); // 引入代码高亮样式
13
+ /**
14
+ * @component Markdown
15
+ * @en Markdown
16
+ * @type 通用 - General
17
+ * @remarks Markdown 组件用于解析和渲染 Markdown 文本内容。 - Markdown component used to parse and render Markdown text content.
18
+ * @when 需要解析和渲染 Markdown 文本内容时使用。 - Use when you need to parse and render Markdown text content.
19
+ */
20
+ const Markdown = (0, react_1.forwardRef)(({ className, onReady, content }, ref) => {
21
+ (0, react_1.useEffect)(() => {
22
+ // 初始化表情库
23
+ (0, dingtalk_im_emoji_1.init)();
24
+ onReady === null || onReady === void 0 ? void 0 : onReady();
25
+ }, [onReady]);
26
+ const containerRef = (0, react_1.useRef)(null);
27
+ // 处理 HTML 标签
28
+ const processedContent = (0, react_1.useMemo)(() => {
29
+ const regex = /<font\s+([^>]+)>([^<]+)<\/font>/g;
30
+ return content.replace(regex, (match, attributes, text) => {
31
+ let sizeToken = '';
32
+ let colorTokenV2 = '';
33
+ // 提取属性
34
+ const sizeTokenMatch = attributes.match(/sizeToken=([\w_]+)/);
35
+ const colorTokenV2Match = attributes.match(/colorTokenV2=([\w_]+)/);
36
+ if (sizeTokenMatch) {
37
+ sizeToken = sizeTokenMatch[1].replace(/-/g, '_');
38
+ }
39
+ if (colorTokenV2Match) {
40
+ colorTokenV2 = colorTokenV2Match[1].replace(/-/g, '_');
41
+ }
42
+ // 生成样式
43
+ const styleParts = [];
44
+ if (sizeToken) {
45
+ styleParts.push(`font-size: var(--${sizeToken})`);
46
+ }
47
+ if (colorTokenV2) {
48
+ styleParts.push(`color: var(--${colorTokenV2})`);
49
+ }
50
+ const style = styleParts.join('; ');
51
+ return `<span style="${style}">${text}</span>`;
52
+ });
53
+ }, [content]);
54
+ // 转换表情符号
55
+ let transformedContent = (0, react_1.useMemo)(() => {
56
+ return (0, dingtalk_im_emoji_1.transformTextWithEmoji)(processedContent, {
57
+ genFrame: (name, url) => {
58
+ return {
59
+ htmlTag: 'img',
60
+ selfClose: true,
61
+ attr: {
62
+ draggable: 'false',
63
+ style: 'vertical-align: text-center; display: inline-block; pointer-events: none;', // 使用相对单位和 inline-block 显示
64
+ class: 'emoji',
65
+ title: '[' + name + ']',
66
+ src: url.url || url.staticURL,
67
+ alt: name,
68
+ },
69
+ };
70
+ },
71
+ });
72
+ }, [processedContent]);
73
+ // 渲染 Markdown
74
+ const html = (0, react_1.useMemo)(() => {
75
+ const md = new markdown_it_1.default({
76
+ html: true, // 确保允许解析 HTML 标签
77
+ xhtmlOut: true,
78
+ breaks: true,
79
+ langPrefix: 'language-',
80
+ linkify: true,
81
+ typographer: true,
82
+ highlight: (str, lang) => {
83
+ if (lang && highlight_js_1.default.getLanguage(lang)) {
84
+ try {
85
+ return highlight_js_1.default.highlight(lang, str, true).value;
86
+ }
87
+ catch (__) { }
88
+ }
89
+ return '';
90
+ }
91
+ });
92
+ // console.log(transformedContent, processedContent);
93
+ // 这里的 </ xx> 都被转成了&#x2F , 所以会font标签的元素 后面都会多一个 </ xx>
94
+ transformedContent = transformedContent.replace(/<&#x2F;/g, '</');
95
+ return md.render(transformedContent);
96
+ }, [transformedContent]);
97
+ (0, react_1.useEffect)(() => {
98
+ if (containerRef.current) {
99
+ // 清除现有的 .code-block-header 元素
100
+ const existingHeaders = containerRef.current.querySelectorAll('.code-block-header');
101
+ existingHeaders.forEach(header => header.remove());
102
+ const codeBlocks = containerRef.current.querySelectorAll('pre code');
103
+ codeBlocks.forEach((block) => {
104
+ var _a;
105
+ const code = block.textContent || '';
106
+ const pre = block.parentElement;
107
+ const lang = block.className.replace('language-', '') || 'plaintext';
108
+ // 创建代码块头部
109
+ const header = document.createElement('div');
110
+ header.className = 'code-block-header';
111
+ // 创建语言标签
112
+ const languageSpan = document.createElement('span');
113
+ languageSpan.className = 'code-block-language';
114
+ languageSpan.textContent = lang;
115
+ // 创建复制按钮
116
+ const copyButton = document.createElement('button');
117
+ copyButton.className = 'code-block-copy';
118
+ copyButton.textContent = '复制';
119
+ copyButton.onclick = () => {
120
+ navigator.clipboard.writeText(code).then(() => {
121
+ copyButton.textContent = '已复制';
122
+ setTimeout(() => {
123
+ copyButton.textContent = '复制';
124
+ }, 1000);
125
+ });
126
+ };
127
+ header.appendChild(languageSpan);
128
+ header.appendChild(copyButton);
129
+ // 插入头部到代码块前
130
+ (_a = pre === null || pre === void 0 ? void 0 : pre.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(header, pre);
131
+ });
132
+ }
133
+ }, [html]);
134
+ return (react_1.default.createElement("div", { ref: containerRef, className: (0, classnames_1.default)(className) },
135
+ react_1.default.createElement(HTMLRenderer_1.default, { imagePreview: true }, html)));
136
+ });
137
+ const MarkdownWithSub = (0, utils_1.assignSubComponent)(Markdown, {
138
+ displayName: 'Markdown',
139
+ });
140
+ tslib_1.__exportStar(require("./types"), exports);
141
+ exports.default = next_1.ConfigProvider.config(MarkdownWithSub);
@@ -0,0 +1,153 @@
1
+ $primaryColor: #0080ff;
2
+ $alternativePrimaryColor: $primaryColor;
3
+ $mistPrimaryColor: fadeout($alternativePrimaryColor,93);
4
+ $mediumTextColor: hsla(230,60%,11%,0.7);
5
+ $subTextColor: hsla(230,90%,11%,0.45);
6
+
7
+ @mixin f-single-line() {
8
+ overflow: hidden;
9
+ white-space: nowrap;
10
+ text-overflow: ellipsis;
11
+ }
12
+
13
+ .box {
14
+ max-width: 100%;
15
+ }
16
+
17
+ .box img:only-child, .box video:only-child, .box .image:only-child {
18
+ display: inline-block;
19
+ margin: 0;
20
+ font-size: inherit;
21
+ vertical-align: inherit;
22
+ }
23
+
24
+ .emoji {
25
+ width: 1em;
26
+ height: 1em;
27
+ vertical-align: text-top;
28
+ display: inline-block;
29
+ pointer-events: none;
30
+ }
31
+
32
+ .title {
33
+ font-size: 16px;
34
+ font-weight: bolder;
35
+ margin-bottom: 12px;
36
+ }
37
+
38
+ .text > div {
39
+ color:$subTextColor;
40
+ }
41
+
42
+ .reference {
43
+ margin-top: 6px;
44
+ font-size: 12px;
45
+
46
+ &-tip {
47
+ display: flex;
48
+ margin: 0 -16px 6px 0;
49
+ justify-content: flex-end;
50
+
51
+ &-inner {
52
+ @include f-single-line();
53
+ background: linear-gradient(to right, transparent, $mistPrimaryColor);
54
+ padding: 0 16px 0 32px;
55
+ color: $mediumTextColor;
56
+ min-width: 0;
57
+ flex: 0 1 auto;
58
+ font-size: 12px;
59
+ line-height: 20px;
60
+ }
61
+ }
62
+ }
63
+
64
+ .trustworthyRiskAlert {
65
+ font-size: 12px;
66
+ line-height: 18px;
67
+ color: $subTextColor;
68
+ margin-bottom: 8px;
69
+ }
70
+ .code-block-header {
71
+ display: flex;
72
+ height:24px;
73
+ // margin-top: 8px;
74
+ justify-content: space-between;
75
+ align-items: center;
76
+ background-color: #EAECED;
77
+ padding: 5px 10px;
78
+ border-top-left-radius: 4px;
79
+ border-top-right-radius: 4px;
80
+ border-bottom: 1px solid #ddd;
81
+ }
82
+
83
+ .code-block-language {
84
+ font-weight: bold;
85
+ }
86
+
87
+ .code-block-copy {
88
+ color: var(--common_level3_base_color);
89
+ border: none;
90
+ border-radius: 4px;
91
+ height: 20px;
92
+ cursor: pointer;
93
+ }
94
+
95
+ pre {
96
+ background-color: #f8f8f8;
97
+ border-bottom-left-radius: 14px;
98
+ border-bottom-right-radius: 14px;
99
+ padding: 10px;
100
+ margin-bottom: 10px;
101
+ }
102
+
103
+ .code-block-copy:hover {
104
+ background-color: #d2d2d2;
105
+ }
106
+
107
+ :root {
108
+ --common_hypertitle_text_style__font_size: 64px;
109
+ --common_largetitle_text_style__font_size: 32px;
110
+ --common_h1_text_style__font_size: 24px;
111
+ --common_h2_text_style__font_size: 20px;
112
+ --common_h3_text_style__font_size: 18px;
113
+ --common_h4_text_style__font_size: 16px;
114
+ --common_h5_text_style__font_size: 15px;
115
+ --common_body_text_style__font_size: 14px;
116
+ --common_footnote_text_style__font_size: 12px;
117
+
118
+ --common_yellow1_color: #e5c442;
119
+ --common_orange1_color: #f1a13b;
120
+ --common_red1_color: #ec6033;
121
+ --common_pink1_color: #da5388;
122
+ --common_purple1_color: #af68cd;
123
+ --common_blue1_color: #387df6;
124
+ --common_water1_color: #79c6f5;
125
+ --common_olive1_color: #77912b;
126
+ --common_green1_color: #4fae51;
127
+ --common_level1_base_color: #1a1a1f;
128
+ --common_level2_base_color: #777578;
129
+ --common_level3_base_color: #a2a3a5;
130
+ --common_level4_base_color: #c8c8c9;
131
+ --common_gray1_color: #888f94;
132
+ --common_gray2_color: #abafb3;
133
+ --common_gray3_color: #c4c7ca;
134
+ --common_gray4_color: #696969;
135
+ --common_gray5_color: #e5e6e8;
136
+ --common_gray6_color: #f0f1f2;
137
+ }
138
+
139
+ //暗黑模式的变量设置
140
+ @media (prefers-color-scheme: dark), (min-width: 0px) {
141
+ :root {
142
+ --common_level4_base_color:#47484a;
143
+ --common_gray1_color:#bebebe;
144
+ --common_gray2_color:#646464;
145
+ --common_gray3_color:#4b4b4b;
146
+ --common_gray4_color:#3a3a3a;
147
+ --common_gray5_color:#2c2c2c;
148
+ --common_gray6_color:#1e1e1e;
149
+ --common_level1_base_color:#D1D1D1;
150
+ --common_level2_base_color: #8C8C8D;
151
+ --common_level3_base_color:#757577;
152
+ }
153
+ }
@@ -0,0 +1,3 @@
1
+ import '../HTMLRenderer/style';
2
+ import './main.scss';
3
+ import 'highlight.js/styles/github.css';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("../HTMLRenderer/style");
4
+ require("./main.scss");
5
+ require("highlight.js/styles/github.css");