@yuntijs/ui 1.0.0-beta.87 → 1.0.0-beta.89

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.
@@ -11,10 +11,11 @@ import { ConfigProvider } from 'antd';
11
11
  import { $getRoot, TextNode } from 'lexical';
12
12
  import React, { useMemo } from 'react';
13
13
  import { isBrowser } from "../utils/tools";
14
+ import { OnBlurBlockPlugin } from "./plugins/OnBlurBlockPlugin";
14
15
  import { CustomTextNode } from "./plugins/custom-text/node";
16
+ import { EditablePlugin } from "./plugins/editable";
15
17
  import { MentionNode, MentionNodePlugin, MentionNodePluginReplacement } from "./plugins/mention-node";
16
18
  import { MentionPickerPlugin } from "./plugins/mention-picker";
17
- import OnBlurBlock from "./plugins/on-blur-or-focus-block";
18
19
  import { MentionsConfigProvider } from "./provider";
19
20
  import { useStyles } from "./style";
20
21
  import { textToEditorState } from "./utils";
@@ -51,8 +52,12 @@ export var Mentions = function Mentions(_ref) {
51
52
  }),
52
53
  styles = _useStyles.styles,
53
54
  cx = _useStyles.cx;
54
- var disabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : componentDisabled;
55
- var editable = !readOnly && !disabled;
55
+ var disabled = useMemo(function () {
56
+ return customDisabled !== null && customDisabled !== void 0 ? customDisabled : componentDisabled;
57
+ }, [componentDisabled, customDisabled]);
58
+ var editable = useMemo(function () {
59
+ return !readOnly && !disabled;
60
+ }, [disabled, readOnly]);
56
61
  var initialConfig = useMemo(function () {
57
62
  return {
58
63
  namespace: 'mentions',
@@ -130,7 +135,7 @@ export var Mentions = function Mentions(_ref) {
130
135
  className: styles.placeholder,
131
136
  children: placeholder || "\u8F93\u5165 ".concat(triggers.join(' 或 '), " \u63D2\u5165\u5F15\u7528")
132
137
  })
133
- }), /*#__PURE__*/_jsx(MentionPickerPlugin, {
138
+ }), editable && /*#__PURE__*/_jsx(MentionPickerPlugin, {
134
139
  allowSpaces: allowSpaces,
135
140
  onSelect: onSelect,
136
141
  options: options,
@@ -140,9 +145,11 @@ export var Mentions = function Mentions(_ref) {
140
145
  triggers: triggers
141
146
  }), /*#__PURE__*/_jsx(MentionNodePlugin, {}), /*#__PURE__*/_jsx(MentionNodePluginReplacement, {}), /*#__PURE__*/_jsx(HistoryPlugin, {}), /*#__PURE__*/_jsx(OnChangePlugin, {
142
147
  onChange: handleEditorChange
143
- }), /*#__PURE__*/_jsx(OnBlurBlock, {
148
+ }), /*#__PURE__*/_jsx(OnBlurBlockPlugin, {
144
149
  onBlur: onBlur,
145
150
  onFocus: onFocus
151
+ }), /*#__PURE__*/_jsx(EditablePlugin, {
152
+ editable: editable
146
153
  })]
147
154
  })
148
155
  })
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ type OnBlurBlockPluginProps = {
3
+ onBlur?: () => void;
4
+ onFocus?: () => void;
5
+ };
6
+ export declare const OnBlurBlockPlugin: FC<OnBlurBlockPluginProps>;
7
+ export {};
@@ -4,7 +4,7 @@ import { mergeRegister } from '@lexical/utils';
4
4
  import { BLUR_COMMAND, COMMAND_PRIORITY_EDITOR, FOCUS_COMMAND, KEY_ESCAPE_COMMAND } from 'lexical';
5
5
  import { useEffect, useRef } from 'react';
6
6
  import { CLEAR_HIDE_MENU_TIMEOUT } from "./mention-node";
7
- var OnBlurBlock = function OnBlurBlock(_ref) {
7
+ export var OnBlurBlockPlugin = function OnBlurBlockPlugin(_ref) {
8
8
  var onBlur = _ref.onBlur,
9
9
  onFocus = _ref.onFocus;
10
10
  var _useLexicalComposerCo = useLexicalComposerContext(),
@@ -32,5 +32,4 @@ var OnBlurBlock = function OnBlurBlock(_ref) {
32
32
  }, COMMAND_PRIORITY_EDITOR));
33
33
  }, [editor, onBlur, onFocus]);
34
34
  return null;
35
- };
36
- export default OnBlurBlock;
35
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const EditablePlugin: React.FC<{
3
+ editable: boolean;
4
+ }>;
@@ -0,0 +1,13 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
+ import { useEffect } from 'react';
4
+ export var EditablePlugin = function EditablePlugin(_ref) {
5
+ var editable = _ref.editable;
6
+ var _useLexicalComposerCo = useLexicalComposerContext(),
7
+ _useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
8
+ editor = _useLexicalComposerCo2[0];
9
+ useEffect(function () {
10
+ editor.setEditable(editable);
11
+ }, [editable, editor]);
12
+ return null;
13
+ };
package/es/index.d.ts CHANGED
@@ -23,7 +23,6 @@ export * from './Form';
23
23
  export * from './FormHelper';
24
24
  export * from './Modal';
25
25
  export * from './notification';
26
- export * from './Radio';
27
26
  export * from './Table';
28
27
  export * from './Tree';
29
28
  export * from './Typography';
@@ -37,7 +36,7 @@ export * from './WaveformIcon';
37
36
  export { Affix, type AffixProps, Anchor, type AnchorProps, type MentionProps as AntdMentionProps, Mentions as AntdMentions, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, BackTop, type BackTopProps, Badge, // @todo composed type
38
37
  type BadgeProps, Button, // @todo dependence unifiedLink. link type, hover primary color, back button
39
38
  type ButtonProps, Calendar, type CalendarProps, Carousel, type CarouselProps, Cascader, type CascaderProps, Checkbox, type CheckboxProps, Col, Collapse, type CollapseProps, ColorPicker, type ColorPickerProps, type ColProps, // @todo center style
40
- type CountdownProps, DatePicker, type DatePickerProps, Empty, type EmptyProps, Flex, type FlexProps, FloatButton, type GlobalToken, Grid, Image, type ImageProps, Input, InputNumber, type InputNumberProps, type InputProps, type InputRef, Layout, type LayoutProps, List, type ListProps, type MappingAlgorithm, Menu, type MenuItemProps, type MenuProps, type MenuRef, type MenuTheme, message, type MessageArgsProps, Pagination, type PaginationProps, Popconfirm, type PopconfirmProps, Popover, type PopoverProps, Progress, type ProgressProps, QRCode, type QRCodeProps, type QRPropsCanvas, type QRPropsSvg, Rate, type RateProps, type RefSelectProps, Result, type ResultProps, Row, type RowProps, Segmented, type SegmentedProps, Select, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderSingleProps, Space, type SpaceProps, Spin, type SpinProps, Statistic, type StatisticProps, type StepProps, Steps, type StepsProps, type SubMenuProps, Switch, type SwitchProps, type TabPaneProps, Tabs, type TabsProps, Tag, type TagProps, type TagType, theme, Timeline, type TimelineItemProps, type TimelineProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, Tooltip, type TooltipProps, Tour, type TourProps, type TourStepProps, Transfer, type TransferProps, Tree, type TreeDataNode, type TreeNodeProps, type TreeProps, TreeSelect, type TreeSelectProps, Upload, type UploadFile, type UploadProps, version, Watermark, type WatermarkProps, } from 'antd';
39
+ type CountdownProps, DatePicker, type DatePickerProps, Empty, type EmptyProps, Flex, type FlexProps, FloatButton, type GlobalToken, Grid, Image, type ImageProps, Input, InputNumber, type InputNumberProps, type InputProps, type InputRef, Layout, type LayoutProps, List, type ListProps, type MappingAlgorithm, Menu, type MenuItemProps, type MenuProps, type MenuRef, type MenuTheme, message, type MessageArgsProps, Pagination, type PaginationProps, Popconfirm, type PopconfirmProps, Popover, type PopoverProps, Progress, type ProgressProps, QRCode, type QRCodeProps, type QRPropsCanvas, type QRPropsSvg, Radio, type RadioGroupProps, type RadioProps, Rate, type RateProps, type RefSelectProps, Result, type ResultProps, Row, type RowProps, Segmented, type SegmentedProps, Select, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderSingleProps, Space, type SpaceProps, Spin, type SpinProps, Statistic, type StatisticProps, type StepProps, Steps, type StepsProps, type SubMenuProps, Switch, type SwitchProps, type TabPaneProps, Tabs, type TabsProps, Tag, type TagProps, type TagType, theme, Timeline, type TimelineItemProps, type TimelineProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, Tooltip, type TooltipProps, Tour, type TourProps, type TourStepProps, Transfer, type TransferProps, Tree, type TreeDataNode, type TreeNodeProps, type TreeProps, TreeSelect, type TreeSelectProps, Upload, type UploadFile, type UploadProps, version, Watermark, type WatermarkProps, } from 'antd';
41
40
  export { CopyButton, type CopyButtonProps, Markdown, type MarkdownProps, SyntaxHighlighter, type SyntaxHighlighterProps, } from '@lobehub/ui';
42
41
  export { SpeechSynthesisTTS } from '@lobehub/tts';
43
42
  export { AudioPlayer, useAudioPlayer, useSpeechRecognition } from '@lobehub/tts/react';
package/es/index.js CHANGED
@@ -25,7 +25,6 @@ export * from "./Form";
25
25
  export * from "./FormHelper";
26
26
  export * from "./Modal";
27
27
  export * from "./notification";
28
- export * from "./Radio";
29
28
  export * from "./Table";
30
29
  export * from "./Tree";
31
30
  export * from "./Typography";
@@ -47,7 +46,7 @@ export { Affix, Anchor, Mentions as AntdMentions, AutoComplete, Avatar, BackTop,
47
46
  , Calendar, Carousel, Cascader, Checkbox, Col, Collapse, ColorPicker
48
47
 
49
48
  // @todo center style
50
- , DatePicker, Empty, Flex, FloatButton, Grid, Image, Input, InputNumber, Layout, List, Menu, message, Pagination, Popconfirm, Popover, Progress, QRCode, Rate, Result, Row, Segmented, Select, Skeleton, Slider, Space, Spin, Statistic, Steps, Switch, Tabs, Tag, theme, Timeline, TimePicker, Tooltip, Tour, Transfer, Tree, TreeSelect, Upload, version, Watermark } from 'antd';
49
+ , DatePicker, Empty, Flex, FloatButton, Grid, Image, Input, InputNumber, Layout, List, Menu, message, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, Result, Row, Segmented, Select, Skeleton, Slider, Space, Spin, Statistic, Steps, Switch, Tabs, Tag, theme, Timeline, TimePicker, Tooltip, Tour, Transfer, Tree, TreeSelect, Upload, version, Watermark } from 'antd';
51
50
 
52
51
  // ~ @lobehub/ui
53
52
  export { CopyButton, Markdown, SyntaxHighlighter } from '@lobehub/ui';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuntijs/ui",
3
- "version": "1.0.0-beta.87",
3
+ "version": "1.0.0-beta.89",
4
4
  "description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
5
5
  "keywords": [
6
6
  "yuntijs",