@pisell/materials 6.11.17 → 6.11.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +9 -9
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +32 -32
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +25 -25
- package/es/components/PisellLayouts/index.d.ts +10 -5
- package/es/components/PisellLayouts/index.js +8 -4
- package/es/components/dataSourceComponents/dataSourceSubForm/index.d.ts +13 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/index.js +274 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/index.less +19 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/schema-full-example.json +544 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/schema-simple-example.json +174 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/types.d.ts +117 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/types.js +1 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.d.ts +9 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.js +61 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/WithMode.js +176 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +12 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.js +11 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/type.d.ts +87 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Tabs/ReadPretty.d.ts +9 -0
- package/es/components/dataSourceComponents/fields/Tabs/ReadPretty.js +16 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.d.ts +23 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.js +93 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.less +64 -0
- package/es/components/dataSourceComponents/fields/Tabs/WithMode.d.ts +6 -0
- package/es/components/dataSourceComponents/fields/Tabs/WithMode.js +9 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +12 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.js +18 -0
- package/es/components/dataSourceComponents/fields/Tabs/type.d.ts +38 -0
- package/es/components/dataSourceComponents/fields/Tabs/type.js +1 -0
- package/es/components/dataSourceComponents/fields/index.d.ts +39 -1
- package/es/components/dataSourceComponents/fields/index.js +5 -1
- package/es/components/dataSourceComponents/fields/utils.js +3 -0
- package/es/components/pisellFilter/type.d.ts +4 -2
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.d.ts +12 -0
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +611 -0
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.less +92 -0
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.stories.d.ts +55 -0
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.stories.js +1667 -0
- package/es/components/pisellFloorMapLayout/components/CanvasTabs.d.ts +27 -0
- package/es/components/pisellFloorMapLayout/components/CanvasTabs.js +203 -0
- package/es/components/pisellFloorMapLayout/components/CanvasTabs.less +189 -0
- package/es/components/pisellFloorMapLayout/components/EditableItemLayer.d.ts +37 -0
- package/es/components/pisellFloorMapLayout/components/EditableItemLayer.js +341 -0
- package/es/components/pisellFloorMapLayout/components/EditableItemLayer.less +89 -0
- package/es/components/pisellFloorMapLayout/components/FigmaTableCard.d.ts +43 -0
- package/es/components/pisellFloorMapLayout/components/FigmaTableCard.js +432 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapDataForm.d.ts +21 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapDataForm.js +131 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapDataForm.less +7 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.d.ts +14 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.js +543 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.less +162 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditTopBar.d.ts +36 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditTopBar.js +135 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditTopBar.less +149 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapImageElement.d.ts +9 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapImageElement.js +69 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.d.ts +35 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.js +366 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.less +239 -0
- package/es/components/pisellFloorMapLayout/components/ItemLayer.d.ts +48 -0
- package/es/components/pisellFloorMapLayout/components/ItemLayer.js +195 -0
- package/es/components/pisellFloorMapLayout/components/ItemLayer.less +19 -0
- package/es/components/pisellFloorMapLayout/components/MapLayer.d.ts +27 -0
- package/es/components/pisellFloorMapLayout/components/MapLayer.js +85 -0
- package/es/components/pisellFloorMapLayout/components/MapLayer.less +7 -0
- package/es/components/pisellFloorMapLayout/components/ViewControls.d.ts +33 -0
- package/es/components/pisellFloorMapLayout/components/ViewControls.js +88 -0
- package/es/components/pisellFloorMapLayout/components/ViewControls.less +101 -0
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +16 -0
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +29 -0
- package/es/components/pisellFloorMapLayout/components/index.d.ts +21 -0
- package/es/components/pisellFloorMapLayout/components/index.js +13 -0
- package/es/components/pisellFloorMapLayout/context/FloorMapLayoutContext.d.ts +16 -0
- package/es/components/pisellFloorMapLayout/context/FloorMapLayoutContext.js +21 -0
- package/es/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.d.ts +5 -0
- package/es/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.js +28 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +63 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.js +561 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapPaletteTouchDrag.d.ts +21 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapPaletteTouchDrag.js +122 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +67 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +399 -0
- package/es/components/pisellFloorMapLayout/index.d.ts +15 -0
- package/es/components/pisellFloorMapLayout/index.js +12 -0
- package/es/components/pisellFloorMapLayout/locales.d.ts +192 -0
- package/es/components/pisellFloorMapLayout/locales.js +191 -0
- package/es/components/pisellFloorMapLayout/types.d.ts +586 -0
- package/es/components/pisellFloorMapLayout/types.js +152 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapCanvasDisplay.d.ts +20 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapCanvasDisplay.js +129 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapConfigMerge.d.ts +8 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapConfigMerge.js +87 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapDataRecordLabel.d.ts +9 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapDataRecordLabel.js +24 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapDropUtils.d.ts +27 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapDropUtils.js +56 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +22 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.js +155 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapFallbackRender.d.ts +11 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapFallbackRender.js +89 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapStageDefaults.d.ts +8 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapStageDefaults.js +8 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapViewConfigDiff.d.ts +8 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapViewConfigDiff.js +108 -0
- package/es/components/pisellFloorMapLayout/utils/layoutMeasurements.d.ts +30 -0
- package/es/components/pisellFloorMapLayout/utils/layoutMeasurements.js +125 -0
- package/es/components/pisellFloorMapLayout/utils/mergeCanvasesForTabs.d.ts +7 -0
- package/es/components/pisellFloorMapLayout/utils/mergeCanvasesForTabs.js +29 -0
- package/es/components/pisellFloorMapLayout/utils/snap.d.ts +10 -0
- package/es/components/pisellFloorMapLayout/utils/snap.js +21 -0
- package/es/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.d.ts +6 -0
- package/es/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.js +175 -0
- package/es/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.less +129 -0
- package/es/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.stories.d.ts +10 -0
- package/es/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.stories.js +237 -0
- package/es/components/pisellHierarchicalSummaryList/components/Row.d.ts +35 -0
- package/es/components/pisellHierarchicalSummaryList/components/Row.js +313 -0
- package/es/components/pisellHierarchicalSummaryList/components/index.d.ts +1 -0
- package/es/components/pisellHierarchicalSummaryList/components/index.js +1 -0
- package/es/components/pisellHierarchicalSummaryList/hooks/index.d.ts +2 -0
- package/es/components/pisellHierarchicalSummaryList/hooks/index.js +1 -0
- package/es/components/pisellHierarchicalSummaryList/hooks/useExpandedKeys.d.ts +15 -0
- package/es/components/pisellHierarchicalSummaryList/hooks/useExpandedKeys.js +34 -0
- package/es/components/pisellHierarchicalSummaryList/index.d.ts +5 -0
- package/es/components/pisellHierarchicalSummaryList/index.js +5 -0
- package/es/components/pisellHierarchicalSummaryList/types.d.ts +248 -0
- package/es/components/pisellHierarchicalSummaryList/types.js +1 -0
- package/es/components/pisellRecordBoard/PisellRecordBoard.d.ts +2 -1
- package/es/components/pisellRecordBoard/PisellRecordBoard.js +98 -18
- package/es/components/pisellRecordBoard/PisellRecordBoard.stories.d.ts +4 -0
- package/es/components/pisellRecordBoard/PisellRecordBoard.stories.js +1276 -344
- package/es/components/pisellRecordBoard/index.d.ts +8 -2
- package/es/components/pisellRecordBoard/index.js +4 -2
- package/es/components/pisellRecordBoard/shellFrame/ColumnSetting/index.js +1 -3
- package/es/components/pisellRecordBoard/shellFrame/FloorMap.d.ts +14 -0
- package/es/components/pisellRecordBoard/shellFrame/FloorMap.js +15 -0
- package/es/components/pisellRecordBoard/shellFrame/ShellBodyMetaContext.d.ts +16 -0
- package/es/components/pisellRecordBoard/shellFrame/ShellBodyMetaContext.js +11 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/ToolBarFilter.less +61 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +1 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +69 -11
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolbar.less +23 -0
- package/es/components/pisellRecordBoard/shellFrame/index.d.ts +6 -10
- package/es/components/pisellRecordBoard/shellFrame/index.js +111 -20
- package/es/components/pisellRecordBoard/shellFrame/shellFrameFloorMap.less +25 -0
- package/es/components/pisellRecordBoard/types.d.ts +68 -2
- package/es/components/pisellRecordBoard/utils/partitionShellFrameChildren.d.ts +15 -0
- package/es/components/pisellRecordBoard/utils/partitionShellFrameChildren.js +57 -0
- package/es/components/pisellReservationSchedule/PisellReservationSchedule.d.ts +10 -0
- package/es/components/pisellReservationSchedule/PisellReservationSchedule.js +156 -0
- package/es/components/pisellReservationSchedule/PisellReservationSchedule.less +88 -0
- package/es/components/pisellReservationSchedule/PisellReservationSchedule.stories.d.ts +12 -0
- package/es/components/pisellReservationSchedule/PisellReservationSchedule.stories.js +105 -0
- package/es/components/pisellReservationSchedule/index.d.ts +2 -0
- package/es/components/pisellReservationSchedule/index.js +1 -0
- package/es/components/pisellReservationSchedule/locales.d.ts +25 -0
- package/es/components/pisellReservationSchedule/locales.js +24 -0
- package/es/components/pisellReservationSchedule/types.d.ts +42 -0
- package/es/components/pisellReservationSchedule/types.js +1 -0
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.d.ts +10 -0
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.js +94 -0
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.less +66 -0
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.stories.d.ts +16 -0
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.stories.js +197 -0
- package/es/components/pisellReservationScheduleBand/index.d.ts +2 -0
- package/es/components/pisellReservationScheduleBand/index.js +1 -0
- package/es/components/pisellReservationScheduleBand/types.d.ts +49 -0
- package/es/components/pisellReservationScheduleBand/types.js +1 -0
- package/es/components/pisellShellFrame/PisellShellFrame.less +11 -0
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.d.ts +10 -0
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.js +787 -0
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.less +461 -0
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.stories.d.ts +79 -0
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.stories.js +290 -0
- package/es/components/pisellTimeNavigator/components/BackgroundLayer.d.ts +14 -0
- package/es/components/pisellTimeNavigator/components/BackgroundLayer.js +30 -0
- package/es/components/pisellTimeNavigator/components/CursorLayer.d.ts +25 -0
- package/es/components/pisellTimeNavigator/components/CursorLayer.js +77 -0
- package/es/components/pisellTimeNavigator/components/GestureLayer.d.ts +33 -0
- package/es/components/pisellTimeNavigator/components/GestureLayer.js +91 -0
- package/es/components/pisellTimeNavigator/components/NowButton.d.ts +14 -0
- package/es/components/pisellTimeNavigator/components/NowButton.js +38 -0
- package/es/components/pisellTimeNavigator/components/ScaleLayer.d.ts +22 -0
- package/es/components/pisellTimeNavigator/components/ScaleLayer.js +73 -0
- package/es/components/pisellTimeNavigator/components/index.d.ts +5 -0
- package/es/components/pisellTimeNavigator/components/index.js +5 -0
- package/es/components/pisellTimeNavigator/hooks/index.d.ts +5 -0
- package/es/components/pisellTimeNavigator/hooks/index.js +3 -0
- package/es/components/pisellTimeNavigator/hooks/useDragInertia.d.ts +14 -0
- package/es/components/pisellTimeNavigator/hooks/useDragInertia.js +109 -0
- package/es/components/pisellTimeNavigator/hooks/useRealtime.d.ts +5 -0
- package/es/components/pisellTimeNavigator/hooks/useRealtime.js +16 -0
- package/es/components/pisellTimeNavigator/hooks/useTimeAxis.d.ts +27 -0
- package/es/components/pisellTimeNavigator/hooks/useTimeAxis.js +76 -0
- package/es/components/pisellTimeNavigator/index.d.ts +5 -0
- package/es/components/pisellTimeNavigator/index.js +4 -0
- package/es/components/pisellTimeNavigator/locales.d.ts +22 -0
- package/es/components/pisellTimeNavigator/locales.js +21 -0
- package/es/components/pisellTimeNavigator/types.d.ts +160 -0
- package/es/components/pisellTimeNavigator/types.js +1 -0
- package/es/components/pisellTimeNavigator/utils/index.d.ts +30 -0
- package/es/components/pisellTimeNavigator/utils/index.js +116 -0
- package/es/components/pisellWalletPassCard/index.js +1 -1
- package/es/components/table/index.js +1 -1
- package/es/index.d.ts +49 -33
- package/es/index.js +47 -27
- package/es/locales/en-US.d.ts +2 -0
- package/es/locales/en-US.js +2 -0
- package/es/locales/zh-CN.d.ts +2 -0
- package/es/locales/zh-CN.js +2 -0
- package/es/locales/zh-TW.d.ts +2 -0
- package/es/locales/zh-TW.js +2 -0
- package/lib/components/PisellLayouts/index.d.ts +10 -5
- package/lib/components/PisellLayouts/index.js +15 -1
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.d.ts +13 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.js +229 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.less +19 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/schema-full-example.json +544 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/schema-simple-example.json +174 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/types.d.ts +117 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/types.js +17 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.d.ts +9 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.js +64 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/WithMode.js +157 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +12 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.js +40 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/type.d.ts +87 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Tabs/ReadPretty.d.ts +9 -0
- package/lib/components/dataSourceComponents/fields/Tabs/ReadPretty.js +45 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.d.ts +23 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.js +95 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.less +64 -0
- package/lib/components/dataSourceComponents/fields/Tabs/WithMode.d.ts +6 -0
- package/lib/components/dataSourceComponents/fields/Tabs/WithMode.js +39 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +12 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.js +40 -0
- package/lib/components/dataSourceComponents/fields/Tabs/type.d.ts +38 -0
- package/lib/components/dataSourceComponents/fields/Tabs/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/index.d.ts +39 -1
- package/lib/components/dataSourceComponents/fields/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/utils.js +3 -0
- package/lib/components/pisellFilter/type.d.ts +4 -2
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.d.ts +12 -0
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +709 -0
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.less +92 -0
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.stories.d.ts +55 -0
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.stories.js +1353 -0
- package/lib/components/pisellFloorMapLayout/components/CanvasTabs.d.ts +27 -0
- package/lib/components/pisellFloorMapLayout/components/CanvasTabs.js +237 -0
- package/lib/components/pisellFloorMapLayout/components/CanvasTabs.less +189 -0
- package/lib/components/pisellFloorMapLayout/components/EditableItemLayer.d.ts +37 -0
- package/lib/components/pisellFloorMapLayout/components/EditableItemLayer.js +358 -0
- package/lib/components/pisellFloorMapLayout/components/EditableItemLayer.less +89 -0
- package/lib/components/pisellFloorMapLayout/components/FigmaTableCard.d.ts +43 -0
- package/lib/components/pisellFloorMapLayout/components/FigmaTableCard.js +482 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapDataForm.d.ts +21 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapDataForm.js +117 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapDataForm.less +7 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.d.ts +14 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.js +556 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.less +162 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditTopBar.d.ts +36 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditTopBar.js +195 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditTopBar.less +149 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapImageElement.d.ts +9 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapImageElement.js +94 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.d.ts +35 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.js +337 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.less +239 -0
- package/lib/components/pisellFloorMapLayout/components/ItemLayer.d.ts +48 -0
- package/lib/components/pisellFloorMapLayout/components/ItemLayer.js +219 -0
- package/lib/components/pisellFloorMapLayout/components/ItemLayer.less +19 -0
- package/lib/components/pisellFloorMapLayout/components/MapLayer.d.ts +27 -0
- package/lib/components/pisellFloorMapLayout/components/MapLayer.js +110 -0
- package/lib/components/pisellFloorMapLayout/components/MapLayer.less +7 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControls.d.ts +33 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControls.js +121 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControls.less +101 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +16 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +65 -0
- package/lib/components/pisellFloorMapLayout/components/index.d.ts +21 -0
- package/lib/components/pisellFloorMapLayout/components/index.js +56 -0
- package/lib/components/pisellFloorMapLayout/context/FloorMapLayoutContext.d.ts +16 -0
- package/lib/components/pisellFloorMapLayout/context/FloorMapLayoutContext.js +54 -0
- package/lib/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.d.ts +5 -0
- package/lib/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.js +47 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +63 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.js +545 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapPaletteTouchDrag.d.ts +21 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapPaletteTouchDrag.js +146 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +67 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +382 -0
- package/lib/components/pisellFloorMapLayout/index.d.ts +15 -0
- package/lib/components/pisellFloorMapLayout/index.js +64 -0
- package/lib/components/pisellFloorMapLayout/locales.d.ts +192 -0
- package/lib/components/pisellFloorMapLayout/locales.js +212 -0
- package/lib/components/pisellFloorMapLayout/types.d.ts +586 -0
- package/lib/components/pisellFloorMapLayout/types.js +32 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapCanvasDisplay.d.ts +20 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapCanvasDisplay.js +126 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapConfigMerge.d.ts +8 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapConfigMerge.js +66 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapDataRecordLabel.d.ts +9 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapDataRecordLabel.js +44 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapDropUtils.d.ts +27 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapDropUtils.js +67 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +22 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.js +139 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapFallbackRender.d.ts +11 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapFallbackRender.js +136 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapStageDefaults.d.ts +8 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapStageDefaults.js +33 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapViewConfigDiff.d.ts +8 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapViewConfigDiff.js +128 -0
- package/lib/components/pisellFloorMapLayout/utils/layoutMeasurements.d.ts +30 -0
- package/lib/components/pisellFloorMapLayout/utils/layoutMeasurements.js +96 -0
- package/lib/components/pisellFloorMapLayout/utils/mergeCanvasesForTabs.d.ts +7 -0
- package/lib/components/pisellFloorMapLayout/utils/mergeCanvasesForTabs.js +41 -0
- package/lib/components/pisellFloorMapLayout/utils/snap.d.ts +10 -0
- package/lib/components/pisellFloorMapLayout/utils/snap.js +43 -0
- package/lib/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.d.ts +6 -0
- package/lib/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.js +179 -0
- package/lib/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.less +129 -0
- package/lib/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.stories.d.ts +10 -0
- package/lib/components/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.stories.js +185 -0
- package/lib/components/pisellHierarchicalSummaryList/components/Row.d.ts +35 -0
- package/lib/components/pisellHierarchicalSummaryList/components/Row.js +343 -0
- package/lib/components/pisellHierarchicalSummaryList/components/index.d.ts +1 -0
- package/lib/components/pisellHierarchicalSummaryList/components/index.js +29 -0
- package/lib/components/pisellHierarchicalSummaryList/hooks/index.d.ts +2 -0
- package/lib/components/pisellHierarchicalSummaryList/hooks/index.js +29 -0
- package/lib/components/pisellHierarchicalSummaryList/hooks/useExpandedKeys.d.ts +15 -0
- package/lib/components/pisellHierarchicalSummaryList/hooks/useExpandedKeys.js +49 -0
- package/lib/components/pisellHierarchicalSummaryList/index.d.ts +5 -0
- package/lib/components/pisellHierarchicalSummaryList/index.js +31 -0
- package/lib/components/pisellHierarchicalSummaryList/types.d.ts +248 -0
- package/lib/components/pisellHierarchicalSummaryList/types.js +17 -0
- package/lib/components/pisellRecordBoard/PisellRecordBoard.d.ts +2 -1
- package/lib/components/pisellRecordBoard/PisellRecordBoard.js +86 -8
- package/lib/components/pisellRecordBoard/PisellRecordBoard.stories.d.ts +4 -0
- package/lib/components/pisellRecordBoard/PisellRecordBoard.stories.js +915 -25
- package/lib/components/pisellRecordBoard/index.d.ts +8 -2
- package/lib/components/pisellRecordBoard/index.js +6 -2
- package/lib/components/pisellRecordBoard/shellFrame/ColumnSetting/index.js +8 -2
- package/lib/components/pisellRecordBoard/shellFrame/FloorMap.d.ts +14 -0
- package/lib/components/pisellRecordBoard/shellFrame/FloorMap.js +27 -0
- package/lib/components/pisellRecordBoard/shellFrame/ShellBodyMetaContext.d.ts +16 -0
- package/lib/components/pisellRecordBoard/shellFrame/ShellBodyMetaContext.js +45 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/ToolBarFilter.less +61 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +1 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +60 -8
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolbar.less +23 -0
- package/lib/components/pisellRecordBoard/shellFrame/index.d.ts +6 -10
- package/lib/components/pisellRecordBoard/shellFrame/index.js +101 -9
- package/lib/components/pisellRecordBoard/shellFrame/shellFrameFloorMap.less +25 -0
- package/lib/components/pisellRecordBoard/types.d.ts +68 -2
- package/lib/components/pisellRecordBoard/utils/partitionShellFrameChildren.d.ts +15 -0
- package/lib/components/pisellRecordBoard/utils/partitionShellFrameChildren.js +88 -0
- package/lib/components/pisellReservationSchedule/PisellReservationSchedule.d.ts +10 -0
- package/lib/components/pisellReservationSchedule/PisellReservationSchedule.js +200 -0
- package/lib/components/pisellReservationSchedule/PisellReservationSchedule.less +88 -0
- package/lib/components/pisellReservationSchedule/PisellReservationSchedule.stories.d.ts +12 -0
- package/lib/components/pisellReservationSchedule/PisellReservationSchedule.stories.js +116 -0
- package/lib/components/pisellReservationSchedule/index.d.ts +2 -0
- package/lib/components/pisellReservationSchedule/index.js +29 -0
- package/lib/components/pisellReservationSchedule/locales.d.ts +25 -0
- package/lib/components/pisellReservationSchedule/locales.js +47 -0
- package/lib/components/pisellReservationSchedule/types.d.ts +42 -0
- package/lib/components/pisellReservationSchedule/types.js +17 -0
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.d.ts +10 -0
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.js +128 -0
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.less +66 -0
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.stories.d.ts +16 -0
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.stories.js +181 -0
- package/lib/components/pisellReservationScheduleBand/index.d.ts +2 -0
- package/lib/components/pisellReservationScheduleBand/index.js +29 -0
- package/lib/components/pisellReservationScheduleBand/types.d.ts +49 -0
- package/lib/components/pisellReservationScheduleBand/types.js +17 -0
- package/lib/components/pisellShellFrame/PisellShellFrame.less +11 -0
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.d.ts +10 -0
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.js +901 -0
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.less +461 -0
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.stories.d.ts +79 -0
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.stories.js +273 -0
- package/lib/components/pisellTimeNavigator/components/BackgroundLayer.d.ts +14 -0
- package/lib/components/pisellTimeNavigator/components/BackgroundLayer.js +78 -0
- package/lib/components/pisellTimeNavigator/components/CursorLayer.d.ts +25 -0
- package/lib/components/pisellTimeNavigator/components/CursorLayer.js +111 -0
- package/lib/components/pisellTimeNavigator/components/GestureLayer.d.ts +33 -0
- package/lib/components/pisellTimeNavigator/components/GestureLayer.js +170 -0
- package/lib/components/pisellTimeNavigator/components/NowButton.d.ts +14 -0
- package/lib/components/pisellTimeNavigator/components/NowButton.js +81 -0
- package/lib/components/pisellTimeNavigator/components/ScaleLayer.d.ts +22 -0
- package/lib/components/pisellTimeNavigator/components/ScaleLayer.js +116 -0
- package/lib/components/pisellTimeNavigator/components/index.d.ts +5 -0
- package/lib/components/pisellTimeNavigator/components/index.js +41 -0
- package/lib/components/pisellTimeNavigator/hooks/index.d.ts +5 -0
- package/lib/components/pisellTimeNavigator/hooks/index.js +35 -0
- package/lib/components/pisellTimeNavigator/hooks/useDragInertia.d.ts +14 -0
- package/lib/components/pisellTimeNavigator/hooks/useDragInertia.js +136 -0
- package/lib/components/pisellTimeNavigator/hooks/useRealtime.d.ts +5 -0
- package/lib/components/pisellTimeNavigator/hooks/useRealtime.js +49 -0
- package/lib/components/pisellTimeNavigator/hooks/useTimeAxis.d.ts +27 -0
- package/lib/components/pisellTimeNavigator/hooks/useTimeAxis.js +87 -0
- package/lib/components/pisellTimeNavigator/index.d.ts +5 -0
- package/lib/components/pisellTimeNavigator/index.js +47 -0
- package/lib/components/pisellTimeNavigator/locales.d.ts +22 -0
- package/lib/components/pisellTimeNavigator/locales.js +41 -0
- package/lib/components/pisellTimeNavigator/types.d.ts +160 -0
- package/lib/components/pisellTimeNavigator/types.js +17 -0
- package/lib/components/pisellTimeNavigator/utils/index.d.ts +30 -0
- package/lib/components/pisellTimeNavigator/utils/index.js +107 -0
- package/lib/components/pisellWalletPassCard/index.js +1 -1
- package/lib/components/table/index.js +2 -2
- package/lib/index.d.ts +49 -33
- package/lib/index.js +93 -27
- package/lib/locales/en-US.d.ts +2 -0
- package/lib/locales/en-US.js +2 -0
- package/lib/locales/zh-CN.d.ts +2 -0
- package/lib/locales/zh-CN.js +2 -0
- package/lib/locales/zh-TW.d.ts +2 -0
- package/lib/locales/zh-TW.js +2 -0
- package/lowcode/data-source-form/constants.ts +3 -0
- package/lowcode/data-source-form/utils.ts +31 -5
- package/lowcode/data-source-sub-form/meta.ts +259 -0
- package/lowcode/data-source-sub-form/snippets.ts +21 -0
- package/lowcode/floor-map-image-element/meta.ts +113 -0
- package/lowcode/floor-map-layout-provider/meta.ts +65 -0
- package/lowcode/form-item-record-list-wrapper/meta.ts +180 -0
- package/lowcode/form-item-record-list-wrapper/snippets.ts +18 -0
- package/lowcode/form-item-tabs/meta.ts +172 -0
- package/lowcode/pisell-floor-map-layout/meta.ts +5599 -0
- package/lowcode/pisell-hierarchical-summary-list/meta.ts +240 -0
- package/lowcode/pisell-reservation-schedule/index.ts +3 -0
- package/lowcode/pisell-reservation-schedule/meta.ts +69 -0
- package/lowcode/pisell-reservation-schedule/snippets.ts +1 -0
- package/lowcode/pisell-reservation-schedule-band/index.ts +3 -0
- package/lowcode/pisell-reservation-schedule-band/meta.ts +96 -0
- package/lowcode/pisell-reservation-schedule-band/snippets.ts +1 -0
- package/lowcode/pisell-time-navigator/index.ts +3 -0
- package/lowcode/pisell-time-navigator/meta.ts +298 -0
- package/lowcode/pisell-time-navigator/snippets.ts +1 -0
- package/lowcode/render-figma-style-round-table-card/meta.ts +589 -0
- package/lowcode/render-figma-style-table-card/meta.ts +589 -0
- package/package.json +3 -2
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellTimeNavigator/components/GestureLayer.tsx
|
|
30
|
+
var GestureLayer_exports = {};
|
|
31
|
+
__export(GestureLayer_exports, {
|
|
32
|
+
GestureLayer: () => GestureLayer
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(GestureLayer_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
function GestureLayer({
|
|
37
|
+
orientation,
|
|
38
|
+
cellSizePx,
|
|
39
|
+
axisStartMarginPx,
|
|
40
|
+
offsetToTime,
|
|
41
|
+
onSelectTime,
|
|
42
|
+
isInDisabledRanges,
|
|
43
|
+
snapToStep,
|
|
44
|
+
stepMinutes,
|
|
45
|
+
snapFn,
|
|
46
|
+
scrollPosition,
|
|
47
|
+
viewportSize,
|
|
48
|
+
onPointerDown,
|
|
49
|
+
onPointerMove,
|
|
50
|
+
onPointerUp,
|
|
51
|
+
onPointerLeave,
|
|
52
|
+
onUserInteraction,
|
|
53
|
+
children
|
|
54
|
+
}) {
|
|
55
|
+
const isHorizontal = orientation === "horizontal";
|
|
56
|
+
const handleClick = (0, import_react.useCallback)(
|
|
57
|
+
(e) => {
|
|
58
|
+
onUserInteraction == null ? void 0 : onUserInteraction();
|
|
59
|
+
const viewport = e.currentTarget.parentElement;
|
|
60
|
+
if (!viewport) return;
|
|
61
|
+
const vRect = viewport.getBoundingClientRect();
|
|
62
|
+
const scroll = isHorizontal ? viewport.scrollLeft : viewport.scrollTop;
|
|
63
|
+
const scrollContentPos = isHorizontal ? scroll + (e.clientX - vRect.left) : scroll + (e.clientY - vRect.top);
|
|
64
|
+
const offset = Math.max(0, scrollContentPos - axisStartMarginPx);
|
|
65
|
+
const t = offsetToTime(offset);
|
|
66
|
+
if (t == null) return;
|
|
67
|
+
const candidate = snapToStep ? snapFn(t) : t;
|
|
68
|
+
if (isInDisabledRanges(candidate)) return;
|
|
69
|
+
onSelectTime(candidate);
|
|
70
|
+
},
|
|
71
|
+
[
|
|
72
|
+
isHorizontal,
|
|
73
|
+
axisStartMarginPx,
|
|
74
|
+
offsetToTime,
|
|
75
|
+
onSelectTime,
|
|
76
|
+
isInDisabledRanges,
|
|
77
|
+
snapToStep,
|
|
78
|
+
snapFn,
|
|
79
|
+
onUserInteraction
|
|
80
|
+
]
|
|
81
|
+
);
|
|
82
|
+
const handleKeyDown = (0, import_react.useCallback)(
|
|
83
|
+
(e) => {
|
|
84
|
+
const scrollContentCenter = orientation === "horizontal" ? scrollPosition.scrollLeft + viewportSize.w / 2 : scrollPosition.scrollTop + viewportSize.h / 2;
|
|
85
|
+
const centerOffset = Math.max(0, scrollContentCenter - axisStartMarginPx);
|
|
86
|
+
const currentTime = offsetToTime(centerOffset);
|
|
87
|
+
if (currentTime == null) return;
|
|
88
|
+
if (e.key === "Enter") {
|
|
89
|
+
const candidate = snapToStep ? snapFn(currentTime) : currentTime;
|
|
90
|
+
if (!isInDisabledRanges(candidate)) {
|
|
91
|
+
onUserInteraction == null ? void 0 : onUserInteraction();
|
|
92
|
+
onSelectTime(candidate);
|
|
93
|
+
}
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const step = stepMinutes * 60 * 1e3;
|
|
98
|
+
let next;
|
|
99
|
+
if (orientation === "horizontal") {
|
|
100
|
+
if (e.key === "ArrowLeft") next = currentTime.subtract(step, "ms");
|
|
101
|
+
else if (e.key === "ArrowRight") next = currentTime.add(step, "ms");
|
|
102
|
+
else return;
|
|
103
|
+
} else {
|
|
104
|
+
if (e.key === "ArrowUp") next = currentTime.subtract(step, "ms");
|
|
105
|
+
else if (e.key === "ArrowDown") next = currentTime.add(step, "ms");
|
|
106
|
+
else return;
|
|
107
|
+
}
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
const snapped = snapToStep ? snapFn(next) : next;
|
|
110
|
+
if (!isInDisabledRanges(snapped)) {
|
|
111
|
+
onUserInteraction == null ? void 0 : onUserInteraction();
|
|
112
|
+
onSelectTime(snapped);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
[
|
|
116
|
+
orientation,
|
|
117
|
+
axisStartMarginPx,
|
|
118
|
+
offsetToTime,
|
|
119
|
+
onSelectTime,
|
|
120
|
+
isInDisabledRanges,
|
|
121
|
+
snapToStep,
|
|
122
|
+
snapFn,
|
|
123
|
+
stepMinutes,
|
|
124
|
+
scrollPosition.scrollLeft,
|
|
125
|
+
scrollPosition.scrollTop,
|
|
126
|
+
viewportSize.w,
|
|
127
|
+
viewportSize.h,
|
|
128
|
+
onUserInteraction
|
|
129
|
+
]
|
|
130
|
+
);
|
|
131
|
+
const handlePointerDown = (0, import_react.useCallback)(
|
|
132
|
+
(e) => {
|
|
133
|
+
onUserInteraction == null ? void 0 : onUserInteraction();
|
|
134
|
+
if (onPointerDown) {
|
|
135
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
136
|
+
onPointerDown(e);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
[onPointerDown, onUserInteraction]
|
|
140
|
+
);
|
|
141
|
+
const handlePointerUp = (0, import_react.useCallback)(
|
|
142
|
+
(e) => {
|
|
143
|
+
if (onPointerUp) {
|
|
144
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
145
|
+
onPointerUp(e);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
[onPointerUp]
|
|
149
|
+
);
|
|
150
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
className: `pisell-time-navigator-gesture pisell-time-navigator-gesture--${orientation}`,
|
|
154
|
+
onClick: handleClick,
|
|
155
|
+
onKeyDown: handleKeyDown,
|
|
156
|
+
onPointerDown: handlePointerDown,
|
|
157
|
+
onPointerMove,
|
|
158
|
+
onPointerUp: handlePointerUp,
|
|
159
|
+
onPointerLeave,
|
|
160
|
+
role: "slider",
|
|
161
|
+
tabIndex: 0,
|
|
162
|
+
"aria-label": "Time"
|
|
163
|
+
},
|
|
164
|
+
children
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
168
|
+
0 && (module.exports = {
|
|
169
|
+
GestureLayer
|
|
170
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
export interface NowButtonProps {
|
|
4
|
+
orientation: 'horizontal' | 'vertical';
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
className?: string;
|
|
8
|
+
renderCustom?: () => React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Now 按钮:固定入口,点击跳回当前时间并进入 Realtime
|
|
12
|
+
* 横向:右侧,左箭头;竖向:底部,上箭头
|
|
13
|
+
*/
|
|
14
|
+
export declare function NowButton({ orientation, onClick, style, className, renderCustom, }: NowButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellTimeNavigator/components/NowButton.tsx
|
|
30
|
+
var NowButton_exports = {};
|
|
31
|
+
__export(NowButton_exports, {
|
|
32
|
+
NowButton: () => NowButton
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(NowButton_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_utils = require("@pisell/utils");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var I18N_NOW = "pisell-time-navigator.now";
|
|
39
|
+
function NowButton({
|
|
40
|
+
orientation,
|
|
41
|
+
onClick,
|
|
42
|
+
style,
|
|
43
|
+
className,
|
|
44
|
+
renderCustom
|
|
45
|
+
}) {
|
|
46
|
+
const raw = import_utils.locales.getText(I18N_NOW);
|
|
47
|
+
const label = raw && raw !== I18N_NOW ? raw : "Now";
|
|
48
|
+
if (renderCustom) {
|
|
49
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
50
|
+
"button",
|
|
51
|
+
{
|
|
52
|
+
type: "button",
|
|
53
|
+
className: (0, import_classnames.default)("pisell-time-navigator-now", className),
|
|
54
|
+
onClick,
|
|
55
|
+
style,
|
|
56
|
+
"aria-label": label
|
|
57
|
+
},
|
|
58
|
+
renderCustom()
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
type: "button",
|
|
65
|
+
className: (0, import_classnames.default)(
|
|
66
|
+
"pisell-time-navigator-now",
|
|
67
|
+
`pisell-time-navigator-now--${orientation}`,
|
|
68
|
+
className
|
|
69
|
+
),
|
|
70
|
+
onClick,
|
|
71
|
+
style,
|
|
72
|
+
"aria-label": label
|
|
73
|
+
},
|
|
74
|
+
/* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-time-navigator-now-icon", "aria-hidden": true }),
|
|
75
|
+
/* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-time-navigator-now-label" }, label)
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
NowButton
|
|
81
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Dayjs } from 'dayjs';
|
|
3
|
+
export interface ScaleLayerProps {
|
|
4
|
+
orientation: 'horizontal' | 'vertical';
|
|
5
|
+
ticks: Dayjs[];
|
|
6
|
+
stepMinutes: number;
|
|
7
|
+
majorStepMinutes: number;
|
|
8
|
+
timeFormat: string;
|
|
9
|
+
locale?: string;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* 横向每格宽度(px),须与 useTimeAxis 的 cellSizePx 一致;
|
|
14
|
+
* 不传时样式表默认 82(axis-moves);cursor-moves 压缩比例时必传
|
|
15
|
+
*/
|
|
16
|
+
horizontalCellSizePx?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 刻度层:渲染时间刻度与标签
|
|
20
|
+
* 横向:整点数字 + 小圆点;竖向:整点/半点数字 + 分割线
|
|
21
|
+
*/
|
|
22
|
+
export declare function ScaleLayer({ orientation, ticks, stepMinutes, majorStepMinutes, timeFormat, locale, style, className, horizontalCellSizePx, }: ScaleLayerProps): React.JSX.Element;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellTimeNavigator/components/ScaleLayer.tsx
|
|
30
|
+
var ScaleLayer_exports = {};
|
|
31
|
+
__export(ScaleLayer_exports, {
|
|
32
|
+
ScaleLayer: () => ScaleLayer
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ScaleLayer_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
37
|
+
function ScaleLayer({
|
|
38
|
+
orientation,
|
|
39
|
+
ticks,
|
|
40
|
+
stepMinutes,
|
|
41
|
+
majorStepMinutes,
|
|
42
|
+
timeFormat,
|
|
43
|
+
locale,
|
|
44
|
+
style,
|
|
45
|
+
className,
|
|
46
|
+
horizontalCellSizePx
|
|
47
|
+
}) {
|
|
48
|
+
const isHorizontal = orientation === "horizontal";
|
|
49
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: (0, import_classnames.default)(
|
|
53
|
+
"pisell-time-navigator-scale",
|
|
54
|
+
`pisell-time-navigator-scale--${orientation}`,
|
|
55
|
+
className
|
|
56
|
+
),
|
|
57
|
+
style
|
|
58
|
+
},
|
|
59
|
+
ticks.map((tick, i) => {
|
|
60
|
+
const isMajor = tick.minute() % majorStepMinutes === 0;
|
|
61
|
+
const label = isHorizontal && isMajor ? locale ? tick.locale(locale).format("H") : tick.format("H") : locale ? tick.locale(locale).format(timeFormat) : tick.format(timeFormat);
|
|
62
|
+
if (isHorizontal) {
|
|
63
|
+
const cw = horizontalCellSizePx != null && horizontalCellSizePx > 0 ? horizontalCellSizePx : void 0;
|
|
64
|
+
const compactPad = cw != null ? cw < 36 ? 2 : cw < 52 ? 6 : 10 : void 0;
|
|
65
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
key: i,
|
|
69
|
+
className: (0, import_classnames.default)(
|
|
70
|
+
"pisell-time-navigator-scale-cell",
|
|
71
|
+
"pisell-time-navigator-scale-cell--h",
|
|
72
|
+
{ "pisell-time-navigator-scale-cell--major": isMajor }
|
|
73
|
+
),
|
|
74
|
+
style: cw != null ? {
|
|
75
|
+
width: cw,
|
|
76
|
+
minWidth: cw,
|
|
77
|
+
maxWidth: cw,
|
|
78
|
+
flex: "0 0 auto",
|
|
79
|
+
boxSizing: "border-box",
|
|
80
|
+
...compactPad != null ? { padding: compactPad } : {}
|
|
81
|
+
} : void 0
|
|
82
|
+
},
|
|
83
|
+
isMajor && /* @__PURE__ */ import_react.default.createElement(
|
|
84
|
+
"span",
|
|
85
|
+
{
|
|
86
|
+
className: "pisell-time-navigator-scale-label",
|
|
87
|
+
style: cw != null && cw < 48 ? {
|
|
88
|
+
fontSize: Math.max(10, Math.round(cw * 0.32)),
|
|
89
|
+
lineHeight: 1.15
|
|
90
|
+
} : void 0
|
|
91
|
+
},
|
|
92
|
+
label
|
|
93
|
+
),
|
|
94
|
+
!isMajor && /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-time-navigator-scale-dot", "aria-hidden": true })
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
key: i,
|
|
101
|
+
className: (0, import_classnames.default)(
|
|
102
|
+
"pisell-time-navigator-scale-cell",
|
|
103
|
+
"pisell-time-navigator-scale-cell--v",
|
|
104
|
+
{ "pisell-time-navigator-scale-cell--major": isMajor }
|
|
105
|
+
)
|
|
106
|
+
},
|
|
107
|
+
/* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-time-navigator-scale-divider", "aria-hidden": true }),
|
|
108
|
+
isMajor && /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-time-navigator-scale-label" }, label)
|
|
109
|
+
);
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
ScaleLayer
|
|
116
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/pisellTimeNavigator/components/index.tsx
|
|
20
|
+
var components_exports = {};
|
|
21
|
+
__export(components_exports, {
|
|
22
|
+
BackgroundLayer: () => import_BackgroundLayer.BackgroundLayer,
|
|
23
|
+
CursorLayer: () => import_CursorLayer.CursorLayer,
|
|
24
|
+
GestureLayer: () => import_GestureLayer.GestureLayer,
|
|
25
|
+
NowButton: () => import_NowButton.NowButton,
|
|
26
|
+
ScaleLayer: () => import_ScaleLayer.ScaleLayer
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(components_exports);
|
|
29
|
+
var import_BackgroundLayer = require("./BackgroundLayer");
|
|
30
|
+
var import_CursorLayer = require("./CursorLayer");
|
|
31
|
+
var import_GestureLayer = require("./GestureLayer");
|
|
32
|
+
var import_NowButton = require("./NowButton");
|
|
33
|
+
var import_ScaleLayer = require("./ScaleLayer");
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
BackgroundLayer,
|
|
37
|
+
CursorLayer,
|
|
38
|
+
GestureLayer,
|
|
39
|
+
NowButton,
|
|
40
|
+
ScaleLayer
|
|
41
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useTimeAxis } from './useTimeAxis';
|
|
2
|
+
export type { UseTimeAxisOptions, TimeAxisState } from './useTimeAxis';
|
|
3
|
+
export { useRealtime } from './useRealtime';
|
|
4
|
+
export { useDragInertia } from './useDragInertia';
|
|
5
|
+
export type { UseDragInertiaOptions } from './useDragInertia';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/pisellTimeNavigator/hooks/index.ts
|
|
20
|
+
var hooks_exports = {};
|
|
21
|
+
__export(hooks_exports, {
|
|
22
|
+
useDragInertia: () => import_useDragInertia.useDragInertia,
|
|
23
|
+
useRealtime: () => import_useRealtime.useRealtime,
|
|
24
|
+
useTimeAxis: () => import_useTimeAxis.useTimeAxis
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
27
|
+
var import_useTimeAxis = require("./useTimeAxis");
|
|
28
|
+
var import_useRealtime = require("./useRealtime");
|
|
29
|
+
var import_useDragInertia = require("./useDragInertia");
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
useDragInertia,
|
|
33
|
+
useRealtime,
|
|
34
|
+
useTimeAxis
|
|
35
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface UseDragInertiaOptions {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
orientation: 'horizontal' | 'vertical';
|
|
4
|
+
getScrollContainer: () => HTMLElement | null;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 惯性滚动:根据拖动末段速度在松手后继续滚动并衰减
|
|
8
|
+
*/
|
|
9
|
+
export declare function useDragInertia(options: UseDragInertiaOptions): {
|
|
10
|
+
onPointerDown: (e: React.PointerEvent) => void;
|
|
11
|
+
onPointerMove: (e: React.PointerEvent) => void;
|
|
12
|
+
onPointerUp: (e: React.PointerEvent) => void;
|
|
13
|
+
stopInertia: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/pisellTimeNavigator/hooks/useDragInertia.ts
|
|
20
|
+
var useDragInertia_exports = {};
|
|
21
|
+
__export(useDragInertia_exports, {
|
|
22
|
+
useDragInertia: () => useDragInertia
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useDragInertia_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var DECAY = 0.95;
|
|
27
|
+
var MIN_VELOCITY = 0.5;
|
|
28
|
+
var SAMPLE_MS = 50;
|
|
29
|
+
function useDragInertia(options) {
|
|
30
|
+
const { enabled, orientation, getScrollContainer } = options;
|
|
31
|
+
const rafId = (0, import_react.useRef)(null);
|
|
32
|
+
const lastPos = (0, import_react.useRef)(0);
|
|
33
|
+
const lastTime = (0, import_react.useRef)(0);
|
|
34
|
+
const velocity = (0, import_react.useRef)(0);
|
|
35
|
+
const samples = (0, import_react.useRef)([]);
|
|
36
|
+
const applyScroll = (0, import_react.useCallback)(
|
|
37
|
+
(delta) => {
|
|
38
|
+
const el = getScrollContainer();
|
|
39
|
+
if (!el) return;
|
|
40
|
+
if (orientation === "horizontal") {
|
|
41
|
+
el.scrollLeft = Math.max(0, el.scrollLeft + delta);
|
|
42
|
+
} else {
|
|
43
|
+
el.scrollTop = Math.max(0, el.scrollTop + delta);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[getScrollContainer, orientation]
|
|
47
|
+
);
|
|
48
|
+
const lastTickTime = (0, import_react.useRef)(0);
|
|
49
|
+
const tick = (0, import_react.useCallback)(
|
|
50
|
+
(now) => {
|
|
51
|
+
const t = now ?? performance.now();
|
|
52
|
+
const dt = lastTickTime.current ? (t - lastTickTime.current) / 1e3 : 0.016;
|
|
53
|
+
lastTickTime.current = t;
|
|
54
|
+
const v = velocity.current;
|
|
55
|
+
if (Math.abs(v) < MIN_VELOCITY) {
|
|
56
|
+
velocity.current = 0;
|
|
57
|
+
lastTickTime.current = 0;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
applyScroll(v * dt);
|
|
61
|
+
velocity.current = v * DECAY;
|
|
62
|
+
rafId.current = requestAnimationFrame(tick);
|
|
63
|
+
},
|
|
64
|
+
[applyScroll]
|
|
65
|
+
);
|
|
66
|
+
const stopInertia = (0, import_react.useCallback)(() => {
|
|
67
|
+
if (rafId.current != null) {
|
|
68
|
+
cancelAnimationFrame(rafId.current);
|
|
69
|
+
rafId.current = null;
|
|
70
|
+
}
|
|
71
|
+
velocity.current = 0;
|
|
72
|
+
samples.current = [];
|
|
73
|
+
}, []);
|
|
74
|
+
const onPointerDown = (0, import_react.useCallback)(
|
|
75
|
+
(e) => {
|
|
76
|
+
if (!enabled) return;
|
|
77
|
+
stopInertia();
|
|
78
|
+
const pos = orientation === "horizontal" ? e.clientX : e.clientY;
|
|
79
|
+
lastPos.current = pos;
|
|
80
|
+
lastTime.current = Date.now();
|
|
81
|
+
samples.current = [{ pos, t: lastTime.current }];
|
|
82
|
+
},
|
|
83
|
+
[enabled, orientation, stopInertia]
|
|
84
|
+
);
|
|
85
|
+
const onPointerMove = (0, import_react.useCallback)(
|
|
86
|
+
(e) => {
|
|
87
|
+
if (!enabled) return;
|
|
88
|
+
const pos = orientation === "horizontal" ? e.clientX : e.clientY;
|
|
89
|
+
const t = Date.now();
|
|
90
|
+
const el = getScrollContainer();
|
|
91
|
+
if (el) {
|
|
92
|
+
const scroll = orientation === "horizontal" ? el.scrollLeft : el.scrollTop;
|
|
93
|
+
const delta = pos - lastPos.current;
|
|
94
|
+
const maxScroll = orientation === "horizontal" ? el.scrollWidth - el.clientWidth : el.scrollHeight - el.clientHeight;
|
|
95
|
+
const next = Math.max(0, Math.min(maxScroll, scroll + delta));
|
|
96
|
+
if (orientation === "horizontal") {
|
|
97
|
+
el.scrollLeft = next;
|
|
98
|
+
} else {
|
|
99
|
+
el.scrollTop = next;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
lastPos.current = pos;
|
|
103
|
+
lastTime.current = t;
|
|
104
|
+
samples.current.push({ pos, t });
|
|
105
|
+
const cutoff = t - SAMPLE_MS;
|
|
106
|
+
while (samples.current.length > 1 && samples.current[0].t < cutoff) {
|
|
107
|
+
samples.current.shift();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
[enabled, orientation, getScrollContainer]
|
|
111
|
+
);
|
|
112
|
+
const onPointerUp = (0, import_react.useCallback)(
|
|
113
|
+
(e) => {
|
|
114
|
+
if (!enabled) return;
|
|
115
|
+
const arr = samples.current;
|
|
116
|
+
if (arr.length < 2) return;
|
|
117
|
+
const first = arr[0];
|
|
118
|
+
const last = arr[arr.length - 1];
|
|
119
|
+
const dt = (last.t - first.t) / 1e3;
|
|
120
|
+
if (dt <= 0) return;
|
|
121
|
+
const scrollEl = getScrollContainer();
|
|
122
|
+
if (!scrollEl) return;
|
|
123
|
+
const scroll = orientation === "horizontal" ? scrollEl.scrollLeft : scrollEl.scrollTop;
|
|
124
|
+
const totalDelta = last.pos - first.pos;
|
|
125
|
+
velocity.current = totalDelta / dt;
|
|
126
|
+
stopInertia();
|
|
127
|
+
rafId.current = requestAnimationFrame(tick);
|
|
128
|
+
},
|
|
129
|
+
[enabled, orientation, getScrollContainer, stopInertia, tick]
|
|
130
|
+
);
|
|
131
|
+
return { onPointerDown, onPointerMove, onPointerUp, stopInertia };
|
|
132
|
+
}
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
useDragInertia
|
|
136
|
+
});
|