@flatbiz/antd 4.4.1 → 4.4.3
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/esm/card-layout/index.css +1 -1
- package/esm/color-picker-wrapper/index.js +1 -1
- package/esm/color-picker-wrapper/index.js.map +1 -1
- package/esm/drag-editable-table/index.js +1 -1
- package/esm/drag-table/index.js +1 -1
- package/esm/drag-table/index.js.map +1 -1
- package/esm/editable-field/index.js +1 -1
- package/esm/editable-field/index.js.map +1 -1
- package/esm/editable-table/index.css +1 -1
- package/esm/editable-table/index.js +1 -1
- package/esm/editable-table/index.js.map +1 -1
- package/esm/fba-app/index.js +1 -1
- package/esm/fba-app/index.js.map +1 -1
- package/esm/icon-wrapper/index.css +1 -1
- package/esm/icon-wrapper/index.js +1 -1
- package/esm/icon-wrapper/index.js.map +1 -1
- package/esm/index.js +2 -1
- package/esm/mentions-wrapper/index.css +0 -0
- package/esm/mentions-wrapper/index.js +5 -0
- package/esm/mentions-wrapper/index.js.map +1 -0
- package/esm/rich-text-viewer/index.js +1 -1
- package/esm/rich-text-viewer/index.js.map +1 -1
- package/esm/switch-wrapper/index.js.map +1 -1
- package/esm/text-symbol-wrapper/index.css +1 -1
- package/esm/text-symbol-wrapper/index.js +1 -1
- package/esm/text-symbol-wrapper/index.js.map +1 -1
- package/index.d.ts +56 -5
- package/package.json +1 -1
package/esm/index.js
CHANGED
|
@@ -73,6 +73,7 @@ import './input-search-wrapper/index.css';
|
|
|
73
73
|
import './json-editor/index.css';
|
|
74
74
|
import './label-value-layout/index.css';
|
|
75
75
|
import './local-loading/index.css';
|
|
76
|
+
import './mentions-wrapper/index.css';
|
|
76
77
|
import './modal-action/index.css';
|
|
77
78
|
import './modal-wrapper/index.css';
|
|
78
79
|
import './page-fixed-footer/index.css';
|
|
@@ -109,5 +110,5 @@ import './tree-selector-wrapper/index.css';
|
|
|
109
110
|
import './tree-wrapper/index.css';
|
|
110
111
|
import './index.css';
|
|
111
112
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
112
|
-
export{AlertWrapper}from"./alert-wrapper/index.js";export{AmountFenInput}from"./amount-fen-input/index.js";export{AmountFenInputFormItem}from"./amount-fen-input-form-item/index.js";export{AnchorSteps}from"./anchor-steps/index.js";export{B as BlockLayout}from"./index-1f45bfd5.js";export{Bootstrap}from"./bootstrap/index.js";export{ButtonOperate,ButtonOperateItemContent}from"./button-operate/index.js";export{ButtonWrapper}from"./button-wrapper/index.js";export{CardLayout}from"./card-layout/index.js";export{CardWrapper}from"./card-wrapper/index.js";export{CascaderWrapper}from"./cascader-wrapper/index.js";export{CheckList}from"./check-list/index.js";export{CheckboxWrapper}from"./checkbox-wrapper/index.js";export{ColorPickerWrapper}from"./color-picker-wrapper/index.js";export{C as ConfigProviderWrapper}from"./index-7f4ad045.js";export{createDrawerWrapperModel}from"./create-drawer-wrapper-model/index.js";export{createModalWrapperModel}from"./create-modal-wrapper-model/index.js";export{CssNodeHover}from"./css-node-hover/index.js";export{DataRender}from"./data-render/index.js";export{DatePickerWrapper}from"./date-picker-wrapper/index.js";export{DateRangePickerWrapper}from"./date-range-picker-wrapper/index.js";export{DateRangePickerWrapperFormItem}from"./date-range-picker-wrapper-form-item/index.js";export{dialogAlert}from"./dialog-alert/index.js";export{dialogConfirm}from"./dialog-confirm/index.js";export{dialogDrawer}from"./dialog-drawer/index.js";export{DialogDrawerContent}from"./dialog-drawer-content/index.js";export{dialogLoading}from"./dialog-loading/index.js";export{dialogModal}from"./dialog-modal/index.js";export{DragCollapse}from"./drag-collapse/index.js";export{DragCollapseFormList}from"./drag-collapse-form-list/index.js";export{DragEditableTable}from"./drag-editable-table/index.js";export{DragFormList}from"./drag-form-list/index.js";export{DragTable}from"./drag-table/index.js";export{DrawerWrapper}from"./drawer-wrapper/index.js";export{DropdownMenuWrapper}from"./dropdown-menu-wrapper/index.js";export{dynamicNode}from"./dynamic-node/index.js";export{EasyTable}from"./easy-table/index.js";export{EditableField}from"./editable-field/index.js";export{EditableFieldProvider}from"./editable-field-provider/index.js";export{EditableTable}from"./editable-table/index.js";export{EditorWrapper}from"./editor-wrapper/index.js";export{ErrorBoundaryWrapper}from"./error-boundary-wrapper/index.js";export{FbaApp}from"./fba-app/index.js";export{fbaHooks}from"./fba-hooks/index.js";export{fbaUtils}from"./fba-utils/index.js";export{FileImport}from"./file-import/index.js";export{FileSelect}from"./file-select/index.js";export{FlexLayout}from"./flex-layout/index.js";export{FormGrid}from"./form-grid/index.js";export{FormItemGroup}from"./form-item-group/index.js";export{FormItemHidden}from"./form-item-hidden/index.js";export{FormItemText}from"./form-item-text/index.js";export{FormItemWrapper}from"./form-item-wrapper/index.js";export{FormListWrapper}from"./form-list-wrapper/index.js";export{Gap}from"./gap/index.js";export{IconWrapper}from"./icon-wrapper/index.js";export{InputSearchWrapper}from"./input-search-wrapper/index.js";export{InputTextAreaWrapper}from"./input-text-area-wrapper/index.js";export{InputWrapper}from"./input-wrapper/index.js";export{JsonEditor}from"./json-editor/index.js";export{LabelValueLayout}from"./label-value-layout/index.js";export{LocalLoading}from"./local-loading/index.js";export{ModalAction}from"./modal-action/index.js";export{ModalWrapper}from"./modal-wrapper/index.js";export{PageFixedFooter}from"./page-fixed-footer/index.js";export{Page404}from"./page404/index.js";export{P as PaginationWrapper}from"./index-6677fbfc.js";export{Permission}from"./permission/index.js";export{preDefinedClassName}from"./pre-defined-class-name/index.js";export{RadioGroupWrapper}from"./radio-group-wrapper/index.js";export{RelationTree}from"./relation-tree/index.js";export{RequestStatus}from"./request-status/index.js";export{RichTextEditor}from"./rich-text-editor/index.js";export{RichTextViewer}from"./rich-text-viewer/index.js";export{RollLocationCenter}from"./roll-location-center/index.js";export{RollLocationInView}from"./roll-location-in-view/index.js";export{RuleDescribe}from"./rule-describe/index.js";export{SearchForm}from"./search-form/index.js";export{SearchMenu}from"./search-menu/index.js";export{SelectorWrapper}from"./selector-wrapper/index.js";export{SelectorWrapperSearch}from"./selector-wrapper-search/index.js";export{SelectorWrapperSimple}from"./selector-wrapper-simple/index.js";export{SimpleLayout}from"./simple-layout/index.js";export{SmsCountDown}from"./sms-count-down/index.js";export{SplitWrapper}from"./split-wrapper/index.js";export{styles}from"./styles/index.js";export{SvgHttpView}from"./svg-http-view/index.js";export{SwitchConfirmWrapper}from"./switch-confirm-wrapper/index.js";export{SwitchWrapper}from"./switch-wrapper/index.js";export{tableCellRender}from"./table-cell-render/index.js";export{TableScrollbar}from"./table-scrollbar/index.js";export{TableTitleTooltip}from"./table-title-tooltip/index.js";export{TabsWrapper}from"./tabs-wrapper/index.js";export{TagGroup}from"./tag-group/index.js";export{TagListSelect}from"./tag-list-select/index.js";export{TagWrapper}from"./tag-wrapper/index.js";export{TextCssEllipsis}from"./text-css-ellipsis/index.js";export{TextOverflow}from"./text-overflow/index.js";export{TextOverflowRender}from"./text-overflow-render/index.js";export{TextSymbolWrapper}from"./text-symbol-wrapper/index.js";export{TimePickerWrapper}from"./time-picker-wrapper/index.js";export{TimeRangePickerWrapper}from"./time-range-picker-wrapper/index.js";export{TimeRangePickerWrapperFormItem}from"./time-range-picker-wrapper-form-item/index.js";export{TipsTitle}from"./tips-title/index.js";export{TipsWrapper}from"./tips-wrapper/index.js";export{TreeSelectorWrapper}from"./tree-selector-wrapper/index.js";export{TreeWrapper}from"./tree-wrapper/index.js";export{UploadWrapper}from"./upload-wrapper/index.js";import"./_rollupPluginBabelHelpers-a0769acd.js";import"@dimjs/utils/cjs/class-names";import"@flatbiz/utils";import"antd";import"react/jsx-runtime";import"react";import"@dimjs/utils/cjs/get";import"@ant-design/icons/es/icons/MoreOutlined";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/lang/cjs/is-plain-object";import"@dimjs/lang/cjs/is-string";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-array";import"@dimjs/utils/cjs/extend";import"@ant-design/icons/es/icons/RedoOutlined";import"@dimjs/model";import"@dimjs/model-react";import"@wove/react/cjs/create-ctx";import"@ant-design/icons/es/icons/CloseCircleOutlined";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"./time-53b3f55f.js";import"react-dom/client";import"./dom-4d04aa64.js";import"./context-1f2093c6.js";import"ahooks";import"@dimjs/utils/cjs/array";import"@dnd-kit/core";import"@dnd-kit/sortable";import"@ant-design/icons/es/icons/DragOutlined";import"@dnd-kit/utilities";import"@dnd-kit/modifiers";import"@ant-design/icons/es/icons/SaveOutlined";import"@ant-design/icons/es/icons/ExclamationCircleFilled";import"@ant-design/icons/es/icons/DownOutlined";import"@ant-design/icons/es/icons/UpOutlined";import"react-is";import"@ant-design/icons/es/icons/CloseOutlined";import"@ant-design/icons/es/icons/CheckOutlined";import"@dimjs/lang/cjs/is-number";import"@ant-design/icons/es/icons/EditOutlined";import"./context-25d0b686.js";import"@ant-design/icons/es/icons/PlusOutlined";import"@dimjs/lang/cjs/is-boolean";import"@ant-design/icons/es/icons/DeleteOutlined";import"@wove/react/cjs/editor";import"./use-responsive-point-21b8c601.js";import"@dimjs/lang/cjs/is-deep-equal";import"@dimjs/lang/cjs/is-object";import"react-ace";import"@tinymce/tinymce-react";import"@ant-design/icons/es/icons/PlusCircleOutlined";import"@ant-design/icons/es/icons/FullscreenOutlined";import"@dimjs/utils/cjs/json";import"pubsub-js";import"react-split";import"@dimjs/lang/cjs/is-empty";import"@ant-design/icons/es/icons/QuestionCircleOutlined";import"dayjs/plugin/isSameOrAfter";import"dayjs/plugin/isSameOrBefore";import"@ant-design/icons/es/icons/CaretDownFilled";import"dequal";import"@dimjs/utils/cjs/tree";import"react-dom";
|
|
113
|
+
export{AlertWrapper}from"./alert-wrapper/index.js";export{AmountFenInput}from"./amount-fen-input/index.js";export{AmountFenInputFormItem}from"./amount-fen-input-form-item/index.js";export{AnchorSteps}from"./anchor-steps/index.js";export{B as BlockLayout}from"./index-1f45bfd5.js";export{Bootstrap}from"./bootstrap/index.js";export{ButtonOperate,ButtonOperateItemContent}from"./button-operate/index.js";export{ButtonWrapper}from"./button-wrapper/index.js";export{CardLayout}from"./card-layout/index.js";export{CardWrapper}from"./card-wrapper/index.js";export{CascaderWrapper}from"./cascader-wrapper/index.js";export{CheckList}from"./check-list/index.js";export{CheckboxWrapper}from"./checkbox-wrapper/index.js";export{ColorPickerWrapper}from"./color-picker-wrapper/index.js";export{C as ConfigProviderWrapper}from"./index-7f4ad045.js";export{createDrawerWrapperModel}from"./create-drawer-wrapper-model/index.js";export{createModalWrapperModel}from"./create-modal-wrapper-model/index.js";export{CssNodeHover}from"./css-node-hover/index.js";export{DataRender}from"./data-render/index.js";export{DatePickerWrapper}from"./date-picker-wrapper/index.js";export{DateRangePickerWrapper}from"./date-range-picker-wrapper/index.js";export{DateRangePickerWrapperFormItem}from"./date-range-picker-wrapper-form-item/index.js";export{dialogAlert}from"./dialog-alert/index.js";export{dialogConfirm}from"./dialog-confirm/index.js";export{dialogDrawer}from"./dialog-drawer/index.js";export{DialogDrawerContent}from"./dialog-drawer-content/index.js";export{dialogLoading}from"./dialog-loading/index.js";export{dialogModal}from"./dialog-modal/index.js";export{DragCollapse}from"./drag-collapse/index.js";export{DragCollapseFormList}from"./drag-collapse-form-list/index.js";export{DragEditableTable}from"./drag-editable-table/index.js";export{DragFormList}from"./drag-form-list/index.js";export{DragTable}from"./drag-table/index.js";export{DrawerWrapper}from"./drawer-wrapper/index.js";export{DropdownMenuWrapper}from"./dropdown-menu-wrapper/index.js";export{dynamicNode}from"./dynamic-node/index.js";export{EasyTable}from"./easy-table/index.js";export{EditableField}from"./editable-field/index.js";export{EditableFieldProvider}from"./editable-field-provider/index.js";export{EditableTable}from"./editable-table/index.js";export{EditorWrapper}from"./editor-wrapper/index.js";export{ErrorBoundaryWrapper}from"./error-boundary-wrapper/index.js";export{FbaApp}from"./fba-app/index.js";export{fbaHooks}from"./fba-hooks/index.js";export{fbaUtils}from"./fba-utils/index.js";export{FileImport}from"./file-import/index.js";export{FileSelect}from"./file-select/index.js";export{FlexLayout}from"./flex-layout/index.js";export{FormGrid}from"./form-grid/index.js";export{FormItemGroup}from"./form-item-group/index.js";export{FormItemHidden}from"./form-item-hidden/index.js";export{FormItemText}from"./form-item-text/index.js";export{FormItemWrapper}from"./form-item-wrapper/index.js";export{FormListWrapper}from"./form-list-wrapper/index.js";export{Gap}from"./gap/index.js";export{IconWrapper}from"./icon-wrapper/index.js";export{InputSearchWrapper}from"./input-search-wrapper/index.js";export{InputTextAreaWrapper}from"./input-text-area-wrapper/index.js";export{InputWrapper}from"./input-wrapper/index.js";export{JsonEditor}from"./json-editor/index.js";export{LabelValueLayout}from"./label-value-layout/index.js";export{LocalLoading}from"./local-loading/index.js";export{MentionsWrapper}from"./mentions-wrapper/index.js";export{ModalAction}from"./modal-action/index.js";export{ModalWrapper}from"./modal-wrapper/index.js";export{PageFixedFooter}from"./page-fixed-footer/index.js";export{Page404}from"./page404/index.js";export{P as PaginationWrapper}from"./index-6677fbfc.js";export{Permission}from"./permission/index.js";export{preDefinedClassName}from"./pre-defined-class-name/index.js";export{RadioGroupWrapper}from"./radio-group-wrapper/index.js";export{RelationTree}from"./relation-tree/index.js";export{RequestStatus}from"./request-status/index.js";export{RichTextEditor}from"./rich-text-editor/index.js";export{RichTextViewer}from"./rich-text-viewer/index.js";export{RollLocationCenter}from"./roll-location-center/index.js";export{RollLocationInView}from"./roll-location-in-view/index.js";export{RuleDescribe}from"./rule-describe/index.js";export{SearchForm}from"./search-form/index.js";export{SearchMenu}from"./search-menu/index.js";export{SelectorWrapper}from"./selector-wrapper/index.js";export{SelectorWrapperSearch}from"./selector-wrapper-search/index.js";export{SelectorWrapperSimple}from"./selector-wrapper-simple/index.js";export{SimpleLayout}from"./simple-layout/index.js";export{SmsCountDown}from"./sms-count-down/index.js";export{SplitWrapper}from"./split-wrapper/index.js";export{styles}from"./styles/index.js";export{SvgHttpView}from"./svg-http-view/index.js";export{SwitchConfirmWrapper}from"./switch-confirm-wrapper/index.js";export{SwitchWrapper}from"./switch-wrapper/index.js";export{tableCellRender}from"./table-cell-render/index.js";export{TableScrollbar}from"./table-scrollbar/index.js";export{TableTitleTooltip}from"./table-title-tooltip/index.js";export{TabsWrapper}from"./tabs-wrapper/index.js";export{TagGroup}from"./tag-group/index.js";export{TagListSelect}from"./tag-list-select/index.js";export{TagWrapper}from"./tag-wrapper/index.js";export{TextCssEllipsis}from"./text-css-ellipsis/index.js";export{TextOverflow}from"./text-overflow/index.js";export{TextOverflowRender}from"./text-overflow-render/index.js";export{TextSymbolWrapper}from"./text-symbol-wrapper/index.js";export{TimePickerWrapper}from"./time-picker-wrapper/index.js";export{TimeRangePickerWrapper}from"./time-range-picker-wrapper/index.js";export{TimeRangePickerWrapperFormItem}from"./time-range-picker-wrapper-form-item/index.js";export{TipsTitle}from"./tips-title/index.js";export{TipsWrapper}from"./tips-wrapper/index.js";export{TreeSelectorWrapper}from"./tree-selector-wrapper/index.js";export{TreeWrapper}from"./tree-wrapper/index.js";export{UploadWrapper}from"./upload-wrapper/index.js";import"./_rollupPluginBabelHelpers-a0769acd.js";import"@dimjs/utils/cjs/class-names";import"@flatbiz/utils";import"antd";import"react/jsx-runtime";import"react";import"@dimjs/utils/cjs/get";import"@ant-design/icons/es/icons/MoreOutlined";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/lang/cjs/is-plain-object";import"@dimjs/lang/cjs/is-string";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-array";import"@dimjs/utils/cjs/extend";import"@ant-design/icons/es/icons/RedoOutlined";import"@dimjs/model";import"@dimjs/model-react";import"@wove/react/cjs/create-ctx";import"@ant-design/icons/es/icons/CloseCircleOutlined";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"./time-53b3f55f.js";import"react-dom/client";import"./dom-4d04aa64.js";import"./context-1f2093c6.js";import"ahooks";import"@dimjs/utils/cjs/array";import"@dnd-kit/core";import"@dnd-kit/sortable";import"@ant-design/icons/es/icons/DragOutlined";import"@dnd-kit/utilities";import"@dnd-kit/modifiers";import"@ant-design/icons/es/icons/SaveOutlined";import"@ant-design/icons/es/icons/ExclamationCircleFilled";import"@ant-design/icons/es/icons/DownOutlined";import"@ant-design/icons/es/icons/UpOutlined";import"react-is";import"@ant-design/icons/es/icons/CloseOutlined";import"@ant-design/icons/es/icons/CheckOutlined";import"@dimjs/lang/cjs/is-number";import"@ant-design/icons/es/icons/EditOutlined";import"./context-25d0b686.js";import"@ant-design/icons/es/icons/PlusOutlined";import"@dimjs/lang/cjs/is-boolean";import"@ant-design/icons/es/icons/DeleteOutlined";import"@wove/react/cjs/editor";import"./use-responsive-point-21b8c601.js";import"@dimjs/lang/cjs/is-deep-equal";import"@dimjs/lang/cjs/is-object";import"react-ace";import"@flatbiz/antd";import"@tinymce/tinymce-react";import"@ant-design/icons/es/icons/PlusCircleOutlined";import"@ant-design/icons/es/icons/FullscreenOutlined";import"@dimjs/utils/cjs/json";import"pubsub-js";import"react-split";import"@dimjs/lang/cjs/is-empty";import"@ant-design/icons/es/icons/QuestionCircleOutlined";import"dayjs/plugin/isSameOrAfter";import"dayjs/plugin/isSameOrBefore";import"@ant-design/icons/es/icons/CaretDownFilled";import"dequal";import"@dimjs/utils/cjs/tree";import"react-dom";
|
|
113
114
|
//# sourceMappingURL=index.js.map
|
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import './index.css';
|
|
3
|
+
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
4
|
+
import{a as r,_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{hooks as n}from"@wove/react/cjs/hooks";import{fbaHooks as t}from"@flatbiz/antd";import{toArray as o}from"@flatbiz/utils";import{useEventListener as i}from"ahooks";import{Mentions as a}from"antd";import{useRef as l,useState as u,useMemo as s}from"react";import{jsx as v}from"react/jsx-runtime";var c=function r(e){if(!e.value||!e.overallKeyWords.length)return[];var n=Array.from(new Set(e.overallKeyWords||[]));var t=[];n.forEach((function(r){var n;if(!((n=e.value)!=null&&n.includes(r)))return;var o=r.replace(/\$/g,"\\$").replace(/\{/g,"\\{").replace(/\}/g,"\\}").replace(/\]/g,"\\]").replace(/\[/g,"\\[");var i=new RegExp(o,"g");var a=[];var l;while((l=i.exec(e.value))!==null){a.push(l.index)}var u=[];a.forEach((function(e){u.push({start:e+1,end:e+r.length})}));t.push(u)}));return t};var f=function r(e){for(var n=0;n<e.keyWordsPosition.length;n++){var t=e.keyWordsPosition[n].find((function(r){return e.cursorPosition>=r.start&&e.cursorPosition<r.end}));if(t)return t}return undefined};var d=["value","onChange","onClick","onCursorChange","options","prefix"];var g=function g(p){var h=p.value,m=p.onChange,k=p.onClick,y=p.onCursorChange,P=p.options,S=p.prefix,w=r(p,d);var C=n.useId(undefined,"overall-input");var R=l();var W=u(0),b=W[0],x=W[1];var A=l(false);var E=h||"";var j=s((function(){if(P){return c({overallKeyWords:P||[],value:E})}return[]}),[P,E]);var K=function r(){var e;return(e=R.current)==null?void 0:e.textarea};t.useEffectCustom((function(){y==null?void 0:y(b||0)}),[b]);i("keydown",(function(r){var e;var n=(e=K())==null?void 0:e.selectionStart;if(["ArrowLeft","ArrowRight"].includes(r.code)){var t=0;if(r.code==="ArrowLeft"){if(n-1<0)return;t=n-1;x(t);var o=f({keyWordsPosition:j,cursorPosition:t});if(o){var i;(i=K())==null?void 0:i.setSelectionRange(o.start,o.start)}}else if(r.code==="ArrowRight"){if(n+1>E.length)return;t=n+1;x(t);var a=f({keyWordsPosition:j,cursorPosition:t});if(a){var l;(l=K())==null?void 0:l.setSelectionRange(a.end-1,a.end-1)}}}else if(r.code==="Backspace"){var u=f({keyWordsPosition:j,cursorPosition:n-1});if(u){A.current=true;var s=E.substring(0,u.start-1)+E.substring(u.end);setTimeout((function(){var r;(r=K())==null?void 0:r.setSelectionRange(u.start-1,u.start-1)}),50);if(!s){A.current=false}m==null?void 0:m(s)}}}),{target:function r(){return document.querySelector("#"+C)}});i("keyup",(function(r){var e;var n=((e=K())==null?void 0:e.selectionStart)||0;if(["ArrowUp","ArrowDown"].includes(r.code)){x(n);var t=f({keyWordsPosition:j,cursorPosition:n});if(t){if(n-t.start<t.end-n){var o;(o=K())==null?void 0:o.setSelectionRange(t.start-1,t.start-1)}else{var i;(i=K())==null?void 0:i.setSelectionRange(t.end,t.end)}}}}),{target:function r(){return document.querySelector("#"+C)}});var q=n.useCallbackRef((function(r){var e;if(w.disabled)return;if(A.current){A.current=false;return}var n=((e=K())==null?void 0:e.selectionStart)||0;x(n);m==null?void 0:m(r)}));var z=n.useCallbackRef((function(r){var e;var n=((e=K())==null?void 0:e.selectionStart)||0;x(n);k==null?void 0:k(r.target.value);var t=f({keyWordsPosition:j,cursorPosition:n});if(t){if(n-t.start<t.end-n){var o;(o=K())==null?void 0:o.setSelectionRange(t.start-1,t.start-1)}else{var i;(i=K())==null?void 0:i.setSelectionRange(t.end,t.end)}}}));var B=s((function(){var r=o(S);return(P==null?void 0:P.map((function(e){var n=e;for(var t=0;t<r.length;t++){var o=r[t];if(n.startsWith(o)){n=n.replace(o,"");break}}return{label:n,value:n}})))||[]}),[P,S]);return v(a,e({notFoundContent:v("div",{children:"暂无数据"}),rows:3},w,{prefix:S,style:e({width:"100%"},w.style),id:C,value:E,ref:R,onChange:q,onClick:z,split:"",validateSearch:function r(e){if(!B.length)return false;var n=B.find((function(r){return e.indexOf(r.value)>=0}));return n&&e.length>n.value.length?false:true},options:B}))};export{g as MentionsWrapper};
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/mentions-wrapper/utils.ts","@flatbiz/antd/src/mentions-wrapper/mentions.tsx"],"sourcesContent":["import { type OverallKeyWordsPosition } from './types';\n\nexport const getOverallKeyWordsPosition = (params: { overallKeyWords: string[]; value?: string }) => {\n if (!params.value || !params.overallKeyWords.length) return [];\n const overallKeyWordsNew = Array.from(new Set(params.overallKeyWords || []));\n const positionItem: OverallKeyWordsPosition[][] = [];\n overallKeyWordsNew.forEach((item) => {\n if (!params.value?.includes(item)) return;\n const newItem = item\n .replace(/\\$/g, '\\\\$')\n .replace(/\\{/g, '\\\\{')\n .replace(/\\}/g, '\\\\}')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\[/g, '\\\\[');\n const regex = new RegExp(newItem, 'g');\n const positions: number[] = [];\n let match;\n // console.log\n while ((match = regex.exec(params.value)) !== null) {\n positions.push(match.index as number);\n }\n const innerList: OverallKeyWordsPosition[] = [];\n positions.forEach((temp) => {\n innerList.push({ start: temp + 1, end: temp + item.length });\n });\n positionItem.push(innerList);\n });\n return positionItem;\n};\n\n/**\n * 判断光标是否处在关键词位置内\n */\nexport const judgmentCursorInKeyWordsPosition = (params: {\n keyWordsPosition: OverallKeyWordsPosition[][];\n cursorPosition: number;\n}) => {\n for (let index = 0; index < params.keyWordsPosition.length; index++) {\n const element = params.keyWordsPosition[index].find((temp) => {\n return params.cursorPosition >= temp.start && params.cursorPosition < temp.end;\n });\n if (element) return element;\n }\n return undefined;\n};\n","import { fbaHooks } from '@flatbiz/antd';\nimport { toArray, type TAny } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { useEventListener } from 'ahooks';\nimport { Mentions, type MentionProps } from 'antd';\nimport { useMemo, useRef, useState } from 'react';\nimport { getOverallKeyWordsPosition, judgmentCursorInKeyWordsPosition } from './utils';\n\nexport type MentionsWrapperProps = Omit<\n MentionProps,\n | 'value'\n | 'onChange'\n | 'onClick'\n | 'onCursorChange'\n | 'options'\n | 'id'\n | 'split'\n | 'validateSearch'\n | 'ref'\n | 'prefix'\n> & {\n value?: string;\n onChange?: (value?: string) => void;\n /** 设置列表提示关键字,例如:@、$等 */\n prefix?: string | string[];\n onClick?: (value?: string) => void;\n /** 光标移动回调 */\n onCursorChange?: (position: number) => void;\n /**\n * 输入框内整体关键词列表\n * ```\n * 整体关键词交互\n * 1. 光标可整体移动\n * 2. 光标不会存在关键词内部\n * 3. 删除时,整体删除\n * ```\n */\n options?: string[];\n};\n\n/**\n * 基于Antd Mentions进行二次封装,可实现输入内关键字整体控制,包括光标移动、关键词删除等\n * ```\n * 可实现\n * 1. 控制光标输入\n * 2. 可设置关键词,光标不会出现在关键词内部\n * 3. 可整体删除关键词\n *\n * 应用场景例如:\n * 1. 公式输入\n * (【xx金额1】+【xx金额2】)*2\n * <MentionsWrapper prefix=\"$\" options={['【xx金额1】', '【xx金额2】']}/>\n *\n * 2. 短信模板设置\n * 您的订单号为${订单号},订单交易时间为${订单时间}\n * <MentionsWrapper prefix=\"$\" options={['${订单号}', '${订单时间}']}/>\n *\n * demo:https://fex.qa.tcshuke.com/docs/admin/main/other/widget\n * ```\n *\n */\nexport const MentionsWrapper = (props: MentionsWrapperProps) => {\n const { value, onChange, onClick, onCursorChange, options, prefix, ...otherProps } = props;\n const id = hooks.useId(undefined, 'overall-input');\n const inputInnerRef = useRef<TAny>();\n const [cursorPosition, setCursorPosition] = useState(0);\n const invalidOnChangeRef = useRef(false);\n const valueNew = value || '';\n /** 关键词位置 */\n const overallKeyWordsPosition = useMemo(() => {\n if (options) {\n return getOverallKeyWordsPosition({\n overallKeyWords: options || [],\n value: valueNew,\n });\n }\n return [];\n }, [options, valueNew]);\n\n const getInputInstance = () => {\n return inputInnerRef.current?.textarea;\n };\n\n fbaHooks.useEffectCustom(() => {\n onCursorChange?.(cursorPosition || 0);\n }, [cursorPosition]);\n\n useEventListener(\n 'keydown',\n (ev) => {\n const selectionStart = getInputInstance()?.selectionStart as number;\n if (['ArrowLeft', 'ArrowRight'].includes(ev.code)) {\n let positionValue = 0;\n if (ev.code === 'ArrowLeft') {\n if (selectionStart - 1 < 0) return;\n positionValue = selectionStart - 1;\n setCursorPosition(positionValue);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: positionValue,\n });\n if (targret) {\n getInputInstance()?.setSelectionRange(targret.start, targret.start);\n }\n } else if (ev.code === 'ArrowRight') {\n if (selectionStart + 1 > valueNew.length) return;\n positionValue = selectionStart + 1;\n setCursorPosition(positionValue);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: positionValue,\n });\n if (targret) {\n getInputInstance()?.setSelectionRange(targret.end - 1, targret.end - 1);\n }\n }\n } else if (ev.code === 'Backspace') {\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart - 1,\n });\n if (targret) {\n invalidOnChangeRef.current = true;\n const result = valueNew.substring(0, targret.start - 1) + valueNew.substring(targret.end);\n setTimeout(() => {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n }, 50);\n if (!result) {\n invalidOnChangeRef.current = false;\n }\n onChange?.(result);\n }\n }\n },\n {\n target: () => {\n return document.querySelector(`#${id}`);\n },\n },\n );\n useEventListener(\n 'keyup',\n (ev) => {\n const selectionStart = getInputInstance()?.selectionStart || 0;\n if (['ArrowUp', 'ArrowDown'].includes(ev.code)) {\n setCursorPosition(selectionStart);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart,\n });\n if (targret) {\n if (selectionStart - targret.start < targret.end - selectionStart) {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n } else {\n getInputInstance()?.setSelectionRange(targret.end, targret.end);\n }\n }\n }\n },\n {\n target: () => {\n return document.querySelector(`#${id}`);\n },\n },\n );\n\n const onInputChange = hooks.useCallbackRef((value) => {\n if (otherProps.disabled) return;\n if (invalidOnChangeRef.current) {\n invalidOnChangeRef.current = false;\n return;\n }\n const selectionStart = getInputInstance()?.selectionStart || 0;\n setCursorPosition(selectionStart);\n onChange?.(value);\n });\n\n const onInputClick = hooks.useCallbackRef((event) => {\n const selectionStart = getInputInstance()?.selectionStart || 0;\n setCursorPosition(selectionStart);\n onClick?.(event.target.value);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart,\n });\n if (targret) {\n if (selectionStart - targret.start < targret.end - selectionStart) {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n } else {\n getInputInstance()?.setSelectionRange(targret.end, targret.end);\n }\n }\n });\n\n const mentionOptions = useMemo(() => {\n const prefixList = toArray<string>(prefix);\n return (\n options?.map((item) => {\n let opValue = item;\n for (let index = 0; index < prefixList.length; index++) {\n const element = prefixList[index];\n if (opValue.startsWith(element)) {\n opValue = opValue.replace(element, '');\n break;\n }\n }\n return { label: opValue, value: opValue };\n }) || []\n );\n }, [options, prefix]);\n\n return (\n <Mentions\n notFoundContent={<div>暂无数据</div>}\n rows={3}\n {...otherProps}\n prefix={prefix}\n style={{ width: '100%', ...otherProps.style }}\n id={id}\n value={valueNew}\n ref={inputInnerRef}\n onChange={onInputChange}\n onClick={onInputClick}\n split=\"\"\n validateSearch={(text: string) => {\n if (!mentionOptions.length) return false;\n const target = mentionOptions.find((item) => text.indexOf(item.value) >= 0);\n return target && text.length > target.value.length ? false : true;\n }}\n options={mentionOptions}\n />\n );\n};\n"],"names":["getOverallKeyWordsPosition","params","value","overallKeyWords","length","overallKeyWordsNew","Array","from","Set","positionItem","forEach","item","_params$value","includes","newItem","replace","regex","RegExp","positions","match","exec","push","index","innerList","temp","start","end","judgmentCursorInKeyWordsPosition","keyWordsPosition","element","find","cursorPosition","undefined","MentionsWrapper","props","onChange","onClick","onCursorChange","options","prefix","otherProps","_objectWithoutPropertiesLoose","_excluded","id","_hooks","useId","inputInnerRef","useRef","_useState","useState","setCursorPosition","invalidOnChangeRef","valueNew","overallKeyWordsPosition","useMemo","getInputInstance","_inputInnerRef$curren","current","textarea","fbaHooks","useEffectCustom","useEventListener","ev","_getInputInstance","selectionStart","code","positionValue","targret","_getInputInstance2","setSelectionRange","_getInputInstance3","result","substring","setTimeout","_getInputInstance4","target","document","querySelector","_getInputInstance5","_getInputInstance6","_getInputInstance7","onInputChange","useCallbackRef","_getInputInstance8","disabled","onInputClick","event","_getInputInstance9","_getInputInstance10","_getInputInstance11","mentionOptions","prefixList","toArray","map","opValue","startsWith","label","_jsx","Mentions","_extends","notFoundContent","children","rows","style","width","ref","split","validateSearch","text","indexOf"],"mappings":";gXAEO,IAAMA,EAA6B,SAA7BA,EAA8BC,GACzC,IAAKA,EAAOC,QAAUD,EAAOE,gBAAgBC,OAAQ,MAAO,GAC5D,IAAMC,EAAqBC,MAAMC,KAAK,IAAIC,IAAIP,EAAOE,iBAAmB,KACxE,IAAMM,EAA4C,GAClDJ,EAAmBK,SAAQ,SAACC,GAAS,IAAAC,EACnC,MAAIA,EAACX,EAAOC,QAAPU,MAAAA,EAAcC,SAASF,IAAO,OACnC,IAAMG,EAAUH,EACbI,QAAQ,MAAO,OACfA,QAAQ,MAAO,OACfA,QAAQ,MAAO,OACfA,QAAQ,MAAO,OACfA,QAAQ,MAAO,OAClB,IAAMC,EAAQ,IAAIC,OAAOH,EAAS,KAClC,IAAMI,EAAsB,GAC5B,IAAIC,EAEJ,OAAQA,EAAQH,EAAMI,KAAKnB,EAAOC,UAAY,KAAM,CAClDgB,EAAUG,KAAKF,EAAMG,MACvB,CACA,IAAMC,EAAuC,GAC7CL,EAAUR,SAAQ,SAACc,GACjBD,EAAUF,KAAK,CAAEI,MAAOD,EAAO,EAAGE,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! @flatjs/forge MIT @flatbiz/antd */
|
|
8
|
-
import e from"@ant-design/icons/es/icons/FullscreenOutlined";import{classNames as i}from"@dimjs/utils/cjs/class-names";import{hooks as r}from"@wove/react/cjs/hooks";import{useKeyPress as o}from"ahooks";import{useState as t,useRef as n}from"react";import{fbaHooks as s}from"../fba-hooks/index.js";import{IconWrapper as a}from"../icon-wrapper/index.js";import{RichTextEditor as l}from"../rich-text-editor/index.js";import{jsxs as m,jsx as c}from"react/jsx-runtime";import"../_rollupPluginBabelHelpers-a0769acd.js";import"@dimjs/lang/cjs/is-array";import"@flatbiz/utils";import"../use-responsive-point-21b8c601.js";import"antd";import"@tinymce/tinymce-react";import"@ant-design/icons/es/icons/PlusCircleOutlined";import"../dynamic-node/index.js";import"react-dom/client";import"../dom-4d04aa64.js";var u=function u(d){var p=t(false),f=p[0],v=p[1];var j=n();o((function(){return true}),(function(e){if(e.type==="keyup"&&e.key==="Escape"&&f){v(false)}}),{events:["keydown","keyup"]});var b=r.useCallbackRef((function(){v(!f)}));var y=r.useCallbackRef((function(e,i){j.current=i;d.onInit==null?void 0:d.onInit(i)}));s.useEffectCustom((function(){var e;(e=j.current)==null?void 0:e.editorCommands.execCommand("mceAutoResize")}),[d.value]);return m("div",{className:i("fba-editor-viewer",{"fba-editor-viewer-fixed":f},d.className),style:d.style,children:[d.children,d.fullscreen&&d.value&&c("div",{className:"fba-editor-viewer-icon",children:c(a,{hoverTips:d.fullscreenIconTips,icon:c(e,{}),onClick:b})}),c(l,{value:d.value,onInit:y,imgPreview:true,disabled:true,init:{plugins:"autoresize",menubar:false,toolbar:"",statusbar:false}})]})};export{u as RichTextViewer};
|
|
8
|
+
import e from"@ant-design/icons/es/icons/FullscreenOutlined";import{classNames as i}from"@dimjs/utils/cjs/class-names";import{hooks as r}from"@wove/react/cjs/hooks";import{useKeyPress as o}from"ahooks";import{useState as t,useRef as n}from"react";import{fbaHooks as s}from"../fba-hooks/index.js";import{IconWrapper as a}from"../icon-wrapper/index.js";import{RichTextEditor as l}from"../rich-text-editor/index.js";import{jsxs as m,jsx as c}from"react/jsx-runtime";import"../_rollupPluginBabelHelpers-a0769acd.js";import"@dimjs/lang/cjs/is-array";import"@flatbiz/utils";import"../use-responsive-point-21b8c601.js";import"antd";import"@dimjs/lang/cjs/is-undefined";import"@tinymce/tinymce-react";import"@ant-design/icons/es/icons/PlusCircleOutlined";import"../dynamic-node/index.js";import"react-dom/client";import"../dom-4d04aa64.js";var u=function u(d){var p=t(false),f=p[0],v=p[1];var j=n();o((function(){return true}),(function(e){if(e.type==="keyup"&&e.key==="Escape"&&f){v(false)}}),{events:["keydown","keyup"]});var b=r.useCallbackRef((function(){v(!f)}));var y=r.useCallbackRef((function(e,i){j.current=i;d.onInit==null?void 0:d.onInit(i)}));s.useEffectCustom((function(){var e;(e=j.current)==null?void 0:e.editorCommands.execCommand("mceAutoResize")}),[d.value]);return m("div",{className:i("fba-editor-viewer",{"fba-editor-viewer-fixed":f},d.className),style:d.style,children:[d.children,d.fullscreen&&d.value&&c("div",{className:"fba-editor-viewer-icon",children:c(a,{hoverTips:d.fullscreenIconTips,icon:c(e,{}),onClick:b})}),c(l,{value:d.value,onInit:y,imgPreview:true,disabled:true,init:{plugins:"autoresize",menubar:false,toolbar:"",statusbar:false}})]})};export{u as RichTextViewer};
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/rich-text-viewer/rich-text-viewer.tsx"],"sourcesContent":["import { FullscreenOutlined } from '@ant-design/icons';\nimport { classNames } from '@dimjs/utils';\nimport { hooks } from '@wove/react';\nimport { useKeyPress } from 'ahooks';\nimport { CSSProperties, ReactElement, useRef, useState } from 'react';\nimport { Editor as TinyMCEEditor } from 'tinymce';\n\nimport { fbaHooks } from '../fba-hooks';\nimport { IconWrapper } from '../icon-wrapper';\nimport { RichTextEditor } from '../rich-text-editor';\nimport './style.less';\n\ntype RichTextViewerProps = {\n value: string;\n className?: string;\n style?: CSSProperties;\n fullscreen?: boolean;\n onInit?: (editor: TinyMCEEditor) => void;\n children?: ReactElement;\n fullscreenIconTips?: string;\n};\n\n/**\n * 预览 RichTextEditor 生成的富文本数据\n * ```\n * 1. 通过 onInit 属性可获取实例:editor\n * 2. 如果高度发生变更,可执行 editor.execCommand('mceAutoResize');\n *\n * ```\n * @param props\n * @returns\n */\nexport const RichTextViewer = (props: RichTextViewerProps) => {\n const [isFixed, setIsFixed] = useState(false);\n const editorRef = useRef<TinyMCEEditor>();\n\n useKeyPress(\n () => true,\n (event) => {\n if (event.type === 'keyup' && event.key === 'Escape' && isFixed) {\n setIsFixed(false);\n }\n },\n { events: ['keydown', 'keyup'] },\n );\n\n const onChangeFixed = hooks.useCallbackRef(() => {\n setIsFixed(!isFixed);\n });\n const onInit = hooks.useCallbackRef((_, editor: TinyMCEEditor) => {\n editorRef.current = editor;\n props.onInit?.(editor);\n });\n\n fbaHooks.useEffectCustom(() => {\n editorRef.current?.editorCommands.execCommand('mceAutoResize');\n }, [props.value]);\n\n return (\n <div\n className={classNames('fba-editor-viewer', { 'fba-editor-viewer-fixed': isFixed }, props.className)}\n style={props.style}\n >\n {props.children}\n {props.fullscreen && props.value && (\n <div className=\"fba-editor-viewer-icon\">\n <IconWrapper\n hoverTips={props.fullscreenIconTips}\n icon={<FullscreenOutlined />}\n onClick={onChangeFixed}\n />\n </div>\n )}\n <RichTextEditor\n value={props.value}\n onInit={onInit}\n imgPreview\n disabled\n init={{\n plugins: 'autoresize',\n menubar: false,\n toolbar: '',\n statusbar: false,\n }}\n />\n </div>\n );\n};\n"],"names":["RichTextViewer","props","_useState","useState","isFixed","setIsFixed","editorRef","useRef","useKeyPress","event","type","key","events","onChangeFixed","_hooks","useCallbackRef","onInit","_","editor","current","fbaHooks","useEffectCustom","_editorRef$current","editorCommands","execCommand","value","_jsxs","className","_classNames","style","children","fullscreen","_jsx","IconWrapper","hoverTips","fullscreenIconTips","icon","_FullscreenOutlined","onClick","RichTextEditor","imgPreview","disabled","init","plugins","menubar","toolbar","statusbar"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/rich-text-viewer/rich-text-viewer.tsx"],"sourcesContent":["import { FullscreenOutlined } from '@ant-design/icons';\nimport { classNames } from '@dimjs/utils';\nimport { hooks } from '@wove/react';\nimport { useKeyPress } from 'ahooks';\nimport { CSSProperties, ReactElement, useRef, useState } from 'react';\nimport { Editor as TinyMCEEditor } from 'tinymce';\n\nimport { fbaHooks } from '../fba-hooks';\nimport { IconWrapper } from '../icon-wrapper';\nimport { RichTextEditor } from '../rich-text-editor';\nimport './style.less';\n\ntype RichTextViewerProps = {\n value: string;\n className?: string;\n style?: CSSProperties;\n fullscreen?: boolean;\n onInit?: (editor: TinyMCEEditor) => void;\n children?: ReactElement;\n fullscreenIconTips?: string;\n};\n\n/**\n * 预览 RichTextEditor 生成的富文本数据\n * ```\n * 1. 通过 onInit 属性可获取实例:editor\n * 2. 如果高度发生变更,可执行 editor.execCommand('mceAutoResize');\n *\n * ```\n * @param props\n * @returns\n */\nexport const RichTextViewer = (props: RichTextViewerProps) => {\n const [isFixed, setIsFixed] = useState(false);\n const editorRef = useRef<TinyMCEEditor>();\n\n useKeyPress(\n () => true,\n (event) => {\n if (event.type === 'keyup' && event.key === 'Escape' && isFixed) {\n setIsFixed(false);\n }\n },\n { events: ['keydown', 'keyup'] },\n );\n\n const onChangeFixed = hooks.useCallbackRef(() => {\n setIsFixed(!isFixed);\n });\n const onInit = hooks.useCallbackRef((_, editor: TinyMCEEditor) => {\n editorRef.current = editor;\n props.onInit?.(editor);\n });\n\n fbaHooks.useEffectCustom(() => {\n editorRef.current?.editorCommands.execCommand('mceAutoResize');\n }, [props.value]);\n\n return (\n <div\n className={classNames('fba-editor-viewer', { 'fba-editor-viewer-fixed': isFixed }, props.className)}\n style={props.style}\n >\n {props.children}\n {props.fullscreen && props.value && (\n <div className=\"fba-editor-viewer-icon\">\n <IconWrapper\n hoverTips={props.fullscreenIconTips}\n icon={<FullscreenOutlined />}\n onClick={onChangeFixed}\n />\n </div>\n )}\n <RichTextEditor\n value={props.value}\n onInit={onInit}\n imgPreview\n disabled\n init={{\n plugins: 'autoresize',\n menubar: false,\n toolbar: '',\n statusbar: false,\n }}\n />\n </div>\n );\n};\n"],"names":["RichTextViewer","props","_useState","useState","isFixed","setIsFixed","editorRef","useRef","useKeyPress","event","type","key","events","onChangeFixed","_hooks","useCallbackRef","onInit","_","editor","current","fbaHooks","useEffectCustom","_editorRef$current","editorCommands","execCommand","value","_jsxs","className","_classNames","style","children","fullscreen","_jsx","IconWrapper","hoverTips","fullscreenIconTips","icon","_FullscreenOutlined","onClick","RichTextEditor","imgPreview","disabled","init","plugins","menubar","toolbar","statusbar"],"mappings":";o0BAgCaA,EAAiB,SAAjBA,EAAkBC,GAC7B,IAAAC,EAA8BC,EAAS,OAAhCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAC1B,IAAMI,EAAYC,IAElBC,GACE,WAAA,OAAM,IACN,IAAA,SAACC,GACC,GAAIA,EAAMC,OAAS,SAAWD,EAAME,MAAQ,UAAYP,EAAS,CAC/DC,EAAW,MACb,CACF,GACA,CAAEO,OAAQ,CAAC,UAAW,WAGxB,IAAMC,EAAgBC,EAAMC,gBAAe,WACzCV,GAAYD,EACd,IACA,IAAMY,EAASF,EAAMC,gBAAe,SAACE,EAAGC,GACtCZ,EAAUa,QAAUD,EACpBjB,EAAMe,QAANf,UAAAA,EAAAA,EAAMe,OAASE,EACjB,IAEAE,EAASC,iBAAgB,WAAM,IAAAC,GAC7BA,EAAAhB,EAAUa,UAAO,UAAA,EAAjBG,EAAmBC,eAAeC,YAAY,gBAChD,GAAG,CAACvB,EAAMwB,QAEV,OACEC,EAAA,MAAA,CACEC,UAAWC,EAAW,oBAAqB,CAAE,0BAA2BxB,GAAWH,EAAM0B,WACzFE,MAAO5B,EAAM4B,MAAMC,SAElB7B,CAAAA,EAAM6B,SACN7B,EAAM8B,YAAc9B,EAAMwB,OACzBO,EAAA,MAAA,CAAKL,UAAU,yBAAwBG,SACrCE,EAACC,EAAW,CACVC,UAAWjC,EAAMkC,mBACjBC,KAAMJ,EAAAK,MACNC,QAASzB,MAIfmB,EAACO,EAAc,CACbd,MAAOxB,EAAMwB,MACbT,OAAQA,EACRwB,WAAU,KACVC,SAAQ,KACRC,KAAM,CACJC,QAAS,aACTC,QAAS,MACTC,QAAS,GACTC,UAAW,WAKrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/switch-wrapper/switch-wrapper.tsx"],"sourcesContent":["import { isUndefinedOrNull, TAny } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { message, Switch, SwitchProps, Tooltip, TooltipProps } from 'antd';\nimport { useState } from 'react';\n\nexport type SwitchWrapperValue = string | number | boolean;\nexport type SwitchWrapperProps = Omit<SwitchProps, 'checked' | 'defaultChecked' | 'onChange'> & {\n value?: SwitchWrapperValue;\n checkedValue: SwitchWrapperValue;\n unCheckedValue: SwitchWrapperValue;\n onChange?: (value: SwitchWrapperValue) => void;\n tooltipProps?: Omit<TooltipProps, 'title'>;\n tooltipTitle?: string | ((value?: SwitchWrapperValue) => string | undefined);\n serviceConfig?: {\n onRequest: (value: SwitchWrapperValue) => TAny;\n message?: {\n success?: string;\n defaultError?: string;\n };\n };\n};\n/**\n * 解决Switch只能接收boolean的限制,与Form.Item结合使用最佳\n * ```\n * 1. value 为状态值,不局限于boolean,可以为 [string | number | boolean]\n * 2. checkedValue 选中值\n * 3. unCheckedValue 未选中值\n * 4. 与 Form.Item 结合使用,不再需要配置 valuePropName\n * <Form.Item name=\"fieldName\">\n * <SwitchWrapper checkedValue={2} unCheckedValue={1} />\n * </Form.Item>\n * 5. 可设置tooltip效果数据显示\n * 6. 可设置 serviceConfig 配置服务调用交互\n * ```\n */\nexport const SwitchWrapper = (props: SwitchWrapperProps) => {\n const {\n checkedValue,\n unCheckedValue,\n onChange,\n value,\n tooltipProps,\n tooltipTitle,\n serviceConfig,\n ...otherProps\n } = props;\n const [loading, setLoading] = useState<boolean>();\n const onChangeHandle = hooks.useCallbackRef(async (checked) => {\n const changeValue = checked ? checkedValue : unCheckedValue;\n if (serviceConfig?.onRequest) {\n try {\n setLoading(true);\n await serviceConfig.onRequest(changeValue);\n onChange?.(changeValue);\n void message.success(serviceConfig?.message?.success || '状态修改成功!');\n } catch (error) {\n void message.error(error?.message || serviceConfig?.message?.defaultError || '状态修改失败!');\n } finally {\n setLoading(false);\n }\n } else {\n onChange?.(changeValue);\n }\n });\n\n let tipTitle: string | undefined;\n\n if (typeof tooltipTitle === 'function') {\n tipTitle = tooltipTitle(value);\n } else {\n tipTitle = tooltipTitle;\n }\n\n if (tipTitle) {\n return (\n <Tooltip placement=\"top\" {...tooltipProps} title={tipTitle}>\n <Switch\n {...otherProps}\n checked={!isUndefinedOrNull(value) && checkedValue === value}\n onChange={onChangeHandle}\n />\n </Tooltip>\n );\n }\n\n return (\n <Switch\n loading={loading}\n {...otherProps}\n checked={!isUndefinedOrNull(value) && checkedValue === value}\n onChange={onChangeHandle}\n />\n );\n};\n"],"names":["SwitchWrapper","props","checkedValue","unCheckedValue","onChange","value","tooltipProps","tooltipTitle","serviceConfig","otherProps","_objectWithoutPropertiesLoose","_excluded","_useState","useState","loading","setLoading","onChangeHandle","_hooks","useCallbackRef","checked","Promise","$return","$error","changeValue","_serviceConfig$messag","_serviceConfig$messag2","onRequest","$Try_1_Finally","$Try_1_Exit","$Try_1_Value","call","this","$boundEx","bind","$Try_1_Post","$If_2","$Try_1_Catch","error","message","defaultError","resolve","then","$await_3","success","tipTitle","_jsx","Tooltip","_extends","placement","title","children","Switch","isUndefinedOrNull"],"mappings":";mZAmCaA,EAAgB,SAAhBA,EAAiBC,GAC5B,IACEC,EAQED,EARFC,aACAC,EAOEF,EAPFE,eACAC,EAMEH,EANFG,SACAC,EAKEJ,EALFI,MACAC,EAIEL,EAJ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O,CACLjC,GAAAA,UAAAA,EAAAA,EAAWmB,GAAa,OA7D9BY,EAAGL,KAAIC,KA8DH,CAAC,SAAAI,IAAA,OAAAd,GAAA,CAAA,OAGH,IAAIuB,EAEJ,UAAWrC,IAAiB,WAAY,CACtCqC,EAAWrC,EAAaF,EAC1B,KAAO,CACLuC,EAAWrC,CACb,CAEA,GAAIqC,EAAU,CACZ,OACEC,EAACC,EAAOC,EAAA,CAACC,UAAU,OAAU1C,EAAY,CAAE2C,MAAOL,EAASM,SACzDL,EAACM,EAAMJ,KACDtC,EAAU,CACdU,SAAUiC,EAAkB/C,IAAUH,IAAiBG,EACvDD,SAAUY,OAIlB,CAEA,OACE6B,EAACM,EAAMJ,EAAA,CACLjC,QAASA,GACLL,EAAU,CACdU,SAAUiC,EAAkB/C,IAAUH,IAAiBG,EACvDD,SAAUY,IAGhB"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/switch-wrapper/switch-wrapper.tsx"],"sourcesContent":["import { isUndefinedOrNull, TAny } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { message, Switch, SwitchProps, Tooltip, TooltipProps } from 'antd';\nimport { useState } from 'react';\n\nexport type SwitchWrapperValue = string | number | boolean;\nexport type SwitchWrapperProps = Omit<SwitchProps, 'checked' | 'defaultChecked' | 'onChange' | 'value'> & {\n value?: SwitchWrapperValue;\n checkedValue: SwitchWrapperValue;\n unCheckedValue: SwitchWrapperValue;\n onChange?: (value: SwitchWrapperValue) => void;\n tooltipProps?: Omit<TooltipProps, 'title'>;\n tooltipTitle?: string | ((value?: SwitchWrapperValue) => string | undefined);\n serviceConfig?: {\n onRequest: (value: SwitchWrapperValue) => TAny;\n message?: {\n success?: string;\n defaultError?: string;\n };\n };\n};\n/**\n * 解决Switch只能接收boolean的限制,与Form.Item结合使用最佳\n * ```\n * 1. value 为状态值,不局限于boolean,可以为 [string | number | boolean]\n * 2. checkedValue 选中值\n * 3. unCheckedValue 未选中值\n * 4. 与 Form.Item 结合使用,不再需要配置 valuePropName\n * <Form.Item name=\"fieldName\">\n * <SwitchWrapper checkedValue={2} unCheckedValue={1} />\n * </Form.Item>\n * 5. 可设置tooltip效果数据显示\n * 6. 可设置 serviceConfig 配置服务调用交互\n * ```\n */\nexport const SwitchWrapper = (props: SwitchWrapperProps) => {\n const {\n checkedValue,\n unCheckedValue,\n onChange,\n value,\n tooltipProps,\n tooltipTitle,\n serviceConfig,\n ...otherProps\n } = props;\n const [loading, setLoading] = useState<boolean>();\n const onChangeHandle = hooks.useCallbackRef(async (checked) => {\n const changeValue = checked ? checkedValue : unCheckedValue;\n if (serviceConfig?.onRequest) {\n try {\n setLoading(true);\n await serviceConfig.onRequest(changeValue);\n onChange?.(changeValue);\n void message.success(serviceConfig?.message?.success || '状态修改成功!');\n } catch (error) {\n void message.error(error?.message || serviceConfig?.message?.defaultError || '状态修改失败!');\n } finally {\n setLoading(false);\n }\n } else {\n onChange?.(changeValue);\n }\n });\n\n let tipTitle: string | undefined;\n\n if (typeof tooltipTitle === 'function') {\n tipTitle = tooltipTitle(value);\n } else {\n tipTitle = tooltipTitle;\n }\n\n if (tipTitle) {\n return (\n <Tooltip placement=\"top\" {...tooltipProps} title={tipTitle}>\n <Switch\n {...otherProps}\n checked={!isUndefinedOrNull(value) && checkedValue === value}\n onChange={onChangeHandle}\n />\n </Tooltip>\n );\n }\n\n return (\n <Switch\n loading={loading}\n {...otherProps}\n checked={!isUndefinedOrNull(value) && checkedValue === value}\n onChange={onChangeHandle}\n />\n );\n};\n"],"names":["SwitchWrapper","props","checkedValue","unCheckedValue","onChange","value","tooltipProps","tooltipTitle","serviceConfig","otherProps","_objectWithoutPropertiesLoose","_excluded","_useState","useState","loading","setLoading","onChangeHandle","_hooks","useCallbackRef","checked","Promise","$return","$error","changeValue","_serviceConfig$messag","_serviceConfig$messag2","onRequest","$Try_1_Finally","$Try_1_Exit","$Try_1_Value","call","this","$boundEx","bind","$Try_1_Post","$If_2","$Try_1_Catch","error","message","defaultError","resolve","then","$await_3","success","tipTitle","_jsx","Tooltip","_extends","placement","title","children","Switch","isUndefinedOrNull"],"mappings":";mZAmCaA,EAAgB,SAAhBA,EAAiBC,GAC5B,IACEC,EAQED,EARFC,aACAC,EAOEF,EAPFE,eACAC,EAMEH,EANFG,SACAC,EAKEJ,EALFI,MACAC,EAIEL,EAJFK,aACAC,EAGEN,EAHFM,aACAC,EAEEP,EAFFO,cACGC,EAAUC,EACXT,EAAKU,GACT,IAAAC,EAA8BC,IAAvBC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAC1B,IAAMI,EAAiBC,EAAMC,gBAAe,SAAOC,GAAP,OAAA,IAAAC,SAAA,SAAAC,EAAAC,GAAA,IACpCC,EAAqDC,EAAAC,EAArDF,EAAcJ,EAAUjB,EAAeC,EAC7C,GAAIK,GAAa,MAAbA,EAAekB,UAAW,CAAA,IAAAC,EAjDlC,SAAAC,GAAA,OAAC,SAAAC,GAAD,IA0DQd,EAAW,OA1D4F,OAAOa,GAAUA,EAAME,KAAKC,KAAIF,EAAtI,CAAC,MAAAG,GAAW,OAAOV,EAAAU,EAAM,CAAgI,EAA/JC,KAAKF,OAALE,KAAKF,MAAR,IAAIG,EAAJ,WAAA,IAAI,OAAJC,EAAGL,KAAIC,KAAE,CAAC,MAAAC,GAAW,OAAOV,EAAAU,EAAM,GAA/BC,KAAKF,MAAR,IAAIK,EAAA,SAuDWC,GAvDf,SAwDaC,EAAQD,OAAMA,GAAAA,UAAAA,EAAAA,EAAOC,WAAW9B,UAAaiB,EAAbjB,EAAe8B,UAAO,UAAA,EAAtBb,EAAwBc,eAAgB,WAxDrF,OAAOZ,EAAAO,EAAAP,EAAE,CAAC,MAAAK,GAAW,OAAOL,EAAAL,EAAAK,CAAAK,EAAM,GAkD5B,IACEjB,EAAW,MACX,OAAAK,QAAAoB,QAAMhC,EAAckB,UAAUH,IAA9BkB,eAA0CC,GApDlD,IAqDQtC,GAAAA,UAAAA,EAAAA,EAAWmB,QACNe,EAAQK,SAAQnC,UAAagB,EAAbhB,EAAe8B,UAAfd,UAAAA,EAAAA,EAAwBmB,UAAW,WAtDhE,OAAOhB,EAAAO,EAAAP,EAAE,CAAC,MAAAK,GAAW,OAAOI,EAAAJ,EAAM,CAAC,GAAAI,EAuD5B,CAAC,MAAOC,GAAOD,EAAPC,EAET,CAGF,KAAO,CACLjC,GAAAA,UAAAA,EAAAA,EAAWmB,GAAa,OA7D9BY,EAAGL,KAAIC,KA8DH,CAAC,SAAAI,IAAA,OAAAd,GAAA,CAAA,OAGH,IAAIuB,EAEJ,UAAWrC,IAAiB,WAAY,CACtCqC,EAAWrC,EAAaF,EAC1B,KAAO,CACLuC,EAAWrC,CACb,CAEA,GAAIqC,EAAU,CACZ,OACEC,EAACC,EAAOC,EAAA,CAACC,UAAU,OAAU1C,EAAY,CAAE2C,MAAOL,EAASM,SACzDL,EAACM,EAAMJ,KACDtC,EAAU,CACdU,SAAUiC,EAAkB/C,IAAUH,IAAiBG,EACvDD,SAAUY,OAIlB,CAEA,OACE6B,EAACM,EAAMJ,EAAA,CACLjC,QAASA,GACLL,EAAU,CACdU,SAAUiC,EAAkB/C,IAAUH,IAAiBG,EACvDD,SAAUY,IAGhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.text-symbol-wrapper{position:relative}.tsw-symbol{font-size:14px;line-height:normal;position:absolute;top:50%}.tsw-symbol-before{
|
|
1
|
+
.text-symbol-wrapper{position:relative}.tsw-symbol{font-size:14px;line-height:normal;position:absolute;top:50%}.tsw-symbol-before{transform:translate(-100%,-50%)}.tsw-symbol-after{transform:translate(100%,-50%)}.tsw-required .tsw-symbol{color:#ff4d4f}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import './index.css';
|
|
3
3
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
4
|
-
import{
|
|
4
|
+
import{_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{classNames as r}from"@dimjs/utils/cjs/class-names";import{useMemo as s}from"react";import{jsx as t,jsxs as l}from"react/jsx-runtime";var a=function a(o){var m=o.gap===undefined?3:o.gap;var i=s((function(){if(o.symbol){return o.symbol}if(o.symbolType==="required"){return"*"}return undefined}),[o.symbolType,o.symbol]);var n=o.position||"before";if(o.hiddenSymbol){return t("span",{className:r("text-symbol-wrapper",o.className),style:o.style,children:o.text})}var p=r("text-symbol-wrapper",{"tsw-required":o.symbolType},o.className);var y=n==="before"?{left:-m}:{right:-m};var b=n==="before"?{left:0}:{right:0};var c=o.text?y:b;return l("span",{className:p,style:o.style,children:[i?t("span",{className:r("tsw-symbol","tsw-symbol-"+n),style:e({},y,c),onClick:o.onSymbolClick,children:i}):null,o.text]})};export{a as TextSymbolWrapper};
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/text-symbol-wrapper/symbol.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { useMemo, type CSSProperties, type ReactElement } from 'react';\nimport './style.less';\n\nexport type TextSymbolWrapperProps = {\n symbolType?: 'required';\n /** 自定义标记符号,优先级大于 symbolType */\n symbol?:
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/text-symbol-wrapper/symbol.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { ReactNode, useMemo, type CSSProperties, type ReactElement } from 'react';\nimport './style.less';\n\nexport type TextSymbolWrapperProps = {\n className?: string;\n style?: CSSProperties;\n /** 内置图标类型 */\n symbolType?: 'required';\n /** 自定义标记符号,优先级大于 symbolType */\n symbol?: ReactNode;\n /** 标记位置,默认:brefore */\n position?: 'before' | 'after';\n /** 显示文本 */\n text?: string | ReactElement;\n symbolStyle?: CSSProperties;\n onSymbolClick?: (event) => void;\n /** 只隐藏符号,不隐藏文案 */\n hiddenSymbol?: boolean;\n /** 图标与文字之间的间距 */\n gap?: number;\n};\n\n/**\n * 为文字添加符号,例如:必填符号\n * ```\n * 例如: <TextSymbolWrapper text={'用户名'} symbolType=\"required\" />\n * ```\n */\nexport const TextSymbolWrapper = (props: TextSymbolWrapperProps) => {\n const gap = props.gap === undefined ? 3 : props.gap;\n const symbol = useMemo(() => {\n if (props.symbol) {\n return props.symbol;\n }\n if (props.symbolType === 'required') {\n return '*';\n }\n return undefined;\n }, [props.symbolType, props.symbol]);\n\n const position = props.position || 'before';\n\n if (props.hiddenSymbol) {\n return (\n <span className={classNames('text-symbol-wrapper', props.className)} style={props.style}>\n {props.text}\n </span>\n );\n }\n\n const cn = classNames('text-symbol-wrapper', { 'tsw-required': props.symbolType }, props.className);\n\n const hasTextSymbolSyle = position === 'before' ? { left: -gap } : { right: -gap };\n const noTextSymbolSyle = position === 'before' ? { left: 0 } : { right: 0 };\n const symbolSyle = props.text ? hasTextSymbolSyle : noTextSymbolSyle;\n return (\n <span className={cn} style={props.style}>\n {symbol ? (\n <span\n className={classNames('tsw-symbol', `tsw-symbol-${position}`)}\n style={{\n ...hasTextSymbolSyle,\n ...symbolSyle,\n }}\n onClick={props.onSymbolClick}\n >\n {symbol}\n </span>\n ) : null}\n\n {props.text}\n </span>\n );\n};\n"],"names":["TextSymbolWrapper","props","gap","undefined","symbol","useMemo","symbolType","position","hiddenSymbol","_jsx","className","_classNames","style","children","text","cn","hasTextSymbolSyle","left","right","noTextSymbolSyle","symbolSyle","_jsxs","_extends","onClick","onSymbolClick"],"mappings":";6MA6BaA,EAAoB,SAApBA,EAAqBC,GAChC,IAAMC,EAAMD,EAAMC,MAAQC,UAAY,EAAIF,EAAMC,IAChD,IAAME,EAASC,GAAQ,WACrB,GAAIJ,EAAMG,OAAQ,CAChB,OAAOH,EAAMG,MACf,CACA,GAAIH,EAAMK,aAAe,WAAY,CACnC,MAAO,GACT,CACA,OAAOH,SACR,GAAE,CAACF,EAAMK,WAAYL,EAAMG,SAE5B,IAAMG,EAAWN,EAAMM,UAAY,SAEnC,GAAIN,EAAMO,aAAc,CACtB,OACEC,EAAA,OAAA,CAAMC,UAAWC,EAAW,sBAAuBV,EAAMS,WAAYE,MAAOX,EAAMW,MAAMC,SACrFZ,EAAMa,MAGb,CAEA,IAAMC,EAAKJ,EAAW,sBAAuB,CAAE,eAAgBV,EAAMK,YAAcL,EAAMS,WAEzF,IAAMM,EAAoBT,IAAa,SAAW,CAAEU,MAAOf,GAAQ,CAAEgB,OAAQhB,GAC7E,IAAMiB,EAAmBZ,IAAa,SAAW,CAAEU,KAAM,GAAM,CAAEC,MAAO,GACxE,IAAME,EAAanB,EAAMa,KAAOE,EAAoBG,EACpD,OACEE,EAAA,OAAA,CAAMX,UAAWK,EAAIH,MAAOX,EAAMW,MAAMC,SAAA,CACrCT,EACCK,EAAA,OAAA,CACEC,UAAWC,EAAW,aAAY,cAAgBJ,GAClDK,MAAKU,EAAA,GACAN,EACAI,GAELG,QAAStB,EAAMuB,cAAcX,SAE5BT,IAED,KAEHH,EAAMa,OAGb"}
|
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { API, ModelType } from '@dimjs/model';
|
|
6
6
|
import { DateFormatType, TAny, TNoopDefine, TPlainObject } from '@flatbiz/utils';
|
|
7
7
|
import { IAllProps } from '@tinymce/tinymce-react';
|
|
8
|
-
import { AlertProps, ButtonProps, CardProps, CascaderProps, CheckboxProps, CollapseProps, ColorPickerProps, DrawerProps, DropdownProps, FormInstance, FormItemProps, FormListFieldData, FormListOperation, InputNumberProps, InputProps, ModalProps, PaginationProps, PopconfirmProps, PopoverProps, RadioGroupProps, RowProps, SelectProps, SpaceProps, SwitchProps, TableProps, TabsProps, TagProps, TimePickerProps, TimeRangePickerProps, TooltipProps, TreeProps, TreeSelectProps, UploadProps } from 'antd';
|
|
8
|
+
import { AlertProps, ButtonProps, CardProps, CascaderProps, CheckboxProps, CollapseProps, ColorPickerProps, DrawerProps, DropdownProps, FormInstance, FormItemProps, FormListFieldData, FormListOperation, InputNumberProps, InputProps, MentionProps, ModalProps, PaginationProps, PopconfirmProps, PopoverProps, RadioGroupProps, RowProps, SelectProps, SpaceProps, SwitchProps, TableProps, TabsProps, TagProps, TimePickerProps, TimeRangePickerProps, TooltipProps, TreeProps, TreeSelectProps, UploadProps } from 'antd';
|
|
9
9
|
import { ConfigProviderProps } from 'antd/es/config-provider';
|
|
10
10
|
import { PickerDateProps, RangePickerDateProps } from 'antd/es/date-picker/generatePicker';
|
|
11
11
|
import { FormListProps } from 'antd/es/form';
|
|
@@ -1072,7 +1072,7 @@ export type SelectorWrapperProps = Omit<SelectProps, "onSearch" | "notFoundConte
|
|
|
1072
1072
|
*/
|
|
1073
1073
|
export declare const SelectorWrapper: (props: SelectorWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
1074
1074
|
export type SwitchWrapperValue = string | number | boolean;
|
|
1075
|
-
export type SwitchWrapperProps = Omit<SwitchProps, "checked" | "defaultChecked" | "onChange"> & {
|
|
1075
|
+
export type SwitchWrapperProps = Omit<SwitchProps, "checked" | "defaultChecked" | "onChange" | "value"> & {
|
|
1076
1076
|
value?: SwitchWrapperValue;
|
|
1077
1077
|
checkedValue: SwitchWrapperValue;
|
|
1078
1078
|
unCheckedValue: SwitchWrapperValue;
|
|
@@ -1353,6 +1353,8 @@ export type EditableTableProps = {
|
|
|
1353
1353
|
hiddenFooterBtn?: boolean;
|
|
1354
1354
|
/** 新增行默认值,自定义onTableAfterRender后失效 */
|
|
1355
1355
|
getAddRowDefaultValues?: () => TPlainObject;
|
|
1356
|
+
/** 空效果显示尺寸,默认值:small */
|
|
1357
|
+
emptyShowSize?: "small" | "large";
|
|
1356
1358
|
};
|
|
1357
1359
|
export type EditableTableRefApi = {
|
|
1358
1360
|
/** 可用于表格行选择操作时,获取操作列数据 */
|
|
@@ -2512,6 +2514,10 @@ export type IconWrapperProps = {
|
|
|
2512
2514
|
onClick?: (event: any) => void;
|
|
2513
2515
|
hideHoverBgColor?: boolean;
|
|
2514
2516
|
hidden?: boolean;
|
|
2517
|
+
/** 图标对比文字的位置,默认:brefore */
|
|
2518
|
+
position?: "before" | "after";
|
|
2519
|
+
/** 图标与文字之间的间距 */
|
|
2520
|
+
gap?: number;
|
|
2515
2521
|
};
|
|
2516
2522
|
export declare const IconWrapper: (props: IconWrapperProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
2517
2523
|
export type InputSearchWrapperProps = Omit<SearchProps, "defaultValue">;
|
|
@@ -2657,6 +2663,47 @@ export declare const LocalLoading: import("react").ForwardRefExoticComponent<Loc
|
|
|
2657
2663
|
onRequest: (params?: TPlainObject) => void;
|
|
2658
2664
|
};
|
|
2659
2665
|
};
|
|
2666
|
+
export type MentionsWrapperProps = Omit<MentionProps, "value" | "onChange" | "onClick" | "onCursorChange" | "options" | "id" | "split" | "validateSearch" | "ref" | "prefix"> & {
|
|
2667
|
+
value?: string;
|
|
2668
|
+
onChange?: (value?: string) => void;
|
|
2669
|
+
/** 设置列表提示关键字,例如:@、$等 */
|
|
2670
|
+
prefix?: string | string[];
|
|
2671
|
+
onClick?: (value?: string) => void;
|
|
2672
|
+
/** 光标移动回调 */
|
|
2673
|
+
onCursorChange?: (position: number) => void;
|
|
2674
|
+
/**
|
|
2675
|
+
* 输入框内整体关键词列表
|
|
2676
|
+
* ```
|
|
2677
|
+
* 整体关键词交互
|
|
2678
|
+
* 1. 光标可整体移动
|
|
2679
|
+
* 2. 光标不会存在关键词内部
|
|
2680
|
+
* 3. 删除时,整体删除
|
|
2681
|
+
* ```
|
|
2682
|
+
*/
|
|
2683
|
+
options?: string[];
|
|
2684
|
+
};
|
|
2685
|
+
/**
|
|
2686
|
+
* 基于Antd Mentions进行二次封装,可实现输入内关键字整体控制,包括光标移动、关键词删除等
|
|
2687
|
+
* ```
|
|
2688
|
+
* 可实现
|
|
2689
|
+
* 1. 控制光标输入
|
|
2690
|
+
* 2. 可设置关键词,光标不会出现在关键词内部
|
|
2691
|
+
* 3. 可整体删除关键词
|
|
2692
|
+
*
|
|
2693
|
+
* 应用场景例如:
|
|
2694
|
+
* 1. 公式输入
|
|
2695
|
+
* (【xx金额1】+【xx金额2】)*2
|
|
2696
|
+
* <MentionsWrapper prefix="$" options={['【xx金额1】', '【xx金额2】']}/>
|
|
2697
|
+
*
|
|
2698
|
+
* 2. 短信模板设置
|
|
2699
|
+
* 您的订单号为${订单号},订单交易时间为${订单时间}
|
|
2700
|
+
* <MentionsWrapper prefix="$" options={['${订单号}', '${订单时间}']}/>
|
|
2701
|
+
*
|
|
2702
|
+
* demo:https://fex.qa.tcshuke.com/docs/admin/main/other/widget
|
|
2703
|
+
* ```
|
|
2704
|
+
*
|
|
2705
|
+
*/
|
|
2706
|
+
export declare const MentionsWrapper: (props: MentionsWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
2660
2707
|
export type onClick = (e?: React.MouseEvent<HTMLElement>) => void;
|
|
2661
2708
|
export interface ModalActionProps {
|
|
2662
2709
|
children: ReactElement | ((data: {
|
|
@@ -3798,18 +3845,22 @@ export type TextOverflowRenderProps = {
|
|
|
3798
3845
|
*/
|
|
3799
3846
|
export declare const TextOverflowRender: (props: TextOverflowRenderProps) => import("react/jsx-runtime").JSX.Element;
|
|
3800
3847
|
export type TextSymbolWrapperProps = {
|
|
3848
|
+
className?: string;
|
|
3849
|
+
style?: CSSProperties;
|
|
3850
|
+
/** 内置图标类型 */
|
|
3801
3851
|
symbolType?: "required";
|
|
3802
3852
|
/** 自定义标记符号,优先级大于 symbolType */
|
|
3803
|
-
symbol?:
|
|
3853
|
+
symbol?: ReactNode;
|
|
3804
3854
|
/** 标记位置,默认:brefore */
|
|
3805
3855
|
position?: "before" | "after";
|
|
3856
|
+
/** 显示文本 */
|
|
3806
3857
|
text?: string | ReactElement;
|
|
3807
3858
|
symbolStyle?: CSSProperties;
|
|
3808
3859
|
onSymbolClick?: (event: any) => void;
|
|
3809
|
-
className?: string;
|
|
3810
|
-
style?: CSSProperties;
|
|
3811
3860
|
/** 只隐藏符号,不隐藏文案 */
|
|
3812
3861
|
hiddenSymbol?: boolean;
|
|
3862
|
+
/** 图标与文字之间的间距 */
|
|
3863
|
+
gap?: number;
|
|
3813
3864
|
};
|
|
3814
3865
|
/**
|
|
3815
3866
|
* 为文字添加符号,例如:必填符号
|