cyberia 3.0.3 → 3.2.5
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/{.env.production → .env.example} +20 -4
- package/.github/workflows/engine-cyberia.cd.yml +43 -10
- package/.github/workflows/engine-cyberia.ci.yml +48 -26
- package/.github/workflows/ghpkg.ci.yml +5 -5
- package/.github/workflows/gitlab.ci.yml +1 -1
- package/.github/workflows/hardhat.ci.yml +82 -0
- package/.github/workflows/npmpkg.ci.yml +60 -14
- package/.github/workflows/publish.ci.yml +26 -7
- package/.github/workflows/publish.cyberia.ci.yml +5 -5
- package/.github/workflows/pwa-microservices-template-page.cd.yml +6 -7
- package/.github/workflows/pwa-microservices-template-test.ci.yml +4 -4
- package/.github/workflows/release.cd.yml +14 -8
- package/.vscode/extensions.json +9 -8
- package/.vscode/settings.json +3 -2
- package/CHANGELOG.md +643 -1
- package/CLI-HELP.md +132 -57
- package/Dockerfile +4 -2
- package/README.md +347 -22
- package/WHITE-PAPER.md +1540 -0
- package/bin/build.js +21 -12
- package/bin/cyberia.js +2640 -106
- package/bin/deploy.js +258 -372
- package/bin/file.js +5 -1
- package/bin/index.js +2640 -106
- package/bin/vs.js +3 -3
- package/conf.js +169 -105
- package/deployment.yaml +236 -20
- package/hardhat/.env.example +31 -0
- package/hardhat/README.md +531 -0
- package/hardhat/WHITE-PAPER.md +1540 -0
- package/hardhat/contracts/ObjectLayerToken.sol +391 -0
- package/hardhat/deployments/.gitkeep +0 -0
- package/hardhat/deployments/hardhat-ObjectLayerToken.json +11 -0
- package/hardhat/hardhat.config.js +136 -0
- package/hardhat/ignition/modules/ObjectLayerToken.js +21 -0
- package/hardhat/networks/besu-object-layer.network.json +138 -0
- package/hardhat/package-lock.json +4323 -0
- package/hardhat/package.json +36 -0
- package/hardhat/scripts/deployObjectLayerToken.js +98 -0
- package/hardhat/test/ObjectLayerToken.js +592 -0
- package/hardhat/types/ethers-contracts/ObjectLayerToken.ts +690 -0
- package/hardhat/types/ethers-contracts/common.ts +92 -0
- package/hardhat/types/ethers-contracts/factories/ObjectLayerToken__factory.ts +1055 -0
- package/hardhat/types/ethers-contracts/factories/index.ts +4 -0
- package/hardhat/types/ethers-contracts/hardhat.d.ts +47 -0
- package/hardhat/types/ethers-contracts/index.ts +6 -0
- package/jsdoc.dd-cyberia.json +68 -0
- package/jsdoc.json +65 -49
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +5 -4
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +5 -4
- package/manifests/deployment/dd-cyberia-development/deployment.yaml +562 -0
- package/manifests/deployment/dd-cyberia-development/proxy.yaml +297 -0
- package/manifests/deployment/dd-cyberia-development/pv-pvc.yaml +132 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +88 -74
- package/manifests/deployment/dd-test-development/proxy.yaml +13 -4
- package/manifests/deployment/playwright/deployment.yaml +1 -1
- package/manifests/pv-pvc-dd.yaml +1 -1
- package/nodemon.json +1 -1
- package/package.json +60 -48
- package/proxy.yaml +118 -10
- package/pv-pvc.yaml +132 -0
- package/scripts/k3s-node-setup.sh +1 -1
- package/scripts/ports-ls.sh +2 -0
- package/scripts/rhel-grpc-setup.sh +56 -0
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +47 -1
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +17 -2
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.router.js +5 -0
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +80 -7
- package/src/api/cyberia-dialogue/cyberia-dialogue.controller.js +93 -0
- package/src/api/cyberia-dialogue/cyberia-dialogue.model.js +36 -0
- package/src/api/cyberia-dialogue/cyberia-dialogue.router.js +29 -0
- package/src/api/cyberia-dialogue/cyberia-dialogue.service.js +51 -0
- package/src/api/cyberia-entity/cyberia-entity.controller.js +74 -0
- package/src/api/cyberia-entity/cyberia-entity.model.js +24 -0
- package/src/api/cyberia-entity/cyberia-entity.router.js +27 -0
- package/src/api/cyberia-entity/cyberia-entity.service.js +42 -0
- package/src/api/cyberia-instance/cyberia-fallback-world.js +368 -0
- package/src/api/cyberia-instance/cyberia-instance.controller.js +92 -0
- package/src/api/cyberia-instance/cyberia-instance.model.js +84 -0
- package/src/api/cyberia-instance/cyberia-instance.router.js +63 -0
- package/src/api/cyberia-instance/cyberia-instance.service.js +191 -0
- package/src/api/cyberia-instance/cyberia-portal-connector.js +486 -0
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.controller.js +74 -0
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.defaults.js +413 -0
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.model.js +228 -0
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.router.js +27 -0
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.service.js +42 -0
- package/src/api/cyberia-map/cyberia-map.controller.js +79 -0
- package/src/api/cyberia-map/cyberia-map.model.js +30 -0
- package/src/api/cyberia-map/cyberia-map.router.js +40 -0
- package/src/api/cyberia-map/cyberia-map.service.js +74 -0
- package/src/api/document/document.service.js +1 -1
- package/src/api/file/file.controller.js +3 -1
- package/src/api/file/file.ref.json +18 -0
- package/src/api/file/file.service.js +28 -5
- package/src/api/ipfs/ipfs.controller.js +4 -25
- package/src/api/ipfs/ipfs.model.js +43 -34
- package/src/api/ipfs/ipfs.router.js +8 -13
- package/src/api/ipfs/ipfs.service.js +56 -104
- package/src/api/object-layer/README.md +347 -22
- package/src/api/object-layer/object-layer.controller.js +6 -2
- package/src/api/object-layer/object-layer.model.js +12 -8
- package/src/api/object-layer/object-layer.router.js +698 -42
- package/src/api/object-layer/object-layer.service.js +119 -37
- package/src/api/object-layer-render-frames/object-layer-render-frames.model.js +1 -2
- package/src/api/user/user.router.js +10 -5
- package/src/api/user/user.service.js +15 -14
- package/src/cli/baremetal.js +6 -10
- package/src/cli/cloud-init.js +0 -3
- package/src/cli/cluster.js +7 -7
- package/src/cli/db.js +723 -857
- package/src/cli/deploy.js +215 -105
- package/src/cli/env.js +34 -5
- package/src/cli/fs.js +5 -4
- package/src/cli/image.js +0 -3
- package/src/cli/index.js +83 -15
- package/src/cli/kubectl.js +211 -0
- package/src/cli/monitor.js +5 -6
- package/src/cli/release.js +284 -0
- package/src/cli/repository.js +708 -62
- package/src/cli/run.js +371 -151
- package/src/cli/secrets.js +73 -2
- package/src/cli/ssh.js +1 -1
- package/src/cli/test.js +3 -3
- package/src/client/Cryptokoyn.index.js +3 -4
- package/src/client/CyberiaPortal.index.js +3 -4
- package/src/client/Default.index.js +3 -4
- package/src/client/Itemledger.index.js +4 -963
- package/src/client/Underpost.index.js +3 -4
- package/src/client/components/core/AgGrid.js +20 -5
- package/src/client/components/core/Alert.js +2 -2
- package/src/client/components/core/AppStore.js +69 -0
- package/src/client/components/core/CalendarCore.js +2 -2
- package/src/client/components/core/Content.js +22 -3
- package/src/client/components/core/Docs.js +30 -6
- package/src/client/components/core/DropDown.js +137 -17
- package/src/client/components/core/FileExplorer.js +71 -4
- package/src/client/components/core/Input.js +1 -1
- package/src/client/components/core/Keyboard.js +2 -2
- package/src/client/components/core/LogIn.js +2 -2
- package/src/client/components/core/LogOut.js +2 -2
- package/src/client/components/core/Modal.js +20 -7
- package/src/client/components/core/Panel.js +0 -1
- package/src/client/components/core/PanelForm.js +19 -19
- package/src/client/components/core/RichText.js +1 -2
- package/src/client/components/core/SocketIo.js +82 -29
- package/src/client/components/core/SocketIoHandler.js +75 -0
- package/src/client/components/core/Stream.js +143 -95
- package/src/client/components/core/Webhook.js +40 -7
- package/src/client/components/cryptokoyn/AppStoreCryptokoyn.js +5 -0
- package/src/client/components/cryptokoyn/LogInCryptokoyn.js +3 -3
- package/src/client/components/cryptokoyn/LogOutCryptokoyn.js +2 -2
- package/src/client/components/cryptokoyn/MenuCryptokoyn.js +3 -3
- package/src/client/components/cryptokoyn/SocketIoCryptokoyn.js +3 -51
- package/src/client/components/cyberia/InstanceEngineCyberia.js +700 -0
- package/src/client/components/cyberia/MapEngineCyberia.js +1359 -2
- package/src/client/components/cyberia/ObjectLayerEngineModal.js +17 -6
- package/src/client/components/cyberia/ObjectLayerEngineViewer.js +92 -54
- package/src/client/components/cyberia-portal/AppStoreCyberiaPortal.js +5 -0
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +217 -30
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +44 -2
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +3 -4
- package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +2 -2
- package/src/client/components/cyberia-portal/MenuCyberiaPortal.js +104 -9
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +5 -0
- package/src/client/components/cyberia-portal/SocketIoCyberiaPortal.js +3 -49
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +4 -0
- package/src/client/components/default/AppStoreDefault.js +5 -0
- package/src/client/components/default/LogInDefault.js +3 -3
- package/src/client/components/default/LogOutDefault.js +2 -2
- package/src/client/components/default/MenuDefault.js +5 -5
- package/src/client/components/default/SocketIoDefault.js +3 -51
- package/src/client/components/itemledger/AppStoreItemledger.js +5 -0
- package/src/client/components/itemledger/LogInItemledger.js +3 -3
- package/src/client/components/itemledger/LogOutItemledger.js +2 -2
- package/src/client/components/itemledger/MenuItemledger.js +3 -3
- package/src/client/components/itemledger/SocketIoItemledger.js +3 -51
- package/src/client/components/underpost/AppStoreUnderpost.js +5 -0
- package/src/client/components/underpost/CssUnderpost.js +59 -0
- package/src/client/components/underpost/LogInUnderpost.js +6 -3
- package/src/client/components/underpost/LogOutUnderpost.js +4 -2
- package/src/client/components/underpost/MenuUnderpost.js +104 -18
- package/src/client/components/underpost/RoutesUnderpost.js +2 -0
- package/src/client/components/underpost/SocketIoUnderpost.js +3 -51
- package/src/client/public/cryptokoyn/assets/logo/base-icon.png +0 -0
- package/src/client/public/cryptokoyn/browserconfig.xml +12 -0
- package/src/client/public/cryptokoyn/microdata.json +85 -0
- package/src/client/public/cryptokoyn/site.webmanifest +57 -0
- package/src/client/public/cryptokoyn/sitemap +3 -3
- package/src/client/public/default/sitemap +3 -3
- package/src/client/public/itemledger/browserconfig.xml +2 -2
- package/src/client/public/itemledger/manifest.webmanifest +4 -4
- package/src/client/public/itemledger/microdata.json +71 -0
- package/src/client/public/itemledger/sitemap +3 -3
- package/src/client/public/itemledger/yandex-browser-manifest.json +2 -2
- package/src/client/public/test/sitemap +3 -3
- package/src/client/services/core/core.service.js +20 -8
- package/src/client/services/cyberia-dialogue/cyberia-dialogue.service.js +105 -0
- package/src/client/services/cyberia-entity/cyberia-entity.management.js +57 -0
- package/src/client/services/cyberia-entity/cyberia-entity.service.js +105 -0
- package/src/client/services/cyberia-instance/cyberia-instance.management.js +194 -0
- package/src/client/services/cyberia-instance/cyberia-instance.service.js +122 -0
- package/src/client/services/cyberia-instance-conf/cyberia-instance-conf.service.js +105 -0
- package/src/client/services/cyberia-map/cyberia-map.management.js +193 -0
- package/src/client/services/cyberia-map/cyberia-map.service.js +126 -0
- package/src/client/services/instance/instance.management.js +2 -2
- package/src/client/services/ipfs/ipfs.service.js +3 -23
- package/src/client/services/object-layer/object-layer.management.js +3 -3
- package/src/client/services/object-layer/object-layer.service.js +21 -0
- package/src/client/services/user/user.management.js +2 -2
- package/src/client/ssr/body/404.js +15 -11
- package/src/client/ssr/body/500.js +15 -11
- package/src/client/ssr/body/SwaggerDarkMode.js +285 -0
- package/src/client/ssr/head/PwaItemledger.js +60 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +11 -10
- package/src/client/ssr/pages/CyberiaServerMetrics.js +1 -1
- package/src/client/ssr/pages/Test.js +11 -10
- package/src/client.build.js +0 -3
- package/src/client.dev.js +0 -3
- package/src/db/DataBaseProvider.js +17 -2
- package/src/db/mariadb/MariaDB.js +14 -9
- package/src/db/mongo/MongooseDB.js +17 -1
- package/src/grpc/cyberia/OFF_CHAIN_ECONOMY.md +305 -0
- package/src/grpc/cyberia/README.md +326 -0
- package/src/grpc/cyberia/grpc-server.js +530 -0
- package/src/index.js +24 -1
- package/src/proxy.js +0 -3
- package/src/runtime/express/Dockerfile +4 -0
- package/src/runtime/express/Express.js +33 -10
- package/src/runtime/lampp/Dockerfile +13 -2
- package/src/runtime/lampp/Lampp.js +33 -17
- package/src/runtime/wp/Dockerfile +68 -0
- package/src/runtime/wp/Wp.js +639 -0
- package/src/server/auth.js +36 -15
- package/src/server/backup.js +39 -12
- package/src/server/besu-genesis-generator.js +1630 -0
- package/src/server/client-build-docs.js +133 -17
- package/src/server/client-build-live.js +9 -18
- package/src/server/client-build.js +229 -101
- package/src/server/client-dev-server.js +14 -13
- package/src/server/client-formatted.js +109 -57
- package/src/server/conf.js +391 -164
- package/src/server/cron.js +27 -24
- package/src/server/dns.js +29 -12
- package/src/server/downloader.js +0 -2
- package/src/server/ipfs-client.js +24 -1
- package/src/server/logger.js +27 -9
- package/src/server/object-layer.js +217 -103
- package/src/server/peer.js +8 -2
- package/src/server/process.js +1 -50
- package/src/server/proxy.js +4 -8
- package/src/server/runtime.js +30 -9
- package/src/server/semantic-layer-generator-floor.js +359 -0
- package/src/server/semantic-layer-generator-skin.js +1294 -0
- package/src/server/semantic-layer-generator.js +116 -555
- package/src/server/ssr.js +0 -3
- package/src/server/start.js +19 -12
- package/src/server/tls.js +0 -2
- package/src/server.js +0 -4
- package/src/ws/IoInterface.js +1 -10
- package/src/ws/IoServer.js +14 -33
- package/src/ws/core/channels/core.ws.chat.js +65 -20
- package/src/ws/core/channels/core.ws.mailer.js +113 -32
- package/src/ws/core/channels/core.ws.stream.js +90 -31
- package/src/ws/core/core.ws.connection.js +12 -33
- package/src/ws/core/core.ws.emit.js +10 -26
- package/src/ws/core/core.ws.server.js +25 -58
- package/src/ws/default/channels/default.ws.main.js +53 -12
- package/src/ws/default/default.ws.connection.js +26 -13
- package/src/ws/default/default.ws.server.js +30 -12
- package/.env.development +0 -43
- package/.env.test +0 -43
- package/hardhat/contracts/CryptoKoyn.sol +0 -59
- package/hardhat/contracts/ItemLedger.sol +0 -73
- package/hardhat/contracts/Lock.sol +0 -34
- package/hardhat/hardhat.config.cjs +0 -45
- package/hardhat/ignition/modules/Lock.js +0 -18
- package/hardhat/networks/cryptokoyn-itemledger.network.json +0 -29
- package/hardhat/scripts/deployCryptokoyn.cjs +0 -25
- package/hardhat/scripts/deployItemledger.cjs +0 -25
- package/hardhat/test/Lock.js +0 -126
- package/hardhat/white-paper.md +0 -581
- package/src/client/components/cryptokoyn/CommonCryptokoyn.js +0 -29
- package/src/client/components/cryptokoyn/ElementsCryptokoyn.js +0 -38
- package/src/client/components/cyberia-portal/ElementsCyberiaPortal.js +0 -38
- package/src/client/components/default/ElementsDefault.js +0 -38
- package/src/client/components/itemledger/CommonItemledger.js +0 -29
- package/src/client/components/itemledger/ElementsItemledger.js +0 -38
- package/src/client/components/underpost/CommonUnderpost.js +0 -29
- package/src/client/components/underpost/ElementsUnderpost.js +0 -38
- package/src/ws/core/management/core.ws.chat.js +0 -8
- package/src/ws/core/management/core.ws.mailer.js +0 -16
- package/src/ws/core/management/core.ws.stream.js +0 -8
- package/src/ws/default/management/default.ws.main.js +0 -8
- package/white-paper.md +0 -581
|
@@ -10,11 +10,10 @@ import { MenuUnderpost } from './components/underpost/MenuUnderpost.js';
|
|
|
10
10
|
import { RouterUnderpost } from './components/underpost/RoutesUnderpost.js';
|
|
11
11
|
import { TranslateUnderpost } from './components/underpost/TranslateUnderpost.js';
|
|
12
12
|
import { Worker } from './components/core/Worker.js';
|
|
13
|
-
import { UnderpostParams } from './components/underpost/CommonUnderpost.js';
|
|
14
13
|
import { Keyboard } from './components/core/Keyboard.js';
|
|
15
14
|
import { SocketIoUnderpost } from './components/underpost/SocketIoUnderpost.js';
|
|
16
15
|
import { SocketIo } from './components/core/SocketIo.js';
|
|
17
|
-
import {
|
|
16
|
+
import { AppStoreUnderpost } from './components/underpost/AppStoreUnderpost.js';
|
|
18
17
|
import { CssUnderpostDark, CssUnderpostLight } from './components/underpost/CssUnderpost.js';
|
|
19
18
|
|
|
20
19
|
window.onload = () =>
|
|
@@ -26,11 +25,11 @@ window.onload = () =>
|
|
|
26
25
|
await TranslateUnderpost.Init();
|
|
27
26
|
await Responsive.Init();
|
|
28
27
|
await MenuUnderpost.Render();
|
|
29
|
-
await SocketIo.Init({ channels:
|
|
28
|
+
await SocketIo.Init({ channels: AppStoreUnderpost.Data });
|
|
30
29
|
await SocketIoUnderpost.Init();
|
|
31
30
|
await LogInUnderpost();
|
|
32
31
|
await LogOutUnderpost();
|
|
33
32
|
await SignUpUnderpost();
|
|
34
|
-
await Keyboard.Init(
|
|
33
|
+
await Keyboard.Init();
|
|
35
34
|
},
|
|
36
35
|
});
|
|
@@ -13,20 +13,32 @@ const AgGrid = {
|
|
|
13
13
|
Render: async function (options) {
|
|
14
14
|
let { id, paginationOptions } = options;
|
|
15
15
|
setTimeout(() => {
|
|
16
|
+
// Normalize rowSelection from deprecated string form to object form (AG Grid v32.2.1+)
|
|
17
|
+
let gridOptionsOverrides = { ...(options.gridOptions || {}) };
|
|
18
|
+
if (typeof gridOptionsOverrides.rowSelection === 'string') {
|
|
19
|
+
const mode = gridOptionsOverrides.rowSelection; // 'single' or 'multiple'
|
|
20
|
+
gridOptionsOverrides.rowSelection = {
|
|
21
|
+
mode: mode === 'multiple' ? 'multiRow' : 'singleRow',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
// Grid Options: Contains all of the grid configurations
|
|
17
26
|
const gridOptions = {
|
|
27
|
+
// Use legacy CSS theme mode to avoid conflict with Theming API (AG Grid v33+)
|
|
28
|
+
theme: 'legacy',
|
|
18
29
|
// Row Data: The data to be displayed.
|
|
19
30
|
pagination: false, // Disabled by default, will be handled by the management view
|
|
20
31
|
// paginationPageSize: 100,
|
|
21
32
|
// suppressPaginationPanel: true, // We are using our own custom pagination component
|
|
22
33
|
// rowHeight: 60,
|
|
23
|
-
enableCellChangeFlash
|
|
34
|
+
// enableCellChangeFlash was removed in v35; use enableCellChangeFlash on defaultColDef instead
|
|
24
35
|
defaultColDef: {
|
|
25
36
|
editable: false,
|
|
26
37
|
flex: 1,
|
|
27
38
|
minWidth: 50,
|
|
28
39
|
filter: true,
|
|
29
40
|
autoHeight: true,
|
|
41
|
+
enableCellChangeFlash: true,
|
|
30
42
|
},
|
|
31
43
|
rowClassRules: {
|
|
32
44
|
'row-new-highlight': (params) => {
|
|
@@ -76,7 +88,7 @@ const AgGrid = {
|
|
|
76
88
|
return { field };
|
|
77
89
|
})
|
|
78
90
|
: [],
|
|
79
|
-
...
|
|
91
|
+
...gridOptionsOverrides,
|
|
80
92
|
};
|
|
81
93
|
|
|
82
94
|
// Your Javascript code to create the grid
|
|
@@ -86,8 +98,11 @@ const AgGrid = {
|
|
|
86
98
|
// myGridElement.style.setProperty('width', '100%');
|
|
87
99
|
ThemeEvents[id] = () => {
|
|
88
100
|
if (s(`.${id}`)) {
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
// darkTheme has already been updated by Css.js when this event fires
|
|
102
|
+
// If darkTheme is true: remove light class, add dark class
|
|
103
|
+
// If darkTheme is false: remove dark class, add light class
|
|
104
|
+
s(`.${id}`).classList.remove(this.theme, this.theme + '-dark');
|
|
105
|
+
s(`.${id}`).classList.add(darkTheme ? this.theme + '-dark' : this.theme);
|
|
91
106
|
} else {
|
|
92
107
|
// console.warn('change theme: grid not found');
|
|
93
108
|
delete ThemeEvents[id];
|
|
@@ -112,7 +127,7 @@ const AgGrid = {
|
|
|
112
127
|
: '';
|
|
113
128
|
return html`
|
|
114
129
|
<div
|
|
115
|
-
class="${id} ${this.theme
|
|
130
|
+
class="${id} ${darkTheme ? this.theme + '-dark' : this.theme}"
|
|
116
131
|
style="${options?.style
|
|
117
132
|
? Object.keys(options.style).map((styleKey) => `${styleKey}: ${options.style[styleKey]}; `)
|
|
118
133
|
: ''}"
|
|
@@ -49,7 +49,7 @@ const e404 = async () => {
|
|
|
49
49
|
<br />
|
|
50
50
|
<br />${Translate.Render('page-not-found')} <br />
|
|
51
51
|
<br />
|
|
52
|
-
<a href="${location.origin}">${Translate.Render('back')}</a>
|
|
52
|
+
<a target="_top" href="${location.origin}">${Translate.Render('back')}</a>
|
|
53
53
|
</div>`;
|
|
54
54
|
};
|
|
55
55
|
|
|
@@ -68,7 +68,7 @@ const e500 = async () => {
|
|
|
68
68
|
<br />
|
|
69
69
|
<br />${Translate.Render('page-broken')} <br />
|
|
70
70
|
<br />
|
|
71
|
-
<a href="${location.origin}">${Translate.Render('back')}</a>
|
|
71
|
+
<a target="_top" href="${location.origin}">${Translate.Render('back')}</a>
|
|
72
72
|
</div>`;
|
|
73
73
|
};
|
|
74
74
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core per-app state store for WebSocket channel data.
|
|
3
|
+
*
|
|
4
|
+
* @module client/core/AppStore
|
|
5
|
+
* @namespace AppStore
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @class AppStore
|
|
10
|
+
* @classdesc Per-app singleton state store for WebSocket channel data and authenticated user state.
|
|
11
|
+
*
|
|
12
|
+
* Usage: `AppStoreX.Data.user.main.model.user` — the authenticated user object.
|
|
13
|
+
* `AppStoreX.Data` keys (`chat`, `mailer`, `stream`, etc.) — channel definitions for `SocketIo.Init`.
|
|
14
|
+
* @memberof AppStore
|
|
15
|
+
*/
|
|
16
|
+
class AppStore {
|
|
17
|
+
/**
|
|
18
|
+
* Channel data map, keyed by channel name (e.g. `user`, `chat`, `mailer`).
|
|
19
|
+
* The `user` channel always contains `{ main: { model: { user: { _id: '' } } } }`.
|
|
20
|
+
*
|
|
21
|
+
* @type {Object.<string, Object>}
|
|
22
|
+
*/
|
|
23
|
+
Data;
|
|
24
|
+
|
|
25
|
+
/** @private @type {function(): Object} */
|
|
26
|
+
#initialStateFactory;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new AppStore instance.
|
|
30
|
+
*
|
|
31
|
+
* @param {function(): Object} initialStateFactory - Factory function returning the initial data shape.
|
|
32
|
+
* Must return at least `{ user: { main: { model: { user: { _id: '' } } } } }`.
|
|
33
|
+
*/
|
|
34
|
+
constructor(initialStateFactory) {
|
|
35
|
+
this.#initialStateFactory = initialStateFactory;
|
|
36
|
+
this.Data = initialStateFactory();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Resets `Data` to its initial state.
|
|
41
|
+
*
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
44
|
+
reset() {
|
|
45
|
+
this.Data = this.#initialStateFactory();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates an AppStore with the standard channel layout.
|
|
50
|
+
* Always includes `user`, `chat`, and `mailer` channels.
|
|
51
|
+
*
|
|
52
|
+
* @static
|
|
53
|
+
* @param {...string} extraChannels - Additional channel names (e.g. `'stream'`).
|
|
54
|
+
* @returns {AppStore}
|
|
55
|
+
*/
|
|
56
|
+
static create(...extraChannels) {
|
|
57
|
+
return new AppStore(() => {
|
|
58
|
+
const state = {
|
|
59
|
+
user: { main: { model: { user: { _id: '' } } } },
|
|
60
|
+
chat: {},
|
|
61
|
+
mailer: {},
|
|
62
|
+
};
|
|
63
|
+
for (const ch of extraChannels) state[ch] = {};
|
|
64
|
+
return state;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { AppStore };
|
|
@@ -25,7 +25,7 @@ const eventDateFactory = (event) =>
|
|
|
25
25
|
const CalendarCore = {
|
|
26
26
|
RenderStyle: async function () {},
|
|
27
27
|
Data: {},
|
|
28
|
-
Render: async function (options = { idModal: '',
|
|
28
|
+
Render: async function (options = { idModal: '', appStore: {}, hiddenDates: [] }) {
|
|
29
29
|
this.Data[options.idModal] = {
|
|
30
30
|
data: [],
|
|
31
31
|
originData: [],
|
|
@@ -49,7 +49,7 @@ const CalendarCore = {
|
|
|
49
49
|
this.Data[options.idModal].filesData = [];
|
|
50
50
|
this.Data[options.idModal].originData = newInstance(resultData);
|
|
51
51
|
this.Data[options.idModal].data = resultData.map((o) => {
|
|
52
|
-
if (o.creatorUserId && options.
|
|
52
|
+
if (o.creatorUserId && options.appStore.Data.user.main.model.user._id === o.creatorUserId) o.tools = true;
|
|
53
53
|
o.id = o._id;
|
|
54
54
|
|
|
55
55
|
this.Data[options.idModal].filesData.push({});
|
|
@@ -56,7 +56,7 @@ const attachMarkdownLinkHandlers = (containerSelector) => {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
const Content = {
|
|
59
|
-
Render: async function (options = { idModal: '' }) {
|
|
59
|
+
Render: async function (options = { idModal: '', titleIcon: '' }) {
|
|
60
60
|
const { idModal } = options;
|
|
61
61
|
setTimeout(async () => {
|
|
62
62
|
try {
|
|
@@ -111,11 +111,30 @@ const Content = {
|
|
|
111
111
|
throw new Error(`no-preview-available`);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
// Use custom titleIcon from options, or extract from the modal's original title HTML, or fall back to default
|
|
115
|
+
const titleIcon = options.titleIcon
|
|
116
|
+
? options.titleIcon
|
|
117
|
+
: Modal.Data[idModal] &&
|
|
118
|
+
Modal.Data[idModal].options &&
|
|
119
|
+
Modal.Data[idModal].options.title &&
|
|
120
|
+
Modal.Data[idModal].options.title.includes &&
|
|
121
|
+
Modal.Data[idModal].options.title.includes('<img')
|
|
122
|
+
? Modal.Data[idModal].options.title.match(/<img[^>]*>/)?.[0] || html`<i class="inl far fa-file"></i>`
|
|
123
|
+
: html`<i class="inl far fa-file"></i>`;
|
|
124
|
+
|
|
125
|
+
// Preserve the original text wrapper class if present in the modal's stored title
|
|
126
|
+
const originalTitle = Modal.Data[idModal]?.options?.title || '';
|
|
127
|
+
const hasCustomTextClass = originalTitle.includes && originalTitle.includes('underpost-text-title-modal');
|
|
128
|
+
const docTitle = documentObj.title ? documentObj.title : documentObj.location;
|
|
129
|
+
const titleText = hasCustomTextClass
|
|
130
|
+
? `<span class='inl underpost-text-title-modal'>${docTitle}</span>`
|
|
131
|
+
: docTitle;
|
|
132
|
+
|
|
114
133
|
htmls(
|
|
115
134
|
`.title-modal-${idModal}`,
|
|
116
135
|
html`${renderViewTitle({
|
|
117
|
-
icon:
|
|
118
|
-
text:
|
|
136
|
+
icon: titleIcon,
|
|
137
|
+
text: titleText,
|
|
119
138
|
})} `,
|
|
120
139
|
);
|
|
121
140
|
htmls(`.content-render-${idModal}`, ``);
|
|
@@ -12,6 +12,10 @@ const Docs = {
|
|
|
12
12
|
const docData = this.Data.find((d) => d.type === type);
|
|
13
13
|
const ModalId = `modal-docs-${docData.type}`;
|
|
14
14
|
const { barConfig } = await Themes[Css.currentTheme]();
|
|
15
|
+
const parentBarMode =
|
|
16
|
+
Modal.Data['modal-docs'] && Modal.Data['modal-docs'].options.barMode
|
|
17
|
+
? Modal.Data['modal-docs'].options.barMode
|
|
18
|
+
: undefined;
|
|
15
19
|
|
|
16
20
|
await Modal.Render({
|
|
17
21
|
barConfig,
|
|
@@ -20,11 +24,18 @@ const Docs = {
|
|
|
20
24
|
html: async () => {
|
|
21
25
|
if (docData.renderHtml) return await docData.renderHtml();
|
|
22
26
|
return html`
|
|
27
|
+
<style>
|
|
28
|
+
.iframe-${ModalId} {
|
|
29
|
+
width: 100%;
|
|
30
|
+
border: none;
|
|
31
|
+
background: white;
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
23
35
|
<iframe
|
|
24
36
|
class="in iframe-${ModalId}"
|
|
25
|
-
style="width: 100%; border: none; background: white; display: block"
|
|
26
37
|
src="${docData.url()}"
|
|
27
|
-
sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-popups-to-escape-sandbox"
|
|
38
|
+
sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-popups-to-escape-sandbox allow-top-navigation"
|
|
28
39
|
>
|
|
29
40
|
</iframe>
|
|
30
41
|
`;
|
|
@@ -34,7 +45,7 @@ const Docs = {
|
|
|
34
45
|
route: 'docs',
|
|
35
46
|
slideMenu: 'modal-menu',
|
|
36
47
|
observer: true,
|
|
37
|
-
barMode:
|
|
48
|
+
barMode: parentBarMode,
|
|
38
49
|
query: true,
|
|
39
50
|
RouterInstance: Modal.Data['modal-docs'].options.RouterInstance,
|
|
40
51
|
});
|
|
@@ -166,6 +177,8 @@ const Docs = {
|
|
|
166
177
|
icon: html`<i class="fab fa-github"></i>`,
|
|
167
178
|
text: `Last Release`,
|
|
168
179
|
url: function () {
|
|
180
|
+
const tokenOpts = Docs.Tokens['modal-docs'];
|
|
181
|
+
if (tokenOpts && tokenOpts.lastReleaseUrl) return tokenOpts.lastReleaseUrl();
|
|
169
182
|
return `https://github.com/underpostnet/pwa-microservices-template-ghpkg/`;
|
|
170
183
|
},
|
|
171
184
|
},
|
|
@@ -180,6 +193,8 @@ const Docs = {
|
|
|
180
193
|
</svg>`,
|
|
181
194
|
text: html`Demo`,
|
|
182
195
|
url: function () {
|
|
196
|
+
const tokenOpts = Docs.Tokens['modal-docs'];
|
|
197
|
+
if (tokenOpts && tokenOpts.demoUrl) return tokenOpts.demoUrl();
|
|
183
198
|
return `https://underpostnet.github.io/pwa-microservices-template-ghpkg/`;
|
|
184
199
|
},
|
|
185
200
|
},
|
|
@@ -204,6 +219,8 @@ const Docs = {
|
|
|
204
219
|
icon: html`<img height="20" width="20" class="doc-icon-coverage" />`,
|
|
205
220
|
text: `Coverage report`,
|
|
206
221
|
url: function () {
|
|
222
|
+
const tokenOpts = Docs.Tokens['modal-docs'];
|
|
223
|
+
if (tokenOpts && tokenOpts.coverageUrl) return tokenOpts.coverageUrl();
|
|
207
224
|
return `${getProxyPath()}docs/coverage`;
|
|
208
225
|
},
|
|
209
226
|
themeEvent: () => {
|
|
@@ -223,7 +240,7 @@ const Docs = {
|
|
|
223
240
|
},
|
|
224
241
|
],
|
|
225
242
|
Tokens: {},
|
|
226
|
-
Init: async function (options) {
|
|
243
|
+
Init: async function (options = {}) {
|
|
227
244
|
const { idModal } = options;
|
|
228
245
|
this.Tokens[idModal] = options;
|
|
229
246
|
setTimeout(() => {
|
|
@@ -284,10 +301,14 @@ const Docs = {
|
|
|
284
301
|
break;
|
|
285
302
|
}
|
|
286
303
|
tabHref = docData.url();
|
|
304
|
+
const subMenuIcon =
|
|
305
|
+
options.subMenuIcon && typeof options.subMenuIcon === 'function'
|
|
306
|
+
? options.subMenuIcon(docData.type)
|
|
307
|
+
: docData.icon;
|
|
287
308
|
docMenuRender += html`
|
|
288
309
|
${await BtnIcon.Render({
|
|
289
310
|
class: `in wfa main-btn-menu submenu-btn btn-docs btn-docs-${docData.type}`,
|
|
290
|
-
label: html`<span class="inl menu-btn-icon">${
|
|
311
|
+
label: html`<span class="inl menu-btn-icon">${subMenuIcon}</span
|
|
291
312
|
><span class="menu-label-text menu-label-text-docs"> ${docData.text} </span>`,
|
|
292
313
|
tabHref,
|
|
293
314
|
tooltipHtml: await Badge.Render(buildBadgeToolTipMenuOption(docData.text, 'right')),
|
|
@@ -447,7 +468,10 @@ const Docs = {
|
|
|
447
468
|
if (s(`.docs-card-container-${item.id}`)) {
|
|
448
469
|
s(`.docs-card-container-${item.id}`).onclick = () => {
|
|
449
470
|
if (item.id.match('demo')) {
|
|
450
|
-
|
|
471
|
+
const demoData = Docs.Data.find((d) => d.type === 'demo');
|
|
472
|
+
location.href = demoData
|
|
473
|
+
? demoData.url()
|
|
474
|
+
: 'https://underpostnet.github.io/pwa-microservices-template-ghpkg/';
|
|
451
475
|
} else if (item.id.match('api')) {
|
|
452
476
|
if (s(`.btn-docs-api`)) s(`.btn-docs-api`).click();
|
|
453
477
|
} else {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Badge } from './Badge.js';
|
|
1
2
|
import { getId, newInstance } from './CommonJs.js';
|
|
3
|
+
import { darkTheme, ThemeEvents } from './Css.js';
|
|
2
4
|
import { Input } from './Input.js';
|
|
3
5
|
import { ToggleSwitch } from './ToggleSwitch.js';
|
|
4
6
|
import { Translate } from './Translate.js';
|
|
@@ -15,17 +17,83 @@ const DropDown = {
|
|
|
15
17
|
originData: options.data ? newInstance(options.data) : [],
|
|
16
18
|
};
|
|
17
19
|
|
|
20
|
+
const _renderSelectedBadges = async () => {
|
|
21
|
+
if (options.type !== 'checkbox') return;
|
|
22
|
+
const container = s(`.dropdown-current-${id}`);
|
|
23
|
+
if (!container) return;
|
|
24
|
+
const selected = Object.entries(DropDown.Tokens[id].oncheckvalues);
|
|
25
|
+
if (selected.length === 0) {
|
|
26
|
+
htmls(`.dropdown-current-${id}`, '');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let badgesHtml = '';
|
|
30
|
+
for (const [key, val] of selected) {
|
|
31
|
+
badgesHtml += html`<span class="inl" style="display:inline-flex;align-items:center;margin:2px;">
|
|
32
|
+
${await Badge.Render({
|
|
33
|
+
text: html`<i class="fa-solid fa-tag" style="margin-right:3px;font-size:9px;"></i>${val.display}`,
|
|
34
|
+
style: {
|
|
35
|
+
background: darkTheme ? '#335' : '#cde',
|
|
36
|
+
color: darkTheme ? '#adf' : '#246',
|
|
37
|
+
'border-radius': '4px',
|
|
38
|
+
'font-size': '11px',
|
|
39
|
+
height: 'auto',
|
|
40
|
+
'min-width': 'auto',
|
|
41
|
+
},
|
|
42
|
+
})}
|
|
43
|
+
<span
|
|
44
|
+
class="dd-badge-del-${id}"
|
|
45
|
+
data-key="${key}"
|
|
46
|
+
style="cursor:pointer;padding:0 4px;font-size:14px;color:${darkTheme ? '#f88' : '#a00'};line-height:1;"
|
|
47
|
+
>×</span
|
|
48
|
+
>
|
|
49
|
+
</span>`;
|
|
50
|
+
}
|
|
51
|
+
htmls(`.dropdown-current-${id}`, badgesHtml);
|
|
52
|
+
container.querySelectorAll(`.dd-badge-del-${id}`).forEach((btn) => {
|
|
53
|
+
btn.onclick = async (e) => {
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
const key = btn.dataset.key;
|
|
56
|
+
delete DropDown.Tokens[id].oncheckvalues[key];
|
|
57
|
+
const dataItem = options.data.find((d) => d.value.trim().replaceAll(' ', '-') === key);
|
|
58
|
+
if (dataItem) dataItem.checked = false;
|
|
59
|
+
if (ToggleSwitch.Tokens[`checkbox-role-${key}`]) {
|
|
60
|
+
const checkbox = s(`.checkbox-role-${key}-checkbox`);
|
|
61
|
+
if (checkbox && checkbox.checked) ToggleSwitch.Tokens[`checkbox-role-${key}`].click();
|
|
62
|
+
}
|
|
63
|
+
DropDown.Tokens[id].value = Object.values(DropDown.Tokens[id].oncheckvalues).map((v) => v.data);
|
|
64
|
+
s(`.${id}`).value = DropDown.Tokens[id].value;
|
|
65
|
+
await _renderSelectedBadges();
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
DropDown.Tokens[id]._renderSelectedBadges = _renderSelectedBadges;
|
|
70
|
+
|
|
18
71
|
options.data.push({
|
|
19
72
|
value: 'reset',
|
|
20
73
|
display: html`<i class="fa-solid fa-broom"></i> ${Translate.Render('clear')}`,
|
|
21
74
|
onClick: () => {
|
|
22
75
|
console.log('DropDown onClick', this.value);
|
|
23
76
|
if (options && options.resetOnClick) options.resetOnClick();
|
|
24
|
-
if (options && options.type === 'checkbox')
|
|
25
|
-
|
|
26
|
-
|
|
77
|
+
if (options && options.type === 'checkbox') {
|
|
78
|
+
DropDown.Tokens[id].oncheckvalues = {};
|
|
79
|
+
DropDown.Tokens[id].value = [];
|
|
80
|
+
s(`.${id}`).value = [];
|
|
81
|
+
htmls(`.dropdown-current-${id}`, '');
|
|
82
|
+
if (options.serviceProvider) {
|
|
83
|
+
htmls(`.${id}-render-container`, '');
|
|
84
|
+
} else {
|
|
85
|
+
for (const optionData of options.data) {
|
|
86
|
+
if (optionData.value !== 'reset' && optionData.value !== 'close' && optionData.checked) {
|
|
87
|
+
optionData.checked = false;
|
|
88
|
+
const vd = optionData.value.trim().replaceAll(' ', '-');
|
|
89
|
+
if (ToggleSwitch.Tokens[`checkbox-role-${vd}`]) {
|
|
90
|
+
const checkbox = s(`.checkbox-role-${vd}-checkbox`);
|
|
91
|
+
if (checkbox && checkbox.checked) ToggleSwitch.Tokens[`checkbox-role-${vd}`].click();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
27
95
|
}
|
|
28
|
-
else this.Tokens[id].value = undefined;
|
|
96
|
+
} else this.Tokens[id].value = undefined;
|
|
29
97
|
},
|
|
30
98
|
});
|
|
31
99
|
|
|
@@ -52,7 +120,7 @@ const DropDown = {
|
|
|
52
120
|
const i = index;
|
|
53
121
|
const valueDisplay = optionData.value.trim().replaceAll(' ', '-');
|
|
54
122
|
setTimeout(() => {
|
|
55
|
-
const onclick = (e) => {
|
|
123
|
+
const onclick = async (e) => {
|
|
56
124
|
if (options && options.lastSelectClass && s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`)) {
|
|
57
125
|
s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`).classList.remove(options.lastSelectClass);
|
|
58
126
|
}
|
|
@@ -72,22 +140,18 @@ const DropDown = {
|
|
|
72
140
|
if (optionData.value !== 'close') {
|
|
73
141
|
if (optionData.value !== 'reset') {
|
|
74
142
|
if (options.type === 'checkbox') {
|
|
75
|
-
|
|
76
|
-
// .filter((d) => d.checked)
|
|
77
|
-
// .map((v, i, a) => `${v.display}${i < a.length - 1 ? ',' : ''}`)
|
|
78
|
-
// .join('');
|
|
79
|
-
const value = Object.keys(DropDown.Tokens[id].oncheckvalues);
|
|
80
|
-
htmls(
|
|
81
|
-
`.dropdown-current-${id}`,
|
|
82
|
-
value.map((v) => DropDown.Tokens[id].originData.find((_v) => _v.value === v).display),
|
|
83
|
-
);
|
|
143
|
+
_renderSelectedBadges();
|
|
84
144
|
} else {
|
|
85
145
|
htmls(`.dropdown-current-${id}`, optionData.display);
|
|
86
146
|
}
|
|
87
147
|
} else htmls(`.dropdown-current-${id}`, '');
|
|
88
148
|
|
|
89
149
|
this.Tokens[id].value =
|
|
90
|
-
options.type === 'checkbox'
|
|
150
|
+
options.type === 'checkbox'
|
|
151
|
+
? options.serviceProvider
|
|
152
|
+
? Object.values(DropDown.Tokens[id].oncheckvalues).map((v) => v.data)
|
|
153
|
+
: data.filter((d) => d.checked).map((d) => d.data)
|
|
154
|
+
: optionData.data;
|
|
91
155
|
|
|
92
156
|
console.warn('current value dropdown id:' + id, this.Tokens[id].value);
|
|
93
157
|
|
|
@@ -126,7 +190,11 @@ const DropDown = {
|
|
|
126
190
|
},
|
|
127
191
|
checked: () => {
|
|
128
192
|
optionData.checked = true;
|
|
129
|
-
DropDown.Tokens[id].oncheckvalues[valueDisplay] = {
|
|
193
|
+
DropDown.Tokens[id].oncheckvalues[valueDisplay] = {
|
|
194
|
+
data: optionData.data,
|
|
195
|
+
display: optionData.display,
|
|
196
|
+
value: optionData.value,
|
|
197
|
+
};
|
|
130
198
|
},
|
|
131
199
|
},
|
|
132
200
|
})}
|
|
@@ -153,6 +221,10 @@ const DropDown = {
|
|
|
153
221
|
s(`.dropdown-current-${id}`).onclick = switchOptionsPanel;
|
|
154
222
|
if (options && options.open) switchOptionsPanel();
|
|
155
223
|
|
|
224
|
+
if (options.type === 'checkbox') {
|
|
225
|
+
ThemeEvents[`dropdown-badge-${id}`] = () => _renderSelectedBadges();
|
|
226
|
+
}
|
|
227
|
+
|
|
156
228
|
const dropDownSearchHandle = async () => {
|
|
157
229
|
const _data = [];
|
|
158
230
|
if (!s(`.search-box-${id}`)) return;
|
|
@@ -160,6 +232,12 @@ const DropDown = {
|
|
|
160
232
|
let _value = s(`.search-box-${id}`).value.toLowerCase();
|
|
161
233
|
|
|
162
234
|
for (const objData of options.data) {
|
|
235
|
+
if (
|
|
236
|
+
options.excludeSelected &&
|
|
237
|
+
options.type === 'checkbox' &&
|
|
238
|
+
DropDown.Tokens[id].oncheckvalues[objData.value.trim().replaceAll(' ', '-')]
|
|
239
|
+
)
|
|
240
|
+
continue;
|
|
163
241
|
const objValue = objData.value.toLowerCase();
|
|
164
242
|
if (
|
|
165
243
|
objValue.match(_value) ||
|
|
@@ -186,7 +264,49 @@ const DropDown = {
|
|
|
186
264
|
}
|
|
187
265
|
};
|
|
188
266
|
|
|
189
|
-
|
|
267
|
+
if (options.serviceProvider) {
|
|
268
|
+
let serviceSearchTimeout = null;
|
|
269
|
+
s(`.search-box-${id}`).oninput = () => {
|
|
270
|
+
clearTimeout(serviceSearchTimeout);
|
|
271
|
+
const q = s(`.search-box-${id}`).value.trim();
|
|
272
|
+
if (!q) {
|
|
273
|
+
htmls(`.${id}-render-container`, '');
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
serviceSearchTimeout = setTimeout(async () => {
|
|
277
|
+
try {
|
|
278
|
+
let results = await options.serviceProvider(q);
|
|
279
|
+
if (options.type === 'checkbox') {
|
|
280
|
+
if (options.excludeSelected) {
|
|
281
|
+
const selectedKeys = Object.keys(DropDown.Tokens[id].oncheckvalues);
|
|
282
|
+
results = results.filter((item) => !selectedKeys.includes(item.value.trim().replaceAll(' ', '-')));
|
|
283
|
+
}
|
|
284
|
+
results = results.map((item) => {
|
|
285
|
+
const vd = item.value.trim().replaceAll(' ', '-');
|
|
286
|
+
return { ...item, checked: !!DropDown.Tokens[id].oncheckvalues[vd] };
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
const controlItems = options.data.filter((d) => d.value === 'reset' || d.value === 'close');
|
|
290
|
+
const allData = [...results, ...controlItems];
|
|
291
|
+
if (allData.length > controlItems.length) {
|
|
292
|
+
const { render } = await _render(allData);
|
|
293
|
+
htmls(`.${id}-render-container`, render);
|
|
294
|
+
} else {
|
|
295
|
+
htmls(
|
|
296
|
+
`.${id}-render-container`,
|
|
297
|
+
html` <div class="inl" style="padding: 10px; color: red">
|
|
298
|
+
<i class="fas fa-exclamation-circle"></i> ${Translate.Render('no-result-found')}
|
|
299
|
+
</div>`,
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
} catch (e) {
|
|
303
|
+
console.error('DropDown serviceProvider error:', e);
|
|
304
|
+
}
|
|
305
|
+
}, 200);
|
|
306
|
+
};
|
|
307
|
+
} else {
|
|
308
|
+
s(`.search-box-${id}`).oninput = dropDownSearchHandle;
|
|
309
|
+
}
|
|
190
310
|
|
|
191
311
|
// Not use onblur generate bug on input toggle
|
|
192
312
|
// s(`.search-box-${id}`).onblur = dropDownSearchHandle;
|