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. 11
      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

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

@ -138,4 +138,13 @@ addDescriptor("DOM", {
addDescriptor("nextTick", {
get: () => nextTick,
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,
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);
});

7
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));
}
});

7
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);
}

9
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() {

9
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() {

2
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<string, string>;
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;

1
scripts/lib/fui.export.txt

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

Loading…
Cancel
Save