Browse Source

Pull request #281324: BI-149124 refactor: 粘贴限制变成参数

Merge in DEC/fineui from ~JIMMY.CHAI/dec-fineui:feature/x to feature/x

* commit 'c8d04fabdb98c7edc82a5d1f96f389d26cb2668a':
  BI-149124 refactor: 粘贴限制变成参数
master^2^2
Jimmy.Chai-柴嘉明 6 months ago
parent
commit
2109dee89d
  1. 9
      packages/fineui/src/core/constant/writable.var.js
  2. 5
      packages/fineui/src/widget/multiselect/multiselect.insert.combo.js
  3. 7
      packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js
  4. 7
      packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js
  5. 9
      packages/fineui/src/widget/multiselectlist/multiselectlist.insert.js
  6. 9
      packages/fineui/src/widget/multiselectlist/multiselectlist.insert.nobar.js
  7. 2
      packages/fineui/typescript/core/var.ts
  8. 1
      scripts/lib/fui.export.txt

9
packages/fineui/src/core/constant/writable.var.js

@ -139,3 +139,12 @@ addDescriptor("nextTick", {
get: () => nextTick, get: () => nextTick,
set: setNextTick, set: setNextTick,
}); });
export let PasteLimit = 2000;
export const setPasteLimit = v => {
PasteLimit = v;
};
addDescriptor("PasteLimit", {
get: () => PasteLimit,
set: setPasteLimit,
});

5
packages/fineui/src/widget/multiselect/multiselect.insert.combo.js

@ -33,6 +33,7 @@ import {
SIZE_CONSANTS, SIZE_CONSANTS,
BlankSplitChar, BlankSplitChar,
size, size,
PasteLimit,
} from "@/core"; } from "@/core";
import { Single, Combo, Msg } from "@/base"; import { Single, Combo, Msg } from "@/base";
import { MultiSelectBar, TriggerIconButton } from "@/case"; import { MultiSelectBar, TriggerIconButton } from "@/case";
@ -146,8 +147,8 @@ export class MultiSelectInsertCombo extends Single {
} }
self._dataChange = true; self._dataChange = true;
}); });
this.getSearcher().getKeywordsLength() > 2000 && this.getSearcher().getKeywordsLength() > PasteLimit &&
Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Paste_Too_Much_Value", PasteLimit));
} }
self.fireEvent(MultiSelectInsertCombo.EVENT_SEARCHING); self.fireEvent(MultiSelectInsertCombo.EVENT_SEARCHING);
}); });

7
packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -29,7 +29,8 @@ import {
pushDistinct, pushDistinct,
Selection, Selection,
BlankSplitChar, BlankSplitChar,
SIZE_CONSANTS SIZE_CONSANTS,
PasteLimit,
} from "@/core"; } from "@/core";
import { Single, Combo, Msg } from "@/base"; import { Single, Combo, Msg } from "@/base";
import { MultiSelectInsertTrigger } from "./multiselect.insert.trigger"; import { MultiSelectInsertTrigger } from "./multiselect.insert.trigger";
@ -134,8 +135,8 @@ export class MultiSelectInsertNoBarCombo extends Single {
} }
self._dataChange = true; self._dataChange = true;
}); });
this.getSearcher().getKeywordsLength() > 2000 && this.getSearcher().getKeywordsLength() > PasteLimit &&
Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Paste_Too_Much_Value", PasteLimit));
} }
}); });

7
packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -10,7 +10,8 @@ import {
size, size,
each, each,
BlankSplitChar, BlankSplitChar,
Selection Selection,
PasteLimit,
} from "@/core"; } from "@/core";
import { MultiSelectEditor } from "./editor.multiselect"; import { MultiSelectEditor } from "./editor.multiselect";
import { Searcher } from "@/base"; import { Searcher } from "@/base";
@ -123,7 +124,7 @@ export class MultiSelectInsertSearcher extends Widget {
const keywords = this.getKeywords(); const keywords = this.getKeywords();
self.fireEvent( self.fireEvent(
MultiSelectInsertSearcher.EVENT_SEARCHING, 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)) { if (isNotNull(o.value)) {
@ -150,7 +151,7 @@ export class MultiSelectInsertSearcher extends Widget {
} }
getKeyword() { getKeyword() {
let keywords = this.editor.getKeywords().slice(0, 2000); let keywords = this.editor.getKeywords().slice(0, PasteLimit);
if (keywords[keywords.length - 1] === BlankSplitChar) { if (keywords[keywords.length - 1] === BlankSplitChar) {
keywords = keywords.slice(0, keywords.length - 1); keywords = keywords.slice(0, keywords.length - 1);
} }

9
packages/fineui/src/widget/multiselectlist/multiselectlist.insert.js

@ -28,7 +28,8 @@ import {
isNull, isNull,
VerticalFillLayout, VerticalFillLayout,
SIZE_CONSANTS, SIZE_CONSANTS,
BlankSplitChar BlankSplitChar,
PasteLimit,
} from "@/core"; } from "@/core";
import { Single, Searcher, Msg } from "@/base"; import { Single, Searcher, Msg } from "@/base";
import { MultiSelectBar } from "@/case"; import { MultiSelectBar } from "@/case";
@ -200,10 +201,10 @@ export class MultiSelectInsertList extends Single {
} }
self.fireEvent(MultiSelectInsertList.EVENT_CHANGE); self.fireEvent(MultiSelectInsertList.EVENT_CHANGE);
}); });
self._getKeywordsLength() > 2000 && self._getKeywordsLength() > PasteLimit &&
Msg.alert( Msg.alert(
i18nText("BI-Basic_Prompt"), 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]); 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() { _getKeywordsLength() {

9
packages/fineui/src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -28,7 +28,8 @@ import {
isNull, isNull,
VTapeLayout, VTapeLayout,
BlankSplitChar, BlankSplitChar,
SIZE_CONSANTS SIZE_CONSANTS,
PasteLimit,
} from "@/core"; } from "@/core";
import { Single, Searcher, Msg } from "@/base"; import { Single, Searcher, Msg } from "@/base";
import { MultiSelectBar } from "@/case"; import { MultiSelectBar } from "@/case";
@ -201,10 +202,10 @@ export class MultiSelectInsertNoBarList extends Single {
} }
self.fireEvent(MultiSelectInsertNoBarList.EVENT_CHANGE); self.fireEvent(MultiSelectInsertNoBarList.EVENT_CHANGE);
}); });
self._getKeywordsLength() > 2000 && self._getKeywordsLength() > PasteLimit &&
Msg.alert( Msg.alert(
i18nText("BI-Basic_Prompt"), 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]); 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() { _getKeywordsLength() {

2
packages/fineui/typescript/core/var.ts

@ -130,6 +130,7 @@ export declare const VerticalAlign: {
export declare const StartOfWeek: number; export declare const StartOfWeek: number;
export declare const BlankSplitChar: string; export declare const BlankSplitChar: string;
export declare const Events: Record<string, string>; export declare const Events: Record<string, string>;
export declare const PasteLimit: number;
type SetFunc = (value: any) => void; type SetFunc = (value: any) => void;
@ -141,3 +142,4 @@ export declare const setBlankSplitChar: SetFunc;
export declare const setPixFormat: SetFunc; export declare const setPixFormat: SetFunc;
export declare const setToPix: SetFunc; export declare const setToPix: SetFunc;
export declare const setEventBlur: SetFunc; export declare const setEventBlur: SetFunc;
export declare const setPasteLimit: SetFunc;

1
scripts/lib/fui.export.txt

@ -295,6 +295,7 @@ Pager
Pane Pane
Panel Panel
PartTree PartTree
PasteLimit
Plugin Plugin
PlusGroupNode PlusGroupNode
Popover Popover

Loading…
Cancel
Save