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
|
@@ -3,12 +3,12 @@ import {Fragment, jsx, jsxs} from 'react/jsx-runtime';
|
|
|
3
3
|
import {
|
|
4
4
|
CellView,
|
|
5
5
|
ResultCellView,
|
|
6
|
-
useCell,
|
|
6
|
+
useCell as useCell$1,
|
|
7
7
|
useCreatePersister,
|
|
8
8
|
useCreateStore,
|
|
9
|
+
useHasCell,
|
|
9
10
|
useIndexes,
|
|
10
11
|
useIndexesIds,
|
|
11
|
-
useIndexesOrIndexesById,
|
|
12
12
|
useIndexIds,
|
|
13
13
|
useMetric,
|
|
14
14
|
useMetricIds,
|
|
@@ -20,30 +20,21 @@ import {
|
|
|
20
20
|
useRelationshipIds,
|
|
21
21
|
useRelationships,
|
|
22
22
|
useRelationshipsIds,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
useResultRowCount,
|
|
26
|
-
useResultSortedRowIds,
|
|
27
|
-
useResultTableCellIds,
|
|
28
|
-
useRowCount,
|
|
29
|
-
useRowIds,
|
|
30
|
-
useSetCellCallback,
|
|
31
|
-
useSetValueCallback,
|
|
23
|
+
useSetCellCallback as useSetCellCallback$1,
|
|
24
|
+
useSetValueCallback as useSetValueCallback$1,
|
|
32
25
|
useSliceIds,
|
|
33
|
-
useSliceRowIds,
|
|
34
|
-
useSortedRowIds,
|
|
35
26
|
useStore,
|
|
36
27
|
useStoreIds,
|
|
37
|
-
|
|
38
|
-
useTableCellIds,
|
|
28
|
+
useTableCellIds as useTableCellIds$1,
|
|
39
29
|
useTableIds,
|
|
40
|
-
useValue,
|
|
41
|
-
useValueIds,
|
|
30
|
+
useValue as useValue$1,
|
|
31
|
+
useValueIds as useValueIds$1,
|
|
42
32
|
useValues,
|
|
43
33
|
ValueView,
|
|
44
34
|
} from '../ui-react/index.js';
|
|
45
35
|
|
|
46
36
|
const getTypeOf = (thing) => typeof thing;
|
|
37
|
+
const TINYBASE = 'tinybase';
|
|
47
38
|
const EMPTY_STRING = '';
|
|
48
39
|
const DOT = '.';
|
|
49
40
|
const STRING = getTypeOf(EMPTY_STRING);
|
|
@@ -52,9 +43,15 @@ const NUMBER = getTypeOf(0);
|
|
|
52
43
|
const FUNCTION = getTypeOf(getTypeOf);
|
|
53
44
|
const TYPE = 'type';
|
|
54
45
|
const DEFAULT = 'default';
|
|
46
|
+
const ALLOW_NULL = 'allowNull';
|
|
55
47
|
const LISTENER = 'Listener';
|
|
48
|
+
const RESULT = 'Result';
|
|
49
|
+
const GET = 'get';
|
|
50
|
+
const SET = 'set';
|
|
56
51
|
const ADD = 'add';
|
|
52
|
+
const DEL = 'del';
|
|
57
53
|
const HAS = 'Has';
|
|
54
|
+
const _HAS = 'has';
|
|
58
55
|
const IDS = 'Ids';
|
|
59
56
|
const TABLE = 'Table';
|
|
60
57
|
const TABLES = TABLE + 's';
|
|
@@ -62,18 +59,26 @@ const TABLE_IDS = TABLE + IDS;
|
|
|
62
59
|
const ROW = 'Row';
|
|
63
60
|
const ROW_COUNT = ROW + 'Count';
|
|
64
61
|
const ROW_IDS = ROW + IDS;
|
|
62
|
+
const SORTED_ROW_IDS = 'Sorted' + ROW + IDS;
|
|
65
63
|
const CELL = 'Cell';
|
|
66
64
|
const CELL_IDS = CELL + IDS;
|
|
67
65
|
const VALUE = 'Value';
|
|
68
66
|
const VALUES = VALUE + 's';
|
|
69
67
|
const VALUE_IDS = VALUE + IDS;
|
|
68
|
+
const SLICE = 'Slice';
|
|
69
|
+
const REMOTE_ROW_ID = 'Remote' + ROW + 'Id';
|
|
70
70
|
const CURRENT_TARGET = 'currentTarget';
|
|
71
71
|
const _VALUE = 'value';
|
|
72
|
+
const EXTRA = 'extra';
|
|
72
73
|
const UNDEFINED = '\uFFFC';
|
|
73
74
|
const id = (key) => EMPTY_STRING + key;
|
|
74
75
|
const strSplit = (str, separator = EMPTY_STRING, limit) =>
|
|
75
76
|
str.split(separator, limit);
|
|
76
77
|
|
|
78
|
+
const getIfNotFunction =
|
|
79
|
+
(predicate = isNullish) =>
|
|
80
|
+
(value, then, otherwise) =>
|
|
81
|
+
predicate(value) ? otherwise?.() : then(value);
|
|
77
82
|
const GLOBAL = globalThis;
|
|
78
83
|
const WINDOW = GLOBAL.window;
|
|
79
84
|
const math = Math;
|
|
@@ -81,9 +86,11 @@ const mathMin = math.min;
|
|
|
81
86
|
const mathFloor = math.floor;
|
|
82
87
|
const isFiniteNumber = isFinite;
|
|
83
88
|
const isInstanceOf = (thing, cls) => thing instanceof cls;
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
|
|
89
|
+
const isNullish = (thing) => thing == null;
|
|
90
|
+
const isUndefined = (thing) => thing === void 0;
|
|
91
|
+
const isNull = (thing) => thing === null;
|
|
92
|
+
const ifNotNullish = getIfNotFunction(isNullish);
|
|
93
|
+
const ifNotUndefined = getIfNotFunction(isUndefined);
|
|
87
94
|
const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
|
|
88
95
|
const isString = (thing) => getTypeOf(thing) == STRING;
|
|
89
96
|
const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
|
|
@@ -91,6 +98,7 @@ const isArray = (thing) => Array.isArray(thing);
|
|
|
91
98
|
const slice = (arrayOrString, start, end) => arrayOrString.slice(start, end);
|
|
92
99
|
const size = (arrayOrString) => arrayOrString.length;
|
|
93
100
|
const test = (regex, subject) => regex.test(subject);
|
|
101
|
+
const getUndefined = () => void 0;
|
|
94
102
|
const errorNew = (message) => {
|
|
95
103
|
throw new Error(message);
|
|
96
104
|
};
|
|
@@ -114,6 +122,7 @@ const arrayJoin = (array, sep = EMPTY_STRING) => array.join(sep);
|
|
|
114
122
|
const arrayMap = (array, cb) => array.map(cb);
|
|
115
123
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
116
124
|
const arrayReduce = (array, cb, initial) => array.reduce(cb, initial);
|
|
125
|
+
const arrayFilter = (array, cb) => array.filter(cb);
|
|
117
126
|
const arrayClear = (array, to) => array.splice(0, to);
|
|
118
127
|
const arrayPush = (array, ...values) => array.push(...values);
|
|
119
128
|
const arrayShift = (array) => array.shift();
|
|
@@ -123,12 +132,12 @@ const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
|
123
132
|
const objFrozen = object.isFrozen;
|
|
124
133
|
const objEntries = object.entries;
|
|
125
134
|
const isObject = (obj) =>
|
|
126
|
-
!
|
|
127
|
-
|
|
135
|
+
!isNullish(obj) &&
|
|
136
|
+
ifNotNullish(
|
|
128
137
|
getPrototypeOf(obj),
|
|
129
138
|
(objPrototype) =>
|
|
130
139
|
objPrototype == object.prototype ||
|
|
131
|
-
|
|
140
|
+
isNullish(getPrototypeOf(objPrototype)),
|
|
132
141
|
|
|
133
142
|
/* istanbul ignore next */
|
|
134
143
|
() => true,
|
|
@@ -136,6 +145,7 @@ const isObject = (obj) =>
|
|
|
136
145
|
const objIds = object.keys;
|
|
137
146
|
const objFreeze = object.freeze;
|
|
138
147
|
const objNew = (entries = []) => object.fromEntries(entries);
|
|
148
|
+
const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
139
149
|
const objHas = (obj, id) => id in obj;
|
|
140
150
|
const objDel = (obj, id) => {
|
|
141
151
|
delete obj[id];
|
|
@@ -149,9 +159,22 @@ const objMap = (obj, cb) =>
|
|
|
149
159
|
objNew(objToArray(obj, (value, id) => [id, cb(value, id)]));
|
|
150
160
|
const objSize = (obj) => size(objIds(obj));
|
|
151
161
|
const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
|
|
162
|
+
const objIsEqual = (obj1, obj2) => {
|
|
163
|
+
const entries1 = objEntries(obj1);
|
|
164
|
+
return (
|
|
165
|
+
size(entries1) === objSize(obj2) &&
|
|
166
|
+
arrayEvery(entries1, ([index, value1]) =>
|
|
167
|
+
isObject(value1)
|
|
168
|
+
? isObject(obj2[index])
|
|
169
|
+
? objIsEqual(obj2[index], value1)
|
|
170
|
+
: false
|
|
171
|
+
: obj2[index] === value1,
|
|
172
|
+
)
|
|
173
|
+
);
|
|
174
|
+
};
|
|
152
175
|
const objValidate = (obj, validateChild, onInvalidObj, emptyIsValid = 0) => {
|
|
153
176
|
if (
|
|
154
|
-
|
|
177
|
+
isNullish(obj) ||
|
|
155
178
|
!isObject(obj) ||
|
|
156
179
|
(!emptyIsValid && objIsEmpty(obj)) ||
|
|
157
180
|
objFrozen(obj)
|
|
@@ -199,7 +222,7 @@ const mapForEach = (map, cb) =>
|
|
|
199
222
|
const mapMap = (coll, cb) =>
|
|
200
223
|
arrayMap([...(coll?.entries() ?? [])], ([key, value]) => cb(value, key));
|
|
201
224
|
const mapSet = (map, key, value) =>
|
|
202
|
-
|
|
225
|
+
value === void 0 ? (collDel(map, key), map) : map?.set(key, value);
|
|
203
226
|
const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
|
|
204
227
|
if (!collHas(map, key)) {
|
|
205
228
|
mapSet(map, key, getDefaultValue());
|
|
@@ -348,7 +371,7 @@ const getListenerFunctions = (getThing) => {
|
|
|
348
371
|
const index = size(ids);
|
|
349
372
|
if (index == size(path)) {
|
|
350
373
|
listener(thing, ...ids, ...extraArgsGetter(ids));
|
|
351
|
-
} else if (
|
|
374
|
+
} else if (isNull(path[index])) {
|
|
352
375
|
arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
|
|
353
376
|
callWithIds(...ids, id2),
|
|
354
377
|
);
|
|
@@ -641,6 +664,9 @@ const createSessionPersister = (store, storageName, onIgnoredError) =>
|
|
|
641
664
|
createStoragePersister(store, storageName, sessionStorage, onIgnoredError);
|
|
642
665
|
|
|
643
666
|
const getCellOrValueType = (cellOrValue) => {
|
|
667
|
+
if (isNull(cellOrValue)) {
|
|
668
|
+
return 'null';
|
|
669
|
+
}
|
|
644
670
|
const type = getTypeOf(cellOrValue);
|
|
645
671
|
return isTypeStringOrBoolean(type) ||
|
|
646
672
|
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
@@ -654,7 +680,13 @@ const setOrDelCell = (store, tableId, rowId, cellId, cell) =>
|
|
|
654
680
|
const setOrDelValue = (store, valueId, value) =>
|
|
655
681
|
isUndefined(value) ? store.delValue(valueId) : store.setValue(valueId, value);
|
|
656
682
|
const getTypeCase = (type, stringCase, numberCase, booleanCase) =>
|
|
657
|
-
type == STRING
|
|
683
|
+
type == STRING
|
|
684
|
+
? stringCase
|
|
685
|
+
: type == NUMBER
|
|
686
|
+
? numberCase
|
|
687
|
+
: type == BOOLEAN
|
|
688
|
+
? booleanCase
|
|
689
|
+
: null;
|
|
658
690
|
|
|
659
691
|
const defaultSorter = (sortKey1, sortKey2) =>
|
|
660
692
|
(sortKey1 ?? 0) < (sortKey2 ?? 0) ? -1 : 1;
|
|
@@ -730,14 +762,22 @@ const createStore = () => {
|
|
|
730
762
|
const validateValuesSchema = (valuesSchema) =>
|
|
731
763
|
objValidate(valuesSchema, validateCellOrValueSchema);
|
|
732
764
|
const validateCellOrValueSchema = (schema) => {
|
|
733
|
-
if (
|
|
765
|
+
if (
|
|
766
|
+
!objValidate(schema, (_child, id2) =>
|
|
767
|
+
arrayHas([TYPE, DEFAULT, ALLOW_NULL], id2),
|
|
768
|
+
)
|
|
769
|
+
) {
|
|
734
770
|
return false;
|
|
735
771
|
}
|
|
736
772
|
const type = schema[TYPE];
|
|
737
773
|
if (!isTypeStringOrBoolean(type) && type != NUMBER) {
|
|
738
774
|
return false;
|
|
739
775
|
}
|
|
740
|
-
|
|
776
|
+
const defaultValue = schema[DEFAULT];
|
|
777
|
+
if (isNull(defaultValue) && !schema[ALLOW_NULL]) {
|
|
778
|
+
return false;
|
|
779
|
+
}
|
|
780
|
+
if (!isNull(defaultValue) && getCellOrValueType(defaultValue) != type) {
|
|
741
781
|
objDel(schema, DEFAULT);
|
|
742
782
|
}
|
|
743
783
|
return true;
|
|
@@ -774,9 +814,19 @@ const createStore = () => {
|
|
|
774
814
|
? ifNotUndefined(
|
|
775
815
|
mapGet(mapGet(tablesSchemaMap, tableId), cellId),
|
|
776
816
|
(cellSchema) =>
|
|
777
|
-
|
|
778
|
-
?
|
|
779
|
-
|
|
817
|
+
isNull(cell)
|
|
818
|
+
? cellSchema[ALLOW_NULL]
|
|
819
|
+
? cell
|
|
820
|
+
: cellInvalid(tableId, rowId, cellId, cell, cellSchema[DEFAULT])
|
|
821
|
+
: getCellOrValueType(cell) == cellSchema[TYPE]
|
|
822
|
+
? cell
|
|
823
|
+
: cellInvalid(
|
|
824
|
+
tableId,
|
|
825
|
+
rowId,
|
|
826
|
+
cellId,
|
|
827
|
+
cell,
|
|
828
|
+
cellSchema[DEFAULT],
|
|
829
|
+
),
|
|
780
830
|
() => cellInvalid(tableId, rowId, cellId, cell),
|
|
781
831
|
)
|
|
782
832
|
: isUndefined(getCellOrValueType(cell))
|
|
@@ -801,9 +851,13 @@ const createStore = () => {
|
|
|
801
851
|
? ifNotUndefined(
|
|
802
852
|
mapGet(valuesSchemaMap, valueId),
|
|
803
853
|
(valueSchema) =>
|
|
804
|
-
|
|
805
|
-
?
|
|
806
|
-
|
|
854
|
+
isNull(value)
|
|
855
|
+
? valueSchema[ALLOW_NULL]
|
|
856
|
+
? value
|
|
857
|
+
: valueInvalid(valueId, value, valueSchema[DEFAULT])
|
|
858
|
+
: getCellOrValueType(value) == valueSchema[TYPE]
|
|
859
|
+
? value
|
|
860
|
+
: valueInvalid(valueId, value, valueSchema[DEFAULT]),
|
|
807
861
|
() => valueInvalid(valueId, value),
|
|
808
862
|
)
|
|
809
863
|
: isUndefined(getCellOrValueType(value))
|
|
@@ -1046,7 +1100,7 @@ const createStore = () => {
|
|
|
1046
1100
|
mapSet(
|
|
1047
1101
|
cellIds,
|
|
1048
1102
|
cellId,
|
|
1049
|
-
count != -addedOrRemoved ? count + addedOrRemoved :
|
|
1103
|
+
count != -addedOrRemoved ? count + addedOrRemoved : void 0,
|
|
1050
1104
|
);
|
|
1051
1105
|
idsChanged(
|
|
1052
1106
|
mapEnsure(mapEnsure(changedCellIds, tableId, mapNew), rowId, mapNew),
|
|
@@ -2056,7 +2110,7 @@ const EDITABLE_CELL = 'editable';
|
|
|
2056
2110
|
const getUniqueId = (...args) => jsonStringWithMap(args);
|
|
2057
2111
|
const sortedIdsMap = (ids, callback) => arrayMap(arraySort([...ids]), callback);
|
|
2058
2112
|
const useEditable = (uniqueId, s) => [
|
|
2059
|
-
!!useCell(STATE_TABLE, uniqueId, EDITABLE_CELL, s),
|
|
2113
|
+
!!useCell$1(STATE_TABLE, uniqueId, EDITABLE_CELL, s),
|
|
2060
2114
|
useCallback(
|
|
2061
2115
|
(event) => {
|
|
2062
2116
|
s.setCell(STATE_TABLE, uniqueId, EDITABLE_CELL, (editable) => !editable);
|
|
@@ -2067,9 +2121,9 @@ const useEditable = (uniqueId, s) => [
|
|
|
2067
2121
|
];
|
|
2068
2122
|
|
|
2069
2123
|
const Nub = ({s}) => {
|
|
2070
|
-
const position = useValue(POSITION_VALUE, s) ?? 1;
|
|
2071
|
-
const handleOpen = useSetValueCallback(OPEN_VALUE, () => true, [], s);
|
|
2072
|
-
return useValue(OPEN_VALUE, s)
|
|
2124
|
+
const position = useValue$1(POSITION_VALUE, s) ?? 1;
|
|
2125
|
+
const handleOpen = useSetValueCallback$1(OPEN_VALUE, () => true, [], s);
|
|
2126
|
+
return useValue$1(OPEN_VALUE, s)
|
|
2073
2127
|
? null
|
|
2074
2128
|
: /* @__PURE__ */ jsx('img', {
|
|
2075
2129
|
onClick: handleOpen,
|
|
@@ -2078,13 +2132,373 @@ const Nub = ({s}) => {
|
|
|
2078
2132
|
});
|
|
2079
2133
|
};
|
|
2080
2134
|
|
|
2081
|
-
const
|
|
2082
|
-
const
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2135
|
+
const TINYBASE_CONTEXT = TINYBASE + '_uirc';
|
|
2136
|
+
const Context = GLOBAL[TINYBASE_CONTEXT]
|
|
2137
|
+
? /* istanbul ignore next */
|
|
2138
|
+
GLOBAL[TINYBASE_CONTEXT]
|
|
2139
|
+
: (GLOBAL[TINYBASE_CONTEXT] = createContext([]));
|
|
2140
|
+
const useThing = (id, offset) => {
|
|
2141
|
+
const contextValue = useContext(Context);
|
|
2142
|
+
return isUndefined(id)
|
|
2143
|
+
? contextValue[offset * 2]
|
|
2144
|
+
: isString(id)
|
|
2145
|
+
? objGet(contextValue[offset * 2 + 1], id)
|
|
2146
|
+
: id;
|
|
2147
|
+
};
|
|
2148
|
+
const useThingOrThingById = (thingOrThingId, offset) => {
|
|
2149
|
+
const thing = useThing(thingOrThingId, offset);
|
|
2150
|
+
return isUndefined(thingOrThingId) || isString(thingOrThingId)
|
|
2151
|
+
? thing
|
|
2152
|
+
: thingOrThingId;
|
|
2153
|
+
};
|
|
2154
|
+
|
|
2155
|
+
const OFFSET_STORE = 0;
|
|
2156
|
+
const OFFSET_INDEXES = 2;
|
|
2157
|
+
const OFFSET_RELATIONSHIPS = 3;
|
|
2158
|
+
const OFFSET_QUERIES = 4;
|
|
2159
|
+
|
|
2160
|
+
const EMPTY_ARRAY = [];
|
|
2161
|
+
const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
|
|
2162
|
+
const IS_EQUALS = [
|
|
2163
|
+
objIsEqual,
|
|
2164
|
+
arrayIsEqual,
|
|
2165
|
+
(
|
|
2166
|
+
[backwardIds1, currentId1, forwardIds1],
|
|
2167
|
+
[backwardIds2, currentId2, forwardIds2],
|
|
2168
|
+
) =>
|
|
2169
|
+
currentId1 === currentId2 &&
|
|
2170
|
+
arrayIsEqual(backwardIds1, backwardIds2) &&
|
|
2171
|
+
arrayIsEqual(forwardIds1, forwardIds2),
|
|
2172
|
+
];
|
|
2173
|
+
const isEqual = (thing1, thing2) => thing1 === thing2;
|
|
2174
|
+
const addAndDelListener = (thing, listenable, ...args) => {
|
|
2175
|
+
const listenerId = thing?.[ADD + listenable + LISTENER]?.(...args);
|
|
2176
|
+
return () => thing?.delListener?.(listenerId);
|
|
2177
|
+
};
|
|
2178
|
+
const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
2179
|
+
const lastResult = useRef(DEFAULTS[returnType]);
|
|
2180
|
+
const getResult = useCallback(
|
|
2181
|
+
() => {
|
|
2182
|
+
const nextResult =
|
|
2183
|
+
thing?.[(returnType == 4 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
2184
|
+
...args,
|
|
2185
|
+
) ?? DEFAULTS[returnType];
|
|
2186
|
+
return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
|
|
2187
|
+
? (lastResult.current = nextResult)
|
|
2188
|
+
: lastResult.current;
|
|
2189
|
+
},
|
|
2190
|
+
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
2191
|
+
[thing, returnType, listenable, ...args],
|
|
2192
|
+
);
|
|
2193
|
+
const subscribe = useCallback(
|
|
2194
|
+
(listener) =>
|
|
2195
|
+
addAndDelListener(
|
|
2196
|
+
thing,
|
|
2197
|
+
(returnType == 4 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
|
|
2198
|
+
...args,
|
|
2199
|
+
listener,
|
|
2200
|
+
),
|
|
2201
|
+
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
2202
|
+
[thing, returnType, listenable, ...args],
|
|
2203
|
+
);
|
|
2204
|
+
return useSyncExternalStore(subscribe, getResult, getResult);
|
|
2205
|
+
};
|
|
2206
|
+
const useSetCallback = (
|
|
2207
|
+
storeOrStoreId,
|
|
2208
|
+
settable,
|
|
2209
|
+
get,
|
|
2210
|
+
getDeps = EMPTY_ARRAY,
|
|
2211
|
+
then = getUndefined,
|
|
2212
|
+
thenDeps = EMPTY_ARRAY,
|
|
2213
|
+
...args
|
|
2214
|
+
) => {
|
|
2215
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
2216
|
+
return useCallback(
|
|
2217
|
+
(parameter) =>
|
|
2218
|
+
ifNotUndefined(store, (store2) =>
|
|
2219
|
+
ifNotUndefined(get(parameter, store2), (thing) =>
|
|
2220
|
+
then(
|
|
2221
|
+
store2[SET + settable](
|
|
2222
|
+
...argsOrGetArgs(args, store2, parameter),
|
|
2223
|
+
thing,
|
|
2224
|
+
),
|
|
2225
|
+
thing,
|
|
2226
|
+
),
|
|
2227
|
+
),
|
|
2228
|
+
),
|
|
2229
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2230
|
+
[store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
|
|
2231
|
+
);
|
|
2232
|
+
};
|
|
2233
|
+
const argsOrGetArgs = (args, store, parameter) =>
|
|
2234
|
+
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
2235
|
+
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
2236
|
+
const useDel = (
|
|
2237
|
+
storeOrStoreId,
|
|
2238
|
+
deletable,
|
|
2239
|
+
then = getUndefined,
|
|
2240
|
+
thenDeps = EMPTY_ARRAY,
|
|
2241
|
+
...args
|
|
2242
|
+
) => {
|
|
2243
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
2244
|
+
return useCallback(
|
|
2245
|
+
(parameter) =>
|
|
2246
|
+
then(store?.[DEL + deletable](...argsOrGetArgs(args, store, parameter))),
|
|
2247
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2248
|
+
[store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
|
|
2249
|
+
);
|
|
2250
|
+
};
|
|
2251
|
+
const useSortedRowIdsImpl = (
|
|
2252
|
+
tableId,
|
|
2253
|
+
cellId,
|
|
2254
|
+
descending,
|
|
2255
|
+
offset,
|
|
2256
|
+
limit,
|
|
2257
|
+
storeOrStoreId,
|
|
2258
|
+
) =>
|
|
2259
|
+
useListenable(
|
|
2260
|
+
SORTED_ROW_IDS,
|
|
2261
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
2262
|
+
1 /* Array */,
|
|
2263
|
+
[tableId, cellId, descending, offset, limit],
|
|
2264
|
+
);
|
|
2265
|
+
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
2266
|
+
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
2267
|
+
const useHasTables = (storeOrStoreId) =>
|
|
2268
|
+
useListenable(
|
|
2269
|
+
TABLES,
|
|
2270
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
2271
|
+
4 /* Boolean */,
|
|
2272
|
+
[],
|
|
2273
|
+
);
|
|
2274
|
+
const useTableCellIds = (tableId, storeOrStoreId) =>
|
|
2275
|
+
useListenable(
|
|
2276
|
+
TABLE + CELL_IDS,
|
|
2277
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
2278
|
+
1 /* Array */,
|
|
2279
|
+
[tableId],
|
|
2280
|
+
);
|
|
2281
|
+
const useRowCount = (tableId, storeOrStoreId) =>
|
|
2282
|
+
useListenable(
|
|
2283
|
+
ROW_COUNT,
|
|
2284
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
2285
|
+
5 /* Number */,
|
|
2286
|
+
[tableId],
|
|
2287
|
+
);
|
|
2288
|
+
const useRowIds = (tableId, storeOrStoreId) =>
|
|
2289
|
+
useListenable(ROW_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */, [
|
|
2290
|
+
tableId,
|
|
2291
|
+
]);
|
|
2292
|
+
const useSortedRowIds = (
|
|
2293
|
+
tableIdOrArgs,
|
|
2294
|
+
cellIdOrStoreOrStoreId,
|
|
2295
|
+
descending,
|
|
2296
|
+
offset,
|
|
2297
|
+
limit,
|
|
2298
|
+
storeOrStoreId,
|
|
2299
|
+
) =>
|
|
2300
|
+
useSortedRowIdsImpl(
|
|
2301
|
+
...(isObject(tableIdOrArgs)
|
|
2302
|
+
? [
|
|
2303
|
+
tableIdOrArgs.tableId,
|
|
2304
|
+
tableIdOrArgs.cellId,
|
|
2305
|
+
tableIdOrArgs.descending ?? false,
|
|
2306
|
+
tableIdOrArgs.offset ?? 0,
|
|
2307
|
+
tableIdOrArgs.limit,
|
|
2308
|
+
cellIdOrStoreOrStoreId,
|
|
2309
|
+
]
|
|
2310
|
+
: [
|
|
2311
|
+
tableIdOrArgs,
|
|
2312
|
+
cellIdOrStoreOrStoreId,
|
|
2313
|
+
descending,
|
|
2314
|
+
offset,
|
|
2315
|
+
limit,
|
|
2316
|
+
storeOrStoreId,
|
|
2317
|
+
]),
|
|
2318
|
+
);
|
|
2319
|
+
const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
2320
|
+
useListenable(
|
|
2321
|
+
CELL,
|
|
2322
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
2323
|
+
3 /* CellOrValue */,
|
|
2324
|
+
[tableId, rowId, cellId],
|
|
2325
|
+
);
|
|
2326
|
+
const useHasValues = (storeOrStoreId) =>
|
|
2327
|
+
useListenable(
|
|
2328
|
+
VALUES,
|
|
2329
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
2330
|
+
4 /* Boolean */,
|
|
2331
|
+
[],
|
|
2332
|
+
);
|
|
2333
|
+
const useValueIds = (storeOrStoreId) =>
|
|
2334
|
+
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
2335
|
+
const useValue = (valueId, storeOrStoreId) =>
|
|
2336
|
+
useListenable(
|
|
2337
|
+
VALUE,
|
|
2338
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
2339
|
+
3 /* CellOrValue */,
|
|
2340
|
+
[valueId],
|
|
2341
|
+
);
|
|
2342
|
+
const useSetTableCallback = (
|
|
2343
|
+
tableId,
|
|
2344
|
+
getTable,
|
|
2345
|
+
getTableDeps,
|
|
2346
|
+
storeOrStoreId,
|
|
2347
|
+
then,
|
|
2348
|
+
thenDeps,
|
|
2349
|
+
) =>
|
|
2350
|
+
useSetCallback(
|
|
2351
|
+
storeOrStoreId,
|
|
2352
|
+
TABLE,
|
|
2353
|
+
getTable,
|
|
2354
|
+
getTableDeps,
|
|
2355
|
+
then,
|
|
2356
|
+
thenDeps,
|
|
2357
|
+
tableId,
|
|
2358
|
+
);
|
|
2359
|
+
const useSetRowCallback = (
|
|
2360
|
+
tableId,
|
|
2361
|
+
rowId,
|
|
2362
|
+
getRow,
|
|
2363
|
+
getRowDeps,
|
|
2364
|
+
storeOrStoreId,
|
|
2365
|
+
then,
|
|
2366
|
+
thenDeps,
|
|
2367
|
+
) =>
|
|
2368
|
+
useSetCallback(
|
|
2369
|
+
storeOrStoreId,
|
|
2370
|
+
ROW,
|
|
2371
|
+
getRow,
|
|
2372
|
+
getRowDeps,
|
|
2373
|
+
then,
|
|
2374
|
+
thenDeps,
|
|
2375
|
+
tableId,
|
|
2376
|
+
rowId,
|
|
2377
|
+
);
|
|
2378
|
+
const useSetCellCallback = (
|
|
2379
|
+
tableId,
|
|
2380
|
+
rowId,
|
|
2381
|
+
cellId,
|
|
2382
|
+
getCell,
|
|
2383
|
+
getCellDeps,
|
|
2384
|
+
storeOrStoreId,
|
|
2385
|
+
then,
|
|
2386
|
+
thenDeps,
|
|
2387
|
+
) =>
|
|
2388
|
+
useSetCallback(
|
|
2389
|
+
storeOrStoreId,
|
|
2390
|
+
CELL,
|
|
2391
|
+
getCell,
|
|
2392
|
+
getCellDeps,
|
|
2393
|
+
then,
|
|
2394
|
+
thenDeps,
|
|
2395
|
+
tableId,
|
|
2396
|
+
rowId,
|
|
2397
|
+
cellId,
|
|
2398
|
+
);
|
|
2399
|
+
const useSetValueCallback = (
|
|
2400
|
+
valueId,
|
|
2401
|
+
getValue,
|
|
2402
|
+
getValueDeps,
|
|
2403
|
+
storeOrStoreId,
|
|
2404
|
+
then,
|
|
2405
|
+
thenDeps,
|
|
2406
|
+
) =>
|
|
2407
|
+
useSetCallback(
|
|
2408
|
+
storeOrStoreId,
|
|
2409
|
+
VALUE,
|
|
2410
|
+
getValue,
|
|
2411
|
+
getValueDeps,
|
|
2412
|
+
then,
|
|
2413
|
+
thenDeps,
|
|
2414
|
+
valueId,
|
|
2415
|
+
);
|
|
2416
|
+
const useDelTablesCallback = (storeOrStoreId, then, thenDeps) =>
|
|
2417
|
+
useDel(storeOrStoreId, TABLES, then, thenDeps);
|
|
2418
|
+
const useDelTableCallback = (tableId, storeOrStoreId, then, thenDeps) =>
|
|
2419
|
+
useDel(storeOrStoreId, TABLE, then, thenDeps, tableId);
|
|
2420
|
+
const useDelRowCallback = (tableId, rowId, storeOrStoreId, then, thenDeps) =>
|
|
2421
|
+
useDel(storeOrStoreId, ROW, then, thenDeps, tableId, rowId);
|
|
2422
|
+
const useDelCellCallback = (
|
|
2423
|
+
tableId,
|
|
2424
|
+
rowId,
|
|
2425
|
+
cellId,
|
|
2426
|
+
forceDel,
|
|
2427
|
+
storeOrStoreId,
|
|
2428
|
+
then,
|
|
2429
|
+
thenDeps,
|
|
2430
|
+
) =>
|
|
2431
|
+
useDel(
|
|
2432
|
+
storeOrStoreId,
|
|
2433
|
+
CELL,
|
|
2434
|
+
then,
|
|
2435
|
+
thenDeps,
|
|
2436
|
+
tableId,
|
|
2437
|
+
rowId,
|
|
2438
|
+
cellId,
|
|
2439
|
+
forceDel,
|
|
2440
|
+
);
|
|
2441
|
+
const useDelValuesCallback = (storeOrStoreId, then, thenDeps) =>
|
|
2442
|
+
useDel(storeOrStoreId, VALUES, then, thenDeps);
|
|
2443
|
+
const useDelValueCallback = (valueId, storeOrStoreId, then, thenDeps) =>
|
|
2444
|
+
useDel(storeOrStoreId, VALUE, then, thenDeps, valueId);
|
|
2445
|
+
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
2446
|
+
useThingOrThingById(indexesOrIndexesId, OFFSET_INDEXES);
|
|
2447
|
+
const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
|
|
2448
|
+
useListenable(
|
|
2449
|
+
SLICE + ROW_IDS,
|
|
2450
|
+
useIndexesOrIndexesById(indexesOrIndexesId),
|
|
2451
|
+
1 /* Array */,
|
|
2452
|
+
[indexId, sliceId],
|
|
2453
|
+
);
|
|
2454
|
+
const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
|
|
2455
|
+
useThingOrThingById(relationshipsOrRelationshipsId, OFFSET_RELATIONSHIPS);
|
|
2456
|
+
const useRemoteRowId = (
|
|
2457
|
+
relationshipId,
|
|
2458
|
+
localRowId,
|
|
2459
|
+
relationshipsOrRelationshipsId,
|
|
2460
|
+
) =>
|
|
2461
|
+
useListenable(
|
|
2462
|
+
REMOTE_ROW_ID,
|
|
2463
|
+
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
2464
|
+
3 /* CellOrValue */,
|
|
2465
|
+
[relationshipId, localRowId],
|
|
2466
|
+
);
|
|
2467
|
+
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
2468
|
+
useThingOrThingById(queriesOrQueriesId, OFFSET_QUERIES);
|
|
2469
|
+
const useResultTableCellIds = (queryId, queriesOrQueriesId) =>
|
|
2470
|
+
useListenable(
|
|
2471
|
+
RESULT + TABLE + CELL_IDS,
|
|
2472
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
2473
|
+
1 /* Array */,
|
|
2474
|
+
[queryId],
|
|
2475
|
+
);
|
|
2476
|
+
const useResultRowCount = (queryId, queriesOrQueriesId) =>
|
|
2477
|
+
useListenable(
|
|
2478
|
+
RESULT + ROW_COUNT,
|
|
2479
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
2480
|
+
5 /* Number */,
|
|
2481
|
+
[queryId],
|
|
2482
|
+
);
|
|
2483
|
+
const useResultSortedRowIds = (
|
|
2484
|
+
queryId,
|
|
2485
|
+
cellId,
|
|
2486
|
+
descending,
|
|
2487
|
+
offset = 0,
|
|
2488
|
+
limit,
|
|
2489
|
+
queriesOrQueriesId,
|
|
2490
|
+
) =>
|
|
2491
|
+
useListenable(
|
|
2492
|
+
RESULT + SORTED_ROW_IDS,
|
|
2493
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
2494
|
+
1 /* Array */,
|
|
2495
|
+
[queryId, cellId, descending, offset, limit],
|
|
2496
|
+
);
|
|
2497
|
+
|
|
2498
|
+
const useStoreCellComponentProps = (store, tableId) =>
|
|
2499
|
+
useMemo(() => ({store, tableId}), [store, tableId]);
|
|
2500
|
+
const useQueriesCellComponentProps = (queries, queryId) =>
|
|
2501
|
+
useMemo(() => ({queries, queryId}), [queries, queryId]);
|
|
2088
2502
|
const useCallbackOrUndefined = (callback, deps, test) => {
|
|
2089
2503
|
const returnCallback = useCallback(callback, deps);
|
|
2090
2504
|
return test ? returnCallback : void 0;
|
|
@@ -2095,69 +2509,6 @@ const useParams = (...args) =>
|
|
|
2095
2509
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2096
2510
|
args,
|
|
2097
2511
|
);
|
|
2098
|
-
const useStoreCellComponentProps = (store, tableId) =>
|
|
2099
|
-
useMemo(() => ({store, tableId}), [store, tableId]);
|
|
2100
|
-
const useQueriesCellComponentProps = (queries, queryId) =>
|
|
2101
|
-
useMemo(() => ({queries, queryId}), [queries, queryId]);
|
|
2102
|
-
const useSortingAndPagination = (
|
|
2103
|
-
cellId,
|
|
2104
|
-
descending = false,
|
|
2105
|
-
sortOnClick,
|
|
2106
|
-
offset = 0,
|
|
2107
|
-
limit,
|
|
2108
|
-
total,
|
|
2109
|
-
paginator,
|
|
2110
|
-
onChange,
|
|
2111
|
-
) => {
|
|
2112
|
-
const [[currentCellId, currentDescending, currentOffset], setState] =
|
|
2113
|
-
useState([cellId, descending, offset]);
|
|
2114
|
-
const setStateAndChange = useCallback(
|
|
2115
|
-
(sortAndOffset) => {
|
|
2116
|
-
setState(sortAndOffset);
|
|
2117
|
-
onChange?.(sortAndOffset);
|
|
2118
|
-
},
|
|
2119
|
-
[onChange],
|
|
2120
|
-
);
|
|
2121
|
-
const handleSort = useCallbackOrUndefined(
|
|
2122
|
-
(cellId2) =>
|
|
2123
|
-
setStateAndChange([
|
|
2124
|
-
cellId2,
|
|
2125
|
-
cellId2 == currentCellId ? !currentDescending : false,
|
|
2126
|
-
currentOffset,
|
|
2127
|
-
]),
|
|
2128
|
-
[setStateAndChange, currentCellId, currentDescending, currentOffset],
|
|
2129
|
-
sortOnClick,
|
|
2130
|
-
);
|
|
2131
|
-
const handleChangeOffset = useCallback(
|
|
2132
|
-
(offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
|
|
2133
|
-
[setStateAndChange, currentCellId, currentDescending],
|
|
2134
|
-
);
|
|
2135
|
-
const PaginatorComponent =
|
|
2136
|
-
paginator === true ? SortedTablePaginator : paginator;
|
|
2137
|
-
return [
|
|
2138
|
-
[currentCellId, currentDescending, currentOffset],
|
|
2139
|
-
handleSort,
|
|
2140
|
-
useMemo(
|
|
2141
|
-
() =>
|
|
2142
|
-
paginator === false
|
|
2143
|
-
? null
|
|
2144
|
-
: /* @__PURE__ */ jsx(PaginatorComponent, {
|
|
2145
|
-
offset: currentOffset,
|
|
2146
|
-
limit,
|
|
2147
|
-
total,
|
|
2148
|
-
onChange: handleChangeOffset,
|
|
2149
|
-
}),
|
|
2150
|
-
[
|
|
2151
|
-
paginator,
|
|
2152
|
-
PaginatorComponent,
|
|
2153
|
-
currentOffset,
|
|
2154
|
-
limit,
|
|
2155
|
-
total,
|
|
2156
|
-
handleChangeOffset,
|
|
2157
|
-
],
|
|
2158
|
-
),
|
|
2159
|
-
];
|
|
2160
|
-
};
|
|
2161
2512
|
const useCells = (defaultCellIds, customCells, defaultCellComponent) =>
|
|
2162
2513
|
useMemo(() => {
|
|
2163
2514
|
const cellIds = customCells ?? defaultCellIds;
|
|
@@ -2173,6 +2524,54 @@ const useCells = (defaultCellIds, customCells, defaultCellComponent) =>
|
|
|
2173
2524
|
}),
|
|
2174
2525
|
);
|
|
2175
2526
|
}, [customCells, defaultCellComponent, defaultCellIds]);
|
|
2527
|
+
|
|
2528
|
+
const UP_ARROW = '\u2191';
|
|
2529
|
+
const DOWN_ARROW = '\u2193';
|
|
2530
|
+
const EDITABLE = 'editable';
|
|
2531
|
+
const extraRowCells = (extraRowCells2 = [], extraRowCellProps, after = 0) =>
|
|
2532
|
+
arrayMap(extraRowCells2, ({component: Component}, index) =>
|
|
2533
|
+
/* @__PURE__ */ jsx(
|
|
2534
|
+
'td',
|
|
2535
|
+
{
|
|
2536
|
+
className: EXTRA,
|
|
2537
|
+
children: /* @__PURE__ */ jsx(Component, {...extraRowCellProps}),
|
|
2538
|
+
},
|
|
2539
|
+
extraKey(index, after),
|
|
2540
|
+
),
|
|
2541
|
+
);
|
|
2542
|
+
const extraKey = (index, after) => (after ? '>' : '<') + index;
|
|
2543
|
+
const extraHeaders = (extraCells = [], after = 0) =>
|
|
2544
|
+
arrayMap(extraCells, ({label}, index) =>
|
|
2545
|
+
/* @__PURE__ */ jsx(
|
|
2546
|
+
'th',
|
|
2547
|
+
{className: EXTRA, children: label},
|
|
2548
|
+
extraKey(index, after),
|
|
2549
|
+
),
|
|
2550
|
+
);
|
|
2551
|
+
|
|
2552
|
+
const HtmlHeaderCell = ({
|
|
2553
|
+
cellId,
|
|
2554
|
+
sort: [sortCellId, sortDescending],
|
|
2555
|
+
label = cellId ?? EMPTY_STRING,
|
|
2556
|
+
onClick,
|
|
2557
|
+
}) =>
|
|
2558
|
+
/* @__PURE__ */ jsxs('th', {
|
|
2559
|
+
onClick: useCallbackOrUndefined(
|
|
2560
|
+
() => onClick?.(cellId),
|
|
2561
|
+
[onClick, cellId],
|
|
2562
|
+
onClick,
|
|
2563
|
+
),
|
|
2564
|
+
className:
|
|
2565
|
+
isUndefined(sortDescending) || sortCellId != cellId
|
|
2566
|
+
? void 0
|
|
2567
|
+
: `sorted ${sortDescending ? 'de' : 'a'}scending`,
|
|
2568
|
+
children: [
|
|
2569
|
+
isUndefined(sortDescending) || sortCellId != cellId
|
|
2570
|
+
? null
|
|
2571
|
+
: (sortDescending ? DOWN_ARROW : UP_ARROW) + ' ',
|
|
2572
|
+
label,
|
|
2573
|
+
],
|
|
2574
|
+
});
|
|
2176
2575
|
const HtmlTable = ({
|
|
2177
2576
|
className,
|
|
2178
2577
|
headerRow,
|
|
@@ -2181,6 +2580,8 @@ const HtmlTable = ({
|
|
|
2181
2580
|
cells,
|
|
2182
2581
|
cellComponentProps,
|
|
2183
2582
|
rowIds,
|
|
2583
|
+
extraCellsBefore,
|
|
2584
|
+
extraCellsAfter,
|
|
2184
2585
|
sortAndOffset,
|
|
2185
2586
|
handleSort,
|
|
2186
2587
|
paginatorComponent,
|
|
@@ -2197,6 +2598,7 @@ const HtmlTable = ({
|
|
|
2197
2598
|
: /* @__PURE__ */ jsx('thead', {
|
|
2198
2599
|
children: /* @__PURE__ */ jsxs('tr', {
|
|
2199
2600
|
children: [
|
|
2601
|
+
extraHeaders(extraCellsBefore),
|
|
2200
2602
|
idColumn === false
|
|
2201
2603
|
? null
|
|
2202
2604
|
: /* @__PURE__ */ jsx(HtmlHeaderCell, {
|
|
@@ -2216,118 +2618,45 @@ const HtmlTable = ({
|
|
|
2216
2618
|
cellId,
|
|
2217
2619
|
),
|
|
2218
2620
|
),
|
|
2621
|
+
extraHeaders(extraCellsAfter, 1),
|
|
2219
2622
|
],
|
|
2220
2623
|
}),
|
|
2221
2624
|
}),
|
|
2222
2625
|
/* @__PURE__ */ jsx('tbody', {
|
|
2223
|
-
children: arrayMap(rowIds, (rowId) =>
|
|
2224
|
-
|
|
2626
|
+
children: arrayMap(rowIds, (rowId) => {
|
|
2627
|
+
const rowProps = {...cellComponentProps, rowId};
|
|
2628
|
+
return /* @__PURE__ */ jsxs(
|
|
2225
2629
|
'tr',
|
|
2226
2630
|
{
|
|
2227
2631
|
children: [
|
|
2632
|
+
extraRowCells(extraCellsBefore, rowProps),
|
|
2228
2633
|
idColumn === false
|
|
2229
2634
|
? null
|
|
2230
|
-
: /* @__PURE__ */ jsx('th', {children: rowId}),
|
|
2635
|
+
: /* @__PURE__ */ jsx('th', {title: rowId, children: rowId}),
|
|
2231
2636
|
objToArray(
|
|
2232
2637
|
cells,
|
|
2233
|
-
({component:
|
|
2638
|
+
({component: CellView, getComponentProps}, cellId) =>
|
|
2234
2639
|
/* @__PURE__ */ jsx(
|
|
2235
2640
|
'td',
|
|
2236
2641
|
{
|
|
2237
|
-
children: /* @__PURE__ */ jsx(
|
|
2642
|
+
children: /* @__PURE__ */ jsx(CellView, {
|
|
2238
2643
|
...getProps(getComponentProps, rowId, cellId),
|
|
2239
|
-
...
|
|
2240
|
-
rowId,
|
|
2644
|
+
...rowProps,
|
|
2241
2645
|
cellId,
|
|
2242
2646
|
}),
|
|
2243
2647
|
},
|
|
2244
2648
|
cellId,
|
|
2245
2649
|
),
|
|
2246
2650
|
),
|
|
2651
|
+
extraRowCells(extraCellsAfter, rowProps, 1),
|
|
2247
2652
|
],
|
|
2248
2653
|
},
|
|
2249
2654
|
rowId,
|
|
2250
|
-
)
|
|
2251
|
-
),
|
|
2655
|
+
);
|
|
2656
|
+
}),
|
|
2252
2657
|
}),
|
|
2253
2658
|
],
|
|
2254
2659
|
});
|
|
2255
|
-
const HtmlHeaderCell = ({
|
|
2256
|
-
cellId,
|
|
2257
|
-
sort: [sortCellId, sortDescending],
|
|
2258
|
-
label = cellId ?? EMPTY_STRING,
|
|
2259
|
-
onClick,
|
|
2260
|
-
}) =>
|
|
2261
|
-
/* @__PURE__ */ jsxs('th', {
|
|
2262
|
-
onClick: useCallbackOrUndefined(
|
|
2263
|
-
() => onClick?.(cellId),
|
|
2264
|
-
[onClick, cellId],
|
|
2265
|
-
onClick,
|
|
2266
|
-
),
|
|
2267
|
-
className:
|
|
2268
|
-
isUndefined(sortDescending) || sortCellId != cellId
|
|
2269
|
-
? void 0
|
|
2270
|
-
: `sorted ${sortDescending ? 'de' : 'a'}scending`,
|
|
2271
|
-
children: [
|
|
2272
|
-
isUndefined(sortDescending) || sortCellId != cellId
|
|
2273
|
-
? null
|
|
2274
|
-
: (sortDescending ? DOWN_ARROW : UP_ARROW) + ' ',
|
|
2275
|
-
label,
|
|
2276
|
-
],
|
|
2277
|
-
});
|
|
2278
|
-
const RelationshipInHtmlRow = ({
|
|
2279
|
-
localRowId,
|
|
2280
|
-
params: [
|
|
2281
|
-
idColumn,
|
|
2282
|
-
cells,
|
|
2283
|
-
localTableId,
|
|
2284
|
-
remoteTableId,
|
|
2285
|
-
relationshipId,
|
|
2286
|
-
relationships,
|
|
2287
|
-
store,
|
|
2288
|
-
],
|
|
2289
|
-
}) => {
|
|
2290
|
-
const remoteRowId = useRemoteRowId(relationshipId, localRowId, relationships);
|
|
2291
|
-
return /* @__PURE__ */ jsxs('tr', {
|
|
2292
|
-
children: [
|
|
2293
|
-
idColumn === false
|
|
2294
|
-
? null
|
|
2295
|
-
: /* @__PURE__ */ jsxs(Fragment, {
|
|
2296
|
-
children: [
|
|
2297
|
-
/* @__PURE__ */ jsx('th', {children: localRowId}),
|
|
2298
|
-
/* @__PURE__ */ jsx('th', {children: remoteRowId}),
|
|
2299
|
-
],
|
|
2300
|
-
}),
|
|
2301
|
-
objToArray(
|
|
2302
|
-
cells,
|
|
2303
|
-
({component: CellView2, getComponentProps}, compoundCellId) => {
|
|
2304
|
-
const [tableId, cellId] = strSplit(compoundCellId, DOT, 2);
|
|
2305
|
-
const rowId =
|
|
2306
|
-
tableId === localTableId
|
|
2307
|
-
? localRowId
|
|
2308
|
-
: tableId === remoteTableId
|
|
2309
|
-
? remoteRowId
|
|
2310
|
-
: null;
|
|
2311
|
-
return isUndefined(rowId)
|
|
2312
|
-
? null
|
|
2313
|
-
: /* @__PURE__ */ jsx(
|
|
2314
|
-
'td',
|
|
2315
|
-
{
|
|
2316
|
-
children: /* @__PURE__ */ jsx(CellView2, {
|
|
2317
|
-
...getProps(getComponentProps, rowId, cellId),
|
|
2318
|
-
store,
|
|
2319
|
-
tableId,
|
|
2320
|
-
rowId,
|
|
2321
|
-
cellId,
|
|
2322
|
-
}),
|
|
2323
|
-
},
|
|
2324
|
-
compoundCellId,
|
|
2325
|
-
);
|
|
2326
|
-
},
|
|
2327
|
-
),
|
|
2328
|
-
],
|
|
2329
|
-
});
|
|
2330
|
-
};
|
|
2331
2660
|
const EditableThing = ({
|
|
2332
2661
|
thing,
|
|
2333
2662
|
onThingChange,
|
|
@@ -2376,181 +2705,172 @@ const EditableThing = ({
|
|
|
2376
2705
|
booleanThing,
|
|
2377
2706
|
thingType,
|
|
2378
2707
|
]);
|
|
2708
|
+
const widget = getTypeCase(
|
|
2709
|
+
thingType,
|
|
2710
|
+
/* @__PURE__ */ jsx(
|
|
2711
|
+
'input',
|
|
2712
|
+
{
|
|
2713
|
+
value: stringThing,
|
|
2714
|
+
onChange: useCallback(
|
|
2715
|
+
(event) =>
|
|
2716
|
+
handleThingChange(
|
|
2717
|
+
String(event[CURRENT_TARGET][_VALUE]),
|
|
2718
|
+
setStringThing,
|
|
2719
|
+
),
|
|
2720
|
+
[handleThingChange],
|
|
2721
|
+
),
|
|
2722
|
+
},
|
|
2723
|
+
thingType,
|
|
2724
|
+
),
|
|
2725
|
+
/* @__PURE__ */ jsx(
|
|
2726
|
+
'input',
|
|
2727
|
+
{
|
|
2728
|
+
type: 'number',
|
|
2729
|
+
value: numberThing,
|
|
2730
|
+
onChange: useCallback(
|
|
2731
|
+
(event) =>
|
|
2732
|
+
handleThingChange(
|
|
2733
|
+
Number(event[CURRENT_TARGET][_VALUE] || 0),
|
|
2734
|
+
setNumberThing,
|
|
2735
|
+
),
|
|
2736
|
+
[handleThingChange],
|
|
2737
|
+
),
|
|
2738
|
+
},
|
|
2739
|
+
thingType,
|
|
2740
|
+
),
|
|
2741
|
+
/* @__PURE__ */ jsx(
|
|
2742
|
+
'input',
|
|
2743
|
+
{
|
|
2744
|
+
type: 'checkbox',
|
|
2745
|
+
checked: booleanThing,
|
|
2746
|
+
onChange: useCallback(
|
|
2747
|
+
(event) =>
|
|
2748
|
+
handleThingChange(
|
|
2749
|
+
Boolean(event[CURRENT_TARGET].checked),
|
|
2750
|
+
setBooleanThing,
|
|
2751
|
+
),
|
|
2752
|
+
[handleThingChange],
|
|
2753
|
+
),
|
|
2754
|
+
},
|
|
2755
|
+
thingType,
|
|
2756
|
+
),
|
|
2757
|
+
);
|
|
2379
2758
|
return /* @__PURE__ */ jsxs('div', {
|
|
2380
2759
|
className,
|
|
2381
2760
|
children: [
|
|
2382
|
-
showType
|
|
2761
|
+
showType && widget
|
|
2383
2762
|
? /* @__PURE__ */ jsx('button', {
|
|
2763
|
+
title: thingType,
|
|
2384
2764
|
className: thingType,
|
|
2385
2765
|
onClick: handleTypeChange,
|
|
2386
2766
|
children: thingType,
|
|
2387
2767
|
})
|
|
2388
2768
|
: null,
|
|
2389
|
-
|
|
2390
|
-
thingType,
|
|
2391
|
-
/* @__PURE__ */ jsx(
|
|
2392
|
-
'input',
|
|
2393
|
-
{
|
|
2394
|
-
value: stringThing,
|
|
2395
|
-
onChange: useCallback(
|
|
2396
|
-
(event) =>
|
|
2397
|
-
handleThingChange(
|
|
2398
|
-
String(event[CURRENT_TARGET][_VALUE]),
|
|
2399
|
-
setStringThing,
|
|
2400
|
-
),
|
|
2401
|
-
[handleThingChange],
|
|
2402
|
-
),
|
|
2403
|
-
},
|
|
2404
|
-
thingType,
|
|
2405
|
-
),
|
|
2406
|
-
/* @__PURE__ */ jsx(
|
|
2407
|
-
'input',
|
|
2408
|
-
{
|
|
2409
|
-
type: 'number',
|
|
2410
|
-
value: numberThing,
|
|
2411
|
-
onChange: useCallback(
|
|
2412
|
-
(event) =>
|
|
2413
|
-
handleThingChange(
|
|
2414
|
-
Number(event[CURRENT_TARGET][_VALUE] || 0),
|
|
2415
|
-
setNumberThing,
|
|
2416
|
-
),
|
|
2417
|
-
[handleThingChange],
|
|
2418
|
-
),
|
|
2419
|
-
},
|
|
2420
|
-
thingType,
|
|
2421
|
-
),
|
|
2422
|
-
/* @__PURE__ */ jsx(
|
|
2423
|
-
'input',
|
|
2424
|
-
{
|
|
2425
|
-
type: 'checkbox',
|
|
2426
|
-
checked: booleanThing,
|
|
2427
|
-
onChange: useCallback(
|
|
2428
|
-
(event) =>
|
|
2429
|
-
handleThingChange(
|
|
2430
|
-
Boolean(event[CURRENT_TARGET].checked),
|
|
2431
|
-
setBooleanThing,
|
|
2432
|
-
),
|
|
2433
|
-
[handleThingChange],
|
|
2434
|
-
),
|
|
2435
|
-
},
|
|
2436
|
-
thingType,
|
|
2437
|
-
),
|
|
2438
|
-
),
|
|
2769
|
+
widget,
|
|
2439
2770
|
],
|
|
2440
2771
|
});
|
|
2441
2772
|
};
|
|
2442
|
-
|
|
2773
|
+
|
|
2774
|
+
const EditableCellView = ({
|
|
2443
2775
|
tableId,
|
|
2776
|
+
rowId,
|
|
2444
2777
|
cellId,
|
|
2445
|
-
descending,
|
|
2446
|
-
offset,
|
|
2447
|
-
limit,
|
|
2448
2778
|
store,
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
useSortingAndPagination(
|
|
2779
|
+
className,
|
|
2780
|
+
showType,
|
|
2781
|
+
}) =>
|
|
2782
|
+
/* @__PURE__ */ jsx(EditableThing, {
|
|
2783
|
+
thing: useCell(tableId, rowId, cellId, store),
|
|
2784
|
+
onThingChange: useSetCellCallback(
|
|
2785
|
+
tableId,
|
|
2786
|
+
rowId,
|
|
2458
2787
|
cellId,
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
limit,
|
|
2463
|
-
useRowCount(tableId, store),
|
|
2464
|
-
paginator,
|
|
2465
|
-
onChange,
|
|
2466
|
-
);
|
|
2467
|
-
return /* @__PURE__ */ jsx(HtmlTable, {
|
|
2468
|
-
...props,
|
|
2469
|
-
params: useParams(
|
|
2470
|
-
useCells(
|
|
2471
|
-
useTableCellIds(tableId, store),
|
|
2472
|
-
customCells,
|
|
2473
|
-
editable ? EditableCellView : CellView,
|
|
2474
|
-
),
|
|
2475
|
-
useStoreCellComponentProps(store, tableId),
|
|
2476
|
-
useSortedRowIds(tableId, ...sortAndOffset, limit, store),
|
|
2477
|
-
sortAndOffset,
|
|
2478
|
-
handleSort,
|
|
2479
|
-
paginatorComponent,
|
|
2788
|
+
(cell) => cell,
|
|
2789
|
+
[],
|
|
2790
|
+
store,
|
|
2480
2791
|
),
|
|
2792
|
+
className: className ?? EDITABLE + CELL,
|
|
2793
|
+
showType,
|
|
2794
|
+
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
2481
2795
|
});
|
|
2482
|
-
|
|
2483
|
-
const
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2796
|
+
|
|
2797
|
+
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
2798
|
+
/* @__PURE__ */ jsx(EditableThing, {
|
|
2799
|
+
thing: useValue(valueId, store),
|
|
2800
|
+
onThingChange: useSetValueCallback(valueId, (value) => value, [], store),
|
|
2801
|
+
className: className ?? EDITABLE + VALUE,
|
|
2802
|
+
showType,
|
|
2803
|
+
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
2804
|
+
});
|
|
2805
|
+
|
|
2806
|
+
const useDottedCellIds = (tableId, store) =>
|
|
2807
|
+
arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
|
|
2808
|
+
const RelationshipInHtmlRow = ({
|
|
2809
|
+
localRowId,
|
|
2810
|
+
params: [
|
|
2811
|
+
idColumn,
|
|
2812
|
+
cells,
|
|
2813
|
+
localTableId,
|
|
2814
|
+
remoteTableId,
|
|
2815
|
+
relationshipId,
|
|
2816
|
+
relationships,
|
|
2817
|
+
store,
|
|
2818
|
+
extraCellsBefore,
|
|
2819
|
+
extraCellsAfter,
|
|
2820
|
+
],
|
|
2821
|
+
}) => {
|
|
2822
|
+
const remoteRowId = useRemoteRowId(relationshipId, localRowId, relationships);
|
|
2823
|
+
const rowProps = {
|
|
2824
|
+
tableId: localTableId ?? '',
|
|
2825
|
+
rowId: localRowId,
|
|
2826
|
+
store,
|
|
2827
|
+
};
|
|
2828
|
+
return /* @__PURE__ */ jsxs('tr', {
|
|
2494
2829
|
children: [
|
|
2495
|
-
|
|
2830
|
+
extraRowCells(extraCellsBefore, rowProps),
|
|
2831
|
+
idColumn === false
|
|
2496
2832
|
? null
|
|
2497
|
-
: /* @__PURE__ */
|
|
2498
|
-
children:
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2833
|
+
: /* @__PURE__ */ jsxs(Fragment, {
|
|
2834
|
+
children: [
|
|
2835
|
+
/* @__PURE__ */ jsx('th', {
|
|
2836
|
+
title: localRowId,
|
|
2837
|
+
children: localRowId,
|
|
2838
|
+
}),
|
|
2839
|
+
/* @__PURE__ */ jsx('th', {
|
|
2840
|
+
title: remoteRowId,
|
|
2841
|
+
children: remoteRowId,
|
|
2842
|
+
}),
|
|
2843
|
+
],
|
|
2506
2844
|
}),
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2845
|
+
objToArray(
|
|
2846
|
+
cells,
|
|
2847
|
+
({component: CellView2, getComponentProps}, compoundCellId) => {
|
|
2848
|
+
const [tableId, cellId] = strSplit(compoundCellId, DOT, 2);
|
|
2849
|
+
const rowId =
|
|
2850
|
+
tableId === localTableId
|
|
2851
|
+
? localRowId
|
|
2852
|
+
: tableId === remoteTableId
|
|
2853
|
+
? remoteRowId
|
|
2854
|
+
: void 0;
|
|
2855
|
+
return isUndefined(rowId)
|
|
2856
|
+
? null
|
|
2857
|
+
: /* @__PURE__ */ jsx(
|
|
2858
|
+
'td',
|
|
2859
|
+
{
|
|
2860
|
+
children: /* @__PURE__ */ jsx(CellView2, {
|
|
2861
|
+
...getProps(getComponentProps, rowId, cellId),
|
|
2520
2862
|
store,
|
|
2863
|
+
tableId,
|
|
2864
|
+
rowId,
|
|
2865
|
+
cellId,
|
|
2521
2866
|
}),
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
),
|
|
2527
|
-
),
|
|
2528
|
-
}),
|
|
2529
|
-
],
|
|
2530
|
-
});
|
|
2531
|
-
const SliceInHtmlTable = ({
|
|
2532
|
-
indexId,
|
|
2533
|
-
sliceId,
|
|
2534
|
-
indexes,
|
|
2535
|
-
editable,
|
|
2536
|
-
customCells,
|
|
2537
|
-
...props
|
|
2538
|
-
}) => {
|
|
2539
|
-
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
2540
|
-
useIndexesOrIndexesById(indexes),
|
|
2541
|
-
indexId,
|
|
2542
|
-
);
|
|
2543
|
-
return /* @__PURE__ */ jsx(HtmlTable, {
|
|
2544
|
-
...props,
|
|
2545
|
-
params: useParams(
|
|
2546
|
-
useCells(
|
|
2547
|
-
useTableCellIds(tableId, store),
|
|
2548
|
-
customCells,
|
|
2549
|
-
editable ? EditableCellView : CellView,
|
|
2867
|
+
},
|
|
2868
|
+
compoundCellId,
|
|
2869
|
+
);
|
|
2870
|
+
},
|
|
2550
2871
|
),
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
),
|
|
2872
|
+
extraRowCells(extraCellsAfter, rowProps, 1),
|
|
2873
|
+
],
|
|
2554
2874
|
});
|
|
2555
2875
|
};
|
|
2556
2876
|
const RelationshipInHtmlTable = ({
|
|
@@ -2558,6 +2878,8 @@ const RelationshipInHtmlTable = ({
|
|
|
2558
2878
|
relationships,
|
|
2559
2879
|
editable,
|
|
2560
2880
|
customCells,
|
|
2881
|
+
extraCellsBefore,
|
|
2882
|
+
extraCellsAfter,
|
|
2561
2883
|
className,
|
|
2562
2884
|
headerRow,
|
|
2563
2885
|
idColumn = true,
|
|
@@ -2583,6 +2905,8 @@ const RelationshipInHtmlTable = ({
|
|
|
2583
2905
|
relationshipId,
|
|
2584
2906
|
resolvedRelationships,
|
|
2585
2907
|
store,
|
|
2908
|
+
extraCellsBefore,
|
|
2909
|
+
extraCellsAfter,
|
|
2586
2910
|
);
|
|
2587
2911
|
return /* @__PURE__ */ jsxs('table', {
|
|
2588
2912
|
className,
|
|
@@ -2592,6 +2916,7 @@ const RelationshipInHtmlTable = ({
|
|
|
2592
2916
|
: /* @__PURE__ */ jsx('thead', {
|
|
2593
2917
|
children: /* @__PURE__ */ jsxs('tr', {
|
|
2594
2918
|
children: [
|
|
2919
|
+
extraHeaders(extraCellsBefore),
|
|
2595
2920
|
idColumn === false
|
|
2596
2921
|
? null
|
|
2597
2922
|
: /* @__PURE__ */ jsxs(Fragment, {
|
|
@@ -2607,6 +2932,7 @@ const RelationshipInHtmlTable = ({
|
|
|
2607
2932
|
objToArray(cells, ({label}, cellId) =>
|
|
2608
2933
|
/* @__PURE__ */ jsx('th', {children: label}, cellId),
|
|
2609
2934
|
),
|
|
2935
|
+
extraHeaders(extraCellsAfter, 1),
|
|
2610
2936
|
],
|
|
2611
2937
|
}),
|
|
2612
2938
|
}),
|
|
@@ -2625,76 +2951,68 @@ const RelationshipInHtmlTable = ({
|
|
|
2625
2951
|
],
|
|
2626
2952
|
});
|
|
2627
2953
|
};
|
|
2628
|
-
|
|
2629
|
-
|
|
2954
|
+
|
|
2955
|
+
const LEFT_ARROW = '\u2190';
|
|
2956
|
+
const RIGHT_ARROW = '\u2192';
|
|
2957
|
+
const useSortingAndPagination = (
|
|
2630
2958
|
cellId,
|
|
2631
|
-
descending,
|
|
2632
|
-
offset,
|
|
2633
|
-
limit,
|
|
2634
|
-
queries,
|
|
2959
|
+
descending = false,
|
|
2635
2960
|
sortOnClick,
|
|
2636
|
-
|
|
2637
|
-
|
|
2961
|
+
offset = 0,
|
|
2962
|
+
limit,
|
|
2963
|
+
total,
|
|
2964
|
+
paginator,
|
|
2638
2965
|
onChange,
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2966
|
+
) => {
|
|
2967
|
+
const [[currentCellId, currentDescending, currentOffset], setState] =
|
|
2968
|
+
useState([cellId, descending, offset]);
|
|
2969
|
+
const setStateAndChange = useCallback(
|
|
2970
|
+
(sortAndOffset) => {
|
|
2971
|
+
setState(sortAndOffset);
|
|
2972
|
+
onChange?.(sortAndOffset);
|
|
2973
|
+
},
|
|
2974
|
+
[onChange],
|
|
2975
|
+
);
|
|
2976
|
+
const handleSort = useCallbackOrUndefined(
|
|
2977
|
+
(cellId2) =>
|
|
2978
|
+
setStateAndChange([
|
|
2979
|
+
cellId2,
|
|
2980
|
+
cellId2 == currentCellId ? !currentDescending : false,
|
|
2981
|
+
currentOffset,
|
|
2982
|
+
]),
|
|
2983
|
+
[setStateAndChange, currentCellId, currentDescending, currentOffset],
|
|
2984
|
+
sortOnClick,
|
|
2985
|
+
);
|
|
2986
|
+
const handleChangeOffset = useCallback(
|
|
2987
|
+
(offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
|
|
2988
|
+
[setStateAndChange, currentCellId, currentDescending],
|
|
2989
|
+
);
|
|
2990
|
+
const PaginatorComponent =
|
|
2991
|
+
paginator === true ? SortedTablePaginator : paginator;
|
|
2992
|
+
return [
|
|
2993
|
+
[currentCellId, currentDescending, currentOffset],
|
|
2994
|
+
handleSort,
|
|
2995
|
+
useMemo(
|
|
2996
|
+
() =>
|
|
2997
|
+
paginator === false
|
|
2998
|
+
? null
|
|
2999
|
+
: /* @__PURE__ */ jsx(PaginatorComponent, {
|
|
3000
|
+
offset: currentOffset,
|
|
3001
|
+
limit,
|
|
3002
|
+
total,
|
|
3003
|
+
onChange: handleChangeOffset,
|
|
3004
|
+
}),
|
|
3005
|
+
[
|
|
3006
|
+
paginator,
|
|
3007
|
+
PaginatorComponent,
|
|
3008
|
+
currentOffset,
|
|
3009
|
+
limit,
|
|
3010
|
+
total,
|
|
3011
|
+
handleChangeOffset,
|
|
3012
|
+
],
|
|
2665
3013
|
),
|
|
2666
|
-
|
|
3014
|
+
];
|
|
2667
3015
|
};
|
|
2668
|
-
const EditableCellView = ({
|
|
2669
|
-
tableId,
|
|
2670
|
-
rowId,
|
|
2671
|
-
cellId,
|
|
2672
|
-
store,
|
|
2673
|
-
className,
|
|
2674
|
-
showType,
|
|
2675
|
-
}) =>
|
|
2676
|
-
/* @__PURE__ */ jsx(EditableThing, {
|
|
2677
|
-
thing: useCell(tableId, rowId, cellId, store),
|
|
2678
|
-
onThingChange: useSetCellCallback(
|
|
2679
|
-
tableId,
|
|
2680
|
-
rowId,
|
|
2681
|
-
cellId,
|
|
2682
|
-
(cell) => cell,
|
|
2683
|
-
[],
|
|
2684
|
-
store,
|
|
2685
|
-
),
|
|
2686
|
-
className: className ?? EDITABLE + CELL,
|
|
2687
|
-
showType,
|
|
2688
|
-
hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
|
|
2689
|
-
});
|
|
2690
|
-
const EditableValueView = ({valueId, store, className, showType}) =>
|
|
2691
|
-
/* @__PURE__ */ jsx(EditableThing, {
|
|
2692
|
-
thing: useValue(valueId, store),
|
|
2693
|
-
onThingChange: useSetValueCallback(valueId, (value) => value, [], store),
|
|
2694
|
-
className: className ?? EDITABLE + VALUE,
|
|
2695
|
-
showType,
|
|
2696
|
-
hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
|
|
2697
|
-
});
|
|
2698
3016
|
const SortedTablePaginator = ({
|
|
2699
3017
|
onChange,
|
|
2700
3018
|
total,
|
|
@@ -2740,23 +3058,210 @@ const SortedTablePaginator = ({
|
|
|
2740
3058
|
' of ',
|
|
2741
3059
|
],
|
|
2742
3060
|
}),
|
|
2743
|
-
total,
|
|
2744
|
-
' ',
|
|
2745
|
-
total != 1 ? plural : singular,
|
|
3061
|
+
total,
|
|
3062
|
+
' ',
|
|
3063
|
+
total != 1 ? plural : singular,
|
|
3064
|
+
],
|
|
3065
|
+
});
|
|
3066
|
+
};
|
|
3067
|
+
|
|
3068
|
+
const ResultSortedTableInHtmlTable = ({
|
|
3069
|
+
queryId,
|
|
3070
|
+
cellId,
|
|
3071
|
+
descending,
|
|
3072
|
+
offset,
|
|
3073
|
+
limit,
|
|
3074
|
+
queries,
|
|
3075
|
+
sortOnClick,
|
|
3076
|
+
paginator = false,
|
|
3077
|
+
customCells,
|
|
3078
|
+
extraCellsBefore,
|
|
3079
|
+
extraCellsAfter,
|
|
3080
|
+
onChange,
|
|
3081
|
+
...props
|
|
3082
|
+
}) => {
|
|
3083
|
+
const [sortAndOffset, handleSort, paginatorComponent] =
|
|
3084
|
+
useSortingAndPagination(
|
|
3085
|
+
cellId,
|
|
3086
|
+
descending,
|
|
3087
|
+
sortOnClick,
|
|
3088
|
+
offset,
|
|
3089
|
+
limit,
|
|
3090
|
+
useResultRowCount(queryId, queries),
|
|
3091
|
+
paginator,
|
|
3092
|
+
onChange,
|
|
3093
|
+
);
|
|
3094
|
+
return /* @__PURE__ */ jsx(HtmlTable, {
|
|
3095
|
+
...props,
|
|
3096
|
+
params: useParams(
|
|
3097
|
+
useCells(
|
|
3098
|
+
useResultTableCellIds(queryId, queries),
|
|
3099
|
+
customCells,
|
|
3100
|
+
ResultCellView,
|
|
3101
|
+
),
|
|
3102
|
+
useQueriesCellComponentProps(queries, queryId),
|
|
3103
|
+
useResultSortedRowIds(queryId, ...sortAndOffset, limit, queries),
|
|
3104
|
+
extraCellsBefore,
|
|
3105
|
+
extraCellsAfter,
|
|
3106
|
+
sortAndOffset,
|
|
3107
|
+
handleSort,
|
|
3108
|
+
paginatorComponent,
|
|
3109
|
+
),
|
|
3110
|
+
});
|
|
3111
|
+
};
|
|
3112
|
+
|
|
3113
|
+
const SliceInHtmlTable = ({
|
|
3114
|
+
indexId,
|
|
3115
|
+
sliceId,
|
|
3116
|
+
indexes,
|
|
3117
|
+
editable,
|
|
3118
|
+
customCells,
|
|
3119
|
+
extraCellsBefore,
|
|
3120
|
+
extraCellsAfter,
|
|
3121
|
+
...props
|
|
3122
|
+
}) => {
|
|
3123
|
+
const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
|
|
3124
|
+
useIndexesOrIndexesById(indexes),
|
|
3125
|
+
indexId,
|
|
3126
|
+
);
|
|
3127
|
+
return /* @__PURE__ */ jsx(HtmlTable, {
|
|
3128
|
+
...props,
|
|
3129
|
+
params: useParams(
|
|
3130
|
+
useCells(
|
|
3131
|
+
useTableCellIds(tableId, store),
|
|
3132
|
+
customCells,
|
|
3133
|
+
editable ? EditableCellView : CellView,
|
|
3134
|
+
),
|
|
3135
|
+
useStoreCellComponentProps(store, tableId),
|
|
3136
|
+
useSliceRowIds(indexId, sliceId, resolvedIndexes),
|
|
3137
|
+
extraCellsBefore,
|
|
3138
|
+
extraCellsAfter,
|
|
3139
|
+
),
|
|
3140
|
+
});
|
|
3141
|
+
};
|
|
3142
|
+
|
|
3143
|
+
const SortedTableInHtmlTable = ({
|
|
3144
|
+
tableId,
|
|
3145
|
+
cellId,
|
|
3146
|
+
descending,
|
|
3147
|
+
offset,
|
|
3148
|
+
limit,
|
|
3149
|
+
store,
|
|
3150
|
+
editable,
|
|
3151
|
+
sortOnClick,
|
|
3152
|
+
paginator = false,
|
|
3153
|
+
onChange,
|
|
3154
|
+
customCells,
|
|
3155
|
+
extraCellsBefore,
|
|
3156
|
+
extraCellsAfter,
|
|
3157
|
+
...props
|
|
3158
|
+
}) => {
|
|
3159
|
+
const [sortAndOffset, handleSort, paginatorComponent] =
|
|
3160
|
+
useSortingAndPagination(
|
|
3161
|
+
cellId,
|
|
3162
|
+
descending,
|
|
3163
|
+
sortOnClick,
|
|
3164
|
+
offset,
|
|
3165
|
+
limit,
|
|
3166
|
+
useRowCount(tableId, store),
|
|
3167
|
+
paginator,
|
|
3168
|
+
onChange,
|
|
3169
|
+
);
|
|
3170
|
+
return /* @__PURE__ */ jsx(HtmlTable, {
|
|
3171
|
+
...props,
|
|
3172
|
+
params: useParams(
|
|
3173
|
+
useCells(
|
|
3174
|
+
useTableCellIds(tableId, store),
|
|
3175
|
+
customCells,
|
|
3176
|
+
editable ? EditableCellView : CellView,
|
|
3177
|
+
),
|
|
3178
|
+
useStoreCellComponentProps(store, tableId),
|
|
3179
|
+
useSortedRowIds(tableId, ...sortAndOffset, limit, store),
|
|
3180
|
+
extraCellsBefore,
|
|
3181
|
+
extraCellsAfter,
|
|
3182
|
+
sortAndOffset,
|
|
3183
|
+
handleSort,
|
|
3184
|
+
paginatorComponent,
|
|
3185
|
+
),
|
|
3186
|
+
});
|
|
3187
|
+
};
|
|
3188
|
+
|
|
3189
|
+
const extraValueCells = (
|
|
3190
|
+
extraValueCells2 = [],
|
|
3191
|
+
extraValueCellProps,
|
|
3192
|
+
after = 0,
|
|
3193
|
+
) =>
|
|
3194
|
+
arrayMap(extraValueCells2, ({component: Component}, index) =>
|
|
3195
|
+
/* @__PURE__ */ jsx(
|
|
3196
|
+
'td',
|
|
3197
|
+
{
|
|
3198
|
+
className: EXTRA,
|
|
3199
|
+
children: /* @__PURE__ */ jsx(Component, {...extraValueCellProps}),
|
|
3200
|
+
},
|
|
3201
|
+
extraKey(index, after),
|
|
3202
|
+
),
|
|
3203
|
+
);
|
|
3204
|
+
const ValuesInHtmlTable = ({
|
|
3205
|
+
store,
|
|
3206
|
+
editable = false,
|
|
3207
|
+
valueComponent: Value = editable ? EditableValueView : ValueView,
|
|
3208
|
+
getValueComponentProps,
|
|
3209
|
+
extraCellsBefore,
|
|
3210
|
+
extraCellsAfter,
|
|
3211
|
+
className,
|
|
3212
|
+
headerRow,
|
|
3213
|
+
idColumn,
|
|
3214
|
+
}) =>
|
|
3215
|
+
/* @__PURE__ */ jsxs('table', {
|
|
3216
|
+
className,
|
|
3217
|
+
children: [
|
|
3218
|
+
headerRow === false
|
|
3219
|
+
? null
|
|
3220
|
+
: /* @__PURE__ */ jsx('thead', {
|
|
3221
|
+
children: /* @__PURE__ */ jsxs('tr', {
|
|
3222
|
+
children: [
|
|
3223
|
+
extraHeaders(extraCellsBefore),
|
|
3224
|
+
idColumn === false
|
|
3225
|
+
? null
|
|
3226
|
+
: /* @__PURE__ */ jsx('th', {children: 'Id'}),
|
|
3227
|
+
/* @__PURE__ */ jsx('th', {children: VALUE}),
|
|
3228
|
+
extraHeaders(extraCellsAfter, 1),
|
|
3229
|
+
],
|
|
3230
|
+
}),
|
|
3231
|
+
}),
|
|
3232
|
+
/* @__PURE__ */ jsx('tbody', {
|
|
3233
|
+
children: arrayMap(useValueIds(store), (valueId) => {
|
|
3234
|
+
const valueProps = {valueId, store};
|
|
3235
|
+
return /* @__PURE__ */ jsxs(
|
|
3236
|
+
'tr',
|
|
3237
|
+
{
|
|
3238
|
+
children: [
|
|
3239
|
+
extraValueCells(extraCellsBefore, valueProps),
|
|
3240
|
+
idColumn === false
|
|
3241
|
+
? null
|
|
3242
|
+
: /* @__PURE__ */ jsx('th', {
|
|
3243
|
+
title: valueId,
|
|
3244
|
+
children: valueId,
|
|
3245
|
+
}),
|
|
3246
|
+
/* @__PURE__ */ jsx('td', {
|
|
3247
|
+
children: /* @__PURE__ */ jsx(Value, {
|
|
3248
|
+
...getProps(getValueComponentProps, valueId),
|
|
3249
|
+
...valueProps,
|
|
3250
|
+
}),
|
|
3251
|
+
}),
|
|
3252
|
+
extraValueCells(extraCellsAfter, valueProps, 1),
|
|
3253
|
+
],
|
|
3254
|
+
},
|
|
3255
|
+
valueId,
|
|
3256
|
+
);
|
|
3257
|
+
}),
|
|
3258
|
+
}),
|
|
2746
3259
|
],
|
|
2747
3260
|
});
|
|
2748
|
-
};
|
|
2749
3261
|
|
|
2750
|
-
const Details = ({
|
|
2751
|
-
uniqueId,
|
|
2752
|
-
|
|
2753
|
-
editable,
|
|
2754
|
-
handleEditable,
|
|
2755
|
-
children,
|
|
2756
|
-
s,
|
|
2757
|
-
}) => {
|
|
2758
|
-
const open = !!useCell(STATE_TABLE, uniqueId, OPEN_CELL, s);
|
|
2759
|
-
const handleToggle = useSetCellCallback(
|
|
3262
|
+
const Details = ({uniqueId, title, editable, handleEditable, children, s}) => {
|
|
3263
|
+
const open = !!useCell$1(STATE_TABLE, uniqueId, OPEN_CELL, s);
|
|
3264
|
+
const handleToggle = useSetCellCallback$1(
|
|
2760
3265
|
STATE_TABLE,
|
|
2761
3266
|
uniqueId,
|
|
2762
3267
|
OPEN_CELL,
|
|
@@ -2770,16 +3275,17 @@ const Details = ({
|
|
|
2770
3275
|
children: [
|
|
2771
3276
|
/* @__PURE__ */ jsxs('summary', {
|
|
2772
3277
|
children: [
|
|
2773
|
-
|
|
3278
|
+
/* @__PURE__ */ jsx('span', {children: title}),
|
|
2774
3279
|
handleEditable
|
|
2775
3280
|
? /* @__PURE__ */ jsx('img', {
|
|
2776
3281
|
onClick: handleEditable,
|
|
2777
3282
|
className: editable ? 'done' : 'edit',
|
|
3283
|
+
title: editable ? 'Done editing' : 'Edit',
|
|
2778
3284
|
})
|
|
2779
3285
|
: null,
|
|
2780
3286
|
],
|
|
2781
3287
|
}),
|
|
2782
|
-
children,
|
|
3288
|
+
/* @__PURE__ */ jsx('div', {children}),
|
|
2783
3289
|
],
|
|
2784
3290
|
});
|
|
2785
3291
|
};
|
|
@@ -2787,7 +3293,7 @@ const Details = ({
|
|
|
2787
3293
|
const IndexView = ({indexes, indexesId, indexId, s}) =>
|
|
2788
3294
|
/* @__PURE__ */ jsx(Details, {
|
|
2789
3295
|
uniqueId: getUniqueId('i', indexesId, indexId),
|
|
2790
|
-
|
|
3296
|
+
title: 'Index: ' + indexId,
|
|
2791
3297
|
s,
|
|
2792
3298
|
children: arrayMap(useSliceIds(indexId, indexes), (sliceId) =>
|
|
2793
3299
|
/* @__PURE__ */ jsx(
|
|
@@ -2808,7 +3314,7 @@ const SliceView = ({indexes, indexesId, indexId, sliceId, s}) => {
|
|
|
2808
3314
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
2809
3315
|
return /* @__PURE__ */ jsx(Details, {
|
|
2810
3316
|
uniqueId,
|
|
2811
|
-
|
|
3317
|
+
title: 'Slice: ' + sliceId,
|
|
2812
3318
|
editable,
|
|
2813
3319
|
handleEditable,
|
|
2814
3320
|
s,
|
|
@@ -2827,7 +3333,7 @@ const IndexesView = ({indexesId, s}) => {
|
|
|
2827
3333
|
? null
|
|
2828
3334
|
: /* @__PURE__ */ jsx(Details, {
|
|
2829
3335
|
uniqueId: getUniqueId('i', indexesId),
|
|
2830
|
-
|
|
3336
|
+
title: 'Indexes: ' + (indexesId ?? DEFAULT),
|
|
2831
3337
|
s,
|
|
2832
3338
|
children: arrayIsEmpty(indexIds)
|
|
2833
3339
|
? 'No indexes defined'
|
|
@@ -2849,7 +3355,7 @@ const IndexesView = ({indexesId, s}) => {
|
|
|
2849
3355
|
const MetricRow = ({metrics, metricId}) =>
|
|
2850
3356
|
/* @__PURE__ */ jsxs('tr', {
|
|
2851
3357
|
children: [
|
|
2852
|
-
/* @__PURE__ */ jsx('th', {children: metricId}),
|
|
3358
|
+
/* @__PURE__ */ jsx('th', {title: metricId, children: metricId}),
|
|
2853
3359
|
/* @__PURE__ */ jsx('td', {children: metrics?.getTableId(metricId)}),
|
|
2854
3360
|
/* @__PURE__ */ jsx('td', {children: useMetric(metricId, metrics)}),
|
|
2855
3361
|
],
|
|
@@ -2861,7 +3367,7 @@ const MetricsView = ({metricsId, s}) => {
|
|
|
2861
3367
|
? null
|
|
2862
3368
|
: /* @__PURE__ */ jsx(Details, {
|
|
2863
3369
|
uniqueId: getUniqueId('m', metricsId),
|
|
2864
|
-
|
|
3370
|
+
title: 'Metrics: ' + (metricsId ?? DEFAULT),
|
|
2865
3371
|
s,
|
|
2866
3372
|
children: arrayIsEmpty(metricIds)
|
|
2867
3373
|
? 'No metrics defined'
|
|
@@ -2891,9 +3397,9 @@ const MetricsView = ({metricsId, s}) => {
|
|
|
2891
3397
|
const QueryView = ({queries, queriesId, queryId, s}) => {
|
|
2892
3398
|
const uniqueId = getUniqueId('q', queriesId, queryId);
|
|
2893
3399
|
const [cellId, descending, offset] = jsonParse(
|
|
2894
|
-
useCell(STATE_TABLE, uniqueId, SORT_CELL, s) ?? '[]',
|
|
3400
|
+
useCell$1(STATE_TABLE, uniqueId, SORT_CELL, s) ?? '[]',
|
|
2895
3401
|
);
|
|
2896
|
-
const handleChange = useSetCellCallback(
|
|
3402
|
+
const handleChange = useSetCellCallback$1(
|
|
2897
3403
|
STATE_TABLE,
|
|
2898
3404
|
uniqueId,
|
|
2899
3405
|
SORT_CELL,
|
|
@@ -2903,7 +3409,7 @@ const QueryView = ({queries, queriesId, queryId, s}) => {
|
|
|
2903
3409
|
);
|
|
2904
3410
|
return /* @__PURE__ */ jsx(Details, {
|
|
2905
3411
|
uniqueId,
|
|
2906
|
-
|
|
3412
|
+
title: 'Query: ' + queryId,
|
|
2907
3413
|
s,
|
|
2908
3414
|
children: /* @__PURE__ */ jsx(ResultSortedTableInHtmlTable, {
|
|
2909
3415
|
queryId,
|
|
@@ -2925,7 +3431,7 @@ const QueriesView = ({queriesId, s}) => {
|
|
|
2925
3431
|
? null
|
|
2926
3432
|
: /* @__PURE__ */ jsx(Details, {
|
|
2927
3433
|
uniqueId: getUniqueId('q', queriesId),
|
|
2928
|
-
|
|
3434
|
+
title: 'Queries: ' + (queriesId ?? DEFAULT),
|
|
2929
3435
|
s,
|
|
2930
3436
|
children: arrayIsEmpty(queryIds)
|
|
2931
3437
|
? 'No queries defined'
|
|
@@ -2954,7 +3460,7 @@ const RelationshipView = ({
|
|
|
2954
3460
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
2955
3461
|
return /* @__PURE__ */ jsx(Details, {
|
|
2956
3462
|
uniqueId,
|
|
2957
|
-
|
|
3463
|
+
title: 'Relationship: ' + relationshipId,
|
|
2958
3464
|
editable,
|
|
2959
3465
|
handleEditable,
|
|
2960
3466
|
s,
|
|
@@ -2972,7 +3478,7 @@ const RelationshipsView = ({relationshipsId, s}) => {
|
|
|
2972
3478
|
? null
|
|
2973
3479
|
: /* @__PURE__ */ jsx(Details, {
|
|
2974
3480
|
uniqueId: getUniqueId('r', relationshipsId),
|
|
2975
|
-
|
|
3481
|
+
title: 'Relationships: ' + (relationshipsId ?? DEFAULT),
|
|
2976
3482
|
s,
|
|
2977
3483
|
children: arrayIsEmpty(relationshipIds)
|
|
2978
3484
|
? 'No relationships defined'
|
|
@@ -2991,12 +3497,318 @@ const RelationshipsView = ({relationshipsId, s}) => {
|
|
|
2991
3497
|
});
|
|
2992
3498
|
};
|
|
2993
3499
|
|
|
3500
|
+
const getNewIdFromSuggestedId = (suggestedId, has) => {
|
|
3501
|
+
let newId;
|
|
3502
|
+
let suffix = 0;
|
|
3503
|
+
while (
|
|
3504
|
+
has(
|
|
3505
|
+
(newId =
|
|
3506
|
+
suggestedId +
|
|
3507
|
+
(suffix > 0 ? ' (copy' + (suffix > 1 ? ' ' + suffix : '') + ')' : '')),
|
|
3508
|
+
)
|
|
3509
|
+
) {
|
|
3510
|
+
suffix++;
|
|
3511
|
+
}
|
|
3512
|
+
return newId;
|
|
3513
|
+
};
|
|
3514
|
+
const ConfirmableActions = ({actions, ...props}) => {
|
|
3515
|
+
const [confirming, setConfirming] = useState();
|
|
3516
|
+
const handleDone = useCallback(() => setConfirming(void 0), []);
|
|
3517
|
+
useEffect(() => {
|
|
3518
|
+
if (!isUndefined(confirming)) {
|
|
3519
|
+
const handleKeyDown = (e) => {
|
|
3520
|
+
if (!isUndefined(confirming) && e.key === 'Escape') {
|
|
3521
|
+
e.preventDefault();
|
|
3522
|
+
handleDone();
|
|
3523
|
+
}
|
|
3524
|
+
};
|
|
3525
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
3526
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
3527
|
+
}
|
|
3528
|
+
}, [confirming, handleDone]);
|
|
3529
|
+
if (!isUndefined(confirming)) {
|
|
3530
|
+
const [, , Component] = actions[confirming];
|
|
3531
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
3532
|
+
children: [
|
|
3533
|
+
/* @__PURE__ */ jsx(Component, {onDone: handleDone, ...props}),
|
|
3534
|
+
/* @__PURE__ */ jsx('img', {
|
|
3535
|
+
onClick: handleDone,
|
|
3536
|
+
title: 'Cancel',
|
|
3537
|
+
className: 'cancel',
|
|
3538
|
+
}),
|
|
3539
|
+
],
|
|
3540
|
+
});
|
|
3541
|
+
} else {
|
|
3542
|
+
return actions.map(([icon, title], index) =>
|
|
3543
|
+
/* @__PURE__ */ jsx(
|
|
3544
|
+
'img',
|
|
3545
|
+
{
|
|
3546
|
+
title,
|
|
3547
|
+
className: icon,
|
|
3548
|
+
onClick: () => setConfirming(index),
|
|
3549
|
+
},
|
|
3550
|
+
index,
|
|
3551
|
+
),
|
|
3552
|
+
);
|
|
3553
|
+
}
|
|
3554
|
+
};
|
|
3555
|
+
const NewId = ({onDone, suggestedId, has, set, prompt = 'New Id'}) => {
|
|
3556
|
+
const [newId, setNewId] = useState(suggestedId);
|
|
3557
|
+
const [newIdOk, setNewIdOk] = useState(true);
|
|
3558
|
+
const [previousSuggestedId, setPreviousSuggestedNewId] =
|
|
3559
|
+
useState(suggestedId);
|
|
3560
|
+
const handleNewIdChange = (e) => {
|
|
3561
|
+
setNewId(e.target.value);
|
|
3562
|
+
setNewIdOk(!has(e.target.value));
|
|
3563
|
+
};
|
|
3564
|
+
const handleClick = useCallback(() => {
|
|
3565
|
+
if (has(newId)) {
|
|
3566
|
+
setNewIdOk(false);
|
|
3567
|
+
} else {
|
|
3568
|
+
set(newId);
|
|
3569
|
+
onDone();
|
|
3570
|
+
}
|
|
3571
|
+
}, [onDone, setNewIdOk, has, set, newId]);
|
|
3572
|
+
const handleKeyDown = useCallback(
|
|
3573
|
+
(e) => {
|
|
3574
|
+
if (e.key === 'Enter') {
|
|
3575
|
+
e.preventDefault();
|
|
3576
|
+
handleClick();
|
|
3577
|
+
}
|
|
3578
|
+
},
|
|
3579
|
+
[handleClick],
|
|
3580
|
+
);
|
|
3581
|
+
if (suggestedId != previousSuggestedId) {
|
|
3582
|
+
setNewId(suggestedId);
|
|
3583
|
+
setPreviousSuggestedNewId(suggestedId);
|
|
3584
|
+
}
|
|
3585
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
3586
|
+
children: [
|
|
3587
|
+
prompt + ': ',
|
|
3588
|
+
/* @__PURE__ */ jsx('input', {
|
|
3589
|
+
type: 'text',
|
|
3590
|
+
value: newId,
|
|
3591
|
+
onChange: handleNewIdChange,
|
|
3592
|
+
onKeyDown: handleKeyDown,
|
|
3593
|
+
autoFocus: true,
|
|
3594
|
+
}),
|
|
3595
|
+
' ',
|
|
3596
|
+
/* @__PURE__ */ jsx('img', {
|
|
3597
|
+
onClick: handleClick,
|
|
3598
|
+
title: newIdOk ? 'Confirm' : 'Id already exists',
|
|
3599
|
+
className: newIdOk ? 'ok' : 'okDis',
|
|
3600
|
+
}),
|
|
3601
|
+
],
|
|
3602
|
+
});
|
|
3603
|
+
};
|
|
3604
|
+
const Delete = ({onClick, prompt = 'Delete'}) => {
|
|
3605
|
+
const handleKeyDown = useCallback(
|
|
3606
|
+
(e) => {
|
|
3607
|
+
if (e.key === 'Enter') {
|
|
3608
|
+
e.preventDefault();
|
|
3609
|
+
onClick();
|
|
3610
|
+
}
|
|
3611
|
+
},
|
|
3612
|
+
[onClick],
|
|
3613
|
+
);
|
|
3614
|
+
useEffect(() => {
|
|
3615
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
3616
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
3617
|
+
}, [handleKeyDown]);
|
|
3618
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
3619
|
+
children: [
|
|
3620
|
+
prompt,
|
|
3621
|
+
'? ',
|
|
3622
|
+
/* @__PURE__ */ jsx('img', {onClick, title: 'Confirm', className: 'ok'}),
|
|
3623
|
+
],
|
|
3624
|
+
});
|
|
3625
|
+
};
|
|
3626
|
+
const Actions = ({left, right}) =>
|
|
3627
|
+
/* @__PURE__ */ jsxs('div', {
|
|
3628
|
+
className: 'actions',
|
|
3629
|
+
children: [
|
|
3630
|
+
/* @__PURE__ */ jsx('div', {children: left}),
|
|
3631
|
+
/* @__PURE__ */ jsx('div', {children: right}),
|
|
3632
|
+
],
|
|
3633
|
+
});
|
|
3634
|
+
|
|
3635
|
+
const useHasTableCallback = (storeOrStoreId) => {
|
|
3636
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
3637
|
+
return useCallback((tableId) => store?.hasTable(tableId) ?? false, [store]);
|
|
3638
|
+
};
|
|
3639
|
+
const AddTable = ({onDone, store}) => {
|
|
3640
|
+
const has = useHasTableCallback(store);
|
|
3641
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
3642
|
+
onDone,
|
|
3643
|
+
suggestedId: getNewIdFromSuggestedId('table', has),
|
|
3644
|
+
has,
|
|
3645
|
+
set: useSetTableCallback(
|
|
3646
|
+
(newId) => newId,
|
|
3647
|
+
() => ({row: {cell: ''}}),
|
|
3648
|
+
[],
|
|
3649
|
+
store,
|
|
3650
|
+
),
|
|
3651
|
+
prompt: 'Add table',
|
|
3652
|
+
});
|
|
3653
|
+
};
|
|
3654
|
+
const DeleteTables = ({onDone, store}) =>
|
|
3655
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
3656
|
+
onClick: useDelTablesCallback(store, onDone),
|
|
3657
|
+
prompt: 'Delete all tables',
|
|
3658
|
+
});
|
|
3659
|
+
const TablesActions = ({store}) =>
|
|
3660
|
+
/* @__PURE__ */ jsx(Actions, {
|
|
3661
|
+
left: /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3662
|
+
actions: [['add', 'Add table', AddTable]],
|
|
3663
|
+
store,
|
|
3664
|
+
}),
|
|
3665
|
+
right: useHasTables(store)
|
|
3666
|
+
? /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3667
|
+
actions: [['delete', 'Delete all tables', DeleteTables]],
|
|
3668
|
+
store,
|
|
3669
|
+
})
|
|
3670
|
+
: null,
|
|
3671
|
+
});
|
|
3672
|
+
const AddRow = ({onDone, tableId, store}) => {
|
|
3673
|
+
const has = useHasRowCallback(store, tableId);
|
|
3674
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
3675
|
+
onDone,
|
|
3676
|
+
suggestedId: getNewIdFromSuggestedId('row', has),
|
|
3677
|
+
has,
|
|
3678
|
+
set: useSetRowCallback(
|
|
3679
|
+
tableId,
|
|
3680
|
+
(newId) => newId,
|
|
3681
|
+
(_, store2) =>
|
|
3682
|
+
objNew(
|
|
3683
|
+
arrayMap(store2.getTableCellIds(tableId), (cellId) => [cellId, '']),
|
|
3684
|
+
),
|
|
3685
|
+
),
|
|
3686
|
+
prompt: 'Add row',
|
|
3687
|
+
});
|
|
3688
|
+
};
|
|
3689
|
+
const CloneTable = ({onDone, tableId, store: storeOrStoreId}) => {
|
|
3690
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
3691
|
+
const has = useHasTableCallback(store);
|
|
3692
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
3693
|
+
onDone,
|
|
3694
|
+
suggestedId: getNewIdFromSuggestedId(tableId, has),
|
|
3695
|
+
has,
|
|
3696
|
+
set: useSetTableCallback(
|
|
3697
|
+
(tableId2) => tableId2,
|
|
3698
|
+
(_, store2) => store2.getTable(tableId),
|
|
3699
|
+
),
|
|
3700
|
+
prompt: 'Clone table to',
|
|
3701
|
+
});
|
|
3702
|
+
};
|
|
3703
|
+
const DeleteTable = ({onDone, tableId, store}) =>
|
|
3704
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
3705
|
+
onClick: useDelTableCallback(tableId, store, onDone),
|
|
3706
|
+
prompt: 'Delete table',
|
|
3707
|
+
});
|
|
3708
|
+
const TableActions1 = ({tableId, store}) =>
|
|
3709
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3710
|
+
actions: [['add', 'Add row', AddRow]],
|
|
3711
|
+
store,
|
|
3712
|
+
tableId,
|
|
3713
|
+
});
|
|
3714
|
+
const TableActions2 = ({tableId, store}) =>
|
|
3715
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3716
|
+
actions: [
|
|
3717
|
+
['clone', 'Clone table', CloneTable],
|
|
3718
|
+
['delete', 'Delete table', DeleteTable],
|
|
3719
|
+
],
|
|
3720
|
+
store,
|
|
3721
|
+
tableId,
|
|
3722
|
+
});
|
|
3723
|
+
const useHasRowCallback = (storeOrStoreId, tableId) => {
|
|
3724
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
3725
|
+
return useCallback(
|
|
3726
|
+
(rowId) => store?.hasRow(tableId, rowId) ?? false,
|
|
3727
|
+
[store, tableId],
|
|
3728
|
+
);
|
|
3729
|
+
};
|
|
3730
|
+
const AddCell = ({onDone, tableId, rowId, store: storeOrStoreId}) => {
|
|
3731
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
3732
|
+
const has = useCallback(
|
|
3733
|
+
(cellId) => store.hasCell(tableId, rowId, cellId),
|
|
3734
|
+
[store, tableId, rowId],
|
|
3735
|
+
);
|
|
3736
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
3737
|
+
onDone,
|
|
3738
|
+
suggestedId: getNewIdFromSuggestedId('cell', has),
|
|
3739
|
+
has,
|
|
3740
|
+
set: useSetCellCallback(
|
|
3741
|
+
tableId,
|
|
3742
|
+
rowId,
|
|
3743
|
+
(newId) => newId,
|
|
3744
|
+
() => '',
|
|
3745
|
+
[],
|
|
3746
|
+
store,
|
|
3747
|
+
),
|
|
3748
|
+
prompt: 'Add cell',
|
|
3749
|
+
});
|
|
3750
|
+
};
|
|
3751
|
+
const CloneRow = ({onDone, tableId, rowId, store: storeOrStoreId}) => {
|
|
3752
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
3753
|
+
const has = useHasRowCallback(store, tableId);
|
|
3754
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
3755
|
+
onDone,
|
|
3756
|
+
suggestedId: getNewIdFromSuggestedId(rowId, has),
|
|
3757
|
+
has,
|
|
3758
|
+
set: useSetRowCallback(
|
|
3759
|
+
tableId,
|
|
3760
|
+
(newId) => newId,
|
|
3761
|
+
(_, store2) => store2.getRow(tableId, rowId),
|
|
3762
|
+
[rowId],
|
|
3763
|
+
),
|
|
3764
|
+
prompt: 'Clone row to',
|
|
3765
|
+
});
|
|
3766
|
+
};
|
|
3767
|
+
const DeleteRow = ({onDone, tableId, rowId, store}) =>
|
|
3768
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
3769
|
+
onClick: useDelRowCallback(tableId, rowId, store, onDone),
|
|
3770
|
+
prompt: 'Delete row',
|
|
3771
|
+
});
|
|
3772
|
+
const RowActions = ({tableId, rowId, store}) =>
|
|
3773
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3774
|
+
actions: [
|
|
3775
|
+
['add', 'Add cell', AddCell],
|
|
3776
|
+
['clone', 'Clone row', CloneRow],
|
|
3777
|
+
['delete', 'Delete row', DeleteRow],
|
|
3778
|
+
],
|
|
3779
|
+
store,
|
|
3780
|
+
tableId,
|
|
3781
|
+
rowId,
|
|
3782
|
+
});
|
|
3783
|
+
const CellDelete = ({onDone, tableId, rowId, cellId, store}) =>
|
|
3784
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
3785
|
+
onClick: useDelCellCallback(tableId, rowId, cellId, true, store, onDone),
|
|
3786
|
+
prompt: 'Delete cell',
|
|
3787
|
+
});
|
|
3788
|
+
const CellActions = ({tableId, rowId, cellId, store}) =>
|
|
3789
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3790
|
+
actions: [['delete', 'Delete cell', CellDelete]],
|
|
3791
|
+
store,
|
|
3792
|
+
tableId,
|
|
3793
|
+
rowId,
|
|
3794
|
+
cellId,
|
|
3795
|
+
});
|
|
3796
|
+
|
|
3797
|
+
const rowActions = [{label: '', component: RowActions}];
|
|
3798
|
+
const EditableCellViewWithActions = (props) =>
|
|
3799
|
+
/* @__PURE__ */ jsxs(Fragment, {
|
|
3800
|
+
children: [
|
|
3801
|
+
/* @__PURE__ */ jsx(EditableCellView, {...props}),
|
|
3802
|
+
useHasCell(props.tableId, props.rowId, props.cellId, props.store) &&
|
|
3803
|
+
/* @__PURE__ */ jsx(CellActions, {...props}),
|
|
3804
|
+
],
|
|
3805
|
+
});
|
|
2994
3806
|
const TableView = ({tableId, store, storeId, s}) => {
|
|
2995
3807
|
const uniqueId = getUniqueId('t', storeId, tableId);
|
|
2996
3808
|
const [cellId, descending, offset] = jsonParse(
|
|
2997
|
-
useCell(STATE_TABLE, uniqueId, SORT_CELL, s) ?? '[]',
|
|
3809
|
+
useCell$1(STATE_TABLE, uniqueId, SORT_CELL, s) ?? '[]',
|
|
2998
3810
|
);
|
|
2999
|
-
const handleChange = useSetCellCallback(
|
|
3811
|
+
const handleChange = useSetCellCallback$1(
|
|
3000
3812
|
STATE_TABLE,
|
|
3001
3813
|
uniqueId,
|
|
3002
3814
|
SORT_CELL,
|
|
@@ -3005,66 +3817,183 @@ const TableView = ({tableId, store, storeId, s}) => {
|
|
|
3005
3817
|
s,
|
|
3006
3818
|
);
|
|
3007
3819
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
3008
|
-
|
|
3820
|
+
const CellComponent = editable ? EditableCellViewWithActions : CellView;
|
|
3821
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
3009
3822
|
uniqueId,
|
|
3010
|
-
|
|
3823
|
+
title: TABLE + ': ' + tableId,
|
|
3011
3824
|
editable,
|
|
3012
3825
|
handleEditable,
|
|
3013
3826
|
s,
|
|
3014
|
-
children:
|
|
3015
|
-
|
|
3827
|
+
children: [
|
|
3828
|
+
/* @__PURE__ */ jsx(SortedTableInHtmlTable, {
|
|
3829
|
+
tableId,
|
|
3830
|
+
store,
|
|
3831
|
+
cellId,
|
|
3832
|
+
descending,
|
|
3833
|
+
offset,
|
|
3834
|
+
limit: 10,
|
|
3835
|
+
paginator: true,
|
|
3836
|
+
sortOnClick: true,
|
|
3837
|
+
onChange: handleChange,
|
|
3838
|
+
editable,
|
|
3839
|
+
extraCellsAfter: editable ? rowActions : [],
|
|
3840
|
+
customCells: objNew(
|
|
3841
|
+
arrayMap(useTableCellIds$1(tableId, store), (cellId2) => [
|
|
3842
|
+
cellId2,
|
|
3843
|
+
{label: cellId2, component: CellComponent},
|
|
3844
|
+
]),
|
|
3845
|
+
),
|
|
3846
|
+
}),
|
|
3847
|
+
editable
|
|
3848
|
+
? /* @__PURE__ */ jsxs('div', {
|
|
3849
|
+
className: 'actions',
|
|
3850
|
+
children: [
|
|
3851
|
+
/* @__PURE__ */ jsx('div', {
|
|
3852
|
+
children: /* @__PURE__ */ jsx(TableActions1, {tableId, store}),
|
|
3853
|
+
}),
|
|
3854
|
+
/* @__PURE__ */ jsx('div', {
|
|
3855
|
+
children: /* @__PURE__ */ jsx(TableActions2, {tableId, store}),
|
|
3856
|
+
}),
|
|
3857
|
+
],
|
|
3858
|
+
})
|
|
3859
|
+
: null,
|
|
3860
|
+
],
|
|
3861
|
+
});
|
|
3862
|
+
};
|
|
3863
|
+
const TablesView = ({store, storeId, s}) => {
|
|
3864
|
+
const uniqueId = getUniqueId('ts', storeId);
|
|
3865
|
+
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
3866
|
+
const tableIds = useTableIds(store);
|
|
3867
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
3868
|
+
uniqueId,
|
|
3869
|
+
title: TABLES,
|
|
3870
|
+
editable,
|
|
3871
|
+
handleEditable,
|
|
3872
|
+
s,
|
|
3873
|
+
children: [
|
|
3874
|
+
arrayIsEmpty(tableIds)
|
|
3875
|
+
? /* @__PURE__ */ jsx('caption', {children: 'No tables.'})
|
|
3876
|
+
: sortedIdsMap(tableIds, (tableId) =>
|
|
3877
|
+
/* @__PURE__ */ jsx(
|
|
3878
|
+
TableView,
|
|
3879
|
+
{
|
|
3880
|
+
store,
|
|
3881
|
+
storeId,
|
|
3882
|
+
tableId,
|
|
3883
|
+
s,
|
|
3884
|
+
},
|
|
3885
|
+
tableId,
|
|
3886
|
+
),
|
|
3887
|
+
),
|
|
3888
|
+
editable ? /* @__PURE__ */ jsx(TablesActions, {store}) : null,
|
|
3889
|
+
],
|
|
3890
|
+
});
|
|
3891
|
+
};
|
|
3892
|
+
|
|
3893
|
+
const useHasValueCallback = (storeOrStoreId) => {
|
|
3894
|
+
const store = useStoreOrStoreById(storeOrStoreId);
|
|
3895
|
+
return useCallback((valueId) => store?.hasValue(valueId) ?? false, [store]);
|
|
3896
|
+
};
|
|
3897
|
+
const AddValue = ({onDone, store}) => {
|
|
3898
|
+
const has = useHasValueCallback(store);
|
|
3899
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
3900
|
+
onDone,
|
|
3901
|
+
suggestedId: getNewIdFromSuggestedId('value', has),
|
|
3902
|
+
has,
|
|
3903
|
+
set: useSetValueCallback(
|
|
3904
|
+
(newId) => newId,
|
|
3905
|
+
() => '',
|
|
3906
|
+
[],
|
|
3907
|
+
store,
|
|
3908
|
+
),
|
|
3909
|
+
prompt: 'Add value',
|
|
3910
|
+
});
|
|
3911
|
+
};
|
|
3912
|
+
const DeleteValues = ({onDone, store}) =>
|
|
3913
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
3914
|
+
onClick: useDelValuesCallback(store, onDone),
|
|
3915
|
+
prompt: 'Delete all values',
|
|
3916
|
+
});
|
|
3917
|
+
const ValuesActions = ({store}) =>
|
|
3918
|
+
/* @__PURE__ */ jsx(Actions, {
|
|
3919
|
+
left: /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3920
|
+
actions: [['add', 'Add value', AddValue]],
|
|
3016
3921
|
store,
|
|
3017
|
-
cellId,
|
|
3018
|
-
descending,
|
|
3019
|
-
offset,
|
|
3020
|
-
limit: 10,
|
|
3021
|
-
paginator: true,
|
|
3022
|
-
sortOnClick: true,
|
|
3023
|
-
onChange: handleChange,
|
|
3024
|
-
editable,
|
|
3025
3922
|
}),
|
|
3923
|
+
right: useHasValues(store)
|
|
3924
|
+
? /* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3925
|
+
actions: [['delete', 'Delete all values', DeleteValues]],
|
|
3926
|
+
store,
|
|
3927
|
+
})
|
|
3928
|
+
: null,
|
|
3929
|
+
});
|
|
3930
|
+
const CloneValue = ({onDone, valueId, store}) => {
|
|
3931
|
+
const has = useHasValueCallback(store);
|
|
3932
|
+
return /* @__PURE__ */ jsx(NewId, {
|
|
3933
|
+
onDone,
|
|
3934
|
+
suggestedId: getNewIdFromSuggestedId(valueId, has),
|
|
3935
|
+
has,
|
|
3936
|
+
set: useSetValueCallback(
|
|
3937
|
+
(newId) => newId,
|
|
3938
|
+
(_, store2) => store2.getValue(valueId) ?? '',
|
|
3939
|
+
[valueId],
|
|
3940
|
+
store,
|
|
3941
|
+
),
|
|
3942
|
+
prompt: 'Clone value to',
|
|
3026
3943
|
});
|
|
3027
3944
|
};
|
|
3945
|
+
const DeleteValue = ({onDone, valueId, store}) =>
|
|
3946
|
+
/* @__PURE__ */ jsx(Delete, {
|
|
3947
|
+
onClick: useDelValueCallback(valueId, store, onDone),
|
|
3948
|
+
prompt: 'Delete value',
|
|
3949
|
+
});
|
|
3950
|
+
const ValueActions = ({valueId, store}) =>
|
|
3951
|
+
/* @__PURE__ */ jsx(ConfirmableActions, {
|
|
3952
|
+
actions: [
|
|
3953
|
+
['clone', 'Clone value', CloneValue],
|
|
3954
|
+
['delete', 'Delete value', DeleteValue],
|
|
3955
|
+
],
|
|
3956
|
+
store,
|
|
3957
|
+
valueId,
|
|
3958
|
+
});
|
|
3959
|
+
|
|
3960
|
+
const valueActions = [{label: '', component: ValueActions}];
|
|
3028
3961
|
const ValuesView = ({store, storeId, s}) => {
|
|
3029
3962
|
const uniqueId = getUniqueId('v', storeId);
|
|
3030
3963
|
const [editable, handleEditable] = useEditable(uniqueId, s);
|
|
3031
|
-
return
|
|
3032
|
-
|
|
3033
|
-
:
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3964
|
+
return /* @__PURE__ */ jsxs(Details, {
|
|
3965
|
+
uniqueId,
|
|
3966
|
+
title: VALUES,
|
|
3967
|
+
editable,
|
|
3968
|
+
handleEditable,
|
|
3969
|
+
s,
|
|
3970
|
+
children: [
|
|
3971
|
+
arrayIsEmpty(useValueIds$1(store))
|
|
3972
|
+
? /* @__PURE__ */ jsx('caption', {children: 'No values.'})
|
|
3973
|
+
: /* @__PURE__ */ jsx(ValuesInHtmlTable, {
|
|
3974
|
+
store,
|
|
3975
|
+
editable,
|
|
3976
|
+
extraCellsAfter: editable ? valueActions : [],
|
|
3977
|
+
}),
|
|
3978
|
+
editable ? /* @__PURE__ */ jsx(ValuesActions, {store}) : null,
|
|
3979
|
+
],
|
|
3980
|
+
});
|
|
3041
3981
|
};
|
|
3982
|
+
|
|
3042
3983
|
const StoreView = ({storeId, s}) => {
|
|
3043
3984
|
const store = useStore(storeId);
|
|
3044
|
-
const tableIds = useTableIds(store);
|
|
3045
3985
|
return isUndefined(store)
|
|
3046
3986
|
? null
|
|
3047
3987
|
: /* @__PURE__ */ jsxs(Details, {
|
|
3048
3988
|
uniqueId: getUniqueId('s', storeId),
|
|
3049
|
-
|
|
3989
|
+
title:
|
|
3050
3990
|
(store.isMergeable() ? 'Mergeable' : '') +
|
|
3051
3991
|
'Store: ' +
|
|
3052
3992
|
(storeId ?? DEFAULT),
|
|
3053
3993
|
s,
|
|
3054
3994
|
children: [
|
|
3055
3995
|
/* @__PURE__ */ jsx(ValuesView, {storeId, store, s}),
|
|
3056
|
-
|
|
3057
|
-
/* @__PURE__ */ jsx(
|
|
3058
|
-
TableView,
|
|
3059
|
-
{
|
|
3060
|
-
store,
|
|
3061
|
-
storeId,
|
|
3062
|
-
tableId,
|
|
3063
|
-
s,
|
|
3064
|
-
},
|
|
3065
|
-
tableId,
|
|
3066
|
-
),
|
|
3067
|
-
),
|
|
3996
|
+
/* @__PURE__ */ jsx(TablesView, {storeId, store, s}),
|
|
3068
3997
|
],
|
|
3069
3998
|
});
|
|
3070
3999
|
};
|
|
@@ -3184,9 +4113,10 @@ class ErrorBoundary extends PureComponent {
|
|
|
3184
4113
|
}
|
|
3185
4114
|
|
|
3186
4115
|
const Header = ({s}) => {
|
|
3187
|
-
const position = useValue(POSITION_VALUE, s) ?? 1;
|
|
3188
|
-
const
|
|
3189
|
-
const
|
|
4116
|
+
const position = useValue$1(POSITION_VALUE, s) ?? 1;
|
|
4117
|
+
const handleClick = () => open('https://tinybase.org', '_blank');
|
|
4118
|
+
const handleClose = useSetValueCallback$1(OPEN_VALUE, () => false, [], s);
|
|
4119
|
+
const handleDock = useSetValueCallback$1(
|
|
3190
4120
|
POSITION_VALUE,
|
|
3191
4121
|
(event) => Number(event[CURRENT_TARGET].dataset.id),
|
|
3192
4122
|
[],
|
|
@@ -3194,7 +4124,11 @@ const Header = ({s}) => {
|
|
|
3194
4124
|
);
|
|
3195
4125
|
return /* @__PURE__ */ jsxs('header', {
|
|
3196
4126
|
children: [
|
|
3197
|
-
/* @__PURE__ */ jsx('img', {
|
|
4127
|
+
/* @__PURE__ */ jsx('img', {
|
|
4128
|
+
className: 'flat',
|
|
4129
|
+
title: TITLE,
|
|
4130
|
+
onClick: handleClick,
|
|
4131
|
+
}),
|
|
3198
4132
|
/* @__PURE__ */ jsx('span', {children: TITLE}),
|
|
3199
4133
|
arrayMap(POSITIONS, (name, p) =>
|
|
3200
4134
|
p == position
|
|
@@ -3209,14 +4143,18 @@ const Header = ({s}) => {
|
|
|
3209
4143
|
p,
|
|
3210
4144
|
),
|
|
3211
4145
|
),
|
|
3212
|
-
/* @__PURE__ */ jsx('img', {
|
|
4146
|
+
/* @__PURE__ */ jsx('img', {
|
|
4147
|
+
className: 'flat',
|
|
4148
|
+
onClick: handleClose,
|
|
4149
|
+
title: 'Close',
|
|
4150
|
+
}),
|
|
3213
4151
|
],
|
|
3214
4152
|
});
|
|
3215
4153
|
};
|
|
3216
4154
|
|
|
3217
4155
|
const Panel = ({s}) => {
|
|
3218
|
-
const position = useValue(POSITION_VALUE, s) ?? 1;
|
|
3219
|
-
return useValue(OPEN_VALUE, s)
|
|
4156
|
+
const position = useValue$1(POSITION_VALUE, s) ?? 1;
|
|
4157
|
+
return useValue$1(OPEN_VALUE, s)
|
|
3220
4158
|
? /* @__PURE__ */ jsxs('main', {
|
|
3221
4159
|
'data-position': position,
|
|
3222
4160
|
children: [
|
|
@@ -3232,70 +4170,237 @@ const Panel = ({s}) => {
|
|
|
3232
4170
|
var img =
|
|
3233
4171
|
"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";
|
|
3234
4172
|
|
|
3235
|
-
const
|
|
3236
|
-
const PRE_CSS = 'content:url("';
|
|
4173
|
+
const PRE_CSS = 'url("';
|
|
3237
4174
|
const POST_CSS = '")';
|
|
3238
|
-
const
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
4175
|
+
const getCssSvg = (path, color = 'white') => ({
|
|
4176
|
+
content:
|
|
4177
|
+
PRE_CSS +
|
|
4178
|
+
`data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' fill='${color}'><path d='${path}' /></svg>` +
|
|
4179
|
+
POST_CSS,
|
|
4180
|
+
});
|
|
4181
|
+
const VERTICAL_THIN = 'v560h120v-560h-120Z';
|
|
4182
|
+
const VERTICAL_THICK = 'v560h360v-560h-360Z';
|
|
4183
|
+
const HORIZONTAL_THIN = 'v120h560v-120h-560Z';
|
|
4184
|
+
const HORIZONTAL_THICK = 'v360h560v-360h-560Z';
|
|
4185
|
+
const LOGO_SVG = {content: PRE_CSS + img + POST_CSS};
|
|
3243
4186
|
const POSITIONS_SVG = arrayMap(
|
|
3244
4187
|
[
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
[30, 30, 40, 40],
|
|
4188
|
+
`M200-760${VERTICAL_THIN} M400-760${VERTICAL_THICK}`,
|
|
4189
|
+
`M200-760${HORIZONTAL_THIN} M200-560${HORIZONTAL_THICK}`,
|
|
4190
|
+
`M200-760${HORIZONTAL_THICK} M200-320${HORIZONTAL_THIN}`,
|
|
4191
|
+
`M200-760${VERTICAL_THICK} M640-760${VERTICAL_THIN}`,
|
|
3250
4192
|
],
|
|
3251
|
-
(
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
4193
|
+
(path) =>
|
|
4194
|
+
getCssSvg(
|
|
4195
|
+
'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' +
|
|
4196
|
+
path,
|
|
4197
|
+
),
|
|
4198
|
+
);
|
|
4199
|
+
arrayPush(
|
|
4200
|
+
POSITIONS_SVG,
|
|
4201
|
+
getCssSvg(
|
|
4202
|
+
'M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z',
|
|
4203
|
+
),
|
|
4204
|
+
);
|
|
4205
|
+
const CLOSE_SVG = getCssSvg(
|
|
4206
|
+
'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',
|
|
4207
|
+
);
|
|
4208
|
+
const EDIT_SVG = getCssSvg(
|
|
4209
|
+
'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',
|
|
4210
|
+
);
|
|
4211
|
+
const DONE_SVG = getCssSvg(
|
|
4212
|
+
'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',
|
|
4213
|
+
);
|
|
4214
|
+
const ADD_SVG = getCssSvg(
|
|
4215
|
+
'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',
|
|
4216
|
+
);
|
|
4217
|
+
const CLONE_SVG = getCssSvg(
|
|
4218
|
+
'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',
|
|
4219
|
+
);
|
|
4220
|
+
const DELETE_SVG = getCssSvg(
|
|
4221
|
+
'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',
|
|
4222
|
+
);
|
|
4223
|
+
const OK_SVG = getCssSvg(
|
|
4224
|
+
'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',
|
|
4225
|
+
'rgb(127,255,127)',
|
|
4226
|
+
);
|
|
4227
|
+
const OK_SVG_DISABLED = getCssSvg(
|
|
4228
|
+
'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',
|
|
4229
|
+
'rgb(255,255,127)',
|
|
4230
|
+
);
|
|
4231
|
+
const CANCEL_SVG = getCssSvg(
|
|
4232
|
+
'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',
|
|
4233
|
+
'rgb(255,127,127)',
|
|
4234
|
+
);
|
|
4235
|
+
const DOWN_SVG = getCssSvg(
|
|
4236
|
+
'M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z',
|
|
4237
|
+
);
|
|
4238
|
+
const RIGHT_SVG = getCssSvg(
|
|
4239
|
+
'M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z',
|
|
3255
4240
|
);
|
|
3256
|
-
const CLOSE_SVG = PRE + `<path d='M20 20l60 60M20 80l60-60' />` + POST;
|
|
3257
|
-
const EDIT_SVG = PRE + `<path d='${PENCIL}' />` + POST;
|
|
3258
|
-
const DONE_SVG = PRE + `<path d='${PENCIL}M20 20l60 60' />` + POST;
|
|
3259
4241
|
|
|
3260
4242
|
const SCROLLBAR = '*::-webkit-scrollbar';
|
|
4243
|
+
const BACKGROUND = 'background';
|
|
4244
|
+
const WIDTH = 'width';
|
|
4245
|
+
const MAX_WIDTH = 'max-' + WIDTH;
|
|
4246
|
+
const MIN_WIDTH = 'min-' + WIDTH;
|
|
4247
|
+
const HEIGHT = 'height';
|
|
4248
|
+
const BORDER = 'border';
|
|
4249
|
+
const BORDER_RADIUS = BORDER + '-radius';
|
|
4250
|
+
const PADDING = 'padding';
|
|
4251
|
+
const MARGIN = 'margin';
|
|
4252
|
+
const MARGIN_RIGHT = MARGIN + '-right';
|
|
4253
|
+
const TOP = 'top';
|
|
4254
|
+
const BOTTOM = 'bottom';
|
|
4255
|
+
const LEFT = 'left';
|
|
4256
|
+
const RIGHT = 'right';
|
|
4257
|
+
const COLOR = 'color';
|
|
4258
|
+
const POSITION = 'position';
|
|
4259
|
+
const BOX_SHADOW = 'box-shadow';
|
|
4260
|
+
const FONT_SIZE = 'font-size';
|
|
4261
|
+
const DISPLAY = 'display';
|
|
4262
|
+
const OVERFLOW = 'overflow';
|
|
4263
|
+
const CURSOR = 'cursor';
|
|
4264
|
+
const VERTICAL_ALIGN = 'vertical-align';
|
|
4265
|
+
const TEXT_ALIGN = 'text-align';
|
|
4266
|
+
const JUSTIFY_CONTENT = 'justify-content';
|
|
4267
|
+
const FIXED = 'fixed';
|
|
4268
|
+
const REVERT = 'revert';
|
|
4269
|
+
const UNSET = 'unset';
|
|
4270
|
+
const NONE = 'none';
|
|
4271
|
+
const FLEX = 'flex';
|
|
4272
|
+
const POINTER = 'pointer';
|
|
4273
|
+
const AUTO = 'auto';
|
|
4274
|
+
const HIDDEN = 'hidden';
|
|
4275
|
+
const NOWRAP = 'nowrap';
|
|
4276
|
+
const oklch = (lPercent, remainder = '% 0.01 ' + cssVar('hue')) =>
|
|
4277
|
+
`oklch(${lPercent}${remainder})`;
|
|
4278
|
+
const cssVar = (name) => `var(--${name})`;
|
|
4279
|
+
const rem = (...rems) => `${rems.join('rem ')}rem`;
|
|
4280
|
+
const px = (...pxs) => `${pxs.join('px ')}px`;
|
|
4281
|
+
const vw = (vw2 = 100) => `${vw2}vw`;
|
|
4282
|
+
const vh = (vh2 = 100) => `${vh2}vh`;
|
|
3261
4283
|
const APP_STYLESHEET = arrayJoin(
|
|
3262
4284
|
objToArray(
|
|
3263
4285
|
{
|
|
3264
|
-
'':
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
4286
|
+
'': {
|
|
4287
|
+
all: 'initial',
|
|
4288
|
+
[FONT_SIZE]: rem(0.75),
|
|
4289
|
+
[POSITION]: FIXED,
|
|
4290
|
+
'font-family': 'inter,sans-serif',
|
|
4291
|
+
'z-index': 999999,
|
|
4292
|
+
'--bg': oklch(20),
|
|
4293
|
+
'--bg2': oklch(15),
|
|
4294
|
+
'--bg3': oklch(25),
|
|
4295
|
+
'--bg4': oklch(30),
|
|
4296
|
+
'--fg': oklch(85),
|
|
4297
|
+
'--fg2': oklch(60),
|
|
4298
|
+
['--' + BORDER]: px(1) + ' solid ' + cssVar('bg4'),
|
|
4299
|
+
['--' + BOX_SHADOW]: px(0, 1, 2, 0) + ' #0007',
|
|
4300
|
+
},
|
|
4301
|
+
'*': {all: REVERT},
|
|
4302
|
+
'*::before': {all: REVERT},
|
|
4303
|
+
'*::after': {all: REVERT},
|
|
4304
|
+
[SCROLLBAR]: {[WIDTH]: rem(0.5), [HEIGHT]: rem(0.5)},
|
|
4305
|
+
[SCROLLBAR + '-thumb']: {[BACKGROUND]: cssVar('bg4')},
|
|
4306
|
+
[SCROLLBAR + '-thumb:hover']: {[BACKGROUND]: cssVar('bg4')},
|
|
4307
|
+
[SCROLLBAR + '-corner']: {[BACKGROUND]: NONE},
|
|
4308
|
+
[SCROLLBAR + '-track']: {[BACKGROUND]: NONE},
|
|
4309
|
+
img: {
|
|
4310
|
+
[WIDTH]: rem(0.8),
|
|
4311
|
+
[HEIGHT]: rem(0.8),
|
|
4312
|
+
[VERTICAL_ALIGN]: 'text-' + BOTTOM,
|
|
4313
|
+
[CURSOR]: POINTER,
|
|
4314
|
+
[MARGIN]: px(-2.5, 2, -2.5, 0),
|
|
4315
|
+
[PADDING]: px(2),
|
|
4316
|
+
[BORDER]: cssVar(BORDER),
|
|
4317
|
+
[BACKGROUND]: cssVar('bg3'),
|
|
4318
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
4319
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
4320
|
+
},
|
|
4321
|
+
'img.flat': {[BORDER]: NONE, [BACKGROUND]: NONE, [BOX_SHADOW]: NONE},
|
|
3274
4322
|
// Nub
|
|
3275
|
-
'>img':
|
|
4323
|
+
'>img': {
|
|
4324
|
+
[PADDING]: rem(0.25),
|
|
4325
|
+
[BOTTOM]: 0,
|
|
4326
|
+
[RIGHT]: 0,
|
|
4327
|
+
[POSITION]: FIXED,
|
|
4328
|
+
[HEIGHT]: UNSET,
|
|
4329
|
+
[MARGIN]: 0,
|
|
4330
|
+
...LOGO_SVG,
|
|
4331
|
+
},
|
|
3276
4332
|
...objNew(
|
|
3277
|
-
arrayMap(
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
4333
|
+
arrayMap(
|
|
4334
|
+
[
|
|
4335
|
+
{[BOTTOM]: 0, [LEFT]: 0},
|
|
4336
|
+
{[TOP]: 0, [RIGHT]: 0},
|
|
4337
|
+
],
|
|
4338
|
+
(css, p) => [`>img[data-position='${p}']`, css],
|
|
4339
|
+
),
|
|
3281
4340
|
),
|
|
3282
4341
|
// Panel
|
|
3283
|
-
main:
|
|
4342
|
+
main: {
|
|
4343
|
+
[DISPLAY]: FLEX,
|
|
4344
|
+
[COLOR]: cssVar('fg'),
|
|
4345
|
+
[BACKGROUND]: cssVar('bg'),
|
|
4346
|
+
[OVERFLOW]: HIDDEN,
|
|
4347
|
+
[POSITION]: FIXED,
|
|
4348
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
4349
|
+
'flex-direction': 'column',
|
|
4350
|
+
},
|
|
3284
4351
|
...objNew(
|
|
3285
4352
|
arrayMap(
|
|
3286
4353
|
[
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
4354
|
+
{
|
|
4355
|
+
[BOTTOM]: 0,
|
|
4356
|
+
[LEFT]: 0,
|
|
4357
|
+
[WIDTH]: vw(35),
|
|
4358
|
+
[HEIGHT]: vh(),
|
|
4359
|
+
[BORDER + '-' + RIGHT]: cssVar(BORDER),
|
|
4360
|
+
},
|
|
4361
|
+
{
|
|
4362
|
+
[TOP]: 0,
|
|
4363
|
+
[RIGHT]: 0,
|
|
4364
|
+
[WIDTH]: vw(),
|
|
4365
|
+
[HEIGHT]: vh(30),
|
|
4366
|
+
[BORDER + '-' + BOTTOM]: cssVar(BORDER),
|
|
4367
|
+
},
|
|
4368
|
+
{
|
|
4369
|
+
[BOTTOM]: 0,
|
|
4370
|
+
[LEFT]: 0,
|
|
4371
|
+
[WIDTH]: vw(),
|
|
4372
|
+
[HEIGHT]: vh(30),
|
|
4373
|
+
[BORDER + '-' + TOP]: cssVar(BORDER),
|
|
4374
|
+
},
|
|
4375
|
+
{
|
|
4376
|
+
[TOP]: 0,
|
|
4377
|
+
[RIGHT]: 0,
|
|
4378
|
+
[WIDTH]: vw(35),
|
|
4379
|
+
[HEIGHT]: vh(),
|
|
4380
|
+
[BORDER + '-' + LEFT]: cssVar(BORDER),
|
|
4381
|
+
},
|
|
4382
|
+
{[TOP]: 0, [RIGHT]: 0, [WIDTH]: vw(), [HEIGHT]: vh()},
|
|
3292
4383
|
],
|
|
3293
4384
|
(css, p) => [`main[data-position='${p}']`, css],
|
|
3294
4385
|
),
|
|
3295
4386
|
),
|
|
3296
4387
|
// Header
|
|
3297
|
-
header:
|
|
3298
|
-
|
|
4388
|
+
header: {
|
|
4389
|
+
[DISPLAY]: FLEX,
|
|
4390
|
+
[PADDING]: rem(0.5),
|
|
4391
|
+
[BOX_SHADOW]: cssVar(BOX_SHADOW),
|
|
4392
|
+
[BACKGROUND]: oklch(30, '% 0.008 var(--hue) / .5'),
|
|
4393
|
+
[WIDTH]: 'calc(100% - .5rem)',
|
|
4394
|
+
[POSITION]: 'absolute',
|
|
4395
|
+
[BORDER + '-' + BOTTOM]: cssVar(BORDER),
|
|
4396
|
+
'align-items': 'center',
|
|
4397
|
+
'backdrop-filter': 'blur(4px)',
|
|
4398
|
+
},
|
|
4399
|
+
'header>img:nth-of-type(1)': {
|
|
4400
|
+
[HEIGHT]: rem(1),
|
|
4401
|
+
[WIDTH]: rem(1),
|
|
4402
|
+
...LOGO_SVG,
|
|
4403
|
+
},
|
|
3299
4404
|
'header>img:nth-of-type(6)': CLOSE_SVG,
|
|
3300
4405
|
...objNew(
|
|
3301
4406
|
arrayMap(POSITIONS_SVG, (SVG, p) => [
|
|
@@ -3303,42 +4408,140 @@ const APP_STYLESHEET = arrayJoin(
|
|
|
3303
4408
|
SVG,
|
|
3304
4409
|
]),
|
|
3305
4410
|
),
|
|
3306
|
-
'header>span':
|
|
3307
|
-
|
|
4411
|
+
'header>span': {
|
|
4412
|
+
[OVERFLOW]: HIDDEN,
|
|
4413
|
+
[FLEX]: 1,
|
|
4414
|
+
'font-weight': 800,
|
|
4415
|
+
'white-space': NOWRAP,
|
|
4416
|
+
'text-overflow': 'ellipsis',
|
|
4417
|
+
},
|
|
3308
4418
|
// Body
|
|
3309
|
-
article:
|
|
3310
|
-
details:
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
4419
|
+
article: {[OVERFLOW]: AUTO, [FLEX]: 1, [PADDING + '-' + TOP]: rem(2)},
|
|
4420
|
+
details: {
|
|
4421
|
+
[MARGIN]: rem(0.5),
|
|
4422
|
+
[BORDER]: cssVar(BORDER),
|
|
4423
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
4424
|
+
},
|
|
4425
|
+
summary: {
|
|
4426
|
+
[BACKGROUND]: cssVar('bg3'),
|
|
4427
|
+
[MARGIN]: px(-1),
|
|
4428
|
+
[BORDER]: cssVar(BORDER),
|
|
4429
|
+
[PADDING]: rem(0.25, 0.125),
|
|
4430
|
+
[DISPLAY]: FLEX,
|
|
4431
|
+
[BORDER_RADIUS]: rem(0.25),
|
|
4432
|
+
'user-select': NONE,
|
|
4433
|
+
[JUSTIFY_CONTENT]: 'space-between',
|
|
4434
|
+
'align-items': 'center',
|
|
4435
|
+
},
|
|
4436
|
+
'summary>span::before': {
|
|
4437
|
+
[DISPLAY]: 'inline-block',
|
|
4438
|
+
[VERTICAL_ALIGN]: 'sub',
|
|
4439
|
+
[MARGIN]: px(2),
|
|
4440
|
+
[WIDTH]: rem(1),
|
|
4441
|
+
[HEIGHT]: rem(1),
|
|
4442
|
+
...RIGHT_SVG,
|
|
4443
|
+
},
|
|
4444
|
+
'details[open]>summary': {
|
|
4445
|
+
'border-bottom-left-radius': 0,
|
|
4446
|
+
'border-bottom-right-radius': 0,
|
|
4447
|
+
[MARGIN + '-' + BOTTOM]: 0,
|
|
4448
|
+
},
|
|
4449
|
+
'details[open]>summary>span::before': DOWN_SVG,
|
|
4450
|
+
'details>summary img': {[DISPLAY]: NONE},
|
|
4451
|
+
'details[open]>summary img': {
|
|
4452
|
+
[DISPLAY]: UNSET,
|
|
4453
|
+
[MARGIN + '-' + LEFT]: rem(0.25),
|
|
4454
|
+
},
|
|
4455
|
+
'details>div': {[OVERFLOW]: AUTO},
|
|
4456
|
+
caption: {
|
|
4457
|
+
[COLOR]: cssVar('fg2'),
|
|
4458
|
+
[PADDING]: rem(0.25, 0.5),
|
|
4459
|
+
[TEXT_ALIGN]: LEFT,
|
|
4460
|
+
'white-space': NOWRAP,
|
|
4461
|
+
},
|
|
4462
|
+
'caption button': {
|
|
4463
|
+
[WIDTH]: rem(1.5),
|
|
4464
|
+
[BORDER]: NONE,
|
|
4465
|
+
[BACKGROUND]: NONE,
|
|
4466
|
+
[COLOR]: cssVar('fg'),
|
|
4467
|
+
[PADDING]: 0,
|
|
4468
|
+
[CURSOR]: POINTER,
|
|
4469
|
+
},
|
|
4470
|
+
'caption button[disabled]': {[COLOR]: cssVar('fg2')},
|
|
4471
|
+
'.actions': {
|
|
4472
|
+
[PADDING]: rem(0.75, 0.5),
|
|
4473
|
+
[MARGIN]: 0,
|
|
4474
|
+
[DISPLAY]: FLEX,
|
|
4475
|
+
[BORDER + '-' + TOP]: cssVar(BORDER),
|
|
4476
|
+
[JUSTIFY_CONTENT]: 'space-between',
|
|
4477
|
+
},
|
|
3318
4478
|
// tables
|
|
3319
|
-
table:
|
|
3320
|
-
|
|
3321
|
-
'
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
'
|
|
4479
|
+
table: {
|
|
4480
|
+
[MIN_WIDTH]: '100%',
|
|
4481
|
+
'border-collapse': 'collapse',
|
|
4482
|
+
'table-layout': FIXED,
|
|
4483
|
+
},
|
|
4484
|
+
thead: {[BACKGROUND]: cssVar('bg')},
|
|
4485
|
+
[`th,#${UNIQUE_ID} td`]: {
|
|
4486
|
+
[OVERFLOW]: HIDDEN,
|
|
4487
|
+
[PADDING]: rem(0.25, 0.5),
|
|
4488
|
+
[MAX_WIDTH]: rem(20),
|
|
4489
|
+
[BORDER]: cssVar(BORDER),
|
|
4490
|
+
'text-overflow': 'ellipsis',
|
|
4491
|
+
'white-space': NOWRAP,
|
|
4492
|
+
'border-width': px(1, 0, 0),
|
|
4493
|
+
[TEXT_ALIGN]: LEFT,
|
|
4494
|
+
},
|
|
4495
|
+
'th:first-child': {
|
|
4496
|
+
[WIDTH]: rem(3),
|
|
4497
|
+
[MIN_WIDTH]: rem(3),
|
|
4498
|
+
[MAX_WIDTH]: rem(3),
|
|
4499
|
+
},
|
|
4500
|
+
'th.sorted': {[BACKGROUND]: cssVar('bg3')},
|
|
4501
|
+
'td.extra': {[TEXT_ALIGN]: RIGHT},
|
|
4502
|
+
'tbody button': {
|
|
4503
|
+
[BACKGROUND]: NONE,
|
|
4504
|
+
[BORDER]: NONE,
|
|
4505
|
+
[FONT_SIZE]: 0,
|
|
4506
|
+
[WIDTH]: rem(0.8),
|
|
4507
|
+
[HEIGHT]: rem(0.8),
|
|
4508
|
+
[COLOR]: cssVar('fg2'),
|
|
4509
|
+
[MARGIN]: rem(0, 0.25, 0, -0.25),
|
|
4510
|
+
'line-height': rem(0.8),
|
|
4511
|
+
},
|
|
4512
|
+
'tbody button:first-letter': {[FONT_SIZE]: rem(0.8)},
|
|
4513
|
+
input: {
|
|
4514
|
+
[BACKGROUND]: cssVar('bg2'),
|
|
4515
|
+
[COLOR]: UNSET,
|
|
4516
|
+
[PADDING]: px(4),
|
|
4517
|
+
[BORDER]: 0,
|
|
4518
|
+
[MARGIN]: px(-4, 0),
|
|
4519
|
+
[FONT_SIZE]: UNSET,
|
|
4520
|
+
[MAX_WIDTH]: rem(6),
|
|
4521
|
+
},
|
|
4522
|
+
'input:focus': {'outline-width': 0},
|
|
4523
|
+
'input[type="number"]': {[WIDTH]: rem(3)},
|
|
4524
|
+
'input[type="checkbox"]': {[VERTICAL_ALIGN]: px(-2)},
|
|
4525
|
+
'.editableCell': {[DISPLAY]: 'inline-block', [MARGIN_RIGHT]: px(2)},
|
|
4526
|
+
'button.next': {[MARGIN_RIGHT]: rem(0.5)},
|
|
4527
|
+
'img.edit': EDIT_SVG,
|
|
4528
|
+
'img.done': DONE_SVG,
|
|
4529
|
+
'img.add': ADD_SVG,
|
|
4530
|
+
'img.clone': CLONE_SVG,
|
|
4531
|
+
'img.delete': DELETE_SVG,
|
|
4532
|
+
'img.ok': OK_SVG,
|
|
4533
|
+
'img.okDis': OK_SVG_DISABLED,
|
|
4534
|
+
'img.cancel': CANCEL_SVG,
|
|
4535
|
+
'span.warn': {[MARGIN]: rem(2, 0.25), [COLOR]: '#d81b60'},
|
|
3336
4536
|
},
|
|
3337
|
-
(style, selector) =>
|
|
4537
|
+
(style, selector) =>
|
|
4538
|
+
`#${UNIQUE_ID} ${selector}{${arrayJoin(
|
|
4539
|
+
objToArray(style, (value, property) => `${property}:${value};`),
|
|
4540
|
+
)}}`,
|
|
3338
4541
|
),
|
|
3339
4542
|
);
|
|
3340
4543
|
|
|
3341
|
-
const Inspector = ({position = 'right', open = false}) => {
|
|
4544
|
+
const Inspector = ({position = 'right', open = false, hue = 270}) => {
|
|
3342
4545
|
const s = useCreateStore(createStore);
|
|
3343
4546
|
const index = POSITIONS.indexOf(position);
|
|
3344
4547
|
useCreatePersister(
|
|
@@ -3365,7 +4568,9 @@ const Inspector = ({position = 'right', open = false}) => {
|
|
|
3365
4568
|
/* @__PURE__ */ jsx(Panel, {s}),
|
|
3366
4569
|
],
|
|
3367
4570
|
}),
|
|
3368
|
-
/* @__PURE__ */
|
|
4571
|
+
/* @__PURE__ */ jsxs('style', {
|
|
4572
|
+
children: [`#${UNIQUE_ID}{--hue:${hue}}`, APP_STYLESHEET],
|
|
4573
|
+
}),
|
|
3369
4574
|
],
|
|
3370
4575
|
});
|
|
3371
4576
|
};
|