@medyll/idae-machine 0.129.0 → 0.136.1
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/README.md +462 -300
- 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/data-ui/field/DataFieldEdit.svelte +103 -0
- package/dist/data-ui/field/DataFieldEdit.svelte.d.ts +14 -0
- 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 +3 -3
- 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 -43
- package/dist/index.js +82 -44
- 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.d.ts +33 -0
- package/dist/main/machine/MachineError.js +49 -0
- package/dist/main/machine/MachineErrorValidation.d.ts +19 -0
- package/dist/main/machine/MachineErrorValidation.js +24 -0
- package/dist/main/machine/MachineFieldType.d.ts +140 -0
- package/dist/main/machine/MachineFieldType.js +341 -0
- 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 +54 -0
- package/dist/main/machine/MachineScheme.js +159 -0
- package/dist/main/machine/MachineSchemeField.js +67 -0
- package/dist/main/machine/MachineSchemeFieldForge.d.ts +84 -0
- package/dist/main/machine/MachineSchemeFieldForge.js +140 -0
- package/dist/main/machine/MachineSchemeFieldValues.d.ts +68 -0
- package/dist/main/machine/MachineSchemeFieldValues.js +97 -0
- package/dist/main/machine/MachineSchemeValidate.d.ts +107 -0
- package/dist/main/machine/MachineSchemeValidate.js +247 -0
- package/dist/main/machine/MachineSchemeValues.d.ts +120 -0
- package/dist/main/machine/MachineSchemeValues.js +306 -0
- package/dist/main/machine/SchemeFieldDefaultValues.d.ts +76 -0
- package/dist/main/machine/SchemeFieldDefaultValues.js +104 -0
- 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 +227 -61
- package/dist/main/machine.js +503 -86
- package/dist/main/machineDb.d.ts +25 -54
- package/dist/main/machineDb.js +40 -94
- 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 +38 -0
- package/dist/main/machineParserForge.js +168 -0
- 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 +70 -31
- package/dist/db/CrudService.d.ts +0 -9
- package/dist/db/CrudService.js +0 -45
- package/dist/db/dbSchema.d.ts +0 -201
- package/dist/db/dbSchema.js +0 -205
- package/dist/db/fieldTypes.d.ts +0 -13
- package/dist/db/fieldTypes.js +0 -67
- package/dist/db/types.d.ts +0 -124
- package/dist/demo/form/CreateUpdate.svelte +0 -198
- package/dist/demo/form/CreateUpdate.svelte.d.ts +0 -29
- package/dist/demo/form/CrudZone.svelte +0 -22
- package/dist/demo/form/CrudZone.svelte.d.ts +0 -29
- package/dist/demo/form/DataProvider.svelte +0 -20
- package/dist/demo/form/DataProvider.svelte.d.ts +0 -9
- package/dist/demo/form/FieldInPlace.svelte +0 -49
- package/dist/demo/form/FieldInPlace.svelte.d.ts +0 -11
- package/dist/demo/form/FieldValue.svelte +0 -212
- package/dist/demo/form/FieldValue.svelte.d.ts +0 -35
- package/dist/demo/form/types.d.ts +0 -17
- package/dist/demo/form/types.js +0 -1
- package/dist/demo/testDbSchema.d.ts +0 -6
- package/dist/demo/testDbSchema.js +0 -58
- package/dist/demo/types.d.ts +0 -140
- package/dist/demo/types.js +0 -1
- package/dist/fragments/Confirm.svelte +0 -58
- package/dist/fragments/Confirm.svelte.d.ts +0 -11
- 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/List.svelte +0 -21
- package/dist/fragments/List.svelte.d.ts +0 -38
- package/dist/fragments/Selector.svelte +0 -26
- package/dist/fragments/Selector.svelte.d.ts +0 -38
- package/dist/main/machine/IDbCollection.d.ts +0 -69
- package/dist/main/machine/IDbCollection.js +0 -98
- package/dist/main/machine/IDbCollectionFieldForge.d.ts +0 -42
- package/dist/main/machine/IDbCollectionFieldForge.js +0 -74
- package/dist/main/machine/IDbCollectionFieldValues.d.ts +0 -46
- package/dist/main/machine/IDbCollectionFieldValues.js +0 -62
- package/dist/main/machine/IDbCollectionValues.d.ts +0 -78
- package/dist/main/machine/IDbCollectionValues.js +0 -203
- package/dist/main/machine/IDbError.d.ts +0 -6
- package/dist/main/machine/IDbError.js +0 -61
- package/dist/main/machine/IDbFormValidate.d.ts +0 -55
- package/dist/main/machine/IDbFormValidate.js +0 -183
- package/dist/main/machine/IDbValidationError.d.ts +0 -19
- package/dist/main/machine/IDbValidationError.js +0 -24
- package/dist/main/machine/types.d.ts +0 -1
- package/dist/main/machine/types.js +0 -1
- package/dist/main/machineForge.d.ts +0 -57
- package/dist/main/machineForge.js +0 -105
- package/dist/types/appschemeTypes.d.ts +0 -71
- package/dist/types/appschemeTypes.js +0 -83
- package/dist/ui/CollectionButton.svelte +0 -26
- package/dist/ui/CollectionButton.svelte.d.ts +0 -29
- package/dist/ui/CollectionFieldGuess.svelte +0 -29
- package/dist/ui/CollectionFieldGuess.svelte.d.ts +0 -11
- package/dist/ui/CollectionFks.svelte +0 -24
- package/dist/ui/CollectionFks.svelte.d.ts +0 -9
- package/dist/ui/CollectionList.svelte +0 -95
- package/dist/ui/CollectionList.svelte.d.ts +0 -37
- package/dist/ui/CollectionListMenu.svelte +0 -47
- package/dist/ui/CollectionListMenu.svelte.d.ts +0 -34
- package/dist/ui/CollectionReverseFks.svelte +0 -56
- package/dist/ui/CollectionReverseFks.svelte.d.ts +0 -18
- /package/dist/{fragments → data-ui/fragments}/Skeleton.svelte.d.ts +0 -0
- /package/dist/{db → main/api}/types.js +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Sort.svelte
|
|
3
|
+
Composable sort menu — prefs-aware. Drop next to <DataList collection> sharing the
|
|
4
|
+
same collection/prefsScope; both bind the same shared prefs store (mediator) and stay in sync.
|
|
5
|
+
|
|
6
|
+
@prop {string} collection
|
|
7
|
+
@prop {string} [prefsScope] - override scope (must match the DataList's)
|
|
8
|
+
@prop {boolean} [usePrefs=true]
|
|
9
|
+
-->
|
|
10
|
+
<script module lang="ts">
|
|
11
|
+
export interface SortProps {
|
|
12
|
+
collection: string;
|
|
13
|
+
prefsScope?: string;
|
|
14
|
+
usePrefs?: boolean;
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { machine } from '../../main/machine.js';
|
|
20
|
+
import {
|
|
21
|
+
useMachinePrefs,
|
|
22
|
+
dataListPrefsScope,
|
|
23
|
+
dataListPrefsDefaults
|
|
24
|
+
} from '../utils/useMachinePrefs.svelte.js';
|
|
25
|
+
import DataSort from './DataSort.svelte';
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
collection,
|
|
29
|
+
prefsScope,
|
|
30
|
+
usePrefs = true
|
|
31
|
+
}: SortProps = $props();
|
|
32
|
+
|
|
33
|
+
const scope = $derived(dataListPrefsScope(collection, prefsScope));
|
|
34
|
+
const prefs = useMachinePrefs(() => scope, dataListPrefsDefaults(), () => usePrefs);
|
|
35
|
+
|
|
36
|
+
let open = $state(false);
|
|
37
|
+
|
|
38
|
+
const fields = $derived.by(() => {
|
|
39
|
+
const logic = machine.logic.collection(collection);
|
|
40
|
+
const pres = logic?.template?.presentation as string | undefined;
|
|
41
|
+
if (pres) return pres.split(/\s+/).filter(Boolean);
|
|
42
|
+
return Object.keys(logic?.fields ?? {}).filter((f) => !f.startsWith('_'));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const active = $derived((prefs.slots.sortBy ?? []).length > 0);
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<div class="sort-menu">
|
|
49
|
+
<button type="button" class="sort-trigger" class:active onclick={() => (open = !open)}>Sort ▾</button>
|
|
50
|
+
{#if open}
|
|
51
|
+
<div class="sort-pop" role="menu">
|
|
52
|
+
{#each fields as f (f)}
|
|
53
|
+
<DataSort field={f} bind:sortBy={() => prefs.get('sortBy'), (v) => prefs.set('sortBy', v)} />
|
|
54
|
+
{/each}
|
|
55
|
+
{#if !fields.length}<span class="sort-empty">No fields</span>{/if}
|
|
56
|
+
</div>
|
|
57
|
+
{/if}
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
@layer components {
|
|
62
|
+
.sort-menu {
|
|
63
|
+
position: relative;
|
|
64
|
+
display: inline-block;
|
|
65
|
+
}
|
|
66
|
+
.sort-trigger {
|
|
67
|
+
padding: var(--pad-xs) var(--pad-sm);
|
|
68
|
+
border: var(--border-width) solid var(--color-border);
|
|
69
|
+
background: var(--color-surface);
|
|
70
|
+
border-radius: var(--radius-sm);
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
font-size: var(--text-sm);
|
|
73
|
+
}
|
|
74
|
+
.sort-trigger.active {
|
|
75
|
+
background: var(--color-primary);
|
|
76
|
+
color: var(--default-color-surface-light);
|
|
77
|
+
border-color: var(--color-primary);
|
|
78
|
+
}
|
|
79
|
+
.sort-pop {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 100%;
|
|
82
|
+
left: 0;
|
|
83
|
+
margin-top: var(--marg-xs);
|
|
84
|
+
padding: var(--pad-xs);
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
gap: var(--gutter-xs);
|
|
88
|
+
background: var(--color-surface-overlay);
|
|
89
|
+
border: var(--border-width) solid var(--color-border);
|
|
90
|
+
border-radius: var(--radius-sm);
|
|
91
|
+
box-shadow: var(--shadow-md);
|
|
92
|
+
min-width: calc(var(--gutter-3xl) * 2.5);
|
|
93
|
+
z-index: var(--z-dropdown);
|
|
94
|
+
}
|
|
95
|
+
.sort-empty {
|
|
96
|
+
color: var(--color-text-muted);
|
|
97
|
+
font-size: var(--text-sm);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
DataCount.svelte
|
|
3
|
+
Reactive record count for a collection — `machine.store(collection, where).records.length`,
|
|
4
|
+
optionally narrowed by a client-side predicate (for aggregates qoolie's Where can't express:
|
|
5
|
+
orphans, status exclusion, distinct…).
|
|
6
|
+
|
|
7
|
+
`where` is captured once at setup and passed straight to machine.store — per CLAUDE.md
|
|
8
|
+
invariant 10, machine.store() registers a subscription at call time and must not be
|
|
9
|
+
re-invoked reactively. A reactive query is expressed via `filter` instead, evaluated
|
|
10
|
+
inside the `count` $derived over the already-subscribed `records`.
|
|
11
|
+
|
|
12
|
+
@prop {string} collection
|
|
13
|
+
@prop {Where<T>} [where] - static qoolie where, applied at the store subscription
|
|
14
|
+
@prop {(record: T) => boolean} [filter] - reactive client-side predicate, applied on top of `where`
|
|
15
|
+
@prop {string} [label]
|
|
16
|
+
@snippet children({ count, records }) - custom rendering; default = label + count
|
|
17
|
+
-->
|
|
18
|
+
<script module lang="ts">
|
|
19
|
+
import type { Snippet } from 'svelte';
|
|
20
|
+
import type { Where } from '../../types/index.js';
|
|
21
|
+
|
|
22
|
+
export interface DataCountProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
23
|
+
collection: string;
|
|
24
|
+
where?: Where<T>;
|
|
25
|
+
filter?: (record: T) => boolean;
|
|
26
|
+
label?: string;
|
|
27
|
+
children?: Snippet<[{ count: number; records: T[] }]>;
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" generics="T extends Record<string, unknown>">
|
|
32
|
+
import { machine } from '../../main/machine.js';
|
|
33
|
+
|
|
34
|
+
let { collection, where, filter, label, children }: DataCountProps<T> = $props();
|
|
35
|
+
|
|
36
|
+
// Setup-time subscription only — see file header.
|
|
37
|
+
const src = machine.store<T>(collection, where);
|
|
38
|
+
|
|
39
|
+
const records = $derived(filter ? (src.records as T[]).filter(filter) : (src.records as T[]));
|
|
40
|
+
const count = $derived(records.length);
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
{#if children}
|
|
44
|
+
{@render children({ count, records })}
|
|
45
|
+
{:else}
|
|
46
|
+
<data-count-fragment>
|
|
47
|
+
{#if label}<span class="data-count-label">{label}</span>{/if}
|
|
48
|
+
<span class="data-count-value">{count}</span>
|
|
49
|
+
</data-count-fragment>
|
|
50
|
+
{/if}
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
@layer components {
|
|
54
|
+
data-count-fragment {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: baseline;
|
|
57
|
+
gap: var(--gutter-xs);
|
|
58
|
+
}
|
|
59
|
+
.data-count-label {
|
|
60
|
+
color: var(--color-text-muted);
|
|
61
|
+
font-size: var(--text-sm);
|
|
62
|
+
}
|
|
63
|
+
.data-count-value {
|
|
64
|
+
font-weight: var(--font-semibold);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Where } from '../../types/index.js';
|
|
3
|
+
export interface DataCountProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
4
|
+
collection: string;
|
|
5
|
+
where?: Where<T>;
|
|
6
|
+
filter?: (record: T) => boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
children?: Snippet<[{
|
|
9
|
+
count: number;
|
|
10
|
+
records: T[];
|
|
11
|
+
}]>;
|
|
12
|
+
}
|
|
13
|
+
declare function $$render<T extends Record<string, unknown>>(): {
|
|
14
|
+
props: DataCountProps<T>;
|
|
15
|
+
exports: {};
|
|
16
|
+
bindings: "";
|
|
17
|
+
slots: {};
|
|
18
|
+
events: {};
|
|
19
|
+
};
|
|
20
|
+
declare class __sveltets_Render<T extends Record<string, unknown>> {
|
|
21
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
22
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
23
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
24
|
+
bindings(): "";
|
|
25
|
+
exports(): {};
|
|
26
|
+
}
|
|
27
|
+
interface $$IsomorphicComponent {
|
|
28
|
+
new <T extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
29
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
30
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
31
|
+
<T extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
32
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
33
|
+
}
|
|
34
|
+
declare const DataCount: $$IsomorphicComponent;
|
|
35
|
+
type DataCount<T extends Record<string, unknown>> = InstanceType<typeof DataCount<T>>;
|
|
36
|
+
export default DataCount;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
DataFk.svelte
|
|
3
|
+
Forward FK relation viewer — shows collections this record points to.
|
|
4
|
+
@role data-relations
|
|
5
|
+
@prop {string} collection - Collection name
|
|
6
|
+
@prop {SortBy | SortBy[]} [sortBy] - Sort FK entries
|
|
7
|
+
@prop {string} [groupBy] - Group FK entries by property
|
|
8
|
+
@slot children (let:item) - Custom FK rendering
|
|
9
|
+
-->
|
|
10
|
+
<script module lang="ts">
|
|
11
|
+
import type { Snippet } from 'svelte';
|
|
12
|
+
import type { TplCollectionName, SortBy } from '../../types/index.js';
|
|
13
|
+
|
|
14
|
+
export interface DataFkProps {
|
|
15
|
+
collection: TplCollectionName;
|
|
16
|
+
sortBy?: SortBy | SortBy[];
|
|
17
|
+
groupBy?: string;
|
|
18
|
+
children?: Snippet<[[string, Record<string, unknown>]]>;
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { machine } from '../../main/machine.js';
|
|
24
|
+
import { sortItems, groupItems } from '../utils/data-utils.js';
|
|
25
|
+
|
|
26
|
+
let { collection, sortBy, groupBy, children }: DataFkProps = $props();
|
|
27
|
+
|
|
28
|
+
const fks = $derived(machine.logic.collection(collection)?.parseFks() ?? {});
|
|
29
|
+
|
|
30
|
+
const fkEntries = $derived(
|
|
31
|
+
Object.entries(fks).map(([key, def]) => ({ key, ...(def as Record<string, unknown>) }))
|
|
32
|
+
);
|
|
33
|
+
const sortedFks = $derived(sortBy ? sortItems(fkEntries, sortBy) : fkEntries);
|
|
34
|
+
const groups = $derived(groupBy ? groupItems(sortedFks, groupBy) : undefined);
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
{#if groups}
|
|
38
|
+
{#each Array.from(groups) as [groupKey, groupEntries] (groupKey)}
|
|
39
|
+
<section>
|
|
40
|
+
<header>{groupKey}</header>
|
|
41
|
+
{#each groupEntries as entry (entry.key)}
|
|
42
|
+
<div>{entry.key}
|
|
43
|
+
{#if children}{@render children([entry.key, entry])}{/if}
|
|
44
|
+
</div>
|
|
45
|
+
{/each}
|
|
46
|
+
</section>
|
|
47
|
+
{/each}
|
|
48
|
+
{:else}
|
|
49
|
+
{#each sortedFks as entry (entry.key)}
|
|
50
|
+
<div>{entry.key}
|
|
51
|
+
{#if children}{@render children([entry.key, entry])}{/if}
|
|
52
|
+
</div>
|
|
53
|
+
{/each}
|
|
54
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { TplCollectionName, SortBy } from '../../types/index.js';
|
|
3
|
+
export interface DataFkProps {
|
|
4
|
+
collection: TplCollectionName;
|
|
5
|
+
sortBy?: SortBy | SortBy[];
|
|
6
|
+
groupBy?: string;
|
|
7
|
+
children?: Snippet<[[string, Record<string, unknown>]]>;
|
|
8
|
+
}
|
|
9
|
+
declare const DataFk: import("svelte").Component<DataFkProps, {}, "">;
|
|
10
|
+
type DataFk = ReturnType<typeof DataFk>;
|
|
11
|
+
export default DataFk;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
DataForm.svelte
|
|
3
|
+
Smart CRUD form — fetch, validate, submit, field iteration.
|
|
4
|
+
@role data-form
|
|
5
|
+
@prop {string} collection - Collection name
|
|
6
|
+
@prop {string} [dataId] - Record id for update/show mode
|
|
7
|
+
@prop {'show'|'create'|'update'} [mode] - Form mode
|
|
8
|
+
@prop {Record<string,unknown>} [withData] - Additional data to merge
|
|
9
|
+
@prop {Record<string,unknown>} [data] - Initial data override
|
|
10
|
+
@prop {string} [groupFieldBy] - FK relation key on appscheme_field to group fields by (e.g. 'appscheme_field_type')
|
|
11
|
+
@prop {(payload: {mode: string; data: Record<string,unknown>}) => void} [onsubmit] - Submit callback
|
|
12
|
+
-->
|
|
13
|
+
<script module lang="ts">
|
|
14
|
+
export interface DataFormProps {
|
|
15
|
+
onsubmit?: (payload: { mode: string; data: Record<string, unknown> }) => void;
|
|
16
|
+
mode?: 'show' | 'create' | 'update';
|
|
17
|
+
collection: string;
|
|
18
|
+
data?: Record<string, unknown>;
|
|
19
|
+
dataId?: string | number;
|
|
20
|
+
withData?: Record<string, unknown>;
|
|
21
|
+
groupFieldBy?: string;
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import { machine } from '../../main/machine.js';
|
|
27
|
+
import { SchemeFieldDefaultValues } from '../../main/machine/SchemeFieldDefaultValues.js';
|
|
28
|
+
import DataRecord from './DataRecord.svelte';
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
onsubmit: onsubmit_callback,
|
|
32
|
+
mode = 'show',
|
|
33
|
+
collection,
|
|
34
|
+
data,
|
|
35
|
+
dataId,
|
|
36
|
+
withData,
|
|
37
|
+
groupFieldBy
|
|
38
|
+
}: DataFormProps = $props();
|
|
39
|
+
|
|
40
|
+
const store = $derived(collection ? machine.collection(collection) : undefined);
|
|
41
|
+
const collLogic = $derived(collection ? machine.logic.collection(collection) : null);
|
|
42
|
+
const formFields = $derived(collLogic?.parse() ?? {});
|
|
43
|
+
const validator = $derived(collLogic?.validator);
|
|
44
|
+
const indexName = $derived(collLogic?.index);
|
|
45
|
+
|
|
46
|
+
const inputFormId = $derived(`form-${String(collection ?? '')}-${mode ?? ''}`);
|
|
47
|
+
|
|
48
|
+
let formData = $state<Record<string, unknown>>({});
|
|
49
|
+
let validationErrors = $state<Record<string, string>>({});
|
|
50
|
+
let isSubmitting = $state(false);
|
|
51
|
+
let submitError = $state<string | null>(null);
|
|
52
|
+
|
|
53
|
+
$effect(() => {
|
|
54
|
+
if (mode === 'create') {
|
|
55
|
+
formData = {
|
|
56
|
+
...SchemeFieldDefaultValues.getDefaults(Object.keys(formFields), collection),
|
|
57
|
+
...data,
|
|
58
|
+
...withData
|
|
59
|
+
};
|
|
60
|
+
} else if (store && dataId) {
|
|
61
|
+
const id = isNaN(Number(dataId)) ? dataId : Number(dataId);
|
|
62
|
+
(async () => {
|
|
63
|
+
const record = await store.get(id) ?? {};
|
|
64
|
+
formData = { ...data, ...withData, ...record };
|
|
65
|
+
})();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const validate = async (data: Record<string, unknown>) => {
|
|
70
|
+
const v = validator;
|
|
71
|
+
if (!v || typeof v.validateForm !== 'function') return true;
|
|
72
|
+
|
|
73
|
+
const ignore = mode === 'create' && indexName ? [indexName] : undefined;
|
|
74
|
+
const out = await v.validateForm(data, { ignoreFields: ignore });
|
|
75
|
+
|
|
76
|
+
validationErrors = out.errors || {};
|
|
77
|
+
return out.isValid;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
async function handleSubmit(event: SubmitEvent) {
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
if (mode === 'show') return;
|
|
83
|
+
|
|
84
|
+
isSubmitting = true;
|
|
85
|
+
submitError = null;
|
|
86
|
+
|
|
87
|
+
const snapshot = $state.snapshot(formData);
|
|
88
|
+
|
|
89
|
+
if (!(await validate(snapshot))) {
|
|
90
|
+
isSubmitting = false;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
let writtenId: unknown = dataId;
|
|
96
|
+
if (mode === 'create' && !dataId) {
|
|
97
|
+
const created = await machine.action(collection, { ...snapshot, ...withData });
|
|
98
|
+
writtenId = created?.id ?? (snapshot as Record<string, unknown>).id;
|
|
99
|
+
} else if (mode === 'update' && dataId) {
|
|
100
|
+
await machine.action(collection, snapshot, { upsertOn: ['id'] });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
void machine.action('appuser_activity', {
|
|
104
|
+
code: mode === 'create' ? 'CREATE' : 'UPDATE',
|
|
105
|
+
collection,
|
|
106
|
+
collection_value: writtenId ?? '',
|
|
107
|
+
collection_vars: { fields: Object.keys(snapshot) }
|
|
108
|
+
}, { touch: 'timestamp' });
|
|
109
|
+
|
|
110
|
+
onsubmit_callback?.({ mode, data: snapshot });
|
|
111
|
+
} catch (e) {
|
|
112
|
+
console.error('Submission failed', e);
|
|
113
|
+
submitError = e instanceof Error ? e.message : 'Submission failed.';
|
|
114
|
+
} finally {
|
|
115
|
+
isSubmitting = false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let errorMessage = $state<string | null>(null);
|
|
120
|
+
|
|
121
|
+
$effect(() => {
|
|
122
|
+
if (!machine.logic.collection(collection)) {
|
|
123
|
+
errorMessage = `Collection '${collection}' non trouvée dans le schéma.`;
|
|
124
|
+
} else {
|
|
125
|
+
errorMessage = null;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
{#if errorMessage}
|
|
131
|
+
<div class="error-message">{errorMessage}</div>
|
|
132
|
+
{:else}
|
|
133
|
+
<form
|
|
134
|
+
id={inputFormId}
|
|
135
|
+
name={inputFormId}
|
|
136
|
+
aria-labelledby="form-title"
|
|
137
|
+
onsubmit={handleSubmit}
|
|
138
|
+
>
|
|
139
|
+
</form>
|
|
140
|
+
|
|
141
|
+
<h2 id="form-title" class="sr-only">
|
|
142
|
+
{mode} {collection}
|
|
143
|
+
</h2>
|
|
144
|
+
|
|
145
|
+
<div class="flex">
|
|
146
|
+
<div class="crud {mode}">
|
|
147
|
+
<DataRecord
|
|
148
|
+
bind:data={formData}
|
|
149
|
+
{collection}
|
|
150
|
+
{mode}
|
|
151
|
+
{groupFieldBy}
|
|
152
|
+
inputForm={inputFormId}
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
{#if submitError}
|
|
158
|
+
<div class="error-message">{submitError}</div>
|
|
159
|
+
{/if}
|
|
160
|
+
|
|
161
|
+
{#if mode !== 'show'}
|
|
162
|
+
<div class="toolbar toolbar-end">
|
|
163
|
+
<button
|
|
164
|
+
type="submit"
|
|
165
|
+
class="btn-primary"
|
|
166
|
+
form={inputFormId}
|
|
167
|
+
disabled={isSubmitting}
|
|
168
|
+
aria-label="Submit"
|
|
169
|
+
>
|
|
170
|
+
{isSubmitting ? '...' : 'Valider'}
|
|
171
|
+
</button>
|
|
172
|
+
</div>
|
|
173
|
+
{/if}
|
|
174
|
+
{/if}
|
|
175
|
+
|
|
176
|
+
<style>
|
|
177
|
+
@layer components {
|
|
178
|
+
.sr-only {
|
|
179
|
+
position: absolute;
|
|
180
|
+
width: var(--border-width);
|
|
181
|
+
height: var(--border-width);
|
|
182
|
+
padding: 0;
|
|
183
|
+
margin: calc(-1 * var(--border-width));
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
clip: rect(0,0,0,0);
|
|
186
|
+
white-space: nowrap;
|
|
187
|
+
border-width: 0;
|
|
188
|
+
}
|
|
189
|
+
.error-message { color: var(--color-critical); padding: var(--pad-md); }
|
|
190
|
+
}
|
|
191
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface DataFormProps {
|
|
2
|
+
onsubmit?: (payload: {
|
|
3
|
+
mode: string;
|
|
4
|
+
data: Record<string, unknown>;
|
|
5
|
+
}) => void;
|
|
6
|
+
mode?: 'show' | 'create' | 'update';
|
|
7
|
+
collection: string;
|
|
8
|
+
data?: Record<string, unknown>;
|
|
9
|
+
dataId?: string | number;
|
|
10
|
+
withData?: Record<string, unknown>;
|
|
11
|
+
groupFieldBy?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const DataForm: import("svelte").Component<DataFormProps, {}, "">;
|
|
14
|
+
type DataForm = ReturnType<typeof DataForm>;
|
|
15
|
+
export default DataForm;
|