@nocobase/plugin-multi-portal 2.2.0-alpha.10
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/LICENSE.txt +107 -0
- package/README.md +14 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/models/index.d.ts +11 -0
- package/dist/client/plugin.d.ts +13 -0
- package/dist/client-v2/354.ead3e96143164cd5.js +10 -0
- package/dist/client-v2/499.ef2ff0c022687485.js +10 -0
- package/dist/client-v2/778.23ba409a924ee34a.js +10 -0
- package/dist/client-v2/845.f2b0ce44ae4be707.js +10 -0
- package/dist/client-v2/entryActions/PortalEntryActionModel.d.ts +52 -0
- package/dist/client-v2/entryActions/portalEntryActionStore.d.ts +36 -0
- package/dist/client-v2/entryActions/registerPortalEntryActions.d.ts +10 -0
- package/dist/client-v2/entryActions/types.d.ts +41 -0
- package/dist/client-v2/entryActions/url.d.ts +10 -0
- package/dist/client-v2/index.d.ts +9 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/layoutRegistration.d.ts +38 -0
- package/dist/client-v2/locale.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalBlockModel.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalMobilePageModels.d.ts +34 -0
- package/dist/client-v2/pages/MultiPortalsPage.d.ts +80 -0
- package/dist/client-v2/permissions/MultiPortalPermissionsTab.d.ts +21 -0
- package/dist/client-v2/permissions/multiPortalPermissions.d.ts +12 -0
- package/dist/client-v2/plugin.d.ts +13 -0
- package/dist/client-v2/routeRepositoryScope.d.ts +11 -0
- package/dist/client-v2/routeUrl.d.ts +18 -0
- package/dist/externalVersion.js +25 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +82 -0
- package/dist/locale/zh-CN.json +82 -0
- package/dist/node_modules/tar/dist/commonjs/create.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/create.js +82 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.d.ts +8 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/extract.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/extract.js +88 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
- package/dist/node_modules/tar/dist/commonjs/header.d.ts +53 -0
- package/dist/node_modules/tar/dist/commonjs/header.js +312 -0
- package/dist/node_modules/tar/dist/commonjs/index.d.ts +20 -0
- package/dist/node_modules/tar/dist/commonjs/index.js +64 -0
- package/dist/node_modules/tar/dist/commonjs/index.min.js +1 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
- package/dist/node_modules/tar/dist/commonjs/list.d.ts +7 -0
- package/dist/node_modules/tar/dist/commonjs/list.js +145 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.d.ts +49 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.js +52 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.d.ts +25 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.js +187 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
- package/dist/node_modules/tar/dist/commonjs/options.d.ts +596 -0
- package/dist/node_modules/tar/dist/commonjs/options.js +66 -0
- package/dist/node_modules/tar/dist/commonjs/pack.d.ts +105 -0
- package/dist/node_modules/tar/dist/commonjs/pack.js +545 -0
- package/dist/node_modules/tar/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/dist/commonjs/parse.d.ts +85 -0
- package/dist/node_modules/tar/dist/commonjs/parse.js +610 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.d.ts +11 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
- package/dist/node_modules/tar/dist/commonjs/pax.d.ts +26 -0
- package/dist/node_modules/tar/dist/commonjs/pax.js +158 -0
- package/dist/node_modules/tar/dist/commonjs/process-umask.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/process-umask.js +7 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.d.ts +36 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.js +136 -0
- package/dist/node_modules/tar/dist/commonjs/replace.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/replace.js +227 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.d.ts +9 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
- package/dist/node_modules/tar/dist/commonjs/types.d.ts +7 -0
- package/dist/node_modules/tar/dist/commonjs/types.js +50 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.d.ts +101 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.js +932 -0
- package/dist/node_modules/tar/dist/commonjs/update.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/update.js +33 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.d.ts +24 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.js +31 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.js +14 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.d.ts +129 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.js +698 -0
- package/dist/node_modules/tar/dist/esm/create.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/create.js +76 -0
- package/dist/node_modules/tar/dist/esm/cwd-error.d.ts +8 -0
- package/dist/node_modules/tar/dist/esm/cwd-error.js +14 -0
- package/dist/node_modules/tar/dist/esm/extract.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/extract.js +49 -0
- package/dist/node_modules/tar/dist/esm/get-write-flag.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/get-write-flag.js +26 -0
- package/dist/node_modules/tar/dist/esm/header.d.ts +53 -0
- package/dist/node_modules/tar/dist/esm/header.js +275 -0
- package/dist/node_modules/tar/dist/esm/index.d.ts +20 -0
- package/dist/node_modules/tar/dist/esm/index.js +20 -0
- package/dist/node_modules/tar/dist/esm/index.min.js +4 -0
- package/dist/node_modules/tar/dist/esm/large-numbers.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/large-numbers.js +94 -0
- package/dist/node_modules/tar/dist/esm/list.d.ts +7 -0
- package/dist/node_modules/tar/dist/esm/list.js +105 -0
- package/dist/node_modules/tar/dist/esm/make-command.d.ts +49 -0
- package/dist/node_modules/tar/dist/esm/make-command.js +48 -0
- package/dist/node_modules/tar/dist/esm/mkdir.d.ts +25 -0
- package/dist/node_modules/tar/dist/esm/mkdir.js +179 -0
- package/dist/node_modules/tar/dist/esm/mode-fix.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/mode-fix.js +25 -0
- package/dist/node_modules/tar/dist/esm/normalize-unicode.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
- package/dist/node_modules/tar/dist/esm/options.d.ts +596 -0
- package/dist/node_modules/tar/dist/esm/options.js +54 -0
- package/dist/node_modules/tar/dist/esm/pack.d.ts +105 -0
- package/dist/node_modules/tar/dist/esm/pack.js +503 -0
- package/dist/node_modules/tar/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/dist/esm/parse.d.ts +85 -0
- package/dist/node_modules/tar/dist/esm/parse.js +606 -0
- package/dist/node_modules/tar/dist/esm/path-reservations.d.ts +11 -0
- package/dist/node_modules/tar/dist/esm/path-reservations.js +166 -0
- package/dist/node_modules/tar/dist/esm/pax.d.ts +26 -0
- package/dist/node_modules/tar/dist/esm/pax.js +154 -0
- package/dist/node_modules/tar/dist/esm/process-umask.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/process-umask.js +3 -0
- package/dist/node_modules/tar/dist/esm/read-entry.d.ts +36 -0
- package/dist/node_modules/tar/dist/esm/read-entry.js +132 -0
- package/dist/node_modules/tar/dist/esm/replace.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/replace.js +221 -0
- package/dist/node_modules/tar/dist/esm/strip-absolute-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
- package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
- package/dist/node_modules/tar/dist/esm/symlink-error.d.ts +9 -0
- package/dist/node_modules/tar/dist/esm/symlink-error.js +15 -0
- package/dist/node_modules/tar/dist/esm/types.d.ts +7 -0
- package/dist/node_modules/tar/dist/esm/types.js +45 -0
- package/dist/node_modules/tar/dist/esm/unpack.d.ts +101 -0
- package/dist/node_modules/tar/dist/esm/unpack.js +891 -0
- package/dist/node_modules/tar/dist/esm/update.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/update.js +30 -0
- package/dist/node_modules/tar/dist/esm/warn-method.d.ts +24 -0
- package/dist/node_modules/tar/dist/esm/warn-method.js +27 -0
- package/dist/node_modules/tar/dist/esm/winchars.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/winchars.js +9 -0
- package/dist/node_modules/tar/dist/esm/write-entry.d.ts +129 -0
- package/dist/node_modules/tar/dist/esm/write-entry.js +656 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.d.ts +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.js +93 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.d.ts +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.js +85 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/chownr/package.json +69 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.d.ts +549 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.js +1028 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.d.ts +549 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.js +1018 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minipass/package.json +82 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.js +416 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.js +117 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.d.ts +99 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.js +363 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minizlib/package.json +80 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts +39 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.js +384 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts +39 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.js +379 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/yallist/package.json +68 -0
- package/dist/node_modules/tar/package.json +1 -0
- package/dist/server/collections/desktopRoutes.d.ts +14 -0
- package/dist/server/collections/desktopRoutes.js +48 -0
- package/dist/server/collections/extendRoleField.d.ts +14 -0
- package/dist/server/collections/extendRoleField.js +51 -0
- package/dist/server/collections/multiPortals.d.ts +10 -0
- package/dist/server/collections/multiPortals.js +128 -0
- package/dist/server/collections/rolesMultiPortalDesktopRoutes.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortalDesktopRoutes.js +76 -0
- package/dist/server/collections/rolesMultiPortalRoutePolicies.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortalRoutePolicies.js +73 -0
- package/dist/server/collections/rolesMultiPortals.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortals.js +68 -0
- package/dist/server/ensureDefaultRoleMultiPortalAccess.d.ts +11 -0
- package/dist/server/ensureDefaultRoleMultiPortalAccess.js +70 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.d.ts +13 -0
- package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.js +104 -0
- package/dist/server/plugin.d.ts +63 -0
- package/dist/server/plugin.js +2130 -0
- package/package.json +34 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Updated Date: February 24, 2026
|
|
2
|
+
|
|
3
|
+
NocoBase License Agreement
|
|
4
|
+
|
|
5
|
+
NOCOBASE PTE. LTD.,a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at 112 ROBINSON ROAD, #03-01, SINGAPORE ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("The User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
|
|
6
|
+
|
|
7
|
+
This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents can no longer sign a separate license agreement for the sale and delivery of the software.
|
|
8
|
+
|
|
9
|
+
The Company reserves the right to formulate and modify this Agreement from time to time as needed. If there are changes, the Company will announce them in the form of website announcements, without further individual notification. The changed Agreement will automatically take effect once it is announced, becoming part of this Agreement.
|
|
10
|
+
|
|
11
|
+
==============
|
|
12
|
+
1. Definitions
|
|
13
|
+
==============
|
|
14
|
+
|
|
15
|
+
1.1 "Software" refers to the NocoBase kernel and plugins placed in the same code repository as the kernel, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
|
|
16
|
+
|
|
17
|
+
1.2 "Community Edition" refers to the free version of the Software provided to the User through public channels.
|
|
18
|
+
|
|
19
|
+
1.3 "Commercial Edition" refers to the paid version of the Software purchased by the User from the Company or its agents, downloaded through exclusive channels, and includes additional benefits. It consists of three versions: Standard Edition, Professional Edition, and Enterprise Edition.
|
|
20
|
+
|
|
21
|
+
1.4 "Upper Layer Application" refers to a specific business use case application serving internal or external customers of the User, developed based on Software and Commercial Plugins, such as ERP/CRM.
|
|
22
|
+
|
|
23
|
+
1.5 "Customer" refers to the clients who purchase the User's Upper Layer Application.
|
|
24
|
+
|
|
25
|
+
1.6 "Third-Party Open Source Software" refers to open source software provided with Software and Commercial Plugins. They are licensed through various published open source software licenses or copyright notices accompanying such software.
|
|
26
|
+
|
|
27
|
+
===================================
|
|
28
|
+
2. Intellectual Property Protection
|
|
29
|
+
===================================
|
|
30
|
+
|
|
31
|
+
Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software and Commercial Plugins are internationally recognized and protected.
|
|
32
|
+
|
|
33
|
+
=============
|
|
34
|
+
3. Disclaimer
|
|
35
|
+
=============
|
|
36
|
+
|
|
37
|
+
3.1 The User shall not use the Software and Commercial Plugins to engage in activities that contravene applicable laws and regulations or offend against public order or religious prohibitions. All legal liabilities and consequences arising from the User’s use shall be borne by the User.
|
|
38
|
+
|
|
39
|
+
3.2 The Company shall not be liable for any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of profits, business interruption, data loss, or business information disclosure) caused by the User's use of the Software and Commercial Plugins, even if it has been previously informed of the possibility of such damages.
|
|
40
|
+
|
|
41
|
+
===============
|
|
42
|
+
4. License Type
|
|
43
|
+
===============
|
|
44
|
+
|
|
45
|
+
4.1 This Agreement serves as the unified license agreement for NocoBase Software, applying to both the Community Edition and the Commercial Editions.
|
|
46
|
+
|
|
47
|
+
4.2 This Agreement incorporates and references the full text of the Apache License, Version 2.0 ("Apache-2.0", available at: https://www.apache.org/licenses/LICENSE-2.0 ). Users must comply with the Apache-2.0 License as well as the supplementary terms set forth in this Agreement. In case of any inconsistency between Apache-2.0 and this Agreement, the supplementary terms of this Agreement shall prevail.
|
|
48
|
+
|
|
49
|
+
================================================
|
|
50
|
+
5. Rights and Obligations of Open Source License
|
|
51
|
+
================================================
|
|
52
|
+
|
|
53
|
+
5.1 The Software can be used for commercial purposes.
|
|
54
|
+
|
|
55
|
+
5.2 It is not allowed to remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface, except for the main LOGO in the upper left corner of the page.
|
|
56
|
+
|
|
57
|
+
5.3 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
58
|
+
|
|
59
|
+
5.4 It is not allowed to provide to the public any form of no-code, zero-code, low-code, AI platform SaaS/PaaS products using the original or modified Software.
|
|
60
|
+
|
|
61
|
+
===============================
|
|
62
|
+
6. Rights of Commercial License
|
|
63
|
+
===============================
|
|
64
|
+
|
|
65
|
+
6.1 Obtain a permanent commercial license of the Software.
|
|
66
|
+
|
|
67
|
+
6.2 Get software upgrades and exclusive technical support during the upgrade validity period.
|
|
68
|
+
|
|
69
|
+
6.3 The licensed Software can be used for commercial purposes with no restrictions on the number of applications and users.
|
|
70
|
+
|
|
71
|
+
6.4 Can remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface.
|
|
72
|
+
|
|
73
|
+
6.5 The User holding a Professional or Enterprise Edition License can sell Upper Layer Application to its Customers.
|
|
74
|
+
|
|
75
|
+
6.6 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
|
|
76
|
+
|
|
77
|
+
====================================
|
|
78
|
+
7. Obligations of Commercial License
|
|
79
|
+
====================================
|
|
80
|
+
|
|
81
|
+
7.1 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
82
|
+
|
|
83
|
+
7.2 It is not allowed to sell, transfer, lease, share, gift, or distribute the Commercial License.
|
|
84
|
+
|
|
85
|
+
7.3 It is not allowed to sell, transfer, lease, share, or distribute any form of no-code, zero-code, low-code, AI platform, or developer tools developed based on Software.
|
|
86
|
+
|
|
87
|
+
7.4 It is not allowed to provide any form of no-code, zero-code, low-code, AI platform SaaS/PaaS products to the public using the original or modified Software.
|
|
88
|
+
|
|
89
|
+
7.5 It is not allowed for the User holding a Standard Edition license to sell Upper Layer Application to Customers without a Commercial license.
|
|
90
|
+
|
|
91
|
+
7.6 It is not allowed for the User holding a Professional or Enterprise Edition license to sell Upper Layer Application to Customers without a Commercial license with access to further development and configuration.
|
|
92
|
+
|
|
93
|
+
7.7 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
|
|
94
|
+
|
|
95
|
+
7.8 If there are other agreements in the contract for the above obligations, the contract agreement shall prevail.
|
|
96
|
+
|
|
97
|
+
=============================================================
|
|
98
|
+
8. Legal Jurisdiction, Interpretation, and Dispute Resolution
|
|
99
|
+
=============================================================
|
|
100
|
+
|
|
101
|
+
8.1 Except for Mainland China, the interpretation, application, and all matters related to this agreement are subject to the jurisdiction of Singapore law.
|
|
102
|
+
|
|
103
|
+
8.2 Any dispute related to this Agreement should first be resolved through friendly negotiation. If the negotiation fails to resolve the dispute, the dispute should be submitted to the International Chamber of Commerce (ICC) for arbitration. The arbitration venue should be Singapore, conducted in English.
|
|
104
|
+
|
|
105
|
+
8.3 All terms and conditions of this Agreement shall be deemed enforceable to the maximum extent permitted by applicable law. If any term of this Agreement is deemed invalid by any applicable law, the invalidity of that term does not affect the validity of any other term of this Agreement, and it should be deemed that the invalid term has been modified as much as possible to make it valid and enforceable, or if the term cannot be modified, it should be deemed to have been deleted from this Agreement.
|
|
106
|
+
|
|
107
|
+
8.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @nocobase/plugin-multi-portal
|
|
2
|
+
|
|
3
|
+
`@nocobase/plugin-multi-portal` is the commercial portal/permission layer built
|
|
4
|
+
on top of `@nocobase/plugin-ui-layout`. A portal selects an enabled UI Layout
|
|
5
|
+
and adds portal-scoped access and desktop route/menu permissions for roles.
|
|
6
|
+
|
|
7
|
+
UI Layout remains the open-source layout/route base. Multi-portal does not
|
|
8
|
+
replace the UI Layout registry; it composes with it to create isolated portal
|
|
9
|
+
entry points and permission boundaries.
|
|
10
|
+
|
|
11
|
+
The `authCheck` route option is not a complete public-access solution. Public
|
|
12
|
+
portals or layouts must be implemented by plugin code that explicitly registers
|
|
13
|
+
the route and provides matching public APIs, permission boundaries, and resource
|
|
14
|
+
validation.
|
package/client-v2.d.ts
ADDED
package/client-v2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client/index.js');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@nocobase/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-multi-portal",["@nocobase/client"],e):"object"==typeof exports?exports["@nocobase/plugin-multi-portal"]=e(require("@nocobase/client")):t["@nocobase/plugin-multi-portal"]=e(t["@nocobase/client"])}(self,function(t){return function(){"use strict";var e={342:function(e){e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.g.importScripts&&(o=n.g.location+"");var o,i=n.g.document;if(!o&&i&&(i.currentScript&&"SCRIPT"===i.currentScript.tagName.toUpperCase()&&(o=i.currentScript.src),!o)){var c=i.getElementsByTagName("script");if(c.length)for(var u=c.length-1;u>-1&&(!o||!/^http(s?):/.test(o));)o=c[u--].src}if(!o)throw Error("Automatic publicPath is not supported in this browser");n.p=o.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var a={};return!function(){var t="",e="u">typeof document?document.currentScript:null;if(e&&e.src){var r=e.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");r.indexOf("/static/plugins/@nocobase/plugin-multi-portal/dist/client/")>=0&&(t=r.replace(/\/[^\/]+$/,"/"))}if(!t){var o=window.__webpack_public_path__||"";o&&("/"!==o.charAt(o.length-1)&&(o+="/"),t=o+"static/plugins/@nocobase/plugin-multi-portal/dist/client/")}if(!t){var i=window.__nocobase_modern_client_prefix__||"v",c="/"+(i=String(i).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(t=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",a=u.indexOf(c);t=a>=0?u.slice(0,a+1):"/"}t&&(t=t.replace(RegExp("/"+i+"/?$"),"/")),t||(t="/"),"/"!==t.charAt(t.length-1)&&(t+="/"),t+="static/plugins/@nocobase/plugin-multi-portal/dist/client/"}n.p=t}(),!function(){n.r(a),n.d(a,{default:function(){return p}});var t=n(342),e={};function r(t,e,r,n,o,i,c){try{var u=t[i](c),a=u.value}catch(t){r(t);return}u.done?e(a):Promise.resolve(a).then(n,o)}function o(t,e,r){return(o=l()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&c(o,r.prototype),o}).apply(null,arguments)}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return o(t,arguments,i(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,t)})(t)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(l=function(){return!!t})()}var p=function(t){var n;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function o(){var t,e;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return t=o,e=arguments,t=i(t),function(t,e){var r;if(e&&("object"==((r=e)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,l()?Reflect.construct(t,e||[],i(this).constructor):t.apply(this,e))}return o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),t&&c(o,t),n=[{key:"load",value:function(){var t;return(t=function(){return function(t,e){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=e.call(t,i)}catch(t){l=[6,t],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return this.flowEngine.registerModels(e),[2]})},function(){var e=this,n=arguments;return new Promise(function(o,i){var c=t.apply(e,n);function u(t){r(c,o,i,u,a,"next",t)}function a(t){r(c,o,i,u,a,"throw",t)}u(void 0)})}).call(this)}}],function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(o.prototype,n),o}(u(t.Plugin))}(),a}()});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useT(): (str: string) => string;
|
|
10
|
+
export declare function tExpr(key: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { ModelConstructor } from '@nocobase/flow-engine';
|
|
10
|
+
declare const _default: Record<string, ModelConstructor>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from '@nocobase/client';
|
|
10
|
+
export declare class PluginMultiPortalClient extends Plugin {
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export default PluginMultiPortalClient;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).push([["354"],{833:function(t,e,r){r.r(e),r.d(e,{MultiPortalMobileChildPageModel:function(){return _},MultiPortalMobileChildPageTabModel:function(){return R},MultiPortalMobileLayoutModel:function(){return M},MultiPortalMobileRootPageModel:function(){return m},MultiPortalMobileRootPageTabModel:function(){return k}});var n=r(485),o=r(69),u=r(133);function i(t,e,r,n,o,u,i){try{var l=t[u](i),c=l.value}catch(t){r(t);return}l.done?e(c):Promise.resolve(c).then(n,o)}function l(t,e,r){return e=p(e),function(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t,d()?Reflect.construct(e,r||[],p(t).constructor):e.apply(t,r))}function c(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t,e,r){return e&&a(t.prototype,e),r&&a(t,r),t}function s(t,e,r){return(s="u">typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r||t):o.value}})(t,e,r||t)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&O(t,e)}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n;n=r[e],e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n})}return t}function h(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e})(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}function O(t,e){return(O=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function v(t){return t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(d=function(){return!!t})()}function P(t){var e,r=null==(e=t.context)?void 0:e.layout,n=null==r?void 0:r.uid;if("string"==typeof n&&n.trim())return(0,u.Cp)(n)||n}function g(t,e){if(!(t&&(void 0===t?"undefined":v(t))==="object"&&!Array.isArray(t)))return t;t.uiLayouts,t.multiPortals;var r=function(t,e){if(null==t)return{};var r,n,o,u={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(t));o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(u[n]=t[n]);return u}if(u=function(t,e){if(null==t)return{};var r,n,o={},u=Object.getOwnPropertyNames(t);for(n=0;n<u.length;n++)r=u[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r]);return o}(t,e),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(u[n]=t[n]);return u}(t,["uiLayouts","multiPortals"]);return e?h(y({},r),{multiPortals:[e]}):r}function j(t,e,r){var n,o=null==(n=e.props)?void 0:n.route;return h(y({},e),{use:r,props:h(y({},e.props),{route:g(o,P(t))})})}function w(t){t.setProps("route",g(t.props.route,P(t)))}var M=function(t){function e(){return c(this,e),l(this,e,arguments)}return b(e,t),f(e,[{key:"layout",get:function(){var t=s(p(e.prototype),"layout",this);return h(y({},t),{uid:(0,u.wj)(t.uid)})}}]),e}(o.MobileLayoutModel),m=function(t){function e(t){c(this,e);var r=l(this,e,[t]),n=r.createPageTabModelOptions.bind(r);return r.createPageTabModelOptions=function(){return j(r,n(),"MultiPortalMobileRootPageTabModel")},r}return b(e,t),e}(o.MobileRootPageModel),_=function(t){function e(t){c(this,e);var r=l(this,e,[t]),n=r.createPageTabModelOptions.bind(r);return r.createPageTabModelOptions=function(){return j(r,n(),"MultiPortalMobileChildPageTabModel")},r}return b(e,t),e}(o.MobileChildPageModel),k=function(t){function e(){return c(this,e),l(this,e,arguments)}return b(e,t),f(e,[{key:"save",value:function(){var t,r=this,n=this;return(t=function(){return function(t,e){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var a=[l,c];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:return w(this),[4,s(p(e.prototype),"save",r).call(n)];case 1:return t.sent(),w(this),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function l(t){i(u,n,o,l,c,"next",t)}function c(t){i(u,n,o,l,c,"throw",t)}l(void 0)})}).call(this)}}]),e}(n.RootPageTabModel),R=function(t){function e(){return c(this,e),l(this,e,arguments)}return b(e,t),f(e,[{key:"onInit",value:function(t){s(p(e.prototype),"onInit",this).call(this,t),w(this)}}]),e}(n.ChildPageTabModel)}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).push([["499"],{918:function(t,e,n){n.r(e),n.d(e,{PortalEntryActionModel:function(){return I}});var r=n(485),i=n(694),o=n(143),a=n(337),l=n(756);function u(t){var e=null==t?void 0:t.trim();return e&&"/"!==e?"/".concat(e.replace(/^\/+/,"")):"/"}function c(t){var e=u(t).replace(/\/+$/,"");return""===e||"/"===e?"":e}function s(t,e){var n=c(t),r=u(e);return!n||r===n||r.startsWith("".concat(n,"/"))?r:"".concat(n).concat(r)}function p(t){return c((function(t){var e,n,i,o;return"function"==typeof(null==t?void 0:t.getPublicPath)?c((0,r.getV2EffectiveBasePath)({getPublicPath:t.getPublicPath,router:{getBasename:function(){var e,n,r;return(null==(n=t.router)||null==(e=n.getBasename)?void 0:e.call(n))||(null==(r=t.router)?void 0:r.basename)}}})):c((null==t||null==(n=t.router)||null==(e=n.getBasename)?void 0:e.call(n))||(null==t||null==(i=t.router)?void 0:i.basename)||(null==t||null==(o=t.getPublicPath)?void 0:o.call(t)))})(t).replace(/\/(?:apps|_app)\/[^/]+$/,"")||"")}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function y(t,e,n,r,i,o,a){try{var l=t[o](a),u=l.value}catch(t){n(t);return}l.done?e(u):Promise.resolve(u).then(r,i)}function h(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){y(o,r,i,a,l,"next",t)}function l(t){y(o,r,i,a,l,"throw",t)}a(void 0)})}}function v(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function b(t,e,n){return(b="u">typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=d(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n||t):i.value}})(t,e,n||t)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function P(t,e){return(P=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function m(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("u">typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t){if(t){if("string"==typeof t)return f(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return f(t,void 0)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(g=function(){return!!t})()}function A(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:u(0)}),l(a,"throw",{value:u(1)}),l(a,"return",{value:u(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function u(l){return function(u){var c=[l,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=e.call(t,o)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var k="PartitionOutlined",T="buttonSettings",E="general";function O(t){return(null==t?void 0:t.title)||(null==t?void 0:t.routePath)}function w(t,e,n){if(t)return"main"===t.appName?(null==n?void 0:n("Main application"))||"Main":(null==e?void 0:e.title)||(null==e?void 0:e.name)||t.appName}function _(t,e,n){var r=O(t),i=w(t,e,n);return i&&r?"".concat(i," / ").concat(r):r}function j(t,e,n){var r=O(t),i=w(t,e,n);return i&&r?"".concat(i," / ").concat(r):r}function R(t){return t.entryPortalTitle||O(t.entryPortal)}function S(t,e){return t.entryPortalTargetTitle||j(t.entryPortal,t.entryPortalApp,e)||R(t)}function x(t,e){if(t)return e.portals.find(function(e){return t.appName===e.appName&&(!!t.uid&&!!e.uid&&t.uid===e.uid||t.routePath===e.routePath)})}function D(t){return m(new Set(t.filter(function(t){return!!t})))}var I=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function n(){var t,e,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,r=arguments,e=d(e),v(t=function(t,e){var n;if(e&&("object"==((n=e)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,g()?Reflect.construct(e,r||[],d(this).constructor):e.apply(this,r)),"entryActionAvailability","available"),v(t,"availabilityRequest",void 0),v(t,"disposeAppPortalsReaction",void 0),v(t,"defaultProps",{type:"default",title:(0,o.MZ)("Portal"),icon:k}),v(t,"enableEditType",!1),v(t,"enableEditDanger",!1),v(t,"enableEditTitle",!0),v(t,"enableEditIconOnly",!1),t}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&P(n,t),e=[{key:"onInit",value:function(t){b(d(n.prototype),"onInit",this).call(this,t),(0,i.define)(this,{entryActionAvailability:i.observable.ref}),this.syncEntryTitle(),this.checkEntryPortalAvailability()}},{key:"afterAddAsSubModel",value:function(){var t=this,e=this;return h(function(){return A(this,function(r){switch(r.label){case 0:return[4,b(d(n.prototype),"afterAddAsSubModel",t).call(e)];case 1:return r.sent(),this.syncEntryTitle(),[4,this.checkEntryPortalAvailability()];case 2:return r.sent(),[2]}})}).call(this)}},{key:"onMount",value:function(){var t=this;if(b(d(n.prototype),"onMount",this).call(this),!this.disposeAppPortalsReaction){var e=this.context.app;if(e){var r=(0,a.G)(e);this.disposeAppPortalsReaction=(0,i.reaction)(function(){return r.revision},function(){t.checkEntryPortalAvailability()})}}}},{key:"onUnmount",value:function(){var t;b(d(n.prototype),"onUnmount",this).call(this),null==(t=this.disposeAppPortalsReaction)||t.call(this),this.disposeAppPortalsReaction=void 0}},{key:"setProps",value:function(t,e){"string"==typeof t?b(d(n.prototype),"setProps",this).call(this,t,e):b(d(n.prototype),"setProps",this).call(this,t),this.syncEntryTitle()}},{key:"getTitle",value:function(){return b(d(n.prototype),"getTitle",this).call(this)||R(this.props)}},{key:"getTitleFieldDescription",value:function(){var t,e,n,r,i=(n=S(t=this.props,this.t),r=null==(e=t.entryPortal)?void 0:e.routePath,n&&r?"".concat(n," (").concat(r,")"):n||r);return i?"".concat(this.context.t("Target portal",(0,o.Dj)()),": ").concat(i):void 0}},{key:"isEntryActionAvailable",value:function(){return"available"===this.entryActionAvailability}},{key:"getEntryActionUnavailableMessage",value:function(){if("unavailable"===this.entryActionAvailability)return this.context.t("This entry is currently unavailable. Please check the application status.",(0,o.Dj)())}},{key:"isDefaultTitle",value:function(t){return"string"==typeof t&&[this.defaultProps.title,this.context.t("Portal",(0,o.Dj)()),"Portal"].filter(Boolean).includes(t)}},{key:"isDefaultIcon",value:function(t){return"string"==typeof t&&t===k}},{key:"isAutoTitle",value:function(t,e){return"string"==typeof t&&e.includes(t)}},{key:"syncEntryTitle",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=R(this.props),i=D([O(this.props.entryPortal),this.props.entryPortalTitle,S(this.props,this.t)].concat(m(e)));r&&(!this.props.title||this.isDefaultTitle(this.props.title)||this.isAutoTitle(this.props.title,i))&&b(d(n.prototype),"setProps",this).call(this,"title",r);var o=(null==(t=this.props.entryPortal)?void 0:t.icon)||k;o&&(!this.props.icon||this.isDefaultIcon(this.props.icon))&&b(d(n.prototype),"setProps",this).call(this,"icon",o),r&&this.syncTitleStepParams(r,o,i)}},{key:"syncTitleStepParams",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=this.getStepParams(T,E)||{},i={};(!r.title||this.isDefaultTitle(r.title)||this.isAutoTitle(r.title,n))&&(i.title=t),e&&(!r.icon||this.isDefaultIcon(r.icon))&&(i.icon=e),Object.keys(i).length&&this.setStepParams(T,E,i)}},{key:"onClick",value:function(){var t=this.props.entryPortal;if(t&&!this.hidden&&"available"===this.entryActionAvailability){var e=this.context.app,n=e?(0,a.G)(e).payload:void 0,r=n&&x(t,n)||t,i=(null==n?void 0:n.apps.find(function(t){return t.name===r.appName}))||this.props.entryPortalApp,o=function(t,e,n){if("main"===e.appName)return(c=a=e.routePath.trim(),/^[a-z][a-z\d+\-.]*:\/\//i.test(c)||c.startsWith("//"))?a:s(p(t),a);var r=u(e.routePath),i=(null==n?void 0:n.ssoEnabled)===!0,o=e.appName===((null==t?void 0:t.name)||"main");if(null==n?void 0:n.cname){var a,c,f,y=(f=n.cname,/^https?:\/\//i.test(f)||f.startsWith("//")?f:"//".concat(f));return i?"".concat(y.replace(/\/+$/,""),"/app-sso?redirect=").concat(encodeURIComponent(r)):"".concat(y.replace(/\/+$/,"")).concat(u(r))}if(o&&!i)return(0,l.u)(t,e.routePath,e.portalType);var h=i?"/apps/".concat(e.appName,"/app-sso?redirect=").concat(encodeURIComponent(r)):"/apps/".concat(e.appName).concat(r);return(null==t?void 0:t.getRouteUrl)?t.getRouteUrl(h):s(p(t),h)}(e,r,i);window.open(o,"_blank","noopener,noreferrer")}}},{key:"t",get:function(){var t=this;return function(e){return String(t.context.t(e,(0,o.Dj)()))}}},{key:"setEntryActionAvailability",value:function(t){this.entryActionAvailability!==t&&(this.entryActionAvailability=t)}},{key:"getAvailabilityForExistingPortal",value:function(t,e){var n,r,i,o,a=(n=t.appName,r=this.props.entryPortalApp,e.apps.find(function(t){return t.name===n})||((null==r?void 0:r.name)===n?r:void 0));return!(o=!(i=null==a?void 0:a.status)?[]:"string"==typeof i?[i]:Object.values(i).filter(function(t){return"string"==typeof t})).length||o.includes("running")?"available":"unavailable"}},{key:"syncCurrentPortal",value:function(t,e){var r=this.props.entryPortal,i=this.props.entryPortalApp,o=R(this.props),a=S(this.props,this.t),l=_(r,i,this.t),u=e.apps.find(function(e){return e.name===t.appName})||i,c=e.apps.length>0||D(e.portals.map(function(t){return t.appName})).length>1||o===l?_(t,u,this.t):O(t),s=j(t,u,this.t);b(d(n.prototype),"setProps",this).call(this,{entryPortal:t,entryPortalApp:u,entryPortalTitle:c,entryPortalTargetTitle:s}),this.syncEntryTitle(D([o,a,l,O(r)]))}},{key:"checkEntryPortalAvailability",value:function(){var t=this;return this.availabilityRequest||(this.availabilityRequest=this.loadEntryPortalAvailability().finally(function(){t.availabilityRequest=void 0})),this.availabilityRequest}},{key:"loadEntryPortalAvailability",value:function(){return h(function(){var t,e,n,r;return A(this,function(i){switch(i.label){case 0:if(t=this.props.entryPortal,e=this.context.app,!t||!e)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,(0,a.G)(e).load()];case 2:return n=i.sent(),(r=x(t,n))?(this.setEntryActionAvailability(this.getAvailabilityForExistingPortal(r,n)),this.syncCurrentPortal(r,n)):this.setEntryActionAvailability("unavailable"),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})}).call(this)}}],function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(n.prototype,e),n}(r.ActionModel);I.define({label:(0,o.MZ)("Portal")})}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).push([["778"],{177:function(e,t,r){r.r(t),r.d(t,{default:function(){return A}});var n=r(485),u=r(694),a=r(625),o=r(59),i=r(155),l=r.n(i),c=r(143);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t,r,n,u,a,o){try{var i=e[a](o),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,u)}function f(e){return function(){var t=this,r=arguments;return new Promise(function(n,u){var a=e.apply(t,r);function o(e){d(a,n,u,o,i,"next",e)}function i(e){d(a,n,u,o,i,"throw",e)}o(void 0)})}}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function p(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,u=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=u){var a=[],o=!0,i=!1;try{for(u=u.call(e);!(o=(r=u.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==u.return||u.return()}finally{if(i)throw n}}return a}}(e,t)||b(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function b(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}function g(e,t){var r,n,u,a={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:l(0)}),i(o,"throw",{value:l(1)}),i(o,"return",{value:l(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(u=2&c[0]?n.return:c[0]?n.throw||((u=n.return)&&u.call(n),0):n.next)&&!(u=u.call(n,c[1])).done)return u;switch(n=0,u&&(c=[2&c[0],u.value]),c[0]){case 0:case 1:u=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(u=(u=a.trys).length>0&&u[u.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!u||c[1]>u[0]&&c[1]<u[3])){a.label=c[1];break}if(6===c[0]&&a.label<u[1]){a.label=u[1],u=c;break}if(u&&a.label<u[2]){a.label=u[2],a.ops.push(c);break}u[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=u=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function w(e){return e&&(void 0===e?"undefined":v(e))==="object"?{data:Array.isArray(e.data)?e.data:[]}:{}}function S(e){return Array.isArray(e)?e.flatMap(function(e){return[e.id].concat(y(S(e.children)))}):[]}function k(e){var t=new Set;return e.filter(function(e){return!t.has(e)&&(t.add(e),!0)})}function M(e,t){return"string"!=typeof e?t("Unnamed"):t(e)||t("Unnamed")}function A(e){var t,r=(0,u.useFlowContext)(),s=(0,c.kj)(),d=o.theme.useToken().token,b=e.activeRole,A="multi-portals"===e.activeKey,P=m((0,i.useState)([]),2),I=P[0],x=P[1],O=m((0,i.useState)(),2),j=O[0],C=O[1],E=m((0,i.useState)([]),2),R=E[0],N=E[1],T=m((0,i.useState)(),2),_=T[0],D=T[1],F=m((0,i.useState)(!1),2),z=F[0],U=F[1],q=m((0,i.useState)(""),2),K=q[0],L=q[1],B=(0,i.useMemo)(function(){return b?r.api.resource("roles.multiPortals",b.name):void 0},[r.api,b]),G=(0,i.useMemo)(function(){return r.api.resource("rolesMultiPortalDesktopRoutes")},[r.api]),$=(0,i.useMemo)(function(){return r.api.resource("rolesMultiPortalRoutePolicies")},[r.api]),H=(0,a.useRequest)(function(){return f(function(){var e,t;return g(this,function(n){switch(n.label){case 0:return[4,r.api.request({url:"multiPortals:listEnabled",method:"get",skipNotify:!0})];case 1:return[2,null!=(e=w(null==(t=n.sent())?void 0:t.data).data)?e:[]]}})})()},{ready:A,refreshDeps:[A]}),J=(0,a.useRequest)(function(){return f(function(){var e,t;return g(this,function(r){switch(r.label){case 0:if(!B)return[2,[]];return[4,B.list({paginate:!1})];case 1:return[2,(null!=(e=w(null==(t=r.sent())?void 0:t.data).data)?e:[]).map(function(e){return e.uid}).filter(function(e){return"string"==typeof e&&!!e})]}})})()},{ready:A&&!!B,refreshDeps:[A,null==b?void 0:b.name],onSuccess:function(e){x(e)}}),Q=(0,i.useMemo)(function(){var e;return null==(e=H.data)?void 0:e.find(function(e){return e.uid===j})},[H.data,j]),V=Q?M(Q.title,s):"",W=Q?s("Configure routes permissions for {{portal}}",{portal:V}):s("Routes permissions"),X=(0,a.useRequest)(function(){return f(function(){var e,t;return g(this,function(n){switch(n.label){case 0:if(!j)return[2,[]];return[4,r.api.request({url:"desktopRoutes:listRolePermissionTargets",method:"get",params:{portal:j},skipNotify:!0})];case 1:var u;return[2,null!=(e=(!(u=null==(t=n.sent())?void 0:t.data)||(void 0===u?"undefined":v(u))!=="object"?{}:{data:Array.isArray(u.data)?u.data:[]}).data)?e:[]]}})})()},{ready:A&&!!j,refreshDeps:[A,j]}),Y=(0,i.useMemo)(function(){return function e(t,r){return Array.isArray(t)?t.map(function(t){var n,u,a=e(t.children,t.id);return{id:t.id,title:t.title,hidden:t.hidden,routePath:"string"==typeof(u=null==(n=t.options)?void 0:n.path)&&u.trim()?u.trim():void 0,parentId:r,children:a.length?a:void 0}}):[]}(X.data)},[X.data]),Z=(0,i.useMemo)(function(){return S(Y)},[Y]),ee=(0,i.useMemo)(function(){return function e(t){return t.flatMap(function(t){var r;return[t].concat(y(e(null!=(r=t.children)?r:[])))})}(Y)},[Y]),et=(0,i.useMemo)(function(){return new Map(ee.map(function(e){return[e.id,e]}))},[ee]),er=(0,i.useMemo)(function(){return function e(t,r,n){var u=r.trim().toLowerCase();return u?t.reduce(function(t,r){var a,o,i,l=e(null!=(a=r.children)?a:[],u,n),c=M(r.title,n).toLowerCase(),s=null!=(o=null==(i=r.routePath)?void 0:i.toLowerCase())?o:"";return(c.includes(u)||s.includes(u)||l.length)&&t.push(p(h({},r),{children:l.length?l:void 0})),t},[]):t}(function e(t){return t.reduce(function(t,r){if(r.hidden)return t;var n,u=e(null!=(n=r.children)?n:[]);return t.push(p(h({},r),{children:u.length?u:void 0})),t},[])}(Y),K,s)},[Y,K,s]),en=(0,i.useMemo)(function(){return S(er)},[er]),eu=(0,i.useMemo)(function(){return function e(t,r){return Array.isArray(t)?k(t.flatMap(function(t){var n,u=null!=(n=r.get(t.id))?n:t;return[t.id].concat(y(S(u.children)),y(e(t.children,r)))})):[]}(er,et)},[et,er]),ea=(0,i.useMemo)(function(){var e=new Set(R);return en.filter(function(t){return e.has(t)}).length},[R,en]),eo=X.error?s("Failed to load routes"):K.trim()?s("No matching routes"):s("No routes"),ei=(0,a.useRequest)(function(){return f(function(){var e;return g(this,function(t){switch(t.label){case 0:if(!b||!j)return[2,[]];return[4,G.list({paginate:!1,filter:{roleName:b.name,multiPortalUid:j}})];case 1:var r;return[2,(!(r=null==(e=t.sent())?void 0:e.data)||(void 0===r?"undefined":v(r))!=="object"?[]:Array.isArray(r.data)?r.data:[]).map(function(e){return e.desktopRouteId}).filter(function(e){return"number"==typeof e})]}})})()},{ready:A&&!!b&&!!j,refreshDeps:[A,null==b?void 0:b.name,j],onSuccess:function(e){N(e)}}),el=(0,a.useRequest)(function(){return f(function(){var e;return g(this,function(t){switch(t.label){case 0:if(!b||!j)return[2,void 0];return[4,$.list({paginate:!1,filter:{roleName:b.name,multiPortalUid:j}})];case 1:return[2,function(e){if(e&&(void 0===e?"undefined":v(e))==="object")return Array.isArray(e.data)?e.data[0]:void 0}(null==(e=t.sent())?void 0:e.data)]}})})()},{ready:A&&!!b&&!!j,refreshDeps:[A,null==b?void 0:b.name,j],onSuccess:function(e){D(e),U(!!(null==e?void 0:e.allowNewMenu))}});(0,i.useEffect)(function(){C(void 0),N([]),D(void 0),U(!1),L("")},[null==b?void 0:b.name]),(0,i.useEffect)(function(){N([]),D(void 0),U(!1),L("")},[j]);var ec=(0,a.useMemoizedFn)(function(e){return f(function(){var t;return g(this,function(n){switch(n.label){case 0:var u,a;if(!B)return[2];u=new Set(I),a=new Set(e),t={add:e.filter(function(e){return!u.has(e)}),remove:I.filter(function(e){return!a.has(e)})},n.label=1;case 1:if(n.trys.push([1,7,,9]),!t.remove.length)return[3,3];return[4,B.remove({values:t.remove})];case 2:n.sent(),n.label=3;case 3:if(!t.add.length)return[3,5];return[4,B.add({values:t.add})];case 4:n.sent(),n.label=5;case 5:return[4,J.refreshAsync()];case 6:return n.sent(),x(e),r.message.success(s("Saved successfully")),[3,9];case 7:return n.sent(),[4,J.refreshAsync().catch(function(){})];case 8:return n.sent(),[3,9];case 9:return[2]}})})()}),es=(0,a.useMemoizedFn)(function(e){return f(function(){return g(this,function(t){switch(t.label){case 0:return[4,ec(I.includes(e.uid)?I.filter(function(t){return t!==e.uid}):y(I).concat([e.uid]))];case 1:return t.sent(),[2]}})})()}),ed=(0,a.useMemoizedFn)(function(t){return f(function(){var n;return g(this,function(u){switch(u.label){case 0:if(!b)return[2];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r.api.resource("roles").update({filterByTk:b.name,values:t})];case 2:return u.sent(),[3,4];case 3:return u.sent(),[2];case 4:return null==(n=e.onRoleChange)||n.call(e,h({},b,t)),r.message.success(s("Saved successfully")),[2]}})})()}),ef=(0,i.useMemo)(function(){return[{dataIndex:"title",title:s("Portal"),render:function(e){return M(e,s)}},{dataIndex:"accessible",title:s("Allow access"),render:function(e,t){var r=M(t.title,s);return l().createElement(o.Checkbox,{"aria-label":s("Allow access to {{portal}}",{portal:r}),checked:I.includes(t.uid),onChange:function(){return es(t)}})}},{dataIndex:"routePermissions",title:s("Routes permissions"),render:function(e,t){var r=M(t.title,s);return l().createElement(o.Button,{"aria-label":s("Configure routes permissions for {{portal}}",{portal:r}),type:"link",onClick:function(){return C(t.uid)}},s("Configure"))}}]},[I,s,es]),eh=(0,a.useMemoizedFn)(function(e){return f(function(){var t,n,u,a,o,i,l,c;return g(this,function(d){switch(d.label){case 0:var f,h,p,m,v;if(!b||!j)return[2];h=new Set((f={currentRouteIds:Z,nextSelectedIds:e,selectedIds:R}).currentRouteIds),p=new Set(f.selectedIds.filter(function(e){return h.has(e)})),m=new Set(f.nextSelectedIds.filter(function(e){return h.has(e)})),t={add:(v=k(y(f.currentRouteIds).concat(y(f.selectedIds),y(f.nextSelectedIds)))).filter(function(e){return h.has(e)&&m.has(e)&&!p.has(e)}),remove:v.filter(function(e){return h.has(e)&&p.has(e)&&!m.has(e)})},d.label=1;case 1:if(d.trys.push([1,13,,15]),!t.remove.length)return[3,3];return[4,G.destroy({filter:{roleName:b.name,multiPortalUid:j,desktopRouteId:t.remove}})];case 2:d.sent(),d.label=3;case 3:n=!0,u=!1,a=void 0,d.label=4;case 4:d.trys.push([4,9,10,11]),o=t.add[Symbol.iterator](),d.label=5;case 5:if(n=(i=o.next()).done)return[3,8];return l=i.value,[4,G.create({values:{roleName:b.name,multiPortalUid:j,desktopRouteId:l}})];case 6:d.sent(),d.label=7;case 7:return n=!0,[3,5];case 8:return[3,11];case 9:return c=d.sent(),u=!0,a=c,[3,11];case 10:try{n||null==o.return||o.return()}finally{if(u)throw a}return[7];case 11:return[4,ei.refreshAsync()];case 12:return d.sent(),N(e),r.message.success(s("Saved successfully")),[3,15];case 13:return d.sent(),[4,ei.refreshAsync().catch(function(){})];case 14:return d.sent(),[3,15];case 15:return[2]}})})()}),ep=(0,a.useMemoizedFn)(function(e){return f(function(){return g(this,function(t){switch(t.label){case 0:if(!b||!j)return[2];t.label=1;case 1:if(t.trys.push([1,7,,9]),!_)return[3,3];return[4,$.update({filter:{roleName:b.name,multiPortalUid:j},values:{allowNewMenu:e}})];case 2:return t.sent(),[3,5];case 3:return[4,$.create({values:{roleName:b.name,multiPortalUid:j,allowNewMenu:e}})];case 4:t.sent(),t.label=5;case 5:return[4,el.refreshAsync()];case 6:return t.sent(),U(e),r.message.success(s("Saved successfully")),[3,9];case 7:return t.sent(),[4,el.refreshAsync().catch(function(){})];case 8:return t.sent(),[3,9];case 9:return[2]}})})()}),em=(0,a.useMemoizedFn)(function(){return f(function(){var e,t;return g(this,function(r){switch(r.label){case 0:return e=new Set(R),t=new Set(en),[4,eh(en.length&&en.every(function(t){return e.has(t)})?R.filter(function(e){return!t.has(e)&&!eu.includes(e)}):k(y(R).concat(y(eu))))];case 1:return r.sent(),[2]}})})()}),ey=(0,a.useMemoizedFn)(function(e){return f(function(){var t,r,n,u,a,o,i;return g(this,function(l){switch(l.label){case 0:return r=R.includes(e.id),n=S((null!=(t=et.get(e.id))?t:e).children),u=r?R.filter(function(t){return t!==e.id&&!n.includes(t)}):k(y(R).concat([e.id],y(n))),e.parentId&&(i=null==(o=et.get(e.parentId))||null==(a=o.children)?void 0:a.some(function(e){return u.includes(e.id)}),r&&!i&&(u=u.filter(function(t){return t!==e.parentId})),r||u.includes(e.parentId)||u.push(e.parentId)),[4,eh(u)];case 1:return l.sent(),[2]}})})()}),ev=(0,i.useMemo)(function(){return[{dataIndex:"title",title:s("Route name"),render:function(e){return M(e,s)}},{dataIndex:"accessible",title:l().createElement(o.Checkbox,{checked:!!en.length&&ea===en.length,disabled:!en.length,indeterminate:ea>0&&ea<en.length,onChange:em},s("Allow access")),render:function(e,t){var r=M(t.title,s);return l().createElement(o.Checkbox,{"aria-label":s("Allow access to {{route}}",{route:r}),checked:R.includes(t.id),onChange:function(){return ey(t)}})}}]},[R,em,s,ey,en.length,ea]);return b?l().createElement(l().Fragment,null,l().createElement(o.Space,{direction:"vertical",size:d.marginSM,style:{width:"100%"}},l().createElement(o.Typography.Text,{strong:!0},s("Portals")),l().createElement(o.Checkbox,{checked:!!b.allowNewMultiPortal,onChange:function(e){ed({allowNewMultiPortal:e.target.checked})}},s("New portals are allowed to be accessed by default")),l().createElement(n.Table,{rowKey:"uid",loading:H.loading||J.loading,pagination:!1,columns:ef,dataSource:null!=(t=H.data)?t:[],locale:{emptyText:H.error?s("Failed to load portals"):s("No portals")}})),l().createElement(o.Drawer,{title:W,"aria-label":W,width:d.screenLG,open:A&&!!Q,onClose:function(){return C(void 0)}},Q?l().createElement(o.Space,{direction:"vertical",size:d.marginSM,style:{width:"100%"}},l().createElement(o.Checkbox,{checked:z,onChange:function(e){return ep(e.target.checked)}},s("New routes are allowed to be accessed by default")),l().createElement(o.Input.Search,{allowClear:!0,"aria-label":s("Search routes"),placeholder:s("Search routes"),value:K,onChange:function(e){return L(e.target.value)}}),l().createElement(n.Table,{rowKey:"id",loading:X.loading||ei.loading||el.loading,pagination:!1,expandable:{defaultExpandAllRows:!1,expandedRowKeys:K.trim()?en:void 0},columns:ev,dataSource:er,locale:{emptyText:eo}})):null)):l().createElement(o.Typography.Text,{type:"secondary"},s("Select a role to configure permissions"))}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).push([["845"],{924:function(e,t,r){r.r(t),r.d(t,{createMultiPortal:function(){return P},deleteMultiPortals:function(){return I},updateMultiPortal:function(){return T}});var n=r(375),a=r(485),l=r(694),o=r(625),i=r(59),u=r(155),c=r.n(u),s=r(337),d=r(143),p=r(756);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r,n,a,l,o){try{var i=e[l](o),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,a)}function y(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var l=e.apply(t,r);function o(e){f(l,n,a,o,i,"next",e)}function i(e){f(l,n,a,o,i,"throw",e)}o(void 0)})}}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l=[],o=!0,i=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw n}}return l}}(e,t)||E(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function E(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}}function S(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:u(0)}),i(o,"throw",{value:u(1)}),i(o,"return",{value:u(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){l.label=c[1];break}if(6===c[0]&&l.label<a[1]){l.label=a[1],a=c;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(c);break}a[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function w(e,t){if(e&&(void 0===e?"undefined":v(e))==="object")return e[t]}function k(e){return"string"==typeof e&&e?e:void 0}function P(e){return y(function(){return S(this,function(t){switch(t.label){case 0:return[4,e.resource.create({values:e.values})];case 1:return t.sent(),e.onSubmitted(),[2]}})})()}function T(e){return y(function(){return S(this,function(t){switch(t.label){case 0:return[4,e.resource.update({filterByTk:e.filterByTk,values:e.values})];case 1:return t.sent(),e.onSubmitted(),[2]}})})()}function I(e){return y(function(){return S(this,function(t){switch(t.label){case 0:return[4,e.resource.destroy({filterByTk:e.filterByTk})];case 1:return t.sent(),e.onDeleted(),[2]}})})()}var F="no-code",O=["no-code","ai"],j="nocobase",A="main",x={portalType:F,enabled:!0},C={paddingInline:0},B={alignItems:"flex-start"},M="multi-portal-described-radio",D="\n.".concat(M," .ant-radio {\n align-self: flex-start;\n margin-top: 3px;\n}\n"),_=new Set(["__default_portal__"]),q=/^[a-z0-9_-]+$/,L=c().forwardRef(function(e,t){return c().createElement("div",{ref:t},c().createElement(a.IconPicker,e))});function N(e){var t=null==e?void 0:e.trim();if(t&&!q.test(t))return"Portal name can only contain lowercase letters, numbers, hyphens, and underscores"}function R(e){return"string"!=typeof e?null:e.trim()||null}function z(e){var t=R(e);return t&&O.some(function(e){return e===t})?t:F}function U(e){var t=R(e);return"nocobase"===t||"git"===t?t:j}function G(e){var t,r=e.portalName.trim(),n=N(r);if(n)throw Error(n);return h(b({},e),{title:e.title.trim(),uid:e.uid.trim(),portalType:z(e.portalType),portalName:r,routePath:"/".concat(r),icon:"string"!=typeof(t=e.icon)?null:t.trim()||null,options:function(e){if("ai"===z(e.portalType)){var t,r=U(e.sourceStorage);return"git"!==r?{sourceStorage:r}:{sourceStorage:r,git:{repo:(null!=(t=e.gitRepo)?t:"").trim(),branch:R(e.gitBranch)||A,path:R(e.gitPath)||""}}}}(e)})}function V(e){var t,r,n=function(e){if(e&&(void 0===e?"undefined":v(e))==="object"){var t,r,n,a=U(e.sourceStorage);return"git"!==a?h(b({},e),{sourceStorage:a}):h(b({},e),{sourceStorage:a,git:h(b({},e.git),{repo:R(null==(t=e.git)?void 0:t.repo)||"",branch:R(null==(r=e.git)?void 0:r.branch)||A,path:R(null==(n=e.git)?void 0:n.path)||""})})}}(e.options);return b({title:e.title,uid:e.uid,portalType:z(e.portalType),portalName:e.portalName,routePath:e.routePath,uiLayoutUid:e.uiLayoutUid||(null==(r=e.uiLayout)?void 0:r.uid)||"",icon:null!=(t=e.icon)?t:null,enabled:e.enabled},n?{options:n}:{})}function K(e){return h(b({},e),{defaultPortal:_.has(e.uid)})}function $(e){var t=e.record,r=e.onSubmitted,n=(0,d.kj)(),s=(0,l.useFlowContext)(),p=i.theme.useToken().token,m=i.App.useApp().notification,f=g(i.Form.useForm(),1)[0],v=g((0,u.useState)(!1),2),E=v[0],I=v[1],F=(0,u.useMemo)(function(){return s.api.resource("multiPortals")},[s.api]),O=(0,o.useRequest)(function(){return y(function(){var e,t;return S(this,function(r){switch(r.label){case 0:return[4,s.api.request({url:"uiLayouts:listEnabled",method:"get",params:{pageSize:200,sort:["uid"]},skipNotify:!0})];case 1:return[2,Array.isArray(null==(t=r.sent())||null==(e=t.data)?void 0:e.data)?t.data.data:[]]}})})()}),C=(0,u.useMemo)(function(){var e;return(null!=(e=O.data)?e:[]).map(function(e){return{value:e.uid,label:"desktop"===e.layoutType?n("Desktop"):"mobile"===e.layoutType?n("Mobile"):e.title||e.uid}})},[O.data,n]);(0,u.useEffect)(function(){if(!(t||f.getFieldValue("uiLayoutUid"))){var e,r,n=null==(e=O.data)||null==(r=e.find(function(e){return"desktop"===e.layoutType}))?void 0:r.uid;n&&f.setFieldValue("uiLayoutUid",n)}},[f,O.data,t]);var _=(0,u.useMemo)(function(){var e,r,n,a,o;return t?(o=(a=V(t)).options,h(b({},a),{sourceStorage:U(null==o?void 0:o.sourceStorage),gitRepo:(null==o||null==(e=o.git)?void 0:e.repo)||"",gitBranch:(null==o||null==(r=o.git)?void 0:r.branch)||A,gitPath:(null==o||null==(n=o.git)?void 0:n.path)||""})):h(b({},x),{uid:"portal-".concat((0,l.randomId)()),sourceStorage:j,gitBranch:A,gitPath:""})},[t]),q=(0,u.useCallback)(function(){return y(function(){var e,a;return S(this,function(l){switch(l.label){case 0:return[4,f.validateFields()];case 1:e=G.apply(void 0,[l.sent()]),I(!0),l.label=2;case 2:if(l.trys.push([2,7,8,9]),!t)return[3,4];return[4,T({resource:F,filterByTk:t.uid,values:e,onSubmitted:r})];case 3:return l.sent(),[3,6];case 4:return[4,P({resource:F,values:e,onSubmitted:r})];case 5:l.sent(),l.label=6;case 6:return[3,9];case 7:throw a=l.sent(),m.error({message:function(e){var t=w(e,"response"),r=w(t,"data"),n=w(r,"errors");if(Array.isArray(n)){var a=n.map(function(e){return k(w(e,"message"))}).filter(function(e){return!!e}).join("\n");if(a)return a}return k(w(w(r,"error"),"message"))||k(w(r,"message"))||k(w(e,"message"))}(a)||n("Failed to save portal"),role:"alert"}),a;case 8:return I(!1),[7];case 9:return[2]}})})()},[f,m,r,t,F,n]);return c().createElement(a.DrawerFormLayout,{title:t?n("Edit portal"):n("Add portal"),onSubmit:q,submitting:E,submitText:n("Submit"),cancelText:n("Cancel")},c().createElement("style",null,D),c().createElement(i.Form,{form:f,layout:"vertical",initialValues:_},c().createElement(i.Form.Item,{name:"title",label:n("Title"),rules:[{required:!0,whitespace:!0,message:n("Title field is required")}]},c().createElement(i.Input,null)),c().createElement(i.Form.Item,{name:"uid",hidden:!0,rules:[{required:!0,whitespace:!0,message:n("The field value is required")}]},c().createElement(i.Input,null)),c().createElement(i.Form.Item,{name:"portalName",label:n("Portal name"),rules:[{required:!0,whitespace:!0,message:n("The field value is required")},{validator:function(e,t){var r=N(t);return r?Promise.reject(Error(n(r))):Promise.resolve()}}]},c().createElement(i.Input,{disabled:null==t?void 0:t.defaultPortal})),c().createElement(i.Form.Item,{name:"portalType",label:n("Portal type"),htmlFor:"multi-portal-portal-type-no-code",rules:[{required:!0,message:n("The field value is required")}]},c().createElement(i.Radio.Group,{disabled:null==t?void 0:t.defaultPortal},c().createElement(i.Space,{direction:"vertical"},c().createElement(i.Radio,{className:M,id:"multi-portal-portal-type-no-code",style:B,value:"no-code"},c().createElement("span",null,n("No-code portal")),c().createElement("div",{style:{color:p.colorTextDescription,fontSize:p.fontSizeSM}},n("Create with visual configuration. AI can help adjust the configuration. Path: /v/<name>"))),c().createElement(i.Radio,{className:M,style:B,value:"ai"},c().createElement("span",null,n("AI portal")),c().createElement("div",{style:{color:p.colorTextDescription,fontSize:p.fontSizeSM}},n("Create with AI Agent and code. Users can request changes in natural language. Path: /x/<name>")))))),c().createElement(i.Form.Item,{noStyle:!0,shouldUpdate:function(e,t){return e.portalType!==t.portalType}},function(e){return"ai"===(0,e.getFieldValue)("portalType")?c().createElement(c().Fragment,null,c().createElement(i.Form.Item,{name:"sourceStorage",label:n("Source storage"),htmlFor:"multi-portal-source-storage-nocobase",rules:[{required:!0,message:n("The field value is required")}]},c().createElement(i.Radio.Group,null,c().createElement(i.Space,{direction:"vertical"},c().createElement(i.Radio,{className:M,id:"multi-portal-source-storage-nocobase",style:B,value:"nocobase"},c().createElement("span",null,n("NocoBase")),c().createElement("div",{style:{color:p.colorTextDescription,fontSize:p.fontSizeSM}},n("Manage portal source code in NocoBase."))),c().createElement(i.Radio,{className:M,style:B,value:"git"},c().createElement("span",null,n("Git")),c().createElement("div",{style:{color:p.colorTextDescription,fontSize:p.fontSizeSM}},n("Manage portal source code in a Git repository.")))))),c().createElement(i.Form.Item,{noStyle:!0,shouldUpdate:function(e,t){return e.sourceStorage!==t.sourceStorage}},function(e){return"git"===(0,e.getFieldValue)("sourceStorage")?c().createElement(c().Fragment,null,c().createElement(i.Form.Item,{name:"gitRepo",label:n("Git repository URL"),rules:[{required:!0,whitespace:!0,message:n("The field value is required")}]},c().createElement(i.Input,{placeholder:"git@github.com:nocobase/customer-portal.git"})),c().createElement(i.Form.Item,{name:"gitBranch",label:n("Git branch")},c().createElement(i.Input,{placeholder:A})),c().createElement(i.Form.Item,{name:"gitPath",label:n("Git path"),extra:n("Directory inside the Git repository for this portal. Leave empty for the root.")},c().createElement(i.Input,{placeholder:""}))):null})):null}),c().createElement(i.Form.Item,{name:"uiLayoutUid",label:n("Layout"),dependencies:["portalType"],rules:[{validator:function(e,t){return"ai"===f.getFieldValue("portalType")||t?Promise.resolve():Promise.reject(Error(n("The field value is required")))}}]},c().createElement(i.Select,{disabled:!!t||(null==t?void 0:t.defaultPortal),loading:O.loading,options:C,showSearch:!0,optionFilterProp:"label"})),c().createElement(i.Form.Item,{name:"icon",label:n("Icon")},c().createElement(L,null)),c().createElement(i.Form.Item,{name:"enabled",label:n("Enabled"),valuePropName:"checked",extra:n("When disabled, this portal will not be registered or accessible.")},c().createElement(i.Switch,null))))}L.displayName="IconPickerFormControl",t.default=function(){var e,t=(0,d.kj)(),r=(0,l.useFlowContext)(),f=i.theme.useToken().token,v=i.App.useApp(),w=v.message,k=v.modal,P=g((0,u.useState)([]),2),F=P[0],O=P[1],j=g((0,u.useState)([]),2),A=j[0],x=j[1],B=(0,u.useMemo)(function(){return r.api.resource("multiPortals")},[r.api]),M=(0,o.useRequest)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return y(function(){var t,r;return S(this,function(n){switch(n.label){case 0:return[4,B.list({page:e,pageSize:20,sort:["createdAt"],appends:["uiLayout"]})];case 1:return[2,null!=(t=null==(r=n.sent())?void 0:r.data)?t:{data:[]}]}})})()}),D=M.data,_=M.loading,q=(0,u.useMemo)(function(){return Array.isArray(null==D?void 0:D.data)?D.data.map(K):[]},[null==D?void 0:D.data]),L=(0,u.useMemo)(function(){var e,t,r,n=null==D?void 0:D.meta;return!!n&&{total:null!=(e=n.count)?e:q.length,pageSize:null!=(t=n.pageSize)?t:20,current:null!=(r=n.page)?r:1}},[null==D?void 0:D.meta,q.length]),N=(0,u.useCallback)(function(){var e,t;O([]),M.run(null!=(e=null==D||null==(t=D.meta)?void 0:t.page)?e:1)},[M,null==D||null==(e=D.meta)?void 0:e.page]),R=(0,u.useCallback)(function(){(0,s.G)(r.app).reload(r.api).catch(function(e){console.error("[NocoBase] Failed to refresh portal entry actions.",e)})},[r.api,r.app]),z=(0,u.useCallback)(function(){N(),R()},[R,N]),U=(0,u.useCallback)(function(e){r.viewer.drawer({width:f.screenMD,closable:!0,content:function(){return c().createElement($,{record:e,onSubmitted:z})}})},[r.viewer,z,f.screenMD]),G=(0,u.useCallback)(function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};k.confirm({title:t("Delete portal"),content:c().createElement(c().Fragment,null,c().createElement("div",null,r.isBatch?t("Are you sure you want to delete the selected Multi-portal records?"):t("Are you sure you want to delete it?")),c().createElement("div",null,t("The corresponding portal directory will also be deleted."))),onOk:function(){return y(function(){return S(this,function(t){switch(t.label){case 0:return[4,I({resource:B,filterByTk:e,onDeleted:z})];case 1:return t.sent(),[2]}})})()}})},[k,z,B,t]),W=(0,u.useCallback)(function(e,r){return y(function(){return S(this,function(n){switch(n.label){case 0:x(function(t){return t.includes(e.uid)?t:((function(e){if(Array.isArray(e))return m(e)})(t)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||E(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([e.uid])}),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,T({resource:B,filterByTk:e.uid,values:h(b({},V(e)),{enabled:r}),onSubmitted:z})];case 2:return n.sent(),w.success(t("Updated successfully")),[3,4];case 3:return x(function(t){return t.filter(function(t){return t!==e.uid})}),[7];case 4:return[2]}})})()},[w,z,B,t]),H=(0,u.useMemo)(function(){return[{title:t("Title"),dataIndex:"title",ellipsis:!0},{title:t("Access path"),dataIndex:"routePath",ellipsis:!0,render:function(e,t){var n=(0,p.u)(r.app,t.routePath,t.portalType);return c().createElement(i.Button,{type:"link",href:n,target:"_blank",rel:"noopener noreferrer",style:C},n)}},{title:t("Portal name"),dataIndex:"portalName",ellipsis:!0},{title:t("Layout"),dataIndex:"uiLayoutUid",ellipsis:!0,render:function(e,t){var r,n,a,l=(null==(n=t.uiLayout)?void 0:n.title)||t.uiLayoutUid;return l?c().createElement(i.Tag,{color:"desktop"===(r=null==(a=t.uiLayout)?void 0:a.layoutType)?"blue":"mobile"===r?"purple":"default"},l):null}},{title:t("Enabled"),dataIndex:"enabled",render:function(e,r){return c().createElement(i.Switch,{"aria-label":t("Enabled"),checked:e,loading:A.includes(r.uid),size:"small",onChange:function(e){return y(function(){return S(this,function(t){switch(t.label){case 0:return[4,W(r,e)];case 1:return t.sent(),[2]}})})()}})}},{title:t("Actions"),render:function(e,n){return c().createElement(i.Space,{size:"small"},c().createElement(i.Button,{type:"link",href:(0,p.u)(r.app,n.routePath,n.portalType),target:"_blank",rel:"noopener noreferrer",style:C},t("View")),c().createElement(i.Button,{type:"link",style:C,onClick:function(){return U(n)}},t("Edit")),c().createElement(i.Button,{type:"link",style:C,onClick:function(){return G(n.uid)}},t("Delete")))}}]},[r.app,G,W,U,t,A]),J=(0,u.useCallback)(function(e){var t;M.run(null!=(t=e.current)?t:1)},[M]);return c().createElement(i.Card,null,c().createElement(i.Flex,{justify:"flex-end",style:{marginBottom:f.marginMD}},c().createElement(i.Space,null,c().createElement(i.Button,{icon:c().createElement(n.ReloadOutlined,null),onClick:z},t("Refresh")),c().createElement(i.Button,{icon:c().createElement(n.DeleteOutlined,null),disabled:0===F.length,onClick:function(){return G(F,{isBatch:!0})}},t("Delete")),c().createElement(i.Button,{type:"primary",icon:c().createElement(n.PlusOutlined,null),onClick:function(){return U()}},t("Add portal")))),c().createElement(a.Table,{rowKey:"uid",loading:_,dataSource:q,columns:H,pagination:L,rowSelection:{selectedRowKeys:F,onChange:function(e){return O(e)}},onChange:J}))}}}]);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { ActionModel } from '@nocobase/client-v2';
|
|
10
|
+
import type { ButtonProps } from 'antd/es/button';
|
|
11
|
+
import type { AppPortalAppItem, AppPortalItem } from './types';
|
|
12
|
+
type PortalEntryActionProps = ButtonProps & {
|
|
13
|
+
entryPortal?: AppPortalItem;
|
|
14
|
+
entryPortalTitle?: string;
|
|
15
|
+
entryPortalTargetTitle?: string;
|
|
16
|
+
entryPortalApp?: AppPortalAppItem;
|
|
17
|
+
};
|
|
18
|
+
type EntryActionAvailability = 'available' | 'unavailable';
|
|
19
|
+
export declare class PortalEntryActionModel extends ActionModel {
|
|
20
|
+
props: PortalEntryActionProps;
|
|
21
|
+
entryActionAvailability: EntryActionAvailability;
|
|
22
|
+
private availabilityRequest?;
|
|
23
|
+
private disposeAppPortalsReaction?;
|
|
24
|
+
defaultProps: PortalEntryActionProps;
|
|
25
|
+
enableEditType: boolean;
|
|
26
|
+
enableEditDanger: boolean;
|
|
27
|
+
enableEditTitle: boolean;
|
|
28
|
+
enableEditIconOnly: boolean;
|
|
29
|
+
onInit(options: unknown): void;
|
|
30
|
+
afterAddAsSubModel(): Promise<void>;
|
|
31
|
+
protected onMount(): void;
|
|
32
|
+
protected onUnmount(): void;
|
|
33
|
+
setProps(props: PortalEntryActionProps): void;
|
|
34
|
+
setProps(key: string, value: unknown): void;
|
|
35
|
+
getTitle(): string;
|
|
36
|
+
getTitleFieldDescription(): string;
|
|
37
|
+
isEntryActionAvailable(): boolean;
|
|
38
|
+
getEntryActionUnavailableMessage(): string;
|
|
39
|
+
private isDefaultTitle;
|
|
40
|
+
private isDefaultIcon;
|
|
41
|
+
private isAutoTitle;
|
|
42
|
+
private syncEntryTitle;
|
|
43
|
+
private syncTitleStepParams;
|
|
44
|
+
onClick(): void;
|
|
45
|
+
private get t();
|
|
46
|
+
private setEntryActionAvailability;
|
|
47
|
+
private getAvailabilityForExistingPortal;
|
|
48
|
+
private syncCurrentPortal;
|
|
49
|
+
private checkEntryPortalAvailability;
|
|
50
|
+
private loadEntryPortalAvailability;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Application } from '@nocobase/client-v2';
|
|
10
|
+
import type { AppPortalsPayload } from './types';
|
|
11
|
+
type AppPortalsApiClientLike = {
|
|
12
|
+
silent?: () => AppPortalsApiClientLike;
|
|
13
|
+
request: (options: {
|
|
14
|
+
url: string;
|
|
15
|
+
skipNotify?: boolean;
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
data?: {
|
|
18
|
+
data?: unknown;
|
|
19
|
+
} | unknown;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
declare class PortalEntryActionStore {
|
|
23
|
+
private app;
|
|
24
|
+
payload: AppPortalsPayload;
|
|
25
|
+
loading: boolean;
|
|
26
|
+
revision: number;
|
|
27
|
+
private loaded;
|
|
28
|
+
private request?;
|
|
29
|
+
private requestId;
|
|
30
|
+
constructor(app: Application);
|
|
31
|
+
load(apiClient?: AppPortalsApiClientLike): Promise<AppPortalsPayload>;
|
|
32
|
+
reload(apiClient?: AppPortalsApiClientLike): Promise<AppPortalsPayload>;
|
|
33
|
+
private requestPortals;
|
|
34
|
+
}
|
|
35
|
+
export declare function getPortalEntryActionStore(app: Application): PortalEntryActionStore;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Application } from '@nocobase/client-v2';
|
|
10
|
+
export declare function registerPortalEntryActions(app: Application, t: (key: string) => string): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export type AppPortalAppStatus = 'preparing' | 'initializing' | 'initialized' | 'running' | 'commanding' | 'stopped' | 'error' | 'not_found';
|
|
10
|
+
export type AppPortalAppItem = {
|
|
11
|
+
name: string;
|
|
12
|
+
title?: string | null;
|
|
13
|
+
icon?: string | null;
|
|
14
|
+
cname?: string | null;
|
|
15
|
+
ssoEnabled?: boolean;
|
|
16
|
+
target?: string;
|
|
17
|
+
status?: AppPortalAppStatus | Record<string, AppPortalAppStatus> | null;
|
|
18
|
+
};
|
|
19
|
+
export type AppPortalItem = {
|
|
20
|
+
uid?: string | null;
|
|
21
|
+
appName: string;
|
|
22
|
+
title?: string | null;
|
|
23
|
+
icon?: string | null;
|
|
24
|
+
portalType?: string | null;
|
|
25
|
+
routePath: string;
|
|
26
|
+
layout?: string | null;
|
|
27
|
+
defaultPortal?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type AppPortalsPayload = {
|
|
30
|
+
apps: AppPortalAppItem[];
|
|
31
|
+
portals: AppPortalItem[];
|
|
32
|
+
};
|
|
33
|
+
export type AppPortalActionAppLike = {
|
|
34
|
+
name?: string;
|
|
35
|
+
getRouteUrl?: (pathname: string) => string;
|
|
36
|
+
getPublicPath?: () => string;
|
|
37
|
+
router?: {
|
|
38
|
+
basename?: string;
|
|
39
|
+
getBasename?: () => string | undefined;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { AppPortalActionAppLike, AppPortalAppItem, AppPortalItem } from './types';
|
|
10
|
+
export declare function getPortalEntryUrl(app: AppPortalActionAppLike | undefined, portal: AppPortalItem, portalApp?: AppPortalAppItem): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { default } from './plugin';
|