@cratis/components 0.1.12 → 0.1.13

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.
Files changed (77) hide show
  1. package/dist/cjs/CommandDialog/CommandDialog.js.map +1 -1
  2. package/dist/cjs/CommandForm/CommandForm.js +6 -2
  3. package/dist/cjs/CommandForm/CommandForm.js.map +1 -1
  4. package/dist/cjs/CommandForm/CommandFormFields.js.map +1 -1
  5. package/dist/cjs/DataTables/DataTableForObservableQuery.js.map +1 -1
  6. package/dist/cjs/DataTables/DataTableForQuery.js.map +1 -1
  7. package/dist/cjs/PivotViewer/components/PivotCanvas.js +3 -3
  8. package/dist/cjs/PivotViewer/components/PivotCanvas.js.map +1 -1
  9. package/dist/cjs/PivotViewer/components/PivotViewerMain.js.map +1 -1
  10. package/dist/cjs/PivotViewer/components/RangeHistogramFilter.js.map +1 -1
  11. package/dist/cjs/PivotViewer/components/pivot/buckets.js.map +1 -1
  12. package/dist/cjs/PivotViewer/components/pivot/sprites.js +1 -1
  13. package/dist/cjs/PivotViewer/components/pivot/sprites.js.map +1 -1
  14. package/dist/cjs/PivotViewer/components/pivot/visibility.js.map +1 -1
  15. package/dist/cjs/PivotViewer/hooks/usePanning.js.map +1 -1
  16. package/dist/cjs/PivotViewer/hooks/usePivotEngine.js.map +1 -1
  17. package/dist/cjs/PivotViewer/types.js.map +1 -1
  18. package/dist/esm/CommandDialog/CommandDialog.d.ts +2 -2
  19. package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
  20. package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
  21. package/dist/esm/CommandForm/CommandForm.d.ts +2 -2
  22. package/dist/esm/CommandForm/CommandForm.d.ts.map +1 -1
  23. package/dist/esm/CommandForm/CommandForm.js +6 -2
  24. package/dist/esm/CommandForm/CommandForm.js.map +1 -1
  25. package/dist/esm/CommandForm/CommandFormFields.d.ts +2 -2
  26. package/dist/esm/CommandForm/CommandFormFields.d.ts.map +1 -1
  27. package/dist/esm/CommandForm/CommandFormFields.js.map +1 -1
  28. package/dist/esm/Common/ErrorBoundary.stories.d.ts +1 -1
  29. package/dist/esm/Common/ErrorBoundary.stories.js.map +1 -1
  30. package/dist/esm/Common/FormElement.stories.d.ts +1 -1
  31. package/dist/esm/Common/FormElement.stories.js.map +1 -1
  32. package/dist/esm/Common/Page.stories.d.ts +1 -1
  33. package/dist/esm/Common/Page.stories.js.map +1 -1
  34. package/dist/esm/DataPage/DataPage.stories.d.ts +1 -1
  35. package/dist/esm/DataPage/DataPage.stories.js.map +1 -1
  36. package/dist/esm/DataTables/DataTableForObservableQuery.d.ts +4 -4
  37. package/dist/esm/DataTables/DataTableForObservableQuery.d.ts.map +1 -1
  38. package/dist/esm/DataTables/DataTableForObservableQuery.js.map +1 -1
  39. package/dist/esm/DataTables/DataTableForObservableQuery.stories.d.ts +1 -1
  40. package/dist/esm/DataTables/DataTableForObservableQuery.stories.js.map +1 -1
  41. package/dist/esm/DataTables/DataTableForQuery.d.ts +4 -4
  42. package/dist/esm/DataTables/DataTableForQuery.d.ts.map +1 -1
  43. package/dist/esm/DataTables/DataTableForQuery.js.map +1 -1
  44. package/dist/esm/DataTables/DataTableForQuery.stories.d.ts +1 -1
  45. package/dist/esm/DataTables/DataTableForQuery.stories.js.map +1 -1
  46. package/dist/esm/Dialogs/ConfirmationDialog.stories.js.map +1 -1
  47. package/dist/esm/PivotViewer/components/PivotCanvas.d.ts +2 -2
  48. package/dist/esm/PivotViewer/components/PivotCanvas.d.ts.map +1 -1
  49. package/dist/esm/PivotViewer/components/PivotCanvas.js +3 -3
  50. package/dist/esm/PivotViewer/components/PivotCanvas.js.map +1 -1
  51. package/dist/esm/PivotViewer/components/PivotViewerMain.js.map +1 -1
  52. package/dist/esm/PivotViewer/components/RangeHistogramFilter.js.map +1 -1
  53. package/dist/esm/PivotViewer/components/pivot/buckets.js.map +1 -1
  54. package/dist/esm/PivotViewer/components/pivot/sprites.js +1 -1
  55. package/dist/esm/PivotViewer/components/pivot/sprites.js.map +1 -1
  56. package/dist/esm/PivotViewer/components/pivot/visibility.js.map +1 -1
  57. package/dist/esm/PivotViewer/engine/pivot.worker.d.ts.map +1 -1
  58. package/dist/esm/PivotViewer/engine/pivot.worker.js.map +1 -1
  59. package/dist/esm/PivotViewer/hooks/useFilterPanelDrag.js.map +1 -1
  60. package/dist/esm/PivotViewer/hooks/usePanning.js.map +1 -1
  61. package/dist/esm/PivotViewer/hooks/usePivotEngine.js.map +1 -1
  62. package/dist/esm/PivotViewer/types.js.map +1 -1
  63. package/dist/esm/TimeMachine/EventsView.stories.d.ts +1 -1
  64. package/dist/esm/TimeMachine/EventsView.stories.js.map +1 -1
  65. package/dist/esm/TimeMachine/Properties.stories.d.ts +1 -1
  66. package/dist/esm/TimeMachine/Properties.stories.js.map +1 -1
  67. package/dist/esm/TimeMachine/ReadModelView.stories.d.ts +1 -1
  68. package/dist/esm/TimeMachine/ReadModelView.stories.js.map +1 -1
  69. package/dist/esm/TimeMachine/TimeMachine.stories.d.ts +1 -1
  70. package/dist/esm/TimeMachine/TimeMachine.stories.js.map +1 -1
  71. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  72. package/dist/esm/vite.config.js.map +1 -1
  73. package/dist/esm/vitest.setup.d.ts +2 -0
  74. package/dist/esm/vitest.setup.d.ts.map +1 -0
  75. package/dist/esm/vitest.setup.js +8 -0
  76. package/dist/esm/vitest.setup.js.map +1 -0
  77. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Constructor } from '@cratis/fundamentals';\nimport { Dialog } from 'primereact/dialog';\nimport { Button } from 'primereact/button';\nimport React, { createContext, useContext } from 'react';\nimport { CommandForm, useCommandFormContext, BeforeExecuteCallback } from '../CommandForm/CommandForm';\nimport { useCommandInstance } from '../CommandForm/CommandForm';\n\nexport type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\nexport type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n\nexport interface CommandDialogProps<TCommand, TResponse = object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n visible: boolean;\n header: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmIcon?: string;\n cancelIcon?: string;\n onConfirm: (result: ICommandResult<TResponse>) => void | Promise<void>;\n onCancel: () => void;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n width?: string;\n}\n\ninterface CommandDialogContextValue<TCommand = unknown> {\n onSuccess: (result: ICommandResult<any>) => void | Promise<void>;\n onCancel: () => void;\n confirmLabel: string;\n cancelLabel: string;\n confirmIcon: string;\n cancelIcon: string;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n}\n\nconst CommandDialogContext = createContext<CommandDialogContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandDialogContext = <TCommand = unknown,>() => {\n const context = useContext(CommandDialogContext);\n if (!context) {\n throw new Error('useCommandDialogContext must be used within a CommandDialog');\n }\n return context as CommandDialogContextValue<TCommand>;\n};\n\nconst CommandDialogFormContent = () => {\n const command = useCommandInstance();\n const { setCommandResult, setCommandValues, isValid, onBeforeExecute } = useCommandFormContext();\n const { onSuccess: onConfirm, onCancel, confirmLabel, cancelLabel, confirmIcon, cancelIcon } = useCommandDialogContext();\n\n const handleConfirm = async () => {\n if (onBeforeExecute) {\n const transformedValues = onBeforeExecute(command);\n setCommandValues(transformedValues);\n }\n const result = await command.execute();\n if (result.isSuccess) {\n await onConfirm(result);\n } else {\n setCommandResult(result);\n }\n };\n\n const handleCancel = () => {\n onCancel();\n };\n\n return (\n <>\n <div className=\"card flex flex-wrap justify-content-center gap-3 mt-8\">\n <Button label={confirmLabel} icon={confirmIcon} onClick={handleConfirm} disabled={!isValid} />\n <Button label={cancelLabel} icon={cancelIcon} severity='secondary' onClick={handleCancel} />\n </div>\n </>\n );\n};\n\nconst CommandDialogFieldsWrapper = (props: { children: React.ReactNode }) => {\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n const component = child.type as any;\n if (component.displayName !== 'CommandFormField') {\n throw new Error(`Only CommandFormField components are allowed as children of CommandDialog.Fields. Got: ${component.displayName || component.name || 'Unknown'}`);\n }\n }\n });\n\n return (\n <CommandForm.Fields>\n {props.children}\n </CommandForm.Fields>\n );\n};\n\nconst CommandDialogComponent = <TCommand extends object = any, TResponse = object>(props: CommandDialogProps<TCommand, TResponse>) => {\n const {\n command,\n initialValues,\n currentValues,\n visible,\n header,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmIcon = 'pi pi-check',\n cancelIcon = 'pi pi-times',\n onConfirm,\n onCancel,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute,\n children,\n style = { width: '50vw' },\n width\n } = props;\n\n const dialogStyle = width ? { ...style, width } : style;\n\n const contextValue: CommandDialogContextValue<TCommand> = {\n onSuccess: onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmIcon,\n cancelIcon,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute\n };\n\n return (\n <Dialog\n header={header}\n visible={visible}\n style={dialogStyle}\n onHide={onCancel}\n contentStyle={{ overflow: 'visible' }}\n >\n <CommandDialogContext.Provider value={contextValue}>\n <CommandForm command={command} initialValues={initialValues} currentValues={currentValues} onFieldValidate={onFieldValidate} onFieldChange={onFieldChange} onBeforeExecute={onBeforeExecute}>\n {children}\n <CommandDialogFormContent />\n </CommandForm>\n </CommandDialogContext.Provider>\n </Dialog>\n );\n};\n\nCommandDialogComponent.Fields = CommandDialogFieldsWrapper;\n\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["createContext","useContext","useCommandInstance","useCommandFormContext","_jsx","_jsxs","Button","CommandForm","Dialog"],"mappings":";;;;;;;;AA8CA,MAAM,oBAAoB,GAAGA,mBAAa,CAAiD,SAAS,CAAC;AAE9F,MAAM,uBAAuB,GAAG,MAA0B;AAC7D,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,oBAAoB,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC;IAClF;AACA,IAAA,OAAO,OAA8C;AACzD;AAEA,MAAM,wBAAwB,GAAG,MAAK;AAClC,IAAA,MAAM,OAAO,GAAGC,8BAAkB,EAAE;AACpC,IAAA,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,GAAGC,iCAAqB,EAAE;AAChG,IAAA,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,uBAAuB,EAAE;AAExH,IAAA,MAAM,aAAa,GAAG,YAAW;QAC7B,IAAI,eAAe,EAAE;AACjB,YAAA,MAAM,iBAAiB,GAAG,eAAe,CAAC,OAAO,CAAC;YAClD,gBAAgB,CAAC,iBAAiB,CAAC;QACvC;AACA,QAAA,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE;AACtC,QAAA,IAAI,MAAM,CAAC,SAAS,EAAE;AAClB,YAAA,MAAM,SAAS,CAAC,MAAM,CAAC;QAC3B;aAAO;YACH,gBAAgB,CAAC,MAAM,CAAC;QAC5B;AACJ,IAAA,CAAC;IAED,MAAM,YAAY,GAAG,MAAK;AACtB,QAAA,QAAQ,EAAE;AACd,IAAA,CAAC;IAED,QACIC,gDACIC,eAAA,CAAA,KAAA,E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GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EACzB,KAAK,EACR,GAAG,KAAK;AAET,IAAA,MAAM,WAAW,GAAG,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK;AAEvD,IAAA,MAAM,YAAY,GAAwC;AACtD,QAAA,SAAS,EAAE,SAAS;QACpB,QAAQ;QACR,YAAY;QACZ,WAAW;QACX,WAAW;QACX,UAAU;QACV,eAAe;QACf,aAAa;QACb;KACH;AAED,IAAA,QACIH,cAAA,CAACI,aAAM,EAAA,EACH,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,QAAQ,EAChB,YAAY,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAA,QAAA,EAErCJ,eAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,QAAA,EAC9CC,eAAA,CAACE,uBAAW,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAA,QAAA,EAAA,CACtL,QAAQ,EACTH,cAAA,CAAC,wBAAwB,EAAA,EAAA,CAAG,CAAA,EAAA,CAClB,EAAA,CACc,EAAA,CAC3B;AAEjB,CAAC;AAED,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;;"}
1
+ {"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Constructor } from '@cratis/fundamentals';\nimport { Dialog } from 'primereact/dialog';\nimport { Button } from 'primereact/button';\nimport React, { createContext, useContext } from 'react';\nimport { CommandForm, useCommandFormContext, BeforeExecuteCallback } from '../CommandForm/CommandForm';\nimport { useCommandInstance } from '../CommandForm/CommandForm';\n\nexport type FieldValidator<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\nexport type FieldChangeCallback<TCommand> = (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n\nexport interface CommandDialogProps<TCommand, TResponse = object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n visible: boolean;\n header: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmIcon?: string;\n cancelIcon?: string;\n onConfirm: (result: ICommandResult<TResponse>) => void | Promise<void>;\n onCancel: () => void;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n width?: string;\n}\n\ninterface CommandDialogContextValue<TCommand = unknown> {\n onSuccess: (result: ICommandResult<unknown>) => void | Promise<void>;\n onCancel: () => void;\n confirmLabel: string;\n cancelLabel: string;\n confirmIcon: string;\n cancelIcon: string;\n onFieldValidate?: FieldValidator<TCommand>;\n onFieldChange?: FieldChangeCallback<TCommand>;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n}\n\nconst CommandDialogContext = createContext<CommandDialogContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandDialogContext = <TCommand = unknown,>() => {\n const context = useContext(CommandDialogContext);\n if (!context) {\n throw new Error('useCommandDialogContext must be used within a CommandDialog');\n }\n return context as CommandDialogContextValue<TCommand>;\n};\n\nconst CommandDialogFormContent = <TCommand extends { execute: () => Promise<ICommandResult<unknown>> }>() => {\n const command = useCommandInstance<TCommand>();\n const { setCommandResult, setCommandValues, isValid, onBeforeExecute } = useCommandFormContext<TCommand>();\n const { onSuccess: onConfirm, onCancel, confirmLabel, cancelLabel, confirmIcon, cancelIcon } = useCommandDialogContext<TCommand>();\n\n const handleConfirm = async () => {\n if (onBeforeExecute) {\n const transformedValues = onBeforeExecute(command);\n setCommandValues(transformedValues);\n }\n const result = await command.execute();\n if (result.isSuccess) {\n await onConfirm(result);\n } else {\n setCommandResult(result);\n }\n };\n\n const handleCancel = () => {\n onCancel();\n };\n\n return (\n <>\n <div className=\"card flex flex-wrap justify-content-center gap-3 mt-8\">\n <Button label={confirmLabel} icon={confirmIcon} onClick={handleConfirm} disabled={!isValid} />\n <Button label={cancelLabel} icon={cancelIcon} severity='secondary' onClick={handleCancel} />\n </div>\n </>\n );\n};\n\nconst CommandDialogFieldsWrapper = (props: { children: React.ReactNode }) => {\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n const component = child.type as React.ComponentType<unknown>;\n if (component.displayName !== 'CommandFormField') {\n throw new Error(`Only CommandFormField components are allowed as children of CommandDialog.Fields. Got: ${component.displayName || component.name || 'Unknown'}`);\n }\n }\n });\n\n return (\n <CommandForm.Fields>\n {props.children}\n </CommandForm.Fields>\n );\n};\n\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(props: CommandDialogProps<TCommand, TResponse>) => {\n const {\n command,\n initialValues,\n currentValues,\n visible,\n header,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n confirmIcon = 'pi pi-check',\n cancelIcon = 'pi pi-times',\n onConfirm,\n onCancel,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute,\n children,\n style = { width: '50vw' },\n width\n } = props;\n\n const dialogStyle = width ? { ...style, width } : style;\n\n const contextValue: CommandDialogContextValue<TCommand> = {\n onSuccess: onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmIcon,\n cancelIcon,\n onFieldValidate,\n onFieldChange,\n onBeforeExecute\n };\n\n return (\n <Dialog\n header={header}\n visible={visible}\n style={dialogStyle}\n onHide={onCancel}\n contentStyle={{ overflow: 'visible' }}\n >\n <CommandDialogContext.Provider value={contextValue}>\n <CommandForm command={command} initialValues={initialValues} currentValues={currentValues} onFieldValidate={onFieldValidate} onFieldChange={onFieldChange} onBeforeExecute={onBeforeExecute}>\n {children}\n <CommandDialogFormContent />\n </CommandForm>\n </CommandDialogContext.Provider>\n </Dialog>\n );\n};\n\nCommandDialogComponent.Fields = CommandDialogFieldsWrapper;\n\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["createContext","useContext","useCommandInstance","useCommandFormContext","_jsx","_jsxs","Button","CommandForm","Dialog"],"mappings":";;;;;;;;AA8CA,MAAM,oBAAoB,GAAGA,mBAAa,CAAiD,SAAS,CAAC;AAE9F,MAAM,uBAAuB,GAAG,MAA0B;AAC7D,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,oBAAoB,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC;IAClF;AACA,IAAA,OAAO,OAA8C;AACzD;AAEA,MAAM,wBAAwB,GAAG,MAA2E;AACxG,IAAA,MAAM,OAAO,GAAGC,8BAAkB,EAAY;AAC9C,IAAA,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,GAAGC,iCAAqB,EAAY;AAC1G,IAAA,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,uBAAuB,EAAY;AAElI,IAAA,MAAM,aAAa,GAAG,YAAW;QAC7B,IAAI,eAAe,EAAE;AACjB,YAAA,MAAM,iBAAiB,GAAG,eAAe,CAAC,OAAO,CAAC;YAClD,gBAAgB,CAAC,iBAAiB,CAAC;QACvC;AACA,QAAA,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE;AACtC,QAAA,IAAI,MAAM,CAAC,SAAS,EAAE;AAClB,YAAA,MAAM,SAAS,CAAC,MAAM,CAAC;QAC3B;aAAO;YACH,gBAAgB,CAAC,MAAM,CAAC;QAC5B;AACJ,I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AW,GAAG,aAAa,EAC3B,UAAU,GAAG,aAAa,EAC1B,SAAS,EACT,QAAQ,EACR,eAAe,EACf,aAAa,EACb,eAAe,EACf,QAAQ,EACR,KAAK,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EACzB,KAAK,EACR,GAAG,KAAK;AAET,IAAA,MAAM,WAAW,GAAG,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK;AAEvD,IAAA,MAAM,YAAY,GAAwC;AACtD,QAAA,SAAS,EAAE,SAAS;QACpB,QAAQ;QACR,YAAY;QACZ,WAAW;QACX,WAAW;QACX,UAAU;QACV,eAAe;QACf,aAAa;QACb;KACH;AAED,IAAA,QACIH,cAAA,CAACI,aAAM,EAAA,EACH,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,QAAQ,EAChB,YAAY,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAA,QAAA,EAErCJ,eAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,QAAA,EAC9CC,eAAA,CAACE,uBAAW,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAA,QAAA,EAAA,CACtL,QAAQ,EACTH,cAAA,CAAC,wBAAwB,EAAA,EAAA,CAAG,CAAA,EAAA,CAClB,EAAA,CACc,EAAA,CAC3B;AAEjB,CAAC;AAED,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAEnD,MAAM,aAAa,GAAG;;;;;"}
@@ -99,6 +99,8 @@ const getCommandFormFields = (props) => {
99
99
  return { fieldsOrColumns: hasColumns ? columns : fields, otherChildren, initialValuesFromFields };
100
100
  };
101
101
  function getPropertyNameFromAccessor(accessor) {
102
+ if (typeof accessor !== 'function')
103
+ return '';
102
104
  const fnStr = accessor.toString();
103
105
  const match = fnStr.match(/\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);
104
106
  return match ? match[1] : '';
@@ -109,7 +111,7 @@ const CommandFormComponent = (props) => {
109
111
  if (!props.currentValues)
110
112
  return {};
111
113
  const tempCommand = new props.command();
112
- const commandProperties = tempCommand.properties || [];
114
+ const commandProperties = (tempCommand.properties || []);
113
115
  const extracted = {};
114
116
  commandProperties.forEach((propertyName) => {
115
117
  if (props.currentValues[propertyName] !== undefined) {
@@ -123,7 +125,9 @@ const CommandFormComponent = (props) => {
123
125
  ...initialValuesFromFields,
124
126
  ...props.initialValues
125
127
  }), [valuesFromCurrentValues, initialValuesFromFields, props.initialValues]);
126
- const [commandInstance, setCommandValues] = commands.useCommand(props.command, mergedInitialValues);
128
+ const useCommandResult = commands.useCommand(props.command, mergedInitialValues);
129
+ const commandInstance = useCommandResult[0];
130
+ const setCommandValues = useCommandResult[1];
127
131
  const [commandResult, setCommandResult] = React.useState(undefined);
128
132
  const [fieldValidities, setFieldValidities] = React.useState({});
129
133
  const [customFieldErrors, setCustomFieldErrors] = React.useState({});
@@ -1 +1 @@
1
- {"version":3,"file":"CommandForm.js","sources":["../../../CommandForm/CommandForm.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandFormFields, ColumnInfo } from './CommandFormFields';\nimport { Constructor } from '@cratis/fundamentals';\nimport { useCommand, SetCommandValues } from '@cratis/arc.react/commands';\nimport { ICommandResult } from '@cratis/arc/commands';\nimport React, { createContext, useContext, useMemo, useState, useCallback } from 'react';\nimport type { CommandFormFieldProps } from './CommandFormField';\nimport { Panel } from 'primereact/panel';\n\nexport type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;\n\nexport interface CommandFormProps<TCommand extends object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n onFieldValidate?: (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\n onFieldChange?: (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n}\n\ninterface CommandFormContextValue<TCommand> {\n command: Constructor<TCommand>;\n commandInstance: TCommand;\n setCommandValues: SetCommandValues<TCommand>;\n commandResult?: ICommandResult<unknown>;\n setCommandResult: (result: ICommandResult<unknown>) => void;\n getFieldError: (propertyName: string) => string | undefined;\n isValid: boolean;\n setFieldValidity: (fieldName: string, isValid: boolean) => void;\n onFieldValidate?: (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\n onFieldChange?: (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n customFieldErrors: Record<string, string>;\n setCustomFieldError: (fieldName: string, error: string | undefined) => void;\n}\n\nconst CommandFormContext = createContext<CommandFormContextValue<any> | undefined>(undefined);\n\nexport const useCommandFormContext = <TCommand,>() => {\n const context = useContext(CommandFormContext);\n if (!context) {\n throw new Error('useCommandFormContext must be used within a CommandForm');\n }\n return context as CommandFormContextValue<TCommand>;\n};\n\n// Hook to get just the command instance for easier access\nexport const useCommandInstance = <TCommand = any>() => {\n const { commandInstance } = useCommandFormContext<any>();\n return commandInstance as TCommand;\n};\n\n// Hook to get setCommandResult for easier access\nexport const useSetCommandResult = () => {\n const { setCommandResult } = useCommandFormContext();\n return setCommandResult;\n};\n\nconst CommandFormFieldsWrapper = (props: { children: React.ReactNode }) => {\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n const component = child.type as any;\n if (component.displayName !== 'CommandFormField') {\n throw new Error(`Only CommandFormField components are allowed as children of CommandForm.Fields. Got: ${component.displayName || component.name || 'Unknown'}`);\n }\n }\n });\n\n return <></>;\n};\n\nCommandFormFieldsWrapper.displayName = 'CommandFormFieldsWrapper';\n\nconst getCommandFormFields = <TCommand,>(props: { children?: React.ReactNode }): { fieldsOrColumns: React.ReactElement[] | ColumnInfo[], otherChildren: React.ReactNode[], initialValuesFromFields: Partial<TCommand> } => {\n if (!props.children) {\n return { fieldsOrColumns: [], otherChildren: [], initialValuesFromFields: {} };\n }\n let fields: React.ReactElement<CommandFormFieldProps<any>>[] = [];\n const columns: ColumnInfo[] = [];\n let hasColumns = false;\n const otherChildren: React.ReactNode[] = [];\n let initialValuesFromFields: Partial<TCommand> = {};\n\n const extractInitialValue = (field: React.ReactElement) => {\n const fieldProps = field.props as any;\n if (fieldProps.currentValue !== undefined && fieldProps.value) {\n const propertyAccessor = fieldProps.value;\n const propertyName = getPropertyNameFromAccessor(propertyAccessor);\n if (propertyName) {\n initialValuesFromFields = { ...initialValuesFromFields, [propertyName]: fieldProps.currentValue } as Partial<TCommand>;\n }\n }\n };\n\n React.Children.toArray(props.children).forEach(child => {\n if (!React.isValidElement(child)) {\n otherChildren.push(child);\n return;\n }\n\n const component = child.type as any;\n\n // Check if child is a CommandFormColumn\n if (component.displayName === 'CommandFormColumn') {\n hasColumns = true;\n const childProps = child.props as { children?: React.ReactNode };\n const columnFields = React.Children.toArray(childProps.children).filter(child => {\n if (React.isValidElement(child)) {\n const comp = child.type as any;\n if (comp.displayName === 'CommandFormField') {\n extractInitialValue(child as React.ReactElement);\n return true;\n }\n }\n return false;\n }) as React.ReactElement[];\n columns.push({ fields: columnFields as React.ReactElement<CommandFormFieldProps<any>>[] });\n }\n // Check if child is a CommandFormField (direct child)\n else if (component.displayName === 'CommandFormField') {\n extractInitialValue(child as React.ReactElement);\n fields.push(child as React.ReactElement<CommandFormFieldProps<any>>);\n }\n // Check if child is Fields wrapper (backwards compatibility)\n else if (component === CommandFormFieldsWrapper || component.displayName === 'CommandFormFieldsWrapper') {\n const childProps = child.props as { children: React.ReactNode };\n const relevantChildren = React.Children.toArray(childProps.children).filter(child => {\n if (React.isValidElement(child)) {\n const component = child.type as any;\n if (component.displayName === 'CommandFormField') {\n extractInitialValue(child as React.ReactElement);\n return true;\n }\n }\n return false;\n }) as React.ReactElement[];\n fields = [...fields, ...(relevantChildren as React.ReactElement<CommandFormFieldProps<any>>[])];\n }\n // Everything else is not a field, keep it as other children\n else {\n otherChildren.push(child);\n }\n });\n\n return { fieldsOrColumns: hasColumns ? columns : fields, otherChildren, initialValuesFromFields };\n};\n\n// Helper function to extract property name from accessor function\nfunction getPropertyNameFromAccessor<T>(accessor: (obj: T) => unknown): string {\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n}\n\nconst CommandFormComponent = <TCommand extends object = any>(props: CommandFormProps<TCommand>) => {\n const { fieldsOrColumns, otherChildren, initialValuesFromFields } = useMemo(() => getCommandFormFields<TCommand>(props), [props.children]);\n\n // Extract matching properties from currentValues\n const valuesFromCurrentValues = useMemo(() => {\n if (!props.currentValues) return {};\n\n const tempCommand = new props.command();\n const commandProperties = (tempCommand as any).properties || [];\n const extracted: Partial<TCommand> = {};\n\n commandProperties.forEach((propertyName: string) => {\n if ((props.currentValues as any)[propertyName] !== undefined) {\n (extracted as any)[propertyName] = (props.currentValues as any)[propertyName];\n }\n });\n\n return extracted;\n }, [props.currentValues, props.command]);\n\n // Merge initialValues prop with values extracted from field currentValue props and currentValues\n const mergedInitialValues = useMemo(() => ({\n ...valuesFromCurrentValues,\n ...initialValuesFromFields,\n ...props.initialValues\n }), [valuesFromCurrentValues, initialValuesFromFields, props.initialValues]);\n\n // useCommand returns [instance, setter] for the typed command. Provide generics so commandInstance is TCommand.\n const [commandInstance, setCommandValues] = useCommand<any>(props.command as Constructor<any>, mergedInitialValues as Partial<any>);\n const [commandResult, setCommandResult] = useState<ICommandResult<unknown> | undefined>(undefined);\n const [fieldValidities, setFieldValidities] = useState<Record<string, boolean>>({});\n const [customFieldErrors, setCustomFieldErrors] = useState<Record<string, string>>({});\n\n // Update command values when mergedInitialValues changes (e.g., when data loads asynchronously)\n React.useEffect(() => {\n if (mergedInitialValues && Object.keys(mergedInitialValues).length > 0) {\n setCommandValues(mergedInitialValues as TCommand);\n }\n }, [mergedInitialValues, setCommandValues]);\n\n const isValid = Object.values(fieldValidities).every(valid => valid);\n\n const setFieldValidity = useCallback((fieldName: string, isFieldValid: boolean) => {\n setFieldValidities(prev => ({ ...prev, [fieldName]: isFieldValid }));\n }, []);\n\n const setCustomFieldError = useCallback((fieldName: string, error: string | undefined) => {\n setCustomFieldErrors(prev => {\n if (error === undefined) {\n const newErrors = { ...prev };\n delete newErrors[fieldName];\n return newErrors;\n }\n return { ...prev, [fieldName]: error };\n });\n }, []);\n\n const getFieldError = (propertyName: string): string | undefined => {\n // Check custom field errors first\n if (customFieldErrors[propertyName]) {\n return customFieldErrors[propertyName];\n }\n\n if (!commandResult || !commandResult.validationResults) {\n return undefined;\n }\n\n for (const validationResult of commandResult.validationResults) {\n if (validationResult.members && validationResult.members.includes(propertyName)) {\n return validationResult.message;\n }\n }\n\n return undefined;\n };\n\n const exceptionMessages = commandResult?.exceptionMessages || [];\n const hasColumns = fieldsOrColumns.length > 0 && 'fields' in fieldsOrColumns[0];\n\n return (\n <CommandFormContext.Provider value={{ command: props.command, commandInstance, setCommandValues, commandResult, setCommandResult, getFieldError, isValid, setFieldValidity, onFieldValidate: props.onFieldValidate, onFieldChange: props.onFieldChange, onBeforeExecute: props.onBeforeExecute, customFieldErrors, setCustomFieldError }}>\n <CommandFormFields fields={hasColumns ? undefined : (fieldsOrColumns as React.ReactElement<CommandFormFieldProps<any>>[])} columns={hasColumns ? fieldsOrColumns as ColumnInfo[] : undefined} />\n {exceptionMessages.length > 0 && (\n <div className=\"card flex flex-row gap-3 mt-3\">\n <Panel header=\"The server responded with\" className=\"w-full\">\n <ul>\n {exceptionMessages.map((msg, idx) => (\n <li key={idx}>{msg}</li>\n ))}\n </ul>\n </Panel>\n </div>\n )}\n {otherChildren}\n </CommandFormContext.Provider>\n );\n};\n\nconst CommandFormColumnComponent = (_props: { children: React.ReactNode }) => {\n void _props;\n return <></>;\n};\n\nCommandFormColumnComponent.displayName = 'CommandFormColumn';\n\nCommandFormComponent.Fields = CommandFormFieldsWrapper;\nCommandFormComponent.Column = CommandFormColumnComponent;\n\nexport const CommandForm = CommandFormComponent;\n"],"names":["createContext","useContext","_jsx","useMemo","useCommand","useState","useCallback","_jsxs","CommandFormFields","Panel"],"mappings":";;;;;;;;AAuCA,MAAM,kBAAkB,GAAGA,mBAAa,CAA2C,SAAS,CAAC;AAEtF,MAAM,qBAAqB,GAAG,MAAgB;AACjD,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,kBAAkB,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC;IAC9E;AACA,IAAA,OAAO,OAA4C;AACvD;AAGO,MAAM,kBAAkB,GAAG,MAAqB;AACnD,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,qBAAqB,EAAO;AACxD,IAAA,OAAO,eAA2B;AACtC;AAGO,MAAM,mBAAmB,GAAG,MAAK;AACpC,IAAA,MAAM,EAAE,gBAAgB,EAAE,GAAG,qBAAqB,EAAE;AACpD,IAAA,OAAO,gBAAgB;AAC3B;AAEA,MAAM,wBAAwB,GAAG,CAAC,KAAoC,KAAI;IACtE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,IAAG;AAC3C,QAAA,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;AAC7B,YAAA,MAAM,SAAS,GAAG,KAAK,CAAC,IAAW;AACnC,YAAA,IAAI,SAAS,CAAC,WAAW,KAAK,kBAAkB,EAAE;AAC9C,gBAAA,MAAM,IAAI,KAAK,CAAC,CAAA,qFAAA,EAAwF,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,SAAS,CAAA,CAAE,CAAC;YACnK;QACJ;AACJ,IAAA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a,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,EAAA,QAAA,EAAA,CACpUL,cAAA,CAACM,mCAAiB,EAAA,EAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAI,eAAoE,EAAE,OAAO,EAAE,UAAU,GAAG,eAA+B,GAAG,SAAS,EAAA,CAAI,EAC/L,iBAAiB,CAAC,MAAM,GAAG,CAAC,KACzBN,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,+BAA+B,EAAA,QAAA,EAC1CA,cAAA,CAACO,WAAK,EAAA,EAAC,MAAM,EAAC,2BAA2B,EAAC,SAAS,EAAC,QAAQ,EAAA,QAAA,EACxDP,cAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EACK,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,MAC5BA,cAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EAAe,GAAG,EAAA,EAAT,GAAG,CAAY,CAC3B,CAAC,EAAA,CACD,EAAA,CACD,EAAA,CACN,CACT,EACA,aAAa,CAAA,EAAA,CACY;AAEtC,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,MAAqC,KAAI;AAEzE,IAAA,OAAOA,uCAAK;AAChB,CAAC;AAED,0BAA0B,CAAC,WAAW,GAAG,mBAAmB;AAE5D,oBAAoB,CAAC,MAAM,GAAG,wBAAwB;AACtD,oBAAoB,CAAC,MAAM,GAAG,0BAA0B;AAEjD,MAAM,WAAW,GAAG;;;;;;;"}
1
+ {"version":3,"file":"CommandForm.js","sources":["../../../CommandForm/CommandForm.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandFormFields, ColumnInfo } from './CommandFormFields';\nimport { Constructor } from '@cratis/fundamentals';\nimport { useCommand, SetCommandValues } from '@cratis/arc.react/commands';\nimport { ICommandResult } from '@cratis/arc/commands';\nimport { Command } from '@cratis/arc/commands';\nimport React, { createContext, useContext, useMemo, useState, useCallback } from 'react';\nimport type { CommandFormFieldProps } from './CommandFormField';\nimport { Panel } from 'primereact/panel';\n\nexport type BeforeExecuteCallback<TCommand> = (values: TCommand) => TCommand;\n\nexport interface CommandFormProps<TCommand extends object> {\n command: Constructor<TCommand>;\n initialValues?: Partial<TCommand>;\n currentValues?: Partial<TCommand> | undefined;\n onFieldValidate?: (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\n onFieldChange?: (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n children?: React.ReactNode;\n}\n\ninterface CommandFormContextValue<TCommand> {\n command: Constructor<TCommand>;\n commandInstance: TCommand;\n setCommandValues: SetCommandValues<TCommand>;\n commandResult?: ICommandResult<unknown>;\n setCommandResult: (result: ICommandResult<unknown>) => void;\n getFieldError: (propertyName: string) => string | undefined;\n isValid: boolean;\n setFieldValidity: (fieldName: string, isValid: boolean) => void;\n onFieldValidate?: (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => string | undefined;\n onFieldChange?: (command: TCommand, fieldName: string, oldValue: unknown, newValue: unknown) => void;\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n customFieldErrors: Record<string, string>;\n setCustomFieldError: (fieldName: string, error: string | undefined) => void;\n}\n\nconst CommandFormContext = createContext<CommandFormContextValue<unknown> | undefined>(undefined);\n\nexport const useCommandFormContext = <TCommand,>() => {\n const context = useContext(CommandFormContext);\n if (!context) {\n throw new Error('useCommandFormContext must be used within a CommandForm');\n }\n return context as CommandFormContextValue<TCommand>;\n};\n\n// Hook to get just the command instance for easier access\nexport const useCommandInstance = <TCommand = unknown>() => {\n const { commandInstance } = useCommandFormContext<TCommand>();\n return commandInstance as TCommand;\n};\n\n// Hook to get setCommandResult for easier access\nexport const useSetCommandResult = () => {\n const { setCommandResult } = useCommandFormContext();\n return setCommandResult;\n};\n\nconst CommandFormFieldsWrapper = (props: { children: React.ReactNode }) => {\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n const component = child.type as React.ComponentType<unknown>;\n if (component.displayName !== 'CommandFormField') {\n throw new Error(`Only CommandFormField components are allowed as children of CommandForm.Fields. Got: ${component.displayName || component.name || 'Unknown'}`);\n }\n }\n });\n\n return <></>;\n};\n\nCommandFormFieldsWrapper.displayName = 'CommandFormFieldsWrapper';\n\nconst getCommandFormFields = <TCommand,>(props: { children?: React.ReactNode }): { fieldsOrColumns: React.ReactElement[] | ColumnInfo[], otherChildren: React.ReactNode[], initialValuesFromFields: Partial<TCommand> } => {\n if (!props.children) {\n return { fieldsOrColumns: [], otherChildren: [], initialValuesFromFields: {} };\n }\n let fields: React.ReactElement<CommandFormFieldProps<unknown>>[] = [];\n const columns: ColumnInfo[] = [];\n let hasColumns = false;\n const otherChildren: React.ReactNode[] = [];\n let initialValuesFromFields: Partial<TCommand> = {};\n\n const extractInitialValue = (field: React.ReactElement) => {\n const fieldProps = field.props as Record<string, unknown>;\n if (fieldProps.currentValue !== undefined && fieldProps.value) {\n const propertyAccessor = fieldProps.value;\n const propertyName = getPropertyNameFromAccessor(propertyAccessor);\n if (propertyName) {\n initialValuesFromFields = { ...initialValuesFromFields, [propertyName]: fieldProps.currentValue } as Partial<TCommand>;\n }\n }\n };\n\n React.Children.toArray(props.children).forEach(child => {\n if (!React.isValidElement(child)) {\n otherChildren.push(child);\n return;\n }\n\n const component = child.type as React.ComponentType<unknown>;\n\n // Check if child is a CommandFormColumn\n if (component.displayName === 'CommandFormColumn') {\n hasColumns = true;\n const childProps = child.props as { children?: React.ReactNode };\n const columnFields = React.Children.toArray(childProps.children).filter(child => {\n if (React.isValidElement(child)) {\n const comp = child.type as React.ComponentType<unknown>;\n if (comp.displayName === 'CommandFormField') {\n extractInitialValue(child as React.ReactElement);\n return true;\n }\n }\n return false;\n }) as React.ReactElement[];\n columns.push({ fields: columnFields as React.ReactElement<CommandFormFieldProps<unknown>>[] });\n }\n // Check if child is a CommandFormField (direct child)\n else if (component.displayName === 'CommandFormField') {\n extractInitialValue(child as React.ReactElement);\n fields.push(child as React.ReactElement<CommandFormFieldProps<unknown>>);\n }\n // Check if child is Fields wrapper (backwards compatibility)\n else if (component === CommandFormFieldsWrapper || component.displayName === 'CommandFormFieldsWrapper') {\n const childProps = child.props as { children: React.ReactNode };\n const relevantChildren = React.Children.toArray(childProps.children).filter(child => {\n if (React.isValidElement(child)) {\n const component = child.type as React.ComponentType<unknown>;\n if (component.displayName === 'CommandFormField') {\n extractInitialValue(child as React.ReactElement);\n return true;\n }\n }\n return false;\n }) as React.ReactElement[];\n fields = [...fields, ...(relevantChildren as React.ReactElement<CommandFormFieldProps<unknown>>[])];\n }\n // Everything else is not a field, keep it as other children\n else {\n otherChildren.push(child);\n }\n });\n\n return { fieldsOrColumns: hasColumns ? columns : fields, otherChildren, initialValuesFromFields };\n};\n\n// Helper function to extract property name from accessor function\nfunction getPropertyNameFromAccessor<T = unknown>(accessor: ((obj: T) => unknown) | unknown): string {\n if (typeof accessor !== 'function') return '';\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n}\n\nconst CommandFormComponent = <TCommand extends object = object>(props: CommandFormProps<TCommand>) => {\n const { fieldsOrColumns, otherChildren, initialValuesFromFields } = useMemo(() => getCommandFormFields<TCommand>(props), [props.children]);\n\n // Extract matching properties from currentValues\n const valuesFromCurrentValues = useMemo(() => {\n if (!props.currentValues) return {};\n\n const tempCommand = new props.command();\n const commandProperties = ((tempCommand as Record<string, unknown>).properties || []) as string[];\n const extracted: Partial<TCommand> = {};\n\n commandProperties.forEach((propertyName: string) => {\n if ((props.currentValues as Record<string, unknown>)[propertyName] !== undefined) {\n (extracted as Record<string, unknown>)[propertyName] = (props.currentValues as Record<string, unknown>)[propertyName];\n }\n });\n\n return extracted;\n }, [props.currentValues, props.command]);\n\n // Merge initialValues prop with values extracted from field currentValue props and currentValues\n const mergedInitialValues = useMemo(() => ({\n ...valuesFromCurrentValues,\n ...initialValuesFromFields,\n ...props.initialValues\n }), [valuesFromCurrentValues, initialValuesFromFields, props.initialValues]);\n\n // useCommand returns [instance, setter] for the typed command. Provide generics so commandInstance is TCommand.\n // Using type assertion through unknown to work around generic constraint mismatch\n const useCommandResult = useCommand(props.command as unknown as Constructor<Command<Partial<TCommand>, object>>, mergedInitialValues);\n const commandInstance = useCommandResult[0] as unknown as TCommand;\n const setCommandValues = useCommandResult[1] as SetCommandValues<TCommand>;\n const [commandResult, setCommandResult] = useState<ICommandResult<unknown> | undefined>(undefined);\n const [fieldValidities, setFieldValidities] = useState<Record<string, boolean>>({});\n const [customFieldErrors, setCustomFieldErrors] = useState<Record<string, string>>({});\n\n // Update command values when mergedInitialValues changes (e.g., when data loads asynchronously)\n React.useEffect(() => {\n if (mergedInitialValues && Object.keys(mergedInitialValues).length > 0) {\n setCommandValues(mergedInitialValues as TCommand);\n }\n }, [mergedInitialValues, setCommandValues]);\n\n const isValid = Object.values(fieldValidities).every(valid => valid);\n\n const setFieldValidity = useCallback((fieldName: string, isFieldValid: boolean) => {\n setFieldValidities(prev => ({ ...prev, [fieldName]: isFieldValid }));\n }, []);\n\n const setCustomFieldError = useCallback((fieldName: string, error: string | undefined) => {\n setCustomFieldErrors(prev => {\n if (error === undefined) {\n const newErrors = { ...prev };\n delete newErrors[fieldName];\n return newErrors;\n }\n return { ...prev, [fieldName]: error };\n });\n }, []);\n\n const getFieldError = (propertyName: string): string | undefined => {\n // Check custom field errors first\n if (customFieldErrors[propertyName]) {\n return customFieldErrors[propertyName];\n }\n\n if (!commandResult || !commandResult.validationResults) {\n return undefined;\n }\n\n for (const validationResult of commandResult.validationResults) {\n if (validationResult.members && validationResult.members.includes(propertyName)) {\n return validationResult.message;\n }\n }\n\n return undefined;\n };\n\n const exceptionMessages = commandResult?.exceptionMessages || [];\n const hasColumns = fieldsOrColumns.length > 0 && 'fields' in fieldsOrColumns[0];\n\n return (\n <CommandFormContext.Provider value={{ command: props.command, commandInstance, setCommandValues, commandResult, setCommandResult, getFieldError, isValid, setFieldValidity, onFieldValidate: props.onFieldValidate, onFieldChange: props.onFieldChange, onBeforeExecute: props.onBeforeExecute, customFieldErrors, setCustomFieldError }}>\n <CommandFormFields fields={hasColumns ? undefined : (fieldsOrColumns as React.ReactElement<CommandFormFieldProps<unknown>>[])} columns={hasColumns ? fieldsOrColumns as ColumnInfo[] : undefined} />\n {exceptionMessages.length > 0 && (\n <div className=\"card flex flex-row gap-3 mt-3\">\n <Panel header=\"The server responded with\" className=\"w-full\">\n <ul>\n {exceptionMessages.map((msg, idx) => (\n <li key={idx}>{msg}</li>\n ))}\n </ul>\n </Panel>\n </div>\n )}\n {otherChildren}\n </CommandFormContext.Provider>\n );\n};\n\nconst CommandFormColumnComponent = (_props: { children: React.ReactNode }) => {\n void _props;\n return <></>;\n};\n\nCommandFormColumnComponent.displayName = 'CommandFormColumn';\n\nCommandFormComponent.Fields = CommandFormFieldsWrapper;\nCommandFormComponent.Column = CommandFormColumnComponent;\n\nexport const CommandForm = CommandFormComponent;\n"],"names":["createContext","useContext","_jsx","useMemo","useCommand","useState","useCallback","_jsxs","CommandFormFields","Panel"],"mappings":";;;;;;;;AAwCA,MAAM,kBAAkB,GAAGA,mBAAa,CAA+C,SAAS,CAAC;AAE1F,MAAM,qBAAqB,GAAG,MAAgB;AACjD,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,kBAAkB,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC;IAC9E;AACA,IAAA,OAAO,OAA4C;AACvD;AAGO,MAAM,kBAAkB,GAAG,MAAyB;AACvD,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,qBAAq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O,WAAK,EAAA,EAAC,MAAM,EAAC,2BAA2B,EAAC,SAAS,EAAC,QAAQ,EAAA,QAAA,EACxDP,cAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EACK,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,MAC5BA,cAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EAAe,GAAG,EAAA,EAAT,GAAG,CAAY,CAC3B,CAAC,EAAA,CACD,EAAA,CACD,EAAA,CACN,CACT,EACA,aAAa,CAAA,EAAA,CACY;AAEtC,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,MAAqC,KAAI;AAEzE,IAAA,OAAOA,uCAAK;AAChB,CAAC;AAED,0BAA0B,CAAC,WAAW,GAAG,mBAAmB;AAE5D,oBAAoB,CAAC,MAAM,GAAG,wBAAwB;AACtD,oBAAoB,CAAC,MAAM,GAAG,0BAA0B;AAEjD,MAAM,WAAW,GAAG;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CommandFormFields.js","sources":["../../../CommandForm/CommandFormFields.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCommandFormContext } from './CommandForm';\nimport React from 'react';\nimport { Tooltip } from 'primereact/tooltip';\nimport type { CommandFormFieldProps } from './CommandFormField';\n\nexport interface ColumnInfo {\n fields: React.ReactElement<CommandFormFieldProps<any>>[];\n}\n\nexport interface CommandFormFieldsProps {\n fields?: React.ReactElement<CommandFormFieldProps<any>>[];\n columns?: ColumnInfo[];\n}\n\n// Separate component for each field to prevent re-rendering all fields\nconst CommandFormFieldWrapper = ({ field, index }: { field: React.ReactElement<CommandFormFieldProps<any>>; index: number }) => {\n const context = useCommandFormContext<any>();\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n\n // Get the property name from the accessor function\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : '';\n\n // Get the current value from the command instance\n const currentValue = propertyName ? (context.commandInstance as any)?.[propertyName] : undefined;\n\n // Get the error message for this field, if any\n const errorMessage = propertyName ? context.getFieldError(propertyName) : undefined;\n\n // Get the property descriptor for this field from the command instance\n const propertyDescriptor = propertyName && (context.commandInstance as any)?.propertyDescriptors\n ? (context.commandInstance as any).propertyDescriptors.find((pd: any) => pd.name === propertyName)\n : undefined;\n\n // Clone the field element with the current value and onChange handler\n const clonedField = React.cloneElement(field as React.ReactElement, {\n ...fieldProps,\n currentValue,\n propertyDescriptor,\n fieldName: propertyName,\n onValueChange: (value: unknown) => {\n if (propertyName) {\n const oldValue = currentValue;\n\n // Update the command value\n context.setCommandValues({ [propertyName]: value } as any);\n\n // Call validate() on the command instance and store the result\n if (context.commandInstance && typeof (context.commandInstance as any).validate === 'function') {\n const validationResult = (context.commandInstance as any).validate();\n if (validationResult) {\n context.setCommandResult(validationResult);\n }\n }\n\n // Call custom field validator if provided\n if (context.onFieldValidate) {\n const validationError = context.onFieldValidate(context.commandInstance as any, propertyName, oldValue, value);\n context.setCustomFieldError(propertyName, validationError);\n }\n\n // Call field change callback if provided\n if (context.onFieldChange) {\n context.onFieldChange(context.commandInstance as any, propertyName, oldValue, value);\n }\n }\n fieldProps.onChange?.(value as any);\n },\n required: fieldProps.required ?? true,\n invalid: !!errorMessage\n } as any);\n\n const tooltipId = fieldProps.description ? `tooltip-${propertyName}-${index}` : undefined;\n\n return (\n <div className=\"w-full\">\n <div className=\"p-inputgroup w-full\">\n {fieldProps.description && (\n <Tooltip target={`.${tooltipId}`} content={fieldProps.description} />\n )}\n {fieldProps.icon && (\n <span className={`p-inputgroup-addon ${tooltipId || ''}`}>\n {fieldProps.icon}\n </span>\n )}\n {clonedField}\n </div>\n {errorMessage && (\n <small className=\"p-error block mt-1\">{errorMessage}</small>\n )}\n </div>\n );\n};\n\nexport const CommandFormFields = (props: CommandFormFieldsProps) => {\n const { fields, columns } = props;\n\n // Render columns if provided\n if (columns && columns.length > 0) {\n return (\n <div className=\"card flex flex-column md:flex-row gap-3\">\n {columns.map((column, columnIndex) => (\n <div key={`column-${columnIndex}`} className=\"flex flex-column gap-3 flex-1\">\n {column.fields.map((field, index) => {\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${columnIndex}-${index}`;\n\n return (\n <CommandFormFieldWrapper\n key={propertyName}\n field={field}\n index={index}\n />\n );\n })}\n </div>\n ))}\n </div>\n );\n }\n\n // Render fields (single column layout)\n return (\n <div className=\"flex flex-col gap-4 w-full\">\n {(fields || []).map((field, index) => {\n const fieldProps = field.props as CommandFormFieldProps<any>;\n const propertyAccessor = fieldProps.value;\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${index}`;\n\n return (\n <CommandFormFieldWrapper\n key={propertyName}\n field={field}\n index={index}\n />\n );\n })}\n </div>\n );\n};\n\n// Helper function to extract property name from accessor function\nfunction getPropertyName<T>(accessor: (obj: T) => unknown): string {\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n}\n"],"names":["useCommandFormContext","_jsxs","_jsx","Tooltip"],"mappings":";;;;;;;AAkBA,MAAM,uBAAuB,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAA4E,KAAI;AAC3H,IAAA,MAAM,OAAO,GAAGA,iCAAqB,EAAO;AAC5C,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,KAAmC;AAC5D,IAAA,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK;AAGzC,IAAA,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,GAAG,EAAE;AAG9E,IAAA,MAAM,YAAY,GAAG,YAAY,GAAI,OAAO,CAAC,eAAuB,GAAG,YAAY,CAAC,GAAG,SAAS;AAGhG,IAAA,MAAM,YAAY,GAAG,YAAY,GAAG,OAAO,CAAC,aAAa,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K,CAAC,8BAA8B,CAAC;AACzD,IAAA,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE;AAChC;;;;"}
1
+ {"version":3,"file":"CommandFormFields.js","sources":["../../../CommandForm/CommandFormFields.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCommandFormContext } from './CommandForm';\nimport React from 'react';\nimport { Tooltip } from 'primereact/tooltip';\nimport type { CommandFormFieldProps } from './CommandFormField';\nimport type { ICommandResult } from '@cratis/arc/commands';\n\nexport interface ColumnInfo {\n fields: React.ReactElement<CommandFormFieldProps<unknown>>[];\n}\n\nexport interface CommandFormFieldsProps {\n fields?: React.ReactElement<CommandFormFieldProps<unknown>>[];\n columns?: ColumnInfo[];\n}\n\n// Separate component for each field to prevent re-rendering all fields\nconst CommandFormFieldWrapper = ({ field, index }: { field: React.ReactElement<CommandFormFieldProps<unknown>>; index: number }) => {\n const context = useCommandFormContext<unknown>();\n const fieldProps = field.props as CommandFormFieldProps<unknown>;\n const propertyAccessor = fieldProps.value;\n\n // Get the property name from the accessor function\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : '';\n\n // Get the current value from the command instance\n const currentValue = propertyName ? (context.commandInstance as Record<string, unknown>)?.[propertyName] : undefined;\n\n // Get the error message for this field, if any\n const errorMessage = propertyName ? context.getFieldError(propertyName) : undefined;\n\n // Get the property descriptor for this field from the command instance\n const propertyDescriptor = propertyName && (context.commandInstance as Record<string, unknown>)?.propertyDescriptors\n ? ((context.commandInstance as Record<string, unknown>).propertyDescriptors as Array<Record<string, unknown>>).find((pd: Record<string, unknown>) => pd.name === propertyName)\n : undefined;\n\n // Clone the field element with the current value and onChange handler\n const clonedField = React.cloneElement(field as React.ReactElement, {\n ...fieldProps,\n currentValue,\n propertyDescriptor,\n fieldName: propertyName,\n onValueChange: (value: unknown) => {\n if (propertyName) {\n const oldValue = currentValue;\n\n // Update the command value\n context.setCommandValues({ [propertyName]: value } as Record<string, unknown>);\n\n // Call validate() on the command instance and store the result\n if (context.commandInstance && typeof (context.commandInstance as Record<string, unknown>).validate === 'function') {\n const validationResult = ((context.commandInstance as Record<string, unknown>).validate as () => ICommandResult<unknown>)();\n if (validationResult) {\n context.setCommandResult(validationResult);\n }\n }\n\n // Call custom field validator if provided\n if (context.onFieldValidate) {\n const validationError = context.onFieldValidate(context.commandInstance as Record<string, unknown>, propertyName, oldValue, value);\n context.setCustomFieldError(propertyName, validationError);\n }\n\n // Call field change callback if provided\n if (context.onFieldChange) {\n context.onFieldChange(context.commandInstance as Record<string, unknown>, propertyName, oldValue, value);\n }\n }\n fieldProps.onChange?.(value as unknown);\n },\n required: fieldProps.required ?? true,\n invalid: !!errorMessage\n } as Record<string, unknown>);\n\n const tooltipId = fieldProps.description ? `tooltip-${propertyName}-${index}` : undefined;\n\n return (\n <div className=\"w-full\">\n <div className=\"p-inputgroup w-full\">\n {fieldProps.description && (\n <Tooltip target={`.${tooltipId}`} content={fieldProps.description} />\n )}\n {fieldProps.icon && (\n <span className={`p-inputgroup-addon ${tooltipId || ''}`}>\n {fieldProps.icon}\n </span>\n )}\n {clonedField}\n </div>\n {errorMessage && (\n <small className=\"p-error block mt-1\">{errorMessage}</small>\n )}\n </div>\n );\n};\n\nexport const CommandFormFields = (props: CommandFormFieldsProps) => {\n const { fields, columns } = props;\n\n // Render columns if provided\n if (columns && columns.length > 0) {\n return (\n <div className=\"card flex flex-column md:flex-row gap-3\">\n {columns.map((column, columnIndex) => (\n <div key={`column-${columnIndex}`} className=\"flex flex-column gap-3 flex-1\">\n {column.fields.map((field, index) => {\n const fieldProps = field.props as CommandFormFieldProps<unknown>;\n const propertyAccessor = fieldProps.value;\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${columnIndex}-${index}`;\n\n return (\n <CommandFormFieldWrapper\n key={propertyName}\n field={field}\n index={index}\n />\n );\n })}\n </div>\n ))}\n </div>\n );\n }\n\n // Render fields (single column layout)\n return (\n <div className=\"flex flex-col gap-4 w-full\">\n {(fields || []).map((field, index) => {\n const fieldProps = field.props as CommandFormFieldProps<unknown>;\n const propertyAccessor = fieldProps.value;\n const propertyName = propertyAccessor ? getPropertyName(propertyAccessor) : `field-${index}`;\n\n return (\n <CommandFormFieldWrapper\n key={propertyName}\n field={field}\n index={index}\n />\n );\n })}\n </div>\n );\n};\n\n// Helper function to extract property name from accessor function\nfunction getPropertyName<T>(accessor: (obj: T) => unknown): string {\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n}\n"],"names":["useCommandFormContext","_jsxs","_jsx","Tooltip"],"mappings":";;;;;;;AAmBA,MAAM,uBAAuB,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAgF,KAAI;AAC/H,IAAA,MAAM,OAAO,GAAGA,iCAAqB,EAAW;AAChD,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,KAAuC;AAChE,IAAA,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK;AAGzC,IAAA,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,GAAG,EAAE;AAG9E,IAAA,MAAM,YAAY,GAAG,YAAY,GAAI,OAAO,CAAC,eAA2C,GAAG,YAAY,CAAC,GAAG,SAAS;AAGpH,IAAA,MAAM,YAAY,GAAG,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS;IAGnF,MAAM,kBAAkB,GAAG,YAAY,IAAK,OAAO,CAAC,eAA2C,EAAE;AAC7F,UAAI,OAAO,CAAC,eAA2C,CAAC,mBAAsD,CAAC,IAAI,CAAC,CAAC,EAA2B,KAAK,EAAE,CAAC,IAAI,KAAK,YAAY;UAC3K,SAAS;AAGf,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC,KAA2B,EAAE;AAChE,QAAA,GAAG,UAAU;QACb,YA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S,WAAW,CAAA,CAAA,EAAI,KAAK,EAAE;AAE3G,oBAAA,QACIA,cAAA,CAAC,uBAAuB,EAAA,EAEpB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EAAA,EAFP,YAAY,CAGnB;gBAEV,CAAC,CAAC,EAAA,EAbA,CAAA,OAAA,EAAU,WAAW,CAAA,CAAE,CAc3B,CACT,CAAC,EAAA,CACA;IAEd;AAGA,IAAA,QACIA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA,QAAA,EACtC,CAAC,MAAM,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAI;AACjC,YAAA,MAAM,UAAU,GAAG,KAAK,CAAC,KAAuC;AAChE,YAAA,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK;AACzC,YAAA,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,GAAG,CAAA,MAAA,EAAS,KAAK,EAAE;AAE5F,YAAA,QACIA,cAAA,CAAC,uBAAuB,EAAA,EAEpB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EAAA,EAFP,YAAY,CAGnB;QAEV,CAAC,CAAC,EAAA,CACA;AAEd;AAGA,SAAS,eAAe,CAAI,QAA6B,EAAA;AACrD,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,EAAE;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC;AACzD,IAAA,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE;AAChC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableForObservableQuery.js","sources":["../../../DataTables/DataTableForObservableQuery.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DataTable, DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';\nimport { Constructor } from '@cratis/fundamentals';\nimport { IObservableQueryFor, Paging } from '@cratis/arc/queries';\nimport { useObservableQueryWithPaging } from '@cratis/arc.react/queries';\nimport { ReactNode, useState } from 'react';\n\n \n\n/**\n * Props for the DataTableForQuery component\n */\nexport interface DataTableForObservableQueryProps<TQuery extends IObservableQueryFor<TDataType>, TDataType, TArguments> {\n /**\n * Children to render\n */\n children?: ReactNode;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: any | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionSingleChangeEvent<any>): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n}\n\nconst paging = new Paging(0, 20);\n\n/**\n * Represents a DataTable for a query.\n * @param props Props for the component\n * @returns Function to render the DataTableForQuery component\n */\nexport const DataTableForObservableQuery = <TQuery extends IObservableQueryFor<TDataType, TArguments>, TDataType, TArguments extends object>(props: DataTableForObservableQueryProps<TQuery, TDataType, TArguments>) => {\n const [filters, setFilters] = useState<DataTableFilterMeta>(props.defaultFilters ?? {});\n const [result, , setPage] = useObservableQueryWithPaging(props.query, paging, props.queryArguments);\n\n return (\n <DataTable\n value={result.data}\n lazy\n rows={paging.pageSize}\n totalRecords={result.paging.totalItems}\n paginator\n alwaysShowPaginator={false}\n first={result.paging.page * paging.pageSize}\n onPage={(e) => setPage(e.page ?? 0)}\n scrollable\n scrollHeight={'flex'}\n selectionMode='single'\n selection={props.selection}\n onSelectionChange={props.onSelectionChange}\n dataKey={props.dataKey}\n filters={filters}\n filterDisplay='menu'\n onFilter={(e) => setFilters(e.filters)}\n globalFilterFields={props.globalFilterFields}\n emptyMessage={props.emptyMessage}>\n {props.children}\n </DataTable>\n );\n};\n"],"names":["Paging","useState","useObservableQueryWithPaging","_jsx","DataTable"],"mappings":";;;;;;;;AA6DA,MAAM,MAAM,GAAG,IAAIA,cAAM,CAAC,CAAC,EAAE,EAAE,CAAC;AAOzB,MAAM,2BAA2B,GAAG,CAAkG,KAAsE,KAAI;AACnN,IAAA,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,CAAsB,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC;IACvF,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAGC,sCAA4B,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC;AAEnG,IAAA,QACIC,cAAA,CAACC,mBAAS,EAAA,EACN,KAAK,EAAE,MAAM,CAAC,IAAI,EAClB,IAAI,EAAA,IAAA,EACJ,IAAI,EAAE,MAAM,CAAC,QAAQ,EACrB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EACtC,SAAS,EAAA,IAAA,EACT,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EACnC,UAAU,EAAA,IAAA,EACV,YAAY,EAAE,MAAM,EACpB,aAAa,EAAC,QAAQ,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAC,MAAM,EACpB,QAAQ,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAAA,QAAA,EAC/B,KAAK,CAAC,QAAQ,EAAA,CACP;AAEpB;;;;"}
1
+ {"version":3,"file":"DataTableForObservableQuery.js","sources":["../../../DataTables/DataTableForObservableQuery.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DataTable, DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';\nimport { Constructor } from '@cratis/fundamentals';\nimport { IObservableQueryFor, Paging } from '@cratis/arc/queries';\nimport { useObservableQueryWithPaging } from '@cratis/arc.react/queries';\nimport { ReactNode, useState } from 'react';\n\n \n\n/**\n * Props for the DataTableForQuery component\n */\nexport interface DataTableForObservableQueryProps<TQuery extends IObservableQueryFor<TDataType, TArguments>, TDataType extends object, TArguments extends object> {\n /**\n * Children to render\n */\n children?: ReactNode;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: TDataType | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionSingleChangeEvent<TDataType[]>): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n}\n\nconst paging = new Paging(0, 20);\n\n/**\n * Represents a DataTable for a query.\n * @param props Props for the component\n * @returns Function to render the DataTableForQuery component\n */\nexport const DataTableForObservableQuery = <TQuery extends IObservableQueryFor<TDataType, TArguments>, TDataType extends object, TArguments extends object>(props: DataTableForObservableQueryProps<TQuery, TDataType, TArguments>) => {\n const [filters, setFilters] = useState<DataTableFilterMeta>(props.defaultFilters ?? {});\n const [result, , setPage] = useObservableQueryWithPaging(props.query, paging, props.queryArguments);\n\n return (\n <DataTable\n value={result.data as unknown as object[]}\n lazy\n rows={paging.pageSize}\n totalRecords={result.paging.totalItems}\n paginator\n alwaysShowPaginator={false}\n first={result.paging.page * paging.pageSize}\n onPage={(e) => setPage(e.page ?? 0)}\n scrollable\n scrollHeight={'flex'}\n selectionMode='single'\n selection={props.selection}\n onSelectionChange={props.onSelectionChange}\n dataKey={props.dataKey}\n filters={filters}\n filterDisplay='menu'\n onFilter={(e) => setFilters(e.filters)}\n globalFilterFields={props.globalFilterFields}\n emptyMessage={props.emptyMessage}>\n {props.children}\n </DataTable>\n );\n};\n"],"names":["Paging","useState","useObservableQueryWithPaging","_jsx","DataTable"],"mappings":";;;;;;;;AA6DA,MAAM,MAAM,GAAG,IAAIA,cAAM,CAAC,CAAC,EAAE,EAAE,CAAC;AAOzB,MAAM,2BAA2B,GAAG,CAAiH,KAAsE,KAAI;AAClO,IAAA,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,CAAsB,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC;IACvF,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAGC,sCAA4B,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC;AAEnG,IAAA,QACIC,cAAA,CAACC,mBAAS,EAAA,EACN,KAAK,EAAE,MAAM,CAAC,IAA2B,EACzC,IAAI,EAAA,IAAA,EACJ,IAAI,EAAE,MAAM,CAAC,QAAQ,EACrB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EACtC,SAAS,EAAA,IAAA,EACT,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EACnC,UAAU,EAAA,IAAA,EACV,YAAY,EAAE,MAAM,EACpB,aAAa,EAAC,QAAQ,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAC,MAAM,EACpB,QAAQ,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAAA,QAAA,EAC/B,KAAK,CAAC,QAAQ,EAAA,CACP;AAEpB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableForQuery.js","sources":["../../../DataTables/DataTableForQuery.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DataTable, DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';\nimport { Constructor } from '@cratis/fundamentals';\nimport { IQueryFor, Paging } from '@cratis/arc/queries';\nimport { useQueryWithPaging } from '@cratis/arc.react/queries';\nimport { ReactNode, useState } from 'react';\n\n \n\n/**\n * Props for the DataTableForQuery component\n */\nexport interface DataTableForQueryProps<TQuery extends IQueryFor<TDataType>, TDataType, TArguments> {\n /**\n * Children to render\n */\n children?: ReactNode;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional Arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: any | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionSingleChangeEvent<any>): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n}\n\nconst paging = new Paging(0, 20);\n\n/**\n * Represents a DataTable for a query.\n * @param props Props for the component\n * @returns Function to render the DataTableForQuery component\n */\nexport const DataTableForQuery = <TQuery extends IQueryFor<TDataType, TArguments>, TDataType, TArguments extends object>(props: DataTableForQueryProps<TQuery, TDataType, TArguments>) => {\n const [filters, setFilters] = useState<DataTableFilterMeta>(props.defaultFilters ?? {});\n const [result, , , setPage] = useQueryWithPaging(props.query, paging, props.queryArguments);\n\n return (\n <DataTable\n value={result.data as unknown}\n lazy\n rows={paging.pageSize}\n totalRecords={result.paging.totalItems}\n paginator\n alwaysShowPaginator={false}\n first={result.paging.page * paging.pageSize}\n onPage={(e) => setPage(e.page ?? 0)}\n scrollable\n scrollHeight={'flex'}\n selectionMode='single'\n selection={props.selection}\n onSelectionChange={props.onSelectionChange}\n dataKey={props.dataKey}\n filters={filters}\n filterDisplay='menu'\n onFilter={(e) => setFilters(e.filters)}\n globalFilterFields={props.globalFilterFields}\n emptyMessage={props.emptyMessage} >\n {props.children}\n </DataTable >\n );\n};\n"],"names":["Paging","useState","useQueryWithPaging","_jsx","DataTable"],"mappings":";;;;;;;;AA6DA,MAAM,MAAM,GAAG,IAAIA,cAAM,CAAC,CAAC,EAAE,EAAE,CAAC;AAOzB,MAAM,iBAAiB,GAAG,CAAwF,KAA4D,KAAI;AACrL,IAAA,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,CAAsB,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC;IACvF,MAAM,CAAC,MAAM,MAAM,OAAO,CAAC,GAAGC,4BAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC;AAE3F,IAAA,QACIC,cAAA,CAACC,mBAAS,EAAA,EACN,KAAK,EAAE,MAAM,CAAC,IAAe,EAC7B,IAAI,EAAA,IAAA,EACJ,IAAI,EAAE,MAAM,CAAC,QAAQ,EACrB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EACtC,SAAS,EAAA,IAAA,EACT,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EACnC,UAAU,EAAA,IAAA,EACV,YAAY,EAAE,MAAM,EACpB,aAAa,EAAC,QAAQ,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAC,MAAM,EACpB,QAAQ,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAAA,QAAA,EAC/B,KAAK,CAAC,QAAQ,EAAA,CACN;AAErB;;;;"}
1
+ {"version":3,"file":"DataTableForQuery.js","sources":["../../../DataTables/DataTableForQuery.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DataTable, DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';\nimport { Constructor } from '@cratis/fundamentals';\nimport { IQueryFor, Paging } from '@cratis/arc/queries';\nimport { useQueryWithPaging } from '@cratis/arc.react/queries';\nimport { ReactNode, useState } from 'react';\n\n \n\n/**\n * Props for the DataTableForQuery component\n */\nexport interface DataTableForQueryProps<TQuery extends IQueryFor<TDataType, TArguments>, TDataType extends object, TArguments extends object> {\n /**\n * Children to render\n */\n children?: ReactNode;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional Arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: TDataType | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionSingleChangeEvent<TDataType[]>): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n}\n\nconst paging = new Paging(0, 20);\n\n/**\n * Represents a DataTable for a query.\n * @param props Props for the component\n * @returns Function to render the DataTableForQuery component\n */\nexport const DataTableForQuery = <TQuery extends IQueryFor<TDataType, TArguments>, TDataType extends object, TArguments extends object>(props: DataTableForQueryProps<TQuery, TDataType, TArguments>) => {\n const [filters, setFilters] = useState<DataTableFilterMeta>(props.defaultFilters ?? {});\n const [result, , , setPage] = useQueryWithPaging(props.query, paging, props.queryArguments);\n\n return (\n <DataTable\n value={result.data as unknown as object[]}\n lazy\n rows={paging.pageSize}\n totalRecords={result.paging.totalItems}\n paginator\n alwaysShowPaginator={false}\n first={result.paging.page * paging.pageSize}\n onPage={(e) => setPage(e.page ?? 0)}\n scrollable\n scrollHeight={'flex'}\n selectionMode='single'\n selection={props.selection}\n onSelectionChange={props.onSelectionChange}\n dataKey={props.dataKey}\n filters={filters}\n filterDisplay='menu'\n onFilter={(e) => setFilters(e.filters)}\n globalFilterFields={props.globalFilterFields}\n emptyMessage={props.emptyMessage} >\n {props.children}\n </DataTable >\n );\n};\n"],"names":["Paging","useState","useQueryWithPaging","_jsx","DataTable"],"mappings":";;;;;;;;AA6DA,MAAM,MAAM,GAAG,IAAIA,cAAM,CAAC,CAAC,EAAE,EAAE,CAAC;AAOzB,MAAM,iBAAiB,GAAG,CAAuG,KAA4D,KAAI;AACpM,IAAA,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,CAAsB,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC;IACvF,MAAM,CAAC,MAAM,MAAM,OAAO,CAAC,GAAGC,4BAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC;AAE3F,IAAA,QACIC,cAAA,CAACC,mBAAS,EAAA,EACN,KAAK,EAAE,MAAM,CAAC,IAA2B,EACzC,IAAI,EAAA,IAAA,EACJ,IAAI,EAAE,MAAM,CAAC,QAAQ,EACrB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EACtC,SAAS,EAAA,IAAA,EACT,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EACnC,UAAU,EAAA,IAAA,EACV,YAAY,EAAE,MAAM,EACpB,aAAa,EAAC,QAAQ,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAC,MAAM,EACpB,QAAQ,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAAA,QAAA,EAC/B,KAAK,CAAC,QAAQ,EAAA,CACN;AAErB;;;;"}
@@ -281,7 +281,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
281
281
  zoomLevel,
282
282
  viewportWidth,
283
283
  viewportHeight,
284
- createCardSprite: (id, x, y) => sprites.createCardSprite(id, x, y, items, (item, e, id) => onCardClickRef.current(item, e, id), onPanStart, cardWidth, cardHeight, cardColorsRef.current),
284
+ createCardSprite: (id, x, y) => sprites.createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStart)(e), cardWidth, cardHeight, cardColorsRef.current),
285
285
  updateCardContent: (sprite, item) => sprites.updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),
286
286
  isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),
287
287
  prevLayout: prevLayoutRef.current,
@@ -373,7 +373,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
373
373
  zoomLevel,
374
374
  viewportWidth,
375
375
  viewportHeight,
376
- createCardSprite: (id, x, y) => sprites.createCardSprite(id, x, y, items, (item, e, id) => onCardClickRef.current(item, e, id), (e) => onPanStartRef.current(e, true), cardWidth, cardHeight, cardColorsRef.current),
376
+ createCardSprite: (id, x, y) => sprites.createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStartRef.current)(e), cardWidth, cardHeight, cardColorsRef.current),
377
377
  updateCardContent: (sprite, item) => sprites.updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),
378
378
  isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),
379
379
  });
@@ -403,7 +403,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
403
403
  function updateSelection() {
404
404
  const sprites = spritesRef.current;
405
405
  for (const sprite of sprites.values()) {
406
- const val = items[String(sprite.itemId)];
406
+ const val = items[Number(sprite.itemId)];
407
407
  updateCardContent(sprite, val);
408
408
  }
409
409
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PivotCanvas.js","sources":["../../../../PivotViewer/components/PivotCanvas.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport * as PIXI from 'pixi.js';\nimport type { ItemId, LayoutResult, GroupingResult } from '../engine/types';\nimport type { ViewMode } from './Toolbar';\nimport { createCssColorResolver, resolveCardColors } from './pivot/colorResolver';\nimport { createCardSprite as createCardSpriteExternal, updateCardContent as updateCardContentExternal, clearSpritePool } from './pivot/sprites';\nimport { syncSpritesToViewport } from './pivot/visibility';\nimport { updateBucketBackgrounds as updateBucketBackgroundsExternal, updateHighlight as updateHighlightExternal } from './pivot/buckets';\nimport { startAnimationLoop as startAnimationLoopExternal, updatePositions as updatePositionsExternal } from './pivot/animation';\nimport { ANIMATION_SPEED, DEFAULT_COLORS, type CardSprite, type CardColors } from './pivot/constants';\n\nexport interface PivotCanvasProps<TItem extends object> {\n /** Original items array */\n items: TItem[];\n\n /** Layout positions */\n layout: LayoutResult;\n\n /** Grouping information */\n grouping: GroupingResult;\n\n /** Visible item IDs */\n visibleIds: Uint32Array;\n\n /** Card dimensions */\n cardWidth: number;\n cardHeight: number;\n\n /** Zoom level */\n zoomLevel: number;\n\n /** Pan offset */\n panX: number;\n panY: number;\n\n /** Viewport dimensions (visible area) */\n viewportWidth: number;\n viewportHeight: number;\n\n /** Selected item ID */\n selectedId: ItemId | null;\n\n /** Hovered group index */\n hoveredGroupIndex: number | null;\n\n /** Current view mode */\n viewMode: ViewMode;\n\n /** Is zooming animation in progress */\n isZooming?: boolean;\n\n /** Card renderer function */\n cardRenderer?: (item: TItem) => ReactNode;\n\n /** ID resolver */\n resolveId: (item: TItem, index: number) => string | number;\n\n /** Click handler */\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void;\n\n /** Pan handlers */\n onPanStart: (e: MouseEvent) => void;\n onPanMove: (e: MouseEvent) => void;\n onPanEnd: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n}\n\n// `CardSprite` type moved to ./pivot/constants and imported above\n\n// constants and CardColors type moved to ./pivot/constants\n\nexport function PivotCanvas<TItem extends object>({\n items,\n layout,\n grouping,\n visibleIds,\n cardWidth,\n cardHeight,\n zoomLevel,\n panX,\n panY,\n viewportWidth,\n viewportHeight,\n selectedId,\n hoveredGroupIndex,\n isZooming: _isZooming = false,\n resolveId: _resolveId,\n onCardClick,\n onPanStart,\n onPanMove,\n onPanEnd,\n viewMode,\n cardRenderer,\n containerRef,\n}: PivotCanvasProps<TItem>) {\n console.log('[PivotCanvas] Render', { viewMode });\n // Use the containerRef passed from the parent viewport so we append the Pixi\n // canvas and spacer into the actual scrollable element.\n const parentContainerRef = containerRef;\n // Mark intentionally-unused destructured props as used to satisfy lint\n void _isZooming;\n void _resolveId;\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const spacerRef = useRef<HTMLDivElement | null>(null);\n const appRef = useRef<PIXI.Application | null>(null);\n const rootRef = useRef<PIXI.Container | null>(null);\n const bucketsContainerRef = useRef<PIXI.Container | null>(null);\n const spritesRef = useRef<Map<ItemId, CardSprite>>(new Map());\n const animationFrameRef = useRef<number>(0);\n const mountedRef = useRef(true);\n const [pixiReady, setPixiReady] = useState(false);\n const isAnimatingRef = useRef(false);\n const needsRenderRef = useRef(false);\n const initializingRef = useRef(false);\n const isViewTransitionRef = useRef(false);\n const lastViewChangeTimeRef = useRef(0);\n const previousViewModeRef = useRef<ViewMode>(viewMode);\n const prevLayoutRef = useRef<LayoutResult | null>(null);\n const prevGroupingRef = useRef<GroupingResult | null>(null);\n const cardColorsRef = useRef<CardColors>(DEFAULT_COLORS);\n void cardRenderer; // unused in Pixi renderer but keep prop compatibility\n\n const cssColorResolver = useMemo(() => createCssColorResolver(), []);\n\n const onPanStartRef = useRef(onPanStart);\n const onPanMoveRef = useRef(onPanMove);\n const onPanEndRef = useRef(onPanEnd);\n const onCardClickRef = useRef(onCardClick);\n const prevPanRef = useRef({ x: panX, y: panY });\n\n // Initialize Pixi Application\n useEffect(() => {\n // ... existing code ...\n onPanMoveRef.current = onPanMove;\n onPanEndRef.current = onPanEnd;\n onCardClickRef.current = onCardClick;\n }, [onPanStart, onPanMove, onPanEnd, onCardClick]);\n\n useEffect(() => {\n cardColorsRef.current = resolveCardColors(cssColorResolver);\n }, [cssColorResolver]);\n\n useEffect(() => {\n // Reset mounted flag\n mountedRef.current = true;\n\n if (!parentContainerRef || !parentContainerRef.current) {\n return;\n }\n\n // Prevent multiple simultaneous initializations\n if (initializingRef.current || appRef.current) {\n return;\n }\n\n initializingRef.current = true;\n let app: PIXI.Application | null = null;\n // Handler references declared here so cleanup can remove them later.\n\n (async () => {\n try {\n // Prefer the new init API (v8+) to avoid deprecation issues. Fall back\n // to the constructor options when `init` is not available.\n const options = {\n backgroundAlpha: 0,\n antialias: false,\n autoStart: false,\n autoDensity: true,\n resolution: window.devicePixelRatio || 1,\n width: viewportWidth > 0 ? viewportWidth : 800,\n height: viewportHeight > 0 ? viewportHeight : 600,\n } as PIXI.ApplicationOptions;\n\n app = new PIXI.Application();\n if ((app as any).init && typeof (app as any).init === 'function') {\n // init may return a promise in some builds\n \n // @ts-ignore\n await app.init(options);\n } else {\n // Fall back to constructor that accepts options\n app.destroy?.();\n app = new PIXI.Application(options);\n }\n\n if (!mountedRef.current || !parentContainerRef.current) {\n // Component unmounted during initialization\n if (app && typeof app.destroy === 'function') app.destroy(true, { children: true });\n initializingRef.current = false;\n return;\n }\n\n appRef.current = app;\n\n const bucketsContainer = new PIXI.Container();\n bucketsContainerRef.current = bucketsContainer;\n app.stage.addChild(bucketsContainer);\n\n const root = new PIXI.Container();\n rootRef.current = root;\n app.stage.addChild(root);\n\n // Resolve canvas element (different Pixi builds expose it as `view` or\n // `canvas`).\n const canvasEl = (app.view ?? (app as any).canvas ?? app.renderer?.view) as HTMLCanvasElement | undefined;\n\n // Place canvas outside the scrollable content so native scrolling\n // doesn't move the canvas DOM element itself. We overlay the canvas\n // on top of the scroll area by inserting it into the parent element\n // (or the container itself if parent is not available). This ensures\n // the Pixi canvas remains stable while we move the Pixi world inside\n // it to represent camera pan.\n const overlayParent = parentContainerRef.current.parentElement ?? parentContainerRef.current;\n if (canvasEl) {\n if (canvasEl.parentElement) {\n canvasEl.parentElement.removeChild(canvasEl);\n }\n overlayParent.appendChild(canvasEl);\n canvasRef.current = canvasEl;\n } else if ((app as any).canvas) {\n const c = (app as any).canvas;\n if (c.parentElement) {\n c.parentElement.removeChild(c);\n }\n overlayParent.appendChild(c);\n canvasRef.current = c;\n }\n\n // Position the canvas to overlay the scrollable container area.\n if (canvasRef.current && parentContainerRef.current) {\n const parentBounds = parentContainerRef.current.getBoundingClientRect();\n void parentBounds;\n canvasRef.current.style.position = 'absolute';\n // Place canvas relative to the overlayParent's coordinate space.\n // If overlayParent is the immediate parent, top/left 0 aligns it.\n const offsetLeft = parentContainerRef.current.offsetLeft;\n const offsetTop = parentContainerRef.current.offsetTop;\n canvasRef.current.style.left = `${offsetLeft}px`;\n canvasRef.current.style.top = `${offsetTop}px`;\n canvasRef.current.style.width = `${parentContainerRef.current.clientWidth}px`;\n canvasRef.current.style.height = `${parentContainerRef.current.clientHeight}px`;\n // Place canvas behind the scrollable container (which has z-index 1)\n // so scrollbars appear on top.\n canvasRef.current.style.zIndex = '0';\n // Disable pointer events on canvas so they pass through to the viewport if needed,\n // though viewport is on top anyway.\n canvasRef.current.style.pointerEvents = 'none';\n }\n\n // We handle clicks and interactions manually in PivotViewerMain now,\n // so we don't need to configure Pixi events on the container.\n // This avoids z-index conflicts and event propagation issues.\n\n // Make canvas fill container with absolute positioning\n if (canvasRef.current) {\n canvasRef.current.style.display = 'block';\n // Ensure canvas does not capture events so they pass through to the viewport\n canvasRef.current.style.pointerEvents = 'none';\n }\n\n // Setup stage events for background panning\n app.stage.eventMode = 'static';\n app.stage.hitArea = new PIXI.Rectangle(0, 0, viewportWidth, viewportHeight);\n\n app.stage.on('pointerdown', (e) => {\n // Only handle if it reached the stage (background)\n // Sprites stop propagation, so this is safe\n onPanStartRef.current(e.nativeEvent as unknown as MouseEvent);\n });\n\n app.stage.on('globalpointermove', (e) => {\n onPanMoveRef.current(e.nativeEvent as unknown as MouseEvent);\n });\n\n app.stage.on('globalpointerup', () => {\n onPanEndRef.current();\n });\n\n // We no longer need manual event listeners on parentEl because Pixi\n // is now listening to events on parentEl directly via setTargetElement.\n // This allows Pixi to handle hit testing through the transparent container.\n const parentEl = parentContainerRef.current;\n if (parentEl) {\n // handleMouseDown = (e: Event) => onPanStartRef.current(e as unknown);\n // handleMouseMove = (e: Event) => onPanMoveRef.current(e as unknown);\n // handleMouseUp = () => onPanEndRef.current();\n // parentEl.addEventListener('mousedown', handleMouseDown);\n // parentEl.addEventListener('mousemove', handleMouseMove);\n // parentEl.addEventListener('mouseup', handleMouseUp);\n // parentEl.addEventListener('mouseleave', handleMouseUp);\n // window.addEventListener('mouseup', handleMouseUp);\n // window.addEventListener('pointerup', handleMouseUp);\n }\n\n // Immediately size to container to avoid delay\n if (viewportWidth > 0 && viewportHeight > 0) {\n app.renderer?.resize(viewportWidth, viewportHeight);\n }\n\n setPixiReady(true);\n initializingRef.current = false;\n\n // Trigger initial render\n needsRenderRef.current = true;\n app.renderer?.render(app.stage);\n } catch (error) {\n console.error('Failed to initialize Pixi.js:', error);\n initializingRef.current = false;\n }\n })();\n\n return () => {\n mountedRef.current = false;\n setPixiReady(false);\n cancelAnimationFrame(animationFrameRef.current);\n\n if (appRef.current && typeof appRef.current.destroy === 'function') {\n appRef.current.destroy(true, { children: true });\n appRef.current = null;\n rootRef.current = null;\n }\n\n // Clear sprite pool to avoid holding onto destroyed textures\n clearSpritePool();\n\n // Remove any event listeners we attached to the parent container\n try {\n const parentEl = parentContainerRef.current;\n if (parentEl) {\n // if (handleMouseDown) parentEl.removeEventListener('mousedown', handleMouseDown);\n // if (handleMouseMove) parentEl.removeEventListener('mousemove', handleMouseMove);\n // if (handleMouseUp) parentEl.removeEventListener('mouseup', handleMouseUp);\n // if (handleMouseUp) parentEl.removeEventListener('mouseleave', handleMouseUp);\n // if (handleMouseUp) {\n // window.removeEventListener('mouseup', handleMouseUp);\n // window.removeEventListener('pointerup', handleMouseUp);\n // }\n }\n } catch (e) {\n void e;\n }\n // Remove DOM nodes we appended\n try {\n if (canvasRef.current && canvasRef.current.parentElement) {\n canvasRef.current.parentElement.removeChild(canvasRef.current);\n }\n } catch (e) {\n void e;\n }\n };\n }, [viewportWidth, viewportHeight]);\n\n // Handle canvas resize\n useEffect(() => {\n if (!parentContainerRef || !parentContainerRef.current || !appRef.current || !pixiReady) return;\n\n const container = parentContainerRef.current;\n const app = appRef.current;\n\n let resizeTimeout: ReturnType<typeof setTimeout>;\n\n const handleResize = () => {\n // Size canvas to viewport dimensions from props\n if (viewportWidth > 0 && viewportHeight > 0) {\n app.renderer?.resize(viewportWidth, viewportHeight);\n app.stage.hitArea = new PIXI.Rectangle(0, 0, viewportWidth, viewportHeight);\n\n // Keep canvas DOM size in sync with container\n if (canvasRef.current && parentContainerRef.current) {\n canvasRef.current.style.width = `${parentContainerRef.current.clientWidth}px`;\n canvasRef.current.style.height = `${parentContainerRef.current.clientHeight}px`;\n // Also update left/top in case the container moved\n canvasRef.current.style.left = `${parentContainerRef.current.offsetLeft}px`;\n canvasRef.current.style.top = `${parentContainerRef.current.offsetTop}px`;\n }\n }\n };\n\n const debouncedResize = () => {\n clearTimeout(resizeTimeout);\n resizeTimeout = setTimeout(handleResize, 150);\n };\n\n // Initial resize (immediate)\n handleResize();\n\n // Watch for size changes (debounced)\n const resizeObserver = new ResizeObserver(debouncedResize);\n resizeObserver.observe(container);\n\n return () => {\n clearTimeout(resizeTimeout);\n resizeObserver.disconnect();\n };\n }, [pixiReady, viewportWidth, viewportHeight]);\n\n // Update bucket backgrounds only when layout/grouping changes\n useEffect(() => {\n if (!bucketsContainerRef.current || !parentContainerRef.current || !pixiReady) return;\n updateBucketBackgroundsExternal(bucketsContainerRef.current, parentContainerRef.current, grouping, layout, zoomLevel, cardColorsRef.current, viewMode);\n needsRenderRef.current = true;\n appRef.current?.renderer?.render(appRef.current.stage);\n }, [grouping, layout, zoomLevel, viewMode, pixiReady]);\n\n useEffect(() => {\n if (!rootRef.current || !parentContainerRef.current || !pixiReady) {\n return;\n }\n\n // Check if this is a view mode change (not just pan/scroll)\n const viewModeChanged = previousViewModeRef.current !== viewMode;\n const groupingChanged = prevGroupingRef.current !== grouping;\n\n if (viewModeChanged || groupingChanged) {\n isViewTransitionRef.current = true;\n lastViewChangeTimeRef.current = Date.now();\n previousViewModeRef.current = viewMode;\n prevGroupingRef.current = grouping;\n \n // When switching modes, mark all sprites for cleanup by hiding them\n // The normal sweep logic will remove them after SWEEP_MS delay\n console.log('[PivotCanvas] View mode or grouping changed - marking sprites for cleanup');\n for (const sprite of spritesRef.current.values()) {\n try {\n if (sprite.container) {\n sprite.container.visible = false;\n }\n (sprite as any).__lastHiddenAt = Date.now();\n } catch (e) {\n void e;\n }\n }\n }\n\n // Update spacer dimensions to match scaled world size\n if (spacerRef.current) {\n const spacer = spacerRef.current;\n const worldWidth = (layout.totalWidth || viewportWidth) * zoomLevel;\n const worldHeight = (layout.totalHeight || viewportHeight) * zoomLevel;\n spacer.style.width = `${Math.max(worldWidth, viewportWidth)}px`;\n spacer.style.height = `${Math.max(worldHeight, viewportHeight)}px`;\n }\n\n // Ensure scroll spacer matches layout so the container becomes scrollable and\n // native scrollLeft/scrollTop reflect the camera position.\n if (parentContainerRef.current) {\n const spacer = spacerRef.current;\n if (spacer) {\n // Debug: log spacer and layout values to detect mismatches\n }\n }\n\n const panDeltaX = panX - prevPanRef.current.x;\n const panDeltaY = panY - prevPanRef.current.y;\n prevPanRef.current = { x: panX, y: panY };\n\n // Sync sprites into viewport and create/remove as needed\n // Provide wrappers for sprite creation and content update so helpers have required context\n syncSpritesToViewport({\n root: rootRef.current,\n container: parentContainerRef.current,\n sprites: spritesRef.current,\n layout,\n visibleIds,\n items,\n cardWidth,\n cardHeight,\n panX,\n panY,\n panDeltaX,\n panDeltaY,\n zoomLevel,\n viewportWidth,\n viewportHeight,\n createCardSprite: (id: string | number, x: number, y: number) => createCardSpriteExternal(\n id,\n x,\n y,\n items as any,\n (item: TItem, e: any, id: string | number) => (onCardClickRef.current as any)(item, e, id),\n (onPanStart as any),\n cardWidth,\n cardHeight,\n cardColorsRef.current\n ),\n updateCardContent: (sprite: CardSprite | any, item: any) => updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),\n isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),\n prevLayout: prevLayoutRef.current,\n });\n needsRenderRef.current = true;\n \n // Force an immediate render after syncing sprites to ensure cards appear\n if (appRef.current?.renderer && rootRef.current) {\n appRef.current.renderer.render(appRef.current.stage);\n needsRenderRef.current = false;\n }\n \n startAnimationLoopExternal({\n mountedRef,\n appRef,\n animationFrameRef,\n isAnimatingRef,\n needsRenderRef,\n spritesRef,\n isViewTransitionRef,\n });\n }, [layout, visibleIds, items, cardWidth, cardHeight, pixiReady, zoomLevel, panX, panY, grouping, viewMode]);\n\n // Update prevLayoutRef after processing layout changes\n useEffect(() => {\n prevLayoutRef.current = layout;\n }, [layout]);\n\n useEffect(() => {\n if (!rootRef.current || !bucketsContainerRef.current) return;\n\n // Camera transform: move world opposite to camera position. Prefer the\n // native container scroll positions where available (they are authoritative\n // during user scrolls) and fall back to the passed pan props.\n const effectivePanX = parentContainerRef.current ? parentContainerRef.current.scrollLeft : panX;\n const effectivePanY = parentContainerRef.current ? parentContainerRef.current.scrollTop : panY;\n\n // Apply zoom and position to root and buckets.\n if (rootRef.current.scale && bucketsContainerRef.current.scale) {\n rootRef.current.scale.set(zoomLevel);\n bucketsContainerRef.current.scale.set(zoomLevel);\n }\n if (rootRef.current.position && bucketsContainerRef.current.position) {\n rootRef.current.position.set(-effectivePanX, -effectivePanY);\n bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);\n }\n appRef.current?.renderer?.render(appRef.current.stage);\n }, [zoomLevel, panX, panY]);\n\n useEffect(() => {\n if (!rootRef.current) return;\n updateSelection();\n needsRenderRef.current = true;\n appRef.current?.renderer.render(appRef.current.stage);\n }, [selectedId, items]);\n\n useEffect(() => {\n if (!rootRef.current) return;\n updateHighlight();\n needsRenderRef.current = true;\n appRef.current?.renderer.render(appRef.current.stage);\n }, [hoveredGroupIndex, layout, grouping]);\n\n // Note: animation loop and bucket background updates are delegated to\n // external helpers (`startAnimationLoopExternal` and\n // `updateBucketBackgroundsExternal`) and invoked where needed. We don't\n // expose local wrappers to avoid unused-function lint warnings.\n\n // Listen to native scroll events on the parent container so we update the\n // Pixi world immediately when the user scrolls (native scrollbar or\n // programmatic). This ensures `syncSpritesToViewport` runs on scroll and\n // creates/destroys sprites as the viewport moves.\n useEffect(() => {\n if (!pixiReady || !parentContainerRef || !parentContainerRef.current || !appRef.current || !rootRef.current) return;\n\n const container = parentContainerRef.current;\n const app = appRef.current;\n\n // rAF-batched scroll handling: store the latest scroll values and process\n // them once per animation frame to avoid heavy synchronous work inside\n // the scroll event which causes jank and de-synchronisation between the\n // compositor and Pixi render updates.\n const lastScroll = { x: container.scrollLeft, y: container.scrollTop };\n const pendingRef = { scheduled: false } as { scheduled: boolean };\n\n const processScroll = () => {\n pendingRef.scheduled = false;\n try {\n // Read directly from container to ensure consistency with visibility logic\n // and to handle cases where scroll changes without event (e.g. resize clamping)\n const effectivePanX = container.scrollLeft;\n const effectivePanY = container.scrollTop;\n\n // Update lastScroll to keep it in sync\n lastScroll.x = effectivePanX;\n lastScroll.y = effectivePanY;\n\n if (rootRef.current && bucketsContainerRef.current) {\n if (rootRef.current.scale && bucketsContainerRef.current.scale) {\n rootRef.current.scale.set(zoomLevel);\n bucketsContainerRef.current.scale.set(zoomLevel);\n }\n const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;\n void invScale;\n if (rootRef.current.position && bucketsContainerRef.current.position) {\n rootRef.current.position.set(-effectivePanX, -effectivePanY);\n bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);\n }\n }\n\n syncSpritesToViewport({\n root: rootRef.current,\n container: parentContainerRef.current,\n sprites: spritesRef.current,\n layout,\n visibleIds,\n items,\n cardWidth,\n cardHeight,\n panX,\n panY,\n zoomLevel,\n viewportWidth,\n viewportHeight,\n createCardSprite: (id: string | number, x: number, y: number) => createCardSpriteExternal(\n id, x, y, items as any,\n (item, e, id) => (onCardClickRef.current as any)(item, e, id),\n (e) => (onPanStartRef.current as any)(e, true), // Explicitly mark as on-card for Pixi events\n cardWidth, cardHeight, cardColorsRef.current\n ),\n updateCardContent: (sprite: CardSprite | any, item: any) => updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),\n isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),\n });\n needsRenderRef.current = true;\n app.renderer?.render(app.stage);\n } catch (e) {\n console.error('[PivotCanvas] processScroll error', e);\n }\n };\n\n const onScroll = () => {\n // capture latest scroll positions quickly and schedule work\n lastScroll.x = container.scrollLeft;\n lastScroll.y = container.scrollTop;\n if (!pendingRef.scheduled) {\n pendingRef.scheduled = true;\n requestAnimationFrame(processScroll);\n }\n };\n\n container.addEventListener('scroll', onScroll, { passive: true });\n\n return () => {\n container.removeEventListener('scroll', onScroll);\n };\n }, [pixiReady, layout, visibleIds, items, cardWidth, cardHeight, zoomLevel, viewportWidth, viewportHeight, panX, panY, grouping, viewMode, selectedId, onCardClick, onPanStart]);\n\n function createCardSprite(id: ItemId, x: number, y: number): CardSprite {\n return createCardSpriteExternal(\n id, x, y, items as any,\n (item, e, id) => (onCardClickRef.current as any)(item, e, id),\n (e) => (onPanStartRef.current as any)(e, true),\n cardWidth, cardHeight, cardColorsRef.current\n );\n }\n // Mark these helpers as used (they may be referenced externally or via callbacks)\n void createCardSprite;\n\n function updateCardContent(sprite: CardSprite, item: TItem) {\n return updateCardContentExternal(sprite as any, item as any, selectedId, cardWidth, cardHeight, cardColorsRef.current) as any;\n }\n\n function updatePositions(): boolean {\n return updatePositionsExternal(spritesRef.current, isViewTransitionRef, ANIMATION_SPEED);\n }\n\n void updatePositions;\n\n function updateSelection() {\n const sprites = spritesRef.current;\n\n for (const sprite of sprites.values()) {\n const val = (items as any)[String(sprite.itemId)];\n updateCardContent(sprite, val);\n }\n }\n\n function updateHighlight() {\n updateHighlightExternal(bucketsContainerRef.current, parentContainerRef.current, grouping, layout, hoveredGroupIndex, cardWidth, zoomLevel);\n }\n\n void updateHighlight;\n\n // This component renders into the parent `containerRef` (we append Pixi canvas\n // and spacer directly into that DOM node). Return null so we don't replace or\n // reassign the parent's ref which must remain the scrollable viewport element.\n return null;\n}\n"],"names":["useRef","useState","DEFAULT_COLORS","useMemo","createCssColorResolver","useEffect","resolveCardColors","PIXI","clearSpritePool","updateBucketBackgroundsExternal","syncSpritesToViewport","createCardSpriteExternal","updateCardContentExternal","startAnimationLoopExternal","updateHighlightExternal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EM,SAAU,WAAW,CAAuB,EAChD,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,SAAS,EAAE,UAAU,GAAG,KAAK,EAC7B,SAAS,EAAE,UAAU,EACrB,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,GACY,EAAA;IACxB,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,CAAC;IAGjD,MAAM,kBAAkB,GAAG,YAAY;AAIvC,IAAA,MAAM,SAAS,GAAGA,YAAM,CAA2B,IAAI,CAAC;AACxD,IAAA,MAAM,SAAS,GAAGA,YAAM,CAAwB,IAAI,CAAC;AACrD,IAAA,MAAM,MAAM,GAAGA,YAAM,CAA0B,IAAI,CAAC;AACpD,IAAA,MAAM,OAAO,GAAGA,YAAM,CAAwB,IAAI,CAAC;AACnD,IAAA,MAAM,mBAAmB,GAAGA,YAAM,CAAwB,IAAI,CAAC;IAC/D,MAAM,UAAU,GAAGA,YAAM,CAA0B,IAAI,GAAG,EAAE,CAAC;AAC7D,IAAA,MAAM,iBAAiB,GAAGA,YAAM,CAAS,CAA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ahL,IAAA,SAAS,iBAAiB,CAAC,MAAkB,EAAE,IAAW,EAAA;AACxD,QAAA,OAAOA,yBAAyB,CAAC,MAAa,EAAE,IAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,OAAO,CAAQ;IAC/H;AAQA,IAAA,SAAS,eAAe,GAAA;AACtB,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO;QAElC,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE;YACrC,MAAM,GAAG,GAAI,KAAa,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACjD,YAAA,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC;QAChC;IACF;AAEA,IAAA,SAAS,eAAe,GAAA;AACtB,QAAAE,uBAAuB,CAAC,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,SAAoB,CAAC;IAC7I;AAOA,IAAA,OAAO,IAAI;AACb;;;;"}
1
+ {"version":3,"file":"PivotCanvas.js","sources":["../../../../PivotViewer/components/PivotCanvas.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport * as PIXI from 'pixi.js';\nimport type { ItemId, LayoutResult, GroupingResult } from '../engine/types';\nimport type { ViewMode } from './Toolbar';\nimport { createCssColorResolver, resolveCardColors } from './pivot/colorResolver';\nimport { createCardSprite as createCardSpriteExternal, updateCardContent as updateCardContentExternal, clearSpritePool } from './pivot/sprites';\nimport { syncSpritesToViewport } from './pivot/visibility';\nimport { updateBucketBackgrounds as updateBucketBackgroundsExternal, updateHighlight as updateHighlightExternal } from './pivot/buckets';\nimport { startAnimationLoop as startAnimationLoopExternal, updatePositions as updatePositionsExternal } from './pivot/animation';\nimport { ANIMATION_SPEED, DEFAULT_COLORS, type CardSprite, type CardColors } from './pivot/constants';\n\nexport interface PivotCanvasProps<TItem extends object> {\n /** Original items array */\n items: TItem[];\n\n /** Layout positions */\n layout: LayoutResult;\n\n /** Grouping information */\n grouping: GroupingResult;\n\n /** Visible item IDs */\n visibleIds: Uint32Array;\n\n /** Card dimensions */\n cardWidth: number;\n cardHeight: number;\n\n /** Zoom level */\n zoomLevel: number;\n\n /** Pan offset */\n panX: number;\n panY: number;\n\n /** Viewport dimensions (visible area) */\n viewportWidth: number;\n viewportHeight: number;\n\n /** Selected item ID */\n selectedId: ItemId | null;\n\n /** Hovered group index */\n hoveredGroupIndex: number | null;\n\n /** Current view mode */\n viewMode: ViewMode;\n\n /** Is zooming animation in progress */\n isZooming?: boolean;\n\n /** Card renderer function */\n cardRenderer?: (item: TItem) => ReactNode;\n\n /** ID resolver */\n resolveId: (item: TItem, index: number) => string | number;\n\n /** Click handler */\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void;\n\n /** Pan handlers */\n onPanStart: (e: React.MouseEvent) => void;\n onPanMove: (e: React.MouseEvent) => void;\n onPanEnd: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n}\n\n// `CardSprite` type moved to ./pivot/constants and imported above\n\n// constants and CardColors type moved to ./pivot/constants\n\nexport function PivotCanvas<TItem extends object>({\n items,\n layout,\n grouping,\n visibleIds,\n cardWidth,\n cardHeight,\n zoomLevel,\n panX,\n panY,\n viewportWidth,\n viewportHeight,\n selectedId,\n hoveredGroupIndex,\n isZooming: _isZooming = false,\n resolveId: _resolveId,\n onCardClick,\n onPanStart,\n onPanMove,\n onPanEnd,\n viewMode,\n cardRenderer,\n containerRef,\n}: PivotCanvasProps<TItem>) {\n console.log('[PivotCanvas] Render', { viewMode });\n // Use the containerRef passed from the parent viewport so we append the Pixi\n // canvas and spacer into the actual scrollable element.\n const parentContainerRef = containerRef;\n // Mark intentionally-unused destructured props as used to satisfy lint\n void _isZooming;\n void _resolveId;\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const spacerRef = useRef<HTMLDivElement | null>(null);\n const appRef = useRef<PIXI.Application | null>(null);\n const rootRef = useRef<PIXI.Container | null>(null);\n const bucketsContainerRef = useRef<PIXI.Container | null>(null);\n const spritesRef = useRef<Map<ItemId, CardSprite>>(new Map());\n const animationFrameRef = useRef<number>(0);\n const mountedRef = useRef(true);\n const [pixiReady, setPixiReady] = useState(false);\n const isAnimatingRef = useRef(false);\n const needsRenderRef = useRef(false);\n const initializingRef = useRef(false);\n const isViewTransitionRef = useRef(false);\n const lastViewChangeTimeRef = useRef(0);\n const previousViewModeRef = useRef<ViewMode>(viewMode);\n const prevLayoutRef = useRef<LayoutResult | null>(null);\n const prevGroupingRef = useRef<GroupingResult | null>(null);\n const cardColorsRef = useRef<CardColors>(DEFAULT_COLORS);\n void cardRenderer; // unused in Pixi renderer but keep prop compatibility\n\n const cssColorResolver = useMemo(() => createCssColorResolver(), []);\n\n const onPanStartRef = useRef(onPanStart);\n const onPanMoveRef = useRef(onPanMove);\n const onPanEndRef = useRef(onPanEnd);\n const onCardClickRef = useRef(onCardClick);\n const prevPanRef = useRef({ x: panX, y: panY });\n\n // Initialize Pixi Application\n useEffect(() => {\n // ... existing code ...\n onPanMoveRef.current = onPanMove;\n onPanEndRef.current = onPanEnd;\n onCardClickRef.current = onCardClick;\n }, [onPanStart, onPanMove, onPanEnd, onCardClick]);\n\n useEffect(() => {\n cardColorsRef.current = resolveCardColors(cssColorResolver);\n }, [cssColorResolver]);\n\n useEffect(() => {\n // Reset mounted flag\n mountedRef.current = true;\n\n if (!parentContainerRef || !parentContainerRef.current) {\n return;\n }\n\n // Prevent multiple simultaneous initializations\n if (initializingRef.current || appRef.current) {\n return;\n }\n\n initializingRef.current = true;\n let app: PIXI.Application | null = null;\n // Handler references declared here so cleanup can remove them later.\n\n (async () => {\n try {\n // Prefer the new init API (v8+) to avoid deprecation issues. Fall back\n // to the constructor options when `init` is not available.\n const options = {\n backgroundAlpha: 0,\n antialias: false,\n autoStart: false,\n autoDensity: true,\n resolution: window.devicePixelRatio || 1,\n width: viewportWidth > 0 ? viewportWidth : 800,\n height: viewportHeight > 0 ? viewportHeight : 600,\n } as PIXI.ApplicationOptions;\n\n app = new PIXI.Application();\n if ((app as unknown as { init?: unknown }).init && typeof (app as unknown as { init: (...args: unknown[]) => unknown }).init === 'function') {\n // init may return a promise in some builds\n \n // @ts-ignore\n await app.init(options);\n } else {\n // Fall back to constructor that accepts options\n app.destroy?.();\n app = new PIXI.Application(options);\n }\n\n if (!mountedRef.current || !parentContainerRef.current) {\n // Component unmounted during initialization\n if (app && typeof app.destroy === 'function') app.destroy(true, { children: true });\n initializingRef.current = false;\n return;\n }\n\n appRef.current = app;\n\n const bucketsContainer = new PIXI.Container();\n bucketsContainerRef.current = bucketsContainer;\n app.stage.addChild(bucketsContainer);\n\n const root = new PIXI.Container();\n rootRef.current = root;\n app.stage.addChild(root);\n\n // Resolve canvas element (different Pixi builds expose it as `view` or\n // `canvas`).\n const canvasEl = (app.view ?? (app as unknown as { canvas?: HTMLCanvasElement }).canvas ?? app.renderer?.view) as HTMLCanvasElement | undefined;\n\n // Place canvas outside the scrollable content so native scrolling\n // doesn't move the canvas DOM element itself. We overlay the canvas\n // on top of the scroll area by inserting it into the parent element\n // (or the container itself if parent is not available). This ensures\n // the Pixi canvas remains stable while we move the Pixi world inside\n // it to represent camera pan.\n const overlayParent = parentContainerRef.current.parentElement ?? parentContainerRef.current;\n if (canvasEl) {\n if (canvasEl.parentElement) {\n canvasEl.parentElement.removeChild(canvasEl);\n }\n overlayParent.appendChild(canvasEl);\n canvasRef.current = canvasEl;\n } else if ((app as unknown as { canvas?: HTMLCanvasElement }).canvas) {\n const c = (app as unknown as { canvas: HTMLCanvasElement }).canvas;\n if (c.parentElement) {\n c.parentElement.removeChild(c);\n }\n overlayParent.appendChild(c);\n canvasRef.current = c;\n }\n\n // Position the canvas to overlay the scrollable container area.\n if (canvasRef.current && parentContainerRef.current) {\n const parentBounds = parentContainerRef.current.getBoundingClientRect();\n void parentBounds;\n canvasRef.current.style.position = 'absolute';\n // Place canvas relative to the overlayParent's coordinate space.\n // If overlayParent is the immediate parent, top/left 0 aligns it.\n const offsetLeft = parentContainerRef.current.offsetLeft;\n const offsetTop = parentContainerRef.current.offsetTop;\n canvasRef.current.style.left = `${offsetLeft}px`;\n canvasRef.current.style.top = `${offsetTop}px`;\n canvasRef.current.style.width = `${parentContainerRef.current.clientWidth}px`;\n canvasRef.current.style.height = `${parentContainerRef.current.clientHeight}px`;\n // Place canvas behind the scrollable container (which has z-index 1)\n // so scrollbars appear on top.\n canvasRef.current.style.zIndex = '0';\n // Disable pointer events on canvas so they pass through to the viewport if needed,\n // though viewport is on top anyway.\n canvasRef.current.style.pointerEvents = 'none';\n }\n\n // We handle clicks and interactions manually in PivotViewerMain now,\n // so we don't need to configure Pixi events on the container.\n // This avoids z-index conflicts and event propagation issues.\n\n // Make canvas fill container with absolute positioning\n if (canvasRef.current) {\n canvasRef.current.style.display = 'block';\n // Ensure canvas does not capture events so they pass through to the viewport\n canvasRef.current.style.pointerEvents = 'none';\n }\n\n // Setup stage events for background panning\n app.stage.eventMode = 'static';\n app.stage.hitArea = new PIXI.Rectangle(0, 0, viewportWidth, viewportHeight);\n\n app.stage.on('pointerdown', (e) => {\n // Only handle if it reached the stage (background)\n // Sprites stop propagation, so this is safe\n onPanStartRef.current(e.nativeEvent as unknown as React.MouseEvent);\n });\n\n app.stage.on('globalpointermove', (e) => {\n onPanMoveRef.current(e.nativeEvent as unknown as React.MouseEvent);\n });\n\n app.stage.on('globalpointerup', () => {\n onPanEndRef.current();\n });\n\n // We no longer need manual event listeners on parentEl because Pixi\n // is now listening to events on parentEl directly via setTargetElement.\n // This allows Pixi to handle hit testing through the transparent container.\n const parentEl = parentContainerRef.current;\n if (parentEl) {\n // handleMouseDown = (e: Event) => onPanStartRef.current(e as unknown);\n // handleMouseMove = (e: Event) => onPanMoveRef.current(e as unknown);\n // handleMouseUp = () => onPanEndRef.current();\n // parentEl.addEventListener('mousedown', handleMouseDown);\n // parentEl.addEventListener('mousemove', handleMouseMove);\n // parentEl.addEventListener('mouseup', handleMouseUp);\n // parentEl.addEventListener('mouseleave', handleMouseUp);\n // window.addEventListener('mouseup', handleMouseUp);\n // window.addEventListener('pointerup', handleMouseUp);\n }\n\n // Immediately size to container to avoid delay\n if (viewportWidth > 0 && viewportHeight > 0) {\n app.renderer?.resize(viewportWidth, viewportHeight);\n }\n\n setPixiReady(true);\n initializingRef.current = false;\n\n // Trigger initial render\n needsRenderRef.current = true;\n app.renderer?.render(app.stage);\n } catch (error) {\n console.error('Failed to initialize Pixi.js:', error);\n initializingRef.current = false;\n }\n })();\n\n return () => {\n mountedRef.current = false;\n setPixiReady(false);\n cancelAnimationFrame(animationFrameRef.current);\n\n if (appRef.current && typeof appRef.current.destroy === 'function') {\n appRef.current.destroy(true, { children: true });\n appRef.current = null;\n rootRef.current = null;\n }\n\n // Clear sprite pool to avoid holding onto destroyed textures\n clearSpritePool();\n\n // Remove any event listeners we attached to the parent container\n try {\n const parentEl = parentContainerRef.current;\n if (parentEl) {\n // if (handleMouseDown) parentEl.removeEventListener('mousedown', handleMouseDown);\n // if (handleMouseMove) parentEl.removeEventListener('mousemove', handleMouseMove);\n // if (handleMouseUp) parentEl.removeEventListener('mouseup', handleMouseUp);\n // if (handleMouseUp) parentEl.removeEventListener('mouseleave', handleMouseUp);\n // if (handleMouseUp) {\n // window.removeEventListener('mouseup', handleMouseUp);\n // window.removeEventListener('pointerup', handleMouseUp);\n // }\n }\n } catch (e) {\n void e;\n }\n // Remove DOM nodes we appended\n try {\n if (canvasRef.current && canvasRef.current.parentElement) {\n canvasRef.current.parentElement.removeChild(canvasRef.current);\n }\n } catch (e) {\n void e;\n }\n };\n }, [viewportWidth, viewportHeight]);\n\n // Handle canvas resize\n useEffect(() => {\n if (!parentContainerRef || !parentContainerRef.current || !appRef.current || !pixiReady) return;\n\n const container = parentContainerRef.current;\n const app = appRef.current;\n\n let resizeTimeout: ReturnType<typeof setTimeout>;\n\n const handleResize = () => {\n // Size canvas to viewport dimensions from props\n if (viewportWidth > 0 && viewportHeight > 0) {\n app.renderer?.resize(viewportWidth, viewportHeight);\n app.stage.hitArea = new PIXI.Rectangle(0, 0, viewportWidth, viewportHeight);\n\n // Keep canvas DOM size in sync with container\n if (canvasRef.current && parentContainerRef.current) {\n canvasRef.current.style.width = `${parentContainerRef.current.clientWidth}px`;\n canvasRef.current.style.height = `${parentContainerRef.current.clientHeight}px`;\n // Also update left/top in case the container moved\n canvasRef.current.style.left = `${parentContainerRef.current.offsetLeft}px`;\n canvasRef.current.style.top = `${parentContainerRef.current.offsetTop}px`;\n }\n }\n };\n\n const debouncedResize = () => {\n clearTimeout(resizeTimeout);\n resizeTimeout = setTimeout(handleResize, 150);\n };\n\n // Initial resize (immediate)\n handleResize();\n\n // Watch for size changes (debounced)\n const resizeObserver = new ResizeObserver(debouncedResize);\n resizeObserver.observe(container);\n\n return () => {\n clearTimeout(resizeTimeout);\n resizeObserver.disconnect();\n };\n }, [pixiReady, viewportWidth, viewportHeight]);\n\n // Update bucket backgrounds only when layout/grouping changes\n useEffect(() => {\n if (!bucketsContainerRef.current || !parentContainerRef.current || !pixiReady) return;\n updateBucketBackgroundsExternal(bucketsContainerRef.current, parentContainerRef.current, grouping, layout, zoomLevel, cardColorsRef.current, viewMode);\n needsRenderRef.current = true;\n appRef.current?.renderer?.render(appRef.current.stage);\n }, [grouping, layout, zoomLevel, viewMode, pixiReady]);\n\n useEffect(() => {\n if (!rootRef.current || !parentContainerRef.current || !pixiReady) {\n return;\n }\n\n // Check if this is a view mode change (not just pan/scroll)\n const viewModeChanged = previousViewModeRef.current !== viewMode;\n const groupingChanged = prevGroupingRef.current !== grouping;\n\n if (viewModeChanged || groupingChanged) {\n isViewTransitionRef.current = true;\n lastViewChangeTimeRef.current = Date.now();\n previousViewModeRef.current = viewMode;\n prevGroupingRef.current = grouping;\n \n // When switching modes, mark all sprites for cleanup by hiding them\n // The normal sweep logic will remove them after SWEEP_MS delay\n console.log('[PivotCanvas] View mode or grouping changed - marking sprites for cleanup');\n for (const sprite of spritesRef.current.values()) {\n try {\n if (sprite.container) {\n sprite.container.visible = false;\n }\n (sprite as unknown as { __lastHiddenAt?: number }).__lastHiddenAt = Date.now();\n } catch (e) {\n void e;\n }\n }\n }\n\n // Update spacer dimensions to match scaled world size\n if (spacerRef.current) {\n const spacer = spacerRef.current;\n const worldWidth = (layout.totalWidth || viewportWidth) * zoomLevel;\n const worldHeight = (layout.totalHeight || viewportHeight) * zoomLevel;\n spacer.style.width = `${Math.max(worldWidth, viewportWidth)}px`;\n spacer.style.height = `${Math.max(worldHeight, viewportHeight)}px`;\n }\n\n // Ensure scroll spacer matches layout so the container becomes scrollable and\n // native scrollLeft/scrollTop reflect the camera position.\n if (parentContainerRef.current) {\n const spacer = spacerRef.current;\n if (spacer) {\n // Debug: log spacer and layout values to detect mismatches\n }\n }\n\n const panDeltaX = panX - prevPanRef.current.x;\n const panDeltaY = panY - prevPanRef.current.y;\n prevPanRef.current = { x: panX, y: panY };\n\n // Sync sprites into viewport and create/remove as needed\n // Provide wrappers for sprite creation and content update so helpers have required context\n syncSpritesToViewport({\n root: rootRef.current,\n container: parentContainerRef.current,\n sprites: spritesRef.current,\n layout,\n visibleIds,\n items,\n cardWidth,\n cardHeight,\n panX,\n panY,\n panDeltaX,\n panDeltaY,\n zoomLevel,\n viewportWidth,\n viewportHeight,\n createCardSprite: (id: string | number, x: number, y: number) => createCardSpriteExternal(\n id,\n x,\n y,\n items as TItem[],\n (item: TItem, e: MouseEvent, id: string | number) => (onCardClickRef.current)(item, e, id),\n (e: MouseEvent) => (onPanStart)(e as unknown as React.MouseEvent),\n cardWidth,\n cardHeight,\n cardColorsRef.current\n ),\n updateCardContent: (sprite: CardSprite, item: TItem) => updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),\n isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),\n prevLayout: prevLayoutRef.current,\n });\n needsRenderRef.current = true;\n \n // Force an immediate render after syncing sprites to ensure cards appear\n if (appRef.current?.renderer && rootRef.current) {\n appRef.current.renderer.render(appRef.current.stage);\n needsRenderRef.current = false;\n }\n \n startAnimationLoopExternal({\n mountedRef,\n appRef,\n animationFrameRef,\n isAnimatingRef,\n needsRenderRef,\n spritesRef,\n isViewTransitionRef,\n });\n }, [layout, visibleIds, items, cardWidth, cardHeight, pixiReady, zoomLevel, panX, panY, grouping, viewMode]);\n\n // Update prevLayoutRef after processing layout changes\n useEffect(() => {\n prevLayoutRef.current = layout;\n }, [layout]);\n\n useEffect(() => {\n if (!rootRef.current || !bucketsContainerRef.current) return;\n\n // Camera transform: move world opposite to camera position. Prefer the\n // native container scroll positions where available (they are authoritative\n // during user scrolls) and fall back to the passed pan props.\n const effectivePanX = parentContainerRef.current ? parentContainerRef.current.scrollLeft : panX;\n const effectivePanY = parentContainerRef.current ? parentContainerRef.current.scrollTop : panY;\n\n // Apply zoom and position to root and buckets.\n if (rootRef.current.scale && bucketsContainerRef.current.scale) {\n rootRef.current.scale.set(zoomLevel);\n bucketsContainerRef.current.scale.set(zoomLevel);\n }\n if (rootRef.current.position && bucketsContainerRef.current.position) {\n rootRef.current.position.set(-effectivePanX, -effectivePanY);\n bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);\n }\n appRef.current?.renderer?.render(appRef.current.stage);\n }, [zoomLevel, panX, panY]);\n\n useEffect(() => {\n if (!rootRef.current) return;\n updateSelection();\n needsRenderRef.current = true;\n appRef.current?.renderer.render(appRef.current.stage);\n }, [selectedId, items]);\n\n useEffect(() => {\n if (!rootRef.current) return;\n updateHighlight();\n needsRenderRef.current = true;\n appRef.current?.renderer.render(appRef.current.stage);\n }, [hoveredGroupIndex, layout, grouping]);\n\n // Note: animation loop and bucket background updates are delegated to\n // external helpers (`startAnimationLoopExternal` and\n // `updateBucketBackgroundsExternal`) and invoked where needed. We don't\n // expose local wrappers to avoid unused-function lint warnings.\n\n // Listen to native scroll events on the parent container so we update the\n // Pixi world immediately when the user scrolls (native scrollbar or\n // programmatic). This ensures `syncSpritesToViewport` runs on scroll and\n // creates/destroys sprites as the viewport moves.\n useEffect(() => {\n if (!pixiReady || !parentContainerRef || !parentContainerRef.current || !appRef.current || !rootRef.current) return;\n\n const container = parentContainerRef.current;\n const app = appRef.current;\n\n // rAF-batched scroll handling: store the latest scroll values and process\n // them once per animation frame to avoid heavy synchronous work inside\n // the scroll event which causes jank and de-synchronisation between the\n // compositor and Pixi render updates.\n const lastScroll = { x: container.scrollLeft, y: container.scrollTop };\n const pendingRef = { scheduled: false } as { scheduled: boolean };\n\n const processScroll = () => {\n pendingRef.scheduled = false;\n try {\n // Read directly from container to ensure consistency with visibility logic\n // and to handle cases where scroll changes without event (e.g. resize clamping)\n const effectivePanX = container.scrollLeft;\n const effectivePanY = container.scrollTop;\n\n // Update lastScroll to keep it in sync\n lastScroll.x = effectivePanX;\n lastScroll.y = effectivePanY;\n\n if (rootRef.current && bucketsContainerRef.current) {\n if (rootRef.current.scale && bucketsContainerRef.current.scale) {\n rootRef.current.scale.set(zoomLevel);\n bucketsContainerRef.current.scale.set(zoomLevel);\n }\n const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;\n void invScale;\n if (rootRef.current.position && bucketsContainerRef.current.position) {\n rootRef.current.position.set(-effectivePanX, -effectivePanY);\n bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);\n }\n }\n\n syncSpritesToViewport({\n root: rootRef.current,\n container: parentContainerRef.current,\n sprites: spritesRef.current,\n layout,\n visibleIds,\n items,\n cardWidth,\n cardHeight,\n panX,\n panY,\n zoomLevel,\n viewportWidth,\n viewportHeight,\n createCardSprite: (id: string | number, x: number, y: number) => createCardSpriteExternal(\n id, x, y, items as TItem[],\n (item, e, id) => (onCardClickRef.current)(item, e, id),\n (e) => (onPanStartRef.current)(e as unknown as React.MouseEvent), // Pixi events to React events\n cardWidth, cardHeight, cardColorsRef.current\n ),\n updateCardContent: (sprite: CardSprite, item: TItem) => updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),\n isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),\n });\n needsRenderRef.current = true;\n app.renderer?.render(app.stage);\n } catch (e) {\n console.error('[PivotCanvas] processScroll error', e);\n }\n };\n\n const onScroll = () => {\n // capture latest scroll positions quickly and schedule work\n lastScroll.x = container.scrollLeft;\n lastScroll.y = container.scrollTop;\n if (!pendingRef.scheduled) {\n pendingRef.scheduled = true;\n requestAnimationFrame(processScroll);\n }\n };\n\n container.addEventListener('scroll', onScroll, { passive: true });\n\n return () => {\n container.removeEventListener('scroll', onScroll);\n };\n }, [pixiReady, layout, visibleIds, items, cardWidth, cardHeight, zoomLevel, viewportWidth, viewportHeight, panX, panY, grouping, viewMode, selectedId, onCardClick, onPanStart]);\n\n function createCardSprite(id: ItemId, x: number, y: number): CardSprite {\n return createCardSpriteExternal(\n id, x, y, items as TItem[],\n (item, e, id) => (onCardClickRef.current)(item, e, id),\n (e) => (onPanStartRef.current)(e as unknown as React.MouseEvent),\n cardWidth, cardHeight, cardColorsRef.current\n );\n }\n // Mark these helpers as used (they may be referenced externally or via callbacks)\n void createCardSprite;\n\n function updateCardContent(sprite: CardSprite, item: TItem) {\n return updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current);\n }\n\n function updatePositions(): boolean {\n return updatePositionsExternal(spritesRef.current, isViewTransitionRef, ANIMATION_SPEED);\n }\n\n void updatePositions;\n\n function updateSelection() {\n const sprites = spritesRef.current;\n\n for (const sprite of sprites.values()) {\n const val = (items as TItem[])[Number(sprite.itemId)];\n updateCardContent(sprite, val);\n }\n }\n\n function updateHighlight() {\n updateHighlightExternal(bucketsContainerRef.current, parentContainerRef.current, grouping, layout, hoveredGroupIndex, cardWidth, zoomLevel);\n }\n\n void updateHighlight;\n\n // This component renders into the parent `containerRef` (we append Pixi canvas\n // and spacer directly into that DOM node). Return null so we don't replace or\n // reassign the parent's ref which must remain the scrollable viewport element.\n return null;\n}\n"],"names":["useRef","useState","DEFAULT_COLORS","useMemo","createCssColorResolver","useEffect","resolveCardColors","PIXI","clearSpritePool","updateBucketBackgroundsExternal","syncSpritesToViewport","createCardSpriteExternal","updateCardContentExternal","startAnimationLoopExternal","updateHighlightExternal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EM,SAAU,WAAW,CAAuB,EAChD,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,SAAS,EAAE,UAAU,GAAG,KAAK,EAC7B,SAAS,EAAE,UAAU,EACrB,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,GACY,EAAA;IACxB,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,CAAC;IAGjD,MAAM,kBAAkB,GAAG,YAAY;AAIvC,IAAA,MAAM,SAAS,GAAGA,YAAM,CAA2B,IAAI,CAAC;AACxD,IAAA,MAAM,SAAS,GAAGA,YAAM,CAAwB,IAAI,CAAC;AACrD,IAAA,MAAM,MAAM,GAAGA,YAAM,CAA0B,IAAI,CAAC;AACpD,IAAA,MAAM,OAAO,GAAGA,YAAM,CAAwB,IAAI,CAAC;AACnD,IAAA,MAAM,mBAAmB,GAAGA,YAAM,CAAwB,IAAI,CAAC;IAC/D,MAAM,UAAU,GAAGA,YAAM,CAA0B,IAAI,GAAG,EAAE,CAAC;AAC7D,IAAA,MAAM,iBAAiB,GAAGA,YAAM,CAAS,CAAC,CAAC;AAC3C,IAAA,MAAM,UAAU,GAAGA,YAAM,CAAC,IAAI,CAAC;IAC/B,MAAM,CAAC,SAAS,EAAE,YAA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AE,IAAW,EAAA;AACxD,QAAA,OAAOA,yBAAyB,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC;IAC1G;AAQA,IAAA,SAAS,eAAe,GAAA;AACtB,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO;QAElC,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE;YACrC,MAAM,GAAG,GAAI,KAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACrD,YAAA,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC;QAChC;IACF;AAEA,IAAA,SAAS,eAAe,GAAA;AACtB,QAAAE,uBAAuB,CAAC,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,SAAoB,CAAC;IAC7I;AAOA,IAAA,OAAO,IAAI;AACb;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PivotViewerMain.js","sources":["../../../../PivotViewer/components/PivotViewerMain.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ReactNode } from 'react';\nimport type { ItemId, LayoutResult, GroupingResult } from '../engine/types';\nimport type { ViewMode } from './Toolbar';\nimport type { PivotDimensionFilter } from '../hooks/useDimensionState';\nimport { Spinner } from './Spinner';\nimport { PivotCanvas } from './PivotCanvas';\nimport { AxisLabels } from './AxisLabels';\nimport { DetailPanel } from './DetailPanel';\n\nexport interface PivotViewerMainProps<TItem extends object> {\n data: TItem[];\n ready: boolean;\n isLoading: boolean;\n visibleIds: Uint32Array;\n grouping: GroupingResult;\n layout: LayoutResult;\n cardWidth: number;\n cardHeight: number;\n zoomLevel: number;\n scrollPosition: { x: number; y: number };\n containerDimensions: { width: number; height: number };\n selectedItem: TItem | null;\n hoveredGroupIndex: number | null;\n isZooming: boolean;\n viewMode: ViewMode;\n cardRenderer?: (item: TItem) => ReactNode;\n resolveId: (item: TItem, index: number) => ItemId;\n emptyContent?: ReactNode;\n dimensionFilter: PivotDimensionFilter;\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void;\n onPanStart: (e: React.MouseEvent) => void;\n onPanMove: (e: React.MouseEvent) => void;\n onPanEnd: () => void;\n onGroupHover: (index: number | null) => void;\n onAxisLabelClick: (value: string) => void;\n onCloseDetail: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n axisLabelsRef: React.RefObject<HTMLDivElement | null>;\n spacerRef: React.RefObject<HTMLDivElement | null>;\n}\n\nexport function PivotViewerMain<TItem extends object>({\n data,\n ready,\n isLoading,\n visibleIds,\n grouping,\n layout,\n cardWidth,\n cardHeight,\n zoomLevel,\n scrollPosition,\n containerDimensions,\n selectedItem,\n hoveredGroupIndex,\n isZooming,\n viewMode,\n cardRenderer,\n resolveId,\n emptyContent,\n dimensionFilter,\n onCardClick,\n onPanStart,\n onPanMove,\n onPanEnd,\n onGroupHover,\n onAxisLabelClick,\n onCloseDetail,\n containerRef,\n axisLabelsRef,\n spacerRef,\n}: PivotViewerMainProps<TItem>) {\n const handleViewportClick = (e: React.MouseEvent) => {\n if (isZooming || !containerRef.current) return;\n\n const container = containerRef.current;\n const rect = container.getBoundingClientRect();\n // Use live DOM scroll position for accurate hit testing\n const scrollLeft = container.scrollLeft;\n const scrollTop = container.scrollTop;\n\n const clickX = e.clientX - rect.left + scrollLeft;\n const clickY = e.clientY - rect.top + scrollTop;\n\n const worldX = clickX / zoomLevel;\n const worldY = clickY / zoomLevel;\n\n // Check visible items\n for (let i = 0; i < visibleIds.length; i++) {\n const id = visibleIds[i];\n const pos = layout.positions.get(id);\n if (pos) {\n if (worldX >= pos.x && worldX <= pos.x + cardWidth &&\n worldY >= pos.y && worldY <= pos.y + cardHeight) {\n const item = data[id];\n if (item) {\n onCardClick(item, e.nativeEvent as unknown as MouseEvent, id);\n }\n return;\n }\n }\n }\n };\n\n const handleViewportMouseMove = (e: React.MouseEvent) => {\n if (isZooming || !containerRef.current) return;\n\n const container = containerRef.current;\n const rect = container.getBoundingClientRect();\n const scrollLeft = container.scrollLeft;\n const scrollTop = container.scrollTop;\n\n const mouseX = e.clientX - rect.left + scrollLeft;\n const mouseY = e.clientY - rect.top + scrollTop;\n\n const worldX = mouseX / zoomLevel;\n const worldY = mouseY / zoomLevel;\n\n let isOverCard = false;\n for (let i = 0; i < visibleIds.length; i++) {\n const id = visibleIds[i];\n const pos = layout.positions.get(id);\n if (pos) {\n if (worldX >= pos.x && worldX <= pos.x + cardWidth &&\n worldY >= pos.y && worldY <= pos.y + cardHeight) {\n isOverCard = true;\n break;\n }\n }\n }\n\n container.style.cursor = isOverCard ? 'pointer' : 'default';\n };\n\n return isLoading ? (\n <Spinner />\n ) : (\n <div className=\"pv-groups-wrapper\">\n <div style={{ position: 'relative', flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0 }}>\n <div\n className={`pv-viewport ${isZooming ? 'pv-zooming' : ''}`}\n ref={containerRef}\n style={{ overflow: 'auto', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}\n onClick={handleViewportClick}\n onMouseMove={handleViewportMouseMove}\n >\n {/* Spacer for scrolling - explicitly rendered to allow synchronous updates during animation */}\n <div\n ref={spacerRef}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: layout.totalWidth * zoomLevel,\n height: layout.totalHeight * zoomLevel,\n pointerEvents: 'none'\n }}\n />\n\n {!ready && (\n <div className=\"pv-loading\">Building indexes...</div>\n )}\n\n {ready && visibleIds.length === 0 && (\n <div className=\"pv-empty\">\n {emptyContent ?? 'No items to display.'}\n </div>\n )}\n\n {ready && visibleIds.length > 0 && (\n <PivotCanvas\n items={data}\n layout={layout}\n grouping={grouping}\n visibleIds={visibleIds}\n cardWidth={cardWidth}\n cardHeight={cardHeight}\n zoomLevel={zoomLevel}\n panX={scrollPosition.x}\n panY={scrollPosition.y}\n viewportWidth={containerDimensions.width}\n viewportHeight={containerDimensions.height}\n selectedId={selectedItem ? resolveId(selectedItem, 0) : null}\n hoveredGroupIndex={hoveredGroupIndex}\n isZooming={isZooming}\n cardRenderer={cardRenderer}\n resolveId={resolveId}\n onCardClick={onCardClick}\n onPanStart={onPanStart as any}\n onPanMove={onPanMove as any}\n onPanEnd={onPanEnd}\n containerRef={containerRef}\n viewMode={viewMode}\n />\n )}\n </div>\n <DetailPanel\n selectedItem={selectedItem}\n onClose={onCloseDetail}\n />\n </div>\n\n {viewMode === 'grouped' && grouping.groups.length > 0 && (\n <AxisLabels\n groups={grouping.groups.map((g) => ({\n key: g.key,\n value: g.value,\n label: String(g.value),\n items: [],\n count: g.ids.length,\n }))}\n bucketWidths={layout.bucketWidths || []}\n zoomLevel={zoomLevel}\n dimensionFilter={dimensionFilter}\n hoveredGroup={hoveredGroupIndex !== null ? String(grouping.groups[hoveredGroupIndex]?.value) : null}\n onHover={(label) => {\n const index = grouping.groups.findIndex(g => String(g.value) === label);\n onGroupHover(index >= 0 ? index : null);\n }}\n onClick={onAxisLabelClick}\n containerRef={axisLabelsRef}\n />\n )}\n </div>\n );\n}\n"],"names":["_jsx","Spinner","_jsxs","PivotCanvas","DetailPanel","AxisLabels"],"mappings":";;;;;;;;AA4CM,SAAU,eAAe,CAAuB,EACpD,IAAI,EACJ,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,eAAe,EACf,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,GACmB,EAAA;AAC5B,IAAA,MAAM,mBAAmB,GAAG,CAAC,CAAmB,KAAI;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AI,EAAE,EACvC,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,iBAAiB,KAAK,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,EACnG,OAAO,EAAE,CAAC,KAAK,KAAI;oBACjB,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AACvE,oBAAA,YAAY,CAAC,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;AACzC,gBAAA,CAAC,EACD,OAAO,EAAE,gBAAgB,EACzB,YAAY,EAAE,aAAa,EAAA,CAC3B,CACH,CAAA,EAAA,CACG,CACP;AACH;;;;"}
1
+ {"version":3,"file":"PivotViewerMain.js","sources":["../../../../PivotViewer/components/PivotViewerMain.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ReactNode } from 'react';\nimport type { ItemId, LayoutResult, GroupingResult } from '../engine/types';\nimport type { ViewMode } from './Toolbar';\nimport type { PivotDimensionFilter } from '../hooks/useDimensionState';\nimport { Spinner } from './Spinner';\nimport { PivotCanvas } from './PivotCanvas';\nimport { AxisLabels } from './AxisLabels';\nimport { DetailPanel } from './DetailPanel';\n\nexport interface PivotViewerMainProps<TItem extends object> {\n data: TItem[];\n ready: boolean;\n isLoading: boolean;\n visibleIds: Uint32Array;\n grouping: GroupingResult;\n layout: LayoutResult;\n cardWidth: number;\n cardHeight: number;\n zoomLevel: number;\n scrollPosition: { x: number; y: number };\n containerDimensions: { width: number; height: number };\n selectedItem: TItem | null;\n hoveredGroupIndex: number | null;\n isZooming: boolean;\n viewMode: ViewMode;\n cardRenderer?: (item: TItem) => ReactNode;\n resolveId: (item: TItem, index: number) => ItemId;\n emptyContent?: ReactNode;\n dimensionFilter: PivotDimensionFilter;\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void;\n onPanStart: (e: React.MouseEvent) => void;\n onPanMove: (e: React.MouseEvent) => void;\n onPanEnd: () => void;\n onGroupHover: (index: number | null) => void;\n onAxisLabelClick: (value: string) => void;\n onCloseDetail: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n axisLabelsRef: React.RefObject<HTMLDivElement | null>;\n spacerRef: React.RefObject<HTMLDivElement | null>;\n}\n\nexport function PivotViewerMain<TItem extends object>({\n data,\n ready,\n isLoading,\n visibleIds,\n grouping,\n layout,\n cardWidth,\n cardHeight,\n zoomLevel,\n scrollPosition,\n containerDimensions,\n selectedItem,\n hoveredGroupIndex,\n isZooming,\n viewMode,\n cardRenderer,\n resolveId,\n emptyContent,\n dimensionFilter,\n onCardClick,\n onPanStart,\n onPanMove,\n onPanEnd,\n onGroupHover,\n onAxisLabelClick,\n onCloseDetail,\n containerRef,\n axisLabelsRef,\n spacerRef,\n}: PivotViewerMainProps<TItem>) {\n const handleViewportClick = (e: React.MouseEvent) => {\n if (isZooming || !containerRef.current) return;\n\n const container = containerRef.current;\n const rect = container.getBoundingClientRect();\n // Use live DOM scroll position for accurate hit testing\n const scrollLeft = container.scrollLeft;\n const scrollTop = container.scrollTop;\n\n const clickX = e.clientX - rect.left + scrollLeft;\n const clickY = e.clientY - rect.top + scrollTop;\n\n const worldX = clickX / zoomLevel;\n const worldY = clickY / zoomLevel;\n\n // Check visible items\n for (let i = 0; i < visibleIds.length; i++) {\n const id = visibleIds[i];\n const pos = layout.positions.get(id);\n if (pos) {\n if (worldX >= pos.x && worldX <= pos.x + cardWidth &&\n worldY >= pos.y && worldY <= pos.y + cardHeight) {\n const item = data[id];\n if (item) {\n onCardClick(item, e.nativeEvent as unknown as MouseEvent, id);\n }\n return;\n }\n }\n }\n };\n\n const handleViewportMouseMove = (e: React.MouseEvent) => {\n if (isZooming || !containerRef.current) return;\n\n const container = containerRef.current;\n const rect = container.getBoundingClientRect();\n const scrollLeft = container.scrollLeft;\n const scrollTop = container.scrollTop;\n\n const mouseX = e.clientX - rect.left + scrollLeft;\n const mouseY = e.clientY - rect.top + scrollTop;\n\n const worldX = mouseX / zoomLevel;\n const worldY = mouseY / zoomLevel;\n\n let isOverCard = false;\n for (let i = 0; i < visibleIds.length; i++) {\n const id = visibleIds[i];\n const pos = layout.positions.get(id);\n if (pos) {\n if (worldX >= pos.x && worldX <= pos.x + cardWidth &&\n worldY >= pos.y && worldY <= pos.y + cardHeight) {\n isOverCard = true;\n break;\n }\n }\n }\n\n container.style.cursor = isOverCard ? 'pointer' : 'default';\n };\n\n return isLoading ? (\n <Spinner />\n ) : (\n <div className=\"pv-groups-wrapper\">\n <div style={{ position: 'relative', flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0 }}>\n <div\n className={`pv-viewport ${isZooming ? 'pv-zooming' : ''}`}\n ref={containerRef}\n style={{ overflow: 'auto', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}\n onClick={handleViewportClick}\n onMouseMove={handleViewportMouseMove}\n >\n {/* Spacer for scrolling - explicitly rendered to allow synchronous updates during animation */}\n <div\n ref={spacerRef}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: layout.totalWidth * zoomLevel,\n height: layout.totalHeight * zoomLevel,\n pointerEvents: 'none'\n }}\n />\n\n {!ready && (\n <div className=\"pv-loading\">Building indexes...</div>\n )}\n\n {ready && visibleIds.length === 0 && (\n <div className=\"pv-empty\">\n {emptyContent ?? 'No items to display.'}\n </div>\n )}\n\n {ready && visibleIds.length > 0 && (\n <PivotCanvas\n items={data}\n layout={layout}\n grouping={grouping}\n visibleIds={visibleIds}\n cardWidth={cardWidth}\n cardHeight={cardHeight}\n zoomLevel={zoomLevel}\n panX={scrollPosition.x}\n panY={scrollPosition.y}\n viewportWidth={containerDimensions.width}\n viewportHeight={containerDimensions.height}\n selectedId={selectedItem ? resolveId(selectedItem, 0) : null}\n hoveredGroupIndex={hoveredGroupIndex}\n isZooming={isZooming}\n cardRenderer={cardRenderer}\n resolveId={resolveId}\n onCardClick={onCardClick}\n onPanStart={onPanStart}\n onPanMove={onPanMove}\n onPanEnd={onPanEnd}\n containerRef={containerRef}\n viewMode={viewMode}\n />\n )}\n </div>\n <DetailPanel\n selectedItem={selectedItem}\n onClose={onCloseDetail}\n />\n </div>\n\n {viewMode === 'grouped' && grouping.groups.length > 0 && (\n <AxisLabels\n groups={grouping.groups.map((g) => ({\n key: g.key,\n value: g.value,\n label: String(g.value),\n items: [],\n count: g.ids.length,\n }))}\n bucketWidths={layout.bucketWidths || []}\n zoomLevel={zoomLevel}\n dimensionFilter={dimensionFilter}\n hoveredGroup={hoveredGroupIndex !== null ? String(grouping.groups[hoveredGroupIndex]?.value) : null}\n onHover={(label) => {\n const index = grouping.groups.findIndex(g => String(g.value) === label);\n onGroupHover(index >= 0 ? index : null);\n }}\n onClick={onAxisLabelClick}\n containerRef={axisLabelsRef}\n />\n )}\n </div>\n );\n}\n"],"names":["_jsx","Spinner","_jsxs","PivotCanvas","DetailPanel","AxisLabels"],"mappings":";;;;;;;;AA4CM,SAAU,eAAe,CAAuB,EACpD,IAAI,EACJ,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,eAAe,EACf,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,GACmB,EAAA;AAC5B,IAAA,MAAM,mBAAmB,GAAG,CAAC,CAAmB,KAAI;AAClD,QAAA,IAAI,SAAS,IAAI,CAAC,YAAY,CAAC,OAAO;YAAE;AAExC,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,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