onekijs-ui 0.9.2 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/AccordionService.d.ts +7 -0
- package/dist/components/accordion/components/AccordionComponent.d.ts +16 -0
- package/dist/components/accordion/components/AccordionContainer.d.ts +4 -0
- package/dist/components/accordion/components/AccordionPanel.d.ts +4 -0
- package/dist/components/accordion/components/AccordionPanelTitle.d.ts +4 -0
- package/dist/components/accordion/hooks/useAccordionPanel.d.ts +3 -0
- package/dist/components/accordion/hooks/useAccordionService.d.ts +5 -0
- package/dist/components/accordion/hooks/useAccordionState.d.ts +4 -0
- package/dist/components/accordion/index.d.ts +16 -0
- package/dist/components/accordion/style.d.ts +3 -0
- package/dist/components/accordion/typings.d.ts +45 -0
- package/dist/components/button/DropdownButton.d.ts +3 -0
- package/dist/components/button/SubmitButton.d.ts +4 -0
- package/dist/components/button/components/ButtonComponent.d.ts +4 -0
- package/dist/components/button/components/DropdownButtonComponent.d.ts +4 -0
- package/dist/components/button/index.d.ts +3 -3
- package/dist/components/button/style.d.ts +5 -4
- package/dist/components/button/typings.d.ts +19 -4
- package/dist/components/card/FormCard.d.ts +4 -0
- package/dist/components/card/components/CardComponent.d.ts +4 -0
- package/dist/components/card/components/CardTitle.d.ts +4 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/style.d.ts +3 -0
- package/dist/components/card/typings.d.ts +24 -0
- package/dist/components/checkbox/FormCheckbox.d.ts +4 -0
- package/dist/components/checkbox/components/CheckboxComponent.d.ts +4 -0
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/checkbox/style.d.ts +4 -0
- package/dist/components/checkbox/typings.d.ts +14 -0
- package/dist/components/dashboard/DashboardService.d.ts +27 -0
- package/dist/components/dashboard/components/DashboardBody.d.ts +5 -0
- package/dist/components/dashboard/components/DashboardComponent.d.ts +7 -0
- package/dist/components/dashboard/components/DashboardContainer.d.ts +5 -0
- package/dist/components/dashboard/components/DashboardFooter.d.ts +2 -0
- package/dist/components/dashboard/components/DashboardHeader.d.ts +2 -0
- package/dist/components/dashboard/components/DashboardLeft.d.ts +2 -0
- package/dist/components/dashboard/components/DashboardOverlay.d.ts +6 -0
- package/dist/components/dashboard/components/DashboardRight.d.ts +2 -0
- package/dist/components/dashboard/components/DashboardToggler.d.ts +5 -0
- package/dist/components/dashboard/hoc/dashboardHorizontalPanel.d.ts +4 -0
- package/dist/components/dashboard/hoc/dashboardVerticalPanel.d.ts +4 -0
- package/dist/components/dashboard/hooks/useDashboard.d.ts +5 -0
- package/dist/components/dashboard/hooks/useDashboardService.d.ts +5 -0
- package/dist/components/dashboard/hooks/useDashboardState.d.ts +5 -0
- package/dist/components/dashboard/index.d.ts +4 -0
- package/dist/components/dashboard/typings.d.ts +96 -0
- package/dist/components/dashboard/utils/dashboardArea.d.ts +3 -0
- package/dist/components/dashboard/utils/dashboardLength.d.ts +5 -0
- package/dist/components/dropdown/components/DropdownComponent.d.ts +4 -4
- package/dist/components/dropdown/hooks/useDropdown.d.ts +5 -0
- package/dist/components/dropdown/index.d.ts +2 -3
- package/dist/components/dropdown/style.d.ts +4 -4
- package/dist/components/dropdown/typings.d.ts +24 -5
- package/dist/components/field/FieldDescription.d.ts +3 -0
- package/dist/components/field/FieldHelp.d.ts +3 -0
- package/dist/components/field/FieldLayout.d.ts +2 -0
- package/dist/components/field/components/FieldDescriptionComponent.d.ts +4 -0
- package/dist/components/field/components/FieldHelpComponent.d.ts +4 -0
- package/dist/components/field/components/FieldLayoutComponent.d.ts +4 -0
- package/dist/components/field/hooks/useFieldLayout.d.ts +4 -0
- package/dist/components/field/style.d.ts +5 -0
- package/dist/components/field/typings.d.ts +53 -0
- package/dist/components/field/util.d.ts +9 -0
- package/dist/components/grid/Col.d.ts +4 -0
- package/dist/components/grid/Row.d.ts +4 -0
- package/dist/components/grid/style.d.ts +4 -0
- package/dist/components/grid/typings.d.ts +33 -0
- package/dist/components/icon/CloseAllIcon.d.ts +4 -0
- package/dist/components/icon/CrossIcon.d.ts +3 -0
- package/dist/components/icon/FileIcon.d.ts +4 -0
- package/dist/components/icon/FolderIcon.d.ts +4 -0
- package/dist/components/icon/LoadingIcon.d.ts +4 -3
- package/dist/components/icon/MenuIcon.d.ts +4 -0
- package/dist/components/icon/RemoveIcon.d.ts +4 -0
- package/dist/components/icon/SearchIcon.d.ts +4 -0
- package/dist/components/icon/TogglerIcon.d.ts +4 -0
- package/dist/components/icon/typings.d.ts +14 -0
- package/dist/components/input/FormInput.d.ts +4 -0
- package/dist/components/input/components/InputComponent.d.ts +4 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/style.d.ts +4 -0
- package/dist/components/input/typings.d.ts +14 -0
- package/dist/components/label/components/LabelComponent.d.ts +4 -0
- package/dist/components/label/index.d.ts +3 -0
- package/dist/components/label/style.d.ts +4 -0
- package/dist/components/label/typings.d.ts +16 -0
- package/dist/components/list/components/ArrayListComponent.d.ts +4 -0
- package/dist/components/list/components/CollectionListComponent.d.ts +4 -0
- package/dist/components/list/components/ListBodyComponent.d.ts +4 -0
- package/dist/components/list/components/ListComponent.d.ts +4 -4
- package/dist/components/list/components/ListItemComponent.d.ts +6 -4
- package/dist/components/list/components/LoadingItem.d.ts +5 -0
- package/dist/components/list/components/StandardListComponent.d.ts +4 -4
- package/dist/components/list/components/VirtualListComponent.d.ts +4 -4
- package/dist/components/list/hooks/useListController.d.ts +4 -0
- package/dist/components/list/hooks/useListService.d.ts +5 -0
- package/dist/components/list/hooks/useListState.d.ts +5 -0
- package/dist/components/list/hooks/useListView.d.ts +22 -0
- package/dist/components/list/index.d.ts +3 -3
- package/dist/components/list/style.d.ts +4 -4
- package/dist/components/list/typings.d.ts +121 -35
- package/dist/components/list/utils.d.ts +3 -4
- package/dist/components/modal/components/ModalComponent.d.ts +4 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/style.d.ts +3 -0
- package/dist/components/modal/typings.d.ts +19 -0
- package/dist/components/properties/components/PropertiesComponent.d.ts +4 -0
- package/dist/components/properties/components/Property.d.ts +4 -0
- package/dist/components/properties/hooks/usePropertiesContext.d.ts +5 -0
- package/dist/components/properties/index.d.ts +3 -0
- package/dist/components/properties/style.d.ts +3 -0
- package/dist/components/properties/typings.d.ts +26 -0
- package/dist/components/resizer/ResizerService.d.ts +17 -0
- package/dist/components/resizer/components/ResizerComponent.d.ts +4 -0
- package/dist/components/resizer/components/ResizerHorizontalSplitter.d.ts +4 -0
- package/dist/components/resizer/components/ResizerVerticalSplitter.d.ts +4 -0
- package/dist/components/resizer/index.d.ts +2 -0
- package/dist/components/resizer/style.d.ts +4 -0
- package/dist/components/resizer/typings.d.ts +34 -0
- package/dist/components/select/FormSelect.d.ts +4 -0
- package/dist/components/select/SelectService.d.ts +5 -0
- package/dist/components/select/components/ArraySelectComponent.d.ts +4 -0
- package/dist/components/select/components/ControllerSelectComponent.d.ts +4 -0
- package/dist/components/select/components/SelectComponent.d.ts +4 -4
- package/dist/components/select/components/SelectIconComponent.d.ts +4 -4
- package/dist/components/select/components/SelectInputComponent.d.ts +4 -4
- package/dist/components/select/components/SelectNotFoundComponent.d.ts +4 -0
- package/dist/components/select/components/SelectOptionComponent.d.ts +6 -4
- package/dist/components/select/components/SelectTokenComponent.d.ts +4 -0
- package/dist/components/select/components/SelectTokensComponent.d.ts +4 -0
- package/dist/components/select/hooks/useSelectConfig.d.ts +4 -0
- package/dist/components/select/hooks/useSelectController.d.ts +6 -0
- package/dist/components/select/index.d.ts +3 -3
- package/dist/components/select/style.d.ts +4 -4
- package/dist/components/select/typings.d.ts +95 -37
- package/dist/components/tab/TabsService.d.ts +24 -0
- package/dist/components/tab/components/ControlledTabsComponent.d.ts +4 -0
- package/dist/components/tab/components/Tab.d.ts +4 -0
- package/dist/components/tab/components/TabTitle.d.ts +4 -0
- package/dist/components/tab/components/TabsComponent.d.ts +4 -0
- package/dist/components/tab/components/TabsContainer.d.ts +4 -0
- package/dist/components/tab/components/UncontrolledTabsComponent.d.ts +4 -0
- package/dist/components/tab/hooks/useTab.d.ts +5 -0
- package/dist/components/tab/hooks/useTabsController.d.ts +3 -0
- package/dist/components/tab/hooks/useTabsService.d.ts +5 -0
- package/dist/components/tab/hooks/useTabsState.d.ts +4 -0
- package/dist/components/tab/index.d.ts +2 -0
- package/dist/components/tab/style.d.ts +3 -0
- package/dist/components/tab/typings.d.ts +54 -0
- package/dist/components/table/FormTable.d.ts +4 -0
- package/dist/components/table/TableService.d.ts +18 -0
- package/dist/components/table/columns/useCheckboxColumn.d.ts +3 -0
- package/dist/components/table/columns/useColumn.d.ts +3 -0
- package/dist/components/table/columns/useInputColumn.d.ts +3 -0
- package/dist/components/table/columns/useLinkColumn.d.ts +3 -0
- package/dist/components/table/columns/useSelectColumn.d.ts +3 -0
- package/dist/components/table/components/ArrayTableComponent.d.ts +4 -0
- package/dist/components/table/components/ControllerTableComponent.d.ts +4 -0
- package/dist/components/table/components/FormTableComponent.d.ts +4 -0
- package/dist/components/table/components/TableBodyCellComponent.d.ts +4 -0
- package/dist/components/table/components/TableBodyComponent.d.ts +4 -0
- package/dist/components/table/components/TableBodyRowComponent.d.ts +4 -0
- package/dist/components/table/components/TableComponent.d.ts +4 -0
- package/dist/components/table/components/TableFooterCellComponent.d.ts +4 -0
- package/dist/components/table/components/TableFooterComponent.d.ts +4 -0
- package/dist/components/table/components/TableHeaderComponent.d.ts +4 -0
- package/dist/components/table/components/TableHeaderFilterComponent.d.ts +4 -0
- package/dist/components/table/components/TableHeaderTitleComponent.d.ts +5 -0
- package/dist/components/table/components/TableLoadingComponent.d.ts +3 -0
- package/dist/components/table/components/TableLoadingRowComponent.d.ts +3 -0
- package/dist/components/table/components/TableNotFoundComponent.d.ts +4 -0
- package/dist/components/table/components/TableSortComponent.d.ts +4 -0
- package/dist/components/table/components/cells/CheckboxCellComponent.d.ts +4 -0
- package/dist/components/table/components/cells/DefaultCellComponent.d.ts +4 -0
- package/dist/components/table/components/cells/ExpandedCellComponent.d.ts +4 -0
- package/dist/components/table/components/cells/InputCellComponent.d.ts +4 -0
- package/dist/components/table/components/cells/SelectCellComponent.d.ts +6 -0
- package/dist/components/table/components/filters/TableInputFilterComponent.d.ts +4 -0
- package/dist/components/table/components/hoc/linkCellComponent.d.ts +4 -0
- package/dist/components/table/hooks/useFormTableContext.d.ts +5 -0
- package/dist/components/table/hooks/useTableColumns.d.ts +3 -0
- package/dist/components/table/hooks/useTableConfig.d.ts +4 -0
- package/dist/components/table/hooks/useTableController.d.ts +5 -0
- package/dist/components/table/hooks/useTableInitialState.d.ts +3 -0
- package/dist/components/table/hooks/useTableItems.d.ts +3 -0
- package/dist/components/table/hooks/useTableService.d.ts +5 -0
- package/dist/components/table/hooks/useTableState.d.ts +4 -0
- package/dist/components/table/index.d.ts +3 -0
- package/dist/components/table/style.d.ts +3 -0
- package/dist/components/table/typings.d.ts +218 -0
- package/dist/components/table/util.d.ts +5 -0
- package/dist/components/tag/components/TagComponent.d.ts +4 -0
- package/dist/components/tag/index.d.ts +2 -0
- package/dist/components/tag/style.d.ts +3 -0
- package/dist/components/tag/typings.d.ts +16 -0
- package/dist/components/tooltip/components/TooltipComponent.d.ts +4 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/style.d.ts +4 -0
- package/dist/components/tooltip/typings.d.ts +10 -0
- package/dist/components/tree/TreeService.d.ts +23 -0
- package/dist/components/tree/components/ArrayTreeComponent.d.ts +4 -0
- package/dist/components/tree/components/ControllerTreeComponent.d.ts +4 -0
- package/dist/components/tree/components/TreeBodyComponent.d.ts +4 -0
- package/dist/components/tree/components/TreeComponent.d.ts +4 -0
- package/dist/components/tree/components/TreeItemComponent.d.ts +6 -0
- package/dist/components/tree/components/TreeListComponent.d.ts +4 -0
- package/dist/components/tree/components/VirtualTreeBodyComponent.d.ts +4 -0
- package/dist/components/tree/components/VirtualTreeListComponent.d.ts +4 -0
- package/dist/components/tree/hooks/useTreeConfig.d.ts +4 -0
- package/dist/components/tree/hooks/useTreeController.d.ts +5 -0
- package/dist/components/tree/hooks/useTreeInitialState.d.ts +5 -0
- package/dist/components/tree/hooks/useTreeItems.d.ts +3 -0
- package/dist/components/tree/hooks/useTreeService.d.ts +5 -0
- package/dist/components/tree/hooks/useTreeState.d.ts +4 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree/style.d.ts +3 -0
- package/dist/components/tree/typings.d.ts +87 -0
- package/dist/components/wizard/WizardModal.d.ts +2 -0
- package/dist/components/wizard/WizardService.d.ts +17 -0
- package/dist/components/wizard/components/ControlledWizardComponent.d.ts +4 -0
- package/dist/components/wizard/components/Step.d.ts +4 -0
- package/dist/components/wizard/components/StepTitle.d.ts +4 -0
- package/dist/components/wizard/components/UncontrolledWizardComponent.d.ts +4 -0
- package/dist/components/wizard/components/WizardComponent.d.ts +4 -0
- package/dist/components/wizard/components/WizardContainer.d.ts +4 -0
- package/dist/components/wizard/components/WizardModalComponent.d.ts +4 -0
- package/dist/components/wizard/hooks/useStep.d.ts +5 -0
- package/dist/components/wizard/hooks/useWizardController.d.ts +3 -0
- package/dist/components/wizard/hooks/useWizardService.d.ts +5 -0
- package/dist/components/wizard/hooks/useWizardState.d.ts +4 -0
- package/dist/components/wizard/index.d.ts +2 -0
- package/dist/components/wizard/style.d.ts +4 -0
- package/dist/components/wizard/typings.d.ts +41 -0
- package/dist/index.d.ts +167 -33
- package/dist/index.js +9945 -5
- package/dist/index.js.map +1 -0
- package/dist/index.module.js +9546 -0
- package/dist/index.module.js.map +1 -0
- package/dist/styles/alignment.d.ts +13 -13
- package/dist/styles/animation.d.ts +10 -9
- package/dist/styles/background.d.ts +11 -11
- package/dist/styles/border.d.ts +39 -39
- package/dist/styles/display.d.ts +6 -5
- package/dist/styles/effects.d.ts +2 -2
- package/dist/styles/flex.d.ts +9 -9
- package/dist/styles/fragmentation.d.ts +6 -6
- package/dist/styles/grid.d.ts +28 -28
- package/dist/styles/icon.d.ts +4 -0
- package/dist/styles/image.d.ts +5 -5
- package/dist/styles/interactivity.d.ts +16 -16
- package/dist/styles/list.d.ts +5 -5
- package/dist/styles/overflow.d.ts +6 -6
- package/dist/styles/position.d.ts +10 -9
- package/dist/styles/size.d.ts +12 -13
- package/dist/styles/spacing.d.ts +16 -16
- package/dist/styles/svg.d.ts +5 -4
- package/dist/styles/table.d.ts +8 -8
- package/dist/styles/transform.d.ts +8 -8
- package/dist/styles/transition.d.ts +5 -5
- package/dist/styles/typings.d.ts +528 -20
- package/dist/styles/typography.d.ts +49 -49
- package/dist/theme/base.d.ts +4 -0
- package/dist/theme/tailwind.d.ts +5 -0
- package/dist/utils/color.d.ts +10 -7
- package/dist/utils/dom.d.ts +9 -0
- package/dist/utils/event.d.ts +2 -1
- package/dist/utils/formatter.d.ts +7 -7
- package/dist/utils/popper.d.ts +4 -4
- package/dist/utils/size.d.ts +3 -0
- package/dist/utils/style.d.ts +9 -7
- package/package.json +36 -24
- package/src/components/accordion/AccordionService.ts +36 -0
- package/src/components/accordion/components/AccordionComponent.tsx +37 -0
- package/src/components/accordion/components/AccordionContainer.tsx +11 -0
- package/src/components/accordion/components/AccordionPanel.tsx +74 -0
- package/src/components/accordion/components/AccordionPanelTitle.tsx +14 -0
- package/src/components/accordion/hooks/useAccordionPanel.ts +19 -0
- package/src/components/accordion/hooks/useAccordionService.ts +11 -0
- package/src/components/accordion/hooks/useAccordionState.ts +7 -0
- package/src/components/accordion/index.ts +23 -0
- package/src/components/accordion/style.ts +72 -0
- package/src/components/accordion/typings.ts +50 -0
- package/src/components/button/DropdownButton.tsx +9 -0
- package/src/components/button/SubmitButton.tsx +58 -0
- package/src/components/button/components/ButtonComponent.tsx +24 -0
- package/src/components/button/components/DropdownButtonComponent.tsx +82 -0
- package/src/components/button/index.tsx +1 -1
- package/src/components/button/style.ts +84 -8
- package/src/components/button/typings.ts +19 -2
- package/src/components/card/FormCard.tsx +24 -0
- package/src/components/card/components/CardComponent.tsx +83 -0
- package/src/components/card/components/CardTitle.tsx +14 -0
- package/src/components/card/index.tsx +9 -0
- package/src/components/card/style.ts +68 -0
- package/src/components/card/typings.ts +28 -0
- package/src/components/checkbox/FormCheckbox.tsx +26 -0
- package/src/components/checkbox/components/CheckboxComponent.tsx +42 -0
- package/src/components/checkbox/index.tsx +9 -0
- package/src/components/checkbox/style.ts +103 -0
- package/src/components/checkbox/typings.ts +18 -0
- package/src/components/dashboard/DashboardService.ts +412 -0
- package/src/components/dashboard/components/DashboardBody.tsx +138 -0
- package/src/components/dashboard/components/DashboardComponent.tsx +36 -0
- package/src/components/dashboard/components/DashboardContainer.tsx +64 -0
- package/src/components/dashboard/components/DashboardFooter.tsx +4 -0
- package/src/components/dashboard/components/DashboardHeader.tsx +4 -0
- package/src/components/dashboard/components/DashboardLeft.tsx +4 -0
- package/src/components/dashboard/components/DashboardOverlay.tsx +29 -0
- package/src/components/dashboard/components/DashboardRight.tsx +4 -0
- package/src/components/dashboard/components/DashboardToggler.tsx +17 -0
- package/src/components/dashboard/hoc/dashboardHorizontalPanel.tsx +145 -0
- package/src/components/dashboard/hoc/dashboardVerticalPanel.tsx +148 -0
- package/src/components/dashboard/hooks/useDashboard.tsx +21 -0
- package/src/components/dashboard/hooks/useDashboardService.ts +11 -0
- package/src/components/dashboard/hooks/useDashboardState.ts +11 -0
- package/src/components/dashboard/index.tsx +13 -0
- package/src/components/dashboard/typings.ts +124 -0
- package/src/components/dashboard/utils/dashboardArea.ts +27 -0
- package/src/components/dashboard/utils/dashboardLength.ts +42 -0
- package/src/components/dropdown/components/DropdownComponent.tsx +201 -23
- package/src/components/dropdown/hooks/useDropdown.tsx +21 -0
- package/src/components/dropdown/style.ts +10 -28
- package/src/components/dropdown/typings.ts +26 -4
- package/src/components/field/FieldDescription.tsx +9 -0
- package/src/components/field/FieldHelp.tsx +9 -0
- package/src/components/field/FieldLayout.tsx +9 -0
- package/src/components/field/components/FieldDescriptionComponent.tsx +14 -0
- package/src/components/field/components/FieldHelpComponent.tsx +22 -0
- package/src/components/field/components/FieldLayoutComponent.tsx +174 -0
- package/src/components/field/hooks/useFieldLayout.ts +36 -0
- package/src/components/field/style.ts +59 -0
- package/src/components/field/typings.ts +67 -0
- package/src/components/field/util.ts +47 -0
- package/src/components/grid/Col.tsx +33 -0
- package/src/components/grid/Row.tsx +35 -0
- package/src/components/grid/style.ts +93 -0
- package/src/components/grid/typings.ts +35 -0
- package/src/components/icon/CloseAllIcon.tsx +38 -0
- package/src/components/icon/CrossIcon.tsx +30 -0
- package/src/components/icon/FileIcon.tsx +36 -0
- package/src/components/icon/FolderIcon.tsx +36 -0
- package/src/components/icon/LoadingIcon.tsx +26 -23
- package/src/components/icon/MenuIcon.tsx +34 -0
- package/src/components/icon/RemoveIcon.tsx +36 -0
- package/src/components/icon/SearchIcon.tsx +38 -0
- package/src/components/icon/TogglerIcon.tsx +126 -0
- package/src/components/icon/typings.ts +15 -0
- package/src/components/input/FormInput.tsx +26 -0
- package/src/components/input/components/InputComponent.tsx +46 -0
- package/src/components/input/index.tsx +9 -0
- package/src/components/input/style.ts +85 -0
- package/src/components/input/typings.ts +17 -0
- package/src/components/label/components/LabelComponent.tsx +39 -0
- package/src/components/label/index.tsx +9 -0
- package/src/components/label/style.ts +64 -0
- package/src/components/label/typings.ts +17 -0
- package/src/components/list/components/ArrayListComponent.tsx +11 -0
- package/src/components/list/components/CollectionListComponent.tsx +77 -0
- package/src/components/list/components/ListBodyComponent.tsx +250 -0
- package/src/components/list/components/ListComponent.tsx +11 -25
- package/src/components/list/components/ListItemComponent.tsx +16 -4
- package/src/components/list/components/LoadingItem.tsx +24 -0
- package/src/components/list/components/StandardListComponent.tsx +23 -21
- package/src/components/list/components/VirtualListComponent.tsx +93 -110
- package/src/components/list/hooks/useListController.ts +19 -0
- package/src/components/list/hooks/useListService.ts +15 -0
- package/src/components/list/hooks/useListState.ts +10 -0
- package/src/components/list/hooks/useListView.tsx +103 -0
- package/src/components/list/typings.ts +162 -24
- package/src/components/list/utils.ts +17 -55
- package/src/components/modal/components/ModalComponent.tsx +132 -0
- package/src/components/modal/index.tsx +9 -0
- package/src/components/modal/style.ts +135 -0
- package/src/components/modal/typings.ts +20 -0
- package/src/components/properties/components/PropertiesComponent.tsx +44 -0
- package/src/components/properties/components/Property.tsx +40 -0
- package/src/components/properties/hooks/usePropertiesContext.ts +10 -0
- package/src/components/properties/index.tsx +9 -0
- package/src/components/properties/style.ts +17 -0
- package/src/components/properties/typings.ts +30 -0
- package/src/components/resizer/ResizerService.ts +96 -0
- package/src/components/resizer/components/ResizerComponent.tsx +28 -0
- package/src/components/resizer/components/ResizerHorizontalSplitter.tsx +38 -0
- package/src/components/resizer/components/ResizerVerticalSplitter.tsx +37 -0
- package/src/components/resizer/index.tsx +9 -0
- package/src/components/resizer/style.ts +51 -0
- package/src/components/resizer/typings.ts +40 -0
- package/src/components/select/FormSelect.tsx +26 -0
- package/src/components/select/SelectService.ts +9 -0
- package/src/components/select/components/ArraySelectComponent.tsx +11 -0
- package/src/components/select/components/ControllerSelectComponent.tsx +441 -0
- package/src/components/select/components/SelectComponent.tsx +13 -121
- package/src/components/select/components/SelectIconComponent.tsx +4 -4
- package/src/components/select/components/SelectInputComponent.tsx +220 -76
- package/src/components/select/components/SelectNotFoundComponent.tsx +14 -0
- package/src/components/select/components/SelectOptionComponent.tsx +54 -20
- package/src/components/select/components/SelectTokenComponent.tsx +25 -0
- package/src/components/select/components/SelectTokensComponent.tsx +50 -0
- package/src/components/select/hooks/useSelectConfig.ts +7 -0
- package/src/components/select/hooks/useSelectController.ts +21 -0
- package/src/components/select/index.tsx +0 -89
- package/src/components/select/style.ts +336 -47
- package/src/components/select/typings.ts +130 -24
- package/src/components/tab/TabsService.ts +192 -0
- package/src/components/tab/components/ControlledTabsComponent.tsx +18 -0
- package/src/components/tab/components/Tab.tsx +55 -0
- package/src/components/tab/components/TabTitle.tsx +18 -0
- package/src/components/tab/components/TabsComponent.tsx +15 -0
- package/src/components/tab/components/TabsContainer.tsx +36 -0
- package/src/components/tab/components/UncontrolledTabsComponent.tsx +13 -0
- package/src/components/tab/hooks/useTab.ts +18 -0
- package/src/components/tab/hooks/useTabsController.ts +15 -0
- package/src/components/tab/hooks/useTabsService.ts +11 -0
- package/src/components/tab/hooks/useTabsState.ts +7 -0
- package/src/components/tab/index.tsx +9 -0
- package/src/components/tab/style.ts +78 -0
- package/src/components/tab/typings.ts +59 -0
- package/src/components/table/FormTable.tsx +38 -0
- package/src/components/table/TableService.ts +123 -0
- package/src/components/table/columns/useCheckboxColumn.ts +24 -0
- package/src/components/table/columns/useColumn.ts +23 -0
- package/src/components/table/columns/useInputColumn.ts +24 -0
- package/src/components/table/columns/useLinkColumn.ts +19 -0
- package/src/components/table/columns/useSelectColumn.ts +26 -0
- package/src/components/table/components/ArrayTableComponent.tsx +14 -0
- package/src/components/table/components/ControllerTableComponent.tsx +167 -0
- package/src/components/table/components/FormTableComponent.tsx +143 -0
- package/src/components/table/components/TableBodyCellComponent.tsx +36 -0
- package/src/components/table/components/TableBodyComponent.tsx +96 -0
- package/src/components/table/components/TableBodyRowComponent.tsx +125 -0
- package/src/components/table/components/TableComponent.tsx +17 -0
- package/src/components/table/components/TableFooterCellComponent.tsx +28 -0
- package/src/components/table/components/TableFooterComponent.tsx +34 -0
- package/src/components/table/components/TableHeaderComponent.tsx +81 -0
- package/src/components/table/components/TableHeaderFilterComponent.tsx +31 -0
- package/src/components/table/components/TableHeaderTitleComponent.tsx +62 -0
- package/src/components/table/components/TableLoadingComponent.tsx +18 -0
- package/src/components/table/components/TableLoadingRowComponent.tsx +21 -0
- package/src/components/table/components/TableNotFoundComponent.tsx +14 -0
- package/src/components/table/components/TableSortComponent.tsx +29 -0
- package/src/components/table/components/cells/CheckboxCellComponent.tsx +42 -0
- package/src/components/table/components/cells/DefaultCellComponent.tsx +9 -0
- package/src/components/table/components/cells/ExpandedCellComponent.tsx +16 -0
- package/src/components/table/components/cells/InputCellComponent.tsx +27 -0
- package/src/components/table/components/cells/SelectCellComponent.tsx +41 -0
- package/src/components/table/components/filters/TableInputFilterComponent.tsx +134 -0
- package/src/components/table/components/hoc/linkCellComponent.tsx +15 -0
- package/src/components/table/hooks/useFormTableContext.ts +10 -0
- package/src/components/table/hooks/useTableColumns.ts +9 -0
- package/src/components/table/hooks/useTableConfig.ts +7 -0
- package/src/components/table/hooks/useTableController.ts +26 -0
- package/src/components/table/hooks/useTableInitialState.ts +22 -0
- package/src/components/table/hooks/useTableItems.ts +9 -0
- package/src/components/table/hooks/useTableService.ts +10 -0
- package/src/components/table/hooks/useTableState.ts +7 -0
- package/src/components/table/index.tsx +9 -0
- package/src/components/table/style.ts +248 -0
- package/src/components/table/typings.ts +322 -0
- package/src/components/table/util.ts +52 -0
- package/src/components/tag/components/TagComponent.tsx +15 -0
- package/src/components/tag/index.tsx +9 -0
- package/src/components/tag/style.ts +62 -0
- package/src/components/tag/typings.ts +17 -0
- package/src/components/tooltip/components/TooltipComponent.tsx +38 -0
- package/src/components/tooltip/index.tsx +9 -0
- package/src/components/tooltip/style.ts +153 -0
- package/src/components/tooltip/typings.ts +10 -0
- package/src/components/tree/TreeService.ts +392 -0
- package/src/components/tree/components/ArrayTreeComponent.tsx +14 -0
- package/src/components/tree/components/ControllerTreeComponent.tsx +72 -0
- package/src/components/tree/components/TreeBodyComponent.tsx +25 -0
- package/src/components/tree/components/TreeComponent.tsx +17 -0
- package/src/components/tree/components/TreeItemComponent.tsx +100 -0
- package/src/components/tree/components/TreeListComponent.tsx +198 -0
- package/src/components/tree/components/VirtualTreeBodyComponent.tsx +34 -0
- package/src/components/tree/components/VirtualTreeListComponent.tsx +287 -0
- package/src/components/tree/hooks/useTreeConfig.ts +7 -0
- package/src/components/tree/hooks/useTreeController.ts +33 -0
- package/src/components/tree/hooks/useTreeInitialState.ts +12 -0
- package/src/components/tree/hooks/useTreeItems.ts +9 -0
- package/src/components/tree/hooks/useTreeService.ts +10 -0
- package/src/components/tree/hooks/useTreeState.ts +7 -0
- package/src/components/tree/index.tsx +9 -0
- package/src/components/tree/style.ts +57 -0
- package/src/components/tree/typings.ts +126 -0
- package/src/components/wizard/WizardModal.ts +9 -0
- package/src/components/wizard/WizardService.ts +123 -0
- package/src/components/wizard/components/ControlledWizardComponent.tsx +22 -0
- package/src/components/wizard/components/Step.tsx +82 -0
- package/src/components/wizard/components/StepTitle.tsx +26 -0
- package/src/components/wizard/components/UncontrolledWizardComponent.tsx +13 -0
- package/src/components/wizard/components/WizardComponent.tsx +15 -0
- package/src/components/wizard/components/WizardContainer.tsx +134 -0
- package/src/components/wizard/components/WizardModalComponent.tsx +15 -0
- package/src/components/wizard/hooks/useStep.ts +18 -0
- package/src/components/wizard/hooks/useWizardController.ts +27 -0
- package/src/components/wizard/hooks/useWizardService.ts +11 -0
- package/src/components/wizard/hooks/useWizardState.ts +7 -0
- package/src/components/wizard/index.tsx +9 -0
- package/src/components/wizard/style.ts +159 -0
- package/src/components/wizard/typings.ts +53 -0
- package/src/fonts.d.ts +1 -0
- package/src/index.ts +269 -9
- package/src/styles/border.ts +8 -11
- package/src/styles/flex.ts +3 -3
- package/src/styles/icon.ts +14 -0
- package/src/styles/position.ts +13 -2
- package/src/styles/size.ts +19 -13
- package/src/styles/svg.ts +4 -3
- package/src/styles/typings.ts +587 -63
- package/src/theme/base.tsx +507 -0
- package/src/theme/tailwind.tsx +112 -0
- package/src/utils/color.ts +35 -1
- package/src/utils/dom.ts +32 -0
- package/src/utils/event.ts +25 -4
- package/src/utils/formatter.ts +7 -10
- package/src/utils/popper.ts +1 -1
- package/src/utils/size.ts +12 -0
- package/src/utils/style.ts +6 -9
- package/src/vendor/reactVirtual.d.ts +76 -0
- package/src/vendor/reactVirtual.js +463 -0
- package/src/vendor/useIsomorphicLayoutEffect.js +3 -0
- package/src/vendor/useRect.js +49 -0
- package/CHANGELOG.md +0 -136
- package/dist/__tests__/mocks/handlers.d.ts +0 -1
- package/dist/__tests__/mocks/responses.d.ts +0 -4
- package/dist/__tests__/mocks/server.d.ts +0 -7
- package/dist/__tests__/setup.d.ts +0 -1
- package/dist/__tests__/setupTests.d.ts +0 -1
- package/dist/__tests__/utils/timeout.d.ts +0 -4
- package/dist/components/button/component.d.ts +0 -4
- package/dist/components/select/components/SelectOptionsComponent.d.ts +0 -4
- package/dist/onekijs-ui.cjs.development.js +0 -2115
- package/dist/onekijs-ui.cjs.development.js.map +0 -1
- package/dist/onekijs-ui.cjs.production.min.js +0 -2
- package/dist/onekijs-ui.cjs.production.min.js.map +0 -1
- package/dist/onekijs-ui.esm.js +0 -1853
- package/dist/onekijs-ui.esm.js.map +0 -1
- package/dist/styles/theme.d.ts +0 -2
- package/jest.config.js +0 -188
- package/postcss.config.js +0 -3
- package/src/__tests__/mocks/handlers.ts +0 -60
- package/src/__tests__/mocks/responses.ts +0 -7
- package/src/__tests__/mocks/server.ts +0 -4
- package/src/__tests__/setup.ts +0 -1
- package/src/__tests__/setupTests.ts +0 -12
- package/src/__tests__/utils/timeout.ts +0 -27
- package/src/components/button/component.tsx +0 -8
- package/src/components/select/components/SelectOptionsComponent.tsx +0 -14
- package/src/styles/index.css +0 -5
- package/src/styles/tailwind.css +0 -86923
- package/src/styles/theme.ts +0 -274
- package/src/utils/query.ts.old +0 -148
- package/tailwind.config.js +0 -8
- package/tsconfig.json +0 -37
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnonymousObject,
|
|
3
|
+
DefaultService,
|
|
4
|
+
get,
|
|
5
|
+
isFalse,
|
|
6
|
+
isMobile,
|
|
7
|
+
isTrue,
|
|
8
|
+
reducer,
|
|
9
|
+
service,
|
|
10
|
+
set,
|
|
11
|
+
} from 'onekijs-framework';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { clearSelection, forceCursor, getTranslateXY } from '../../utils/dom';
|
|
14
|
+
import { ResizeStep } from '../resizer/typings';
|
|
15
|
+
import {
|
|
16
|
+
DashboardArea,
|
|
17
|
+
DashboardBodyPanel,
|
|
18
|
+
DashboardBodyPanelProps,
|
|
19
|
+
DashboardHorizontalArea,
|
|
20
|
+
DashboardHorizontalPanel,
|
|
21
|
+
DashboardHorizontalPanelProps,
|
|
22
|
+
DashboardSize,
|
|
23
|
+
DashboardState,
|
|
24
|
+
DashboardVerticalArea,
|
|
25
|
+
DashboardVerticalPanel,
|
|
26
|
+
DashboardVerticalPanelProps,
|
|
27
|
+
} from './typings';
|
|
28
|
+
import { isAreaInColumn, isAreaInRow } from './utils/dashboardArea';
|
|
29
|
+
import { getCollapseKey, getFloatingKey } from './utils/dashboardLength';
|
|
30
|
+
|
|
31
|
+
@service
|
|
32
|
+
export class DashboardService extends DefaultService<DashboardState> {
|
|
33
|
+
protected areas: DashboardArea[][] = [
|
|
34
|
+
['none', 'none', 'none'],
|
|
35
|
+
['none', 'none', 'none'],
|
|
36
|
+
['none', 'none', 'none'],
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
@reducer
|
|
40
|
+
collapse(area: DashboardArea | 'all', collapse = true): void {
|
|
41
|
+
if (area === 'all') {
|
|
42
|
+
['left', 'right', 'header', 'footer'].forEach((area) => {
|
|
43
|
+
set(this.state, `${area}.${this._getCollapseKey()}`, collapse);
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
set(this.state, `${area}.${this._getCollapseKey()}`, collapse);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@reducer
|
|
51
|
+
collapseFloating(): void {
|
|
52
|
+
['left', 'right', 'header', 'footer'].forEach((area) => {
|
|
53
|
+
const panel = this.state[area as 'left' | 'right' | 'header' | 'footer'];
|
|
54
|
+
if (panel && panel[this._getFloatingKey()]) {
|
|
55
|
+
panel[this._getCollapseKey()] = true;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@reducer
|
|
61
|
+
float(area: DashboardArea | 'all', float = true): void {
|
|
62
|
+
if (area === 'all') {
|
|
63
|
+
['left', 'right', 'header', 'footer'].forEach((area) => {
|
|
64
|
+
set(this.state, `${area}.${this._getFloatingKey()}`, float);
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
set(this.state, `${area}.${this._getFloatingKey()}`, float);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
getBodyPanel(): DashboardBodyPanel | undefined {
|
|
72
|
+
return this.state.body;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
getHorizontalPanel(area: 'footer' | 'header'): DashboardHorizontalPanel | undefined {
|
|
76
|
+
return this.state[area];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
getVerticalPanel(area: 'left' | 'right'): DashboardVerticalPanel | undefined {
|
|
80
|
+
return this.state[area];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@reducer
|
|
84
|
+
initBodyPanel(_props: DashboardBodyPanelProps, ref: React.RefObject<HTMLDivElement>): void {
|
|
85
|
+
this.areas[1][1] = 'body';
|
|
86
|
+
this.state.body = { ref };
|
|
87
|
+
this._compileAreas();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@reducer
|
|
91
|
+
initContainer(ref: React.RefObject<HTMLDivElement>): void {
|
|
92
|
+
this.state.container = { ref };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@reducer
|
|
96
|
+
initHorizontalPanel(
|
|
97
|
+
area: 'footer' | 'header',
|
|
98
|
+
props: DashboardHorizontalPanelProps,
|
|
99
|
+
ref: React.RefObject<HTMLDivElement>,
|
|
100
|
+
): void {
|
|
101
|
+
const dashboardPanel: DashboardHorizontalPanel = {
|
|
102
|
+
area,
|
|
103
|
+
className: props.className || '',
|
|
104
|
+
collapseHeight: props.collapseHeight ?? '50px',
|
|
105
|
+
collapseLarge: props.collapseLarge ?? props.collapse ?? false,
|
|
106
|
+
collapseMedium: props.collapseMedium ?? props.collapse ?? true,
|
|
107
|
+
collapseSmall: props.collapseSmall ?? props.collapse ?? true,
|
|
108
|
+
floatingLarge: props.floatingLarge ?? props.floating ?? false,
|
|
109
|
+
floatingMedium: props.floatingMedium ?? props.floating ?? false,
|
|
110
|
+
floatingSmall: props.floatingSmall ?? props.floating ?? true,
|
|
111
|
+
minHeight: props.minHeight ?? 0,
|
|
112
|
+
height: props.height ?? '70px',
|
|
113
|
+
maxHeight: props.maxHeight ?? 0,
|
|
114
|
+
ref,
|
|
115
|
+
resizable: props.resizable || false,
|
|
116
|
+
};
|
|
117
|
+
this.state[area] = dashboardPanel;
|
|
118
|
+
this._fillRow(area === 'header' ? 0 : 2, area);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@reducer
|
|
122
|
+
initVerticalPanel(
|
|
123
|
+
area: 'left' | 'right',
|
|
124
|
+
props: DashboardVerticalPanelProps,
|
|
125
|
+
ref: React.RefObject<HTMLDivElement>,
|
|
126
|
+
): void {
|
|
127
|
+
const dashboardPanel: DashboardVerticalPanel = {
|
|
128
|
+
area,
|
|
129
|
+
className: props.className || '',
|
|
130
|
+
collapseLarge: props.collapseLarge ?? props.collapse ?? false,
|
|
131
|
+
collapseMedium: props.collapseMedium ?? props.collapse ?? true,
|
|
132
|
+
collapseSmall: props.collapseSmall ?? props.collapse ?? true,
|
|
133
|
+
collapseWidth: props.collapseWidth ?? '50px',
|
|
134
|
+
floatingLarge: props.floatingLarge ?? props.floating ?? false,
|
|
135
|
+
floatingMedium: props.floatingMedium ?? props.floating ?? false,
|
|
136
|
+
floatingSmall: props.floatingSmall ?? props.floating ?? true,
|
|
137
|
+
minWidth: props.minWidth ?? 0,
|
|
138
|
+
maxWidth: props.maxWidth ?? 0,
|
|
139
|
+
width: props.width ?? '200px',
|
|
140
|
+
ref,
|
|
141
|
+
resizable: props.resizable || false,
|
|
142
|
+
};
|
|
143
|
+
this.state[area] = dashboardPanel;
|
|
144
|
+
this._fillColumn(area === 'left' ? 0 : 2, area);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@reducer
|
|
148
|
+
resizeHeight(area: DashboardHorizontalArea, nextHeight: number, step: ResizeStep): void {
|
|
149
|
+
const panel = this.state[area];
|
|
150
|
+
const left = this.state.left;
|
|
151
|
+
const right = this.state.right;
|
|
152
|
+
const body = this.state.body;
|
|
153
|
+
const header = this.state.header;
|
|
154
|
+
const footer = this.state.footer;
|
|
155
|
+
const elements: AnonymousObject<HTMLDivElement | undefined> = {};
|
|
156
|
+
elements['panel'] = panel !== undefined && panel.ref.current !== null ? panel.ref.current : undefined;
|
|
157
|
+
elements['body'] = body !== undefined && body.ref.current !== null ? body.ref.current : undefined;
|
|
158
|
+
// only touch the left panel if it's at the footer of the header panel or at the header of the footer panel
|
|
159
|
+
elements['left'] =
|
|
160
|
+
isAreaInColumn('first', area, this.state.areas) && left !== undefined && left.ref.current !== null
|
|
161
|
+
? left.ref.current
|
|
162
|
+
: undefined;
|
|
163
|
+
// only touch the right panel if it's at the footer of the header panel or at the header of the footer panel
|
|
164
|
+
elements['right'] =
|
|
165
|
+
isAreaInColumn('last', area, this.state.areas) && right !== undefined && right.ref.current !== null
|
|
166
|
+
? right.ref.current
|
|
167
|
+
: undefined;
|
|
168
|
+
|
|
169
|
+
elements['header'] = header !== undefined && header.ref.current !== null ? header.ref.current : undefined;
|
|
170
|
+
elements['footer'] = footer !== undefined && footer.ref.current !== null ? footer.ref.current : undefined;
|
|
171
|
+
|
|
172
|
+
switch (step) {
|
|
173
|
+
case 'start':
|
|
174
|
+
// deactivate transition animation during the resize
|
|
175
|
+
clearSelection();
|
|
176
|
+
forceCursor('n-resize');
|
|
177
|
+
['panel', 'body', 'left', 'right'].forEach((_area) => {
|
|
178
|
+
const el = elements[_area];
|
|
179
|
+
if (el) el.style.transition = 'none';
|
|
180
|
+
});
|
|
181
|
+
break;
|
|
182
|
+
case 'stop':
|
|
183
|
+
forceCursor(undefined);
|
|
184
|
+
// set the new height in the panel object. Will be used by styled to set the correct height via CSS
|
|
185
|
+
if (panel) panel.height = `${nextHeight}px`;
|
|
186
|
+
// remove any style added during the resize and let styled managed height and height via CSS
|
|
187
|
+
['panel', 'body', 'left', 'right'].forEach((_area) => {
|
|
188
|
+
const el = elements[_area];
|
|
189
|
+
if (el) {
|
|
190
|
+
['transition', 'height', 'transform'].forEach((k) => {
|
|
191
|
+
el.style[k as any] = '';
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
break;
|
|
196
|
+
case 'run':
|
|
197
|
+
if (elements['panel']) {
|
|
198
|
+
// force the new height via the style
|
|
199
|
+
elements['panel'].style.height = `${nextHeight}px`;
|
|
200
|
+
// if the resized panel is the footer one, we must translateX the panel in addition of changing the size
|
|
201
|
+
if (area === 'footer') {
|
|
202
|
+
const translate = getTranslateXY(elements['panel']);
|
|
203
|
+
elements['panel'].style.transform = `translate(${translate.x}px,-${nextHeight}px)`;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
(['left', 'right', 'body'] as DashboardArea[]).forEach((_area) => {
|
|
207
|
+
let height = '100%';
|
|
208
|
+
const el = elements[_area];
|
|
209
|
+
if (el) {
|
|
210
|
+
if (!isAreaInColumn('first', _area, this.state.areas) && header && elements['header']) {
|
|
211
|
+
// remove the header height
|
|
212
|
+
height = `${height} - ${header[this._getFloatingKey()] ? 0 : elements['header'].offsetHeight}px`;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (!isAreaInColumn('last', _area, this.state.areas) && footer && elements['footer']) {
|
|
216
|
+
// remove the header height
|
|
217
|
+
height = `${height} - ${footer[this._getFloatingKey()] ? 0 : elements['footer'].offsetHeight}px`;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
el.style.height = height === '100%' ? height : `calc(${height})`;
|
|
221
|
+
// If the resized panel is the header one, we must translateX non vertical panels in addition of changing the size
|
|
222
|
+
if (area === 'header') {
|
|
223
|
+
const translate = getTranslateXY(el);
|
|
224
|
+
el.style.transform = `translate(${translate.x}px,${nextHeight}px)`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@reducer
|
|
234
|
+
resizeWidth(area: DashboardVerticalArea, nextWidth: number, step: ResizeStep): void {
|
|
235
|
+
const panel = this.state[area];
|
|
236
|
+
const header = this.state.header;
|
|
237
|
+
const footer = this.state.footer;
|
|
238
|
+
const body = this.state.body;
|
|
239
|
+
const left = this.state.left;
|
|
240
|
+
const right = this.state.right;
|
|
241
|
+
const elements: AnonymousObject<HTMLDivElement | undefined> = {};
|
|
242
|
+
elements['panel'] = panel !== undefined && panel.ref.current !== null ? panel.ref.current : undefined;
|
|
243
|
+
elements['body'] = body !== undefined && body.ref.current !== null ? body.ref.current : undefined;
|
|
244
|
+
// only touch the header panel if it's at the right of the left panel or at the left of the right panel
|
|
245
|
+
elements['header'] =
|
|
246
|
+
isAreaInRow('first', area, this.state.areas) && header !== undefined && header.ref.current !== null
|
|
247
|
+
? header.ref.current
|
|
248
|
+
: undefined;
|
|
249
|
+
// only touch the footer panel if it's at the right of the left panel or at the left of the right panel
|
|
250
|
+
elements['footer'] =
|
|
251
|
+
isAreaInRow('last', area, this.state.areas) && footer !== undefined && footer.ref.current !== null
|
|
252
|
+
? footer.ref.current
|
|
253
|
+
: undefined;
|
|
254
|
+
|
|
255
|
+
elements['left'] = left !== undefined && left.ref.current !== null ? left.ref.current : undefined;
|
|
256
|
+
elements['right'] = right !== undefined && right.ref.current !== null ? right.ref.current : undefined;
|
|
257
|
+
|
|
258
|
+
switch (step) {
|
|
259
|
+
case 'start':
|
|
260
|
+
clearSelection();
|
|
261
|
+
forceCursor('e-resize');
|
|
262
|
+
// deactivate transition animation during the resize
|
|
263
|
+
['panel', 'body', 'header', 'footer'].forEach((_area) => {
|
|
264
|
+
const el = elements[_area];
|
|
265
|
+
if (el) el.style.transition = 'none';
|
|
266
|
+
});
|
|
267
|
+
break;
|
|
268
|
+
case 'stop':
|
|
269
|
+
forceCursor(undefined);
|
|
270
|
+
// set the new width in the panel object. Will be used by styled to set the correct width via CSS
|
|
271
|
+
if (panel) panel.width = `${nextWidth}px`;
|
|
272
|
+
// remove any style added during the resize and let styled managed width and height via CSS
|
|
273
|
+
['panel', 'body', 'header', 'footer'].forEach((_area) => {
|
|
274
|
+
const el = elements[_area];
|
|
275
|
+
if (el) {
|
|
276
|
+
['transition', 'width', 'transform'].forEach((k) => {
|
|
277
|
+
el.style[k as any] = '';
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
break;
|
|
282
|
+
case 'run':
|
|
283
|
+
if (elements['panel']) {
|
|
284
|
+
// force the new width via the style
|
|
285
|
+
elements['panel'].style.width = `${nextWidth}px`;
|
|
286
|
+
// if the resized panel is the right one, we must translateX the panel in addition of changing the size
|
|
287
|
+
if (area === 'right') {
|
|
288
|
+
const translate = getTranslateXY(elements['panel']);
|
|
289
|
+
elements['panel'].style.transform = `translate(-${nextWidth}px,${translate.y}px)`;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
(['header', 'footer', 'body'] as DashboardArea[]).forEach((_area) => {
|
|
293
|
+
let width = '100%';
|
|
294
|
+
const el = elements[_area];
|
|
295
|
+
if (el) {
|
|
296
|
+
if (!isAreaInColumn('first', _area, this.state.areas) && left && elements['left']) {
|
|
297
|
+
// remove the left width
|
|
298
|
+
width = `${width} - ${left[this._getFloatingKey()] ? 0 : elements['left'].offsetWidth}px`;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (!isAreaInColumn('last', _area, this.state.areas) && right && elements['right']) {
|
|
302
|
+
// remove the left width
|
|
303
|
+
width = `${width} - ${right[this._getFloatingKey()] ? 0 : elements['right'].offsetWidth}px`;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
el.style.width = width === '100%' ? width : `calc(${width})`;
|
|
307
|
+
// If the resized panel is the left one, we must translateX non vertical panels in addition of changing the size
|
|
308
|
+
if (area === 'left') {
|
|
309
|
+
const translate = getTranslateXY(el);
|
|
310
|
+
el.style.transform = `translate(${nextWidth}px,${translate.y}px)`;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
showOverlay(): boolean {
|
|
320
|
+
let result = false;
|
|
321
|
+
const areas: ('right' | 'left' | 'header' | 'footer')[] = ['right', 'left', 'header', 'footer'];
|
|
322
|
+
areas.forEach((area) => {
|
|
323
|
+
if (
|
|
324
|
+
isTrue(get(this.state[area], this._getFloatingKey())) &&
|
|
325
|
+
isFalse(get(this.state[area], this._getCollapseKey()))
|
|
326
|
+
) {
|
|
327
|
+
result = true;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
return result;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
@reducer
|
|
334
|
+
toggle(area: DashboardArea | 'all'): void {
|
|
335
|
+
const areas: DashboardArea[] = area === 'all' ? ['left', 'right', 'header', 'footer'] : [area];
|
|
336
|
+
areas.forEach((area) => {
|
|
337
|
+
const collapse: boolean = get(this.state, `${area}.${this._getCollapseKey()}`, false);
|
|
338
|
+
set(this.state, `${area}.${this._getCollapseKey()}`, !collapse);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
@reducer
|
|
343
|
+
_compileAreas(): void {
|
|
344
|
+
const clone = (items: any) => items.map((item: any) => (Array.isArray(item) ? clone(item) : item));
|
|
345
|
+
const dashboardAreas: DashboardArea[][] = clone(this.areas);
|
|
346
|
+
|
|
347
|
+
if (!this.state.right) {
|
|
348
|
+
// drop last column
|
|
349
|
+
[0, 1, 2].forEach((i) => dashboardAreas[i].splice(2, 1));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (!this.state.left) {
|
|
353
|
+
// drop first column
|
|
354
|
+
[0, 1, 2].forEach((i) => dashboardAreas[i].splice(0, 1));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (!this.state.footer) {
|
|
358
|
+
dashboardAreas.splice(2, 1);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (!this.state.header) {
|
|
362
|
+
dashboardAreas.splice(0, 1);
|
|
363
|
+
}
|
|
364
|
+
this.state.areas = dashboardAreas;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// When a "column" area component is found as a child of the dashboard component, it tries to take the maximum of space
|
|
368
|
+
// If the left component is found first, it will take the thre areas of the first column
|
|
369
|
+
// If the left component if found after the header component, it will only take the second and third cell of the first column
|
|
370
|
+
@reducer
|
|
371
|
+
_fillColumn(colIndex: number, area: DashboardVerticalArea): void {
|
|
372
|
+
const areas = this.areas;
|
|
373
|
+
areas.forEach((row, rowIndex) => {
|
|
374
|
+
if (row[colIndex] === 'none') {
|
|
375
|
+
areas[rowIndex][colIndex] = area;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
this._compileAreas();
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
_getCollapseKey(): 'collapseSmall' | 'collapseMedium' | 'collapseLarge' {
|
|
382
|
+
return getCollapseKey(this._getSize());
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
_getFloatingKey(): 'floatingSmall' | 'floatingMedium' | 'floatingLarge' {
|
|
386
|
+
return getFloatingKey(this._getSize());
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
_getSize(): DashboardSize {
|
|
390
|
+
if (!this.state.container || !this.state.container.ref.current) {
|
|
391
|
+
return isMobile() ? 'small' : 'large';
|
|
392
|
+
}
|
|
393
|
+
const dashboardWidth = this.state.container.ref.current.offsetWidth;
|
|
394
|
+
if (dashboardWidth < 768) return 'small';
|
|
395
|
+
if (dashboardWidth < 992) return 'medium';
|
|
396
|
+
return 'large';
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// When a "row" area component is found as a child of the dashboard component, it tries to take the maximum of space
|
|
400
|
+
// If the header component is found first, it will take the thre areas of the first row
|
|
401
|
+
// If the header component if found after the left component, it will only take the second and third cell of the first row
|
|
402
|
+
@reducer
|
|
403
|
+
_fillRow(rowIndex: number, area: DashboardHorizontalArea): void {
|
|
404
|
+
const areas = this.areas;
|
|
405
|
+
areas[rowIndex].forEach((cell, colIndex) => {
|
|
406
|
+
if (cell === 'none') {
|
|
407
|
+
areas[rowIndex][colIndex] = area;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
this._compileAreas();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { FCC } from 'onekijs-framework';
|
|
2
|
+
import React, { CSSProperties, useEffect, useRef } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { backgroundColor } from '../../../styles/background';
|
|
5
|
+
import { ComponentStyle } from '../../../styles/typings';
|
|
6
|
+
import useDashboardService from '../hooks/useDashboardService';
|
|
7
|
+
import useDashboardState from '../hooks/useDashboardState';
|
|
8
|
+
import { DashboardBodyComponentProps, DashboardBodyPanelProps, DashboardSize } from '../typings';
|
|
9
|
+
import { getDashboardPanelLength, getFloatingKey, getWorkspacePanelLength } from '../utils/dashboardLength';
|
|
10
|
+
|
|
11
|
+
const DashboardBodyComponent: FCC<DashboardBodyComponentProps> = (props) => {
|
|
12
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
13
|
+
const service = useDashboardService();
|
|
14
|
+
const stepRef = useRef<'initializing' | 'initialized' | undefined>();
|
|
15
|
+
const style: CSSProperties = {};
|
|
16
|
+
if (stepRef.current !== 'initialized') {
|
|
17
|
+
style.transition = 'none';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (stepRef.current === undefined) {
|
|
22
|
+
stepRef.current = 'initializing';
|
|
23
|
+
service.initBodyPanel(props, ref);
|
|
24
|
+
} else if (stepRef.current === 'initializing' && ref.current) {
|
|
25
|
+
stepRef.current = 'initialized';
|
|
26
|
+
ref.current.style.transition = '';
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className={props.className} ref={ref} style={style}>
|
|
32
|
+
{stepRef.current && props.children}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const getBodyLength = (
|
|
38
|
+
type: 'width' | 'height',
|
|
39
|
+
size: DashboardSize,
|
|
40
|
+
props: DashboardBodyComponentProps,
|
|
41
|
+
): string => {
|
|
42
|
+
let result = '100%';
|
|
43
|
+
|
|
44
|
+
const front = type === 'width' ? props.left : props.header;
|
|
45
|
+
const back = type === 'width' ? props.right : props.footer;
|
|
46
|
+
|
|
47
|
+
const frontLength = getWorkspacePanelLength(type, size, front);
|
|
48
|
+
if (frontLength !== 0) {
|
|
49
|
+
result = `${result} - ${frontLength}`;
|
|
50
|
+
}
|
|
51
|
+
const backLength = getWorkspacePanelLength(type, size, back);
|
|
52
|
+
if (backLength !== 0) {
|
|
53
|
+
result = `${result} - ${backLength}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return result === '100%' ? result : `calc(${result})`;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// const getTranslate = (axis: 'x' | 'y', size: DashboardSize, props: DashboardBodyComponentProps): string | 0 => {
|
|
60
|
+
// let translate: string | 0 = 0;
|
|
61
|
+
// const panel = axis === 'x' ? props.left : props.header;
|
|
62
|
+
// const panelCollapseLength =
|
|
63
|
+
// axis === 'x'
|
|
64
|
+
// ? (panel as DashboardVerticalPanel)?.collapseWidth
|
|
65
|
+
// : (panel as DashboardHorizontalPanel)?.collapseHeight;
|
|
66
|
+
|
|
67
|
+
// const panelLength =
|
|
68
|
+
// axis === 'x' ? (panel as DashboardVerticalPanel)?.width : (panel as DashboardHorizontalPanel)?.height;
|
|
69
|
+
|
|
70
|
+
// if (size === 'small') {
|
|
71
|
+
// if (panel && !panel.floating && panelCollapseLength !== 0) {
|
|
72
|
+
// translate = panelCollapseLength;
|
|
73
|
+
// }
|
|
74
|
+
// } else if (panel && !panel.floating) {
|
|
75
|
+
// translate = panel.collapse ? panelCollapseLength : panelLength;
|
|
76
|
+
// }
|
|
77
|
+
// return translate;
|
|
78
|
+
// };
|
|
79
|
+
|
|
80
|
+
const getTranslateX = (size: DashboardSize, props: DashboardBodyComponentProps): string | 0 => {
|
|
81
|
+
const panel = props.left;
|
|
82
|
+
if (panel) {
|
|
83
|
+
return panel[getFloatingKey(size)]
|
|
84
|
+
? getDashboardPanelLength('width', size, panel) // actual size of the panel
|
|
85
|
+
: getWorkspacePanelLength('width', size, panel); // size of the panel on the workspace (if floating, the workspace panel size is 0)
|
|
86
|
+
}
|
|
87
|
+
return 0;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const getTranslateY = (size: DashboardSize, props: DashboardBodyComponentProps): string | 0 => {
|
|
91
|
+
const panel = props.header;
|
|
92
|
+
if (panel) {
|
|
93
|
+
return panel[getFloatingKey(size)]
|
|
94
|
+
? getDashboardPanelLength('height', size, panel) // actual size of the panel
|
|
95
|
+
: getWorkspacePanelLength('height', size, panel); // size of the panel on the workspace (if floating, the workspace panel size is 0)
|
|
96
|
+
}
|
|
97
|
+
return 0;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const style: ComponentStyle<DashboardBodyComponentProps> = (props) => {
|
|
101
|
+
const t = props.theme.dashboard.body;
|
|
102
|
+
return css`
|
|
103
|
+
${backgroundColor(t.bgColor)}
|
|
104
|
+
grid-area: body;
|
|
105
|
+
width: ${() => getBodyLength('width', 'small', props)};
|
|
106
|
+
height: ${() => getBodyLength('height', 'small', props)};
|
|
107
|
+
overflow: auto;
|
|
108
|
+
transition: ${() => (props.panel ? 'transform 0.6s, width 0.6s, height 0.6s' : 'none')};
|
|
109
|
+
transform: translate(${() => getTranslateX('small', props)}, ${() => getTranslateY('small', props)});
|
|
110
|
+
@media only screen and (min-width: 768px) {
|
|
111
|
+
width: ${() => getBodyLength('width', 'medium', props)};
|
|
112
|
+
height: ${() => getBodyLength('height', 'medium', props)};
|
|
113
|
+
transform: translate(${() => getTranslateX('medium', props)}, ${() => getTranslateY('medium', props)});
|
|
114
|
+
}
|
|
115
|
+
@media only screen and (min-width: 992px) {
|
|
116
|
+
width: ${() => getBodyLength('width', 'large', props)};
|
|
117
|
+
height: ${() => getBodyLength('height', 'large', props)};
|
|
118
|
+
transform: translate(${() => getTranslateX('large', props)}, ${() => getTranslateY('large', props)});
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const StyledDashboardBody = styled(DashboardBodyComponent)`
|
|
124
|
+
${style}
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
const DashboardBody: FCC<DashboardBodyPanelProps> = (props) => {
|
|
128
|
+
const state = useDashboardState();
|
|
129
|
+
|
|
130
|
+
const panel = state.body;
|
|
131
|
+
return (
|
|
132
|
+
<StyledDashboardBody {...state} panel={panel} className={props.className}>
|
|
133
|
+
{props.children}
|
|
134
|
+
</StyledDashboardBody>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default DashboardBody;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FCC } from 'onekijs-framework';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DashboardService } from '../DashboardService';
|
|
4
|
+
import { DashboardServiceContext } from '../hooks/useDashboardService';
|
|
5
|
+
import { DashboardStateContext } from '../hooks/useDashboardState';
|
|
6
|
+
import { DashboardProps } from '../typings';
|
|
7
|
+
import DashboardContainer from './DashboardContainer';
|
|
8
|
+
import DashboardOverlay from './DashboardOverlay';
|
|
9
|
+
|
|
10
|
+
const DashboardComponent: FCC<DashboardProps & { service: DashboardService }> = ({
|
|
11
|
+
ContainerComponent = DashboardContainer,
|
|
12
|
+
OverlayComponent = DashboardOverlay,
|
|
13
|
+
children,
|
|
14
|
+
service,
|
|
15
|
+
}) => {
|
|
16
|
+
return (
|
|
17
|
+
<DashboardServiceContext.Provider value={service}>
|
|
18
|
+
<DashboardStateContext.Provider value={service.state}>
|
|
19
|
+
<ContainerComponent
|
|
20
|
+
areas={service.state.areas}
|
|
21
|
+
header={service.state.header}
|
|
22
|
+
footer={service.state.footer}
|
|
23
|
+
left={service.state.left}
|
|
24
|
+
right={service.state.right}
|
|
25
|
+
body={service.state.body}
|
|
26
|
+
onInit={(ref) => service.initContainer(ref)}
|
|
27
|
+
>
|
|
28
|
+
<OverlayComponent show={service.showOverlay()} onClick={() => service.collapseFloating()} />
|
|
29
|
+
{children}
|
|
30
|
+
</ContainerComponent>
|
|
31
|
+
</DashboardStateContext.Provider>
|
|
32
|
+
</DashboardServiceContext.Provider>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default DashboardComponent;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FCC } from 'onekijs-framework';
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { DashboardContainerProps } from '../typings';
|
|
5
|
+
|
|
6
|
+
export const getDashboardTemplate = (dashboardContainerProps: DashboardContainerProps): string => {
|
|
7
|
+
const { areas, left, right, header, footer } = dashboardContainerProps;
|
|
8
|
+
if (!areas) {
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
11
|
+
const clone = (items: any) => items.map((item: any) => (Array.isArray(item) ? clone(item) : item));
|
|
12
|
+
const rows: (0 | string)[] = [0, '1fr', 0];
|
|
13
|
+
const cols: (0 | string)[] = [0, '1fr', 0];
|
|
14
|
+
|
|
15
|
+
if (!right) {
|
|
16
|
+
// drop last column
|
|
17
|
+
cols.splice(2, 1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!left) {
|
|
21
|
+
// drop first column
|
|
22
|
+
cols.splice(0, 1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!footer) {
|
|
26
|
+
rows.splice(2, 1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!header) {
|
|
30
|
+
rows.splice(0, 1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return `
|
|
34
|
+
grid-template-columns: ${cols.join(' ')};
|
|
35
|
+
grid-template-rows: ${rows.join(' ')};
|
|
36
|
+
grid-template-areas: "${areas.map((row) => row.join(' ')).join('" "')}";
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const DashboardContainerComponent: FCC<DashboardContainerProps> = (props) => {
|
|
41
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
props.onInit(ref);
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className={props.className} ref={ref}>
|
|
49
|
+
{props.children}
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const DashboardContainer = styled(DashboardContainerComponent)`
|
|
55
|
+
display: grid;
|
|
56
|
+
${(props) => getDashboardTemplate(props)}
|
|
57
|
+
height: 100vh;
|
|
58
|
+
padding: 0;
|
|
59
|
+
margin: 0;
|
|
60
|
+
overflow-x: hidden;
|
|
61
|
+
overflow-y: hidden;
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
export default DashboardContainer;
|