@voplus/morpho-csp 1.3.5 → 1.3.7

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.
Files changed (119) hide show
  1. package/es/components/CorporateUnitSelectDialog/index.d.ts +12 -0
  2. package/es/components/CorporateUnitSelectDialog/index.js +33 -0
  3. package/es/components/CorporateUnitSelectDialog/index.js.map +1 -0
  4. package/es/components/CorporateUnitSelectDialog/index.less +36 -0
  5. package/es/components/CorporateUnitSelectDialog/state.d.ts +65 -0
  6. package/es/components/CorporateUnitSelectDialog/state.js +263 -0
  7. package/es/components/CorporateUnitSelectDialog/state.js.map +1 -0
  8. package/es/components/CorporateUnitSortableTree/index.d.ts +10 -0
  9. package/es/components/CorporateUnitSortableTree/index.js +87 -0
  10. package/es/components/CorporateUnitSortableTree/index.js.map +1 -0
  11. package/es/components/CorporateUnitSortableTree/state.d.ts +62 -0
  12. package/es/components/CorporateUnitSortableTree/state.js +220 -0
  13. package/es/components/CorporateUnitSortableTree/state.js.map +1 -0
  14. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/index.d.ts +3 -0
  15. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/index.js +22 -0
  16. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/index.js.map +1 -0
  17. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/node-content-renderer.d.ts +4 -0
  18. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/node-content-renderer.js +84 -0
  19. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/node-content-renderer.js.map +1 -0
  20. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/node-content-renderer.less +319 -0
  21. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/tree-node-renderer.d.ts +3 -0
  22. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/tree-node-renderer.js +21 -0
  23. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/tree-node-renderer.js.map +1 -0
  24. package/es/components/CorporateUnitSortableTree/themes/FileExplorerTheme/tree-node-renderer.less +4 -0
  25. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/index.d.ts +4 -0
  26. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/index.js +23 -0
  27. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/index.js.map +1 -0
  28. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/node-content-renderer.d.ts +3 -0
  29. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/node-content-renderer.js +58 -0
  30. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/node-content-renderer.js.map +1 -0
  31. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/node-content-renderer.less +45 -0
  32. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/tree-node-renderer.d.ts +3 -0
  33. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/tree-node-renderer.js +73 -0
  34. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/tree-node-renderer.js.map +1 -0
  35. package/es/components/CorporateUnitSortableTree/themes/SortableTreeUnitTheme/tree-node-renderer.less +12 -0
  36. package/es/data/corporate/interfaces.d.ts +3 -0
  37. package/es/data/corporate/types.d.ts +3 -0
  38. package/es/data/share-certificate/ShareCertificateStore.d.ts +2 -0
  39. package/es/data/share-certificate/ShareCertificateStore.js +15 -1
  40. package/es/data/share-certificate/ShareCertificateStore.js.map +1 -1
  41. package/es/data/share-certificate/interfaces.d.ts +3 -0
  42. package/es/data/share-certificate/types.d.ts +2 -0
  43. package/es/modules/corporate/company/components/CompanyDetailsView/index.js +11 -46
  44. package/es/modules/corporate/company/components/CompanyDetailsView/index.js.map +1 -1
  45. package/es/modules/corporate/company/components/CompanyProperties/Properties.d.ts +7 -0
  46. package/es/modules/corporate/company/components/CompanyProperties/Properties.js +68 -0
  47. package/es/modules/corporate/company/components/CompanyProperties/Properties.js.map +1 -0
  48. package/es/modules/corporate/company/components/CompanyProperties/index.d.ts +9 -3
  49. package/es/modules/corporate/company/components/CompanyProperties/index.js +18 -86
  50. package/es/modules/corporate/company/components/CompanyProperties/index.js.map +1 -1
  51. package/es/modules/corporate/company/member-register/components/CompanyMemberItem/index.d.ts +6 -2
  52. package/es/modules/corporate/company/member-register/components/CompanyMemberItem/index.js +10 -5
  53. package/es/modules/corporate/company/member-register/components/CompanyMemberItem/index.js.map +1 -1
  54. package/es/modules/corporate/company/member-register/components/CompanyMemberItem/index.less +9 -1
  55. package/es/modules/corporate/company/member-register/components/CompanyMemberList/index.d.ts +10 -4
  56. package/es/modules/corporate/company/member-register/components/CompanyMemberList/index.js +37 -11
  57. package/es/modules/corporate/company/member-register/components/CompanyMemberList/index.js.map +1 -1
  58. package/es/modules/corporate/company/member-register/components/CompanyMemberList/index.less +15 -12
  59. package/es/modules/corporate/company/member-register/components/CompanyMemberList/state.d.ts +1 -0
  60. package/es/modules/corporate/company/member-register/components/CompanyMemberList/state.js +9 -0
  61. package/es/modules/corporate/company/member-register/components/CompanyMemberList/state.js.map +1 -1
  62. package/es/modules/corporate/company/officer-register/components/OfficerItem/index.d.ts +6 -2
  63. package/es/modules/corporate/company/officer-register/components/OfficerItem/index.js +13 -6
  64. package/es/modules/corporate/company/officer-register/components/OfficerItem/index.js.map +1 -1
  65. package/es/modules/corporate/company/officer-register/components/OfficerItem/index.less +8 -1
  66. package/es/modules/corporate/company/officer-register/components/OfficerList/index.d.ts +9 -4
  67. package/es/modules/corporate/company/officer-register/components/OfficerList/index.js +34 -8
  68. package/es/modules/corporate/company/officer-register/components/OfficerList/index.js.map +1 -1
  69. package/es/modules/corporate/company/officer-register/components/OfficerList/state.d.ts +1 -0
  70. package/es/modules/corporate/company/officer-register/components/OfficerList/state.js +9 -0
  71. package/es/modules/corporate/company/officer-register/components/OfficerList/state.js.map +1 -1
  72. package/es/modules/corporate/company/pages/CompanyDefaultView/index.js +1 -1
  73. package/es/modules/corporate/company/pages/CompanyDefaultView/index.js.map +1 -1
  74. package/es/modules/corporate/company/pages/CompanyPage/CompanySetting.d.ts +7 -0
  75. package/es/modules/corporate/company/pages/CompanyPage/CompanySetting.js +25 -0
  76. package/es/modules/corporate/company/pages/CompanyPage/CompanySetting.js.map +1 -0
  77. package/es/modules/corporate/company/pages/CompanyPage/index.js +6 -3
  78. package/es/modules/corporate/company/pages/CompanyPage/index.js.map +1 -1
  79. package/es/modules/corporate/company/pages/CompanyPage/index.less +6 -0
  80. package/es/modules/corporate/company/share-transactions-register/components/ShareTablePreview/index.d.ts +7 -0
  81. package/es/modules/corporate/company/share-transactions-register/components/ShareTablePreview/index.js +34 -0
  82. package/es/modules/corporate/company/share-transactions-register/components/ShareTablePreview/index.js.map +1 -0
  83. package/es/modules/corporate/company/share-transactions-register/components/ShareTablePreview/index.less +10 -0
  84. package/es/modules/corporate/company/share-transactions-register/components/ShareTransactionItem/index.d.ts +0 -4
  85. package/es/modules/corporate/company/share-transactions-register/components/ShareTransactionItem/index.js +21 -42
  86. package/es/modules/corporate/company/share-transactions-register/components/ShareTransactionItem/index.js.map +1 -1
  87. package/es/modules/corporate/company/share-transactions-register/components/ShareTransactionItem/index.less +30 -70
  88. package/es/modules/corporate/company/share-transactions-register/components/ShareTransactionList/index.d.ts +0 -2
  89. package/es/modules/corporate/company/share-transactions-register/components/ShareTransactionList/index.js +3 -3
  90. package/es/modules/corporate/company/share-transactions-register/components/ShareTransactionList/index.js.map +1 -1
  91. package/es/modules/corporate/share-certificate/components/ShareCertificate/index.js +28 -21
  92. package/es/modules/corporate/share-certificate/components/ShareCertificate/index.js.map +1 -1
  93. package/es/modules/corporate/share-certificate/components/ShareCertificate/index.less +18 -6
  94. package/es/modules/corporate/share-certificate/components/ShareCertificateProperties/index.d.ts +1 -1
  95. package/es/modules/corporate/share-certificate/components/ShareCertificateProperties/index.js +24 -0
  96. package/es/modules/corporate/share-certificate/components/ShareCertificateProperties/index.js.map +1 -1
  97. package/es/modules/corporate/share-certificate/components/ShareCertificateQuickViewDialog/index.js +3 -3
  98. package/es/modules/corporate/share-certificate/components/ShareCertificateQuickViewDialog/index.js.map +1 -1
  99. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/index.js +4 -1
  100. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/index.js.map +1 -1
  101. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/SendToShareholder.d.ts +8 -0
  102. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/SendToShareholder.js +22 -0
  103. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/SendToShareholder.js.map +1 -0
  104. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/SendToSignee.d.ts +8 -0
  105. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/SendToSignee.js +22 -0
  106. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/SendToSignee.js.map +1 -0
  107. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/index.d.ts +2 -0
  108. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/index.js +3 -0
  109. package/es/modules/corporate/share-certificate/controls/ShareCertificateMenu/items/index.js.map +1 -0
  110. package/es/modules/corporate/share-certificate/pages/ShareCertificateClientView/index.d.ts +3 -0
  111. package/es/modules/corporate/share-certificate/pages/ShareCertificateClientView/index.js +56 -0
  112. package/es/modules/corporate/share-certificate/pages/ShareCertificateClientView/index.js.map +1 -0
  113. package/es/modules/corporate/share-certificate/pages/ShareCertificateClientView/index.less +54 -0
  114. package/es/obsolete/OfficerRegisterDefaultView/index.js +1 -1
  115. package/es/obsolete/OfficerRegisterDefaultView/index.js.map +1 -1
  116. package/es/routes.d.ts +6 -0
  117. package/es/routes.js +13 -0
  118. package/es/routes.js.map +1 -1
  119. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { UnitTypeSelectDialogProps } from "./state";
3
+ declare const CorporateUnitSelectDialog: {
4
+ (props: UnitTypeSelectDialogProps): JSX.Element;
5
+ defaultProps: {
6
+ multiSelect: boolean;
7
+ type: string;
8
+ title: string;
9
+ defaultSelection: string;
10
+ };
11
+ };
12
+ export default CorporateUnitSelectDialog;
@@ -0,0 +1,33 @@
1
+ import React, { useState } from "react";
2
+ import { State } from "./state";
3
+ import { useApplicationContext } from "@voplus/morpho-data";
4
+ import { observe } from "@voplus/morpho-ui";
5
+ import { Modal } from "@voplus/antd";
6
+ import FileExplorerTheme from "../CorporateUnitSortableTree/themes/FileExplorerTheme";
7
+ import SubUnitList from "@voplus/morpho-org/es/components/SubUnitList";
8
+ import CompanyMemberList from "../../modules/corporate/company/member-register/components/CompanyMemberList";
9
+ import OfficerList from "../../modules/corporate/company/officer-register/components/OfficerList";
10
+ import UnitSortableTree from "../CorporateUnitSortableTree";
11
+ import classnames from "classnames";
12
+ import styles from "./index.less";
13
+ const CorporateUnitSelectDialog = (props) => {
14
+ const context = useApplicationContext();
15
+ const [state] = useState(new State(props.defaultSelection, props.multiSelect, props.defaultSelected));
16
+ state.props = props;
17
+ state.multiSelect = props.multiSelect;
18
+ return observe(() => (React.createElement(Modal, { className: classnames(styles["doc-select-dialog"], props.className), width: 800, title: props.title, visible: true, okText: "Select", onOk: () => state.handleOk(), onCancel: () => state.handleCancel() },
19
+ React.createElement("div", { className: "file-tree" },
20
+ React.createElement(UnitSortableTree, { organizationId: context.user.info.organizationId, active: state.current, canDrag: false, theme: FileExplorerTheme, onUnitSelected: (id) => state.onExpand(id) })),
21
+ React.createElement("div", { className: "document-list" }, state.current === "members" ? (React.createElement(CompanyMemberList, { selectDialog: true, corporateId: props.corporateId, selectedLists: state.selectedMemberLists, onSelectCorporateUnit: (item) => state.onSelectMemberUnit(item) })) : state.current === "officers" ? (React.createElement(OfficerList, { selectDialog: true, corporateId: props.corporateId, selectedLists: state.selectedOfficerLists, onSelectCorporateUnit: (item) => state.onSelectOfficerUnit(item) })) : (React.createElement(SubUnitList, { parentId: state.id, isShowParentItem: state.id === "c896a84e-b31a-4d10-a181-5d34a21b172d", isFilterUsers: state.isFilterUsers, isFilterRoles: state.isFilterRoles, isFilterOrganization: state.isFilterOrganization, isFilterTeam: state.isFilterTeam, type: props.type, unitSelectAdd: true, addAble: true, selectedLists: state.selectedLists, onSelectUnit: (item) => state.onSelectUnit(item) }))),
22
+ state.multiSelect && (React.createElement("div", { className: "selected-document-list" },
23
+ React.createElement("div", { className: "selected-list-title" }, "\u5DF2\u9009\u8054\u7CFB\u4EBA"),
24
+ state.selectedLists.map((item) => (React.createElement("div", { className: "document-itme-name", key: item.id, onDoubleClick: () => state.deselectUnit(item) }, item.name))))))));
25
+ };
26
+ CorporateUnitSelectDialog.defaultProps = {
27
+ multiSelect: true,
28
+ type: "select",
29
+ title: "Corporate ContactSelect",
30
+ defaultSelection: "Everyone",
31
+ };
32
+ export default CorporateUnitSelectDialog;
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CorporateUnitSelectDialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,EAA6B,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,iBAAiB,MAAM,uDAAuD,CAAC;AACtF,OAAO,WAAW,MAAM,8CAA8C,CAAC;AACvE,OAAO,iBAAiB,MAAM,8EAA8E,CAAC;AAC7G,OAAO,WAAW,MAAM,yEAAyE,CAAC;AAClG,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAC5D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,MAAM,MAAM,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AACJ,CAAC,CAAC;AAEF,yBAAyB,CAAC,YAAY,GAAG;IACxC,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,yBAAyB;IAChC,gBAAgB,EAAE,UAAU;CAC5B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,36 @@
1
+ .doc-select-dialog {
2
+ :global {
3
+ .ant-modal-body {
4
+ display: flex;
5
+ height: 600px;
6
+ padding: 0;
7
+ > div {
8
+ flex: 1;
9
+ border-right: 1px solid #e8e8e8;
10
+ }
11
+ > div:last-child {
12
+ border-right: none;
13
+ }
14
+ .file-tree {
15
+ padding: 10px 0 0 15px;
16
+ }
17
+ .document-list {
18
+ flex: 2;
19
+ }
20
+ .selected-document-list {
21
+ padding-left: 10px;
22
+ .selected-list-title {
23
+ line-height: 44px;
24
+ border-bottom: 1px solid #e8e8e8;
25
+ }
26
+ .document-itme-name {
27
+ line-height: 32px;
28
+ }
29
+ .file-type {
30
+ display: inline-block;
31
+ margin-right: 10px;
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,65 @@
1
+ import { IUnit } from "@voplus/morpho-org";
2
+ import { ICompanyMember } from "../../data/member";
3
+ import { IOfficer } from "../../data/officer";
4
+ export declare type UnitTypeSelectDialogProps = {
5
+ /** 保存时 是否允许返回空数据 */
6
+ isEmptyData?: boolean;
7
+ /** member officer list filter corporateId */
8
+ corporateId?: string;
9
+ className?: string;
10
+ /** 是否多选 */
11
+ multiSelect?: boolean;
12
+ /** select | click (单击模式显示checkIcon)*/
13
+ type?: string;
14
+ /** */
15
+ title?: string;
16
+ /** 预设 "Everyone" | "Users" */
17
+ defaultSelection?: "Everyone" | "Users" | "Members" | "Officers";
18
+ /** Selected members */
19
+ defaultSelected?: {
20
+ id: string;
21
+ name?: string;
22
+ }[];
23
+ /** 文件选择 确定方法 */
24
+ onSelect?: (params?: {
25
+ id: string;
26
+ name: string;
27
+ type: string;
28
+ }[]) => void;
29
+ /** 文件选择 取消方法 */
30
+ onCancel?: () => void;
31
+ };
32
+ export declare class State {
33
+ private defaultSelection;
34
+ private multiple;
35
+ private defaultSelected;
36
+ props: UnitTypeSelectDialogProps;
37
+ /** UnitList id */
38
+ id: string;
39
+ /** 已选文件列表 */
40
+ selectedLists: IUnit[];
41
+ selectedMemberLists: ICompanyMember[];
42
+ selectedOfficerLists: IOfficer[];
43
+ /** 是否多选 */
44
+ multiSelect: boolean;
45
+ /** 是否 filter users */
46
+ isFilterUsers: boolean;
47
+ /** 是否 filter roles */
48
+ isFilterRoles: boolean;
49
+ isFilterOrganization: boolean;
50
+ isFilterTeam: boolean;
51
+ /** document tree 点击时current id */
52
+ current: string;
53
+ constructor(defaultSelection: string, multiple: boolean, defaultSelected: any[]);
54
+ /**Select function*/
55
+ handleOk(): void | import("@voplus/antd/es/message").MessageType;
56
+ /**cancel function*/
57
+ handleCancel(): void;
58
+ /**已选文件列表 双击取消选择文件*/
59
+ deselectUnit(item: IUnit): void;
60
+ /**UnitTree 选择文件返回unit id, UnitList获得id显示列表*/
61
+ onExpand(expandedKeys: string): void;
62
+ onSelectUnit(item: IUnit): void | IUnit[];
63
+ onSelectMemberUnit(item: ICompanyMember): void | any[][];
64
+ onSelectOfficerUnit(item: IOfficer): void | any[][];
65
+ }
@@ -0,0 +1,263 @@
1
+ import { __decorate } from "tslib";
2
+ import { action, makeObservable, observable } from "mobx";
3
+ import { message } from "@voplus/antd";
4
+ export class State {
5
+ constructor(defaultSelection, multiple, defaultSelected) {
6
+ var _a;
7
+ Object.defineProperty(this, "defaultSelection", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: defaultSelection
12
+ });
13
+ Object.defineProperty(this, "multiple", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: multiple
18
+ });
19
+ Object.defineProperty(this, "defaultSelected", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: defaultSelected
24
+ });
25
+ Object.defineProperty(this, "props", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
31
+ /** UnitList id */
32
+ Object.defineProperty(this, "id", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: ""
37
+ });
38
+ /** 已选文件列表 */
39
+ Object.defineProperty(this, "selectedLists", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: []
44
+ });
45
+ Object.defineProperty(this, "selectedMemberLists", {
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true,
49
+ value: []
50
+ });
51
+ Object.defineProperty(this, "selectedOfficerLists", {
52
+ enumerable: true,
53
+ configurable: true,
54
+ writable: true,
55
+ value: []
56
+ });
57
+ /** 是否多选 */
58
+ Object.defineProperty(this, "multiSelect", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ writable: true,
62
+ value: false
63
+ });
64
+ /** 是否 filter users */
65
+ Object.defineProperty(this, "isFilterUsers", {
66
+ enumerable: true,
67
+ configurable: true,
68
+ writable: true,
69
+ value: false
70
+ });
71
+ /** 是否 filter roles */
72
+ Object.defineProperty(this, "isFilterRoles", {
73
+ enumerable: true,
74
+ configurable: true,
75
+ writable: true,
76
+ value: false
77
+ });
78
+ Object.defineProperty(this, "isFilterOrganization", {
79
+ enumerable: true,
80
+ configurable: true,
81
+ writable: true,
82
+ value: false
83
+ });
84
+ Object.defineProperty(this, "isFilterTeam", {
85
+ enumerable: true,
86
+ configurable: true,
87
+ writable: true,
88
+ value: false
89
+ });
90
+ /** document tree 点击时current id */
91
+ Object.defineProperty(this, "current", {
92
+ enumerable: true,
93
+ configurable: true,
94
+ writable: true,
95
+ value: ""
96
+ });
97
+ makeObservable(this);
98
+ switch (this.defaultSelection) {
99
+ case "Everyone":
100
+ this.id = "c896a84e-b31a-4d10-a181-5d34a21b172d";
101
+ this.current = "c896a84e-b31a-4d10-a181-5d34a21b172d";
102
+ break;
103
+ case "Users":
104
+ this.isFilterUsers = true;
105
+ break;
106
+ case "Members":
107
+ this.current = "members";
108
+ break;
109
+ case "Officers":
110
+ this.current = "officers";
111
+ break;
112
+ default:
113
+ break;
114
+ }
115
+ // defaultSelected 用于被选中成员的数据回显
116
+ if (((_a = this.defaultSelected) === null || _a === void 0 ? void 0 : _a.length) && this.multiple) {
117
+ this.defaultSelected.map((item) => {
118
+ this.selectedLists.push(item);
119
+ });
120
+ }
121
+ }
122
+ /**Select function*/
123
+ handleOk() {
124
+ var _a, _b;
125
+ if (!this.selectedLists.length && !this.props.isEmptyData)
126
+ return message.warning("Please select Unit");
127
+ return (_b = (_a = this.props).onSelect) === null || _b === void 0 ? void 0 : _b.call(_a, this.selectedLists);
128
+ }
129
+ /**cancel function*/
130
+ handleCancel() {
131
+ var _a, _b;
132
+ (_b = (_a = this.props).onCancel) === null || _b === void 0 ? void 0 : _b.call(_a);
133
+ }
134
+ /**已选文件列表 双击取消选择文件*/
135
+ deselectUnit(item) {
136
+ this.selectedLists = this.selectedLists.filter((i) => i !== item);
137
+ }
138
+ /**UnitTree 选择文件返回unit id, UnitList获得id显示列表*/
139
+ onExpand(expandedKeys) {
140
+ if (expandedKeys) {
141
+ this.id = expandedKeys;
142
+ this.isFilterUsers = false;
143
+ this.isFilterRoles = false;
144
+ this.isFilterOrganization = false;
145
+ this.isFilterTeam = false;
146
+ }
147
+ else {
148
+ this.id = "";
149
+ this.isFilterUsers = true;
150
+ this.isFilterRoles = false;
151
+ this.isFilterOrganization = false;
152
+ this.isFilterTeam = false;
153
+ }
154
+ this.current = expandedKeys;
155
+ }
156
+ /*UnitTree,UnitList 双击选择文件显示在已选文件列表*/
157
+ onSelectUnit(item) {
158
+ var _a, _b, _c;
159
+ if (!this.multiSelect)
160
+ return ((_a = this.props) === null || _a === void 0 ? void 0 : _a.type) === "click"
161
+ ? (this.selectedLists = [item])
162
+ : (_c = (_b = this.props).onSelect) === null || _c === void 0 ? void 0 : _c.call(_b, [{ id: item.id, name: item.name, type: item.type }]);
163
+ if (!this.selectedLists.some((ele) => ele.id === item.id)) {
164
+ this.selectedLists.push(item);
165
+ }
166
+ }
167
+ onSelectMemberUnit(item) {
168
+ var _a, _b, _c;
169
+ if (!this.multiSelect)
170
+ return ((_a = this.props) === null || _a === void 0 ? void 0 : _a.type) === "click"
171
+ ? [
172
+ (this.selectedMemberLists = [item]),
173
+ (this.selectedLists = [
174
+ { id: item.contact.id, name: item.contact.name, type: "MemberUnit" },
175
+ ]),
176
+ ]
177
+ : (_c = (_b = this.props).onSelect) === null || _c === void 0 ? void 0 : _c.call(_b, [
178
+ { id: item.contact.id, name: item.contact.name, type: "MemberUnit" },
179
+ ]);
180
+ if (!this.selectedMemberLists.some((ele) => ele.id === item.id)) {
181
+ this.selectedMemberLists.push(item);
182
+ this.selectedLists.push({
183
+ id: item.contact.id,
184
+ name: item.contact.name,
185
+ type: "MemberUnit",
186
+ });
187
+ }
188
+ }
189
+ onSelectOfficerUnit(item) {
190
+ var _a, _b, _c;
191
+ if (!this.multiSelect)
192
+ return ((_a = this.props) === null || _a === void 0 ? void 0 : _a.type) === "click"
193
+ ? [
194
+ (this.selectedOfficerLists = [item]),
195
+ (this.selectedLists = [
196
+ { id: item.contact.id, name: item.contact.name, type: "OfficerUnit" },
197
+ ]),
198
+ ]
199
+ : (_c = (_b = this.props).onSelect) === null || _c === void 0 ? void 0 : _c.call(_b, [
200
+ { id: item.contact.id, name: item.contact.name, type: "OfficerUnit" },
201
+ ]);
202
+ if (!this.selectedOfficerLists.some((ele) => ele.id === item.id)) {
203
+ this.selectedOfficerLists.push(item);
204
+ this.selectedLists.push({
205
+ id: item.contact.id,
206
+ name: item.contact.name,
207
+ type: "OfficerUnit",
208
+ });
209
+ }
210
+ }
211
+ }
212
+ __decorate([
213
+ observable
214
+ ], State.prototype, "id", void 0);
215
+ __decorate([
216
+ observable
217
+ ], State.prototype, "selectedLists", void 0);
218
+ __decorate([
219
+ observable
220
+ ], State.prototype, "selectedMemberLists", void 0);
221
+ __decorate([
222
+ observable
223
+ ], State.prototype, "selectedOfficerLists", void 0);
224
+ __decorate([
225
+ observable
226
+ ], State.prototype, "multiSelect", void 0);
227
+ __decorate([
228
+ observable
229
+ ], State.prototype, "isFilterUsers", void 0);
230
+ __decorate([
231
+ observable
232
+ ], State.prototype, "isFilterRoles", void 0);
233
+ __decorate([
234
+ observable
235
+ ], State.prototype, "isFilterOrganization", void 0);
236
+ __decorate([
237
+ observable
238
+ ], State.prototype, "isFilterTeam", void 0);
239
+ __decorate([
240
+ observable
241
+ ], State.prototype, "current", void 0);
242
+ __decorate([
243
+ action
244
+ ], State.prototype, "handleOk", null);
245
+ __decorate([
246
+ action
247
+ ], State.prototype, "handleCancel", null);
248
+ __decorate([
249
+ action
250
+ ], State.prototype, "deselectUnit", null);
251
+ __decorate([
252
+ action
253
+ ], State.prototype, "onExpand", null);
254
+ __decorate([
255
+ action
256
+ ], State.prototype, "onSelectUnit", null);
257
+ __decorate([
258
+ action
259
+ ], State.prototype, "onSelectMemberUnit", null);
260
+ __decorate([
261
+ action
262
+ ], State.prototype, "onSelectOfficerUnit", null);
263
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/components/CorporateUnitSelectDialog/state.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAI1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAkCvC,MAAM,OAAO,KAAK;IAqBjB,YACS,gBAAwB,EACxB,QAAiB,EACjB,eAAsB;;;;;;mBAFtB;;;;;;mBACA;;;;;;mBACA;;QAvBT;;;;;WAAwC;QACxC,kBAAkB;QACN;;;;mBAAY,EAAE;WAAC;QAC3B,aAAa;QACD;;;;mBAAgC,EAAE;WAAC;QAEnC;;;;mBAA+C,EAAE;WAAC;QAElD;;;;mBAA0C,EAAE;WAAC;QACzD,WAAW;QACC;;;;mBAAqB,KAA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AA8B;AAC7B;IAAX,UAAU;mDAAqC;AACpC;IAAX,UAAU;2CAA6B;AAE5B;IAAX,UAAU;sCAAqB;AAqChC;IADC,MAAM;qCAKN;AAID;IADC,MAAM;yCAGN;AAID;IADC,MAAM;yCAGN;AAID;IADC,MAAM;qCAgBN;AAID;IADC,MAAM;yCASN;AAGD;IADC,MAAM;+CAqBN;AAGD;IADC,MAAM;gDAqBN"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { UnitSortableTreeProps } from "./state";
3
+ declare const UnitSortableTree: {
4
+ (props: UnitSortableTreeProps): JSX.Element;
5
+ defaultProps: {
6
+ canDrag: boolean;
7
+ theme: import("@voplus/react-sortable-tree").ThemeProps;
8
+ };
9
+ };
10
+ export default UnitSortableTree;
@@ -0,0 +1,87 @@
1
+ import { useOnDeleteUnit, useOnNewUnit, useUnit, useUnitListEffect, useUnitStore, } from "@voplus/morpho-org";
2
+ import React, { useEffect, useState } from "react";
3
+ import { State } from "./state";
4
+ import { UnitContext, UnitContextState } from "@voplus/morpho-org/es/data/UnitContext";
5
+ import { observe, useAutorunEffect, useRenderOnChange } from "@voplus/morpho-ui";
6
+ import Panable from "@voplus/morpho-ui/es/controls/Panable";
7
+ import SortableTree from "@voplus/react-sortable-tree";
8
+ import SortableTreeUnitTheme from "./themes/SortableTreeUnitTheme";
9
+ import { runInAction } from "mobx";
10
+ const UnitSortableTree = (props) => {
11
+ var _a, _b;
12
+ const { theme, canDrag } = props;
13
+ const store = useUnitStore();
14
+ const [state] = useState(new State(store));
15
+ /**把store 传给子级 UnitItem*/
16
+ const [options] = useState(new UnitContextState());
17
+ options.onUnitSelected = props.onUnitSelected;
18
+ options.active = props.active;
19
+ /** 根文件 / organization */
20
+ const root = useUnit((_b = (_a = props.id) !== null && _a !== void 0 ? _a : props.organizationId) !== null && _b !== void 0 ? _b : "");
21
+ useAutorunEffect(() => {
22
+ if (root.id && root.loaded && !state.treeData.length) {
23
+ root.children = state.treeChildren;
24
+ runInAction(() => {
25
+ state.treeData = [
26
+ { id: "c896a84e-b31a-4d10-a181-5d34a21b172d", name: "Everyone" },
27
+ { id: "", name: "Users" },
28
+ { id: "members", name: "Members" },
29
+ { id: "officers", name: "Officers" },
30
+ ];
31
+ });
32
+ }
33
+ });
34
+ useEffect(() => {
35
+ runInAction(() => {
36
+ var _a, _b;
37
+ state.filterType = props.filterType;
38
+ if (state.treeData.length &&
39
+ ((_a = state.treeData[0]) === null || _a === void 0 ? void 0 : _a.id) &&
40
+ ((_b = state.treeData[0]) === null || _b === void 0 ? void 0 : _b.childrenListLoading) !== undefined) {
41
+ state.id = state.treeData[0].id;
42
+ state.treeData[0].children = [];
43
+ state.treeData = [...state.treeData];
44
+ state.treeNodeChildren = state.treeData[0];
45
+ state.treeNodeChildren.childrenListLoading = true;
46
+ state.effect = state.updateNodes;
47
+ }
48
+ });
49
+ }, [props.filterType]);
50
+ useUnitListEffect(null, state.effect, {
51
+ Filters: state.filters,
52
+ });
53
+ useRenderOnChange(() => state.id);
54
+ useOnNewUnit((s, unit) => {
55
+ runInAction(() => {
56
+ var _a, _b;
57
+ state.editTreeData(state.treeData, unit.parentNodeId);
58
+ if (!((_a = state.treeNodeChildren) === null || _a === void 0 ? void 0 : _a.children)) {
59
+ state.treeNodeChildren.children = [unit];
60
+ }
61
+ else {
62
+ const index = state.treeNodeChildren.children.findIndex((i) => i.id === unit.id);
63
+ if (index === -1)
64
+ (_b = state.treeNodeChildren) === null || _b === void 0 ? void 0 : _b.children.push(unit);
65
+ }
66
+ state.treeData = [...state.treeData];
67
+ });
68
+ });
69
+ useOnDeleteUnit((s, unit) => {
70
+ runInAction(() => {
71
+ state.editTreeData(state.treeData, unit.parentNodeId);
72
+ state.treeNodeChildren.children = state.treeNodeChildren.children.filter((item) => item.id !== unit.id);
73
+ state.treeData = [...state.treeData];
74
+ });
75
+ });
76
+ /** isVirtualized={false} 可以解决滚动时,重新渲染UnitItem组件
77
+ * 设置为false可禁用虚拟化。默认为true。注意:拖动时自动滚动以及滚动到searchFocusOffset都将被禁用。*/
78
+ return observe(() => (React.createElement(UnitContext.Provider, { value: options },
79
+ React.createElement(Panable, { scroll: true, isDragging: state.isDragging },
80
+ React.createElement(SortableTree, { isVirtualized: false, treeData: state.treeData, onChange: (val) => state.updateTreeData(val), getNodeKey: ({ node }) => node.id, onVisibilityToggle: (val) => state.onVisibilityToggle(val), onMoveNode: (val) => state.onMoveNode(val), canDrop: ({ nextPath }) => ((nextPath === null || nextPath === void 0 ? void 0 : nextPath.length) > 1 ? true : false), canNodeHaveChildren: (node) => state.toHaveChildren(node), onDragStateChanged: (data) => runInAction(() => (state.isDragging = data.isDragging)), canDrag: canDrag, theme: theme })))));
81
+ };
82
+ UnitSortableTree.defaultProps = {
83
+ canDrag: true,
84
+ theme: SortableTreeUnitTheme,
85
+ };
86
+ export default UnitSortableTree;
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CorporateUnitSortableTree/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGN,eAAe,EACf,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,KAAK,EAAyB,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEjF,OAAO,OAAO,MAAM,uCAAuC,CAAC;AAC5D,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,qBAAqB,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,gBAAgB,GAAG,CAAC,KAA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CAAC,EACjD,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EACjC,kBAAkB,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAC/D,UAAU,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAC/C,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,IAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAChE,mBAAmB,EAAE,CAAC,IAAS,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAC9D,kBAAkB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,EACrF,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GACX,CACO,CACY,CACvB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG;IAC/B,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,qBAAqB;CAC5B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { IUnit, UnitStore } from "@voplus/morpho-org";
2
+ import { FilterOption } from "@voplus/morpho-data";
3
+ export declare type UnitSortableTreeProps = {
4
+ /** 当前 id */
5
+ id?: string;
6
+ /** 当前用户的Organization id */
7
+ organizationId?: string;
8
+ /** Unit Tree theme */
9
+ theme?: any;
10
+ /** 是否可以拖放 */
11
+ canDrag?: boolean;
12
+ filterType?: FilterOption;
13
+ /** active id */
14
+ active?: string;
15
+ /** Unit selected */
16
+ onUnitSelected?: (params?: any) => void;
17
+ };
18
+ export interface ITreeNodeData extends IUnit {
19
+ /** node expanded 与否 */
20
+ expanded?: boolean;
21
+ children?: ITreeNodeData[];
22
+ /** 子数据列表是否 loading */
23
+ childrenListLoading?: boolean;
24
+ }
25
+ export declare class State {
26
+ private _store;
27
+ constructor(_store: UnitStore);
28
+ id: string;
29
+ /** 如果effect 是null就不执行 useUnitListEffect*/
30
+ effect: (list: IUnit[]) => void | null;
31
+ treeNodeChildren: any;
32
+ /** dummy placeholder data */
33
+ treeChildren: ITreeNodeData[];
34
+ /** 沒load之前, 看看現在這個文件有沒有子文件, 有的話要放個 dummy placeholder data 在children里, */
35
+ treeData: ITreeNodeData[];
36
+ /** filter type for unit */
37
+ filterType: FilterOption | undefined;
38
+ /** onDragStateChanged 在拖动开始或结束时调用。拖动开始时为true,拖动结束时为false */
39
+ isDragging?: boolean;
40
+ /** 根据path查找文件 */
41
+ findFiles(path: string[]): any;
42
+ /** 接收@treeData state.treeData
43
+ * @id 找id 文件 */
44
+ editTreeData(treeData: any, id: string): void;
45
+ /** 更新 TreeData */
46
+ updateTreeData(val: any): void;
47
+ /** update useUnitListEffect */
48
+ updateNodes: (list: IUnit[]) => void;
49
+ /**在子节点折叠或者展开后调用*/
50
+ onVisibilityToggle(val: any): void;
51
+ /** 在节点移动操作之后调用 */
52
+ onMoveNode(val: any): Promise<void>;
53
+ /**
54
+ * 确定节点是否可以具有子级的功能,对于在canDrop有条件时防止悬停预览很有用。默认设置为返回的函数true。函数应为类型(node): bool
55
+ */
56
+ toHaveChildren(node: any): boolean;
57
+ /**
58
+ * unit filters
59
+ * @return unit filters
60
+ */
61
+ get filters(): any[];
62
+ }