tinybase 7.0.0-beta.1 → 7.0.0-beta.3
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/@types/common/index.d.ts +1 -1
- package/@types/mergeable-store/index.d.ts +2 -1
- package/@types/mergeable-store/with-schemas/index.d.ts +5 -3
- package/@types/omni/index.d.ts +2 -0
- package/@types/omni/with-schemas/index.d.ts +2 -0
- package/@types/persisters/index.d.ts +4 -0
- package/@types/persisters/persister-automerge/index.d.ts +4 -6
- package/@types/persisters/persister-automerge/with-schemas/index.d.ts +7 -8
- package/@types/persisters/persister-browser/index.d.ts +97 -6
- package/@types/persisters/persister-browser/with-schemas/index.d.ts +113 -6
- package/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +4 -0
- package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +7 -2
- package/@types/persisters/persister-durable-object-sql-storage/index.d.ts +6 -2
- package/@types/persisters/persister-durable-object-sql-storage/with-schemas/index.d.ts +5 -0
- package/@types/persisters/persister-durable-object-storage/index.d.ts +1 -2
- package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-electric-sql/index.d.ts +4 -0
- package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +7 -2
- package/@types/persisters/persister-expo-sqlite/index.d.ts +5 -2
- package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +7 -2
- package/@types/persisters/persister-file/index.d.ts +1 -2
- package/@types/persisters/persister-file/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-libsql/index.d.ts +4 -0
- package/@types/persisters/persister-libsql/with-schemas/index.d.ts +7 -2
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-pglite/index.d.ts +7 -3
- package/@types/persisters/persister-pglite/with-schemas/index.d.ts +9 -3
- package/@types/persisters/persister-postgres/index.d.ts +5 -2
- package/@types/persisters/persister-postgres/with-schemas/index.d.ts +7 -2
- package/@types/persisters/persister-powersync/index.d.ts +4 -0
- package/@types/persisters/persister-powersync/with-schemas/index.d.ts +7 -2
- package/@types/persisters/persister-react-native-mmkv/index.d.ts +117 -0
- package/@types/persisters/persister-react-native-mmkv/with-schemas/index.d.ts +133 -0
- package/@types/persisters/persister-react-native-sqlite/index.d.ts +184 -0
- package/@types/persisters/persister-react-native-sqlite/with-schemas/index.d.ts +207 -0
- package/@types/persisters/persister-remote/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-sqlite-bun/index.d.ts +5 -2
- package/@types/persisters/persister-sqlite-bun/with-schemas/index.d.ts +7 -2
- package/@types/persisters/persister-sqlite-wasm/index.d.ts +6 -2
- package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +8 -2
- package/@types/persisters/persister-sqlite3/index.d.ts +5 -2
- package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +7 -2
- package/@types/persisters/persister-yjs/with-schemas/index.d.ts +3 -2
- package/@types/persisters/with-schemas/index.d.ts +4 -0
- package/@types/queries/index.d.ts +1 -1
- package/@types/queries/with-schemas/index.d.ts +4 -8
- package/@types/store/index.d.ts +34 -19
- package/@types/store/with-schemas/index.d.ts +28 -13
- package/@types/synchronizers/index.d.ts +1 -0
- package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.ts +3 -2
- package/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +3 -2
- package/@types/synchronizers/synchronizer-ws-client/index.d.ts +4 -2
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +1 -0
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +7 -7
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +7 -7
- package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.ts +1 -0
- package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.ts +1 -0
- package/@types/synchronizers/synchronizer-ws-server-simple/index.d.ts +1 -1
- package/@types/synchronizers/synchronizer-ws-server-simple/with-schemas/index.d.ts +1 -1
- package/@types/synchronizers/with-schemas/index.d.ts +4 -2
- package/@types/ui-react/index.d.ts +6 -1
- package/@types/ui-react/with-schemas/index.d.ts +6 -1
- package/@types/ui-react-dom/index.d.ts +153 -20
- package/@types/ui-react-dom/with-schemas/index.d.ts +72 -20
- package/@types/ui-react-inspector/index.d.ts +8 -0
- package/@types/ui-react-inspector/with-schemas/index.d.ts +27 -1925
- package/agents.md +343 -0
- package/checkpoints/index.js +11 -6
- package/checkpoints/with-schemas/index.js +11 -6
- package/common/index.js +8 -4
- package/common/with-schemas/index.js +8 -4
- package/index.js +63 -31
- package/indexes/index.js +10 -5
- package/indexes/with-schemas/index.js +10 -5
- package/mergeable-store/index.js +54 -22
- package/mergeable-store/with-schemas/index.js +54 -22
- package/metrics/index.js +10 -5
- package/metrics/with-schemas/index.js +10 -5
- package/min/checkpoints/index.js +1 -1
- package/min/checkpoints/index.js.gz +0 -0
- package/min/checkpoints/with-schemas/index.js +1 -1
- package/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/min/common/index.js +1 -1
- package/min/common/index.js.gz +0 -0
- package/min/common/with-schemas/index.js +1 -1
- package/min/common/with-schemas/index.js.gz +0 -0
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/indexes/index.js +1 -1
- package/min/indexes/index.js.gz +0 -0
- package/min/indexes/with-schemas/index.js +1 -1
- package/min/indexes/with-schemas/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/metrics/index.js +1 -1
- package/min/metrics/index.js.gz +0 -0
- package/min/metrics/with-schemas/index.js +1 -1
- package/min/metrics/with-schemas/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/persisters/index.js +1 -1
- package/min/persisters/index.js.gz +0 -0
- package/min/persisters/persister-automerge/index.js +1 -1
- package/min/persisters/persister-automerge/index.js.gz +0 -0
- package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-browser/index.js +1 -1
- package/min/persisters/persister-browser/index.js.gz +0 -0
- package/min/persisters/persister-browser/with-schemas/index.js +1 -1
- package/min/persisters/persister-browser/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
- package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-storage/index.js +1 -1
- package/min/persisters/persister-durable-object-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-storage/with-schemas/index.js +1 -1
- package/min/persisters/persister-durable-object-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/index.js +1 -1
- package/min/persisters/persister-electric-sql/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
- package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-file/index.js +1 -1
- package/min/persisters/persister-file/index.js.gz +0 -0
- package/min/persisters/persister-file/with-schemas/index.js +1 -1
- package/min/persisters/persister-file/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/index.js +1 -1
- package/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-libsql/index.js +1 -1
- package/min/persisters/persister-libsql/index.js.gz +0 -0
- package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
- package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/index.js +1 -1
- package/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-partykit-server/index.js +1 -1
- package/min/persisters/persister-partykit-server/index.js.gz +0 -0
- package/min/persisters/persister-partykit-server/with-schemas/index.js +1 -1
- package/min/persisters/persister-partykit-server/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-pglite/index.js +1 -1
- package/min/persisters/persister-pglite/index.js.gz +0 -0
- package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-postgres/index.js +1 -1
- package/min/persisters/persister-postgres/index.js.gz +0 -0
- package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
- package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-powersync/index.js +1 -1
- package/min/persisters/persister-powersync/index.js.gz +0 -0
- package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
- package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-react-native-mmkv/index.js +1 -0
- package/min/persisters/persister-react-native-mmkv/index.js.gz +0 -0
- package/min/persisters/persister-react-native-mmkv/with-schemas/index.js +1 -0
- package/min/persisters/persister-react-native-mmkv/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/index.js +1 -0
- package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -0
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-remote/index.js +1 -1
- package/min/persisters/persister-remote/index.js.gz +0 -0
- package/min/persisters/persister-remote/with-schemas/index.js +1 -1
- package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/index.js +1 -1
- package/min/persisters/persister-sqlite3/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-yjs/index.js +1 -1
- package/min/persisters/persister-yjs/index.js.gz +0 -0
- package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/min/persisters/with-schemas/index.js +1 -1
- package/min/persisters/with-schemas/index.js.gz +0 -0
- package/min/queries/index.js +1 -1
- package/min/queries/index.js.gz +0 -0
- package/min/queries/with-schemas/index.js +1 -1
- package/min/queries/with-schemas/index.js.gz +0 -0
- package/min/relationships/index.js +1 -1
- package/min/relationships/index.js.gz +0 -0
- package/min/relationships/with-schemas/index.js +1 -1
- package/min/relationships/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/index.js +1 -1
- package/min/synchronizers/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/index.js +1 -1
- package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-simple/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-simple/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/with-schemas/index.js +1 -1
- package/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +2178 -1203
- package/omni/with-schemas/index.js +2178 -1203
- package/package.json +91 -11
- package/persisters/index.js +16 -10
- package/persisters/persister-automerge/index.js +15 -9
- package/persisters/persister-automerge/with-schemas/index.js +15 -9
- package/persisters/persister-browser/index.js +41 -9
- package/persisters/persister-browser/with-schemas/index.js +41 -9
- package/persisters/persister-cr-sqlite-wasm/index.js +16 -10
- package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +16 -10
- package/persisters/persister-durable-object-sql-storage/index.js +16 -10
- package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +16 -10
- package/persisters/persister-durable-object-storage/index.js +14 -8
- package/persisters/persister-durable-object-storage/with-schemas/index.js +14 -8
- package/persisters/persister-electric-sql/index.js +16 -10
- package/persisters/persister-electric-sql/with-schemas/index.js +16 -10
- package/persisters/persister-expo-sqlite/index.js +16 -10
- package/persisters/persister-expo-sqlite/with-schemas/index.js +16 -10
- package/persisters/persister-file/index.js +14 -8
- package/persisters/persister-file/with-schemas/index.js +14 -8
- package/persisters/persister-indexed-db/index.js +14 -8
- package/persisters/persister-indexed-db/with-schemas/index.js +14 -8
- package/persisters/persister-libsql/index.js +16 -10
- package/persisters/persister-libsql/with-schemas/index.js +16 -10
- package/persisters/persister-partykit-client/index.js +14 -8
- package/persisters/persister-partykit-client/with-schemas/index.js +14 -8
- package/persisters/persister-partykit-server/index.js +7 -3
- package/persisters/persister-partykit-server/with-schemas/index.js +7 -3
- package/persisters/persister-pglite/index.js +15 -9
- package/persisters/persister-pglite/with-schemas/index.js +15 -9
- package/persisters/persister-postgres/index.js +15 -9
- package/persisters/persister-postgres/with-schemas/index.js +15 -9
- package/persisters/persister-powersync/index.js +16 -10
- package/persisters/persister-powersync/with-schemas/index.js +16 -10
- package/persisters/persister-react-native-mmkv/index.js +465 -0
- package/persisters/persister-react-native-mmkv/with-schemas/index.js +465 -0
- package/persisters/persister-react-native-sqlite/index.js +1195 -0
- package/persisters/persister-react-native-sqlite/with-schemas/index.js +1195 -0
- package/persisters/persister-remote/index.js +16 -10
- package/persisters/persister-remote/with-schemas/index.js +16 -10
- package/persisters/persister-sqlite-bun/index.js +16 -10
- package/persisters/persister-sqlite-bun/with-schemas/index.js +16 -10
- package/persisters/persister-sqlite-wasm/index.js +16 -10
- package/persisters/persister-sqlite-wasm/with-schemas/index.js +16 -10
- package/persisters/persister-sqlite3/index.js +16 -10
- package/persisters/persister-sqlite3/with-schemas/index.js +16 -10
- package/persisters/persister-yjs/index.js +20 -12
- package/persisters/persister-yjs/with-schemas/index.js +20 -12
- package/persisters/with-schemas/index.js +16 -10
- package/queries/index.js +20 -12
- package/queries/with-schemas/index.js +20 -12
- package/readme.md +13 -13
- package/relationships/index.js +10 -5
- package/relationships/with-schemas/index.js +10 -5
- package/releases.md +179 -41
- package/store/index.js +50 -18
- package/store/with-schemas/index.js +50 -18
- package/synchronizers/index.js +16 -10
- package/synchronizers/synchronizer-broadcast-channel/index.js +17 -11
- package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +17 -11
- package/synchronizers/synchronizer-local/index.js +17 -11
- package/synchronizers/synchronizer-local/with-schemas/index.js +17 -11
- package/synchronizers/synchronizer-ws-client/index.js +16 -10
- package/synchronizers/synchronizer-ws-client/with-schemas/index.js +16 -10
- package/synchronizers/synchronizer-ws-server/index.js +16 -10
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +16 -10
- package/synchronizers/synchronizer-ws-server-durable-object/index.js +16 -10
- package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +16 -10
- package/synchronizers/synchronizer-ws-server-simple/index.js +8 -4
- package/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +8 -4
- package/synchronizers/with-schemas/index.js +16 -10
- package/ui-react/index.js +408 -374
- package/ui-react/with-schemas/index.js +408 -374
- package/ui-react-dom/index.js +883 -437
- package/ui-react-dom/with-schemas/index.js +883 -437
- package/ui-react-inspector/index.js +1761 -556
- package/ui-react-inspector/with-schemas/index.js +1761 -556
- package/with-schemas/index.js +63 -31
package/omni/index.js
CHANGED
|
@@ -18,6 +18,7 @@ const FUNCTION$1 = getTypeOf(getTypeOf);
|
|
|
18
18
|
const TRUE = 'true';
|
|
19
19
|
const TYPE = 'type';
|
|
20
20
|
const DEFAULT = 'default';
|
|
21
|
+
const ALLOW_NULL = 'allowNull';
|
|
21
22
|
const UTF8 = 'utf8';
|
|
22
23
|
const SUM = 'sum';
|
|
23
24
|
const AVG = 'avg';
|
|
@@ -62,6 +63,7 @@ const _VALUE = 'value';
|
|
|
62
63
|
const OPEN = 'open';
|
|
63
64
|
const MESSAGE = 'message';
|
|
64
65
|
const ERROR = 'error';
|
|
66
|
+
const EXTRA = 'extra';
|
|
65
67
|
const T = 't';
|
|
66
68
|
const V = 'v';
|
|
67
69
|
const UNDEFINED = '\uFFFC';
|
|
@@ -75,6 +77,10 @@ const strReplace = (str, searchValue, replaceValue) =>
|
|
|
75
77
|
str.replace(searchValue, replaceValue);
|
|
76
78
|
|
|
77
79
|
const promise = Promise;
|
|
80
|
+
const getIfNotFunction =
|
|
81
|
+
(predicate = isNullish) =>
|
|
82
|
+
(value, then, otherwise) =>
|
|
83
|
+
predicate(value) ? otherwise?.() : then(value);
|
|
78
84
|
const GLOBAL = globalThis;
|
|
79
85
|
const WINDOW = GLOBAL.window;
|
|
80
86
|
const THOUSAND = 1e3;
|
|
@@ -90,9 +96,11 @@ const mathMin = math.min;
|
|
|
90
96
|
const mathFloor = math.floor;
|
|
91
97
|
const isFiniteNumber = isFinite;
|
|
92
98
|
const isInstanceOf = (thing, cls) => thing instanceof cls;
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
99
|
+
const isNullish = (thing) => thing == null;
|
|
100
|
+
const isUndefined = (thing) => thing === void 0;
|
|
101
|
+
const isNull = (thing) => thing === null;
|
|
102
|
+
const ifNotNullish = getIfNotFunction(isNullish);
|
|
103
|
+
const ifNotUndefined = getIfNotFunction(isUndefined);
|
|
96
104
|
const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
|
|
97
105
|
const isString = (thing) => getTypeOf(thing) == STRING;
|
|
98
106
|
const isFunction = (thing) => getTypeOf(thing) == FUNCTION$1;
|
|
@@ -144,13 +152,16 @@ const arrayShift = (array) => array.shift();
|
|
|
144
152
|
const arrayWith = (array, index, value) => array.with(index, value);
|
|
145
153
|
|
|
146
154
|
const getCellOrValueType = (cellOrValue) => {
|
|
155
|
+
if (isNull(cellOrValue)) {
|
|
156
|
+
return 'null';
|
|
157
|
+
}
|
|
147
158
|
const type = getTypeOf(cellOrValue);
|
|
148
159
|
return isTypeStringOrBoolean(type) ||
|
|
149
160
|
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
150
161
|
? type
|
|
151
162
|
: void 0;
|
|
152
163
|
};
|
|
153
|
-
const
|
|
164
|
+
const isCellOrValueOrUndefined = (cellOrValue) =>
|
|
154
165
|
isUndefined(cellOrValue) || !isUndefined(getCellOrValueType(cellOrValue));
|
|
155
166
|
const setOrDelCell = (store, tableId, rowId, cellId, cell) =>
|
|
156
167
|
isUndefined(cell)
|
|
@@ -159,7 +170,13 @@ const setOrDelCell = (store, tableId, rowId, cellId, cell) =>
|
|
|
159
170
|
const setOrDelValue = (store, valueId, value) =>
|
|
160
171
|
isUndefined(value) ? store.delValue(valueId) : store.setValue(valueId, value);
|
|
161
172
|
const getTypeCase = (type, stringCase, numberCase, booleanCase) =>
|
|
162
|
-
type == STRING
|
|
173
|
+
type == STRING
|
|
174
|
+
? stringCase
|
|
175
|
+
: type == NUMBER
|
|
176
|
+
? numberCase
|
|
177
|
+
: type == BOOLEAN
|
|
178
|
+
? booleanCase
|
|
179
|
+
: null;
|
|
163
180
|
|
|
164
181
|
const collSizeN = (collSizer) => (coll) =>
|
|
165
182
|
arrayReduce(collValues(coll), (total, coll2) => total + collSizer(coll2), 0);
|
|
@@ -179,12 +196,12 @@ const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
|
179
196
|
const objFrozen = object.isFrozen;
|
|
180
197
|
const objEntries = object.entries;
|
|
181
198
|
const isObject = (obj) =>
|
|
182
|
-
!
|
|
183
|
-
|
|
199
|
+
!isNullish(obj) &&
|
|
200
|
+
ifNotNullish(
|
|
184
201
|
getPrototypeOf(obj),
|
|
185
202
|
(objPrototype) =>
|
|
186
203
|
objPrototype == object.prototype ||
|
|
187
|
-
|
|
204
|
+
isNullish(getPrototypeOf(objPrototype)),
|
|
188
205
|
|
|
189
206
|
/* istanbul ignore next */
|
|
190
207
|
() => true,
|
|
@@ -229,7 +246,7 @@ const objEnsure = (obj, id, getDefaultValue) => {
|
|
|
229
246
|
};
|
|
230
247
|
const objValidate = (obj, validateChild, onInvalidObj, emptyIsValid = 0) => {
|
|
231
248
|
if (
|
|
232
|
-
|
|
249
|
+
isNullish(obj) ||
|
|
233
250
|
!isObject(obj) ||
|
|
234
251
|
(!emptyIsValid && objIsEmpty(obj)) ||
|
|
235
252
|
objFrozen(obj)
|
|
@@ -253,7 +270,7 @@ const mapForEach = (map, cb) =>
|
|
|
253
270
|
const mapMap = (coll, cb) =>
|
|
254
271
|
arrayMap([...(coll?.entries() ?? [])], ([key, value]) => cb(value, key));
|
|
255
272
|
const mapSet = (map, key, value) =>
|
|
256
|
-
|
|
273
|
+
value === void 0 ? (collDel(map, key), map) : map?.set(key, value);
|
|
257
274
|
const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
|
|
258
275
|
if (!collHas(map, key)) {
|
|
259
276
|
mapSet(map, key, getDefaultValue());
|
|
@@ -574,7 +591,7 @@ const getListenerFunctions = (getThing) => {
|
|
|
574
591
|
const index = size(ids);
|
|
575
592
|
if (index == size(path)) {
|
|
576
593
|
listener(thing, ...ids, ...extraArgsGetter(ids));
|
|
577
|
-
} else if (
|
|
594
|
+
} else if (isNull(path[index])) {
|
|
578
595
|
arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
|
|
579
596
|
callWithIds(...ids, id2),
|
|
580
597
|
);
|
|
@@ -727,7 +744,7 @@ const createCheckpoints = getCreateFunction(
|
|
|
727
744
|
? goBackwardImpl
|
|
728
745
|
: arrayHas(forwardIds, checkpointId)
|
|
729
746
|
? goForwardImpl
|
|
730
|
-
:
|
|
747
|
+
: void 0;
|
|
731
748
|
while (!isUndefined(action) && checkpointId != currentId) {
|
|
732
749
|
action();
|
|
733
750
|
}
|
|
@@ -856,7 +873,7 @@ const getUniqueId$1 = (length = 16) =>
|
|
|
856
873
|
arrayReduce(
|
|
857
874
|
getRandomValues(new Uint8Array(length)),
|
|
858
875
|
(uniqueId, number) => uniqueId + encode(number),
|
|
859
|
-
|
|
876
|
+
EMPTY_STRING,
|
|
860
877
|
);
|
|
861
878
|
|
|
862
879
|
const jsonString = JSON.stringify;
|
|
@@ -1311,14 +1328,22 @@ const createStore = () => {
|
|
|
1311
1328
|
const validateValuesSchema = (valuesSchema) =>
|
|
1312
1329
|
objValidate(valuesSchema, validateCellOrValueSchema);
|
|
1313
1330
|
const validateCellOrValueSchema = (schema) => {
|
|
1314
|
-
if (
|
|
1331
|
+
if (
|
|
1332
|
+
!objValidate(schema, (_child, id2) =>
|
|
1333
|
+
arrayHas([TYPE, DEFAULT, ALLOW_NULL], id2),
|
|
1334
|
+
)
|
|
1335
|
+
) {
|
|
1315
1336
|
return false;
|
|
1316
1337
|
}
|
|
1317
1338
|
const type = schema[TYPE];
|
|
1318
1339
|
if (!isTypeStringOrBoolean(type) && type != NUMBER) {
|
|
1319
1340
|
return false;
|
|
1320
1341
|
}
|
|
1321
|
-
|
|
1342
|
+
const defaultValue = schema[DEFAULT];
|
|
1343
|
+
if (isNull(defaultValue) && !schema[ALLOW_NULL]) {
|
|
1344
|
+
return false;
|
|
1345
|
+
}
|
|
1346
|
+
if (!isNull(defaultValue) && getCellOrValueType(defaultValue) != type) {
|
|
1322
1347
|
objDel(schema, DEFAULT);
|
|
1323
1348
|
}
|
|
1324
1349
|
return true;
|
|
@@ -1355,9 +1380,19 @@ const createStore = () => {
|
|
|
1355
1380
|
? ifNotUndefined(
|
|
1356
1381
|
mapGet(mapGet(tablesSchemaMap, tableId), cellId),
|
|
1357
1382
|
(cellSchema) =>
|
|
1358
|
-
|
|
1359
|
-
?
|
|
1360
|
-
|
|
1383
|
+
isNull(cell)
|
|
1384
|
+
? cellSchema[ALLOW_NULL]
|
|
1385
|
+
? cell
|
|
1386
|
+
: cellInvalid(tableId, rowId, cellId, cell, cellSchema[DEFAULT])
|
|
1387
|
+
: getCellOrValueType(cell) == cellSchema[TYPE]
|
|
1388
|
+
? cell
|
|
1389
|
+
: cellInvalid(
|
|
1390
|
+
tableId,
|
|
1391
|
+
rowId,
|
|
1392
|
+
cellId,
|
|
1393
|
+
cell,
|
|
1394
|
+
cellSchema[DEFAULT],
|
|
1395
|
+
),
|
|
1361
1396
|
() => cellInvalid(tableId, rowId, cellId, cell),
|
|
1362
1397
|
)
|
|
1363
1398
|
: isUndefined(getCellOrValueType(cell))
|
|
@@ -1382,9 +1417,13 @@ const createStore = () => {
|
|
|
1382
1417
|
? ifNotUndefined(
|
|
1383
1418
|
mapGet(valuesSchemaMap, valueId),
|
|
1384
1419
|
(valueSchema) =>
|
|
1385
|
-
|
|
1386
|
-
?
|
|
1387
|
-
|
|
1420
|
+
isNull(value)
|
|
1421
|
+
? valueSchema[ALLOW_NULL]
|
|
1422
|
+
? value
|
|
1423
|
+
: valueInvalid(valueId, value, valueSchema[DEFAULT])
|
|
1424
|
+
: getCellOrValueType(value) == valueSchema[TYPE]
|
|
1425
|
+
? value
|
|
1426
|
+
: valueInvalid(valueId, value, valueSchema[DEFAULT]),
|
|
1388
1427
|
() => valueInvalid(valueId, value),
|
|
1389
1428
|
)
|
|
1390
1429
|
: isUndefined(getCellOrValueType(value))
|
|
@@ -1627,7 +1666,7 @@ const createStore = () => {
|
|
|
1627
1666
|
mapSet(
|
|
1628
1667
|
cellIds,
|
|
1629
1668
|
cellId,
|
|
1630
|
-
count != -addedOrRemoved ? count + addedOrRemoved :
|
|
1669
|
+
count != -addedOrRemoved ? count + addedOrRemoved : void 0,
|
|
1631
1670
|
);
|
|
1632
1671
|
idsChanged(
|
|
1633
1672
|
mapEnsure(mapEnsure(changedCellIds, tableId, mapNew), rowId, mapNew),
|
|
@@ -2636,7 +2675,7 @@ const validateMergeableContent = (mergeableContent) =>
|
|
|
2636
2675
|
objValidate(
|
|
2637
2676
|
cellStamps,
|
|
2638
2677
|
(cellStamp) =>
|
|
2639
|
-
stampValidate(cellStamp,
|
|
2678
|
+
stampValidate(cellStamp, isCellOrValueOrUndefined),
|
|
2640
2679
|
void 0,
|
|
2641
2680
|
1,
|
|
2642
2681
|
),
|
|
@@ -2652,7 +2691,7 @@ const validateMergeableContent = (mergeableContent) =>
|
|
|
2652
2691
|
stampValidate(mergeableContent[1], (values) =>
|
|
2653
2692
|
objValidate(
|
|
2654
2693
|
values,
|
|
2655
|
-
(value) => stampValidate(value,
|
|
2694
|
+
(value) => stampValidate(value, isCellOrValueOrUndefined),
|
|
2656
2695
|
void 0,
|
|
2657
2696
|
1,
|
|
2658
2697
|
),
|
|
@@ -3601,7 +3640,7 @@ const getDefaultedTabularConfigMap = (
|
|
|
3601
3640
|
0,
|
|
3602
3641
|
objSize(defaultObj),
|
|
3603
3642
|
);
|
|
3604
|
-
if (!
|
|
3643
|
+
if (!isNull(defaultedConfig[0]) && !exclude(id, defaultedConfig[0])) {
|
|
3605
3644
|
then(id, defaultedConfig[0]);
|
|
3606
3645
|
mapSet(configMap, id, defaultedConfig);
|
|
3607
3646
|
}
|
|
@@ -4328,7 +4367,7 @@ const createCustomSqlitePersister = (
|
|
|
4328
4367
|
` ${DATA_VERSION} d,${SCHEMA_VERSION} s,TOTAL_CHANGES() c FROM ${PRAGMA}${DATA_VERSION} JOIN ${PRAGMA}${SCHEMA_VERSION}`,
|
|
4329
4368
|
);
|
|
4330
4369
|
if (d != dataVersion || s != schemaVersion || c != totalChanges) {
|
|
4331
|
-
if (dataVersion
|
|
4370
|
+
if (!isNullish(dataVersion)) {
|
|
4332
4371
|
listener();
|
|
4333
4372
|
}
|
|
4334
4373
|
dataVersion = d;
|
|
@@ -4484,7 +4523,7 @@ const createAutomergePersister = (
|
|
|
4484
4523
|
) => {
|
|
4485
4524
|
docHandle.change((doc) => objEnsure(doc, docObjName, objNew));
|
|
4486
4525
|
const getPersisted = async () => {
|
|
4487
|
-
const doc =
|
|
4526
|
+
const doc = docHandle.doc();
|
|
4488
4527
|
return objSize(doc?.[docObjName]) == 2
|
|
4489
4528
|
? getDocContent(doc, docObjName)
|
|
4490
4529
|
: void 0;
|
|
@@ -4514,7 +4553,7 @@ const createAutomergePersister = (
|
|
|
4514
4553
|
);
|
|
4515
4554
|
};
|
|
4516
4555
|
|
|
4517
|
-
const STORAGE = 'storage';
|
|
4556
|
+
const STORAGE$1 = 'storage';
|
|
4518
4557
|
const createStoragePersister = (
|
|
4519
4558
|
store,
|
|
4520
4559
|
storageName,
|
|
@@ -4534,11 +4573,11 @@ const createStoragePersister = (
|
|
|
4534
4573
|
);
|
|
4535
4574
|
}
|
|
4536
4575
|
};
|
|
4537
|
-
WINDOW.addEventListener(STORAGE, storageListener);
|
|
4576
|
+
WINDOW.addEventListener(STORAGE$1, storageListener);
|
|
4538
4577
|
return storageListener;
|
|
4539
4578
|
};
|
|
4540
4579
|
const delPersisterListener = (storageListener) =>
|
|
4541
|
-
WINDOW.removeEventListener(STORAGE, storageListener);
|
|
4580
|
+
WINDOW.removeEventListener(STORAGE$1, storageListener);
|
|
4542
4581
|
return createCustomPersister(
|
|
4543
4582
|
store,
|
|
4544
4583
|
getPersisted,
|
|
@@ -4555,6 +4594,32 @@ const createLocalPersister = (store, storageName, onIgnoredError) =>
|
|
|
4555
4594
|
createStoragePersister(store, storageName, localStorage, onIgnoredError);
|
|
4556
4595
|
const createSessionPersister = (store, storageName, onIgnoredError) =>
|
|
4557
4596
|
createStoragePersister(store, storageName, sessionStorage, onIgnoredError);
|
|
4597
|
+
const createOpfsPersister = (store, handle, onIgnoredError) => {
|
|
4598
|
+
const getPersisted = async () =>
|
|
4599
|
+
jsonParseWithUndefined(await (await handle.getFile()).text());
|
|
4600
|
+
const setPersisted = async (getContent) => {
|
|
4601
|
+
const writable = await handle.createWritable();
|
|
4602
|
+
await writable.write(jsonStringWithUndefined(getContent()));
|
|
4603
|
+
await writable.close();
|
|
4604
|
+
};
|
|
4605
|
+
const addPersisterListener = async (listener) => {
|
|
4606
|
+
const observer = new FileSystemObserver(() => listener());
|
|
4607
|
+
await observer.observe(handle);
|
|
4608
|
+
return observer;
|
|
4609
|
+
};
|
|
4610
|
+
const delPersisterListener = (observer) => observer?.disconnect();
|
|
4611
|
+
return createCustomPersister(
|
|
4612
|
+
store,
|
|
4613
|
+
getPersisted,
|
|
4614
|
+
setPersisted,
|
|
4615
|
+
addPersisterListener,
|
|
4616
|
+
delPersisterListener,
|
|
4617
|
+
onIgnoredError,
|
|
4618
|
+
3,
|
|
4619
|
+
// StoreOrMergeableStore,
|
|
4620
|
+
{getHandle: () => handle},
|
|
4621
|
+
);
|
|
4622
|
+
};
|
|
4558
4623
|
|
|
4559
4624
|
const createCrSqliteWasmPersister = (
|
|
4560
4625
|
store,
|
|
@@ -5360,6 +5425,71 @@ const viewUpsert = async (
|
|
|
5360
5425
|
);
|
|
5361
5426
|
};
|
|
5362
5427
|
|
|
5428
|
+
const STORAGE = 'storage';
|
|
5429
|
+
const createReactNativeMmkvPersister = (
|
|
5430
|
+
store,
|
|
5431
|
+
storage,
|
|
5432
|
+
storageName = STORAGE,
|
|
5433
|
+
onIgnoredError,
|
|
5434
|
+
) => {
|
|
5435
|
+
const getPersisted = async () => {
|
|
5436
|
+
const data = storage.getString(storageName);
|
|
5437
|
+
const value = data === void 0 ? void 0 : JSON.parse(data);
|
|
5438
|
+
return Promise.resolve(value);
|
|
5439
|
+
};
|
|
5440
|
+
const setPersisted = async (getContent) => {
|
|
5441
|
+
const content = getContent();
|
|
5442
|
+
if (content !== void 0) {
|
|
5443
|
+
storage.set(storageName, JSON.stringify(content));
|
|
5444
|
+
}
|
|
5445
|
+
};
|
|
5446
|
+
const addPersisterListener = (listener) =>
|
|
5447
|
+
storage.addOnValueChangedListener((key) => {
|
|
5448
|
+
if (key === storageName) {
|
|
5449
|
+
const value = storage.getString(storageName);
|
|
5450
|
+
if (value) {
|
|
5451
|
+
listener(JSON.parse(value));
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5454
|
+
});
|
|
5455
|
+
const delPersisterListener = (storageListener) => {
|
|
5456
|
+
storageListener.remove();
|
|
5457
|
+
};
|
|
5458
|
+
return createCustomPersister(
|
|
5459
|
+
store,
|
|
5460
|
+
getPersisted,
|
|
5461
|
+
setPersisted,
|
|
5462
|
+
addPersisterListener,
|
|
5463
|
+
delPersisterListener,
|
|
5464
|
+
onIgnoredError,
|
|
5465
|
+
3,
|
|
5466
|
+
// StoreOrMergeableStore
|
|
5467
|
+
{getStorageName: () => storageName},
|
|
5468
|
+
);
|
|
5469
|
+
};
|
|
5470
|
+
|
|
5471
|
+
const createReactNativeSqlitePersister = (
|
|
5472
|
+
store,
|
|
5473
|
+
db,
|
|
5474
|
+
configOrStoreTableName,
|
|
5475
|
+
onSqlCommand,
|
|
5476
|
+
onIgnoredError,
|
|
5477
|
+
) =>
|
|
5478
|
+
createCustomSqlitePersister(
|
|
5479
|
+
store,
|
|
5480
|
+
configOrStoreTableName,
|
|
5481
|
+
async (sql, params = []) =>
|
|
5482
|
+
(await db.executeSql(sql, params))[0].rows.raw(),
|
|
5483
|
+
noop,
|
|
5484
|
+
noop,
|
|
5485
|
+
onSqlCommand,
|
|
5486
|
+
onIgnoredError,
|
|
5487
|
+
noop,
|
|
5488
|
+
3,
|
|
5489
|
+
// StoreOrMergeableStore,
|
|
5490
|
+
db,
|
|
5491
|
+
);
|
|
5492
|
+
|
|
5363
5493
|
const getETag = (response) => response.headers.get('ETag');
|
|
5364
5494
|
const createRemotePersister = (
|
|
5365
5495
|
store,
|
|
@@ -5385,8 +5515,8 @@ const createRemotePersister = (
|
|
|
5385
5515
|
const response = await fetch(loadUrl, {method: 'HEAD'});
|
|
5386
5516
|
const currentEtag = getETag(response);
|
|
5387
5517
|
if (
|
|
5388
|
-
!
|
|
5389
|
-
!
|
|
5518
|
+
!isNull(lastEtag) &&
|
|
5519
|
+
!isNull(currentEtag) &&
|
|
5390
5520
|
currentEtag != lastEtag
|
|
5391
5521
|
) {
|
|
5392
5522
|
lastEtag = currentEtag;
|
|
@@ -5513,7 +5643,8 @@ const getChangesFromYDoc = (yContent, events) => {
|
|
|
5513
5643
|
mapForEach(
|
|
5514
5644
|
keys,
|
|
5515
5645
|
(cellId, {action}) =>
|
|
5516
|
-
(row[cellId] =
|
|
5646
|
+
(row[cellId] =
|
|
5647
|
+
action == DELETE ? void 0 : yRow.get(cellId)),
|
|
5517
5648
|
);
|
|
5518
5649
|
},
|
|
5519
5650
|
() =>
|
|
@@ -5521,7 +5652,7 @@ const getChangesFromYDoc = (yContent, events) => {
|
|
|
5521
5652
|
keys,
|
|
5522
5653
|
(rowId, {action}) =>
|
|
5523
5654
|
(table[rowId] =
|
|
5524
|
-
action == DELETE ?
|
|
5655
|
+
action == DELETE ? void 0 : yTable.get(rowId)?.toJSON()),
|
|
5525
5656
|
),
|
|
5526
5657
|
);
|
|
5527
5658
|
},
|
|
@@ -5530,13 +5661,14 @@ const getChangesFromYDoc = (yContent, events) => {
|
|
|
5530
5661
|
keys,
|
|
5531
5662
|
(tableId, {action}) =>
|
|
5532
5663
|
(tables[tableId] =
|
|
5533
|
-
action == DELETE ?
|
|
5664
|
+
action == DELETE ? void 0 : yTables.get(tableId)?.toJSON()),
|
|
5534
5665
|
),
|
|
5535
5666
|
)
|
|
5536
5667
|
: mapForEach(
|
|
5537
5668
|
keys,
|
|
5538
5669
|
(valueId, {action}) =>
|
|
5539
|
-
(values[valueId] =
|
|
5670
|
+
(values[valueId] =
|
|
5671
|
+
action == DELETE ? void 0 : yValues.get(valueId)),
|
|
5540
5672
|
),
|
|
5541
5673
|
);
|
|
5542
5674
|
return [tables, values, 1];
|
|
@@ -5734,7 +5866,7 @@ const createQueries = getCreateFunction((store) => {
|
|
|
5734
5866
|
setDefinition(queryId, tableId);
|
|
5735
5867
|
resetPreStores(queryId);
|
|
5736
5868
|
const selectEntries = [];
|
|
5737
|
-
const joinEntries = [[
|
|
5869
|
+
const joinEntries = [[void 0, [tableId, void 0, void 0, [], mapNew()]]];
|
|
5738
5870
|
const wheres = [];
|
|
5739
5871
|
const groupEntries = [];
|
|
5740
5872
|
const havings = [];
|
|
@@ -5750,7 +5882,7 @@ const createQueries = getCreateFunction((store) => {
|
|
|
5750
5882
|
};
|
|
5751
5883
|
const join = (joinedTableId, arg1, arg2) => {
|
|
5752
5884
|
const fromIntermediateJoinedTableId =
|
|
5753
|
-
isUndefined(arg2) || isFunction(arg1) ?
|
|
5885
|
+
isUndefined(arg2) || isFunction(arg1) ? void 0 : arg1;
|
|
5754
5886
|
const onArg = isUndefined(fromIntermediateJoinedTableId) ? arg1 : arg2;
|
|
5755
5887
|
const joinEntry = [
|
|
5756
5888
|
joinedTableId,
|
|
@@ -5870,7 +6002,7 @@ const createQueries = getCreateFunction((store) => {
|
|
|
5870
6002
|
groupRow[groupedCellId] = isUndefined(
|
|
5871
6003
|
getCellOrValueType(aggregateValue),
|
|
5872
6004
|
)
|
|
5873
|
-
?
|
|
6005
|
+
? void 0
|
|
5874
6006
|
: aggregateValue;
|
|
5875
6007
|
},
|
|
5876
6008
|
);
|
|
@@ -5999,20 +6131,20 @@ const createQueries = getCreateFunction((store) => {
|
|
|
5999
6131
|
const listenToTable = (rootRowId, tableId2, rowId, joinedTableIds2) => {
|
|
6000
6132
|
const getCell = (cellId) => store.getCell(tableId2, rowId, cellId);
|
|
6001
6133
|
arrayForEach(joinedTableIds2, (remoteAsTableId) => {
|
|
6002
|
-
const [realJoinedTableId, , on, nextJoinedTableIds,
|
|
6134
|
+
const [realJoinedTableId, , on, nextJoinedTableIds, remoteIdPairs] =
|
|
6003
6135
|
mapGet(joins, remoteAsTableId);
|
|
6004
6136
|
const remoteRowId = on?.(getCell, rootRowId);
|
|
6005
6137
|
const [previousRemoteRowId, previousRemoteListenerId] =
|
|
6006
|
-
mapGet(
|
|
6138
|
+
mapGet(remoteIdPairs, rootRowId) ?? [];
|
|
6007
6139
|
if (remoteRowId != previousRemoteRowId) {
|
|
6008
6140
|
if (!isUndefined(previousRemoteListenerId)) {
|
|
6009
6141
|
delStoreListeners(queryId, previousRemoteListenerId);
|
|
6010
6142
|
}
|
|
6011
6143
|
mapSet(
|
|
6012
|
-
|
|
6144
|
+
remoteIdPairs,
|
|
6013
6145
|
rootRowId,
|
|
6014
6146
|
isUndefined(remoteRowId)
|
|
6015
|
-
?
|
|
6147
|
+
? void 0
|
|
6016
6148
|
: [
|
|
6017
6149
|
remoteRowId,
|
|
6018
6150
|
...addStoreListeners(
|
|
@@ -6033,7 +6165,7 @@ const createQueries = getCreateFunction((store) => {
|
|
|
6033
6165
|
});
|
|
6034
6166
|
writeSelectRow(rootRowId);
|
|
6035
6167
|
};
|
|
6036
|
-
const {3: joinedTableIds} = mapGet(joins,
|
|
6168
|
+
const {3: joinedTableIds} = mapGet(joins, void 0);
|
|
6037
6169
|
selectJoinWhereStore.transaction(() =>
|
|
6038
6170
|
addStoreListeners(
|
|
6039
6171
|
queryId,
|
|
@@ -6497,7 +6629,7 @@ const createCustomSynchronizer = (
|
|
|
6497
6629
|
ifNotUndefined(
|
|
6498
6630
|
mapGet(pendingRequests, transactionOrRequestId),
|
|
6499
6631
|
([toClientId, handleResponse]) =>
|
|
6500
|
-
|
|
6632
|
+
isNull(toClientId) || toClientId == fromClientId
|
|
6501
6633
|
? handleResponse(body, fromClientId)
|
|
6502
6634
|
: /* istanbul ignore next */
|
|
6503
6635
|
0,
|
|
@@ -6557,7 +6689,7 @@ const createBroadcastChannelSynchronizer = (
|
|
|
6557
6689
|
channel.onmessage = ({
|
|
6558
6690
|
data: [fromClientId, toClientId, requestId, message, body],
|
|
6559
6691
|
}) =>
|
|
6560
|
-
|
|
6692
|
+
isNull(toClientId) || toClientId == clientId
|
|
6561
6693
|
? receive(fromClientId, requestId, message, body)
|
|
6562
6694
|
: 0;
|
|
6563
6695
|
};
|
|
@@ -6582,7 +6714,7 @@ const createLocalSynchronizer = (store, onSend, onReceive, onIgnoredError) => {
|
|
|
6582
6714
|
const clientId = getUniqueId$1();
|
|
6583
6715
|
const send = (toClientId, requestId, message, body) =>
|
|
6584
6716
|
startTimeout(() =>
|
|
6585
|
-
|
|
6717
|
+
isNull(toClientId)
|
|
6586
6718
|
? mapForEach(clients, (otherClientId, receive) =>
|
|
6587
6719
|
otherClientId != clientId
|
|
6588
6720
|
? receive(clientId, requestId, message, body)
|
|
@@ -7021,17 +7153,6 @@ const getIndexStoreTableId = (indexes, indexId) => [
|
|
|
7021
7153
|
indexes?.getTableId(indexId),
|
|
7022
7154
|
];
|
|
7023
7155
|
|
|
7024
|
-
var Offsets = /* @__PURE__ */ ((Offsets2) => {
|
|
7025
|
-
Offsets2[(Offsets2['Store'] = 0)] = 'Store';
|
|
7026
|
-
Offsets2[(Offsets2['Metrics'] = 1)] = 'Metrics';
|
|
7027
|
-
Offsets2[(Offsets2['Indexes'] = 2)] = 'Indexes';
|
|
7028
|
-
Offsets2[(Offsets2['Relationships'] = 3)] = 'Relationships';
|
|
7029
|
-
Offsets2[(Offsets2['Queries'] = 4)] = 'Queries';
|
|
7030
|
-
Offsets2[(Offsets2['Checkpoints'] = 5)] = 'Checkpoints';
|
|
7031
|
-
Offsets2[(Offsets2['Persister'] = 6)] = 'Persister';
|
|
7032
|
-
Offsets2[(Offsets2['Synchronizer'] = 7)] = 'Synchronizer';
|
|
7033
|
-
return Offsets2;
|
|
7034
|
-
})(Offsets || {});
|
|
7035
7156
|
const TINYBASE_CONTEXT = TINYBASE + '_uirc';
|
|
7036
7157
|
const Context = GLOBAL[TINYBASE_CONTEXT]
|
|
7037
7158
|
? /* istanbul ignore next */
|
|
@@ -7062,6 +7183,165 @@ const useProvideThing = (thingId, thing, offset) => {
|
|
|
7062
7183
|
const useThingIds = (offset) =>
|
|
7063
7184
|
objIds(useContext(Context)[offset * 2 + 1] ?? {});
|
|
7064
7185
|
|
|
7186
|
+
const OFFSET_STORE = 0;
|
|
7187
|
+
const OFFSET_METRICS = 1;
|
|
7188
|
+
const OFFSET_INDEXES = 2;
|
|
7189
|
+
const OFFSET_RELATIONSHIPS = 3;
|
|
7190
|
+
const OFFSET_QUERIES = 4;
|
|
7191
|
+
const OFFSET_CHECKPOINTS = 5;
|
|
7192
|
+
const OFFSET_PERSISTER = 6;
|
|
7193
|
+
const OFFSET_SYNCHRONIZER = 7;
|
|
7194
|
+
const mergeParentThings = (
|
|
7195
|
+
offset,
|
|
7196
|
+
parentValue,
|
|
7197
|
+
defaultThing,
|
|
7198
|
+
thingsById,
|
|
7199
|
+
extraThingsById,
|
|
7200
|
+
) => [
|
|
7201
|
+
defaultThing ?? parentValue[offset * 2],
|
|
7202
|
+
{
|
|
7203
|
+
...parentValue[offset * 2 + 1],
|
|
7204
|
+
...thingsById,
|
|
7205
|
+
...extraThingsById[offset],
|
|
7206
|
+
},
|
|
7207
|
+
];
|
|
7208
|
+
const Provider = ({
|
|
7209
|
+
store,
|
|
7210
|
+
storesById,
|
|
7211
|
+
metrics,
|
|
7212
|
+
metricsById,
|
|
7213
|
+
indexes,
|
|
7214
|
+
indexesById,
|
|
7215
|
+
relationships,
|
|
7216
|
+
relationshipsById,
|
|
7217
|
+
queries,
|
|
7218
|
+
queriesById,
|
|
7219
|
+
checkpoints,
|
|
7220
|
+
checkpointsById,
|
|
7221
|
+
persister,
|
|
7222
|
+
persistersById,
|
|
7223
|
+
synchronizer,
|
|
7224
|
+
synchronizersById,
|
|
7225
|
+
children,
|
|
7226
|
+
}) => {
|
|
7227
|
+
const parentValue = useContext(Context);
|
|
7228
|
+
const [extraThingsById, setExtraThingsById] = useState(() =>
|
|
7229
|
+
arrayNew(8, () => ({})),
|
|
7230
|
+
);
|
|
7231
|
+
const addExtraThingById = useCallback(
|
|
7232
|
+
(thingOffset, id, thing) =>
|
|
7233
|
+
setExtraThingsById((extraThingsById2) =>
|
|
7234
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
7235
|
+
? extraThingsById2
|
|
7236
|
+
: arrayWith(extraThingsById2, thingOffset, {
|
|
7237
|
+
...extraThingsById2[thingOffset],
|
|
7238
|
+
[id]: thing,
|
|
7239
|
+
}),
|
|
7240
|
+
),
|
|
7241
|
+
[],
|
|
7242
|
+
);
|
|
7243
|
+
const delExtraThingById = useCallback(
|
|
7244
|
+
(thingOffset, id) =>
|
|
7245
|
+
setExtraThingsById((extraThingsById2) =>
|
|
7246
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
7247
|
+
? extraThingsById2
|
|
7248
|
+
: arrayWith(
|
|
7249
|
+
extraThingsById2,
|
|
7250
|
+
thingOffset,
|
|
7251
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
7252
|
+
),
|
|
7253
|
+
),
|
|
7254
|
+
[],
|
|
7255
|
+
);
|
|
7256
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
7257
|
+
value: useMemo(
|
|
7258
|
+
() => [
|
|
7259
|
+
...mergeParentThings(
|
|
7260
|
+
OFFSET_STORE,
|
|
7261
|
+
parentValue,
|
|
7262
|
+
store,
|
|
7263
|
+
storesById,
|
|
7264
|
+
extraThingsById,
|
|
7265
|
+
),
|
|
7266
|
+
...mergeParentThings(
|
|
7267
|
+
OFFSET_METRICS,
|
|
7268
|
+
parentValue,
|
|
7269
|
+
metrics,
|
|
7270
|
+
metricsById,
|
|
7271
|
+
extraThingsById,
|
|
7272
|
+
),
|
|
7273
|
+
...mergeParentThings(
|
|
7274
|
+
OFFSET_INDEXES,
|
|
7275
|
+
parentValue,
|
|
7276
|
+
indexes,
|
|
7277
|
+
indexesById,
|
|
7278
|
+
extraThingsById,
|
|
7279
|
+
),
|
|
7280
|
+
...mergeParentThings(
|
|
7281
|
+
OFFSET_RELATIONSHIPS,
|
|
7282
|
+
parentValue,
|
|
7283
|
+
relationships,
|
|
7284
|
+
relationshipsById,
|
|
7285
|
+
extraThingsById,
|
|
7286
|
+
),
|
|
7287
|
+
...mergeParentThings(
|
|
7288
|
+
OFFSET_QUERIES,
|
|
7289
|
+
parentValue,
|
|
7290
|
+
queries,
|
|
7291
|
+
queriesById,
|
|
7292
|
+
extraThingsById,
|
|
7293
|
+
),
|
|
7294
|
+
...mergeParentThings(
|
|
7295
|
+
OFFSET_CHECKPOINTS,
|
|
7296
|
+
parentValue,
|
|
7297
|
+
checkpoints,
|
|
7298
|
+
checkpointsById,
|
|
7299
|
+
extraThingsById,
|
|
7300
|
+
),
|
|
7301
|
+
...mergeParentThings(
|
|
7302
|
+
OFFSET_PERSISTER,
|
|
7303
|
+
parentValue,
|
|
7304
|
+
persister,
|
|
7305
|
+
persistersById,
|
|
7306
|
+
extraThingsById,
|
|
7307
|
+
),
|
|
7308
|
+
...mergeParentThings(
|
|
7309
|
+
OFFSET_SYNCHRONIZER,
|
|
7310
|
+
parentValue,
|
|
7311
|
+
synchronizer,
|
|
7312
|
+
synchronizersById,
|
|
7313
|
+
extraThingsById,
|
|
7314
|
+
),
|
|
7315
|
+
addExtraThingById,
|
|
7316
|
+
delExtraThingById,
|
|
7317
|
+
],
|
|
7318
|
+
[
|
|
7319
|
+
extraThingsById,
|
|
7320
|
+
store,
|
|
7321
|
+
storesById,
|
|
7322
|
+
metrics,
|
|
7323
|
+
metricsById,
|
|
7324
|
+
indexes,
|
|
7325
|
+
indexesById,
|
|
7326
|
+
relationships,
|
|
7327
|
+
relationshipsById,
|
|
7328
|
+
queries,
|
|
7329
|
+
queriesById,
|
|
7330
|
+
checkpoints,
|
|
7331
|
+
checkpointsById,
|
|
7332
|
+
persister,
|
|
7333
|
+
persistersById,
|
|
7334
|
+
synchronizer,
|
|
7335
|
+
synchronizersById,
|
|
7336
|
+
parentValue,
|
|
7337
|
+
addExtraThingById,
|
|
7338
|
+
delExtraThingById,
|
|
7339
|
+
],
|
|
7340
|
+
),
|
|
7341
|
+
children,
|
|
7342
|
+
});
|
|
7343
|
+
};
|
|
7344
|
+
|
|
7065
7345
|
const EMPTY_ARRAY = [];
|
|
7066
7346
|
const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
|
|
7067
7347
|
const IS_EQUALS = [
|
|
@@ -7226,13 +7506,13 @@ const useSortedRowIdsListenerImpl = (
|
|
|
7226
7506
|
);
|
|
7227
7507
|
const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
7228
7508
|
useMemo(create, createDeps);
|
|
7229
|
-
const useStoreIds = () => useThingIds(
|
|
7230
|
-
const useStore = (id) => useThing(id,
|
|
7231
|
-
const useStores = () => useThings(
|
|
7509
|
+
const useStoreIds = () => useThingIds(OFFSET_STORE);
|
|
7510
|
+
const useStore = (id) => useThing(id, OFFSET_STORE);
|
|
7511
|
+
const useStores = () => useThings(OFFSET_STORE);
|
|
7232
7512
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
7233
|
-
useThingOrThingById(storeOrStoreId,
|
|
7513
|
+
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
7234
7514
|
const useProvideStore = (storeId, store) =>
|
|
7235
|
-
useProvideThing(storeId, store,
|
|
7515
|
+
useProvideThing(storeId, store, OFFSET_STORE);
|
|
7236
7516
|
const useCreateMergeableStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
7237
7517
|
useMemo(create, createDeps);
|
|
7238
7518
|
const useHasTables = (storeOrStoreId) =>
|
|
@@ -7886,12 +8166,12 @@ const useDidFinishTransactionListener = (
|
|
|
7886
8166
|
);
|
|
7887
8167
|
const useCreateMetrics = (store, create, createDeps) =>
|
|
7888
8168
|
useCreate(store, create, createDeps);
|
|
7889
|
-
const useMetricsIds = () => useThingIds(
|
|
7890
|
-
const useMetrics = (id) => useThing(id,
|
|
8169
|
+
const useMetricsIds = () => useThingIds(OFFSET_METRICS);
|
|
8170
|
+
const useMetrics = (id) => useThing(id, OFFSET_METRICS);
|
|
7891
8171
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
7892
|
-
useThingOrThingById(metricsOrMetricsId,
|
|
8172
|
+
useThingOrThingById(metricsOrMetricsId, OFFSET_METRICS);
|
|
7893
8173
|
const useProvideMetrics = (metricsId, metrics) =>
|
|
7894
|
-
useProvideThing(metricsId, metrics,
|
|
8174
|
+
useProvideThing(metricsId, metrics, OFFSET_METRICS);
|
|
7895
8175
|
const useMetricIds = (metricsOrMetricsId) =>
|
|
7896
8176
|
useListenable(
|
|
7897
8177
|
METRIC + IDS,
|
|
@@ -7920,12 +8200,12 @@ const useMetricListener = (
|
|
|
7920
8200
|
);
|
|
7921
8201
|
const useCreateIndexes = (store, create, createDeps) =>
|
|
7922
8202
|
useCreate(store, create, createDeps);
|
|
7923
|
-
const useIndexesIds = () => useThingIds(
|
|
7924
|
-
const useIndexes = (id) => useThing(id,
|
|
8203
|
+
const useIndexesIds = () => useThingIds(OFFSET_INDEXES);
|
|
8204
|
+
const useIndexes = (id) => useThing(id, OFFSET_INDEXES);
|
|
7925
8205
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
7926
|
-
useThingOrThingById(indexesOrIndexesId,
|
|
8206
|
+
useThingOrThingById(indexesOrIndexesId, OFFSET_INDEXES);
|
|
7927
8207
|
const useProvideIndexes = (indexesId, indexes) =>
|
|
7928
|
-
useProvideThing(indexesId, indexes,
|
|
8208
|
+
useProvideThing(indexesId, indexes, OFFSET_INDEXES);
|
|
7929
8209
|
const useSliceIds = (indexId, indexesOrIndexesId) =>
|
|
7930
8210
|
useListenable(
|
|
7931
8211
|
SLICE + IDS,
|
|
@@ -7975,12 +8255,12 @@ const useSliceRowIdsListener = (
|
|
|
7975
8255
|
);
|
|
7976
8256
|
const useCreateRelationships = (store, create, createDeps) =>
|
|
7977
8257
|
useCreate(store, create, createDeps);
|
|
7978
|
-
const useRelationshipsIds = () => useThingIds(
|
|
7979
|
-
const useRelationships = (id) => useThing(id,
|
|
8258
|
+
const useRelationshipsIds = () => useThingIds(OFFSET_RELATIONSHIPS);
|
|
8259
|
+
const useRelationships = (id) => useThing(id, OFFSET_RELATIONSHIPS);
|
|
7980
8260
|
const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
|
|
7981
|
-
useThingOrThingById(relationshipsOrRelationshipsId,
|
|
8261
|
+
useThingOrThingById(relationshipsOrRelationshipsId, OFFSET_RELATIONSHIPS);
|
|
7982
8262
|
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
7983
|
-
useProvideThing(relationshipsId, relationships,
|
|
8263
|
+
useProvideThing(relationshipsId, relationships, OFFSET_RELATIONSHIPS);
|
|
7984
8264
|
const useRelationshipIds = (relationshipsOrRelationshipsId) =>
|
|
7985
8265
|
useListenable(
|
|
7986
8266
|
RELATIONSHIP + IDS,
|
|
@@ -8064,12 +8344,12 @@ const useLinkedRowIdsListener = (
|
|
|
8064
8344
|
);
|
|
8065
8345
|
const useCreateQueries = (store, create, createDeps) =>
|
|
8066
8346
|
useCreate(store, create, createDeps);
|
|
8067
|
-
const useQueriesIds = () => useThingIds(
|
|
8068
|
-
const useQueries = (id) => useThing(id,
|
|
8347
|
+
const useQueriesIds = () => useThingIds(OFFSET_QUERIES);
|
|
8348
|
+
const useQueries = (id) => useThing(id, OFFSET_QUERIES);
|
|
8069
8349
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
8070
|
-
useThingOrThingById(queriesOrQueriesId,
|
|
8350
|
+
useThingOrThingById(queriesOrQueriesId, OFFSET_QUERIES);
|
|
8071
8351
|
const useProvideQueries = (queriesId, queries) =>
|
|
8072
|
-
useProvideThing(queriesId, queries,
|
|
8352
|
+
useProvideThing(queriesId, queries, OFFSET_QUERIES);
|
|
8073
8353
|
const useQueryIds = (queriesOrQueriesId) =>
|
|
8074
8354
|
useListenable(
|
|
8075
8355
|
QUERY + IDS,
|
|
@@ -8253,12 +8533,12 @@ const useResultCellListener = (
|
|
|
8253
8533
|
);
|
|
8254
8534
|
const useCreateCheckpoints = (store, create, createDeps) =>
|
|
8255
8535
|
useCreate(store, create, createDeps);
|
|
8256
|
-
const useCheckpointsIds = () => useThingIds(
|
|
8257
|
-
const useCheckpoints = (id) => useThing(id,
|
|
8536
|
+
const useCheckpointsIds = () => useThingIds(OFFSET_CHECKPOINTS);
|
|
8537
|
+
const useCheckpoints = (id) => useThing(id, OFFSET_CHECKPOINTS);
|
|
8258
8538
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
8259
|
-
useThingOrThingById(checkpointsOrCheckpointsId,
|
|
8539
|
+
useThingOrThingById(checkpointsOrCheckpointsId, OFFSET_CHECKPOINTS);
|
|
8260
8540
|
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
8261
|
-
useProvideThing(checkpointsId, checkpoints,
|
|
8541
|
+
useProvideThing(checkpointsId, checkpoints, OFFSET_CHECKPOINTS);
|
|
8262
8542
|
const useCheckpointIds = (checkpointsOrCheckpointsId) =>
|
|
8263
8543
|
useListenable(
|
|
8264
8544
|
CHECKPOINT + IDS,
|
|
@@ -8406,12 +8686,12 @@ const useCreatePersister = (
|
|
|
8406
8686
|
);
|
|
8407
8687
|
return persister;
|
|
8408
8688
|
};
|
|
8409
|
-
const usePersisterIds = () => useThingIds(
|
|
8410
|
-
const usePersister = (id) => useThing(id,
|
|
8689
|
+
const usePersisterIds = () => useThingIds(OFFSET_PERSISTER);
|
|
8690
|
+
const usePersister = (id) => useThing(id, OFFSET_PERSISTER);
|
|
8411
8691
|
const usePersisterOrPersisterById = (persisterOrPersisterId) =>
|
|
8412
|
-
useThingOrThingById(persisterOrPersisterId,
|
|
8692
|
+
useThingOrThingById(persisterOrPersisterId, OFFSET_PERSISTER);
|
|
8413
8693
|
const useProvidePersister = (persisterId, persister) =>
|
|
8414
|
-
useProvideThing(persisterId, persister,
|
|
8694
|
+
useProvideThing(persisterId, persister, OFFSET_PERSISTER);
|
|
8415
8695
|
const usePersisterStatus = (persisterOrPersisterId) =>
|
|
8416
8696
|
useListenable(
|
|
8417
8697
|
STATUS,
|
|
@@ -8461,12 +8741,12 @@ const useCreateSynchronizer = (
|
|
|
8461
8741
|
);
|
|
8462
8742
|
return synchronizer;
|
|
8463
8743
|
};
|
|
8464
|
-
const useSynchronizerIds = () => useThingIds(
|
|
8465
|
-
const useSynchronizer = (id) => useThing(id,
|
|
8744
|
+
const useSynchronizerIds = () => useThingIds(OFFSET_SYNCHRONIZER);
|
|
8745
|
+
const useSynchronizer = (id) => useThing(id, OFFSET_SYNCHRONIZER);
|
|
8466
8746
|
const useSynchronizerOrSynchronizerById = (synchronizerOrSynchronizerId) =>
|
|
8467
|
-
useThingOrThingById(synchronizerOrSynchronizerId,
|
|
8747
|
+
useThingOrThingById(synchronizerOrSynchronizerId, OFFSET_SYNCHRONIZER);
|
|
8468
8748
|
const useProvideSynchronizer = (persisterId, persister) =>
|
|
8469
|
-
useProvideThing(persisterId, persister,
|
|
8749
|
+
useProvideThing(persisterId, persister, OFFSET_SYNCHRONIZER);
|
|
8470
8750
|
const useSynchronizerStatus = (synchronizerOrSynchronizerId) =>
|
|
8471
8751
|
useListenable(
|
|
8472
8752
|
STATUS,
|
|
@@ -8487,281 +8767,314 @@ const useSynchronizerStatusListener = (
|
|
|
8487
8767
|
[],
|
|
8488
8768
|
);
|
|
8489
8769
|
|
|
8490
|
-
const
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
];
|
|
8504
|
-
const tableView = (
|
|
8505
|
-
{
|
|
8506
|
-
tableId,
|
|
8507
|
-
store,
|
|
8508
|
-
rowComponent: Row = RowView,
|
|
8509
|
-
getRowComponentProps,
|
|
8510
|
-
customCellIds,
|
|
8511
|
-
separator,
|
|
8512
|
-
debugIds,
|
|
8513
|
-
},
|
|
8514
|
-
rowIds,
|
|
8515
|
-
) =>
|
|
8516
|
-
wrap(
|
|
8517
|
-
arrayMap(rowIds, (rowId) =>
|
|
8518
|
-
/* @__PURE__ */ jsx(
|
|
8519
|
-
Row,
|
|
8520
|
-
{
|
|
8521
|
-
...getProps(getRowComponentProps, rowId),
|
|
8522
|
-
tableId,
|
|
8523
|
-
rowId,
|
|
8524
|
-
customCellIds,
|
|
8525
|
-
store,
|
|
8526
|
-
debugIds,
|
|
8527
|
-
},
|
|
8528
|
-
rowId,
|
|
8529
|
-
),
|
|
8530
|
-
),
|
|
8531
|
-
separator,
|
|
8532
|
-
debugIds,
|
|
8533
|
-
tableId,
|
|
8770
|
+
const useStoreCellComponentProps = (store, tableId) =>
|
|
8771
|
+
useMemo(() => ({store, tableId}), [store, tableId]);
|
|
8772
|
+
const useQueriesCellComponentProps = (queries, queryId) =>
|
|
8773
|
+
useMemo(() => ({queries, queryId}), [queries, queryId]);
|
|
8774
|
+
const useCallbackOrUndefined = (callback, deps, test) => {
|
|
8775
|
+
const returnCallback = useCallback(callback, deps);
|
|
8776
|
+
return test ? returnCallback : void 0;
|
|
8777
|
+
};
|
|
8778
|
+
const useParams = (...args) =>
|
|
8779
|
+
useMemo(
|
|
8780
|
+
() => args,
|
|
8781
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8782
|
+
args,
|
|
8534
8783
|
);
|
|
8535
|
-
const
|
|
8536
|
-
{
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8784
|
+
const useCells = (defaultCellIds, customCells, defaultCellComponent) =>
|
|
8785
|
+
useMemo(() => {
|
|
8786
|
+
const cellIds = customCells ?? defaultCellIds;
|
|
8787
|
+
return objMap(
|
|
8788
|
+
isArray(cellIds)
|
|
8789
|
+
? objNew(arrayMap(cellIds, (cellId) => [cellId, cellId]))
|
|
8790
|
+
: cellIds,
|
|
8791
|
+
(labelOrCustomCell, cellId) => ({
|
|
8792
|
+
...{label: cellId, component: defaultCellComponent},
|
|
8793
|
+
...(isString(labelOrCustomCell)
|
|
8794
|
+
? {label: labelOrCustomCell}
|
|
8795
|
+
: labelOrCustomCell),
|
|
8796
|
+
}),
|
|
8797
|
+
);
|
|
8798
|
+
}, [customCells, defaultCellComponent, defaultCellIds]);
|
|
8799
|
+
|
|
8800
|
+
const UP_ARROW = '\u2191';
|
|
8801
|
+
const DOWN_ARROW = '\u2193';
|
|
8802
|
+
const EDITABLE = 'editable';
|
|
8803
|
+
const extraRowCells = (extraRowCells2 = [], extraRowCellProps, after = 0) =>
|
|
8804
|
+
arrayMap(extraRowCells2, ({component: Component}, index) =>
|
|
8805
|
+
/* @__PURE__ */ jsx(
|
|
8806
|
+
'td',
|
|
8807
|
+
{
|
|
8808
|
+
className: EXTRA,
|
|
8809
|
+
children: /* @__PURE__ */ jsx(Component, {...extraRowCellProps}),
|
|
8810
|
+
},
|
|
8811
|
+
extraKey(index, after),
|
|
8559
8812
|
),
|
|
8560
|
-
separator,
|
|
8561
|
-
debugIds,
|
|
8562
|
-
queryId,
|
|
8563
8813
|
);
|
|
8564
|
-
const
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
debugIds,
|
|
8572
|
-
},
|
|
8573
|
-
getRowIdsHook,
|
|
8574
|
-
rowId,
|
|
8575
|
-
) => {
|
|
8576
|
-
const [resolvedRelationships, store, localTableId] =
|
|
8577
|
-
getRelationshipsStoreTableIds(
|
|
8578
|
-
useRelationshipsOrRelationshipsById(relationships),
|
|
8579
|
-
relationshipId,
|
|
8580
|
-
);
|
|
8581
|
-
const rowIds = getRowIdsHook(relationshipId, rowId, resolvedRelationships);
|
|
8582
|
-
return wrap(
|
|
8583
|
-
arrayMap(rowIds, (rowId2) =>
|
|
8584
|
-
/* @__PURE__ */ jsx(
|
|
8585
|
-
Row,
|
|
8586
|
-
{
|
|
8587
|
-
...getProps(getRowComponentProps, rowId2),
|
|
8588
|
-
tableId: localTableId,
|
|
8589
|
-
rowId: rowId2,
|
|
8590
|
-
store,
|
|
8591
|
-
debugIds,
|
|
8592
|
-
},
|
|
8593
|
-
rowId2,
|
|
8594
|
-
),
|
|
8814
|
+
const extraKey = (index, after) => (after ? '>' : '<') + index;
|
|
8815
|
+
const extraHeaders = (extraCells = [], after = 0) =>
|
|
8816
|
+
arrayMap(extraCells, ({label}, index) =>
|
|
8817
|
+
/* @__PURE__ */ jsx(
|
|
8818
|
+
'th',
|
|
8819
|
+
{className: EXTRA, children: label},
|
|
8820
|
+
extraKey(index, after),
|
|
8595
8821
|
),
|
|
8596
|
-
separator,
|
|
8597
|
-
debugIds,
|
|
8598
|
-
rowId,
|
|
8599
8822
|
);
|
|
8600
|
-
|
|
8601
|
-
const
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8823
|
+
|
|
8824
|
+
const HtmlHeaderCell = ({
|
|
8825
|
+
cellId,
|
|
8826
|
+
sort: [sortCellId, sortDescending],
|
|
8827
|
+
label = cellId ?? EMPTY_STRING,
|
|
8828
|
+
onClick,
|
|
8829
|
+
}) =>
|
|
8830
|
+
/* @__PURE__ */ jsxs('th', {
|
|
8831
|
+
onClick: useCallbackOrUndefined(
|
|
8832
|
+
() => onClick?.(cellId),
|
|
8833
|
+
[onClick, cellId],
|
|
8834
|
+
onClick,
|
|
8835
|
+
),
|
|
8836
|
+
className:
|
|
8837
|
+
isUndefined(sortDescending) || sortCellId != cellId
|
|
8838
|
+
? void 0
|
|
8839
|
+
: `sorted ${sortDescending ? 'de' : 'a'}scending`,
|
|
8840
|
+
children: [
|
|
8841
|
+
isUndefined(sortDescending) || sortCellId != cellId
|
|
8842
|
+
? null
|
|
8843
|
+
: (sortDescending ? DOWN_ARROW : UP_ARROW) + ' ',
|
|
8844
|
+
label,
|
|
8845
|
+
],
|
|
8846
|
+
});
|
|
8847
|
+
const HtmlTable = ({
|
|
8848
|
+
className,
|
|
8849
|
+
headerRow,
|
|
8850
|
+
idColumn,
|
|
8851
|
+
params: [
|
|
8852
|
+
cells,
|
|
8853
|
+
cellComponentProps,
|
|
8854
|
+
rowIds,
|
|
8855
|
+
extraCellsBefore,
|
|
8856
|
+
extraCellsAfter,
|
|
8857
|
+
sortAndOffset,
|
|
8858
|
+
handleSort,
|
|
8859
|
+
paginatorComponent,
|
|
8860
|
+
],
|
|
8861
|
+
}) =>
|
|
8862
|
+
/* @__PURE__ */ jsxs('table', {
|
|
8863
|
+
className,
|
|
8864
|
+
children: [
|
|
8865
|
+
paginatorComponent
|
|
8866
|
+
? /* @__PURE__ */ jsx('caption', {children: paginatorComponent})
|
|
8867
|
+
: null,
|
|
8868
|
+
headerRow === false
|
|
8869
|
+
? null
|
|
8870
|
+
: /* @__PURE__ */ jsx('thead', {
|
|
8871
|
+
children: /* @__PURE__ */ jsxs('tr', {
|
|
8872
|
+
children: [
|
|
8873
|
+
extraHeaders(extraCellsBefore),
|
|
8874
|
+
idColumn === false
|
|
8875
|
+
? null
|
|
8876
|
+
: /* @__PURE__ */ jsx(HtmlHeaderCell, {
|
|
8877
|
+
sort: sortAndOffset ?? [],
|
|
8878
|
+
label: 'Id',
|
|
8879
|
+
onClick: handleSort,
|
|
8880
|
+
}),
|
|
8881
|
+
objToArray(cells, ({label}, cellId) =>
|
|
8882
|
+
/* @__PURE__ */ jsx(
|
|
8883
|
+
HtmlHeaderCell,
|
|
8884
|
+
{
|
|
8885
|
+
cellId,
|
|
8886
|
+
label,
|
|
8887
|
+
sort: sortAndOffset ?? [],
|
|
8888
|
+
onClick: handleSort,
|
|
8889
|
+
},
|
|
8890
|
+
cellId,
|
|
8891
|
+
),
|
|
8892
|
+
),
|
|
8893
|
+
extraHeaders(extraCellsAfter, 1),
|
|
8894
|
+
],
|
|
8895
|
+
}),
|
|
8896
|
+
}),
|
|
8897
|
+
/* @__PURE__ */ jsx('tbody', {
|
|
8898
|
+
children: arrayMap(rowIds, (rowId) => {
|
|
8899
|
+
const rowProps = {...cellComponentProps, rowId};
|
|
8900
|
+
return /* @__PURE__ */ jsxs(
|
|
8901
|
+
'tr',
|
|
8617
8902
|
{
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8903
|
+
children: [
|
|
8904
|
+
extraRowCells(extraCellsBefore, rowProps),
|
|
8905
|
+
idColumn === false
|
|
8906
|
+
? null
|
|
8907
|
+
: /* @__PURE__ */ jsx('th', {title: rowId, children: rowId}),
|
|
8908
|
+
objToArray(
|
|
8909
|
+
cells,
|
|
8910
|
+
({component: CellView, getComponentProps}, cellId) =>
|
|
8911
|
+
/* @__PURE__ */ jsx(
|
|
8912
|
+
'td',
|
|
8913
|
+
{
|
|
8914
|
+
children: /* @__PURE__ */ jsx(CellView, {
|
|
8915
|
+
...getProps(getComponentProps, rowId, cellId),
|
|
8916
|
+
...rowProps,
|
|
8917
|
+
cellId,
|
|
8918
|
+
}),
|
|
8919
|
+
},
|
|
8920
|
+
cellId,
|
|
8921
|
+
),
|
|
8922
|
+
),
|
|
8923
|
+
extraRowCells(extraCellsAfter, rowProps, 1),
|
|
8924
|
+
],
|
|
8622
8925
|
},
|
|
8623
|
-
|
|
8624
|
-
)
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
};
|
|
8629
|
-
const
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
indexesById,
|
|
8636
|
-
relationships,
|
|
8637
|
-
relationshipsById,
|
|
8638
|
-
queries,
|
|
8639
|
-
queriesById,
|
|
8640
|
-
checkpoints,
|
|
8641
|
-
checkpointsById,
|
|
8642
|
-
persister,
|
|
8643
|
-
persistersById,
|
|
8644
|
-
synchronizer,
|
|
8645
|
-
synchronizersById,
|
|
8646
|
-
children,
|
|
8926
|
+
rowId,
|
|
8927
|
+
);
|
|
8928
|
+
}),
|
|
8929
|
+
}),
|
|
8930
|
+
],
|
|
8931
|
+
});
|
|
8932
|
+
const EditableThing = ({
|
|
8933
|
+
thing,
|
|
8934
|
+
onThingChange,
|
|
8935
|
+
className,
|
|
8936
|
+
hasSchema,
|
|
8937
|
+
showType = true,
|
|
8647
8938
|
}) => {
|
|
8648
|
-
const
|
|
8649
|
-
const [
|
|
8650
|
-
|
|
8651
|
-
);
|
|
8652
|
-
const
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8939
|
+
const [thingType, setThingType] = useState();
|
|
8940
|
+
const [currentThing, setCurrentThing] = useState();
|
|
8941
|
+
const [stringThing, setStringThing] = useState();
|
|
8942
|
+
const [numberThing, setNumberThing] = useState();
|
|
8943
|
+
const [booleanThing, setBooleanThing] = useState();
|
|
8944
|
+
if (currentThing !== thing) {
|
|
8945
|
+
setThingType(getCellOrValueType(thing));
|
|
8946
|
+
setCurrentThing(thing);
|
|
8947
|
+
setStringThing(String(thing));
|
|
8948
|
+
setNumberThing(Number(thing) || 0);
|
|
8949
|
+
setBooleanThing(Boolean(thing));
|
|
8950
|
+
}
|
|
8951
|
+
const handleThingChange = useCallback(
|
|
8952
|
+
(thing2, setTypedThing) => {
|
|
8953
|
+
setTypedThing(thing2);
|
|
8954
|
+
setCurrentThing(thing2);
|
|
8955
|
+
onThingChange(thing2);
|
|
8956
|
+
},
|
|
8957
|
+
[onThingChange],
|
|
8663
8958
|
);
|
|
8664
|
-
const
|
|
8665
|
-
(
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8959
|
+
const handleTypeChange = useCallback(() => {
|
|
8960
|
+
if (!hasSchema?.()) {
|
|
8961
|
+
const nextType = getTypeCase(thingType, NUMBER, BOOLEAN, STRING);
|
|
8962
|
+
const thing2 = getTypeCase(
|
|
8963
|
+
nextType,
|
|
8964
|
+
stringThing,
|
|
8965
|
+
numberThing,
|
|
8966
|
+
booleanThing,
|
|
8967
|
+
);
|
|
8968
|
+
setThingType(nextType);
|
|
8969
|
+
setCurrentThing(thing2);
|
|
8970
|
+
onThingChange(thing2);
|
|
8971
|
+
}
|
|
8972
|
+
}, [
|
|
8973
|
+
hasSchema,
|
|
8974
|
+
onThingChange,
|
|
8975
|
+
stringThing,
|
|
8976
|
+
numberThing,
|
|
8977
|
+
booleanThing,
|
|
8978
|
+
thingType,
|
|
8979
|
+
]);
|
|
8980
|
+
const widget = getTypeCase(
|
|
8981
|
+
thingType,
|
|
8982
|
+
/* @__PURE__ */ jsx(
|
|
8983
|
+
'input',
|
|
8984
|
+
{
|
|
8985
|
+
value: stringThing,
|
|
8986
|
+
onChange: useCallback(
|
|
8987
|
+
(event) =>
|
|
8988
|
+
handleThingChange(
|
|
8989
|
+
String(event[CURRENT_TARGET][_VALUE]),
|
|
8990
|
+
setStringThing,
|
|
8673
8991
|
),
|
|
8674
|
-
|
|
8675
|
-
[],
|
|
8676
|
-
);
|
|
8677
|
-
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
8678
|
-
value: useMemo(
|
|
8679
|
-
() => [
|
|
8680
|
-
...mergeParentThings(
|
|
8681
|
-
0 /* Store */,
|
|
8682
|
-
parentValue,
|
|
8683
|
-
store,
|
|
8684
|
-
storesById,
|
|
8685
|
-
extraThingsById,
|
|
8992
|
+
[handleThingChange],
|
|
8686
8993
|
),
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
3 /* Relationships */,
|
|
8703
|
-
parentValue,
|
|
8704
|
-
relationships,
|
|
8705
|
-
relationshipsById,
|
|
8706
|
-
extraThingsById,
|
|
8707
|
-
),
|
|
8708
|
-
...mergeParentThings(
|
|
8709
|
-
4 /* Queries */,
|
|
8710
|
-
parentValue,
|
|
8711
|
-
queries,
|
|
8712
|
-
queriesById,
|
|
8713
|
-
extraThingsById,
|
|
8714
|
-
),
|
|
8715
|
-
...mergeParentThings(
|
|
8716
|
-
5 /* Checkpoints */,
|
|
8717
|
-
parentValue,
|
|
8718
|
-
checkpoints,
|
|
8719
|
-
checkpointsById,
|
|
8720
|
-
extraThingsById,
|
|
8721
|
-
),
|
|
8722
|
-
...mergeParentThings(
|
|
8723
|
-
6 /* Persister */,
|
|
8724
|
-
parentValue,
|
|
8725
|
-
persister,
|
|
8726
|
-
persistersById,
|
|
8727
|
-
extraThingsById,
|
|
8994
|
+
},
|
|
8995
|
+
thingType,
|
|
8996
|
+
),
|
|
8997
|
+
/* @__PURE__ */ jsx(
|
|
8998
|
+
'input',
|
|
8999
|
+
{
|
|
9000
|
+
type: 'number',
|
|
9001
|
+
value: numberThing,
|
|
9002
|
+
onChange: useCallback(
|
|
9003
|
+
(event) =>
|
|
9004
|
+
handleThingChange(
|
|
9005
|
+
Number(event[CURRENT_TARGET][_VALUE] || 0),
|
|
9006
|
+
setNumberThing,
|
|
9007
|
+
),
|
|
9008
|
+
[handleThingChange],
|
|
8728
9009
|
),
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
9010
|
+
},
|
|
9011
|
+
thingType,
|
|
9012
|
+
),
|
|
9013
|
+
/* @__PURE__ */ jsx(
|
|
9014
|
+
'input',
|
|
9015
|
+
{
|
|
9016
|
+
type: 'checkbox',
|
|
9017
|
+
checked: booleanThing,
|
|
9018
|
+
onChange: useCallback(
|
|
9019
|
+
(event) =>
|
|
9020
|
+
handleThingChange(
|
|
9021
|
+
Boolean(event[CURRENT_TARGET].checked),
|
|
9022
|
+
setBooleanThing,
|
|
9023
|
+
),
|
|
9024
|
+
[handleThingChange],
|
|
8735
9025
|
),
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
],
|
|
8739
|
-
[
|
|
8740
|
-
extraThingsById,
|
|
8741
|
-
store,
|
|
8742
|
-
storesById,
|
|
8743
|
-
metrics,
|
|
8744
|
-
metricsById,
|
|
8745
|
-
indexes,
|
|
8746
|
-
indexesById,
|
|
8747
|
-
relationships,
|
|
8748
|
-
relationshipsById,
|
|
8749
|
-
queries,
|
|
8750
|
-
queriesById,
|
|
8751
|
-
checkpoints,
|
|
8752
|
-
checkpointsById,
|
|
8753
|
-
persister,
|
|
8754
|
-
persistersById,
|
|
8755
|
-
synchronizer,
|
|
8756
|
-
synchronizersById,
|
|
8757
|
-
parentValue,
|
|
8758
|
-
addExtraThingById,
|
|
8759
|
-
delExtraThingById,
|
|
8760
|
-
],
|
|
9026
|
+
},
|
|
9027
|
+
thingType,
|
|
8761
9028
|
),
|
|
8762
|
-
|
|
9029
|
+
);
|
|
9030
|
+
return /* @__PURE__ */ jsxs('div', {
|
|
9031
|
+
className,
|
|
9032
|
+
children: [
|
|
9033
|
+
showType && widget
|
|
9034
|
+
? /* @__PURE__ */ jsx('button', {
|
|
9035
|
+
title: thingType,
|
|
9036
|
+
className: thingType,
|
|
9037
|
+
onClick: handleTypeChange,
|
|
9038
|
+
children: thingType,
|
|
9039
|
+
})
|
|
9040
|
+
: null,
|
|
9041
|
+
widget,
|
|
9042
|
+
],
|
|
8763
9043
|
});
|
|
8764
9044
|
};
|
|
9045
|
+
|
|
9046
|
+
const EditableCellView = ({
|
|
9047
|
+
tableId,
|
|
9048
|
+
rowId,
|
|
9049
|
+
cellId,
|
|
9050
|
+
store,
|
|
9051
|
+
className,
|
|
9052
|
+
showType,
|
|
9053
|
+
}) =>
|
|
9054
|
+
/* @__PURE__ */ jsx(EditableThing, {
|
|
9055
|
+
thing: useCell(tableId, rowId, cellId, store),
|
|
9056
|
+
onThingChange: useSetCellCallback(
|
|
9057
|
+
tableId,
|
|
9058
|
+
rowId,
|
|
9059
|
+
cellId,
|
|
9060
|
+
(cell) => cell,
|
|
9061
|
+
[],
|
|
9062
|
+
store,
|
|
9063
|
+
),
|
|
9064
|
+
className: className ?? EDITABLE + CELL,
|
|
9065
|
+
showType,
|
|
9066
|
+
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
9067
|
+
});
|
|
9068
|
+
|
|
9069
|
+
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
9070
|
+
/* @__PURE__ */ jsx(EditableThing, {
|
|
9071
|
+
thing: useValue(valueId, store),
|
|
9072
|
+
onThingChange: useSetValueCallback(valueId, (value) => value, [], store),
|
|
9073
|
+
className: className ?? EDITABLE + VALUE,
|
|
9074
|
+
showType,
|
|
9075
|
+
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
9076
|
+
});
|
|
9077
|
+
|
|
8765
9078
|
const wrap = (children, separator, encloseWithId, id) => {
|
|
8766
9079
|
const separated =
|
|
8767
9080
|
isUndefined(separator) || !isArray(children)
|
|
@@ -8769,10 +9082,53 @@ const wrap = (children, separator, encloseWithId, id) => {
|
|
|
8769
9082
|
: arrayMap(children, (child, c) => (c > 0 ? [separator, child] : child));
|
|
8770
9083
|
return encloseWithId ? [id, ':{', separated, '}'] : separated;
|
|
8771
9084
|
};
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
9085
|
+
|
|
9086
|
+
const CheckpointView = ({checkpoints, checkpointId, debugIds}) =>
|
|
9087
|
+
wrap(
|
|
9088
|
+
useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
|
|
9089
|
+
void 0,
|
|
9090
|
+
debugIds,
|
|
9091
|
+
checkpointId,
|
|
9092
|
+
);
|
|
9093
|
+
|
|
9094
|
+
const ResultCellView = ({queryId, rowId, cellId, queries, debugIds}) =>
|
|
9095
|
+
wrap(
|
|
9096
|
+
EMPTY_STRING +
|
|
9097
|
+
(useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
|
|
9098
|
+
void 0,
|
|
9099
|
+
debugIds,
|
|
9100
|
+
cellId,
|
|
9101
|
+
);
|
|
9102
|
+
|
|
9103
|
+
const ResultRowView = ({
|
|
9104
|
+
queryId,
|
|
9105
|
+
rowId,
|
|
9106
|
+
queries,
|
|
9107
|
+
resultCellComponent: ResultCell = ResultCellView,
|
|
9108
|
+
getResultCellComponentProps,
|
|
9109
|
+
separator,
|
|
9110
|
+
debugIds,
|
|
9111
|
+
}) =>
|
|
9112
|
+
wrap(
|
|
9113
|
+
arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) =>
|
|
9114
|
+
/* @__PURE__ */ jsx(
|
|
9115
|
+
ResultCell,
|
|
9116
|
+
{
|
|
9117
|
+
...getProps(getResultCellComponentProps, cellId),
|
|
9118
|
+
queryId,
|
|
9119
|
+
rowId,
|
|
9120
|
+
cellId,
|
|
9121
|
+
queries,
|
|
9122
|
+
debugIds,
|
|
9123
|
+
},
|
|
9124
|
+
cellId,
|
|
9125
|
+
),
|
|
9126
|
+
),
|
|
9127
|
+
separator,
|
|
9128
|
+
debugIds,
|
|
9129
|
+
rowId,
|
|
9130
|
+
);
|
|
9131
|
+
|
|
8776
9132
|
const CellView = ({tableId, rowId, cellId, store, debugIds}) =>
|
|
8777
9133
|
wrap(
|
|
8778
9134
|
EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING),
|
|
@@ -8780,6 +9136,12 @@ const CellView = ({tableId, rowId, cellId, store, debugIds}) =>
|
|
|
8780
9136
|
debugIds,
|
|
8781
9137
|
cellId,
|
|
8782
9138
|
);
|
|
9139
|
+
|
|
9140
|
+
const useCustomOrDefaultCellIds = (customCellIds, tableId, rowId, store) => {
|
|
9141
|
+
const defaultCellIds = useCellIds(tableId, rowId, store);
|
|
9142
|
+
return customCellIds ?? defaultCellIds;
|
|
9143
|
+
};
|
|
9144
|
+
|
|
8783
9145
|
const RowView = ({
|
|
8784
9146
|
tableId,
|
|
8785
9147
|
rowId,
|
|
@@ -8811,93 +9173,20 @@ const RowView = ({
|
|
|
8811
9173
|
debugIds,
|
|
8812
9174
|
rowId,
|
|
8813
9175
|
);
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
descending,
|
|
8823
|
-
offset,
|
|
8824
|
-
limit,
|
|
8825
|
-
props.store,
|
|
8826
|
-
),
|
|
8827
|
-
);
|
|
8828
|
-
const TablesView = ({
|
|
8829
|
-
store,
|
|
8830
|
-
tableComponent: Table = TableView$1,
|
|
8831
|
-
getTableComponentProps,
|
|
8832
|
-
separator,
|
|
8833
|
-
debugIds,
|
|
8834
|
-
}) =>
|
|
8835
|
-
wrap(
|
|
8836
|
-
arrayMap(useTableIds(store), (tableId) =>
|
|
8837
|
-
/* @__PURE__ */ jsx(
|
|
8838
|
-
Table,
|
|
8839
|
-
{
|
|
8840
|
-
...getProps(getTableComponentProps, tableId),
|
|
8841
|
-
tableId,
|
|
8842
|
-
store,
|
|
8843
|
-
debugIds,
|
|
8844
|
-
},
|
|
8845
|
-
tableId,
|
|
8846
|
-
),
|
|
8847
|
-
),
|
|
9176
|
+
|
|
9177
|
+
const tableView = (
|
|
9178
|
+
{
|
|
9179
|
+
tableId,
|
|
9180
|
+
store,
|
|
9181
|
+
rowComponent: Row = RowView,
|
|
9182
|
+
getRowComponentProps,
|
|
9183
|
+
customCellIds,
|
|
8848
9184
|
separator,
|
|
8849
|
-
);
|
|
8850
|
-
const ValueView = ({valueId, store, debugIds}) =>
|
|
8851
|
-
wrap(
|
|
8852
|
-
EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
|
|
8853
|
-
void 0,
|
|
8854
9185
|
debugIds,
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
store,
|
|
8859
|
-
valueComponent: Value = ValueView,
|
|
8860
|
-
getValueComponentProps,
|
|
8861
|
-
separator,
|
|
8862
|
-
debugIds,
|
|
8863
|
-
}) =>
|
|
8864
|
-
wrap(
|
|
8865
|
-
arrayMap(useValueIds(store), (valueId) =>
|
|
8866
|
-
/* @__PURE__ */ jsx(
|
|
8867
|
-
Value,
|
|
8868
|
-
{
|
|
8869
|
-
...getProps(getValueComponentProps, valueId),
|
|
8870
|
-
valueId,
|
|
8871
|
-
store,
|
|
8872
|
-
debugIds,
|
|
8873
|
-
},
|
|
8874
|
-
valueId,
|
|
8875
|
-
),
|
|
8876
|
-
),
|
|
8877
|
-
separator,
|
|
8878
|
-
);
|
|
8879
|
-
const MetricView = ({metricId, metrics, debugIds}) =>
|
|
9186
|
+
},
|
|
9187
|
+
rowIds,
|
|
9188
|
+
) =>
|
|
8880
9189
|
wrap(
|
|
8881
|
-
useMetric(metricId, metrics) ?? EMPTY_STRING,
|
|
8882
|
-
void 0,
|
|
8883
|
-
debugIds,
|
|
8884
|
-
metricId,
|
|
8885
|
-
);
|
|
8886
|
-
const SliceView$1 = ({
|
|
8887
|
-
indexId,
|
|
8888
|
-
sliceId,
|
|
8889
|
-
indexes,
|
|
8890
|
-
rowComponent: Row = RowView,
|
|
8891
|
-
getRowComponentProps,
|
|
8892
|
-
separator,
|
|
8893
|
-
debugIds,
|
|
8894
|
-
}) => {
|
|
8895
|
-
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
8896
|
-
useIndexesOrIndexesById(indexes),
|
|
8897
|
-
indexId,
|
|
8898
|
-
);
|
|
8899
|
-
const rowIds = useSliceRowIds(indexId, sliceId, resolvedIndexes);
|
|
8900
|
-
return wrap(
|
|
8901
9190
|
arrayMap(rowIds, (rowId) =>
|
|
8902
9191
|
/* @__PURE__ */ jsx(
|
|
8903
9192
|
Row,
|
|
@@ -8905,6 +9194,7 @@ const SliceView$1 = ({
|
|
|
8905
9194
|
...getProps(getRowComponentProps, rowId),
|
|
8906
9195
|
tableId,
|
|
8907
9196
|
rowId,
|
|
9197
|
+
customCellIds,
|
|
8908
9198
|
store,
|
|
8909
9199
|
debugIds,
|
|
8910
9200
|
},
|
|
@@ -8913,340 +9203,316 @@ const SliceView$1 = ({
|
|
|
8913
9203
|
),
|
|
8914
9204
|
separator,
|
|
8915
9205
|
debugIds,
|
|
8916
|
-
|
|
9206
|
+
tableId,
|
|
8917
9207
|
);
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
}
|
|
9208
|
+
const resultTableView = (
|
|
9209
|
+
{
|
|
9210
|
+
queryId,
|
|
9211
|
+
queries,
|
|
9212
|
+
resultRowComponent: ResultRow = ResultRowView,
|
|
9213
|
+
getResultRowComponentProps,
|
|
9214
|
+
separator,
|
|
9215
|
+
debugIds,
|
|
9216
|
+
},
|
|
9217
|
+
rowIds,
|
|
9218
|
+
) =>
|
|
8927
9219
|
wrap(
|
|
8928
|
-
arrayMap(
|
|
9220
|
+
arrayMap(rowIds, (rowId) =>
|
|
8929
9221
|
/* @__PURE__ */ jsx(
|
|
8930
|
-
|
|
9222
|
+
ResultRow,
|
|
8931
9223
|
{
|
|
8932
|
-
...getProps(
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
9224
|
+
...getProps(getResultRowComponentProps, rowId),
|
|
9225
|
+
queryId,
|
|
9226
|
+
rowId,
|
|
9227
|
+
queries,
|
|
8936
9228
|
debugIds,
|
|
8937
9229
|
},
|
|
8938
|
-
|
|
9230
|
+
rowId,
|
|
8939
9231
|
),
|
|
8940
9232
|
),
|
|
8941
9233
|
separator,
|
|
8942
9234
|
debugIds,
|
|
8943
|
-
|
|
9235
|
+
queryId,
|
|
8944
9236
|
);
|
|
8945
|
-
const
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
9237
|
+
const useComponentPerRow = (
|
|
9238
|
+
{
|
|
9239
|
+
relationshipId,
|
|
9240
|
+
relationships,
|
|
9241
|
+
rowComponent: Row = RowView,
|
|
9242
|
+
getRowComponentProps,
|
|
9243
|
+
separator,
|
|
9244
|
+
debugIds,
|
|
9245
|
+
},
|
|
9246
|
+
getRowIdsHook,
|
|
9247
|
+
rowId,
|
|
9248
|
+
) => {
|
|
9249
|
+
const [resolvedRelationships, store, localTableId] =
|
|
8954
9250
|
getRelationshipsStoreTableIds(
|
|
8955
9251
|
useRelationshipsOrRelationshipsById(relationships),
|
|
8956
9252
|
relationshipId,
|
|
8957
9253
|
);
|
|
8958
|
-
const
|
|
8959
|
-
relationshipId,
|
|
8960
|
-
localRowId,
|
|
8961
|
-
resolvedRelationships,
|
|
8962
|
-
);
|
|
9254
|
+
const rowIds = getRowIdsHook(relationshipId, rowId, resolvedRelationships);
|
|
8963
9255
|
return wrap(
|
|
8964
|
-
|
|
8965
|
-
? null
|
|
8966
|
-
: /* @__PURE__ */ jsx(
|
|
8967
|
-
Row,
|
|
8968
|
-
{
|
|
8969
|
-
...getProps(getRowComponentProps, rowId),
|
|
8970
|
-
tableId: remoteTableId,
|
|
8971
|
-
rowId,
|
|
8972
|
-
store,
|
|
8973
|
-
debugIds,
|
|
8974
|
-
},
|
|
8975
|
-
rowId,
|
|
8976
|
-
),
|
|
8977
|
-
void 0,
|
|
8978
|
-
debugIds,
|
|
8979
|
-
localRowId,
|
|
8980
|
-
);
|
|
8981
|
-
};
|
|
8982
|
-
const LocalRowsView = (props) =>
|
|
8983
|
-
useComponentPerRow(props, useLocalRowIds, props.remoteRowId);
|
|
8984
|
-
const LinkedRowsView = (props) =>
|
|
8985
|
-
useComponentPerRow(props, useLinkedRowIds, props.firstRowId);
|
|
8986
|
-
const ResultCellView = ({queryId, rowId, cellId, queries, debugIds}) =>
|
|
8987
|
-
wrap(
|
|
8988
|
-
EMPTY_STRING +
|
|
8989
|
-
(useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
|
|
8990
|
-
void 0,
|
|
8991
|
-
debugIds,
|
|
8992
|
-
cellId,
|
|
8993
|
-
);
|
|
8994
|
-
const ResultRowView = ({
|
|
8995
|
-
queryId,
|
|
8996
|
-
rowId,
|
|
8997
|
-
queries,
|
|
8998
|
-
resultCellComponent: ResultCell = ResultCellView,
|
|
8999
|
-
getResultCellComponentProps,
|
|
9000
|
-
separator,
|
|
9001
|
-
debugIds,
|
|
9002
|
-
}) =>
|
|
9003
|
-
wrap(
|
|
9004
|
-
arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) =>
|
|
9256
|
+
arrayMap(rowIds, (rowId2) =>
|
|
9005
9257
|
/* @__PURE__ */ jsx(
|
|
9006
|
-
|
|
9258
|
+
Row,
|
|
9007
9259
|
{
|
|
9008
|
-
...getProps(
|
|
9009
|
-
|
|
9010
|
-
rowId,
|
|
9011
|
-
|
|
9012
|
-
queries,
|
|
9260
|
+
...getProps(getRowComponentProps, rowId2),
|
|
9261
|
+
tableId: localTableId,
|
|
9262
|
+
rowId: rowId2,
|
|
9263
|
+
store,
|
|
9013
9264
|
debugIds,
|
|
9014
9265
|
},
|
|
9015
|
-
|
|
9266
|
+
rowId2,
|
|
9016
9267
|
),
|
|
9017
9268
|
),
|
|
9018
9269
|
separator,
|
|
9019
9270
|
debugIds,
|
|
9020
9271
|
rowId,
|
|
9021
9272
|
);
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
descending,
|
|
9031
|
-
offset,
|
|
9032
|
-
limit,
|
|
9033
|
-
props.queries,
|
|
9034
|
-
),
|
|
9035
|
-
);
|
|
9036
|
-
const CheckpointView = ({checkpoints, checkpointId, debugIds}) =>
|
|
9037
|
-
wrap(
|
|
9038
|
-
useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
|
|
9039
|
-
void 0,
|
|
9273
|
+
};
|
|
9274
|
+
const getUseCheckpointView =
|
|
9275
|
+
(getCheckpoints) =>
|
|
9276
|
+
({
|
|
9277
|
+
checkpoints,
|
|
9278
|
+
checkpointComponent: Checkpoint = CheckpointView,
|
|
9279
|
+
getCheckpointComponentProps,
|
|
9280
|
+
separator,
|
|
9040
9281
|
debugIds,
|
|
9041
|
-
|
|
9042
|
-
|
|
9282
|
+
}) => {
|
|
9283
|
+
const resolvedCheckpoints = useCheckpointsOrCheckpointsById(checkpoints);
|
|
9284
|
+
return wrap(
|
|
9285
|
+
arrayMap(
|
|
9286
|
+
getCheckpoints(useCheckpointIds(resolvedCheckpoints)),
|
|
9287
|
+
(checkpointId) =>
|
|
9288
|
+
/* @__PURE__ */ jsx(
|
|
9289
|
+
Checkpoint,
|
|
9290
|
+
{
|
|
9291
|
+
...getProps(getCheckpointComponentProps, checkpointId),
|
|
9292
|
+
checkpoints: resolvedCheckpoints,
|
|
9293
|
+
checkpointId,
|
|
9294
|
+
debugIds,
|
|
9295
|
+
},
|
|
9296
|
+
checkpointId,
|
|
9297
|
+
),
|
|
9298
|
+
),
|
|
9299
|
+
separator,
|
|
9300
|
+
);
|
|
9301
|
+
};
|
|
9302
|
+
|
|
9043
9303
|
const BackwardCheckpointsView = getUseCheckpointView(
|
|
9044
9304
|
(checkpointIds) => checkpointIds[0],
|
|
9045
9305
|
);
|
|
9306
|
+
|
|
9046
9307
|
const CurrentCheckpointView = getUseCheckpointView((checkpointIds) =>
|
|
9047
9308
|
isUndefined(checkpointIds[1]) ? [] : [checkpointIds[1]],
|
|
9048
9309
|
);
|
|
9310
|
+
|
|
9049
9311
|
const ForwardCheckpointsView = getUseCheckpointView(
|
|
9050
9312
|
(checkpointIds) => checkpointIds[2],
|
|
9051
9313
|
);
|
|
9052
9314
|
|
|
9053
|
-
const
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
useMemo(
|
|
9066
|
-
() => args,
|
|
9067
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9068
|
-
args,
|
|
9069
|
-
);
|
|
9070
|
-
const useStoreCellComponentProps = (store, tableId) =>
|
|
9071
|
-
useMemo(() => ({store, tableId}), [store, tableId]);
|
|
9072
|
-
const useQueriesCellComponentProps = (queries, queryId) =>
|
|
9073
|
-
useMemo(() => ({queries, queryId}), [queries, queryId]);
|
|
9074
|
-
const useSortingAndPagination = (
|
|
9075
|
-
cellId,
|
|
9076
|
-
descending = false,
|
|
9077
|
-
sortOnClick,
|
|
9078
|
-
offset = 0,
|
|
9079
|
-
limit,
|
|
9080
|
-
total,
|
|
9081
|
-
paginator,
|
|
9082
|
-
onChange,
|
|
9083
|
-
) => {
|
|
9084
|
-
const [[currentCellId, currentDescending, currentOffset], setState] =
|
|
9085
|
-
useState([cellId, descending, offset]);
|
|
9086
|
-
const setStateAndChange = useCallback(
|
|
9087
|
-
(sortAndOffset) => {
|
|
9088
|
-
setState(sortAndOffset);
|
|
9089
|
-
onChange?.(sortAndOffset);
|
|
9090
|
-
},
|
|
9091
|
-
[onChange],
|
|
9092
|
-
);
|
|
9093
|
-
const handleSort = useCallbackOrUndefined(
|
|
9094
|
-
(cellId2) =>
|
|
9095
|
-
setStateAndChange([
|
|
9096
|
-
cellId2,
|
|
9097
|
-
cellId2 == currentCellId ? !currentDescending : false,
|
|
9098
|
-
currentOffset,
|
|
9099
|
-
]),
|
|
9100
|
-
[setStateAndChange, currentCellId, currentDescending, currentOffset],
|
|
9101
|
-
sortOnClick,
|
|
9102
|
-
);
|
|
9103
|
-
const handleChangeOffset = useCallback(
|
|
9104
|
-
(offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
|
|
9105
|
-
[setStateAndChange, currentCellId, currentDescending],
|
|
9315
|
+
const SliceView$1 = ({
|
|
9316
|
+
indexId,
|
|
9317
|
+
sliceId,
|
|
9318
|
+
indexes,
|
|
9319
|
+
rowComponent: Row = RowView,
|
|
9320
|
+
getRowComponentProps,
|
|
9321
|
+
separator,
|
|
9322
|
+
debugIds,
|
|
9323
|
+
}) => {
|
|
9324
|
+
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
9325
|
+
useIndexesOrIndexesById(indexes),
|
|
9326
|
+
indexId,
|
|
9106
9327
|
);
|
|
9107
|
-
const
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
}),
|
|
9122
|
-
[
|
|
9123
|
-
paginator,
|
|
9124
|
-
PaginatorComponent,
|
|
9125
|
-
currentOffset,
|
|
9126
|
-
limit,
|
|
9127
|
-
total,
|
|
9128
|
-
handleChangeOffset,
|
|
9129
|
-
],
|
|
9328
|
+
const rowIds = useSliceRowIds(indexId, sliceId, resolvedIndexes);
|
|
9329
|
+
return wrap(
|
|
9330
|
+
arrayMap(rowIds, (rowId) =>
|
|
9331
|
+
/* @__PURE__ */ jsx(
|
|
9332
|
+
Row,
|
|
9333
|
+
{
|
|
9334
|
+
...getProps(getRowComponentProps, rowId),
|
|
9335
|
+
tableId,
|
|
9336
|
+
rowId,
|
|
9337
|
+
store,
|
|
9338
|
+
debugIds,
|
|
9339
|
+
},
|
|
9340
|
+
rowId,
|
|
9341
|
+
),
|
|
9130
9342
|
),
|
|
9131
|
-
|
|
9343
|
+
separator,
|
|
9344
|
+
debugIds,
|
|
9345
|
+
sliceId,
|
|
9346
|
+
);
|
|
9132
9347
|
};
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
? null
|
|
9202
|
-
: /* @__PURE__ */ jsx('th', {children: rowId}),
|
|
9203
|
-
objToArray(
|
|
9204
|
-
cells,
|
|
9205
|
-
({component: CellView2, getComponentProps}, cellId) =>
|
|
9206
|
-
/* @__PURE__ */ jsx(
|
|
9207
|
-
'td',
|
|
9208
|
-
{
|
|
9209
|
-
children: /* @__PURE__ */ jsx(CellView2, {
|
|
9210
|
-
...getProps(getComponentProps, rowId, cellId),
|
|
9211
|
-
...cellComponentProps,
|
|
9212
|
-
rowId,
|
|
9213
|
-
cellId,
|
|
9214
|
-
}),
|
|
9215
|
-
},
|
|
9216
|
-
cellId,
|
|
9217
|
-
),
|
|
9218
|
-
),
|
|
9219
|
-
],
|
|
9220
|
-
},
|
|
9348
|
+
|
|
9349
|
+
const IndexView$1 = ({
|
|
9350
|
+
indexId,
|
|
9351
|
+
indexes,
|
|
9352
|
+
sliceComponent: Slice = SliceView$1,
|
|
9353
|
+
getSliceComponentProps,
|
|
9354
|
+
separator,
|
|
9355
|
+
debugIds,
|
|
9356
|
+
}) =>
|
|
9357
|
+
wrap(
|
|
9358
|
+
arrayMap(useSliceIds(indexId, indexes), (sliceId) =>
|
|
9359
|
+
/* @__PURE__ */ jsx(
|
|
9360
|
+
Slice,
|
|
9361
|
+
{
|
|
9362
|
+
...getProps(getSliceComponentProps, sliceId),
|
|
9363
|
+
indexId,
|
|
9364
|
+
sliceId,
|
|
9365
|
+
indexes,
|
|
9366
|
+
debugIds,
|
|
9367
|
+
},
|
|
9368
|
+
sliceId,
|
|
9369
|
+
),
|
|
9370
|
+
),
|
|
9371
|
+
separator,
|
|
9372
|
+
debugIds,
|
|
9373
|
+
indexId,
|
|
9374
|
+
);
|
|
9375
|
+
|
|
9376
|
+
const LinkedRowsView = (props) =>
|
|
9377
|
+
useComponentPerRow(props, useLinkedRowIds, props.firstRowId);
|
|
9378
|
+
|
|
9379
|
+
const LocalRowsView = (props) =>
|
|
9380
|
+
useComponentPerRow(props, useLocalRowIds, props.remoteRowId);
|
|
9381
|
+
|
|
9382
|
+
const MetricView = ({metricId, metrics, debugIds}) =>
|
|
9383
|
+
wrap(
|
|
9384
|
+
useMetric(metricId, metrics) ?? EMPTY_STRING,
|
|
9385
|
+
void 0,
|
|
9386
|
+
debugIds,
|
|
9387
|
+
metricId,
|
|
9388
|
+
);
|
|
9389
|
+
|
|
9390
|
+
const RemoteRowView = ({
|
|
9391
|
+
relationshipId,
|
|
9392
|
+
localRowId,
|
|
9393
|
+
relationships,
|
|
9394
|
+
rowComponent: Row = RowView,
|
|
9395
|
+
getRowComponentProps,
|
|
9396
|
+
debugIds,
|
|
9397
|
+
}) => {
|
|
9398
|
+
const [resolvedRelationships, store, , remoteTableId] =
|
|
9399
|
+
getRelationshipsStoreTableIds(
|
|
9400
|
+
useRelationshipsOrRelationshipsById(relationships),
|
|
9401
|
+
relationshipId,
|
|
9402
|
+
);
|
|
9403
|
+
const rowId = useRemoteRowId(
|
|
9404
|
+
relationshipId,
|
|
9405
|
+
localRowId,
|
|
9406
|
+
resolvedRelationships,
|
|
9407
|
+
);
|
|
9408
|
+
return wrap(
|
|
9409
|
+
isUndefined(remoteTableId) || isUndefined(rowId)
|
|
9410
|
+
? null
|
|
9411
|
+
: /* @__PURE__ */ jsx(
|
|
9412
|
+
Row,
|
|
9413
|
+
{
|
|
9414
|
+
...getProps(getRowComponentProps, rowId),
|
|
9415
|
+
tableId: remoteTableId,
|
|
9221
9416
|
rowId,
|
|
9222
|
-
|
|
9417
|
+
store,
|
|
9418
|
+
debugIds,
|
|
9419
|
+
},
|
|
9420
|
+
rowId,
|
|
9223
9421
|
),
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9422
|
+
void 0,
|
|
9423
|
+
debugIds,
|
|
9424
|
+
localRowId,
|
|
9425
|
+
);
|
|
9426
|
+
};
|
|
9427
|
+
|
|
9428
|
+
const ResultSortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
9429
|
+
resultTableView(
|
|
9430
|
+
props,
|
|
9431
|
+
useResultSortedRowIds(
|
|
9432
|
+
props.queryId,
|
|
9433
|
+
cellId,
|
|
9434
|
+
descending,
|
|
9435
|
+
offset,
|
|
9436
|
+
limit,
|
|
9437
|
+
props.queries,
|
|
9438
|
+
),
|
|
9439
|
+
);
|
|
9440
|
+
|
|
9441
|
+
const ResultTableView = (props) =>
|
|
9442
|
+
resultTableView(props, useResultRowIds(props.queryId, props.queries));
|
|
9443
|
+
|
|
9444
|
+
const SortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
9445
|
+
tableView(
|
|
9446
|
+
props,
|
|
9447
|
+
useSortedRowIds(
|
|
9448
|
+
props.tableId,
|
|
9449
|
+
cellId,
|
|
9450
|
+
descending,
|
|
9451
|
+
offset,
|
|
9452
|
+
limit,
|
|
9453
|
+
props.store,
|
|
9454
|
+
),
|
|
9455
|
+
);
|
|
9456
|
+
|
|
9457
|
+
const TableView$1 = (props) =>
|
|
9458
|
+
tableView(props, useRowIds(props.tableId, props.store));
|
|
9459
|
+
|
|
9460
|
+
const TablesView$1 = ({
|
|
9461
|
+
store,
|
|
9462
|
+
tableComponent: Table = TableView$1,
|
|
9463
|
+
getTableComponentProps,
|
|
9464
|
+
separator,
|
|
9465
|
+
debugIds,
|
|
9232
9466
|
}) =>
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9467
|
+
wrap(
|
|
9468
|
+
arrayMap(useTableIds(store), (tableId) =>
|
|
9469
|
+
/* @__PURE__ */ jsx(
|
|
9470
|
+
Table,
|
|
9471
|
+
{
|
|
9472
|
+
...getProps(getTableComponentProps, tableId),
|
|
9473
|
+
tableId,
|
|
9474
|
+
store,
|
|
9475
|
+
debugIds,
|
|
9476
|
+
},
|
|
9477
|
+
tableId,
|
|
9478
|
+
),
|
|
9238
9479
|
),
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9480
|
+
separator,
|
|
9481
|
+
);
|
|
9482
|
+
|
|
9483
|
+
const ValueView = ({valueId, store, debugIds}) =>
|
|
9484
|
+
wrap(
|
|
9485
|
+
EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
|
|
9486
|
+
void 0,
|
|
9487
|
+
debugIds,
|
|
9488
|
+
valueId,
|
|
9489
|
+
);
|
|
9490
|
+
|
|
9491
|
+
const ValuesView$1 = ({
|
|
9492
|
+
store,
|
|
9493
|
+
valueComponent: Value = ValueView,
|
|
9494
|
+
getValueComponentProps,
|
|
9495
|
+
separator,
|
|
9496
|
+
debugIds,
|
|
9497
|
+
}) =>
|
|
9498
|
+
wrap(
|
|
9499
|
+
arrayMap(useValueIds(store), (valueId) =>
|
|
9500
|
+
/* @__PURE__ */ jsx(
|
|
9501
|
+
Value,
|
|
9502
|
+
{
|
|
9503
|
+
...getProps(getValueComponentProps, valueId),
|
|
9504
|
+
valueId,
|
|
9505
|
+
store,
|
|
9506
|
+
debugIds,
|
|
9507
|
+
},
|
|
9508
|
+
valueId,
|
|
9509
|
+
),
|
|
9510
|
+
),
|
|
9511
|
+
separator,
|
|
9512
|
+
);
|
|
9513
|
+
|
|
9514
|
+
const useDottedCellIds = (tableId, store) =>
|
|
9515
|
+
arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
|
|
9250
9516
|
const RelationshipInHtmlRow = ({
|
|
9251
9517
|
localRowId,
|
|
9252
9518
|
params: [
|
|
@@ -9257,17 +9523,31 @@ const RelationshipInHtmlRow = ({
|
|
|
9257
9523
|
relationshipId,
|
|
9258
9524
|
relationships,
|
|
9259
9525
|
store,
|
|
9526
|
+
extraCellsBefore,
|
|
9527
|
+
extraCellsAfter,
|
|
9260
9528
|
],
|
|
9261
9529
|
}) => {
|
|
9262
9530
|
const remoteRowId = useRemoteRowId(relationshipId, localRowId, relationships);
|
|
9531
|
+
const rowProps = {
|
|
9532
|
+
tableId: localTableId ?? '',
|
|
9533
|
+
rowId: localRowId,
|
|
9534
|
+
store,
|
|
9535
|
+
};
|
|
9263
9536
|
return /* @__PURE__ */ jsxs('tr', {
|
|
9264
9537
|
children: [
|
|
9538
|
+
extraRowCells(extraCellsBefore, rowProps),
|
|
9265
9539
|
idColumn === false
|
|
9266
9540
|
? null
|
|
9267
9541
|
: /* @__PURE__ */ jsxs(Fragment, {
|
|
9268
9542
|
children: [
|
|
9269
|
-
/* @__PURE__ */ jsx('th', {
|
|
9270
|
-
|
|
9543
|
+
/* @__PURE__ */ jsx('th', {
|
|
9544
|
+
title: localRowId,
|
|
9545
|
+
children: localRowId,
|
|
9546
|
+
}),
|
|
9547
|
+
/* @__PURE__ */ jsx('th', {
|
|
9548
|
+
title: remoteRowId,
|
|
9549
|
+
children: remoteRowId,
|
|
9550
|
+
}),
|
|
9271
9551
|
],
|
|
9272
9552
|
}),
|
|
9273
9553
|
objToArray(
|
|
@@ -9279,7 +9559,7 @@ const RelationshipInHtmlRow = ({
|
|
|
9279
9559
|
? localRowId
|
|
9280
9560
|
: tableId === remoteTableId
|
|
9281
9561
|
? remoteRowId
|
|
9282
|
-
:
|
|
9562
|
+
: void 0;
|
|
9283
9563
|
return isUndefined(rowId)
|
|
9284
9564
|
? null
|
|
9285
9565
|
: /* @__PURE__ */ jsx(
|
|
@@ -9297,145 +9577,215 @@ const RelationshipInHtmlRow = ({
|
|
|
9297
9577
|
);
|
|
9298
9578
|
},
|
|
9299
9579
|
),
|
|
9580
|
+
extraRowCells(extraCellsAfter, rowProps, 1),
|
|
9581
|
+
],
|
|
9582
|
+
});
|
|
9583
|
+
};
|
|
9584
|
+
const RelationshipInHtmlTable = ({
|
|
9585
|
+
relationshipId,
|
|
9586
|
+
relationships,
|
|
9587
|
+
editable,
|
|
9588
|
+
customCells,
|
|
9589
|
+
extraCellsBefore,
|
|
9590
|
+
extraCellsAfter,
|
|
9591
|
+
className,
|
|
9592
|
+
headerRow,
|
|
9593
|
+
idColumn = true,
|
|
9594
|
+
}) => {
|
|
9595
|
+
const [resolvedRelationships, store, localTableId, remoteTableId] =
|
|
9596
|
+
getRelationshipsStoreTableIds(
|
|
9597
|
+
useRelationshipsOrRelationshipsById(relationships),
|
|
9598
|
+
relationshipId,
|
|
9599
|
+
);
|
|
9600
|
+
const cells = useCells(
|
|
9601
|
+
[
|
|
9602
|
+
...useDottedCellIds(localTableId, store),
|
|
9603
|
+
...useDottedCellIds(remoteTableId, store),
|
|
9604
|
+
],
|
|
9605
|
+
customCells,
|
|
9606
|
+
editable ? EditableCellView : CellView,
|
|
9607
|
+
);
|
|
9608
|
+
const params = useParams(
|
|
9609
|
+
idColumn,
|
|
9610
|
+
cells,
|
|
9611
|
+
localTableId,
|
|
9612
|
+
remoteTableId,
|
|
9613
|
+
relationshipId,
|
|
9614
|
+
resolvedRelationships,
|
|
9615
|
+
store,
|
|
9616
|
+
extraCellsBefore,
|
|
9617
|
+
extraCellsAfter,
|
|
9618
|
+
);
|
|
9619
|
+
return /* @__PURE__ */ jsxs('table', {
|
|
9620
|
+
className,
|
|
9621
|
+
children: [
|
|
9622
|
+
headerRow === false
|
|
9623
|
+
? null
|
|
9624
|
+
: /* @__PURE__ */ jsx('thead', {
|
|
9625
|
+
children: /* @__PURE__ */ jsxs('tr', {
|
|
9626
|
+
children: [
|
|
9627
|
+
extraHeaders(extraCellsBefore),
|
|
9628
|
+
idColumn === false
|
|
9629
|
+
? null
|
|
9630
|
+
: /* @__PURE__ */ jsxs(Fragment, {
|
|
9631
|
+
children: [
|
|
9632
|
+
/* @__PURE__ */ jsxs('th', {
|
|
9633
|
+
children: [localTableId, '.Id'],
|
|
9634
|
+
}),
|
|
9635
|
+
/* @__PURE__ */ jsxs('th', {
|
|
9636
|
+
children: [remoteTableId, '.Id'],
|
|
9637
|
+
}),
|
|
9638
|
+
],
|
|
9639
|
+
}),
|
|
9640
|
+
objToArray(cells, ({label}, cellId) =>
|
|
9641
|
+
/* @__PURE__ */ jsx('th', {children: label}, cellId),
|
|
9642
|
+
),
|
|
9643
|
+
extraHeaders(extraCellsAfter, 1),
|
|
9644
|
+
],
|
|
9645
|
+
}),
|
|
9646
|
+
}),
|
|
9647
|
+
/* @__PURE__ */ jsx('tbody', {
|
|
9648
|
+
children: arrayMap(useRowIds(localTableId, store), (localRowId) =>
|
|
9649
|
+
/* @__PURE__ */ jsx(
|
|
9650
|
+
RelationshipInHtmlRow,
|
|
9651
|
+
{
|
|
9652
|
+
localRowId,
|
|
9653
|
+
params,
|
|
9654
|
+
},
|
|
9655
|
+
localRowId,
|
|
9656
|
+
),
|
|
9657
|
+
),
|
|
9658
|
+
}),
|
|
9300
9659
|
],
|
|
9301
9660
|
});
|
|
9302
9661
|
};
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9662
|
+
|
|
9663
|
+
const LEFT_ARROW = '\u2190';
|
|
9664
|
+
const RIGHT_ARROW = '\u2192';
|
|
9665
|
+
const useSortingAndPagination = (
|
|
9666
|
+
cellId,
|
|
9667
|
+
descending = false,
|
|
9668
|
+
sortOnClick,
|
|
9669
|
+
offset = 0,
|
|
9670
|
+
limit,
|
|
9671
|
+
total,
|
|
9672
|
+
paginator,
|
|
9673
|
+
onChange,
|
|
9674
|
+
) => {
|
|
9675
|
+
const [[currentCellId, currentDescending, currentOffset], setState] =
|
|
9676
|
+
useState([cellId, descending, offset]);
|
|
9677
|
+
const setStateAndChange = useCallback(
|
|
9678
|
+
(sortAndOffset) => {
|
|
9679
|
+
setState(sortAndOffset);
|
|
9680
|
+
onChange?.(sortAndOffset);
|
|
9681
|
+
},
|
|
9682
|
+
[onChange],
|
|
9683
|
+
);
|
|
9684
|
+
const handleSort = useCallbackOrUndefined(
|
|
9685
|
+
(cellId2) =>
|
|
9686
|
+
setStateAndChange([
|
|
9687
|
+
cellId2,
|
|
9688
|
+
cellId2 == currentCellId ? !currentDescending : false,
|
|
9689
|
+
currentOffset,
|
|
9690
|
+
]),
|
|
9691
|
+
[setStateAndChange, currentCellId, currentDescending, currentOffset],
|
|
9692
|
+
sortOnClick,
|
|
9693
|
+
);
|
|
9694
|
+
const handleChangeOffset = useCallback(
|
|
9695
|
+
(offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
|
|
9696
|
+
[setStateAndChange, currentCellId, currentDescending],
|
|
9697
|
+
);
|
|
9698
|
+
const PaginatorComponent =
|
|
9699
|
+
paginator === true ? SortedTablePaginator : paginator;
|
|
9700
|
+
return [
|
|
9701
|
+
[currentCellId, currentDescending, currentOffset],
|
|
9702
|
+
handleSort,
|
|
9703
|
+
useMemo(
|
|
9704
|
+
() =>
|
|
9705
|
+
paginator === false
|
|
9706
|
+
? null
|
|
9707
|
+
: /* @__PURE__ */ jsx(PaginatorComponent, {
|
|
9708
|
+
offset: currentOffset,
|
|
9709
|
+
limit,
|
|
9710
|
+
total,
|
|
9711
|
+
onChange: handleChangeOffset,
|
|
9712
|
+
}),
|
|
9713
|
+
[
|
|
9714
|
+
paginator,
|
|
9715
|
+
PaginatorComponent,
|
|
9716
|
+
currentOffset,
|
|
9717
|
+
limit,
|
|
9718
|
+
total,
|
|
9719
|
+
handleChangeOffset,
|
|
9720
|
+
],
|
|
9721
|
+
),
|
|
9722
|
+
];
|
|
9723
|
+
};
|
|
9724
|
+
const SortedTablePaginator = ({
|
|
9725
|
+
onChange,
|
|
9726
|
+
total,
|
|
9727
|
+
offset = 0,
|
|
9728
|
+
limit = total,
|
|
9729
|
+
singular = 'row',
|
|
9730
|
+
plural = singular + 's',
|
|
9309
9731
|
}) => {
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
const [numberThing, setNumberThing] = useState();
|
|
9314
|
-
const [booleanThing, setBooleanThing] = useState();
|
|
9315
|
-
if (currentThing !== thing) {
|
|
9316
|
-
setThingType(getCellOrValueType(thing));
|
|
9317
|
-
setCurrentThing(thing);
|
|
9318
|
-
setStringThing(String(thing));
|
|
9319
|
-
setNumberThing(Number(thing) || 0);
|
|
9320
|
-
setBooleanThing(Boolean(thing));
|
|
9732
|
+
if (offset > total || offset < 0) {
|
|
9733
|
+
offset = 0;
|
|
9734
|
+
onChange(0);
|
|
9321
9735
|
}
|
|
9322
|
-
const
|
|
9323
|
-
(
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
onThingChange(thing2);
|
|
9327
|
-
},
|
|
9328
|
-
[onThingChange],
|
|
9736
|
+
const handlePrevClick = useCallbackOrUndefined(
|
|
9737
|
+
() => onChange(offset - limit),
|
|
9738
|
+
[onChange, offset, limit],
|
|
9739
|
+
offset > 0,
|
|
9329
9740
|
);
|
|
9330
|
-
const
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
numberThing,
|
|
9337
|
-
booleanThing,
|
|
9338
|
-
);
|
|
9339
|
-
setThingType(nextType);
|
|
9340
|
-
setCurrentThing(thing2);
|
|
9341
|
-
onThingChange(thing2);
|
|
9342
|
-
}
|
|
9343
|
-
}, [
|
|
9344
|
-
hasSchema,
|
|
9345
|
-
onThingChange,
|
|
9346
|
-
stringThing,
|
|
9347
|
-
numberThing,
|
|
9348
|
-
booleanThing,
|
|
9349
|
-
thingType,
|
|
9350
|
-
]);
|
|
9351
|
-
return /* @__PURE__ */ jsxs('div', {
|
|
9352
|
-
className,
|
|
9741
|
+
const handleNextClick = useCallbackOrUndefined(
|
|
9742
|
+
() => onChange(offset + limit),
|
|
9743
|
+
[onChange, offset, limit],
|
|
9744
|
+
offset + limit < total,
|
|
9745
|
+
);
|
|
9746
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
9353
9747
|
children: [
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
/* @__PURE__ */ jsx(
|
|
9379
|
-
'input',
|
|
9380
|
-
{
|
|
9381
|
-
type: 'number',
|
|
9382
|
-
value: numberThing,
|
|
9383
|
-
onChange: useCallback(
|
|
9384
|
-
(event) =>
|
|
9385
|
-
handleThingChange(
|
|
9386
|
-
Number(event[CURRENT_TARGET][_VALUE] || 0),
|
|
9387
|
-
setNumberThing,
|
|
9388
|
-
),
|
|
9389
|
-
[handleThingChange],
|
|
9390
|
-
),
|
|
9391
|
-
},
|
|
9392
|
-
thingType,
|
|
9393
|
-
),
|
|
9394
|
-
/* @__PURE__ */ jsx(
|
|
9395
|
-
'input',
|
|
9396
|
-
{
|
|
9397
|
-
type: 'checkbox',
|
|
9398
|
-
checked: booleanThing,
|
|
9399
|
-
onChange: useCallback(
|
|
9400
|
-
(event) =>
|
|
9401
|
-
handleThingChange(
|
|
9402
|
-
Boolean(event[CURRENT_TARGET].checked),
|
|
9403
|
-
setBooleanThing,
|
|
9404
|
-
),
|
|
9405
|
-
[handleThingChange],
|
|
9406
|
-
),
|
|
9407
|
-
},
|
|
9408
|
-
thingType,
|
|
9409
|
-
),
|
|
9410
|
-
),
|
|
9748
|
+
total > limit &&
|
|
9749
|
+
/* @__PURE__ */ jsxs(Fragment, {
|
|
9750
|
+
children: [
|
|
9751
|
+
/* @__PURE__ */ jsx('button', {
|
|
9752
|
+
className: 'previous',
|
|
9753
|
+
disabled: offset == 0,
|
|
9754
|
+
onClick: handlePrevClick,
|
|
9755
|
+
children: LEFT_ARROW,
|
|
9756
|
+
}),
|
|
9757
|
+
/* @__PURE__ */ jsx('button', {
|
|
9758
|
+
className: 'next',
|
|
9759
|
+
disabled: offset + limit >= total,
|
|
9760
|
+
onClick: handleNextClick,
|
|
9761
|
+
children: RIGHT_ARROW,
|
|
9762
|
+
}),
|
|
9763
|
+
offset + 1,
|
|
9764
|
+
' to ',
|
|
9765
|
+
mathMin(total, offset + limit),
|
|
9766
|
+
' of ',
|
|
9767
|
+
],
|
|
9768
|
+
}),
|
|
9769
|
+
total,
|
|
9770
|
+
' ',
|
|
9771
|
+
total != 1 ? plural : singular,
|
|
9411
9772
|
],
|
|
9412
9773
|
});
|
|
9413
9774
|
};
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
params: useParams(
|
|
9418
|
-
useCells(
|
|
9419
|
-
useTableCellIds(tableId, store),
|
|
9420
|
-
customCells,
|
|
9421
|
-
editable ? EditableCellView : CellView,
|
|
9422
|
-
),
|
|
9423
|
-
useStoreCellComponentProps(store, tableId),
|
|
9424
|
-
useRowIds(tableId, store),
|
|
9425
|
-
),
|
|
9426
|
-
});
|
|
9427
|
-
const SortedTableInHtmlTable = ({
|
|
9428
|
-
tableId,
|
|
9775
|
+
|
|
9776
|
+
const ResultSortedTableInHtmlTable = ({
|
|
9777
|
+
queryId,
|
|
9429
9778
|
cellId,
|
|
9430
9779
|
descending,
|
|
9431
9780
|
offset,
|
|
9432
9781
|
limit,
|
|
9433
|
-
|
|
9434
|
-
editable,
|
|
9782
|
+
queries,
|
|
9435
9783
|
sortOnClick,
|
|
9436
9784
|
paginator = false,
|
|
9437
|
-
onChange,
|
|
9438
9785
|
customCells,
|
|
9786
|
+
extraCellsBefore,
|
|
9787
|
+
extraCellsAfter,
|
|
9788
|
+
onChange,
|
|
9439
9789
|
...props
|
|
9440
9790
|
}) => {
|
|
9441
9791
|
const [sortAndOffset, handleSort, paginatorComponent] =
|
|
@@ -9445,7 +9795,7 @@ const SortedTableInHtmlTable = ({
|
|
|
9445
9795
|
sortOnClick,
|
|
9446
9796
|
offset,
|
|
9447
9797
|
limit,
|
|
9448
|
-
|
|
9798
|
+
useResultRowCount(queryId, queries),
|
|
9449
9799
|
paginator,
|
|
9450
9800
|
onChange,
|
|
9451
9801
|
);
|
|
@@ -9453,72 +9803,52 @@ const SortedTableInHtmlTable = ({
|
|
|
9453
9803
|
...props,
|
|
9454
9804
|
params: useParams(
|
|
9455
9805
|
useCells(
|
|
9456
|
-
|
|
9806
|
+
useResultTableCellIds(queryId, queries),
|
|
9457
9807
|
customCells,
|
|
9458
|
-
|
|
9808
|
+
ResultCellView,
|
|
9459
9809
|
),
|
|
9460
|
-
|
|
9461
|
-
|
|
9810
|
+
useQueriesCellComponentProps(queries, queryId),
|
|
9811
|
+
useResultSortedRowIds(queryId, ...sortAndOffset, limit, queries),
|
|
9812
|
+
extraCellsBefore,
|
|
9813
|
+
extraCellsAfter,
|
|
9462
9814
|
sortAndOffset,
|
|
9463
9815
|
handleSort,
|
|
9464
9816
|
paginatorComponent,
|
|
9465
9817
|
),
|
|
9466
9818
|
});
|
|
9467
|
-
};
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
}) =>
|
|
9477
|
-
/* @__PURE__ */
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
}),
|
|
9491
|
-
}),
|
|
9492
|
-
/* @__PURE__ */ jsx('tbody', {
|
|
9493
|
-
children: arrayMap(useValueIds(store), (valueId) =>
|
|
9494
|
-
/* @__PURE__ */ jsxs(
|
|
9495
|
-
'tr',
|
|
9496
|
-
{
|
|
9497
|
-
children: [
|
|
9498
|
-
idColumn === false
|
|
9499
|
-
? null
|
|
9500
|
-
: /* @__PURE__ */ jsx('th', {children: valueId}),
|
|
9501
|
-
/* @__PURE__ */ jsx('td', {
|
|
9502
|
-
children: /* @__PURE__ */ jsx(Value, {
|
|
9503
|
-
...getProps(getValueComponentProps, valueId),
|
|
9504
|
-
valueId,
|
|
9505
|
-
store,
|
|
9506
|
-
}),
|
|
9507
|
-
}),
|
|
9508
|
-
],
|
|
9509
|
-
},
|
|
9510
|
-
valueId,
|
|
9511
|
-
),
|
|
9512
|
-
),
|
|
9513
|
-
}),
|
|
9514
|
-
],
|
|
9819
|
+
};
|
|
9820
|
+
|
|
9821
|
+
const ResultTableInHtmlTable = ({
|
|
9822
|
+
queryId,
|
|
9823
|
+
queries,
|
|
9824
|
+
customCells,
|
|
9825
|
+
extraCellsBefore,
|
|
9826
|
+
extraCellsAfter,
|
|
9827
|
+
...props
|
|
9828
|
+
}) =>
|
|
9829
|
+
/* @__PURE__ */ jsx(HtmlTable, {
|
|
9830
|
+
...props,
|
|
9831
|
+
params: useParams(
|
|
9832
|
+
useCells(
|
|
9833
|
+
useResultTableCellIds(queryId, queries),
|
|
9834
|
+
customCells,
|
|
9835
|
+
ResultCellView,
|
|
9836
|
+
),
|
|
9837
|
+
useQueriesCellComponentProps(queries, queryId),
|
|
9838
|
+
useResultRowIds(queryId, queries),
|
|
9839
|
+
extraCellsBefore,
|
|
9840
|
+
extraCellsAfter,
|
|
9841
|
+
),
|
|
9515
9842
|
});
|
|
9843
|
+
|
|
9516
9844
|
const SliceInHtmlTable = ({
|
|
9517
9845
|
indexId,
|
|
9518
9846
|
sliceId,
|
|
9519
9847
|
indexes,
|
|
9520
9848
|
editable,
|
|
9521
9849
|
customCells,
|
|
9850
|
+
extraCellsBefore,
|
|
9851
|
+
extraCellsAfter,
|
|
9522
9852
|
...props
|
|
9523
9853
|
}) => {
|
|
9524
9854
|
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
@@ -9535,105 +9865,26 @@ const SliceInHtmlTable = ({
|
|
|
9535
9865
|
),
|
|
9536
9866
|
useStoreCellComponentProps(store, tableId),
|
|
9537
9867
|
useSliceRowIds(indexId, sliceId, resolvedIndexes),
|
|
9868
|
+
extraCellsBefore,
|
|
9869
|
+
extraCellsAfter,
|
|
9538
9870
|
),
|
|
9539
9871
|
});
|
|
9540
9872
|
};
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
editable,
|
|
9545
|
-
customCells,
|
|
9546
|
-
className,
|
|
9547
|
-
headerRow,
|
|
9548
|
-
idColumn = true,
|
|
9549
|
-
}) => {
|
|
9550
|
-
const [resolvedRelationships, store, localTableId, remoteTableId] =
|
|
9551
|
-
getRelationshipsStoreTableIds(
|
|
9552
|
-
useRelationshipsOrRelationshipsById(relationships),
|
|
9553
|
-
relationshipId,
|
|
9554
|
-
);
|
|
9555
|
-
const cells = useCells(
|
|
9556
|
-
[
|
|
9557
|
-
...useDottedCellIds(localTableId, store),
|
|
9558
|
-
...useDottedCellIds(remoteTableId, store),
|
|
9559
|
-
],
|
|
9560
|
-
customCells,
|
|
9561
|
-
editable ? EditableCellView : CellView,
|
|
9562
|
-
);
|
|
9563
|
-
const params = useParams(
|
|
9564
|
-
idColumn,
|
|
9565
|
-
cells,
|
|
9566
|
-
localTableId,
|
|
9567
|
-
remoteTableId,
|
|
9568
|
-
relationshipId,
|
|
9569
|
-
resolvedRelationships,
|
|
9570
|
-
store,
|
|
9571
|
-
);
|
|
9572
|
-
return /* @__PURE__ */ jsxs('table', {
|
|
9573
|
-
className,
|
|
9574
|
-
children: [
|
|
9575
|
-
headerRow === false
|
|
9576
|
-
? null
|
|
9577
|
-
: /* @__PURE__ */ jsx('thead', {
|
|
9578
|
-
children: /* @__PURE__ */ jsxs('tr', {
|
|
9579
|
-
children: [
|
|
9580
|
-
idColumn === false
|
|
9581
|
-
? null
|
|
9582
|
-
: /* @__PURE__ */ jsxs(Fragment, {
|
|
9583
|
-
children: [
|
|
9584
|
-
/* @__PURE__ */ jsxs('th', {
|
|
9585
|
-
children: [localTableId, '.Id'],
|
|
9586
|
-
}),
|
|
9587
|
-
/* @__PURE__ */ jsxs('th', {
|
|
9588
|
-
children: [remoteTableId, '.Id'],
|
|
9589
|
-
}),
|
|
9590
|
-
],
|
|
9591
|
-
}),
|
|
9592
|
-
objToArray(cells, ({label}, cellId) =>
|
|
9593
|
-
/* @__PURE__ */ jsx('th', {children: label}, cellId),
|
|
9594
|
-
),
|
|
9595
|
-
],
|
|
9596
|
-
}),
|
|
9597
|
-
}),
|
|
9598
|
-
/* @__PURE__ */ jsx('tbody', {
|
|
9599
|
-
children: arrayMap(useRowIds(localTableId, store), (localRowId) =>
|
|
9600
|
-
/* @__PURE__ */ jsx(
|
|
9601
|
-
RelationshipInHtmlRow,
|
|
9602
|
-
{
|
|
9603
|
-
localRowId,
|
|
9604
|
-
params,
|
|
9605
|
-
},
|
|
9606
|
-
localRowId,
|
|
9607
|
-
),
|
|
9608
|
-
),
|
|
9609
|
-
}),
|
|
9610
|
-
],
|
|
9611
|
-
});
|
|
9612
|
-
};
|
|
9613
|
-
const ResultTableInHtmlTable = ({queryId, queries, customCells, ...props}) =>
|
|
9614
|
-
/* @__PURE__ */ jsx(HtmlTable, {
|
|
9615
|
-
...props,
|
|
9616
|
-
params: useParams(
|
|
9617
|
-
useCells(
|
|
9618
|
-
useResultTableCellIds(queryId, queries),
|
|
9619
|
-
customCells,
|
|
9620
|
-
ResultCellView,
|
|
9621
|
-
),
|
|
9622
|
-
useQueriesCellComponentProps(queries, queryId),
|
|
9623
|
-
useResultRowIds(queryId, queries),
|
|
9624
|
-
),
|
|
9625
|
-
});
|
|
9626
|
-
const ResultSortedTableInHtmlTable = ({
|
|
9627
|
-
queryId,
|
|
9873
|
+
|
|
9874
|
+
const SortedTableInHtmlTable = ({
|
|
9875
|
+
tableId,
|
|
9628
9876
|
cellId,
|
|
9629
9877
|
descending,
|
|
9630
9878
|
offset,
|
|
9631
9879
|
limit,
|
|
9632
|
-
|
|
9880
|
+
store,
|
|
9881
|
+
editable,
|
|
9633
9882
|
sortOnClick,
|
|
9634
9883
|
paginator = false,
|
|
9635
|
-
customCells,
|
|
9636
9884
|
onChange,
|
|
9885
|
+
customCells,
|
|
9886
|
+
extraCellsBefore,
|
|
9887
|
+
extraCellsAfter,
|
|
9637
9888
|
...props
|
|
9638
9889
|
}) => {
|
|
9639
9890
|
const [sortAndOffset, handleSort, paginatorComponent] =
|
|
@@ -9643,7 +9894,7 @@ const ResultSortedTableInHtmlTable = ({
|
|
|
9643
9894
|
sortOnClick,
|
|
9644
9895
|
offset,
|
|
9645
9896
|
limit,
|
|
9646
|
-
|
|
9897
|
+
useRowCount(tableId, store),
|
|
9647
9898
|
paginator,
|
|
9648
9899
|
onChange,
|
|
9649
9900
|
);
|
|
@@ -9651,99 +9902,117 @@ const ResultSortedTableInHtmlTable = ({
|
|
|
9651
9902
|
...props,
|
|
9652
9903
|
params: useParams(
|
|
9653
9904
|
useCells(
|
|
9654
|
-
|
|
9905
|
+
useTableCellIds(tableId, store),
|
|
9655
9906
|
customCells,
|
|
9656
|
-
|
|
9907
|
+
editable ? EditableCellView : CellView,
|
|
9657
9908
|
),
|
|
9658
|
-
|
|
9659
|
-
|
|
9909
|
+
useStoreCellComponentProps(store, tableId),
|
|
9910
|
+
useSortedRowIds(tableId, ...sortAndOffset, limit, store),
|
|
9911
|
+
extraCellsBefore,
|
|
9912
|
+
extraCellsAfter,
|
|
9660
9913
|
sortAndOffset,
|
|
9661
9914
|
handleSort,
|
|
9662
9915
|
paginatorComponent,
|
|
9663
9916
|
),
|
|
9664
9917
|
});
|
|
9665
9918
|
};
|
|
9666
|
-
|
|
9919
|
+
|
|
9920
|
+
const TableInHtmlTable = ({
|
|
9667
9921
|
tableId,
|
|
9668
|
-
rowId,
|
|
9669
|
-
cellId,
|
|
9670
9922
|
store,
|
|
9671
|
-
|
|
9672
|
-
|
|
9923
|
+
editable,
|
|
9924
|
+
customCells,
|
|
9925
|
+
extraCellsBefore,
|
|
9926
|
+
extraCellsAfter,
|
|
9927
|
+
...props
|
|
9673
9928
|
}) =>
|
|
9674
|
-
/* @__PURE__ */ jsx(
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
store,
|
|
9929
|
+
/* @__PURE__ */ jsx(HtmlTable, {
|
|
9930
|
+
...props,
|
|
9931
|
+
params: useParams(
|
|
9932
|
+
useCells(
|
|
9933
|
+
useTableCellIds(tableId, store),
|
|
9934
|
+
customCells,
|
|
9935
|
+
editable ? EditableCellView : CellView,
|
|
9936
|
+
),
|
|
9937
|
+
useStoreCellComponentProps(store, tableId),
|
|
9938
|
+
useRowIds(tableId, store),
|
|
9939
|
+
extraCellsBefore,
|
|
9940
|
+
extraCellsAfter,
|
|
9683
9941
|
),
|
|
9684
|
-
className: className ?? EDITABLE + CELL,
|
|
9685
|
-
showType,
|
|
9686
|
-
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
9687
|
-
});
|
|
9688
|
-
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
9689
|
-
/* @__PURE__ */ jsx(EditableThing, {
|
|
9690
|
-
thing: useValue(valueId, store),
|
|
9691
|
-
onThingChange: useSetValueCallback(valueId, (value) => value, [], store),
|
|
9692
|
-
className: className ?? EDITABLE + VALUE,
|
|
9693
|
-
showType,
|
|
9694
|
-
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
9695
9942
|
});
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
offset > 0,
|
|
9712
|
-
);
|
|
9713
|
-
const handleNextClick = useCallbackOrUndefined(
|
|
9714
|
-
() => onChange(offset + limit),
|
|
9715
|
-
[onChange, offset, limit],
|
|
9716
|
-
offset + limit < total,
|
|
9943
|
+
|
|
9944
|
+
const extraValueCells = (
|
|
9945
|
+
extraValueCells2 = [],
|
|
9946
|
+
extraValueCellProps,
|
|
9947
|
+
after = 0,
|
|
9948
|
+
) =>
|
|
9949
|
+
arrayMap(extraValueCells2, ({component: Component}, index) =>
|
|
9950
|
+
/* @__PURE__ */ jsx(
|
|
9951
|
+
'td',
|
|
9952
|
+
{
|
|
9953
|
+
className: EXTRA,
|
|
9954
|
+
children: /* @__PURE__ */ jsx(Component, {...extraValueCellProps}),
|
|
9955
|
+
},
|
|
9956
|
+
extraKey(index, after),
|
|
9957
|
+
),
|
|
9717
9958
|
);
|
|
9718
|
-
|
|
9959
|
+
const ValuesInHtmlTable = ({
|
|
9960
|
+
store,
|
|
9961
|
+
editable = false,
|
|
9962
|
+
valueComponent: Value = editable ? EditableValueView : ValueView,
|
|
9963
|
+
getValueComponentProps,
|
|
9964
|
+
extraCellsBefore,
|
|
9965
|
+
extraCellsAfter,
|
|
9966
|
+
className,
|
|
9967
|
+
headerRow,
|
|
9968
|
+
idColumn,
|
|
9969
|
+
}) =>
|
|
9970
|
+
/* @__PURE__ */ jsxs('table', {
|
|
9971
|
+
className,
|
|
9719
9972
|
children: [
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
/* @__PURE__ */
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
onClick: handleNextClick,
|
|
9733
|
-
children: RIGHT_ARROW,
|
|
9973
|
+
headerRow === false
|
|
9974
|
+
? null
|
|
9975
|
+
: /* @__PURE__ */ jsx('thead', {
|
|
9976
|
+
children: /* @__PURE__ */ jsxs('tr', {
|
|
9977
|
+
children: [
|
|
9978
|
+
extraHeaders(extraCellsBefore),
|
|
9979
|
+
idColumn === false
|
|
9980
|
+
? null
|
|
9981
|
+
: /* @__PURE__ */ jsx('th', {children: 'Id'}),
|
|
9982
|
+
/* @__PURE__ */ jsx('th', {children: VALUE}),
|
|
9983
|
+
extraHeaders(extraCellsAfter, 1),
|
|
9984
|
+
],
|
|
9734
9985
|
}),
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9986
|
+
}),
|
|
9987
|
+
/* @__PURE__ */ jsx('tbody', {
|
|
9988
|
+
children: arrayMap(useValueIds(store), (valueId) => {
|
|
9989
|
+
const valueProps = {valueId, store};
|
|
9990
|
+
return /* @__PURE__ */ jsxs(
|
|
9991
|
+
'tr',
|
|
9992
|
+
{
|
|
9993
|
+
children: [
|
|
9994
|
+
extraValueCells(extraCellsBefore, valueProps),
|
|
9995
|
+
idColumn === false
|
|
9996
|
+
? null
|
|
9997
|
+
: /* @__PURE__ */ jsx('th', {
|
|
9998
|
+
title: valueId,
|
|
9999
|
+
children: valueId,
|
|
10000
|
+
}),
|
|
10001
|
+
/* @__PURE__ */ jsx('td', {
|
|
10002
|
+
children: /* @__PURE__ */ jsx(Value, {
|
|
10003
|
+
...getProps(getValueComponentProps, valueId),
|
|
10004
|
+
...valueProps,
|
|
10005
|
+
}),
|
|
10006
|
+
}),
|
|
10007
|
+
extraValueCells(extraCellsAfter, valueProps, 1),
|
|
10008
|
+
],
|
|
10009
|
+
},
|
|
10010
|
+
valueId,
|
|
10011
|
+
);
|
|
9740
10012
|
}),
|
|
9741
|
-
|
|
9742
|
-
' ',
|
|
9743
|
-
total != 1 ? plural : singular,
|
|
10013
|
+
}),
|
|
9744
10014
|
],
|
|
9745
10015
|
});
|
|
9746
|
-
};
|
|
9747
10016
|
|
|
9748
10017
|
const UNIQUE_ID = 'tinybaseInspector';
|
|
9749
10018
|
const TITLE = 'TinyBase Inspector';
|
|
@@ -9777,16 +10046,9 @@ const Nub = ({s}) => {
|
|
|
9777
10046
|
title: TITLE,
|
|
9778
10047
|
'data-position': position,
|
|
9779
10048
|
});
|
|
9780
|
-
};
|
|
9781
|
-
|
|
9782
|
-
const Details = ({
|
|
9783
|
-
uniqueId,
|
|
9784
|
-
summary,
|
|
9785
|
-
editable,
|
|
9786
|
-
handleEditable,
|
|
9787
|
-
children,
|
|
9788
|
-
s,
|
|
9789
|
-
}) => {
|
|
10049
|
+
};
|
|
10050
|
+
|
|
10051
|
+
const Details = ({uniqueId, title, editable, handleEditable, children, s}) => {
|
|
9790
10052
|
const open = !!useCell(STATE_TABLE, uniqueId, OPEN_CELL, s);
|
|
9791
10053
|
const handleToggle = useSetCellCallback(
|
|
9792
10054
|
STATE_TABLE,
|
|
@@ -9802,16 +10064,17 @@ const Details = ({
|
|
|
9802
10064
|
children: [
|
|
9803
10065
|
/* @__PURE__ */ jsxs('summary', {
|
|
9804
10066
|
children: [
|
|
9805
|
-
|
|
10067
|
+
/* @__PURE__ */ jsx('span', {children: title}),
|
|
9806
10068
|
handleEditable
|
|
9807
10069
|
? /* @__PURE__ */ jsx('img', {
|
|
9808
10070
|
onClick: handleEditable,
|
|
9809
10071
|
className: editable ? 'done' : 'edit',
|
|
10072
|
+
title: editable ? 'Done editing' : 'Edit',
|
|
9810
10073
|
})
|
|
9811
10074
|
: null,
|
|
9812
10075
|
],
|
|
9813
10076
|
}),
|
|
9814
|
-
children,
|
|
10077
|
+
/* @__PURE__ */ jsx('div', {children}),
|
|
9815
10078
|
],
|
|
9816
10079
|
});
|
|
9817
10080
|
};
|
|
@@ -9819,7 +10082,7 @@ const Details = ({
|
|
|
9819
10082
|
const IndexView = ({indexes, indexesId, indexId, s}) =>
|
|
9820
10083
|
/* @__PURE__ */ jsx(Details, {
|
|
9821
10084
|
uniqueId: getUniqueId('i', indexesId, indexId),
|
|
9822
|
-
|
|
10085
|
+
title: 'Index: ' + indexId,
|
|
9823
10086
|
s,
|
|
9824
10087
|
children: arrayMap(useSliceIds(indexId, indexes), (sliceId) =>
|
|
9825
10088
|
/* @__PURE__ */ jsx(
|
|
@@ -9840,7 +10103,7 @@ const SliceView = ({indexes, indexesId, indexId, sliceId, s}) => {
|
|
|
9840
10103
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
9841
10104
|
return /* @__PURE__ */ jsx(Details, {
|
|
9842
10105
|
uniqueId,
|
|
9843
|
-
|
|
10106
|
+
title: 'Slice: ' + sliceId,
|
|
9844
10107
|
editable,
|
|
9845
10108
|
handleEditable,
|
|
9846
10109
|
s,
|
|
@@ -9859,7 +10122,7 @@ const IndexesView = ({indexesId, s}) => {
|
|
|
9859
10122
|
? null
|
|
9860
10123
|
: /* @__PURE__ */ jsx(Details, {
|
|
9861
10124
|
uniqueId: getUniqueId('i', indexesId),
|
|
9862
|
-
|
|
10125
|
+
title: 'Indexes: ' + (indexesId ?? DEFAULT),
|
|
9863
10126
|
s,
|
|
9864
10127
|
children: arrayIsEmpty(indexIds)
|
|
9865
10128
|
? 'No indexes defined'
|
|
@@ -9881,7 +10144,7 @@ const IndexesView = ({indexesId, s}) => {
|
|
|
9881
10144
|
const MetricRow = ({metrics, metricId}) =>
|
|
9882
10145
|
/* @__PURE__ */ jsxs('tr', {
|
|
9883
10146
|
children: [
|
|
9884
|
-
/* @__PURE__ */ jsx('th', {children: metricId}),
|
|
10147
|
+
/* @__PURE__ */ jsx('th', {title: metricId, children: metricId}),
|
|
9885
10148
|
/* @__PURE__ */ jsx('td', {children: metrics?.getTableId(metricId)}),
|
|
9886
10149
|
/* @__PURE__ */ jsx('td', {children: useMetric(metricId, metrics)}),
|
|
9887
10150
|
],
|
|
@@ -9893,7 +10156,7 @@ const MetricsView = ({metricsId, s}) => {
|
|
|
9893
10156
|
? null
|
|
9894
10157
|
: /* @__PURE__ */ jsx(Details, {
|
|
9895
10158
|
uniqueId: getUniqueId('m', metricsId),
|
|
9896
|
-
|
|
10159
|
+
title: 'Metrics: ' + (metricsId ?? DEFAULT),
|
|
9897
10160
|
s,
|
|
9898
10161
|
children: arrayIsEmpty(metricIds)
|
|
9899
10162
|
? 'No metrics defined'
|
|
@@ -9935,7 +10198,7 @@ const QueryView = ({queries, queriesId, queryId, s}) => {
|
|
|
9935
10198
|
);
|
|
9936
10199
|
return /* @__PURE__ */ jsx(Details, {
|
|
9937
10200
|
uniqueId,
|
|
9938
|
-
|
|
10201
|
+
title: 'Query: ' + queryId,
|
|
9939
10202
|
s,
|
|
9940
10203
|
children: /* @__PURE__ */ jsx(ResultSortedTableInHtmlTable, {
|
|
9941
10204
|
queryId,
|
|
@@ -9957,7 +10220,7 @@ const QueriesView = ({queriesId, s}) => {
|
|
|
9957
10220
|
? null
|
|
9958
10221
|
: /* @__PURE__ */ jsx(Details, {
|
|
9959
10222
|
uniqueId: getUniqueId('q', queriesId),
|
|
9960
|
-
|
|
10223
|
+
title: 'Queries: ' + (queriesId ?? DEFAULT),
|
|
9961
10224
|
s,
|
|
9962
10225
|
children: arrayIsEmpty(queryIds)
|
|
9963
10226
|
? 'No queries defined'
|
|
@@ -9986,7 +10249,7 @@ const RelationshipView = ({
|
|
|
9986
10249
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
9987
10250
|
return /* @__PURE__ */ jsx(Details, {
|
|
9988
10251
|
uniqueId,
|
|
9989
|
-
|
|
10252
|
+
title: 'Relationship: ' + relationshipId,
|
|
9990
10253
|
editable,
|
|
9991
10254
|
handleEditable,
|
|
9992
10255
|
s,
|
|
@@ -10004,7 +10267,7 @@ const RelationshipsView = ({relationshipsId, s}) => {
|
|
|
10004
10267
|
? null
|
|
10005
10268
|
: /* @__PURE__ */ jsx(Details, {
|
|
10006
10269
|
uniqueId: getUniqueId('r', relationshipsId),
|
|
10007
|
-
|
|
10270
|
+
title: 'Relationships: ' + (relationshipsId ?? DEFAULT),
|
|
10008
10271
|
s,
|
|
10009
10272
|
children: arrayIsEmpty(relationshipIds)
|
|
10010
10273
|
? 'No relationships defined'
|
|
@@ -10023,6 +10286,312 @@ const RelationshipsView = ({relationshipsId, s}) => {
|
|
|
10023
10286
|
});
|
|
10024
10287
|
};
|
|
10025
10288
|
|
|
10289
|
+
const getNewIdFromSuggestedId = (suggestedId, has) => {
|
|
10290
|
+
let newId;
|
|
10291
|
+
let suffix = 0;
|
|
10292
|
+
while (
|
|
10293
|
+
has(
|
|
10294
|
+
(newId =
|
|
10295
|
+
suggestedId +
|
|
10296
|
+
(suffix > 0 ? ' (copy' + (suffix > 1 ? ' ' + suffix : '') + ')' : '')),
|
|
10297
|
+
)
|
|
10298
|
+
) {
|
|
10299
|
+
suffix++;
|
|
10300
|
+
}
|
|
10301
|
+
return newId;
|
|
10302
|
+
};
|
|
10303
|
+
const ConfirmableActions = ({actions, ...props}) => {
|
|
10304
|
+
const [confirming, setConfirming] = useState();
|
|
10305
|
+
const handleDone = useCallback(() => setConfirming(void 0), []);
|
|
10306
|
+
useEffect(() => {
|
|
10307
|
+
if (!isUndefined(confirming)) {
|
|
10308
|
+
const handleKeyDown = (e) => {
|
|
10309
|
+
if (!isUndefined(confirming) && e.key === 'Escape') {
|
|
10310
|
+
e.preventDefault();
|
|
10311
|
+
handleDone();
|
|
10312
|
+
}
|
|
10313
|
+
};
|
|
10314
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
10315
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
10316
|
+
}
|
|
10317
|
+
}, [confirming, handleDone]);
|
|
10318
|
+
if (!isUndefined(confirming)) {
|
|
10319
|
+
const [, , Component] = actions[confirming];
|
|
10320
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
10321
|
+
children: [
|
|
10322
|
+
/* @__PURE__ */ jsx(Component, {onDone: handleDone, ...props}),
|
|
10323
|
+
/* @__PURE__ */ jsx('img', {
|
|
10324
|
+
onClick: handleDone,
|
|
10325
|
+
title: 'Cancel',
|
|
10326
|
+
className: 'cancel',
|
|
10327
|
+
}),
|
|
10328
|
+
],
|
|
10329
|
+
});
|
|
10330
|
+
} else {
|
|
10331
|
+
return actions.map(([icon, title], index) =>
|
|
10332
|
+
/* @__PURE__ */ jsx(
|
|
10333
|
+
'img',
|
|
10334
|
+
{
|
|
10335
|
+
title,
|
|
10336
|
+
className: icon,
|
|
10337
|
+
onClick: () => setConfirming(index),
|
|
10338
|
+
},
|
|
10339
|
+
index,
|
|
10340
|
+
),
|
|
10341
|
+
);
|
|
10342
|
+
}
|
|
10343
|
+
};
|
|
10344
|
+
const NewId = ({onDone, suggestedId, has, set, prompt = 'New Id'}) => {
|
|
10345
|
+
const [newId, setNewId] = useState(suggestedId);
|
|
10346
|
+
const [newIdOk, setNewIdOk] = useState(true);
|
|
10347
|
+
const [previousSuggestedId, setPreviousSuggestedNewId] =
|
|
10348
|
+
useState(suggestedId);
|
|
10349
|
+
const handleNewIdChange = (e) => {
|
|
10350
|
+
setNewId(e.target.value);
|
|
10351
|
+
setNewIdOk(!has(e.target.value));
|
|
10352
|
+
};
|
|
10353
|
+
const handleClick = useCallback(() => {
|
|
10354
|
+
if (has(newId)) {
|
|
10355
|
+
setNewIdOk(false);
|
|
10356
|
+
} else {
|
|
10357
|
+
set(newId);
|
|
10358
|
+
onDone();
|
|
10359
|
+
}
|
|
10360
|
+
}, [onDone, setNewIdOk, has, set, newId]);
|
|
10361
|
+
const handleKeyDown = useCallback(
|
|
10362
|
+
(e) => {
|
|
10363
|
+
if (e.key === 'Enter') {
|
|
10364
|
+
e.preventDefault();
|
|
10365
|
+
handleClick();
|
|
10366
|
+
}
|
|
10367
|
+
},
|
|
10368
|
+
[handleClick],
|
|
10369
|
+
);
|
|
10370
|
+
if (suggestedId != previousSuggestedId) {
|
|
10371
|
+
setNewId(suggestedId);
|
|
10372
|
+
setPreviousSuggestedNewId(suggestedId);
|
|
10373
|
+
}
|
|
10374
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
10375
|
+
children: [
|
|
10376
|
+
prompt + ': ',
|
|
10377
|
+
/* @__PURE__ */ jsx('input', {
|
|
10378
|
+
type: 'text',
|
|
10379
|
+
value: newId,
|
|
10380
|
+
onChange: handleNewIdChange,
|
|
10381
|
+
onKeyDown: handleKeyDown,
|
|
10382
|
+
autoFocus: true,
|
|
10383
|
+
}),
|
|
10384
|
+
' ',
|
|
10385
|
+
/* @__PURE__ */ jsx('img', {
|
|
10386
|
+
onClick: handleClick,
|
|
10387
|
+
title: newIdOk ? 'Confirm' : 'Id already exists',
|
|
10388
|
+
className: newIdOk ? 'ok' : 'okDis',
|
|
10389
|
+
}),
|
|
10390
|
+
],
|
|
10391
|
+
});
|
|
10392
|
+
};
|
|
10393
|
+
const Delete = ({onClick, prompt = 'Delete'}) => {
|
|
10394
|
+
const handleKeyDown = useCallback(
|
|
10395
|
+
(e) => {
|
|
10396
|
+
if (e.key === 'Enter') {
|
|
10397
|
+
e.preventDefault();
|
|
10398
|
+
onClick();
|
|
10399
|
+
}
|
|
10400
|
+
},
|
|
10401
|
+
[onClick],
|
|
10402
|
+
);
|
|
10403
|
+
useEffect(() => {
|
|
10404
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
10405
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
10406
|
+
}, [handleKeyDown]);
|
|
10407
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
10408
|
+
children: [
|
|
10409
|
+
prompt,
|
|
10410
|
+
'? ',
|
|
10411
|
+
/* @__PURE__ */ jsx('img', {onClick, title: 'Confirm', className: 'ok'}),
|
|
10412
|
+
],
|
|
10413
|
+
});
|
|
10414
|
+
};
|
|
10415
|
+
const Actions = ({left, right}) =>
|
|
10416
|
+
/* @__PURE__ */ jsxs('div', {
|
|
10417
|
+
className: 'actions',
|
|
10418
|
+
children: [
|
|
10419
|
+
/* @__PURE__ */ jsx('div', {children: left}),
|
|
10420
|
+
/* @__PURE__ */ jsx('div', {children: right}),
|
|
10421
|
+
],
|
|
10422
|
+
});
|
|
10423
|
+
|
|
10424
|
+
const useHasTableCallback = (storeOrStoreId) => {
|
|
10425
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10426
|
+
return useCallback((tableId) => store?.hasTable(tableId) ?? false, [store]);
|
|
10427
|
+
};
|
|
10428
|
+
const AddTable = ({onDone, store}) => {
|
|
10429
|
+
const has = useHasTableCallback(store);
|
|
10430
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10431
|
+
onDone,
|
|
10432
|
+
suggestedId: getNewIdFromSuggestedId('table', has),
|
|
10433
|
+
has,
|
|
10434
|
+
set: useSetTableCallback(
|
|
10435
|
+
(newId) => newId,
|
|
10436
|
+
() => ({row: {cell: ''}}),
|
|
10437
|
+
[],
|
|
10438
|
+
store,
|
|
10439
|
+
),
|
|
10440
|
+
prompt: 'Add table',
|
|
10441
|
+
});
|
|
10442
|
+
};
|
|
10443
|
+
const DeleteTables = ({onDone, store}) =>
|
|
10444
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10445
|
+
onClick: useDelTablesCallback(store, onDone),
|
|
10446
|
+
prompt: 'Delete all tables',
|
|
10447
|
+
});
|
|
10448
|
+
const TablesActions = ({store}) =>
|
|
10449
|
+
/* @__PURE__ */ jsx(Actions, {
|
|
10450
|
+
left: /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10451
|
+
actions: [['add', 'Add table', AddTable]],
|
|
10452
|
+
store,
|
|
10453
|
+
}),
|
|
10454
|
+
right: useHasTables(store)
|
|
10455
|
+
? /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10456
|
+
actions: [['delete', 'Delete all tables', DeleteTables]],
|
|
10457
|
+
store,
|
|
10458
|
+
})
|
|
10459
|
+
: null,
|
|
10460
|
+
});
|
|
10461
|
+
const AddRow = ({onDone, tableId, store}) => {
|
|
10462
|
+
const has = useHasRowCallback(store, tableId);
|
|
10463
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10464
|
+
onDone,
|
|
10465
|
+
suggestedId: getNewIdFromSuggestedId('row', has),
|
|
10466
|
+
has,
|
|
10467
|
+
set: useSetRowCallback(
|
|
10468
|
+
tableId,
|
|
10469
|
+
(newId) => newId,
|
|
10470
|
+
(_, store2) =>
|
|
10471
|
+
objNew(
|
|
10472
|
+
arrayMap(store2.getTableCellIds(tableId), (cellId) => [cellId, '']),
|
|
10473
|
+
),
|
|
10474
|
+
),
|
|
10475
|
+
prompt: 'Add row',
|
|
10476
|
+
});
|
|
10477
|
+
};
|
|
10478
|
+
const CloneTable = ({onDone, tableId, store: storeOrStoreId}) => {
|
|
10479
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10480
|
+
const has = useHasTableCallback(store);
|
|
10481
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10482
|
+
onDone,
|
|
10483
|
+
suggestedId: getNewIdFromSuggestedId(tableId, has),
|
|
10484
|
+
has,
|
|
10485
|
+
set: useSetTableCallback(
|
|
10486
|
+
(tableId2) => tableId2,
|
|
10487
|
+
(_, store2) => store2.getTable(tableId),
|
|
10488
|
+
),
|
|
10489
|
+
prompt: 'Clone table to',
|
|
10490
|
+
});
|
|
10491
|
+
};
|
|
10492
|
+
const DeleteTable = ({onDone, tableId, store}) =>
|
|
10493
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10494
|
+
onClick: useDelTableCallback(tableId, store, onDone),
|
|
10495
|
+
prompt: 'Delete table',
|
|
10496
|
+
});
|
|
10497
|
+
const TableActions1 = ({tableId, store}) =>
|
|
10498
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10499
|
+
actions: [['add', 'Add row', AddRow]],
|
|
10500
|
+
store,
|
|
10501
|
+
tableId,
|
|
10502
|
+
});
|
|
10503
|
+
const TableActions2 = ({tableId, store}) =>
|
|
10504
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10505
|
+
actions: [
|
|
10506
|
+
['clone', 'Clone table', CloneTable],
|
|
10507
|
+
['delete', 'Delete table', DeleteTable],
|
|
10508
|
+
],
|
|
10509
|
+
store,
|
|
10510
|
+
tableId,
|
|
10511
|
+
});
|
|
10512
|
+
const useHasRowCallback = (storeOrStoreId, tableId) => {
|
|
10513
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10514
|
+
return useCallback(
|
|
10515
|
+
(rowId) => store?.hasRow(tableId, rowId) ?? false,
|
|
10516
|
+
[store, tableId],
|
|
10517
|
+
);
|
|
10518
|
+
};
|
|
10519
|
+
const AddCell = ({onDone, tableId, rowId, store: storeOrStoreId}) => {
|
|
10520
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10521
|
+
const has = useCallback(
|
|
10522
|
+
(cellId) => store.hasCell(tableId, rowId, cellId),
|
|
10523
|
+
[store, tableId, rowId],
|
|
10524
|
+
);
|
|
10525
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10526
|
+
onDone,
|
|
10527
|
+
suggestedId: getNewIdFromSuggestedId('cell', has),
|
|
10528
|
+
has,
|
|
10529
|
+
set: useSetCellCallback(
|
|
10530
|
+
tableId,
|
|
10531
|
+
rowId,
|
|
10532
|
+
(newId) => newId,
|
|
10533
|
+
() => '',
|
|
10534
|
+
[],
|
|
10535
|
+
store,
|
|
10536
|
+
),
|
|
10537
|
+
prompt: 'Add cell',
|
|
10538
|
+
});
|
|
10539
|
+
};
|
|
10540
|
+
const CloneRow = ({onDone, tableId, rowId, store: storeOrStoreId}) => {
|
|
10541
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10542
|
+
const has = useHasRowCallback(store, tableId);
|
|
10543
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10544
|
+
onDone,
|
|
10545
|
+
suggestedId: getNewIdFromSuggestedId(rowId, has),
|
|
10546
|
+
has,
|
|
10547
|
+
set: useSetRowCallback(
|
|
10548
|
+
tableId,
|
|
10549
|
+
(newId) => newId,
|
|
10550
|
+
(_, store2) => store2.getRow(tableId, rowId),
|
|
10551
|
+
[rowId],
|
|
10552
|
+
),
|
|
10553
|
+
prompt: 'Clone row to',
|
|
10554
|
+
});
|
|
10555
|
+
};
|
|
10556
|
+
const DeleteRow = ({onDone, tableId, rowId, store}) =>
|
|
10557
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10558
|
+
onClick: useDelRowCallback(tableId, rowId, store, onDone),
|
|
10559
|
+
prompt: 'Delete row',
|
|
10560
|
+
});
|
|
10561
|
+
const RowActions = ({tableId, rowId, store}) =>
|
|
10562
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10563
|
+
actions: [
|
|
10564
|
+
['add', 'Add cell', AddCell],
|
|
10565
|
+
['clone', 'Clone row', CloneRow],
|
|
10566
|
+
['delete', 'Delete row', DeleteRow],
|
|
10567
|
+
],
|
|
10568
|
+
store,
|
|
10569
|
+
tableId,
|
|
10570
|
+
rowId,
|
|
10571
|
+
});
|
|
10572
|
+
const CellDelete = ({onDone, tableId, rowId, cellId, store}) =>
|
|
10573
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10574
|
+
onClick: useDelCellCallback(tableId, rowId, cellId, true, store, onDone),
|
|
10575
|
+
prompt: 'Delete cell',
|
|
10576
|
+
});
|
|
10577
|
+
const CellActions = ({tableId, rowId, cellId, store}) =>
|
|
10578
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10579
|
+
actions: [['delete', 'Delete cell', CellDelete]],
|
|
10580
|
+
store,
|
|
10581
|
+
tableId,
|
|
10582
|
+
rowId,
|
|
10583
|
+
cellId,
|
|
10584
|
+
});
|
|
10585
|
+
|
|
10586
|
+
const rowActions = [{label: '', component: RowActions}];
|
|
10587
|
+
const EditableCellViewWithActions = (props) =>
|
|
10588
|
+
/* @__PURE__ */ jsxs(Fragment, {
|
|
10589
|
+
children: [
|
|
10590
|
+
/* @__PURE__ */ jsx(EditableCellView, {...props}),
|
|
10591
|
+
useHasCell(props.tableId, props.rowId, props.cellId, props.store) &&
|
|
10592
|
+
/* @__PURE__ */ jsx(CellActions, {...props}),
|
|
10593
|
+
],
|
|
10594
|
+
});
|
|
10026
10595
|
const TableView = ({tableId, store, storeId, s}) => {
|
|
10027
10596
|
const uniqueId = getUniqueId('t', storeId, tableId);
|
|
10028
10597
|
const [cellId, descending, offset] = jsonParse(
|
|
@@ -10037,66 +10606,183 @@ const TableView = ({tableId, store, storeId, s}) => {
|
|
|
10037
10606
|
s,
|
|
10038
10607
|
);
|
|
10039
10608
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
10040
|
-
|
|
10609
|
+
const CellComponent = editable ? EditableCellViewWithActions : CellView;
|
|
10610
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
10041
10611
|
uniqueId,
|
|
10042
|
-
|
|
10612
|
+
title: TABLE$1 + ': ' + tableId,
|
|
10043
10613
|
editable,
|
|
10044
10614
|
handleEditable,
|
|
10045
10615
|
s,
|
|
10046
|
-
children:
|
|
10047
|
-
|
|
10616
|
+
children: [
|
|
10617
|
+
/* @__PURE__ */ jsx(SortedTableInHtmlTable, {
|
|
10618
|
+
tableId,
|
|
10619
|
+
store,
|
|
10620
|
+
cellId,
|
|
10621
|
+
descending,
|
|
10622
|
+
offset,
|
|
10623
|
+
limit: 10,
|
|
10624
|
+
paginator: true,
|
|
10625
|
+
sortOnClick: true,
|
|
10626
|
+
onChange: handleChange,
|
|
10627
|
+
editable,
|
|
10628
|
+
extraCellsAfter: editable ? rowActions : [],
|
|
10629
|
+
customCells: objNew(
|
|
10630
|
+
arrayMap(useTableCellIds(tableId, store), (cellId2) => [
|
|
10631
|
+
cellId2,
|
|
10632
|
+
{label: cellId2, component: CellComponent},
|
|
10633
|
+
]),
|
|
10634
|
+
),
|
|
10635
|
+
}),
|
|
10636
|
+
editable
|
|
10637
|
+
? /* @__PURE__ */ jsxs('div', {
|
|
10638
|
+
className: 'actions',
|
|
10639
|
+
children: [
|
|
10640
|
+
/* @__PURE__ */ jsx('div', {
|
|
10641
|
+
children: /* @__PURE__ */ jsx(TableActions1, {tableId, store}),
|
|
10642
|
+
}),
|
|
10643
|
+
/* @__PURE__ */ jsx('div', {
|
|
10644
|
+
children: /* @__PURE__ */ jsx(TableActions2, {tableId, store}),
|
|
10645
|
+
}),
|
|
10646
|
+
],
|
|
10647
|
+
})
|
|
10648
|
+
: null,
|
|
10649
|
+
],
|
|
10650
|
+
});
|
|
10651
|
+
};
|
|
10652
|
+
const TablesView = ({store, storeId, s}) => {
|
|
10653
|
+
const uniqueId = getUniqueId('ts', storeId);
|
|
10654
|
+
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
10655
|
+
const tableIds = useTableIds(store);
|
|
10656
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
10657
|
+
uniqueId,
|
|
10658
|
+
title: TABLES,
|
|
10659
|
+
editable,
|
|
10660
|
+
handleEditable,
|
|
10661
|
+
s,
|
|
10662
|
+
children: [
|
|
10663
|
+
arrayIsEmpty(tableIds)
|
|
10664
|
+
? /* @__PURE__ */ jsx('caption', {children: 'No tables.'})
|
|
10665
|
+
: sortedIdsMap(tableIds, (tableId) =>
|
|
10666
|
+
/* @__PURE__ */ jsx(
|
|
10667
|
+
TableView,
|
|
10668
|
+
{
|
|
10669
|
+
store,
|
|
10670
|
+
storeId,
|
|
10671
|
+
tableId,
|
|
10672
|
+
s,
|
|
10673
|
+
},
|
|
10674
|
+
tableId,
|
|
10675
|
+
),
|
|
10676
|
+
),
|
|
10677
|
+
editable ? /* @__PURE__ */ jsx(TablesActions, {store}) : null,
|
|
10678
|
+
],
|
|
10679
|
+
});
|
|
10680
|
+
};
|
|
10681
|
+
|
|
10682
|
+
const useHasValueCallback = (storeOrStoreId) => {
|
|
10683
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
10684
|
+
return useCallback((valueId) => store?.hasValue(valueId) ?? false, [store]);
|
|
10685
|
+
};
|
|
10686
|
+
const AddValue = ({onDone, store}) => {
|
|
10687
|
+
const has = useHasValueCallback(store);
|
|
10688
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10689
|
+
onDone,
|
|
10690
|
+
suggestedId: getNewIdFromSuggestedId('value', has),
|
|
10691
|
+
has,
|
|
10692
|
+
set: useSetValueCallback(
|
|
10693
|
+
(newId) => newId,
|
|
10694
|
+
() => '',
|
|
10695
|
+
[],
|
|
10696
|
+
store,
|
|
10697
|
+
),
|
|
10698
|
+
prompt: 'Add value',
|
|
10699
|
+
});
|
|
10700
|
+
};
|
|
10701
|
+
const DeleteValues = ({onDone, store}) =>
|
|
10702
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10703
|
+
onClick: useDelValuesCallback(store, onDone),
|
|
10704
|
+
prompt: 'Delete all values',
|
|
10705
|
+
});
|
|
10706
|
+
const ValuesActions = ({store}) =>
|
|
10707
|
+
/* @__PURE__ */ jsx(Actions, {
|
|
10708
|
+
left: /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10709
|
+
actions: [['add', 'Add value', AddValue]],
|
|
10048
10710
|
store,
|
|
10049
|
-
cellId,
|
|
10050
|
-
descending,
|
|
10051
|
-
offset,
|
|
10052
|
-
limit: 10,
|
|
10053
|
-
paginator: true,
|
|
10054
|
-
sortOnClick: true,
|
|
10055
|
-
onChange: handleChange,
|
|
10056
|
-
editable,
|
|
10057
10711
|
}),
|
|
10712
|
+
right: useHasValues(store)
|
|
10713
|
+
? /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10714
|
+
actions: [['delete', 'Delete all values', DeleteValues]],
|
|
10715
|
+
store,
|
|
10716
|
+
})
|
|
10717
|
+
: null,
|
|
10718
|
+
});
|
|
10719
|
+
const CloneValue = ({onDone, valueId, store}) => {
|
|
10720
|
+
const has = useHasValueCallback(store);
|
|
10721
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
10722
|
+
onDone,
|
|
10723
|
+
suggestedId: getNewIdFromSuggestedId(valueId, has),
|
|
10724
|
+
has,
|
|
10725
|
+
set: useSetValueCallback(
|
|
10726
|
+
(newId) => newId,
|
|
10727
|
+
(_, store2) => store2.getValue(valueId) ?? '',
|
|
10728
|
+
[valueId],
|
|
10729
|
+
store,
|
|
10730
|
+
),
|
|
10731
|
+
prompt: 'Clone value to',
|
|
10058
10732
|
});
|
|
10059
10733
|
};
|
|
10734
|
+
const DeleteValue = ({onDone, valueId, store}) =>
|
|
10735
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
10736
|
+
onClick: useDelValueCallback(valueId, store, onDone),
|
|
10737
|
+
prompt: 'Delete value',
|
|
10738
|
+
});
|
|
10739
|
+
const ValueActions = ({valueId, store}) =>
|
|
10740
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
10741
|
+
actions: [
|
|
10742
|
+
['clone', 'Clone value', CloneValue],
|
|
10743
|
+
['delete', 'Delete value', DeleteValue],
|
|
10744
|
+
],
|
|
10745
|
+
store,
|
|
10746
|
+
valueId,
|
|
10747
|
+
});
|
|
10748
|
+
|
|
10749
|
+
const valueActions = [{label: '', component: ValueActions}];
|
|
10060
10750
|
const ValuesView = ({store, storeId, s}) => {
|
|
10061
10751
|
const uniqueId = getUniqueId('v', storeId);
|
|
10062
10752
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
10063
|
-
return
|
|
10064
|
-
|
|
10065
|
-
:
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10753
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
10754
|
+
uniqueId,
|
|
10755
|
+
title: VALUES,
|
|
10756
|
+
editable,
|
|
10757
|
+
handleEditable,
|
|
10758
|
+
s,
|
|
10759
|
+
children: [
|
|
10760
|
+
arrayIsEmpty(useValueIds(store))
|
|
10761
|
+
? /* @__PURE__ */ jsx('caption', {children: 'No values.'})
|
|
10762
|
+
: /* @__PURE__ */ jsx(ValuesInHtmlTable, {
|
|
10763
|
+
store,
|
|
10764
|
+
editable,
|
|
10765
|
+
extraCellsAfter: editable ? valueActions : [],
|
|
10766
|
+
}),
|
|
10767
|
+
editable ? /* @__PURE__ */ jsx(ValuesActions, {store}) : null,
|
|
10768
|
+
],
|
|
10769
|
+
});
|
|
10073
10770
|
};
|
|
10771
|
+
|
|
10074
10772
|
const StoreView = ({storeId, s}) => {
|
|
10075
10773
|
const store = useStore(storeId);
|
|
10076
|
-
const tableIds = useTableIds(store);
|
|
10077
10774
|
return isUndefined(store)
|
|
10078
10775
|
? null
|
|
10079
10776
|
: /* @__PURE__ */ jsxs(Details, {
|
|
10080
10777
|
uniqueId: getUniqueId('s', storeId),
|
|
10081
|
-
|
|
10778
|
+
title:
|
|
10082
10779
|
(store.isMergeable() ? 'Mergeable' : '') +
|
|
10083
10780
|
'Store: ' +
|
|
10084
10781
|
(storeId ?? DEFAULT),
|
|
10085
10782
|
s,
|
|
10086
10783
|
children: [
|
|
10087
10784
|
/* @__PURE__ */ jsx(ValuesView, {storeId, store, s}),
|
|
10088
|
-
|
|
10089
|
-
/* @__PURE__ */ jsx(
|
|
10090
|
-
TableView,
|
|
10091
|
-
{
|
|
10092
|
-
store,
|
|
10093
|
-
storeId,
|
|
10094
|
-
tableId,
|
|
10095
|
-
s,
|
|
10096
|
-
},
|
|
10097
|
-
tableId,
|
|
10098
|
-
),
|
|
10099
|
-
),
|
|
10785
|
+
/* @__PURE__ */ jsx(TablesView, {storeId, store, s}),
|
|
10100
10786
|
],
|
|
10101
10787
|
});
|
|
10102
10788
|
};
|
|
@@ -10217,6 +10903,7 @@ class ErrorBoundary extends PureComponent {
|
|
|
10217
10903
|
|
|
10218
10904
|
const Header = ({s}) => {
|
|
10219
10905
|
const position = useValue(POSITION_VALUE, s) ?? 1;
|
|
10906
|
+
const handleClick = () => open('https://tinybase.org', '_blank');
|
|
10220
10907
|
const handleClose = useSetValueCallback(OPEN_VALUE, () => false, [], s);
|
|
10221
10908
|
const handleDock = useSetValueCallback(
|
|
10222
10909
|
POSITION_VALUE,
|
|
@@ -10226,7 +10913,11 @@ const Header = ({s}) => {
|
|
|
10226
10913
|
);
|
|
10227
10914
|
return /* @__PURE__ */ jsxs('header', {
|
|
10228
10915
|
children: [
|
|
10229
|
-
/* @__PURE__ */ jsx('img', {
|
|
10916
|
+
/* @__PURE__ */ jsx('img', {
|
|
10917
|
+
className: 'flat',
|
|
10918
|
+
title: TITLE,
|
|
10919
|
+
onClick: handleClick,
|
|
10920
|
+
}),
|
|
10230
10921
|
/* @__PURE__ */ jsx('span', {children: TITLE}),
|
|
10231
10922
|
arrayMap(POSITIONS, (name, p) =>
|
|
10232
10923
|
p == position
|
|
@@ -10241,7 +10932,11 @@ const Header = ({s}) => {
|
|
|
10241
10932
|
p,
|
|
10242
10933
|
),
|
|
10243
10934
|
),
|
|
10244
|
-
/* @__PURE__ */ jsx('img', {
|
|
10935
|
+
/* @__PURE__ */ jsx('img', {
|
|
10936
|
+
className: 'flat',
|
|
10937
|
+
onClick: handleClose,
|
|
10938
|
+
title: 'Close',
|
|
10939
|
+
}),
|
|
10245
10940
|
],
|
|
10246
10941
|
});
|
|
10247
10942
|
};
|
|
@@ -10264,70 +10959,237 @@ const Panel = ({s}) => {
|
|
|
10264
10959
|
var img =
|
|
10265
10960
|
"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e";
|
|
10266
10961
|
|
|
10267
|
-
const
|
|
10268
|
-
const PRE_CSS = 'content:url("';
|
|
10962
|
+
const PRE_CSS = 'url("';
|
|
10269
10963
|
const POST_CSS = '")';
|
|
10270
|
-
const
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10964
|
+
const getCssSvg = (path, color = 'white') => ({
|
|
10965
|
+
content:
|
|
10966
|
+
PRE_CSS +
|
|
10967
|
+
`data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' fill='${color}'><path d='${path}' /></svg>` +
|
|
10968
|
+
POST_CSS,
|
|
10969
|
+
});
|
|
10970
|
+
const VERTICAL_THIN = 'v560h120v-560h-120Z';
|
|
10971
|
+
const VERTICAL_THICK = 'v560h360v-560h-360Z';
|
|
10972
|
+
const HORIZONTAL_THIN = 'v120h560v-120h-560Z';
|
|
10973
|
+
const HORIZONTAL_THICK = 'v360h560v-360h-560Z';
|
|
10974
|
+
const LOGO_SVG = {content: PRE_CSS + img + POST_CSS};
|
|
10275
10975
|
const POSITIONS_SVG = arrayMap(
|
|
10276
10976
|
[
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
[30, 30, 40, 40],
|
|
10977
|
+
`M200-760${VERTICAL_THIN} M400-760${VERTICAL_THICK}`,
|
|
10978
|
+
`M200-760${HORIZONTAL_THIN} M200-560${HORIZONTAL_THICK}`,
|
|
10979
|
+
`M200-760${HORIZONTAL_THICK} M200-320${HORIZONTAL_THIN}`,
|
|
10980
|
+
`M200-760${VERTICAL_THICK} M640-760${VERTICAL_THIN}`,
|
|
10282
10981
|
],
|
|
10283
|
-
(
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10982
|
+
(path) =>
|
|
10983
|
+
getCssSvg(
|
|
10984
|
+
'M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z' +
|
|
10985
|
+
path,
|
|
10986
|
+
),
|
|
10987
|
+
);
|
|
10988
|
+
arrayPush(
|
|
10989
|
+
POSITIONS_SVG,
|
|
10990
|
+
getCssSvg(
|
|
10991
|
+
'M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z',
|
|
10992
|
+
),
|
|
10993
|
+
);
|
|
10994
|
+
const CLOSE_SVG = getCssSvg(
|
|
10995
|
+
'm336-280-56-56 144-144-144-143 56-56 144 144 143-144 56 56-144 143 144 144-56 56-143-144-144 144Z',
|
|
10996
|
+
);
|
|
10997
|
+
const EDIT_SVG = getCssSvg(
|
|
10998
|
+
'M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z',
|
|
10999
|
+
);
|
|
11000
|
+
const DONE_SVG = getCssSvg(
|
|
11001
|
+
'm622-453-56-56 82-82-57-57-82 82-56-56 195-195q12-12 26.5-17.5T705-840q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L622-453ZM200-200h57l195-195-28-29-29-28-195 195v57ZM792-56 509-338 290-120H120v-169l219-219L56-792l57-57 736 736-57 57Zm-32-648-56-56 56 56Zm-169 56 57 57-57-57ZM424-424l-29-28 57 57-28-29Z',
|
|
11002
|
+
);
|
|
11003
|
+
const ADD_SVG = getCssSvg(
|
|
11004
|
+
'M440-280h80v-160h160v-80H520v-160h-80v160H280v80h160v160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z',
|
|
11005
|
+
);
|
|
11006
|
+
const CLONE_SVG = getCssSvg(
|
|
11007
|
+
'M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z',
|
|
11008
|
+
);
|
|
11009
|
+
const DELETE_SVG = getCssSvg(
|
|
11010
|
+
'M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z',
|
|
11011
|
+
);
|
|
11012
|
+
const OK_SVG = getCssSvg(
|
|
11013
|
+
'm424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z',
|
|
11014
|
+
'rgb(127,255,127)',
|
|
11015
|
+
);
|
|
11016
|
+
const OK_SVG_DISABLED = getCssSvg(
|
|
11017
|
+
'm40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z',
|
|
11018
|
+
'rgb(255,255,127)',
|
|
11019
|
+
);
|
|
11020
|
+
const CANCEL_SVG = getCssSvg(
|
|
11021
|
+
'm336-280 144-144 144 144 56-56-144-144 144-144-56-56-144 144-144-144-56 56 144 144-144 144 56 56ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z',
|
|
11022
|
+
'rgb(255,127,127)',
|
|
11023
|
+
);
|
|
11024
|
+
const DOWN_SVG = getCssSvg(
|
|
11025
|
+
'M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z',
|
|
11026
|
+
);
|
|
11027
|
+
const RIGHT_SVG = getCssSvg(
|
|
11028
|
+
'M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z',
|
|
10287
11029
|
);
|
|
10288
|
-
const CLOSE_SVG = PRE + `<path d='M20 20l60 60M20 80l60-60' />` + POST;
|
|
10289
|
-
const EDIT_SVG = PRE + `<path d='${PENCIL}' />` + POST;
|
|
10290
|
-
const DONE_SVG = PRE + `<path d='${PENCIL}M20 20l60 60' />` + POST;
|
|
10291
11030
|
|
|
10292
11031
|
const SCROLLBAR = '*::-webkit-scrollbar';
|
|
11032
|
+
const BACKGROUND = 'background';
|
|
11033
|
+
const WIDTH = 'width';
|
|
11034
|
+
const MAX_WIDTH = 'max-' + WIDTH;
|
|
11035
|
+
const MIN_WIDTH = 'min-' + WIDTH;
|
|
11036
|
+
const HEIGHT = 'height';
|
|
11037
|
+
const BORDER = 'border';
|
|
11038
|
+
const BORDER_RADIUS = BORDER + '-radius';
|
|
11039
|
+
const PADDING = 'padding';
|
|
11040
|
+
const MARGIN = 'margin';
|
|
11041
|
+
const MARGIN_RIGHT = MARGIN + '-right';
|
|
11042
|
+
const TOP = 'top';
|
|
11043
|
+
const BOTTOM = 'bottom';
|
|
11044
|
+
const LEFT = 'left';
|
|
11045
|
+
const RIGHT = 'right';
|
|
11046
|
+
const COLOR = 'color';
|
|
11047
|
+
const POSITION = 'position';
|
|
11048
|
+
const BOX_SHADOW = 'box-shadow';
|
|
11049
|
+
const FONT_SIZE = 'font-size';
|
|
11050
|
+
const DISPLAY = 'display';
|
|
11051
|
+
const OVERFLOW = 'overflow';
|
|
11052
|
+
const CURSOR = 'cursor';
|
|
11053
|
+
const VERTICAL_ALIGN = 'vertical-align';
|
|
11054
|
+
const TEXT_ALIGN = 'text-align';
|
|
11055
|
+
const JUSTIFY_CONTENT = 'justify-content';
|
|
11056
|
+
const FIXED = 'fixed';
|
|
11057
|
+
const REVERT = 'revert';
|
|
11058
|
+
const UNSET = 'unset';
|
|
11059
|
+
const NONE = 'none';
|
|
11060
|
+
const FLEX = 'flex';
|
|
11061
|
+
const POINTER = 'pointer';
|
|
11062
|
+
const AUTO = 'auto';
|
|
11063
|
+
const HIDDEN = 'hidden';
|
|
11064
|
+
const NOWRAP = 'nowrap';
|
|
11065
|
+
const oklch = (lPercent, remainder = '% 0.01 ' + cssVar('hue')) =>
|
|
11066
|
+
`oklch(${lPercent}${remainder})`;
|
|
11067
|
+
const cssVar = (name) => `var(--${name})`;
|
|
11068
|
+
const rem = (...rems) => `${rems.join('rem ')}rem`;
|
|
11069
|
+
const px = (...pxs) => `${pxs.join('px ')}px`;
|
|
11070
|
+
const vw = (vw2 = 100) => `${vw2}vw`;
|
|
11071
|
+
const vh = (vh2 = 100) => `${vh2}vh`;
|
|
10293
11072
|
const APP_STYLESHEET = arrayJoin(
|
|
10294
11073
|
objToArray(
|
|
10295
11074
|
{
|
|
10296
|
-
'':
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
11075
|
+
'': {
|
|
11076
|
+
all: 'initial',
|
|
11077
|
+
[FONT_SIZE]: rem(0.75),
|
|
11078
|
+
[POSITION]: FIXED,
|
|
11079
|
+
'font-family': 'inter,sans-serif',
|
|
11080
|
+
'z-index': 999999,
|
|
11081
|
+
'--bg': oklch(20),
|
|
11082
|
+
'--bg2': oklch(15),
|
|
11083
|
+
'--bg3': oklch(25),
|
|
11084
|
+
'--bg4': oklch(30),
|
|
11085
|
+
'--fg': oklch(85),
|
|
11086
|
+
'--fg2': oklch(60),
|
|
11087
|
+
['--' + BORDER]: px(1) + ' solid ' + cssVar('bg4'),
|
|
11088
|
+
['--' + BOX_SHADOW]: px(0, 1, 2, 0) + ' #0007',
|
|
11089
|
+
},
|
|
11090
|
+
'*': {all: REVERT},
|
|
11091
|
+
'*::before': {all: REVERT},
|
|
11092
|
+
'*::after': {all: REVERT},
|
|
11093
|
+
[SCROLLBAR]: {[WIDTH]: rem(0.5), [HEIGHT]: rem(0.5)},
|
|
11094
|
+
[SCROLLBAR + '-thumb']: {[BACKGROUND]: cssVar('bg4')},
|
|
11095
|
+
[SCROLLBAR + '-thumb:hover']: {[BACKGROUND]: cssVar('bg4')},
|
|
11096
|
+
[SCROLLBAR + '-corner']: {[BACKGROUND]: NONE},
|
|
11097
|
+
[SCROLLBAR + '-track']: {[BACKGROUND]: NONE},
|
|
11098
|
+
img: {
|
|
11099
|
+
[WIDTH]: rem(0.8),
|
|
11100
|
+
[HEIGHT]: rem(0.8),
|
|
11101
|
+
[VERTICAL_ALIGN]: 'text-' + BOTTOM,
|
|
11102
|
+
[CURSOR]: POINTER,
|
|
11103
|
+
[MARGIN]: px(-2.5, 2, -2.5, 0),
|
|
11104
|
+
[PADDING]: px(2),
|
|
11105
|
+
[BORDER]: cssVar(BORDER),
|
|
11106
|
+
[BACKGROUND]: cssVar('bg3'),
|
|
11107
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
11108
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
11109
|
+
},
|
|
11110
|
+
'img.flat': {[BORDER]: NONE, [BACKGROUND]: NONE, [BOX_SHADOW]: NONE},
|
|
10306
11111
|
// Nub
|
|
10307
|
-
'>img':
|
|
11112
|
+
'>img': {
|
|
11113
|
+
[PADDING]: rem(0.25),
|
|
11114
|
+
[BOTTOM]: 0,
|
|
11115
|
+
[RIGHT]: 0,
|
|
11116
|
+
[POSITION]: FIXED,
|
|
11117
|
+
[HEIGHT]: UNSET,
|
|
11118
|
+
[MARGIN]: 0,
|
|
11119
|
+
...LOGO_SVG,
|
|
11120
|
+
},
|
|
10308
11121
|
...objNew(
|
|
10309
|
-
arrayMap(
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
11122
|
+
arrayMap(
|
|
11123
|
+
[
|
|
11124
|
+
{[BOTTOM]: 0, [LEFT]: 0},
|
|
11125
|
+
{[TOP]: 0, [RIGHT]: 0},
|
|
11126
|
+
],
|
|
11127
|
+
(css, p) => [`>img[data-position='${p}']`, css],
|
|
11128
|
+
),
|
|
10313
11129
|
),
|
|
10314
11130
|
// Panel
|
|
10315
|
-
main:
|
|
11131
|
+
main: {
|
|
11132
|
+
[DISPLAY]: FLEX,
|
|
11133
|
+
[COLOR]: cssVar('fg'),
|
|
11134
|
+
[BACKGROUND]: cssVar('bg'),
|
|
11135
|
+
[OVERFLOW]: HIDDEN,
|
|
11136
|
+
[POSITION]: FIXED,
|
|
11137
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
11138
|
+
'flex-direction': 'column',
|
|
11139
|
+
},
|
|
10316
11140
|
...objNew(
|
|
10317
11141
|
arrayMap(
|
|
10318
11142
|
[
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
11143
|
+
{
|
|
11144
|
+
[BOTTOM]: 0,
|
|
11145
|
+
[LEFT]: 0,
|
|
11146
|
+
[WIDTH]: vw(35),
|
|
11147
|
+
[HEIGHT]: vh(),
|
|
11148
|
+
[BORDER + '-' + RIGHT]: cssVar(BORDER),
|
|
11149
|
+
},
|
|
11150
|
+
{
|
|
11151
|
+
[TOP]: 0,
|
|
11152
|
+
[RIGHT]: 0,
|
|
11153
|
+
[WIDTH]: vw(),
|
|
11154
|
+
[HEIGHT]: vh(30),
|
|
11155
|
+
[BORDER + '-' + BOTTOM]: cssVar(BORDER),
|
|
11156
|
+
},
|
|
11157
|
+
{
|
|
11158
|
+
[BOTTOM]: 0,
|
|
11159
|
+
[LEFT]: 0,
|
|
11160
|
+
[WIDTH]: vw(),
|
|
11161
|
+
[HEIGHT]: vh(30),
|
|
11162
|
+
[BORDER + '-' + TOP]: cssVar(BORDER),
|
|
11163
|
+
},
|
|
11164
|
+
{
|
|
11165
|
+
[TOP]: 0,
|
|
11166
|
+
[RIGHT]: 0,
|
|
11167
|
+
[WIDTH]: vw(35),
|
|
11168
|
+
[HEIGHT]: vh(),
|
|
11169
|
+
[BORDER + '-' + LEFT]: cssVar(BORDER),
|
|
11170
|
+
},
|
|
11171
|
+
{[TOP]: 0, [RIGHT]: 0, [WIDTH]: vw(), [HEIGHT]: vh()},
|
|
10324
11172
|
],
|
|
10325
11173
|
(css, p) => [`main[data-position='${p}']`, css],
|
|
10326
11174
|
),
|
|
10327
11175
|
),
|
|
10328
11176
|
// Header
|
|
10329
|
-
header:
|
|
10330
|
-
|
|
11177
|
+
header: {
|
|
11178
|
+
[DISPLAY]: FLEX,
|
|
11179
|
+
[PADDING]: rem(0.5),
|
|
11180
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
11181
|
+
[BACKGROUND]: oklch(30, '% 0.008 var(--hue) / .5'),
|
|
11182
|
+
[WIDTH]: 'calc(100% - .5rem)',
|
|
11183
|
+
[POSITION]: 'absolute',
|
|
11184
|
+
[BORDER + '-' + BOTTOM]: cssVar(BORDER),
|
|
11185
|
+
'align-items': 'center',
|
|
11186
|
+
'backdrop-filter': 'blur(4px)',
|
|
11187
|
+
},
|
|
11188
|
+
'header>img:nth-of-type(1)': {
|
|
11189
|
+
[HEIGHT]: rem(1),
|
|
11190
|
+
[WIDTH]: rem(1),
|
|
11191
|
+
...LOGO_SVG,
|
|
11192
|
+
},
|
|
10331
11193
|
'header>img:nth-of-type(6)': CLOSE_SVG,
|
|
10332
11194
|
...objNew(
|
|
10333
11195
|
arrayMap(POSITIONS_SVG, (SVG, p) => [
|
|
@@ -10335,42 +11197,140 @@ const APP_STYLESHEET = arrayJoin(
|
|
|
10335
11197
|
SVG,
|
|
10336
11198
|
]),
|
|
10337
11199
|
),
|
|
10338
|
-
'header>span':
|
|
10339
|
-
|
|
11200
|
+
'header>span': {
|
|
11201
|
+
[OVERFLOW]: HIDDEN,
|
|
11202
|
+
[FLEX]: 1,
|
|
11203
|
+
'font-weight': 800,
|
|
11204
|
+
'white-space': NOWRAP,
|
|
11205
|
+
'text-overflow': 'ellipsis',
|
|
11206
|
+
},
|
|
10340
11207
|
// Body
|
|
10341
|
-
article:
|
|
10342
|
-
details:
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
11208
|
+
article: {[OVERFLOW]: AUTO, [FLEX]: 1, [PADDING + '-' + TOP]: rem(2)},
|
|
11209
|
+
details: {
|
|
11210
|
+
[MARGIN]: rem(0.5),
|
|
11211
|
+
[BORDER]: cssVar(BORDER),
|
|
11212
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
11213
|
+
},
|
|
11214
|
+
summary: {
|
|
11215
|
+
[BACKGROUND]: cssVar('bg3'),
|
|
11216
|
+
[MARGIN]: px(-1),
|
|
11217
|
+
[BORDER]: cssVar(BORDER),
|
|
11218
|
+
[PADDING]: rem(0.25, 0.125),
|
|
11219
|
+
[DISPLAY]: FLEX,
|
|
11220
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
11221
|
+
'user-select': NONE,
|
|
11222
|
+
[JUSTIFY_CONTENT]: 'space-between',
|
|
11223
|
+
'align-items': 'center',
|
|
11224
|
+
},
|
|
11225
|
+
'summary>span::before': {
|
|
11226
|
+
[DISPLAY]: 'inline-block',
|
|
11227
|
+
[VERTICAL_ALIGN]: 'sub',
|
|
11228
|
+
[MARGIN]: px(2),
|
|
11229
|
+
[WIDTH]: rem(1),
|
|
11230
|
+
[HEIGHT]: rem(1),
|
|
11231
|
+
...RIGHT_SVG,
|
|
11232
|
+
},
|
|
11233
|
+
'details[open]>summary': {
|
|
11234
|
+
'border-bottom-left-radius': 0,
|
|
11235
|
+
'border-bottom-right-radius': 0,
|
|
11236
|
+
[MARGIN + '-' + BOTTOM]: 0,
|
|
11237
|
+
},
|
|
11238
|
+
'details[open]>summary>span::before': DOWN_SVG,
|
|
11239
|
+
'details>summary img': {[DISPLAY]: NONE},
|
|
11240
|
+
'details[open]>summary img': {
|
|
11241
|
+
[DISPLAY]: UNSET,
|
|
11242
|
+
[MARGIN + '-' + LEFT]: rem(0.25),
|
|
11243
|
+
},
|
|
11244
|
+
'details>div': {[OVERFLOW]: AUTO},
|
|
11245
|
+
caption: {
|
|
11246
|
+
[COLOR]: cssVar('fg2'),
|
|
11247
|
+
[PADDING]: rem(0.25, 0.5),
|
|
11248
|
+
[TEXT_ALIGN]: LEFT,
|
|
11249
|
+
'white-space': NOWRAP,
|
|
11250
|
+
},
|
|
11251
|
+
'caption button': {
|
|
11252
|
+
[WIDTH]: rem(1.5),
|
|
11253
|
+
[BORDER]: NONE,
|
|
11254
|
+
[BACKGROUND]: NONE,
|
|
11255
|
+
[COLOR]: cssVar('fg'),
|
|
11256
|
+
[PADDING]: 0,
|
|
11257
|
+
[CURSOR]: POINTER,
|
|
11258
|
+
},
|
|
11259
|
+
'caption button[disabled]': {[COLOR]: cssVar('fg2')},
|
|
11260
|
+
'.actions': {
|
|
11261
|
+
[PADDING]: rem(0.75, 0.5),
|
|
11262
|
+
[MARGIN]: 0,
|
|
11263
|
+
[DISPLAY]: FLEX,
|
|
11264
|
+
[BORDER + '-' + TOP]: cssVar(BORDER),
|
|
11265
|
+
[JUSTIFY_CONTENT]: 'space-between',
|
|
11266
|
+
},
|
|
10350
11267
|
// tables
|
|
10351
|
-
table:
|
|
10352
|
-
|
|
10353
|
-
'
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
'
|
|
11268
|
+
table: {
|
|
11269
|
+
[MIN_WIDTH]: '100%',
|
|
11270
|
+
'border-collapse': 'collapse',
|
|
11271
|
+
'table-layout': FIXED,
|
|
11272
|
+
},
|
|
11273
|
+
thead: {[BACKGROUND]: cssVar('bg')},
|
|
11274
|
+
[`th,#${UNIQUE_ID} td`]: {
|
|
11275
|
+
[OVERFLOW]: HIDDEN,
|
|
11276
|
+
[PADDING]: rem(0.25, 0.5),
|
|
11277
|
+
[MAX_WIDTH]: rem(20),
|
|
11278
|
+
[BORDER]: cssVar(BORDER),
|
|
11279
|
+
'text-overflow': 'ellipsis',
|
|
11280
|
+
'white-space': NOWRAP,
|
|
11281
|
+
'border-width': px(1, 0, 0),
|
|
11282
|
+
[TEXT_ALIGN]: LEFT,
|
|
11283
|
+
},
|
|
11284
|
+
'th:first-child': {
|
|
11285
|
+
[WIDTH]: rem(3),
|
|
11286
|
+
[MIN_WIDTH]: rem(3),
|
|
11287
|
+
[MAX_WIDTH]: rem(3),
|
|
11288
|
+
},
|
|
11289
|
+
'th.sorted': {[BACKGROUND]: cssVar('bg3')},
|
|
11290
|
+
'td.extra': {[TEXT_ALIGN]: RIGHT},
|
|
11291
|
+
'tbody button': {
|
|
11292
|
+
[BACKGROUND]: NONE,
|
|
11293
|
+
[BORDER]: NONE,
|
|
11294
|
+
[FONT_SIZE]: 0,
|
|
11295
|
+
[WIDTH]: rem(0.8),
|
|
11296
|
+
[HEIGHT]: rem(0.8),
|
|
11297
|
+
[COLOR]: cssVar('fg2'),
|
|
11298
|
+
[MARGIN]: rem(0, 0.25, 0, -0.25),
|
|
11299
|
+
'line-height': rem(0.8),
|
|
11300
|
+
},
|
|
11301
|
+
'tbody button:first-letter': {[FONT_SIZE]: rem(0.8)},
|
|
11302
|
+
input: {
|
|
11303
|
+
[BACKGROUND]: cssVar('bg2'),
|
|
11304
|
+
[COLOR]: UNSET,
|
|
11305
|
+
[PADDING]: px(4),
|
|
11306
|
+
[BORDER]: 0,
|
|
11307
|
+
[MARGIN]: px(-4, 0),
|
|
11308
|
+
[FONT_SIZE]: UNSET,
|
|
11309
|
+
[MAX_WIDTH]: rem(6),
|
|
11310
|
+
},
|
|
11311
|
+
'input:focus': {'outline-width': 0},
|
|
11312
|
+
'input[type="number"]': {[WIDTH]: rem(3)},
|
|
11313
|
+
'input[type="checkbox"]': {[VERTICAL_ALIGN]: px(-2)},
|
|
11314
|
+
'.editableCell': {[DISPLAY]: 'inline-block', [MARGIN_RIGHT]: px(2)},
|
|
11315
|
+
'button.next': {[MARGIN_RIGHT]: rem(0.5)},
|
|
11316
|
+
'img.edit': EDIT_SVG,
|
|
11317
|
+
'img.done': DONE_SVG,
|
|
11318
|
+
'img.add': ADD_SVG,
|
|
11319
|
+
'img.clone': CLONE_SVG,
|
|
11320
|
+
'img.delete': DELETE_SVG,
|
|
11321
|
+
'img.ok': OK_SVG,
|
|
11322
|
+
'img.okDis': OK_SVG_DISABLED,
|
|
11323
|
+
'img.cancel': CANCEL_SVG,
|
|
11324
|
+
'span.warn': {[MARGIN]: rem(2, 0.25), [COLOR]: '#d81b60'},
|
|
10368
11325
|
},
|
|
10369
|
-
(style, selector) =>
|
|
11326
|
+
(style, selector) =>
|
|
11327
|
+
`#${UNIQUE_ID} ${selector}{${arrayJoin(
|
|
11328
|
+
objToArray(style, (value, property) => `${property}:${value};`),
|
|
11329
|
+
)}}`,
|
|
10370
11330
|
),
|
|
10371
11331
|
);
|
|
10372
11332
|
|
|
10373
|
-
const Inspector = ({position = 'right', open = false}) => {
|
|
11333
|
+
const Inspector = ({position = 'right', open = false, hue = 270}) => {
|
|
10374
11334
|
const s = useCreateStore(createStore);
|
|
10375
11335
|
const index = POSITIONS.indexOf(position);
|
|
10376
11336
|
useCreatePersister(
|
|
@@ -10397,7 +11357,9 @@ const Inspector = ({position = 'right', open = false}) => {
|
|
|
10397
11357
|
/* @__PURE__ */ jsx(Panel, {s}),
|
|
10398
11358
|
],
|
|
10399
11359
|
}),
|
|
10400
|
-
/* @__PURE__ */
|
|
11360
|
+
/* @__PURE__ */ jsxs('style', {
|
|
11361
|
+
children: [`#${UNIQUE_ID}{--hue:${hue}}`, APP_STYLESHEET],
|
|
11362
|
+
}),
|
|
10401
11363
|
],
|
|
10402
11364
|
});
|
|
10403
11365
|
};
|
|
@@ -10427,11 +11389,14 @@ export {
|
|
|
10427
11389
|
createLocalSynchronizer,
|
|
10428
11390
|
createMergeableStore,
|
|
10429
11391
|
createMetrics,
|
|
11392
|
+
createOpfsPersister,
|
|
10430
11393
|
createPartyKitPersister,
|
|
10431
11394
|
createPglitePersister,
|
|
10432
11395
|
createPostgresPersister,
|
|
10433
11396
|
createPowerSyncPersister,
|
|
10434
11397
|
createQueries,
|
|
11398
|
+
createReactNativeMmkvPersister,
|
|
11399
|
+
createReactNativeSqlitePersister,
|
|
10435
11400
|
createRelationships,
|
|
10436
11401
|
createRemotePersister,
|
|
10437
11402
|
createSessionPersister,
|
|
@@ -10471,8 +11436,17 @@ export {
|
|
|
10471
11436
|
Message,
|
|
10472
11437
|
MetricView,
|
|
10473
11438
|
objectStoreMatch,
|
|
11439
|
+
OFFSET_CHECKPOINTS,
|
|
11440
|
+
OFFSET_INDEXES,
|
|
11441
|
+
OFFSET_METRICS,
|
|
11442
|
+
OFFSET_PERSISTER,
|
|
11443
|
+
OFFSET_QUERIES,
|
|
11444
|
+
OFFSET_RELATIONSHIPS,
|
|
11445
|
+
OFFSET_STORE,
|
|
11446
|
+
OFFSET_SYNCHRONIZER,
|
|
10474
11447
|
Persists,
|
|
10475
11448
|
Provider,
|
|
11449
|
+
RelationshipInHtmlRow,
|
|
10476
11450
|
RelationshipInHtmlTable,
|
|
10477
11451
|
RemoteRowView,
|
|
10478
11452
|
ResultCellView,
|
|
@@ -10489,7 +11463,7 @@ export {
|
|
|
10489
11463
|
SortedTableView,
|
|
10490
11464
|
Status,
|
|
10491
11465
|
TableInHtmlTable,
|
|
10492
|
-
TablesView,
|
|
11466
|
+
TablesView$1 as TablesView,
|
|
10493
11467
|
TableView$1 as TableView,
|
|
10494
11468
|
TinyBasePartyKitServer,
|
|
10495
11469
|
useAddRowCallback,
|
|
@@ -10613,6 +11587,7 @@ export {
|
|
|
10613
11587
|
useSortedRowIds,
|
|
10614
11588
|
useSortedRowIdsListener,
|
|
10615
11589
|
useSortedRowIdsListenerImpl,
|
|
11590
|
+
useSortingAndPagination,
|
|
10616
11591
|
useStartTransactionListener,
|
|
10617
11592
|
useStore,
|
|
10618
11593
|
useStoreIds,
|