@voplus/morpho-csp 11.2.8 → 11.3.0-dev.0
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/es/components/LegalContactSelect/index.d.ts +7 -0
- package/es/components/LegalContactSelect/index.js +127 -12
- package/es/components/LegalContactSelect/index.js.map +1 -1
- package/es/data/clda-form/conversion.d.ts +9 -6
- package/es/data/clda-form/conversion.js +11 -18
- package/es/data/clda-form/conversion.js.map +1 -1
- package/es/data/clda-form/identityAdapter.d.ts +60 -0
- package/es/data/clda-form/identityAdapter.js +196 -0
- package/es/data/clda-form/identityAdapter.js.map +1 -0
- package/es/data/clda-form/interfaces.d.ts +20 -1
- package/es/data/clda-form/saveFormDraft.d.ts +4 -0
- package/es/data/clda-form/saveFormDraft.js +21 -0
- package/es/data/clda-form/saveFormDraft.js.map +1 -0
- package/es/data/clda-form/types.d.ts +31 -2
- package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/IdentityShapeFields.d.ts +35 -0
- package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/IdentityShapeFields.js +53 -0
- package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/IdentityShapeFields.js.map +1 -0
- package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/index.js +41 -15
- package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/index.js.map +1 -1
- package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/state.d.ts +59 -1
- package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/state.js +244 -15
- package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/state.js.map +1 -1
- package/es/modules/corporate/company/components/CorporateOfficerSelect/index.d.ts +5 -0
- package/es/modules/corporate/company/components/CorporateOfficerSelect/index.js +13 -7
- package/es/modules/corporate/company/components/CorporateOfficerSelect/index.js.map +1 -1
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step3.d.ts +2 -2
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step3.js +20 -24
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step3.js.map +1 -1
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step4.d.ts +2 -2
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step4.js +38 -11
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step4.js.map +1 -1
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/index.d.ts +3 -3
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/index.js.map +1 -1
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/state.d.ts +25 -4
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/state.js +88 -5
- package/es/modules/corporate/company/identity/components/NewLegalContactDialog/state.js.map +1 -1
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/DialogShell.d.ts +13 -0
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/DialogShell.js +20 -0
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/DialogShell.js.map +1 -0
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page1.js +28 -28
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page1.js.map +1 -1
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page2.js +3 -4
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page2.js.map +1 -1
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page3.js +16 -9
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page3.js.map +1 -1
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page4.d.ts +2 -2
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page4.js +128 -61
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page4.js.map +1 -1
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page5.d.ts +2 -2
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page5.js +119 -24
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page5.js.map +1 -1
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/index.d.ts +0 -1
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/index.js +16 -8
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/index.js.map +1 -1
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/state.d.ts +274 -23
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/state.js +560 -210
- package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/state.js.map +1 -1
- package/es/modules/corporate/components/CorporateSelect/index.d.ts +12 -1
- package/es/modules/corporate/components/CorporateSelect/index.js +19 -5
- package/es/modules/corporate/components/CorporateSelect/index.js.map +1 -1
- package/es/modules/corporate/filing-record/filing-type/components/FilingTypeReminderScheduleList/index.js +9 -6
- package/es/modules/corporate/filing-record/filing-type/components/FilingTypeReminderScheduleList/index.js.map +1 -1
- package/es/modules/corporate/legal-generation/components/AppointOfficer/index.d.ts +6 -1
- package/es/modules/corporate/legal-generation/components/AppointOfficer/index.js +3 -2
- package/es/modules/corporate/legal-generation/components/AppointOfficer/index.js.map +1 -1
- package/es/modules/corporate/legal-generation/components/CorporateRepresentative/index.d.ts +6 -1
- package/es/modules/corporate/legal-generation/components/CorporateRepresentative/index.js +3 -2
- package/es/modules/corporate/legal-generation/components/CorporateRepresentative/index.js.map +1 -1
- package/es/modules/corporate/legal-generation/components/IssueShares/Fields.js +3 -3
- package/es/modules/corporate/legal-generation/components/IssueShares/Fields.js.map +1 -1
- package/es/modules/corporate/legal-generation/components/IssueShares/interface.d.ts +1 -1
- package/es/modules/corporate/legal-generation/components/PowerOfAttroney/Fields.d.ts +16 -1
- package/es/modules/corporate/legal-generation/components/PowerOfAttroney/Fields.js +27 -9
- package/es/modules/corporate/legal-generation/components/PowerOfAttroney/Fields.js.map +1 -1
- package/es/modules/corporate/legal-generation/components/PowerOfAttroney/interface.d.ts +5 -2
- package/es/modules/corporate/legal-generation/components/ResignationLetter/Fields.js +1 -1
- package/es/modules/corporate/legal-generation/components/ResignationLetter/Fields.js.map +1 -1
- package/es/modules/corporate/legal-generation/components/ShareTransfer/Fields.d.ts +13 -1
- package/es/modules/corporate/legal-generation/components/ShareTransfer/Fields.js +24 -6
- package/es/modules/corporate/legal-generation/components/ShareTransfer/Fields.js.map +1 -1
- package/es/modules/corporate/legal-generation/components/ShareTransfer/interface.d.ts +5 -2
- package/es/modules/corporate/legal-generation/components/SubmitButton/index.d.ts +11 -3
- package/es/modules/corporate/legal-generation/components/SubmitButton/index.js +9 -3
- package/es/modules/corporate/legal-generation/components/SubmitButton/index.js.map +1 -1
- package/es/modules/corporate/legal-generation/fields/AppointOfficerFields.d.ts +31 -2
- package/es/modules/corporate/legal-generation/fields/AppointOfficerFields.js +52 -37
- package/es/modules/corporate/legal-generation/fields/AppointOfficerFields.js.map +1 -1
- package/es/modules/corporate/legal-generation/fields/CorporateRepresentativeFields.d.ts +27 -2
- package/es/modules/corporate/legal-generation/fields/CorporateRepresentativeFields.js +78 -21
- package/es/modules/corporate/legal-generation/fields/CorporateRepresentativeFields.js.map +1 -1
- package/es/modules/corporate/legal-generation/fields/ParentCompanyDetailsFields.d.ts +17 -0
- package/es/modules/corporate/legal-generation/fields/ParentCompanyDetailsFields.js +36 -0
- package/es/modules/corporate/legal-generation/fields/ParentCompanyDetailsFields.js.map +1 -0
- package/es/modules/corporate/legal-generation/fields/renderCapturedIdentityColumn.d.ts +11 -0
- package/es/modules/corporate/legal-generation/fields/renderCapturedIdentityColumn.js +25 -0
- package/es/modules/corporate/legal-generation/fields/renderCapturedIdentityColumn.js.map +1 -0
- package/es/modules/corporate/legal-generation/fields/state/index.d.ts +7 -0
- package/es/modules/corporate/legal-generation/fields/state/index.js +5 -0
- package/es/modules/corporate/legal-generation/fields/state/index.js.map +1 -0
- package/es/modules/corporate/legal-generation/fields/state/types.d.ts +37 -0
- package/es/modules/corporate/legal-generation/fields/state/types.js +27 -0
- package/es/modules/corporate/legal-generation/fields/state/types.js.map +1 -0
- package/es/modules/corporate/legal-generation/fields/state/useCapturedIdentityField.d.ts +28 -0
- package/es/modules/corporate/legal-generation/fields/state/useCapturedIdentityField.js +45 -0
- package/es/modules/corporate/legal-generation/fields/state/useCapturedIdentityField.js.map +1 -0
- package/es/modules/corporate/legal-generation/fields/state/useIdentityShapeCapture.d.ts +31 -0
- package/es/modules/corporate/legal-generation/fields/state/useIdentityShapeCapture.js +47 -0
- package/es/modules/corporate/legal-generation/fields/state/useIdentityShapeCapture.js.map +1 -0
- package/es/modules/corporate/legal-generation/fields/state/useLegalGenerationIdentityCapture.d.ts +35 -0
- package/es/modules/corporate/legal-generation/fields/state/useLegalGenerationIdentityCapture.js +36 -0
- package/es/modules/corporate/legal-generation/fields/state/useLegalGenerationIdentityCapture.js.map +1 -0
- package/es/modules/corporate/legal-generation/fields/state/useOperateField.d.ts +15 -0
- package/es/modules/corporate/legal-generation/fields/state/useOperateField.js +27 -0
- package/es/modules/corporate/legal-generation/fields/state/useOperateField.js.map +1 -0
- package/es/modules/corporate/legal-generation/form/AppointOfficerForm.d.ts +18 -9
- package/es/modules/corporate/legal-generation/form/AppointOfficerForm.js +130 -28
- package/es/modules/corporate/legal-generation/form/AppointOfficerForm.js.map +1 -1
- package/es/modules/corporate/legal-generation/form/CorporateRepresentativeForm.d.ts +27 -17
- package/es/modules/corporate/legal-generation/form/CorporateRepresentativeForm.js +112 -24
- package/es/modules/corporate/legal-generation/form/CorporateRepresentativeForm.js.map +1 -1
- package/es/modules/corporate/legal-generation/form/legalGenerationSubmit.d.ts +637 -0
- package/es/modules/corporate/legal-generation/form/legalGenerationSubmit.js +840 -0
- package/es/modules/corporate/legal-generation/form/legalGenerationSubmit.js.map +1 -0
- package/es/modules/corporate/legal-generation/form/useLegalGenerationDocument.d.ts +23 -0
- package/es/modules/corporate/legal-generation/form/useLegalGenerationDocument.js +55 -0
- package/es/modules/corporate/legal-generation/form/useLegalGenerationDocument.js.map +1 -0
- package/es/modules/corporate/legal-generation/pages/CorporateLegalGeneration/index.js +38 -8
- package/es/modules/corporate/legal-generation/pages/CorporateLegalGeneration/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/components/CLDAContactList/index.js +50 -33
- package/es/modules/self-registration/clda-form/components/CLDAContactList/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/components/ContactFields/index.d.ts +5 -2
- package/es/modules/self-registration/clda-form/components/ContactFields/index.js +6 -3
- package/es/modules/self-registration/clda-form/components/ContactFields/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/components/DataProtectionOfficer/NewDPODialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/components/DataProtectionOfficer/NewDPODialog/index.js +7 -18
- package/es/modules/self-registration/clda-form/components/DataProtectionOfficer/NewDPODialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/components/NewDirectorDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/components/NewDirectorDialog/index.js +7 -18
- package/es/modules/self-registration/clda-form/components/NewDirectorDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/components/NewSecretaryDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/components/NewSecretaryDialog/index.js +7 -18
- package/es/modules/self-registration/clda-form/components/NewSecretaryDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/components/NewShareholderDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/components/NewShareholderDialog/index.js +7 -18
- package/es/modules/self-registration/clda-form/components/NewShareholderDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/components/useContactEditSession.d.ts +35 -0
- package/es/modules/self-registration/clda-form/components/useContactEditSession.js +51 -0
- package/es/modules/self-registration/clda-form/components/useContactEditSession.js.map +1 -0
- package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailItem/index.d.ts +2 -3
- package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailItem/index.js +60 -12
- package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailItem/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailList/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailList/index.js +3 -5
- package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailList/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/appoint-representative/index.js +7 -21
- package/es/modules/self-registration/clda-form/incorporation/appoint-representative/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/CompanyGeneralForm.js +6 -5
- package/es/modules/self-registration/clda-form/incorporation/company-general/CompanyGeneralForm.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddAllotmentDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddAllotmentDialog/index.js +23 -28
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddAllotmentDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddBankOpeningDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddBankOpeningDialog/index.js +11 -24
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddBankOpeningDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddDivideDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddDivideDialog/index.js +13 -8
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddDivideDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddOfficerDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddOfficerDialog/index.js +11 -24
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddOfficerDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRedonminationDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRedonminationDialog/index.js +18 -9
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRedonminationDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRemoveOfficerDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRemoveOfficerDialog/index.js +11 -24
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRemoveOfficerDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddTransferDialog/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddTransferDialog/index.js +23 -28
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddTransferDialog/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentItem/index.d.ts +2 -3
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentItem/index.js +81 -14
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentItem/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentList/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentList/index.js +11 -15
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentList/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningContactItem/index.d.ts +2 -3
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningContactItem/index.js +34 -5
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningContactItem/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningList/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningList/index.js +4 -5
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningList/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/CapitalReceiptSelect/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/CapitalReceiptSelect/index.js +5 -4
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/CapitalReceiptSelect/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/OfficerDetailItem/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/OfficerDetailItem/index.js +32 -12
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/OfficerDetailItem/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferItem/index.d.ts +2 -3
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferItem/index.js +80 -13
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferItem/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferList/index.d.ts +1 -2
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferList/index.js +7 -9
- package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferList/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/incorporation/components/FormContactEditor/index.d.ts +3 -0
- package/es/modules/self-registration/clda-form/incorporation/components/FormContactEditor/index.js +4 -2
- package/es/modules/self-registration/clda-form/incorporation/components/FormContactEditor/index.js.map +1 -1
- package/es/modules/self-registration/clda-form/pages/CLDAFormDefaultView/Content.js +16 -1
- package/es/modules/self-registration/clda-form/pages/CLDAFormDefaultView/Content.js.map +1 -1
- package/es/routes.d.ts +1 -1
- package/es/routes.js +4 -2
- package/es/routes.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { IIdentity } from "../../data/identity";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const LegalContactSelect: (props: {
|
|
4
|
+
/** Company whose member/officer owners are eligible representatives. */
|
|
5
|
+
companyId?: string;
|
|
6
|
+
/** Form-controlled restored legal identity, independent of its owner id. */
|
|
7
|
+
value?: {
|
|
8
|
+
id: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
};
|
|
4
11
|
onChange?: (contact?: IIdentity) => void;
|
|
5
12
|
}) => React.JSX.Element;
|
|
6
13
|
export default LegalContactSelect;
|
|
@@ -1,28 +1,143 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useState } from "react";
|
|
3
|
-
import { Select } from "antd";
|
|
1
|
+
import { useIdentityStore } from "../../data/identity";
|
|
2
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { Button, Select } from "antd";
|
|
4
4
|
import { State } from "./state";
|
|
5
5
|
import { observe } from "@voplus/morpho-ui";
|
|
6
6
|
import { runInAction } from "mobx";
|
|
7
|
+
import { useMemberStore } from "../../data/member";
|
|
8
|
+
import { useOfficerStore } from "../../data/officer";
|
|
9
|
+
/** Explicit paging prevents the standard list endpoint's 50-row default from hiding eligible data. */
|
|
10
|
+
const PAGE_SIZE = 50;
|
|
11
|
+
/** Loads every page from a standard list endpoint without requesting its counted envelope. */
|
|
12
|
+
async function loadEveryPage(load, filters) {
|
|
13
|
+
const items = [];
|
|
14
|
+
for (let page = 1;; page += 1) {
|
|
15
|
+
const next = await load({
|
|
16
|
+
Filters: filters,
|
|
17
|
+
List: true,
|
|
18
|
+
Total: false,
|
|
19
|
+
Page: { Page: page, PageSize: PAGE_SIZE },
|
|
20
|
+
});
|
|
21
|
+
items.push(...next);
|
|
22
|
+
if (next.length < PAGE_SIZE)
|
|
23
|
+
return items;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Builds a stable readable label from members actually emitted by the IdentityModel wire. */
|
|
27
|
+
function identityLabel(identity) {
|
|
28
|
+
const parts = [identity.fullName, identity.number, identity.shape?.name]
|
|
29
|
+
.map((part) => part?.trim())
|
|
30
|
+
.filter((part) => !!part);
|
|
31
|
+
return parts.length ? parts.join(" · ") : identity.id;
|
|
32
|
+
}
|
|
7
33
|
const LegalContactSelect = (props) => {
|
|
8
34
|
const [state] = useState(new State());
|
|
9
|
-
|
|
35
|
+
const [requestState, setRequestState] = useState(props.companyId ? "loading" : "idle");
|
|
36
|
+
const [retryVersion, setRetryVersion] = useState(0);
|
|
37
|
+
const previousCompanyId = useRef(props.companyId);
|
|
38
|
+
const selectionCompanyId = useRef(props.value?.id ? props.companyId : undefined);
|
|
39
|
+
const onChange = useRef(props.onChange);
|
|
40
|
+
const value = useRef(props.value);
|
|
41
|
+
onChange.current = props.onChange;
|
|
42
|
+
value.current = props.value;
|
|
43
|
+
const memberStore = useMemberStore();
|
|
44
|
+
const officerStore = useOfficerStore();
|
|
45
|
+
const identityStore = useIdentityStore();
|
|
46
|
+
// spec:1929 — CSP: 需要指定人员的表单提供“选择已有”与“手动录入”两种单选模式
|
|
47
|
+
// spec:1930 — CSP: 使用“Select existing”模式时,表单发送所选实体的 id;手动模式发送用户键入的字段
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
let current = true;
|
|
50
|
+
const companyChanged = previousCompanyId.current !== props.companyId;
|
|
51
|
+
const restoringInitialCompany = previousCompanyId.current === undefined &&
|
|
52
|
+
props.companyId !== undefined &&
|
|
53
|
+
selectionCompanyId.current === undefined &&
|
|
54
|
+
!!value.current?.id;
|
|
55
|
+
previousCompanyId.current = props.companyId;
|
|
56
|
+
if (restoringInitialCompany) {
|
|
57
|
+
selectionCompanyId.current = props.companyId;
|
|
58
|
+
}
|
|
59
|
+
else if (companyChanged) {
|
|
60
|
+
selectionCompanyId.current = undefined;
|
|
61
|
+
if (value.current?.id)
|
|
62
|
+
onChange.current?.(undefined);
|
|
63
|
+
}
|
|
10
64
|
runInAction(() => {
|
|
11
|
-
state.contactList =
|
|
12
|
-
|
|
65
|
+
state.contactList = [];
|
|
66
|
+
if (companyChanged)
|
|
67
|
+
state.identityId = "";
|
|
13
68
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
|
|
69
|
+
setRequestState(props.companyId ? "loading" : "idle");
|
|
70
|
+
if (!props.companyId)
|
|
71
|
+
return () => void (current = false);
|
|
72
|
+
const corporateFilter = [
|
|
73
|
+
{ c: "CorporateId", o: "=", l: "And", v1: props.companyId },
|
|
74
|
+
];
|
|
75
|
+
void (async () => {
|
|
76
|
+
try {
|
|
77
|
+
const [members, officers] = await Promise.all([
|
|
78
|
+
loadEveryPage(memberStore.loadList.bind(memberStore), corporateFilter),
|
|
79
|
+
loadEveryPage(officerStore.loadList.bind(officerStore), corporateFilter),
|
|
80
|
+
]);
|
|
81
|
+
const ownerIds = new Set();
|
|
82
|
+
members.forEach((member) => member.contact?.id && ownerIds.add(member.contact.id));
|
|
83
|
+
officers.forEach((officer) => officer.appointment && officer.contact?.id && ownerIds.add(officer.contact.id));
|
|
84
|
+
const pages = await Promise.all([...ownerIds].map((ownerId) => loadEveryPage(identityStore.loadList.bind(identityStore), [
|
|
85
|
+
{ c: "UnitId", o: "=", l: "And", v1: ownerId },
|
|
86
|
+
])));
|
|
87
|
+
if (!current)
|
|
88
|
+
return;
|
|
89
|
+
const unique = new Map();
|
|
90
|
+
pages.flat().forEach((identity) => unique.set(identity.id, identity));
|
|
91
|
+
runInAction(() => {
|
|
92
|
+
state.contactList = [...unique.values()];
|
|
93
|
+
});
|
|
94
|
+
setRequestState("idle");
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
if (current) {
|
|
98
|
+
runInAction(() => (state.contactList = []));
|
|
99
|
+
setRequestState("error");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
})();
|
|
103
|
+
return () => void (current = false);
|
|
104
|
+
}, [identityStore, memberStore, officerStore, props.companyId, retryVersion, state]);
|
|
105
|
+
const selectionBelongsToCompany = selectionCompanyId.current === props.companyId;
|
|
106
|
+
return observe(() => (React.createElement(React.Fragment, null,
|
|
107
|
+
React.createElement(Select, { value: selectionBelongsToCompany ? props.value?.id ?? state.identityId : "", loading: requestState === "loading", disabled: !props.companyId, status: requestState === "error" ? "error" : undefined, showSearch: { filterOption: filterItems }, optionLabelProp: "title", onSelect: onSelect, style: { width: "100%" }, options: [
|
|
108
|
+
...(selectionBelongsToCompany &&
|
|
109
|
+
props.value?.id &&
|
|
110
|
+
!state.contactList.some((identity) => identity.id === props.value?.id)
|
|
111
|
+
? [
|
|
112
|
+
{
|
|
113
|
+
value: props.value.id,
|
|
114
|
+
label: props.value.name ?? props.value.id,
|
|
115
|
+
title: props.value.name ?? props.value.id,
|
|
116
|
+
},
|
|
117
|
+
]
|
|
118
|
+
: []),
|
|
119
|
+
...state.contactList.map((i) => {
|
|
120
|
+
const label = identityLabel(i);
|
|
121
|
+
return { value: i.id, label, title: label };
|
|
122
|
+
}),
|
|
123
|
+
] }),
|
|
124
|
+
requestState === "error" && (React.createElement("div", { role: "alert" },
|
|
125
|
+
"Unable to load company contacts.",
|
|
126
|
+
" ",
|
|
127
|
+
React.createElement(Button, { onClick: () => setRetryVersion((v) => v + 1) }, "Retry"))))));
|
|
128
|
+
/** Matches only readable option metadata and stays safe for restored fallback rows. */
|
|
18
129
|
function filterItems(input, option) {
|
|
19
|
-
return option
|
|
130
|
+
return option?.title?.toLowerCase().includes(input.toLowerCase()) ?? false;
|
|
20
131
|
}
|
|
132
|
+
// spec:3848 — CSP form identities retain their selected shape snapshot
|
|
21
133
|
/** select unit */
|
|
22
134
|
function onSelect(id) {
|
|
23
135
|
const contact = state.contactList.find((x) => x.id === id);
|
|
24
136
|
runInAction(() => (state.identityId = id));
|
|
25
|
-
|
|
137
|
+
if (contact) {
|
|
138
|
+
selectionCompanyId.current = props.companyId;
|
|
139
|
+
props.onChange?.(contact);
|
|
140
|
+
}
|
|
26
141
|
}
|
|
27
142
|
};
|
|
28
143
|
export default LegalContactSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LegalContactSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LegalContactSelect/index.tsx"],"names":[],"mapp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,uEAAuE;IACvE,kBAAkB;IAClB,SAAS,QAAQ,CAAC,EAAU;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3D,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC;QAC3C,IAAI,OAAO,EAAE,CAAC;YACb,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;YAC7C,KAAK,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC;AACF,CAAC,CAAC;AACF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** The typed PascalCase JSON counterpart, preserving primitives, arrays and date serializers. */
|
|
2
|
+
export type PascalValue<T> = T extends Date ? T : T extends readonly (infer V)[] ? PascalValue<V>[] : T extends object ? {
|
|
3
|
+
[K in keyof T as K extends string ? Capitalize<K> : K]: PascalValue<T[K]>;
|
|
4
|
+
} : T;
|
|
5
|
+
/** Capitalize a JSON field name without changing its remaining spelling. */
|
|
2
6
|
export declare function titleCase(str: string): string;
|
|
3
|
-
/**
|
|
4
|
-
export declare function setPascalCase(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function CapitalizeFirstLetter(arr: any[]): any;
|
|
7
|
+
/** Map all nested form fields, including array members, without touching wire literals. */
|
|
8
|
+
export declare function setPascalCase<T>(value: T): PascalValue<T>;
|
|
9
|
+
/** Retain the established roster API while using the same recursive JSON mapper. */
|
|
10
|
+
export declare function CapitalizeFirstLetter<T>(arr: T[]): PascalValue<T>[];
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Capitalize a JSON field name without changing its remaining spelling. */
|
|
2
2
|
export function titleCase(str) {
|
|
3
3
|
return str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return Object.fromEntries(objL);
|
|
5
|
+
// spec:3850 — typed form saves preserve full rosters and nullable captured clears.
|
|
6
|
+
/** Map all nested form fields, including array members, without touching wire literals. */
|
|
7
|
+
export function setPascalCase(value) {
|
|
8
|
+
if (Array.isArray(value))
|
|
9
|
+
return value.map((field) => setPascalCase(field));
|
|
10
|
+
if (value === null || typeof value !== "object" || value instanceof Date || "toJSON" in value)
|
|
11
|
+
return value;
|
|
12
|
+
return Object.fromEntries(Object.entries(value).map(([key, field]) => [titleCase(key), setPascalCase(field)]));
|
|
16
13
|
}
|
|
14
|
+
/** Retain the established roster API while using the same recursive JSON mapper. */
|
|
17
15
|
export function CapitalizeFirstLetter(arr) {
|
|
18
|
-
|
|
19
|
-
arr.forEach((item) => {
|
|
20
|
-
item = setPascalCase(item);
|
|
21
|
-
newArr.push(item);
|
|
22
|
-
});
|
|
23
|
-
return newArr;
|
|
16
|
+
return arr.map((item) => setPascalCase(item));
|
|
24
17
|
}
|
|
25
18
|
//# sourceMappingURL=conversion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../../src/data/clda-form/conversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../../src/data/clda-form/conversion.ts"],"names":[],"mappings":"AAQA,4EAA4E;AAC5E,MAAM,UAAU,SAAS,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AACD,mFAAmF;AACnF,2FAA2F;AAC3F,MAAM,UAAU,aAAa,CAAI,KAAQ;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAmB,CAAC;IAC9F,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,IAAI,IAAI,QAAQ,IAAI,KAAK;QAC5F,OAAO,KAAuB,CAAC;IAChC,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CACjE,CAAC;AACrB,CAAC;AACD,oFAAoF;AACpF,MAAM,UAAU,qBAAqB,CAAI,GAAQ;IAChD,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { IdentityShapeCatalogStatus } from "@voplus/morpho-compliance/es/components/IdentityShapeSelect";
|
|
2
|
+
import type { IIdentity } from "../identity";
|
|
3
|
+
import type { IAddress } from "@voplus/morpho-ui/es/data";
|
|
4
|
+
import type { IFormPeopleOptions } from "./interfaces";
|
|
5
|
+
import type { ILegalGenerationShapeSnapshot } from "../../modules/corporate/legal-generation/form/legalGenerationSubmit";
|
|
6
|
+
/** The form-only wizard callback; these values never create a Compliance owner or identity. */
|
|
7
|
+
export interface FormContactCapture {
|
|
8
|
+
/** Display name, synchronized with the captured identity's full name. */
|
|
9
|
+
FullName: string;
|
|
10
|
+
/** Captured document number. */
|
|
11
|
+
Number: string | number;
|
|
12
|
+
/** The person's nationality or organisation's registration country. */
|
|
13
|
+
Country: string;
|
|
14
|
+
/** Legacy metadata supplied by historical callers, never inferred from a custom shape. */
|
|
15
|
+
Type?: IIdentity["type"];
|
|
16
|
+
/** The contact's subject applicability. */
|
|
17
|
+
UnitType: string;
|
|
18
|
+
/** Redundant authoritative selected source. */
|
|
19
|
+
SourceNumber?: number;
|
|
20
|
+
/** Complete frozen sibling record. */
|
|
21
|
+
IdentityShape?: ILegalGenerationShapeSnapshot;
|
|
22
|
+
/** Optional or explicitly cleared alias. */
|
|
23
|
+
Alias?: string | null;
|
|
24
|
+
/** Independent issuing country or explicit clear. */
|
|
25
|
+
IssuingCountry?: string | null;
|
|
26
|
+
/** Captured expiry value or explicit clear. */
|
|
27
|
+
ExpiryDate?: string | null;
|
|
28
|
+
/** Contact email, retained from the wizard. */
|
|
29
|
+
Email?: string;
|
|
30
|
+
/** Contact phone, retained from the wizard. */
|
|
31
|
+
Phone?: string;
|
|
32
|
+
/** Contact address, retained from the wizard. */
|
|
33
|
+
Address?: IAddress;
|
|
34
|
+
}
|
|
35
|
+
/** Project a form identity into the shared editor without mutating the saved form. */
|
|
36
|
+
export declare function toFormIdentity(contact: IFormPeopleOptions): IIdentity & {
|
|
37
|
+
sourceNumber?: number;
|
|
38
|
+
};
|
|
39
|
+
/** Apply shared editor values, keeping snapshots beside Identity and confirmed clears explicit. */
|
|
40
|
+
export declare function applyFormIdentity(contact: IFormPeopleOptions, value: IIdentity): void;
|
|
41
|
+
/** Create a form-person value from a wizard callback without guessing a deprecated Type. */
|
|
42
|
+
export declare function toFormPerson(id: string, info: FormContactCapture): IFormPeopleOptions;
|
|
43
|
+
/** 完整身份校验供新捕获、冻结值及最终提交使用;历史草稿保存另行分类。 */
|
|
44
|
+
export declare function validateFormIdentity(contact: IFormPeopleOptions): string[];
|
|
45
|
+
/** 普通文书草稿的保存判断;与最终提交的完整性校验分开。 */
|
|
46
|
+
export interface FormDraftSaveDecision {
|
|
47
|
+
/** 按钮及实际保存入口共同使用的放行结果。 */
|
|
48
|
+
allowed: boolean;
|
|
49
|
+
/** 直接触发保存时可显示的失败原因。 */
|
|
50
|
+
errors: string[];
|
|
51
|
+
/** 区分已保存资料、新捕获以及无效变更。 */
|
|
52
|
+
reason: "retained-manual" | "legacy-draft" | "current-capture" | "invalid-transition" | "catalog-unavailable";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 基线必须由宿主在打开编辑时独立复制,不能传入正在编辑的对象。
|
|
56
|
+
* 本函数只判断,不回填身份或读取目录;新捕获的来源认证仍由共享选择器及服务端执行。
|
|
57
|
+
*/
|
|
58
|
+
export declare function getFormDraftSaveDecision(baseline: Readonly<IFormPeopleOptions> | undefined, draft: IFormPeopleOptions, catalogStatus: IdentityShapeCatalogStatus): FormDraftSaveDecision;
|
|
59
|
+
/** 股份区段只读接收人可直接保存引用;更换手工接收人必须按新捕获验证,不能借用原草稿基线。 */
|
|
60
|
+
export declare function getFormRecipientSaveDecision(baseline: Readonly<IFormPeopleOptions>, recipient: Readonly<IFormPeopleOptions>, draft: IFormPeopleOptions, catalogStatus: IdentityShapeCatalogStatus): FormDraftSaveDecision;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { toIdentityCapture, toIdentityShapeSnapshot, } from "../../modules/corporate/legal-generation/form/legalGenerationSubmit";
|
|
2
|
+
// spec:3848 — render stored semantics without catalogue recapture or persisted backfill.
|
|
3
|
+
/** Project a form identity into the shared editor without mutating the saved form. */
|
|
4
|
+
export function toFormIdentity(contact) {
|
|
5
|
+
return {
|
|
6
|
+
...contact.identity,
|
|
7
|
+
alias: contact.identity?.alias ?? undefined,
|
|
8
|
+
issuingCountry: contact.identity?.issuingCountry ?? undefined,
|
|
9
|
+
expiryDate: contact.identity?.expiryDate ?? undefined,
|
|
10
|
+
fullName: contact.identity?.fullName ?? contact.name ?? "",
|
|
11
|
+
sourceNumber: contact.identity?.sourceNumber ?? contact.identityShape?.sourceNumber,
|
|
12
|
+
shape: toIdentityCapture({ identityShape: contact.identityShape, identity: contact.identity })
|
|
13
|
+
?.shape,
|
|
14
|
+
unitType: contact.type === "Organization" ? "Organization" : "Person",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
// spec:3848 — selected source and seven frozen members share one contact update.
|
|
18
|
+
/** Apply shared editor values, keeping snapshots beside Identity and confirmed clears explicit. */
|
|
19
|
+
export function applyFormIdentity(contact, value) {
|
|
20
|
+
const savedSource = contact.identity?.sourceNumber;
|
|
21
|
+
const { shape, unitType: _viewSubject, ...identity } = value;
|
|
22
|
+
const snapshot = shape ? toIdentityShapeSnapshot(shape) : undefined;
|
|
23
|
+
const changedShape = snapshot &&
|
|
24
|
+
Object.keys(snapshot).some((field) => snapshot[field] !== contact.identityShape?.[field]);
|
|
25
|
+
contact.identity = {
|
|
26
|
+
...identity,
|
|
27
|
+
// spec:3848 — 旧记录的 null 仅在控件投影中归一化;无捕获更新必须保留原清除值。
|
|
28
|
+
...(!shape && identity.alias === undefined && contact.identity?.alias === null
|
|
29
|
+
? { alias: null }
|
|
30
|
+
: {}),
|
|
31
|
+
...(!shape && identity.issuingCountry === undefined && contact.identity?.issuingCountry === null
|
|
32
|
+
? { issuingCountry: null }
|
|
33
|
+
: {}),
|
|
34
|
+
...(!shape && identity.expiryDate === undefined && contact.identity?.expiryDate === null
|
|
35
|
+
? { expiryDate: null }
|
|
36
|
+
: {}),
|
|
37
|
+
...(shape && changedShape ? { sourceNumber: shape.source } : {}),
|
|
38
|
+
...(shape &&
|
|
39
|
+
(changedShape || contact.identity?.alias !== identity.alias) &&
|
|
40
|
+
identity.alias === undefined
|
|
41
|
+
? { alias: null }
|
|
42
|
+
: {}),
|
|
43
|
+
...(shape &&
|
|
44
|
+
(changedShape || contact.identity?.issuingCountry !== identity.issuingCountry) &&
|
|
45
|
+
identity.issuingCountry === undefined
|
|
46
|
+
? { issuingCountry: null }
|
|
47
|
+
: {}),
|
|
48
|
+
...(shape &&
|
|
49
|
+
(changedShape || contact.identity?.expiryDate !== identity.expiryDate) &&
|
|
50
|
+
identity.expiryDate === undefined
|
|
51
|
+
? { expiryDate: null, clearExpiryDate: true }
|
|
52
|
+
: {}),
|
|
53
|
+
...(shape &&
|
|
54
|
+
identity.expiryDate !== undefined &&
|
|
55
|
+
contact.identity?.expiryDate !== identity.expiryDate
|
|
56
|
+
? { clearExpiryDate: false }
|
|
57
|
+
: {}),
|
|
58
|
+
};
|
|
59
|
+
// A projection may restore a missing redundant source. It must not silently backfill a read.
|
|
60
|
+
if (shape && !changedShape && contact.identityShape && savedSource === undefined)
|
|
61
|
+
delete contact.identity.sourceNumber;
|
|
62
|
+
contact.name = identity.fullName ?? contact.name;
|
|
63
|
+
if (snapshot && changedShape)
|
|
64
|
+
contact.identityShape = snapshot;
|
|
65
|
+
}
|
|
66
|
+
// spec:3848 — all form-only constructors consume the same complete capture.
|
|
67
|
+
/** Create a form-person value from a wizard callback without guessing a deprecated Type. */
|
|
68
|
+
export function toFormPerson(id, info) {
|
|
69
|
+
return {
|
|
70
|
+
id,
|
|
71
|
+
idType: "NewId",
|
|
72
|
+
name: info.FullName,
|
|
73
|
+
type: info.UnitType,
|
|
74
|
+
email: info.Email,
|
|
75
|
+
phone: info.Phone,
|
|
76
|
+
address: info.Address,
|
|
77
|
+
identity: {
|
|
78
|
+
fullName: info.FullName,
|
|
79
|
+
number: String(info.Number),
|
|
80
|
+
country: info.Country,
|
|
81
|
+
...(info.Type ? { type: info.Type } : {}),
|
|
82
|
+
...(info.IdentityShape
|
|
83
|
+
? { sourceNumber: info.IdentityShape.sourceNumber }
|
|
84
|
+
: info.SourceNumber !== undefined
|
|
85
|
+
? { sourceNumber: info.SourceNumber }
|
|
86
|
+
: {}),
|
|
87
|
+
alias: info.Alias,
|
|
88
|
+
issuingCountry: info.IssuingCountry,
|
|
89
|
+
expiryDate: info.ExpiryDate,
|
|
90
|
+
},
|
|
91
|
+
...(info.IdentityShape ? { identityShape: { ...info.IdentityShape } } : {}),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// spec:3848 — mandatory captured values follow frozen policies; historical validation stays legacy.
|
|
95
|
+
/** 完整身份校验供新捕获、冻结值及最终提交使用;历史草稿保存另行分类。 */
|
|
96
|
+
export function validateFormIdentity(contact) {
|
|
97
|
+
const identity = contact.identity;
|
|
98
|
+
const errors = [];
|
|
99
|
+
if (!contact.name?.trim() ||
|
|
100
|
+
!identity?.number?.trim() ||
|
|
101
|
+
!identity.country?.trim() ||
|
|
102
|
+
(!contact.identityShape && !identity.type))
|
|
103
|
+
errors.push("Please input identity details.");
|
|
104
|
+
if (contact.identityShape) {
|
|
105
|
+
const fields = [
|
|
106
|
+
["aliasPolicy", "alias", "Alias"],
|
|
107
|
+
["issuingCountryPolicy", "issuingCountry", "Issuing Country"],
|
|
108
|
+
["expiryPolicy", "expiryDate", "Expiry Date"],
|
|
109
|
+
];
|
|
110
|
+
for (const [policy, key, label] of fields)
|
|
111
|
+
if (contact.identityShape[policy] === "mandatory" && !identity?.[key]?.trim())
|
|
112
|
+
errors.push(`${label} is required.`);
|
|
113
|
+
}
|
|
114
|
+
return errors;
|
|
115
|
+
}
|
|
116
|
+
/** 冻结语义由全部七个成员决定,不能只比较来源或对象引用。 */
|
|
117
|
+
const formShapeMembers = [
|
|
118
|
+
"sourceNumber",
|
|
119
|
+
"name",
|
|
120
|
+
"family",
|
|
121
|
+
"subject",
|
|
122
|
+
"aliasPolicy",
|
|
123
|
+
"issuingCountryPolicy",
|
|
124
|
+
"expiryPolicy",
|
|
125
|
+
];
|
|
126
|
+
/**
|
|
127
|
+
* 基线必须由宿主在打开编辑时独立复制,不能传入正在编辑的对象。
|
|
128
|
+
* 本函数只判断,不回填身份或读取目录;新捕获的来源认证仍由共享选择器及服务端执行。
|
|
129
|
+
*/
|
|
130
|
+
export function getFormDraftSaveDecision(baseline, draft, catalogStatus) {
|
|
131
|
+
const shape = draft.identityShape;
|
|
132
|
+
const source = draft.identity?.sourceNumber;
|
|
133
|
+
/** 绑定或捕获不一致时,不允许退回历史草稿分支。 */
|
|
134
|
+
const invalid = () => ({
|
|
135
|
+
allowed: false,
|
|
136
|
+
errors: [
|
|
137
|
+
"The contact binding or identity capture has changed. Please select the contact or identity type again.",
|
|
138
|
+
],
|
|
139
|
+
reason: "invalid-transition",
|
|
140
|
+
});
|
|
141
|
+
if (baseline &&
|
|
142
|
+
(baseline.id !== draft.id ||
|
|
143
|
+
baseline.idType !== draft.idType ||
|
|
144
|
+
baseline.type !== draft.type ||
|
|
145
|
+
(baseline.selectedEntityId ?? undefined) !== (draft.selectedEntityId ?? undefined) ||
|
|
146
|
+
(baseline.selectedIdentityId ?? undefined) !== (draft.selectedIdentityId ?? undefined) ||
|
|
147
|
+
(baseline.identityShape && !shape)))
|
|
148
|
+
return invalid();
|
|
149
|
+
if (shape &&
|
|
150
|
+
(formShapeMembers.some((member) => shape[member] === undefined || shape[member] === null) ||
|
|
151
|
+
(source !== undefined && source !== shape.sourceNumber)))
|
|
152
|
+
return invalid();
|
|
153
|
+
const manual = draft.idType !== "ExistingContactId" && !draft.selectedEntityId && !draft.selectedIdentityId;
|
|
154
|
+
if (baseline && !baseline.identityShape && !shape) {
|
|
155
|
+
// 旧记录的冗余来源保持原样;单独改来源不能冒充无形状旧草稿。
|
|
156
|
+
if (baseline.identity?.sourceNumber !== source)
|
|
157
|
+
return invalid();
|
|
158
|
+
return { allowed: true, errors: [], reason: "legacy-draft" };
|
|
159
|
+
}
|
|
160
|
+
if (manual &&
|
|
161
|
+
baseline?.identityShape &&
|
|
162
|
+
shape &&
|
|
163
|
+
formShapeMembers.every((member) => baseline.identityShape[member] === shape[member])) {
|
|
164
|
+
const errors = validateFormIdentity(draft);
|
|
165
|
+
return { allowed: errors.length === 0, errors, reason: "retained-manual" };
|
|
166
|
+
}
|
|
167
|
+
if (catalogStatus !== "ready") {
|
|
168
|
+
return {
|
|
169
|
+
allowed: false,
|
|
170
|
+
errors: ["Please wait for the identity types to load or retry."],
|
|
171
|
+
reason: "catalog-unavailable",
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
// 新捕获必须有完整形状;无法借历史无形状的宽松保存规则跳过采集。
|
|
175
|
+
if (!shape || (!manual && !baseline))
|
|
176
|
+
return invalid();
|
|
177
|
+
const errors = validateFormIdentity(draft);
|
|
178
|
+
const subject = draft.type === "Organization" ? "Organization" : "Person";
|
|
179
|
+
if (shape.subject !== "Both" && shape.subject !== subject)
|
|
180
|
+
errors.push("The identity type does not apply to this contact.");
|
|
181
|
+
return { allowed: errors.length === 0, errors, reason: "current-capture" };
|
|
182
|
+
}
|
|
183
|
+
/** 股份区段只读接收人可直接保存引用;更换手工接收人必须按新捕获验证,不能借用原草稿基线。 */
|
|
184
|
+
export function getFormRecipientSaveDecision(baseline, recipient, draft, catalogStatus) {
|
|
185
|
+
const decision = getFormDraftSaveDecision(recipient, draft, catalogStatus);
|
|
186
|
+
if (recipient.idType !== "NewId") {
|
|
187
|
+
// 该分支没有身份编辑器,父列表只保存区段引用,不写联系人资料。
|
|
188
|
+
return decision.reason === "invalid-transition"
|
|
189
|
+
? decision
|
|
190
|
+
: { allowed: true, errors: [], reason: "current-capture" };
|
|
191
|
+
}
|
|
192
|
+
if (!decision.allowed || recipient.id === baseline.id)
|
|
193
|
+
return decision;
|
|
194
|
+
return getFormDraftSaveDecision(undefined, draft, catalogStatus);
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=identityAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identityAdapter.js","sourceRoot":"","sources":["../../../src/data/clda-form/identityAdapter.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,iBAAiB,EACjB,uBAAuB,GACvB,MAAM,qEAAqE,CAAC;AAiC7E,yFAAyF;AACzF,sFAAsF;AACtF,MAAM,UAAU,cAAc,CAAC,OAA2B;IACzD,OAAO;QACN,GAAG,OAAO,CAAC,QAAQ;QACnB,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,SAAS;Q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voplus/morpho-ui/es/data";
|
|
2
2
|
import { IDocument } from "@voplus/morpho-document-core";
|
|
3
3
|
import { IIdentity } from "../identity";
|
|
4
|
+
import type { ILegalGenerationShapeSnapshot } from "../../modules/corporate/legal-generation/form/legalGenerationSubmit";
|
|
4
5
|
export interface IFormPeopleOptions {
|
|
5
6
|
/** 需要前端自己生成,可以用uuid */
|
|
6
7
|
id: string;
|
|
@@ -8,7 +9,25 @@ export interface IFormPeopleOptions {
|
|
|
8
9
|
email?: string;
|
|
9
10
|
phone?: string;
|
|
10
11
|
address?: IAddress;
|
|
11
|
-
identity
|
|
12
|
+
/** Form identity values are separate from the shared record command and allow explicit clears. */
|
|
13
|
+
identity?: Omit<Partial<IIdentity>, "shape" | "alias" | "issuingCountry" | "expiryDate"> & {
|
|
14
|
+
/** Explicit selected source, redundant with the frozen sibling snapshot. */
|
|
15
|
+
sourceNumber?: number;
|
|
16
|
+
/** Captured alias or a confirmed clear. */
|
|
17
|
+
alias?: string | null;
|
|
18
|
+
/** Independent issuing country or a confirmed clear. */
|
|
19
|
+
issuingCountry?: string | null;
|
|
20
|
+
/** Captured expiry or a confirmed clear. */
|
|
21
|
+
expiryDate?: string | null;
|
|
22
|
+
/** Legacy clear intent retained in form JSON. */
|
|
23
|
+
clearExpiryDate?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** The CSP canonical sibling snapshot persisted alongside Identity. */
|
|
26
|
+
identityShape?: ILegalGenerationShapeSnapshot;
|
|
27
|
+
/** The gallery picker selection, distinct from owner id. */
|
|
28
|
+
selectedEntityId?: string | null;
|
|
29
|
+
/** The exact existing identity the gallery captured. */
|
|
30
|
+
selectedIdentityId?: string | null;
|
|
12
31
|
idType?: string;
|
|
13
32
|
type?: string;
|
|
14
33
|
types?: (string | undefined)[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CLDAFormStore } from "./store";
|
|
2
|
+
import type { EditCLDAFormOptions } from "./types";
|
|
3
|
+
/** Interpret both store error callbacks and thrown failures before a host closes its editor. */
|
|
4
|
+
export declare function saveFormDraft(store: Pick<CLDAFormStore, "edit">, id: string, data: EditCLDAFormOptions): Promise<boolean>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { message } from "antd";
|
|
2
|
+
// spec:3848 — a rejected captured save retains the draft and its confirmed clears.
|
|
3
|
+
/** Interpret both store error callbacks and thrown failures before a host closes its editor. */
|
|
4
|
+
export async function saveFormDraft(store, id, data) {
|
|
5
|
+
let failed = false;
|
|
6
|
+
try {
|
|
7
|
+
await store.edit(id, {
|
|
8
|
+
data,
|
|
9
|
+
error: (error) => {
|
|
10
|
+
failed = true;
|
|
11
|
+
message.error(error.message);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
return !failed;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
message.error(error instanceof Error ? error.message : String(error));
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=saveFormDraft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveFormDraft.js","sourceRoot":"","sources":["../../../src/data/clda-form/saveFormDraft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAI/B,mFAAmF;AACnF,gGAAgG;AAChG,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,KAAkC,EAClC,EAAU,EACV,IAAyB;IAEzB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC;QACJ,MAAM,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE;YACpB,IAAI;YACJ,KAAK,EAAE,CAAC,KAAY,EAAQ,EAAE;gBAC7B,MAAM,GAAG,IAAI,CAAC;gBACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;SACD,CAAC,CAAC;QACH,OAAO,CAAC,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC"}
|