diff --git a/packages/fineui/src/core/constant/writable.var.js b/packages/fineui/src/core/constant/writable.var.js index d8a503c29..16fb88042 100644 --- a/packages/fineui/src/core/constant/writable.var.js +++ b/packages/fineui/src/core/constant/writable.var.js @@ -138,4 +138,13 @@ addDescriptor("DOM", { addDescriptor("nextTick", { get: () => nextTick, set: setNextTick, -}); \ No newline at end of file +}); + +export let PasteLimit = 2000; +export const setPasteLimit = v => { + PasteLimit = v; +}; +addDescriptor("PasteLimit", { + get: () => PasteLimit, + set: setPasteLimit, +}); diff --git a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js index 25ebc9feb..61e9f125a 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js +++ b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js @@ -33,6 +33,7 @@ import { SIZE_CONSANTS, BlankSplitChar, size, + PasteLimit, } from "@/core"; import { Single, Combo, Msg } from "@/base"; import { MultiSelectBar, TriggerIconButton } from "@/case"; @@ -146,8 +147,8 @@ export class MultiSelectInsertCombo extends Single { } self._dataChange = true; }); - this.getSearcher().getKeywordsLength() > 2000 && - Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); + this.getSearcher().getKeywordsLength() > PasteLimit && + Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Paste_Too_Much_Value", PasteLimit)); } self.fireEvent(MultiSelectInsertCombo.EVENT_SEARCHING); }); diff --git a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js index 03300f29c..3c782b9e9 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -29,7 +29,8 @@ import { pushDistinct, Selection, BlankSplitChar, - SIZE_CONSANTS + SIZE_CONSANTS, + PasteLimit, } from "@/core"; import { Single, Combo, Msg } from "@/base"; import { MultiSelectInsertTrigger } from "./multiselect.insert.trigger"; @@ -134,8 +135,8 @@ export class MultiSelectInsertNoBarCombo extends Single { } self._dataChange = true; }); - this.getSearcher().getKeywordsLength() > 2000 && - Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); + this.getSearcher().getKeywordsLength() > PasteLimit && + Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Paste_Too_Much_Value", PasteLimit)); } }); diff --git a/packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js b/packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js index c54bba3c8..36d2cf184 100644 --- a/packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js +++ b/packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js @@ -10,7 +10,8 @@ import { size, each, BlankSplitChar, - Selection + Selection, + PasteLimit, } from "@/core"; import { MultiSelectEditor } from "./editor.multiselect"; import { Searcher } from "@/base"; @@ -123,7 +124,7 @@ export class MultiSelectInsertSearcher extends Widget { const keywords = this.getKeywords(); self.fireEvent( MultiSelectInsertSearcher.EVENT_SEARCHING, - keywords.length > 2000 ? keywords.slice(0, 2000).concat([BlankSplitChar]) : keywords.slice(0, 2000) + keywords.length > PasteLimit ? keywords.slice(0, PasteLimit).concat([BlankSplitChar]) : keywords.slice(0, PasteLimit) ); }); if (isNotNull(o.value)) { @@ -150,7 +151,7 @@ export class MultiSelectInsertSearcher extends Widget { } getKeyword() { - let keywords = this.editor.getKeywords().slice(0, 2000); + let keywords = this.editor.getKeywords().slice(0, PasteLimit); if (keywords[keywords.length - 1] === BlankSplitChar) { keywords = keywords.slice(0, keywords.length - 1); } diff --git a/packages/fineui/src/widget/multiselectlist/multiselectlist.insert.js b/packages/fineui/src/widget/multiselectlist/multiselectlist.insert.js index e0e4aac3b..a7b52fc2e 100644 --- a/packages/fineui/src/widget/multiselectlist/multiselectlist.insert.js +++ b/packages/fineui/src/widget/multiselectlist/multiselectlist.insert.js @@ -28,7 +28,8 @@ import { isNull, VerticalFillLayout, SIZE_CONSANTS, - BlankSplitChar + BlankSplitChar, + PasteLimit, } from "@/core"; import { Single, Searcher, Msg } from "@/base"; import { MultiSelectBar } from "@/case"; @@ -200,10 +201,10 @@ export class MultiSelectInsertList extends Single { } self.fireEvent(MultiSelectInsertList.EVENT_CHANGE); }); - self._getKeywordsLength() > 2000 && + self._getKeywordsLength() > PasteLimit && Msg.alert( i18nText("BI-Basic_Prompt"), - i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand") + i18nText("BI-Basic_Paste_Too_Much_Value", PasteLimit) ); } }, @@ -266,7 +267,7 @@ export class MultiSelectInsertList extends Single { keywords = keywords.concat([BlankSplitChar]); } - return keywords.length > 2000 ? keywords.slice(0, 2000).concat([BlankSplitChar]) : keywords.slice(0, 2000); + return keywords.length > PasteLimit ? keywords.slice(0, PasteLimit).concat([BlankSplitChar]) : keywords.slice(0, PasteLimit); } _getKeywordsLength() { diff --git a/packages/fineui/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/packages/fineui/src/widget/multiselectlist/multiselectlist.insert.nobar.js index 1bca0a442..c166b8224 100644 --- a/packages/fineui/src/widget/multiselectlist/multiselectlist.insert.nobar.js +++ b/packages/fineui/src/widget/multiselectlist/multiselectlist.insert.nobar.js @@ -28,7 +28,8 @@ import { isNull, VTapeLayout, BlankSplitChar, - SIZE_CONSANTS + SIZE_CONSANTS, + PasteLimit, } from "@/core"; import { Single, Searcher, Msg } from "@/base"; import { MultiSelectBar } from "@/case"; @@ -201,10 +202,10 @@ export class MultiSelectInsertNoBarList extends Single { } self.fireEvent(MultiSelectInsertNoBarList.EVENT_CHANGE); }); - self._getKeywordsLength() > 2000 && + self._getKeywordsLength() > PasteLimit && Msg.alert( i18nText("BI-Basic_Prompt"), - i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand") + i18nText("BI-Basic_Paste_Too_Much_Value", PasteLimit) ); } }, @@ -271,7 +272,7 @@ export class MultiSelectInsertNoBarList extends Single { keywords = keywords.concat([BlankSplitChar]); } - return keywords.length > 2000 ? keywords.slice(0, 2000).concat([BlankSplitChar]) : keywords.slice(0, 2000); + return keywords.length > PasteLimit ? keywords.slice(0, PasteLimit).concat([BlankSplitChar]) : keywords.slice(0, PasteLimit); } _getKeywordsLength() { diff --git a/packages/fineui/typescript/core/var.ts b/packages/fineui/typescript/core/var.ts index 580091fb2..09e5c89e9 100644 --- a/packages/fineui/typescript/core/var.ts +++ b/packages/fineui/typescript/core/var.ts @@ -130,6 +130,7 @@ export declare const VerticalAlign: { export declare const StartOfWeek: number; export declare const BlankSplitChar: string; export declare const Events: Record; +export declare const PasteLimit: number; type SetFunc = (value: any) => void; @@ -141,3 +142,4 @@ export declare const setBlankSplitChar: SetFunc; export declare const setPixFormat: SetFunc; export declare const setToPix: SetFunc; export declare const setEventBlur: SetFunc; +export declare const setPasteLimit: SetFunc; diff --git a/scripts/lib/fui.export.txt b/scripts/lib/fui.export.txt index b04b355ce..b24fd652c 100644 --- a/scripts/lib/fui.export.txt +++ b/scripts/lib/fui.export.txt @@ -295,6 +295,7 @@ Pager Pane Panel PartTree +PasteLimit Plugin PlusGroupNode Popover