@medyll/idae-machine 0.135.2 → 0.136.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +555 -360
- package/cli.cjs +22 -0
- package/dist/__fixtures__/demoModel.d.ts +79 -0
- package/dist/__fixtures__/demoModel.js +146 -0
- package/dist/ai/frame/AiChatSession.svelte +152 -0
- package/dist/ai/frame/AiChatSession.svelte.d.ts +7 -0
- package/dist/ai/frame/index.d.ts +1 -0
- package/dist/ai/frame/index.js +2 -0
- package/dist/ai/index.d.ts +9 -0
- package/dist/ai/index.js +12 -0
- package/dist/ai/schema/ai-catalogs.d.ts +2 -0
- package/dist/ai/schema/ai-catalogs.js +86 -0
- package/dist/ai/schema/ai-chat-session.d.ts +2 -0
- package/dist/ai/schema/ai-chat-session.js +35 -0
- package/dist/ai/schema/ai-companion.d.ts +2 -0
- package/dist/ai/schema/ai-companion.js +25 -0
- package/dist/ai/schema/ai-message.d.ts +2 -0
- package/dist/ai/schema/ai-message.js +20 -0
- package/dist/ai/schema/ai-tool-call.d.ts +2 -0
- package/dist/ai/schema/ai-tool-call.js +18 -0
- package/dist/ai/schema/ai-user-prompt.d.ts +2 -0
- package/dist/ai/schema/ai-user-prompt.js +17 -0
- package/dist/ai/schema/tag.d.ts +2 -0
- package/dist/ai/schema/tag.js +14 -0
- package/dist/ai/streamIntoRecord.d.ts +31 -0
- package/dist/ai/streamIntoRecord.js +79 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +19 -0
- package/dist/data-ui/controls/AlphabetFilter.svelte +114 -0
- package/dist/data-ui/controls/AlphabetFilter.svelte.d.ts +10 -0
- package/dist/data-ui/controls/ButtonAction.svelte +151 -0
- package/dist/data-ui/controls/ButtonAction.svelte.d.ts +18 -0
- package/dist/data-ui/controls/DataFind.svelte +174 -0
- package/dist/data-ui/controls/DataFind.svelte.d.ts +10 -0
- package/dist/data-ui/controls/DataGroup.svelte +150 -0
- package/dist/data-ui/controls/DataGroup.svelte.d.ts +7 -0
- package/dist/data-ui/controls/DataSort.svelte +78 -0
- package/dist/data-ui/controls/DataSort.svelte.d.ts +9 -0
- package/dist/data-ui/controls/DataToolbar.svelte +67 -0
- package/dist/data-ui/controls/DataToolbar.svelte.d.ts +11 -0
- package/dist/data-ui/controls/Find.svelte +38 -0
- package/dist/data-ui/controls/Find.svelte.d.ts +9 -0
- package/dist/data-ui/controls/FkFilter.svelte +94 -0
- package/dist/data-ui/controls/FkFilter.svelte.d.ts +11 -0
- package/dist/data-ui/controls/Group.svelte +36 -0
- package/dist/data-ui/controls/Group.svelte.d.ts +8 -0
- package/dist/data-ui/controls/ListMode.svelte +79 -0
- package/dist/data-ui/controls/ListMode.svelte.d.ts +10 -0
- package/dist/data-ui/controls/Sort.svelte +100 -0
- package/dist/data-ui/controls/Sort.svelte.d.ts +8 -0
- package/dist/data-ui/data/DataCount.svelte +67 -0
- package/dist/data-ui/data/DataCount.svelte.d.ts +36 -0
- package/dist/data-ui/data/DataFk.svelte +54 -0
- package/dist/data-ui/data/DataFk.svelte.d.ts +11 -0
- package/dist/data-ui/data/DataForm.svelte +191 -0
- package/dist/data-ui/data/DataForm.svelte.d.ts +15 -0
- package/dist/data-ui/data/DataList.svelte +645 -0
- package/dist/data-ui/data/DataList.svelte.d.ts +75 -0
- package/dist/data-ui/data/DataListFk.svelte +111 -0
- package/dist/data-ui/data/DataListFk.svelte.d.ts +13 -0
- package/dist/data-ui/data/DataListRfk.svelte +111 -0
- package/dist/data-ui/data/DataListRfk.svelte.d.ts +13 -0
- package/dist/data-ui/data/DataRecord.svelte +167 -0
- package/dist/data-ui/data/DataRecord.svelte.d.ts +22 -0
- package/dist/data-ui/data/DataRfk.svelte +73 -0
- package/dist/data-ui/data/DataRfk.svelte.d.ts +15 -0
- package/dist/data-ui/data/index.d.ts +7 -0
- package/dist/data-ui/data/index.js +8 -0
- package/dist/data-ui/field/DataField.svelte +343 -0
- package/dist/data-ui/field/DataField.svelte.d.ts +33 -0
- package/dist/{form/FieldInPlace.svelte → data-ui/field/DataFieldEdit.svelte} +103 -98
- package/dist/{form/FieldInPlace.svelte.d.ts → data-ui/field/DataFieldEdit.svelte.d.ts} +5 -5
- package/dist/data-ui/field/index.d.ts +2 -0
- package/dist/data-ui/field/index.js +3 -0
- package/dist/data-ui/field/snippets/FieldAiPrompt.svelte +145 -0
- package/dist/data-ui/field/snippets/FieldAiPrompt.svelte.d.ts +14 -0
- package/dist/data-ui/field/snippets/FieldBoolean.svelte +43 -0
- package/dist/data-ui/field/snippets/FieldBoolean.svelte.d.ts +12 -0
- package/dist/data-ui/field/snippets/FieldColor.svelte +48 -0
- package/dist/data-ui/field/snippets/FieldColor.svelte.d.ts +10 -0
- package/dist/data-ui/field/snippets/FieldCurrency.svelte +105 -0
- package/dist/data-ui/field/snippets/FieldCurrency.svelte.d.ts +15 -0
- package/dist/data-ui/field/snippets/FieldEmail.svelte +77 -0
- package/dist/data-ui/field/snippets/FieldEmail.svelte.d.ts +14 -0
- package/dist/data-ui/field/snippets/FieldIcon.svelte +73 -0
- package/dist/data-ui/field/snippets/FieldIcon.svelte.d.ts +11 -0
- package/dist/data-ui/field/snippets/FieldSelect.svelte +71 -0
- package/dist/data-ui/field/snippets/FieldSelect.svelte.d.ts +15 -0
- package/dist/data-ui/field/snippets/FieldText.svelte +52 -0
- package/dist/data-ui/field/snippets/FieldText.svelte.d.ts +13 -0
- package/dist/data-ui/field/snippets/FieldTextarea.svelte +50 -0
- package/dist/data-ui/field/snippets/FieldTextarea.svelte.d.ts +13 -0
- package/dist/data-ui/field/snippets/index.d.ts +9 -0
- package/dist/data-ui/field/snippets/index.js +10 -0
- package/dist/data-ui/fragments/ContextMenu.svelte +109 -0
- package/dist/data-ui/fragments/ContextMenu.svelte.d.ts +4 -0
- package/dist/data-ui/fragments/ContextMenuContent.svelte +275 -0
- package/dist/data-ui/fragments/ContextMenuContent.svelte.d.ts +8 -0
- package/dist/data-ui/fragments/Frame.svelte +43 -0
- package/dist/data-ui/fragments/Frame.svelte.d.ts +10 -0
- package/dist/data-ui/fragments/InfoLine.svelte +123 -0
- package/dist/data-ui/fragments/InfoLine.svelte.d.ts +12 -0
- package/dist/data-ui/fragments/Selector.svelte +56 -0
- package/dist/data-ui/fragments/Selector.svelte.d.ts +10 -0
- package/dist/{fragments → data-ui/fragments}/Skeleton.svelte +21 -21
- package/dist/data-ui/fragments/Tile.svelte +126 -0
- package/dist/data-ui/fragments/Tile.svelte.d.ts +14 -0
- package/dist/data-ui/fragments/contextMenu.svelte.d.ts +22 -0
- package/dist/data-ui/fragments/contextMenu.svelte.js +31 -0
- package/dist/data-ui/fragments/dialog/Dialog.svelte +185 -0
- package/dist/data-ui/fragments/dialog/Dialog.svelte.d.ts +29 -0
- package/dist/data-ui/fragments/dialog/dialog.svelte.d.ts +27 -0
- package/dist/data-ui/fragments/dialog/dialog.svelte.js +41 -0
- package/dist/data-ui/fragments/index.d.ts +11 -0
- package/dist/data-ui/fragments/index.js +11 -0
- package/dist/data-ui/utils/__tests__/HostProbe.svelte +18 -0
- package/dist/data-ui/utils/__tests__/HostProbe.svelte.d.ts +8 -0
- package/dist/data-ui/utils/data-utils.d.ts +29 -0
- package/dist/data-ui/utils/data-utils.js +83 -0
- package/dist/data-ui/utils/dataRelationUtils.d.ts +37 -0
- package/dist/data-ui/utils/dataRelationUtils.js +125 -0
- package/dist/data-ui/utils/diagramUtils.d.ts +6 -0
- package/dist/data-ui/utils/diagramUtils.js +131 -0
- package/dist/data-ui/utils/draggable.d.ts +15 -0
- package/dist/data-ui/utils/draggable.js +61 -0
- package/dist/data-ui/utils/menuPrefs.d.ts +80 -0
- package/dist/data-ui/utils/menuPrefs.js +119 -0
- package/dist/data-ui/utils/useMachinePrefs.svelte.d.ts +38 -0
- package/dist/data-ui/utils/useMachinePrefs.svelte.js +117 -0
- package/dist/data-ui/utils/useMenuTree.svelte.d.ts +26 -0
- package/dist/data-ui/utils/useMenuTree.svelte.js +68 -0
- package/dist/data-ui/utils/useRecordData.svelte.d.ts +22 -0
- package/dist/data-ui/utils/useRecordData.svelte.js +50 -0
- package/dist/data-ui/utils/useViewFields.svelte.d.ts +22 -0
- package/dist/data-ui/utils/useViewFields.svelte.js +59 -0
- package/dist/demo/.gitkeep +0 -0
- package/dist/demo/demo-status.json +9 -0
- package/dist/idae/boot.d.ts +28 -0
- package/dist/idae/boot.js +43 -0
- package/dist/idae/bridge/register.d.ts +4 -0
- package/dist/idae/bridge/register.js +15 -0
- package/dist/idae/capabilities/Capabilities.d.ts +10 -0
- package/dist/idae/capabilities/Capabilities.js +34 -0
- package/dist/idae/codefield/CodeFieldConvention.d.ts +3 -0
- package/dist/idae/codefield/CodeFieldConvention.js +25 -0
- package/dist/idae/fieldcatalog/defaultFieldTypesDef.d.ts +2 -0
- package/dist/idae/fieldcatalog/defaultFieldTypesDef.js +104 -0
- package/dist/idae/frames/FrameCatalog.d.ts +31 -0
- package/dist/idae/frames/FrameCatalog.js +31 -0
- package/dist/idae/index.d.ts +14 -0
- package/dist/idae/index.js +13 -0
- package/dist/idae/menu/IdaeMenuManager.d.ts +79 -0
- package/dist/idae/menu/IdaeMenuManager.js +108 -0
- package/dist/idae/menu/IdaeMenuStore.d.ts +77 -0
- package/dist/idae/menu/IdaeMenuStore.js +68 -0
- package/dist/idae/menu/menuSnapshot.d.ts +30 -0
- package/dist/idae/menu/menuSnapshot.js +30 -0
- package/dist/idae/meta/MetaModelProvider.d.ts +11 -0
- package/dist/idae/meta/MetaModelProvider.js +43 -0
- package/dist/idae/relations/RelationPolicy.d.ts +19 -0
- package/dist/idae/relations/RelationPolicy.js +125 -0
- package/dist/idae/rights/RightsPolicy.d.ts +16 -0
- package/dist/idae/rights/RightsPolicy.js +80 -0
- package/dist/idae/userscope/UserScopePolicy.d.ts +9 -0
- package/dist/idae/userscope/UserScopePolicy.js +42 -0
- package/dist/idae/userscope/navTracking.d.ts +11 -0
- package/dist/idae/userscope/navTracking.js +15 -0
- package/dist/index.d.ts +68 -35
- package/dist/index.js +82 -36
- package/dist/main/__tests__/_relationTestUtils.d.ts +12 -0
- package/dist/main/__tests__/_relationTestUtils.js +53 -0
- package/dist/main/__tests__/helpers/mockCollection.d.ts +21 -0
- package/dist/main/__tests__/helpers/mockCollection.js +27 -0
- package/dist/main/api/types.d.ts +29 -0
- package/dist/main/ext/hooks.d.ts +32 -0
- package/dist/main/ext/hooks.js +31 -0
- package/dist/main/ext/interfaces.d.ts +69 -0
- package/dist/main/ext/interfaces.js +3 -0
- package/dist/main/ext/registry.d.ts +29 -0
- package/dist/main/ext/registry.js +30 -0
- package/dist/main/frame/MachineFrameManager.d.ts +187 -0
- package/dist/main/frame/MachineFrameManager.js +403 -0
- package/dist/main/frame/contextMenuSetup.d.ts +9 -0
- package/dist/main/frame/contextMenuSetup.js +42 -0
- package/dist/main/frame/frameUrl.d.ts +1 -0
- package/dist/main/frame/frameUrl.js +8 -0
- package/dist/main/frame/frameUtils.d.ts +16 -0
- package/dist/main/frame/frameUtils.js +26 -0
- package/dist/main/frame/linkParser.d.ts +9 -0
- package/dist/main/frame/linkParser.js +15 -0
- package/dist/main/index.d.ts +15 -0
- package/dist/main/index.js +19 -0
- package/dist/main/machine/MachineAction.d.ts +62 -0
- package/dist/main/machine/MachineAction.js +96 -0
- package/dist/main/machine/MachineError.js +2 -2
- package/dist/main/machine/MachineFieldType.d.ts +25 -6
- package/dist/main/machine/MachineFieldType.js +118 -27
- package/dist/main/machine/MachineFkFold.d.ts +34 -0
- package/dist/main/machine/MachineFkFold.js +57 -0
- package/dist/main/machine/MachineRecordIdentity.d.ts +26 -0
- package/dist/main/machine/MachineRecordIdentity.js +44 -0
- package/dist/main/machine/MachineRights.d.ts +50 -0
- package/dist/main/machine/MachineRights.js +133 -0
- package/dist/main/machine/MachineRouter.d.ts +56 -0
- package/dist/main/machine/MachineRouter.js +250 -0
- package/dist/main/machine/MachineScheme.d.ts +40 -70
- package/dist/main/machine/MachineScheme.js +107 -94
- package/dist/main/machine/MachineSchemeField.js +32 -16
- package/dist/main/machine/MachineSchemeFieldForge.d.ts +11 -11
- package/dist/main/machine/MachineSchemeFieldForge.js +33 -21
- package/dist/main/machine/MachineSchemeFieldValues.d.ts +8 -9
- package/dist/main/machine/MachineSchemeFieldValues.js +12 -9
- package/dist/main/machine/MachineSchemeValidate.d.ts +69 -13
- package/dist/main/machine/MachineSchemeValidate.js +173 -46
- package/dist/main/machine/MachineSchemeValues.d.ts +32 -21
- package/dist/main/machine/MachineSchemeValues.js +132 -104
- package/dist/main/machine/SchemeFieldDefaultValues.d.ts +4 -2
- package/dist/main/machine/SchemeFieldDefaultValues.js +8 -2
- package/dist/main/machine/authState.svelte.d.ts +11 -0
- package/dist/main/machine/authState.svelte.js +17 -0
- package/dist/main/machine/fieldBuilder.d.ts +23 -0
- package/dist/main/machine/fieldBuilder.d.ts.map +1 -0
- package/dist/main/machine/fieldBuilder.js +10 -0
- package/dist/main/machine/fieldBuilder.js.map +1 -0
- package/dist/main/machine/machineLabel.d.ts +11 -0
- package/dist/main/machine/machineLabel.js +23 -0
- package/dist/main/machine/validateRules.d.ts +38 -0
- package/dist/main/machine/validateRules.js +109 -0
- package/dist/main/machine.d.ts +207 -68
- package/dist/main/machine.js +482 -96
- package/dist/main/machineDb.d.ts +21 -8
- package/dist/main/machineDb.js +33 -4
- package/dist/main/machineIdbAdapter.d.ts +83 -0
- package/dist/main/machineIdbAdapter.js +347 -0
- package/dist/main/machineModelBuilder.d.ts +31 -0
- package/dist/main/machineModelBuilder.js +58 -0
- package/dist/main/machineParserForge.d.ts +9 -18
- package/dist/main/machineParserForge.js +92 -35
- package/dist/main/machineSchemaCache.d.ts +8 -0
- package/dist/main/machineSchemaCache.js +58 -0
- package/dist/main/machineSchemaDoctor.d.ts +17 -0
- package/dist/main/machineSchemaDoctor.js +73 -0
- package/dist/main/machineSchemaLoader.d.ts +18 -0
- package/dist/main/machineSchemaLoader.js +43 -0
- package/dist/main/machineSeed.d.ts +21 -0
- package/dist/main/machineSeed.js +44 -0
- package/dist/main/router/componentRegistry.d.ts +35 -0
- package/dist/main/router/componentRegistry.js +35 -0
- package/dist/main/router/urlParser.d.ts +17 -0
- package/dist/main/router/urlParser.js +41 -0
- package/dist/main/warmupUtils.d.ts +40 -0
- package/dist/main/warmupUtils.js +73 -0
- package/dist/mcp/MachineMcpClient.d.ts +43 -0
- package/dist/mcp/MachineMcpClient.js +175 -0
- package/dist/shell/Frame.svelte +67 -0
- package/dist/shell/Frame.svelte.d.ts +11 -0
- package/dist/shell/auth/Login.svelte +244 -0
- package/dist/shell/auth/Login.svelte.d.ts +3 -0
- package/dist/shell/frame/dashboard/Dashboard.svelte +0 -0
- package/dist/shell/frame/dashboard/Dashboard.svelte.d.ts +26 -0
- package/dist/shell/frame/diagram/Diagram.svelte +244 -0
- package/dist/shell/frame/diagram/Diagram.svelte.d.ts +9 -0
- package/dist/shell/frame/explorer/Explorer.svelte +86 -0
- package/dist/shell/frame/explorer/Explorer.svelte.d.ts +29 -0
- package/dist/shell/frame/explorer/ExplorerContent.svelte +126 -0
- package/dist/shell/frame/explorer/ExplorerContent.svelte.d.ts +32 -0
- package/dist/shell/frame/index.d.ts +8 -0
- package/dist/shell/frame/index.js +9 -0
- package/dist/shell/frame/main-menu-content/MainMenuContent.svelte +100 -0
- package/dist/shell/frame/main-menu-content/MainMenuContent.svelte.d.ts +6 -0
- package/dist/shell/frame/planning/Planning.svelte +426 -0
- package/dist/shell/frame/planning/Planning.svelte.d.ts +12 -0
- package/dist/shell/frame/rbac/RbacMatrix.svelte +197 -0
- package/dist/shell/frame/rbac/RbacMatrix.svelte.d.ts +7 -0
- package/dist/shell/frame/space/Space.svelte +554 -0
- package/dist/shell/frame/space/Space.svelte.d.ts +8 -0
- package/dist/shell/frame/synthesis/Synthesis.svelte +383 -0
- package/dist/shell/frame/synthesis/Synthesis.svelte.d.ts +8 -0
- package/dist/shell/frame/today/Today.svelte +174 -0
- package/dist/shell/frame/today/Today.svelte.d.ts +3 -0
- package/dist/shell/layout/App.svelte +30 -0
- package/dist/shell/layout/App.svelte.d.ts +3 -0
- package/dist/shell/layout/Breadcrumb.svelte +67 -0
- package/dist/shell/layout/Breadcrumb.svelte.d.ts +12 -0
- package/dist/shell/layout/Columner.svelte +214 -0
- package/dist/shell/layout/Columner.svelte.d.ts +16 -0
- package/dist/shell/layout/DevResetPanel.svelte +194 -0
- package/dist/shell/layout/DevResetPanel.svelte.d.ts +7 -0
- package/dist/shell/layout/Fiche.svelte +111 -0
- package/dist/shell/layout/Fiche.svelte.d.ts +7 -0
- package/dist/shell/layout/FicheUpdate.svelte +53 -0
- package/dist/shell/layout/FicheUpdate.svelte.d.ts +7 -0
- package/dist/shell/layout/MainMenu.svelte +256 -0
- package/dist/shell/layout/MainMenu.svelte.d.ts +6 -0
- package/dist/shell/layout/MenuSettings.svelte +182 -0
- package/dist/shell/layout/MenuSettings.svelte.d.ts +6 -0
- package/dist/shell/layout/RecordTimeline.svelte +199 -0
- package/dist/shell/layout/RecordTimeline.svelte.d.ts +8 -0
- package/dist/shell/layout/RecordToolbar.svelte +39 -0
- package/dist/shell/layout/RecordToolbar.svelte.d.ts +7 -0
- package/dist/shell/layout/TaskBar.svelte +118 -0
- package/dist/shell/layout/TaskBar.svelte.d.ts +7 -0
- package/dist/shell/layout/TemplateShell.svelte +48 -0
- package/dist/shell/layout/TemplateShell.svelte.d.ts +15 -0
- package/dist/shell/layout/ThemeToggle.svelte +46 -0
- package/dist/shell/layout/ThemeToggle.svelte.d.ts +3 -0
- package/dist/shell/layout/index.d.ts +8 -0
- package/dist/shell/layout/index.js +9 -0
- package/dist/storage/ApiStorageAdapter.d.ts +41 -0
- package/dist/storage/ApiStorageAdapter.js +111 -0
- package/dist/storage/IdbStorageAdapter.d.ts +31 -0
- package/dist/storage/IdbStorageAdapter.js +72 -0
- package/dist/storage/MemoryStorageAdapter.d.ts +33 -0
- package/dist/storage/MemoryStorageAdapter.js +132 -0
- package/dist/storage/README.md +222 -0
- package/dist/storage/StorageAdapter.d.ts +75 -0
- package/dist/storage/StorageAdapter.js +7 -0
- package/dist/storage/demo/storage-demo.d.ts +22 -0
- package/dist/storage/demo/storage-demo.js +107 -0
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.js +9 -0
- package/dist/types/entity-types.d.ts +444 -0
- package/dist/types/entity-types.js +16 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +6 -0
- package/dist/types/machine-model.d.ts +198 -0
- package/dist/types/machine-model.js +5 -0
- package/dist/types/qoolie-svelte.d.ts +11 -0
- package/dist/types/schema-utils.d.ts +32 -0
- package/dist/types/schema-utils.js +103 -0
- package/dist/utils/generateCode.d.ts +5 -0
- package/dist/utils/generateCode.js +9 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +20 -0
- package/package.json +59 -33
- package/cli.js +0 -46
- package/dist/db/CrudService.d.ts +0 -9
- package/dist/db/CrudService.js +0 -45
- package/dist/demo/dbSchema.d.ts +0 -446
- package/dist/demo/dbSchema.js +0 -449
- package/dist/demo/testScheme.d.ts +0 -56
- package/dist/demo/testScheme.js +0 -42
- package/dist/form/CreateUpdate.svelte +0 -219
- package/dist/form/CreateUpdate.svelte.d.ts +0 -27
- package/dist/form/DataProvider.svelte +0 -23
- package/dist/form/DataProvider.svelte.d.ts +0 -7
- package/dist/form/FieldValue.svelte +0 -148
- package/dist/form/FieldValue.svelte.d.ts +0 -34
- package/dist/form/types.d.ts +0 -17
- package/dist/fragments/Confirm.svelte +0 -73
- package/dist/fragments/Confirm.svelte.d.ts +0 -7
- package/dist/fragments/Frame.svelte +0 -19
- package/dist/fragments/Frame.svelte.d.ts +0 -32
- package/dist/fragments/InfoLine.svelte +0 -21
- package/dist/fragments/InfoLine.svelte.d.ts +0 -35
- package/dist/fragments/Selector.svelte +0 -26
- package/dist/fragments/Selector.svelte.d.ts +0 -38
- package/dist/main/machine/MachineSchemeField.d.ts +0 -19
- package/dist/types/appschemeTypes.d.ts +0 -71
- package/dist/types/appschemeTypes.js +0 -83
- package/dist/ui/CollectionButton.svelte +0 -29
- package/dist/ui/CollectionButton.svelte.d.ts +0 -29
- package/dist/ui/CollectionFks.svelte +0 -24
- package/dist/ui/CollectionFks.svelte.d.ts +0 -9
- package/dist/ui/CollectionList.svelte +0 -100
- package/dist/ui/CollectionList.svelte.d.ts +0 -36
- package/dist/ui/CollectionListFieldValues.svelte +0 -59
- package/dist/ui/CollectionListFieldValues.svelte.d.ts +0 -9
- package/dist/ui/CollectionListMenu.svelte +0 -39
- package/dist/ui/CollectionListMenu.svelte.d.ts +0 -34
- package/dist/ui/CollectionReverseFks.svelte +0 -37
- package/dist/ui/CollectionReverseFks.svelte.d.ts +0 -14
- /package/dist/{fragments → data-ui/fragments}/Skeleton.svelte.d.ts +0 -0
- /package/dist/{form → main/api}/types.js +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { SortBy, TplCollectionName, ViewTypeCode, Where } from '../../types/index.js';
|
|
3
|
+
import type { LinkString } from '../../main/frame/linkParser.js';
|
|
4
|
+
export interface PaginationInfo {
|
|
5
|
+
page: number;
|
|
6
|
+
pageSize: number;
|
|
7
|
+
total: number;
|
|
8
|
+
totalPages: number;
|
|
9
|
+
}
|
|
10
|
+
export interface DataListProps<COL extends Record<string, unknown> = Record<string, unknown>> {
|
|
11
|
+
collection: string;
|
|
12
|
+
where?: Where<COL>;
|
|
13
|
+
sortBy?: SortBy | SortBy[];
|
|
14
|
+
groupBy?: string;
|
|
15
|
+
mode?: 'list' | 'table' | 'grid' | 'accordion';
|
|
16
|
+
view?: ViewTypeCode;
|
|
17
|
+
pageSize?: number;
|
|
18
|
+
page?: number;
|
|
19
|
+
infiniteScroll?: boolean;
|
|
20
|
+
listClass?: string;
|
|
21
|
+
groupClass?: string;
|
|
22
|
+
link?: LinkString;
|
|
23
|
+
linkTarget?: string;
|
|
24
|
+
linkVars?: Record<string, any>;
|
|
25
|
+
/** Field of the record to use as collection name for navigation (e.g. "code" for appscheme). */
|
|
26
|
+
linkCollectionField?: string;
|
|
27
|
+
/** Hydrate/persist appuser_prefs for this DataList instance. */
|
|
28
|
+
usePrefs?: boolean;
|
|
29
|
+
/** Override appuser_prefs scope key. Defaults to `datalist.{collection}`. */
|
|
30
|
+
prefsScope?: string;
|
|
31
|
+
/** CRUD state for DataRecord rendering per record ('show' | 'update'). Defaults to 'show'. */
|
|
32
|
+
crudMode?: 'show' | 'update';
|
|
33
|
+
dataRecord?: Snippet<[
|
|
34
|
+
{
|
|
35
|
+
collection: TplCollectionName;
|
|
36
|
+
collectionId: number;
|
|
37
|
+
data: COL;
|
|
38
|
+
mode: 'show' | 'update';
|
|
39
|
+
view: string;
|
|
40
|
+
idx: number;
|
|
41
|
+
}
|
|
42
|
+
]>;
|
|
43
|
+
dataListHeader?: Snippet<[{
|
|
44
|
+
key: string;
|
|
45
|
+
count: number;
|
|
46
|
+
}]>;
|
|
47
|
+
empty?: Snippet;
|
|
48
|
+
footer?: Snippet<[{
|
|
49
|
+
pagination: PaginationInfo;
|
|
50
|
+
}]>;
|
|
51
|
+
}
|
|
52
|
+
declare function $$render<COL extends Record<string, unknown>>(): {
|
|
53
|
+
props: DataListProps<COL>;
|
|
54
|
+
exports: {};
|
|
55
|
+
bindings: "";
|
|
56
|
+
slots: {};
|
|
57
|
+
events: {};
|
|
58
|
+
};
|
|
59
|
+
declare class __sveltets_Render<COL extends Record<string, unknown>> {
|
|
60
|
+
props(): ReturnType<typeof $$render<COL>>['props'];
|
|
61
|
+
events(): ReturnType<typeof $$render<COL>>['events'];
|
|
62
|
+
slots(): ReturnType<typeof $$render<COL>>['slots'];
|
|
63
|
+
bindings(): "";
|
|
64
|
+
exports(): {};
|
|
65
|
+
}
|
|
66
|
+
interface $$IsomorphicComponent {
|
|
67
|
+
new <COL extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<COL>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<COL>['props']>, ReturnType<__sveltets_Render<COL>['events']>, ReturnType<__sveltets_Render<COL>['slots']>> & {
|
|
68
|
+
$$bindings?: ReturnType<__sveltets_Render<COL>['bindings']>;
|
|
69
|
+
} & ReturnType<__sveltets_Render<COL>['exports']>;
|
|
70
|
+
<COL extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<COL>['props']> & {}): ReturnType<__sveltets_Render<COL>['exports']>;
|
|
71
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
72
|
+
}
|
|
73
|
+
declare const DataList: $$IsomorphicComponent;
|
|
74
|
+
type DataList<COL extends Record<string, unknown>> = InstanceType<typeof DataList<COL>>;
|
|
75
|
+
export default DataList;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
DataListFk.svelte
|
|
3
|
+
Renders forward FK relations for a record as DataList sections.
|
|
4
|
+
@prop {string} collection - Source collection name
|
|
5
|
+
@prop {string|number} [collectionId] - Source record id (if data not provided)
|
|
6
|
+
@prop {Record<string,unknown>|null} [data] - Source record (controlled)
|
|
7
|
+
@prop {string} [fk] - Filter to a single FK key
|
|
8
|
+
@prop {boolean} [showTitle] - Show section title (default: true)
|
|
9
|
+
@prop {boolean} [usePrefs] - Use persisted user prefs (default: false)
|
|
10
|
+
@prop {string} [prefsScope] - Custom prefs scope
|
|
11
|
+
-->
|
|
12
|
+
<script module lang="ts">
|
|
13
|
+
export interface DataListFkProps {
|
|
14
|
+
collection: string;
|
|
15
|
+
collectionId?: string | number;
|
|
16
|
+
data?: Record<string, unknown> | null;
|
|
17
|
+
fk?: string;
|
|
18
|
+
showTitle?: boolean;
|
|
19
|
+
usePrefs?: boolean;
|
|
20
|
+
prefsScope?: string;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import DataList from './DataList.svelte';
|
|
27
|
+
import { machine } from '../../main/machine.js';
|
|
28
|
+
import { resolveForwardRelations } from '../utils/dataRelationUtils.js';
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
collection,
|
|
32
|
+
collectionId,
|
|
33
|
+
data = undefined,
|
|
34
|
+
fk,
|
|
35
|
+
showTitle = true,
|
|
36
|
+
usePrefs = false,
|
|
37
|
+
prefsScope,
|
|
38
|
+
...dataListProps
|
|
39
|
+
}: DataListFkProps = $props();
|
|
40
|
+
|
|
41
|
+
const sourceStore = $derived(collection ? machine.store<Record<string, unknown>>(collection) : { records: [] as Record<string, unknown>[] });
|
|
42
|
+
const scheme = $derived(collection ? machine.logic.collection(collection) : null);
|
|
43
|
+
|
|
44
|
+
const storeRecord = $derived.by(() => {
|
|
45
|
+
if (collectionId == null) return null;
|
|
46
|
+
return sourceStore.records.find((item) => String(item.id) === String(collectionId)) ?? null;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
let fetchedRecord = $state<Record<string, unknown> | null>(null);
|
|
50
|
+
let lookupDone = $state(false);
|
|
51
|
+
$effect(() => {
|
|
52
|
+
if (data != null || collectionId == null || storeRecord != null) {
|
|
53
|
+
lookupDone = true;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
lookupDone = false;
|
|
57
|
+
fetchedRecord = null;
|
|
58
|
+
let cancelled = false;
|
|
59
|
+
Promise.resolve(machine.collection(collection).get(collectionId)).then((rec) => {
|
|
60
|
+
if (cancelled) return;
|
|
61
|
+
fetchedRecord = (rec as Record<string, unknown> | undefined) ?? null;
|
|
62
|
+
lookupDone = true;
|
|
63
|
+
});
|
|
64
|
+
return () => { cancelled = true; };
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const record = $derived.by(() => {
|
|
68
|
+
if (data) return data;
|
|
69
|
+
if (collectionId == null) return null;
|
|
70
|
+
return storeRecord ?? fetchedRecord;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const recordState = $derived.by(() => {
|
|
74
|
+
if (record) return 'found';
|
|
75
|
+
if (data != null || collectionId == null) return 'absent';
|
|
76
|
+
return lookupDone ? 'absent' : 'loading';
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const relations = $derived.by(() => {
|
|
80
|
+
if (!scheme || !record) return { resolved: [], unresolved: [] };
|
|
81
|
+
return resolveForwardRelations(scheme, record, fk);
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
{#if recordState === 'loading'}
|
|
86
|
+
<div class="data-list-relation-state">Loading...</div>
|
|
87
|
+
{:else if recordState === 'absent'}
|
|
88
|
+
<div class="data-list-relation-state">Record not found.</div>
|
|
89
|
+
{:else}
|
|
90
|
+
{#each relations.unresolved as relation (relation.collection + ':' + relation.key)}
|
|
91
|
+
<div class="data-list-relation-error">{relation.error}</div>
|
|
92
|
+
{/each}
|
|
93
|
+
{#if relations.resolved.length}
|
|
94
|
+
{#each relations.resolved as relation (relation.collection + ':' + relation.key)}
|
|
95
|
+
<section class="data-list-relation">
|
|
96
|
+
{#if showTitle}
|
|
97
|
+
<h3 class="data-list-relation-title">{relation.title}</h3>
|
|
98
|
+
{/if}
|
|
99
|
+
<DataList
|
|
100
|
+
{usePrefs}
|
|
101
|
+
{prefsScope}
|
|
102
|
+
collection={relation.collection}
|
|
103
|
+
where={relation.where}
|
|
104
|
+
{...dataListProps}
|
|
105
|
+
/>
|
|
106
|
+
</section>
|
|
107
|
+
{/each}
|
|
108
|
+
{:else if !relations.unresolved.length}
|
|
109
|
+
<div class="data-list-relation-state">No related records.</div>
|
|
110
|
+
{/if}
|
|
111
|
+
{/if}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DataListFkProps {
|
|
2
|
+
collection: string;
|
|
3
|
+
collectionId?: string | number;
|
|
4
|
+
data?: Record<string, unknown> | null;
|
|
5
|
+
fk?: string;
|
|
6
|
+
showTitle?: boolean;
|
|
7
|
+
usePrefs?: boolean;
|
|
8
|
+
prefsScope?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
declare const DataListFk: import("svelte").Component<DataListFkProps, {}, "">;
|
|
12
|
+
type DataListFk = ReturnType<typeof DataListFk>;
|
|
13
|
+
export default DataListFk;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
DataListRfk.svelte
|
|
3
|
+
Renders reverse FK relations for a record as DataList sections.
|
|
4
|
+
@prop {string} collection - Source collection name
|
|
5
|
+
@prop {string|number} [collectionId] - Source record id (if data not provided)
|
|
6
|
+
@prop {Record<string,unknown>|null} [data] - Source record (controlled)
|
|
7
|
+
@prop {string} [fk] - Filter to a single FK key
|
|
8
|
+
@prop {boolean} [showTitle] - Show section title (default: true)
|
|
9
|
+
@prop {boolean} [usePrefs] - Use persisted user prefs (default: false)
|
|
10
|
+
@prop {string} [prefsScope] - Custom prefs scope
|
|
11
|
+
-->
|
|
12
|
+
<script module lang="ts">
|
|
13
|
+
export interface DataListRfkProps {
|
|
14
|
+
collection: string;
|
|
15
|
+
collectionId?: string | number;
|
|
16
|
+
data?: Record<string, unknown> | null;
|
|
17
|
+
fk?: string;
|
|
18
|
+
showTitle?: boolean;
|
|
19
|
+
usePrefs?: boolean;
|
|
20
|
+
prefsScope?: string;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import DataList from './DataList.svelte';
|
|
27
|
+
import { machine } from '../../main/machine.js';
|
|
28
|
+
import { resolveReverseRelations } from '../utils/dataRelationUtils.js';
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
collection,
|
|
32
|
+
collectionId,
|
|
33
|
+
data = undefined,
|
|
34
|
+
fk,
|
|
35
|
+
showTitle = true,
|
|
36
|
+
usePrefs = false,
|
|
37
|
+
prefsScope,
|
|
38
|
+
...dataListProps
|
|
39
|
+
}: DataListRfkProps = $props();
|
|
40
|
+
|
|
41
|
+
const sourceStore = $derived(collection ? machine.store<Record<string, unknown>>(collection) : { records: [] as Record<string, unknown>[] });
|
|
42
|
+
const scheme = $derived(collection ? machine.logic.collection(collection) : null);
|
|
43
|
+
|
|
44
|
+
const storeRecord = $derived.by(() => {
|
|
45
|
+
if (collectionId == null) return null;
|
|
46
|
+
return sourceStore.records.find((item) => String(item.id) === String(collectionId)) ?? null;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
let fetchedRecord = $state<Record<string, unknown> | null>(null);
|
|
50
|
+
let lookupDone = $state(false);
|
|
51
|
+
$effect(() => {
|
|
52
|
+
if (data != null || collectionId == null || storeRecord != null) {
|
|
53
|
+
lookupDone = true;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
lookupDone = false;
|
|
57
|
+
fetchedRecord = null;
|
|
58
|
+
let cancelled = false;
|
|
59
|
+
Promise.resolve(machine.collection(collection).get(collectionId)).then((rec) => {
|
|
60
|
+
if (cancelled) return;
|
|
61
|
+
fetchedRecord = (rec as Record<string, unknown> | undefined) ?? null;
|
|
62
|
+
lookupDone = true;
|
|
63
|
+
});
|
|
64
|
+
return () => { cancelled = true; };
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const record = $derived.by(() => {
|
|
68
|
+
if (data) return data;
|
|
69
|
+
if (collectionId == null) return null;
|
|
70
|
+
return storeRecord ?? fetchedRecord;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const recordState = $derived.by(() => {
|
|
74
|
+
if (record) return 'found';
|
|
75
|
+
if (data != null || collectionId == null) return 'absent';
|
|
76
|
+
return lookupDone ? 'absent' : 'loading';
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const relations = $derived.by(() => {
|
|
80
|
+
if (!scheme || !record) return { resolved: [], unresolved: [] };
|
|
81
|
+
return resolveReverseRelations(scheme, record, fk);
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
{#if recordState === 'loading'}
|
|
86
|
+
<div class="data-list-relation-state">Loading...</div>
|
|
87
|
+
{:else if recordState === 'absent'}
|
|
88
|
+
<div class="data-list-relation-state">Record not found.</div>
|
|
89
|
+
{:else}
|
|
90
|
+
{#each relations.unresolved as relation (relation.collection + ':' + relation.key)}
|
|
91
|
+
<div class="data-list-relation-error">{relation.error}</div>
|
|
92
|
+
{/each}
|
|
93
|
+
{#if relations.resolved.length}
|
|
94
|
+
{#each relations.resolved as relation (relation.collection + ':' + relation.key)}
|
|
95
|
+
<section class="data-list-relation">
|
|
96
|
+
{#if showTitle}
|
|
97
|
+
<h3 class="data-list-relation-title">{relation.title}</h3>
|
|
98
|
+
{/if}
|
|
99
|
+
<DataList
|
|
100
|
+
{usePrefs}
|
|
101
|
+
{prefsScope}
|
|
102
|
+
collection={relation.collection}
|
|
103
|
+
where={relation.where}
|
|
104
|
+
{...dataListProps}
|
|
105
|
+
/>
|
|
106
|
+
</section>
|
|
107
|
+
{/each}
|
|
108
|
+
{:else if !relations.unresolved.length}
|
|
109
|
+
<div class="data-list-relation-state">No related records.</div>
|
|
110
|
+
{/if}
|
|
111
|
+
{/if}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DataListRfkProps {
|
|
2
|
+
collection: string;
|
|
3
|
+
collectionId?: string | number;
|
|
4
|
+
data?: Record<string, unknown> | null;
|
|
5
|
+
fk?: string;
|
|
6
|
+
showTitle?: boolean;
|
|
7
|
+
usePrefs?: boolean;
|
|
8
|
+
prefsScope?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
declare const DataListRfk: import("svelte").Component<DataListRfkProps, {}, "">;
|
|
12
|
+
type DataListRfk = ReturnType<typeof DataListRfk>;
|
|
13
|
+
export default DataListRfk;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
DataRecord.svelte
|
|
3
|
+
Iterates a record's fields and renders DataField for each.
|
|
4
|
+
@role data-record
|
|
5
|
+
@prop {string} collection - Collection name
|
|
6
|
+
@prop {Record<string,any>} data - Record data (bindable)
|
|
7
|
+
@prop {'show'|'create'|'update'} [mode] - CRUD state, independent of layout.
|
|
8
|
+
@prop {'fields'|'row'} [as] - Layout wrapper. 'row' emits <td> per field for use inside <tr> (no groupBy support). Does not affect `mode`.
|
|
9
|
+
@prop {string[]} [showFields] - Explicit field list, bypasses the view query entirely
|
|
10
|
+
@prop {string} [view] - Named view (resolved via appscheme_view/appscheme_field query — see useViewFields)
|
|
11
|
+
@prop {string} [groupFieldBy] - FK relation key on appscheme_field to group by (e.g. 'appscheme_field_type'); grouping runs on `fks.{groupFieldBy}.code` via native groupBy
|
|
12
|
+
-->
|
|
13
|
+
<script module lang="ts">
|
|
14
|
+
import type { Snippet } from 'svelte';
|
|
15
|
+
import type { ViewTypeCode } from '../../types/index.js';
|
|
16
|
+
|
|
17
|
+
export interface DataRecordProps {
|
|
18
|
+
collection: string;
|
|
19
|
+
collectionId?: string | number;
|
|
20
|
+
data?: Record<string, any>;
|
|
21
|
+
mode?: 'show' | 'create' | 'update';
|
|
22
|
+
as?: 'fields' | 'row';
|
|
23
|
+
showFields?: string[];
|
|
24
|
+
view?: ViewTypeCode;
|
|
25
|
+
groupFieldBy?: string;
|
|
26
|
+
groupChildren?: Snippet<[{ key: string; fieldNames: string[] }]>;
|
|
27
|
+
inputForm?: string;
|
|
28
|
+
showLabel?: boolean | string;
|
|
29
|
+
showGroupNames?: boolean;
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<script lang="ts">
|
|
34
|
+
import DataField from '../field/DataField.svelte';
|
|
35
|
+
import { machine } from '../../main/machine.js';
|
|
36
|
+
import { useViewFields } from '../utils/useViewFields.svelte.js';
|
|
37
|
+
import { useRecordData } from '../utils/useRecordData.svelte.js';
|
|
38
|
+
import { getContext } from 'svelte';
|
|
39
|
+
|
|
40
|
+
let {
|
|
41
|
+
collection = getContext('collection'),
|
|
42
|
+
collectionId,
|
|
43
|
+
data = $bindable(),
|
|
44
|
+
mode = 'show',
|
|
45
|
+
as = 'fields',
|
|
46
|
+
showFields,
|
|
47
|
+
view = 'full',
|
|
48
|
+
groupFieldBy,
|
|
49
|
+
groupChildren,
|
|
50
|
+
inputForm,
|
|
51
|
+
showLabel = true,
|
|
52
|
+
showGroupNames = true
|
|
53
|
+
}: DataRecordProps = $props();
|
|
54
|
+
|
|
55
|
+
// Data source contract (CLAUDE.md §4): `data` prop → controlled (e.g. DataList store
|
|
56
|
+
// items), used as-is; else `collectionId` → reactive read via machine.store (BL-24,
|
|
57
|
+
// useRecordData — NOT machine.collection; store is the reactive read layer).
|
|
58
|
+
const recordData = useRecordData(() => collection, () => ({ collectionId, data }));
|
|
59
|
+
const scheme = $derived(recordData.scheme);
|
|
60
|
+
const effectiveData = $derived(recordData.record);
|
|
61
|
+
|
|
62
|
+
// Field list: explicit `showFields` bypasses the view query; otherwise query-resolved
|
|
63
|
+
// via appscheme_view → appscheme_field (see useViewFields — no client-side heuristics).
|
|
64
|
+
const viewFields = useViewFields(() => collection, () => view, () => groupFieldBy);
|
|
65
|
+
const fieldNames = $derived(showFields?.length ? showFields : viewFields.fieldNames);
|
|
66
|
+
const groups = $derived(showFields?.length ? undefined : viewFields.groups);
|
|
67
|
+
|
|
68
|
+
// FK fields are shown even when absent from the record (placeholder empty value).
|
|
69
|
+
// Scalar fields are skipped when absent — MachineSchemeValues.format throws FIELD_NOT_FOUND.
|
|
70
|
+
const schemeFks = $derived(scheme?.fks ?? {});
|
|
71
|
+
const isFkField = (fieldName: string) => fieldName in schemeFks;
|
|
72
|
+
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
{#if as === 'row'}
|
|
76
|
+
{#if scheme && fieldNames.length && effectiveData != null}
|
|
77
|
+
{#each fieldNames as fieldName (fieldName)}
|
|
78
|
+
{#if (scheme.fields?.[fieldName] || isFkField(fieldName)) && (fieldName in effectiveData || isFkField(fieldName))}
|
|
79
|
+
<td>
|
|
80
|
+
{#if mode === 'show'}
|
|
81
|
+
<DataField {collection} {fieldName} mode="show" data={effectiveData} showLabel={false} />
|
|
82
|
+
{:else if data !== undefined}
|
|
83
|
+
<DataField {collection} {fieldName} {mode} bind:data showLabel={false} />
|
|
84
|
+
{/if}
|
|
85
|
+
</td>
|
|
86
|
+
{/if}
|
|
87
|
+
{/each}
|
|
88
|
+
{/if}
|
|
89
|
+
{:else if groups}
|
|
90
|
+
{#each Object.entries(groups) as [key, groupFields] (key)}
|
|
91
|
+
{@const visibleFields = groupFields.filter(
|
|
92
|
+
({ code: fieldName }) =>
|
|
93
|
+
(scheme?.fields?.[fieldName] || isFkField(fieldName)) &&
|
|
94
|
+
(mode !== 'show' ||
|
|
95
|
+
(effectiveData != null && (fieldName in effectiveData || isFkField(fieldName))))
|
|
96
|
+
)}
|
|
97
|
+
{#if groupChildren}
|
|
98
|
+
{@render groupChildren({ key, fieldNames: groupFields.map((f) => f.code) })}
|
|
99
|
+
{:else if visibleFields.length}
|
|
100
|
+
<fieldset class="field-group">
|
|
101
|
+
{#if showGroupNames}<legend>- {key}</legend>{/if}
|
|
102
|
+
{#each visibleFields as { code: fieldName } (fieldName)}
|
|
103
|
+
<div class="field">
|
|
104
|
+
{#if mode === 'show'}
|
|
105
|
+
<DataField {showLabel} {collection} {fieldName} {mode} data={effectiveData!} {inputForm} />
|
|
106
|
+
{:else if data !== undefined}<DataField
|
|
107
|
+
{collection}
|
|
108
|
+
{fieldName}
|
|
109
|
+
{mode}
|
|
110
|
+
bind:data
|
|
111
|
+
{inputForm}
|
|
112
|
+
/>{/if}
|
|
113
|
+
</div>
|
|
114
|
+
{/each}
|
|
115
|
+
</fieldset>
|
|
116
|
+
{/if}
|
|
117
|
+
{/each}
|
|
118
|
+
{:else}
|
|
119
|
+
<div class="form">
|
|
120
|
+
{#if scheme && fieldNames.length}
|
|
121
|
+
{#each fieldNames as fieldName (fieldName)}
|
|
122
|
+
{#if (scheme.fields?.[fieldName] || isFkField(fieldName)) && (mode !== 'show' || (effectiveData != null && (fieldName in effectiveData || isFkField(fieldName))))}
|
|
123
|
+
<div class="field">
|
|
124
|
+
{#if mode === 'show'}
|
|
125
|
+
<DataField {collection} {fieldName} {mode} data={effectiveData!} {showLabel} {inputForm} />
|
|
126
|
+
{:else if data !== undefined}<DataField
|
|
127
|
+
{collection}
|
|
128
|
+
{fieldName}
|
|
129
|
+
{mode}
|
|
130
|
+
bind:data={data as Record<string, unknown>}
|
|
131
|
+
{inputForm}
|
|
132
|
+
{showLabel}
|
|
133
|
+
/>{/if}
|
|
134
|
+
</div>
|
|
135
|
+
{/if}
|
|
136
|
+
{/each}
|
|
137
|
+
{/if}
|
|
138
|
+
</div>
|
|
139
|
+
{/if}
|
|
140
|
+
|
|
141
|
+
<style>
|
|
142
|
+
@layer components {
|
|
143
|
+
/* flex-wrap (legacy .fiche_field_group: flex_h flex_wrap) — each DataField's
|
|
144
|
+
`.field-line` carries its own flex-basis (~320px, legacy min-width:40%) and
|
|
145
|
+
fixed-width label, so values line up without a rigid grid forcing uneven
|
|
146
|
+
rows to match height. */
|
|
147
|
+
.form,
|
|
148
|
+
fieldset.field-group {
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-wrap: wrap;
|
|
151
|
+
align-items: flex-start;
|
|
152
|
+
}
|
|
153
|
+
fieldset.field-group {
|
|
154
|
+
border: none;
|
|
155
|
+
padding: 0;
|
|
156
|
+
}
|
|
157
|
+
.field {
|
|
158
|
+
display: contents;
|
|
159
|
+
}
|
|
160
|
+
legend {
|
|
161
|
+
width: 100%;
|
|
162
|
+
padding: var(--pad-sm) 0 var(--pad-xs);
|
|
163
|
+
font-weight: var(--font-medium);
|
|
164
|
+
color: var(--color-text-muted);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ViewTypeCode } from '../../types/index.js';
|
|
3
|
+
export interface DataRecordProps {
|
|
4
|
+
collection: string;
|
|
5
|
+
collectionId?: string | number;
|
|
6
|
+
data?: Record<string, any>;
|
|
7
|
+
mode?: 'show' | 'create' | 'update';
|
|
8
|
+
as?: 'fields' | 'row';
|
|
9
|
+
showFields?: string[];
|
|
10
|
+
view?: ViewTypeCode;
|
|
11
|
+
groupFieldBy?: string;
|
|
12
|
+
groupChildren?: Snippet<[{
|
|
13
|
+
key: string;
|
|
14
|
+
fieldNames: string[];
|
|
15
|
+
}]>;
|
|
16
|
+
inputForm?: string;
|
|
17
|
+
showLabel?: boolean | string;
|
|
18
|
+
showGroupNames?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare const DataRecord: import("svelte").Component<DataRecordProps, {}, "data">;
|
|
21
|
+
type DataRecord = ReturnType<typeof DataRecord>;
|
|
22
|
+
export default DataRecord;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
DataRfk.svelte
|
|
3
|
+
Reverse FK relation viewer — shows collections that point to this record.
|
|
4
|
+
@role data-relations
|
|
5
|
+
@prop {string} collection - Collection name
|
|
6
|
+
@prop {boolean|string} [showTitle] - Show or override title
|
|
7
|
+
@prop {SortBy | SortBy[]} [sortBy] - Sort reverse FK entries
|
|
8
|
+
@prop {string} [groupBy] - Group reverse FK entries by property
|
|
9
|
+
@prop {typeof SvelteComponent} [component] - Custom component
|
|
10
|
+
@prop {Record<string,any>} [componentProps] - Props for custom component
|
|
11
|
+
@slot children (let:item) - Custom reverse FK rendering
|
|
12
|
+
-->
|
|
13
|
+
<script module lang="ts">
|
|
14
|
+
import type { Snippet } from 'svelte';
|
|
15
|
+
import type { TplCollectionName, SortBy } from '../../types/index.js';
|
|
16
|
+
import type { SvelteComponent } from 'svelte';
|
|
17
|
+
|
|
18
|
+
export interface DataRfkProps {
|
|
19
|
+
collection: TplCollectionName;
|
|
20
|
+
showTitle?: boolean | string;
|
|
21
|
+
sortBy?: SortBy | SortBy[];
|
|
22
|
+
groupBy?: string;
|
|
23
|
+
component?: typeof SvelteComponent;
|
|
24
|
+
componentProps?: Record<string, any>;
|
|
25
|
+
children?: Snippet<[[string, Record<string, unknown>]]>;
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import { machine } from '../../main/machine.js';
|
|
31
|
+
import { sortItems, groupItems } from '../utils/data-utils.js';
|
|
32
|
+
|
|
33
|
+
let { collection, showTitle = false, component, componentProps = {}, sortBy, groupBy, children }: DataRfkProps = $props();
|
|
34
|
+
|
|
35
|
+
const reverseFks = $derived(machine.logic.collection(collection)?.parseReverseFks() ?? {});
|
|
36
|
+
|
|
37
|
+
const rfkEntries = $derived(
|
|
38
|
+
Object.entries(reverseFks).map(([key, def]) => ({ key, ...(def as Record<string, unknown>) }))
|
|
39
|
+
);
|
|
40
|
+
const sortedRfks = $derived(sortBy ? sortItems(rfkEntries, sortBy) : rfkEntries);
|
|
41
|
+
const groups = $derived(groupBy ? groupItems(sortedRfks, groupBy) : undefined);
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
{#if groups}
|
|
45
|
+
{#each Array.from(groups) as [groupKey, groupEntries] (groupKey)}
|
|
46
|
+
<section>
|
|
47
|
+
<header>{groupKey}</header>
|
|
48
|
+
{#each groupEntries as entry (entry.key)}
|
|
49
|
+
<div>
|
|
50
|
+
{#if showTitle}<div class="p2 font-bold">{entry.key}</div>{/if}
|
|
51
|
+
{#if component}
|
|
52
|
+
{@const DynComp = component}
|
|
53
|
+
<DynComp collection={collection} template={entry} {...componentProps} />
|
|
54
|
+
{:else if children}
|
|
55
|
+
{@render children([entry.key, entry])}
|
|
56
|
+
{/if}
|
|
57
|
+
</div>
|
|
58
|
+
{/each}
|
|
59
|
+
</section>
|
|
60
|
+
{/each}
|
|
61
|
+
{:else}
|
|
62
|
+
{#each sortedRfks as entry (entry.key)}
|
|
63
|
+
<div>
|
|
64
|
+
{#if showTitle}<div class="p2 font-bold">{entry.key}</div>{/if}
|
|
65
|
+
{#if component}
|
|
66
|
+
{@const DynComp = component}
|
|
67
|
+
<DynComp collection={collection} template={entry} {...componentProps} />
|
|
68
|
+
{:else if children}
|
|
69
|
+
{@render children([entry.key, entry])}
|
|
70
|
+
{/if}
|
|
71
|
+
</div>
|
|
72
|
+
{/each}
|
|
73
|
+
{/if}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { TplCollectionName, SortBy } from '../../types/index.js';
|
|
4
|
+
export interface DataRfkProps {
|
|
5
|
+
collection: TplCollectionName;
|
|
6
|
+
showTitle?: boolean | string;
|
|
7
|
+
sortBy?: SortBy | SortBy[];
|
|
8
|
+
groupBy?: string;
|
|
9
|
+
component?: typeof SvelteComponent;
|
|
10
|
+
componentProps?: Record<string, any>;
|
|
11
|
+
children?: Snippet<[[string, Record<string, unknown>]]>;
|
|
12
|
+
}
|
|
13
|
+
declare const DataRfk: import("svelte").Component<DataRfkProps, {}, "">;
|
|
14
|
+
type DataRfk = ReturnType<typeof DataRfk>;
|
|
15
|
+
export default DataRfk;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as DataList } from './DataList.svelte';
|
|
2
|
+
export { default as DataListFk } from './DataListFk.svelte';
|
|
3
|
+
export { default as DataListRfk } from './DataListRfk.svelte';
|
|
4
|
+
export { default as DataForm } from './DataForm.svelte';
|
|
5
|
+
export { default as DataRecord } from './DataRecord.svelte';
|
|
6
|
+
export { default as DataFk } from './DataFk.svelte';
|
|
7
|
+
export { default as DataRfk } from './DataRfk.svelte';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Data components barrel export
|
|
2
|
+
export { default as DataList } from './DataList.svelte';
|
|
3
|
+
export { default as DataListFk } from './DataListFk.svelte';
|
|
4
|
+
export { default as DataListRfk } from './DataListRfk.svelte';
|
|
5
|
+
export { default as DataForm } from './DataForm.svelte';
|
|
6
|
+
export { default as DataRecord } from './DataRecord.svelte';
|
|
7
|
+
export { default as DataFk } from './DataFk.svelte';
|
|
8
|
+
export { default as DataRfk } from './DataRfk.svelte';
|