@yoka-ui/ui 1.0.4 → 1.0.6
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/@Docs-yoka/exports.generated.md +68 -63
- package/README.md +44 -15
- package/dist/es/business/AiChat/index.js.map +1 -1
- package/dist/es/business/AiChat/intentRecognizer.js.map +1 -1
- package/dist/es/business/AiChat/navigationManager.js +6 -6
- package/dist/es/business/AiChat/navigationManager.js.map +2 -2
- package/dist/es/business/DrawerPageInfo/index.js +2 -2
- package/dist/es/business/DrawerPageInfo/index.js.map +2 -2
- package/dist/es/business/Editor/index.d.ts +1 -1
- package/dist/es/business/Editor/index.js.map +2 -2
- package/dist/es/business/Empty/index.js +1 -1
- package/dist/es/business/Empty/index.js.map +1 -1
- package/dist/es/business/ModCommonFilter/components/PopoverContent/Category.js +2 -2
- package/dist/es/business/ModCommonFilter/components/PopoverContent/Category.js.map +2 -2
- package/dist/es/business/ModCommonFilter/components/PopoverContent/Content.js +3 -3
- package/dist/es/business/ModCommonFilter/components/PopoverContent/Content.js.map +2 -2
- package/dist/es/business/ModCommonFilter/components/PopoverContent/Selected.js +2 -2
- package/dist/es/business/ModCommonFilter/components/PopoverContent/Selected.js.map +2 -2
- package/dist/es/business/ModCommonFilter/index.d.ts +1 -1
- package/dist/es/business/ModCommonFilter/index.js.map +2 -2
- package/dist/es/business/YkLoginModule/SmsLoginForm.d.ts +25 -0
- package/dist/es/business/YkLoginModule/SmsLoginForm.js +178 -0
- package/dist/es/business/YkLoginModule/SmsLoginForm.js.map +7 -0
- package/dist/es/business/YkLoginModule/index.d.ts +48 -0
- package/dist/es/business/YkLoginModule/index.js +198 -0
- package/dist/es/business/YkLoginModule/index.js.map +7 -0
- package/dist/es/business/YkLoginModule/styles.module.less +169 -0
- package/dist/es/business/YkPorjectSelect/index.d.ts +1 -1
- package/dist/es/business/YkPorjectSelect/index.js +2 -2
- package/dist/es/business/YkPorjectSelect/index.js.map +2 -2
- package/dist/es/business/YkSqlEdit/code-mirror-custom.module.less +154 -0
- package/dist/es/business/YkSqlEdit/index.d.ts +20 -0
- package/dist/es/business/YkSqlEdit/index.js +180 -0
- package/dist/es/business/YkSqlEdit/index.js.map +7 -0
- package/dist/es/business/YkSqlEdit/sql-language.d.ts +11 -0
- package/dist/es/business/YkSqlEdit/sql-language.js +1460 -0
- package/dist/es/business/YkSqlEdit/sql-language.js.map +7 -0
- package/dist/es/components/DebounceInput/index.js.map +2 -2
- package/dist/es/components/MultipleSelect/index.d.ts +14 -0
- package/dist/es/components/MultipleSelect/index.js +1 -1
- package/dist/es/components/MultipleSelect/index.js.map +2 -2
- package/dist/es/components/RefreshButton/index.js.map +2 -2
- package/dist/es/components/SearchWithHistory/index.js +1 -1
- package/dist/es/components/SearchWithHistory/index.js.map +2 -2
- package/dist/es/components/TextWithToolTip/index.d.ts +1 -1
- package/dist/es/components/TextWithToolTip/index.js.map +2 -2
- package/dist/es/components/TreeTransfer/components/TreeTransferPanel/index.d.ts +1 -24
- package/dist/es/components/TreeTransfer/components/TreeTransferPanel/index.js +2 -2
- package/dist/es/components/TreeTransfer/components/TreeTransferPanel/index.js.map +2 -2
- package/dist/es/components/TreeTransfer/index.d.ts +1 -24
- package/dist/es/components/TreeTransfer/index.js +8 -8
- package/dist/es/components/TreeTransfer/index.js.map +2 -2
- package/dist/es/components/TreeTransfer/utils/index.d.ts +1 -1
- package/dist/es/components/TreeTransfer/utils/index.js.map +2 -2
- package/dist/es/components/YkDateRangePicker/index.d.ts +1 -1
- package/dist/es/components/YkDateRangePicker/index.js +1 -1
- package/dist/es/components/YkDateRangePicker/index.js.map +2 -2
- package/dist/es/components/YkDateRangePicker/index.module.less +2 -1
- package/dist/es/components/YkRangeDateWithVS/YkRangeDateWithVSCompare.d.ts +1 -1
- package/dist/es/components/YkRangeDateWithVS/YkRangeDateWithVSCompare.js +3 -2
- package/dist/es/components/YkRangeDateWithVS/YkRangeDateWithVSCompare.js.map +2 -2
- package/dist/es/components/YkRangeDateWithVS/YkRangeDateWithVSRange.d.ts +1 -1
- package/dist/es/components/YkRangeDateWithVS/YkRangeDateWithVSRange.js +60 -9
- package/dist/es/components/YkRangeDateWithVS/YkRangeDateWithVSRange.js.map +3 -3
- package/dist/es/components/YkRangeDateWithVS/YkRangeDateWithVSSelect.d.ts +1 -1
- package/dist/es/components/YkRangeDateWithVS/YkRangeDateWithVSSelect.js.map +2 -2
- package/dist/es/components/YkRangeDateWithVS/index.d.ts +4 -4
- package/dist/es/components/YkRangeDateWithVS/index.js +2 -3
- package/dist/es/components/YkRangeDateWithVS/index.js.map +2 -2
- package/dist/es/components/YkRangeDateWithVS/index.module.less +23 -4
- package/dist/es/components/YkRangeTimeWithRecent/index.d.ts +1 -18
- package/dist/es/components/YkRangeTimeWithRecent/index.js +27 -7
- package/dist/es/components/YkRangeTimeWithRecent/index.js.map +2 -2
- package/dist/es/creative/ArcCheckbox/index.d.ts +12 -0
- package/dist/es/creative/ArcCheckbox/index.js +49 -0
- package/dist/es/creative/ArcCheckbox/index.js.map +7 -0
- package/dist/es/creative/ArcCheckbox/index.module.less +102 -0
- package/dist/es/creative/ButtonRadioWithInfo/index.js.map +1 -1
- package/dist/es/creative/ButtonWithProgress/index.d.ts +1 -1
- package/dist/es/creative/ButtonWithProgress/index.js.map +2 -2
- package/dist/es/creative/GlassSegmentedRadio/index.d.ts +24 -0
- package/dist/es/creative/GlassSegmentedRadio/index.js +75 -0
- package/dist/es/creative/GlassSegmentedRadio/index.js.map +7 -0
- package/dist/es/creative/GlassSegmentedRadio/index.module.less +241 -0
- package/dist/es/index.d.ts +32 -26
- package/dist/es/index.js +90 -82
- package/dist/es/index.js.map +2 -2
- package/dist/es/index.less +5 -1
- package/dist/es/layout/FlexGrid/index.d.ts +1 -1
- package/dist/es/layout/FlexGrid/index.js.map +2 -2
- package/dist/es/layout/YkContainer/index.js.map +1 -1
- package/dist/es/layout/YkDrawer/index.d.ts +1 -1
- package/dist/es/layout/YkDrawer/index.js +2 -1
- package/dist/es/layout/YkDrawer/index.js.map +2 -2
- package/dist/es/ui/LabelSelect/demo.js +1 -1
- package/dist/es/ui/LabelSelect/demo.js.map +2 -2
- package/dist/es/ui/LabelSelect/index.d.ts +1 -1
- package/dist/es/ui/LabelSelect/index.js +1 -1
- package/dist/es/ui/LabelSelect/index.js.map +2 -2
- package/dist/es/ui/LogicOperator/index.d.ts +1 -1
- package/dist/es/ui/LogicOperator/index.js.map +2 -2
- package/dist/es/ui/YkButton/index.d.ts +1 -1
- package/dist/es/ui/YkButton/index.js.map +2 -2
- package/dist/es/ui/YkCard/index.d.ts +1 -1
- package/dist/es/ui/YkCard/index.js +1 -1
- package/dist/es/ui/YkCard/index.js.map +2 -2
- package/dist/es/ui/YkCheckbox/index.d.ts +1 -1
- package/dist/es/ui/YkCheckbox/index.js.map +2 -2
- package/dist/es/ui/YkDescriptions/index.d.ts +1 -1
- package/dist/es/ui/YkDescriptions/index.js.map +2 -2
- package/dist/es/ui/YkPagination/index.d.ts +1 -1
- package/dist/es/ui/YkPagination/index.js.map +2 -2
- package/dist/es/ui/YkRadio/index.d.ts +1 -1
- package/dist/es/ui/YkRadio/index.js.map +2 -2
- package/dist/es/ui/YkSegmented/index.d.ts +1 -1
- package/dist/es/ui/YkSegmented/index.js.map +2 -2
- package/dist/es/ui/YkSelect/index.d.ts +1 -1
- package/dist/es/ui/YkSelect/index.js.map +2 -2
- package/dist/es/ui/YkSpin/index.d.ts +1 -1
- package/dist/es/ui/YkSpin/index.js.map +2 -2
- package/dist/es/ui/YkStatistic/index.d.ts +1 -1
- package/dist/es/ui/YkStatistic/index.js.map +2 -2
- package/dist/es/ui/YkSwitch/index.d.ts +1 -1
- package/dist/es/ui/YkSwitch/index.js.map +2 -2
- package/dist/es/ui/YkTabs/index.d.ts +1 -1
- package/dist/es/ui/YkTabs/index.js.map +2 -2
- package/dist/es/ui/YkTooltip/index.d.ts +1 -1
- package/dist/es/ui/YkTooltip/index.js.map +2 -2
- package/dist/es/utils/styleUtils.js.map +2 -2
- package/dist/es/utils/ykStorybookDoc.js +1 -1
- package/dist/es/utils/ykStorybookDoc.js.map +1 -1
- package/dist/lib/business/AiChat/index.js.map +1 -1
- package/dist/lib/business/AiChat/intentRecognizer.js.map +1 -1
- package/dist/lib/business/AiChat/navigationManager.js +6 -6
- package/dist/lib/business/AiChat/navigationManager.js.map +2 -2
- package/dist/lib/business/DrawerPageInfo/index.js +1 -1
- package/dist/lib/business/DrawerPageInfo/index.js.map +2 -2
- package/dist/lib/business/Editor/index.d.ts +1 -1
- package/dist/lib/business/Editor/index.js.map +2 -2
- package/dist/lib/business/Empty/index.js +1 -1
- package/dist/lib/business/Empty/index.js.map +1 -1
- package/dist/lib/business/ModCommonFilter/components/PopoverContent/Category.js +3 -3
- package/dist/lib/business/ModCommonFilter/components/PopoverContent/Category.js.map +2 -2
- package/dist/lib/business/ModCommonFilter/components/PopoverContent/Content.js +4 -4
- package/dist/lib/business/ModCommonFilter/components/PopoverContent/Content.js.map +2 -2
- package/dist/lib/business/ModCommonFilter/components/PopoverContent/Selected.js +3 -3
- package/dist/lib/business/ModCommonFilter/components/PopoverContent/Selected.js.map +2 -2
- package/dist/lib/business/ModCommonFilter/index.d.ts +1 -1
- package/dist/lib/business/ModCommonFilter/index.js.map +2 -2
- package/dist/lib/business/YkLoginModule/SmsLoginForm.d.ts +25 -0
- package/dist/lib/business/YkLoginModule/SmsLoginForm.js +171 -0
- package/dist/lib/business/YkLoginModule/SmsLoginForm.js.map +7 -0
- package/dist/lib/business/YkLoginModule/index.d.ts +48 -0
- package/dist/lib/business/YkLoginModule/index.js +206 -0
- package/dist/lib/business/YkLoginModule/index.js.map +7 -0
- package/dist/lib/business/YkLoginModule/styles.module.less +169 -0
- package/dist/lib/business/YkPorjectSelect/index.d.ts +1 -1
- package/dist/lib/business/YkPorjectSelect/index.js +3 -3
- package/dist/lib/business/YkPorjectSelect/index.js.map +2 -2
- package/dist/lib/business/YkSqlEdit/code-mirror-custom.module.less +154 -0
- package/dist/lib/business/YkSqlEdit/index.d.ts +20 -0
- package/dist/lib/business/YkSqlEdit/index.js +202 -0
- package/dist/lib/business/YkSqlEdit/index.js.map +7 -0
- package/dist/lib/business/YkSqlEdit/sql-language.d.ts +11 -0
- package/dist/lib/business/YkSqlEdit/sql-language.js +1493 -0
- package/dist/lib/business/YkSqlEdit/sql-language.js.map +7 -0
- package/dist/lib/components/DebounceInput/index.js.map +2 -2
- package/dist/lib/components/MultipleSelect/index.d.ts +14 -0
- package/dist/lib/components/MultipleSelect/index.js +1 -1
- package/dist/lib/components/MultipleSelect/index.js.map +2 -2
- package/dist/lib/components/RefreshButton/index.js.map +2 -2
- package/dist/lib/components/SearchWithHistory/index.js +1 -1
- package/dist/lib/components/SearchWithHistory/index.js.map +2 -2
- package/dist/lib/components/TextWithToolTip/index.d.ts +1 -1
- package/dist/lib/components/TextWithToolTip/index.js.map +2 -2
- package/dist/lib/components/TreeTransfer/components/TreeTransferPanel/index.d.ts +1 -24
- package/dist/lib/components/TreeTransfer/components/TreeTransferPanel/index.js +2 -2
- package/dist/lib/components/TreeTransfer/components/TreeTransferPanel/index.js.map +2 -2
- package/dist/lib/components/TreeTransfer/index.d.ts +1 -24
- package/dist/lib/components/TreeTransfer/index.js +3 -3
- package/dist/lib/components/TreeTransfer/index.js.map +2 -2
- package/dist/lib/components/TreeTransfer/utils/index.d.ts +1 -1
- package/dist/lib/components/TreeTransfer/utils/index.js.map +2 -2
- package/dist/lib/components/YkDateRangePicker/index.d.ts +1 -1
- package/dist/lib/components/YkDateRangePicker/index.js +1 -1
- package/dist/lib/components/YkDateRangePicker/index.js.map +2 -2
- package/dist/lib/components/YkDateRangePicker/index.module.less +2 -1
- package/dist/lib/components/YkRangeDateWithVS/YkRangeDateWithVSCompare.d.ts +1 -1
- package/dist/lib/components/YkRangeDateWithVS/YkRangeDateWithVSCompare.js +3 -2
- package/dist/lib/components/YkRangeDateWithVS/YkRangeDateWithVSCompare.js.map +2 -2
- package/dist/lib/components/YkRangeDateWithVS/YkRangeDateWithVSRange.d.ts +1 -1
- package/dist/lib/components/YkRangeDateWithVS/YkRangeDateWithVSRange.js +59 -8
- package/dist/lib/components/YkRangeDateWithVS/YkRangeDateWithVSRange.js.map +3 -3
- package/dist/lib/components/YkRangeDateWithVS/YkRangeDateWithVSSelect.d.ts +1 -1
- package/dist/lib/components/YkRangeDateWithVS/YkRangeDateWithVSSelect.js.map +2 -2
- package/dist/lib/components/YkRangeDateWithVS/index.d.ts +4 -4
- package/dist/lib/components/YkRangeDateWithVS/index.js +4 -5
- package/dist/lib/components/YkRangeDateWithVS/index.js.map +3 -3
- package/dist/lib/components/YkRangeDateWithVS/index.module.less +23 -4
- package/dist/lib/components/YkRangeTimeWithRecent/index.d.ts +1 -18
- package/dist/lib/components/YkRangeTimeWithRecent/index.js +27 -7
- package/dist/lib/components/YkRangeTimeWithRecent/index.js.map +2 -2
- package/dist/lib/creative/ArcCheckbox/index.d.ts +12 -0
- package/dist/lib/creative/ArcCheckbox/index.js +50 -0
- package/dist/lib/creative/ArcCheckbox/index.js.map +7 -0
- package/dist/lib/creative/ArcCheckbox/index.module.less +102 -0
- package/dist/lib/creative/ButtonRadioWithInfo/index.js.map +1 -1
- package/dist/lib/creative/ButtonWithProgress/index.d.ts +1 -1
- package/dist/lib/creative/ButtonWithProgress/index.js.map +2 -2
- package/dist/lib/creative/GlassSegmentedRadio/index.d.ts +24 -0
- package/dist/lib/creative/GlassSegmentedRadio/index.js +78 -0
- package/dist/lib/creative/GlassSegmentedRadio/index.js.map +7 -0
- package/dist/lib/creative/GlassSegmentedRadio/index.module.less +241 -0
- package/dist/lib/index.d.ts +32 -26
- package/dist/lib/index.js +37 -25
- package/dist/lib/index.js.map +2 -2
- package/dist/lib/index.less +5 -1
- package/dist/lib/layout/FlexGrid/index.d.ts +1 -1
- package/dist/lib/layout/FlexGrid/index.js.map +2 -2
- package/dist/lib/layout/YkContainer/index.js.map +1 -1
- package/dist/lib/layout/YkDrawer/index.d.ts +1 -1
- package/dist/lib/layout/YkDrawer/index.js +2 -1
- package/dist/lib/layout/YkDrawer/index.js.map +2 -2
- package/dist/lib/ui/LabelSelect/demo.js +1 -1
- package/dist/lib/ui/LabelSelect/demo.js.map +2 -2
- package/dist/lib/ui/LabelSelect/index.d.ts +1 -1
- package/dist/lib/ui/LabelSelect/index.js +1 -1
- package/dist/lib/ui/LabelSelect/index.js.map +2 -2
- package/dist/lib/ui/LogicOperator/index.d.ts +1 -1
- package/dist/lib/ui/LogicOperator/index.js.map +2 -2
- package/dist/lib/ui/YkButton/index.d.ts +1 -1
- package/dist/lib/ui/YkButton/index.js.map +2 -2
- package/dist/lib/ui/YkCard/index.d.ts +1 -1
- package/dist/lib/ui/YkCard/index.js.map +2 -2
- package/dist/lib/ui/YkCheckbox/index.d.ts +1 -1
- package/dist/lib/ui/YkCheckbox/index.js.map +2 -2
- package/dist/lib/ui/YkDescriptions/index.d.ts +1 -1
- package/dist/lib/ui/YkDescriptions/index.js.map +2 -2
- package/dist/lib/ui/YkPagination/index.d.ts +1 -1
- package/dist/lib/ui/YkPagination/index.js.map +2 -2
- package/dist/lib/ui/YkRadio/index.d.ts +1 -1
- package/dist/lib/ui/YkRadio/index.js.map +2 -2
- package/dist/lib/ui/YkSegmented/index.d.ts +1 -1
- package/dist/lib/ui/YkSegmented/index.js.map +2 -2
- package/dist/lib/ui/YkSelect/index.d.ts +1 -1
- package/dist/lib/ui/YkSelect/index.js.map +2 -2
- package/dist/lib/ui/YkSpin/index.d.ts +1 -1
- package/dist/lib/ui/YkSpin/index.js.map +2 -2
- package/dist/lib/ui/YkStatistic/index.d.ts +1 -1
- package/dist/lib/ui/YkStatistic/index.js.map +2 -2
- package/dist/lib/ui/YkSwitch/index.d.ts +1 -1
- package/dist/lib/ui/YkSwitch/index.js.map +2 -2
- package/dist/lib/ui/YkTabs/index.d.ts +1 -1
- package/dist/lib/ui/YkTabs/index.js.map +2 -2
- package/dist/lib/ui/YkTooltip/index.d.ts +1 -1
- package/dist/lib/ui/YkTooltip/index.js.map +2 -2
- package/dist/lib/utils/styleUtils.js.map +2 -2
- package/dist/lib/utils/ykStorybookDoc.js +1 -1
- package/dist/lib/utils/ykStorybookDoc.js.map +1 -1
- package/package.json +43 -45
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/business/YkLoginModule/index.tsx
|
|
30
|
+
var YkLoginModule_exports = {};
|
|
31
|
+
__export(YkLoginModule_exports, {
|
|
32
|
+
default: () => YkLoginModule_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(YkLoginModule_exports);
|
|
35
|
+
var import_pro_form = require("@ant-design/pro-form");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_SmsLoginForm = __toESM(require("./SmsLoginForm"));
|
|
39
|
+
var import_styles_module = __toESM(require("./styles.module.less"));
|
|
40
|
+
var DEFAULT_QRCODE_WRAP_STYLE = {
|
|
41
|
+
padding: 10,
|
|
42
|
+
display: "flex",
|
|
43
|
+
justifyContent: "center"
|
|
44
|
+
};
|
|
45
|
+
var LoginModule = (props) => {
|
|
46
|
+
const {
|
|
47
|
+
title,
|
|
48
|
+
tabs,
|
|
49
|
+
defaultLoginType,
|
|
50
|
+
containerStyle,
|
|
51
|
+
actions,
|
|
52
|
+
onFinish,
|
|
53
|
+
qrcode,
|
|
54
|
+
className = import_styles_module.default.root,
|
|
55
|
+
formClassName = import_styles_module.default.form,
|
|
56
|
+
tabsClassName = import_styles_module.default.tabs,
|
|
57
|
+
inputClassName,
|
|
58
|
+
qrcodeClassName = import_styles_module.default.qrcode,
|
|
59
|
+
qrcodeBoxClassName = import_styles_module.default.qrcodeBox,
|
|
60
|
+
sms
|
|
61
|
+
} = props;
|
|
62
|
+
const [loginType, setLoginType] = (0, import_react.useState)(defaultLoginType);
|
|
63
|
+
const [qrcodeStatus, setQrcodeStatus] = (0, import_react.useState)("active");
|
|
64
|
+
const [qrcodeUrl, setQrcodeUrl] = (0, import_react.useState)("-");
|
|
65
|
+
const [qrcodeValue, setQrcodeValue] = (0, import_react.useState)("");
|
|
66
|
+
const pollIntervalRef = (0, import_react.useRef)(null);
|
|
67
|
+
const pollTimeoutRef = (0, import_react.useRef)(null);
|
|
68
|
+
const shouldShowSubmitter = loginType !== "qrcode";
|
|
69
|
+
const resolvedActions = (0, import_react.useMemo)(() => {
|
|
70
|
+
if (!actions)
|
|
71
|
+
return void 0;
|
|
72
|
+
return typeof actions === "function" ? actions(loginType) : actions;
|
|
73
|
+
}, [actions, loginType]);
|
|
74
|
+
const safeClearTimers = (0, import_react.useCallback)(() => {
|
|
75
|
+
if (pollIntervalRef.current)
|
|
76
|
+
clearInterval(pollIntervalRef.current);
|
|
77
|
+
if (pollTimeoutRef.current)
|
|
78
|
+
clearTimeout(pollTimeoutRef.current);
|
|
79
|
+
pollIntervalRef.current = null;
|
|
80
|
+
pollTimeoutRef.current = null;
|
|
81
|
+
}, []);
|
|
82
|
+
const handleQrcodeRefresh = (0, import_react.useCallback)(async () => {
|
|
83
|
+
if (!qrcode)
|
|
84
|
+
return;
|
|
85
|
+
setQrcodeStatus("loading");
|
|
86
|
+
try {
|
|
87
|
+
const res = await qrcode.api.getQrcode();
|
|
88
|
+
setQrcodeUrl(res.url);
|
|
89
|
+
setQrcodeValue(res.qrcode);
|
|
90
|
+
setQrcodeStatus("active");
|
|
91
|
+
} catch {
|
|
92
|
+
setQrcodeStatus("expired");
|
|
93
|
+
import_antd.message.error("获取二维码失败,请稍后重试");
|
|
94
|
+
}
|
|
95
|
+
}, [qrcode]);
|
|
96
|
+
const enabledTabKeys = (0, import_react.useMemo)(() => new Set(tabs.map((t) => t.key)), [tabs]);
|
|
97
|
+
(0, import_react.useEffect)(() => {
|
|
98
|
+
var _a;
|
|
99
|
+
if (enabledTabKeys.has(defaultLoginType)) {
|
|
100
|
+
setLoginType(defaultLoginType);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const fallback = (_a = tabs[0]) == null ? void 0 : _a.key;
|
|
104
|
+
if (fallback)
|
|
105
|
+
setLoginType(fallback);
|
|
106
|
+
}, [defaultLoginType, enabledTabKeys, tabs]);
|
|
107
|
+
(0, import_react.useEffect)(() => {
|
|
108
|
+
var _a;
|
|
109
|
+
if (enabledTabKeys.has(loginType))
|
|
110
|
+
return;
|
|
111
|
+
const fallback = (_a = tabs[0]) == null ? void 0 : _a.key;
|
|
112
|
+
if (fallback)
|
|
113
|
+
setLoginType(fallback);
|
|
114
|
+
}, [enabledTabKeys, loginType, tabs]);
|
|
115
|
+
(0, import_react.useEffect)(() => {
|
|
116
|
+
safeClearTimers();
|
|
117
|
+
if (loginType !== "qrcode") {
|
|
118
|
+
setQrcodeStatus("expired");
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (!qrcode) {
|
|
122
|
+
setQrcodeStatus("expired");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
void handleQrcodeRefresh();
|
|
126
|
+
return safeClearTimers;
|
|
127
|
+
}, [handleQrcodeRefresh, loginType, qrcode, safeClearTimers]);
|
|
128
|
+
(0, import_react.useEffect)(() => {
|
|
129
|
+
safeClearTimers();
|
|
130
|
+
if (!qrcode)
|
|
131
|
+
return;
|
|
132
|
+
if (loginType !== "qrcode")
|
|
133
|
+
return;
|
|
134
|
+
if (qrcodeStatus !== "active")
|
|
135
|
+
return;
|
|
136
|
+
if (!qrcodeValue)
|
|
137
|
+
return;
|
|
138
|
+
pollIntervalRef.current = setInterval(() => {
|
|
139
|
+
void qrcode.api.scanLogin(qrcodeValue).then((res) => {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
if (res.code !== 200)
|
|
142
|
+
return;
|
|
143
|
+
const status = (_a = res.data) == null ? void 0 : _a.status;
|
|
144
|
+
const msg = ((_b = res.data) == null ? void 0 : _b.msg) ?? "扫码遇到问题,稍后重试";
|
|
145
|
+
if (status === -1)
|
|
146
|
+
return;
|
|
147
|
+
if (status !== 1) {
|
|
148
|
+
safeClearTimers();
|
|
149
|
+
setQrcodeStatus("expired");
|
|
150
|
+
import_antd.message.error(msg, 3);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
safeClearTimers();
|
|
154
|
+
void qrcode.onSuccess();
|
|
155
|
+
}).catch(() => {
|
|
156
|
+
});
|
|
157
|
+
}, 1e3);
|
|
158
|
+
pollTimeoutRef.current = setTimeout(() => {
|
|
159
|
+
setQrcodeStatus("expired");
|
|
160
|
+
safeClearTimers();
|
|
161
|
+
}, 3e4);
|
|
162
|
+
return safeClearTimers;
|
|
163
|
+
}, [loginType, qrcode, qrcodeStatus, qrcodeValue, safeClearTimers]);
|
|
164
|
+
const tabItems = (0, import_react.useMemo)(() => tabs.map((t) => ({ key: t.key, label: t.label })), [tabs]);
|
|
165
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className, style: { maxWidth: "500px" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
166
|
+
import_pro_form.LoginForm,
|
|
167
|
+
{
|
|
168
|
+
className: formClassName,
|
|
169
|
+
onFinish: async (values) => {
|
|
170
|
+
await onFinish(values);
|
|
171
|
+
},
|
|
172
|
+
title: typeof title === "string" ? /* @__PURE__ */ import_react.default.createElement("div", { className: import_styles_module.default.title }, title) : title,
|
|
173
|
+
containerStyle,
|
|
174
|
+
submitter: shouldShowSubmitter ? void 0 : false,
|
|
175
|
+
actions: resolvedActions
|
|
176
|
+
},
|
|
177
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
178
|
+
import_antd.Tabs,
|
|
179
|
+
{
|
|
180
|
+
className: tabsClassName,
|
|
181
|
+
centered: true,
|
|
182
|
+
activeKey: loginType,
|
|
183
|
+
onChange: (activeKey) => {
|
|
184
|
+
const next = activeKey;
|
|
185
|
+
setLoginType(next);
|
|
186
|
+
},
|
|
187
|
+
items: tabItems
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
enabledTabKeys.has("qrcode") && loginType === "qrcode" && qrcode && /* @__PURE__ */ import_react.default.createElement("div", { style: qrcode.wrapStyle ?? DEFAULT_QRCODE_WRAP_STYLE }, /* @__PURE__ */ import_react.default.createElement("div", { className: qrcodeBoxClassName }, /* @__PURE__ */ import_react.default.createElement(import_antd.Flex, { justify: "center", align: "center" }, /* @__PURE__ */ import_react.default.createElement("i", { className: "iconfont icon-saoyisao", style: { color: "#999999", marginRight: 10, fontSize: 14 } }), "请使用", /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#0A6BFD" } }, "小闪扫码"), "登录"), /* @__PURE__ */ import_react.default.createElement(
|
|
191
|
+
import_antd.QRCode,
|
|
192
|
+
{
|
|
193
|
+
icon: qrcode.icon,
|
|
194
|
+
iconSize: qrcode.iconSize ?? 50,
|
|
195
|
+
className: qrcodeClassName,
|
|
196
|
+
size: qrcode.size ?? 240,
|
|
197
|
+
value: qrcodeUrl,
|
|
198
|
+
status: qrcodeStatus,
|
|
199
|
+
onRefresh: handleQrcodeRefresh
|
|
200
|
+
}
|
|
201
|
+
))),
|
|
202
|
+
enabledTabKeys.has("sms") && loginType === "sms" && sms && /* @__PURE__ */ import_react.default.createElement(import_SmsLoginForm.default, { inputClassName: inputClassName ?? "", api: sms.api, appKey: sms.appKey })
|
|
203
|
+
));
|
|
204
|
+
};
|
|
205
|
+
var YkLoginModule_default = LoginModule;
|
|
206
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/business/YkLoginModule/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import { LoginForm } from '@ant-design/pro-form';\nimport { Flex, message, QRCode, Tabs } from 'antd';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport SmsLoginForm, { type SmsLoginFormApi } from './SmsLoginForm';\nimport styles from './styles.module.less';\n\nexport type LoginType = 'qrcode' | 'sms';\n\nexport type LoginTabItem = {\n key: LoginType;\n label: React.ReactNode;\n};\n\nexport type QrcodeApi = {\n getQrcode: () => Promise<{ qrcode: string; url: string }>;\n scanLogin: (qrcode: string) => Promise<{\n code: number;\n data?: {\n status?: number;\n msg?: string;\n };\n }>;\n};\n\nexport type LoginModuleProps = {\n title: React.ReactNode;\n tabs: LoginTabItem[];\n defaultLoginType: LoginType;\n containerStyle?: React.CSSProperties;\n actions?: React.ReactNode | ((loginType: LoginType) => React.ReactNode);\n className?: string;\n formClassName?: string;\n tabsClassName?: string;\n inputClassName?: string;\n qrcodeClassName?: string;\n qrcodeBoxClassName?: string;\n\n onFinish: (values: Record<string, unknown>) => Promise<void>;\n\n qrcode?: {\n api: QrcodeApi;\n icon: string;\n iconSize?: number;\n size?: number;\n wrapStyle?: React.CSSProperties;\n onSuccess: () => void | Promise<void>;\n };\n\n sms?: {\n api: SmsLoginFormApi;\n appKey: string;\n };\n};\n\nconst DEFAULT_QRCODE_WRAP_STYLE: React.CSSProperties = {\n padding: 10,\n display: 'flex',\n justifyContent: 'center',\n};\n\nconst LoginModule: React.FC<LoginModuleProps> = (props) => {\n const {\n title,\n tabs,\n defaultLoginType,\n containerStyle,\n actions,\n onFinish,\n qrcode,\n className = styles.root,\n formClassName = styles.form,\n tabsClassName = styles.tabs,\n inputClassName,\n qrcodeClassName = styles.qrcode,\n qrcodeBoxClassName = styles.qrcodeBox,\n sms,\n } = props;\n\n const [loginType, setLoginType] = useState<LoginType>(defaultLoginType);\n\n const [qrcodeStatus, setQrcodeStatus] = useState<'active' | 'expired' | 'loading'>('active');\n const [qrcodeUrl, setQrcodeUrl] = useState<string>('-');\n const [qrcodeValue, setQrcodeValue] = useState<string>('');\n const pollIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null);\n const pollTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const shouldShowSubmitter = loginType !== 'qrcode';\n\n const resolvedActions = useMemo(() => {\n if (!actions) return undefined;\n return typeof actions === 'function' ? actions(loginType) : actions;\n }, [actions, loginType]);\n\n const safeClearTimers = useCallback(() => {\n if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);\n if (pollTimeoutRef.current) clearTimeout(pollTimeoutRef.current);\n pollIntervalRef.current = null;\n pollTimeoutRef.current = null;\n }, []);\n\n const handleQrcodeRefresh = useCallback(async () => {\n if (!qrcode) return;\n setQrcodeStatus('loading');\n try {\n const res = await qrcode.api.getQrcode();\n setQrcodeUrl(res.url);\n setQrcodeValue(res.qrcode);\n setQrcodeStatus('active');\n } catch {\n setQrcodeStatus('expired');\n message.error('获取二维码失败,请稍后重试');\n }\n }, [qrcode]);\n\n const enabledTabKeys = useMemo(() => new Set(tabs.map((t) => t.key)), [tabs]);\n\n useEffect(() => {\n if (enabledTabKeys.has(defaultLoginType)) {\n setLoginType(defaultLoginType);\n return;\n }\n const fallback = tabs[0]?.key;\n if (fallback) setLoginType(fallback);\n }, [defaultLoginType, enabledTabKeys, tabs]);\n\n useEffect(() => {\n if (enabledTabKeys.has(loginType)) return;\n const fallback = tabs[0]?.key;\n if (fallback) setLoginType(fallback);\n }, [enabledTabKeys, loginType, tabs]);\n\n // 切到扫码登录时刷新二维码;离开扫码登录时停止轮询并标记过期\n useEffect(() => {\n safeClearTimers();\n if (loginType !== 'qrcode') {\n setQrcodeStatus('expired');\n return;\n }\n if (!qrcode) {\n setQrcodeStatus('expired');\n return;\n }\n void handleQrcodeRefresh();\n return safeClearTimers;\n }, [handleQrcodeRefresh, loginType, qrcode, safeClearTimers]);\n\n // 扫码轮询:仅在二维码“激活 + 有值 + 在扫码 Tab”时启动\n useEffect(() => {\n safeClearTimers();\n if (!qrcode) return;\n if (loginType !== 'qrcode') return;\n if (qrcodeStatus !== 'active') return;\n if (!qrcodeValue) return;\n\n pollIntervalRef.current = setInterval(() => {\n void qrcode.api\n .scanLogin(qrcodeValue)\n .then((res) => {\n if (res.code !== 200) return;\n\n const status = res.data?.status;\n const msg = res.data?.msg ?? '扫码遇到问题,稍后重试';\n\n if (status === -1) return;\n if (status !== 1) {\n safeClearTimers();\n setQrcodeStatus('expired');\n message.error(msg, 3);\n return;\n }\n safeClearTimers();\n void qrcode.onSuccess();\n })\n .catch(() => {\n // 忽略轮询中的偶发网络错误,保持继续轮询直到超时/成功\n });\n }, 1000);\n\n pollTimeoutRef.current = setTimeout(() => {\n setQrcodeStatus('expired');\n safeClearTimers();\n }, 30000);\n\n return safeClearTimers;\n }, [loginType, qrcode, qrcodeStatus, qrcodeValue, safeClearTimers]);\n\n const tabItems = useMemo(() => tabs.map((t) => ({ key: t.key, label: t.label })), [tabs]);\n\n return (\n <div className={className} style={{ maxWidth: '500px' }}>\n <LoginForm\n className={formClassName}\n onFinish={async (values) => {\n await onFinish(values);\n }}\n title={typeof title === 'string' ? <div className={styles.title}>{title}</div> : title}\n containerStyle={containerStyle}\n submitter={shouldShowSubmitter ? undefined : (false as const)}\n actions={resolvedActions}\n >\n <Tabs\n className={tabsClassName}\n centered\n activeKey={loginType}\n onChange={(activeKey) => {\n const next = activeKey as LoginType;\n setLoginType(next);\n }}\n items={tabItems}\n />\n\n {enabledTabKeys.has('qrcode') && loginType === 'qrcode' && qrcode && (\n <div style={qrcode.wrapStyle ?? DEFAULT_QRCODE_WRAP_STYLE}>\n <div className={qrcodeBoxClassName}>\n <Flex justify='center' align='center'>\n <i className='iconfont icon-saoyisao' style={{ color: '#999999', marginRight: 10, fontSize: 14 }}></i>\n 请使用<span style={{ color: '#0A6BFD' }}>小闪扫码</span>登录\n </Flex>\n <QRCode\n icon={qrcode.icon}\n iconSize={qrcode.iconSize ?? 50}\n className={qrcodeClassName}\n size={qrcode.size ?? 240}\n value={qrcodeUrl}\n status={qrcodeStatus}\n onRefresh={handleQrcodeRefresh}\n />\n </div>\n </div>\n )}\n\n {enabledTabKeys.has('sms') && loginType === 'sms' && sms && (\n <SmsLoginForm inputClassName={inputClassName ?? ''} api={sms.api} appKey={sms.appKey} />\n )}\n </LoginForm>\n </div>\n );\n};\n\nexport default LoginModule;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA0B;AAC1B,kBAA4C;AAC5C,mBAAyE;AACzE,0BAAmD;AACnD,2BAAmB;AAkDnB,IAAM,4BAAiD;AAAA,EACrD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,gBAAgB;AAClB;AAEA,IAAM,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AAAA,QAAA,cAAC,oBAAK,SAAQ,UAAS,OAAM,YAC3B,6BAAAA,QAAA,cAAC,OAAE,WAAU,0BAAyB,OAAO,EAAE,OAAO,WAAW,aAAa,IAAI,UAAU,GAAG,GAAG,GAAI,OACnG,6BAAAA,QAAA,cAAC,UAAK,OAAO,EAAE,OAAO,UAAU,KAAG,MAAI,GAAO,IACnD,GACA,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,OAAO;AAAA,QACb,UAAU,OAAO,YAAY;AAAA,QAC7B,WAAW;AAAA,QACX,MAAM,OAAO,QAAQ;AAAA,QACrB,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,WAAW;AAAA;AAAA,IACb,CACF,CACF;AAAA,IAGD,eAAe,IAAI,KAAK,KAAK,cAAc,SAAS,OACnD,6BAAAA,QAAA,cAAC,oBAAAC,SAAA,EAAa,gBAAgB,kBAAkB,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,QAAQ;AAAA,EAE1F,CACF;AAEJ;AAEA,IAAO,wBAAQ;",
|
|
6
|
+
"names": ["styles", "React", "SmsLoginForm"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex: 1;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
|
|
7
|
+
:global {
|
|
8
|
+
@media (max-width: 768px) {
|
|
9
|
+
.ant-pro-form-login-container {
|
|
10
|
+
padding: 20px !important;
|
|
11
|
+
padding-inline: 0;
|
|
12
|
+
padding-block: 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ant-pro-form-login-container {
|
|
17
|
+
border: 1px solid #ececec;
|
|
18
|
+
border-radius: 12px;
|
|
19
|
+
background: #ffffff;
|
|
20
|
+
|
|
21
|
+
.ant-pro-form-login-top {
|
|
22
|
+
margin-bottom: 54px;
|
|
23
|
+
|
|
24
|
+
.ant-pro-form-login-header {
|
|
25
|
+
justify-content: flex-start;
|
|
26
|
+
height: 33px;
|
|
27
|
+
line-height: 33px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ant-pro-form-login-main {
|
|
32
|
+
width: 100% !important;
|
|
33
|
+
max-width: 500px !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (max-width: 768px) {
|
|
37
|
+
.ant-pro-form-login-main {
|
|
38
|
+
width: 100% !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ant-form-item-control-input {
|
|
42
|
+
.ant-input-affix-wrapper {
|
|
43
|
+
width: 100% !important;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ant-pro-form-login-main-other {
|
|
49
|
+
margin-top: 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.title {
|
|
56
|
+
height: 33px;
|
|
57
|
+
color: #333333;
|
|
58
|
+
font-weight: 600;
|
|
59
|
+
font-size: 24px;
|
|
60
|
+
line-height: 33px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tabs {
|
|
64
|
+
:global {
|
|
65
|
+
.ant-tabs-nav {
|
|
66
|
+
margin: 0 0 30px 0;
|
|
67
|
+
|
|
68
|
+
.ant-tabs-nav-wrap {
|
|
69
|
+
justify-content: left;
|
|
70
|
+
border-bottom: 1px solid #eeeeee;
|
|
71
|
+
|
|
72
|
+
.ant-tabs-nav-list {
|
|
73
|
+
.ant-tabs-tab {
|
|
74
|
+
padding: 0 0 15px 0;
|
|
75
|
+
|
|
76
|
+
.ant-tabs-tab-btn {
|
|
77
|
+
color: #666666;
|
|
78
|
+
font-weight: 400;
|
|
79
|
+
font-size: 18px;
|
|
80
|
+
line-height: 25px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&.ant-tabs-tab-active {
|
|
84
|
+
.ant-tabs-tab-btn {
|
|
85
|
+
color: #333333;
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.form {
|
|
97
|
+
:global {
|
|
98
|
+
width: 100%;
|
|
99
|
+
|
|
100
|
+
.ant-form-item {
|
|
101
|
+
margin-bottom: 20px;
|
|
102
|
+
|
|
103
|
+
.ant-form-item-row {
|
|
104
|
+
.ant-form-item-explain-error {
|
|
105
|
+
font-size: 12px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ant-form-item-control-input {
|
|
109
|
+
.ant-input-affix-wrapper {
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 50px;
|
|
112
|
+
background: #fcfcfc;
|
|
113
|
+
border: 1px solid #ececec;
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
|
|
116
|
+
.ant-input-prefix {
|
|
117
|
+
margin-right: 15px;
|
|
118
|
+
color: #666;
|
|
119
|
+
font-size: 20px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
input {
|
|
123
|
+
background: #fcfcfc;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ant-btn-primary {
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 50px;
|
|
133
|
+
margin-top: 37px;
|
|
134
|
+
margin-bottom: 46px;
|
|
135
|
+
padding: 0;
|
|
136
|
+
color: #ffffff;
|
|
137
|
+
font-weight: 600;
|
|
138
|
+
font-size: 18px;
|
|
139
|
+
line-height: 50px;
|
|
140
|
+
background: linear-gradient(131deg, #1d93ff 0%, #0a6bfd 100%);
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.actions {
|
|
147
|
+
color: #666666;
|
|
148
|
+
font-weight: 400;
|
|
149
|
+
font-size: 14px;
|
|
150
|
+
line-height: 25px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.qrcodeBox {
|
|
154
|
+
padding: 20px 24px;
|
|
155
|
+
border: 1px solid #ececec;
|
|
156
|
+
border-radius: 12px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.qrcode {
|
|
160
|
+
:global {
|
|
161
|
+
border: none !important;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.captchaBtn {
|
|
166
|
+
padding: 0;
|
|
167
|
+
color: #0a6bfd;
|
|
168
|
+
}
|
|
169
|
+
|
|
@@ -32,12 +32,12 @@ __export(YkPorjectSelect_exports, {
|
|
|
32
32
|
default: () => YkPorjectSelect_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(YkPorjectSelect_exports);
|
|
35
|
-
var import_TextWithToolTip = __toESM(require("../../components/TextWithToolTip"));
|
|
36
35
|
var import_icons = require("@ant-design/icons");
|
|
37
36
|
var import_antd = require("antd");
|
|
38
37
|
var import_classnames = __toESM(require("classnames"));
|
|
39
38
|
var import_react = __toESM(require("react"));
|
|
40
|
-
var
|
|
39
|
+
var import_react_custom_scrollbars_2 = require("react-custom-scrollbars-2");
|
|
40
|
+
var import_TextWithToolTip = __toESM(require("../../components/TextWithToolTip"));
|
|
41
41
|
var import_icon_product = __toESM(require("./icon-product.png"));
|
|
42
42
|
var import_index_module = __toESM(require("./index.module.less"));
|
|
43
43
|
var YkPorjectSelect = ({ value, options, onChange, followedCallback, slot, customShow }) => {
|
|
@@ -198,7 +198,7 @@ var YkPorjectSelect = ({ value, options, onChange, followedCallback, slot, custo
|
|
|
198
198
|
items: tabs
|
|
199
199
|
}
|
|
200
200
|
), localOptions.length === 0 ? /* @__PURE__ */ import_react.default.createElement(import_antd.Empty, { image: import_antd.Empty.PRESENTED_IMAGE_SIMPLE }) : /* @__PURE__ */ import_react.default.createElement("div", { className: import_index_module.default.ykPorjectSelectListSection }, /* @__PURE__ */ import_react.default.createElement("div", { className: import_index_module.default.contentHeader }, "全部项目"), /* @__PURE__ */ import_react.default.createElement(
|
|
201
|
-
|
|
201
|
+
import_react_custom_scrollbars_2.Scrollbars,
|
|
202
202
|
{
|
|
203
203
|
className: import_index_module.default.ykPorjectSelectScrollBarsBox,
|
|
204
204
|
autoHeight: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/business/YkPorjectSelect/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import TextWithTooltip from '@/components/TextWithToolTip';\nimport { SearchOutlined } from '@ant-design/icons';\nimport type { InputRef } from 'antd';\nimport { ConfigProvider, Empty, Flex, Input, Popover, Rate, Tabs, Tooltip } from 'antd';\nimport classNames from 'classnames';\nimport React, { FC, useEffect, useMemo, useRef, useState } from 'react';\nimport { Scrollbars } from 'react-custom-scrollbars';\nimport iconProductDefault from './icon-product.png';\nimport styles from './index.module.less';\n\n/** 项目选项项 */\ntype OptionItem = {\n /** 项目名称 */\n label: string;\n /** 项目 ID */\n value: string | number;\n /** 项目图标 URL */\n icon: string;\n /** 是否已关注 */\n followed?: boolean;\n /** 关注排序索引 */\n follow_index?: number;\n /** 是否最近访问 */\n recent_visit?: boolean;\n /** 是否已关服 */\n closed?: boolean;\n};\n\n/** 项目选择器 Props */\ntype PageTypes = {\n /** 当前选中的项目 ID */\n value: string | number;\n /** 项目选项列表 */\n options: OptionItem[];\n /** 选中项目变化时的回调 */\n onChange: (value: string | number) => void;\n /** 关注/取消关注时的回调 */\n followedCallback?: (item: OptionItem, bool: boolean) => void;\n /** 弹层内自定义插槽,渲染在搜索框下方、关注项目上方 */\n slot?: React.ReactNode;\n /** 自定义触发元素,替代默认的「图标+名称+下拉箭头」展示 */\n customShow?: React.ReactNode;\n};\n\n/**\n * 项目选择器\n *\n * 支持搜索、关注/取消关注(最多6个)、在营/关服切换。\n * 弹层展开时自动聚焦搜索框,使用 preventScroll 避免页面滚动。\n *\n * @example\n * ```tsx\n * <YkPorjectSelect\n * value={projectId}\n * options={options}\n * onChange={setProjectId}\n * followedCallback={(item, followed) => api.follow(item.value, followed)}\n * />\n * ```\n */\nconst YkPorjectSelect: FC<PageTypes> = ({ value, options, onChange, followedCallback, slot, customShow }) => {\n const [open, setOpen] = useState(false);\n const [status, setStatus] = useState<string>('1');\n const [searchKey, setSearchKey] = useState('');\n const [pageHeight, setPageHeight] = useState<number>(1000);\n const [localOptions, setLocalOptions] = useState<OptionItem[]>(options);\n const searchInputRef = useRef<InputRef>(null);\n\n useEffect(() => {\n setLocalOptions(options);\n }, [options]);\n\n /** 弹层展开时聚焦搜索框,使用 preventScroll 避免浏览器滚动到顶部;延迟等待 Popover 内容挂载 */\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n if (open) {\n timer = setTimeout(() => {\n searchInputRef.current?.input?.focus({ preventScroll: true });\n }, 0);\n }\n return () => {\n if (timer !== undefined) {\n clearTimeout(timer);\n }\n };\n }, [open]);\n\n /** 在营/关服数量统计 */\n const stateCount = useMemo(() => {\n return localOptions.reduce(\n (acc, item) => {\n const statusClosed = item.closed ? 2 : 1;\n if (!acc[statusClosed]) {\n acc[statusClosed] = 0;\n }\n acc[statusClosed] += 1;\n return acc;\n },\n {} as { [key: string]: number },\n );\n }, [localOptions]);\n\n /** 在营/关服 Tab 配置 */\n const tabs = [\n { key: '1', label: `在营(${stateCount['1'] || 0})` },\n { key: '2', label: `关服(${stateCount['2'] || 0})` },\n ];\n\n /** 当前选中的项目(用于展示图标与名称) */\n const activeItem = useMemo(() => {\n return localOptions.find((item) => item.value === value);\n }, [localOptions, value]);\n\n /** 已关注的项目列表(顶部展示、用于计算关注数限制) */\n const followedOptions = useMemo(() => {\n return localOptions.filter((item) => item.followed);\n }, [localOptions]);\n\n // 切换在营/关服\n const handleTabChange = (tabKey: string) => {\n setStatus(tabKey);\n };\n\n // 点击关注或取消关注\n const handleStarChange = async (item: OptionItem, val: number) => {\n void followedCallback?.(item, val === 1);\n setLocalOptions((prev) =>\n prev.map((p) => {\n if (p.value === item.value) {\n return { ...p, followed: val === 1 };\n }\n return p;\n }),\n );\n };\n\n const handleResize = () => {\n const height = window.innerHeight;\n setPageHeight(height);\n };\n\n useEffect(() => {\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n /** 渲染单个项目行(名称、ID、关注星标) */\n const renderItem = (item: OptionItem) => {\n const isDisabled = !item.followed && followedOptions.length >= 6;\n return (\n <Flex justify='space-between' align='center'>\n <span className={styles.contentItemSpan} onClick={() => onChange(item.value)}>\n <img className={styles.contentItemSpanIcon} src={item?.icon ? item.icon : iconProductDefault} />\n <div className={styles.contentItemSpanDev}>\n <div className={styles.contentItemSpanProName}>\n <TextWithTooltip\n text={item.label}\n width='100%'\n maxWidth={175}\n arrow={true}\n color='#fff'\n styles={{ body: { color: '#333' } }}\n ></TextWithTooltip>\n {item.recent_visit ? <span className={styles.recentVisit}>最近访问</span> : null}\n </div>\n <div className={styles.contentItemSpanProId}>ID: {item.value}</div>\n </div>\n </span>\n <Tooltip\n title={isDisabled ? '最多关注6个项目' : item.followed ? '取消关注' : '关注'}\n color='#fff'\n placement='right'\n styles={{ body: { color: '#333' } }}\n >\n <label\n className={classNames(styles.contentItemStar, isDisabled && styles.contentItemStarDisabled)}\n onClick={() => {\n if (isDisabled) {\n return;\n }\n void handleStarChange(item, item.followed ? 0 : 1);\n }}\n >\n <ConfigProvider\n theme={{\n components: {\n Rate: {\n starBg: '#dcdbdb',\n },\n },\n }}\n >\n <Rate\n style={{\n fontSize: 14,\n color: isDisabled ? 'rgba(0, 0, 0, 0.06)' : '#FFB401',\n opacity: item.followed || followedOptions.length === 0 ? 1 : 0,\n }}\n value={item.followed ? 1 : 0}\n count={1}\n />\n </ConfigProvider>\n </label>\n </Tooltip>\n </Flex>\n );\n };\n\n /** 弹层内容:搜索、slot、关注区、Tab、项目列表 */\n const content = (\n <div className={styles.ykPorjectSelectContent}>\n <div className={styles.ykPorjectSelectHeader}>\n <Input\n ref={searchInputRef}\n className={styles.ykPorjectSelectSearchInput}\n prefix={<SearchOutlined style={{ color: '#999', marginRight: '10px' }} />}\n value={searchKey}\n onChange={(e) => setSearchKey(e.target.value)}\n allowClear\n placeholder='请输入项目ID/名称'\n />\n </div>\n {slot && <div className={styles.ykPorjectSelectSoltContainer}>{slot}</div>}\n <div className={styles.ykPorjectSelectFollowed}>\n <div className={styles.contentHeader}>关注项目</div>\n <div className={styles.ykPorjectSelectFollowedList}>\n {followedOptions.map((item) => (\n <Tooltip\n key={item.value}\n title={\n <>\n <div style={{ fontSize: 14, color: '#555555' }}>{item.label}</div>\n <div style={{ fontSize: 12, color: '#999' }}>ID: {item.value}</div>\n </>\n }\n color='#fff'\n placement='bottomLeft'\n styles={{ body: { color: '#333' } }}\n >\n <div key={item.value} className={styles.ykPorjectSelectFollowedItem}>\n <img className={styles.ykPorjectSelectFollowedItemIcon} src={item.icon} alt={item.label} />\n <div className={styles.closeIcon} onClick={() => void handleStarChange(item, 0)} />\n </div>\n </Tooltip>\n ))}\n </div>\n </div>\n <Tabs\n className={styles.ykPorjectSelectProductPanelTabs}\n centered\n onChange={handleTabChange}\n activeKey={status}\n items={tabs}\n ></Tabs>\n {localOptions.length === 0 ? (\n <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />\n ) : (\n <div className={styles.ykPorjectSelectListSection}>\n <div className={styles.contentHeader}>全部项目</div>\n <Scrollbars\n className={styles.ykPorjectSelectScrollBarsBox}\n autoHeight\n autoHide\n autoHeightMax={Math.min(450, pageHeight - 310)}\n renderThumbVertical={({ style, ...props }) => (\n <div {...props} style={{ ...style, background: '#EEEEEE', borderRadius: 3, width: 6 }} />\n )}\n >\n {localOptions\n .sort((a, b) => (b.recent_visit ? 1 : 0) - (a.recent_visit ? 1 : 0))\n .map((item) => (\n <div\n key={item.value}\n className={classNames(styles.contentItem, item.value === value ? styles.contentItemActive : '')}\n >\n {renderItem(item)}\n </div>\n ))}\n </Scrollbars>\n </div>\n )}\n </div>\n );\n\n return (\n <Popover\n className={styles.ykPorjectSelect}\n styles={{ body: { borderRadius: 4, padding: 0 } }}\n content={content}\n placement='bottom'\n trigger='click'\n open={open}\n onOpenChange={setOpen}\n getPopupContainer={(triggerNode: HTMLElement) => triggerNode.parentNode as HTMLElement}\n autoAdjustOverflow={false}\n >\n {customShow ? (\n customShow\n ) : (\n <div className={styles.ykPorjectSelectShow}>\n <img className={styles.ykPorjectSelectShowIcon} src={activeItem?.icon} alt={activeItem?.label} />\n <span className={styles.ykPorjectSelectShowText}>{activeItem?.label}</span>\n <i className='iconfont icon-xiala' />\n </div>\n )}\n </Popover>\n );\n};\n\nexport default YkPorjectSelect;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { SearchOutlined } from '@ant-design/icons';\nimport type { InputRef } from 'antd';\nimport { ConfigProvider, Empty, Flex, Input, Popover, Rate, Tabs, Tooltip } from 'antd';\nimport classNames from 'classnames';\nimport React, { type FC, useEffect, useMemo, useRef, useState } from 'react';\nimport { Scrollbars } from 'react-custom-scrollbars-2';\nimport TextWithTooltip from '@/components/TextWithToolTip';\nimport iconProductDefault from './icon-product.png';\nimport styles from './index.module.less';\n\n/** 项目选项项 */\ntype OptionItem = {\n /** 项目名称 */\n label: string;\n /** 项目 ID */\n value: string | number;\n /** 项目图标 URL */\n icon: string;\n /** 是否已关注 */\n followed?: boolean;\n /** 关注排序索引 */\n follow_index?: number;\n /** 是否最近访问 */\n recent_visit?: boolean;\n /** 是否已关服 */\n closed?: boolean;\n};\n\n/** 项目选择器 Props */\ntype PageTypes = {\n /** 当前选中的项目 ID */\n value: string | number;\n /** 项目选项列表 */\n options: OptionItem[];\n /** 选中项目变化时的回调 */\n onChange: (value: string | number) => void;\n /** 关注/取消关注时的回调 */\n followedCallback?: (item: OptionItem, bool: boolean) => void;\n /** 弹层内自定义插槽,渲染在搜索框下方、关注项目上方 */\n slot?: React.ReactNode;\n /** 自定义触发元素,替代默认的「图标+名称+下拉箭头」展示 */\n customShow?: React.ReactNode;\n};\n\n/**\n * 项目选择器\n *\n * 支持搜索、关注/取消关注(最多6个)、在营/关服切换。\n * 弹层展开时自动聚焦搜索框,使用 preventScroll 避免页面滚动。\n *\n * @example\n * ```tsx\n * <YkPorjectSelect\n * value={projectId}\n * options={options}\n * onChange={setProjectId}\n * followedCallback={(item, followed) => api.follow(item.value, followed)}\n * />\n * ```\n */\nconst YkPorjectSelect: FC<PageTypes> = ({ value, options, onChange, followedCallback, slot, customShow }) => {\n const [open, setOpen] = useState(false);\n const [status, setStatus] = useState<string>('1');\n const [searchKey, setSearchKey] = useState('');\n const [pageHeight, setPageHeight] = useState<number>(1000);\n const [localOptions, setLocalOptions] = useState<OptionItem[]>(options);\n const searchInputRef = useRef<InputRef>(null);\n\n useEffect(() => {\n setLocalOptions(options);\n }, [options]);\n\n /** 弹层展开时聚焦搜索框,使用 preventScroll 避免浏览器滚动到顶部;延迟等待 Popover 内容挂载 */\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n if (open) {\n timer = setTimeout(() => {\n searchInputRef.current?.input?.focus({ preventScroll: true });\n }, 0);\n }\n return () => {\n if (timer !== undefined) {\n clearTimeout(timer);\n }\n };\n }, [open]);\n\n /** 在营/关服数量统计 */\n const stateCount = useMemo(() => {\n return localOptions.reduce(\n (acc, item) => {\n const statusClosed = item.closed ? 2 : 1;\n if (!acc[statusClosed]) {\n acc[statusClosed] = 0;\n }\n acc[statusClosed] += 1;\n return acc;\n },\n {} as { [key: string]: number },\n );\n }, [localOptions]);\n\n /** 在营/关服 Tab 配置 */\n const tabs = [\n { key: '1', label: `在营(${stateCount['1'] || 0})` },\n { key: '2', label: `关服(${stateCount['2'] || 0})` },\n ];\n\n /** 当前选中的项目(用于展示图标与名称) */\n const activeItem = useMemo(() => {\n return localOptions.find((item) => item.value === value);\n }, [localOptions, value]);\n\n /** 已关注的项目列表(顶部展示、用于计算关注数限制) */\n const followedOptions = useMemo(() => {\n return localOptions.filter((item) => item.followed);\n }, [localOptions]);\n\n // 切换在营/关服\n const handleTabChange = (tabKey: string) => {\n setStatus(tabKey);\n };\n\n // 点击关注或取消关注\n const handleStarChange = async (item: OptionItem, val: number) => {\n void followedCallback?.(item, val === 1);\n setLocalOptions((prev) =>\n prev.map((p) => {\n if (p.value === item.value) {\n return { ...p, followed: val === 1 };\n }\n return p;\n }),\n );\n };\n\n const handleResize = () => {\n const height = window.innerHeight;\n setPageHeight(height);\n };\n\n useEffect(() => {\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n /** 渲染单个项目行(名称、ID、关注星标) */\n const renderItem = (item: OptionItem) => {\n const isDisabled = !item.followed && followedOptions.length >= 6;\n return (\n <Flex justify='space-between' align='center'>\n <span className={styles.contentItemSpan} onClick={() => onChange(item.value)}>\n <img className={styles.contentItemSpanIcon} src={item?.icon ? item.icon : iconProductDefault} />\n <div className={styles.contentItemSpanDev}>\n <div className={styles.contentItemSpanProName}>\n <TextWithTooltip\n text={item.label}\n width='100%'\n maxWidth={175}\n arrow={true}\n color='#fff'\n styles={{ body: { color: '#333' } }}\n ></TextWithTooltip>\n {item.recent_visit ? <span className={styles.recentVisit}>最近访问</span> : null}\n </div>\n <div className={styles.contentItemSpanProId}>ID: {item.value}</div>\n </div>\n </span>\n <Tooltip\n title={isDisabled ? '最多关注6个项目' : item.followed ? '取消关注' : '关注'}\n color='#fff'\n placement='right'\n styles={{ body: { color: '#333' } }}\n >\n <label\n className={classNames(styles.contentItemStar, isDisabled && styles.contentItemStarDisabled)}\n onClick={() => {\n if (isDisabled) {\n return;\n }\n void handleStarChange(item, item.followed ? 0 : 1);\n }}\n >\n <ConfigProvider\n theme={{\n components: {\n Rate: {\n starBg: '#dcdbdb',\n },\n },\n }}\n >\n <Rate\n style={{\n fontSize: 14,\n color: isDisabled ? 'rgba(0, 0, 0, 0.06)' : '#FFB401',\n opacity: item.followed || followedOptions.length === 0 ? 1 : 0,\n }}\n value={item.followed ? 1 : 0}\n count={1}\n />\n </ConfigProvider>\n </label>\n </Tooltip>\n </Flex>\n );\n };\n\n /** 弹层内容:搜索、slot、关注区、Tab、项目列表 */\n const content = (\n <div className={styles.ykPorjectSelectContent}>\n <div className={styles.ykPorjectSelectHeader}>\n <Input\n ref={searchInputRef}\n className={styles.ykPorjectSelectSearchInput}\n prefix={<SearchOutlined style={{ color: '#999', marginRight: '10px' }} />}\n value={searchKey}\n onChange={(e) => setSearchKey(e.target.value)}\n allowClear\n placeholder='请输入项目ID/名称'\n />\n </div>\n {slot && <div className={styles.ykPorjectSelectSoltContainer}>{slot}</div>}\n <div className={styles.ykPorjectSelectFollowed}>\n <div className={styles.contentHeader}>关注项目</div>\n <div className={styles.ykPorjectSelectFollowedList}>\n {followedOptions.map((item) => (\n <Tooltip\n key={item.value}\n title={\n <>\n <div style={{ fontSize: 14, color: '#555555' }}>{item.label}</div>\n <div style={{ fontSize: 12, color: '#999' }}>ID: {item.value}</div>\n </>\n }\n color='#fff'\n placement='bottomLeft'\n styles={{ body: { color: '#333' } }}\n >\n <div key={item.value} className={styles.ykPorjectSelectFollowedItem}>\n <img className={styles.ykPorjectSelectFollowedItemIcon} src={item.icon} alt={item.label} />\n <div className={styles.closeIcon} onClick={() => void handleStarChange(item, 0)} />\n </div>\n </Tooltip>\n ))}\n </div>\n </div>\n <Tabs\n className={styles.ykPorjectSelectProductPanelTabs}\n centered\n onChange={handleTabChange}\n activeKey={status}\n items={tabs}\n ></Tabs>\n {localOptions.length === 0 ? (\n <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />\n ) : (\n <div className={styles.ykPorjectSelectListSection}>\n <div className={styles.contentHeader}>全部项目</div>\n <Scrollbars\n className={styles.ykPorjectSelectScrollBarsBox}\n autoHeight\n autoHide\n autoHeightMax={Math.min(450, pageHeight - 310)}\n renderThumbVertical={({ style, ...props }) => (\n <div {...props} style={{ ...style, background: '#EEEEEE', borderRadius: 3, width: 6 }} />\n )}\n >\n {localOptions\n .sort((a, b) => (b.recent_visit ? 1 : 0) - (a.recent_visit ? 1 : 0))\n .map((item) => (\n <div\n key={item.value}\n className={classNames(styles.contentItem, item.value === value ? styles.contentItemActive : '')}\n >\n {renderItem(item)}\n </div>\n ))}\n </Scrollbars>\n </div>\n )}\n </div>\n );\n\n return (\n <Popover\n className={styles.ykPorjectSelect}\n styles={{ body: { borderRadius: 4, padding: 0 } }}\n content={content}\n placement='bottom'\n trigger='click'\n open={open}\n onOpenChange={setOpen}\n getPopupContainer={(triggerNode: HTMLElement) => triggerNode.parentNode as HTMLElement}\n autoAdjustOverflow={false}\n >\n {customShow ? (\n customShow\n ) : (\n <div className={styles.ykPorjectSelectShow}>\n <img className={styles.ykPorjectSelectShowIcon} src={activeItem?.icon} alt={activeItem?.label} />\n <span className={styles.ykPorjectSelectShowText}>{activeItem?.label}</span>\n <i className='iconfont icon-xiala' />\n </div>\n )}\n </Popover>\n );\n};\n\nexport default YkPorjectSelect;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAE/B,kBAAiF;AACjF,wBAAuB;AACvB,mBAAqE;AACrE,uCAA2B;AAC3B,6BAA4B;AAC5B,0BAA+B;AAC/B,0BAAmB;AAoDnB,IAAM,kBAAiC,CAAC,EAAE,OAAO,SAAS,UAAU,kBAAkB,MAAM,WAAW,MAAM;AAC3G,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,KAAK;AACtC,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAiB,GAAG;AAChD,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,EAAE;AAC7C,QAAM,CAAC,YAAY,aAAa,QA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